jinzd-ai-cli 0.4.270 → 0.4.271

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 (33) hide show
  1. package/dist/{batch-IMLMUXJL.js → batch-FPDT2USZ.js} +2 -2
  2. package/dist/{chunk-PLFXDRNX.js → chunk-2RN4T4XD.js} +1 -1
  3. package/dist/{chunk-YHLTSZVH.js → chunk-4UNRDXZV.js} +8 -8
  4. package/dist/{chunk-JJVVCWO4.js → chunk-5JFRM47R.js} +1 -1
  5. package/dist/{chunk-X3JPBJ6C.js → chunk-BFPF3JF2.js} +6 -6
  6. package/dist/{chunk-75SPJKDY.js → chunk-FT3WS5PG.js} +1 -1
  7. package/dist/{chunk-TG4PF7FZ.js → chunk-OSYK6D4G.js} +1 -1
  8. package/dist/{chunk-M3GDYEUH.js → chunk-PDRAOFGI.js} +4 -4
  9. package/dist/{chunk-HOT76ATM.js → chunk-PG7O7N7D.js} +8 -8
  10. package/dist/{chunk-F26YTEMB.js → chunk-PMRU2CAF.js} +4 -4
  11. package/dist/{chunk-UDUE4DAE.js → chunk-RLAUMACS.js} +1 -1
  12. package/dist/{chunk-FXCDD7JS.js → chunk-RNDHIERN.js} +3 -3
  13. package/dist/{chunk-DIJIYWQE.js → chunk-V26ZMB3D.js} +11 -11
  14. package/dist/{chunk-BOMB6XCF.js → chunk-VPXNLE7E.js} +1 -1
  15. package/dist/chunk-XNFIYS7G.js +82 -0
  16. package/dist/{ci-HQVXWJ53.js → ci-VPN5RWCO.js} +4 -4
  17. package/dist/{ci-format-762IL4OM.js → ci-format-GKXVCVME.js} +2 -2
  18. package/dist/config-command-E5DHADEV.js +11 -0
  19. package/dist/{constants-4TPE3JSV.js → constants-Y43DJFGV.js} +1 -1
  20. package/dist/{doctor-cli-3ES6NFVL.js → doctor-cli-RZGZB2TF.js} +4 -4
  21. package/dist/electron-server.js +91 -23
  22. package/dist/{hub-QXRWPBJP.js → hub-FJWP6SDG.js} +1 -1
  23. package/dist/index.js +81 -97
  24. package/dist/{persistent-memory-F4JPWYZJ.js → persistent-memory-IR47JCTF.js} +3 -3
  25. package/dist/{persistent-memory-URIJJJ3N.js → persistent-memory-KX2R67AT.js} +2 -2
  26. package/dist/{pr-HVVHZOJ2.js → pr-NTQ3N4B4.js} +5 -5
  27. package/dist/{run-tests-UZG6SVJ5.js → run-tests-25CNXJ4N.js} +2 -2
  28. package/dist/{run-tests-WM7TMO2N.js → run-tests-UTES6HCT.js} +2 -2
  29. package/dist/{server-E5OBXT33.js → server-IGCCSX4B.js} +10 -10
  30. package/dist/{server-HPRLFLOI.js → server-R56CVHCM.js} +49 -52
  31. package/dist/{task-orchestrator-HJUUL55Y.js → task-orchestrator-MFYEKR2I.js} +12 -12
  32. package/dist/{usage-L3DUPHD6.js → usage-FHX7PQQH.js} +2 -2
  33. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-F26YTEMB.js";
4
+ } from "./chunk-PMRU2CAF.js";
5
5
  import "./chunk-TU3L3PW7.js";
6
- import "./chunk-75SPJKDY.js";
7
6
  import {
8
7
  atomicWriteFileSync
9
8
  } from "./chunk-IW3Q7AE5.js";
9
+ import "./chunk-FT3WS5PG.js";
10
10
 
11
11
  // src/cli/batch.ts
12
12
  import Anthropic from "@anthropic-ai/sdk";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-75SPJKDY.js";
4
+ } from "./chunk-FT3WS5PG.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- getGitRoot
4
- } from "./chunk-HOSJZMQS.js";
5
- import {
6
- MEMORY_FILE_NAME,
7
- MEMORY_MAX_CHARS,
8
- MEMORY_STORE_FILE_NAME
9
- } from "./chunk-75SPJKDY.js";
10
2
  import {
11
3
  DEFAULT_PATTERNS,
12
4
  redactString
13
5
  } from "./chunk-B5TYJO7V.js";
