jinzd-ai-cli 0.4.225 → 0.4.226

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 (26) hide show
  1. package/dist/{batch-OWM7PN4L.js → batch-IJ6X3SWP.js} +2 -2
  2. package/dist/{chunk-YENINV7F.js → chunk-55NPPWBW.js} +1 -1
  3. package/dist/{chunk-YUGXAALR.js → chunk-D5A2K4AO.js} +1 -1
  4. package/dist/{chunk-IZ4VM2P5.js → chunk-GOMPGWWO.js} +3 -3
  5. package/dist/{chunk-Q3XNGXNR.js → chunk-HZC6JFPM.js} +3 -3
  6. package/dist/{chunk-MFFMRTP6.js → chunk-KDJEFBOS.js} +3 -3
  7. package/dist/{chunk-6ISALPIH.js → chunk-NQYNIK4C.js} +1 -1
  8. package/dist/{chunk-RC7FBLFT.js → chunk-PEUYYZQU.js} +1 -1
  9. package/dist/{chunk-DUKZBAI4.js → chunk-QNIFXUKV.js} +1 -1
  10. package/dist/{chunk-M4QZYFPN.js → chunk-SHJL3ZEA.js} +1 -1
  11. package/dist/{chunk-BWCZYPEU.js → chunk-XN24Y4OZ.js} +2 -2
  12. package/dist/{ci-RTGUV5C3.js → ci-7SRQSN7E.js} +4 -4
  13. package/dist/{ci-format-QDBP5WBU.js → ci-format-FM52GDQG.js} +2 -2
  14. package/dist/{constants-P4NBXYN5.js → constants-LX5P32PH.js} +1 -1
  15. package/dist/{doctor-cli-SEX44HGI.js → doctor-cli-6KSSI65N.js} +4 -4
  16. package/dist/electron-server.js +47 -3
  17. package/dist/{hub-FAKZZQGX.js → hub-AWY3NZUF.js} +1 -1
  18. package/dist/index.js +113 -20
  19. package/dist/{pr-DK6ENTZN.js → pr-IO56XB47.js} +4 -4
  20. package/dist/{run-tests-COCXP4B6.js → run-tests-FKBEUFKX.js} +2 -2
  21. package/dist/{run-tests-P6F27SWN.js → run-tests-NQWCJSZX.js} +1 -1
  22. package/dist/{server-J4W6UZXJ.js → server-I2RRWW7W.js} +4 -4
  23. package/dist/{server-BG3J7GFG.js → server-Y7YXAYF3.js} +53 -9
  24. package/dist/{task-orchestrator-6LKQAS74.js → task-orchestrator-CODR7HC6.js} +4 -4
  25. package/dist/{usage-IPFSL5WT.js → usage-6H5AIUZM.js} +2 -2
  26. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-6ISALPIH.js";
4
+ } from "./chunk-NQYNIK4C.js";
5
5
  import "./chunk-5ULLIOVC.js";
6
- import "./chunk-DUKZBAI4.js";
6
+ import "./chunk-QNIFXUKV.js";
7
7
  import {
8
8
  atomicWriteFileSync
9
9
  } from "./chunk-IW3Q7AE5.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-DUKZBAI4.js";
4
+ } from "./chunk-QNIFXUKV.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  PLUGINS_DIR_NAME
5
- } from "./chunk-DUKZBAI4.js";
5
+ } from "./chunk-QNIFXUKV.js";
6
6
  import {
7
7
  atomicWriteFileSync
8
8
  } from "./chunk-IW3Q7AE5.js";
@@ -14,7 +14,7 @@ import {
14
14
  runHook,
15
15
  runLifecycleHooks,
16
16
  runTool
17
- } from "./chunk-YUGXAALR.js";
17
+ } from "./chunk-D5A2K4AO.js";
18
18
  import {
19
19
  getDangerLevel,
20
20
  isFileWriteTool,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-4BKXL7SM.js";
34
34
  import {
35
35
  runTestsTool
36
- } from "./chunk-RC7FBLFT.js";
36
+ } from "./chunk-PEUYYZQU.js";
37
37
  import {
38
38
  CONFIG_DIR_NAME,
39
39
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -43,7 +43,7 @@ import {
43
43
  SUBAGENT_ALLOWED_TOOLS,
44
44
  SUBAGENT_DEFAULT_MAX_ROUNDS,
45
45
  SUBAGENT_MAX_ROUNDS_LIMIT
46
- } from "./chunk-DUKZBAI4.js";
46
+ } from "./chunk-QNIFXUKV.js";
47
47
  import {
48
48
  loadChatIndex,
49
49
  searchChatMemory
@@ -11,10 +11,10 @@ import {
11
11
  listHooks,
12
12
  listInstalledPlugins,
13
13
  resetStats
14
- } from "./chunk-YUGXAALR.js";
14
+ } from "./chunk-D5A2K4AO.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-6ISALPIH.js";
17
+ } from "./chunk-NQYNIK4C.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-DUKZBAI4.js";
29
+ } from "./chunk-QNIFXUKV.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-YENINV7F.js";
5
+ } from "./chunk-55NPPWBW.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -13,10 +13,10 @@ import {
13
13
  } from "./chunk-PUBCJF7E.js";
