jinzd-ai-cli 0.4.208 → 0.4.210

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.
Files changed (28) hide show
  1. package/README.md +10 -8
  2. package/README.zh-CN.md +5 -5
  3. package/dist/{batch-3T44NFLG.js → batch-MFPYHOIL.js} +4 -4
  4. package/dist/{chunk-TD7JEHCR.js → chunk-7JWT3KXO.js} +390 -23
  5. package/dist/{chunk-SQB66GP6.js → chunk-BNERFXVO.js} +12 -9
  6. package/dist/{chunk-J22B3OSQ.js → chunk-DJ35G5VO.js} +1 -1
  7. package/dist/{chunk-VWYUB22Y.js → chunk-E2ZWWE6Q.js} +1 -1
  8. package/dist/{chunk-KV4GYNEA.js → chunk-GRJNQJA5.js} +5 -3
  9. package/dist/{chunk-QDY72ABW.js → chunk-HZQVX7VF.js} +5 -3
  10. package/dist/{chunk-O6UFCEUZ.js → chunk-K3CF65QH.js} +12 -9
  11. package/dist/{chunk-2OVMMSGQ.js → chunk-NEPFADHX.js} +10 -9
  12. package/dist/{chunk-P7JY3SWA.js → chunk-NWP7C6CC.js} +1 -1
  13. package/dist/{chunk-TM4MS63K.js → chunk-P6MTFCXB.js} +14 -6
  14. package/dist/{ci-6QWBVRJX.js → ci-QLJUDLMY.js} +3 -2
  15. package/dist/{constants-SZTQNN7K.js → constants-47OR72MV.js} +3 -1
  16. package/dist/{doctor-cli-I2Y2YR4V.js → doctor-cli-32COMA5K.js} +4 -4
  17. package/dist/electron-server.js +652 -457
  18. package/dist/{hub-XVPFBODB.js → hub-3NWJUCLK.js} +1 -1
  19. package/dist/index.js +128 -376
  20. package/dist/{indexer-AKWMYNJI.js → indexer-2AG4G6B5.js} +1 -1
  21. package/dist/{indexer-BMYUUDLH.js → indexer-4WWS3VIL.js} +1 -1
  22. package/dist/{run-tests-HZ2CRCTZ.js → run-tests-NT2UIUVB.js} +1 -1
  23. package/dist/{run-tests-D5SNUBYX.js → run-tests-UT7RZ7Y3.js} +2 -2
  24. package/dist/{server-PVKLPRUP.js → server-AIHVMLNU.js} +5 -5
  25. package/dist/{server-4EFTRFTN.js → server-E5D54DIZ.js} +87 -306
  26. package/dist/{task-orchestrator-2A5VCFLS.js → task-orchestrator-BFDSTSOH.js} +5 -5
  27. package/dist/{usage-Q24E5636.js → usage-P4B2RZKL.js} +2 -2
  28. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-KV4GYNEA.js";
4
+ } from "./chunk-GRJNQJA5.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.208";
4
+ var VERSION = "0.4.210";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -9,7 +9,8 @@ var HISTORY_DIR_NAME = "history";
9
9
  var PLUGINS_DIR_NAME = "plugins";
10
10
  var SKILLS_DIR_NAME = "skills";
11
11
  var CUSTOM_COMMANDS_DIR_NAME = "commands";
12
- var CONTEXT_FILE_CANDIDATES = ["AICLI.md", "CLAUDE.md"];
12
+ var CONTEXT_FILE_CANDIDATES = ["AICLI.override.md", "AGENTS.override.md", "AICLI.md", "CLAUDE.md", "AGENTS.md"];
13
+ var CONTEXT_FILE_MAX_BYTES = 32 * 1024;
13
14
  var MEMORY_FILE_NAME = "memory.md";
14
15
  var MEMORY_MAX_CHARS = 1e4;
15
16
  var DEV_STATE_FILE_NAME = "dev-state.md";
