@amdahl/cli 0.3.4 → 0.3.6

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 (3) hide show
  1. package/README.md +165 -66
  2. package/dist/amdahl.js +594 -311
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -45,93 +45,173 @@ anything, names the version it found, and links the Node.js download page.
45
45
 
46
46
  ```sh
47
47
  # Run once, with no install
48
- npx @amdahl/cli login
48
+ npx -y amdahl
49
49
 
50
50
  # Or install the `amdahl` command
51
51
  npm i -g @amdahl/cli
52
- amdahl login
52
+ amdahl
53
53
  ```
54
54
 
55
55
  `amdahl` is also on npm by its short name, so `npx amdahl ...` is the same as
56
56
  `npx @amdahl/cli ...`. That package ([packages/amdahl](packages/amdahl)) has no
57
57
  code of its own: it depends on `@amdahl/cli` at the same version and runs it.
58
+ npm asks "Ok to proceed? (y)" before every `npx` run of a package you have not
59
+ installed; `npx -y` skips that question, so every example here uses it.
58
60
 
59
- The quickest way to start is `npx amdahl` with nothing after it (or
60
- `npx amdahl setup`), in a terminal. It walks you through setup:
61
+ The quickest way to start is `npx -y amdahl` with nothing after it (or
62
+ `npx -y amdahl setup`), in a terminal. It asks where Amdahl should work:
61
63
 
62
64
  ```
63
- $ npx amdahl
65
+ $ npx -y amdahl
64
66
  Amdahl · predictive ML for GTM
65
67
  Where should Amdahl work?
66
68
  > [x] Claude Code found on your machine
67
69
  [ ] Cursor
68
70
  [ ] Codex
69
- ↑↓ move · Space tick/untick · Enter to install
71
+ [ ] This terminal
72
+ ↑↓ move · Space tick/untick · Enter continue
70
73
  ```
71
74
 
72
75
  It finds Claude Code, Cursor and Codex by their command on your PATH
73
76
  (`claude`, `cursor`, `codex`) or their files in your home folder (`.claude`
74
77
  or `.claude.json`, `.cursor`, `.codex`). Only the ones it finds are ticked
