coolhand-cli 0.5.2 → 0.7.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 (91) hide show
  1. package/README.md +27 -121
  2. package/dist/api/last-sync.d.ts +5 -0
  3. package/dist/api/last-sync.d.ts.map +1 -1
  4. package/dist/api/last-sync.js +5 -0
  5. package/dist/api/last-sync.js.map +1 -1
  6. package/dist/auth/callback-server.js +3 -3
  7. package/dist/auth/callback-server.js.map +1 -1
  8. package/dist/cli.d.ts +10 -0
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +320 -37
  11. package/dist/cli.js.map +1 -1
  12. package/dist/commands/analyze-claude-sessions.d.ts.map +1 -1
  13. package/dist/commands/analyze-claude-sessions.js +37 -6
  14. package/dist/commands/analyze-claude-sessions.js.map +1 -1
  15. package/dist/commands/claude.d.ts +10 -10
  16. package/dist/commands/claude.d.ts.map +1 -1
  17. package/dist/commands/claude.js +6 -77
  18. package/dist/commands/claude.js.map +1 -1
  19. package/dist/commands/clients.js +1 -1
  20. package/dist/commands/clients.js.map +1 -1
  21. package/dist/commands/flush-pending.d.ts +25 -0
  22. package/dist/commands/flush-pending.d.ts.map +1 -0
  23. package/dist/commands/flush-pending.js +100 -0
  24. package/dist/commands/flush-pending.js.map +1 -0
  25. package/dist/commands/get-workload.d.ts +3 -0
  26. package/dist/commands/get-workload.d.ts.map +1 -0
  27. package/dist/commands/get-workload.js +28 -0
  28. package/dist/commands/get-workload.js.map +1 -0
  29. package/dist/commands/list-workloads.d.ts +3 -0
  30. package/dist/commands/list-workloads.d.ts.map +1 -0
  31. package/dist/commands/list-workloads.js +52 -0
  32. package/dist/commands/list-workloads.js.map +1 -0
  33. package/dist/commands/login.d.ts.map +1 -1
  34. package/dist/commands/login.js +41 -6
  35. package/dist/commands/login.js.map +1 -1
  36. package/dist/commands/mcp-call.d.ts.map +1 -1
  37. package/dist/commands/mcp-call.js +57 -10
  38. package/dist/commands/mcp-call.js.map +1 -1
  39. package/dist/commands/monitor.d.ts +9 -0
  40. package/dist/commands/monitor.d.ts.map +1 -0
  41. package/dist/commands/monitor.js +10 -0
  42. package/dist/commands/monitor.js.map +1 -0
  43. package/dist/commands/status.js +2 -2
  44. package/dist/commands/status.js.map +1 -1
  45. package/dist/commands/update-workload.d.ts +3 -0
  46. package/dist/commands/update-workload.d.ts.map +1 -0
  47. package/dist/commands/update-workload.js +35 -0
  48. package/dist/commands/update-workload.js.map +1 -0
  49. package/dist/commands/whoami.js +1 -1
  50. package/dist/commands/whoami.js.map +1 -1
  51. package/dist/commands/wildcard.d.ts.map +1 -1
  52. package/dist/commands/wildcard.js +118 -20
  53. package/dist/commands/wildcard.js.map +1 -1
  54. package/dist/config.d.ts +16 -0
  55. package/dist/config.d.ts.map +1 -1
  56. package/dist/config.js +127 -6
  57. package/dist/config.js.map +1 -1
  58. package/dist/pending-store.d.ts +31 -0
  59. package/dist/pending-store.d.ts.map +1 -0
  60. package/dist/pending-store.js +81 -0
  61. package/dist/pending-store.js.map +1 -0
  62. package/dist/prompt.d.ts +13 -0
  63. package/dist/prompt.d.ts.map +1 -0
  64. package/dist/prompt.js +30 -0
  65. package/dist/prompt.js.map +1 -0
  66. package/dist/proxy/certs.d.ts +14 -0
  67. package/dist/proxy/certs.d.ts.map +1 -0
  68. package/dist/proxy/certs.js +64 -0
  69. package/dist/proxy/certs.js.map +1 -0
  70. package/dist/proxy/interceptor.d.ts +16 -0
  71. package/dist/proxy/interceptor.d.ts.map +1 -0
  72. package/dist/proxy/interceptor.js +57 -0
  73. package/dist/proxy/interceptor.js.map +1 -0
  74. package/dist/proxy/proxy.d.ts +20 -0
  75. package/dist/proxy/proxy.d.ts.map +1 -0
  76. package/dist/proxy/proxy.js +114 -0
  77. package/dist/proxy/proxy.js.map +1 -0
  78. package/dist/proxy/sender.d.ts +32 -0
  79. package/dist/proxy/sender.d.ts.map +1 -0
  80. package/dist/proxy/sender.js +66 -0
  81. package/dist/proxy/sender.js.map +1 -0
  82. package/dist/proxy/wrap-runner.d.ts +36 -0
  83. package/dist/proxy/wrap-runner.d.ts.map +1 -0
  84. package/dist/proxy/wrap-runner.js +153 -0
  85. package/dist/proxy/wrap-runner.js.map +1 -0
  86. package/dist/types.d.ts +29 -2
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/types.js.map +1 -1
  89. package/dist/version.d.ts +2 -2
  90. package/dist/version.js +1 -1
  91. package/package.json +2 -2