@@ -95,7 +96,7 @@ var AGENTIC_BEHAVIOR_GUIDELINE = `# Important Behavioral Guidelines
95
96
  - Only begin using write/execute tools when the user **explicitly requests** an action (e.g., "generate", "create", "modify", "run", "start", etc.).
96
97
  - **Stop when the explicit task is done \u2014 do NOT autonomously test, verify, or run what you just created.** If the user asks "write/create/save file X", finish writing the file and STOP. Do not run it, do not test it, do not "verify it works" with bash/run_interactive. The user will run it themselves and tell you if anything is wrong. Only run/test when the user explicitly says "run", "test", "execute", "try it", "verify", "make sure it works", etc.
97
98
  - **Do NOT retry the same failing command with variants.** If a command fails (exit code non-zero), report the failure to the user with a brief diagnosis and STOP. Do not loop through alternate shells, alternate quoting, alternate paths, or alternate Python invocations. The user can decide whether to retry.
98
- - Project context files (CLAUDE.md, AICLI.md) provide background information about the project. They are NOT instructions to start working. Only use them as reference when the user asks a project-related question or task.
99
+ - Project context files (AICLI.md, CLAUDE.md, AGENTS.md, and override variants) provide background information about the project. They are NOT instructions to start working. Only use them as reference when the user asks a project-related question or task.
99
100
  - If you are unsure about the user's intent, use the ask_user tool to confirm with the user, rather than assuming and executing on your own.
100
101
  - **Do NOT abuse ask_user for redundant confirmations**: When the user has already given a clear, explicit instruction (e.g., "write lesson 142", "generate file X", "create the report"), execute it immediately. Do NOT ask "are you sure?" or request details that can be found in project documents. Repeatedly asking the user to confirm wastes their time and is extremely frustrating. Only use ask_user when critical information is genuinely missing and cannot be inferred from context files.`;