75
- and tagged "found on your machine" (in dim grey where colour is allowed). If
76
- it finds none, it says "We didn't find any of these on this computer. Tick
77
- the ones you use." under the question. The `>` marker starts on the first
78
- ticked row, and only the marker is coloured, so the row under it never
79
- looks picked when it is not. Esc, `q` or Ctrl+C stops with nothing changed
80
- (exit 130). The menu redraws in place in any width, also in a split pane
81
- narrower than its lines, and `NO_COLOR` or `--no-color` turn the colour off.
82
-
83
- After Enter it first checks each client it can set up, so a broken
84
- `~/.cursor/mcp.json` or `~/.claude.json` is reported before you sign in.
85
- If you are not signed in, it signs you in through the browser:
78
+ and tagged "found on your machine" (in dim grey where colour is allowed).
79
+ "This terminal" is always there and never ticked for you. If it finds none
80
+ of the three, it says so under the question, points Claude and ChatGPT app
81
+ users to https://amdahl.ai/connect, and the marker starts on "This
82
+ terminal", so Space then Enter picks it:
83
+
84
+ ```
85
+ Where should Amdahl work?
86
+ We didn't find Claude Code, Cursor or Codex on this computer.
87
+ Using the Claude or ChatGPT app? Connect it at https://amdahl.ai/connect
88
+ [ ] Claude Code
89
+ [ ] Cursor
90
+ [ ] Codex
91
+ > [ ] This terminal
92
+ ↑↓ move · Space tick/untick · Enter continue
93
+ ```
94
+
95
+ The `>` marker starts on the first ticked row, and only the marker is
96
+ coloured, so the row under it never looks picked when it is not. Esc, `q`
97
+ or Ctrl+C stops with nothing changed (exit 130). The menu redraws in place
98
+ in any width, also in a split pane narrower than its lines, and `NO_COLOR`
99
+ or `--no-color` turn the colour off. Enter with nothing ticked changes
100
+ nothing and says how to try Amdahl: run it again and tick "This terminal",
101
+ or connect the Claude or ChatGPT app at https://amdahl.ai/connect.
102
+
103
+ ### The AI tools: set up first, then one sign-in in the tool
104
+
105
+ For Claude Code, Cursor and Codex there is no sign-in in the terminal. The
106
+ setup writes each tool's config straight away (as `amdahl install` does), so
107
+ nothing is lost if you stop later, and then prints that tool's next steps.
108
+ Each tool signs in to Amdahl itself, over OAuth, the first time it connects;
109
+ that sign-in is also where a new user creates their free workspace. Each
110
+ screen is six lines or fewer:
111
+
112
+ ```
113
+ ✓ Added Amdahl to Claude Code.
114
+ One step left, in Claude Code:
115
+ 1. If it's open, quit and reopen it. Type /mcp, pick amdahl, sign in.
116
+ 2. Paste an email and say: "Use Amdahl to make this sound less like AI"
117
+ New to Amdahl? The sign-in sets up your free workspace.
118
+ ```
119
+
120
+ ```
121
+ ✓ Added Amdahl to Cursor.
122
+ One step left, in Cursor:
123
+ 1. If it's open, quit and reopen it. In Customize > MCPs, sign in to amdahl.
124
+ 2. In chat, paste an email, say: "Use Amdahl to make this sound less like AI"
125
+ ```
126
+
127
+ Cursor reads `~/.cursor/mcp.json` when it starts and lists its MCP servers
128
+ under Customize, then MCPs.
129
+
130
+ Codex runs in the same terminal, so with `codex` on your PATH the setup
131
+ offers to run its sign-in for you:
132
+
133
+ ```
134
+ ✓ Added Amdahl to Codex.
135
+ Press Enter to sign Codex in to Amdahl (opens your browser).
136
+ ✓ Codex is connected.
137
+ Run codex, paste an email and say: "Use Amdahl to make this sound less like AI"
138
+ ```
139
+
140
+ Enter runs `codex mcp login amdahl` on your terminal (it prints the link and
141
+ opens the browser). Ctrl+C there skips it and names the command to run
142
+ later; if the sign-in does not finish, it says so and names the same
143
+ command. Without `codex` on your PATH, and always on Windows (where `codex`
144
+ is a `.cmd` file the CLI cannot start without a shell), the screen lists
145
+ `codex mcp login amdahl` as step 1. With more than one tool, the screens follow one another
146
+ and the "New to Amdahl?" line is printed once. A tool that fails (a broken
147
+ `~/.cursor/mcp.json` or `~/.claude.json`, say) prints its error, the rest
148
+ still run, and the exit code is the first failure's. In a terminal narrower
149
+ than a screen's lines, they break between words, and a numbered step's next
150
+ line starts under its text.
151
+
152
+ ### This terminal: try it on a message
153
+
154
+ Pick "This terminal" (alone or beside the tools, which are set up first) to
155
+ see Amdahl work right away. It signs you in through the browser if you are
156
+ not signed in yet, then asks for a message:
86
157
 
87
158
  ```
88
- Where should Amdahl work? Claude Code
89
- Opening your browser…
90
159
  ✓ Signed in · Acme
91
- ✓ Added to Claude Code
92
- Try it: say "make this email sound less like AI" in Claude Code.
93
- Before that, run /mcp once in Claude Code to connect Amdahl.
160
+ Paste an email or LinkedIn message, then press Enter on an empty line:
161
+ <your draft>
162
+ Amdahl is rewriting it. This can take a minute.
163
+ ── Amdahl's version ──────────────
164
+ <the rewritten message>
165
+ Cut the opener and 2 sentences nothing backed.
166
+ Next time: npx -y amdahl optimize draft.txt,
167
+ or pbpaste | npx -y amdahl optimize -
94
168
  ```
95
169
 