6
+ import {
7
+ getGitRoot
8
+ } from "./chunk-HOSJZMQS.js";
14
9
  import {
15
10
  atomicWriteFileSync
16
11
  } from "./chunk-IW3Q7AE5.js";
12
+ import {
13
+ MEMORY_FILE_NAME,
14
+ MEMORY_MAX_CHARS,
15
+ MEMORY_STORE_FILE_NAME
16
+ } from "./chunk-FT3WS5PG.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.270";
2
+ var VERSION = "0.4.271";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -5,11 +5,14 @@ import {
5
5
  import {
6
6
  estimateTokens,
7
7
  truncateForPersist
8
- } from "./chunk-DIJIYWQE.js";
8
+ } from "./chunk-V26ZMB3D.js";
9
9
  import {
10
10
  isMemoryExpired,
11
11
  isMemoryStale
12
- } from "./chunk-YHLTSZVH.js";
12
+ } from "./chunk-4UNRDXZV.js";
13
+ import {
14
+ atomicWriteFileSync
15
+ } from "./chunk-IW3Q7AE5.js";
13
16
  import {
14
17
  APP_NAME,
15
18
  CONFIG_DIR_NAME,
@@ -20,10 +23,7 @@ import {
20
23
  MCP_PROTOCOL_VERSION,
21
24
  MCP_TOOL_PREFIX,
22
25
  VERSION
23
- } from "./chunk-75SPJKDY.js";
24
- import {
25
- atomicWriteFileSync
26
- } from "./chunk-IW3Q7AE5.js";
26
+ } from "./chunk-FT3WS5PG.js";
27
27
 
28
28
  // src/mcp/client.ts
29
29
  import { spawn } 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.270";
4
+ var VERSION = "0.4.271";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-75SPJKDY.js";
4
+ } from "./chunk-FT3WS5PG.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- CONFIG_DIR_NAME,
4
- PLUGINS_DIR_NAME
5
- } from "./chunk-75SPJKDY.js";
6
2
  import {
7
3
  atomicWriteFileSync
8
4
  } from "./chunk-IW3Q7AE5.js";
5
+ import {
6
+ CONFIG_DIR_NAME,
7
+ PLUGINS_DIR_NAME
8
+ } from "./chunk-FT3WS5PG.js";
9
9
 
10
10
  // src/diagnostics/tool-stats.ts
11
11
  import { existsSync, readFileSync, mkdirSync } from "fs";
@@ -1,10 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- ProviderRegistry
4
- } from "./chunk-AUEX6RNY.js";
5
- import {
6
- ConfigManager
7
- } from "./chunk-F26YTEMB.js";
8
2
  import {
9
3
  getActivePluginAssets,
10
4
  getPendingHookTrust,
@@ -14,7 +8,13 @@ import {
14
8
  listHooks,
15
9
  listInstalledPlugins,
16
10
  resetStats
17
- } from "./chunk-M3GDYEUH.js";
11
+ } from "./chunk-PDRAOFGI.js";
12
+ import {
13
+ ProviderRegistry
14
+ } from "./chunk-AUEX6RNY.js";
15
+ import {
16
+ ConfigManager
17
+ } from "./chunk-PMRU2CAF.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-75SPJKDY.js";
29
+ } from "./chunk-FT3WS5PG.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -3,15 +3,15 @@ import {
3
3
  ConfigError,
4
4
  EnvLoader
5
5
  } from "./chunk-TU3L3PW7.js";