14
14
  import {
15
15
  ConfigManager
16
- } from "./chunk-6ISALPIH.js";
16
+ } from "./chunk-NQYNIK4C.js";
17
17
  import {
18
18
  VERSION
19
- } from "./chunk-DUKZBAI4.js";
19
+ } from "./chunk-QNIFXUKV.js";
20
20
 
21
21
  // src/cli/ci.ts
22
22
  import { execFileSync } from "child_process";
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-DUKZBAI4.js";
11
+ } from "./chunk-QNIFXUKV.js";
12
12
  import {
13
13
  atomicWriteFileSync
14
14
  } from "./chunk-IW3Q7AE5.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-DUKZBAI4.js";
4
+ } from "./chunk-QNIFXUKV.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.225";
4
+ var VERSION = "0.4.226";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -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.225";
9
+ var VERSION = "0.4.226";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  truncateForPersist
4
- } from "./chunk-IZ4VM2P5.js";
4
+ } from "./chunk-GOMPGWWO.js";
5
5
  import {
6
6
  APP_NAME,
7
7
  CONFIG_DIR_NAME,
@@ -11,7 +11,7 @@ import {
11
11
  MCP_PROTOCOL_VERSION,
12
12
  MCP_TOOL_PREFIX,
13
13
  VERSION
14
- } from "./chunk-DUKZBAI4.js";
14
+ } from "./chunk-QNIFXUKV.js";
15
15
  import {
16
16
  atomicWriteFileSync
17
17
  } from "./chunk-IW3Q7AE5.js";
@@ -3,14 +3,14 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-MFFMRTP6.js";
7
- import "./chunk-YENINV7F.js";
6
+ } from "./chunk-KDJEFBOS.js";
7
+ import "./chunk-55NPPWBW.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-PUBCJF7E.js";
10
10
  import "./chunk-XPBEJB27.js";
11
- import "./chunk-6ISALPIH.js";
11
+ import "./chunk-NQYNIK4C.js";
12
12
  import "./chunk-5ULLIOVC.js";
13
- import "./chunk-DUKZBAI4.js";
13
+ import "./chunk-QNIFXUKV.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
15
  export {
16
16
  CI_COMMENT_MARKER,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-YENINV7F.js";
10
- import "./chunk-DUKZBAI4.js";
9
+ } from "./chunk-55NPPWBW.js";
10
+ import "./chunk-QNIFXUKV.js";
11
11
  export {
12
12
  DEFAULT_CI_THRESHOLDS,
13
13
  detectCiGateSignals,
@@ -38,7 +38,7 @@ import {
38
38
  TEST_TIMEOUT,
39
39
  VERSION,
40
40
  buildUserIdentityPrompt
41
- } from "./chunk-DUKZBAI4.js";
41
+ } from "./chunk-QNIFXUKV.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-Q3XNGXNR.js";
5
+ } from "./chunk-HZC6JFPM.js";
6
6
  import "./chunk-PUBCJF7E.js";
7
- import "./chunk-YUGXAALR.js";
7
+ import "./chunk-D5A2K4AO.js";
8
8
  import "./chunk-XPBEJB27.js";
9
- import "./chunk-6ISALPIH.js";
9
+ import "./chunk-NQYNIK4C.js";
10
10
  import "./chunk-5ULLIOVC.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