101
102
  function buildUserIdentityPrompt(profile) {
@@ -142,6 +143,7 @@ export {
142
143
  SKILLS_DIR_NAME,
143
144
  CUSTOM_COMMANDS_DIR_NAME,
144
145
  CONTEXT_FILE_CANDIDATES,
146
+ CONTEXT_FILE_MAX_BYTES,
145
147
  MEMORY_FILE_NAME,
146
148
  MEMORY_MAX_CHARS,
147
149
  DEV_STATE_FILE_NAME,
@@ -6,7 +6,7 @@ import { platform } from "os";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // src/core/constants.ts
9
- var VERSION = "0.4.208";
9
+ var VERSION = "0.4.210";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -14,7 +14,8 @@ var HISTORY_DIR_NAME = "history";
14
14
  var PLUGINS_DIR_NAME = "plugins";
15
15
  var SKILLS_DIR_NAME = "skills";
16
16
  var CUSTOM_COMMANDS_DIR_NAME = "commands";
17
- var CONTEXT_FILE_CANDIDATES = ["AICLI.md", "CLAUDE.md"];
17
+ var CONTEXT_FILE_CANDIDATES = ["AICLI.override.md", "AGENTS.override.md", "AICLI.md", "CLAUDE.md", "AGENTS.md"];
18
+ var CONTEXT_FILE_MAX_BYTES = 32 * 1024;
18
19
  var MEMORY_FILE_NAME = "memory.md";
19
20
  var MEMORY_MAX_CHARS = 1e4;
20
21
  var DEV_STATE_FILE_NAME = "dev-state.md";
@@ -96,7 +97,7 @@ var AGENTIC_BEHAVIOR_GUIDELINE = `# Important Behavioral Guidelines
96
97
  - Only begin using write/execute tools when the user **explicitly requests** an action (e.g., "generate", "create", "modify", "run", "start", etc.).
97
98
  - **Stop when the explicit task is done \u2014 do NOT autonomously test, verify, or run what you just created.** If the user asks "write/create/save file X", finish writing the file and STOP. Do not run it, do not test it, do not "verify it works" with bash/run_interactive. The user will run it themselves and tell you if anything is wrong. Only run/test when the user explicitly says "run", "test", "execute", "try it", "verify", "make sure it works", etc.
98
99
  - **Do NOT retry the same failing command with variants.** If a command fails (exit code non-zero), report the failure to the user with a brief diagnosis and STOP. Do not loop through alternate shells, alternate quoting, alternate paths, or alternate Python invocations. The user can decide whether to retry.
99
- - Project context files (CLAUDE.md, AICLI.md) provide background information about the project. They are NOT instructions to start working. Only use them as reference when the user asks a project-related question or task.
100
+ - Project context files (AICLI.md, CLAUDE.md, AGENTS.md, and override variants) provide background information about the project. They are NOT instructions to start working. Only use them as reference when the user asks a project-related question or task.
100
101
  - If you are unsure about the user's intent, use the ask_user tool to confirm with the user, rather than assuming and executing on your own.
101
102
  - **Do NOT abuse ask_user for redundant confirmations**: When the user has already given a clear, explicit instruction (e.g., "write lesson 142", "generate file X", "create the report"), execute it immediately. Do NOT ask "are you sure?" or request details that can be found in project documents. Repeatedly asking the user to confirm wastes their time and is extremely frustrating. Only use ask_user when critical information is genuinely missing and cannot be inferred from context files.`;
102
103
  function buildUserIdentityPrompt(profile) {
@@ -549,6 +550,7 @@ export {
549
550
  SKILLS_DIR_NAME,
550
551
  CUSTOM_COMMANDS_DIR_NAME,
551
552
  CONTEXT_FILE_CANDIDATES,
553
+ CONTEXT_FILE_MAX_BYTES,
552
554
  MEMORY_FILE_NAME,
553
555
  MEMORY_MAX_CHARS,
554
556
  DEV_STATE_FILE_NAME,
@@ -20,12 +20,13 @@ import { Parser, Language } from "web-tree-sitter";
20
20
  import { createRequire } from "module";
21
21
  import path from "path";
22
22
  import fs from "fs";
23
- import { fileURLToPath } from "url";
24
- var _metaUrl = import.meta?.url;
25
- var _cjsFilename = globalThis.__filename;
26
- var __filename_ = _metaUrl ? fileURLToPath(_metaUrl) : _cjsFilename ?? process.execPath;
27
- var __dirname_ = path.dirname(__filename_);
28
- var require_ = _metaUrl ? createRequire(_metaUrl) : createRequire(__filename_);
23
+ var entryCandidates = [
24
+ process.pkg?.entrypoint,
25
+ process.argv[1],
26
+ process.execPath
27
+ ].filter((p) => !!p);
28
+ var bundleDirs = [...new Set(entryCandidates.map((p) => path.dirname(path.resolve(p))))];
29
+ var require_ = createRequire(path.join(process.cwd(), "package.json"));
29
30
  var GRAMMAR_FILE = {
30
31
  typescript: "tree-sitter-typescript.wasm",
31
32
  tsx: "tree-sitter-tsx.wasm",
@@ -42,9 +43,11 @@ var languageCache = /* @__PURE__ */ new Map();
42
43
  var parserCache = /* @__PURE__ */ new Map();
43
44
  function resolveWasmPath(filename) {
44
45
  const candidates = [];
45
- candidates.push(path.join(__dirname_, "wasm", filename));
46
- candidates.push(path.join(__dirname_, "..", "wasm", filename));
47
- candidates.push(path.join(__dirname_, "..", "dist", "wasm", filename));
46
+ for (const dir of bundleDirs) {
47
+ candidates.push(path.join(dir, "wasm", filename));
48
+ candidates.push(path.join(dir, "..", "wasm", filename));
49
+ candidates.push(path.join(dir, "..", "dist", "wasm", filename));
50
+ }
48
51
  if (process.pkg) {
49
52
  candidates.push(path.join(path.dirname(process.execPath), "dist", "wasm", filename));
50
53
  candidates.push(path.join("/snapshot", "ai-cli", "dist", "wasm", filename));
@@ -5,10 +5,10 @@ import {
5
5
  } from "./chunk-T2NL5ZIA.js";
6
6
  import {
7
7
  runTestsTool
8
- } from "./chunk-VWYUB22Y.js";
8
+ } from "./chunk-E2ZWWE6Q.js";
9
9
  import {
10
10
  runTool
11
- } from "./chunk-J22B3OSQ.js";
11
+ } from "./chunk-DJ35G5VO.js";
12
12
  import {
13
13
  getDangerLevel,
14
14
  isFileWriteTool,
@@ -26,7 +26,7 @@ import {
26
26
  SUBAGENT_ALLOWED_TOOLS,
27
27
  SUBAGENT_DEFAULT_MAX_ROUNDS,
28
28
  SUBAGENT_MAX_ROUNDS_LIMIT
29
- } from "./chunk-KV4GYNEA.js";
29
+ } from "./chunk-GRJNQJA5.js";
30
30
  import {
31
31
  fileCheckpoints
32
32
  } from "./chunk-4BKXL7SM.js";
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-TB4W4Y4T.js";
37
37
  import {
38
38
  indexProject
39
- } from "./chunk-O6UFCEUZ.js";
39
+ } from "./chunk-K3CF65QH.js";
40
40
  import {
41
41
  loadIndex
42
42
  } from "./chunk-CKH4KQ4E.js";
@@ -2145,7 +2145,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
2145
2145
  const mode = appendMode ? "appended" : "written";
2146
2146
  void (async () => {
2147
2147
  try {
2148
- const { updateFile } = await import("./indexer-AKWMYNJI.js");
2148
+ const { updateFile } = await import("./indexer-2AG4G6B5.js");
2149
2149
  await updateFile(process.cwd(), filePath);
2150
2150
  } catch {
2151
2151
  }
@@ -3929,7 +3929,7 @@ Any of these triggers means use save_last_response, NOT write_file:
3929
3929
  };
3930
3930
 
3931
3931
  // src/tools/builtin/save-memory.ts
3932
- import { existsSync as existsSync9, statSync as statSync6, appendFileSync as appendFileSync2, mkdirSync as mkdirSync3 } from "fs";
3932
+ import { existsSync as existsSync9, readFileSync as readFileSync6, statSync as statSync6, mkdirSync as mkdirSync3 } from "fs";
3933
3933
  import { join as join4 } from "path";
3934
3934
  import { homedir as homedir3 } from "os";
3935
3935
  function getMemoryFilePath() {
@@ -3966,7 +3966,8 @@ var saveMemoryTool = {
3966
3966
  ## ${timestamp}
3967
3967
  ${content}
3968
3968
  `;
3969
- appendFileSync2(memoryPath, entry, "utf-8");
3969
+ const previous = existsSync9(memoryPath) ? readFileSync6(memoryPath, "utf-8") : "";
3970
+ atomicWriteFileSync(memoryPath, previous + entry);
3970
3971
  const byteSize = statSync6(memoryPath).size;
3971
3972
  return `Memory saved successfully. File size: ${byteSize} bytes in ${MEMORY_FILE_NAME}`;
3972
3973
  }
@@ -5031,7 +5032,7 @@ ${commitOutput.trim()}`;
5031
5032
  };
5032
5033
 
5033
5034
  // src/tools/builtin/notebook-edit.ts
5034
- import { readFileSync as readFileSync6, existsSync as existsSync11 } from "fs";
5035
+ import { readFileSync as readFileSync7, existsSync as existsSync11 } from "fs";
5035
5036
  import { writeFile } from "fs/promises";
5036
5037
  import { resolve as resolve4, extname as extname2 } from "path";
5037
5038
  var notebookEditTool = {
@@ -5089,7 +5090,7 @@ var notebookEditTool = {
5089
5090
  if (!existsSync11(absPath)) {
5090
5091
  throw new ToolError("notebook_edit", `Notebook not found: ${filePath}`);
5091
5092
  }
5092
- const raw = readFileSync6(absPath, "utf-8");
5093
+ const raw = readFileSync7(absPath, "utf-8");
5093
5094
  const nb = parseNotebook(raw);
5094
5095
  const cellIdx0 = cellIndexRaw - 1;
5095
5096
  undoStack.push(absPath, `notebook_edit (${action}): ${filePath}`);
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  VERSION
5
- } from "./chunk-KV4GYNEA.js";
5
+ } from "./chunk-GRJNQJA5.js";
6
6
 
7
7
  // src/diagnostics/crash-log.ts
8
8
  import {
@@ -8,10 +8,13 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-KV4GYNEA.js";
11
+ } from "./chunk-GRJNQJA5.js";
12
+ import {
13
+ atomicWriteFileSync
14
+ } from "./chunk-IW3Q7AE5.js";
12
15
 
13
16
  // src/config/config-manager.ts
14
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
17
+ import { readFileSync, existsSync, mkdirSync } from "fs";
15
18
  import { join } from "path";
16
19
  import { homedir } from "os";
17
20
 
@@ -119,10 +122,15 @@ var ConfigSchema = z.object({
119
122
  systemPrompt: z.string().optional()
120
123
  }).default({}),
121
124
  // 项目上下文文件配置
122
- // 启动时自动读取并注入 system prompt,类似 Claude Code 的 CLAUDE.md 机制
123
- // 默认按顺序查找:AICLI.md → CLAUDE.md → .aicli/context.md
124
- // 设为 false 可禁用此功能
125
+ // 启动时自动读取并注入 system prompt,类似 Claude Code 的 CLAUDE.md / Codex AGENTS.md 机制
126
+ // 默认按顺序查找:AICLI.override.md → AGENTS.override.md → AICLI.md → CLAUDE.md → AGENTS.md
127
+ // 设为 false 可禁用此功能;指定字符串时仅加载 cwd 下的该文件
125
128
  contextFile: z.union([z.string(), z.literal(false)]).default("auto"),
129
+ context: z.object({
130
+ projectDocFallbackFilenames: z.array(z.string()).default([]),
131
+ projectDocMaxBytes: z.number().int().positive().default(32 * 1024),
132
+ showLoadedContextSources: z.boolean().default(false)
133
+ }).default({}),
126
134
  // Google Custom Search API 的 Search Engine ID (cx 参数)
127
135
  // API Key 通过 apiKeys['google-search'] 或 AICLI_API_KEY_GOOGLESEARCH 环境变量配置
128
136
  // CX 也可通过 AICLI_GOOGLE_CX 环境变量覆盖
@@ -347,7 +355,7 @@ ${err}`
347
355
  }
348
356
  save() {
349
357
  mkdirSync(this.configDir, { recursive: true });
350
- writeFileSync(this.configPath, JSON.stringify(this.config, null, 2), "utf-8");
358
+ atomicWriteFileSync(this.configPath, JSON.stringify(this.config, null, 2));
351
359
  }
352
360
  getApiKey(providerId) {
353
361
  const envKey = EnvLoader.getApiKey(providerId);
@@ -10,11 +10,12 @@ import {
10
10
  import "./chunk-XPBEJB27.js";
11
11
  import {
12
12
  ConfigManager
13
- } from "./chunk-TM4MS63K.js";
13
+ } from "./chunk-P6MTFCXB.js";
14
14
  import "./chunk-TZQHYZKT.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-KV4GYNEA.js";
17
+ } from "./chunk-GRJNQJA5.js";
18
+ import "./chunk-IW3Q7AE5.js";
18
19
 
19
20
  // src/cli/ci.ts
20
21
  import { execFileSync } from "child_process";
@@ -7,6 +7,7 @@ import {
7
7
  CONFIG_DIR_NAME,
8
8
  CONFIG_FILE_NAME,
9
9
  CONTEXT_FILE_CANDIDATES,
10
+ CONTEXT_FILE_MAX_BYTES,
10
11
  CONTEXT_PRESSURE_THRESHOLD,
11
12
  CONTEXT_WARNING_THRESHOLD,
12
13
  CUSTOM_COMMANDS_DIR_NAME,
@@ -36,7 +37,7 @@ import {
36
37
  TEST_TIMEOUT,
37
38
  VERSION,
38
39
  buildUserIdentityPrompt
39
- } from "./chunk-KV4GYNEA.js";
40
+ } from "./chunk-GRJNQJA5.js";
40
41
  export {
41
42
  AGENTIC_BEHAVIOR_GUIDELINE,
42
43
  APP_NAME,
@@ -45,6 +46,7 @@ export {
45
46
  CONFIG_DIR_NAME,
46
47
  CONFIG_FILE_NAME,
47
48
  CONTEXT_FILE_CANDIDATES,
49
+ CONTEXT_FILE_MAX_BYTES,
48
50
  CONTEXT_PRESSURE_THRESHOLD,
49
51
  CONTEXT_WARNING_THRESHOLD,
50
52
  CUSTOM_COMMANDS_DIR_NAME,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getConfigDirUsage,
4
4
  listRecentCrashes
5
- } from "./chunk-P7JY3SWA.js";
5
+ } from "./chunk-NWP7C6CC.js";
6
6
  import {
7
7
  ProviderRegistry
8
8
  } from "./chunk-QMXC327F.js";
@@ -11,17 +11,17 @@ import {
11
11
  getTopFailingTools,
12
12
  getTopUsedTools,
13
13
  resetStats
14
- } from "./chunk-J22B3OSQ.js";
14
+ } from "./chunk-DJ35G5VO.js";
15
15
  import "./chunk-XPBEJB27.js";
16
16
  import {
17
17
  ConfigManager
18
- } from "./chunk-TM4MS63K.js";
18
+ } from "./chunk-P6MTFCXB.js";
19
19
  import "./chunk-TZQHYZKT.js";
20
20
  import {
21
21
  DEV_STATE_FILE_NAME,
22
22
  MEMORY_FILE_NAME,
23
23
  VERSION
24
- } from "./chunk-KV4GYNEA.js";
24
+ } from "./chunk-GRJNQJA5.js";
25
25
  import "./chunk-IW3Q7AE5.js";
26
26
 
27
27
  // src/diagnostics/doctor-cli.ts