6
+ import {
7
+ atomicWriteFileSync
8
+ } from "./chunk-IW3Q7AE5.js";
6
9
  import {
7
10
  CONFIG_DIR_NAME,
8
11
  CONFIG_FILE_NAME,
9
12
  HISTORY_DIR_NAME,
10
13
  PLUGINS_DIR_NAME
11
- } from "./chunk-75SPJKDY.js";
12
- import {
13
- atomicWriteFileSync
14
- } from "./chunk-IW3Q7AE5.js";
14
+ } from "./chunk-FT3WS5PG.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-JJVVCWO4.js";
3
+ } from "./chunk-5JFRM47R.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-PLFXDRNX.js";
5
+ } from "./chunk-2RN4T4XD.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-AUEX6RNY.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-F26YTEMB.js";
19
+ } from "./chunk-PMRU2CAF.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-75SPJKDY.js";
22
+ } from "./chunk-FT3WS5PG.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ loadChatIndex,
4
+ searchChatMemory
5
+ } from "./chunk-6RPGQ5CG.js";
2
6
  import {
3
7
  addMemoryEntry,
4
8
  findSimilarMemory,
@@ -7,7 +11,7 @@ import {
7
11
  searchPersistentMemories,
8
12
  touchMemoryReferences,
9
13
  updateMemoryEntry
10
- } from "./chunk-YHLTSZVH.js";
14
+ } from "./chunk-4UNRDXZV.js";
11
15
  import {
12
16
  indexProject
13
17
  } from "./chunk-GLSR2NR3.js";
@@ -26,7 +30,7 @@ import {
26
30
  runHook,
27
31
  runLifecycleHooks,
28
32
  runTool
29
- } from "./chunk-M3GDYEUH.js";
33
+ } from "./chunk-PDRAOFGI.js";
30
34
  import {
31
35
  buildTruncatedArgumentsError,
32
36
  getDangerLevel,
@@ -38,26 +42,22 @@ import {
38
42
  NetworkError,
39
43
  ToolError
40
44
  } from "./chunk-TU3L3PW7.js";
45
+ import {
46
+ atomicWriteFileSync
47
+ } from "./chunk-IW3Q7AE5.js";
41
48
  import {
42
49
  fileCheckpoints
43
50
  } from "./chunk-4BKXL7SM.js";
44
51
  import {
45
52
  runTestsTool
46
- } from "./chunk-TG4PF7FZ.js";
53
+ } from "./chunk-OSYK6D4G.js";
47
54
  import {
48
55
  CONFIG_DIR_NAME,
49
56
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
50
57
  SUBAGENT_ALLOWED_TOOLS,
51
58
  SUBAGENT_DEFAULT_MAX_ROUNDS,
52
59
  SUBAGENT_MAX_ROUNDS_LIMIT
53
- } from "./chunk-75SPJKDY.js";
54
- import {
55
- loadChatIndex,
56
- searchChatMemory
57
- } from "./chunk-6RPGQ5CG.js";
58
- import {
59
- atomicWriteFileSync
60
- } from "./chunk-IW3Q7AE5.js";
60
+ } from "./chunk-FT3WS5PG.js";
61
61
 
62
62
  // src/tools/shell-pool.ts
63
63
  import { spawn as spawn2 } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-JJVVCWO4.js";
