myshell-tools 2.15.0 → 3.0.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.
- package/CHANGELOG.md +31 -0
- package/README.md +8 -24
- package/dist/cli.js +12 -17
- package/dist/cli.js.map +1 -1
- package/dist/commands/cost.js +6 -2
- package/dist/commands/cost.js.map +1 -1
- package/dist/commands/doctor.js +6 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/login.d.ts +18 -10
- package/dist/commands/login.js +81 -109
- package/dist/commands/login.js.map +1 -1
- package/dist/core/json-envelope.js +31 -3
- package/dist/core/json-envelope.js.map +1 -1
- package/dist/core/orchestrate.js +82 -40
- package/dist/core/orchestrate.js.map +1 -1
- package/dist/infra/atomic.d.ts +9 -1
- package/dist/infra/atomic.js +12 -2
- package/dist/infra/atomic.js.map +1 -1
- package/dist/infra/credentials.d.ts +34 -3
- package/dist/infra/credentials.js +59 -8
- package/dist/infra/credentials.js.map +1 -1
- package/dist/interface/menu.js +97 -62
- package/dist/interface/menu.js.map +1 -1
- package/dist/interface/render.js +9 -5
- package/dist/interface/render.js.map +1 -1
- package/dist/providers/claude.js +12 -0
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/detect.js +22 -1
- package/dist/providers/detect.js.map +1 -1
- package/dist/providers/registry.d.ts +8 -4
- package/dist/providers/registry.js +7 -6
- package/dist/providers/registry.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,37 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
|
|
|
11
11
|
- Cross-OS CI execution (requires a public remote).
|
|
12
12
|
- First npm publish.
|
|
13
13
|
|
|
14
|
+
## [2.17.0]
|
|
15
|
+
|
|
16
|
+
### Security
|
|
17
|
+
- Credentials file (~/.myshell-tools/credentials.json) is now created with mode 0600 and its directory 0700 from the first write (atomicWrite gained an optional mode), closing a brief world-readable window on shared systems.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- opencode now advertises a model per tier so routing never picks a model it does not have.
|
|
21
|
+
- run (one-shot) now respects your Settings mode (cost-saver/balanced/quality-first) instead of always using the default policy.
|
|
22
|
+
- Environment detection runs once per launch (was duplicated: 6 provider --version spawns, now 3).
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Honest labels: opencode shows ready (free models) (not signed in); doctor shows free models (no sign-in needed); the cost total is labeled provider-reported where available, otherwise estimated from list prices (Codex costs are estimates).
|
|
26
|
+
- README de-staled (auto-update default-on + (Y/n) + MYSHELL_NO_UPDATE documented; alpha roadmap table removed; brittle test-count claims replaced).
|
|
27
|
+
- Architecture guards strengthened (no-orphan logic; core purity now also forbids new Date(/node:os/node:crypto) and two weak tests made assertive.
|
|
28
|
+
|
|
29
|
+
## [2.16.0]
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
- **Login no longer garbles the screen**: the Claude code-method sign-in now runs claude setup-token with inherited stdio (clean native animation) and uses the robust paste prompt, instead of piping/echoing the output (which turned the spinner into a scroll of repeated banners). Honest error on non-zero exit.
|
|
33
|
+
- **Auth errors short-circuit**: a not-signed-in provider no longer burns failover + tier escalation (3 failed attempts) before surfacing — it stops after one attempt and the conversation offers inline re-login immediately.
|
|
34
|
+
- **Orchestrator edge cases**: reviewer escalate at the top tier no longer loops silently; a failover event is never shown when no attempt remains to honor it; reviewer revise notes are now applied on retries at any tier; the JSON-envelope scanner is string-aware (braces inside string values no longer break confidence/verdict parsing).
|
|
35
|
+
- **Ctrl+C x2 returns to menu even mid-task** (was dropped while a task was running).
|
|
36
|
+
- **No dead-end runs**: starting a task with no signed-in provider now prompts you to sign in instead of failing through the tiers.
|
|
37
|
+
- **Inline re-login retries with refreshed auth** (was reusing stale provider state).
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- **Conversation feels like a chat**: the per-message prompt is now a plain > (not myshell-tools>), and the verbose Classified: routing line is hidden unless MYSHELL_DEBUG is set — the model's reply is the focus.
|
|
41
|
+
|
|
42
|
+
### Security
|
|
43
|
+
- Credentials file is created with 0600 and its dir 0700 from the start (no world-readable race) — see 2.16.x.
|
|
44
|
+
|
|
14
45
|
## [2.15.0]
|
|
15
46
|
|
|
16
47
|
### Changed
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`myshell-tools` routes each task to the *cheapest* model likely to succeed, runs it on your real codebase, optionally has a **different vendor** review the result, and shows you exactly what it did and what it truly cost — with **no fabricated data, ever**.
|
|
6
6
|
|
|
7
|
-
> **Status: `
|
|
7
|
+
> **Status: `3.0.0` — honest, tested, and real.** Claude, Codex, and opencode (experimental) all work, provider auth is detected for real, and the tool notifies you when a newer version is available.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -92,11 +92,13 @@ The globally-installed CLI includes the **update notifier**: it checks the npm r
|
|
|
92
92
|
|
|
93
93
|
Press `u` to install the update in-place (`npm install -g myshell-tools@latest`). No relaunch is forced — restart the CLI when you're ready.
|
|
94
94
|
|
|
95
|
-
You can also enable **auto-update** so the CLI updates and relaunches itself silently at startup
|
|
95
|
+
You can also enable **auto-update** so the CLI updates and relaunches itself silently at startup. Auto-update is **on by default** — the first-run prompt asks `Keep myshell-tools up to date automatically? (Y/n)` and defaults to yes.
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
97
|
+
To opt out:
|
|
98
|
+
- During first-run setup: answer `n` to the `Keep myshell-tools up to date automatically? (Y/n)` prompt.
|
|
99
|
+
- In the control panel: `[s] Settings → [3] Auto-update: on → off`.
|
|
100
|
+
- Or set `"autoUpdate": false` in `~/.myshell-tools/config.json`.
|
|
101
|
+
- Or set `MYSHELL_NO_UPDATE=1` in your environment to disable auto-update permanently without changing config.
|
|
100
102
|
|
|
101
103
|
To update manually at any time:
|
|
102
104
|
|
|
@@ -204,7 +206,7 @@ classify ─▶ route(cheapest tier) ─▶ run ─▶ assess
|
|
|
204
206
|
This is a ground‑up rebuild whose first principle is: **the tool never shows fabricated, mocked, or randomized data as if it were real.** It's enforced, not promised:
|
|
205
207
|
|
|
206
208
|
- **Architecture guard tests** fail the build if the UI/command layers contain hardcoded "AI responses", fake metrics, or a digit‑then‑`%` literal; if the orchestration core touches the filesystem, clock, or RNG directly; or if any module other than the entry point can terminate the process.
|
|
207
|
-
- **
|
|
209
|
+
- **An extensive unit + architecture-guard suite** (plus contract tests with parsers pinned to *recorded real transcripts*), with `tsc --strict`, ESLint, and a clean `npm pack` checked in CI across Windows / macOS / Linux.
|
|
208
210
|
|
|
209
211
|
---
|
|
210
212
|
|
|
@@ -239,24 +241,6 @@ npm run build # tsc → dist/
|
|
|
239
241
|
|
|
240
242
|
---
|
|
241
243
|
|
|
242
|
-
## Status & roadmap
|
|
243
|
-
|
|
244
|
-
Honest snapshot of `2.0.0-alpha.0`:
|
|
245
|
-
|
|
246
|
-
| Area | State |
|
|
247
|
-
| --- | --- |
|
|
248
|
-
| Core routing + escalation + cross‑vendor review loop | ✅ implemented & unit‑proven |
|
|
249
|
-
| Claude adapter | ✅ live, validated end‑to‑end on real models |
|
|
250
|
-
| Codex adapter | ✅ built; auto‑activates once `codex` is installed + authed |
|
|
251
|
-
| opencode adapter (experimental) | ✅ auto-detected; free models work without keys |
|
|
252
|
-
| Routing prefers advertised models (never routes to unavailable model) | ✅ |
|
|
253
|
-
| `doctor` / `cost` / REPL / streaming UI | ✅ |
|
|
254
|
-
| Live cross‑vendor demonstration | ⏳ pending Codex auth |
|
|
255
|
-
| Cross‑OS CI run | ⏳ pending a public remote |
|
|
256
|
-
| npm publish | ⏳ alpha |
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
244
|
## License
|
|
261
245
|
|
|
262
246
|
MIT — see [LICENSE](LICENSE).
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { execa } from 'execa';
|
|
|
10
10
|
import { systemClock } from './infra/clock.js';
|
|
11
11
|
import { createSessionWriter } from './infra/session.js';
|
|
12
12
|
import { createLedger } from './infra/ledger.js';
|
|
13
|
-
import { DEFAULT_POLICY } from './core/policy.js';
|
|
13
|
+
import { DEFAULT_POLICY, POLICY_PRESETS } from './core/policy.js';
|
|
14
14
|
import { runTask } from './interface/run.js';
|
|
15
15
|
import { startRepl } from './interface/repl.js';
|
|
16
16
|
import { startMenu } from './interface/menu.js';
|
|
@@ -26,7 +26,6 @@ import { runInstall } from './commands/install.js';
|
|
|
26
26
|
import { banner } from './ui/banner.js';
|
|
27
27
|
import { createSpinner } from './ui/spinner.js';
|
|
28
28
|
import { dim } from './ui/theme.js';
|
|
29
|
-
import { applyStoredCredentials } from './infra/credentials.js';
|
|
30
29
|
const require = createRequire(import.meta.url);
|
|
31
30
|
const pkg = require('../package.json');
|
|
32
31
|
const version = pkg.version;
|
|
@@ -63,12 +62,9 @@ Examples:
|
|
|
63
62
|
|
|
64
63
|
Repository: https://github.com/hey-vera/myshell-tools
|
|
65
64
|
`;
|
|
66
|
-
/** Build the orchestration dependencies
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
buildProviders(cwd),
|
|
70
|
-
detectEnvironment(),
|
|
71
|
-
]);
|
|
65
|
+
/** Build the orchestration dependencies from a pre-detected EnvironmentStatus. */
|
|
66
|
+
function buildDeps(cwd, env, policy = DEFAULT_POLICY) {
|
|
67
|
+
const providers = buildProviders(cwd, env);
|
|
72
68
|
// Populate advertised model lists from detection so route() can prefer a
|
|
73
69
|
// model the provider CLI actually has. Only include installed providers.
|
|
74
70
|
const availableModels = {};
|
|
@@ -94,7 +90,7 @@ async function buildDeps(cwd) {
|
|
|
94
90
|
clock: systemClock,
|
|
95
91
|
session: createSessionWriter({ cwd, id: systemClock.uuid() }),
|
|
96
92
|
ledger: createLedger({ cwd }),
|
|
97
|
-
policy
|
|
93
|
+
policy,
|
|
98
94
|
providers,
|
|
99
95
|
cwd,
|
|
100
96
|
sandbox: 'workspace-write',
|
|
@@ -114,10 +110,6 @@ function welcome(deps, color) {
|
|
|
114
110
|
'(diagnose: myshell-tools doctor)', color);
|
|
115
111
|
}
|
|
116
112
|
async function main() {
|
|
117
|
-
// Inject any previously-saved Claude OAuth token into process.env before any
|
|
118
|
-
// detection or provider spawn so `claude auth status` and `claude -p …` both
|
|
119
|
-
// see it without the user needing to export CLAUDE_CODE_OAUTH_TOKEN manually.
|
|
120
|
-
await applyStoredCredentials(process.env);
|
|
121
113
|
const args = process.argv.slice(2);
|
|
122
114
|
if (args.includes('--help') || args.includes('-h')) {
|
|
123
115
|
process.stdout.write(HELP);
|
|
@@ -168,7 +160,9 @@ async function main() {
|
|
|
168
160
|
process.stderr.write('myshell-tools run: expected a task description\n');
|
|
169
161
|
process.exit(1);
|
|
170
162
|
}
|
|
171
|
-
const
|
|
163
|
+
const [env, config] = await Promise.all([detectEnvironment(), loadConfig()]);
|
|
164
|
+
const policy = POLICY_PRESETS[config.mode ?? 'balanced'];
|
|
165
|
+
const deps = buildDeps(cwd, env, policy);
|
|
172
166
|
const result = await runTask(taskParts.join(' '), deps, out, new AbortController().signal);
|
|
173
167
|
process.exit(result.code);
|
|
174
168
|
}
|
|
@@ -176,11 +170,11 @@ async function main() {
|
|
|
176
170
|
if (args.length === 0) {
|
|
177
171
|
const spinner = createSpinner(out);
|
|
178
172
|
spinner.start('Detecting providers…');
|
|
179
|
-
const [
|
|
180
|
-
buildProviders(cwd),
|
|
173
|
+
const [env, config] = await Promise.all([
|
|
181
174
|
detectEnvironment(),
|
|
182
175
|
loadConfig(),
|
|
183
176
|
]);
|
|
177
|
+
const providers = buildProviders(cwd, env);
|
|
184
178
|
spinner.stop();
|
|
185
179
|
const store = createFileConversationStore({ clock: systemClock });
|
|
186
180
|
const ledger = createLedger({ cwd });
|
|
@@ -230,7 +224,8 @@ async function main() {
|
|
|
230
224
|
out.write(banner(version, out.color) + '\n');
|
|
231
225
|
const spinner = createSpinner(out);
|
|
232
226
|
spinner.start('Detecting providers…');
|
|
233
|
-
const
|
|
227
|
+
const env = await detectEnvironment();
|
|
228
|
+
const deps = buildDeps(cwd, env);
|
|
234
229
|
spinner.stop();
|
|
235
230
|
out.write(welcome(deps, out.color) + '\n\n');
|
|
236
231
|
await startRepl(deps, out);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB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IAED,+EAA+E;IAC/E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,mCAAmC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,0CAA0C,CAC3F,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/commands/cost.js
CHANGED
|
@@ -55,8 +55,12 @@ export function formatCostReport(entries, color = false) {
|
|
|
55
55
|
lines.push(bold('myshell-tools cost', color));
|
|
56
56
|
lines.push(divider(color));
|
|
57
57
|
// ---- Summary ---------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// The total is provider-reported where the provider supplies cost in its
|
|
59
|
+
// output (Claude, opencode step_finish), and estimated from list prices for
|
|
60
|
+
// providers that do not report cost (Codex). We therefore avoid claiming this
|
|
61
|
+
// is "as billed" — it may include estimates.
|
|
62
|
+
lines.push(`${label('Total cost', color)}: $${summary.totalUsd.toFixed(4)} ` +
|
|
63
|
+
`${dim('(provider-reported where available, otherwise estimated from list prices)', color)}`);
|
|
60
64
|
lines.push(`${label('Total calls', color)}: ${summary.calls}`);
|
|
61
65
|
lines.push(divider(color));
|
|
62
66
|
// ---- Per-model breakdown ---------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../../src/commands/cost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAA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R,GAAG,CAAC,0EAA0E,EAAE,KAAK,CAAC,CACvF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8EAA8E;AAC9E,gCAAgC;AAChC,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,GAAe;IACxD,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -58,7 +58,12 @@ export function buildDoctorReport(env, extras, color) {
|
|
|
58
58
|
if (ps.installed) {
|
|
59
59
|
const versionStr = ps.version !== null ? ps.version : 'unknown';
|
|
60
60
|
lines.push(` ${green('✓', color)} ${bold(ps.id, color)} — installed, version: ${versionStr}`);
|
|
61
|
-
if (ps.
|
|
61
|
+
if (ps.id === 'opencode') {
|
|
62
|
+
// opencode auth was never probed — it is usable via free models without
|
|
63
|
+
// sign-in. Saying "signed in" would be dishonest.
|
|
64
|
+
lines.push(` ${label('auth', color)}: ${green('free models (no sign-in needed)', color)}`);
|
|
65
|
+
}
|
|
66
|
+
else if (ps.authenticated) {
|
|
62
67
|
const planLabel = ps.plan !== null ? ` (${ps.plan})` : '';
|
|
63
68
|
lines.push(` ${label('auth', color)}: ${green('signed in', color)}${planLabel}`);
|
|
64
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,QAAQ,MAAM,eAAe,C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AAK,CAAC,CAAC,CAAC;QAClE,CAAC;aAAM,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;YACxB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,+BAA+B,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,oBAAoB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -11,13 +11,11 @@
|
|
|
11
11
|
* containers / over SSH (Replit, Codespaces, etc.) where localhost can't be
|
|
12
12
|
* reached from the user's browser.
|
|
13
13
|
* - 'code': a no-localhost flow that works anywhere.
|
|
14
|
-
* · claude → `claude setup-token`:
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* (
|
|
18
|
-
*
|
|
19
|
-
* back to prompting the user to paste it (up to 3 retries, with helpful
|
|
20
|
-
* warnings for blank or wrong-type inputs).
|
|
14
|
+
* · claude → `claude setup-token`: spawned with fully inherited stdio so
|
|
15
|
+
* the native spinner/animation renders cleanly. After the process exits
|
|
16
|
+
* successfully, the user is prompted to paste the token (sk-ant-oat…)
|
|
17
|
+
* back here (up to 3 retries, with helpful warnings for blank or
|
|
18
|
+
* wrong-type inputs).
|
|
21
19
|
* · codex → `codex login --device-auth`: prints a URL + one-time code;
|
|
22
20
|
* the user authorizes their ChatGPT account on any device.
|
|
23
21
|
*
|
|
@@ -25,9 +23,8 @@
|
|
|
25
23
|
* to 'code' (so the localhost trap is avoided), everything else to 'browser'.
|
|
26
24
|
*
|
|
27
25
|
* Security: myshell-tools never stores raw API keys or passwords. The Claude
|
|
28
|
-
* OAuth token (sk-ant-oat…) is
|
|
29
|
-
*
|
|
30
|
-
* ~/.myshell-tools/credentials.json (mode 0o600).
|
|
26
|
+
* OAuth token (sk-ant-oat…) is captured after the user explicitly pastes it,
|
|
27
|
+
* and is stored in ~/.myshell-tools/credentials.json (mode 0o600).
|
|
31
28
|
*/
|
|
32
29
|
import type { OutputSink } from '../interface/render.js';
|
|
33
30
|
import type { ProviderId } from '../providers/port.js';
|
|
@@ -52,6 +49,17 @@ export declare function isHeadlessEnv(env: NodeJS.ProcessEnv, platform: NodeJS.P
|
|
|
52
49
|
* Pure / testable.
|
|
53
50
|
*/
|
|
54
51
|
export declare function resolveLoginMethod(explicit: LoginMethod | undefined, env: NodeJS.ProcessEnv, platform: NodeJS.Platform): LoginMethod;
|
|
52
|
+
/**
|
|
53
|
+
* Decide whether to retry a failed browser sign-in using the code method,
|
|
54
|
+
* based on the user's answer to the interactive prompt.
|
|
55
|
+
*
|
|
56
|
+
* Wraps {@link parseYesNo} with `defaultYes=true` (pressing Enter accepts the
|
|
57
|
+
* retry). Pure / hermetically testable.
|
|
58
|
+
*
|
|
59
|
+
* @param answer - Raw line from readLine(), or null on EOF.
|
|
60
|
+
* @returns True if the code method should be retried; false if not.
|
|
61
|
+
*/
|
|
62
|
+
export declare function shouldRetryWithCode(answer: string | null): boolean;
|
|
55
63
|
/**
|
|
56
64
|
* Run the interactive sign-in flow for one provider (or all installed providers
|
|
57
65
|
* when no argument is given). Returns 0 on success, 1 only for an invalid
|
package/dist/commands/login.js
CHANGED
|
@@ -11,13 +11,11 @@
|
|
|
11
11
|
* containers / over SSH (Replit, Codespaces, etc.) where localhost can't be
|
|
12
12
|
* reached from the user's browser.
|
|
13
13
|
* - 'code': a no-localhost flow that works anywhere.
|
|
14
|
-
* · claude → `claude setup-token`:
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* (
|
|
18
|
-
*
|
|
19
|
-
* back to prompting the user to paste it (up to 3 retries, with helpful
|
|
20
|
-
* warnings for blank or wrong-type inputs).
|
|
14
|
+
* · claude → `claude setup-token`: spawned with fully inherited stdio so
|
|
15
|
+
* the native spinner/animation renders cleanly. After the process exits
|
|
16
|
+
* successfully, the user is prompted to paste the token (sk-ant-oat…)
|
|
17
|
+
* back here (up to 3 retries, with helpful warnings for blank or
|
|
18
|
+
* wrong-type inputs).
|
|
21
19
|
* · codex → `codex login --device-auth`: prints a URL + one-time code;
|
|
22
20
|
* the user authorizes their ChatGPT account on any device.
|
|
23
21
|
*
|
|
@@ -25,14 +23,14 @@
|
|
|
25
23
|
* to 'code' (so the localhost trap is avoided), everything else to 'browser'.
|
|
26
24
|
*
|
|
27
25
|
* Security: myshell-tools never stores raw API keys or passwords. The Claude
|
|
28
|
-
* OAuth token (sk-ant-oat…) is
|
|
29
|
-
*
|
|
30
|
-
* ~/.myshell-tools/credentials.json (mode 0o600).
|
|
26
|
+
* OAuth token (sk-ant-oat…) is captured after the user explicitly pastes it,
|
|
27
|
+
* and is stored in ~/.myshell-tools/credentials.json (mode 0o600).
|
|
31
28
|
*/
|
|
32
29
|
import readline from 'node:readline';
|
|
33
30
|
import { execa } from 'execa';
|
|
34
31
|
import { detectProvider, getInstallCommand } from '../providers/detect.js';
|
|
35
32
|
import { bold, dim, green, red, yellow } from '../ui/theme.js';
|
|
33
|
+
import { parseYesNo } from '../interface/menu.js';
|
|
36
34
|
import { classifyPastedSecret, extractClaudeToken, saveClaudeToken, stripPastedSecretWrapper, } from '../infra/credentials.js';
|
|
37
35
|
/** Each provider's default (browser/localhost) sign-in command. */
|
|
38
36
|
const LOGIN_COMMAND = {
|
|
@@ -52,9 +50,8 @@ const LOGIN_CODE_COMMAND = {
|
|
|
52
50
|
args: ['setup-token'],
|
|
53
51
|
guidance: 'A sign-in link will appear below.\n' +
|
|
54
52
|
' 1. Open it in any browser and sign in at claude.ai.\n' +
|
|
55
|
-
' 2. Copy the
|
|
56
|
-
' 3.
|
|
57
|
-
' We will capture the token automatically when possible.',
|
|
53
|
+
' 2. Copy the token it shows you (starts with sk-ant-oat).\n' +
|
|
54
|
+
' 3. When prompted below, paste it here and press Enter.',
|
|
58
55
|
},
|
|
59
56
|
codex: {
|
|
60
57
|
bin: 'codex',
|
|
@@ -114,6 +111,51 @@ export function resolveLoginMethod(explicit, env, platform) {
|
|
|
114
111
|
return explicit;
|
|
115
112
|
return isHeadlessEnv(env, platform) ? 'code' : 'browser';
|
|
116
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Decide whether to retry a failed browser sign-in using the code method,
|
|
116
|
+
* based on the user's answer to the interactive prompt.
|
|
117
|
+
*
|
|
118
|
+
* Wraps {@link parseYesNo} with `defaultYes=true` (pressing Enter accepts the
|
|
119
|
+
* retry). Pure / hermetically testable.
|
|
120
|
+
*
|
|
121
|
+
* @param answer - Raw line from readLine(), or null on EOF.
|
|
122
|
+
* @returns True if the code method should be retried; false if not.
|
|
123
|
+
*/
|
|
124
|
+
export function shouldRetryWithCode(answer) {
|
|
125
|
+
return parseYesNo(answer, true);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Run the code sign-in method for a single provider.
|
|
129
|
+
*
|
|
130
|
+
* Factored out so both the initial `--code` path and the browser-fail retry
|
|
131
|
+
* path can invoke it without duplicating the spawn + paste-capture logic.
|
|
132
|
+
* Never throws.
|
|
133
|
+
*/
|
|
134
|
+
async function runCodeMethodForProvider(out, id, readLine) {
|
|
135
|
+
const { bin, args, guidance } = LOGIN_CODE_COMMAND[id];
|
|
136
|
+
out.write(bold(`\nSigning in to ${id} — code method (no localhost needed).\n`, out.color));
|
|
137
|
+
out.write(dim(guidance + '\n', out.color));
|
|
138
|
+
const result = await execa(bin, [...args], { stdin: 'inherit', stdout: 'inherit', stderr: 'inherit', reject: false });
|
|
139
|
+
if (result.exitCode === 0) {
|
|
140
|
+
if (id === 'claude') {
|
|
141
|
+
// `claude setup-token` ran with inherited stdio (so the native animation
|
|
142
|
+
// rendered cleanly). Now prompt the user to paste the token it printed.
|
|
143
|
+
// captureClaudeTokenWithPaste reports its own success/failure messages.
|
|
144
|
+
await captureClaudeTokenWithPaste(out, readLine);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
out.write(green(`✓ ${id} sign-in complete.\n`, out.color));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (id === 'claude') {
|
|
152
|
+
out.write(red(`✗ claude setup-token did not complete (exit ${result.exitCode ?? 'unknown'}). Run it manually: claude setup-token\n`, out.color));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
out.write(red(`✗ ${id} sign-in did not complete (exit ${result.exitCode ?? 'unknown'}).\n`, out.color));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
117
159
|
/**
|
|
118
160
|
* Run the interactive sign-in flow for one provider (or all installed providers
|
|
119
161
|
* when no argument is given). Returns 0 on success, 1 only for an invalid
|
|
@@ -144,117 +186,47 @@ export async function runLogin(out, providerArg, opts) {
|
|
|
144
186
|
out.write(dim(`${id}: not installed — skipping. Install with: ${getInstallCommand(id)}\n`, out.color));
|
|
145
187
|
continue;
|
|
146
188
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// and stderr are piped so we can scan for the token, but each line is also
|
|
152
|
-
// written verbatim to the real terminal so the user sees the flow live.
|
|
153
|
-
// stdin is still inherited so the user can interact (paste the auth code).
|
|
154
|
-
let result;
|
|
155
|
-
let capturedOutput = '';
|
|
156
|
-
if (method === 'code' && id === 'claude') {
|
|
157
|
-
const { bin, args, guidance } = LOGIN_CODE_COMMAND[id];
|
|
158
|
-
out.write(bold(`\nSigning in to ${id} — code method (no localhost needed).\n`, out.color));
|
|
159
|
-
out.write(dim(guidance + '\n', out.color));
|
|
160
|
-
capturedOutput = await runWithTeeCapture(bin, [...args]);
|
|
161
|
-
// We use a synthetic exit-code-0 result — tee-capture never throws, and
|
|
162
|
-
// we treat the flow as complete regardless of the subprocess exit code
|
|
163
|
-
// (the token presence is the real signal).
|
|
164
|
-
result = { exitCode: 0 };
|
|
165
|
-
}
|
|
166
|
-
else if (method === 'code') {
|
|
167
|
-
const { bin, args, guidance } = LOGIN_CODE_COMMAND[id];
|
|
168
|
-
out.write(bold(`\nSigning in to ${id} — code method (no localhost needed).\n`, out.color));
|
|
169
|
-
out.write(dim(guidance + '\n', out.color));
|
|
170
|
-
result = await execa(bin, [...args], { stdin: 'inherit', stdout: 'inherit', stderr: 'inherit', reject: false });
|
|
189
|
+
if (method === 'code') {
|
|
190
|
+
// stdio:'inherit' hands the terminal to the provider CLI so its OAuth /
|
|
191
|
+
// device / paste flow runs in place.
|
|
192
|
+
await runCodeMethodForProvider(out, id, opts?.readLine);
|
|
171
193
|
}
|
|
172
194
|
else {
|
|
195
|
+
// Browser method
|
|
173
196
|
const { bin, args } = LOGIN_COMMAND[id];
|
|
174
197
|
out.write(bold(`\nSigning in to ${id} — a browser window may open…\n`, out.color));
|
|
175
|
-
result = await execa(bin, [...args], { stdin: 'inherit', stdout: 'inherit', stderr: 'inherit', reject: false });
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
out.write(green('✓ Claude token captured and saved — claude is now ready.\n', out.color));
|
|
198
|
+
const result = await execa(bin, [...args], { stdin: 'inherit', stdout: 'inherit', stderr: 'inherit', reject: false });
|
|
199
|
+
if (result.exitCode === 0) {
|
|
200
|
+
out.write(green(`✓ ${id} sign-in complete.\n`, out.color));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
out.write(red(`✗ ${id} sign-in did not complete (exit ${result.exitCode ?? 'unknown'}).\n`, out.color));
|
|
204
|
+
// The classic container failure mode is a dead localhost callback.
|
|
205
|
+
// When an interactive readline is available, offer to immediately retry
|
|
206
|
+
// using the no-localhost code method. Otherwise print the manual hint.
|
|
207
|
+
if (opts?.readLine !== undefined) {
|
|
208
|
+
out.write(`Browser sign-in failed. Try the no-localhost code method now? (Y/n) `);
|
|
209
|
+
const ans = await opts.readLine();
|
|
210
|
+
if (shouldRetryWithCode(ans)) {
|
|
211
|
+
await runCodeMethodForProvider(out, id, opts.readLine);
|
|
190
212
|
}
|
|
191
|
-
|
|
192
|
-
out.write(dim(
|
|
213
|
+
else {
|
|
214
|
+
out.write(dim(`If the browser/localhost step failed, try the code method instead:\n` +
|
|
215
|
+
` myshell-tools login ${id} --code\n`, out.color));
|
|
193
216
|
}
|
|
194
217
|
}
|
|
195
218
|
else {
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
await captureClaudeTokenWithPaste(out, opts?.readLine);
|
|
219
|
+
// Non-interactive path: print the hint as before.
|
|
220
|
+
out.write(dim(`If the browser/localhost step failed, try the code method instead:\n` +
|
|
221
|
+
` myshell-tools login ${id} --code\n`, out.color));
|
|
200
222
|
}
|
|
201
223
|
}
|
|
202
|
-
else {
|
|
203
|
-
out.write(green(`✓ ${id} sign-in complete.\n`, out.color));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
out.write(red(`✗ ${id} sign-in did not complete (exit ${result.exitCode ?? 'unknown'}).\n`, out.color));
|
|
208
|
-
// The classic container failure mode is a dead localhost callback. Point
|
|
209
|
-
// the user at the code method, which sidesteps localhost entirely.
|
|
210
|
-
if (method === 'browser') {
|
|
211
|
-
out.write(dim(`If the browser/localhost step failed, try the code method instead:\n` +
|
|
212
|
-
` myshell-tools login ${id} --code\n`, out.color));
|
|
213
|
-
}
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
226
|
return 0;
|
|
217
227
|
}
|
|
218
228
|
// ---------------------------------------------------------------------------
|
|
219
|
-
//
|
|
220
|
-
// ---------------------------------------------------------------------------
|
|
221
|
-
/**
|
|
222
|
-
* Run a command with stdout and stderr piped (tee'd to the real terminal) and
|
|
223
|
-
* stdin inherited. Returns the accumulated stdout+stderr text, or an empty
|
|
224
|
-
* string on spawn failure. Never throws.
|
|
225
|
-
*
|
|
226
|
-
* Uses execa v9's `all: true` option to merge stdout+stderr into one stream,
|
|
227
|
-
* then iterates it via `subprocess.iterable({ from: 'all', preserveNewlines: true })`
|
|
228
|
-
* while mirroring each chunk to `process.stdout` so the user sees the output
|
|
229
|
-
* live. stdin is inherited so the user can interact (e.g. paste an auth code).
|
|
230
|
-
*/
|
|
231
|
-
async function runWithTeeCapture(bin, args) {
|
|
232
|
-
try {
|
|
233
|
-
const subprocess = execa(bin, [...args], {
|
|
234
|
-
stdin: 'inherit',
|
|
235
|
-
stdout: 'pipe',
|
|
236
|
-
stderr: 'pipe',
|
|
237
|
-
all: true,
|
|
238
|
-
reject: false,
|
|
239
|
-
timeout: 300_000,
|
|
240
|
-
});
|
|
241
|
-
const chunks = [];
|
|
242
|
-
for await (const line of subprocess.iterable({ from: 'all', preserveNewlines: true })) {
|
|
243
|
-
const text = typeof line === 'string' ? line : String(line);
|
|
244
|
-
process.stdout.write(text);
|
|
245
|
-
chunks.push(text);
|
|
246
|
-
}
|
|
247
|
-
await subprocess; // wait for exit (already resolved by the iteration above)
|
|
248
|
-
return chunks.join('');
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
// Spawn error or unexpected failure — return empty so the caller falls back
|
|
252
|
-
// to the paste prompt.
|
|
253
|
-
return '';
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// ---------------------------------------------------------------------------
|
|
257
|
-
// Paste-fallback token capture helper (internal)
|
|
229
|
+
// Paste token capture helper (internal)
|
|
258
230
|
// ---------------------------------------------------------------------------
|
|
259
231
|
/**
|
|
260
232
|
* Prompt the user to paste the token shown by `claude setup-token`, extract
|