jinzd-ai-cli 0.4.218 → 0.4.220
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 +102 -99
- package/README.zh-CN.md +40 -38
- package/dist/{batch-7V7OTMUP.js → batch-QBSKTLTO.js} +3 -3
- package/dist/{chunk-TZQHYZKT.js → chunk-5ULLIOVC.js} +1 -0
- package/dist/{chunk-P4VBLXKS.js → chunk-5WBNXYDJ.js} +2 -2
- package/dist/chunk-ALQN7VUJ.js +604 -0
- package/dist/{chunk-C2Z42DI5.js → chunk-CAUHLHDR.js} +1 -1
- package/dist/{chunk-GX3HSGJX.js → chunk-IZW5LMI6.js} +166 -638
- package/dist/chunk-P3LKFA54.js +639 -0
- package/dist/{chunk-5CA2TJ5F.js → chunk-P4DYAGUI.js} +1 -1
- package/dist/{chunk-L4UREAID.js → chunk-P4PTXCHY.js} +6 -5
- package/dist/{chunk-QMXC327F.js → chunk-PUBCJF7E.js} +213 -175
- package/dist/{chunk-NTCB7CMT.js → chunk-QZYNRCPX.js} +1 -1
- package/dist/{chunk-H2UIHGHH.js → chunk-VHX7KZDY.js} +29 -189
- package/dist/{chunk-VGFTM3XT.js → chunk-Y25MSSUP.js} +1 -1
- package/dist/{ci-L6GH2WVC.js → ci-5SNXGM3M.js} +6 -6
- package/dist/{ci-format-WW7454AY.js → ci-format-57QQTHQE.js} +2 -2
- package/dist/{constants-NCTFSHDU.js → constants-ML5KFEOH.js} +1 -1
- package/dist/doctor-cli-ZRH3XZ3R.js +17 -0
- package/dist/electron-server.js +836 -470
- package/dist/{hub-CDL6T7CP.js → hub-IPLMJ6TJ.js} +1 -1
- package/dist/index.js +125 -194
- package/dist/{pr-D6PEKEGK.js → pr-GJYDAPK4.js} +8 -7
- package/dist/{run-tests-NXVVKAK2.js → run-tests-GK5AIAV2.js} +1 -1
- package/dist/{run-tests-SWU2XEV7.js → run-tests-KLQAI5CX.js} +2 -2
- package/dist/{server-WUT7VYTD.js → server-5FZDALHH.js} +10 -10
- package/dist/{server-LHYSS6CK.js → server-RU36PRSH.js} +74 -83
- package/dist/{task-orchestrator-C5AA2BI5.js → task-orchestrator-JMHPVNUO.js} +10 -10
- package/dist/{usage-6ZUUJBI2.js → usage-IRMRCCKN.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-MWKE2TNS.js +0 -129
- package/dist/chunk-OUC75QCF.js +0 -166
- package/dist/doctor-cli-EWMFBP5Q.js +0 -226
|
@@ -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-
|
|
157
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-JMHPVNUO.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
autoTrimSessionIfNeeded,
|
|
7
7
|
buildInitPrompt,
|
|
8
8
|
clearDevState,
|
|
9
|
-
loadContextFiles,
|
|
10
9
|
loadDevState,
|
|
11
10
|
parseSimpleYaml,
|
|
12
11
|
persistToolRound,
|
|
@@ -15,7 +14,7 @@ import {
|
|
|
15
14
|
scanProject,
|
|
16
15
|
sessionHasMeaningfulContent,
|
|
17
16
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VHX7KZDY.js";
|
|
19
18
|
import {
|
|
20
19
|
buildReviewPrompt,
|
|
21
20
|
buildSecurityReviewPrompt
|
|
@@ -28,48 +27,35 @@ import {
|
|
|
28
27
|
cleanupRejectedTeeFile,
|
|
29
28
|
clearRecentlyDeniedAutoActions,
|
|
30
29
|
deleteMemoryEntry,
|
|
31
|
-
describePlugin,
|
|
32
30
|
estimateTokens,
|
|
33
31
|
expireMemoryEntry,
|
|
34
32
|
exportMemoryEntries,
|
|
35
33
|
formatMemoryForPrompt,
|
|
36
34
|
formatPermissionProfileWarning,
|
|
37
|
-
getActivePluginAssets,
|
|
38
|
-
getInstalledPlugin,
|
|
39
|
-
getPendingHookTrust,
|
|
40
35
|
getRecentlyDeniedAutoActions,
|
|
41
36
|
googleSearchContext,
|
|
42
37
|
initTheme,
|
|
43
|
-
installPlugin,
|
|
44
38
|
isInterrupted,
|
|
45
39
|
isMemoryExpired,
|
|
46
40
|
lastResponseStore,
|
|
47
|
-
listHooks,
|
|
48
|
-
listInstalledPlugins,
|
|
49
41
|
listMemoryEntries,
|
|
50
42
|
memoryMarkdownPath,
|
|
51
43
|
memoryStorePath,
|
|
52
|
-
mergePluginHooks,
|
|
53
|
-
pluginRoot,
|
|
54
44
|
renderDiff,
|
|
55
45
|
requestInterrupt,
|
|
56
46
|
resetInterrupt,
|
|
57
47
|
rlInternal,
|
|
58
|
-
runLifecycleHooks,
|
|
59
48
|
setContextWindow,
|
|
60
49
|
setMaxOutputCap,
|
|
61
|
-
setPluginEnabled,
|
|
62
50
|
spawnAgentContext,
|
|
63
51
|
theme,
|
|
64
|
-
trustHook,
|
|
65
|
-
trustPlugin,
|
|
66
52
|
undoStack,
|
|
67
|
-
untrustHook,
|
|
68
53
|
updateMemoryApproval
|
|
69
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-IZW5LMI6.js";
|
|
55
|
+
import "./chunk-K3CF65QH.js";
|
|
70
56
|
import "./chunk-T2NL5ZIA.js";
|
|
71
57
|
import "./chunk-BXP6YZ2P.js";
|
|
72
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-Y25MSSUP.js";
|
|
73
59
|
import {
|
|
74
60
|
SessionManager,
|
|
75
61
|
getContentText
|
|
@@ -83,19 +69,45 @@ import {
|
|
|
83
69
|
getPricing
|
|
84
70
|
} from "./chunk-E44DTERW.js";
|
|
85
71
|
import {
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
fileCheckpoints
|
|
73
|
+
} from "./chunk-4BKXL7SM.js";
|
|
74
|
+
import {
|
|
75
|
+
buildChatIndex,
|
|
76
|
+
clearChatIndex,
|
|
77
|
+
getChatIndexStatus,
|
|
78
|
+
searchChatMemory
|
|
79
|
+
} from "./chunk-TB4W4Y4T.js";
|
|
80
|
+
import "./chunk-KHYD3WXE.js";
|
|
81
|
+
import {
|
|
82
|
+
DEFAULT_PATTERNS,
|
|
83
|
+
scanString
|
|
84
|
+
} from "./chunk-SLSWPBK3.js";
|
|
85
|
+
import {
|
|
86
|
+
buildDoctorReport,
|
|
87
|
+
formatDoctorReport,
|
|
88
|
+
loadContextFiles,
|
|
88
89
|
writeCrashLog
|
|
89
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-P3LKFA54.js";
|
|
90
91
|
import {
|
|
91
92
|
ProviderRegistry
|
|
92
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-PUBCJF7E.js";
|
|
93
94
|
import {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
describePlugin,
|
|
96
|
+
getActivePluginAssets,
|
|
97
|
+
getInstalledPlugin,
|
|
98
|
+
getPendingHookTrust,
|
|
99
|
+
installFlushOnExit,
|
|
100
|
+
installPlugin,
|
|
101
|
+
listHooks,
|
|
102
|
+
listInstalledPlugins,
|
|
103
|
+
mergePluginHooks,
|
|
104
|
+
pluginRoot,
|
|
105
|
+
runLifecycleHooks,
|
|
106
|
+
setPluginEnabled,
|
|
107
|
+
trustHook,
|
|
108
|
+
trustPlugin,
|
|
109
|
+
untrustHook
|
|
110
|
+
} from "./chunk-ALQN7VUJ.js";
|
|
99
111
|
import {
|
|
100
112
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
101
113
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -117,12 +129,12 @@ import {
|
|
|
117
129
|
} from "./chunk-XPBEJB27.js";
|
|
118
130
|
import {
|
|
119
131
|
ConfigManager
|
|
120
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-5WBNXYDJ.js";
|
|
121
133
|
import {
|
|
122
134
|
AuthError,
|
|
123
135
|
ProviderError,
|
|
124
136
|
RateLimitError
|
|
125
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-5ULLIOVC.js";
|
|
126
138
|
import {
|
|
127
139
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
128
140
|
AUTHOR,
|
|
@@ -135,34 +147,18 @@ import {
|
|
|
135
147
|
DESCRIPTION,
|
|
136
148
|
DEV_STATE_FILE_NAME,
|
|
137
149
|
MCP_PROJECT_CONFIG_NAME,
|
|
138
|
-
MEMORY_FILE_NAME,
|
|
139
150
|
PLAN_MODE_READONLY_TOOLS,
|
|
140
151
|
PLAN_MODE_SYSTEM_ADDON,
|
|
141
152
|
REPO_URL,
|
|
142
153
|
SKILLS_DIR_NAME,
|
|
143
154
|
VERSION,
|
|
144
155
|
buildUserIdentityPrompt
|
|
145
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-QZYNRCPX.js";
|
|
146
157
|
import {
|
|
147
158
|
formatGitContextForPrompt,
|
|
148
159
|
getGitContext,
|
|
149
160
|
getGitRoot
|
|
150
161
|
} from "./chunk-HOSJZMQS.js";
|
|
151
|
-
import {
|
|
152
|
-
fileCheckpoints
|
|
153
|
-
} from "./chunk-4BKXL7SM.js";
|
|
154
|
-
import {
|
|
155
|
-
buildChatIndex,
|
|
156
|
-
clearChatIndex,
|
|
157
|
-
getChatIndexStatus,
|
|
158
|
-
searchChatMemory
|
|
159
|
-
} from "./chunk-TB4W4Y4T.js";
|
|
160
|
-
import "./chunk-KHYD3WXE.js";
|
|
161
|
-
import {
|
|
162
|
-
DEFAULT_PATTERNS,
|
|
163
|
-
scanString
|
|
164
|
-
} from "./chunk-SLSWPBK3.js";
|
|
165
|
-
import "./chunk-K3CF65QH.js";
|
|
166
162
|
import "./chunk-CKH4KQ4E.js";
|
|
167
163
|
import {
|
|
168
164
|
atomicWriteFileSync
|
|
@@ -173,7 +169,7 @@ import { program } from "commander";
|
|
|
173
169
|
|
|
174
170
|
// src/repl/repl.ts
|
|
175
171
|
import * as readline from "readline";
|
|
176
|
-
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as
|
|
172
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, mkdirSync as mkdirSync4 } from "fs";
|
|
177
173
|
import { join as join4, resolve as resolve2, extname as extname2, dirname as dirname3, basename as basename2 } from "path";
|
|
178
174
|
import chalk4 from "chalk";
|
|
179
175
|
|
|
@@ -666,7 +662,7 @@ Error${typeName}: ${lines.join("\n")}
|
|
|
666
662
|
};
|
|
667
663
|
|
|
668
664
|
// src/repl/commands/index.ts
|
|
669
|
-
import { writeFileSync, mkdirSync as mkdirSync2, existsSync as existsSync2, readFileSync
|
|
665
|
+
import { writeFileSync, mkdirSync as mkdirSync2, existsSync as existsSync2, readFileSync } from "fs";
|
|
670
666
|
import { execSync as execSync2 } from "child_process";
|
|
671
667
|
import { platform } from "os";
|
|
672
668
|
import { resolve, dirname as dirname2, join as join2, basename } from "path";
|
|
@@ -895,7 +891,7 @@ function createDefaultCommands() {
|
|
|
895
891
|
title: "Chat & model",
|
|
896
892
|
rows: [
|
|
897
893
|
["/provider <name>", "Switch AI provider"],
|
|
898
|
-
["/model
|
|
894
|
+
["/model [name|refresh|cache]", "Switch model or refresh live model cache"],
|
|
899
895
|
["/route [on|off|show|test <msg>]", "Smart model routing rules"],
|
|
900
896
|
["/think [on|off|status]", "Toggle Extended Thinking (deep reasoning)"],
|
|
901
897
|
["/plan [execute|exit|status]", "Enter/manage Plan Mode (read-only)"],
|
|
@@ -1063,13 +1059,46 @@ No commands match "${filter}".
|
|
|
1063
1059
|
},
|
|
1064
1060
|
{
|
|
1065
1061
|
name: "model",
|
|
1066
|
-
description: "Switch model
|
|
1067
|
-
usage: "/model [name]",
|
|
1062
|
+
description: "Switch model, refresh live model list, or inspect model cache",
|
|
1063
|
+
usage: "/model [name|refresh [provider]|cache [clear [provider]]]",
|
|
1068
1064
|
async execute(args, ctx) {
|
|
1065
|
+
const sub = (args[0] ?? "").toLowerCase();
|
|
1066
|
+
if (sub === "refresh") {
|
|
1067
|
+
const providerId = args[1] ?? ctx.getCurrentProvider();
|
|
1068
|
+
if (!ctx.providers.has(providerId)) {
|
|
1069
|
+
ctx.renderer.printInfo(`Provider is not configured: ${providerId}`);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
ctx.renderer.printInfo(`Refreshing models for ${providerId}...`);
|
|
1073
|
+
try {
|
|
1074
|
+
const models = await ctx.providers.refreshModels(providerId);
|
|
1075
|
+
ctx.renderer.printSuccess(`Refreshed ${models.length} model(s) for ${providerId}.`);
|
|
1076
|
+
} catch (err) {
|
|
1077
|
+
ctx.renderer.printInfo(`Model refresh failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1078
|
+
}
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
if (sub === "cache") {
|
|
1082
|
+
if ((args[1] ?? "").toLowerCase() === "clear") {
|
|
1083
|
+
const providerId = args[2];
|
|
1084
|
+
ctx.providers.clearModelCache(providerId);
|
|
1085
|
+
ctx.renderer.printSuccess(providerId ? `Cleared model cache for ${providerId}.` : "Cleared model cache.");
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
const rows = ctx.providers.getModelCacheStatus();
|
|
1089
|
+
if (rows.length === 0) {
|
|
1090
|
+
ctx.renderer.printInfo("Model cache is empty. Use /model refresh to populate it.");
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
ctx.renderer.printTable(
|
|
1094
|
+
["Provider", "Models", "Fetched"],
|
|
1095
|
+
rows.map((row) => [row.providerId, row.count, row.fetchedAt])
|
|
1096
|
+
);
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1069
1099
|
let targetModel;
|
|
1070
1100
|
if (!args[0]) {
|
|
1071
|
-
const
|
|
1072
|
-
const models = await provider.listModels();
|
|
1101
|
+
const models = await ctx.providers.listModels(ctx.getCurrentProvider());
|
|
1073
1102
|
const currentModel = ctx.getCurrentModel();
|
|
1074
1103
|
const items = models.map((m) => ({
|
|
1075
1104
|
value: m.id,
|
|
@@ -1077,7 +1106,9 @@ No commands match "${filter}".
|
|
|
1077
1106
|
hint: [
|
|
1078
1107
|
m.displayName,
|
|
1079
1108
|
`ctx:${fmtCtx(m.contextWindow)}`,
|
|
1080
|
-
m.supportsThinking ? "
|
|
1109
|
+
m.supportsThinking ? "thinking" : "",
|
|
1110
|
+
m.metadataUnknown ? "metadata?" : "",
|
|
1111
|
+
m.source && m.source !== "curated" ? m.source : "",
|
|
1081
1112
|
m.id === currentModel ? "(current)" : ""
|
|
1082
1113
|
].filter(Boolean).join(" ")
|
|
1083
1114
|
}));
|
|
@@ -1765,7 +1796,7 @@ No tools match "${filter}".
|
|
|
1765
1796
|
const { join: join5 } = await import("path");
|
|
1766
1797
|
const { existsSync: existsSync5 } = await import("fs");
|
|
1767
1798
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1768
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1799
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-ML5KFEOH.js");
|
|
1769
1800
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1770
1801
|
const cwd = process.cwd();
|
|
1771
1802
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2824,7 +2855,7 @@ ${hint}` : "")
|
|
|
2824
2855
|
usage: "/test [command|filter]",
|
|
2825
2856
|
async execute(args, ctx) {
|
|
2826
2857
|
try {
|
|
2827
|
-
const { executeTests } = await import("./run-tests-
|
|
2858
|
+
const { executeTests } = await import("./run-tests-KLQAI5CX.js");
|
|
2828
2859
|
const argStr = args.join(" ").trim();
|
|
2829
2860
|
let testArgs = {};
|
|
2830
2861
|
if (argStr) {
|
|
@@ -3185,126 +3216,16 @@ ${hint}` : "")
|
|
|
3185
3216
|
// ── /doctor ────────────────────────────────────────────────────────────────
|
|
3186
3217
|
{
|
|
3187
3218
|
name: "doctor",
|
|
3188
|
-
description: "Health check:
|
|
3219
|
+
description: "Health check: context, permissions, hooks, plugins, MCP, config",
|
|
3189
3220
|
usage: "/doctor",
|
|
3190
3221
|
execute(_args, ctx) {
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
}
|
|
3199
|
-
console.log();
|
|
3200
|
-
const configDir = ctx.config.getConfigDir();
|
|
3201
|
-
console.log(theme.heading("Config Files:"));
|
|
3202
|
-
console.log(` Dir: ${theme.accent(configDir)}`);
|
|
3203
|
-
const checkFile = (label, filePath) => {
|
|
3204
|
-
const exists = existsSync2(filePath);
|
|
3205
|
-
const icon = exists ? theme.success("\u2713") : theme.dim("\u2013");
|
|
3206
|
-
let extra = "";
|
|
3207
|
-
if (exists) {
|
|
3208
|
-
try {
|
|
3209
|
-
extra = theme.dim(` (${statSync2(filePath).size} bytes)`);
|
|
3210
|
-
} catch {
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
console.log(` ${icon} ${label.padEnd(14)} ${exists ? filePath : theme.dim("(not found)")}${extra}`);
|
|
3214
|
-
};
|
|
3215
|
-
checkFile("config.json", join2(configDir, "config.json"));
|
|
3216
|
-
checkFile("memory.md", join2(configDir, MEMORY_FILE_NAME));
|
|
3217
|
-
checkFile("dev-state.md", join2(configDir, "dev-state.md"));
|
|
3218
|
-
console.log();
|
|
3219
|
-
const mcpManager = ctx.getMcpManager();
|
|
3220
|
-
if (mcpManager) {
|
|
3221
|
-
console.log(theme.heading("MCP Servers:"));
|
|
3222
|
-
const statuses = mcpManager.getStatus();
|
|
3223
|
-
if (statuses.length === 0) {
|
|
3224
|
-
console.log(theme.dim(" (no servers configured)"));
|
|
3225
|
-
} else {
|
|
3226
|
-
for (const s of statuses) {
|
|
3227
|
-
const icon = s.connected ? theme.success(" \u2713") : theme.error(" \u2717");
|
|
3228
|
-
const state = s.connected ? theme.success(`connected`) + theme.dim(` \xB7 ${s.serverName} \xB7 ${s.toolCount} tools`) : theme.error("disconnected") + (s.error ? theme.dim(` \xB7 ${s.error}`) : "");
|
|
3229
|
-
console.log(`${icon} ${s.serverId.padEnd(16)} ${state}`);
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
console.log();
|
|
3233
|
-
}
|
|
3234
|
-
const provider = ctx.getCurrentProvider();
|
|
3235
|
-
const model = ctx.getCurrentModel();
|
|
3236
|
-
const ctxTokens = ctx.estimateConversationTokens();
|
|
3237
|
-
const ctxWindow = ctx.getContextWindowSize();
|
|
3238
|
-
const pct = ctxWindow > 0 ? Math.round(ctxTokens / ctxWindow * 100) : 0;
|
|
3239
|
-
const pctColor = pct > 80 ? theme.error : pct > 60 ? theme.warning : theme.success;
|
|
3240
|
-
const dirs = ctx.listContextDirs();
|
|
3241
|
-
console.log(theme.heading("Current Session:"));
|
|
3242
|
-
console.log(` Provider: ${theme.accent(provider)}`);
|
|
3243
|
-
console.log(` Model: ${theme.accent(model)}`);
|
|
3244
|
-
console.log(` Context: ${pctColor(`${pct}%`)} (est. ${ctxTokens.toLocaleString()} / ${ctxWindow.toLocaleString()} tokens)`);
|
|
3245
|
-
if (dirs.length > 0) {
|
|
3246
|
-
console.log(` Extra dirs: ${dirs.map((d) => d.dir).join(", ")}`);
|
|
3247
|
-
}
|
|
3248
|
-
console.log();
|
|
3249
|
-
const crashes = listRecentCrashes(5, configDir);
|
|
3250
|
-
console.log(theme.heading("Recent Crashes (last 5):"));
|
|
3251
|
-
if (crashes.length === 0) {
|
|
3252
|
-
console.log(theme.dim(" (none \u2014 clean!)"));
|
|
3253
|
-
} else {
|
|
3254
|
-
for (const c of crashes) {
|
|
3255
|
-
console.log(` ${theme.error("\u2717")} ${c.timestamp} ${theme.warning(c.kind)}`);
|
|
3256
|
-
console.log(` ${theme.dim(c.message)}`);
|
|
3257
|
-
console.log(` ${theme.dim(c.file)}`);
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3260
|
-
console.log();
|
|
3261
|
-
const allStats = getStatsSnapshot();
|
|
3262
|
-
const totalCalls = allStats.reduce((a, b) => a + b.calls, 0);
|
|
3263
|
-
const totalFails = allStats.reduce((a, b) => a + b.failures, 0);
|
|
3264
|
-
const topUsed = getTopUsedTools(5);
|
|
3265
|
-
const topFailing = getTopFailingTools(5);
|
|
3266
|
-
console.log(theme.heading("Tool Usage:"));
|
|
3267
|
-
const pctFail = totalCalls ? (totalFails * 100 / totalCalls).toFixed(1) : "0.0";
|
|
3268
|
-
console.log(` total: ${totalCalls} calls \xB7 ${totalFails} failures (${pctFail}%)`);
|
|
3269
|
-
if (topUsed.length > 0) {
|
|
3270
|
-
console.log(theme.dim(" top used:"));
|
|
3271
|
-
for (const t of topUsed) {
|
|
3272
|
-
const avg = t.calls ? (t.totalDurationMs / t.calls).toFixed(0) : "0";
|
|
3273
|
-
console.log(` ${t.name.padEnd(20)} ${String(t.calls).padStart(6)} calls \xB7 avg ${avg}ms`);
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
if (topFailing.length > 0) {
|
|
3277
|
-
console.log(theme.dim(" top failing:"));
|
|
3278
|
-
for (const t of topFailing) {
|
|
3279
|
-
const rate = (t.failures * 100 / Math.max(1, t.calls)).toFixed(1);
|
|
3280
|
-
const msg = t.lastFailureMessage ? ` \xB7 ${theme.dim(t.lastFailureMessage.slice(0, 80))}` : "";
|
|
3281
|
-
console.log(` ${theme.error(t.name.padEnd(20))} ${t.failures}/${t.calls} (${rate}%)${msg}`);
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
console.log();
|
|
3285
|
-
const usage = getConfigDirUsage(configDir);
|
|
3286
|
-
const fmt = (n) => {
|
|
3287
|
-
if (n < 1024) return `${n} B`;
|
|
3288
|
-
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
3289
|
-
if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
3290
|
-
return `${(n / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
3291
|
-
};
|
|
3292
|
-
const dirAnnotations = {
|
|
3293
|
-
models: "semantic search model \u2192 /index semantic-clear to free",
|
|
3294
|
-
index: "symbol index \u2192 /index clear to rebuild",
|
|
3295
|
-
history: "conversation history \u2192 auto-pruned after 30 days",
|
|
3296
|
-
logs: "crash logs",
|
|
3297
|
-
"memory-index": "chat memory index \u2192 /memory index-clear to free"
|
|
3298
|
-
};
|
|
3299
|
-
console.log(theme.heading("Disk Usage (~/.aicli):"));
|
|
3300
|
-
console.log(` total: ${theme.accent(fmt(usage.totalBytes))}`);
|
|
3301
|
-
for (const e of usage.entries.slice(0, 10)) {
|
|
3302
|
-
const note = dirAnnotations[e.name];
|
|
3303
|
-
const noteStr = note ? ` ${theme.dim("\xB7")} ${theme.dim(note)}` : "";
|
|
3304
|
-
console.log(` ${e.name.padEnd(18)} ${theme.dim(fmt(e.bytes))}${noteStr}`);
|
|
3305
|
-
}
|
|
3306
|
-
console.log();
|
|
3307
|
-
console.log(theme.success("\u2713 Health check complete\n"));
|
|
3222
|
+
const report = buildDoctorReport({
|
|
3223
|
+
config: ctx.config,
|
|
3224
|
+
providers: ctx.providers,
|
|
3225
|
+
cwd: process.cwd(),
|
|
3226
|
+
mcpStatuses: ctx.getMcpManager()?.getStatus() ?? []
|
|
3227
|
+
});
|
|
3228
|
+
console.log(formatDoctorReport(report, true));
|
|
3308
3229
|
}
|
|
3309
3230
|
},
|
|
3310
3231
|
{
|
|
@@ -3900,6 +3821,7 @@ var PROVIDERS = [
|
|
|
3900
3821
|
{ value: "zhipu", name: "Zhipu (GLM)" },
|
|
3901
3822
|
{ value: "kimi", name: "Kimi (Moonshot AI)" },
|
|
3902
3823
|
{ value: "minimax", name: "MiniMax (\u6D77\u87BA)" },
|
|
3824
|
+
{ value: "qwen", name: "Qwen (Alibaba Cloud)" },
|
|
3903
3825
|
{ value: "openai", name: "OpenAI" },
|
|
3904
3826
|
{ value: "openrouter", name: "OpenRouter" },
|
|
3905
3827
|
{ value: "ollama", name: "Ollama (Local)" }
|
|
@@ -4691,7 +4613,7 @@ function parseAtReferences(input2, cwd) {
|
|
|
4691
4613
|
continue;
|
|
4692
4614
|
}
|
|
4693
4615
|
if (mime) {
|
|
4694
|
-
const fileSize =
|
|
4616
|
+
const fileSize = statSync2(absPath).size;
|
|
4695
4617
|
if (fileSize > MAX_IMAGE_BYTES) {
|
|
4696
4618
|
refs.push({ path: rawPath, type: "toolarge" });
|
|
4697
4619
|
continue;
|
|
@@ -4949,7 +4871,7 @@ var Repl = class {
|
|
|
4949
4871
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
4950
4872
|
let isDir;
|
|
4951
4873
|
try {
|
|
4952
|
-
isDir =
|
|
4874
|
+
isDir = statSync2(fullPath).isDirectory();
|
|
4953
4875
|
} catch {
|
|
4954
4876
|
continue;
|
|
4955
4877
|
}
|
|
@@ -4981,7 +4903,7 @@ ${treeLines.join("\n")}`
|
|
|
4981
4903
|
const fullPath = join4(dir, name);
|
|
4982
4904
|
let st;
|
|
4983
4905
|
try {
|
|
4984
|
-
st =
|
|
4906
|
+
st = statSync2(fullPath);
|
|
4985
4907
|
} catch {
|
|
4986
4908
|
continue;
|
|
4987
4909
|
}
|
|
@@ -5028,7 +4950,7 @@ ${content}
|
|
|
5028
4950
|
}
|
|
5029
4951
|
let isDir;
|
|
5030
4952
|
try {
|
|
5031
|
-
isDir =
|
|
4953
|
+
isDir = statSync2(absPath).isDirectory();
|
|
5032
4954
|
} catch {
|
|
5033
4955
|
return { success: false, charCount: 0, added: false, error: `Cannot access: ${dirPath}` };
|
|
5034
4956
|
}
|
|
@@ -6198,7 +6120,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6198
6120
|
if (!entry.toLowerCase().startsWith(prefix.toLowerCase())) continue;
|
|
6199
6121
|
try {
|
|
6200
6122
|
const fullPath = join4(absDir, entry);
|
|
6201
|
-
const stat =
|
|
6123
|
+
const stat = statSync2(fullPath);
|
|
6202
6124
|
const rel = dir === "." ? entry : `${dir}/${entry}`;
|
|
6203
6125
|
results.push(stat.isDirectory() ? `${rel}/` : rel);
|
|
6204
6126
|
} catch {
|
|
@@ -7345,7 +7267,8 @@ program.command("providers").description("List all AI providers and their config
|
|
|
7345
7267
|
baseUrl: config.get("customBaseUrls")[id],
|
|
7346
7268
|
timeout: config.get("timeouts")[id]
|
|
7347
7269
|
}),
|
|
7348
|
-
config.get("customProviders")
|
|
7270
|
+
config.get("customProviders"),
|
|
7271
|
+
config.getConfigDir()
|
|
7349
7272
|
);
|
|
7350
7273
|
const all = registry.listAll();
|
|
7351
7274
|
console.log("\nAvailable providers:\n");
|
|
@@ -7369,7 +7292,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7369
7292
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7370
7293
|
process.exit(1);
|
|
7371
7294
|
}
|
|
7372
|
-
const { startWebServer } = await import("./server-
|
|
7295
|
+
const { startWebServer } = await import("./server-RU36PRSH.js");
|
|
7373
7296
|
await startWebServer({ port, host: options.host });
|
|
7374
7297
|
});
|
|
7375
7298
|
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) => {
|
|
@@ -7536,16 +7459,20 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7536
7459
|
console.log(footer + "\n");
|
|
7537
7460
|
});
|
|
7538
7461
|
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) => {
|
|
7539
|
-
const { runUsageCli } = await import("./usage-
|
|
7462
|
+
const { runUsageCli } = await import("./usage-IRMRCCKN.js");
|
|
7540
7463
|
await runUsageCli(options);
|
|
7541
7464
|
});
|
|
7542
7465
|
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) => {
|
|
7543
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7544
|
-
|
|
7466
|
+
const { runDoctorCli } = await import("./doctor-cli-ZRH3XZ3R.js");
|
|
7467
|
+
const argv = process.argv.slice(2);
|
|
7468
|
+
await runDoctorCli({
|
|
7469
|
+
json: !!options.json || argv.includes("--json"),
|
|
7470
|
+
resetStats: !!options.resetStats || argv.includes("--reset-stats")
|
|
7471
|
+
});
|
|
7545
7472
|
});
|
|
7546
7473
|
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) => {
|
|
7547
7474
|
try {
|
|
7548
|
-
const batch = await import("./batch-
|
|
7475
|
+
const batch = await import("./batch-QBSKTLTO.js");
|
|
7549
7476
|
switch (action) {
|
|
7550
7477
|
case "submit":
|
|
7551
7478
|
if (!arg) {
|
|
@@ -7588,7 +7515,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7588
7515
|
}
|
|
7589
7516
|
});
|
|
7590
7517
|
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) => {
|
|
7591
|
-
const { startMcpServer } = await import("./server-
|
|
7518
|
+
const { startMcpServer } = await import("./server-5FZDALHH.js");
|
|
7592
7519
|
await startMcpServer({
|
|
7593
7520
|
allowDestructive: !!options.allowDestructive,
|
|
7594
7521
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7601,7 +7528,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7601
7528
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
7602
7529
|
process.exit(1);
|
|
7603
7530
|
}
|
|
7604
|
-
const { runPrCli } = await import("./pr-
|
|
7531
|
+
const { runPrCli } = await import("./pr-GJYDAPK4.js");
|
|
7605
7532
|
const result = await runPrCli({
|
|
7606
7533
|
action,
|
|
7607
7534
|
target,
|
|
@@ -7621,8 +7548,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7621
7548
|
process.exit(result.exitCode);
|
|
7622
7549
|
});
|
|
7623
7550
|
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) => {
|
|
7624
|
-
const { runCi } = await import("./ci-
|
|
7625
|
-
const { formatCiResult } = await import("./ci-format-
|
|
7551
|
+
const { runCi } = await import("./ci-5SNXGM3M.js");
|
|
7552
|
+
const { formatCiResult } = await import("./ci-format-57QQTHQE.js");
|
|
7626
7553
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
7627
7554
|
if (formats > 1) {
|
|
7628
7555
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -7777,9 +7704,10 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7777
7704
|
baseUrl: config.get("customBaseUrls")[id],
|
|
7778
7705
|
timeout: config.get("timeouts")[id]
|
|
7779
7706
|
}),
|
|
7780
|
-
config.get("customProviders")
|
|
7707
|
+
config.get("customProviders"),
|
|
7708
|
+
config.getConfigDir()
|
|
7781
7709
|
);
|
|
7782
|
-
const { startHub } = await import("./hub-
|
|
7710
|
+
const { startHub } = await import("./hub-IPLMJ6TJ.js");
|
|
7783
7711
|
await startHub(
|
|
7784
7712
|
{
|
|
7785
7713
|
topic: topic ?? "",
|
|
@@ -7812,7 +7740,8 @@ program.command("join").description("Join a running hub as a remote AI agent").o
|
|
|
7812
7740
|
baseUrl: config.get("customBaseUrls")[id],
|
|
7813
7741
|
timeout: config.get("timeouts")[id]
|
|
7814
7742
|
}),
|
|
7815
|
-
config.get("customProviders")
|
|
7743
|
+
config.get("customProviders"),
|
|
7744
|
+
config.getConfigDir()
|
|
7816
7745
|
);
|
|
7817
7746
|
const { joinHub } = await import("./agent-client-6GX6QQDU.js");
|
|
7818
7747
|
await joinHub(
|
|
@@ -7853,7 +7782,8 @@ async function runHeadless(options) {
|
|
|
7853
7782
|
timeout: config.get("timeouts")[id],
|
|
7854
7783
|
proxy: config.get("proxy")
|
|
7855
7784
|
}),
|
|
7856
|
-
config.get("customProviders")
|
|
7785
|
+
config.get("customProviders"),
|
|
7786
|
+
config.getConfigDir()
|
|
7857
7787
|
);
|
|
7858
7788
|
const providerId = options.provider ?? config.getDefaultProvider();
|
|
7859
7789
|
if (!providers.has(providerId)) {
|
|
@@ -8012,7 +7942,8 @@ async function startRepl(options) {
|
|
|
8012
7942
|
timeout: config.get("timeouts")[id],
|
|
8013
7943
|
proxy: config.get("proxy")
|
|
8014
7944
|
}),
|
|
8015
|
-
config.get("customProviders")
|
|
7945
|
+
config.get("customProviders"),
|
|
7946
|
+
config.getConfigDir()
|
|
8016
7947
|
);
|
|
8017
7948
|
if (providers.listAvailable().length === 0) {
|
|
8018
7949
|
console.error(
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-P4PTXCHY.js";
|
|
6
|
+
import "./chunk-P4DYAGUI.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
} from "./chunk-HLWUDRBO.js";
|
|
12
12
|
import {
|
|
13
13
|
ProviderRegistry
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PUBCJF7E.js";
|
|
15
15
|
import "./chunk-XPBEJB27.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-5WBNXYDJ.js";
|
|
19
|
+
import "./chunk-5ULLIOVC.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QZYNRCPX.js";
|
|
23
23
|
import "./chunk-IW3Q7AE5.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/pr.ts
|
|
@@ -179,7 +179,8 @@ async function getProvider(opts) {
|
|
|
179
179
|
await registry.initialize(
|
|
180
180
|
(id) => config.getApiKey(id),
|
|
181
181
|
(id) => ({ baseUrl: config.get("customBaseUrls")[id], timeout: config.get("timeouts")[id], proxy: config.get("proxy") }),
|
|
182
|
-
config.get("customProviders")
|
|
182
|
+
config.get("customProviders"),
|
|
183
|
+
config.getConfigDir()
|
|
183
184
|
);
|
|
184
185
|
const providerId = opts.provider ?? config.getDefaultProvider();
|
|
185
186
|
if (!registry.has(providerId)) throw new Error(`Provider '${providerId}' is not configured. Set the right AICLI_API_KEY_* env var or pass --provider.`);
|