9
+ } from "./chunk-5JFRM47R.js";
10
10
  import {
11
11
  atomicWriteFileSync
12
12
  } from "./chunk-6BUTA5VW.js";
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/core/config-command.ts
4
+ var CONFIG_USAGE = "Usage: config [show | get <path> | set <path> <value>]";
5
+ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
6
+ function maskSecret(value) {
7
+ if (value.length <= 8) return "****";
8
+ return `${value.slice(0, 4)}****${value.slice(-4)}`;
9
+ }
10
+ function maskConfigSecrets(config) {
11
+ const apiKeys = config["apiKeys"];
12
+ if (apiKeys && typeof apiKeys === "object") {
13
+ const keys = apiKeys;
14
+ for (const k of Object.keys(keys)) {
15
+ if (typeof keys[k] === "string") keys[k] = maskSecret(keys[k]);
16
+ }
17
+ }
18
+ const custom = config["customProviders"];
19
+ if (custom && typeof custom === "object") {
20
+ for (const entry of Object.values(custom)) {
21
+ if (entry && typeof entry === "object" && typeof entry["apiKey"] === "string") {
22
+ const e = entry;
23
+ e["apiKey"] = maskSecret(e["apiKey"]);
24
+ }
25
+ }
26
+ }
27
+ return config;
28
+ }
29
+ function applyConfigCommand(args, target) {
30
+ const sub = args[0]?.toLowerCase();
31
+ if (!sub) return { action: "wizard", changed: false, isError: false };
32
+ if (sub === "show") {
33
+ return {
34
+ action: "show",
35
+ json: JSON.stringify(maskConfigSecrets(target.toJSON()), null, 2),
36
+ changed: false,
37
+ isError: false
38
+ };
39
+ }
40
+ if (sub === "get") {
41
+ const path = args[1]?.trim();
42
+ if (!path) {
43
+ return { action: "usage", summary: "Usage: config get <path> (e.g. ui.theme)", changed: false, isError: true };
44
+ }
45
+ const value = target.getByPath(path);
46
+ const shown = value === void 0 ? "(undefined)" : typeof value === "object" ? JSON.stringify(value) : String(value);
47
+ return { action: "get", summary: `${path} = ${shown}`, changed: false, isError: false };
48
+ }
49
+ if (sub === "set") {
50
+ const path = args[1]?.trim();
51
+ const value = args.slice(2).join(" ").trim();
52
+ if (!path || value === "") {
53
+ return {
54
+ action: "usage",
55
+ summary: "Usage: config set <path> <value> (e.g. ui.theme light)",
56
+ changed: false,
57
+ isError: true
58
+ };
59
+ }
60
+ if (path.split(".").some((k) => FORBIDDEN_KEYS.has(k))) {
61
+ return { action: "set", summary: `Forbidden path segment in "${path}"`, changed: false, isError: true };
62
+ }
63
+ try {
64
+ target.setByPath(path, value);
65
+ } catch (err) {
66
+ return {
67
+ action: "set",
68
+ summary: `Config error: ${err instanceof Error ? err.message : String(err)}`,
69
+ changed: false,
70
+ isError: true
71
+ };
72
+ }
73
+ return { action: "set", summary: `Set ${path} = ${value}`, changed: true, isError: false };
74
+ }
75
+ return { action: "usage", summary: CONFIG_USAGE, changed: false, isError: true };
76
+ }
77
+
78
+ export {
79
+ CONFIG_USAGE,
80
+ maskConfigSecrets,
81
+ applyConfigCommand
82
+ };
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-FXCDD7JS.js";
7
- import "./chunk-PLFXDRNX.js";
6
+ } from "./chunk-RNDHIERN.js";
7
+ import "./chunk-2RN4T4XD.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
10
  import "./chunk-AUEX6RNY.js";
11
- import "./chunk-F26YTEMB.js";
11
+ import "./chunk-PMRU2CAF.js";
12
12
  import "./chunk-3OBY7WSS.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
- import "./chunk-75SPJKDY.js";
15
14
  import "./chunk-IW3Q7AE5.js";
15
+ import "./chunk-FT3WS5PG.js";
16
16
  export {
17
17
  CI_COMMENT_MARKER,
18
18
  countSeverity,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-PLFXDRNX.js";
10
- import "./chunk-75SPJKDY.js";
9
+ } from "./chunk-2RN4T4XD.js";
10
+ import "./chunk-FT3WS5PG.js";
11
11
  export {
12
12
  DEFAULT_CI_THRESHOLDS,
13
13
  detectCiGateSignals,
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CONFIG_USAGE,
4
+ applyConfigCommand,
5
+ maskConfigSecrets
6
+ } from "./chunk-XNFIYS7G.js";
7
+ export {
8
+ CONFIG_USAGE,
9
+ applyConfigCommand,
10
+ maskConfigSecrets
11
+ };
@@ -38,7 +38,7 @@ import {
38
38
  TEST_TIMEOUT,
39
39
  VERSION,
40
40
  buildUserIdentityPrompt
41
- } from "./chunk-75SPJKDY.js";
41
+ } from "./chunk-FT3WS5PG.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-HOT76ATM.js";
5
+ } from "./chunk-PG7O7N7D.js";
6
+ import "./chunk-PDRAOFGI.js";
6
7
  import "./chunk-AUEX6RNY.js";
7
- import "./chunk-F26YTEMB.js";
8
- import "./chunk-M3GDYEUH.js";
8
+ import "./chunk-PMRU2CAF.js";
9
9
  import "./chunk-3OBY7WSS.js";
10
10
  import "./chunk-TU3L3PW7.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
- import "./chunk-75SPJKDY.js";
13
12
  import "./chunk-IW3Q7AE5.js";
