code-agent-auto-commit 1.0.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/docs/zh-CN.md ADDED
@@ -0,0 +1,81 @@
1
+ # code-agent-auto-commit User Guide
2
+
3
+ `code-agent-auto-commit` (`cac`) is a TypeScript-based auto-commit tool for:
4
+
5
+ - OpenCode
6
+ - Codex CLI
7
+ - Claude Code
8
+
9
+ It runs commits automatically when a chat/agent turn ends.
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # 1. 初始化配置
15
+ cac init
16
+
17
+ # 2. 配置 AI API Key(必须,否则无法生成 AI commit message)
18
+ # 编辑 .code-agent-auto-commit.json,设置 provider、model 和 apiKeyEnv。
19
+ # 或者在 shell 中导出对应的环境变量:
20
+ export MINIMAX_API_KEY='your-api-key' # 或 OPENAI_API_KEY 等
21
+
22
+ # 3. 安装钩子
23
+ cac install --tool all --scope project
24
+
25
+ # 4. 验证状态
26
+ cac status --scope project
27
+ ```
28
+
29
+ > **重要:** `cac init` 之后**必须**配置 AI provider 的 API Key。
30
+ > 没有有效的 Key,AI 生成 commit message 会失败,`cac` 会退回到
31
+ > `chore(auto): ...` 格式的通用消息。
32
+ >
33
+ > **模型选择建议:** 推荐选择速度快、轻量的模型(如 `gpt-4.1-mini`、
34
+ > `MiniMax-M2.1-highspeed`)。Commit message 内容很短,速度比智能更重要。
35
+
36
+ ## Command Reference
37
+
38
+ - `cac init [--worktree <path>] [--config <path>]`
39
+ - Initializes a config file.
40
+ - Writes to `<worktree>/.code-agent-auto-commit.json` by default; use `--config` for a custom path.
41
+
42
+ - `cac install [--tool all|opencode|codex|claude] [--scope project|global] [--worktree <path>] [--config <path>]`
43
+ - Installs auto-commit adapters for selected tools (OpenCode/Codex/Claude).
44
+ - `--scope project` writes project-level config, `--scope global` writes user-level config.
45
+ - Creates the target config file automatically when it does not exist.
46
+
47
+ - `cac uninstall [--tool all|opencode|codex|claude] [--scope project|global] [--worktree <path>]`
48
+ - Uninstalls adapters/hooks for selected tools.
49
+
50
+ - `cac status [--scope project|global] [--worktree <path>] [--config <path>]`
51
+ - Shows active config and install status.
52
+ - Output includes config path, worktree, commit mode, AI/Push toggles, and adapter install status for each tool.
53
+
54
+ - `cac run [--tool opencode|codex|claude|manual] [--worktree <path>] [--config <path>] [--event-json <json>] [--event-stdin]`
55
+ - Executes one auto-commit pass (manual trigger or hook trigger).
56
+ - Runs the configured pipeline: filter files -> stage -> commit -> optional push.
57
+
58
+ - `cac set-worktree <path> [--config <path>]`
59
+ - Updates only the `worktree` field in config and leaves other settings unchanged.
60
+
61
+ ## Configurable Options
62
+
63
+ - Commit modes:
64
+ - `single`: commit all files in one commit
65
+ - `per-file`: one commit per file
66
+ - AI commit messages: supports `provider/model` with multiple providers (OpenAI-compatible and Anthropic-compatible)
67
+ - Auto-push: configurable for GitHub/GitLab
68
+
69
+ ## Config File
70
+
71
+ Default location in repository root: `.code-agent-auto-commit.json`
72
+
73
+ For full field details, see `docs/CONFIG.md`.
74
+
75
+ ## Important Notes
76
+
77
+ - `.env` and key-like files are excluded by default.
78
+ - `per-file` mode requires a clean staging area.
79
+ - Push is disabled by default; verify remote and branch settings before enabling.
80
+ - `ai.providers.<name>.apiKeyEnv` must be an environment variable name (for example, `MINIMAX_API_KEY`), not the raw key.
81
+ - If you want to store the key directly in config, use `ai.providers.<name>.apiKey`.
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "code-agent-auto-commit",
3
+ "version": "1.0.0",
4
+ "description": "CAC provides configurable AI auto-commit(using your git account) for OpenCode, Claude Code, Codex, and other AI code agents",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "bin": {
10
+ "cac": "dist/cli.js",
11
+ "code-agent-auto-commit": "dist/cli.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE",
17
+ "CONTRIBUTING.md",
18
+ "CODE_OF_CONDUCT.md",
19
+ "SECURITY.md",
20
+ "docs",
21
+ ".code-agent-auto-commit.example.json"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "clean": "rm -rf dist",
28
+ "build": "tsc -p tsconfig.json",
29
+ "typecheck": "tsc -p tsconfig.json --noEmit",
30
+ "test": "node --test dist/test/*.test.js",
31
+ "prepare": "pnpm run build"
32
+ },
33
+ "keywords": [
34
+ "git",
35
+ "commit",
36
+ "automation",
37
+ "opencode",
38
+ "codex",
39
+ "claude-code"
40
+ ],
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
44
+ "packageManager": "pnpm@10.28.2",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/0xtresser/code-agent-auto-commit.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/0xtresser/code-agent-auto-commit/issues"
51
+ },
52
+ "homepage": "https://github.com/0xtresser/code-agent-auto-commit#readme",
53
+ "devDependencies": {
54
+ "@types/node": "^22.10.0",
55
+ "typescript": "^5.7.2"
56
+ }
57
+ }