@dungle-scrubs/harness-cli-normalizer 0.1.3 → 0.3.0

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.
Files changed (151) hide show
  1. package/README.md +144 -7
  2. package/dist/cli/args.d.ts +74 -0
  3. package/dist/cli/args.d.ts.map +1 -0
  4. package/dist/cli/args.js +339 -0
  5. package/dist/cli/args.js.map +1 -0
  6. package/dist/cli/check.d.ts +2 -0
  7. package/dist/cli/check.d.ts.map +1 -0
  8. package/dist/cli/check.js +110 -0
  9. package/dist/cli/check.js.map +1 -0
  10. package/dist/cli/exit-codes.d.ts +7 -0
  11. package/dist/cli/exit-codes.d.ts.map +1 -0
  12. package/dist/cli/exit-codes.js +11 -0
  13. package/dist/cli/exit-codes.js.map +1 -0
  14. package/dist/cli/help.d.ts +7 -0
  15. package/dist/cli/help.d.ts.map +1 -0
  16. package/dist/cli/help.js +110 -0
  17. package/dist/cli/help.js.map +1 -0
  18. package/dist/cli/index.d.ts +4 -0
  19. package/dist/cli/index.d.ts.map +1 -0
  20. package/dist/cli/index.js +170 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/cli/inspect.d.ts +3 -0
  23. package/dist/cli/inspect.d.ts.map +1 -0
  24. package/dist/cli/inspect.js +170 -0
  25. package/dist/cli/inspect.js.map +1 -0
  26. package/dist/cli/ls.d.ts +2 -0
  27. package/dist/cli/ls.d.ts.map +1 -0
  28. package/dist/cli/ls.js +10 -0
  29. package/dist/cli/ls.js.map +1 -0
  30. package/dist/cli/render.d.ts +8 -0
  31. package/dist/cli/render.d.ts.map +1 -0
  32. package/dist/cli/render.js +55 -0
  33. package/dist/cli/render.js.map +1 -0
  34. package/dist/cli/resolve-harness.d.ts +4 -0
  35. package/dist/cli/resolve-harness.d.ts.map +1 -0
  36. package/dist/cli/resolve-harness.js +31 -0
  37. package/dist/cli/resolve-harness.js.map +1 -0
  38. package/dist/cli/run.d.ts +2 -0
  39. package/dist/cli/run.d.ts.map +1 -0
  40. package/dist/cli/run.js +280 -0
  41. package/dist/cli/run.js.map +1 -0
  42. package/dist/cli/session.d.ts +2 -0
  43. package/dist/cli/session.d.ts.map +1 -0
  44. package/dist/cli/session.js +128 -0
  45. package/dist/cli/session.js.map +1 -0
  46. package/dist/cli/version.d.ts +2 -0
  47. package/dist/cli/version.d.ts.map +1 -0
  48. package/dist/cli/version.js +34 -0
  49. package/dist/cli/version.js.map +1 -0
  50. package/dist/cli.js +2 -0
  51. package/dist/execution/decode.d.ts.map +1 -1
  52. package/dist/execution/decode.js +32 -0
  53. package/dist/execution/decode.js.map +1 -1
  54. package/dist/execution/deps.d.ts +7 -1
  55. package/dist/execution/deps.d.ts.map +1 -1
  56. package/dist/execution/events.d.ts +6 -2
  57. package/dist/execution/events.d.ts.map +1 -1
  58. package/dist/execution/events.js.map +1 -1
  59. package/dist/execution/failure.d.ts +45 -0
  60. package/dist/execution/failure.d.ts.map +1 -0
  61. package/dist/execution/failure.js +121 -0
  62. package/dist/execution/failure.js.map +1 -0
  63. package/dist/execution/node-deps.d.ts.map +1 -1
  64. package/dist/execution/node-deps.js +19 -0
  65. package/dist/execution/node-deps.js.map +1 -1
  66. package/dist/execution/stream-turn.d.ts +2 -0
  67. package/dist/execution/stream-turn.d.ts.map +1 -1
  68. package/dist/execution/stream-turn.js +181 -16
  69. package/dist/execution/stream-turn.js.map +1 -1
  70. package/dist/interpretation/argv.d.ts +16 -4
  71. package/dist/interpretation/argv.d.ts.map +1 -1
  72. package/dist/interpretation/argv.js +68 -19
  73. package/dist/interpretation/argv.js.map +1 -1
  74. package/dist/interpretation/dimensions.d.ts +0 -2
  75. package/dist/interpretation/dimensions.d.ts.map +1 -1
  76. package/dist/interpretation/dimensions.js +0 -2
  77. package/dist/interpretation/dimensions.js.map +1 -1
  78. package/dist/interpretation/limits.d.ts +10 -1
  79. package/dist/interpretation/limits.d.ts.map +1 -1
  80. package/dist/interpretation/limits.js +84 -5
  81. package/dist/interpretation/limits.js.map +1 -1
  82. package/dist/interpretation/refusal.d.ts +31 -0
  83. package/dist/interpretation/refusal.d.ts.map +1 -0
  84. package/dist/interpretation/refusal.js +87 -0
  85. package/dist/interpretation/refusal.js.map +1 -0
  86. package/dist/interpretation/turn-options.d.ts +18 -0
  87. package/dist/interpretation/turn-options.d.ts.map +1 -0
  88. package/dist/interpretation/turn-options.js +417 -0
  89. package/dist/interpretation/turn-options.js.map +1 -0
  90. package/dist/interpretation/vocabulary.d.ts +5 -0
  91. package/dist/interpretation/vocabulary.d.ts.map +1 -1
  92. package/dist/interpretation/vocabulary.js +1 -1
  93. package/dist/interpretation/vocabulary.js.map +1 -1
  94. package/dist/knowledge/claude-code.d.ts +13 -1
  95. package/dist/knowledge/claude-code.d.ts.map +1 -1
  96. package/dist/knowledge/claude-code.js +35 -13
  97. package/dist/knowledge/claude-code.js.map +1 -1
  98. package/dist/knowledge/codex.d.ts.map +1 -1
  99. package/dist/knowledge/codex.js +25 -14
  100. package/dist/knowledge/codex.js.map +1 -1
  101. package/dist/knowledge/descriptor.d.ts +118 -14
  102. package/dist/knowledge/descriptor.d.ts.map +1 -1
  103. package/dist/knowledge/descriptor.js +58 -0
  104. package/dist/knowledge/descriptor.js.map +1 -1
  105. package/dist/knowledge/matchers.d.ts +3 -3
  106. package/dist/knowledge/matchers.d.ts.map +1 -1
  107. package/dist/knowledge/matchers.js +19 -6
  108. package/dist/knowledge/matchers.js.map +1 -1
  109. package/dist/knowledge/muse.d.ts +2 -2
  110. package/dist/knowledge/muse.d.ts.map +1 -1
  111. package/dist/knowledge/muse.js +22 -6
  112. package/dist/knowledge/muse.js.map +1 -1
  113. package/dist/knowledge/overrides.d.ts +7 -0
  114. package/dist/knowledge/overrides.d.ts.map +1 -1
  115. package/dist/knowledge/overrides.js +76 -0
  116. package/dist/knowledge/overrides.js.map +1 -1
  117. package/dist/knowledge/pi.d.ts.map +1 -1
  118. package/dist/knowledge/pi.js +25 -3
  119. package/dist/knowledge/pi.js.map +1 -1
  120. package/package.json +5 -2
  121. package/src/cli/args.ts +381 -0
  122. package/src/cli/check.ts +136 -0
  123. package/src/cli/exit-codes.ts +13 -0
  124. package/src/cli/help.ts +114 -0
  125. package/src/cli/index.ts +177 -0
  126. package/src/cli/inspect.ts +174 -0
  127. package/src/cli/ls.ts +14 -0
  128. package/src/cli/render.ts +62 -0
  129. package/src/cli/resolve-harness.ts +33 -0
  130. package/src/cli/run.ts +280 -0
  131. package/src/cli/session.ts +137 -0
  132. package/src/cli/version.ts +32 -0
  133. package/src/execution/decode.ts +32 -0
  134. package/src/execution/deps.ts +7 -1
  135. package/src/execution/events.ts +9 -2
  136. package/src/execution/failure.ts +159 -0
  137. package/src/execution/node-deps.ts +17 -0
  138. package/src/execution/stream-turn.ts +189 -17
  139. package/src/interpretation/argv.ts +85 -27
  140. package/src/interpretation/dimensions.ts +0 -6
  141. package/src/interpretation/limits.ts +97 -6
  142. package/src/interpretation/refusal.ts +116 -0
  143. package/src/interpretation/turn-options.ts +424 -0
  144. package/src/interpretation/vocabulary.ts +1 -1
  145. package/src/knowledge/claude-code.ts +35 -13
  146. package/src/knowledge/codex.ts +25 -14
  147. package/src/knowledge/descriptor.ts +138 -12
  148. package/src/knowledge/matchers.ts +22 -9
  149. package/src/knowledge/muse.ts +22 -6
  150. package/src/knowledge/overrides.ts +97 -0
  151. package/src/knowledge/pi.ts +25 -3
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # harness-cli-normalizer
2
2
 