package/README.md CHANGED
@@ -25,15 +25,15 @@ Requires Node 20 or newer.
25
25
  coolhand analyze-claude-sessions [--dry-run] [--client-id ID] [--json]
26
26
  ```
27
27
 
28
- Submit your historical Claude sessions to Coolhand for analysis. Coolhand scans the uploaded sessions to surface:
28
+ Upload your historical Claude Code session transcripts to your Coolhand account for analysis. Coolhand analyzes the uploaded conversations to surface:
29
29
 
30
30
  - **Repeatable patterns** — tasks you do by hand on repeat that could be scripted or automated
31
31
  - **Efficiency gaps** — workflows with unnecessary back-and-forth or redundant steps
32
32
  - **Cost insights** — sessions with high token usage relative to their outcome
33
33
 
34
- Use `--dry-run` to preview what would be sent without submitting anything.
34
+ > **What gets uploaded**: The conversation transcripts stored in `~/.claude/projects/` — the messages exchanged between you and Claude, including any code or context you shared in those conversations. Use `--dry-run` to preview exactly what would be sent before submitting anything.
35
35
 
36
- See [Session capture](./docs/session-capture.md) for scan logic, duplicate-avoidance details, and the full flag reference.
36
+ See [Session capture](./docs/session-capture.md) for capture logic, duplicate-avoidance details, and the full flag reference.
37
37
 
38
38
  ## Wildcard (agent complaint box)
39
39
 
@@ -46,7 +46,7 @@ coolhand wildcard \
46
46
  --thinking "I attempted to connect to localhost:5432 but got connection refused. I checked for a running postgres process and found none. Without a live database I cannot apply or validate the migration."
47
47
  ```
48
48
 
49
- The command records the complaint as feedback tagged `creator_type: agent`, prints a terminal de-loop message, and exits `0` so the agent stops and moves on. The de-loop always fires — even if the feedback could not be recorded (not logged in or a server error) — because the missing capability is real regardless of whether the server was reachable, and a logged-out agent in a sandbox is exactly who this command is for. When recording fails the message says so plainly and a warning is logged, so the failure still surfaces without trapping the agent in the retry loop the command exists to break.
49
+ The command records the complaint as feedback tagged `creator_type: agent`, prints a terminal de-loop message, and exits `0` so the agent stops and moves on. The de-loop always fires — even if the feedback could not be recorded (not logged in or a server error) — because the missing capability is real regardless of whether the server was reachable, and a logged-out agent in a sandbox is exactly who this command is for. When recording fails the message says so plainly and a warning is logged, so the failure still surfaces without trapping the agent in the retry loop the command exists to break. When no API key is available, the feedback is saved locally to `~/.coolhand/pending/` and will be uploaded automatically the next time you run `coolhand login`.
50
50
 
51
51
  Set `COOLHAND_AGENT_NAME` to avoid passing `--agent-name` on every call. Optional `--thinking` attaches the reasoning that led to the blocker; `--log-id` ties it to a specific LLM request log.
52
52
 