13
+ import "./chunk-FT3WS5PG.js";
14
14
  export {
15
15
  formatDoctorReport,
16
16
  runDoctorCli
@@ -36,14 +36,14 @@ import {
36
36
  touchMemoryReferences,
37
37
  updateMemoryApproval,
38
38
  updateMemoryEntry
39
- } from "./chunk-BOMB6XCF.js";
39
+ } from "./chunk-VPXNLE7E.js";
40
40
  import {
41
41
  redactJson,
42
42
  scanString
43
43
  } from "./chunk-YVTASHS5.js";
44
44
  import {
45
45
  runTestsTool
46
- } from "./chunk-UDUE4DAE.js";
46
+ } from "./chunk-RLAUMACS.js";
47
47
  import {
48
48
  AGENTIC_BEHAVIOR_GUIDELINE,
49
49
  APP_NAME,
@@ -76,7 +76,7 @@ import {
76
76
  SUBAGENT_MAX_ROUNDS_LIMIT,
77
77
  VERSION,
78
78
  buildUserIdentityPrompt
79
- } from "./chunk-JJVVCWO4.js";
79
+ } from "./chunk-5JFRM47R.js";
80
80
  import {
81
81
  hasSemanticIndex,
82
82
  semanticSearch
@@ -16039,7 +16039,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
16039
16039
  Cost: ${formatCost(cost)}` : "";
16040
16040
  let memoryLine = "";
16041
16041
  try {
16042
- const { countPendingMemories } = await import("./persistent-memory-URIJJJ3N.js");
16042
+ const { countPendingMemories } = await import("./persistent-memory-KX2R67AT.js");
16043
16043
  const pending = countPendingMemories(ctx.config.getConfigDir());
16044
16044
  if (pending > 0) memoryLine = `
16045
16045
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -16852,7 +16852,7 @@ async function handleTest(args, ctx) {
16852
16852
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
16853
16853
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
16854
16854
  }
16855
- const runTests = ctx.runTests ?? (await import("./run-tests-UZG6SVJ5.js")).executeTests;
16855
+ const runTests = ctx.runTests ?? (await import("./run-tests-25CNXJ4N.js")).executeTests;
16856
16856
  const report = await runTests(testArgs);
16857
16857
  ctx.send({ type: "info", message: report });
16858
16858
  } catch (err) {
@@ -17110,7 +17110,7 @@ async function handleMemory(args, ctx) {
17110
17110
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
17111
17111
  } else if (sub === "export") {
17112
17112
  if (args[1] === "md") {
17113
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-URIJJJ3N.js");
17113
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-KX2R67AT.js");
17114
17114
  ctx.send({
17115
17115
  type: "export_data",
17116
17116
  format: "md",
@@ -17275,28 +17275,96 @@ function applyProfileCommand(args, profile) {
17275
17275
  };
17276
17276
  }
17277
17277
 
17278
+ // src/core/config-command.ts
17279
+ var CONFIG_USAGE = "Usage: config [show | get <path> | set <path> <value>]";
17280
+ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
17281
+ function maskSecret(value) {
17282
+ if (value.length <= 8) return "****";
17283
+ return `${value.slice(0, 4)}****${value.slice(-4)}`;
17284
+ }
17285
+ function maskConfigSecrets(config) {
17286
+ const apiKeys = config["apiKeys"];
17287
+ if (apiKeys && typeof apiKeys === "object") {
17288
+ const keys = apiKeys;
17289
+ for (const k of Object.keys(keys)) {
17290
+ if (typeof keys[k] === "string") keys[k] = maskSecret(keys[k]);
17291
+ }
17292
+ }
17293
+ const custom = config["customProviders"];
17294
+ if (custom && typeof custom === "object") {
17295
+ for (const entry of Object.values(custom)) {
17296
+ if (entry && typeof entry === "object" && typeof entry["apiKey"] === "string") {
17297
+ const e = entry;
17298
+ e["apiKey"] = maskSecret(e["apiKey"]);
17299
+ }
17300
+ }
17301
+ }
17302
+ return config;
17303
+ }
17304
+ function applyConfigCommand(args, target) {
17305
+ const sub = args[0]?.toLowerCase();
17306
+ if (!sub) return { action: "wizard", changed: false, isError: false };
17307
+ if (sub === "show") {
17308
+ return {
17309
+ action: "show",
17310
+ json: JSON.stringify(maskConfigSecrets(target.toJSON()), null, 2),
17311
+ changed: false,
17312
+ isError: false
17313
+ };
17314
+ }
17315
+ if (sub === "get") {
17316
+ const path3 = args[1]?.trim();
17317
+ if (!path3) {
17318
+ return { action: "usage", summary: "Usage: config get <path> (e.g. ui.theme)", changed: false, isError: true };
17319
+ }
17320
+ const value = target.getByPath(path3);
17321
+ const shown = value === void 0 ? "(undefined)" : typeof value === "object" ? JSON.stringify(value) : String(value);
17322
+ return { action: "get", summary: `${path3} = ${shown}`, changed: false, isError: false };
17323
+ }
17324
+ if (sub === "set") {
17325
+ const path3 = args[1]?.trim();
17326
+ const value = args.slice(2).join(" ").trim();
17327
+ if (!path3 || value === "") {
17328
+ return {
17329
+ action: "usage",
17330
+ summary: "Usage: config set <path> <value> (e.g. ui.theme light)",
17331
+ changed: false,
17332
+ isError: true
17333
+ };
17334
+ }
17335
+ if (path3.split(".").some((k) => FORBIDDEN_KEYS.has(k))) {
17336
+ return { action: "set", summary: `Forbidden path segment in "${path3}"`, changed: false, isError: true };
17337
+ }
17338
+ try {
17339
+ target.setByPath(path3, value);
17340
+ } catch (err) {
17341
+ return {
17342
+ action: "set",
17343
+ summary: `Config error: ${err instanceof Error ? err.message : String(err)}`,
17344
+ changed: false,
17345
+ isError: true
17346
+ };
17347
+ }
17348
+ return { action: "set", summary: `Set ${path3} = ${value}`, changed: true, isError: false };
17349
+ }
17350
+ return { action: "usage", summary: CONFIG_USAGE, changed: false, isError: true };
17351
+ }
17352
+
17278
17353
  // src/web/commands/security-commands.ts
17279
17354
  async function handleConfig(args, ctx) {
17280
- const sub = args[0];
17281
- if (sub === "show" || !sub) {
17282
- ctx.send({ type: "info", message: `\u2699\uFE0F Configuration:
17355
+ const outcome = applyConfigCommand(args, ctx.config);
17356
+ if (outcome.action === "show" || outcome.action === "wizard") {
17357
+ const json = outcome.json ?? JSON.stringify(maskConfigSecrets(ctx.config.toJSON()), null, 2);
17358
+ ctx.send({ type: "info", message: `\u2699\uFE0F Configuration (secrets masked):
17283
17359
  \`\`\`json
17284
- ${ctx.config.toFormattedJSON()}
17360
+ ${json}
17285
17361
  \`\`\`` });
17286
- } else if (sub === "get" && args[1]) {
17287
- const val = ctx.config.getByPath(args[1]);
17288
- const display = typeof val === "object" ? JSON.stringify(val, null, 2) : String(val ?? "undefined");
17289
- ctx.send({ type: "info", message: `${args[1]} = ${display}` });
17290
- } else if (sub === "set" && args[1] && args[2] !== void 0) {
17291
- try {
17292
- ctx.config.setByPath(args[1], args.slice(2).join(" "));
17293
- ctx.send({ type: "info", message: `\u2713 ${args[1]} = ${args.slice(2).join(" ")}` });
17294
- } catch (err) {
17295
- ctx.send({ type: "error", message: `Config error: ${err.message}` });
17296
- }
17297
- } else {
17298
- ctx.send({ type: "info", message: "Usage: /config [show] | /config get <key> | /config set <key> <value>" });
17362
+ return;
17299
17363
  }
17364
+ ctx.send({
17365
+ type: outcome.isError ? "error" : "info",
17366
+ message: (outcome.changed ? "\u2713 " : "") + (outcome.summary ?? "")
17367
+ });
17300
17368
  }
17301
17369
  async function handleDoctor(_args, ctx) {
17302
17370
  const report = buildDoctorReport({
@@ -158,7 +158,7 @@ ${content}`);
158
158
  }
159
159
  }
160
160
  async function runTaskMode(config, providers, configManager, topic) {
161
- const { TaskOrchestrator } = await import("./task-orchestrator-HJUUL55Y.js");
161
+ const { TaskOrchestrator } = await import("./task-orchestrator-MFYEKR2I.js");
162
162
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
163
163
  let interrupted = false;
164
164
  const onSigint = () => {