@zhivex-ai/harness 1.1.1 → 1.2.0-rc.13
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/CHANGELOG.md +160 -0
- package/README.md +14 -7
- package/SECURITY.md +1 -1
- package/SUPPORT.md +3 -3
- package/benchmarks/README.md +17 -0
- package/contracts/public-api.json +95 -5
- package/contracts/stable-api-signatures.json +38 -38
- package/dist/acp-cli.d.ts +2 -0
- package/dist/acp-cli.js +15938 -0
- package/dist/cli/arguments.d.ts +7 -1
- package/dist/cli/cli-credentials.d.ts +6 -1
- package/dist/cli/cli-options.d.ts +1 -1
- package/dist/cli/cli-profiles.d.ts +15 -0
- package/dist/cli/cli-stream.d.ts +3 -3
- package/dist/cli/console/console-budget.d.ts +9 -0
- package/dist/cli/console/console-commands.d.ts +3 -3
- package/dist/cli/console/console-compaction.d.ts +18 -0
- package/dist/cli/console/console-input.d.ts +22 -3
- package/dist/cli/console/console-navigation.d.ts +3 -0
- package/dist/cli/console/console-presentation.d.ts +9 -2
- package/dist/cli/console/console-progress.d.ts +6 -0
- package/dist/cli/console/console-reasoning.d.ts +3 -0
- package/dist/cli/doctor.d.ts +2 -2
- package/dist/cli/presentation.d.ts +8 -1
- package/dist/cli/qwen-connection.d.ts +23 -0
- package/dist/cli/run-document.d.ts +4 -4
- package/dist/cli/terminal/activity-history.d.ts +15 -0
- package/dist/cli/terminal/session-grants.d.ts +4 -0
- package/dist/cli/terminal/terminal-markdown.d.ts +7 -4
- package/dist/cli/terminal/terminal-table.d.ts +6 -0
- package/dist/cli/terminal/terminal-ui.d.ts +3 -0
- package/dist/cli/terminal/tool-activity.d.ts +21 -10
- package/dist/cli/tool-execution.d.ts +1 -0
- package/dist/cli-3jmy4h5h.js +5798 -0
- package/dist/cli-entry-1bx83sw4.js +4 -0
- package/dist/cli-entry-427869g9.js +2009 -0
- package/dist/cli-entry-64pdp3k5.js +17 -0
- package/dist/cli-entry-b1mfvmxe.js +376 -0
- package/dist/cli-entry-c2f58zj2.js +13602 -0
- package/dist/cli-entry.d.ts +2 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -19168
- package/dist/client/acp-stdio.d.ts +9 -0
- package/dist/client/acp.d.ts +18 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/json-contracts.d.ts +22 -8
- package/dist/config-1k9t4jhh.js +59 -0
- package/dist/context/adaptive-compaction.d.ts +2 -0
- package/dist/context/compaction.d.ts +3 -1
- package/dist/context/qwen-reasoning.d.ts +5 -0
- package/dist/context/scoped-context.d.ts +61 -0
- package/dist/context/semantic-compaction.d.ts +21 -0
- package/dist/context/task-memory.d.ts +13 -8
- package/dist/execution/execution-environment.d.ts +5 -0
- package/dist/execution/oci-observability.d.ts +2 -0
- package/dist/execution/patch-diagnostics.d.ts +6 -0
- package/dist/hostile-repository-demo.js +4614 -1930
- package/dist/index.d.ts +13 -1
- package/dist/index.js +16435 -12486
- package/dist/integrations/mcp.d.ts +23 -3
- package/dist/models/catalog.d.ts +76 -0
- package/dist/models/compaction-recommendations.d.ts +28 -0
- package/dist/models/sdk-catalog-adapter.d.ts +7 -0
- package/dist/persistence/operations.d.ts +10 -6
- package/dist/persistence/state-backup-stream.d.ts +4 -0
- package/dist/persistence/state-backup.d.ts +52 -0
- package/dist/persistence/state-gitignore.d.ts +2 -0
- package/dist/persistence/workspace-checkpoints.d.ts +149 -0
- package/dist/providers/meta-continuation.d.ts +1 -1
- package/dist/providers/meta-errors.d.ts +2 -0
- package/dist/providers/meta-replay.d.ts +2 -0
- package/dist/providers/qwen-context.d.ts +2 -0
- package/dist/providers/qwen-hosted-policy.d.ts +5 -0
- package/dist/providers/reasoning.d.ts +18 -0
- package/dist/runtime/config.d.ts +12 -3
- package/dist/runtime/context-runtime.d.ts +12 -0
- package/dist/runtime/error-diagnostics.d.ts +641 -0
- package/dist/runtime/harness.d.ts +13 -4
- package/dist/runtime/model-edit-references.d.ts +8 -0
- package/dist/runtime/oci-delivery.d.ts +17 -0
- package/dist/runtime/progress-monitor.d.ts +33 -0
- package/dist/runtime/provider-diagnostics.d.ts +35 -0
- package/dist/runtime/runtime-checkpoints.d.ts +3 -0
- package/dist/runtime/runtime-diagnostics.d.ts +5 -5
- package/dist/runtime/runtime-policy.d.ts +14 -6
- package/dist/runtime/time-to-safe-fix.d.ts +308 -1
- package/dist/runtime/tool-execution.d.ts +11 -0
- package/dist/runtime/tool-policy.d.ts +55 -0
- package/dist/runtime/tool-scheduling.d.ts +5 -0
- package/dist/runtime/usage-ledger.d.ts +1 -0
- package/dist/service-cli.js +9422 -6622
- package/dist/service-client-cli-yx56n0hc.js +1086 -0
- package/dist/tools/dependency-read.d.ts +63 -0
- package/dist/tools/execution.d.ts +8 -8
- package/dist/tools/workspace.d.ts +31 -15
- package/dist/verify-historical-migrations.js +5272 -2437
- package/dist/workspace/file-security.d.ts +6 -0
- package/dist/zhx.js +15 -19168
- package/docs/ACP.md +55 -0
- package/docs/CLI.md +292 -29
- package/docs/CONTEXT_ENGINEERING.md +184 -20
- package/docs/CREDENTIALS.md +38 -6
- package/docs/DURABLE_OPERATIONS.md +10 -0
- package/docs/EXTENSIBILITY.md +101 -4
- package/docs/FIRST_USE.md +7 -5
- package/docs/MODEL_CATALOG.md +52 -1
- package/docs/README.md +1 -0
- package/docs/REPOSITORY_EDITING.md +42 -0
- package/docs/STABILITY.md +2 -0
- package/docs/SUPPORT_MATRIX_1_1.md +17 -0
- package/docs/USAGE.md +9 -0
- package/docs/WORKSPACE_CHECKPOINTS.md +27 -0
- package/docs/images/cli-conversation.png +0 -0
- package/docs/support-matrix-1.1.json +29 -0
- package/evaluations/golden-expectations.json +5 -0
- package/evaluations/representative-assembly-matrix.json +145 -1
- package/evaluations/representative-repositories-v2.jsonl +7 -0
- package/examples/README.md +2 -2
- package/package.json +19 -13
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/version.ts
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var packageMetadata = createRequire(import.meta.url)("../package.json");
|
|
4
|
+
if (typeof packageMetadata.version !== "string" || packageMetadata.version.length === 0) {
|
|
5
|
+
throw new Error("package.json must contain a non-empty version.");
|
|
6
|
+
}
|
|
7
|
+
if (typeof packageMetadata.engines?.node !== "string" || packageMetadata.engines.node.length === 0) {
|
|
8
|
+
throw new Error("package.json must contain a non-empty engines.node requirement.");
|
|
9
|
+
}
|
|
10
|
+
if (typeof packageMetadata.engines?.bun !== "string" || packageMetadata.engines.bun.length === 0) {
|
|
11
|
+
throw new Error("package.json must contain a non-empty engines.bun requirement.");
|
|
12
|
+
}
|
|
13
|
+
var HARNESS_VERSION = packageMetadata.version;
|
|
14
|
+
var NODE_ENGINE_RANGE = packageMetadata.engines.node;
|
|
15
|
+
var BUN_ENGINE_RANGE = packageMetadata.engines.bun;
|
|
16
|
+
|
|
17
|
+
export { HARNESS_VERSION, NODE_ENGINE_RANGE, BUN_ENGINE_RANGE };
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// src/cli/cli-options.ts
|
|
2
|
+
var repeatableOptions = new Set([
|
|
3
|
+
"--route",
|
|
4
|
+
"--oci-allow-command",
|
|
5
|
+
"--allow-check",
|
|
6
|
+
"--require-capability",
|
|
7
|
+
"--subagent",
|
|
8
|
+
"--reviewer",
|
|
9
|
+
"--status"
|
|
10
|
+
]);
|
|
11
|
+
var conflicts = {
|
|
12
|
+
"--approval-mode": ["--yes"],
|
|
13
|
+
"--yes": ["--approval-mode"],
|
|
14
|
+
"--token-budget": ["--no-token-budget"],
|
|
15
|
+
"--no-token-budget": ["--token-budget"],
|
|
16
|
+
"--usage-limit-usd": ["--max-cost-usd", "--input-cost-per-million", "--output-cost-per-million"],
|
|
17
|
+
"--max-cost-usd": ["--usage-limit-usd"],
|
|
18
|
+
"--input-cost-per-million": ["--usage-limit-usd"],
|
|
19
|
+
"--output-cost-per-million": ["--usage-limit-usd"],
|
|
20
|
+
"--json": ["--jsonl"],
|
|
21
|
+
"--jsonl": ["--json"],
|
|
22
|
+
"--session": ["--continue"],
|
|
23
|
+
"--continue": ["--session"],
|
|
24
|
+
"--approve": ["--deny"],
|
|
25
|
+
"--deny": ["--approve"]
|
|
26
|
+
};
|
|
27
|
+
var CLI_OPTION_NAMES = [
|
|
28
|
+
"--compaction-model",
|
|
29
|
+
"--compaction-provider",
|
|
30
|
+
"--provider",
|
|
31
|
+
"--model",
|
|
32
|
+
"--reasoning",
|
|
33
|
+
"--profile",
|
|
34
|
+
"--route",
|
|
35
|
+
"--workspace",
|
|
36
|
+
"--state-dir",
|
|
37
|
+
"--mcp-config",
|
|
38
|
+
"--context-config",
|
|
39
|
+
"--no-project-context",
|
|
40
|
+
"--patch",
|
|
41
|
+
"--preconditions",
|
|
42
|
+
"--now",
|
|
43
|
+
"--require-verified-delivery",
|
|
44
|
+
"--execution",
|
|
45
|
+
"--oci-runtime",
|
|
46
|
+
"--oci-image",
|
|
47
|
+
"--oci-allow-command",
|
|
48
|
+
"--oci-shell",
|
|
49
|
+
"--oci-max-process-runtime-ms",
|
|
50
|
+
"--oci-max-process-output-bytes",
|
|
51
|
+
"--oci-max-memory-mb",
|
|
52
|
+
"--oci-max-pids",
|
|
53
|
+
"--oci-max-cpus",
|
|
54
|
+
"--oci-max-workspace-bytes",
|
|
55
|
+
"--oci-max-file-write-bytes",
|
|
56
|
+
"--oci-tmpfs-mb",
|
|
57
|
+
"--store",
|
|
58
|
+
"--tenant",
|
|
59
|
+
"--user",
|
|
60
|
+
"--namespace",
|
|
61
|
+
"--idempotency-key",
|
|
62
|
+
"--token-budget",
|
|
63
|
+
"--context-tokens",
|
|
64
|
+
"--no-token-budget",
|
|
65
|
+
"--max-steps",
|
|
66
|
+
"--timeout-ms",
|
|
67
|
+
"--max-tool-calls",
|
|
68
|
+
"--max-tool-errors",
|
|
69
|
+
"--max-input-tokens",
|
|
70
|
+
"--max-output-tokens",
|
|
71
|
+
"--max-total-tokens",
|
|
72
|
+
"--subagent-max-steps",
|
|
73
|
+
"--subagent-max-tool-calls",
|
|
74
|
+
"--subagent-max-tool-errors",
|
|
75
|
+
"--subagent-max-input-tokens",
|
|
76
|
+
"--subagent-max-output-tokens",
|
|
77
|
+
"--subagent-max-total-tokens",
|
|
78
|
+
"--subagent-timeout-ms",
|
|
79
|
+
"--max-parallel-reviews",
|
|
80
|
+
"--max-cost-usd",
|
|
81
|
+
"--input-cost-per-million",
|
|
82
|
+
"--output-cost-per-million",
|
|
83
|
+
"--allow-check",
|
|
84
|
+
"--require-capability",
|
|
85
|
+
"--subagent",
|
|
86
|
+
"--reviewer",
|
|
87
|
+
"--approval-mode",
|
|
88
|
+
"--yes",
|
|
89
|
+
"--approve",
|
|
90
|
+
"--deny",
|
|
91
|
+
"--json",
|
|
92
|
+
"--jsonl",
|
|
93
|
+
"--session",
|
|
94
|
+
"--continue",
|
|
95
|
+
"--update",
|
|
96
|
+
"--status",
|
|
97
|
+
"--limit",
|
|
98
|
+
"--cursor",
|
|
99
|
+
"--before",
|
|
100
|
+
"--reason",
|
|
101
|
+
"--cascade",
|
|
102
|
+
"--final",
|
|
103
|
+
"--service",
|
|
104
|
+
"--apply",
|
|
105
|
+
"--help",
|
|
106
|
+
"--version",
|
|
107
|
+
"--search",
|
|
108
|
+
"--pricing-file",
|
|
109
|
+
"--usage-limit-usd"
|
|
110
|
+
];
|
|
111
|
+
var CLI_OPTION_DEFINITIONS = Object.fromEntries(CLI_OPTION_NAMES.map((name) => [name, {
|
|
112
|
+
repeatable: repeatableOptions.has(name),
|
|
113
|
+
conflictsWith: conflicts[name] ?? []
|
|
114
|
+
}]));
|
|
115
|
+
var locator = ["--workspace", "--state-dir", "--store", "--tenant", "--user", "--namespace"];
|
|
116
|
+
var provider = ["--provider", "--model", "--reasoning"];
|
|
117
|
+
var profile = ["--profile"];
|
|
118
|
+
var project = ["--mcp-config", "--context-config", "--no-project-context"];
|
|
119
|
+
var execution = [
|
|
120
|
+
"--require-verified-delivery",
|
|
121
|
+
"--execution",
|
|
122
|
+
"--oci-runtime",
|
|
123
|
+
"--oci-image",
|
|
124
|
+
"--oci-allow-command",
|
|
125
|
+
"--oci-shell",
|
|
126
|
+
"--oci-max-process-runtime-ms",
|
|
127
|
+
"--oci-max-process-output-bytes",
|
|
128
|
+
"--oci-max-memory-mb",
|
|
129
|
+
"--oci-max-pids",
|
|
130
|
+
"--oci-max-cpus",
|
|
131
|
+
"--oci-max-workspace-bytes",
|
|
132
|
+
"--oci-max-file-write-bytes",
|
|
133
|
+
"--oci-tmpfs-mb"
|
|
134
|
+
];
|
|
135
|
+
var budgets = [
|
|
136
|
+
"--token-budget",
|
|
137
|
+
"--context-tokens",
|
|
138
|
+
"--no-token-budget",
|
|
139
|
+
"--max-steps",
|
|
140
|
+
"--timeout-ms",
|
|
141
|
+
"--max-tool-calls",
|
|
142
|
+
"--max-tool-errors",
|
|
143
|
+
"--max-input-tokens",
|
|
144
|
+
"--max-output-tokens",
|
|
145
|
+
"--max-total-tokens",
|
|
146
|
+
"--max-cost-usd",
|
|
147
|
+
"--input-cost-per-million",
|
|
148
|
+
"--output-cost-per-million",
|
|
149
|
+
"--subagent-max-steps",
|
|
150
|
+
"--subagent-max-tool-calls",
|
|
151
|
+
"--subagent-max-tool-errors",
|
|
152
|
+
"--subagent-max-input-tokens",
|
|
153
|
+
"--subagent-max-output-tokens",
|
|
154
|
+
"--subagent-max-total-tokens",
|
|
155
|
+
"--subagent-timeout-ms"
|
|
156
|
+
];
|
|
157
|
+
var childBudgets = [
|
|
158
|
+
"--no-token-budget",
|
|
159
|
+
"--subagent-max-steps",
|
|
160
|
+
"--subagent-max-tool-calls",
|
|
161
|
+
"--subagent-max-tool-errors",
|
|
162
|
+
"--subagent-max-input-tokens",
|
|
163
|
+
"--subagent-max-output-tokens",
|
|
164
|
+
"--subagent-max-total-tokens",
|
|
165
|
+
"--subagent-timeout-ms"
|
|
166
|
+
];
|
|
167
|
+
var agent = [
|
|
168
|
+
"--compaction-model",
|
|
169
|
+
"--compaction-provider",
|
|
170
|
+
"--pricing-file",
|
|
171
|
+
"--usage-limit-usd",
|
|
172
|
+
...provider,
|
|
173
|
+
...profile,
|
|
174
|
+
"--route",
|
|
175
|
+
...locator,
|
|
176
|
+
...project,
|
|
177
|
+
...execution,
|
|
178
|
+
...budgets,
|
|
179
|
+
"--allow-check",
|
|
180
|
+
"--require-capability",
|
|
181
|
+
"--subagent"
|
|
182
|
+
];
|
|
183
|
+
var contract = (allowed, required = []) => {
|
|
184
|
+
const allowedSet = new Set(allowed);
|
|
185
|
+
return {
|
|
186
|
+
allowed,
|
|
187
|
+
required,
|
|
188
|
+
repeatable: allowed.filter((name) => repeatableOptions.has(name)),
|
|
189
|
+
conflicts: Object.fromEntries(allowed.flatMap((name) => {
|
|
190
|
+
const relevant = conflicts[name]?.filter((other) => allowedSet.has(other)) ?? [];
|
|
191
|
+
return relevant.length > 0 ? [[name, relevant]] : [];
|
|
192
|
+
}))
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
var CLI_COMMAND_OPTION_CONTRACTS = {
|
|
196
|
+
init: contract([...provider, ...profile, "--update", "--json"]),
|
|
197
|
+
run: contract(["--service", "--session", ...agent, "--idempotency-key", "--approval-mode", "--yes", "--json", "--jsonl"]),
|
|
198
|
+
review: contract([
|
|
199
|
+
"--pricing-file",
|
|
200
|
+
"--usage-limit-usd",
|
|
201
|
+
...provider,
|
|
202
|
+
...profile,
|
|
203
|
+
"--route",
|
|
204
|
+
...locator,
|
|
205
|
+
"--context-config",
|
|
206
|
+
"--no-project-context",
|
|
207
|
+
...childBudgets,
|
|
208
|
+
"--max-parallel-reviews",
|
|
209
|
+
"--require-capability",
|
|
210
|
+
"--reviewer",
|
|
211
|
+
"--json"
|
|
212
|
+
]),
|
|
213
|
+
chat: contract(["--service", ...agent, "--approval-mode", "--yes", "--session", "--continue"]),
|
|
214
|
+
providers: contract(["--json"]),
|
|
215
|
+
doctor: contract([...provider, ...profile, ...locator, ...project, ...execution, ...budgets, "--allow-check", "--require-capability", "--subagent", "--json"]),
|
|
216
|
+
resume: contract(["--service", "--session", ...locator, "--approve", "--deny", "--json", "--jsonl"], [["--approve", "--deny"]]),
|
|
217
|
+
"runs:list": contract([...locator, "--status", "--limit", "--cursor", "--json"]),
|
|
218
|
+
"runs:inspect": contract([...locator, "--json"]),
|
|
219
|
+
"runs:cancel": contract([...locator, "--reason", "--cascade", "--final", "--json"]),
|
|
220
|
+
"runs:cleanup": contract([...locator, "--before", "--status", "--limit", "--json"], ["--before"]),
|
|
221
|
+
"runs:export": contract([...locator, "--json"]),
|
|
222
|
+
"sessions:list": contract(["--service", ...locator, "--limit", "--json", "--search"]),
|
|
223
|
+
"sessions:inspect": contract(["--service", ...locator, "--json"]),
|
|
224
|
+
"sessions:rename": contract(["--service", ...locator, "--json"]),
|
|
225
|
+
"sessions:fork": contract([...locator, "--json"]),
|
|
226
|
+
"sessions:archive": contract([...locator, "--json"]),
|
|
227
|
+
"changes:create": contract(["--patch"], ["--patch"]),
|
|
228
|
+
"changes:verify": contract(["--patch", "--preconditions", "--now"], ["--patch"]),
|
|
229
|
+
"state:status": contract([...locator, "--json"]),
|
|
230
|
+
"state:export": contract([...locator, "--json"]),
|
|
231
|
+
"state:import": contract([...locator, "--apply", "--json"]),
|
|
232
|
+
help: contract(["--help"]),
|
|
233
|
+
version: contract(["--version"])
|
|
234
|
+
};
|
|
235
|
+
var validateCliCommandOptions = (commandKey, counts) => {
|
|
236
|
+
const commandContract = CLI_COMMAND_OPTION_CONTRACTS[commandKey];
|
|
237
|
+
const allowed = new Set(commandContract.allowed);
|
|
238
|
+
for (const [name, count] of counts) {
|
|
239
|
+
if (!allowed.has(name)) {
|
|
240
|
+
throw new Error(`${name} is not supported by ${commandKey.replace(":", " ")}.`);
|
|
241
|
+
}
|
|
242
|
+
if (count > 1 && !commandContract.repeatable.includes(name)) {
|
|
243
|
+
throw new Error(`${name} cannot be repeated for ${commandKey.replace(":", " ")}.`);
|
|
244
|
+
}
|
|
245
|
+
for (const conflicting of commandContract.conflicts[name] ?? []) {
|
|
246
|
+
if (counts.has(conflicting)) {
|
|
247
|
+
throw new Error(`${name} cannot be combined with ${conflicting}.`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
for (const requirement of commandContract.required) {
|
|
252
|
+
if (typeof requirement === "string") {
|
|
253
|
+
if (!counts.has(requirement)) {
|
|
254
|
+
throw new Error(`${requirement} is required by ${commandKey.replace(":", " ")}.`);
|
|
255
|
+
}
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (!requirement.some((name) => counts.has(name))) {
|
|
259
|
+
throw new Error(`${requirement.join(" or ")} is required by ${commandKey.replace(":", " ")}.`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/cli/cli-help.ts
|
|
265
|
+
var usage = {
|
|
266
|
+
init: "zhx init [--provider <id>] [--model <id>] [--profile <name>] [--update]",
|
|
267
|
+
run: 'zhx run [options] "task" | zhx run [options] -',
|
|
268
|
+
review: 'zhx review [options] "review task" | zhx review [options] -',
|
|
269
|
+
chat: "zhx [--continue | --session <id>]",
|
|
270
|
+
providers: "zhx providers [--json]",
|
|
271
|
+
doctor: "zhx doctor [options]",
|
|
272
|
+
resume: "zhx resume <runId> --approve|--deny",
|
|
273
|
+
"runs:list": "zhx runs list [options]",
|
|
274
|
+
"runs:inspect": "zhx runs inspect <runId>",
|
|
275
|
+
"runs:cancel": "zhx runs cancel <runId> [options]",
|
|
276
|
+
"runs:cleanup": "zhx runs cleanup --before <date> [options]",
|
|
277
|
+
"runs:export": "zhx runs export <runId>",
|
|
278
|
+
"sessions:list": "zhx sessions list [--search <text>]",
|
|
279
|
+
"sessions:inspect": "zhx sessions inspect <sessionId>",
|
|
280
|
+
"sessions:rename": 'zhx sessions rename <sessionId> "title"',
|
|
281
|
+
"sessions:fork": "zhx sessions fork <sessionId>",
|
|
282
|
+
"sessions:archive": "zhx sessions archive <sessionId>",
|
|
283
|
+
"changes:create": "zhx changes create <input.json> --patch <artifact>",
|
|
284
|
+
"changes:verify": "zhx changes verify <envelope.json> --patch <artifact> [options]",
|
|
285
|
+
"state:status": "zhx state status",
|
|
286
|
+
"state:export": "zhx state export <backup.json>",
|
|
287
|
+
"state:import": "zhx state import <backup.json> [--apply]",
|
|
288
|
+
version: "zhx --version"
|
|
289
|
+
};
|
|
290
|
+
var shortCliHelp = (version) => `Zhivex Harness v${version}
|
|
291
|
+
|
|
292
|
+
Start in your project:
|
|
293
|
+
zhx Open the conversation (first-use setup if needed)
|
|
294
|
+
zhx --continue Reopen the latest conversation
|
|
295
|
+
zhx run "task" Run one task for a script or automation
|
|
296
|
+
zhx doctor Check local configuration
|
|
297
|
+
|
|
298
|
+
Inside the console, type / for common actions or /help for guidance.
|
|
299
|
+
zhx init Configure a provider/model profile explicitly
|
|
300
|
+
zhx <command> --help Show help for one command
|
|
301
|
+
zhx help all Show every command and advanced option
|
|
302
|
+
zhx --version Show the installed version
|
|
303
|
+
|
|
304
|
+
Requires Node >=22.13. The console guides API key setup; automation uses environment keys.
|
|
305
|
+
zhx chat and zhivex-harness remain supported aliases.`;
|
|
306
|
+
function resolveHelpTopic(parts, explicit) {
|
|
307
|
+
if (!explicit || !parts.length)
|
|
308
|
+
return;
|
|
309
|
+
const topic = parts.join(":");
|
|
310
|
+
if (topic === "all" || Object.hasOwn(usage, topic) || Object.keys(usage).some((key) => key.startsWith(`${topic}:`)))
|
|
311
|
+
return topic;
|
|
312
|
+
throw new Error(`Unknown help topic: ${parts.join(" ")}. Use zhx help all.`);
|
|
313
|
+
}
|
|
314
|
+
function formatCliHelp(topic, version, full) {
|
|
315
|
+
if (!topic)
|
|
316
|
+
return shortCliHelp(version);
|
|
317
|
+
if (topic === "all")
|
|
318
|
+
return full;
|
|
319
|
+
const contract2 = CLI_COMMAND_OPTION_CONTRACTS[topic];
|
|
320
|
+
if (!contract2) {
|
|
321
|
+
return `Zhivex Harness — ${topic}
|
|
322
|
+
|
|
323
|
+
` + Object.entries(usage).filter(([key]) => key.startsWith(`${topic}:`)).map(([, command]) => ` ${command}`).join(`
|
|
324
|
+
`) + `
|
|
325
|
+
|
|
326
|
+
Use zhx ${topic} <subcommand> --help for its options.`;
|
|
327
|
+
}
|
|
328
|
+
const descriptions = new Map;
|
|
329
|
+
for (const line of full.split(`
|
|
330
|
+
`)) {
|
|
331
|
+
const match = line.match(/^ (--[\w-]+)(?:\s|$)/);
|
|
332
|
+
if (match)
|
|
333
|
+
descriptions.set(match[1], line);
|
|
334
|
+
}
|
|
335
|
+
const extra = {
|
|
336
|
+
"--approve": " --approve Approve the pending batch",
|
|
337
|
+
"--deny": " --deny Deny the pending batch",
|
|
338
|
+
"--status": " --status <status> Filter by run status; repeatable",
|
|
339
|
+
"--limit": " --limit <n> Maximum number of results",
|
|
340
|
+
"--search": " --search <text> Literal conversation title or ID filter",
|
|
341
|
+
"--pricing-file": " --pricing-file <file.json> Operator-supplied price estimates",
|
|
342
|
+
"--usage-limit-usd": " --usage-limit-usd <amount> Per-run monetary limit; requires pricing",
|
|
343
|
+
"--version": " --version Show the installed version"
|
|
344
|
+
};
|
|
345
|
+
const examples = {
|
|
346
|
+
run: ['zhx run "Explain this repository"', 'zhx run --profile daily --json "Review the parser"', "git diff | zhx run -"],
|
|
347
|
+
review: ['zhx review "Review error handling"', "zhx review - < review-task.txt"],
|
|
348
|
+
init: ["zhx init --profile daily", "zhx init --profile daily --update --model <id>"],
|
|
349
|
+
doctor: ["zhx doctor --profile daily", "zhx doctor --workspace /path/to/project"]
|
|
350
|
+
};
|
|
351
|
+
const groups = new Map;
|
|
352
|
+
for (const name of contract2.allowed) {
|
|
353
|
+
const group = name.startsWith("--oci-") || ["--execution", "--require-verified-delivery", "--allow-check", "--yes"].includes(name) ? "Execution and approvals" : /subagent|reviewer|parallel-reviews|^--route$/.test(name) ? "Specialist agents" : /cost|pricing|usage-limit|^--max-|^--timeout/.test(name) ? "Budgets and limits" : ["--state-dir", "--store", "--tenant", "--user", "--namespace", "--idempotency-key"].includes(name) ? "State and scope" : ["--mcp-config", "--context-config", "--no-project-context", "--require-capability"].includes(name) ? "Context and capabilities" : "Common options";
|
|
354
|
+
const lines = groups.get(group) ?? [];
|
|
355
|
+
lines.push(descriptions.get(name) ?? extra[name] ?? ` ${name}`);
|
|
356
|
+
groups.set(group, lines);
|
|
357
|
+
}
|
|
358
|
+
const sections = ["Common options", "Execution and approvals", "Budgets and limits", "Specialist agents", "Context and capabilities", "State and scope"].filter((group) => groups.has(group)).map((group) => `${group}:
|
|
359
|
+
${groups.get(group).join(`
|
|
360
|
+
`)}`);
|
|
361
|
+
return `Zhivex Harness — ${topic.replace(":", " ")}
|
|
362
|
+
|
|
363
|
+
Usage: ${usage[topic]}
|
|
364
|
+
` + (examples[topic] ? `
|
|
365
|
+
Examples:
|
|
366
|
+
${examples[topic].map((example) => ` ${example}`).join(`
|
|
367
|
+
`)}
|
|
368
|
+
` : "") + `
|
|
369
|
+
${sections.join(`
|
|
370
|
+
|
|
371
|
+
`)}
|
|
372
|
+
|
|
373
|
+
Use zhx help all for the full reference and exit codes.`;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export { CLI_OPTION_DEFINITIONS, validateCliCommandOptions, shortCliHelp, resolveHelpTopic, formatCliHelp };
|