myshell-tools 2.15.0 → 3.2.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 +83 -1
- package/README.md +39 -44
- package/dist/cli.js +33 -22
- package/dist/cli.js.map +1 -1
- package/dist/commands/cost.js +44 -21
- package/dist/commands/cost.js.map +1 -1
- package/dist/commands/doctor.d.ts +17 -4
- package/dist/commands/doctor.js +62 -35
- 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/native-session.d.ts +57 -0
- package/dist/core/native-session.js +68 -0
- package/dist/core/native-session.js.map +1 -0
- package/dist/core/orchestrate.js +106 -43
- package/dist/core/orchestrate.js.map +1 -1
- package/dist/core/types.d.ts +26 -0
- 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/config.d.ts +8 -0
- package/dist/infra/config.js.map +1 -1
- package/dist/infra/credentials.d.ts +69 -3
- package/dist/infra/credentials.js +118 -9
- package/dist/infra/credentials.js.map +1 -1
- package/dist/infra/health.d.ts +57 -0
- package/dist/infra/health.js +96 -0
- package/dist/infra/health.js.map +1 -0
- package/dist/infra/insights.d.ts +14 -0
- package/dist/infra/insights.js +31 -0
- package/dist/infra/insights.js.map +1 -1
- package/dist/interface/menu.d.ts +70 -5
- package/dist/interface/menu.js +292 -88
- package/dist/interface/menu.js.map +1 -1
- package/dist/interface/render.js +20 -13
- package/dist/interface/render.js.map +1 -1
- package/dist/providers/claude.d.ts +24 -8
- package/dist/providers/claude.js +77 -15
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex-parse.js +14 -2
- package/dist/providers/codex-parse.js.map +1 -1
- package/dist/providers/codex.d.ts +13 -1
- package/dist/providers/codex.js +19 -8
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/detect.js +22 -1
- package/dist/providers/detect.js.map +1 -1
- package/dist/providers/port.d.ts +15 -0
- package/dist/providers/registry.d.ts +8 -4
- package/dist/providers/registry.js +7 -6
- package/dist/providers/registry.js.map +1 -1
- package/dist/ui/help.d.ts +17 -0
- package/dist/ui/help.js +106 -0
- package/dist/ui/help.js.map +1 -0
- package/package.json +1 -1
package/dist/interface/menu.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ import type { Provider, ProviderId, SandboxLevel } from '../providers/port.js';
|
|
|
24
24
|
import type { OutputSink } from './render.js';
|
|
25
25
|
import type { LoginMethod } from '../commands/login.js';
|
|
26
26
|
import type { UpdateCheckResult } from '../infra/update-check.js';
|
|
27
|
+
import type { ClaudeTokenStatus } from '../infra/credentials.js';
|
|
28
|
+
import { claudeTokenStatus } from '../infra/credentials.js';
|
|
29
|
+
import type { HealthIssue } from '../infra/health.js';
|
|
27
30
|
export interface MenuContext {
|
|
28
31
|
readonly version: string;
|
|
29
32
|
readonly clock: Clock;
|
|
@@ -92,6 +95,30 @@ export interface MenuContext {
|
|
|
92
95
|
* Used only for the opt-in auto-update path.
|
|
93
96
|
*/
|
|
94
97
|
readonly relaunch?: () => Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Optional pre-computed Claude token lifetime status for testing. When provided,
|
|
100
|
+
* `startMenu` uses this instead of loading from disk, allowing tests to drive
|
|
101
|
+
* the token-expiry header warning without touching the filesystem.
|
|
102
|
+
*
|
|
103
|
+
* Pass `null` explicitly to suppress any token warning; omit (undefined) to
|
|
104
|
+
* trigger the real disk read via `loadClaudeTokenCapturedAt`.
|
|
105
|
+
*/
|
|
106
|
+
readonly claudeTokenInfo?: ClaudeTokenStatus | null;
|
|
107
|
+
/**
|
|
108
|
+
* Optional override for npx-context detection (testing). When provided,
|
|
109
|
+
* `startMenu` uses this instead of inspecting `process.argv[1]`, so tests can
|
|
110
|
+
* drive the "running under npx" warning + auto-update suppression without a
|
|
111
|
+
* real npx cache path. Omit (undefined) to trigger the real detection.
|
|
112
|
+
*/
|
|
113
|
+
readonly runningUnderNpx?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Pre-computed environment health issues (Node version, state-dir writable,
|
|
116
|
+
* pricing staleness) surfaced automatically below the header — only when a
|
|
117
|
+
* problem exists. Computed once at startup by cli.ts (the diagnostics don't
|
|
118
|
+
* change in-session) so the user never has to run a separate health command.
|
|
119
|
+
* Omit/empty → nothing is shown.
|
|
120
|
+
*/
|
|
121
|
+
readonly healthIssues?: readonly HealthIssue[];
|
|
95
122
|
}
|
|
96
123
|
/**
|
|
97
124
|
* Parse a yes/no answer from a raw input line, with a configurable default.
|
|
@@ -150,6 +177,35 @@ export declare function defaultAliasHint(shell: string | undefined, platform: st
|
|
|
150
177
|
* All arithmetic is pure — no Date, no Math.random.
|
|
151
178
|
*/
|
|
152
179
|
export declare function relativeTime(thenMs: number, nowMs: number): string;
|
|
180
|
+
/**
|
|
181
|
+
* Build the short version-status suffix shown next to the version number in the
|
|
182
|
+
* header title — so the user always knows, at a glance, whether they are current.
|
|
183
|
+
*
|
|
184
|
+
* Pure — no I/O. Returns a leading-space string ready to append to the title:
|
|
185
|
+
* - update available + known latest → ` → 3.1.0 available`
|
|
186
|
+
* - up to date (latest known, no update) → ` (latest)`
|
|
187
|
+
* - check failed / offline (latest unknown) → `` (claim nothing)
|
|
188
|
+
*
|
|
189
|
+
* @param updateInfo - Result of the update check, or undefined when not run.
|
|
190
|
+
*/
|
|
191
|
+
export declare function versionStatusLabel(updateInfo?: UpdateCheckResult): string;
|
|
192
|
+
/**
|
|
193
|
+
* Detect whether myshell-tools is running via `npx` rather than a global install.
|
|
194
|
+
*
|
|
195
|
+
* Pure — takes the running script path (process.argv[1]) and the environment.
|
|
196
|
+
* npx executes packages from a cache directory containing a `_npx` segment
|
|
197
|
+
* (e.g. ~/.npm/_npx/<hash>/node_modules/myshell-tools/dist/cli.js), so the
|
|
198
|
+
* presence of that segment in the script path is the reliable signal. Handles
|
|
199
|
+
* both POSIX and Windows separators. Never throws.
|
|
200
|
+
*
|
|
201
|
+
* Why it matters: self-update runs `npm install -g`, which an npx invocation
|
|
202
|
+
* will ignore on the next run (npx re-serves its own cache). So under npx we
|
|
203
|
+
* skip silent auto-update and instead tell the user to install globally.
|
|
204
|
+
*
|
|
205
|
+
* @param scriptPath - The running script path (typically process.argv[1]).
|
|
206
|
+
* @param env - Environment to read npm_* hints from.
|
|
207
|
+
*/
|
|
208
|
+
export declare function isRunningUnderNpx(scriptPath: string | undefined, env: NodeJS.ProcessEnv): boolean;
|
|
153
209
|
/**
|
|
154
210
|
* Build the header box lines (provider status) from real EnvironmentStatus.
|
|
155
211
|
* Returns string[] safe to pass as the `lines` arg to box().
|
|
@@ -159,14 +215,23 @@ export declare function relativeTime(thenMs: number, nowMs: number): string;
|
|
|
159
215
|
* ⚠️ when ps.installed && !ps.authenticated (append " not signed in")
|
|
160
216
|
* ❌ when !ps.installed (append install command)
|
|
161
217
|
* Plan label appended when ps.plan is non-null (e.g. " (Max x5)").
|
|
218
|
+
*
|
|
219
|
+
* @param claudeToken - Optional pre-computed token lifetime status. When the token
|
|
220
|
+
* is near expiry or expired, ONE concise warning line is appended. Computed by
|
|
221
|
+
* the caller (startMenu) so this function stays pure and I/O-free.
|
|
162
222
|
*/
|
|
163
|
-
export declare function renderHeaderLines(env: EnvironmentStatus, _version: string): string[];
|
|
223
|
+
export declare function renderHeaderLines(env: EnvironmentStatus, _version: string, claudeToken?: ReturnType<typeof claudeTokenStatus>): string[];
|
|
164
224
|
/**
|
|
165
|
-
* Render the
|
|
225
|
+
* Render the activity status line shown beneath the provider header.
|
|
226
|
+
*
|
|
227
|
+
* This is a SUBSCRIPTION tool, not an API-key tool — per-token dollar figures
|
|
228
|
+
* don't map to flat subscription billing and read as misleading bloat, so the
|
|
229
|
+
* always-on line shows REAL, measured signals only: task count and tokens. The
|
|
230
|
+
* estimated-dollar view lives on-demand in `myshell-tools cost`, clearly
|
|
231
|
+
* captioned there as an API-equivalent (not your actual bill).
|
|
166
232
|
*
|
|
167
|
-
* Uses real numbers only — all values come from the SpendSummary
|
|
168
|
-
*
|
|
169
|
-
* shows dollar amounts only.
|
|
233
|
+
* Uses real numbers only — all values come from the SpendSummary derived from
|
|
234
|
+
* `readLedger`. No digit-% literals appear here.
|
|
170
235
|
*
|
|
171
236
|
* @param spend - Output of summarizeSpend() over real ledger entries.
|
|
172
237
|
* @param color - When false, no ANSI escape codes are emitted.
|