@@ -54,122 +54,26 @@ See [Your AI agent has notes](https://michael.carroll.io/talks/2026/your-ai-agen
54
54
 
55
55
  ## Commands
56
56
 
57
- ```
58
- coolhand login [--base-url URL] [--scope private] [--write-env PATH] [--client-id ID] [--json]
59
- coolhand logout [--client-id ID | --all] [--json]
60
- coolhand status [--client-id ID] [--json]
61
- coolhand whoami [--client-id ID]
62
- coolhand clients [use <id>] [--json]
63
- coolhand claude [claude args...]
64
-
65
- coolhand search-optimizations [--status V] [--type V] [--category V] [--query V]
66
- [--from DATE] [--to DATE] [--days-back N]
67
- [--template-id ID] [--workload-id ID]
68
- [--sort-by impact_desc|complexity_asc|created_at_desc]
69
- [--page N] [--per-page N] [--client-id ID] [--json]
70
- coolhand get-optimization <id> [--client-id ID] [--json]
71
- coolhand update-optimization <id> [--title V] [--analysis V] [--plan V] [--client-id ID] [--json]
72
- coolhand close-optimization <id> <reason> [--client-id ID] [--json]
73
-
74
- coolhand analyze-claude-sessions [--dry-run] [--client-id ID] [--json]
75
-
76
- coolhand wildcard --complaint "..." --agent-name "..." [--thinking "..."] [--log-id ID] [--json]
77
- coolhand report-blocker (alias for wildcard)
78
- coolhand complaint-box (alias for wildcard)
79
- ```
80
-
81
- ### login
82
-
83
- Opens your browser to the Coolhand consent page, listens on `127.0.0.1` for the callback, and stores the returned token. The token is the **public** `api_key` for the client you select — the same key you would use with `coolhand-node`, `coolhand-python`, or the `coolhand-js` widget.
84
-
85
- `--scope private` authenticates against a private workspace instead of the default shared workspace.
86
-
87
- `--write-env PATH` will additionally set `COOLHAND_API_KEY=<token>` in the target `.env` file (idempotent — replaces an existing value rather than appending a duplicate).
88
-
89
- ### status
90
-
91
- `coolhand status --json` is the programmatic check used by integrations:
92
-
93
- ```json
94
- {
95
- "configured": true,
96
- "clients": [
97
- {"client_id": "acme", "client_name": "Acme Inc",
98
- "masked_token": "e885b463…1148", "base_url": "https://coolhandlabs.com"}
99
- ],
100
- "default_client_id": "acme"
101
- }
102
- ```
103
-
104
- Exit code is `0` if a token is configured for the default (or requested) client, `1` otherwise.
105
-
106
- ### clients
107
-
108
- Multiple clients can be stored at once. `coolhand clients` lists them, `coolhand clients use <id>` switches the default. Each `coolhand login` adds (or refreshes) one entry, keyed by the server-assigned `client_id`.
109
-
110
- ### run
111
-
112
- Coolhand can wrap any LLM-backed process to capture its sessions, then evaluate them to find where prompts, context, or workflows can be made more efficient.
113
-
114
- Use `coolhand claude` to wrap a single Claude session and capture it for later evaluation — a coding session, a skill walkthrough, a debugging run:
115
-
116
- ```bash
117
- coolhand claude # starts Claude with capture on
118
- coolhand claude --resume # any args after `claude` go straight to the Claude CLI
119
- ```
120
-
121
- Captured sessions flow into your Coolhand account, where they can be analyzed for optimization opportunities — reduced token usage, tighter prompts, better context management.
122
-
123
- ## Optimization commands
124
-
125
- Coolhand stores LLM-generated optimization suggestions as structured records. These commands let you query, update, and comment on them from the terminal or from agent workflows.
126
-
127
- ### search-optimizations
128
-
129
- Lists optimizations with optional filtering and pagination.
130
-
131
- | Flag | Description |
132
- |------|-------------|
133
- | `--status V` | Filter by status (e.g. `open`, `closed`) |
134
- | `--type V` | Filter by optimization type |
135
- | `--category V` | Filter by category |
136
- | `--query V` | Free-text search |
137
- | `--from DATE` | Start of date range |
138
- | `--to DATE` | End of date range |
139
- | `--days-back N` | Only show optimizations from the last N days |
140
- | `--template-id ID` | Filter to a specific template |
141
- | `--workload-id ID` | Filter to a specific workload |
142
- | `--sort-by V` | Sort order: `impact_desc`, `complexity_asc`, or `created_at_desc` |
143
- | `--page N` | Page number (default: 1) |
144
- | `--per-page N` | Results per page (default: 20, max: 50) |
145
- | `--client-id ID` | Use a specific stored client |
146
- | `--json` | Emit JSON output |
147
-
148
- Human-readable output includes a pagination hint: `Page N of M (X total)`.
149
-
150
- ### get-optimization
151
-
152
- ```bash
153
- coolhand get-optimization <id>
154
- ```
155
-
156
- Fetches a single optimization by ID. When present, the output includes PR information (`PR: #N <url>`) and a `--- Coding Prompt ---` block with the full coding prompt text.
157
-
158
- ### update-optimization
159
-
160
- ```bash
161
- coolhand update-optimization <id> --title "..." --analysis "..." --plan "..."
162
- ```
163
-
164
- Updates an existing optimization. Only the flags you provide are changed.
165
-
166
- ### close-optimization
167
-
168
- ```bash
169
- coolhand close-optimization <id> <reason>
170
- ```
171
-
172
- Closes an optimization. The reason is a free-text positional argument (quote it if it contains spaces).
57
+ | Command | Description |
58
+ |---------|-------------|
59
+ | `coolhand login` | Authenticate and store API keys |
60
+ | `coolhand logout` | Remove a stored client |
61
+ | `coolhand status` | Check whether a token is configured |
62
+ | `coolhand whoami` | Show the currently configured client |
63
+ | `coolhand clients` | List or switch the default client |
64
+ | `coolhand claude` | Run Claude CLI through the Coolhand proxy |
65
+ | `coolhand monitor` | Run an arbitrary CLI through the Coolhand proxy |
66
+ | `coolhand list-workloads` | List workloads with optional search and pagination |
67
+ | `coolhand get-workload` | Fetch a single workload by ID |
68
+ | `coolhand update-workload` | Update a workload's name and/or description |
69
+ | `coolhand search-optimizations` | List and filter optimization records |
70
+ | `coolhand get-optimization` | Fetch a single optimization by ID |
71
+ | `coolhand update-optimization` | Update an optimization's fields |
72
+ | `coolhand close-optimization` | Close an optimization with a reason |
73
+ | `coolhand analyze-claude-sessions` | Submit Claude sessions for pattern and cost analysis |
74
+ | `coolhand wildcard` | Record an agent blocker and exit cleanly |
75
+
76
+ See [docs/commands.md](./docs/commands.md) for full flag reference and usage notes.
173
77
 
174
78
  ## Security
175
79
 
@@ -189,7 +93,7 @@ await run(['login', '--json']);
189
93
 
190
94
  const cfg = await loadConfig();
191
95
  const client = getClient(cfg);
192
- console.log(maskToken(client!.api_key));
96
+ console.log(client!.api_key ? maskToken(client!.api_key) : '(no public key)');
193
97
  ```
194
98
 
195
99
  The CLI is shipped as an ES module. Importers must be ESM as well, or use a dynamic `import()`.
@@ -233,6 +137,8 @@ Located at `$HOME/.coolhand/config.json` (override with `COOLHAND_CONFIG_DIR` fo
233
137
 
234
138
  ## Documentation
235
139
 
140
+ - [Commands](./docs/commands.md) — full flag reference and usage notes for all commands
141
+ - [Proxy](./docs/proxy.md) — CA certificate setup, proxy env vars, and system trust store instructions
236
142
  - [Auth Flow](./docs/auth-flow.md) — browser-callback sequence, state machine, timeout and error paths
237
143
  - [Configuration File](./docs/config-file.md) — full config schema, multi-client model, `COOLHAND_CONFIG_DIR` override
238
144
  - [Session Capture](./docs/session-capture.md) — session scanning, envelope format, deduplication, scope and limitations
@@ -9,6 +9,11 @@
9
9
  *
10
10
  * Auth mirrors the ingest path (`log-request.ts`): the public `api_key` sent as `X-API-Key`, since
11
11
  * the endpoint lives on the same `/api/v2/llm_request_logs` path.
12
+ *
13
+ * `opts.clientId` is expected to be an **already-resolved** `client_id` string (e.g. from
14
+ * `resolveClient`), not a raw user input. `getClient` is used here deliberately: by the time this
15
+ * is called the client has already been selected (or is undefined for dry-run), so re-running the
16
+ * full resolution chain would be redundant and could trigger a second TTY prompt.
12
17
  */
13
18
  export declare function fetchLastSync(opts?: {
14
19
  clientId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"last-sync.d.ts","sourceRoot":"","sources":["../../src/api/last-sync.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAuD1F"}
1
+ {"version":3,"file":"last-sync.d.ts","sourceRoot":"","sources":["../../src/api/last-sync.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAuD1F"}
@@ -14,6 +14,11 @@ const COLLECTOR = `${PACKAGE_IDENTIFIER}/claude-code`;
14
14
  *
15
15
  * Auth mirrors the ingest path (`log-request.ts`): the public `api_key` sent as `X-API-Key`, since
16
16
  * the endpoint lives on the same `/api/v2/llm_request_logs` path.
17
+ *
18
+ * `opts.clientId` is expected to be an **already-resolved** `client_id` string (e.g. from
19
+ * `resolveClient`), not a raw user input. `getClient` is used here deliberately: by the time this
20
+ * is called the client has already been selected (or is undefined for dry-run), so re-running the
21
+ * full resolution chain would be redundant and could trigger a second TTY prompt.
17
22
  */
18
23
  export async function fetchLastSync(opts = {}) {
19
24
  let apiKey;
@@ -1 +1 @@
1
- {"version":3,"file":"last-sync.js","sourceRoot":"","sources":["../../src/api/last-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,kGAAkG;AAClG,MAAM,SAAS,GAAG,GAAG,kBAAkB,cAAc,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA8B,EAAE;IAClE,IAAI,MAA0B,CAAC;IAC/B,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM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AAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC"}
@@ -53,12 +53,12 @@ export async function startCallbackServer(opts) {
53
53
  closeServerSoon();
54
54
  return;
55
55
  }
56
- if (!token || !clientId || !clientName) {
56
+ if (!clientId || !clientName || (!token && !privateToken)) {
57
57
  consumed = true;
58
58
  res.statusCode = 400;
59
59
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
60
60
  res.end(errorHtml('Callback was missing required parameters.'));
61
- rejectResult(new CliError('INVALID_CALLBACK', 'Callback was missing token, client_id, or client_name. Make sure your Coolhand server is up to date.'));
61
+ rejectResult(new CliError('INVALID_CALLBACK', 'Callback was missing client_id, client_name, or any token. Make sure your Coolhand server is up to date.'));
62
62
  closeServerSoon();
63
63
  return;
64
64
  }
@@ -66,7 +66,7 @@ export async function startCallbackServer(opts) {
66
66
  res.statusCode = 200;
67
67
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
68
68
  res.end(SUCCESS_HTML);
69
- resolveResult({ token, clientName, clientId, private_token: privateToken });
69
+ resolveResult({ token: token ?? undefined, clientName, clientId, private_token: privateToken });
70
70
  closeServerSoon();
71
71
  }
72
72
  await new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"callback-server.js","sourceRoot":"","sources":["../../src/auth/callback-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2C,MAAM,MAAM,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB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AC,MAAM,CAAC,gBAAgB,CAC1B,OAAO,EACP,GAAG,EAAE;gBACH,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,QAAQ,GAAG,IAAI,CAAC;oBAChB,YAAY,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,6CAA6C,CAAC,CAAC,CAAC;oBACrF,eAAe,EAAE,CAAC;gBACpB,CAAC;YACH,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,IAAI,KAAK,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,SAAS,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAE/C,KAAK,UAAU,KAAK;QAClB,OAAO,EAAE,CAAC;QACV,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC;YAChB,YAAY,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAC,CAAC;QAC9F,CAAC;QACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBACtB,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjC,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -3,6 +3,16 @@ interface ParsedArgs {
3
3
  positional: string[];
4
4
  flags: Record<string, string | boolean>;
5
5
  }
6
+ /**
7
+ * Strips a leading `--client-id VALUE` or `--client-id=VALUE` from argv,
8
+ * stopping at the first positional arg (the command name). Used to support
9
+ * `coolhand --client-id acme claude ...` where the `claude` passthrough would
10
+ * otherwise bypass parseArgs and never see the flag.
11
+ */
12
+ export declare function peelClientId(argv: string[]): {
13
+ clientId: string | undefined;
14
+ rest: string[];
15
+ };
6
16
  export declare function parseArgs(argv: string[]): ParsedArgs;
7
17
  export declare function run(argv: string[]): Promise<number>;
8
18
  export {};
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AA6BA,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AA2LD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAqCpD;AAiOD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAqFzD"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAuCA,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AA4OD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAgE7F;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAqCpD;AA+VD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkIzD"}