@thankarezos/git-ai-commit 0.1.0 → 0.1.2
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/README.md +11 -13
- package/bin/git-aic.js +37 -3
- package/bin/presets.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,24 +10,20 @@ $ git aic -ap "mention the migration"
|
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
|
-
Until this is published to npm, install from source:
|
|
14
|
-
|
|
15
13
|
```sh
|
|
16
|
-
|
|
17
|
-
cd git-ai-commit
|
|
18
|
-
npm link # symlinks `git-aic` onto your PATH
|
|
14
|
+
npm install -g @thankarezos/git-ai-commit
|
|
19
15
|
```
|
|
20
16
|
|
|
21
|
-
> If `npm link` fails with `EACCES`, set a user-owned npm prefix:
|
|
22
|
-
> ```sh
|
|
23
|
-
> npm config set prefix ~/.npm-global
|
|
24
|
-
> mkdir -p ~/.npm-global
|
|
25
|
-
> # add to ~/.bashrc or ~/.zshrc:
|
|
26
|
-
> export PATH="$HOME/.npm-global/bin:$PATH"
|
|
27
|
-
> ```
|
|
28
|
-
|
|
29
17
|
Requires **Node 18+**. Because the binary is named `git-aic`, git resolves `git aic` automatically.
|
|
30
18
|
|
|
19
|
+
### Install from source
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
git clone https://github.com/thankarezos/git-ai-commit.git
|
|
23
|
+
cd git-ai-commit
|
|
24
|
+
npm link
|
|
25
|
+
```
|
|
26
|
+
|
|
31
27
|
## Quick start
|
|
32
28
|
|
|
33
29
|
```sh
|
|
@@ -48,6 +44,7 @@ First run launches an **interactive wizard** that asks you to pick a provider, e
|
|
|
48
44
|
| `-a`, `--add` | Run `git add -A` before generating |
|
|
49
45
|
| `-p "..."`, `--prompt "..."` | Append extra instructions to the AI prompt |
|
|
50
46
|
| `-ap "..."`, `-pa "..."` | Combine `-a` and `-p` |
|
|
47
|
+
| `--provider <name>`, `-P <name>` | One-off provider override. `<name>` matches a preset command (`claude`, `gemini`, `codex`, `opencode`, `llm`, `ollama`). |
|
|
51
48
|
| `--no-commit` | Generate and edit, but skip the `git commit` |
|
|
52
49
|
| `--commit` | Force commit (overrides `commit: false` in config) |
|
|
53
50
|
| `--require-edit` | Refuse to commit if the saved message is byte-identical to what the AI produced |
|
|
@@ -104,6 +101,7 @@ The wizard ships with presets for:
|
|
|
104
101
|
- **Claude Code** — `claude -p "{prompt}"` (reads diff from stdin)
|
|
105
102
|
- **Gemini CLI** — `gemini -p "{prompt}"`
|
|
106
103
|
- **Codex CLI** — `codex exec --skip-git-repo-check "{prompt}"`
|
|
104
|
+
- **OpenCode** — `opencode run "{prompt}"`
|
|
107
105
|
- **llm** (Simon Willison) — `llm "{prompt}"`
|
|
108
106
|
- **Ollama** — `ollama run llama3 "{prompt}"`
|
|
109
107
|
- **Custom** — type your own `command` and `args`
|
package/bin/git-aic.js
CHANGED
|
@@ -18,6 +18,7 @@ import { extractCommitMessage } from "./extract.js";
|
|
|
18
18
|
import { runProvider } from "./run-provider.js";
|
|
19
19
|
import { applyUserOverrides, getConfiguration } from "./prompts.js";
|
|
20
20
|
import { getConfigPath, loadConfig } from "./get-config-path.js";
|
|
21
|
+
import { PROVIDER_PRESETS } from "./presets.js";
|
|
21
22
|
|
|
22
23
|
function fail(message, code = 1) {
|
|
23
24
|
console.error(message);
|
|
@@ -38,6 +39,7 @@ function parseArgs(argv) {
|
|
|
38
39
|
let printConfig = false;
|
|
39
40
|
let runInit = false;
|
|
40
41
|
let shouldAdd = false;
|
|
42
|
+
let providerName = null;
|
|
41
43
|
|
|
42
44
|
for (let i = 0; i < argv.length; i++) {
|
|
43
45
|
const arg = argv[i];
|
|
@@ -58,6 +60,20 @@ function parseArgs(argv) {
|
|
|
58
60
|
continue;
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
if (arg === "--provider" || arg === "-P") {
|
|
64
|
+
const next = argv[i + 1];
|
|
65
|
+
if (!next || next.startsWith("-")) {
|
|
66
|
+
console.log("Available providers:");
|
|
67
|
+
for (const p of PROVIDER_PRESETS) {
|
|
68
|
+
console.log(` ${p.command.padEnd(10)} ${p.name}`);
|
|
69
|
+
}
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
providerName = next;
|
|
73
|
+
i++;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
61
77
|
if (arg === "--no-commit") {
|
|
62
78
|
shouldCommit = false;
|
|
63
79
|
continue;
|
|
@@ -92,9 +108,11 @@ function parseArgs(argv) {
|
|
|
92
108
|
console.log(`
|
|
93
109
|
Usage:
|
|
94
110
|
git aic
|
|
95
|
-
git aic -a
|
|
111
|
+
git aic -a # stage all changes first (git add -A)
|
|
96
112
|
git aic -p "extra prompt"
|
|
97
|
-
git aic -ap "extra prompt"
|
|
113
|
+
git aic -ap "extra prompt" # combine -a and -p
|
|
114
|
+
git aic --provider gemini # one-off provider override (also -P)
|
|
115
|
+
git aic --provider # list available providers
|
|
98
116
|
git aic --no-commit
|
|
99
117
|
git aic --config
|
|
100
118
|
git aic --init
|
|
@@ -105,7 +123,8 @@ Examples:
|
|
|
105
123
|
git aic -p "prefer docs(specs), mention Asset Management API"
|
|
106
124
|
git aic -ap "mention Asset Management API"
|
|
107
125
|
git aic --no-commit -p "only generate the message"
|
|
108
|
-
git aic --
|
|
126
|
+
git aic --provider claude # use Claude Code for this run
|
|
127
|
+
git aic --init # interactive config wizard
|
|
109
128
|
|
|
110
129
|
Config:
|
|
111
130
|
~/.config/git-aic/config.json
|
|
@@ -126,6 +145,7 @@ Environment:
|
|
|
126
145
|
printConfig,
|
|
127
146
|
runInit,
|
|
128
147
|
shouldAdd,
|
|
148
|
+
providerName,
|
|
129
149
|
};
|
|
130
150
|
}
|
|
131
151
|
|
|
@@ -163,6 +183,18 @@ try {
|
|
|
163
183
|
|
|
164
184
|
applyUserOverrides(config);
|
|
165
185
|
|
|
186
|
+
if (args.providerName) {
|
|
187
|
+
const wanted = args.providerName.toLowerCase();
|
|
188
|
+
const preset = PROVIDER_PRESETS.find(
|
|
189
|
+
(p) => p.command.toLowerCase() === wanted
|
|
190
|
+
);
|
|
191
|
+
if (!preset) {
|
|
192
|
+
const names = PROVIDER_PRESETS.map((p) => p.command).join(", ");
|
|
193
|
+
fail(`Unknown provider: ${args.providerName}. Available: ${names}`);
|
|
194
|
+
}
|
|
195
|
+
config.provider = { command: preset.command, args: preset.args };
|
|
196
|
+
}
|
|
197
|
+
|
|
166
198
|
if (args.printConfig) {
|
|
167
199
|
console.log(getConfigPath());
|
|
168
200
|
console.log(JSON.stringify(config, null, 2));
|
|
@@ -199,6 +231,8 @@ if (diff.status !== 0) {
|
|
|
199
231
|
|
|
200
232
|
const prompt = buildPrompt(args.extraPrompt);
|
|
201
233
|
|
|
234
|
+
console.log(`Using provider: ${config.provider.command}`);
|
|
235
|
+
|
|
202
236
|
let raw;
|
|
203
237
|
try {
|
|
204
238
|
raw = runProvider(config.provider, prompt, diff.stdout);
|
package/bin/presets.js
CHANGED
|
@@ -14,6 +14,11 @@ export const PROVIDER_PRESETS = [
|
|
|
14
14
|
command: "codex",
|
|
15
15
|
args: ["exec", "--skip-git-repo-check", "{prompt}"]
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
name: "OpenCode",
|
|
19
|
+
command: "opencode",
|
|
20
|
+
args: ["run", "{prompt}"]
|
|
21
|
+
},
|
|
17
22
|
{
|
|
18
23
|
name: "llm (Simon Willison)",
|
|
19
24
|
command: "llm",
|