96
- While it waits, it prints one short line under "Opening your browser…". In
97
- a terminal that shows links (iTerm2, VS Code, Warp, Terminal, WezTerm,
98
- Ghostty, Windows Terminal, VTE 0.50 or later) it reads "Browser didn't open?
99
- Open the sign-in page" and the last words are a link; elsewhere it says to
100
- press Enter for the link. `FORCE_HYPERLINK=1` or `0` overrides the guess,
101
- and `NO_COLOR` turns the link off. Either way, Enter prints the full sign-in
102
- link once. Once you are signed in, that line is replaced by `✓ Signed in`.
103
- If the browser could not be opened, or with `--no-browser`, the full link
104
- prints at once. It waits up to 15 minutes, so someone new can create their
105
- workspace on the way and land back in the same setup. If the server rejects
106
- a key set in `AMDAHL_KEY` (or `AMDAHL_API_KEY`, `AMDAHL_ACCESS_TOKEN`,
107
- `--api-key`), it says so and skips the browser sign-in, since that key would
108
- still win.
109
-
110
- Then it sets up each client you ticked the way `amdahl install` does, one
111
- line each. A client that fails prints its error and the rest still run; the
112
- exit code is the first failure's. Each client then signs in to Amdahl
113
- itself, once, the first time it connects, and the setup ends with that step
114
- for every client it set up, on every run: `/mcp` in Claude Code, `codex mcp
115
- login amdahl` for Codex, and Cursor asks on first use. With more than one:
170
+ Empty lines inside a paste stay in the message: the terminal marks a paste
171
+ (bracketed paste), and where it does not, an empty line that more text
172
+ follows at once counts as pasted. Ctrl+D also ends the message. The lines
173
+ under Amdahl's version say what it did, as `amdahl optimize` does. The
174
+ `pbpaste` line is printed on macOS only.
175
+
176
+ While it waits for the browser, it prints one short line under "Opening
177
+ your browser…". In a terminal that shows links (iTerm2, VS Code, Warp,
178
+ Terminal, WezTerm, Ghostty, Windows Terminal, VTE 0.50 or later) it reads
179
+ "Browser didn't open? Open the sign-in page" and the last words are a link;
180
+ elsewhere it says to press Enter for the link. `FORCE_HYPERLINK=1` or `0`
181
+ overrides the guess, and `NO_COLOR` turns the link off. Either way, Enter
182
+ prints the full sign-in link once. Once you are signed in, that line is
183
+ replaced by `✓ Signed in`. If the browser could not be opened, or with
184
+ `--no-browser`, the full link prints at once. It waits up to 15 minutes, so
185
+ someone new can create their workspace on the way and land back in the same
186
+ setup. If the server rejects a key set in `AMDAHL_KEY` (or `AMDAHL_API_KEY`,
187
+ `AMDAHL_ACCESS_TOKEN`, `--api-key`), it says so, skips the browser sign-in
188
+ (that key would still win) and exits 3. Ctrl+C during the sign-in or the
189
+ paste stops with exit 130; if tools were set up first, it says they still
190
+ are.
191
+
192
+ ### Run it again
193
+
194
+ When every tool it finds already points at Amdahl, it asks nothing, needs no
195
+ network and signs in nowhere. It says so, with the one thing to try and how
196
+ to finish the tool's sign-in if you have not yet:
116
197
 
117
198
  ```
118
- Try it: say "make this email sound less like AI" in any of them.
119
- Before that, connect each one once:
120
- Claude Code: run /mcp
121
- Cursor: sign in when it asks, on first use
122
- Codex: run `codex mcp login amdahl`
199
+ Amdahl is in Claude Code. You're all set.
200
+ Paste an email there and say: "Use Amdahl to make this sound less like AI"
201
+ If you've already run /mcp, you're done.
202
+ If not: quit and reopen Claude Code, type /mcp, pick amdahl, sign in.
203
+ Want to try it here instead? Run: npx -y amdahl optimize
123
204
  ```