- import "./chunk-DUKZBAI4.js";
12
+ import "./chunk-QNIFXUKV.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
14
  export {
15
15
  formatDoctorReport,
@@ -38,7 +38,7 @@ import {
38
38
  VERSION,
39
39
  buildUserIdentityPrompt,
40
40
  runTestsTool
41
- } from "./chunk-M4QZYFPN.js";
41
+ } from "./chunk-SHJL3ZEA.js";
42
42
  import {
43
43
  hasSemanticIndex,
44
44
  semanticSearch
@@ -15289,6 +15289,50 @@ async function handleSession(args, ctx) {
15289
15289
  }
15290
15290
  if (sub === "delete" && args[1]) {
15291
15291
  const targetId = args[1];
15292
+ if (targetId === "--filter") {
15293
+ let filterMessages;
15294
+ for (let i = 1; i < args.length; i++) {
15295
+ if (args[i] === "--filter" && i + 1 < args.length) {
15296
+ const val = args[i + 1];
15297
+ i++;
15298
+ const eq = val.indexOf("=");
15299
+ if (eq > 0) {
15300
+ const key = val.slice(0, eq);
15301
+ const vals = val.slice(eq + 1).split(",").map((s) => s.trim().toLowerCase());
15302
+ if (key === "messages") {
15303
+ const n = Number(vals[0]);
15304
+ if (Number.isFinite(n) && n >= 0) filterMessages = n;
15305
+ }
15306
+ }
15307
+ }
15308
+ }
15309
+ if (filterMessages === void 0) {
15310
+ ctx.send({ type: "error", message: "Usage: /session delete --filter messages=N" });
15311
+ return;
15312
+ }
15313
+ const list2 = ctx.sessions.listSessions();
15314
+ const matches = list2.filter((s) => s.messageCount === filterMessages);
15315
+ if (matches.length === 0) {
15316
+ ctx.send({ type: "info", message: `No sessions with ${filterMessages} message(s) found.` });
15317
+ return;
15318
+ }
15319
+ let deleted = 0;
15320
+ let failed = 0;
15321
+ for (const s of matches) {
15322
+ if (ctx.sessions.deleteSession(s.id)) {
15323
+ deleted++;
15324
+ } else {
15325
+ failed++;
15326
+ }
15327
+ }
15328
+ if (!ctx.sessions.current) {
15329
+ ctx.sessions.createSession(ctx.currentProvider, ctx.currentModel);
15330
+ ctx.resetWebSessionUsage();
15331
+ }
15332
+ ctx.send({ type: "info", message: `Deleted ${deleted} session(s) with ${filterMessages} message(s)${failed > 0 ? `, ${failed} failed` : ""}.` });
15333
+ ctx.sendSessionList();
15334
+ return;
15335
+ }
15292
15336
  const cachedKey = ctx.unsavedSessions.has(targetId) ? targetId : [...ctx.unsavedSessions.keys()].find((k) => k.startsWith(targetId));
15293
15337
  if (cachedKey) {
15294
15338
  ctx.unsavedSessions.delete(cachedKey);
@@ -15363,7 +15407,7 @@ async function handleSession(args, ctx) {
15363
15407
  }
15364
15408
  return;
15365
15409
  }
15366
- ctx.send({ type: "info", message: "Usage: /session new | list | load <id> | delete <id> | rename <id> <title>" });
15410
+ ctx.send({ type: "info", message: "Usage: /session new | list | load <id> | delete <id> | delete --filter messages=N | rename <id> <title>" });
15367
15411
  }
15368
15412
  async function handleExport(args, ctx) {
15369
15413
  const format = args[0] === "json" ? "json" : "md";
@@ -15973,7 +16017,7 @@ async function handleSecurityReview(args, ctx) {
15973
16017
  async function handleTest(args, ctx) {
15974
16018
  ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
15975
16019
  try {
15976
- const { executeTests } = await import("./run-tests-P6F27SWN.js");
16020
+ const { executeTests } = await import("./run-tests-NQWCJSZX.js");
15977
16021
  const argStr = args.join(" ").trim();
15978
16022
  let testArgs = {};
15979
16023
  if (argStr) {
@@ -154,7 +154,7 @@ ${content}`);
154
154
  }
155
155
  }
156
156
  async function runTaskMode(config, providers, configManager, topic) {
157
- const { TaskOrchestrator } = await import("./task-orchestrator-6LKQAS74.js");
157
+ const { TaskOrchestrator } = await import("./task-orchestrator-CODR7HC6.js");
158
158
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
159
159
  let interrupted = false;
160
160
  const onSigint = () => {
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  scanProject,
15
15
  sessionHasMeaningfulContent,
16
16
  setupProxy
17
- } from "./chunk-BWCZYPEU.js";
17
+ } from "./chunk-XN24Y4OZ.js";
18
18
  import {
19
19
  buildReviewPrompt,
20
20
  buildSecurityReviewPrompt
@@ -52,7 +52,7 @@ import {
52
52
  theme,
53
53
  undoStack,
54
54
  updateMemoryApproval
55
- } from "./chunk-IZ4VM2P5.js";
55
+ } from "./chunk-GOMPGWWO.js";
56
56
  import "./chunk-K3CF65QH.js";
57
57
  import "./chunk-UUSRWSSX.js";
58
58
  import "./chunk-CKH4KQ4E.js";
@@ -74,7 +74,7 @@ import {
74
74
  formatDoctorReport,
75
75
  loadContextFiles,
76
76
  writeCrashLog
77
- } from "./chunk-Q3XNGXNR.js";
77
+ } from "./chunk-HZC6JFPM.js";
78
78
  import {
79
79
  ProviderRegistry
80
80
  } from "./chunk-PUBCJF7E.js";
@@ -94,7 +94,7 @@ import {
94
94
  trustHook,
95
95
  trustPlugin,
96
96
  untrustHook
97
- } from "./chunk-YUGXAALR.js";
97
+ } from "./chunk-D5A2K4AO.js";
98
98
  import {
99
99
  CONTENT_ONLY_STREAM_REMINDER,
100
100
  TEE_FINAL_USER_NUDGE,
@@ -116,7 +116,7 @@ import {
116
116
  } from "./chunk-XPBEJB27.js";
117
117
  import {
118
118
  ConfigManager
119
- } from "./chunk-6ISALPIH.js";
119
+ } from "./chunk-NQYNIK4C.js";
120
120
  import {
121
121
  AuthError,
122
122
  ProviderError,
@@ -130,7 +130,7 @@ import {
130
130
  import {
131
131
  fileCheckpoints
132
132
  } from "./chunk-4BKXL7SM.js";
133
- import "./chunk-RC7FBLFT.js";
133
+ import "./chunk-PEUYYZQU.js";
134
134
  import {
135
135
  AGENTIC_BEHAVIOR_GUIDELINE,
136
136
  AUTHOR,
@@ -149,7 +149,7 @@ import {
149
149
  SKILLS_DIR_NAME,
150
150
  VERSION,
151
151
  buildUserIdentityPrompt
152
- } from "./chunk-DUKZBAI4.js";
152
+ } from "./chunk-QNIFXUKV.js";
153
153
  import {
154
154
  buildChatIndex,
155
155
  clearChatIndex,
@@ -1833,7 +1833,7 @@ No tools match "${filter}".
1833
1833
  const { join: join7 } = await import("path");
1834
1834
  const { existsSync: existsSync6 } = await import("fs");
1835
1835
  const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
1836
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-P4NBXYN5.js");
1836
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-LX5P32PH.js");
1837
1837
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
1838
1838
  const cwd = process.cwd();
1839
1839
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -2812,7 +2812,7 @@ function createReviewCommands() {
2812
2812
  usage: "/test [command|filter]",
2813
2813
  async execute(args, ctx) {
2814
2814
  try {
2815
- const { executeTests } = await import("./run-tests-COCXP4B6.js");
2815
+ const { executeTests } = await import("./run-tests-FKBEUFKX.js");
2816
2816
  const argStr = args.join(" ").trim();
2817
2817
  let testArgs = {};
2818
2818
  if (argStr) {
@@ -3621,9 +3621,102 @@ function createSessionCommands() {
3621
3621
  }
3622
3622
  renderTranscriptPage(cur.messages, ctx.renderer, n);
3623
3623
  } else if (sub === "remove" || sub === "delete") {
3624
+ if (args[1] === "--filter") {
3625
+ let filterMessages;
3626
+ let dryRun = false;
3627
+ for (let i = 1; i < args.length; i++) {
3628
+ if (args[i] === "--filter" && i + 1 < args.length) {
3629
+ const val = args[++i];
3630
+ const eq = val.indexOf("=");
3631
+ if (eq > 0) {
3632
+ const key = val.slice(0, eq);
3633
+ const vals = val.slice(eq + 1).split(",").map((s) => s.trim().toLowerCase());
3634
+ if (key === "messages") {
3635
+ const n = Number(vals[0]);
3636
+ if (Number.isFinite(n) && n >= 0) filterMessages = n;
3637
+ else {
3638
+ ctx.renderer.renderError(`Invalid filter value for "messages": expected a non-negative integer, got "${vals[0]}"`);
3639
+ return;
3640
+ }
3641
+ } else {
3642
+ ctx.renderer.renderError(`Unsupported filter key for remove: "${key}". Only "messages" is supported.`);
3643
+ return;
3644
+ }
3645
+ } else {
3646
+ ctx.renderer.renderError(`Invalid --filter syntax: "${val}". Expected key=value (e.g., messages=0)`);
3647
+ return;
3648
+ }
3649
+ } else if (args[i] === "--dry-run") {
3650
+ dryRun = true;
3651
+ }
3652
+ }
3653
+ if (filterMessages === void 0) {
3654
+ ctx.renderer.renderError("Usage: /session remove --filter messages=N [--dry-run]");
3655
+ return;
3656
+ }
3657
+ const allSessions = ctx.sessions.listSessions();
3658
+ const matches3 = allSessions.filter((s) => s.messageCount === filterMessages);
3659
+ if (matches3.length === 0) {
3660
+ ctx.renderer.printInfo(`No sessions with ${filterMessages} message(s) found.`);
3661
+ return;
3662
+ }
3663
+ console.log();
3664
+ console.log(
3665
+ theme.warning(` Found ${matches3.length} session(s) with ${filterMessages} message(s):`)
3666
+ );
3667
+ for (const s of matches3.slice(0, 20)) {
3668
+ console.log(
3669
+ theme.dim(
3670
+ ` ${s.id.slice(0, 12)} ${s.provider}/${s.model} ${String(s.messageCount).padStart(4)} msgs ${s.updated.toISOString().slice(0, 10)} ${truncateTitle(s.title ?? "(untitled)", 60)}`
3671
+ )
3672
+ );
3673
+ }
3674
+ if (matches3.length > 20) {
3675
+ console.log(theme.dim(` ... and ${matches3.length - 20} more`));
3676
+ }
3677
+ if (dryRun) {
3678
+ console.log(
3679
+ theme.info(`
3680
+ --dry-run: no sessions were deleted. Remove --dry-run to actually delete.`)
3681
+ );
3682
+ return;
3683
+ }
3684
+ console.log();
3685
+ const choice2 = await ctx.select(
3686
+ `Delete all ${matches3.length} matching sessions?`,
3687
+ [
3688
+ { label: "No \u2014 keep them", value: "no" },
3689
+ { label: "Yes \u2014 delete permanently", value: "yes", hint: "unlinks all matching history files" }
3690
+ ]
3691
+ );
3692
+ if (choice2 !== "yes") {
3693
+ ctx.renderer.printInfo("Cancelled \u2014 no sessions deleted.");
3694
+ return;
3695
+ }
3696
+ let deleted = 0;
3697
+ let failed = 0;
3698
+ for (const s of matches3) {
3699
+ if (ctx.sessions.deleteSession(s.id)) {
3700
+ deleted++;
3701
+ } else {
3702
+ failed++;
3703
+ }
3704
+ }
3705
+ const currentStillExists = ctx.sessions.current !== null;
3706
+ ctx.renderer.printSuccess(
3707
+ `Removed: ${deleted} deleted${failed > 0 ? `, ${failed} failed` : ""}.`
3708
+ );
3709
+ if (!currentStillExists) {
3710
+ ctx.sessions.createSession(ctx.getCurrentProvider(), ctx.getCurrentModel());
3711
+ ctx.resetSessionTokenUsage();
3712
+ ctx.clearDevState();
3713
+ ctx.renderer.printInfo("Current session was among deleted \u2014 started a fresh session.");
3714
+ }
3715
+ return;
3716
+ }
3624
3717
  const id = args[1];
3625
3718
  if (!id) {
3626
- ctx.renderer.renderError("Usage: /session remove <id>");
3719
+ ctx.renderer.renderError("Usage: /session remove <id> | /session remove --filter messages=N [--dry-run]");
3627
3720
  return;
3628
3721
  }
3629
3722
  const sessions = ctx.sessions.listSessions();
@@ -3731,7 +3824,7 @@ function createSessionCommands() {
3731
3824
  `Cleaned up: ${deleted} deleted${failed > 0 ? `, ${failed} failed` : ""}.`
3732
3825
  );
3733
3826
  } else {
3734
- ctx.renderer.renderError("Usage: /session new|list|load <id>|show <id> [page]|page <n>|remove <id>");
3827
+ ctx.renderer.renderError("Usage: /session new|list|load <id>|show <id> [page]|page <n>|remove <id>|remove --filter messages=N [--dry-run]|clean --stale N [--dry-run]");
3735
3828
  }
3736
3829
  }
3737
3830
  },
@@ -7664,7 +7757,7 @@ program.command("web").description("Start Web UI server with browser-based chat
7664
7757
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
7665
7758
  process.exit(1);
7666
7759
  }
7667
- const { startWebServer } = await import("./server-BG3J7GFG.js");
7760
+ const { startWebServer } = await import("./server-Y7YXAYF3.js");
7668
7761
  await startWebServer({ port, host: options.host });
7669
7762
  });
7670
7763
  program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | logout-all <name> | migrate <name>)").action(async (action, username) => {
@@ -7831,11 +7924,11 @@ program.command("sessions").description("List recent conversation sessions").opt
7831
7924
  console.log(footer + "\n");
7832
7925
  });
7833
7926
  program.command("usage").description("Show token + cost usage grouped by provider/model (cross-session)").option("--days <n>", "Only the last N days (inclusive of today)").option("--month <ym>", "Only a specific month, format YYYY-MM (e.g. 2026-06)").option("--json", "Output as JSON (for scripting)").action(async (options) => {
7834
- const { runUsageCli } = await import("./usage-IPFSL5WT.js");
7927
+ const { runUsageCli } = await import("./usage-6H5AIUZM.js");
7835
7928
  await runUsageCli(options);
7836
7929
  });
7837
7930
  program.command("doctor").description("Health check: API keys, config, MCP, recent crashes, tool usage, disk usage").option("--json", "Output as JSON (for scripting)").option("--reset-stats", "Reset accumulated tool usage statistics").action(async (options) => {
7838
- const { runDoctorCli } = await import("./doctor-cli-SEX44HGI.js");
7931
+ const { runDoctorCli } = await import("./doctor-cli-6KSSI65N.js");
7839
7932
  const argv = process.argv.slice(2);
7840
7933
  await runDoctorCli({
7841
7934
  json: !!options.json || argv.includes("--json"),
@@ -7844,7 +7937,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
7844
7937
  });
7845
7938
  program.command("batch <action> [arg] [arg2]").description("Anthropic Message Batches: submit | list | status <id> | results <id> [out] | cancel <id>").option("--dry-run", "Parse and validate input without submitting (submit only)").action(async (action, arg, arg2, options) => {
7846
7939
  try {
7847
- const batch = await import("./batch-OWM7PN4L.js");
7940
+ const batch = await import("./batch-IJ6X3SWP.js");
7848
7941
  switch (action) {
7849
7942
  case "submit":
7850
7943
  if (!arg) {
@@ -7887,7 +7980,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
7887
7980
  }
7888
7981
  });
7889
7982
  program.command("mcp-serve").description("Start an MCP server over STDIO, exposing aicli's built-in tools to Claude Desktop / Cursor / other MCP clients").option("--allow-destructive", "Allow bash / run_interactive / task_create (always destructive in MCP mode)").option("--allow-outside-cwd", "Allow tool path arguments to escape the sandbox root \u2014 disabled by default").option("--tools <list>", "Comma-separated whitelist of tools to expose (default: all eligible tools)").option("--cwd <path>", "Working directory AND sandbox root (default: current directory)").action(async (options) => {
7890
- const { startMcpServer } = await import("./server-J4W6UZXJ.js");
7983
+ const { startMcpServer } = await import("./server-I2RRWW7W.js");
7891
7984
  await startMcpServer({
7892
7985
  allowDestructive: !!options.allowDestructive,
7893
7986
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7900,7 +7993,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7900
7993
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
7901
7994
  process.exit(1);
7902
7995
  }
7903
- const { runPrCli } = await import("./pr-DK6ENTZN.js");
7996
+ const { runPrCli } = await import("./pr-IO56XB47.js");
7904
7997
  const result = await runPrCli({
7905
7998
  action,
7906
7999
  target,
@@ -7920,8 +8013,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7920
8013
  process.exit(result.exitCode);
7921
8014
  });
7922
8015
  program.command("ci").description("Headless PR review (code + security) \u2014 reads git/gh diff, optionally posts to PR. Designed for GitHub Actions.").option("--pr <num>", "PR number or URL; diff fetched via gh pr diff <value>", (v) => /^#?\d+$/.test(v) ? parseInt(v.replace(/^#/, ""), 10) : v).option("--base <ref>", "Base ref for git diff <ref>...HEAD (ignored when --pr set)").option("--post", "Post review as a PR comment (requires gh CLI + GH_TOKEN, needs --pr)").option("--no-update", "Always create a new comment instead of updating the previous aicli review").option("--skip-code", "Skip the code review section").option("--skip-security", "Skip the security review section").option("--detailed", "Use the detailed code-review prompt").option("--max-diff <n>", "Max diff chars sent to the model (default 30000)", (v) => parseInt(v, 10)).option("--provider <id>", "Override provider (default: config.defaultProvider)").option("--model <id>", "Override model").option("--dry-run", "Print result to stdout instead of posting (overrides --post)").option("--json", "Output a structured JSON report").option("--markdown", "Output Markdown report (default)").option("--sarif", "Output SARIF 2.1.0 for code scanning artifacts").option("--fail-on-security-high", "Fail when the security review contains HIGH/CRITICAL findings (default)").option("--no-fail-on-security-high", "Do not fail on security HIGH/CRITICAL findings").option("--fail-on-test-failure", "Fail when the report mentions test failures (default)").option("--no-fail-on-test-failure", "Do not fail on test failure findings").option("--fail-on-lint-failure", "Fail when the report mentions lint/typecheck failures (default)").option("--no-fail-on-lint-failure", "Do not fail on lint/typecheck failure findings").action(async (options) => {
7923
- const { runCi } = await import("./ci-RTGUV5C3.js");
7924
- const { formatCiResult } = await import("./ci-format-QDBP5WBU.js");
8016
+ const { runCi } = await import("./ci-7SRQSN7E.js");
8017
+ const { formatCiResult } = await import("./ci-format-FM52GDQG.js");
7925
8018
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
7926
8019
  if (formats > 1) {
7927
8020
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -8079,7 +8172,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
8079
8172
  config.get("customProviders"),
8080
8173
  config.getConfigDir()
8081
8174
  );
8082
- const { startHub } = await import("./hub-FAKZZQGX.js");
8175
+ const { startHub } = await import("./hub-AWY3NZUF.js");
8083
8176
  await startHub(
8084
8177
  {
8085
8178
  topic: topic ?? "",
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-MFFMRTP6.js";
6
- import "./chunk-YENINV7F.js";
5
+ } from "./chunk-KDJEFBOS.js";
6
+ import "./chunk-55NPPWBW.js";
7
7
  import {
8
8
  buildReviewPrompt,
9
9
  buildSecurityReviewPrompt,
@@ -15,11 +15,11 @@ import {
15
15
  import "./chunk-XPBEJB27.js";
16
16
  import {
17
17
  ConfigManager
18
- } from "./chunk-6ISALPIH.js";
18
+ } from "./chunk-NQYNIK4C.js";
19
19
  import "./chunk-5ULLIOVC.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-DUKZBAI4.js";
22
+ } from "./chunk-QNIFXUKV.js";
23
23
  import "./chunk-IW3Q7AE5.js";
24
24
 
25
25
  // src/cli/pr.ts
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-RC7FBLFT.js";
6
- import "./chunk-DUKZBAI4.js";
5
+ } from "./chunk-PEUYYZQU.js";
6
+ import "./chunk-QNIFXUKV.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-M4QZYFPN.js";
4
+ } from "./chunk-SHJL3ZEA.js";
5
5
  export {
6
6
  executeTests,
7
7
  runTestsTool
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-IZ4VM2P5.js";
4
+ } from "./chunk-GOMPGWWO.js";
5
5
  import "./chunk-K3CF65QH.js";
6
6
  import "./chunk-UUSRWSSX.js";
7
7
  import "./chunk-CKH4KQ4E.js";
8
8
  import "./chunk-BXP6YZ2P.js";
9
9
  import {
10
10
  runTool
11
- } from "./chunk-YUGXAALR.js";
11
+ } from "./chunk-D5A2K4AO.js";
12
12
  import {
13
13
  getDangerLevel,
14
14
  schemaToJsonSchema
@@ -16,10 +16,10 @@ import {
16
16
  import "./chunk-5ULLIOVC.js";
17
17
  import "./chunk-HOSJZMQS.js";
18
18
  import "./chunk-4BKXL7SM.js";
19
- import "./chunk-RC7FBLFT.js";
19
+ import "./chunk-PEUYYZQU.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-DUKZBAI4.js";
22
+ } from "./chunk-QNIFXUKV.js";
23
23
  import "./chunk-NVUCDUXE.js";
24
24
  import "./chunk-KHYD3WXE.js";
25
25
  import "./chunk-B5TYJO7V.js";
@@ -23,7 +23,7 @@ import {
23
23
  scanDirTree,
24
24
  scanProject,
25
25
  setupProxy
26
- } from "./chunk-BWCZYPEU.js";
26
+ } from "./chunk-XN24Y4OZ.js";
27
27
  import {
28
28
  buildReviewPrompt,
29
29
  buildSecurityReviewPrompt
@@ -67,7 +67,7 @@ import {
67
67
  truncateOutput,
68
68
  undoStack,
69
69
  updateMemoryApproval
70
- } from "./chunk-IZ4VM2P5.js";
70
+ } from "./chunk-GOMPGWWO.js";
71
71
  import "./chunk-K3CF65QH.js";
72
72
  import "./chunk-UUSRWSSX.js";
73
73
  import "./chunk-CKH4KQ4E.js";
@@ -84,7 +84,7 @@ import {
84
84
  buildDoctorReport,
85
85
  formatDoctorReport,
86
86
  loadContextFiles
87
- } from "./chunk-Q3XNGXNR.js";
87
+ } from "./chunk-HZC6JFPM.js";
88
88
  import {
89
89
  ProviderRegistry
90
90
  } from "./chunk-PUBCJF7E.js";
@@ -102,7 +102,7 @@ import {
102
102
  runTool,
103
103
  setPluginEnabled,
104
104
  trustPlugin
105
- } from "./chunk-YUGXAALR.js";
105
+ } from "./chunk-D5A2K4AO.js";
106
106
  import {
107
107
  CONTENT_ONLY_STREAM_REMINDER,
108
108
  TEE_FINAL_USER_NUDGE,
@@ -121,7 +121,7 @@ import {
121
121
  } from "./chunk-XPBEJB27.js";
122
122
  import {
123
123
  ConfigManager
124
- } from "./chunk-6ISALPIH.js";
124
+ } from "./chunk-NQYNIK4C.js";
125
125
  import "./chunk-5ULLIOVC.js";
126
126
  import {
127
127
  formatGitContextForPrompt,
@@ -129,7 +129,7 @@ import {
129
129
  getGitRoot
130
130
  } from "./chunk-HOSJZMQS.js";
131
131
  import "./chunk-4BKXL7SM.js";
132
- import "./chunk-RC7FBLFT.js";
132
+ import "./chunk-PEUYYZQU.js";
133
133
  import {
134
134
  AGENTIC_BEHAVIOR_GUIDELINE,
135
135
  AUTHOR,
@@ -146,7 +146,7 @@ import {
146
146
  SKILLS_DIR_NAME,
147
147
  VERSION,
148
148
  buildUserIdentityPrompt
149
- } from "./chunk-DUKZBAI4.js";
149
+ } from "./chunk-QNIFXUKV.js";
150
150
  import "./chunk-NVUCDUXE.js";
151
151
  import "./chunk-KHYD3WXE.js";
152
152
  import {
@@ -870,6 +870,50 @@ async function handleSession(args, ctx) {
870
870
  }
871
871
  if (sub === "delete" && args[1]) {
872
872
  const targetId = args[1];
873
+ if (targetId === "--filter") {
874
+ let filterMessages;
875
+ for (let i = 1; i < args.length; i++) {
876
+ if (args[i] === "--filter" && i + 1 < args.length) {
877
+ const val = args[i + 1];
878
+ i++;
879
+ const eq = val.indexOf("=");
880
+ if (eq > 0) {
881
+ const key = val.slice(0, eq);
882
+ const vals = val.slice(eq + 1).split(",").map((s) => s.trim().toLowerCase());
883
+ if (key === "messages") {
884
+ const n = Number(vals[0]);
885
+ if (Number.isFinite(n) && n >= 0) filterMessages = n;
886
+ }
887
+ }
888
+ }
889
+ }
890
+ if (filterMessages === void 0) {
891
+ ctx.send({ type: "error", message: "Usage: /session delete --filter messages=N" });
892
+ return;
893
+ }
894
+ const list2 = ctx.sessions.listSessions();
895
+ const matches = list2.filter((s) => s.messageCount === filterMessages);
896
+ if (matches.length === 0) {
897
+ ctx.send({ type: "info", message: `No sessions with ${filterMessages} message(s) found.` });
898
+ return;
899
+ }
900
+ let deleted = 0;
901
+ let failed = 0;
902
+ for (const s of matches) {
903
+ if (ctx.sessions.deleteSession(s.id)) {
904
+ deleted++;
905
+ } else {
906
+ failed++;
907
+ }
908
+ }
909
+ if (!ctx.sessions.current) {
910
+ ctx.sessions.createSession(ctx.currentProvider, ctx.currentModel);
911
+ ctx.resetWebSessionUsage();
912
+ }
913
+ ctx.send({ type: "info", message: `Deleted ${deleted} session(s) with ${filterMessages} message(s)${failed > 0 ? `, ${failed} failed` : ""}.` });
914
+ ctx.sendSessionList();
915
+ return;
916
+ }
873
917
  const cachedKey = ctx.unsavedSessions.has(targetId) ? targetId : [...ctx.unsavedSessions.keys()].find((k) => k.startsWith(targetId));
874
918
  if (cachedKey) {
875
919
  ctx.unsavedSessions.delete(cachedKey);
@@ -944,7 +988,7 @@ async function handleSession(args, ctx) {
944
988
  }
945
989
  return;
946
990
  }
947
- ctx.send({ type: "info", message: "Usage: /session new | list | load <id> | delete <id> | rename <id> <title>" });
991
+ ctx.send({ type: "info", message: "Usage: /session new | list | load <id> | delete <id> | delete --filter messages=N | rename <id> <title>" });
948
992
  }
949
993
  async function handleExport(args, ctx) {
950
994
  const format = args[0] === "json" ? "json" : "md";
@@ -1554,7 +1598,7 @@ async function handleSecurityReview(args, ctx) {
1554
1598
  async function handleTest(args, ctx) {
1555
1599
  ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
1556
1600
  try {
1557
- const { executeTests } = await import("./run-tests-COCXP4B6.js");
1601
+ const { executeTests } = await import("./run-tests-FKBEUFKX.js");
1558
1602
  const argStr = args.join(" ").trim();
1559
1603
  let testArgs = {};
1560
1604
  if (argStr) {
@@ -3,14 +3,14 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-IZ4VM2P5.js";
6
+ } from "./chunk-GOMPGWWO.js";
7
7
  import "./chunk-K3CF65QH.js";
8
8
  import "./chunk-UUSRWSSX.js";
9
9
  import "./chunk-CKH4KQ4E.js";
10
10
  import "./chunk-BXP6YZ2P.js";
11
11
  import {
12
12
  runTool
13
- } from "./chunk-YUGXAALR.js";
13
+ } from "./chunk-D5A2K4AO.js";
14
14
  import {
15
15
  getDangerLevel,
16
16
  runLeanAgentLoop
@@ -18,10 +18,10 @@ import {
18
18
  import "./chunk-5ULLIOVC.js";
19
19
  import "./chunk-HOSJZMQS.js";
20
20
  import "./chunk-4BKXL7SM.js";
21
- import "./chunk-RC7FBLFT.js";
21
+ import "./chunk-PEUYYZQU.js";
22
22
  import {
23
23
  SUBAGENT_ALLOWED_TOOLS
24
- } from "./chunk-DUKZBAI4.js";
24
+ } from "./chunk-QNIFXUKV.js";
25
25
  import "./chunk-NVUCDUXE.js";
26
26
  import "./chunk-KHYD3WXE.js";
27
27
  import "./chunk-B5TYJO7V.js";
@@ -8,9 +8,9 @@ import {
8
8
  } from "./chunk-E44DTERW.js";
9
9
  import {
10
10
  ConfigManager
11
- } from "./chunk-6ISALPIH.js";
11
+ } from "./chunk-NQYNIK4C.js";
12
12
  import "./chunk-5ULLIOVC.js";
13
- import "./chunk-DUKZBAI4.js";
13
+ import "./chunk-QNIFXUKV.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
15
 
16
16
  // src/cli/usage.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.225",
3
+ "version": "0.4.226",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",