@ksw8954/git-ai-commit 1.0.12 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/Makefile +50 -1
- package/dist/commands/completion.d.ts +10 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +250 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts/tag.d.ts.map +1 -1
- package/dist/prompts/tag.js +48 -21
- package/dist/prompts/tag.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/completion.ts +251 -0
- package/src/index.ts +3 -0
- package/src/prompts/tag.ts +50 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 - 2026-01-06
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
- Add `completion` command for bash/zsh shell auto-completion
|
|
7
|
+
- Add `make install-completion` and `make uninstall-completion` targets
|
|
8
|
+
|
|
9
|
+
### Improvements
|
|
10
|
+
- Change tag message format to GitHub Release style (title + categorized notes)
|
|
11
|
+
|
|
3
12
|
## 1.0.11 - 2025-12-29
|
|
4
13
|
- Default to `max_completion_tokens` and retry with `max_tokens` if unsupported.
|
|
5
14
|
- Remove `temperature` from API requests to rely on model defaults.
|
package/Makefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: install build dev lint test typecheck clean uninstall link unlink version publish install-package
|
|
1
|
+
.PHONY: install build dev lint test typecheck clean uninstall link unlink version publish install-package install-completion uninstall-completion
|
|
2
2
|
|
|
3
3
|
install: ## Install dependencies and build the project
|
|
4
4
|
npm install
|
|
@@ -42,3 +42,52 @@ publish: build ## Publish the package to npm (ensure you're logged in)
|
|
|
42
42
|
|
|
43
43
|
install-package: ## Install this package globally via npm
|
|
44
44
|
npm i -g @ksw8954/git-ai-commit
|
|
45
|
+
|
|
46
|
+
install-completion: ## Install shell completion for current shell (bash/zsh)
|
|
47
|
+
@CURRENT_SHELL=$$(basename "$$SHELL"); \
|
|
48
|
+
if [ "$$CURRENT_SHELL" = "zsh" ]; then \
|
|
49
|
+
RCFILE="$$HOME/.zshrc"; \
|
|
50
|
+
COMPLETION_LINE='eval "$$(git-ai-commit completion zsh)"'; \
|
|
51
|
+
elif [ "$$CURRENT_SHELL" = "bash" ]; then \
|
|
52
|
+
if [ -f "$$HOME/.bash_profile" ]; then \
|
|
53
|
+
RCFILE="$$HOME/.bash_profile"; \
|
|
54
|
+
else \
|
|
55
|
+
RCFILE="$$HOME/.bashrc"; \
|
|
56
|
+
fi; \
|
|
57
|
+
COMPLETION_LINE='eval "$$(git-ai-commit completion bash)"'; \
|
|
58
|
+
else \
|
|
59
|
+
echo "Unsupported shell: $$CURRENT_SHELL (only bash and zsh are supported)"; \
|
|
60
|
+
exit 1; \
|
|
61
|
+
fi; \
|
|
62
|
+
if grep -q "git-ai-commit completion" "$$RCFILE" 2>/dev/null; then \
|
|
63
|
+
echo "Completion already installed in $$RCFILE"; \
|
|
64
|
+
else \
|
|
65
|
+
echo "" >> "$$RCFILE"; \
|
|
66
|
+
echo "# git-ai-commit shell completion" >> "$$RCFILE"; \
|
|
67
|
+
echo "$$COMPLETION_LINE" >> "$$RCFILE"; \
|
|
68
|
+
echo "Completion installed in $$RCFILE"; \
|
|
69
|
+
echo "Run 'source $$RCFILE' or restart your shell to enable"; \
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
uninstall-completion: ## Remove shell completion from current shell config
|
|
73
|
+
@CURRENT_SHELL=$$(basename "$$SHELL"); \
|
|
74
|
+
if [ "$$CURRENT_SHELL" = "zsh" ]; then \
|
|
75
|
+
RCFILE="$$HOME/.zshrc"; \
|
|
76
|
+
elif [ "$$CURRENT_SHELL" = "bash" ]; then \
|
|
77
|
+
if [ -f "$$HOME/.bash_profile" ]; then \
|
|
78
|
+
RCFILE="$$HOME/.bash_profile"; \
|
|
79
|
+
else \
|
|
80
|
+
RCFILE="$$HOME/.bashrc"; \
|
|
81
|
+
fi; \
|
|
82
|
+
else \
|
|
83
|
+
echo "Unsupported shell: $$CURRENT_SHELL"; \
|
|
84
|
+
exit 1; \
|
|
85
|
+
fi; \
|
|
86
|
+
if grep -q "git-ai-commit completion" "$$RCFILE" 2>/dev/null; then \
|
|
87
|
+
sed -i.bak '/# git-ai-commit shell completion/d' "$$RCFILE"; \
|
|
88
|
+
sed -i.bak '/git-ai-commit completion/d' "$$RCFILE"; \
|
|
89
|
+
rm -f "$$RCFILE.bak"; \
|
|
90
|
+
echo "Completion removed from $$RCFILE"; \
|
|
91
|
+
else \
|
|
92
|
+
echo "No completion found in $$RCFILE"; \
|
|
93
|
+
fi
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare class CompletionCommand {
|
|
3
|
+
private program;
|
|
4
|
+
constructor();
|
|
5
|
+
private handleCompletion;
|
|
6
|
+
private generateBashCompletion;
|
|
7
|
+
private generateZshCompletion;
|
|
8
|
+
getCommand(): Command;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAU;;IASzB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,sBAAsB;IAsG9B,OAAO,CAAC,qBAAqB;IAuH7B,UAAU,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompletionCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
class CompletionCommand {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.program = new commander_1.Command('completion')
|
|
8
|
+
.description('Generate shell completion scripts')
|
|
9
|
+
.argument('<shell>', 'Shell type (bash or zsh)')
|
|
10
|
+
.action(this.handleCompletion.bind(this));
|
|
11
|
+
}
|
|
12
|
+
handleCompletion(shell) {
|
|
13
|
+
const normalized = shell.toLowerCase().trim();
|
|
14
|
+
if (normalized === 'bash') {
|
|
15
|
+
console.log(this.generateBashCompletion());
|
|
16
|
+
}
|
|
17
|
+
else if (normalized === 'zsh') {
|
|
18
|
+
console.log(this.generateZshCompletion());
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.error(`Unsupported shell: ${shell}`);
|
|
22
|
+
console.error('Supported shells: bash, zsh');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
generateBashCompletion() {
|
|
27
|
+
return `# git-ai-commit bash completion
|
|
28
|
+
# Add to ~/.bashrc or ~/.bash_profile:
|
|
29
|
+
# eval "$(git-ai-commit completion bash)"
|
|
30
|
+
|
|
31
|
+
_git_ai_commit() {
|
|
32
|
+
local cur prev words cword
|
|
33
|
+
_init_completion || return
|
|
34
|
+
|
|
35
|
+
local commands="commit config pr tag history completion"
|
|
36
|
+
|
|
37
|
+
# Global options
|
|
38
|
+
local global_opts="-v --version -h --help"
|
|
39
|
+
|
|
40
|
+
# Command-specific options
|
|
41
|
+
local commit_opts="-k --api-key -b --base-url --model -m --message-only -p --push --prompt --no-verify"
|
|
42
|
+
local config_opts="-s --show -l --language --auto-push --no-auto-push -k --api-key -b --base-url -m --model --mode"
|
|
43
|
+
local pr_opts="--base --compare -k --api-key -b --base-url --model"
|
|
44
|
+
local tag_opts="-k --api-key --base-url -m --model --message -t --base-tag --prompt"
|
|
45
|
+
local history_opts="-l --limit --json --clear"
|
|
46
|
+
local completion_opts=""
|
|
47
|
+
|
|
48
|
+
case "\${cword}" in
|
|
49
|
+
1)
|
|
50
|
+
COMPREPLY=( \$(compgen -W "\${commands} \${global_opts}" -- "\${cur}") )
|
|
51
|
+
return
|
|
52
|
+
;;
|
|
53
|
+
esac
|
|
54
|
+
|
|
55
|
+
local cmd="\${words[1]}"
|
|
56
|
+
|
|
57
|
+
case "\${cmd}" in
|
|
58
|
+
commit)
|
|
59
|
+
case "\${prev}" in
|
|
60
|
+
-k|--api-key|-b|--base-url|--model|--prompt)
|
|
61
|
+
return
|
|
62
|
+
;;
|
|
63
|
+
esac
|
|
64
|
+
COMPREPLY=( \$(compgen -W "\${commit_opts}" -- "\${cur}") )
|
|
65
|
+
;;
|
|
66
|
+
config)
|
|
67
|
+
case "\${prev}" in
|
|
68
|
+
-l|--language)
|
|
69
|
+
COMPREPLY=( \$(compgen -W "ko en" -- "\${cur}") )
|
|
70
|
+
return
|
|
71
|
+
;;
|
|
72
|
+
--mode)
|
|
73
|
+
COMPREPLY=( \$(compgen -W "custom openai" -- "\${cur}") )
|
|
74
|
+
return
|
|
75
|
+
;;
|
|
76
|
+
-k|--api-key|-b|--base-url|-m|--model)
|
|
77
|
+
return
|
|
78
|
+
;;
|
|
79
|
+
esac
|
|
80
|
+
COMPREPLY=( \$(compgen -W "\${config_opts}" -- "\${cur}") )
|
|
81
|
+
;;
|
|
82
|
+
pr)
|
|
83
|
+
case "\${prev}" in
|
|
84
|
+
--base|--compare)
|
|
85
|
+
# Complete with git branches
|
|
86
|
+
local branches=\$(git branch --format='%(refname:short)' 2>/dev/null)
|
|
87
|
+
COMPREPLY=( \$(compgen -W "\${branches}" -- "\${cur}") )
|
|
88
|
+
return
|
|
89
|
+
;;
|
|
90
|
+
-k|--api-key|-b|--base-url|--model)
|
|
91
|
+
return
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
COMPREPLY=( \$(compgen -W "\${pr_opts}" -- "\${cur}") )
|
|
95
|
+
;;
|
|
96
|
+
tag)
|
|
97
|
+
case "\${prev}" in
|
|
98
|
+
-t|--base-tag)
|
|
99
|
+
# Complete with git tags
|
|
100
|
+
local tags=\$(git tag 2>/dev/null)
|
|
101
|
+
COMPREPLY=( \$(compgen -W "\${tags}" -- "\${cur}") )
|
|
102
|
+
return
|
|
103
|
+
;;
|
|
104
|
+
-k|--api-key|--base-url|-m|--model|--message|--prompt)
|
|
105
|
+
return
|
|
106
|
+
;;
|
|
107
|
+
esac
|
|
108
|
+
COMPREPLY=( \$(compgen -W "\${tag_opts}" -- "\${cur}") )
|
|
109
|
+
;;
|
|
110
|
+
history)
|
|
111
|
+
case "\${prev}" in
|
|
112
|
+
-l|--limit)
|
|
113
|
+
return
|
|
114
|
+
;;
|
|
115
|
+
esac
|
|
116
|
+
COMPREPLY=( \$(compgen -W "\${history_opts}" -- "\${cur}") )
|
|
117
|
+
;;
|
|
118
|
+
completion)
|
|
119
|
+
COMPREPLY=( \$(compgen -W "bash zsh" -- "\${cur}") )
|
|
120
|
+
;;
|
|
121
|
+
esac
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
complete -F _git_ai_commit git-ai-commit
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
generateZshCompletion() {
|
|
128
|
+
return `#compdef git-ai-commit
|
|
129
|
+
# git-ai-commit zsh completion
|
|
130
|
+
# Add to ~/.zshrc:
|
|
131
|
+
# eval "$(git-ai-commit completion zsh)"
|
|
132
|
+
# Or save to a file in your $fpath (e.g., ~/.zsh/completions/_git-ai-commit)
|
|
133
|
+
|
|
134
|
+
_git-ai-commit() {
|
|
135
|
+
local -a commands
|
|
136
|
+
commands=(
|
|
137
|
+
'commit:Generate AI-powered commit message'
|
|
138
|
+
'config:Manage git-ai-commit configuration'
|
|
139
|
+
'pr:Generate a pull request title and summary'
|
|
140
|
+
'tag:Create an annotated git tag with AI-generated notes'
|
|
141
|
+
'history:Manage git-ai-commit command history'
|
|
142
|
+
'completion:Generate shell completion scripts'
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
_arguments -C \\
|
|
146
|
+
'-v[output the version number]' \\
|
|
147
|
+
'--version[output the version number]' \\
|
|
148
|
+
'-h[display help]' \\
|
|
149
|
+
'--help[display help]' \\
|
|
150
|
+
'1: :->command' \\
|
|
151
|
+
'*:: :->args'
|
|
152
|
+
|
|
153
|
+
case \$state in
|
|
154
|
+
command)
|
|
155
|
+
_describe -t commands 'git-ai-commit commands' commands
|
|
156
|
+
;;
|
|
157
|
+
args)
|
|
158
|
+
case \$words[1] in
|
|
159
|
+
commit)
|
|
160
|
+
_arguments \\
|
|
161
|
+
'-k[OpenAI API key]:key:' \\
|
|
162
|
+
'--api-key[OpenAI API key]:key:' \\
|
|
163
|
+
'-b[Custom API base URL]:url:' \\
|
|
164
|
+
'--base-url[Custom API base URL]:url:' \\
|
|
165
|
+
'--model[Model to use]:model:' \\
|
|
166
|
+
'-m[Output only the generated commit message]' \\
|
|
167
|
+
'--message-only[Output only the generated commit message]' \\
|
|
168
|
+
'-p[Push after creating the commit]' \\
|
|
169
|
+
'--push[Push after creating the commit]' \\
|
|
170
|
+
'--prompt[Additional AI prompt instructions]:text:' \\
|
|
171
|
+
'--no-verify[Skip pre-commit hooks]'
|
|
172
|
+
;;
|
|
173
|
+
config)
|
|
174
|
+
_arguments \\
|
|
175
|
+
'-s[Show current configuration]' \\
|
|
176
|
+
'--show[Show current configuration]' \\
|
|
177
|
+
'-l[Set default language]:language:(ko en)' \\
|
|
178
|
+
'--language[Set default language]:language:(ko en)' \\
|
|
179
|
+
'--auto-push[Enable automatic git push]' \\
|
|
180
|
+
'--no-auto-push[Disable automatic git push]' \\
|
|
181
|
+
'-k[Persist API key]:key:' \\
|
|
182
|
+
'--api-key[Persist API key]:key:' \\
|
|
183
|
+
'-b[Persist API base URL]:url:' \\
|
|
184
|
+
'--base-url[Persist API base URL]:url:' \\
|
|
185
|
+
'-m[Persist default AI model]:model:' \\
|
|
186
|
+
'--model[Persist default AI model]:model:' \\
|
|
187
|
+
'--mode[Persist AI mode]:mode:(custom openai)'
|
|
188
|
+
;;
|
|
189
|
+
pr)
|
|
190
|
+
_arguments \\
|
|
191
|
+
'--base[Base branch to diff against]:branch:__git_branch_names' \\
|
|
192
|
+
'--compare[Compare branch to describe]:branch:__git_branch_names' \\
|
|
193
|
+
'-k[Override API key]:key:' \\
|
|
194
|
+
'--api-key[Override API key]:key:' \\
|
|
195
|
+
'-b[Override API base URL]:url:' \\
|
|
196
|
+
'--base-url[Override API base URL]:url:' \\
|
|
197
|
+
'--model[Override AI model]:model:'
|
|
198
|
+
;;
|
|
199
|
+
tag)
|
|
200
|
+
_arguments \\
|
|
201
|
+
'1:tag name:' \\
|
|
202
|
+
'-k[OpenAI API key]:key:' \\
|
|
203
|
+
'--api-key[OpenAI API key]:key:' \\
|
|
204
|
+
'--base-url[Custom API base URL]:url:' \\
|
|
205
|
+
'-m[Model to use]:model:' \\
|
|
206
|
+
'--model[Model to use]:model:' \\
|
|
207
|
+
'--message[Tag message to use directly]:message:' \\
|
|
208
|
+
'-t[Existing tag to diff against]:tag:__git_tags' \\
|
|
209
|
+
'--base-tag[Existing tag to diff against]:tag:__git_tags' \\
|
|
210
|
+
'--prompt[Additional AI prompt instructions]:text:'
|
|
211
|
+
;;
|
|
212
|
+
history)
|
|
213
|
+
_arguments \\
|
|
214
|
+
'-l[Limit number of entries]:number:' \\
|
|
215
|
+
'--limit[Limit number of entries]:number:' \\
|
|
216
|
+
'--json[Output in JSON format]' \\
|
|
217
|
+
'--clear[Clear all stored history]'
|
|
218
|
+
;;
|
|
219
|
+
completion)
|
|
220
|
+
_arguments \\
|
|
221
|
+
'1:shell:(bash zsh)'
|
|
222
|
+
;;
|
|
223
|
+
esac
|
|
224
|
+
;;
|
|
225
|
+
esac
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
# Helper function to complete git branches
|
|
229
|
+
__git_branch_names() {
|
|
230
|
+
local -a branches
|
|
231
|
+
branches=(\${(f)"\$(git branch --format='%(refname:short)' 2>/dev/null)"})
|
|
232
|
+
_describe -t branches 'branches' branches
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
# Helper function to complete git tags
|
|
236
|
+
__git_tags() {
|
|
237
|
+
local -a tags
|
|
238
|
+
tags=(\${(f)"\$(git tag 2>/dev/null)"})
|
|
239
|
+
_describe -t tags 'tags' tags
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
_git-ai-commit "\$@"
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
getCommand() {
|
|
246
|
+
return this.program;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.CompletionCommand = CompletionCommand;
|
|
250
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,MAAa,iBAAiB;IAG5B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC;aACrC,WAAW,CAAC,mCAAmC,CAAC;aAChD,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;aAC/C,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEO,gBAAgB,CAAC,KAAa;QACpC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAE9C,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;QAC7C,CAAC;aAAM,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAEO,sBAAsB;QAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGV,CAAC;IACA,CAAC;IAEO,qBAAqB;QAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHV,CAAC;IACA,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAxPD,8CAwPC"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const configCommand_1 = require("./commands/configCommand");
|
|
|
12
12
|
const prCommand_1 = require("./commands/prCommand");
|
|
13
13
|
const tag_1 = require("./commands/tag");
|
|
14
14
|
const history_1 = require("./commands/history");
|
|
15
|
+
const completion_1 = require("./commands/completion");
|
|
15
16
|
function getPackageVersion() {
|
|
16
17
|
try {
|
|
17
18
|
// When compiled, __dirname will be dist/; package.json is one level up
|
|
@@ -35,10 +36,12 @@ const configCommand = new configCommand_1.ConfigCommand();
|
|
|
35
36
|
const pullRequestCommand = new prCommand_1.PullRequestCommand();
|
|
36
37
|
const tagCommand = new tag_1.TagCommand();
|
|
37
38
|
const historyCommand = new history_1.HistoryCommand();
|
|
39
|
+
const completionCommand = new completion_1.CompletionCommand();
|
|
38
40
|
program.addCommand(commitCommand.getCommand());
|
|
39
41
|
program.addCommand(configCommand.getCommand());
|
|
40
42
|
program.addCommand(pullRequestCommand.getCommand());
|
|
41
43
|
program.addCommand(tagCommand.getCommand());
|
|
42
44
|
program.addCommand(historyCommand.getCommand());
|
|
45
|
+
program.addCommand(completionCommand.getCommand());
|
|
43
46
|
program.parse();
|
|
44
47
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,8CAAkD;AAClD,4DAAyD;AACzD,oDAA0D;AAC1D,wCAA4C;AAC5C,gDAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,8CAAkD;AAClD,4DAAyD;AACzD,oDAA0D;AAC1D,wCAA4C;AAC5C,gDAAoD;AACpD,sDAA0D;AAE1D,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,uEAAuE;QACvE,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,YAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,eAAe,CAAC;KACrB,WAAW,CAAC,yCAAyC,CAAC;IACvD,6CAA6C;KAC5C,OAAO,CAAC,iBAAiB,EAAE,EAAE,eAAe,EAAE,2BAA2B,CAAC,CAAC;AAE9E,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAC;AAC1C,MAAM,aAAa,GAAG,IAAI,6BAAa,EAAE,CAAC;AAC1C,MAAM,kBAAkB,GAAG,IAAI,8BAAkB,EAAE,CAAC;AACpD,MAAM,UAAU,GAAG,IAAI,gBAAU,EAAE,CAAC;AACpC,MAAM,cAAc,GAAG,IAAI,wBAAc,EAAE,CAAC;AAC5C,MAAM,iBAAiB,GAAG,IAAI,8BAAiB,EAAE,CAAC;AAElD,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/C,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/C,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC,CAAC;AACpD,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAC5C,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC;AAChD,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAC,CAAC;AAEnD,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/prompts/tag.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,2BAAuB,EACvB,WAAU,iBAAwB,KACjC,
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/prompts/tag.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,2BAAuB,EACvB,WAAU,iBAAwB,KACjC,MAwEF,CAAC"}
|
package/dist/prompts/tag.js
CHANGED
|
@@ -2,42 +2,69 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTagPrompt = void 0;
|
|
4
4
|
const generateTagPrompt = (tagName, customInstructions = '', language = 'ko') => {
|
|
5
|
+
const titleInstruction = language === 'ko'
|
|
6
|
+
? `첫 줄에 버전 "${tagName}"을 제목으로 작성하세요.`
|
|
7
|
+
: `Write the version "${tagName}" as the title on the first line.`;
|
|
5
8
|
const summaryInstruction = language === 'ko'
|
|
6
|
-
? '
|
|
7
|
-
: '
|
|
9
|
+
? '제목 다음 줄에 이번 릴리즈의 전체적인 영향을 요약하는 한 문장을 작성하세요.'
|
|
10
|
+
: 'On the line after the title, write a one-sentence summary capturing the overall impact of this release.';
|
|
8
11
|
const listInstruction = language === 'ko'
|
|
9
|
-
? '
|
|
10
|
-
: 'After the summary,
|
|
12
|
+
? '요약 후 빈 줄을 두고, 각 카테고리별로 변경사항을 나열하세요: 새로운 기능, 버그 수정, 개선사항. 각 항목은 "- " 로 시작합니다.'
|
|
13
|
+
: 'After the summary, leave a blank line, then list changes by category: New Features, Bug Fixes, Improvements. Each item starts with "- ".';
|
|
14
|
+
const categoryFormat = language === 'ko'
|
|
15
|
+
? `카테고리 형식:
|
|
16
|
+
### 새로운 기능
|
|
17
|
+
- 변경사항 1
|
|
18
|
+
- 변경사항 2
|
|
19
|
+
|
|
20
|
+
### 버그 수정
|
|
21
|
+
- 수정사항 1
|
|
22
|
+
|
|
23
|
+
### 개선사항
|
|
24
|
+
- 개선사항 1`
|
|
25
|
+
: `Category format:
|
|
26
|
+
### New Features
|
|
27
|
+
- Change 1
|
|
28
|
+
- Change 2
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
- Fix 1
|
|
32
|
+
|
|
33
|
+
### Improvements
|
|
34
|
+
- Improvement 1`;
|
|
11
35
|
const emptyCategoryInstruction = language === 'ko'
|
|
12
|
-
? '
|
|
13
|
-
: '
|
|
36
|
+
? '변경사항이 없는 카테고리는 생략하세요.'
|
|
37
|
+
: 'Omit categories with no changes.';
|
|
14
38
|
const noChangesInstruction = language === 'ko'
|
|
15
|
-
? '
|
|
16
|
-
: 'If no changes exist at all, state "No changes to report."
|
|
39
|
+
? '변경사항이 전혀 없으면 "변경 사항 없음"이라고 작성하세요.'
|
|
40
|
+
: 'If no changes exist at all, state "No changes to report."';
|
|
17
41
|
const outputLanguageLine = language === 'ko'
|
|
18
|
-
? '
|
|
19
|
-
: 'Write the release notes in English
|
|
20
|
-
return `You are an experienced release manager. Produce clear, user-facing release notes
|
|
42
|
+
? '릴리즈 노트를 한국어로 작성하세요.'
|
|
43
|
+
: 'Write the release notes in English.';
|
|
44
|
+
return `You are an experienced release manager. Produce clear, user-facing release notes in GitHub Release style.
|
|
21
45
|
|
|
22
46
|
## Objective
|
|
23
|
-
|
|
47
|
+
Create release notes for ${tagName} that describe the meaningful changes since the previous release.
|
|
24
48
|
|
|
25
49
|
## Input Context
|
|
26
50
|
- Target tag to publish: ${tagName}
|
|
27
|
-
- Commit history between the previous tag and ${tagName} will be supplied in the user message
|
|
51
|
+
- Commit history between the previous tag and ${tagName} will be supplied in the user message.
|
|
52
|
+
|
|
53
|
+
${customInstructions ? `## Additional Instructions\n${customInstructions}\n` : ''}
|
|
54
|
+
## Output Format (GitHub Release Style)
|
|
55
|
+
${titleInstruction}
|
|
56
|
+
${summaryInstruction}
|
|
57
|
+
${listInstruction}
|
|
28
58
|
|
|
29
|
-
${
|
|
59
|
+
${categoryFormat}
|
|
30
60
|
|
|
31
|
-
##
|
|
61
|
+
## Rules
|
|
32
62
|
- ${outputLanguageLine}
|
|
33
|
-
- ${summaryInstruction}
|
|
34
|
-
- ${listInstruction}
|
|
35
|
-
- Use short phrases for each change and include scope/component names when helpful, without copying commit messages verbatim.
|
|
36
63
|
- ${emptyCategoryInstruction}
|
|
37
64
|
- ${noChangesInstruction}
|
|
38
|
-
-
|
|
39
|
-
- Do not
|
|
40
|
-
-
|
|
65
|
+
- Use concise descriptions; do not copy commit messages verbatim.
|
|
66
|
+
- Do not invent changes beyond what appears in the commit log.
|
|
67
|
+
- Use markdown formatting (###, -, etc.) as shown in the category format.
|
|
41
68
|
- Return only the release notes content with no surrounding commentary.`;
|
|
42
69
|
};
|
|
43
70
|
exports.generateTagPrompt = generateTagPrompt;
|
package/dist/prompts/tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../src/prompts/tag.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAC/B,OAAe,EACf,kBAAkB,GAAG,EAAE,EACvB,WAA8B,IAAI,EAC1B,EAAE;IACV,MAAM,kBAAkB,GAAG,QAAQ,KAAK,IAAI;QAC1C,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../src/prompts/tag.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAC/B,OAAe,EACf,kBAAkB,GAAG,EAAE,EACvB,WAA8B,IAAI,EAC1B,EAAE;IACV,MAAM,gBAAgB,GAAG,QAAQ,KAAK,IAAI;QACxC,CAAC,CAAC,YAAY,OAAO,gBAAgB;QACrC,CAAC,CAAC,sBAAsB,OAAO,mCAAmC,CAAC;IAErE,MAAM,kBAAkB,GAAG,QAAQ,KAAK,IAAI;QAC1C,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,yGAAyG,CAAC;IAE9G,MAAM,eAAe,GAAG,QAAQ,KAAK,IAAI;QACvC,CAAC,CAAC,8EAA8E;QAChF,CAAC,CAAC,0IAA0I,CAAC;IAE/I,MAAM,cAAc,GAAG,QAAQ,KAAK,IAAI;QACtC,CAAC,CAAC;;;;;;;;;SASG;QACL,CAAC,CAAC;;;;;;;;;gBASU,CAAC;IAEf,MAAM,wBAAwB,GAAG,QAAQ,KAAK,IAAI;QAChD,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,kCAAkC,CAAC;IAEvC,MAAM,oBAAoB,GAAG,QAAQ,KAAK,IAAI;QAC5C,CAAC,CAAC,mCAAmC;QACrC,CAAC,CAAC,2DAA2D,CAAC;IAEhE,MAAM,kBAAkB,GAAG,QAAQ,KAAK,IAAI;QAC1C,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,qCAAqC,CAAC;IAE1C,OAAO;;;2BAGkB,OAAO;;;2BAGP,OAAO;gDACc,OAAO;;EAErD,kBAAkB,CAAC,CAAC,CAAC,+BAA+B,kBAAkB,IAAI,CAAC,CAAC,CAAC,EAAE;;EAE/E,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;;EAEf,cAAc;;;IAGZ,kBAAkB;IAClB,wBAAwB;IACxB,oBAAoB;;;;wEAIgD,CAAC;AACzE,CAAC,CAAC;AA5EW,QAAA,iBAAiB,qBA4E5B"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
|
|
3
|
+
export class CompletionCommand {
|
|
4
|
+
private program: Command;
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this.program = new Command('completion')
|
|
8
|
+
.description('Generate shell completion scripts')
|
|
9
|
+
.argument('<shell>', 'Shell type (bash or zsh)')
|
|
10
|
+
.action(this.handleCompletion.bind(this));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private handleCompletion(shell: string): void {
|
|
14
|
+
const normalized = shell.toLowerCase().trim();
|
|
15
|
+
|
|
16
|
+
if (normalized === 'bash') {
|
|
17
|
+
console.log(this.generateBashCompletion());
|
|
18
|
+
} else if (normalized === 'zsh') {
|
|
19
|
+
console.log(this.generateZshCompletion());
|
|
20
|
+
} else {
|
|
21
|
+
console.error(`Unsupported shell: ${shell}`);
|
|
22
|
+
console.error('Supported shells: bash, zsh');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private generateBashCompletion(): string {
|
|
28
|
+
return `# git-ai-commit bash completion
|
|
29
|
+
# Add to ~/.bashrc or ~/.bash_profile:
|
|
30
|
+
# eval "$(git-ai-commit completion bash)"
|
|
31
|
+
|
|
32
|
+
_git_ai_commit() {
|
|
33
|
+
local cur prev words cword
|
|
34
|
+
_init_completion || return
|
|
35
|
+
|
|
36
|
+
local commands="commit config pr tag history completion"
|
|
37
|
+
|
|
38
|
+
# Global options
|
|
39
|
+
local global_opts="-v --version -h --help"
|
|
40
|
+
|
|
41
|
+
# Command-specific options
|
|
42
|
+
local commit_opts="-k --api-key -b --base-url --model -m --message-only -p --push --prompt --no-verify"
|
|
43
|
+
local config_opts="-s --show -l --language --auto-push --no-auto-push -k --api-key -b --base-url -m --model --mode"
|
|
44
|
+
local pr_opts="--base --compare -k --api-key -b --base-url --model"
|
|
45
|
+
local tag_opts="-k --api-key --base-url -m --model --message -t --base-tag --prompt"
|
|
46
|
+
local history_opts="-l --limit --json --clear"
|
|
47
|
+
local completion_opts=""
|
|
48
|
+
|
|
49
|
+
case "\${cword}" in
|
|
50
|
+
1)
|
|
51
|
+
COMPREPLY=( \$(compgen -W "\${commands} \${global_opts}" -- "\${cur}") )
|
|
52
|
+
return
|
|
53
|
+
;;
|
|
54
|
+
esac
|
|
55
|
+
|
|
56
|
+
local cmd="\${words[1]}"
|
|
57
|
+
|
|
58
|
+
case "\${cmd}" in
|
|
59
|
+
commit)
|
|
60
|
+
case "\${prev}" in
|
|
61
|
+
-k|--api-key|-b|--base-url|--model|--prompt)
|
|
62
|
+
return
|
|
63
|
+
;;
|
|
64
|
+
esac
|
|
65
|
+
COMPREPLY=( \$(compgen -W "\${commit_opts}" -- "\${cur}") )
|
|
66
|
+
;;
|
|
67
|
+
config)
|
|
68
|
+
case "\${prev}" in
|
|
69
|
+
-l|--language)
|
|
70
|
+
COMPREPLY=( \$(compgen -W "ko en" -- "\${cur}") )
|
|
71
|
+
return
|
|
72
|
+
;;
|
|
73
|
+
--mode)
|
|
74
|
+
COMPREPLY=( \$(compgen -W "custom openai" -- "\${cur}") )
|
|
75
|
+
return
|
|
76
|
+
;;
|
|
77
|
+
-k|--api-key|-b|--base-url|-m|--model)
|
|
78
|
+
return
|
|
79
|
+
;;
|
|
80
|
+
esac
|
|
81
|
+
COMPREPLY=( \$(compgen -W "\${config_opts}" -- "\${cur}") )
|
|
82
|
+
;;
|
|
83
|
+
pr)
|
|
84
|
+
case "\${prev}" in
|
|
85
|
+
--base|--compare)
|
|
86
|
+
# Complete with git branches
|
|
87
|
+
local branches=\$(git branch --format='%(refname:short)' 2>/dev/null)
|
|
88
|
+
COMPREPLY=( \$(compgen -W "\${branches}" -- "\${cur}") )
|
|
89
|
+
return
|
|
90
|
+
;;
|
|
91
|
+
-k|--api-key|-b|--base-url|--model)
|
|
92
|
+
return
|
|
93
|
+
;;
|
|
94
|
+
esac
|
|
95
|
+
COMPREPLY=( \$(compgen -W "\${pr_opts}" -- "\${cur}") )
|
|
96
|
+
;;
|
|
97
|
+
tag)
|
|
98
|
+
case "\${prev}" in
|
|
99
|
+
-t|--base-tag)
|
|
100
|
+
# Complete with git tags
|
|
101
|
+
local tags=\$(git tag 2>/dev/null)
|
|
102
|
+
COMPREPLY=( \$(compgen -W "\${tags}" -- "\${cur}") )
|
|
103
|
+
return
|
|
104
|
+
;;
|
|
105
|
+
-k|--api-key|--base-url|-m|--model|--message|--prompt)
|
|
106
|
+
return
|
|
107
|
+
;;
|
|
108
|
+
esac
|
|
109
|
+
COMPREPLY=( \$(compgen -W "\${tag_opts}" -- "\${cur}") )
|
|
110
|
+
;;
|
|
111
|
+
history)
|
|
112
|
+
case "\${prev}" in
|
|
113
|
+
-l|--limit)
|
|
114
|
+
return
|
|
115
|
+
;;
|
|
116
|
+
esac
|
|
117
|
+
COMPREPLY=( \$(compgen -W "\${history_opts}" -- "\${cur}") )
|
|
118
|
+
;;
|
|
119
|
+
completion)
|
|
120
|
+
COMPREPLY=( \$(compgen -W "bash zsh" -- "\${cur}") )
|
|
121
|
+
;;
|
|
122
|
+
esac
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
complete -F _git_ai_commit git-ai-commit
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private generateZshCompletion(): string {
|
|
130
|
+
return `#compdef git-ai-commit
|
|
131
|
+
# git-ai-commit zsh completion
|
|
132
|
+
# Add to ~/.zshrc:
|
|
133
|
+
# eval "$(git-ai-commit completion zsh)"
|
|
134
|
+
# Or save to a file in your $fpath (e.g., ~/.zsh/completions/_git-ai-commit)
|
|
135
|
+
|
|
136
|
+
_git-ai-commit() {
|
|
137
|
+
local -a commands
|
|
138
|
+
commands=(
|
|
139
|
+
'commit:Generate AI-powered commit message'
|
|
140
|
+
'config:Manage git-ai-commit configuration'
|
|
141
|
+
'pr:Generate a pull request title and summary'
|
|
142
|
+
'tag:Create an annotated git tag with AI-generated notes'
|
|
143
|
+
'history:Manage git-ai-commit command history'
|
|
144
|
+
'completion:Generate shell completion scripts'
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
_arguments -C \\
|
|
148
|
+
'-v[output the version number]' \\
|
|
149
|
+
'--version[output the version number]' \\
|
|
150
|
+
'-h[display help]' \\
|
|
151
|
+
'--help[display help]' \\
|
|
152
|
+
'1: :->command' \\
|
|
153
|
+
'*:: :->args'
|
|
154
|
+
|
|
155
|
+
case \$state in
|
|
156
|
+
command)
|
|
157
|
+
_describe -t commands 'git-ai-commit commands' commands
|
|
158
|
+
;;
|
|
159
|
+
args)
|
|
160
|
+
case \$words[1] in
|
|
161
|
+
commit)
|
|
162
|
+
_arguments \\
|
|
163
|
+
'-k[OpenAI API key]:key:' \\
|
|
164
|
+
'--api-key[OpenAI API key]:key:' \\
|
|
165
|
+
'-b[Custom API base URL]:url:' \\
|
|
166
|
+
'--base-url[Custom API base URL]:url:' \\
|
|
167
|
+
'--model[Model to use]:model:' \\
|
|
168
|
+
'-m[Output only the generated commit message]' \\
|
|
169
|
+
'--message-only[Output only the generated commit message]' \\
|
|
170
|
+
'-p[Push after creating the commit]' \\
|
|
171
|
+
'--push[Push after creating the commit]' \\
|
|
172
|
+
'--prompt[Additional AI prompt instructions]:text:' \\
|
|
173
|
+
'--no-verify[Skip pre-commit hooks]'
|
|
174
|
+
;;
|
|
175
|
+
config)
|
|
176
|
+
_arguments \\
|
|
177
|
+
'-s[Show current configuration]' \\
|
|
178
|
+
'--show[Show current configuration]' \\
|
|
179
|
+
'-l[Set default language]:language:(ko en)' \\
|
|
180
|
+
'--language[Set default language]:language:(ko en)' \\
|
|
181
|
+
'--auto-push[Enable automatic git push]' \\
|
|
182
|
+
'--no-auto-push[Disable automatic git push]' \\
|
|
183
|
+
'-k[Persist API key]:key:' \\
|
|
184
|
+
'--api-key[Persist API key]:key:' \\
|
|
185
|
+
'-b[Persist API base URL]:url:' \\
|
|
186
|
+
'--base-url[Persist API base URL]:url:' \\
|
|
187
|
+
'-m[Persist default AI model]:model:' \\
|
|
188
|
+
'--model[Persist default AI model]:model:' \\
|
|
189
|
+
'--mode[Persist AI mode]:mode:(custom openai)'
|
|
190
|
+
;;
|
|
191
|
+
pr)
|
|
192
|
+
_arguments \\
|
|
193
|
+
'--base[Base branch to diff against]:branch:__git_branch_names' \\
|
|
194
|
+
'--compare[Compare branch to describe]:branch:__git_branch_names' \\
|
|
195
|
+
'-k[Override API key]:key:' \\
|
|
196
|
+
'--api-key[Override API key]:key:' \\
|
|
197
|
+
'-b[Override API base URL]:url:' \\
|
|
198
|
+
'--base-url[Override API base URL]:url:' \\
|
|
199
|
+
'--model[Override AI model]:model:'
|
|
200
|
+
;;
|
|
201
|
+
tag)
|
|
202
|
+
_arguments \\
|
|
203
|
+
'1:tag name:' \\
|
|
204
|
+
'-k[OpenAI API key]:key:' \\
|
|
205
|
+
'--api-key[OpenAI API key]:key:' \\
|
|
206
|
+
'--base-url[Custom API base URL]:url:' \\
|
|
207
|
+
'-m[Model to use]:model:' \\
|
|
208
|
+
'--model[Model to use]:model:' \\
|
|
209
|
+
'--message[Tag message to use directly]:message:' \\
|
|
210
|
+
'-t[Existing tag to diff against]:tag:__git_tags' \\
|
|
211
|
+
'--base-tag[Existing tag to diff against]:tag:__git_tags' \\
|
|
212
|
+
'--prompt[Additional AI prompt instructions]:text:'
|
|
213
|
+
;;
|
|
214
|
+
history)
|
|
215
|
+
_arguments \\
|
|
216
|
+
'-l[Limit number of entries]:number:' \\
|
|
217
|
+
'--limit[Limit number of entries]:number:' \\
|
|
218
|
+
'--json[Output in JSON format]' \\
|
|
219
|
+
'--clear[Clear all stored history]'
|
|
220
|
+
;;
|
|
221
|
+
completion)
|
|
222
|
+
_arguments \\
|
|
223
|
+
'1:shell:(bash zsh)'
|
|
224
|
+
;;
|
|
225
|
+
esac
|
|
226
|
+
;;
|
|
227
|
+
esac
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
# Helper function to complete git branches
|
|
231
|
+
__git_branch_names() {
|
|
232
|
+
local -a branches
|
|
233
|
+
branches=(\${(f)"\$(git branch --format='%(refname:short)' 2>/dev/null)"})
|
|
234
|
+
_describe -t branches 'branches' branches
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
# Helper function to complete git tags
|
|
238
|
+
__git_tags() {
|
|
239
|
+
local -a tags
|
|
240
|
+
tags=(\${(f)"\$(git tag 2>/dev/null)"})
|
|
241
|
+
_describe -t tags 'tags' tags
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
_git-ai-commit "\$@"
|
|
245
|
+
`;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
getCommand(): Command {
|
|
249
|
+
return this.program;
|
|
250
|
+
}
|
|
251
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ConfigCommand } from './commands/configCommand';
|
|
|
8
8
|
import { PullRequestCommand } from './commands/prCommand';
|
|
9
9
|
import { TagCommand } from './commands/tag';
|
|
10
10
|
import { HistoryCommand } from './commands/history';
|
|
11
|
+
import { CompletionCommand } from './commands/completion';
|
|
11
12
|
|
|
12
13
|
function getPackageVersion(): string {
|
|
13
14
|
try {
|
|
@@ -34,11 +35,13 @@ const configCommand = new ConfigCommand();
|
|
|
34
35
|
const pullRequestCommand = new PullRequestCommand();
|
|
35
36
|
const tagCommand = new TagCommand();
|
|
36
37
|
const historyCommand = new HistoryCommand();
|
|
38
|
+
const completionCommand = new CompletionCommand();
|
|
37
39
|
|
|
38
40
|
program.addCommand(commitCommand.getCommand());
|
|
39
41
|
program.addCommand(configCommand.getCommand());
|
|
40
42
|
program.addCommand(pullRequestCommand.getCommand());
|
|
41
43
|
program.addCommand(tagCommand.getCommand());
|
|
42
44
|
program.addCommand(historyCommand.getCommand());
|
|
45
|
+
program.addCommand(completionCommand.getCommand());
|
|
43
46
|
|
|
44
47
|
program.parse();
|
package/src/prompts/tag.ts
CHANGED
|
@@ -5,46 +5,75 @@ export const generateTagPrompt = (
|
|
|
5
5
|
customInstructions = '',
|
|
6
6
|
language: TagPromptLanguage = 'ko'
|
|
7
7
|
): string => {
|
|
8
|
+
const titleInstruction = language === 'ko'
|
|
9
|
+
? `첫 줄에 버전 "${tagName}"을 제목으로 작성하세요.`
|
|
10
|
+
: `Write the version "${tagName}" as the title on the first line.`;
|
|
11
|
+
|
|
8
12
|
const summaryInstruction = language === 'ko'
|
|
9
|
-
? '
|
|
10
|
-
: '
|
|
13
|
+
? '제목 다음 줄에 이번 릴리즈의 전체적인 영향을 요약하는 한 문장을 작성하세요.'
|
|
14
|
+
: 'On the line after the title, write a one-sentence summary capturing the overall impact of this release.';
|
|
11
15
|
|
|
12
16
|
const listInstruction = language === 'ko'
|
|
13
|
-
? '
|
|
14
|
-
: 'After the summary,
|
|
17
|
+
? '요약 후 빈 줄을 두고, 각 카테고리별로 변경사항을 나열하세요: 새로운 기능, 버그 수정, 개선사항. 각 항목은 "- " 로 시작합니다.'
|
|
18
|
+
: 'After the summary, leave a blank line, then list changes by category: New Features, Bug Fixes, Improvements. Each item starts with "- ".';
|
|
19
|
+
|
|
20
|
+
const categoryFormat = language === 'ko'
|
|
21
|
+
? `카테고리 형식:
|
|
22
|
+
### 새로운 기능
|
|
23
|
+
- 변경사항 1
|
|
24
|
+
- 변경사항 2
|
|
25
|
+
|
|
26
|
+
### 버그 수정
|
|
27
|
+
- 수정사항 1
|
|
28
|
+
|
|
29
|
+
### 개선사항
|
|
30
|
+
- 개선사항 1`
|
|
31
|
+
: `Category format:
|
|
32
|
+
### New Features
|
|
33
|
+
- Change 1
|
|
34
|
+
- Change 2
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
- Fix 1
|
|
38
|
+
|
|
39
|
+
### Improvements
|
|
40
|
+
- Improvement 1`;
|
|
15
41
|
|
|
16
42
|
const emptyCategoryInstruction = language === 'ko'
|
|
17
|
-
? '
|
|
18
|
-
: '
|
|
43
|
+
? '변경사항이 없는 카테고리는 생략하세요.'
|
|
44
|
+
: 'Omit categories with no changes.';
|
|
19
45
|
|
|
20
46
|
const noChangesInstruction = language === 'ko'
|
|
21
|
-
? '
|
|
22
|
-
: 'If no changes exist at all, state "No changes to report."
|
|
47
|
+
? '변경사항이 전혀 없으면 "변경 사항 없음"이라고 작성하세요.'
|
|
48
|
+
: 'If no changes exist at all, state "No changes to report."';
|
|
23
49
|
|
|
24
50
|
const outputLanguageLine = language === 'ko'
|
|
25
|
-
? '
|
|
26
|
-
: 'Write the release notes in English
|
|
51
|
+
? '릴리즈 노트를 한국어로 작성하세요.'
|
|
52
|
+
: 'Write the release notes in English.';
|
|
27
53
|
|
|
28
|
-
return `You are an experienced release manager. Produce clear, user-facing release notes
|
|
54
|
+
return `You are an experienced release manager. Produce clear, user-facing release notes in GitHub Release style.
|
|
29
55
|
|
|
30
56
|
## Objective
|
|
31
|
-
|
|
57
|
+
Create release notes for ${tagName} that describe the meaningful changes since the previous release.
|
|
32
58
|
|
|
33
59
|
## Input Context
|
|
34
60
|
- Target tag to publish: ${tagName}
|
|
35
|
-
- Commit history between the previous tag and ${tagName} will be supplied in the user message
|
|
61
|
+
- Commit history between the previous tag and ${tagName} will be supplied in the user message.
|
|
62
|
+
|
|
63
|
+
${customInstructions ? `## Additional Instructions\n${customInstructions}\n` : ''}
|
|
64
|
+
## Output Format (GitHub Release Style)
|
|
65
|
+
${titleInstruction}
|
|
66
|
+
${summaryInstruction}
|
|
67
|
+
${listInstruction}
|
|
36
68
|
|
|
37
|
-
${
|
|
69
|
+
${categoryFormat}
|
|
38
70
|
|
|
39
|
-
##
|
|
71
|
+
## Rules
|
|
40
72
|
- ${outputLanguageLine}
|
|
41
|
-
- ${summaryInstruction}
|
|
42
|
-
- ${listInstruction}
|
|
43
|
-
- Use short phrases for each change and include scope/component names when helpful, without copying commit messages verbatim.
|
|
44
73
|
- ${emptyCategoryInstruction}
|
|
45
74
|
- ${noChangesInstruction}
|
|
46
|
-
-
|
|
47
|
-
- Do not
|
|
48
|
-
-
|
|
75
|
+
- Use concise descriptions; do not copy commit messages verbatim.
|
|
76
|
+
- Do not invent changes beyond what appears in the commit log.
|
|
77
|
+
- Use markdown formatting (###, -, etc.) as shown in the category format.
|
|
49
78
|
- Return only the release notes content with no surrounding commentary.`;
|
|
50
79
|
};
|