jinzd-ai-cli 0.4.253 → 0.4.255
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/dist/{batch-TPW2SM6G.js → batch-OWBKG6XZ.js} +2 -2
- package/dist/{chunk-P5JUXUBS.js → chunk-2UZ23L5P.js} +2 -2
- package/dist/{chunk-SC6FMQLH.js → chunk-3WKUKMBG.js} +3 -3
- package/dist/{chunk-YWG5KKSL.js → chunk-7QWFFLKV.js} +3 -3
- package/dist/{chunk-RPYNPLIE.js → chunk-B42HK6GL.js} +1 -1
- package/dist/{chunk-UMW33EEH.js → chunk-CU5ZNAIX.js} +1 -1
- package/dist/{chunk-Q4KBR2SG.js → chunk-FOC2YWOF.js} +1 -1
- package/dist/{chunk-OWCEONX7.js → chunk-IRSNREEO.js} +1 -1
- package/dist/{chunk-BZNTSGLQ.js → chunk-PSP4W2MG.js} +15 -7
- package/dist/{chunk-YMHARKR6.js → chunk-SMIQ6CBX.js} +1 -1
- package/dist/{chunk-M2QHKPRA.js → chunk-SVWIUNOA.js} +1 -1
- package/dist/{chunk-ABMMKA5S.js → chunk-U6OV523Y.js} +1 -1
- package/dist/{chunk-USG3ASQ2.js → chunk-X2V76VPG.js} +1 -1
- package/dist/{chunk-2JHYZUQE.js → chunk-YJ7VL7VL.js} +1 -1
- package/dist/{ci-DYTVVEBO.js → ci-V5GVGYZO.js} +4 -4
- package/dist/{ci-format-QTSA6FJJ.js → ci-format-CTGDLJTS.js} +2 -2
- package/dist/{constants-7KSDW6RF.js → constants-LJRYL7IN.js} +1 -1
- package/dist/{doctor-cli-ZOIMXV4C.js → doctor-cli-GOM2GQUK.js} +4 -4
- package/dist/electron-server.js +17 -9
- package/dist/{hub-6L2UCZAU.js → hub-4EEDUJED.js} +1 -1
- package/dist/index.js +116 -112
- package/dist/{persistent-memory-HQKE5X7Z.js → persistent-memory-DMN76UB5.js} +2 -2
- package/dist/{persistent-memory-QOT2TQCT.js → persistent-memory-EEAGHDFR.js} +2 -2
- package/dist/{pr-HMOXDXWR.js → pr-Q74YHWN2.js} +4 -4
- package/dist/{run-tests-RSYTYFZF.js → run-tests-ADZQ2JWI.js} +2 -2
- package/dist/{run-tests-JVQU3RAN.js → run-tests-N3ES4YMU.js} +2 -2
- package/dist/{server-O2YQGG72.js → server-HUWVPJKQ.js} +5 -5
- package/dist/{server-VOIG5VKM.js → server-PMEZ3HDO.js} +11 -11
- package/dist/{task-orchestrator-PLP3INNN.js → task-orchestrator-KLCN25OY.js} +5 -5
- package/dist/{usage-3EQUVK37.js → usage-MNMRX5OE.js} +2 -2
- package/dist/web/client/api.js +41 -0
- package/dist/web/client/app.js +9 -35
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
scanProject,
|
|
18
18
|
sessionHasMeaningfulContent,
|
|
19
19
|
setupProxy
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2UZ23L5P.js";
|
|
21
21
|
import {
|
|
22
22
|
computeCost,
|
|
23
23
|
formatCost,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
spawnAgentContext,
|
|
51
51
|
theme,
|
|
52
52
|
undoStack
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-PSP4W2MG.js";
|
|
54
54
|
import {
|
|
55
55
|
addMemoryEntry,
|
|
56
56
|
backupMemoryStore,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
touchMemoryReferences,
|
|
77
77
|
updateMemoryApproval,
|
|
78
78
|
updateMemoryEntry
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-X2V76VPG.js";
|
|
80
80
|
import "./chunk-GLSR2NR3.js";
|
|
81
81
|
import "./chunk-UUSRWSSX.js";
|
|
82
82
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -90,13 +90,13 @@ import {
|
|
|
90
90
|
formatDoctorReport,
|
|
91
91
|
loadContextFiles,
|
|
92
92
|
writeCrashLog
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-3WKUKMBG.js";
|
|
94
94
|
import {
|
|
95
95
|
ProviderRegistry
|
|
96
96
|
} from "./chunk-ZRBGH245.js";
|
|
97
97
|
import {
|
|
98
98
|
ConfigManager
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-IRSNREEO.js";
|
|
100
100
|
import {
|
|
101
101
|
describePlugin,
|
|
102
102
|
getActivePluginAssets,
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
trustHook,
|
|
114
114
|
trustPlugin,
|
|
115
115
|
untrustHook
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-FOC2YWOF.js";
|
|
117
117
|
import {
|
|
118
118
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
119
119
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
import {
|
|
147
147
|
fileCheckpoints
|
|
148
148
|
} from "./chunk-4BKXL7SM.js";
|
|
149
|
-
import "./chunk-
|
|
149
|
+
import "./chunk-U6OV523Y.js";
|
|
150
150
|
import {
|
|
151
151
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
152
152
|
AUTHOR,
|
|
@@ -165,7 +165,7 @@ import {
|
|
|
165
165
|
SKILLS_DIR_NAME,
|
|
166
166
|
VERSION,
|
|
167
167
|
buildUserIdentityPrompt
|
|
168
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-SVWIUNOA.js";
|
|
169
169
|
import {
|
|
170
170
|
buildChatIndex,
|
|
171
171
|
clearChatIndex,
|
|
@@ -187,8 +187,8 @@ import { program } from "commander";
|
|
|
187
187
|
|
|
188
188
|
// src/repl/repl.ts
|
|
189
189
|
import * as readline from "readline";
|
|
190
|
-
import { existsSync as
|
|
191
|
-
import { join as join5, resolve as
|
|
190
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync3, statSync as statSync4, mkdirSync as mkdirSync4 } from "fs";
|
|
191
|
+
import { join as join5, resolve as resolve3, dirname as dirname3, basename as basename2 } from "path";
|
|
192
192
|
import chalk5 from "chalk";
|
|
193
193
|
|
|
194
194
|
// src/session/title-generator.ts
|
|
@@ -556,8 +556,8 @@ var Renderer = class {
|
|
|
556
556
|
}
|
|
557
557
|
if (fileStream) {
|
|
558
558
|
try {
|
|
559
|
-
await new Promise((
|
|
560
|
-
fileStream.end(() =>
|
|
559
|
+
await new Promise((resolve4) => {
|
|
560
|
+
fileStream.end(() => resolve4());
|
|
561
561
|
});
|
|
562
562
|
} catch {
|
|
563
563
|
}
|
|
@@ -606,7 +606,7 @@ var Renderer = class {
|
|
|
606
606
|
process.stdout.write(displayed.slice(pos, end));
|
|
607
607
|
pos = end;
|
|
608
608
|
if (pos < displayed.length) {
|
|
609
|
-
await new Promise((
|
|
609
|
+
await new Promise((resolve4) => setTimeout(resolve4, DELAY_MS));
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
process.stdout.write("\n\n");
|
|
@@ -1385,15 +1385,15 @@ No tools match "${filter}".
|
|
|
1385
1385
|
async execute(args, ctx) {
|
|
1386
1386
|
if (args[0] === "trust-project") {
|
|
1387
1387
|
const { join: join6 } = await import("path");
|
|
1388
|
-
const { existsSync:
|
|
1388
|
+
const { existsSync: existsSync6 } = await import("fs");
|
|
1389
1389
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1390
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1390
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-LJRYL7IN.js");
|
|
1391
1391
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1392
1392
|
const cwd = process.cwd();
|
|
1393
1393
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
1394
1394
|
const mcpPath = join6(projectRoot, MCP_PROJECT_CONFIG_NAME2);
|
|
1395
1395
|
console.log();
|
|
1396
|
-
if (!
|
|
1396
|
+
if (!existsSync6(mcpPath)) {
|
|
1397
1397
|
console.log(theme.dim(` No .mcp.json in ${projectRoot}.`));
|
|
1398
1398
|
console.log();
|
|
1399
1399
|
return;
|
|
@@ -1883,12 +1883,12 @@ function createSecurityCommands() {
|
|
|
1883
1883
|
if (scanAll) {
|
|
1884
1884
|
const metas = ctx.sessions.listSessions();
|
|
1885
1885
|
console.log(theme.info(` Scanning ${metas.length} session(s)\u2026`));
|
|
1886
|
-
const { readFileSync:
|
|
1886
|
+
const { readFileSync: readFileSync6 } = await import("fs");
|
|
1887
1887
|
const { join: join6 } = await import("path");
|
|
1888
1888
|
const historyDir = ctx.config.getHistoryDir();
|
|
1889
1889
|
for (const m of metas) {
|
|
1890
1890
|
try {
|
|
1891
|
-
const content =
|
|
1891
|
+
const content = readFileSync6(join6(historyDir, `${m.id}.json`), "utf-8");
|
|
1892
1892
|
const hits2 = scanString(content, opts);
|
|
1893
1893
|
if (hits2.length) {
|
|
1894
1894
|
filesWithHits++;
|
|
@@ -2098,7 +2098,7 @@ function createReviewCommands() {
|
|
|
2098
2098
|
return;
|
|
2099
2099
|
}
|
|
2100
2100
|
const sub = args[0]?.toLowerCase();
|
|
2101
|
-
const
|
|
2101
|
+
const resolve4 = (ref) => {
|
|
2102
2102
|
const r = session.resolveBranchRef(ref);
|
|
2103
2103
|
if (r.ok) return r.id;
|
|
2104
2104
|
if (r.reason === "ambiguous") {
|
|
@@ -2163,7 +2163,7 @@ function createReviewCommands() {
|
|
|
2163
2163
|
ctx.renderer.renderError("Usage: /branch switch <id|title>");
|
|
2164
2164
|
return;
|
|
2165
2165
|
}
|
|
2166
|
-
const id =
|
|
2166
|
+
const id = resolve4(ref);
|
|
2167
2167
|
if (!id) return;
|
|
2168
2168
|
const ok = session.switchBranch(id);
|
|
2169
2169
|
if (ok) {
|
|
@@ -2184,7 +2184,7 @@ function createReviewCommands() {
|
|
|
2184
2184
|
ctx.renderer.renderError("Usage: /branch delete <id|title>");
|
|
2185
2185
|
return;
|
|
2186
2186
|
}
|
|
2187
|
-
const id =
|
|
2187
|
+
const id = resolve4(ref);
|
|
2188
2188
|
if (!id) return;
|
|
2189
2189
|
const ok = session.deleteBranch(id);
|
|
2190
2190
|
if (ok) {
|
|
@@ -2206,7 +2206,7 @@ function createReviewCommands() {
|
|
|
2206
2206
|
ctx.renderer.renderError("Usage: /branch rename <id|title> <new title>");
|
|
2207
2207
|
return;
|
|
2208
2208
|
}
|
|
2209
|
-
const id =
|
|
2209
|
+
const id = resolve4(ref);
|
|
2210
2210
|
if (!id) return;
|
|
2211
2211
|
const ok = session.renameBranch(id, title);
|
|
2212
2212
|
if (ok) {
|
|
@@ -2225,7 +2225,7 @@ function createReviewCommands() {
|
|
|
2225
2225
|
ctx.renderer.renderError("Usage: /branch diff <id|title> \u2014 diff the given branch against the active branch");
|
|
2226
2226
|
return;
|
|
2227
2227
|
}
|
|
2228
|
-
const id =
|
|
2228
|
+
const id = resolve4(ref);
|
|
2229
2229
|
if (!id) return;
|
|
2230
2230
|
const d = session.diffBranches(id);
|
|
2231
2231
|
if (!d) {
|
|
@@ -2270,7 +2270,7 @@ function createReviewCommands() {
|
|
|
2270
2270
|
ctx.renderer.renderError("Usage: /branch cherry-pick <source-id|title> <msg-index>");
|
|
2271
2271
|
return;
|
|
2272
2272
|
}
|
|
2273
|
-
const id =
|
|
2273
|
+
const id = resolve4(ref);
|
|
2274
2274
|
if (!id) return;
|
|
2275
2275
|
const idx = parseInt(idxStr, 10);
|
|
2276
2276
|
if (Number.isNaN(idx)) {
|
|
@@ -2366,7 +2366,7 @@ function createReviewCommands() {
|
|
|
2366
2366
|
usage: "/test [command|filter]",
|
|
2367
2367
|
async execute(args, ctx) {
|
|
2368
2368
|
try {
|
|
2369
|
-
const { executeTests } = await import("./run-tests-
|
|
2369
|
+
const { executeTests } = await import("./run-tests-ADZQ2JWI.js");
|
|
2370
2370
|
const argStr = args.join(" ").trim();
|
|
2371
2371
|
let testArgs = {};
|
|
2372
2372
|
if (argStr) {
|
|
@@ -4290,7 +4290,7 @@ var IGNORE_ENTER_MS = 80;
|
|
|
4290
4290
|
function selectFromList(prompt, items, initialIndex = 0) {
|
|
4291
4291
|
if (items.length === 0) return Promise.resolve(null);
|
|
4292
4292
|
const PAGE = 12;
|
|
4293
|
-
return new Promise((
|
|
4293
|
+
return new Promise((resolve4) => {
|
|
4294
4294
|
let selected = Math.max(0, Math.min(initialIndex, items.length - 1));
|
|
4295
4295
|
let windowStart = Math.max(0, selected - Math.floor(PAGE / 2));
|
|
4296
4296
|
let lastRenderedLines = 0;
|
|
@@ -4365,7 +4365,7 @@ function selectFromList(prompt, items, initialIndex = 0) {
|
|
|
4365
4365
|
process.stdout.write(chalk4.dim(` \u2714 ${result}
|
|
4366
4366
|
`));
|
|
4367
4367
|
}
|
|
4368
|
-
|
|
4368
|
+
resolve4(result);
|
|
4369
4369
|
};
|
|
4370
4370
|
const handleSequence = (seq) => {
|
|
4371
4371
|
if (seq === "\x1B") {
|
|
@@ -4429,13 +4429,13 @@ function selectFromList(prompt, items, initialIndex = 0) {
|
|
|
4429
4429
|
}
|
|
4430
4430
|
};
|
|
4431
4431
|
if (!process.stdin.isTTY) {
|
|
4432
|
-
|
|
4432
|
+
resolve4(items[0]?.value ?? null);
|
|
4433
4433
|
return;
|
|
4434
4434
|
}
|
|
4435
4435
|
try {
|
|
4436
4436
|
process.stdin.setRawMode(true);
|
|
4437
4437
|
} catch {
|
|
4438
|
-
|
|
4438
|
+
resolve4(items[0]?.value ?? null);
|
|
4439
4439
|
return;
|
|
4440
4440
|
}
|
|
4441
4441
|
savedDataListeners = process.stdin.rawListeners("data");
|
|
@@ -5182,6 +5182,65 @@ function getVisionModelHint(model, provider) {
|
|
|
5182
5182
|
return `model "${model}" may not support image input`;
|
|
5183
5183
|
}
|
|
5184
5184
|
|
|
5185
|
+
// src/repl/at-references.ts
|
|
5186
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, statSync as statSync3 } from "fs";
|
|
5187
|
+
import { extname as extname3, resolve as resolve2 } from "path";
|
|
5188
|
+
var IMAGE_MIME = {
|
|
5189
|
+
".png": "image/png",
|
|
5190
|
+
".jpg": "image/jpeg",
|
|
5191
|
+
".jpeg": "image/jpeg",
|
|
5192
|
+
".gif": "image/gif",
|
|
5193
|
+
".webp": "image/webp"
|
|
5194
|
+
};
|
|
5195
|
+
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
5196
|
+
function parseAtReferences(input2, cwd) {
|
|
5197
|
+
const atPattern = /@(?:"([^"]+)"|'([^']+)'|(\S+))/g;
|
|
5198
|
+
const refs = [];
|
|
5199
|
+
const imageParts = [];
|
|
5200
|
+
let textBody = input2;
|
|
5201
|
+
let match;
|
|
5202
|
+
while ((match = atPattern.exec(input2)) !== null) {
|
|
5203
|
+
const rawPath = match[1] ?? match[2] ?? match[3] ?? "";
|
|
5204
|
+
const absPath = resolve2(cwd, rawPath);
|
|
5205
|
+
const ext = extname3(rawPath).toLowerCase();
|
|
5206
|
+
const mime = IMAGE_MIME[ext];
|
|
5207
|
+
if (!existsSync4(absPath)) {
|
|
5208
|
+
refs.push({ path: rawPath, type: "notfound" });
|
|
5209
|
+
continue;
|
|
5210
|
+
}
|
|
5211
|
+
if (mime) {
|
|
5212
|
+
const fileSize = statSync3(absPath).size;
|
|
5213
|
+
if (fileSize > MAX_IMAGE_BYTES) {
|
|
5214
|
+
refs.push({ path: rawPath, type: "toolarge" });
|
|
5215
|
+
continue;
|
|
5216
|
+
}
|
|
5217
|
+
const data = readFileSync4(absPath).toString("base64");
|
|
5218
|
+
imageParts.push({
|
|
5219
|
+
type: "image_url",
|
|
5220
|
+
image_url: { url: `data:${mime};base64,${data}` }
|
|
5221
|
+
});
|
|
5222
|
+
refs.push({ path: rawPath, type: "image" });
|
|
5223
|
+
textBody = textBody.replace(match[0], "").trim();
|
|
5224
|
+
} else {
|
|
5225
|
+
const content = readFileSync4(absPath, "utf-8");
|
|
5226
|
+
const inlined = `
|
|
5227
|
+
|
|
5228
|
+
[File: ${rawPath}]
|
|
5229
|
+
\`\`\`
|
|
5230
|
+
${content}
|
|
5231
|
+
\`\`\``;
|
|
5232
|
+
textBody = textBody.replace(match[0], inlined);
|
|
5233
|
+
refs.push({ path: rawPath, type: "text" });
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
const parts = [];
|
|
5237
|
+
if (textBody.trim()) {
|
|
5238
|
+
parts.push({ type: "text", text: textBody.trim() });
|
|
5239
|
+
}
|
|
5240
|
+
parts.push(...imageParts);
|
|
5241
|
+
return { parts, hasImage: imageParts.length > 0, refs };
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5185
5244
|
// src/core/model-router.ts
|
|
5186
5245
|
var TAG_REGEX = /(?:^|\s)#([a-zA-Z][\w-]{0,31})\b/g;
|
|
5187
5246
|
function extractTags(message) {
|
|
@@ -5452,61 +5511,6 @@ function sendNotification(title, body) {
|
|
|
5452
5511
|
}
|
|
5453
5512
|
|
|
5454
5513
|
// src/repl/repl.ts
|
|
5455
|
-
var IMAGE_MIME = {
|
|
5456
|
-
".png": "image/png",
|
|
5457
|
-
".jpg": "image/jpeg",
|
|
5458
|
-
".jpeg": "image/jpeg",
|
|
5459
|
-
".gif": "image/gif",
|
|
5460
|
-
".webp": "image/webp"
|
|
5461
|
-
};
|
|
5462
|
-
var MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
5463
|
-
function parseAtReferences(input2, cwd) {
|
|
5464
|
-
const atPattern = /@(?:"([^"]+)"|'([^']+)'|(\S+))/g;
|
|
5465
|
-
const refs = [];
|
|
5466
|
-
const imageParts = [];
|
|
5467
|
-
let textBody = input2;
|
|
5468
|
-
let match;
|
|
5469
|
-
while ((match = atPattern.exec(input2)) !== null) {
|
|
5470
|
-
const rawPath = match[1] ?? match[2] ?? match[3] ?? "";
|
|
5471
|
-
const absPath = resolve2(cwd, rawPath);
|
|
5472
|
-
const ext = extname3(rawPath).toLowerCase();
|
|
5473
|
-
const mime = IMAGE_MIME[ext];
|
|
5474
|
-
if (!existsSync4(absPath)) {
|
|
5475
|
-
refs.push({ path: rawPath, type: "notfound" });
|
|
5476
|
-
continue;
|
|
5477
|
-
}
|
|
5478
|
-
if (mime) {
|
|
5479
|
-
const fileSize = statSync3(absPath).size;
|
|
5480
|
-
if (fileSize > MAX_IMAGE_BYTES) {
|
|
5481
|
-
refs.push({ path: rawPath, type: "toolarge" });
|
|
5482
|
-
continue;
|
|
5483
|
-
}
|
|
5484
|
-
const data = readFileSync4(absPath).toString("base64");
|
|
5485
|
-
imageParts.push({
|
|
5486
|
-
type: "image_url",
|
|
5487
|
-
image_url: { url: `data:${mime};base64,${data}` }
|
|
5488
|
-
});
|
|
5489
|
-
refs.push({ path: rawPath, type: "image" });
|
|
5490
|
-
textBody = textBody.replace(match[0], "").trim();
|
|
5491
|
-
} else {
|
|
5492
|
-
const content = readFileSync4(absPath, "utf-8");
|
|
5493
|
-
const inlined = `
|
|
5494
|
-
|
|
5495
|
-
[File: ${rawPath}]
|
|
5496
|
-
\`\`\`
|
|
5497
|
-
${content}
|
|
5498
|
-
\`\`\``;
|
|
5499
|
-
textBody = textBody.replace(match[0], inlined);
|
|
5500
|
-
refs.push({ path: rawPath, type: "text" });
|
|
5501
|
-
}
|
|
5502
|
-
}
|
|
5503
|
-
const parts = [];
|
|
5504
|
-
if (textBody.trim()) {
|
|
5505
|
-
parts.push({ type: "text", text: textBody.trim() });
|
|
5506
|
-
}
|
|
5507
|
-
parts.push(...imageParts);
|
|
5508
|
-
return { parts, hasImage: imageParts.length > 0, refs };
|
|
5509
|
-
}
|
|
5510
5514
|
var MAX_REPEATED_TOOL_CALLS = 2;
|
|
5511
5515
|
var DEFAULT_AUTO_PAUSE_INTERVAL = 50;
|
|
5512
5516
|
function fmtTokens(n) {
|
|
@@ -5665,13 +5669,13 @@ var Repl = class {
|
|
|
5665
5669
|
* 已添加时返回 added=false(无重复添加)。
|
|
5666
5670
|
*/
|
|
5667
5671
|
addExtraContextDir(dirPath) {
|
|
5668
|
-
const absPath =
|
|
5669
|
-
if (!
|
|
5672
|
+
const absPath = resolve3(dirPath);
|
|
5673
|
+
if (!existsSync5(absPath)) {
|
|
5670
5674
|
return { success: false, charCount: 0, added: false, error: `Directory not found: ${dirPath}` };
|
|
5671
5675
|
}
|
|
5672
5676
|
let isDir;
|
|
5673
5677
|
try {
|
|
5674
|
-
isDir =
|
|
5678
|
+
isDir = statSync4(absPath).isDirectory();
|
|
5675
5679
|
} catch {
|
|
5676
5680
|
return { success: false, charCount: 0, added: false, error: `Cannot access: ${dirPath}` };
|
|
5677
5681
|
}
|
|
@@ -5688,7 +5692,7 @@ var Repl = class {
|
|
|
5688
5692
|
}
|
|
5689
5693
|
/** 从额外上下文中移除目录。返回 true 表示成功移除,false 表示未找到。 */
|
|
5690
5694
|
removeExtraContextDir(dirPath) {
|
|
5691
|
-
const absPath =
|
|
5695
|
+
const absPath = resolve3(dirPath);
|
|
5692
5696
|
const idx = this.extraContextDirs.findIndex((d) => d.dir === absPath);
|
|
5693
5697
|
if (idx === -1) return false;
|
|
5694
5698
|
this.extraContextDirs.splice(idx, 1);
|
|
@@ -5704,9 +5708,9 @@ var Repl = class {
|
|
|
5704
5708
|
const gitRoot = getGitRoot(cwd);
|
|
5705
5709
|
const projectRoot = gitRoot ?? cwd;
|
|
5706
5710
|
const mcpPath = join5(projectRoot, MCP_PROJECT_CONFIG_NAME);
|
|
5707
|
-
if (!
|
|
5711
|
+
if (!existsSync5(mcpPath)) return null;
|
|
5708
5712
|
try {
|
|
5709
|
-
const raw = JSON.parse(
|
|
5713
|
+
const raw = JSON.parse(readFileSync5(mcpPath, "utf-8"));
|
|
5710
5714
|
const servers = raw?.mcpServers;
|
|
5711
5715
|
if (!servers || typeof servers !== "object") {
|
|
5712
5716
|
process.stderr.write(
|
|
@@ -6320,8 +6324,8 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6320
6324
|
`);
|
|
6321
6325
|
});
|
|
6322
6326
|
const FAST_MCP_DEADLINE_MS = 1500;
|
|
6323
|
-
const deadlinePromise = new Promise((
|
|
6324
|
-
setTimeout(() =>
|
|
6327
|
+
const deadlinePromise = new Promise((resolve4) => {
|
|
6328
|
+
setTimeout(() => resolve4("timeout"), FAST_MCP_DEADLINE_MS).unref?.();
|
|
6325
6329
|
});
|
|
6326
6330
|
const winner = await Promise.race([
|
|
6327
6331
|
mcpReadyPromise.then(() => "ready"),
|
|
@@ -6358,7 +6362,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6358
6362
|
});
|
|
6359
6363
|
this.showPrompt();
|
|
6360
6364
|
process.stdin.setMaxListeners(20);
|
|
6361
|
-
await new Promise((
|
|
6365
|
+
await new Promise((resolve4) => {
|
|
6362
6366
|
let processing = false;
|
|
6363
6367
|
let pasteTimer = null;
|
|
6364
6368
|
const PASTE_DEBOUNCE_MS = 50;
|
|
@@ -6391,7 +6395,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6391
6395
|
process.stdin.resume();
|
|
6392
6396
|
this.showPrompt();
|
|
6393
6397
|
} else {
|
|
6394
|
-
|
|
6398
|
+
resolve4();
|
|
6395
6399
|
}
|
|
6396
6400
|
}
|
|
6397
6401
|
};
|
|
@@ -6425,7 +6429,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6425
6429
|
pasteTimer = null;
|
|
6426
6430
|
}
|
|
6427
6431
|
if (!processing) {
|
|
6428
|
-
|
|
6432
|
+
resolve4();
|
|
6429
6433
|
}
|
|
6430
6434
|
});
|
|
6431
6435
|
});
|
|
@@ -6829,8 +6833,8 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6829
6833
|
const normalized = partial.replace(/\\/g, "/");
|
|
6830
6834
|
const dir = normalized.includes("/") ? dirname3(normalized) : ".";
|
|
6831
6835
|
const prefix = normalized.includes("/") ? basename2(normalized) : normalized;
|
|
6832
|
-
const absDir =
|
|
6833
|
-
if (!
|
|
6836
|
+
const absDir = resolve3(process.cwd(), dir);
|
|
6837
|
+
if (!existsSync5(absDir)) return [];
|
|
6834
6838
|
const entries = readdirSync3(absDir);
|
|
6835
6839
|
const results = [];
|
|
6836
6840
|
for (const entry of entries) {
|
|
@@ -6838,7 +6842,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6838
6842
|
if (!entry.toLowerCase().startsWith(prefix.toLowerCase())) continue;
|
|
6839
6843
|
try {
|
|
6840
6844
|
const fullPath = join5(absDir, entry);
|
|
6841
|
-
const stat =
|
|
6845
|
+
const stat = statSync4(fullPath);
|
|
6842
6846
|
const rel = dir === "." ? entry : `${dir}/${entry}`;
|
|
6843
6847
|
results.push(stat.isDirectory() ? `${rel}/` : rel);
|
|
6844
6848
|
} catch {
|
|
@@ -7493,13 +7497,13 @@ ${decision.displayMessage}
|
|
|
7493
7497
|
process.stdout.write(theme.dim(" Press ") + theme.info("y") + theme.dim(" to continue, or ") + theme.info("type a message") + theme.dim(" to redirect AI:\n"));
|
|
7494
7498
|
process.stdout.write(theme.dim(" (Press ") + theme.info("n") + theme.dim(" or ") + theme.info("Esc") + theme.dim(" to stop)\n"));
|
|
7495
7499
|
this.teardownInterjectionListener();
|
|
7496
|
-
const pauseResponse = await new Promise((
|
|
7500
|
+
const pauseResponse = await new Promise((resolve4) => {
|
|
7497
7501
|
const rlWithOutput = rlInternal(this.rl);
|
|
7498
7502
|
const savedOutput = rlWithOutput.output;
|
|
7499
7503
|
rlWithOutput.output = process.stdout;
|
|
7500
7504
|
this.rl.question(theme.warning(" \u25B8 "), (answer) => {
|
|
7501
7505
|
rlWithOutput.output = savedOutput;
|
|
7502
|
-
|
|
7506
|
+
resolve4(answer.trim());
|
|
7503
7507
|
});
|
|
7504
7508
|
});
|
|
7505
7509
|
this.setupInterjectionListener();
|
|
@@ -7903,7 +7907,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
|
|
|
7903
7907
|
try {
|
|
7904
7908
|
await Promise.race([
|
|
7905
7909
|
this.generateDevStateSnapshot(),
|
|
7906
|
-
new Promise((
|
|
7910
|
+
new Promise((resolve4) => setTimeout(resolve4, 1e4).unref())
|
|
7907
7911
|
]);
|
|
7908
7912
|
} catch {
|
|
7909
7913
|
}
|
|
@@ -8013,7 +8017,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
8013
8017
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
8014
8018
|
process.exit(1);
|
|
8015
8019
|
}
|
|
8016
|
-
const { startWebServer } = await import("./server-
|
|
8020
|
+
const { startWebServer } = await import("./server-PMEZ3HDO.js");
|
|
8017
8021
|
await startWebServer({ port, host: options.host });
|
|
8018
8022
|
});
|
|
8019
8023
|
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) => {
|
|
@@ -8180,11 +8184,11 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
8180
8184
|
console.log(footer + "\n");
|
|
8181
8185
|
});
|
|
8182
8186
|
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) => {
|
|
8183
|
-
const { runUsageCli } = await import("./usage-
|
|
8187
|
+
const { runUsageCli } = await import("./usage-MNMRX5OE.js");
|
|
8184
8188
|
await runUsageCli(options);
|
|
8185
8189
|
});
|
|
8186
8190
|
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) => {
|
|
8187
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
8191
|
+
const { runDoctorCli } = await import("./doctor-cli-GOM2GQUK.js");
|
|
8188
8192
|
const argv = process.argv.slice(2);
|
|
8189
8193
|
await runDoctorCli({
|
|
8190
8194
|
json: !!options.json || argv.includes("--json"),
|
|
@@ -8193,7 +8197,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
|
|
|
8193
8197
|
});
|
|
8194
8198
|
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) => {
|
|
8195
8199
|
try {
|
|
8196
|
-
const batch = await import("./batch-
|
|
8200
|
+
const batch = await import("./batch-OWBKG6XZ.js");
|
|
8197
8201
|
switch (action) {
|
|
8198
8202
|
case "submit":
|
|
8199
8203
|
if (!arg) {
|
|
@@ -8236,7 +8240,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
8236
8240
|
}
|
|
8237
8241
|
});
|
|
8238
8242
|
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) => {
|
|
8239
|
-
const { startMcpServer } = await import("./server-
|
|
8243
|
+
const { startMcpServer } = await import("./server-HUWVPJKQ.js");
|
|
8240
8244
|
await startMcpServer({
|
|
8241
8245
|
allowDestructive: !!options.allowDestructive,
|
|
8242
8246
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -8249,7 +8253,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
8249
8253
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
8250
8254
|
process.exit(1);
|
|
8251
8255
|
}
|
|
8252
|
-
const { runPrCli } = await import("./pr-
|
|
8256
|
+
const { runPrCli } = await import("./pr-Q74YHWN2.js");
|
|
8253
8257
|
const result = await runPrCli({
|
|
8254
8258
|
action,
|
|
8255
8259
|
target,
|
|
@@ -8269,8 +8273,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
8269
8273
|
process.exit(result.exitCode);
|
|
8270
8274
|
});
|
|
8271
8275
|
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) => {
|
|
8272
|
-
const { runCi } = await import("./ci-
|
|
8273
|
-
const { formatCiResult } = await import("./ci-format-
|
|
8276
|
+
const { runCi } = await import("./ci-V5GVGYZO.js");
|
|
8277
|
+
const { formatCiResult } = await import("./ci-format-CTGDLJTS.js");
|
|
8274
8278
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
8275
8279
|
if (formats > 1) {
|
|
8276
8280
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -8428,7 +8432,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
8428
8432
|
config.get("customProviders"),
|
|
8429
8433
|
config.getConfigDir()
|
|
8430
8434
|
);
|
|
8431
|
-
const { startHub } = await import("./hub-
|
|
8435
|
+
const { startHub } = await import("./hub-4EEDUJED.js");
|
|
8432
8436
|
await startHub(
|
|
8433
8437
|
{
|
|
8434
8438
|
topic: topic ?? "",
|
|
@@ -8481,10 +8485,10 @@ program.command("join").description("Join a running hub as a remote AI agent").o
|
|
|
8481
8485
|
program.parse();
|
|
8482
8486
|
async function readStdin() {
|
|
8483
8487
|
if (process.stdin.isTTY) return "";
|
|
8484
|
-
return new Promise((
|
|
8488
|
+
return new Promise((resolve4, reject) => {
|
|
8485
8489
|
const chunks = [];
|
|
8486
8490
|
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
8487
|
-
process.stdin.on("end", () =>
|
|
8491
|
+
process.stdin.on("end", () => resolve4(Buffer.concat(chunks).toString("utf-8").trimEnd()));
|
|
8488
8492
|
process.stdin.on("error", reject);
|
|
8489
8493
|
});
|
|
8490
8494
|
}
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
touchMemoryReferences,
|
|
29
29
|
updateMemoryApproval,
|
|
30
30
|
updateMemoryEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-X2V76VPG.js";
|
|
32
32
|
import "./chunk-HOSJZMQS.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-SVWIUNOA.js";
|
|
34
34
|
import "./chunk-B5TYJO7V.js";
|
|
35
35
|
import "./chunk-IW3Q7AE5.js";
|
|
36
36
|
export {
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
touchMemoryReferences,
|
|
28
28
|
updateMemoryApproval,
|
|
29
29
|
updateMemoryEntry
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-YJ7VL7VL.js";
|
|
31
31
|
import "./chunk-YVTASHS5.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-CU5ZNAIX.js";
|
|
33
33
|
import "./chunk-6BUTA5VW.js";
|
|
34
34
|
export {
|
|
35
35
|
addMemoryEntry,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-7QWFFLKV.js";
|
|
6
|
+
import "./chunk-SMIQ6CBX.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
} from "./chunk-ZRBGH245.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigManager
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IRSNREEO.js";
|
|
18
18
|
import "./chunk-PSXIVQ3N.js";
|
|
19
19
|
import "./chunk-5ULLIOVC.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SVWIUNOA.js";
|
|
23
23
|
import "./chunk-IW3Q7AE5.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/pr.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-PSP4W2MG.js";
|
|
5
|
+
import "./chunk-X2V76VPG.js";
|
|
6
6
|
import "./chunk-GLSR2NR3.js";
|
|
7
7
|
import "./chunk-UUSRWSSX.js";
|
|
8
8
|
import "./chunk-CKH4KQ4E.js";
|
|
9
9
|
import "./chunk-BXP6YZ2P.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FOC2YWOF.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel,
|
|
15
15
|
schemaToJsonSchema
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
import "./chunk-5ULLIOVC.js";
|
|
18
18
|
import "./chunk-HOSJZMQS.js";
|
|
19
19
|
import "./chunk-4BKXL7SM.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-U6OV523Y.js";
|
|
21
21
|
import {
|
|
22
22
|
VERSION
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-SVWIUNOA.js";
|
|
24
24
|
import "./chunk-6RPGQ5CG.js";
|
|
25
25
|
import "./chunk-KHYD3WXE.js";
|
|
26
26
|
import "./chunk-NYNSYLFY.js";
|