jinzd-ai-cli 0.4.24 → 0.4.26
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 +8 -3
- package/README.zh-CN.md +8 -3
- package/dist/chunk-4BKXL7SM.js +98 -0
- package/dist/{chunk-PDVX5QJA.js → chunk-5GZQLJAY.js} +1068 -201
- package/dist/{chunk-UA4BVWKV.js → chunk-AHH5I2U6.js} +1 -1
- package/dist/{chunk-XMTMCMAP.js → chunk-ETMUP3CY.js} +1 -1
- package/dist/chunk-SKET65WZ.js +96 -0
- package/dist/{chunk-GBMVHLPA.js → chunk-SS7BQZ5R.js} +2 -198
- package/dist/{hub-YN245LMP.js → hub-JOYPSPR2.js} +1 -1
- package/dist/index.js +178 -504
- package/dist/{run-tests-2S6SYL2M.js → run-tests-25BZE3KQ.js} +1 -1
- package/dist/{run-tests-7ZBI4ZTU.js → run-tests-L3JNRB6X.js} +1 -1
- package/dist/{server-SD5ICBFP.js → server-SZZXQZWY.js} +128 -7
- package/dist/{task-orchestrator-C472QXTJ.js → task-orchestrator-4N5UUA6L.js} +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
- **PWA Support** — Install Web UI as a desktop/mobile app, accessible over LAN
|
|
35
35
|
- **Hierarchical Context** — 3-layer context files (global / project / subdirectory) auto-injected
|
|
36
36
|
- **Headless Mode** — `ai-cli -p "prompt"` for CI/CD pipelines and scripting
|
|
37
|
-
- **
|
|
37
|
+
- **40 REPL Commands** — Session management, checkpointing, code review, security review, rewind, scaffolding, and more
|
|
38
38
|
- **GitHub Actions CI/CD** — Automated testing on Node 20/22 + npm publish on release tags
|
|
39
39
|
- **Cross-Platform** — Windows, macOS, Linux
|
|
40
40
|
|
|
@@ -121,7 +121,7 @@ Any OpenAI-compatible API can also be used via `customBaseUrls` in config.
|
|
|
121
121
|
|
|
122
122
|
## Built-in Tools (Agentic)
|
|
123
123
|
|
|
124
|
-
AI autonomously invokes these
|
|
124
|
+
AI autonomously invokes these 19 tools during conversations:
|
|
125
125
|
|
|
126
126
|
| Tool | Safety | Description |
|
|
127
127
|
|------|--------|-------------|
|
|
@@ -141,6 +141,9 @@ AI autonomously invokes these 16 tools during conversations:
|
|
|
141
141
|
| `save_memory` | safe | Persist important info across sessions |
|
|
142
142
|
| `write_todos` | safe | Task breakdown with live progress rendering |
|
|
143
143
|
| `save_last_response` | write | Save AI response to file |
|
|
144
|
+
| `task_create` | write | Start a command running in the background |
|
|
145
|
+
| `task_list` | safe | List background tasks and their status/output |
|
|
146
|
+
| `task_stop` | write | Stop a running background task |
|
|
144
147
|
|
|
145
148
|
**Safety levels**: `safe` = auto-execute, `write` = diff preview + confirmation, `destructive` = prominent warning + confirmation.
|
|
146
149
|
|
|
@@ -154,6 +157,8 @@ AI autonomously invokes these 16 tools during conversations:
|
|
|
154
157
|
| `/think` | Toggle Claude extended thinking |
|
|
155
158
|
| `/test` | Auto-detect and run project tests |
|
|
156
159
|
| `/review` | AI code review of current git diff |
|
|
160
|
+
| `/security-review` | Security vulnerability scan on git diff |
|
|
161
|
+
| `/rewind` | Rewind conversation + restore files to checkpoint state |
|
|
157
162
|
| `/scaffold <desc>` | AI generates project skeleton |
|
|
158
163
|
| `/init` | AI generates project context file (AICLI.md) |
|
|
159
164
|
| `/compact` | Compress conversation history |
|
|
@@ -173,7 +178,7 @@ AI autonomously invokes these 16 tools during conversations:
|
|
|
173
178
|
|
|
174
179
|
**Multi-line input**: Use `\` at end of line for continuation, or paste multi-line content directly (auto-detected and merged).
|
|
175
180
|
|
|
176
|
-
Type `/help` in the REPL to see all
|
|
181
|
+
Type `/help` in the REPL to see all 40 commands.
|
|
177
182
|
|
|
178
183
|
## CLI Parameters
|
|
179
184
|
|
package/README.zh-CN.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
- **PWA 支持** — Web UI 可安装为桌面/移动应用,支持局域网访问
|
|
27
27
|
- **三层级上下文** — 全局 / 项目 / 子目录上下文文件自动注入
|
|
28
28
|
- **无头模式** — `aicli -p "提示词"` 用于 CI/CD 管道和脚本
|
|
29
|
-
- **
|
|
29
|
+
- **40 个 REPL 命令** — 会话管理、检查点、代码审查、安全审查、对话回退、脚手架等
|
|
30
30
|
- **GitHub Actions CI/CD** — Node 20/22 自动测试 + Release tag 自动发布 npm
|
|
31
31
|
- **跨平台** — Windows、macOS、Linux
|
|
32
32
|
|
|
@@ -113,7 +113,7 @@ aicli user delete x # 删除用户
|
|
|
113
113
|
|
|
114
114
|
## 内置工具(Agentic 能力)
|
|
115
115
|
|
|
116
|
-
AI 在对话中可自主调用
|
|
116
|
+
AI 在对话中可自主调用 19 个工具:
|
|
117
117
|
|
|
118
118
|
| 工具 | 安全级别 | 说明 |
|
|
119
119
|
|------|---------|------|
|
|
@@ -133,6 +133,9 @@ AI 在对话中可自主调用 16 个工具:
|
|
|
133
133
|
| `save_memory` | 安全 | 跨会话持久化重要信息 |
|
|
134
134
|
| `write_todos` | 安全 | 任务拆解,终端实时渲染进度 |
|
|
135
135
|
| `save_last_response` | 写入 | 保存 AI 回复到文件 |
|
|
136
|
+
| `task_create` | 写入 | 在后台启动命令 |
|
|
137
|
+
| `task_list` | 安全 | 列出后台任务及其状态/输出 |
|
|
138
|
+
| `task_stop` | 写入 | 停止运行中的后台任务 |
|
|
136
139
|
|
|
137
140
|
**安全级别**:`安全` = 自动执行,`写入` = diff 预览 + 确认,`破坏性` = 醒目警告 + 确认。
|
|
138
141
|
|
|
@@ -146,6 +149,8 @@ AI 在对话中可自主调用 16 个工具:
|
|
|
146
149
|
| `/think` | 切换 Claude 深度推理 |
|
|
147
150
|
| `/test` | 自动检测并运行测试 |
|
|
148
151
|
| `/review` | AI 代码审查 git diff |
|
|
152
|
+
| `/security-review` | 安全漏洞扫描 git diff |
|
|
153
|
+
| `/rewind` | 回退对话 + 恢复文件到检查点状态 |
|
|
149
154
|
| `/scaffold <描述>` | AI 生成项目骨架 |
|
|
150
155
|
| `/init` | AI 生成项目上下文文件 |
|
|
151
156
|
| `/compact` | 压缩对话历史 |
|
|
@@ -165,7 +170,7 @@ AI 在对话中可自主调用 16 个工具:
|
|
|
165
170
|
|
|
166
171
|
**多行输入**:行末加 `\` 续行,或直接粘贴多行内容(自动检测合并)。
|
|
167
172
|
|
|
168
|
-
在 REPL 中输入 `/help` 查看全部
|
|
173
|
+
在 REPL 中输入 `/help` 查看全部 40 个命令。
|
|
169
174
|
|
|
170
175
|
## CLI 参数
|
|
171
176
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/tools/file-checkpoint.ts
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync, unlinkSync } from "fs";
|
|
5
|
+
var MAX_SNAPSHOTS = 200;
|
|
6
|
+
var FileCheckpointStore = class {
|
|
7
|
+
snapshots = [];
|
|
8
|
+
/**
|
|
9
|
+
* 在文件写入前调用,保存当前文件内容。
|
|
10
|
+
* 同一 messageIndex 下同一文件只记录首次快照。
|
|
11
|
+
*/
|
|
12
|
+
snapshot(filePath, messageIndex) {
|
|
13
|
+
const exists = this.snapshots.some(
|
|
14
|
+
(s) => s.filePath === filePath && s.messageIndex === messageIndex
|
|
15
|
+
);
|
|
16
|
+
if (exists) return;
|
|
17
|
+
let content = null;
|
|
18
|
+
if (existsSync(filePath)) {
|
|
19
|
+
try {
|
|
20
|
+
content = readFileSync(filePath, "utf-8");
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
this.snapshots.push({
|
|
26
|
+
filePath,
|
|
27
|
+
content,
|
|
28
|
+
messageIndex,
|
|
29
|
+
timestamp: Date.now()
|
|
30
|
+
});
|
|
31
|
+
if (this.snapshots.length > MAX_SNAPSHOTS) {
|
|
32
|
+
this.snapshots = this.snapshots.slice(-MAX_SNAPSHOTS);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 恢复所有在指定消息索引之后被修改的文件到该索引时的状态。
|
|
37
|
+
* @returns 恢复和删除的文件数量
|
|
38
|
+
*/
|
|
39
|
+
restoreToMessageIndex(targetIndex) {
|
|
40
|
+
const modifiedAfter = this.snapshots.filter((s) => s.messageIndex > targetIndex);
|
|
41
|
+
const uniqueFiles = [...new Set(modifiedAfter.map((s) => s.filePath))];
|
|
42
|
+
let restored = 0;
|
|
43
|
+
let deleted = 0;
|
|
44
|
+
const files = [];
|
|
45
|
+
for (const filePath of uniqueFiles) {
|
|
46
|
+
const beforeSnapshots = this.snapshots.filter((s) => s.filePath === filePath && s.messageIndex <= targetIndex).sort((a, b) => b.messageIndex - a.messageIndex);
|
|
47
|
+
const restoreTo = beforeSnapshots[0];
|
|
48
|
+
try {
|
|
49
|
+
if (restoreTo) {
|
|
50
|
+
if (restoreTo.content === null) {
|
|
51
|
+
if (existsSync(filePath)) {
|
|
52
|
+
unlinkSync(filePath);
|
|
53
|
+
deleted++;
|
|
54
|
+
files.push(filePath);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
writeFileSync(filePath, restoreTo.content, "utf-8");
|
|
58
|
+
restored++;
|
|
59
|
+
files.push(filePath);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
const earliest = this.snapshots.filter((s) => s.filePath === filePath).sort((a, b) => a.messageIndex - b.messageIndex)[0];
|
|
63
|
+
if (earliest && earliest.content === null) {
|
|
64
|
+
if (existsSync(filePath)) {
|
|
65
|
+
unlinkSync(filePath);
|
|
66
|
+
deleted++;
|
|
67
|
+
files.push(filePath);
|
|
68
|
+
}
|
|
69
|
+
} else if (earliest) {
|
|
70
|
+
writeFileSync(filePath, earliest.content, "utf-8");
|
|
71
|
+
restored++;
|
|
72
|
+
files.push(filePath);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
this.snapshots = this.snapshots.filter((s) => s.messageIndex <= targetIndex);
|
|
79
|
+
return { restored, deleted, files };
|
|
80
|
+
}
|
|
81
|
+
/** 获取所有快照(供调试/显示) */
|
|
82
|
+
getSnapshots() {
|
|
83
|
+
return this.snapshots;
|
|
84
|
+
}
|
|
85
|
+
/** 获取有快照的消息索引列表(去重排序) */
|
|
86
|
+
getMessageIndices() {
|
|
87
|
+
return [...new Set(this.snapshots.map((s) => s.messageIndex))].sort((a, b) => a - b);
|
|
88
|
+
}
|
|
89
|
+
/** 清空所有快照(新会话/清除时调用) */
|
|
90
|
+
clear() {
|
|
91
|
+
this.snapshots = [];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var fileCheckpoints = new FileCheckpointStore();
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
fileCheckpoints
|
|
98
|
+
};
|