@brawnen/agent-harness-cli 0.1.1 → 0.1.2
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 +26 -4
- package/README.zh-CN.md +16 -4
- package/package.json +12 -4
- package/src/commands/docs.js +19 -13
- package/src/commands/init.js +64 -11
- package/src/commands/report.js +4 -4
- package/src/commands/status.js +102 -61
- package/src/commands/sync.js +88 -0
- package/src/index.js +9 -3
- package/src/lib/hook-core.js +26 -3
- package/src/lib/host-layout.js +1384 -0
- package/src/lib/output-policy.js +6 -6
- package/src/lib/task-core.js +83 -19
- package/src/runtime-host/index.js +57 -0
package/src/index.js
CHANGED
|
@@ -5,12 +5,13 @@ import { runGate } from "./commands/gate.js";
|
|
|
5
5
|
import { runHook } from "./commands/hook.js";
|
|
6
6
|
import { runInit } from "./commands/init.js";
|
|
7
7
|
import { runReport } from "./commands/report.js";
|
|
8
|
+
import { runSync } from "./commands/sync.js";
|
|
8
9
|
import { runState } from "./commands/state.js";
|
|
9
10
|
import { runStatus } from "./commands/status.js";
|
|
10
11
|
import { runTask } from "./commands/task.js";
|
|
11
12
|
import { runVerify } from "./commands/verify.js";
|
|
12
13
|
|
|
13
|
-
const HELP_TEXT = `agent-harness CLI
|
|
14
|
+
const HELP_TEXT = `agent-harness compatibility CLI
|
|
14
15
|
|
|
15
16
|
Usage:
|
|
16
17
|
agent-harness --help
|
|
@@ -23,6 +24,7 @@ Usage:
|
|
|
23
24
|
agent-harness docs scaffold --type <design-note|adr>
|
|
24
25
|
agent-harness gate before-tool --tool <tool>
|
|
25
26
|
agent-harness hook <claude|codex|gemini> <event>
|
|
27
|
+
agent-harness sync [--check] [--rewrite]
|
|
26
28
|
agent-harness status
|
|
27
29
|
agent-harness task intake "<任务描述>"
|
|
28
30
|
agent-harness task confirm [--task-id <task-id>]
|
|
@@ -41,7 +43,7 @@ Options:
|
|
|
41
43
|
--force
|
|
42
44
|
|
|
43
45
|
Status:
|
|
44
|
-
|
|
46
|
+
CLI 主要承担 init/status/manual fallback,宿主运行时正向 repo-local hooks 收敛。
|
|
45
47
|
`;
|
|
46
48
|
|
|
47
49
|
export function run(argv) {
|
|
@@ -53,7 +55,7 @@ export function run(argv) {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
if (command === "--version" || command === "-v") {
|
|
56
|
-
console.log("0.1.
|
|
58
|
+
console.log("0.1.2");
|
|
57
59
|
return 0;
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -85,6 +87,10 @@ export function run(argv) {
|
|
|
85
87
|
return runStatus(argv.slice(1));
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
if (command === "sync") {
|
|
91
|
+
return runSync(argv.slice(1));
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
if (command === "task") {
|
|
89
95
|
return runTask(argv.slice(1));
|
|
90
96
|
}
|
package/src/lib/hook-core.js
CHANGED
|
@@ -76,10 +76,10 @@ export function buildManualFallbackContext(reason, { commands = [], hostDisplayN
|
|
|
76
76
|
const fallbackCommands = Array.isArray(commands) ? commands.filter(Boolean) : [];
|
|
77
77
|
|
|
78
78
|
if (fallbackCommands.length === 0) {
|
|
79
|
-
return `${message}
|
|
79
|
+
return `${message},已降级继续。`;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return `${message}
|
|
82
|
+
return `${message},已降级。手动命令:${fallbackCommands.join(";")}`;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function handleSessionStart({
|
|
@@ -276,7 +276,7 @@ function handleUserOverridePrompt({ cwd, hostDisplayName, prompt }) {
|
|
|
276
276
|
const additionalNotes = [];
|
|
277
277
|
|
|
278
278
|
if (overrideDecision.type === "manual_confirmation") {
|
|
279
|
-
if (!(riskLevel === "high" && pendingConfirmation)) {
|
|
279
|
+
if (!(riskLevel === "high" && pendingConfirmation && isStandaloneConfirmationReply(prompt))) {
|
|
280
280
|
return null;
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -322,6 +322,29 @@ function handleUserOverridePrompt({ cwd, hostDisplayName, prompt }) {
|
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
function isStandaloneConfirmationReply(prompt) {
|
|
326
|
+
const normalized = String(prompt ?? "").trim().toLowerCase();
|
|
327
|
+
if (!normalized) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (normalized.length > 24) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const separators = /[,。!?;,.!?;::]/;
|
|
336
|
+
if (separators.test(normalized)) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const tokens = normalized.split(/\s+/).filter(Boolean);
|
|
341
|
+
if (tokens.length > 4) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
|
|
325
348
|
function appendOverrideEntry(cwd, taskId, entry) {
|
|
326
349
|
const persistedEntry = appendAuditEntry(cwd, {
|
|
327
350
|
...entry,
|