124
205
 
125
- `npx amdahl --verbose` also prints the files it wrote, the profile and
126
- where the sign-in is stored. Run it again once you are set up and it says
127
- `You're set up in Claude Code and Cursor.` with the same closing lines, and
128
- asks nothing; if it cannot reach Amdahl to check your sign-in, it still
129
- says so.
206
+ An old copy of the Amdahl skill is brought up to date on the way. A tool it
207
+ finds that does not point at Amdahl yet brings the menu back.
208
+ `npx -y amdahl --verbose` also prints the files it wrote, the profile and
209
+ where the sign-in is stored.
130
210
 
131
211
  ### Run by an agent, or with no terminal
132
212
 
133
- You can ask Claude Code, Cursor or Codex to run `npx amdahl` for you. With
134
- no terminal (an agent's shell, a pipe such as `npx amdahl | cat`, or stdin,
213
+ You can ask Claude Code, Cursor or Codex to run `npx -y amdahl` for you. With
214
+ no terminal (an agent's shell, a pipe such as `npx -y amdahl | cat`, or stdin,
135
215
  stdout or stderr redirected), and whenever `CLAUDECODE` or `CURSOR_AGENT`
136
216
  is set, it sets up without a question and without a browser sign-in:
137
217
 
@@ -142,14 +222,22 @@ is set, it sets up without a question and without a browser sign-in:
142
222
  In Codex's default sandbox, writes outside the workspace and network access
143
223
  are blocked, so the run usually fails (`npx` cannot fetch the package, or
144
224
  `Could not update ~/.codex/config.toml`, exit 1) unless you approve the
145
- escalation Codex asks for, or run `npx amdahl` in your own terminal.
225
+ escalation Codex asks for, or run `npx -y amdahl` in your own terminal.
146
226
 
147
227
  Each client signs in on its first connect, over OAuth, so the CLI needs no
148
- sign-in of its own here. The last lines say how to finish, as above. Run
149
- from inside Claude Code, the step is "restart Claude Code and run /mcp
228
+ sign-in of its own here. The last lines say what to try and the one step
229
+ that connects each client:
230
+
231
+ ```
232
+ ✓ Added to Claude Code
233
+ Try it: paste an email and say "Use Amdahl to make this sound less like AI" in Claude Code.
234
+ Before that, restart Claude Code and run /mcp once to connect Amdahl.
235
+ ```
236
+
237
+ Run from inside Claude Code, the step is "restart Claude Code and run /mcp
150
238
  once", since a running session may only see the new server after a
151
239
  restart. If
152
- it finds no client, it says so on stderr, names `npx amdahl install
240
+ it finds no client, it says so on stderr, names `npx -y amdahl install
153
241
  claude-code`, writes nothing and exits 1.
154
242
 
155
243
  **Exit code change in 0.3.4.** Before 0.3.4, bare `amdahl` with no terminal
@@ -163,8 +251,8 @@ line that says why and names `amdahl install`. CI means one of `CI`, `JENKINS_UR
163
251
  `BUILD_NUMBER` is set together with `JENKINS_HOME`.
164
252
 
165
253
  When the CLI was started by `npx`, every message that names a command says
166
- `npx amdahl ...` (for example `npx amdahl login`), since an `npx` user has no
167
- `amdahl` on their PATH.
254
+ `npx -y amdahl ...` (for example `npx -y amdahl login`), since an `npx` user
255
+ has no `amdahl` on their PATH, and `-y` skips npm's question.
168
256
 
169
257
  To connect one AI client yourself, run `amdahl install claude-code` (or `codex`,
170
258
  `cursor`). It adds the Amdahl MCP server and also installs the Amdahl skill,
@@ -189,7 +277,7 @@ files are also written whole through a temp file. A symbolic link at
189
277
  `~/.claude.json` is followed to its target, even one not created yet, and
190
278
  stays a link. An `mcpServers` that is not a JSON object (an array, say) in
191
279
  `~/.claude.json` or `~/.cursor/mcp.json` is left alone with `invalid_config`,
192
- found before the sign-in. If it cannot write the client's config file, it
280
+ found before the setup writes anything. If it cannot write the client's config file, it
193
281
  exits 1 with `write_failed` and names the file. The skill goes to the
194
282
  client's user skills folder:
195
283
 
@@ -209,11 +297,11 @@ https://docs.amdahl.ai/skills/amdahl/SKILL.md.
209
297
  ## Quick start
210
298
 
211
299
  ```sh
212
- amdahl # guided setup for Claude Code, Cursor and Codex (an agent can run it too)
300
+ amdahl # guided setup for Claude Code, Cursor and Codex, or try it here (an agent can run it too)
213
301
  amdahl login # sign in through the browser with your console account
214
302
  amdahl whoami # the account, workspace and role you are signed in as
215
303
  amdahl status # can this workspace optimize, and what blocks it
216
- amdahl optimize draft.md # rewrite one message (or pipe it in with -)
304
+ amdahl optimize draft.md # rewrite one message (or pipe it in with -, or run it bare and paste)
217
305
  amdahl install claude-code # connect an AI client and add the Amdahl skill (also codex, cursor)
218
306
  amdahl skills add <publisher>/<skill> # add a skill from amdahl.ai/skills to this project
219
307
  ```
@@ -227,6 +315,17 @@ terminal keeps waiting for it. Anything
227
315
  else exits 5 with the one next step (ask your company's admins, try again
228
316
  tomorrow, and so on). The CLI itself never creates or joins a workspace.
229
317
 
318
+ `amdahl login` ends with the next step: `amdahl optimize` to try a pasted
319
+ message, or bare `amdahl` to add Amdahl to Claude Code, Cursor or Codex.
320
+
321
+ `amdahl optimize` with no file, at a terminal, asks you to paste the message
322
+ (as the setup's "This terminal" does) and signs you in through the browser
323
+ first if you are not signed in ("Sign in first, then paste your message."). With stdin piped, or `-`, it reads stdin
324
+ whole as before. At a terminal it still says to give a file (exit 2) when
325
+ an agent runs it (`CLAUDECODE` or `CURSOR_AGENT` set), in CI (the same
326
+ variables bare `amdahl` checks) or with `AMDAHL_NO_PROMPT=1`: none of them
327
+ can paste.
328
+
230
329
  On a server or in CI, skip `login` and set an API key in `AMDAHL_KEY`.
231
330
 
232
331
  ## Commands
@@ -260,9 +359,9 @@ stderr. An unknown option prints `Unknown option --foo.` and `Run \`amdahl
260
359
  It needs no sign-in.
261
360
 
262
361
  ```sh
263
- npx amdahl skills add <publisher>/<skill>
362
+ npx -y amdahl skills add <publisher>/<skill>
264
363
  # the skill's link works too, with or without .md:
265
- npx amdahl skills add https://amdahl.ai/skills/<publisher>/<skill>
364
+ npx -y amdahl skills add https://amdahl.ai/skills/<publisher>/<skill>
266
365
  ```
267
366
 
268
367
  In a terminal, it asks one question. It prints `Checking <publisher>/<skill>
@@ -452,7 +551,7 @@ code shown in the terminal; then the key is printed once and stored nowhere.
452
551
  | 7 | approval denied, expired or locked out |
453
552
  | 8 | network or 5xx |
454
553
  | 9 | `skills add` did not install a skill amdahl.ai's security review flagged: no terminal to ask, `-y`, `--json` or an agent ran it, and no `--accept-warning` (nothing was written) |
455
- | 130 | stopped with Ctrl+C (or Esc or `q` in a menu) at a question: "Stopped. Nothing changed." |
554
+ | 130 | stopped with Ctrl+C (or Esc or `q` in a menu) at a question: "Stopped. Nothing changed." (in the setup, after tools were set up: "Stopped. Amdahl is still set up in …") |
456
555
 
457
556
  ## Development
458
557