jinzd-ai-cli 0.2.3 → 0.2.5
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/{chunk-MVARMOOJ.js → chunk-EKCYEBAS.js} +31 -4
- package/dist/{chunk-ZV5BU6FL.js → chunk-OIJT7K75.js} +1 -1
- package/dist/index.js +48 -7
- package/dist/{run-tests-ONH2KZTI.js → run-tests-TEXIYKPE.js} +1 -1
- package/dist/{server-6JLWLVZ5.js → server-IT4WXV42.js} +2 -2
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
SUBAGENT_MAX_ROUNDS_LIMIT,
|
|
17
17
|
VERSION,
|
|
18
18
|
runTestsTool
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OIJT7K75.js";
|
|
20
20
|
|
|
21
21
|
// src/config/config-manager.ts
|
|
22
22
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -2704,11 +2704,14 @@ Important rules:
|
|
|
2704
2704
|
1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir; ls" or "mkdir mydir; cd mydir; New-Item file.txt".
|
|
2705
2705
|
2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
|
|
2706
2706
|
3. Multiple commands can be combined with semicolons in a single call to reduce rounds.
|
|
2707
|
-
4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method)
|
|
2707
|
+
4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method).
|
|
2708
|
+
5. IMPORTANT: On Windows, "curl" is an alias for Invoke-WebRequest and does NOT support curl flags like -s, -X, -H. Use Invoke-RestMethod instead for HTTP requests. Example: Invoke-RestMethod -Uri "http://localhost:3000/api/health" -Method Get
|
|
2709
|
+
6. For long-running server commands (node server.js, npm run dev, etc.), use Start-Process -NoNewWindow to run in background, otherwise the tool will block until timeout.` : `Execute commands in ${SHELL}.
|
|
2708
2710
|
Important rules:
|
|
2709
2711
|
1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir && ls" or "mkdir -p mydir && touch mydir/file.txt".
|
|
2710
2712
|
2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
|
|
2711
|
-
3. Multiple commands can be combined with && in a single call to reduce rounds
|
|
2713
|
+
3. Multiple commands can be combined with && in a single call to reduce rounds.
|
|
2714
|
+
4. For long-running server commands (node server.js, npm start, npm run dev, etc.), run in background with & or nohup, otherwise the tool will block until timeout.`,
|
|
2712
2715
|
parameters: {
|
|
2713
2716
|
command: {
|
|
2714
2717
|
type: "string",
|
|
@@ -3228,10 +3231,11 @@ var editFileTool = {
|
|
|
3228
3231
|
definition: {
|
|
3229
3232
|
name: "edit_file",
|
|
3230
3233
|
description: `Precisely edit file contents. Supports three modes:
|
|
3231
|
-
1. String replace (most common): Provide old_str and new_str to replace an exact match. old_str must appear exactly once in the file.
|
|
3234
|
+
1. String replace (most common): Provide old_str and new_str to replace an exact match. old_str must appear exactly once in the file (unless replace_all is true).
|
|
3232
3235
|
2. Line insert: Provide insert_after_line (1-based line number) and insert_content to insert after that line.
|
|
3233
3236
|
3. Line delete: Provide delete_from_line and delete_to_line (inclusive) to delete that range.
|
|
3234
3237
|
Optional ignore_whitespace: true to match ignoring indentation differences.
|
|
3238
|
+
Optional replace_all: true to replace ALL occurrences of old_str in the file at once (saves tool rounds when renaming variables/functions).
|
|
3235
3239
|
Note: Path can be absolute or relative to the current working directory.`,
|
|
3236
3240
|
parameters: {
|
|
3237
3241
|
path: {
|
|
@@ -3254,6 +3258,11 @@ Note: Path can be absolute or relative to the current working directory.`,
|
|
|
3254
3258
|
description: "[Replace mode] Whether to ignore leading/trailing whitespace per line when matching, defaults to false",
|
|
3255
3259
|
required: false
|
|
3256
3260
|
},
|
|
3261
|
+
replace_all: {
|
|
3262
|
+
type: "boolean",
|
|
3263
|
+
description: "[Replace mode] Replace ALL occurrences of old_str instead of requiring unique match. Useful for renaming variables/functions across the file in one call.",
|
|
3264
|
+
required: false
|
|
3265
|
+
},
|
|
3257
3266
|
insert_after_line: {
|
|
3258
3267
|
type: "number",
|
|
3259
3268
|
description: "[Insert mode] Insert after this line number (1-based), 0 means insert at the beginning",
|
|
@@ -3293,6 +3302,7 @@ Note: Path can be absolute or relative to the current working directory.`,
|
|
|
3293
3302
|
const oldStr = String(args["old_str"]);
|
|
3294
3303
|
const newStr = String(args["new_str"] ?? "");
|
|
3295
3304
|
const ignoreWs = Boolean(args["ignore_whitespace"]);
|
|
3305
|
+
const replaceAll = Boolean(args["replace_all"]);
|
|
3296
3306
|
if (oldStr === "") throw new Error("old_str cannot be empty");
|
|
3297
3307
|
if (ignoreWs) {
|
|
3298
3308
|
const fileLines = original.split("\n");
|
|
@@ -3320,6 +3330,23 @@ Please read the file first and use exact text.`;
|
|
|
3320
3330
|
Replaced: ${searchLines.length} line(s) \u2192 ${newStr.split("\n").length} line(s)
|
|
3321
3331
|
Old: ${truncatePreview(oldStr)}
|
|
3322
3332
|
New: ${truncatePreview(newStr)}`;
|
|
3333
|
+
}
|
|
3334
|
+
if (replaceAll) {
|
|
3335
|
+
const occurrences = original.split(oldStr).length - 1;
|
|
3336
|
+
if (occurrences === 0) {
|
|
3337
|
+
const similar = findSimilarLines(original, oldStr);
|
|
3338
|
+
const hint = similar.length > 0 ? `
|
|
3339
|
+
Similar lines found (did you mean?):
|
|
3340
|
+
${similar.join("\n")}` : "";
|
|
3341
|
+
return `ERROR: old_str not found in file.${hint}
|
|
3342
|
+
Please read the file first and use exact text.`;
|
|
3343
|
+
}
|
|
3344
|
+
undoStack.push(filePath, `edit_file (replace_all): ${filePath}`);
|
|
3345
|
+
const updated2 = original.split(oldStr).join(newStr);
|
|
3346
|
+
writeFileSync5(filePath, updated2, encoding);
|
|
3347
|
+
return `Successfully edited ${filePath} (replace_all)
|
|
3348
|
+
Replaced: ${occurrences} occurrence(s) of ${truncatePreview(oldStr)}
|
|
3349
|
+
With: ${truncatePreview(newStr)}`;
|
|
3323
3350
|
}
|
|
3324
3351
|
const firstIndex = original.indexOf(oldStr);
|
|
3325
3352
|
if (firstIndex === -1) {
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
theme,
|
|
36
36
|
truncateOutput,
|
|
37
37
|
undoStack
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-EKCYEBAS.js";
|
|
39
39
|
import {
|
|
40
40
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
41
41
|
AUTHOR,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
REPO_URL,
|
|
56
56
|
SKILLS_DIR_NAME,
|
|
57
57
|
VERSION
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-OIJT7K75.js";
|
|
59
59
|
|
|
60
60
|
// src/index.ts
|
|
61
61
|
import { program } from "commander";
|
|
@@ -1904,7 +1904,7 @@ ${hint}` : "")
|
|
|
1904
1904
|
description: "Run project tests and show structured report",
|
|
1905
1905
|
usage: "/test [command|filter]",
|
|
1906
1906
|
async execute(args, _ctx) {
|
|
1907
|
-
const { executeTests } = await import("./run-tests-
|
|
1907
|
+
const { executeTests } = await import("./run-tests-TEXIYKPE.js");
|
|
1908
1908
|
const argStr = args.join(" ").trim();
|
|
1909
1909
|
let testArgs = {};
|
|
1910
1910
|
if (argStr) {
|
|
@@ -2474,6 +2474,8 @@ var ToolExecutor = class {
|
|
|
2474
2474
|
* 防止用户输入 "y"+Enter 被同时触发 once('line') 和主循环 on('line')。
|
|
2475
2475
|
*/
|
|
2476
2476
|
confirming = false;
|
|
2477
|
+
/** 在 confirm 期间用户输入的 slash 命令,由 repl.ts 主循环消费 */
|
|
2478
|
+
pendingSlashCommand = null;
|
|
2477
2479
|
/** confirm() 的取消回调,由 SIGINT handler 调用 */
|
|
2478
2480
|
cancelConfirmFn = null;
|
|
2479
2481
|
/**
|
|
@@ -2691,7 +2693,16 @@ var ToolExecutor = class {
|
|
|
2691
2693
|
resolve3(result);
|
|
2692
2694
|
};
|
|
2693
2695
|
const onLine = (line) => {
|
|
2694
|
-
const
|
|
2696
|
+
const trimmed = line.trim();
|
|
2697
|
+
if (trimmed.startsWith("/")) {
|
|
2698
|
+
this.pendingSlashCommand = trimmed;
|
|
2699
|
+
process.stdout.write(theme.dim(`
|
|
2700
|
+
(command "${trimmed}" queued, will execute after current operation)
|
|
2701
|
+
`));
|
|
2702
|
+
cleanup("none");
|
|
2703
|
+
return;
|
|
2704
|
+
}
|
|
2705
|
+
const input2 = trimmed.toLowerCase();
|
|
2695
2706
|
if (input2 === "a" || input2 === "all" || input2 === "y") {
|
|
2696
2707
|
cleanup("all");
|
|
2697
2708
|
} else if (input2 === "r" || input2 === "reject" || input2 === "n" || input2 === "") {
|
|
@@ -2862,7 +2873,16 @@ var ToolExecutor = class {
|
|
|
2862
2873
|
resolve3(answer === "y");
|
|
2863
2874
|
};
|
|
2864
2875
|
const onLine = (line) => {
|
|
2865
|
-
|
|
2876
|
+
const trimmed = line.trim();
|
|
2877
|
+
if (trimmed.startsWith("/")) {
|
|
2878
|
+
this.pendingSlashCommand = trimmed;
|
|
2879
|
+
process.stdout.write(theme.dim(`
|
|
2880
|
+
(command "${trimmed}" queued, will execute after current operation)
|
|
2881
|
+
`));
|
|
2882
|
+
cleanup("n");
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
cleanup(trimmed.toLowerCase());
|
|
2866
2886
|
};
|
|
2867
2887
|
this.cancelConfirmFn = () => {
|
|
2868
2888
|
process.stdout.write(theme.dim("\n(cancelled)\n"));
|
|
@@ -4490,9 +4510,16 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4490
4510
|
const byte = data[i];
|
|
4491
4511
|
if (byte === 13 || byte === 10) {
|
|
4492
4512
|
if (this._interjectionBuf.length > 0) {
|
|
4493
|
-
|
|
4513
|
+
const line = this._interjectionBuf;
|
|
4494
4514
|
this._interjectionBuf = "";
|
|
4495
4515
|
process.stdout.write("\n");
|
|
4516
|
+
if (line.startsWith("/")) {
|
|
4517
|
+
this.toolExecutor.pendingSlashCommand = line;
|
|
4518
|
+
process.stdout.write(theme.dim(` (command "${line}" queued)
|
|
4519
|
+
`));
|
|
4520
|
+
} else {
|
|
4521
|
+
this._userInterjection = line;
|
|
4522
|
+
}
|
|
4496
4523
|
}
|
|
4497
4524
|
} else if (byte === 127 || byte === 8) {
|
|
4498
4525
|
if (this._interjectionBuf.length > 0) {
|
|
@@ -4761,6 +4788,20 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4761
4788
|
try {
|
|
4762
4789
|
for (let round = 0; round < MAX_TOOL_ROUNDS; round++) {
|
|
4763
4790
|
this.toolExecutor.setRoundInfo(round + 1, MAX_TOOL_ROUNDS);
|
|
4791
|
+
if (this.toolExecutor.pendingSlashCommand) {
|
|
4792
|
+
const cmd = this.toolExecutor.pendingSlashCommand;
|
|
4793
|
+
this.toolExecutor.pendingSlashCommand = null;
|
|
4794
|
+
if (cmd === "/exit" || cmd === "/quit" || cmd === "/q") {
|
|
4795
|
+
spinner.stop();
|
|
4796
|
+
process.stdout.write(theme.warning(`\u26A1 ${cmd} \u2014 stopping agentic loop
|
|
4797
|
+
`));
|
|
4798
|
+
this.teardownInterjectionListener();
|
|
4799
|
+
return;
|
|
4800
|
+
}
|
|
4801
|
+
process.stdout.write(theme.warning(`\u26A1 Command "${cmd}" \u2014 injected as message
|
|
4802
|
+
`));
|
|
4803
|
+
extraMessages.push({ role: "user", content: cmd });
|
|
4804
|
+
}
|
|
4764
4805
|
if (this._userInterjection) {
|
|
4765
4806
|
const msg = this._userInterjection;
|
|
4766
4807
|
this._userInterjection = null;
|
|
@@ -5292,7 +5333,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5292
5333
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5293
5334
|
process.exit(1);
|
|
5294
5335
|
}
|
|
5295
|
-
const { startWebServer } = await import("./server-
|
|
5336
|
+
const { startWebServer } = await import("./server-IT4WXV42.js");
|
|
5296
5337
|
await startWebServer({ port, host: options.host });
|
|
5297
5338
|
});
|
|
5298
5339
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
setupProxy,
|
|
24
24
|
spawnAgentContext,
|
|
25
25
|
truncateOutput
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EKCYEBAS.js";
|
|
27
27
|
import {
|
|
28
28
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
29
29
|
CONTEXT_FILE_CANDIDATES,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
PLAN_MODE_SYSTEM_ADDON,
|
|
36
36
|
SKILLS_DIR_NAME,
|
|
37
37
|
VERSION
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-OIJT7K75.js";
|
|
39
39
|
import {
|
|
40
40
|
AuthManager
|
|
41
41
|
} from "./chunk-CPLT6CD3.js";
|