3
- One stable interface to four coding-agent CLIs that survives their updates.
3
+ One stable interface to four coding-agent CLIs.
4
4
 
5
5
  [![CI](https://github.com/dungle-scrubs/harness-cli-normalizer/actions/workflows/ci.yml/badge.svg)](https://github.com/dungle-scrubs/harness-cli-normalizer/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/@dungle-scrubs/harness-cli-normalizer.svg)](https://www.npmjs.com/package/@dungle-scrubs/harness-cli-normalizer) [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
 
7
- harness-cli-normalizer describes each of four coding-agent CLIs (Claude Code, Codex, pi, and Muse) as pure data and normalizes their headless output into a single `HarnessEvent` stream. You write one consumer against that surface instead of a bespoke spawn-and-parse path for each agent. A separate execution layer drives any of them as a child process and emits the events. Today most teams hold these agents together by hand, one parser per CLI, and redo the work whenever an agent ships a new version.
8
-
9
- You reach for this when you are building on top of more than one coding agent: an orchestrator, an observer, a benchmark rig, or a way to switch which agent does a job. Each descriptor is pinned to the CLI version its facts were verified against, and a weekly check flags when a harness has shipped ahead of its descriptor. You learn drift is possible from a check, not from a crash.
7
+ <!-- D-001 -->
8
+ harness-cli-normalizer describes Claude Code, Codex, pi, and Muse as pure data and normalizes their headless output to a single `HarnessEvent` stream. You build one consumer against that stream instead of a separate spawn-and-parse path per CLI - the execution layer spawns the harness and emits the events. Use it for multi-agent work like an orchestrator, observer, benchmark rig, or to swap agents. Descriptors are pinned to their verified CLI version and a weekly check flags when a harness has moved ahead.
10
9
 
11
10
  ```bash
12
11
  pnpm add @dungle-scrubs/harness-cli-normalizer
@@ -61,6 +60,72 @@ bun run demo --chat claude # interactive session (claude only)
61
60
 
62
61
  For a multi-turn session you drive yourself, `openSession` returns a handle whose `turns` you iterate and whose `send()` you call between turns. See `scripts/demo.ts` for the working pattern.
63
62
 
63
+ ## CLI
64
+
65
+ The package ships a `hcn` binary for shell and CI use. Install it with your package manager or run it ad-hoc with `npx`:
66
+
67
+ ```bash
68
+ pnpm add @dungle-scrubs/harness-cli-normalizer
69
+ npx hcn --help
70
+ npm install -g @dungle-scrubs/harness-cli-normalizer # global
71
+ ```
72
+
73
+ One-shot turn:
74
+
75
+ ```bash
76
+ hcn run claude "explain a monad in one sentence"
77
+ hcn run codex "what is 2+2" --model gpt-5.6-sol
78
+ hcn run pi "name three primes" --provider zai/glm-5.2
79
+ hcn run muse "say hi" --no-write
80
+ ```
81
+
82
+ Piped JSON for programmatic use:
83
+
84
+ ```bash
85
+ hcn run claude "say hi" --json | jq .
86
+ hcn run claude "hi" --json | head -n 5 # abandonment-safe, no hanging handles
87
+ ```
88
+
89
+ Session (Claude-only):
90
+
91
+ ```bash
92
+ hcn session claude
93
+ hcn session claude --model opus --session-id 550e8400-e29b-41d4-a716-446655440000
94
+ ```
95
+
96
+ Inspection and drift (no spawn):
97
+
98
+ ```bash
99
+ hcn ls
100
+ hcn inspect claude
101
+ hcn inspect claude --argv --prompt "hi" --effort high
102
+ hcn check
103
+ hcn check --json
104
+ ```
105
+
106
+ Flag table (maps to `TurnOptions` / `TurnRunOptions`):
107
+
108
+ | CLI flag | TurnOptions field | Notes |
109
+ |---|---|---|
110
+ | `--prompt <text>` | `prompt` | Alternative to positional; mutual exclusion |
111
+ | `--prompt-file <path\|->` | `prompt` | Reads UTF-8 file or stdin (`-`) |
112
+ | `--model <id>` | `model` | Validated via `validateModel` |
113
+ | `--effort <value>` | `effort` | Validated via `validateEffort` |
114
+ | `--sandbox <value>` | `sandbox` | Codex only |
115
+ | `--provider <value>` | `provider` | pi only |
116
+ | `--tools <a,b>` | `tools` | Claude only, comma-separated |
117
+ | `--autonomy` / `--no-autonomy` | `autonomy` | |
118
+ | `--write` / `--no-write` | `write` | Muse |
119
+ | `--shell` / `--no-shell` | `shell` | Muse |
120
+ | `--max-steps <n>` | `maxSteps` | Muse, 1-10000 |
121
+ | `--no-tools, --no-instruction-files, --no-extensions, --no-skills` | `discovery` | |
122
+ | `--cwd <path>` | `cwd` | Working directory |
123
+ | `--env KEY=VAL` | `env` | Repeatable; `KEY=` deletes |
124
+ | `--resume <uuid>` | `resume` | Resume session |
125
+ | `--json` | output mode | NDJSON `HarnessEvent` to stdout |
126
+
127
+ For development, `bun run demo claude "hi"` remains as a live-rendering alternative.
128
+
64
129
  ## Concepts
65
130
 
66
131
  ### Descriptors are data, not behavior
@@ -79,12 +144,84 @@ knowledge (pure data) -> interpretation (pure functions) -> execution (child pro
79
144
 
80
145
  Every descriptor carries a `verifiedAgainst` version, the anchor for all of its facts. A weekly CI job compares each harness's published version to its descriptor and opens a tracking issue when one has moved ahead. Trust a descriptor only at its pinned version, and bump `verifiedAgainst` only after re-running the capability checks locally.
81
146
 
147
+ ## Turn options
148
+
149
+ Every `streamTurn` call can now shape the turn per-call without touching the descriptor:
150
+
151
+ ```ts
152
+ await streamTurn(claudeCode, {
153
+ prompt: "explain a monad",
154
+ effort: "high", // --effort (claude), -c model_reasoning_effort (codex), --thinking (pi), --reasoning-effort (muse)
155
+ provider: "zai/glm-5.2", // --provider (pi only)
156
+ discovery: { tools: false, instructionFiles: false, extensions: false, skills: false }, // -nt/-nc/-ne/-ns (pi) or --setting-sources project (claude)
157
+ write: false, // --disable-write (muse)
158
+ shell: false, // --disable-shell (muse)
159
+ maxSteps: 50, // --max-model-steps (muse)
160
+ sandbox: "read-only", // --sandbox (codex, launch only)
161
+ }, deps);
162
+ ```
163
+
164
+ Support matrix (anything not marked refuses with a typed `ArgvRefusalError` naming what the harness does support):
165
+
166
+ | Option | claude | codex | pi | muse |
167
+ | --- | --- | --- | --- | --- |
168
+ | `effort` | `--effort` | `-c model_reasoning_effort=` | `--thinking` | `--reasoning-effort` |
169
+ | `sandbox` | - | `--sandbox` (launch only) | - | - |
170
+ | `provider` | - | - | `--provider` | - |
171
+ | `discovery.tools` | - | - | `-nt` | - |
172
+ | `discovery.instructionFiles` | - | - | `-nc` | - |
173
+ | `discovery.extensions` | `--setting-sources project` | - | `-ne` | - |
174
+ | `discovery.skills` | `--setting-sources project` | - | `-ns` | - |
175
+ | `write` | - | - | - | `--disable-write` |
176
+ | `shell` | - | - | - | `--disable-shell` |
177
+ | `maxSteps` | - | - | - | `--max-model-steps` |
178
+ | `tools` | `--allowedTools` | - | - | - |
179
+
180
+ Per-call `env` is merged over the parent environment (`""` deletes) and never appears in logs:
181
+
182
+ ```ts
183
+ streamTurn(harness, { prompt, env: { FOO: "bar", OLD: "" } }, deps);
184
+ ```
185
+
186
+ ## Failure taxonomy
187
+
188
+ Every failure - provider, work, transport, or refusal - arrives as a typed `failure` event and reduces to one self-sufficient summary on `done`:
189
+
190
+ ```ts
191
+ type FailureClass = "rate-limit" | "usage-limit" | "quota" | "auth" | "budget" | "task" | "transport" | "rejected";
192
+ interface FailureSummary { class: FailureClass; retryable: boolean; message: string; code?: LimitCode; authKind?: AuthFailureKind; resetsAt?: number; issue?: RefusalIssue; option?: TurnOptionKey; facet?: DiscoveryFacet; supported?: readonly string[]; }
193
+ type HarnessEvent = ... | ({ kind: "failure" } & FailureSummary) | { kind: "done"; exitCode: number | null; cause: ExitCause; failure?: FailureSummary };
194
+ type ExitCause = "clean" | "limit" | "crash" | "stall" | "killed" | "failed";
195
+ ```
196
+
197
+ The canonical consumer check, identical for a deterministic router and an agent:
198
+
199
+ ```ts
200
+ if (done.failure) {
201
+ if (done.failure.retryable) descendFallbackChain(done.failure);
202
+ else pivot(done.failure); // rejected -> change options; budget -> raise cap; task -> surface
203
+ }
204
+ ```
205
+
206
+ `retryable` is `false` for `task`, `budget`, `rejected` and `true` for the rest. `rejected` is non-retryable across the whole model chain because the remedy is different options or a different harness.
207
+
208
+ ## Refusals
209
+
210
+ An unexpressible option throws `ArgvRefusalError` from the builders and is also delivered as `failure class=rejected` + `done cause=failed` from `streamTurn` (which never throws out of its first `next()`):
211
+
212
+ ```ts
213
+ class ArgvRefusalError extends Error { issue: RefusalIssue; harness: HarnessName; option?: TurnOptionKey; facet?: DiscoveryFacet; supported: readonly string[]; }
214
+ type RefusalIssue = "unsupported-option" | "unsupported-option-facet" | "unsupported-on-resume" | "invalid-option-value" | "unknown-effort" | "unknown-model" | "invalid-env" | "invalid-tool-grant" | "prompt-flag-injection" | "no-autonomy-mode" | "no-session-mode";
215
+ ```
216
+
217
+ Every refusal names an alternative in `supported` and `message`, not only a negation.
218
+
82
219
  ## Reference
83
220
 
84
221
  - Descriptors live in `src/knowledge/` (`claude-code.ts`, `codex.ts`, `pi.ts`, `muse.ts`), with shared types in `descriptor.ts`.
85
- - The normalized event surface is `HarnessEvent` in `src/execution/events.ts`: `identity`, `token`, `message`, `progress`, `tool`, `context`, `limit`, `error`, `done`.
86
- - Narrow or override a descriptor's facts with `parseOverrides` (`src/knowledge/overrides.ts`). An override a harness cannot satisfy throws `OverrideRefusalError` instead of producing a broken argv.
87
- - `DROPPABLE_KINDS` (`token`, `progress`, `context`) marks events safe to drop when you only need the full messages.
222
+ - The normalized event surface is `HarnessEvent` in `src/execution/events.ts`: `identity`, `token`, `message`, `progress`, `tool`, `context`, `limit`, `error`, `failure`, `done` (with `done.failure`).
223
+ - Narrow or override a descriptor's facts with `parseOverrides` (`src/knowledge/overrides.ts`). An override a harness cannot satisfy throws `OverrideRefusalError` instead of producing a broken argv. `limitMatchers`/`authMatchers` are now serializable `{pattern, flags, code/kind}` objects so they can be overridden from JSON; bad patterns are refused at load with file and harness named.
224
+ - `DROPPABLE_KINDS` (`token`, `progress`, `context`) marks events safe to drop when you only need the full messages. `failure` is never droppable.
88
225
 
89
226
  ## Contributing
90
227
 
@@ -0,0 +1,74 @@
1
+ import { parseArgs } from "node:util";
2
+ import type { TurnOptions } from "../interpretation/argv.js";
3
+ export type ParsedPromptSource = {
4
+ kind: "positional";
5
+ prompt: string;
6
+ } | {
7
+ kind: "prompt-flag";
8
+ prompt: string;
9
+ } | {
10
+ kind: "prompt-file";
11
+ prompt: string;
12
+ } | {
13
+ kind: "none";
14
+ };
15
+ export interface CliTurnOptions extends TurnOptions {
16
+ }
17
+ export interface CliRunOptions extends CliTurnOptions {
18
+ readonly cwd?: string;
19
+ readonly env?: Record<string, string>;
20
+ readonly resume?: string;
21
+ readonly json?: boolean;
22
+ }
23
+ export interface ParseCommonResult {
24
+ prompt: string | undefined;
25
+ promptSource: ParsedPromptSource["kind"];
26
+ turnOptions: TurnOptions;
27
+ runOptions: {
28
+ cwd?: string;
29
+ env?: Record<string, string>;
30
+ resume?: string;
31
+ };
32
+ }
33
+ /**
34
+ * Parse --env KEY=VAL entries into env record. "" value means delete.
35
+ */
36
+ export declare const parseEnvEntries: (entries: string[] | string | undefined) => Record<string, string> | undefined;
37
+ export declare const resolvePrompt: (args: {
38
+ positionalPrompt?: string;
39
+ promptFlag?: string;
40
+ promptFile?: string;
41
+ }) => {
42
+ prompt: string;
43
+ source: ParsedPromptSource["kind"];
44
+ };
45
+ export declare const resolvePromptAsync: (args: {
46
+ positionalPrompt?: string;
47
+ promptFlag?: string;
48
+ promptFile?: string;
49
+ }) => Promise<{
50
+ prompt: string;
51
+ source: ParsedPromptSource["kind"];
52
+ }>;
53
+ /**
54
+ * Build TurnOptions from parsed flag values. Shared between run and inspect --argv.
55
+ */
56
+ export declare const parseTurnOptions: (values: Record<string, unknown>) => TurnOptions;
57
+ export declare const parseRunExtra: (values: Record<string, unknown>) => {
58
+ cwd?: string;
59
+ env?: Record<string, string>;
60
+ resume?: string;
61
+ };
62
+ export interface CommonParseConfig {
63
+ allowPrompt: boolean;
64
+ allowPromptFile: boolean;
65
+ }
66
+ export declare const detectPositionalPromptInjection: (argv: string[]) => string | null;
67
+ /**
68
+ * Wrapper around node:util parseArgs for the common flag table.
69
+ * Throws with exit code 2 on unknown flag.
70
+ */
71
+ export declare const parseCommonFlags: (argv: string[], opts?: {
72
+ strict?: boolean;
73
+ }) => ReturnType<typeof parseArgs>;
74
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAoB,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG/E,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAA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AG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;CAAE,CAiCjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,WAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,WAyDlE,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAW/D,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAgDD,eAAO,MAAM,+BAA+B,SAAU,MAAM,EAAE,KAAG,MAAM,GAAG,IAmCzE,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SACrB,MAAM,EAAE,SACR;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,KACzB,UAAU,CAAC,OAAO,SAAS,CAoC7B,CAAC"}
@@ -0,0 +1,339 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { parseArgs } from "node:util";
3
+ import { ArgvRefusalError } from "../interpretation/refusal.js";
4
+ const _DISCOVERY_FLAGS = {
5
+ tools: "no-tools",
6
+ instructionFiles: "no-instruction-files",
7
+ extensions: "no-extensions",
8
+ skills: "no-skills",
9
+ };
10
+ /**
11
+ * Parse --env KEY=VAL entries into env record. "" value means delete.
12
+ */
13
+ export const parseEnvEntries = (entries) => {
14
+ if (entries === undefined)
15
+ return undefined;
16
+ const list = Array.isArray(entries) ? entries : [entries];
17
+ if (list.length === 0)
18
+ return undefined;
19
+ const env = {};
20
+ for (const entry of list) {
21
+ const eq = entry.indexOf("=");
22
+ if (eq === -1) {
23
+ throw new ArgvRefusalError({
24
+ issue: "invalid-env",
25
+ harness: "claude",
26
+ supported: ["KEY=VAL"],
27
+ detail: entry,
28
+ });
29
+ }
30
+ const key = entry.slice(0, eq);
31
+ const value = entry.slice(eq + 1);
32
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || value.includes("\0") || key.includes("\0")) {
33
+ throw new ArgvRefusalError({
34
+ issue: "invalid-env",
35
+ harness: "claude",
36
+ supported: ["keys must match ^[A-Za-z_][A-Za-z0-9_]*$ and contain no NUL"],
37
+ detail: entry,
38
+ });
39
+ }
40
+ env[key] = value;
41
+ }
42
+ return env;
43
+ };
44
+ export const resolvePrompt = (args) => {
45
+ const hasPositional = args.positionalPrompt !== undefined && args.positionalPrompt !== "";
46
+ const hasPrompt = args.promptFlag !== undefined;
47
+ const hasFile = args.promptFile !== undefined;
48
+ const count = Number(hasPositional) + Number(hasPrompt) + Number(hasFile);
49
+ if (count === 0) {
50
+ throw new ArgvRefusalError({
51
+ issue: "invalid-option-value",
52
+ harness: "claude",
53
+ supported: ["provide prompt via positional, --prompt, or --prompt-file"],
54
+ detail: "missing prompt",
55
+ });
56
+ }
57
+ if (count > 1) {
58
+ throw new ArgvRefusalError({
59
+ issue: "invalid-option-value",
60
+ harness: "claude",
61
+ supported: ["use one of positional, --prompt, or --prompt-file"],
62
+ detail: "mutual exclusion",
63
+ });
64
+ }
65
+ if (hasPositional)
66
+ return { prompt: args.positionalPrompt, source: "positional" };
67
+ if (hasPrompt)
68
+ return { prompt: args.promptFlag, source: "prompt-flag" };
69
+ // --prompt-file
70
+ const file = args.promptFile;
71
+ if (file === "-") {
72
+ // read from stdin sync - caller may provide content differently for async path.
73
+ // For sync path, read stdin fd 0.
74
+ const content = readFileSync(0, "utf8");
75
+ return { prompt: content, source: "prompt-file" };
76
+ }
77
+ const content = readFileSync(file, "utf8");
78
+ return { prompt: content, source: "prompt-file" };
79
+ };
80
+ export const resolvePromptAsync = async (args) => {
81
+ const hasPositional = args.positionalPrompt !== undefined && args.positionalPrompt !== "";
82
+ const hasPrompt = args.promptFlag !== undefined;
83
+ const hasFile = args.promptFile !== undefined;
84
+ const count = Number(hasPositional) + Number(hasPrompt) + Number(hasFile);
85
+ if (count === 0) {
86
+ throw new ArgvRefusalError({
87
+ issue: "invalid-option-value",
88
+ harness: "claude",
89
+ supported: ["provide prompt via positional, --prompt, or --prompt-file"],
90
+ detail: "missing prompt",
91
+ });
92
+ }
93
+ if (count > 1) {
94
+ throw new ArgvRefusalError({
95
+ issue: "invalid-option-value",
96
+ harness: "claude",
97
+ supported: ["use one of positional, --prompt, or --prompt-file"],
98
+ detail: "mutual exclusion",
99
+ });
100
+ }
101
+ if (hasPositional)
102
+ return { prompt: args.positionalPrompt, source: "positional" };
103
+ if (hasPrompt)
104
+ return { prompt: args.promptFlag, source: "prompt-flag" };
105
+ const file = args.promptFile;
106
+ if (file === "-") {
107
+ const chunks = [];
108
+ for await (const chunk of process.stdin)
109
+ chunks.push(chunk);
110
+ return { prompt: Buffer.concat(chunks).toString("utf8"), source: "prompt-file" };
111
+ }
112
+ const { readFile } = await import("node:fs/promises");
113
+ const content = await readFile(file, "utf8");
114
+ return { prompt: content, source: "prompt-file" };
115
+ };
116
+ /**
117
+ * Build TurnOptions from parsed flag values. Shared between run and inspect --argv.
118
+ */
119
+ export const parseTurnOptions = (values) => {
120
+ const opts = {};
121
+ if (values.model !== undefined)
122
+ opts.model = values.model;
123
+ if (values.effort !== undefined)
124
+ opts.effort = values.effort;
125
+ if (values.sandbox !== undefined)
126
+ opts.sandbox = values.sandbox;
127
+ if (values.provider !== undefined)
128
+ opts.provider = values.provider;
129
+ if (values.tools !== undefined) {
130
+ const raw = String(values.tools);
131
+ opts.tools = raw.length === 0 ? [] : raw.split(",").map((s) => s.trim());
132
+ }
133
+ if (values.autonomy === true)
134
+ opts.autonomy = true;
135
+ else if (values["no-autonomy"] === true)
136
+ opts.autonomy = false;
137
+ else if (values.autonomy === false)
138
+ opts.autonomy = false; // for completeness
139
+ if (values.write === true)
140
+ opts.write = true;
141
+ else if (values["no-write"] === true)
142
+ opts.write = false;
143
+ if (values.shell === true)
144
+ opts.shell = true;
145
+ else if (values["no-shell"] === true)
146
+ opts.shell = false;
147
+ if (values["max-steps"] !== undefined) {
148
+ const n = Number(values["max-steps"]);
149
+ if (!Number.isFinite(n)) {
150
+ throw new ArgvRefusalError({
151
+ issue: "invalid-option-value",
152
+ harness: "claude",
153
+ option: "maxSteps",
154
+ supported: ["integer 1-10000"],
155
+ detail: String(values["max-steps"]),
156
+ });
157
+ }
158
+ opts.maxSteps = n;
159
+ }
160
+ // discovery facets: --no-* means false, otherwise undefined (no-op)
161
+ const discovery = {};
162
+ let hasDiscovery = false;
163
+ if (values["no-tools"] === true) {
164
+ discovery.tools = false;
165
+ hasDiscovery = true;
166
+ }
167
+ if (values["no-instruction-files"] === true) {
168
+ discovery.instructionFiles = false;
169
+ hasDiscovery = true;
170
+ }
171
+ if (values["no-extensions"] === true) {
172
+ discovery.extensions = false;
173
+ hasDiscovery = true;
174
+ }
175
+ if (values["no-skills"] === true) {
176
+ discovery.skills = false;
177
+ hasDiscovery = true;
178
+ }
179
+ if (hasDiscovery)
180
+ opts.discovery = discovery;
181
+ // prompt will be set by caller after resolvePrompt
182
+ return opts;
183
+ };
184
+ export const parseRunExtra = (values) => {
185
+ const extra = {};
186
+ if (values.cwd !== undefined)
187
+ extra.cwd = String(values.cwd);
188
+ if (values.resume !== undefined)
189
+ extra.resume = String(values.resume);
190
+ if (values["session-id"] !== undefined)
191
+ extra.resume = String(values["session-id"]);
192
+ if (values.env !== undefined) {
193
+ // parseArgs with multiple:true gives string[] ; else string
194
+ const list = values.env;
195
+ extra.env = parseEnvEntries(list);
196
+ }
197
+ return extra;
198
+ };
199
+ const KNOWN_FLAGS = new Set([
200
+ "--prompt",
201
+ "--prompt-file",
202
+ "--model",
203
+ "--effort",
204
+ "--sandbox",
205
+ "--provider",
206
+ "--tools",
207
+ "--autonomy",
208
+ "--no-autonomy",
209
+ "--write",
210
+ "--no-write",
211
+ "--shell",
212
+ "--no-shell",
213
+ "--max-steps",
214
+ "--no-tools",
215
+ "--no-instruction-files",
216
+ "--no-extensions",
217
+ "--no-skills",
218
+ "--cwd",
219
+ "--env",
220
+ "--resume",
221
+ "--session-id",
222
+ "--json",
223
+ "--argv",
224
+ "--help",
225
+ "-h",
226
+ "--version",
227
+ "-V",
228
+ ]);
229
+ const FLAGS_WITH_VALUE = new Set([
230
+ "--prompt",
231
+ "--prompt-file",
232
+ "--model",
233
+ "--effort",
234
+ "--sandbox",
235
+ "--provider",
236
+ "--tools",
237
+ "--max-steps",
238
+ "--cwd",
239
+ "--env",
240
+ "--resume",
241
+ "--session-id",
242
+ ]);
243
+ export const detectPositionalPromptInjection = (argv) => {
244
+ const hasExplicitPrompt = argv.some((a) => a === "--prompt" ||
245
+ a.startsWith("--prompt=") ||
246
+ a === "--prompt-file" ||
247
+ a.startsWith("--prompt-file="));
248
+ if (hasExplicitPrompt)
249
+ return null;
250
+ let expectValue = false;
251
+ for (const token of argv) {
252
+ if (expectValue) {
253
+ expectValue = false;
254
+ continue;
255
+ }
256
+ if (FLAGS_WITH_VALUE.has(token)) {
257
+ expectValue = true;
258
+ continue;
259
+ }
260
+ if (token.startsWith("--") && token.includes("=")) {
261
+ continue;
262
+ }
263
+ if (KNOWN_FLAGS.has(token)) {
264
+ continue;
265
+ }
266
+ if (token === "--") {
267
+ continue;
268
+ }
269
+ // Only single-dash tokens are considered prompt injection candidates
270
+ // Double-dash unknown flags (e.g. --unknown) are handled as unknown flag errors by parseArgs
271
+ if (token.startsWith("-") && !token.startsWith("--")) {
272
+ return token;
273
+ }
274
+ }
275
+ return null;
276
+ };
277
+ const preprocessPromptArgs = (argv) => {
278
+ const out = [];
279
+ for (let i = 0; i < argv.length; i++) {
280
+ const token = argv[i];
281
+ if (token === "--prompt" && i + 1 < argv.length) {
282
+ const next = argv[i + 1];
283
+ // If next starts with '-' and isn't '--', convert to --prompt=-value form so parseArgs accepts it
284
+ if (next.startsWith("-") && next !== "--" && !next.startsWith("--prompt")) {
285
+ out.push(`--prompt=${next}`);
286
+ i++;
287
+ continue;
288
+ }
289
+ }
290
+ if (token.startsWith("--prompt=")) {
291
+ out.push(token);
292
+ continue;
293
+ }
294
+ out.push(token);
295
+ }
296
+ return out;
297
+ };
298
+ /**
299
+ * Wrapper around node:util parseArgs for the common flag table.
300
+ * Throws with exit code 2 on unknown flag.
301
+ */
302
+ export const parseCommonFlags = (argv, opts = {}) => {
303
+ const normalized = preprocessPromptArgs(argv);
304
+ const config = {
305
+ allowPositionals: true,
306
+ strict: opts.strict ?? true,
307
+ options: {
308
+ prompt: { type: "string" },
309
+ "prompt-file": { type: "string" },
310
+ model: { type: "string" },
311
+ effort: { type: "string" },
312
+ sandbox: { type: "string" },
313
+ provider: { type: "string" },
314
+ tools: { type: "string" },
315
+ autonomy: { type: "boolean" },
316
+ "no-autonomy": { type: "boolean" },
317
+ write: { type: "boolean" },
318
+ "no-write": { type: "boolean" },
319
+ shell: { type: "boolean" },
320
+ "no-shell": { type: "boolean" },
321
+ "max-steps": { type: "string" },
322
+ "no-tools": { type: "boolean" },
323
+ "no-instruction-files": { type: "boolean" },
324
+ "no-extensions": { type: "boolean" },
325
+ "no-skills": { type: "boolean" },
326
+ cwd: { type: "string" },
327
+ env: { type: "string", multiple: true },
328
+ resume: { type: "string" },
329
+ "session-id": { type: "string" },
330
+ json: { type: "boolean" },
331
+ argv: { type: "boolean" },
332
+ help: { type: "boolean" },
333
+ version: { type: "boolean" },
334
+ },
335
+ };
336
+ // parseArgs throws on unknown flag when strict true - we let it bubble and caller maps to exit 2
337
+ return parseArgs({ ...config, args: normalized });
338
+ };
339
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,E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;SACtC;KACO,CAAC;IACX,iGAAiG;IACjG,OAAO,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const check: (rawArgs: string[]) => Promise<void>;
2
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/cli/check.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,KAAK,YAAmB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAoF3D,CAAC"}