@hifullmoon/aicommit 2.0.0 → 2.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/.aicommit.config.example.json +0 -10
- package/CHANGELOG.md +24 -1
- package/README.md +11 -36
- package/README.zh-CN.md +11 -36
- package/SECURITY.md +0 -1
- package/bin/aicommit.js +0 -18
- package/docs/distribution.md +1 -1
- package/docs/privacy.md +18 -20
- package/docs/provider-compatibility.md +13 -25
- package/docs/team-policy.md +2 -2
- package/docs/troubleshooting.md +16 -19
- package/package.json +1 -1
- package/src/api.js +3 -20
- package/src/cli.js +16 -130
- package/src/completion.js +1 -16
- package/src/config-command.js +24 -6
- package/src/config-paths.js +31 -0
- package/src/config.js +22 -42
- package/src/doctor.js +1 -12
- package/src/git.js +1 -1
- package/src/main.js +2 -26
- package/src/provider-presets.js +5 -95
- package/src/providers.js +5 -6
- package/src/setup.js +18 -4
- package/src/split.js +4 -119
- package/src/utils.js +1 -1
- package/docs/examples/extension/aicommit-extension.json +0 -9
- package/docs/examples/extension/index.mjs +0 -32
- package/docs/extensions.md +0 -93
- package/docs/provider-presets.md +0 -113
- package/schemas/aicommit-extension.schema.json +0 -27
- package/src/extension-runner.mjs +0 -36
- package/src/extensions.js +0 -426
- package/src/metrics.js +0 -375
- package/src/preset-command.js +0 -91
|
@@ -112,16 +112,6 @@
|
|
|
112
112
|
"enabled": false,
|
|
113
113
|
"username": "aicommit"
|
|
114
114
|
},
|
|
115
|
-
"metrics": {
|
|
116
|
-
"enabled": true,
|
|
117
|
-
"path": "",
|
|
118
|
-
"maxEntries": 500
|
|
119
|
-
},
|
|
120
|
-
"extensions": {
|
|
121
|
-
"manifests": [],
|
|
122
|
-
"timeoutMs": 3000,
|
|
123
|
-
"maxContextChars": 2000
|
|
124
|
-
},
|
|
125
115
|
"maxDiffChars": 30000,
|
|
126
116
|
"maxFileDiffChars": 3000,
|
|
127
117
|
"splitMaxDiffChars": 16000,
|
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.1.0] - 2026-08-27
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Made quality and cross-platform compatibility checks blocking prerequisites of npm publishing in the single tag-triggered release workflow.
|
|
12
|
+
- Moved user configuration to `~/.aicommit/config.json` with legacy-path compatibility; project configuration remains `./.aicommit.config.json`.
|
|
13
|
+
- Simplified the primary help and documentation around the everyday setup, doctor, commit, and file-level split workflows; automation and team-policy commands are now presented as advanced tools.
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
- Removed local run metrics and the `stats` command; aicommit no longer creates `~/.aicommit/metrics.jsonl`.
|
|
18
|
+
- Removed executable extensions and extension-backed provider adapters to reduce the trusted-code and compatibility surface.
|
|
19
|
+
- Removed user-installable provider preset lifecycle commands; setup now uses the validated defaults shipped with each aicommit release.
|
|
20
|
+
- Removed the experimental `--split-hunks` planning entry point. Existing versioned hunk plan artifacts remain readable for recovery and compatibility.
|
|
21
|
+
|
|
22
|
+
## [2.0.1] - 2026-08-27
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Made tag-only workflow validation portable across LF and CRLF checkouts.
|
|
27
|
+
|
|
7
28
|
## [2.0.0] - 2026-08-27
|
|
8
29
|
|
|
9
30
|
### Added
|
|
@@ -126,7 +147,9 @@ This file lists notable user-facing changes. Internal refactors, test-only chang
|
|
|
126
147
|
- Added file-level split planning and execution with Git-state concurrency checks.
|
|
127
148
|
- Added provider presets and user/project configuration boundaries.
|
|
128
149
|
|
|
129
|
-
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/v2.
|
|
150
|
+
[Unreleased]: https://github.com/hi-fullmoon/AICommit/compare/v2.1.0...HEAD
|
|
151
|
+
[2.1.0]: https://github.com/hi-fullmoon/AICommit/releases/tag/v2.1.0
|
|
152
|
+
[2.0.1]: https://github.com/hi-fullmoon/AICommit/releases/tag/v2.0.1
|
|
130
153
|
[2.0.0]: https://github.com/hi-fullmoon/AICommit/releases/tag/v2.0.0
|
|
131
154
|
[1.5.1]: https://github.com/hi-fullmoon/AICommit/releases/tag/v1.5.1
|
|
132
155
|
[1.5.0]: https://github.com/hi-fullmoon/AICommit/releases/tag/v1.5.0
|
package/README.md
CHANGED
|
@@ -44,9 +44,9 @@ The fastest way is the interactive wizard:
|
|
|
44
44
|
aicommit setup
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
It walks you through
|
|
47
|
+
It walks you through choosing built-in provider defaults (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. The legacy `~/.aicommit.config.json` path remains readable and `aicommit setup` migrates its settings to the canonical path when saving.
|
|
48
48
|
|
|
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.
|
|
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 the project config at `./.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.
|
|
50
50
|
|
|
51
51
|
To keep a key out of the JSON file, set `"apiKeyEnv": "OPENAI_API_KEY"` (and leave `apiKey` empty), or enter `env:OPENAI_API_KEY` in the setup wizard. Environment variables take priority over every other credential source and are recommended for CI and other stateless environments.
|
|
52
52
|
|
|
@@ -101,7 +101,7 @@ This is the only supported user-config shape. Earlier flat or provider-level `mo
|
|
|
101
101
|
| `apiUrl` | OpenAI-compatible chat completions endpoint |
|
|
102
102
|
| `apiKey` | API key (empty string allowed for local models) |
|
|
103
103
|
| `apiKeyEnv` | Environment variable containing the API key; takes precedence over `apiKey` (default: empty) |
|
|
104
|
-
| `providerType` | Required adapter: `openai`, `openrouter`, `deepseek`, `minimax`, `ollama`,
|
|
104
|
+
| `providerType` | Required adapter: `openai`, `openrouter`, `deepseek`, `minimax`, `ollama`, or `custom` |
|
|
105
105
|
| `defaultModel` | Required model alias used when `-m` is not given |
|
|
106
106
|
| `models` | Named model profiles under one provider |
|
|
107
107
|
| `modelId` | Required API model identifier inside each model profile |
|
|
@@ -115,8 +115,6 @@ This is the only supported user-config shape. Earlier flat or provider-level `mo
|
|
|
115
115
|
| `timeoutMs` | Per-request timeout in milliseconds (default: `120000`) |
|
|
116
116
|
| `retry` | Transient retry limits: `maxAttempts`, `baseDelayMs`, and `maxDelayMs` (defaults: `3`, `500`, and `5000`) |
|
|
117
117
|
| `credentialHelper` | Opt in to `git credential fill` with `enabled` and `username` (defaults: `false` and `aicommit`) |
|
|
118
|
-
| `metrics` | Local-only metrics controls: `enabled`, absolute `path` or empty for the default, and `maxEntries` (defaults: `true`, empty, and `500`) |
|
|
119
|
-
| `extensions` | User-owned absolute manifest paths plus execution timeout/context ceiling; repository config cannot enable or redirect extensions |
|
|
120
118
|
| `maxDiffChars` | Diff chars sent to the model per call; oversized diffs become a `--stat` summary + truncated hunks (default: `30000`) |
|
|
121
119
|
| `maxFileDiffChars` | Cap on a single file's diff section; bigger sections are truncated to their leading hunks so one huge file can't crowd out the rest (default: `3000`) |
|
|
122
120
|
| `splitMaxDiffChars` | Diff chars sent to the split-planning call; split mode needs less hunk detail than final message generation (default: `16000`) |
|
|
@@ -163,7 +161,7 @@ aicommit doctor -p kimi-code
|
|
|
163
161
|
|
|
164
162
|
`kimi-for-coding` is available to all Kimi Code membership tiers and follows the service's rolling model upgrades. Kimi Code membership keys use `api.kimi.com`; Kimi Platform pay-as-you-go keys use a different endpoint and are not interchangeable.
|
|
165
163
|
|
|
166
|
-
See the bilingual [provider compatibility table](docs/provider-compatibility.md) for streaming, reasoning, token-budget, usage,
|
|
164
|
+
See the bilingual [provider compatibility table](docs/provider-compatibility.md) for streaming, reasoning, token-budget, usage, and authentication boundaries.
|
|
167
165
|
|
|
168
166
|
### Repository policy and bounded context
|
|
169
167
|
|
|
@@ -217,22 +215,9 @@ Every provider adapter maps the same generation contract: messages, streaming, r
|
|
|
217
215
|
|
|
218
216
|
Requests retry only transient failures: HTTP 429, recoverable 5xx responses, network interruption, and interrupted response bodies. Retries are bounded by `retry.maxAttempts`, use capped exponential backoff, and honor `Retry-After` when present. Authentication, invalid-parameter, and content-safety failures are returned immediately without retrying.
|
|
219
217
|
|
|
220
|
-
###
|
|
218
|
+
### Built-in provider defaults
|
|
221
219
|
|
|
222
|
-
Setup
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
aicommit preset show
|
|
226
|
-
aicommit preset validate --file=provider-presets.json
|
|
227
|
-
aicommit preset install --file=provider-presets.json
|
|
228
|
-
aicommit preset rollback
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
The active user manifest is `~/.aicommit/provider-presets.json`; each update keeps the previous valid version for rollback. Manifests declare their own semantic version, supported core range, and adapter-contract version, and cannot contain credentials. Core prerelease versions and build metadata are parsed using SemVer rules; build metadata does not affect compatibility ordering. See the bilingual [preset compatibility/update guide](docs/provider-presets.md) and [published schema](schemas/aicommit-provider-presets.schema.json).
|
|
232
|
-
|
|
233
|
-
### Credential-denied extensions
|
|
234
|
-
|
|
235
|
-
Three minimal extension interfaces are available: bounded repository context, commit-message validation, and provider request/response adaptation. User-installed single-file ESM extensions run outside the CLI process under Node's permission model and declare `credentials: false`; they receive neither resolved credentials nor inherited secret environment variables. Repository config cannot install or select extension code. Node.js 20+ is required only when executable extensions are enabled; the core CLI remains compatible with Node.js 18. See the bilingual [extension contract, security model, and executable example](docs/extensions.md), plus the [manifest schema](schemas/aicommit-extension.schema.json).
|
|
220
|
+
Setup uses validated provider defaults shipped with AICommit. For another OpenAI-compatible service, add a named provider directly to the user config; no separate manifest installation or third-party executable code is required.
|
|
236
221
|
|
|
237
222
|
### Saving tokens
|
|
238
223
|
|
|
@@ -245,9 +230,9 @@ Token spend per call is dominated by the diff; aicommit already strips lock file
|
|
|
245
230
|
|
|
246
231
|
## Privacy and data flow
|
|
247
232
|
|
|
248
|
-
The bilingual [privacy model](docs/privacy.md) maps
|
|
233
|
+
The bilingual [privacy model](docs/privacy.md) maps the local process, provider, credential, and distribution trust boundaries. The summary below covers the default runtime path.
|
|
249
234
|
|
|
250
|
-
AICommit has no hosted backend and
|
|
235
|
+
AICommit has no hosted backend and does not record or upload usage metrics. At runtime it only makes generation requests to the `apiUrl` selected from your user-owned provider configuration. The API key is sent to that endpoint as authorization; verify custom endpoints before trusting them with credentials or repository content.
|
|
251
236
|
|
|
252
237
|
Commit-generation requests can contain:
|
|
253
238
|
|
|
@@ -260,11 +245,7 @@ Commit-generation requests can contain:
|
|
|
260
245
|
|
|
261
246
|
AICommit does not intentionally send unrelated repository files, historical commit bodies, environment variables, or its local configuration file. Every selected diff, path list, history sample, preview, and convention excerpt is placed inside an explicit JSON envelope marked as untrusted data; the authoritative system policy instructs the model never to follow embedded repository instructions. Lock files, configured `stripFiles`, oversized sections, common sensitive filenames, private-key material, cloud access-key IDs, and credential-like assignments are omitted, truncated, or redacted before the default request. The interactive warning still allows explicitly sending the original diff, so review that choice carefully. Detection and prompt boundaries are guardrails, not complete secret or prompt-injection defenses.
|
|
262
247
|
|
|
263
|
-
Project-level configuration is treated as untrusted: it cannot change the endpoint, provider, credentials, retry policy,
|
|
264
|
-
|
|
265
|
-
Successful and failed commit runs write a minimal local JSONL metric by default to `~/.aicommit/metrics.jsonl`. Each record contains exactly duration, normalized token usage, a bounded result category, whether the message was edited, and the rewrite count (including automatic policy correction). It never contains the diff, reasoning, commit message, file names, provider, model, or credentials. The file retains the newest 500 records by default and is written with owner-only permissions where supported.
|
|
266
|
-
|
|
267
|
-
Use `aicommit stats` to view first-pass acceptance, edit/rewrite/failure rates, P50/P95 latency, token totals, and recent-vs-previous trends. After ten successful runs it compares two chronological baseline windows and reports progress toward the roadmap's 20% relative edit/rewrite-rate improvement target. `aicommit stats clear|enable|disable` manages the same local store; clearing is permanent. Set `metrics.enabled` to `false`, choose an absolute `metrics.path`, or change `metrics.maxEntries` in the user config. Project config cannot override these settings, and there is no upload implementation.
|
|
248
|
+
Project-level configuration is treated as untrusted: it cannot change the endpoint, provider, credentials, retry policy, reasoning request controls, or increase user-configured data/cost ceilings. Prefer `apiKeyEnv` or the OS-backed Git credential helper for credentials. The setup wizard can save a literal key in the user config when requested; that file is written atomically with owner-only permissions where the OS supports them.
|
|
268
249
|
|
|
269
250
|
## Usage
|
|
270
251
|
|
|
@@ -275,14 +256,11 @@ aicommit config show # show the effective config with secrets redacted
|
|
|
275
256
|
aicommit config validate # validate config without resolving credentials
|
|
276
257
|
aicommit config path # print user and project config paths
|
|
277
258
|
aicommit completion bash # generate Bash completion on stdout
|
|
278
|
-
aicommit stats # show local quality, latency, and token trends
|
|
279
|
-
aicommit stats clear # permanently clear local metric history
|
|
280
259
|
aicommit # generate & commit in current directory
|
|
281
260
|
aicommit /path/to/repo # or a target directory
|
|
282
261
|
aicommit split # choose staged/all scope, then split logical commits
|
|
283
262
|
aicommit split --scope=staged # split only the reviewed index snapshot
|
|
284
263
|
aicommit split --scope=all # split the complete working-tree snapshot
|
|
285
|
-
aicommit split --scope=staged --split-hunks # experimental same-file hunk splitting
|
|
286
264
|
aicommit --dry-run # generate and review without creating a commit
|
|
287
265
|
aicommit split --dry-run # review a split plan without creating commits
|
|
288
266
|
aicommit --yes # non-interactively commit already staged changes
|
|
@@ -306,7 +284,6 @@ aicommit -h # help
|
|
|
306
284
|
| `-l`, `--lang` | Commit message language (`zh` or `en`) |
|
|
307
285
|
| `-p`, `--provider` | Use the named provider from `providers` |
|
|
308
286
|
| `-m`, `--model` | Use a named model profile from the selected provider |
|
|
309
|
-
| `--split-hunks` | Opt in to experimental same-file text-hunk planning; disabled by default |
|
|
310
287
|
| `--scope` | `staged` or `all` scope for `aicommit split` and `aicommit split plan` |
|
|
311
288
|
| `--file` | JSON plan path for `aicommit split plan` and `aicommit split apply` |
|
|
312
289
|
| `--dry-run` | Generate and review a message or split plan without creating commits |
|
|
@@ -382,7 +359,7 @@ Stable process exits are shared by text and JSON modes:
|
|
|
382
359
|
|
|
383
360
|
`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.
|
|
384
361
|
|
|
385
|
-
For stable error categories, npm verification failures,
|
|
362
|
+
For stable error categories, npm verification failures, provider configuration, and split recovery, use the bilingual [troubleshooting matrix](docs/troubleshooting.md).
|
|
386
363
|
|
|
387
364
|
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.
|
|
388
365
|
|
|
@@ -411,14 +388,12 @@ When reasoning mode is `on` (including via `--reasoning=<level>`), aicommit requ
|
|
|
411
388
|
|
|
412
389
|
### Split mode
|
|
413
390
|
|
|
414
|
-
`aicommit split` (also available as the explicit `aicommit split run`) asks whether to group the staged index snapshot or all staged, unstaged, and untracked changes into logical commits. Use `--scope=staged` or `--scope=all` when the boundary must be explicit, including every non-interactive run. You can review the plan, regenerate messages for selected groups, or edit the plan as JSON before committing.
|
|
391
|
+
`aicommit split` (also available as the explicit `aicommit split run`) asks whether to group the staged index snapshot or all staged, unstaged, and untracked changes into file-level logical commits. Use `--scope=staged` or `--scope=all` when the boundary must be explicit, including every non-interactive run. You can review the plan, regenerate messages for selected groups, or edit the plan as JSON before committing. Sensitive-content detection fails closed before a non-interactive provider request or automatic staging.
|
|
415
392
|
|
|
416
393
|
For an auditable two-step flow, `aicommit split plan --scope=staged|all --file=<path>` exports a versioned JSON artifact, and `aicommit split apply --file=<path>` rechecks its base commit, change set, and content fingerprint before touching the index. Keep plan files outside the worktree or under `.git` so they cannot become part of their own plan.
|
|
417
394
|
|
|
418
395
|
Execution uses temporary indexes and a code-free checkpoint under `.git/aicommit`. A hook, Git error, interruption, or crash leaves completed commits in history and preserves the pending snapshot; the failure report shows checkpointed, in-flight, pending, and current worktree/index state. Resolve the cause and run `aicommit split resume`. Resume reconciles the possible post-commit crash window before creating anything else, so a completed group is neither duplicated nor omitted. If you intentionally finished or replaced the interrupted work through another Git workflow, run `aicommit split abort`; it removes only the stale checkpoint and never rewrites HEAD, the index, or the worktree. New committing split runs detect a checkpoint before contacting the provider. If planning or preflight fails before the first group, no split commit is created and the real index remains unchanged.
|
|
419
396
|
|
|
420
|
-
Split remains file-level by default. `--split-hunks` opts in to experimental same-file splitting for tracked text modifications with multiple unified-diff hunks. The JSON plan and checkpoint store only hunk IDs, line ranges, and hashes—not patch content. Before the first commit, AICommit applies every selected patch to a temporary index and requires the final tree to reproduce the captured target blobs exactly; parsing, patching, binary/mode-change, or lossless-validation failures fall back to a file-level plan. The worktree is never modified by hunk execution.
|
|
421
|
-
|
|
422
397
|
## Development and releases
|
|
423
398
|
|
|
424
399
|
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`.
|
package/README.zh-CN.md
CHANGED
|
@@ -46,9 +46,9 @@ npm install --global @hifullmoon/aicommit
|
|
|
46
46
|
aicommit setup
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
向导会引导你选择内置 Provider 默认值(OpenAI、DeepSeek、OpenRouter、MiniMax、Kimi Code 和 Ollama),或填写自定义 OpenAI 兼容端点;随后输入 API Key 和一个或多个模型、选择默认模型和提交信息语言,并可选测试连接。配置会原子写入用户配置文件 `~/.aicommit/config.json`;如果已有文件格式错误或属于旧格式,替换前会先备份。旧路径 `~/.aicommit.config.json` 仍可读取,运行 `aicommit setup` 并保存时会把其中设置迁移到规范路径。
|
|
50
50
|
|
|
51
|
-
如需手动配置,请从 [.aicommit.config.example.json](.aicommit.config.example.json) 开始。AICommit
|
|
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`)、推理请求控制、未知字段,以及任何试图提高上限的配置,都会被忽略并给出警告。这样可以防止克隆的仓库重定向已鉴权请求,或在不知情的情况下扩大成本和数据范围。
|
|
52
52
|
|
|
53
53
|
如需避免把密钥写入 JSON,请设置 `"apiKeyEnv": "OPENAI_API_KEY"`(并将 `apiKey` 留空),或在 setup 向导中输入 `env:OPENAI_API_KEY`。环境变量优先于所有其他凭据来源,推荐用于 CI 和其他无状态环境。
|
|
54
54
|
|
|
@@ -103,7 +103,7 @@ AICommit 也可以读取操作系统上已经配置的 Git credential helper。
|
|
|
103
103
|
| `apiUrl` | OpenAI 兼容的 Chat Completions 端点 |
|
|
104
104
|
| `apiKey` | API Key;本地模型允许使用空字符串 |
|
|
105
105
|
| `apiKeyEnv` | 保存 API Key 的环境变量名,优先于 `apiKey`(默认:空) |
|
|
106
|
-
| `providerType` | 必填适配器:`openai`、`openrouter`、`deepseek`、`minimax`、`ollama
|
|
106
|
+
| `providerType` | 必填适配器:`openai`、`openrouter`、`deepseek`、`minimax`、`ollama` 或 `custom` |
|
|
107
107
|
| `defaultModel` | 必填;未指定 `-m` 时使用的模型别名 |
|
|
108
108
|
| `models` | 一个 Provider 下的命名模型配置 |
|
|
109
109
|
| `modelId` | 每个模型配置中必填的 API 模型标识 |
|
|
@@ -117,8 +117,6 @@ AICommit 也可以读取操作系统上已经配置的 Git credential helper。
|
|
|
117
117
|
| `timeoutMs` | 单次请求超时,单位为毫秒(默认:`120000`) |
|
|
118
118
|
| `retry` | 瞬时错误重试限制:`maxAttempts`、`baseDelayMs`、`maxDelayMs`(默认:`3`、`500`、`5000`) |
|
|
119
119
|
| `credentialHelper` | 通过 `enabled` 和 `username` 选择性启用 `git credential fill`(默认:`false`、`aicommit`) |
|
|
120
|
-
| `metrics` | 仅本地指标控制:`enabled`、绝对路径 `path`(空表示默认路径)、`maxEntries`(默认:`true`、空、`500`) |
|
|
121
|
-
| `extensions` | 用户拥有的绝对扩展清单路径,以及执行超时和上下文上限;项目配置不能启用或重定向扩展 |
|
|
122
120
|
| `maxDiffChars` | 单次发送给模型的 diff 字符数;超限后改为 `--stat` 摘要和截断的 hunk(默认:`30000`) |
|
|
123
121
|
| `maxFileDiffChars` | 单文件 diff 上限;超限文件只保留前部 hunk,避免一个大文件挤占全部上下文(默认:`3000`) |
|
|
124
122
|
| `splitMaxDiffChars` | 拆分规划请求的 diff 字符数;规划阶段需要的 hunk 细节少于最终信息生成(默认:`16000`) |
|
|
@@ -165,7 +163,7 @@ aicommit doctor -p kimi-code
|
|
|
165
163
|
|
|
166
164
|
`kimi-for-coding` 对所有 Kimi Code 会员档位开放,并随服务滚动升级模型。Kimi Code 会员 Key 使用 `api.kimi.com`;Kimi 开放平台按量付费 Key 使用不同端点,两者不能混用。
|
|
167
165
|
|
|
168
|
-
流式输出、推理、token 预算、usage
|
|
166
|
+
流式输出、推理、token 预算、usage 和鉴权边界,请参阅双语 [Provider 兼容表](docs/provider-compatibility.md)。
|
|
169
167
|
|
|
170
168
|
### 仓库策略与受限上下文
|
|
171
169
|
|
|
@@ -219,22 +217,9 @@ aicommit policy check --range=origin/main..HEAD --output=json
|
|
|
219
217
|
|
|
220
218
|
请求只对瞬时错误重试:HTTP 429、可恢复的 5xx、网络中断和响应体中断。重试次数受 `retry.maxAttempts` 限制,使用带上限的指数退避,并遵循 `Retry-After`。鉴权、非法参数和内容安全错误会立即返回,不会重试。
|
|
221
219
|
|
|
222
|
-
###
|
|
220
|
+
### 内置 Provider 默认值
|
|
223
221
|
|
|
224
|
-
setup
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
aicommit preset show
|
|
228
|
-
aicommit preset validate --file=provider-presets.json
|
|
229
|
-
aicommit preset install --file=provider-presets.json
|
|
230
|
-
aicommit preset rollback
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
当前用户清单位于 `~/.aicommit/provider-presets.json`;每次更新都会保留上一份有效版本,以便回滚。清单声明自己的语义版本、支持的核心版本范围和适配器契约版本,并且不能包含凭据。核心预发布版本和构建元数据按 SemVer 规则解析;构建元数据不影响兼容性排序。参阅双语[预设兼容与更新指南](docs/provider-presets.md)及已发布的 [schema](schemas/aicommit-provider-presets.schema.json)。
|
|
234
|
-
|
|
235
|
-
### 无凭据扩展
|
|
236
|
-
|
|
237
|
-
AICommit 提供三种最小扩展接口:受限仓库上下文、提交信息校验,以及 Provider 请求 / 响应适配。用户安装的单文件 ESM 扩展在 CLI 进程之外、Node 权限模型下运行,并声明 `credentials: false`;扩展既不会收到已解析凭据,也不会继承秘密环境变量。仓库配置不能安装或选择扩展代码。只有启用可执行扩展时才需要 Node.js 20+;核心 CLI 仍兼容 Node.js 18。参阅双语[扩展契约、安全模型和可执行示例](docs/extensions.md),以及[扩展清单 schema](schemas/aicommit-extension.schema.json)。
|
|
222
|
+
setup 使用随 AICommit 一起发布并经过校验的 Provider 默认值。需要其他 OpenAI 兼容服务时,直接在用户配置中增加命名 Provider;无需安装额外清单或执行第三方代码。
|
|
238
223
|
|
|
239
224
|
### 节省 Token
|
|
240
225
|
|
|
@@ -247,9 +232,9 @@ AICommit 提供三种最小扩展接口:受限仓库上下文、提交信息
|
|
|
247
232
|
|
|
248
233
|
## 隐私与数据流
|
|
249
234
|
|
|
250
|
-
双语[隐私模型](docs/privacy.md)描述了本地进程、Provider
|
|
235
|
+
双语[隐私模型](docs/privacy.md)描述了本地进程、Provider、凭据和分发环节的信任边界。下面概述默认运行路径。
|
|
251
236
|
|
|
252
|
-
AICommit
|
|
237
|
+
AICommit 没有托管后端,也不会记录或上传使用指标。运行时只会向用户配置选定的 `apiUrl` 发起生成请求。API Key 会作为鉴权信息发送到该端点;在把凭据或仓库内容交给自定义端点前,请先验证其可信度。
|
|
253
238
|
|
|
254
239
|
提交生成请求可能包含:
|
|
255
240
|
|
|
@@ -262,11 +247,7 @@ AICommit 没有托管后端,也没有指标上传实现。运行时只会向
|
|
|
262
247
|
|
|
263
248
|
AICommit 不会主动发送无关的仓库文件、历史提交正文、环境变量或本地配置文件。每个选中的 diff、路径列表、历史样本、预览和约定摘录都会放入标记为“不可信数据”的显式 JSON 信封;权威 system policy 会要求模型绝不执行仓库内容中嵌入的指令。lock 文件、配置的 `stripFiles`、超大段落、常见敏感文件名、私钥材料、云访问 Key ID 和疑似凭据赋值,会在默认请求前被省略、截断或脱敏。交互警告仍允许你明确发送原始 diff,请谨慎确认。检测规则和 prompt 边界属于安全护栏,不能完全替代秘密扫描或 prompt injection 防护。
|
|
264
249
|
|
|
265
|
-
项目级配置被视为不可信:它不能修改端点、Provider
|
|
266
|
-
|
|
267
|
-
默认情况下,成功和失败的提交运行会向 `~/.aicommit/metrics.jsonl` 写入最小化的本地 JSONL 指标。每条记录只包含耗时、标准化 token 用量、受限结果分类、消息是否被编辑,以及重写次数(包括自动策略修正)。它绝不包含 diff、推理、提交信息、文件名、Provider、模型或凭据。默认只保留最新 500 条记录,并在系统支持时使用仅所有者权限写入。
|
|
268
|
-
|
|
269
|
-
使用 `aicommit stats` 查看首次接受率、编辑 / 重写 / 失败率、P50 / P95 延迟、token 总量,以及近期窗口和前一窗口的趋势。成功运行达到 10 次后,它会比较两个按时间排序的基线窗口,并报告相对于路线图“编辑 / 重写率降低 20%”目标的进度。`aicommit stats clear|enable|disable` 管理同一本地数据;清除操作不可恢复。可以在用户配置中将 `metrics.enabled` 设为 `false`、指定绝对 `metrics.path`,或修改 `metrics.maxEntries`。项目配置不能覆盖这些设置,也不存在上传实现。
|
|
250
|
+
项目级配置被视为不可信:它不能修改端点、Provider、凭据、重试策略、推理请求控制,也不能提高用户配置的数据或成本上限。凭据建议使用 `apiKeyEnv` 或由操作系统保护的 Git credential helper。如果用户明确要求,setup 向导也可以把明文 Key 写入用户配置;在操作系统支持时,该文件会以仅所有者可读写权限原子保存。
|
|
270
251
|
|
|
271
252
|
## 使用方法
|
|
272
253
|
|
|
@@ -277,14 +258,11 @@ aicommit config show # 显示脱敏后的有效配置
|
|
|
277
258
|
aicommit config validate # 校验配置,但不解析凭据
|
|
278
259
|
aicommit config path # 显示用户配置和项目配置路径
|
|
279
260
|
aicommit completion bash # 向 stdout 生成 Bash 补全脚本
|
|
280
|
-
aicommit stats # 显示本地质量、延迟和 token 趋势
|
|
281
|
-
aicommit stats clear # 永久清除本地指标历史
|
|
282
261
|
aicommit # 在当前目录生成提交信息并提交
|
|
283
262
|
aicommit /path/to/repo # 或指定目标目录
|
|
284
263
|
aicommit split # 选择 staged / all 范围并拆分逻辑提交
|
|
285
264
|
aicommit split --scope=staged # 只拆分已审阅的 index 快照
|
|
286
265
|
aicommit split --scope=all # 拆分完整工作区快照
|
|
287
|
-
aicommit split --scope=staged --split-hunks # 实验性同文件 hunk 拆分
|
|
288
266
|
aicommit --dry-run # 生成并审阅,但不创建提交
|
|
289
267
|
aicommit split --dry-run # 审阅拆分计划,但不创建提交
|
|
290
268
|
aicommit --yes # 非交互提交已明确暂存的变更
|
|
@@ -308,7 +286,6 @@ aicommit -h # 帮助
|
|
|
308
286
|
| `-l`, `--lang` | 提交信息语言:`zh` 或 `en` |
|
|
309
287
|
| `-p`, `--provider` | 使用 `providers` 中的命名 Provider |
|
|
310
288
|
| `-m`, `--model` | 使用所选 Provider 下的命名模型配置 |
|
|
311
|
-
| `--split-hunks` | 启用实验性同文件文本 hunk 规划;默认关闭 |
|
|
312
289
|
| `--scope` | `aicommit split` 和 `aicommit split plan` 的范围:`staged` 或 `all` |
|
|
313
290
|
| `--file` | `aicommit split plan` 和 `aicommit split apply` 的 JSON 计划路径 |
|
|
314
291
|
| `--dry-run` | 生成并审阅消息或拆分计划,但不创建提交 |
|
|
@@ -384,7 +361,7 @@ aicommit completion fish > ~/.config/fish/completions/aicommit.fish
|
|
|
384
361
|
|
|
385
362
|
`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`。
|
|
386
363
|
|
|
387
|
-
稳定错误分类、npm 校验失败、split
|
|
364
|
+
稳定错误分类、npm 校验失败、Provider 配置和 split 恢复问题,请参阅双语[故障排查矩阵](docs/troubleshooting.md)。
|
|
388
365
|
|
|
389
366
|
基本流程:读取暂存 diff,发送给 AI,然后让你选择**接受**(Enter)、**编辑**(`e`)或**取消**(`n`)。在交互式选择提示中,按 `q` 会立即退出。如果没有暂存内容,但工作区存在未暂存或未跟踪变更,AICommit 会先询问是否为你暂存——可以一次性执行 `git add -A`,也可以逐文件选择——然后继续。一旦存在暂存内容,就以该 index 快照为准,其余工作区变更保持不动。
|
|
390
367
|
|
|
@@ -413,14 +390,12 @@ aicommit completion fish > ~/.config/fish/completions/aicommit.fish
|
|
|
413
390
|
|
|
414
391
|
### 拆分提交模式
|
|
415
392
|
|
|
416
|
-
`aicommit split`(也可以显式写成 `aicommit split run`)会询问是对暂存 index
|
|
393
|
+
`aicommit split`(也可以显式写成 `aicommit split run`)会询问是对暂存 index 快照分组,还是对全部已暂存、未暂存和未跟踪变更做文件级分组。边界必须明确时请使用 `--scope=staged` 或 `--scope=all`,所有非交互运行都应显式指定范围。提交前可以审阅计划、为选中的组重新生成消息,或直接编辑 JSON 计划。敏感内容检测会在非交互 Provider 请求或自动暂存前 fail closed。
|
|
417
394
|
|
|
418
395
|
如需可审计的两步流程,使用 `aicommit split plan --scope=staged|all --file=<path>` 导出版本化 JSON 工件,再用 `aicommit split apply --file=<path>` 在接触 index 前重新校验 base commit、变更集和内容指纹。计划文件应保存在工作区之外或 `.git` 下,避免被纳入自身计划。
|
|
419
396
|
|
|
420
397
|
执行过程使用临时 index,并在 `.git/aicommit` 下保存不含代码内容的 checkpoint。hook、Git 错误、中断或崩溃发生后,已完成提交仍保留在历史中,待处理快照也会保留;失败报告会显示已 checkpoint、执行中、待处理,以及当前工作区 / index 状态。解决问题后运行 `aicommit split resume`。恢复流程会先协调“提交完成后崩溃”的可能窗口,再创建任何新提交,因此不会重复或遗漏已完成分组。如果你通过其他 Git 流程有意完成或替换了中断工作,请运行 `aicommit split abort`;它只删除过期 checkpoint,绝不会改写 HEAD、index 或工作区。新的 split 提交流程会在联系 Provider 前检测现有 checkpoint。如果规划或预检在第一组之前失败,不会创建任何 split 提交,真实 index 也保持不变。
|
|
421
398
|
|
|
422
|
-
split 默认仍按文件拆分。`--split-hunks` 可选择性启用实验性的同文件拆分,适用于包含多个 unified-diff hunk 的 tracked 文本修改。JSON 计划和 checkpoint 只保存 hunk ID、行范围和哈希,不保存 patch 内容。第一次提交前,AICommit 会把每个选中 patch 应用到临时 index,并要求最终 tree 精确还原捕获的目标 blob;解析、patch、二进制 / mode-change 或无损校验失败时会退回文件级计划。hunk 执行绝不会修改工作区。
|
|
423
|
-
|
|
424
399
|
## 开发与发布
|
|
425
400
|
|
|
426
401
|
本地开发和 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` 的一部分。
|
package/SECURITY.md
CHANGED
|
@@ -23,7 +23,6 @@ AICommit is a local CLI that sends selected repository context directly to the c
|
|
|
23
23
|
- untrusted diff, file, model, and reasoning text must not execute terminal control sequences;
|
|
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
|
-
- 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
26
|
- npm releases must use Trusted Publishing provenance.
|
|
28
27
|
|
|
29
28
|
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.
|
package/bin/aicommit.js
CHANGED
|
@@ -6,10 +6,8 @@ import { main } from '../src/main.js';
|
|
|
6
6
|
import { sanitizeTerminalText } from '../src/utils.js';
|
|
7
7
|
import { classifyError } from '../src/errors.js';
|
|
8
8
|
import { errorOutput, isJsonOutputRequested, successOutput } from '../src/output.js';
|
|
9
|
-
import { recordMetric } from '../src/metrics.js';
|
|
10
9
|
|
|
11
10
|
const jsonOutput = isJsonOutputRequested();
|
|
12
|
-
const runStartedAt = performance.now();
|
|
13
11
|
if (jsonOutput) {
|
|
14
12
|
// Keep stdout as a strict one-object machine channel. Existing progress UI
|
|
15
13
|
// remains useful diagnostics, but is redirected to stderr in JSON mode.
|
|
@@ -18,13 +16,6 @@ if (jsonOutput) {
|
|
|
18
16
|
|
|
19
17
|
try {
|
|
20
18
|
const result = await main();
|
|
21
|
-
await recordMetric({
|
|
22
|
-
durationMs: result?.latencyMs ?? performance.now() - runStartedAt,
|
|
23
|
-
usage: result?.usage,
|
|
24
|
-
result: result?.committed ? 'committed' : result?.exitReason || 'success',
|
|
25
|
-
edited: result?.edited,
|
|
26
|
-
rewrites: result?.rewrites,
|
|
27
|
-
}).catch((err) => console.error(` ⚠ Failed to write local metrics: ${err.message}`));
|
|
28
19
|
if (jsonOutput) process.stdout.write(`${JSON.stringify(successOutput(result))}\n`);
|
|
29
20
|
} catch (err) {
|
|
30
21
|
const classified = classifyError(err);
|
|
@@ -33,15 +24,6 @@ try {
|
|
|
33
24
|
'\n ' + chalk.red(`✗ ${sanitizeTerminalText(classified.message || classified)}\n`),
|
|
34
25
|
);
|
|
35
26
|
}
|
|
36
|
-
await recordMetric({
|
|
37
|
-
durationMs: performance.now() - runStartedAt,
|
|
38
|
-
usage: null,
|
|
39
|
-
result: classified.category,
|
|
40
|
-
edited: false,
|
|
41
|
-
rewrites: 0,
|
|
42
|
-
}).catch((metricError) =>
|
|
43
|
-
console.error(` ⚠ Failed to write local metrics: ${metricError.message}`),
|
|
44
|
-
);
|
|
45
27
|
if (jsonOutput) process.stdout.write(`${JSON.stringify(errorOutput(classified))}\n`);
|
|
46
28
|
process.exitCode = classified.exitCode;
|
|
47
29
|
}
|
package/docs/distribution.md
CHANGED
|
@@ -26,7 +26,7 @@ The release workflow uses npm Trusted Publishing without a long-lived `NPM_TOKEN
|
|
|
26
26
|
```bash
|
|
27
27
|
workdir=$(mktemp -d)
|
|
28
28
|
cd "$workdir"
|
|
29
|
-
npm install --package-lock-only @hifullmoon/aicommit@2.
|
|
29
|
+
npm install --package-lock-only @hifullmoon/aicommit@2.1.0
|
|
30
30
|
npm audit signatures
|
|
31
31
|
```
|
|
32
32
|
|
package/docs/privacy.md
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# Privacy model / 隐私模型
|
|
2
2
|
|
|
3
|
-
AICommit is a local CLI, not a hosted relay. Repository data travels directly from the local process to the provider endpoint selected in the user-owned config.
|
|
3
|
+
AICommit is a local CLI, not a hosted relay. Repository data travels directly from the local process to the provider endpoint selected in the user-owned config. The CLI does not record or upload usage metrics.
|
|
4
4
|
|
|
5
|
-
AICommit 是本地 CLI,不是托管中转服务。仓库数据从本地进程直接发送到用户配置选定的 provider endpoint
|
|
5
|
+
AICommit 是本地 CLI,不是托管中转服务。仓库数据从本地进程直接发送到用户配置选定的 provider endpoint;CLI 不记录或上传使用指标。
|
|
6
6
|
|
|
7
7
|
## Trust boundaries / 信任边界
|
|
8
8
|
|
|
9
|
-
| Boundary / 边界 | Data visible there / 可见数据 | Default control / 默认控制
|
|
10
|
-
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
11
|
-
| Main CLI process / CLI 主进程 | Selected Git metadata/diff, effective config, resolved provider credential / 选定 Git 元数据与 diff、有效配置、provider 凭据 | User config owns connection fields; project config is filtered / 连接字段归用户配置,项目配置受过滤
|
|
12
|
-
| Git subprocess / Git 子进程 | Requested status, diff, index/tree operations / 请求的 status、diff、index/tree 操作 | Explicit arguments, temporary indexes, fingerprints and recovery checkpoints / 显式参数、临时 index、指纹与恢复 checkpoint
|
|
13
|
-
| Provider endpoint / Provider 端点 | Prompt, protected selected diff/context, model options, Bearer credential / prompt、保护后的选定 diff/context、模型选项、Bearer 凭据 | Remote HTTPS except loopback; preview/protection before send; bounded context / 远端仅 HTTPS;发送前预览/保护;上下文有预算
|
|
14
|
-
|
|
|
15
|
-
| Local metrics file / 本地指标文件 | Duration, token totals, bounded result, edited/rewrite flags / 延迟、token 总量、结果类别、编辑/重写标记 | Local-only, owner permissions, retention cap, disable/clear controls / 仅本地、owner 权限、保留上限、可关闭/清除 |
|
|
16
|
-
| GitHub/npm during installation / 安装期 GitHub/npm | Package download metadata / package 下载元数据 | Version tag and npm Trusted Publishing provenance / 版本 tag 与 npm Trusted Publishing provenance |
|
|
9
|
+
| Boundary / 边界 | Data visible there / 可见数据 | Default control / 默认控制 |
|
|
10
|
+
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| Main CLI process / CLI 主进程 | Selected Git metadata/diff, effective config, resolved provider credential / 选定 Git 元数据与 diff、有效配置、provider 凭据 | User config owns connection fields; project config is filtered / 连接字段归用户配置,项目配置受过滤 |
|
|
12
|
+
| Git subprocess / Git 子进程 | Requested status, diff, index/tree operations / 请求的 status、diff、index/tree 操作 | Explicit arguments, temporary indexes, fingerprints and recovery checkpoints / 显式参数、临时 index、指纹与恢复 checkpoint |
|
|
13
|
+
| Provider endpoint / Provider 端点 | Prompt, protected selected diff/context, model options, Bearer credential / prompt、保护后的选定 diff/context、模型选项、Bearer 凭据 | Remote HTTPS except loopback; preview/protection before send; bounded context / 远端仅 HTTPS;发送前预览/保护;上下文有预算 |
|
|
14
|
+
| GitHub/npm during installation / 安装期 GitHub/npm | Package download metadata / package 下载元数据 | Version tag and npm Trusted Publishing provenance / 版本 tag 与 npm Trusted Publishing provenance |
|
|
17
15
|
|
|
18
16
|
## Provider request contents / Provider 请求内容
|
|
19
17
|
|
|
@@ -21,9 +19,9 @@ A normal generation can send the system policy, requested language, selected cha
|
|
|
21
19
|
|
|
22
20
|
普通生成可能发送 system policy、语言、选定文件路径/状态、staged diff、受限仓库上下文及 provider/model 控制。Split planning 还可能发送 tracked diff 与未跟踪普通文件的受限预览。默认重写只发送上一条消息而不重发 diff。连通性检查只发送固定 `OK` prompt。
|
|
23
21
|
|
|
24
|
-
AICommit does not intentionally send unrelated files, historical commit bodies,
|
|
22
|
+
AICommit does not intentionally send unrelated files, historical commit bodies, environment variables, its config file, Git credential-helper output, split checkpoint content, or model reasoning in machine output.
|
|
25
23
|
|
|
26
|
-
AICommit 不会主动发送无关文件、历史 commit body
|
|
24
|
+
AICommit 不会主动发送无关文件、历史 commit body、环境变量、配置文件、Git credential-helper 输出、split checkpoint 内容,也不会在机器输出中包含模型 reasoning。
|
|
27
25
|
|
|
28
26
|
## Data minimization and sensitive content / 数据最小化与敏感内容
|
|
29
27
|
|
|
@@ -39,20 +37,20 @@ AICommit 不会主动发送无关文件、历史 commit body、本地指标、
|
|
|
39
37
|
- 仓库文本作为不可信 JSON 数据编码,由权威 system policy 约束。
|
|
40
38
|
- 交互用户可在警告后明确发送原文;这是应谨慎使用的主动覆盖。
|
|
41
39
|
|
|
42
|
-
Detection, redaction, prompt boundaries
|
|
40
|
+
Detection, redaction, and prompt boundaries are defense in depth, not proofs that arbitrary data is safe. Verify custom endpoints before sending private code.
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
检测、脱敏和 prompt 边界都是纵深防御,不能证明任意数据绝对安全。在向自定义 endpoint 发送私有代码前,请核实其可信度。
|
|
45
43
|
|
|
46
44
|
## Credentials and retention / 凭据与保留
|
|
47
45
|
|
|
48
|
-
Credential resolution order is environment variable → opted-in Git credential helper → literal user config → keyless loopback. Project config and team policy cannot select a credential source. The provider credential is used only by the core transport
|
|
46
|
+
Credential resolution order is environment variable → opted-in Git credential helper → literal user config → keyless loopback. Project config and team policy cannot select a credential source. The provider credential is used only by the core transport.
|
|
49
47
|
|
|
50
|
-
凭据解析顺序为:环境变量 → 用户启用的 Git credential helper → 用户配置明文 → 无 key 的 loopback。项目配置和团队 policy 无权选择凭据来源。Provider
|
|
48
|
+
凭据解析顺序为:环境变量 → 用户启用的 Git credential helper → 用户配置明文 → 无 key 的 loopback。项目配置和团队 policy 无权选择凭据来源。Provider 凭据只由核心传输层使用。
|
|
51
49
|
|
|
52
|
-
Providers control their own server-side retention and training policies; AICommit cannot enforce them. Consult the selected provider's current terms. Locally, Git commits retain the accepted message, split checkpoints persist only code-free plan metadata until completion
|
|
50
|
+
Providers control their own server-side retention and training policies; AICommit cannot enforce them. Consult the selected provider's current terms. Locally, Git commits retain the accepted message, and split checkpoints persist only code-free plan metadata until completion or recovery.
|
|
53
51
|
|
|
54
|
-
Provider 自行决定服务端保留与训练策略,AICommit 无法强制控制;请查阅所选 provider 的现行条款。本地 Git commit 会保留接受的消息;split checkpoint
|
|
52
|
+
Provider 自行决定服务端保留与训练策略,AICommit 无法强制控制;请查阅所选 provider 的现行条款。本地 Git commit 会保留接受的消息;split checkpoint 在完成或恢复前只保存不含代码的计划元数据。
|
|
55
53
|
|
|
56
|
-
Use `aicommit config show
|
|
54
|
+
Use `aicommit config show` to inspect effective local state without revealing credentials.
|
|
57
55
|
|
|
58
|
-
使用 `aicommit config show
|
|
56
|
+
使用 `aicommit config show` 可在不显示凭据的情况下检查本地状态。
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
# Provider compatibility / Provider 兼容表
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Built-in setup defaults choose an adapter and endpoint; adapters own request/response dialects; the core owns Git state, user interaction, HTTPS enforcement, retry, timeout, authorization, and machine output.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
内置 setup 默认值负责选择 adapter 和端点;adapter 负责请求/响应方言;核心负责 Git 状态、用户交互、HTTPS、重试、超时、鉴权与机器输出。
|
|
6
6
|
|
|
7
|
-
| Provider / adapter | Endpoint and auth / 端点与鉴权
|
|
8
|
-
| ---------------------------- |
|
|
9
|
-
| OpenAI / `openai` | Official HTTPS Chat Completions; Bearer key / 官方 HTTPS;Bearer key
|
|
10
|
-
| OpenRouter / `openrouter` | OpenRouter HTTPS; Bearer key; `X-Title: aicommit`
|
|
11
|
-
| DeepSeek / `deepseek` | DeepSeek HTTPS; Bearer key
|
|
12
|
-
| MiniMax / `minimax` | MiniMax HTTPS; Bearer key
|
|
13
|
-
| Kimi Code / `custom` | Kimi Code OpenAI-compatible HTTPS; Bearer key / Kimi Code OpenAI 兼容 HTTPS
|
|
14
|
-
| Ollama native / `ollama` | Loopback `/api/chat` or `/api/generate`; normally keyless HTTP
|
|
15
|
-
| Custom compatible / `custom` | HTTPS remote or loopback HTTP; optional core Bearer key
|
|
16
|
-
| Extension / `extension:<id>` | Core HTTPS/loopback transport and optional Bearer only / 核心传输与可选 Bearer | Declared conservative in API v1 / v1 保守声明 | Adapter operation can transform non-secret reasoning config | Adapter maps body and normalized response | No custom credential scheme or headers; credential-like body fields rejected / 不支持自定义鉴权或 header |
|
|
7
|
+
| Provider / adapter | Endpoint and auth / 端点与鉴权 | Streaming / 流式 | Reasoning / 推理 | Token and usage mapping / token 与 usage | Notes / 说明 |
|
|
8
|
+
| ---------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| OpenAI / `openai` | Official HTTPS Chat Completions; Bearer key / 官方 HTTPS;Bearer key | SSE | Native for recognized `o*`/`gpt-5*`; model-dependent otherwise / 已识别推理模型原生支持 | `max_completion_tokens` for reasoning models, otherwise `max_tokens`; OpenAI usage | Unsupported effort is rejected locally for known model generations / 已知模型不支持的 effort 会本地拒绝 |
|
|
10
|
+
| OpenRouter / `openrouter` | OpenRouter HTTPS; Bearer key; `X-Title: aicommit` | SSE | `reasoning.effort` | `max_tokens`; OpenAI-style usage | Model IDs commonly include vendor prefix / model 通常含厂商前缀 |
|
|
11
|
+
| DeepSeek / `deepseek` | DeepSeek HTTPS; Bearer key | SSE | `thinking.type` plus normalized effort / thinking 与归一 effort | `max_tokens`; compatible usage | `medium`/`xhigh` map to supported high behavior where required / 必要时映射为 high |
|
|
12
|
+
| MiniMax / `minimax` | MiniMax HTTPS; Bearer key | SSE | `reasoning_split` and thinking switch | `max_tokens`; compatible usage | Adapter removes conflicting switches before send / 发送前移除冲突开关 |
|
|
13
|
+
| Kimi Code / `custom` | Kimi Code OpenAI-compatible HTTPS; Bearer key / Kimi Code OpenAI 兼容 HTTPS | SSE | Server default; no vendor fields injected / 使用服务端默认值,不注入厂商字段 | `max_tokens`; OpenAI-style usage | Bundled preset uses `kimi-for-coding`; membership and Platform keys are distinct / 会员与开放平台 key 不通用 |
|
|
14
|
+
| Ollama native / `ollama` | Loopback `/api/chat` or `/api/generate`; normally keyless HTTP | Complete JSON in v1; native NDJSON streaming is not consumed / v1 使用完整 JSON | Native `think` boolean | `options.num_predict`; `prompt_eval_count` + `eval_count` | OpenAI-compatible `/v1/chat/completions` uses the compatible shape instead / `/v1` 使用兼容方言 |
|
|
15
|
+
| Custom compatible / `custom` | HTTPS remote or loopback HTTP; optional core Bearer key | SSE when endpoint supports Chat Completions events | No vendor fields by default; explicit `enabledBody`/`disabledBody` / 默认不注入厂商字段 | `max_tokens`; common OpenAI/Anthropic/Ollama usage fields normalized | Validate the endpoint before trusting it with code or credentials / 发送代码前验证端点 |
|
|
17
16
|
|
|
18
17
|
## Compatibility contract / 兼容契约
|
|
19
18
|
|
|
@@ -21,17 +20,6 @@ All built-in adapters return `content`, optional `reasoning`, normalized usage,
|
|
|
21
20
|
|
|
22
21
|
所有内置 adapter 返回 `content`、可选 `reasoning`、标准 usage、finish reason、raw response、capability、attempts 与 latency。仅 429、部分 5xx、网络/响应中断会重试;鉴权、参数与安全错误不会重试。
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Use `aicommit doctor -p provider-name` to verify the selected adapter and live endpoint. Reuse a built-in adapter when only setup defaults change, and use `custom` for an OpenAI-compatible endpoint with optional body switches. A protocol requiring a different transport, streaming parser, or credential scheme needs core support.
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
aicommit preset show
|
|
30
|
-
aicommit preset validate --file=provider-presets.json
|
|
31
|
-
aicommit preset install --file=provider-presets.json
|
|
32
|
-
aicommit doctor -p provider-name
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Use an existing built-in adapter when only setup defaults change. Use `custom` for an OpenAI-compatible endpoint with optional body switches. Use a reviewed `providerAdapter` extension only when the JSON request/response dialect differs and core Bearer authorization is sufficient. A protocol requiring different transport, streaming parser, or credential scheme is not compatible with extension API v1 and must not be disguised as a preset.
|
|
36
|
-
|
|
37
|
-
若只改变 setup 默认值,应复用内置 adapter;OpenAI-compatible endpoint 及少量 body 开关使用 `custom`;仅当 JSON 请求/响应方言不同且核心 Bearer 鉴权足够时,才使用已审查的 `providerAdapter` 扩展。若协议需要不同传输、流解析或鉴权方案,则不兼容扩展 API v1,不能伪装成 preset。
|
|
25
|
+
使用 `aicommit doctor -p provider-name` 校验所选 adapter 与在线端点。若只改变 setup 默认值,应复用内置 adapter;OpenAI-compatible endpoint 及少量 body 开关使用 `custom`。需要不同传输、流解析或鉴权方案的协议必须由核心直接支持。
|
package/docs/team-policy.md
CHANGED
|
@@ -46,7 +46,7 @@ Both paths call the same validator. `--output=json` returns the effective policy
|
|
|
46
46
|
|
|
47
47
|
1. Move Conventional Commit types, scope rules, subject length, body rules, breaking-change handling, and language out of free-form `prompt` text and into `.aicommit.policy.json`.
|
|
48
48
|
2. Declare every field instead of relying on personal defaults. Start with optional scopes and narrow the values only after current history has been sampled.
|
|
49
|
-
3. Keep provider credentials in `~/.aicommit
|
|
49
|
+
3. Keep provider credentials in `~/.aicommit/config.json` or environment variables; never copy them into the repository policy.
|
|
50
50
|
4. If commitlint already defines `type-enum`, `scope-enum`, `subject-max-length`, or `header-max-length`, keep that file committed. AICommit reads recognized scalar values as data and never executes the config.
|
|
51
51
|
5. Run the local hook and CI example on the same known-good and known-bad messages. Their `policyFingerprint` and issue codes must match before making the gate required.
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Both paths call the same validator. `--output=json` returns the effective policy
|
|
|
54
54
|
|
|
55
55
|
1. 将 Conventional Commit 类型、scope 规则、标题长度、正文规则、破坏性变更和语言要求从自由文本 `prompt` 迁移到 `.aicommit.policy.json`。
|
|
56
56
|
2. 明确声明所有字段,不依赖个人默认值。可先保留可选 scope,再根据现有提交历史逐步收紧取值。
|
|
57
|
-
3. provider 凭据继续放在 `~/.aicommit
|
|
57
|
+
3. provider 凭据继续放在 `~/.aicommit/config.json` 或环境变量中,绝不要复制到仓库策略。
|
|
58
58
|
4. 如果 commitlint 已定义 `type-enum`、`scope-enum`、`subject-max-length` 或 `header-max-length`,继续提交该配置。AICommit 只按数据读取识别出的标量规则,不执行配置文件。
|
|
59
59
|
5. 用同一组已知正确/错误消息分别运行本地 hook 与 CI 示例;在强制启用门禁前,确认两者的 `policyFingerprint` 和问题代码一致。
|
|
60
60
|
|