@hifullmoon/aicommit 1.5.1 → 2.0.1
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/.aicommit.config.example.json +30 -10
- package/CHANGELOG.md +24 -1
- package/README.md +43 -41
- package/README.zh-CN.md +68 -66
- package/SECURITY.md +1 -1
- package/docs/distribution.md +3 -38
- package/docs/privacy.md +8 -8
- package/docs/provider-presets.md +22 -9
- package/docs/troubleshooting.md +0 -1
- package/package.json +2 -3
- package/presets/provider-presets.json +48 -15
- package/schemas/aicommit-provider-presets.schema.json +24 -4
- package/src/cli.js +38 -7
- package/src/completion.js +4 -1
- package/src/config-command.js +7 -5
- package/src/config.js +198 -26
- package/src/doctor.js +5 -3
- package/src/main.js +29 -6
- package/src/provider-presets.js +43 -15
- package/src/setup.js +66 -37
- package/src/ui.js +66 -13
|
@@ -1,40 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
+
"schemaVersion": 1,
|
|
2
3
|
"defaultProvider": "minimax",
|
|
3
4
|
"providers": {
|
|
4
5
|
"minimax": {
|
|
5
6
|
"providerType": "minimax",
|
|
6
7
|
"apiUrl": "https://api.minimaxi.com/v1/chat/completions",
|
|
7
8
|
"apiKeyEnv": "MINIMAX_API_KEY",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
"defaultModel": "default",
|
|
10
|
+
"models": {
|
|
11
|
+
"default": {
|
|
12
|
+
"modelId": "MiniMax-M3",
|
|
13
|
+
"extraBody": {
|
|
14
|
+
"thinking": {
|
|
15
|
+
"type": "disabled"
|
|
16
|
+
},
|
|
17
|
+
"reasoning_split": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
21
|
},
|
|
16
22
|
"deepseek": {
|
|
17
23
|
"providerType": "deepseek",
|
|
18
24
|
"apiUrl": "https://api.deepseek.com/v1/chat/completions",
|
|
19
25
|
"apiKeyEnv": "DEEPSEEK_API_KEY",
|
|
20
|
-
"
|
|
26
|
+
"defaultModel": "chat",
|
|
27
|
+
"models": {
|
|
28
|
+
"chat": { "modelId": "deepseek-v4-flash" }
|
|
29
|
+
}
|
|
21
30
|
},
|
|
22
31
|
"openrouter": {
|
|
23
32
|
"providerType": "openrouter",
|
|
24
33
|
"apiUrl": "https://openrouter.ai/api/v1/chat/completions",
|
|
25
34
|
"apiKeyEnv": "OPENROUTER_API_KEY",
|
|
26
|
-
"
|
|
35
|
+
"defaultModel": "fast",
|
|
36
|
+
"models": {
|
|
37
|
+
"fast": { "modelId": "openai/gpt-4o-mini" },
|
|
38
|
+
"quality": { "modelId": "openai/gpt-4o" }
|
|
39
|
+
}
|
|
27
40
|
},
|
|
28
41
|
"kimi-code": {
|
|
29
42
|
"providerType": "custom",
|
|
30
43
|
"apiUrl": "https://api.kimi.com/coding/v1/chat/completions",
|
|
31
44
|
"apiKeyEnv": "KIMI_API_KEY",
|
|
32
|
-
"
|
|
45
|
+
"defaultModel": "default",
|
|
46
|
+
"models": {
|
|
47
|
+
"default": { "modelId": "kimi-for-coding" }
|
|
48
|
+
}
|
|
33
49
|
},
|
|
34
50
|
"ollama": {
|
|
35
51
|
"providerType": "ollama",
|
|
36
52
|
"apiUrl": "http://127.0.0.1:11434/api/chat",
|
|
37
|
-
"
|
|
53
|
+
"defaultModel": "qwen",
|
|
54
|
+
"models": {
|
|
55
|
+
"qwen": { "modelId": "qwen3:8b" },
|
|
56
|
+
"deepseek": { "modelId": "deepseek-r1:14b" }
|
|
57
|
+
}
|
|
38
58
|
}
|
|
39
59
|
},
|
|
40
60
|
"language": "en",
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,27 @@ This file lists notable user-facing changes. Internal refactors, test-only chang
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.0.1] - 2026-08-27
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Made tag-only workflow validation portable across LF and CRLF checkouts.
|
|
12
|
+
|
|
13
|
+
## [2.0.0] - 2026-08-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added named model profiles per provider, with model selection available in setup and through `--model`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **Breaking:** user configuration now requires `schemaVersion: 1`, an explicit `defaultProvider`, and provider-level `defaultModel`/`models` maps; legacy flat and provider-level `modelId` configurations must be migrated with `aicommit setup`.
|
|
22
|
+
- Provider preset manifests now use schema version 2 with named model maps and explicit default models.
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
- Removed the Homebrew distribution channel; install and upgrade AICommit through npm.
|
|
27
|
+
|
|
7
28
|
## [1.5.1] - 2026-08-27
|
|
8
29
|
|
|
9
30
|
### Fixed
|
|
@@ -111,6 +132,8 @@ This file lists notable user-facing changes. Internal refactors, test-only chang
|
|
|
111
132
|
- Added file-level split planning and execution with Git-state concurrency checks.
|
|
112
133
|
- Added provider presets and user/project configuration boundaries.
|
|
113
134
|
|
|
114
|
-
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/
|
|
135
|
+
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/v2.0.1...HEAD
|
|
136
|
+
[2.0.1]: https://github.com/hi-fullmoon/AICommit/releases/tag/v2.0.1
|
|
137
|
+
[2.0.0]: https://github.com/hi-fullmoon/AICommit/releases/tag/v2.0.0
|
|
115
138
|
[1.5.1]: https://github.com/hi-fullmoon/AICommit/releases/tag/v1.5.1
|
|
116
139
|
[1.5.0]: https://github.com/hi-fullmoon/AICommit/releases/tag/v1.5.0
|
package/README.md
CHANGED
|
@@ -30,16 +30,9 @@ These screenshots were captured from real interactive terminal sessions in this
|
|
|
30
30
|
npm install --global @hifullmoon/aicommit
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Or install with Homebrew:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
brew tap hi-fullmoon/aicommit https://github.com/hi-fullmoon/AICommit.git
|
|
37
|
-
brew install hi-fullmoon/aicommit/aicommit
|
|
38
|
-
```
|
|
39
|
-
|
|
40
33
|
Requires Node.js >= 18.
|
|
41
34
|
|
|
42
|
-
See the bilingual [installation, upgrade, signature-verification, and rollback guide](docs/distribution.md).
|
|
35
|
+
See the bilingual [installation, upgrade, signature-verification, and rollback guide](docs/distribution.md). The npm package has an automated installation smoke test.
|
|
43
36
|
|
|
44
37
|
To install a source checkout instead, run `npm install --global .` from the repository root.
|
|
45
38
|
|
|
@@ -51,7 +44,7 @@ The fastest way is the interactive wizard:
|
|
|
51
44
|
aicommit setup
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
It walks you through picking a provider from the active versioned preset manifest (bundled presets include OpenAI, DeepSeek, OpenRouter, MiniMax, Kimi Code, and Ollama) or entering a custom OpenAI-compatible endpoint, then entering your API key
|
|
47
|
+
It walks you through picking a provider from the active versioned preset manifest (bundled presets include OpenAI, DeepSeek, OpenRouter, MiniMax, Kimi Code, and Ollama) or entering a custom OpenAI-compatible endpoint, then entering your API key and one or more models, choosing a default model and commit language, and optionally testing the connection. Configuration is written atomically to the user config (`~/.aicommit.config.json`); a malformed or old-format existing file is backed up before replacement.
|
|
55
48
|
|
|
56
49
|
To configure by hand, start from [.aicommit.config.example.json](.aicommit.config.example.json). User config is loaded first, then allow-listed generation preferences from `./.aicommit.config.json` are deep-merged over it. Project config may set `language`, `commitPolicy`, `stripFiles`, `temperature`, and lower diff/token/timeout or repository-context ceilings. A project-owned `prompt` is ignored unless the user config explicitly sets `allowProjectPrompt: true`. Connection/provider fields (including `apiKeyEnv`), reasoning request controls, unknown keys, and attempts to raise a ceiling are ignored with a warning. This prevents a cloned repository from redirecting an authenticated request or silently increasing its cost/data scope.
|
|
57
50
|
|
|
@@ -59,56 +52,59 @@ To keep a key out of the JSON file, set `"apiKeyEnv": "OPENAI_API_KEY"` (and lea
|
|
|
59
52
|
|
|
60
53
|
AICommit can also read from the Git credential helper already configured on your OS. Enable `credentialHelper.enabled`, store the provider credential through your normal Git/OS credential workflow, and AICommit will call `git credential fill` without prompting. The lookup username defaults to `aicommit` and can be changed with `credentialHelper.username`. Credential resolution order is environment variable → Git credential helper → plaintext user config → keyless localhost. A project config cannot enable a helper or select a credential source.
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
Each provider owns one or more named model profiles. Switch providers with `-p` / `--provider` and models within that provider with `-m` / `--model`:
|
|
63
56
|
|
|
64
57
|
```json
|
|
65
58
|
{
|
|
59
|
+
"schemaVersion": 1,
|
|
66
60
|
"defaultProvider": "minimax",
|
|
67
|
-
|
|
68
61
|
"providers": {
|
|
69
62
|
"minimax": {
|
|
70
63
|
"providerType": "minimax",
|
|
71
64
|
"apiUrl": "https://api.minimaxi.com/v1/chat/completions",
|
|
72
65
|
"apiKeyEnv": "MINIMAX_API_KEY",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
66
|
+
"defaultModel": "default",
|
|
67
|
+
"models": {
|
|
68
|
+
"default": {
|
|
69
|
+
"label": "MiniMax M3",
|
|
70
|
+
"modelId": "MiniMax-M3",
|
|
71
|
+
"extraBody": {
|
|
72
|
+
"thinking": { "type": "disabled" },
|
|
73
|
+
"reasoning_split": true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
78
|
"deepseek": {
|
|
80
79
|
"providerType": "deepseek",
|
|
81
80
|
"apiUrl": "https://api.deepseek.com/v1/chat/completions",
|
|
82
81
|
"apiKeyEnv": "DEEPSEEK_API_KEY",
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"apiKeyEnv": "OPENROUTER_API_KEY",
|
|
89
|
-
"modelId": "openai/gpt-4o-mini"
|
|
90
|
-
},
|
|
91
|
-
"kimi-code": {
|
|
92
|
-
"providerType": "custom",
|
|
93
|
-
"apiUrl": "https://api.kimi.com/coding/v1/chat/completions",
|
|
94
|
-
"apiKeyEnv": "KIMI_API_KEY",
|
|
95
|
-
"modelId": "kimi-for-coding"
|
|
82
|
+
"defaultModel": "chat",
|
|
83
|
+
"models": {
|
|
84
|
+
"chat": { "modelId": "deepseek-v4-flash" },
|
|
85
|
+
"reasoner": { "modelId": "deepseek-v4-pro" }
|
|
86
|
+
}
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
90
|
```
|
|
100
91
|
|
|
101
|
-
|
|
92
|
+
`schemaVersion`, `defaultProvider`, `providers`, and every provider's `providerType`, `apiUrl`, `defaultModel`, and non-empty `models` map are required. Without `-p`, AICommit selects `defaultProvider`; without `-m`, it selects that provider's `defaultModel`. Model profiles inherit global generation settings and provider connection settings, then may override `temperature`, `maxTokens`, `timeoutMs`, `reasoning`, and `extraBody`. Provider and model names are stable local aliases; `modelId` is the identifier sent to the API.
|
|
93
|
+
|
|
94
|
+
This is the only supported user-config shape. Earlier flat or provider-level `modelId` configurations are rejected; run `aicommit setup` or migrate them explicitly.
|
|
102
95
|
|
|
103
96
|
| Key | Description |
|
|
104
97
|
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
98
|
+
| `schemaVersion` | Required user-config schema version; currently `1` |
|
|
99
|
+
| `providers` | Named provider configs; each contains connection settings, `defaultModel`, and a non-empty `models` map |
|
|
100
|
+
| `defaultProvider` | Required provider alias used when `-p` is not given |
|
|
107
101
|
| `apiUrl` | OpenAI-compatible chat completions endpoint |
|
|
108
102
|
| `apiKey` | API key (empty string allowed for local models) |
|
|
109
103
|
| `apiKeyEnv` | Environment variable containing the API key; takes precedence over `apiKey` (default: empty) |
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
104
|
+
| `providerType` | Required adapter: `openai`, `openrouter`, `deepseek`, `minimax`, `ollama`, `custom`, or a user-installed `extension:<id>` |
|
|
105
|
+
| `defaultModel` | Required model alias used when `-m` is not given |
|
|
106
|
+
| `models` | Named model profiles under one provider |
|
|
107
|
+
| `modelId` | Required API model identifier inside each model profile |
|
|
112
108
|
| `commitPolicy` | Versioned commit rules for types, scope, subject length, body, breaking changes, and language |
|
|
113
109
|
| `prompt` | Optional user-approved guidance appended to the authoritative structured policy (default: empty) |
|
|
114
110
|
| `allowProjectPrompt` | User-owned opt-in for accepting `prompt` from project config (default: `false`) |
|
|
@@ -128,8 +124,8 @@ The selected provider's values are deep-merged over the top-level keys, so share
|
|
|
128
124
|
| `diffContextLines` | Context lines around each diff hunk (`git diff --unified=<n>`); lower values mean fewer tokens (default: `1`) |
|
|
129
125
|
| `stripFiles` | Extra files to stub out of the diff like lock files, matched by basename with `*`/`?` wildcards, e.g. `["*.min.js", "*.map", "*.snap"]` (default: `[]`; project-level entries are merged with user-level ones, not replaced) |
|
|
130
126
|
| `regenerateWithDiff` | `true` re-sends the full diff on every regenerate for more varied rewrites; `false` (default) only asks the model to reword its previous message, which is far cheaper |
|
|
131
|
-
| `extraBody` |
|
|
132
|
-
| `reasoning` |
|
|
127
|
+
| `extraBody` | Model-profile JSON fields merged into the request body, except `model`/`messages` (default: `{}`) |
|
|
128
|
+
| `reasoning` | Global or model-profile reasoning controls: `mode`, `effort`, `maxTokens`, and `maxDisplayChars`; defaults to `mode: "on"` and streams reasoning automatically |
|
|
133
129
|
|
|
134
130
|
Works with OpenAI, DeepSeek, [OpenRouter](https://openrouter.ai), MiniMax, [Kimi Code](https://www.kimi.com/code/docs/), Ollama (native `/api/chat` or OpenAI-compatible `/v1/chat/completions`), LiteLLM, and other compatible endpoints. HTTPS is required for remote endpoints; plaintext HTTP is accepted only for localhost/loopback.
|
|
135
131
|
|
|
@@ -143,13 +139,17 @@ export KIMI_API_KEY='your-kimi-code-api-key'
|
|
|
143
139
|
|
|
144
140
|
```json
|
|
145
141
|
{
|
|
142
|
+
"schemaVersion": 1,
|
|
146
143
|
"defaultProvider": "kimi-code",
|
|
147
144
|
"providers": {
|
|
148
145
|
"kimi-code": {
|
|
149
146
|
"providerType": "custom",
|
|
150
147
|
"apiUrl": "https://api.kimi.com/coding/v1/chat/completions",
|
|
151
148
|
"apiKeyEnv": "KIMI_API_KEY",
|
|
152
|
-
"
|
|
149
|
+
"defaultModel": "default",
|
|
150
|
+
"models": {
|
|
151
|
+
"default": { "modelId": "kimi-for-coding" }
|
|
152
|
+
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
@@ -296,6 +296,7 @@ aicommit --reasoning=low # stream low-effort reasoning; Ctrl+O expands/collapses
|
|
|
296
296
|
aicommit --no-reasoning # explicitly disable reasoning when supported
|
|
297
297
|
aicommit -l zh # commit message language
|
|
298
298
|
aicommit -p deepseek # switch to the "deepseek" provider
|
|
299
|
+
aicommit -p deepseek -m reasoner # use its "reasoner" model profile
|
|
299
300
|
aicommit --yes --output=json # emit one schema-validated JSON result on stdout
|
|
300
301
|
aicommit -h # help
|
|
301
302
|
```
|
|
@@ -304,6 +305,7 @@ aicommit -h # help
|
|
|
304
305
|
| ------------------ | ---------------------------------------------------------------------------- |
|
|
305
306
|
| `-l`, `--lang` | Commit message language (`zh` or `en`) |
|
|
306
307
|
| `-p`, `--provider` | Use the named provider from `providers` |
|
|
308
|
+
| `-m`, `--model` | Use a named model profile from the selected provider |
|
|
307
309
|
| `--split-hunks` | Opt in to experimental same-file text-hunk planning; disabled by default |
|
|
308
310
|
| `--scope` | `staged` or `all` scope for `aicommit split` and `aicommit split plan` |
|
|
309
311
|
| `--file` | JSON plan path for `aicommit split plan` and `aicommit split apply` |
|
|
@@ -317,7 +319,7 @@ aicommit -h # help
|
|
|
317
319
|
|
|
318
320
|
### Configuration inspection
|
|
319
321
|
|
|
320
|
-
`aicommit config show|validate|path` can run outside a repository and accepts an optional target directory. `show` applies the same user/project/team-policy trust filtering and provider selection as commit generation, but recursively masks secrets. `validate` parses, merges, and validates configuration without reading environment credentials or invoking Git credential helpers, making `aicommit config validate --output=json` safe for CI. `path` reports user config, project config, and team-policy locations even when a config file is malformed. `show` and `validate` accept `--provider=<name>`.
|
|
322
|
+
`aicommit config show|validate|path` can run outside a repository and accepts an optional target directory. `show` applies the same user/project/team-policy trust filtering and provider/model selection as commit generation, but recursively masks secrets. `validate` parses, merges, and validates configuration without reading environment credentials or invoking Git credential helpers, making `aicommit config validate --output=json` safe for CI. `path` reports user config, project config, and team-policy locations even when a config file is malformed. `show` and `validate` accept `--provider=<name>` and `--model=<name>`.
|
|
321
323
|
|
|
322
324
|
### Shell completion
|
|
323
325
|
|
|
@@ -378,11 +380,11 @@ Stable process exits are shared by text and JSON modes:
|
|
|
378
380
|
|
|
379
381
|
### Diagnostics
|
|
380
382
|
|
|
381
|
-
`aicommit doctor` checks the running Node.js and Git versions, loaded config sources, endpoint security, selected adapter capabilities, redacted credential source, and a live provider connection. It prints source labels such as `env:OPENAI_API_KEY`, `git credential helper`, or `keyless localhost`, never the credential value. Endpoint userinfo, credential-like query parameters, and fragments are also redacted from normal output and credential-resolution errors. Use `aicommit doctor -p <
|
|
383
|
+
`aicommit doctor` checks the running Node.js and Git versions, loaded config sources, endpoint security, selected adapter capabilities, redacted credential source, and a live provider connection. It prints source labels such as `env:OPENAI_API_KEY`, `git credential helper`, or `keyless localhost`, never the credential value. Endpoint userinfo, credential-like query parameters, and fragments are also redacted from normal output and credential-resolution errors. Use `aicommit doctor -p <provider> -m <model>` to select a configured provider/model pair or `aicommit doctor --output=json` in automation.
|
|
382
384
|
|
|
383
|
-
For stable error categories,
|
|
385
|
+
For stable error categories, npm verification failures, split recovery, preset compatibility, and extension isolation failures, use the bilingual [troubleshooting matrix](docs/troubleshooting.md).
|
|
384
386
|
|
|
385
|
-
Flow: reads the staged diff, sends it to the AI, then lets you **accept** (Enter), **edit** (`e`), or **cancel** (`n`). If nothing is staged but the working tree has unstaged or untracked changes, aicommit offers to stage them for you — all at once (`git add -A`) or file by file — before continuing. Once anything is staged, that index snapshot is authoritative; other working-tree changes are left untouched.
|
|
387
|
+
Flow: reads the staged diff, sends it to the AI, then lets you **accept** (Enter), **edit** (`e`), or **cancel** (`n`). In interactive selection prompts, `q` exits immediately. If nothing is staged but the working tree has unstaged or untracked changes, aicommit offers to stage them for you — all at once (`git add -A`) or file by file — before continuing. Once anything is staged, that index snapshot is authoritative; other working-tree changes are left untouched.
|
|
386
388
|
|
|
387
389
|
`--dry-run` follows the same review flow but stops before `git commit`. Any staging performed by aicommit is restored before it exits. Cancellation and failures use the same index transaction; if another process changed the index concurrently, aicommit leaves it untouched instead of overwriting that work.
|
|
388
390
|
|
|
@@ -419,7 +421,7 @@ Split remains file-level by default. `--split-hunks` opts in to experimental sam
|
|
|
419
421
|
|
|
420
422
|
## Development and releases
|
|
421
423
|
|
|
422
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for local development and pull-request checks, [SECURITY.md](SECURITY.md) for private vulnerability reporting, [RELEASING.md](RELEASING.md) for the maintainer process, and the bilingual [distribution guide](docs/distribution.md) for npm
|
|
424
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for local development and pull-request checks, [SECURITY.md](SECURITY.md) for private vulnerability reporting, [RELEASING.md](RELEASING.md) for the maintainer process, and the bilingual [distribution guide](docs/distribution.md) for npm installation and rollback. Releases use npm Trusted Publishing with provenance and publish the exact verified package tarball. `npm run eval` runs the anonymous local quality corpus covering single and mixed changes, renames, generated files, long diffs, Chinese/English output, and malformed weak-model candidates; it is also part of `npm run ci`.
|
|
423
425
|
|
|
424
426
|
## License
|
|
425
427
|
|
package/README.zh-CN.md
CHANGED
|
@@ -32,16 +32,9 @@ AI 驱动的 Git 提交信息生成器:读取 diff,请 AI 模型生成符合
|
|
|
32
32
|
npm install --global @hifullmoon/aicommit
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
或使用 Homebrew:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
brew tap hi-fullmoon/aicommit https://github.com/hi-fullmoon/AICommit.git
|
|
39
|
-
brew install hi-fullmoon/aicommit/aicommit
|
|
40
|
-
```
|
|
41
|
-
|
|
42
35
|
需要 Node.js >= 18。
|
|
43
36
|
|
|
44
|
-
安装、升级、签名校验与回滚请参阅双语[分发指南](docs/distribution.md)。npm
|
|
37
|
+
安装、升级、签名校验与回滚请参阅双语[分发指南](docs/distribution.md)。npm package 带有自动化安装冒烟测试。
|
|
45
38
|
|
|
46
39
|
如需直接安装源码检出版本,请在仓库根目录运行 `npm install --global .`。
|
|
47
40
|
|
|
@@ -53,7 +46,7 @@ brew install hi-fullmoon/aicommit/aicommit
|
|
|
53
46
|
aicommit setup
|
|
54
47
|
```
|
|
55
48
|
|
|
56
|
-
向导会引导你从当前生效的版本化预设清单中选择 Provider(内置预设包括 OpenAI、DeepSeek、OpenRouter、MiniMax、Kimi Code 和 Ollama),或填写自定义 OpenAI 兼容端点;随后输入 API Key
|
|
49
|
+
向导会引导你从当前生效的版本化预设清单中选择 Provider(内置预设包括 OpenAI、DeepSeek、OpenRouter、MiniMax、Kimi Code 和 Ollama),或填写自定义 OpenAI 兼容端点;随后输入 API Key 和一个或多个模型、选择默认模型和提交信息语言,并可选测试连接。配置会原子写入用户配置文件 `~/.aicommit.config.json`;如果已有文件格式错误或属于旧格式,替换前会先备份。
|
|
57
50
|
|
|
58
51
|
如需手动配置,请从 [.aicommit.config.example.json](.aicommit.config.example.json) 开始。AICommit 先加载用户配置,再将 `./.aicommit.config.json` 中白名单内的生成偏好深度合并到用户配置之上。项目配置可以设置 `language`、`commitPolicy`、`stripFiles`、`temperature`,也可以降低 diff、token、timeout 或仓库上下文上限。项目拥有的 `prompt` 默认会被忽略,除非用户配置明确设置 `allowProjectPrompt: true`。连接或 Provider 字段(包括 `apiKeyEnv`)、推理请求控制、未知字段,以及任何试图提高上限的配置,都会被忽略并给出警告。这样可以防止克隆的仓库重定向已鉴权请求,或在不知情的情况下扩大成本和数据范围。
|
|
59
52
|
|
|
@@ -61,77 +54,80 @@ aicommit setup
|
|
|
61
54
|
|
|
62
55
|
AICommit 也可以读取操作系统上已经配置的 Git credential helper。启用 `credentialHelper.enabled`,通过常规 Git/系统凭据流程保存 Provider 凭据,AICommit 就会在不弹出输入提示的情况下调用 `git credential fill`。查询用户名默认为 `aicommit`,可通过 `credentialHelper.username` 修改。凭据解析顺序为:环境变量 → Git credential helper → 用户配置中的明文凭据 → 无密钥 localhost。项目配置不能启用 credential helper,也不能选择凭据来源。
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
每个 Provider 可以拥有多个命名模型配置。通过 `-p` / `--provider` 切换 Provider,通过 `-m` / `--model` 选择该 Provider 下的模型:
|
|
65
58
|
|
|
66
59
|
```json
|
|
67
60
|
{
|
|
61
|
+
"schemaVersion": 1,
|
|
68
62
|
"defaultProvider": "minimax",
|
|
69
|
-
|
|
70
63
|
"providers": {
|
|
71
64
|
"minimax": {
|
|
72
65
|
"providerType": "minimax",
|
|
73
66
|
"apiUrl": "https://api.minimaxi.com/v1/chat/completions",
|
|
74
67
|
"apiKeyEnv": "MINIMAX_API_KEY",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
68
|
+
"defaultModel": "default",
|
|
69
|
+
"models": {
|
|
70
|
+
"default": {
|
|
71
|
+
"label": "MiniMax M3",
|
|
72
|
+
"modelId": "MiniMax-M3",
|
|
73
|
+
"extraBody": {
|
|
74
|
+
"thinking": { "type": "disabled" },
|
|
75
|
+
"reasoning_split": true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
79
78
|
}
|
|
80
79
|
},
|
|
81
80
|
"deepseek": {
|
|
82
81
|
"providerType": "deepseek",
|
|
83
82
|
"apiUrl": "https://api.deepseek.com/v1/chat/completions",
|
|
84
83
|
"apiKeyEnv": "DEEPSEEK_API_KEY",
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"apiKeyEnv": "OPENROUTER_API_KEY",
|
|
91
|
-
"modelId": "openai/gpt-4o-mini"
|
|
92
|
-
},
|
|
93
|
-
"kimi-code": {
|
|
94
|
-
"providerType": "custom",
|
|
95
|
-
"apiUrl": "https://api.kimi.com/coding/v1/chat/completions",
|
|
96
|
-
"apiKeyEnv": "KIMI_API_KEY",
|
|
97
|
-
"modelId": "kimi-for-coding"
|
|
84
|
+
"defaultModel": "chat",
|
|
85
|
+
"models": {
|
|
86
|
+
"chat": { "modelId": "deepseek-v4-flash" },
|
|
87
|
+
"reasoner": { "modelId": "deepseek-v4-pro" }
|
|
88
|
+
}
|
|
98
89
|
}
|
|
99
90
|
}
|
|
100
91
|
}
|
|
101
92
|
```
|
|
102
93
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
94
|
+
`schemaVersion`、`defaultProvider`、`providers`,以及每个 Provider 的 `providerType`、`apiUrl`、`defaultModel` 和非空 `models` 都是必填项。未指定 `-p` 时选择 `defaultProvider`;未指定 `-m` 时选择该 Provider 的 `defaultModel`。模型配置会继承全局生成设置和 Provider 连接设置,并可覆盖 `temperature`、`maxTokens`、`timeoutMs`、`reasoning` 与 `extraBody`。Provider 名和模型名是稳定的本地别名,`modelId` 才是发送给 API 的模型标识。
|
|
95
|
+
|
|
96
|
+
这是唯一支持的用户配置格式。旧版扁平配置或 Provider 级 `modelId` 会被直接拒绝;请运行 `aicommit setup` 或显式迁移。
|
|
97
|
+
|
|
98
|
+
| 配置项 | 说明 |
|
|
99
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `schemaVersion` | 必填的用户配置 schema 版本,当前为 `1` |
|
|
101
|
+
| `providers` | 命名 Provider 配置;每项包含连接设置、`defaultModel` 和非空 `models` |
|
|
102
|
+
| `defaultProvider` | 必填;未指定 `-p` 时使用的 Provider 别名 |
|
|
103
|
+
| `apiUrl` | OpenAI 兼容的 Chat Completions 端点 |
|
|
104
|
+
| `apiKey` | API Key;本地模型允许使用空字符串 |
|
|
105
|
+
| `apiKeyEnv` | 保存 API Key 的环境变量名,优先于 `apiKey`(默认:空) |
|
|
106
|
+
| `providerType` | 必填适配器:`openai`、`openrouter`、`deepseek`、`minimax`、`ollama`、`custom` 或用户安装的 `extension:<id>` |
|
|
107
|
+
| `defaultModel` | 必填;未指定 `-m` 时使用的模型别名 |
|
|
108
|
+
| `models` | 一个 Provider 下的命名模型配置 |
|
|
109
|
+
| `modelId` | 每个模型配置中必填的 API 模型标识 |
|
|
110
|
+
| `commitPolicy` | 版本化提交规则:type、scope、主题长度、正文、破坏性变更和语言 |
|
|
111
|
+
| `prompt` | 用户批准的可选指导,追加到权威结构化策略之后(默认:空) |
|
|
112
|
+
| `allowProjectPrompt` | 是否接受项目配置中的 `prompt`,只能由用户配置启用(默认:`false`) |
|
|
113
|
+
| `repositoryContext` | 近期提交、包边界、可信约定和 commitlint 检测的总预算与分类预算 |
|
|
114
|
+
| `language` | 提交信息语言:`zh` 或 `en`(默认:`zh`) |
|
|
115
|
+
| `temperature` | 采样温度(默认:`0.3`) |
|
|
116
|
+
| `maxTokens` | 最大响应 token 数(默认:`1024`) |
|
|
117
|
+
| `timeoutMs` | 单次请求超时,单位为毫秒(默认:`120000`) |
|
|
118
|
+
| `retry` | 瞬时错误重试限制:`maxAttempts`、`baseDelayMs`、`maxDelayMs`(默认:`3`、`500`、`5000`) |
|
|
119
|
+
| `credentialHelper` | 通过 `enabled` 和 `username` 选择性启用 `git credential fill`(默认:`false`、`aicommit`) |
|
|
120
|
+
| `metrics` | 仅本地指标控制:`enabled`、绝对路径 `path`(空表示默认路径)、`maxEntries`(默认:`true`、空、`500`) |
|
|
121
|
+
| `extensions` | 用户拥有的绝对扩展清单路径,以及执行超时和上下文上限;项目配置不能启用或重定向扩展 |
|
|
122
|
+
| `maxDiffChars` | 单次发送给模型的 diff 字符数;超限后改为 `--stat` 摘要和截断的 hunk(默认:`30000`) |
|
|
123
|
+
| `maxFileDiffChars` | 单文件 diff 上限;超限文件只保留前部 hunk,避免一个大文件挤占全部上下文(默认:`3000`) |
|
|
124
|
+
| `splitMaxDiffChars` | 拆分规划请求的 diff 字符数;规划阶段需要的 hunk 细节少于最终信息生成(默认:`16000`) |
|
|
125
|
+
| `splitMaxPlanFiles` | 交给拆分规划器的最大变更文件数;超出部分归入兜底提交(默认:`100`) |
|
|
126
|
+
| `diffContextLines` | 每个 diff hunk 周围的上下文行数(`git diff --unified=<n>`);越小越节省 token(默认:`1`) |
|
|
127
|
+
| `stripFiles` | 额外替换为占位的文件,按 basename 使用 `*` / `?` 通配,如 `["*.min.js", "*.map", "*.snap"]`(默认:`[]`;项目项与用户项合并而非覆盖) |
|
|
128
|
+
| `regenerateWithDiff` | `true` 表示每次重写都重发完整 diff,以获得更多变化;`false`(默认)只要求模型改写上一条消息,成本更低 |
|
|
129
|
+
| `extraBody` | 模型配置中合并到请求体的 JSON 字段,但不允许覆盖 `model` / `messages`(默认:`{}`) |
|
|
130
|
+
| `reasoning` | 全局或模型级推理控制:`mode`、`effort`、`maxTokens` 和 `maxDisplayChars`;默认为 `mode: "on"`,并自动流式展示推理 |
|
|
135
131
|
|
|
136
132
|
AICommit 支持 OpenAI、DeepSeek、[OpenRouter](https://openrouter.ai)、MiniMax、[Kimi Code](https://www.kimi.com/code/docs/)、Ollama(原生 `/api/chat` 或 OpenAI 兼容 `/v1/chat/completions`)、LiteLLM,以及其他兼容端点。远程端点必须使用 HTTPS;明文 HTTP 只允许 localhost / loopback。
|
|
137
133
|
|
|
@@ -145,13 +141,17 @@ export KIMI_API_KEY='your-kimi-code-api-key'
|
|
|
145
141
|
|
|
146
142
|
```json
|
|
147
143
|
{
|
|
144
|
+
"schemaVersion": 1,
|
|
148
145
|
"defaultProvider": "kimi-code",
|
|
149
146
|
"providers": {
|
|
150
147
|
"kimi-code": {
|
|
151
148
|
"providerType": "custom",
|
|
152
149
|
"apiUrl": "https://api.kimi.com/coding/v1/chat/completions",
|
|
153
150
|
"apiKeyEnv": "KIMI_API_KEY",
|
|
154
|
-
"
|
|
151
|
+
"defaultModel": "default",
|
|
152
|
+
"models": {
|
|
153
|
+
"default": { "modelId": "kimi-for-coding" }
|
|
154
|
+
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -298,6 +298,7 @@ aicommit --reasoning=low # 流式显示低强度推理;Ctrl+O 展开或收起
|
|
|
298
298
|
aicommit --no-reasoning # Provider / 模型支持时显式关闭推理
|
|
299
299
|
aicommit -l zh # 提交信息语言
|
|
300
300
|
aicommit -p deepseek # 切换到名为 "deepseek" 的 Provider
|
|
301
|
+
aicommit -p deepseek -m reasoner # 使用其中名为 "reasoner" 的模型配置
|
|
301
302
|
aicommit --yes --output=json # 向 stdout 输出一个通过 schema 校验的 JSON 结果
|
|
302
303
|
aicommit -h # 帮助
|
|
303
304
|
```
|
|
@@ -306,6 +307,7 @@ aicommit -h # 帮助
|
|
|
306
307
|
| ------------------ | ------------------------------------------------------------------- |
|
|
307
308
|
| `-l`, `--lang` | 提交信息语言:`zh` 或 `en` |
|
|
308
309
|
| `-p`, `--provider` | 使用 `providers` 中的命名 Provider |
|
|
310
|
+
| `-m`, `--model` | 使用所选 Provider 下的命名模型配置 |
|
|
309
311
|
| `--split-hunks` | 启用实验性同文件文本 hunk 规划;默认关闭 |
|
|
310
312
|
| `--scope` | `aicommit split` 和 `aicommit split plan` 的范围:`staged` 或 `all` |
|
|
311
313
|
| `--file` | `aicommit split plan` 和 `aicommit split apply` 的 JSON 计划路径 |
|
|
@@ -319,7 +321,7 @@ aicommit -h # 帮助
|
|
|
319
321
|
|
|
320
322
|
### 配置检查
|
|
321
323
|
|
|
322
|
-
`aicommit config show|validate|path` 可以在仓库外运行,并接受可选目标目录。`show` 使用与提交生成相同的用户 / 项目 / 团队策略信任过滤和 Provider
|
|
324
|
+
`aicommit config show|validate|path` 可以在仓库外运行,并接受可选目标目录。`show` 使用与提交生成相同的用户 / 项目 / 团队策略信任过滤和 Provider / 模型选择,但会递归遮蔽秘密。`validate` 在不读取环境凭据、不调用 Git credential helper 的情况下解析、合并并校验配置,因此 `aicommit config validate --output=json` 可安全用于 CI。即使配置文件格式错误,`path` 仍会报告用户配置、项目配置和团队策略路径。`show` 与 `validate` 都接受 `--provider=<name>` 和 `--model=<name>`。
|
|
323
325
|
|
|
324
326
|
### Shell 补全
|
|
325
327
|
|
|
@@ -380,11 +382,11 @@ aicommit completion fish > ~/.config/fish/completions/aicommit.fish
|
|
|
380
382
|
|
|
381
383
|
### 诊断
|
|
382
384
|
|
|
383
|
-
`aicommit doctor` 会检查当前 Node.js 与 Git 版本、已加载的配置来源、端点安全、所选适配器能力、脱敏后的凭据来源,以及实时 Provider 连接。它会显示 `env:OPENAI_API_KEY`、`git credential helper`、`keyless localhost` 等来源标签,但绝不会显示凭据值。端点 userinfo、疑似凭据的查询参数和 URL fragment 也会从正常输出及凭据解析错误中脱敏。使用 `aicommit doctor -p <
|
|
385
|
+
`aicommit doctor` 会检查当前 Node.js 与 Git 版本、已加载的配置来源、端点安全、所选适配器能力、脱敏后的凭据来源,以及实时 Provider 连接。它会显示 `env:OPENAI_API_KEY`、`git credential helper`、`keyless localhost` 等来源标签,但绝不会显示凭据值。端点 userinfo、疑似凭据的查询参数和 URL fragment 也会从正常输出及凭据解析错误中脱敏。使用 `aicommit doctor -p <provider> -m <model>` 选择已配置的 Provider / 模型组合,或在自动化中使用 `aicommit doctor --output=json`。
|
|
384
386
|
|
|
385
|
-
稳定错误分类、
|
|
387
|
+
稳定错误分类、npm 校验失败、split 恢复、预设兼容和扩展隔离错误,请参阅双语[故障排查矩阵](docs/troubleshooting.md)。
|
|
386
388
|
|
|
387
|
-
基本流程:读取暂存 diff,发送给 AI,然后让你选择**接受**(Enter)、**编辑**(`e`)或**取消**(`n
|
|
389
|
+
基本流程:读取暂存 diff,发送给 AI,然后让你选择**接受**(Enter)、**编辑**(`e`)或**取消**(`n`)。在交互式选择提示中,按 `q` 会立即退出。如果没有暂存内容,但工作区存在未暂存或未跟踪变更,AICommit 会先询问是否为你暂存——可以一次性执行 `git add -A`,也可以逐文件选择——然后继续。一旦存在暂存内容,就以该 index 快照为准,其余工作区变更保持不动。
|
|
388
390
|
|
|
389
391
|
`--dry-run` 使用相同审阅流程,但会在 `git commit` 前停止。AICommit 在执行期间做出的任何暂存操作都会在退出前恢复。取消和失败也使用同一 index 事务;如果另一个进程并发修改了 index,AICommit 会保持其现状,不会覆盖对方的工作。
|
|
390
392
|
|
|
@@ -421,7 +423,7 @@ split 默认仍按文件拆分。`--split-hunks` 可选择性启用实验性的
|
|
|
421
423
|
|
|
422
424
|
## 开发与发布
|
|
423
425
|
|
|
424
|
-
本地开发和 Pull Request 检查请参阅 [CONTRIBUTING.md](CONTRIBUTING.md),私密漏洞报告请参阅 [SECURITY.md](SECURITY.md),维护者发布流程请参阅 [RELEASING.md](RELEASING.md),npm
|
|
426
|
+
本地开发和 Pull Request 检查请参阅 [CONTRIBUTING.md](CONTRIBUTING.md),私密漏洞报告请参阅 [SECURITY.md](SECURITY.md),维护者发布流程请参阅 [RELEASING.md](RELEASING.md),npm 安装和用户回滚请参阅双语[分发指南](docs/distribution.md)。发布通过 npm Trusted Publishing 生成 provenance,并发布经过校验的精确 package tarball。`npm run eval` 会运行匿名本地质量语料,覆盖单一与混合变更、rename、生成文件、长 diff、中英文输出和格式错误的弱模型候选;该命令也是 `npm run ci` 的一部分。
|
|
425
427
|
|
|
426
428
|
## 许可证
|
|
427
429
|
|
package/SECURITY.md
CHANGED
|
@@ -24,7 +24,7 @@ AICommit is a local CLI that sends selected repository context directly to the c
|
|
|
24
24
|
- common sensitive content should be detected and protected before the default model request;
|
|
25
25
|
- remote endpoints must use HTTPS, while plaintext HTTP is limited to loopback development services.
|
|
26
26
|
- third-party extension API v1 must deny resolved credential access, run out of process with a sanitized environment, and fail instead of falling back to unsandboxed execution;
|
|
27
|
-
- npm releases must use Trusted Publishing provenance
|
|
27
|
+
- npm releases must use Trusted Publishing provenance.
|
|
28
28
|
|
|
29
29
|
Sensitive-content detection is intentionally a defense in depth and cannot replace a dedicated secret scanner. Interactive users can explicitly choose to send original content after a warning. Review the selected endpoint and diff before doing so.
|
|
30
30
|
|