jinzd-ai-cli 0.1.39 → 0.1.40
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/CLAUDE.md
CHANGED
|
@@ -348,9 +348,9 @@ const stdinLines = Array.isArray(rawStdin) ? rawStdin.map(String)
|
|
|
348
348
|
- [x] **web_fetch DNS 解析时 SSRF 防护**(v0.1.25):新增 `resolveAndCheck()` 函数,用 `dns.promises.lookup()` 预解析域名,检查结果 IP 是否为私有地址。初始 URL 和 redirect 目标均校验。
|
|
349
349
|
- [ ] **`persistentCwd` 全局状态**:bash 工具的当前工作目录是模块级全局变量,多 session 并发时可能串扰。现阶段单 session REPL 无影响,GUI 多会话扩展时需重构为 per-session 状态。
|
|
350
350
|
|
|
351
|
-
## 本轮开发完成记录(2026-03-07,v0.1.38 → v0.1.
|
|
351
|
+
## 本轮开发完成记录(2026-03-07,v0.1.38 → v0.1.40)
|
|
352
352
|
|
|
353
|
-
### Bug 修复(3
|
|
353
|
+
### Bug 修复(3 个使用中发现的问题 + 1 个系统改进)
|
|
354
354
|
|
|
355
355
|
**Bug 1:`/init` 输出路径错误** 🔴
|
|
356
356
|
- **问题**:在 `D:\xgitee\ai-courses\prjs\vocational` 运行 `/init`,AICLI.md 被写到 git 根目录 `D:\xgitee\ai-courses\AICLI.md` 而非 cwd
|
|
@@ -368,8 +368,14 @@ const stdinLines = Array.isArray(rawStdin) ? rawStdin.map(String)
|
|
|
368
368
|
- 新增 `FREE_ROUND_TOOLS = new Set(['write_todos'])`:本轮全部工具调用都属于免费工具时,`round--` 回退计数
|
|
369
369
|
- MAX_TOOL_ROUNDS 从 20 → **25**:更充裕的工具调用空间
|
|
370
370
|
|
|
371
|
+
**Bug 4:AI 在 Windows 上反复使用 Unix 命令导致 bash 工具失败** 🟠
|
|
372
|
+
- **问题**:AI 使用 `date +%Y%m%d`、`grep`、`head`、`find | wc -l` 等 Unix 命令,在 Windows PowerShell 上全部失败,每次浪费 1-2 个工具轮次
|
|
373
|
+
- **根因**:system prompt 中未告知 AI 当前操作系统和 shell 环境,AI 默认使用 Unix 命令
|
|
374
|
+
- **修复**:`buildCurrentSystemPrompt()` 中注入操作系统信息 + shell 类型 + 工作目录。Windows 环境下明确提示"不要使用 Unix 命令,应使用 PowerShell 等效命令",列出常见替代(Select-String/Select-Object -First/Get-ChildItem/Get-Date -Format 等)
|
|
375
|
+
- **文件**:`src/repl/repl.ts` `buildCurrentSystemPrompt()` 新增 `envInfo` 段落
|
|
376
|
+
|
|
371
377
|
### 版本与收尾
|
|
372
|
-
- `src/core/constants.ts`:VERSION `0.1.38` → `0.1.
|
|
378
|
+
- `src/core/constants.ts`:VERSION `0.1.38` → `0.1.40`
|
|
373
379
|
- `package.json`:version 同步
|
|
374
380
|
- 构建验证:`npm run build` 零错误
|
|
375
381
|
|
|
@@ -377,10 +383,10 @@ const stdinLines = Array.isArray(rawStdin) ? rawStdin.map(String)
|
|
|
377
383
|
|
|
378
384
|
| 文件 | 变更类型 | 说明 |
|
|
379
385
|
|------|---------|------|
|
|
380
|
-
| `src/core/constants.ts` | 修改 | VERSION 0.1.38 → 0.1.
|
|
381
|
-
| `src/repl/repl.ts` | 修改 | MAX_TOOL_ROUNDS 20→25 + FREE_ROUND_TOOLS +
|
|
386
|
+
| `src/core/constants.ts` | 修改 | VERSION 0.1.38 → 0.1.40 |
|
|
387
|
+
| `src/repl/repl.ts` | 修改 | MAX_TOOL_ROUNDS 20→25 + FREE_ROUND_TOOLS + 轮次耗尽总结 + OS/shell 信息注入 system prompt |
|
|
382
388
|
| `src/repl/commands/index.ts` | 修改 | /init targetDir 从 gitRoot → cwd |
|
|
383
|
-
| `package.json` | 修改 | version 0.1.38 → 0.1.
|
|
389
|
+
| `package.json` | 修改 | version 0.1.38 → 0.1.40 |
|
|
384
390
|
|
|
385
391
|
### 下一步建议
|
|
386
392
|
1. **`/config set` 快捷配置**:REPL 内直接 `/config set ui.theme light` 无需进入向导
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
SUBAGENT_MAX_ROUNDS_LIMIT,
|
|
30
30
|
VERSION,
|
|
31
31
|
runTestsTool
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-5XTQNTUG.js";
|
|
33
33
|
|
|
34
34
|
// src/index.ts
|
|
35
35
|
import { program } from "commander";
|
|
@@ -3711,7 +3711,7 @@ ${hint}` : "")
|
|
|
3711
3711
|
description: "Run project tests and show structured report",
|
|
3712
3712
|
usage: "/test [command|filter]",
|
|
3713
3713
|
async execute(args, _ctx) {
|
|
3714
|
-
const { executeTests } = await import("./run-tests-
|
|
3714
|
+
const { executeTests } = await import("./run-tests-COTUXAOM.js");
|
|
3715
3715
|
const argStr = args.join(" ").trim();
|
|
3716
3716
|
let testArgs = {};
|
|
3717
3717
|
if (argStr) {
|
|
@@ -8376,7 +8376,12 @@ ${projectContext}`);
|
|
|
8376
8376
|
const dateStr = `${now.getFullYear()}\u5E74${pad(now.getMonth() + 1)}\u6708${pad(now.getDate())}\u65E5 ${WEEKDAYS[now.getDay()]}`;
|
|
8377
8377
|
const timeStr = `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
|
|
8378
8378
|
const dateTimeInfo = `\u5F53\u524D\u65E5\u671F\u65F6\u95F4\uFF1A${dateStr} ${timeStr}`;
|
|
8379
|
-
const
|
|
8379
|
+
const osName = process.platform === "win32" ? "Windows" : process.platform === "darwin" ? "macOS" : "Linux";
|
|
8380
|
+
const shellInfo = process.platform === "win32" ? "bash \u5DE5\u5177\u4F7F\u7528 PowerShell\uFF08\u975E cmd\uFF09\uFF0C\u8BF7\u4F7F\u7528 PowerShell \u547D\u4EE4\u8BED\u6CD5\u3002\u4E0D\u8981\u4F7F\u7528 Unix \u547D\u4EE4\uFF08\u5982 grep\u3001head\u3001find\u3001wc\u3001date +\u683C\u5F0F \u7B49\uFF09\uFF0C\u5E94\u4F7F\u7528 PowerShell \u7B49\u6548\u547D\u4EE4\uFF08\u5982 Select-String\u3001Select-Object -First\u3001Get-ChildItem\u3001Measure-Object\u3001Get-Date -Format \u7B49\uFF09\u3002" : `bash \u5DE5\u5177\u4F7F\u7528 ${process.env.SHELL || "/bin/bash"}\u3002`;
|
|
8381
|
+
const envInfo = `\u64CD\u4F5C\u7CFB\u7EDF\uFF1A${osName}
|
|
8382
|
+
${shellInfo}
|
|
8383
|
+
\u5DE5\u4F5C\u76EE\u5F55\uFF1A${process.cwd()}`;
|
|
8384
|
+
const parts = [dateTimeInfo + "\n" + envInfo];
|
|
8380
8385
|
const memory = this.loadMemoryContent();
|
|
8381
8386
|
if (memory) {
|
|
8382
8387
|
parts.push(`# Persistent Memory
|