coolhand-cli 0.5.1 → 0.6.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 (86) hide show
  1. package/README.md +41 -140
  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 +7 -1
  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 +296 -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 +22 -3
  16. package/dist/commands/claude.d.ts.map +1 -1
  17. package/dist/commands/claude.js +117 -49
  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/status.js +2 -2
  40. package/dist/commands/status.js.map +1 -1
  41. package/dist/commands/update-workload.d.ts +3 -0
  42. package/dist/commands/update-workload.d.ts.map +1 -0
  43. package/dist/commands/update-workload.js +35 -0
  44. package/dist/commands/update-workload.js.map +1 -0
  45. package/dist/commands/whoami.js +1 -1
  46. package/dist/commands/whoami.js.map +1 -1
  47. package/dist/commands/wildcard.d.ts.map +1 -1
  48. package/dist/commands/wildcard.js +119 -19
  49. package/dist/commands/wildcard.js.map +1 -1
  50. package/dist/config.d.ts +16 -0
  51. package/dist/config.d.ts.map +1 -1
  52. package/dist/config.js +127 -6
  53. package/dist/config.js.map +1 -1
  54. package/dist/log-request.d.ts.map +1 -1
  55. package/dist/log-request.js +2 -1
  56. package/dist/log-request.js.map +1 -1
  57. package/dist/pending-store.d.ts +31 -0
  58. package/dist/pending-store.d.ts.map +1 -0
  59. package/dist/pending-store.js +81 -0
  60. package/dist/pending-store.js.map +1 -0
  61. package/dist/prompt.d.ts +13 -0
  62. package/dist/prompt.d.ts.map +1 -0
  63. package/dist/prompt.js +30 -0
  64. package/dist/prompt.js.map +1 -0
  65. package/dist/proxy/certs.d.ts +14 -0
  66. package/dist/proxy/certs.d.ts.map +1 -0
  67. package/dist/proxy/certs.js +64 -0
  68. package/dist/proxy/certs.js.map +1 -0
  69. package/dist/proxy/interceptor.d.ts +16 -0
  70. package/dist/proxy/interceptor.d.ts.map +1 -0
  71. package/dist/proxy/interceptor.js +57 -0
  72. package/dist/proxy/interceptor.js.map +1 -0
  73. package/dist/proxy/proxy.d.ts +18 -0
  74. package/dist/proxy/proxy.d.ts.map +1 -0
  75. package/dist/proxy/proxy.js +113 -0
  76. package/dist/proxy/proxy.js.map +1 -0
  77. package/dist/proxy/sender.d.ts +31 -0
  78. package/dist/proxy/sender.d.ts.map +1 -0
  79. package/dist/proxy/sender.js +66 -0
  80. package/dist/proxy/sender.js.map +1 -0
  81. package/dist/types.d.ts +24 -2
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/types.js.map +1 -1
  84. package/dist/version.d.ts +2 -2
  85. package/dist/version.js +1 -1
  86. package/package.json +2 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/coolhand-cli.svg)](https://badge.fury.io/js/coolhand-cli)
4
4
 
5
- Command-line authentication helper for [Coolhand](https://coolhandlabs.com). Opens a browser, captures your public API token via a localhost callback (same flow as `gh auth login` and `gcloud auth login`), and stores it in `~/.coolhand/config.json`.
5
+ `coolhand-cli` is a free command-line tool that helps you analyze and improve your local AI workflows, identify silent agent failures, and interact with the [Coolhand](https://coolhandlabs.com) APIs to find improvements for your production agents.
6
6
 
7
7
  ## Install
8
8
 
@@ -19,147 +19,60 @@ coolhand login
19
19
 
20
20
  Requires Node 20 or newer.
21
21
 
22
- ## Commands
23
-
24
- ```
25
- coolhand login [--base-url URL] [--scope private] [--write-env PATH] [--client-id ID] [--json]
26
- coolhand logout [--client-id ID | --all] [--json]
27
- coolhand status [--client-id ID] [--json]
28
- coolhand whoami [--client-id ID]
29
- coolhand clients [use <id>] [--json]
30
- coolhand claude [claude args...]
31
-
32
- coolhand search-optimizations [--status V] [--type V] [--category V] [--query V]
33
- [--from DATE] [--to DATE] [--days-back N]
34
- [--template-id ID] [--workload-id ID]
35
- [--sort-by impact_desc|complexity_asc|created_at_desc]
36
- [--page N] [--per-page N] [--client-id ID] [--json]
37
- coolhand get-optimization <id> [--client-id ID] [--json]
38
- coolhand update-optimization <id> [--title V] [--analysis V] [--plan V] [--client-id ID] [--json]
39
- coolhand close-optimization <id> <reason> [--client-id ID] [--json]
40
-
41
- coolhand analyze-claude-sessions [--dry-run] [--client-id ID] [--json]
42
-
43
- coolhand wildcard --complaint "..." --agent-name "..." [--thinking "..."] [--log-id ID] [--json]
44
- coolhand report-blocker (alias for wildcard)
45
- coolhand complaint-box (alias for wildcard)
46
- ```
47
-
48
- ### login
49
-
50
- 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.
51
-
52
- `--scope private` authenticates against a private workspace instead of the default shared workspace.
53
-
54
- `--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).
55
-
56
- ### status
57
-
58
- `coolhand status --json` is the programmatic check used by integrations:
59
-
60
- ```json
61
- {
62
- "configured": true,
63
- "clients": [
64
- {"client_id": "acme", "client_name": "Acme Inc",
65
- "masked_token": "e885b463…1148", "base_url": "https://coolhandlabs.com"}
66
- ],
67
- "default_client_id": "acme"
68
- }
69
- ```
70
-
71
- Exit code is `0` if a token is configured for the default (or requested) client, `1` otherwise.
72
-
73
- ### clients
74
-
75
- 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`.
76
-
77
- ### run
78
-
79
- 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.
80
-
81
- Use `coolhand claude` to wrap a single Claude session and capture it for later evaluation — a coding session, a skill walkthrough, a debugging run:
82
-
83
- ```bash
84
- coolhand claude # starts Claude with capture on
85
- coolhand claude --resume # any args after `claude` go straight to the Claude CLI
86
- ```
87
-
88
- Captured sessions flow into your Coolhand account, where they can be analyzed for optimization opportunities — reduced token usage, tighter prompts, better context management.
89
-
90
- ## Optimization commands
91
-
92
- 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.
93
-
94
- ### search-optimizations
95
-
96
- Lists optimizations with optional filtering and pagination.
97
-
98
- | Flag | Description |
99
- |------|-------------|
100
- | `--status V` | Filter by status (e.g. `open`, `closed`) |
101
- | `--type V` | Filter by optimization type |
102
- | `--category V` | Filter by category |
103
- | `--query V` | Free-text search |
104
- | `--from DATE` | Start of date range |
105
- | `--to DATE` | End of date range |
106
- | `--days-back N` | Only show optimizations from the last N days |
107
- | `--template-id ID` | Filter to a specific template |
108
- | `--workload-id ID` | Filter to a specific workload |
109
- | `--sort-by V` | Sort order: `impact_desc`, `complexity_asc`, or `created_at_desc` |
110
- | `--page N` | Page number (default: 1) |
111
- | `--per-page N` | Results per page (default: 20, max: 50) |
112
- | `--client-id ID` | Use a specific stored client |
113
- | `--json` | Emit JSON output |
114
-
115
- Human-readable output includes a pagination hint: `Page N of M (X total)`.
116
-
117
- ### get-optimization
22
+ ## Analyze Claude sessions
118
23
 
119
24
  ```bash
120
- coolhand get-optimization <id>
25
+ coolhand analyze-claude-sessions [--dry-run] [--client-id ID] [--json]
121
26
  ```
122
27
 
123
- 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.
124
-
125
- ### update-optimization
28
+ Upload your historical Claude Code session transcripts to your Coolhand account for analysis. Coolhand analyzes the uploaded conversations to surface:
126
29
 
127
- ```bash
128
- coolhand update-optimization <id> --title "..." --analysis "..." --plan "..."
129
- ```
30
+ - **Repeatable patterns** — tasks you do by hand on repeat that could be scripted or automated
31
+ - **Efficiency gaps** — workflows with unnecessary back-and-forth or redundant steps
32
+ - **Cost insights** — sessions with high token usage relative to their outcome
130
33
 
131
- Updates an existing optimization. Only the flags you provide are changed.
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.
132
35
 
133
- ### close-optimization
36
+ See [Session capture](./docs/session-capture.md) for capture logic, duplicate-avoidance details, and the full flag reference.
134
37
 
135
- ```bash
136
- coolhand close-optimization <id> <reason>
137
- ```
38
+ ## Wildcard (agent complaint box)
138
39
 
139
- Closes an optimization. The reason is a free-text positional argument (quote it if it contains spaces).
140
-
141
- ## Analyze Claude sessions
40
+ When an agent is blocked because a capability does not exist in its environment, it can record the blocker and get back an unambiguous "stop and move on" response:
142
41
 
143
42
  ```bash
144
- coolhand analyze-claude-sessions [--dry-run] [--client-id ID] [--json]
43
+ coolhand wildcard \
44
+ --complaint "I need to run database migrations but no database is reachable" \
45
+ --agent-name code-review-agent \
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."
145
47
  ```
146
48
 
147
- Submit your historical Claude sessions to Coolhand for analysis. Coolhand scans the uploaded sessions to surface:
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`.
148
50
 
149
- - **Repeatable patterns** — tasks you do by hand on repeat that could be scripted or automated
150
- - **Efficiency gaps** — workflows with unnecessary back-and-forth or redundant steps
151
- - **Cost insights** — sessions with high token usage relative to their outcome
152
-
153
- The command scans two local sources and merges the results:
154
-
155
- - **Claude Code** — `~/.claude/projects/` (all platforms)
156
- - **Claude Cowork** — `~/Library/Application Support/Claude/local-agent-mode-sessions/` (macOS)
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.
157
52
 
158
- Each session is posted as a single conversation log. New sessions are submitted on first run; sessions that have grown (more turns added since the last sync) are re-uploaded with the full updated conversation. Unchanged sessions are skipped. It is safe to re-run at any time.
53
+ See [Your AI agent has notes](https://michael.carroll.io/talks/2026/your-ai-agent-has-notes) for a presentation on the research & best practices for using this pattern.
159
54
 
160
- Use `--dry-run` to preview what would be sent without submitting anything.
55
+ ## Commands
161
56
 
162
- See [Session capture](./docs/session-capture.md) for scan logic, duplicate-avoidance details, and the full flag reference.
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 list-workloads` | List workloads with optional search and pagination |
66
+ | `coolhand get-workload` | Fetch a single workload by ID |
67
+ | `coolhand update-workload` | Update a workload's name and/or description |
68
+ | `coolhand search-optimizations` | List and filter optimization records |
69
+ | `coolhand get-optimization` | Fetch a single optimization by ID |
70
+ | `coolhand update-optimization` | Update an optimization's fields |
71
+ | `coolhand close-optimization` | Close an optimization with a reason |
72
+ | `coolhand analyze-claude-sessions` | Submit Claude sessions for pattern and cost analysis |
73
+ | `coolhand wildcard` | Record an agent blocker and exit cleanly |
74
+
75
+ See [docs/commands.md](./docs/commands.md) for full flag reference and usage notes.
163
76
 
164
77
  ## Security
165
78
 
@@ -179,7 +92,7 @@ await run(['login', '--json']);
179
92
 
180
93
  const cfg = await loadConfig();
181
94
  const client = getClient(cfg);
182
- console.log(maskToken(client!.api_key));
95
+ console.log(client!.api_key ? maskToken(client!.api_key) : '(no public key)');
183
96
  ```
184
97
 
185
98
  The CLI is shipped as an ES module. Importers must be ESM as well, or use a dynamic `import()`.
@@ -201,20 +114,6 @@ coolhand login --write-env .env
201
114
 
202
115
  The CLI works especially well with the [Coolhand feedback collection skill](https://github.com/Coolhand-Labs/feedback-collection-skill) for Claude Code. The skill scans your project for LLM inference calls and implements best-practice human feedback collection — it reads `COOLHAND_API_KEY` from the environment, which `coolhand login --write-env .env` puts in place.
203
116
 
204
- ### wildcard (agent complaint box)
205
-
206
- When an agent is blocked because a capability does not exist in its environment, it can record the blocker and get back an unambiguous "stop and move on" response:
207
-
208
- ```bash
209
- coolhand wildcard \
210
- --complaint "I need to run database migrations but no database is reachable" \
211
- --agent-name code-review-agent
212
- ```
213
-
214
- 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.
215
-
216
- 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.
217
-
218
117
  ## Configuration file
219
118
 
220
119
  Located at `$HOME/.coolhand/config.json` (override with `COOLHAND_CONFIG_DIR` for testing). Schema:
@@ -237,6 +136,8 @@ Located at `$HOME/.coolhand/config.json` (override with `COOLHAND_CONFIG_DIR` fo
237
136
 
238
137
  ## Documentation
239
138
 
139
+ - [Commands](./docs/commands.md) — full flag reference and usage notes for all commands
140
+ - [Proxy](./docs/proxy.md) — CA certificate setup, proxy env vars, and system trust store instructions
240
141
  - [Auth Flow](./docs/auth-flow.md) — browser-callback sequence, state machine, timeout and error paths
241
142
  - [Configuration File](./docs/config-file.md) — full config schema, multi-client model, `COOLHAND_CONFIG_DIR` override
242
143
  - [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":"AAMA;;;;;;;;;;;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"}
@@ -1,7 +1,8 @@
1
1
  import { loadConfig, getClient } from '../config.js';
2
2
  import { DEFAULT_BASE_URL } from '../types.js';
3
+ import { PACKAGE_IDENTIFIER } from '../version.js';
3
4
  /** Identifies this tool's logs in the server's collector field (matches the ingest collector). */
4
- const COLLECTOR = 'coolhand-cli/claude-code';
5
+ const COLLECTOR = `${PACKAGE_IDENTIFIER}/claude-code`;
5
6
  /**
6
7
  * Ask the server for the timestamp of the most recent log it already holds from this collector, so
7
8
  * `capture-sessions` only re-scans files newer than that. This is a server-authoritative cutoff that
@@ -13,6 +14,11 @@ const COLLECTOR = 'coolhand-cli/claude-code';
13
14
  *
14
15
  * Auth mirrors the ingest path (`log-request.ts`): the public `api_key` sent as `X-API-Key`, since
15
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.
16
22
  */
17
23
  export async function fetchLastSync(opts = {}) {
18
24
  let apiKey;
@@ -1 +1 @@
1
- {"version":3,"file":"last-sync.js","sourceRoot":"","sources":["../../src/api/last-sync.ts"],"names":[],"mappings":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AC;IACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,8EAA8E;QAC9E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAyC,CAAC;IAC9C,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAwC,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE,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,CAAC;AAG5D,MAAM,QAAQ,GAAG,WAAW,CAAC;AAc7B,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAgC;IACxE,IAAI,aAA+C,CAAC;IACpD,IAAI,YAAmC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7D,aAAa,GAAG,OAAO,CAAC;QACxB,YAAY,GAAG,MAAM,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,KAAiC,CAAC;IAEtC,MAAM,MAAM,GAAW,YAAY,CAAC,CAAC,GAAoB,EAAE,GAAmB,EAAE,EAAE;QAChF,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,SAAS,eAAe;QACtB,YAAY,CAAC,GAAG,EAAE;YAChB,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,aAAa,CAAC,GAAoB,EAAE,GAAmB;QAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,EAAE,UAAU,QAAQ,EAAE,CAAC,CAAC;QAE1D,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;YACrB,GAAG,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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":"AAsCA,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;AAmOD;;;;;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,CAmHzD"}