jinzd-ai-cli 0.2.24 → 0.2.26
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-I5PCIFFK.js → chunk-3PBMD3H6.js} +1 -1
- package/dist/{chunk-FGZU7XNQ.js → chunk-BSUW2USA.js} +1 -1
- package/dist/index.js +51 -5
- package/dist/{run-tests-MIUBHRXG.js → run-tests-GPPAKSCT.js} +1 -1
- package/dist/{server-E2TJNNYH.js → server-HSGK6BPN.js} +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
theme,
|
|
37
37
|
truncateOutput,
|
|
38
38
|
undoStack
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-BSUW2USA.js";
|
|
40
40
|
import {
|
|
41
41
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
42
42
|
AUTHOR,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
REPO_URL,
|
|
57
57
|
SKILLS_DIR_NAME,
|
|
58
58
|
VERSION
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-3PBMD3H6.js";
|
|
60
60
|
|
|
61
61
|
// src/index.ts
|
|
62
62
|
import { program } from "commander";
|
|
@@ -866,6 +866,7 @@ function createDefaultCommands() {
|
|
|
866
866
|
" /bug [--copy] - Generate bug report template (--copy to clipboard)",
|
|
867
867
|
" /diff [--stats] - Show all file modifications in this session",
|
|
868
868
|
" /fork [checkpoint] - Fork session from checkpoint or current position",
|
|
869
|
+
" /yolo [on|off] - Toggle session auto-approve (skip confirmations)",
|
|
869
870
|
" /exit - Exit"
|
|
870
871
|
] : [];
|
|
871
872
|
console.log("\nAvailable commands:");
|
|
@@ -1905,7 +1906,7 @@ ${hint}` : "")
|
|
|
1905
1906
|
description: "Run project tests and show structured report",
|
|
1906
1907
|
usage: "/test [command|filter]",
|
|
1907
1908
|
async execute(args, _ctx) {
|
|
1908
|
-
const { executeTests } = await import("./run-tests-
|
|
1909
|
+
const { executeTests } = await import("./run-tests-GPPAKSCT.js");
|
|
1909
1910
|
const argStr = args.join(" ").trim();
|
|
1910
1911
|
let testArgs = {};
|
|
1911
1912
|
if (argStr) {
|
|
@@ -2283,6 +2284,24 @@ Summary: ${fileMap.size} file(s) \u2014 ${newFiles} new, ${modifiedFiles} modifi
|
|
|
2283
2284
|
}
|
|
2284
2285
|
}
|
|
2285
2286
|
},
|
|
2287
|
+
{
|
|
2288
|
+
name: "yolo",
|
|
2289
|
+
description: "Toggle session auto-approve (skip all confirmations)",
|
|
2290
|
+
usage: "/yolo [on|off]",
|
|
2291
|
+
execute(args, ctx) {
|
|
2292
|
+
const sub = args[0]?.toLowerCase();
|
|
2293
|
+
const executor = ctx.getToolExecutor();
|
|
2294
|
+
if (sub === "off") {
|
|
2295
|
+
executor.sessionAutoApprove = false;
|
|
2296
|
+
console.log(theme.info(" \u{1F512} Auto-approve disabled \u2014 confirmations restored for this session."));
|
|
2297
|
+
} else {
|
|
2298
|
+
executor.sessionAutoApprove = true;
|
|
2299
|
+
console.log(theme.warning(" \u26A1 YOLO mode ON \u2014 all write/destructive tools auto-approved for this session."));
|
|
2300
|
+
console.log(theme.dim(" Use /yolo off to re-enable confirmations."));
|
|
2301
|
+
}
|
|
2302
|
+
console.log();
|
|
2303
|
+
}
|
|
2304
|
+
},
|
|
2286
2305
|
{
|
|
2287
2306
|
name: "exit",
|
|
2288
2307
|
description: "Exit the REPL",
|
|
@@ -2479,6 +2498,11 @@ var ToolExecutor = class {
|
|
|
2479
2498
|
pendingSlashCommand = null;
|
|
2480
2499
|
/** confirm() 的取消回调,由 SIGINT handler 调用 */
|
|
2481
2500
|
cancelConfirmFn = null;
|
|
2501
|
+
/**
|
|
2502
|
+
* 会话级 auto-approve:跳过所有 write/destructive 确认(仅当前会话有效)。
|
|
2503
|
+
* 通过 /yolo 命令切换。destructive 操作仍会显示警告但不阻塞。
|
|
2504
|
+
*/
|
|
2505
|
+
sessionAutoApprove = false;
|
|
2482
2506
|
/**
|
|
2483
2507
|
* 由外部(repl.ts SIGINT handler)调用,将当前 confirm() 等待视为用户按 N 取消。
|
|
2484
2508
|
* 若当前没有 confirm() 进行中,无操作。
|
|
@@ -2547,6 +2571,24 @@ var ToolExecutor = class {
|
|
|
2547
2571
|
}
|
|
2548
2572
|
}
|
|
2549
2573
|
}
|
|
2574
|
+
if (this.sessionAutoApprove && dangerLevel !== "safe") {
|
|
2575
|
+
this.printToolCall(call);
|
|
2576
|
+
if (dangerLevel === "write") this.printDiffPreview(call);
|
|
2577
|
+
console.log(theme.warning(" \u26A1 Auto-approved (session /yolo mode)"));
|
|
2578
|
+
try {
|
|
2579
|
+
const rawContent = await tool.execute(call.arguments);
|
|
2580
|
+
const content = truncateOutput(rawContent, call.name);
|
|
2581
|
+
const wasTruncated = content !== rawContent;
|
|
2582
|
+
this.printToolResult(call.name, rawContent, false, wasTruncated);
|
|
2583
|
+
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
|
|
2584
|
+
return { callId: call.id, content, isError: false };
|
|
2585
|
+
} catch (err) {
|
|
2586
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2587
|
+
this.printToolResult(call.name, message, true, false);
|
|
2588
|
+
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
|
|
2589
|
+
return { callId: call.id, content: message, isError: true };
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2550
2592
|
if (dangerLevel === "write") {
|
|
2551
2593
|
this.printToolCall(call);
|
|
2552
2594
|
this.printDiffPreview(call);
|
|
@@ -2635,7 +2677,10 @@ var ToolExecutor = class {
|
|
|
2635
2677
|
this.printDiffPreview(call);
|
|
2636
2678
|
}
|
|
2637
2679
|
console.log(theme.dim("\u2500".repeat(50)));
|
|
2638
|
-
const decision = await this.batchConfirm(calls.length);
|
|
2680
|
+
const decision = this.sessionAutoApprove ? "all" : await this.batchConfirm(calls.length);
|
|
2681
|
+
if (this.sessionAutoApprove) {
|
|
2682
|
+
console.log(theme.warning(" \u26A1 All auto-approved (session /yolo mode)"));
|
|
2683
|
+
}
|
|
2639
2684
|
const results = [];
|
|
2640
2685
|
for (let i = 0; i < calls.length; i++) {
|
|
2641
2686
|
const call = calls[i];
|
|
@@ -5368,6 +5413,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
|
|
|
5368
5413
|
removeContextDir: (dirPath) => this.removeExtraContextDir(dirPath),
|
|
5369
5414
|
listContextDirs: () => [...this.extraContextDirs],
|
|
5370
5415
|
forkSession: (messageCount, title) => this.sessions.forkSession(messageCount, title),
|
|
5416
|
+
getToolExecutor: () => this.toolExecutor,
|
|
5371
5417
|
exit: () => this.handleExit()
|
|
5372
5418
|
};
|
|
5373
5419
|
await cmd.execute(args, ctx);
|
|
@@ -5470,7 +5516,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5470
5516
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5471
5517
|
process.exit(1);
|
|
5472
5518
|
}
|
|
5473
|
-
const { startWebServer } = await import("./server-
|
|
5519
|
+
const { startWebServer } = await import("./server-HSGK6BPN.js");
|
|
5474
5520
|
await startWebServer({ port, host: options.host });
|
|
5475
5521
|
});
|
|
5476
5522
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
setupProxy,
|
|
25
25
|
spawnAgentContext,
|
|
26
26
|
truncateOutput
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BSUW2USA.js";
|
|
28
28
|
import {
|
|
29
29
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
30
30
|
CONTEXT_FILE_CANDIDATES,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
PLAN_MODE_SYSTEM_ADDON,
|
|
37
37
|
SKILLS_DIR_NAME,
|
|
38
38
|
VERSION
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3PBMD3H6.js";
|
|
40
40
|
import {
|
|
41
41
|
AuthManager
|
|
42
42
|
} from "./chunk-CPLT6CD3.js";
|