myshell-tools 2.8.0 → 2.13.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 +38 -0
- package/README.md +34 -3
- package/dist/cli.js +35 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts +36 -1
- package/dist/commands/doctor.js +130 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/install.d.ts +5 -0
- package/dist/commands/install.js +16 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.d.ts +8 -5
- package/dist/commands/login.js +143 -44
- package/dist/commands/login.js.map +1 -1
- package/dist/core/classify.d.ts +20 -4
- package/dist/core/classify.js +241 -43
- package/dist/core/classify.js.map +1 -1
- package/dist/core/orchestrate.js +115 -85
- package/dist/core/orchestrate.js.map +1 -1
- package/dist/core/types.d.ts +10 -0
- package/dist/infra/config.d.ts +6 -0
- package/dist/infra/config.js.map +1 -1
- package/dist/infra/credentials.d.ts +28 -0
- package/dist/infra/credentials.js +52 -1
- package/dist/infra/credentials.js.map +1 -1
- package/dist/infra/update-check.d.ts +67 -0
- package/dist/infra/update-check.js +181 -0
- package/dist/infra/update-check.js.map +1 -0
- package/dist/interface/menu.d.ts +69 -0
- package/dist/interface/menu.js +334 -30
- package/dist/interface/menu.js.map +1 -1
- package/dist/interface/render.js +8 -1
- package/dist/interface/render.js.map +1 -1
- package/dist/interface/run.d.ts +12 -3
- package/dist/interface/run.js +3 -3
- package/dist/interface/run.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,44 @@ 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.13.0]
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- **Cross-vendor failover**: when a provider errors mid-task, the orchestrator now retries the same tier on another available vendor (emitting a `failover` event) before escalating — so a transient outage on one vendor doesn't sink the task. Single-provider behavior is unchanged.
|
|
18
|
+
- **Inline re-login on auth failure**: if a task fails because a provider isn't signed in, the conversation offers `Sign in to <provider> now and retry? (Y/n)` and, on yes, signs in and re-runs the task once. The failing provider + error category are now carried on the final event.
|
|
19
|
+
- **Live cost meter**: each tier-done line now shows a running `session so far: $X` total as a task progresses, not just the final total.
|
|
20
|
+
- **`doctor --fix`**: `myshell-tools doctor --fix` interactively offers to install missing providers and sign in to unauthenticated ones, then re-checks — instead of only reporting.
|
|
21
|
+
- **Raw-session escape (Unix)**: inside a raw `[r]` native session, pressing Ctrl+C twice quickly returns you to the myshell menu (best-effort, Unix-only; single Ctrl+C still reaches the native CLI). No-op on Windows.
|
|
22
|
+
|
|
23
|
+
## [2.12.0]
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **Shell quick-keys**: when you enable "set as default shell", the guarded startup hook now also defines `cm` and `mst` aliases (both open the control panel) so the menu is one keystroke from any shell prompt after you exit it. Fully reversible via `myshell-tools uninstall` (the whole block is stripped).
|
|
27
|
+
|
|
28
|
+
## [2.11.0]
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Ctrl+C escape model in conversations** (DATA-Tools-style): while in a conversation, `Ctrl+C` once cancels the running task (or hints when idle), **twice** returns to the control-panel menu, and **three times** exits to the shell — all within a ~1.5s window. Implemented with pure, tested helpers (`countRecentInterrupts`, `interpretInterrupt`); the menu is now always one gesture away. (Escaping from *inside* a raw native `claude`/`codex` passthrough session is a separate, Unix-specific follow-up.)
|
|
32
|
+
|
|
33
|
+
## [2.10.0]
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- **Claude token auto-capture (no paste step)**: `login claude --code` now tees the `claude setup-token` output and automatically extracts the `sk-ant-oat…` token — you no longer have to copy/paste it. A robust paste fallback remains for when auto-capture can't read it: it retries (up to 3×), strips surrounding quotes/whitespace, and gives a specific warning if you paste an Anthropic **API key** (`sk-ant-api…`) instead of the **OAuth token** (`sk-ant-oat…`). New pure helpers `classifyPastedSecret` / `stripPastedSecretWrapper` in `src/infra/credentials.ts`.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- **Smarter task classifier**: tier selection is now multi-signal scored — read/lookup phrasing → worker, edit/implement verbs → ic, design/review/security/audit/architecture → manager (deterministic tie-break manager > ic > worker, default ic). Risk signals were tightened with word boundaries (no more false hits like "keyboard") and expanded (oauth, api key, private key, jwt, session → critical; production, release, rollback, terraform, kubernetes, docker, db migration → high; lint, ci, build, dependencies → medium). Still pure/deterministic; the `rationale` names every matched signal so routing stays auditable.
|
|
40
|
+
- **Internal**: the duplicated provider-streaming loop in the orchestrator (IC run vs cross-vendor review run) is now a single shared `streamProvider` generator — behavior-identical (no test changes), just less duplication in the most critical code path.
|
|
41
|
+
|
|
42
|
+
## [2.9.0]
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- **Update notifier**: myshell-tools now checks the npm registry (once per 24h, cached) for a newer version and shows a banner `▲ Update available: <current> → <latest> (press u)` in the control-panel header when one is found. The check is injected via a seam in tests so no real npm requests are made during the test suite.
|
|
46
|
+
- **`[u] Update now`**: a new Options menu entry appears only when an update is available. Pressing `u` runs `npm install -g myshell-tools@latest` (stdio inherit) and prints `✓ Updated to <latest> — restart myshell-tools to use it.` on success. The manual `[u]` path does not auto-relaunch — restart is explicit and safe.
|
|
47
|
+
- **Opt-in auto-update**: when `autoUpdate: true` is set in config, myshell-tools updates itself at launch (before entering the main loop) and relaunches the freshly-installed binary. On failure it prints a note and continues to the menu normally.
|
|
48
|
+
- **`autoUpdate` config flag** (`src/infra/config.ts`): new optional boolean field in `AppConfig`. Absent/false = notify-only banner. True = auto-update at launch. Merged over defaults so old config files are unaffected.
|
|
49
|
+
- **Wizard auto-update prompt**: the first-run welcome wizard now asks `Keep myshell-tools up to date automatically? (y/N)` after set-as-default, using the standard `(y/N)` convention (Enter → no).
|
|
50
|
+
- **Settings `[3] Auto-update` toggle**: the Settings screen (`[s]`) now lists `[3] Auto-update: on/off`; selecting it flips the flag and persists the updated config.
|
|
51
|
+
|
|
14
52
|
## [2.8.0]
|
|
15
53
|
|
|
16
54
|
### Added
|
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: `2.
|
|
7
|
+
> **Status: `2.13.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
|
|
|
@@ -69,10 +69,41 @@ You need **one** to start; install **both** claude and codex to unlock cross‑v
|
|
|
69
69
|
|
|
70
70
|
| Method | Command | Notes |
|
|
71
71
|
|--------|---------|-------|
|
|
72
|
-
| Zero-install (
|
|
73
|
-
| Global install | `npm install -g myshell-tools` then `myshell-tools` |
|
|
72
|
+
| Zero-install (one-time) | `npx myshell-tools` | Fetches and runs; first-run setup included |
|
|
73
|
+
| Global install (recommended for regular use) | `npm install -g myshell-tools` then `myshell-tools` | Fastest; gets the update notifier |
|
|
74
74
|
| From source | See below | For development |
|
|
75
75
|
|
|
76
|
+
### `npx` vs. `npm install -g` — which to choose?
|
|
77
|
+
|
|
78
|
+
`npx myshell-tools` is convenient for a one-off run but **caches the downloaded version** — subsequent invocations reuse the cache and **will not pick up new releases** automatically.
|
|
79
|
+
|
|
80
|
+
For day-to-day use, a global install is recommended:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g myshell-tools
|
|
84
|
+
myshell-tools
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The globally-installed CLI includes the **update notifier**: it checks the npm registry once per 24 hours (cached, non-blocking) and shows a banner in the control panel when a newer version is available:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
▲ Update available: 2.9.0 → 3.0.0 (press u)
|
|
91
|
+
```
|
|
92
|
+
|
|
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
|
+
|
|
95
|
+
You can also enable **auto-update** so the CLI updates and relaunches itself silently at startup:
|
|
96
|
+
|
|
97
|
+
- During first-run setup: answer `y` to the `Keep myshell-tools up to date automatically? (y/N)` prompt.
|
|
98
|
+
- In the control panel: `[s] Settings → [3] Auto-update: off → on`.
|
|
99
|
+
- Or set `"autoUpdate": true` in `~/.myshell-tools/config.json`.
|
|
100
|
+
|
|
101
|
+
To update manually at any time:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install -g myshell-tools@latest
|
|
105
|
+
```
|
|
106
|
+
|
|
76
107
|
### From source
|
|
77
108
|
|
|
78
109
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* All other modules return values and let this file decide the exit code.
|
|
7
7
|
*/
|
|
8
8
|
import { createRequire } from 'node:module';
|
|
9
|
+
import { execa } from 'execa';
|
|
9
10
|
import { systemClock } from './infra/clock.js';
|
|
10
11
|
import { createSessionWriter } from './infra/session.js';
|
|
11
12
|
import { createLedger } from './infra/ledger.js';
|
|
@@ -17,6 +18,7 @@ import { buildProviders } from './providers/registry.js';
|
|
|
17
18
|
import { detectEnvironment } from './providers/detect.js';
|
|
18
19
|
import { createFileConversationStore } from './infra/conversations.js';
|
|
19
20
|
import { loadConfig } from './infra/config.js';
|
|
21
|
+
import { checkForUpdate } from './infra/update-check.js';
|
|
20
22
|
import { runDoctor } from './commands/doctor.js';
|
|
21
23
|
import { runCost } from './commands/cost.js';
|
|
22
24
|
import { runLogin } from './commands/login.js';
|
|
@@ -45,7 +47,9 @@ Commands:
|
|
|
45
47
|
Add --code to use the no-localhost flow (paste a code for
|
|
46
48
|
claude, device code for codex) — best inside containers /
|
|
47
49
|
over SSH. Add --browser to force the localhost flow.
|
|
48
|
-
doctor
|
|
50
|
+
doctor [--fix] Check provider installation, auth, and environment health.
|
|
51
|
+
Add --fix to interactively install missing providers and
|
|
52
|
+
sign in to unauthenticated ones.
|
|
49
53
|
cost Show real spend from the ledger with a per-model breakdown
|
|
50
54
|
install Write a guarded startup hook to your shell rc file so new
|
|
51
55
|
interactive shells launch myshell-tools automatically
|
|
@@ -135,7 +139,8 @@ async function main() {
|
|
|
135
139
|
process.exit(await runLogin(out, provider, method !== undefined ? { method } : undefined));
|
|
136
140
|
}
|
|
137
141
|
if (args[0] === 'doctor') {
|
|
138
|
-
|
|
142
|
+
const fix = args.includes('--fix');
|
|
143
|
+
process.exit(await runDoctor(out, fix ? { fix: true } : undefined));
|
|
139
144
|
}
|
|
140
145
|
if (args[0] === 'cost') {
|
|
141
146
|
process.exit(await runCost(cwd, out));
|
|
@@ -154,8 +159,8 @@ async function main() {
|
|
|
154
159
|
process.exit(1);
|
|
155
160
|
}
|
|
156
161
|
const deps = await buildDeps(cwd);
|
|
157
|
-
const
|
|
158
|
-
process.exit(code);
|
|
162
|
+
const result = await runTask(taskParts.join(' '), deps, out, new AbortController().signal);
|
|
163
|
+
process.exit(result.code);
|
|
159
164
|
}
|
|
160
165
|
// ---- Interactive Menu (default — sessions-first control panel) ------------
|
|
161
166
|
if (args.length === 0) {
|
|
@@ -180,6 +185,32 @@ async function main() {
|
|
|
180
185
|
cwd,
|
|
181
186
|
sandbox: 'workspace-write',
|
|
182
187
|
timeoutMs: 120000,
|
|
188
|
+
checkForUpdate: () => checkForUpdate({ currentVersion: version, now: Date.now() }),
|
|
189
|
+
updateSelf: async (updateOut) => {
|
|
190
|
+
try {
|
|
191
|
+
const result = await execa('npm', ['install', '-g', 'myshell-tools@latest'], {
|
|
192
|
+
stdio: 'inherit',
|
|
193
|
+
reject: false,
|
|
194
|
+
});
|
|
195
|
+
return result.exitCode === 0;
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
updateOut.write('Update failed — run: npm install -g myshell-tools@latest\n');
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
relaunch: async () => {
|
|
203
|
+
try {
|
|
204
|
+
const result = await execa('myshell-tools', process.argv.slice(2), {
|
|
205
|
+
stdio: 'inherit',
|
|
206
|
+
reject: false,
|
|
207
|
+
});
|
|
208
|
+
return result.exitCode ?? 0;
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
},
|
|
183
214
|
};
|
|
184
215
|
await startMenu(menuCtx, out);
|
|
185
216
|
process.exit(0);
|
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,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;AAGlD,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,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,o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C,CAAC,CAAC;IAClB,CAAC;IAED,+EAA+E;IAC/E,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QACvB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QAC7C,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;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"}
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
* Honesty contract: authentication status is based on real CLI probes
|
|
9
9
|
* (`claude auth status`, `codex login status`). Plan labels are only shown
|
|
10
10
|
* when the CLI output clearly provides them; plan is never fabricated.
|
|
11
|
+
*
|
|
12
|
+
* --fix mode: after printing the normal report, prompts to install missing
|
|
13
|
+
* providers and sign in to installed-but-unauthenticated ones. All I/O seams
|
|
14
|
+
* (detectEnvironment, installProvider, login, readLine) are injectable so tests
|
|
15
|
+
* remain hermetic — no real npm/login/detect spawned in tests.
|
|
11
16
|
*/
|
|
12
17
|
import type { OutputSink } from '../interface/render.js';
|
|
13
18
|
import type { EnvironmentStatus } from '../providers/detect.js';
|
|
@@ -28,10 +33,40 @@ export interface DoctorExtras {
|
|
|
28
33
|
* @param color - Whether to emit ANSI colour codes.
|
|
29
34
|
*/
|
|
30
35
|
export declare function buildDoctorReport(env: EnvironmentStatus, extras: DoctorExtras, color: boolean): string[];
|
|
36
|
+
export interface DoctorFixOpts {
|
|
37
|
+
/** When true, run an interactive fix pass after the report. */
|
|
38
|
+
readonly fix?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Read one line of user input. Used for Y/n prompts in fix mode.
|
|
41
|
+
* When absent, a temporary readline interface is created (real CLI path).
|
|
42
|
+
*/
|
|
43
|
+
readonly readLine?: () => Promise<string | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Install a provider. Injected in tests to avoid real npm spawns.
|
|
46
|
+
* Defaults to the real installProvider from providers/install.ts.
|
|
47
|
+
*/
|
|
48
|
+
readonly installProvider?: (id: 'claude' | 'codex' | 'opencode', out: OutputSink) => Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Sign in to a provider. Injected in tests to avoid real login spawns.
|
|
51
|
+
* Defaults to the real runLogin from commands/login.ts.
|
|
52
|
+
*/
|
|
53
|
+
readonly login?: (out: OutputSink, providerArg?: string) => Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* Detect the environment. Injected in tests to avoid real spawns.
|
|
56
|
+
* Defaults to the real detectEnvironment from providers/detect.ts.
|
|
57
|
+
*/
|
|
58
|
+
readonly detectEnvironment?: () => Promise<EnvironmentStatus>;
|
|
59
|
+
}
|
|
31
60
|
/**
|
|
32
61
|
* Detect the environment, probe I/O, build the report, and write it to `out`.
|
|
33
62
|
*
|
|
63
|
+
* When `opts.fix` is true, runs an interactive fix pass after the report:
|
|
64
|
+
* prompts to install missing providers, re-detects, then prompts to sign in
|
|
65
|
+
* to any installed-but-unauthenticated providers. All I/O seams are injectable
|
|
66
|
+
* via `opts` so tests stay hermetic.
|
|
67
|
+
*
|
|
34
68
|
* Returns 0 when at least one provider is installed, 1 otherwise.
|
|
35
69
|
* Never calls process.exit — that is handled exclusively by src/cli.ts.
|
|
70
|
+
* Never throws — any step failure is reported and the pass continues.
|
|
36
71
|
*/
|
|
37
|
-
export declare function runDoctor(out: OutputSink): Promise<number>;
|
|
72
|
+
export declare function runDoctor(out: OutputSink, opts?: DoctorFixOpts): Promise<number>;
|
package/dist/commands/doctor.js
CHANGED
|
@@ -8,11 +8,20 @@
|
|
|
8
8
|
* Honesty contract: authentication status is based on real CLI probes
|
|
9
9
|
* (`claude auth status`, `codex login status`). Plan labels are only shown
|
|
10
10
|
* when the CLI output clearly provides them; plan is never fabricated.
|
|
11
|
+
*
|
|
12
|
+
* --fix mode: after printing the normal report, prompts to install missing
|
|
13
|
+
* providers and sign in to installed-but-unauthenticated ones. All I/O seams
|
|
14
|
+
* (detectEnvironment, installProvider, login, readLine) are injectable so tests
|
|
15
|
+
* remain hermetic — no real npm/login/detect spawned in tests.
|
|
11
16
|
*/
|
|
17
|
+
import readline from 'node:readline';
|
|
12
18
|
import { access, mkdir, writeFile, rm } from 'node:fs/promises';
|
|
13
19
|
import { join } from 'node:path';
|
|
14
20
|
import { detectEnvironment, getInstallCommand } from '../providers/detect.js';
|
|
21
|
+
import { installProvider } from '../providers/install.js';
|
|
22
|
+
import { runLogin } from './login.js';
|
|
15
23
|
import { isPricingStale } from '../infra/pricing.js';
|
|
24
|
+
import { parseYesNo } from '../interface/menu.js';
|
|
16
25
|
import { bold, green, red, yellow, dim, divider, label } from '../ui/theme.js';
|
|
17
26
|
/**
|
|
18
27
|
* Build the doctor report lines from pre-collected data.
|
|
@@ -96,14 +105,26 @@ async function probestateWritable(cwd) {
|
|
|
96
105
|
return false;
|
|
97
106
|
}
|
|
98
107
|
}
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// I/O runner — called by cli.ts
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
99
111
|
/**
|
|
100
112
|
* Detect the environment, probe I/O, build the report, and write it to `out`.
|
|
101
113
|
*
|
|
114
|
+
* When `opts.fix` is true, runs an interactive fix pass after the report:
|
|
115
|
+
* prompts to install missing providers, re-detects, then prompts to sign in
|
|
116
|
+
* to any installed-but-unauthenticated providers. All I/O seams are injectable
|
|
117
|
+
* via `opts` so tests stay hermetic.
|
|
118
|
+
*
|
|
102
119
|
* Returns 0 when at least one provider is installed, 1 otherwise.
|
|
103
120
|
* Never calls process.exit — that is handled exclusively by src/cli.ts.
|
|
121
|
+
* Never throws — any step failure is reported and the pass continues.
|
|
104
122
|
*/
|
|
105
|
-
export async function runDoctor(out) {
|
|
106
|
-
const
|
|
123
|
+
export async function runDoctor(out, opts) {
|
|
124
|
+
const detectEnvironmentFn = opts?.detectEnvironment ?? detectEnvironment;
|
|
125
|
+
const installProviderFn = opts?.installProvider ?? installProvider;
|
|
126
|
+
const loginFn = opts?.login ?? ((o, id) => runLogin(o, id));
|
|
127
|
+
const env = await detectEnvironmentFn();
|
|
107
128
|
const stateWritable = await probestateWritable(process.cwd());
|
|
108
129
|
const extras = {
|
|
109
130
|
nodeVersion: process.version,
|
|
@@ -114,6 +135,112 @@ export async function runDoctor(out) {
|
|
|
114
135
|
for (const line of lines) {
|
|
115
136
|
out.write(line + '\n');
|
|
116
137
|
}
|
|
117
|
-
|
|
138
|
+
if (!opts?.fix) {
|
|
139
|
+
return env.hasAnyProvider ? 0 : 1;
|
|
140
|
+
}
|
|
141
|
+
// ---- Fix pass --------------------------------------------------------------
|
|
142
|
+
// Create a temporary readline if no readLine seam was injected (real CLI path).
|
|
143
|
+
let rlClose;
|
|
144
|
+
let readLineFn = opts.readLine;
|
|
145
|
+
if (readLineFn === undefined) {
|
|
146
|
+
const rl = readline.createInterface({
|
|
147
|
+
input: process.stdin,
|
|
148
|
+
output: process.stdout,
|
|
149
|
+
terminal: false,
|
|
150
|
+
});
|
|
151
|
+
readLineFn = () => new Promise((resolve) => {
|
|
152
|
+
rl.once('line', (raw) => resolve(raw.trim()));
|
|
153
|
+
rl.once('close', () => resolve(null));
|
|
154
|
+
});
|
|
155
|
+
rlClose = () => rl.close();
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
await runFixPass(out, env, readLineFn, installProviderFn, loginFn, detectEnvironmentFn);
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
rlClose?.();
|
|
162
|
+
}
|
|
163
|
+
return 0;
|
|
164
|
+
}
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Fix pass (internal — separated for clarity and testability)
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
/**
|
|
169
|
+
* Interactive fix pass:
|
|
170
|
+
* 1. Offer to install each missing provider (claude, codex, opencode).
|
|
171
|
+
* 2. Re-detect to pick up any newly installed ones.
|
|
172
|
+
* 3. Offer to sign in to each installed-but-unauthenticated provider.
|
|
173
|
+
* (opencode is always authenticated when installed, so it is never
|
|
174
|
+
* offered a sign-in prompt — that is by design, not an omission.)
|
|
175
|
+
* 4. Re-detect once more and print a brief final status line.
|
|
176
|
+
*
|
|
177
|
+
* Never throws — any step failure is caught and reported via `out`.
|
|
178
|
+
*/
|
|
179
|
+
async function runFixPass(out, initialEnv, readLine, installProviderFn, loginFn, detectEnvironmentFn) {
|
|
180
|
+
const providers = ['claude', 'codex', 'opencode'];
|
|
181
|
+
// ---- Step 1: offer installs for missing providers -------------------------
|
|
182
|
+
const missingIds = providers.filter((id) => !initialEnv[id].installed);
|
|
183
|
+
let didInstallAny = false;
|
|
184
|
+
for (const id of missingIds) {
|
|
185
|
+
const pkg = getInstallCommand(id).replace('npm install -g ', '');
|
|
186
|
+
out.write(`\nInstall ${id} (${pkg})? (Y/n) `);
|
|
187
|
+
const ans = await readLine();
|
|
188
|
+
if (parseYesNo(ans, true)) {
|
|
189
|
+
try {
|
|
190
|
+
await installProviderFn(id, out);
|
|
191
|
+
didInstallAny = true;
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
out.write(red(`✗ Install of ${id} failed.\n`, out.color));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// ---- Step 2: re-detect if anything was installed --------------------------
|
|
199
|
+
let env = initialEnv;
|
|
200
|
+
if (didInstallAny || missingIds.length > 0) {
|
|
201
|
+
try {
|
|
202
|
+
env = await detectEnvironmentFn();
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
// If re-detection fails, continue with the original env — never throw.
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// ---- Step 3: offer sign-in for installed-but-unauthenticated providers ----
|
|
209
|
+
// opencode.authenticated is always true when installed (free models, no creds
|
|
210
|
+
// needed) so it naturally won't appear here — the condition is honest.
|
|
211
|
+
const needsAuth = providers.filter((id) => env[id].installed && !env[id].authenticated);
|
|
212
|
+
for (const id of needsAuth) {
|
|
213
|
+
out.write(`\nSign in to ${id} now? (Y/n) `);
|
|
214
|
+
const ans = await readLine();
|
|
215
|
+
if (parseYesNo(ans, true)) {
|
|
216
|
+
try {
|
|
217
|
+
await loginFn(out, id);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
out.write(red(`✗ Sign-in for ${id} did not complete.\n`, out.color));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// ---- Step 4: final re-detect and brief summary ----------------------------
|
|
225
|
+
let finalEnv = env;
|
|
226
|
+
try {
|
|
227
|
+
finalEnv = await detectEnvironmentFn();
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
// Best-effort — report from last known state if this fails.
|
|
231
|
+
}
|
|
232
|
+
out.write('\n');
|
|
233
|
+
for (const id of providers) {
|
|
234
|
+
const ps = finalEnv[id];
|
|
235
|
+
if (ps.installed && ps.authenticated) {
|
|
236
|
+
out.write(green(`✓ ${id}: installed, signed in.\n`, out.color));
|
|
237
|
+
}
|
|
238
|
+
else if (ps.installed) {
|
|
239
|
+
out.write(yellow(`~ ${id}: installed, not signed in.\n`, out.color));
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
out.write(red(`✗ ${id}: not installed.\n`, out.color));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
118
245
|
}
|
|
119
246
|
//# sourceMappingURL=doctor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAY/E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAsB,EACtB,MAAoB,EACpB,KAAc;IAEd,MAAM,KAAK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AC;IACnB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,mBAAmB,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,aAAa,EAAE,CAAC;YACrC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,2BAA2B,EAAE,GAAG,CAAC,KAAK,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"}
|
|
@@ -35,6 +35,11 @@ export declare function detectShellTarget(env: NodeJS.ProcessEnv, platform: Node
|
|
|
35
35
|
* For bash/zsh: uses POSIX `[ -t 1 ]` TTY guard and env-var opt-out.
|
|
36
36
|
* For powershell: uses `$Host.UI.RawUI` TTY check and equivalent env guards.
|
|
37
37
|
*
|
|
38
|
+
* Also defines convenience aliases (`cm` and `mst`) for myshell-tools so the
|
|
39
|
+
* control panel is reachable from any shell prompt after first launch. The
|
|
40
|
+
* aliases are guarded by a command-exists check so they are harmless on shells
|
|
41
|
+
* where myshell-tools is not installed.
|
|
42
|
+
*
|
|
38
43
|
* Pure function — returns a string, never does I/O.
|
|
39
44
|
*/
|
|
40
45
|
export declare function buildHookBlock(kind: ShellKind): string;
|
package/dist/commands/install.js
CHANGED
|
@@ -56,6 +56,11 @@ export function detectShellTarget(env, platform) {
|
|
|
56
56
|
* For bash/zsh: uses POSIX `[ -t 1 ]` TTY guard and env-var opt-out.
|
|
57
57
|
* For powershell: uses `$Host.UI.RawUI` TTY check and equivalent env guards.
|
|
58
58
|
*
|
|
59
|
+
* Also defines convenience aliases (`cm` and `mst`) for myshell-tools so the
|
|
60
|
+
* control panel is reachable from any shell prompt after first launch. The
|
|
61
|
+
* aliases are guarded by a command-exists check so they are harmless on shells
|
|
62
|
+
* where myshell-tools is not installed.
|
|
63
|
+
*
|
|
59
64
|
* Pure function — returns a string, never does I/O.
|
|
60
65
|
*/
|
|
61
66
|
export function buildHookBlock(kind) {
|
|
@@ -66,6 +71,11 @@ export function buildHookBlock(kind) {
|
|
|
66
71
|
` export MYSHELL_LOADED=1\n` +
|
|
67
72
|
` command -v myshell-tools >/dev/null 2>&1 && myshell-tools\n` +
|
|
68
73
|
`fi\n` +
|
|
74
|
+
`# Convenience aliases: cm / mst → myshell-tools (control menu)\n` +
|
|
75
|
+
`if command -v myshell-tools >/dev/null 2>&1; then\n` +
|
|
76
|
+
` alias cm='myshell-tools'\n` +
|
|
77
|
+
` alias mst='myshell-tools'\n` +
|
|
78
|
+
`fi\n` +
|
|
69
79
|
`${HOOK_END}`);
|
|
70
80
|
}
|
|
71
81
|
// powershell
|
|
@@ -75,6 +85,11 @@ export function buildHookBlock(kind) {
|
|
|
75
85
|
` $env:MYSHELL_LOADED = '1'\n` +
|
|
76
86
|
` if (Get-Command myshell-tools -ErrorAction SilentlyContinue) { myshell-tools }\n` +
|
|
77
87
|
`}\n` +
|
|
88
|
+
`# Convenience functions: cm / mst → myshell-tools (control menu)\n` +
|
|
89
|
+
`if (Get-Command myshell-tools -ErrorAction SilentlyContinue) {\n` +
|
|
90
|
+
` function cm { myshell-tools @args }\n` +
|
|
91
|
+
` function mst { myshell-tools @args }\n` +
|
|
92
|
+
`}\n` +
|
|
78
93
|
`${HOOK_END}`);
|
|
79
94
|
}
|
|
80
95
|
// ---------------------------------------------------------------------------
|
|
@@ -162,6 +177,7 @@ export async function runInstall(out, opts) {
|
|
|
162
177
|
if (enable) {
|
|
163
178
|
out.write(`[info] Shell hook installed in: ${rcPath}\n`);
|
|
164
179
|
out.write(`[info] New interactive shells will launch myshell-tools automatically.\n`);
|
|
180
|
+
out.write(`[info] Shortcuts available in new shells: cm / mst (both run myshell-tools).\n`);
|
|
165
181
|
out.write(`[info] Opt out any time: export MYSHELL_SKIP=1 (bash/zsh) or $env:MYSHELL_SKIP='1' (PowerShell)\n`);
|
|
166
182
|
out.write(`[info] To reverse: myshell-tools uninstall\n`);
|
|
167
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AASjD,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,MAAM,CAAC,MAAM,UAAU,GAAG,yBAAyB,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAElD,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAsB,EACtB,QAAyB;IAEzB,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC;QAC/D,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,GAAG,WAAW,kEAAkE;SACvF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO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AC5D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,mCAAmC,MAAM,IAAI,CAAC,CAAC;QACzD,GAAG,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
* - 'code': a no-localhost flow that works anywhere.
|
|
14
14
|
* · claude → `claude setup-token`: prints a link; the user signs in at
|
|
15
15
|
* claude.ai, copies the authorization code, and pastes it back here.
|
|
16
|
-
*
|
|
17
|
-
* (sk-ant-oat…)
|
|
18
|
-
*
|
|
16
|
+
* We TEE the output so we can scan it for the minted token
|
|
17
|
+
* (sk-ant-oat…) automatically. If auto-capture finds the token, it is
|
|
18
|
+
* persisted immediately with no user action required. Otherwise we fall
|
|
19
|
+
* back to prompting the user to paste it (up to 3 retries, with helpful
|
|
20
|
+
* warnings for blank or wrong-type inputs).
|
|
19
21
|
* · codex → `codex login --device-auth`: prints a URL + one-time code;
|
|
20
22
|
* the user authorizes their ChatGPT account on any device.
|
|
21
23
|
*
|
|
@@ -23,8 +25,9 @@
|
|
|
23
25
|
* to 'code' (so the localhost trap is avoided), everything else to 'browser'.
|
|
24
26
|
*
|
|
25
27
|
* Security: myshell-tools never stores raw API keys or passwords. The Claude
|
|
26
|
-
* OAuth token (sk-ant-oat…) is captured
|
|
27
|
-
* it and is stored in
|
|
28
|
+
* OAuth token (sk-ant-oat…) is either auto-captured from the tee'd output or
|
|
29
|
+
* captured after the user explicitly pastes it, and is stored in
|
|
30
|
+
* ~/.myshell-tools/credentials.json (mode 0o600).
|
|
28
31
|
*/
|
|
29
32
|
import type { OutputSink } from '../interface/render.js';
|
|
30
33
|
import type { ProviderId } from '../providers/port.js';
|