Usage

The 8 examples below are taken from zig-changelog's README.

.dependencies = .{
    .changelog = .{
        .url = "https://github.com/yourusername/zig-changelog/archive/main.tar.gz",
        .hash = "...",
    },
},
const std = @import("std");
const changelog = @import("changelog");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();
    const allocator = gpa.allocator();

    const config = changelog.Config{
        .from_ref = "v1.0.0",
        .to_ref = "HEAD",
        .verbose = true,
    };

    var result = try changelog.generateChangelog(allocator, ".", &config);
    defer result.deinit(allocator);

    std.debug.print("{s}\n", .{result.content});
}
pub const Config = struct {
    from_ref: ?[]const u8 = null,        // Start commit reference
    to_ref: []const u8 = "HEAD",         // End commit reference
    output_file: ?[]const u8 = null,     // Output file path
    verbose: bool = false,                // Enable verbose logging
    hide_author_email: bool = false,      // Hide author emails
    exclude_authors: []const []const u8 = &[_][]const u8{}, // Authors to exclude
    include_dates: bool = true,           // Include dates in output
    group_breaking_changes: bool = true,  // Group breaking changes
    repo_url: ?[]const u8 = null,        // Repository URL for links
};
pub const Commit = struct {
    hash: []const u8,
    short_hash: []const u8,
    author_name: []const u8,
    author_email: []const u8,
    date: []const u8,
    message: []const u8,
    commit_type: CommitType,
    scope: ?[]const u8,
    description: []const u8,
    breaking: bool,
    body: ?[]const u8,
};
pub const CommitType = enum {
    feat,
    fix,
    docs,
    style,
    refactor,
    perf,
    test,
    build,
    ci,
    chore,
    revert,
    unknown,
};
pub fn generateChangelog(
    allocator: std.mem.Allocator,
    dir: []const u8,
    config: *const Config,
) !ChangelogResult
pub fn isGitRepository(
    allocator: std.mem.Allocator,
    dir: []const u8,
) !bool
pub fn getLatestTag(
    allocator: std.mem.Allocator,
    dir: []const u8,
) !?[]const u8