An AI-powered tool that generates human-readable summaries of git changes using tool calling with a self-hosted LLM
1package llm
2
3// Tools defines the available tools for the LLM
4var Tools = []Tool{
5 {
6 Type: "function",
7 Function: FunctionDef{
8 Name: "git_log",
9 Description: "Get commit log between two refs with commit messages",
10 Parameters: Parameters{
11 Type: "object",
12 Properties: map[string]Property{
13 "base": {Type: "string", Description: "Base ref (e.g. main, v1.0.0, HEAD~10)"},
14 "head": {Type: "string", Description: "Head ref (e.g. HEAD, feature-branch)"},
15 "max_count": {Type: "integer", Description: "Max commits to return (default 50)"},
16 },
17 Required: []string{"base", "head"},
18 },
19 },
20 },
21 {
22 Type: "function",
23 Function: FunctionDef{
24 Name: "git_diff",
25 Description: "Get the diff between two refs. Can optionally filter to specific files.",
26 Parameters: Parameters{
27 Type: "object",
28 Properties: map[string]Property{
29 "base": {Type: "string", Description: "Base ref"},
30 "head": {Type: "string", Description: "Head ref"},
31 "files": {Type: "array", Description: "Optional list of files to diff", Items: &Items{Type: "string"}},
32 },
33 Required: []string{"base", "head"},
34 },
35 },
36 },
37 {
38 Type: "function",
39 Function: FunctionDef{
40 Name: "list_changed_files",
41 Description: "List all files changed between two refs with their status (added/modified/deleted)",
42 Parameters: Parameters{
43 Type: "object",
44 Properties: map[string]Property{
45 "base": {Type: "string", Description: "Base ref"},
46 "head": {Type: "string", Description: "Head ref"},
47 },
48 Required: []string{"base", "head"},
49 },
50 },
51 },
52 {
53 Type: "function",
54 Function: FunctionDef{
55 Name: "git_show_commit",
56 Description: "Show details of a specific commit including message and stats",
57 Parameters: Parameters{
58 Type: "object",
59 Properties: map[string]Property{
60 "ref": {Type: "string", Description: "Commit ref (hash, tag, branch)"},
61 },
62 Required: []string{"ref"},
63 },
64 },
65 },
66 {
67 Type: "function",
68 Function: FunctionDef{
69 Name: "read_file",
70 Description: "Read contents of a file at a specific ref",
71 Parameters: Parameters{
72 Type: "object",
73 Properties: map[string]Property{
74 "path": {Type: "string", Description: "File path relative to repo root"},
75 "ref": {Type: "string", Description: "Git ref (default HEAD)"},
76 },
77 Required: []string{"path"},
78 },
79 },
80 },
81 {
82 Type: "function",
83 Function: FunctionDef{
84 Name: "git_diff_stats",
85 Description: "Get diff statistics (files changed, insertions, deletions) between two refs",
86 Parameters: Parameters{
87 Type: "object",
88 Properties: map[string]Property{
89 "base": {Type: "string", Description: "Base ref"},
90 "head": {Type: "string", Description: "Head ref"},
91 },
92 Required: []string{"base", "head"},
93 },
94 },
95 },
96}