@askdkc/dsh-cli 0.13.5 → 0.14.1
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/bin/{dsh-tui.js → dsh-cli.js} +27 -27
- package/cordis.patch.yml +32 -32
- package/cordis.yml +17 -17
- package/lib/types/activityPrefs.d.ts +2 -2
- package/lib/types/activityPrefs.js +2 -2
- package/lib/types/adapter/channel/actions.js +1 -1
- package/lib/types/adapter/channel/consumer.js +1 -1
- package/lib/types/adapter/channel/internal-token.js +1 -1
- package/lib/types/adapter/channel/plugins.js +1 -1
- package/lib/types/adapter/channel/session-projection.js +3 -3
- package/lib/types/adapter/channel/transcript.js +1 -1
- package/lib/types/adapter/channel/ui.js +3 -3
- package/lib/types/adapter/kernel/host-facade.d.ts +1 -1
- package/lib/types/adapter/kernel/host-facade.js +6 -6
- package/lib/types/adapter/kernel/host-probe-access.d.ts +1 -1
- package/lib/types/adapter/kernel/host-probe-access.js +6 -6
- package/lib/types/adapter/kernel/kernel-runtime.js +1 -1
- package/lib/types/adapter/kernel/legacy-facade.d.ts +1 -1
- package/lib/types/adapter/kernel/legacy-facade.js +1 -1
- package/lib/types/adapter/kernel/replay-isolation.js +1 -1
- package/lib/types/adapter/kernel/runtime.d.ts +1 -1
- package/lib/types/adapter/kernel/runtime.js +7 -7
- package/lib/types/adapter/ports/channel-display.d.ts +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +15 -15
- package/lib/types/adapter/standard/descriptor.d.ts +1 -1
- package/lib/types/adapter/standard/descriptor.js +2 -2
- package/lib/types/adapter/standard/registry.d.ts +1 -1
- package/lib/types/adapter/standard/registry.js +2 -2
- package/lib/types/adapter/standard/tui-extension.d.ts +2 -2
- package/lib/types/adapter/standard/tui-extension.js +3 -3
- package/lib/types/adapter/upstream/channel-driver.js +10 -10
- package/lib/types/adapter/upstream/decisions-driver.js +3 -3
- package/lib/types/adapter/upstream/extensions-driver.js +18 -18
- package/lib/types/adapter/upstream/host-descriptor-driver.js +4 -4
- package/lib/types/adapter/upstream/presentation-driver.js +5 -5
- package/lib/types/adapter/upstream/scenes-driver.js +4 -4
- package/lib/types/adapter/upstream/settings-driver.js +4 -4
- package/lib/types/adapter/upstream/workspace-driver.js +2 -2
- package/lib/types/bootstrap/state.d.ts +4 -4
- package/lib/types/bootstrap/state.js +4 -4
- package/lib/types/{tuiDisplayPrefs.d.ts → cliDisplayPrefs.d.ts} +1 -1
- package/lib/types/{tuiDisplayPrefs.d.ts.map → cliDisplayPrefs.d.ts.map} +1 -1
- package/lib/types/{tuiDisplayPrefs.js → cliDisplayPrefs.js} +1 -1
- package/lib/types/commands.js +7 -7
- package/lib/types/components/AutoRecapRow.d.ts +1 -1
- package/lib/types/components/AutoRecapRow.js +1 -1
- package/lib/types/components/HelpMenu.d.ts +1 -1
- package/lib/types/components/HelpMenu.js +1 -1
- package/lib/types/components/LogoV2.d.ts +2 -2
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +5 -19
- package/lib/types/components/MermaidDiagram.js +1 -1
- package/lib/types/components/MessageList.d.ts +2 -2
- package/lib/types/components/MessageList.js +1 -1
- package/lib/types/components/PageMargin.d.ts +3 -3
- package/lib/types/components/PageMargin.js +1 -1
- package/lib/types/components/PluginSceneBoundary.d.ts +1 -1
- package/lib/types/components/PluginSceneBoundary.js +1 -1
- package/lib/types/components/PromptInput.d.ts +1 -1
- package/lib/types/components/PromptInput.js +3 -3
- package/lib/types/components/ScrollbarGutter.d.ts +1 -1
- package/lib/types/components/ScrollbarGutter.js +1 -1
- package/lib/types/components/Select.d.ts +1 -1
- package/lib/types/components/Select.js +1 -1
- package/lib/types/components/SplitDiffView.d.ts +1 -1
- package/lib/types/components/ThemePicker.d.ts +1 -1
- package/lib/types/components/ThemePicker.js +1 -1
- package/lib/types/components/activityFrames.d.ts +1 -1
- package/lib/types/components/activityFrames.js +1 -1
- package/lib/types/components/design-system/Byline.d.ts +1 -1
- package/lib/types/components/design-system/Byline.js +1 -1
- package/lib/types/components/design-system/Divider.d.ts +1 -1
- package/lib/types/components/design-system/Divider.js +1 -1
- package/lib/types/components/design-system/StatusIcon.d.ts +1 -1
- package/lib/types/components/design-system/StatusIcon.js +1 -1
- package/lib/types/components/design-system/ThemeProvider.d.ts +1 -1
- package/lib/types/components/design-system/ThemeProvider.js +11 -11
- package/lib/types/components/design-system/ThemedBox.d.ts +1 -1
- package/lib/types/components/design-system/ThemedBox.js +1 -1
- package/lib/types/components/design-system/ThemedText.d.ts +1 -1
- package/lib/types/components/design-system/ThemedText.js +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +3 -3
- package/lib/types/components/messages/AssistantToolUseMessage.js +1 -1
- package/lib/types/components/messages/originalImage.js +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +1 -1
- package/lib/types/components/smoothReveal.d.ts +1 -1
- package/lib/types/components/smoothReveal.js +1 -1
- package/lib/types/customTheme.d.ts +5 -5
- package/lib/types/customTheme.js +7 -7
- package/lib/types/dsh-adapter/activity-store.d.ts +1 -1
- package/lib/types/dsh-adapter/activity-store.js +3 -3
- package/lib/types/dsh-adapter/bundled-presets.js +2 -2
- package/lib/types/dsh-adapter/channel/action-readiness.js +2 -2
- package/lib/types/dsh-adapter/channel/agent-view-projection.js +1 -1
- package/lib/types/dsh-adapter/channel/background-action.js +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +1 -1
- package/lib/types/dsh-adapter/channel/binding.js +14 -14
- package/lib/types/dsh-adapter/channel/external-commands.js +3 -3
- package/lib/types/dsh-adapter/channel/input-delivery.js +1 -1
- package/lib/types/dsh-adapter/channel/job-projection.js +1 -1
- package/lib/types/dsh-adapter/channel/lifetime-resources.js +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +1 -1
- package/lib/types/dsh-adapter/channel/mode-actions.js +1 -1
- package/lib/types/dsh-adapter/channel/mode-permission.js +6 -6
- package/lib/types/dsh-adapter/channel/mode-roster.js +1 -1
- package/lib/types/dsh-adapter/channel/owner.js +2 -2
- package/lib/types/dsh-adapter/channel/preferences.js +1 -1
- package/lib/types/dsh-adapter/channel/projection.js +1 -1
- package/lib/types/dsh-adapter/channel/reports.js +3 -3
- package/lib/types/dsh-adapter/channel/session-fork.js +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts +4 -4
- package/lib/types/dsh-adapter/channel/session-metadata.js +2 -2
- package/lib/types/dsh-adapter/channel/session-rewind.js +2 -2
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.js +1 -1
- package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
- package/lib/types/dsh-adapter/channel-ui.js +2 -2
- package/lib/types/dsh-adapter/channel.js +9 -9
- package/lib/types/dsh-adapter/cli-registration.d.ts.map +1 -1
- package/lib/types/dsh-adapter/cli-registration.js +5 -4
- package/lib/types/dsh-adapter/command-trees.d.ts +1 -1
- package/lib/types/dsh-adapter/command-trees.js +2 -2
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +3 -3
- package/lib/types/dsh-adapter/compat/sessionLog.js +5 -5
- package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/settings.js +15 -7
- package/lib/types/dsh-adapter/contract.d.ts +1 -1
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +0 -1
- package/lib/types/dsh-adapter/decision-guard.d.ts +3 -3
- package/lib/types/dsh-adapter/decision-guard.js +6 -6
- package/lib/types/dsh-adapter/dialogs.d.ts +1 -1
- package/lib/types/dsh-adapter/dialogs.js +7 -7
- package/lib/types/dsh-adapter/effect-ledger.d.ts +2 -2
- package/lib/types/dsh-adapter/effect-ledger.js +5 -5
- package/lib/types/dsh-adapter/extension-events.js +10 -10
- package/lib/types/dsh-adapter/extensions.d.ts +3 -3
- package/lib/types/dsh-adapter/extensions.js +3 -3
- package/lib/types/dsh-adapter/host-access.js +11 -11
- package/lib/types/dsh-adapter/ide-channel.d.ts +6 -6
- package/lib/types/dsh-adapter/ide-channel.js +6 -6
- package/lib/types/dsh-adapter/index.d.ts +18 -18
- package/lib/types/dsh-adapter/index.js +5 -5
- package/lib/types/dsh-adapter/inject-channel.d.ts +4 -4
- package/lib/types/dsh-adapter/inject-channel.js +5 -5
- package/lib/types/dsh-adapter/invariant.d.ts +9 -2
- package/lib/types/dsh-adapter/invariant.d.ts.map +1 -1
- package/lib/types/dsh-adapter/invariant.js +1 -1
- package/lib/types/dsh-adapter/message-observer.d.ts +2 -2
- package/lib/types/dsh-adapter/message-observer.js +23 -23
- package/lib/types/dsh-adapter/migrate/adapters/scan.js +1 -1
- package/lib/types/dsh-adapter/migrate/bin-path.d.ts +1 -1
- package/lib/types/dsh-adapter/migrate/bin-path.js +4 -4
- package/lib/types/dsh-adapter/migrate/picker.d.ts +1 -1
- package/lib/types/dsh-adapter/migrate/picker.js +1 -1
- package/lib/types/dsh-adapter/migrate/uuid.js +1 -1
- package/lib/types/dsh-adapter/packaged-presets.js +1 -1
- package/lib/types/dsh-adapter/plugin-host.d.ts +2 -2
- package/lib/types/dsh-adapter/plugin-host.js +32 -32
- package/lib/types/dsh-adapter/plugin-storage.d.ts +3 -3
- package/lib/types/dsh-adapter/plugin-storage.js +5 -5
- package/lib/types/dsh-adapter/plugin.d.ts +4 -4
- package/lib/types/dsh-adapter/plugin.js +89 -89
- package/lib/types/dsh-adapter/preset-resolution.d.ts +1 -1
- package/lib/types/dsh-adapter/presets.js +1 -1
- package/lib/types/dsh-adapter/promptDebug.js +1 -1
- package/lib/types/dsh-adapter/questions.d.ts +1 -1
- package/lib/types/dsh-adapter/questions.js +1 -1
- package/lib/types/dsh-adapter/renderers.js +7 -7
- package/lib/types/dsh-adapter/scenes.d.ts +1 -1
- package/lib/types/dsh-adapter/scenes.js +6 -6
- package/lib/types/dsh-adapter/settings-sections.d.ts +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +5 -5
- package/lib/types/dsh-adapter/sharp.js +1 -1
- package/lib/types/dsh-adapter/shortcuts.js +9 -9
- package/lib/types/dsh-adapter/status.js +21 -21
- package/lib/types/dsh-adapter/themes.js +2 -2
- package/lib/types/dsh-adapter/toast.js +7 -7
- package/lib/types/dsh-adapter/types.d.ts +0 -1
- package/lib/types/dsh-adapter/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/workspaces.d.ts +1 -1
- package/lib/types/dsh-adapter/workspaces.js +6 -6
- package/lib/types/effortPrefs.d.ts +2 -2
- package/lib/types/effortPrefs.js +2 -2
- package/lib/types/force-production-react.js +1 -1
- package/lib/types/herdr.js +4 -4
- package/lib/types/homePrefs.js +1 -1
- package/lib/types/i18n.d.ts +54 -54
- package/lib/types/i18n.js +39 -39
- package/lib/types/ink/clearTerminal.d.ts +1 -1
- package/lib/types/ink/clearTerminal.js +1 -1
- package/lib/types/ink/colorize.js +1 -1
- package/lib/types/ink/components/App.d.ts +1 -1
- package/lib/types/ink/components/App.js +5 -5
- package/lib/types/ink/components/Text.d.ts +1 -1
- package/lib/types/ink/devtools.d.ts +1 -1
- package/lib/types/ink/dom.d.ts +1 -1
- package/lib/types/ink/dom.js +1 -1
- package/lib/types/ink/geometry-trace.js +4 -4
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +8 -19
- package/lib/types/ink/reconciler.d.ts +1 -1
- package/lib/types/ink/reconciler.d.ts.map +1 -1
- package/lib/types/ink/reconciler.js +6 -3
- package/lib/types/ink/render-to-screen.d.ts.map +1 -1
- package/lib/types/ink/render-to-screen.js +0 -5
- package/lib/types/ink/terminal.js +3 -3
- package/lib/types/ink/termio/osc.js +1 -1
- package/lib/types/ink/update-overflow-guard.js +2 -2
- package/lib/types/minimalMode.d.ts +2 -2
- package/lib/types/minimalMode.js +2 -2
- package/lib/types/modelGroups.d.ts +1 -1
- package/lib/types/modelGroups.js +1 -1
- package/lib/types/modelPrefs.d.ts +1 -1
- package/lib/types/modelPrefs.js +1 -1
- package/lib/types/modelRecents.d.ts +2 -2
- package/lib/types/modelRecents.js +2 -2
- package/lib/types/package-version.d.ts +3 -0
- package/lib/types/package-version.d.ts.map +1 -0
- package/lib/types/package-version.js +25 -0
- package/lib/types/presetPrefs.d.ts +1 -1
- package/lib/types/presetPrefs.js +1 -1
- package/lib/types/reload.d.ts +8 -8
- package/lib/types/reload.js +4 -4
- package/lib/types/screens/Chat.js +27 -27
- package/lib/types/screens/StatusLine.js +1 -1
- package/lib/types/screens/StatusMetrics.js +1 -1
- package/lib/types/sessionHistory.d.ts +3 -3
- package/lib/types/sessionHistory.js +7 -7
- package/lib/types/sessionModes.js +1 -1
- package/lib/types/sessionMounts.d.ts +1 -1
- package/lib/types/sessionMounts.js +1 -1
- package/lib/types/sessionPins.d.ts +1 -1
- package/lib/types/sessionPins.js +1 -1
- package/lib/types/terminal-utils/cliHighlight.d.ts +1 -1
- package/lib/types/terminal-utils/hash.d.ts +1 -1
- package/lib/types/terminal-utils/hash.js +1 -1
- package/lib/types/terminal-utils/mermaid.d.ts +1 -1
- package/lib/types/terminal-utils/syntaxTheme.js +1 -1
- package/lib/types/theme.d.ts +3 -3
- package/lib/types/theme.js +3 -3
- package/lib/types/themePrefs.d.ts +3 -3
- package/lib/types/themePrefs.js +3 -3
- package/lib/types/tips.js +4 -4
- package/lib/types/trajectory/effortIgnition.d.ts +1 -1
- package/lib/types/trajectoryPrefs.d.ts +1 -1
- package/lib/types/trajectoryPrefs.js +1 -1
- package/lib/types/ui.d.ts +1 -1
- package/lib/types/ui.js +1 -1
- package/lib/types/update.d.ts +25 -26
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +55 -73
- package/lib/types/utils/clipboard.js +1 -1
- package/lib/types/utils/credentials.js +2 -2
- package/lib/types/utils/debug.d.ts +3 -3
- package/lib/types/utils/debug.js +6 -6
- package/lib/types/utils/earlyInput.d.ts +1 -1
- package/lib/types/utils/earlyInput.js +1 -1
- package/lib/types/utils/externalEditor.js +1 -1
- package/lib/types/utils/fullscreen.d.ts +3 -3
- package/lib/types/utils/fullscreen.js +4 -4
- package/lib/types/utils/log.js +1 -1
- package/lib/types/utils/paths.d.ts +3 -3
- package/lib/types/utils/paths.js +4 -4
- package/lib/types/working-activity.js +1 -1
- package/node_modules/@askdkc/dsh-auth/dsh-plugin.json +1 -1
- package/node_modules/@askdkc/dsh-auth/lib/index.d.ts +2 -2
- package/node_modules/@askdkc/dsh-auth/lib/index.js +2 -2
- package/node_modules/@askdkc/dsh-auth/lib/pi-ai.d.ts +0 -2
- package/node_modules/@askdkc/dsh-auth/lib/pi-ai.js +0 -2
- package/node_modules/@askdkc/dsh-auth/lib/service.d.ts +1 -1
- package/node_modules/@askdkc/dsh-auth/lib/service.js +2 -2
- package/node_modules/dsh-working-activity/lib/client.js.map +1 -1
- package/node_modules/dsh-working-activity/lib/types/client/index.d.ts +1 -1
- package/node_modules/dsh-working-activity/lib/types/config.d.ts +2 -2
- package/node_modules/dsh-working-activity/lib/types/config.js +2 -2
- package/node_modules/dsh-working-activity/lib/types/frames.d.ts +1 -1
- package/node_modules/dsh-working-activity/lib/types/frames.js +1 -1
- package/node_modules/dsh-working-activity/lib/types/index.d.ts +1 -1
- package/node_modules/dsh-working-activity/lib/types/index.js +2 -2
- package/node_modules/dsh-working-activity/lib/types/invariant.d.ts +13 -1
- package/node_modules/dsh-working-activity/lib/types/lang.d.ts +5 -5
- package/node_modules/dsh-working-activity/lib/types/lang.js +8 -8
- package/node_modules/dsh-working-activity/lib/types/projection.d.ts +1 -1
- package/node_modules/dsh-working-activity/lib/types/projection.js +1 -1
- package/node_modules/dsh-working-activity/lib/types/status.d.ts +1 -1
- package/node_modules/dsh-working-activity/lib/types/status.js +1 -1
- package/node_modules/dsh-working-activity/package.json +0 -4
- package/node_modules/dsh-working-activity/src/client/index.ts +1 -1
- package/node_modules/dsh-working-activity/src/config.ts +2 -2
- package/node_modules/dsh-working-activity/src/frames.ts +1 -1
- package/node_modules/dsh-working-activity/src/index.ts +4 -4
- package/node_modules/dsh-working-activity/src/invariant.ts +10 -3
- package/node_modules/dsh-working-activity/src/lang.ts +8 -8
- package/node_modules/dsh-working-activity/src/projection.ts +1 -1
- package/node_modules/dsh-working-activity/src/status.ts +1 -1
- package/package.json +8 -13
- package/presets/liangshen/agent.cordis.yml +1 -1
- package/presets/liangshen/custom-bash.mjs +2 -2
package/lib/types/update.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export { installedCliVersion } from './package-version.js';
|
|
1
2
|
import { shellQuote } from './utils/shellQuote.js';
|
|
2
3
|
export { shellQuote };
|
|
3
4
|
/**
|
|
4
|
-
* Append a /restart handoff event to ~/.dsh-
|
|
5
|
+
* Append a /restart handoff event to ~/.dsh-cli/restart.log.
|
|
5
6
|
* @param event - Short stable event name.
|
|
6
7
|
* @param data - Small JSON-safe detail (never credentials or session text).
|
|
7
8
|
*/
|
|
@@ -14,7 +15,7 @@ export declare function beginRestartAttempt(sessionId: string): void;
|
|
|
14
15
|
* indistinguishable from a silent failure.
|
|
15
16
|
*/
|
|
16
17
|
export declare function writeHandoffNotice(text: string): void;
|
|
17
|
-
export interface
|
|
18
|
+
export interface CliUpdateInfo {
|
|
18
19
|
current: string;
|
|
19
20
|
latest: string;
|
|
20
21
|
isStandalone?: boolean;
|
|
@@ -23,7 +24,7 @@ export interface TuiUpdateInfo {
|
|
|
23
24
|
checksumUrl?: string;
|
|
24
25
|
}
|
|
25
26
|
/** What a fresh registry lookup says about this install. */
|
|
26
|
-
export type
|
|
27
|
+
export type CliUpdateTarget = {
|
|
27
28
|
kind: 'update';
|
|
28
29
|
current: string;
|
|
29
30
|
latest: string;
|
|
@@ -39,7 +40,7 @@ export type TuiUpdateTarget = {
|
|
|
39
40
|
kind: 'unknown';
|
|
40
41
|
isStandalone?: boolean;
|
|
41
42
|
};
|
|
42
|
-
export interface
|
|
43
|
+
export interface CliUpdateResult {
|
|
43
44
|
/** Exit code of the `dsh plugin update` run (0 = the package was updated). */
|
|
44
45
|
updateCode: number;
|
|
45
46
|
/**
|
|
@@ -48,8 +49,6 @@ export interface TuiUpdateResult {
|
|
|
48
49
|
*/
|
|
49
50
|
restartCode: number;
|
|
50
51
|
}
|
|
51
|
-
/** Read the version from either the compiled package or the source checkout. */
|
|
52
|
-
export declare function installedTuiVersion(): string | undefined;
|
|
53
52
|
/**
|
|
54
53
|
* The profile this TUI was booted with (`dsh --profile <name>`), read from
|
|
55
54
|
* the launcher argv the process inherited. dsh sets no profile env var, and
|
|
@@ -70,7 +69,7 @@ export declare function isVersionNewer(current: string, previous: string): boole
|
|
|
70
69
|
/**
|
|
71
70
|
* Versions whose compiled plugin hard-injects `tuiWorkspaces`
|
|
72
71
|
* ('0.7.0'–'0.7.1'; removed in 0.7.2). Installing one while the globally
|
|
73
|
-
* installed launcher copy predates the `dsh-
|
|
72
|
+
* installed launcher copy predates the `dsh-cli-workspaces` patch row
|
|
74
73
|
* deadlocks boot forever at "pending (waiting for service: tuiWorkspaces)"
|
|
75
74
|
* (issues #183/#307) — and /update reaching such a target is exactly how
|
|
76
75
|
* stale-mirror installs stranded users. /update must refuse them.
|
|
@@ -156,7 +155,7 @@ export declare function verifyAssetChecksum(buffer: Buffer, manifestText: string
|
|
|
156
155
|
* Escape a value for embedding in a PowerShell single-quoted literal: only
|
|
157
156
|
* `''` needs escaping there (same convention as `buildPsScript` in
|
|
158
157
|
* src/utils/clipboard.ts). Extract/archive paths derive from environment
|
|
159
|
-
* variables (`
|
|
158
|
+
* variables (`DSH_CLI_STANDALONE_CACHE`), so an unescaped `'` closes the
|
|
160
159
|
* literal and turns the rest of the path into executable command text.
|
|
161
160
|
* @param value - Raw string to embed between single quotes.
|
|
162
161
|
* @returns The value with every `'` doubled.
|
|
@@ -262,15 +261,15 @@ export declare function downloadAndReplaceStandaloneBinary(downloadUrl: string,
|
|
|
262
261
|
* say "installing X now, official latest is Y" instead of silently
|
|
263
262
|
* upgrading to yesterday's version.
|
|
264
263
|
*/
|
|
265
|
-
export declare function
|
|
264
|
+
export declare function resolveCliUpdateTarget(): Promise<CliUpdateTarget>;
|
|
266
265
|
/**
|
|
267
266
|
* Check npm for a newer published TUI version. Network and registry errors
|
|
268
267
|
* are intentionally treated as "no result" so an offline launch never delays
|
|
269
268
|
* or blocks the interactive TUI.
|
|
270
269
|
*/
|
|
271
|
-
export declare function
|
|
270
|
+
export declare function checkForCliUpdate(): Promise<CliUpdateInfo | undefined>;
|
|
272
271
|
/** Build the profile-manager command, preferring a preflight-pinned version. */
|
|
273
|
-
export declare function
|
|
272
|
+
export declare function cliUpdatePluginArgs(profile: string, targetVersion?: string): string[];
|
|
274
273
|
/** The profile's pnpm-workspace.yaml (`$DSH_HOME ?? ~/.dsh` layout). */
|
|
275
274
|
export declare function profileWorkspaceYamlPath(profile: string): string;
|
|
276
275
|
/** What ensureProfileAllowBuilds did to the profile workspace file. */
|
|
@@ -282,7 +281,7 @@ export interface AllowBuildsOutcome {
|
|
|
282
281
|
}
|
|
283
282
|
/**
|
|
284
283
|
* Make sure the profile's pnpm-workspace.yaml carries explicit `false`
|
|
285
|
-
* allowBuilds entries for the dsh-
|
|
284
|
+
* allowBuilds entries for the dsh-cli chain's postinstall-only deps, so a
|
|
286
285
|
* pnpm ≥11 update is not killed by ERR_PNPM_IGNORED_BUILDS. Best effort and
|
|
287
286
|
* idempotent: existing entries are never overwritten (an explicit user
|
|
288
287
|
* decision wins), a missing `allowBuilds:` block is appended, and a missing
|
|
@@ -431,15 +430,15 @@ export interface StaleInstallRemoval {
|
|
|
431
430
|
export declare function removeStalePackageInstall(profile: string): StaleInstallRemoval;
|
|
432
431
|
/**
|
|
433
432
|
* Best-effort migrate the GLOBAL launcher to the delegating shim (0.8.7):
|
|
434
|
-
* after a successful profile update, copy this package's `bin/dsh-
|
|
433
|
+
* after a successful profile update, copy this package's `bin/dsh-cli.js`
|
|
435
434
|
* and `package.json` over the global install so the launcher can never lag
|
|
436
435
|
* the profile again — the shim delegates all logic to the profile copy it
|
|
437
436
|
* just updated. Single-file-safe by contract: the new bin imports nothing
|
|
438
437
|
* from lib/ (see its header), so overwriting it inside an older global
|
|
439
438
|
* install cannot dangle a missing helper.
|
|
440
439
|
*
|
|
441
|
-
* Locating the global dir relies on argv[1] being the global `dsh-
|
|
442
|
-
* (true when booted through the `dsh-
|
|
440
|
+
* Locating the global dir relies on argv[1] being the global `dsh-cli.js`
|
|
441
|
+
* (true when booted through the `dsh-cli` command). Source checkouts and
|
|
443
442
|
* direct `dsh --profile` boots resolve nothing — the migration is a silent
|
|
444
443
|
* no-op there. Write failures (permissions, locked files) are equally
|
|
445
444
|
* silent: the launcher-alignment warning remains the fallback diagnosis.
|
|
@@ -448,7 +447,7 @@ export declare function removeStalePackageInstall(profile: string): StaleInstall
|
|
|
448
447
|
*/
|
|
449
448
|
export declare function migrateGlobalLauncher(): boolean;
|
|
450
449
|
/** Outcome of the install-only half of an update (no restart). */
|
|
451
|
-
export interface
|
|
450
|
+
export interface CliUpdateOutcome {
|
|
452
451
|
/** 0 = the profile now runs the intended version; non-zero = failed. */
|
|
453
452
|
code: number;
|
|
454
453
|
/** Version installed before the update ran (the #307 stamp). */
|
|
@@ -459,7 +458,7 @@ export interface TuiUpdateOutcome {
|
|
|
459
458
|
/**
|
|
460
459
|
* Install-only half of `/update`: run `dsh plugin add`, refuse boot-deadlock
|
|
461
460
|
* targets, verify the profile actually advanced, and migrate the global
|
|
462
|
-
* launcher. No restart — `
|
|
461
|
+
* launcher. No restart — `updateCliAndRestart` layers the session-preserving
|
|
463
462
|
* restart on top, and the `dsh-cli update` CLI stops here.
|
|
464
463
|
*
|
|
465
464
|
* @param profile - The dsh profile to update.
|
|
@@ -467,9 +466,9 @@ export interface TuiUpdateOutcome {
|
|
|
467
466
|
* undefined when that check failed and pnpm should resolve latest.
|
|
468
467
|
* @returns The update exit code plus the before/after versions.
|
|
469
468
|
*/
|
|
470
|
-
export declare function
|
|
469
|
+
export declare function updateCli(profile: string, targetVersion?: string): Promise<CliUpdateOutcome>;
|
|
471
470
|
/**
|
|
472
|
-
* Update the installed dsh-
|
|
471
|
+
* Update the installed dsh-cli package and restart the same launcher while
|
|
473
472
|
* preserving the active session. The TUI must already be unmounted before
|
|
474
473
|
* this is called so pnpm output cannot corrupt the rendered terminal frame.
|
|
475
474
|
*
|
|
@@ -486,7 +485,7 @@ export declare function updateTui(profile: string, targetVersion?: string): Prom
|
|
|
486
485
|
* check, or undefined when that check failed and pnpm should resolve latest.
|
|
487
486
|
* @returns Exit codes for the update run and the replacement process.
|
|
488
487
|
*/
|
|
489
|
-
export declare function
|
|
488
|
+
export declare function updateCliAndRestart(sessionId: string, profile: string, targetVersion?: string): Promise<CliUpdateResult>;
|
|
490
489
|
/**
|
|
491
490
|
* Headless `dsh-cli update`: the `/update` decision flow (preflight, deadlock
|
|
492
491
|
* refusal, mirror-lag note, `--latest` fallback) followed by the install-only
|
|
@@ -509,12 +508,12 @@ export declare function cliUpdate(profile: string): Promise<number>;
|
|
|
509
508
|
* update restarts into a TUI that takes no input).
|
|
510
509
|
*
|
|
511
510
|
* The TUI must already be unmounted before this is called (same terminal
|
|
512
|
-
* handoff contract as `
|
|
511
|
+
* handoff contract as `updateCliAndRestart`): the caller runs this from the
|
|
513
512
|
* exit funnel's done callback, after finishExit detached the terminal and
|
|
514
513
|
* the readable stdin pump.
|
|
515
514
|
*
|
|
516
515
|
* This waits for the replacement's natural exit: the outer command
|
|
517
|
-
* interpreter that ran `dsh-
|
|
516
|
+
* interpreter that ran `dsh-cli` reclaims the console the moment the
|
|
518
517
|
* launch chain (cmd → wrapper → this process) unwinds, and an orphaned
|
|
519
518
|
* replacement still attached to the console then fights the interpreter's
|
|
520
519
|
* own prompt and line reader for every keypress (field evidence
|
|
@@ -532,19 +531,19 @@ export declare function cliUpdate(profile: string): Promise<number>;
|
|
|
532
531
|
* @param sessionId - Session to resume in the replacement process.
|
|
533
532
|
* @param options - `kind: 'update'` drops the /restart boot-diagnosis
|
|
534
533
|
* marker and tags restart.log events for the update flow; `env` adds
|
|
535
|
-
* marker variables for the replacement (e.g.
|
|
534
|
+
* marker variables for the replacement (e.g. DSH_CLI_UPDATED_FROM).
|
|
536
535
|
* @returns 0 when the replacement ran and exited cleanly, 127 when it
|
|
537
536
|
* failed to start, otherwise the child's own exit code.
|
|
538
537
|
*/
|
|
539
|
-
export interface
|
|
538
|
+
export interface CliRestartOptions {
|
|
540
539
|
/** Extra env markers for the replacement process (/update's stamp). */
|
|
541
540
|
env?: Record<string, string>;
|
|
542
541
|
/**
|
|
543
542
|
* 'update' reuses this handoff after an install: no
|
|
544
|
-
*
|
|
543
|
+
* DSH_CLI_RESTART_CHILD marker (that flag is /restart-only boot
|
|
545
544
|
* diagnostics) and restart.log events carry the update-restart tag.
|
|
546
545
|
*/
|
|
547
546
|
kind?: 'restart' | 'update';
|
|
548
547
|
}
|
|
549
|
-
export declare function
|
|
548
|
+
export declare function restartCli(sessionId: string, options?: CliRestartOptions): Promise<number>;
|
|
550
549
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAQ1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAKlD,OAAO,EAAE,UAAU,EAAE,CAAA;AAiDrB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAEnF;AAED,0EAA0E;AAC1E,wBAAgB,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ChC,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAC5B;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6HpG"}
|
package/lib/types/update.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { installedCliVersion } from './package-version.js';
|
|
2
|
+
export { installedCliVersion } from './package-version.js';
|
|
1
3
|
import { execFileSync, spawn } from 'node:child_process';
|
|
2
4
|
import { createHash } from 'node:crypto';
|
|
3
5
|
import { appendFileSync, chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
@@ -28,12 +30,12 @@ const MAX_ASSET_BYTES = 512 * 1024 * 1024;
|
|
|
28
30
|
/** The SHA256SUMS manifest itself is plain text; anything past this is broken. */
|
|
29
31
|
const MAX_CHECKSUM_MANIFEST_BYTES = 1024 * 1024;
|
|
30
32
|
/** env marker set on the /update restart; the new process verifies it at boot. */
|
|
31
|
-
const UPDATED_FROM_ENV = '
|
|
33
|
+
const UPDATED_FROM_ENV = 'DSH_CLI_UPDATED_FROM';
|
|
32
34
|
/**
|
|
33
35
|
* env marker set on the /restart replacement: its boot logs to restart.log
|
|
34
36
|
* (ordinary launches stay silent, so the file is restart-only evidence).
|
|
35
37
|
*/
|
|
36
|
-
const RESTART_CHILD_ENV = '
|
|
38
|
+
const RESTART_CHILD_ENV = 'DSH_CLI_RESTART_CHILD';
|
|
37
39
|
/**
|
|
38
40
|
* Field-diagnosis log for the /restart terminal handoff, appended by BOTH
|
|
39
41
|
* processes: the exiting TUI logs the funnel path, the spawned replacement
|
|
@@ -56,7 +58,7 @@ function writeRestartLine(line) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
|
-
* Append a /restart handoff event to ~/.dsh-
|
|
61
|
+
* Append a /restart handoff event to ~/.dsh-cli/restart.log.
|
|
60
62
|
* @param event - Short stable event name.
|
|
61
63
|
* @param data - Small JSON-safe detail (never credentials or session text).
|
|
62
64
|
*/
|
|
@@ -95,26 +97,6 @@ export function writeHandoffNotice(text) {
|
|
|
95
97
|
process.stderr.write(text);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
/** Read the version from either the compiled package or the source checkout. */
|
|
99
|
-
export function installedTuiVersion() {
|
|
100
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
101
|
-
for (const relativePath of ['../../package.json', '../package.json']) {
|
|
102
|
-
try {
|
|
103
|
-
const parsed = JSON.parse(readFileSync(join(here, relativePath), 'utf8'));
|
|
104
|
-
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
105
|
-
const packageJson = parsed;
|
|
106
|
-
const version = packageJson.version;
|
|
107
|
-
if (packageJson.name === PACKAGE_NAME && typeof version === 'string' && valid(version) !== null) {
|
|
108
|
-
return version;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// Try the source-layout fallback after the compiled-layout path.
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
100
|
/**
|
|
119
101
|
* The profile this TUI was booted with (`dsh --profile <name>`), read from
|
|
120
102
|
* the launcher argv the process inherited. dsh sets no profile env var, and
|
|
@@ -166,7 +148,7 @@ export function isVersionNewer(current, previous) {
|
|
|
166
148
|
/**
|
|
167
149
|
* Versions whose compiled plugin hard-injects `tuiWorkspaces`
|
|
168
150
|
* ('0.7.0'–'0.7.1'; removed in 0.7.2). Installing one while the globally
|
|
169
|
-
* installed launcher copy predates the `dsh-
|
|
151
|
+
* installed launcher copy predates the `dsh-cli-workspaces` patch row
|
|
170
152
|
* deadlocks boot forever at "pending (waiting for service: tuiWorkspaces)"
|
|
171
153
|
* (issues #183/#307) — and /update reaching such a target is exactly how
|
|
172
154
|
* stale-mirror installs stranded users. /update must refuse them.
|
|
@@ -210,9 +192,9 @@ async function fetchLatestVersion(registryBase) {
|
|
|
210
192
|
* @returns `true` when running inside a standalone binary distribution, `false` otherwise.
|
|
211
193
|
*/
|
|
212
194
|
export function isStandaloneRuntime() {
|
|
213
|
-
return (process.env.
|
|
214
|
-
process.env.
|
|
215
|
-
(typeof process.env.DSH_HOME === 'string' && process.env.DSH_HOME.includes('dsh-
|
|
195
|
+
return (process.env.DSH_CLI_STANDALONE === '1' ||
|
|
196
|
+
process.env.DSH_CLI_STANDALONE_BINARY !== undefined ||
|
|
197
|
+
(typeof process.env.DSH_HOME === 'string' && process.env.DSH_HOME.includes('dsh-cli-standalone')));
|
|
216
198
|
}
|
|
217
199
|
/**
|
|
218
200
|
* Get the path to the current standalone executable binary.
|
|
@@ -220,7 +202,7 @@ export function isStandaloneRuntime() {
|
|
|
220
202
|
* @returns The resolved executable path from environment or `process.execPath`.
|
|
221
203
|
*/
|
|
222
204
|
export function getStandaloneBinaryPath() {
|
|
223
|
-
return process.env.
|
|
205
|
+
return process.env.DSH_CLI_STANDALONE_BINARY ?? process.execPath;
|
|
224
206
|
}
|
|
225
207
|
/**
|
|
226
208
|
* Get the expected release asset file name for the current platform and architecture.
|
|
@@ -231,16 +213,16 @@ export function getStandaloneBinaryPath() {
|
|
|
231
213
|
*/
|
|
232
214
|
export function getStandaloneAssetName(platform = process.platform, arch = process.arch) {
|
|
233
215
|
if (platform === 'win32') {
|
|
234
|
-
return 'dsh-
|
|
216
|
+
return 'dsh-cli-standalone-win-x64.zip';
|
|
235
217
|
}
|
|
236
218
|
if (platform === 'darwin') {
|
|
237
219
|
return arch === 'arm64'
|
|
238
|
-
? 'dsh-
|
|
239
|
-
: 'dsh-
|
|
220
|
+
? 'dsh-cli-standalone-darwin-arm64.tar.gz'
|
|
221
|
+
: 'dsh-cli-standalone-darwin-x64.tar.gz';
|
|
240
222
|
}
|
|
241
223
|
return arch === 'arm64'
|
|
242
|
-
? 'dsh-
|
|
243
|
-
: 'dsh-
|
|
224
|
+
? 'dsh-cli-standalone-linux-arm64.tar.gz'
|
|
225
|
+
: 'dsh-cli-standalone-linux-x64.tar.gz';
|
|
244
226
|
}
|
|
245
227
|
/**
|
|
246
228
|
* Locate the release's checksum manifest among its assets: the aggregator
|
|
@@ -287,7 +269,7 @@ async function probeChecksumManifestUrl(url) {
|
|
|
287
269
|
const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
|
|
288
270
|
try {
|
|
289
271
|
const response = await fetch(url, {
|
|
290
|
-
headers: { 'user-agent': 'dsh-
|
|
272
|
+
headers: { 'user-agent': 'dsh-cli-updater' },
|
|
291
273
|
redirect: 'follow',
|
|
292
274
|
signal: controller.signal,
|
|
293
275
|
});
|
|
@@ -314,7 +296,7 @@ export async function fetchGithubLatestRelease(options = {}) {
|
|
|
314
296
|
const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
|
|
315
297
|
try {
|
|
316
298
|
const response = await doFetch(`${options.apiBaseUrl ?? 'https://api.github.com'}/repos/${GITHUB_REPO}/releases/latest`, {
|
|
317
|
-
headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'dsh-
|
|
299
|
+
headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'dsh-cli-updater' },
|
|
318
300
|
signal: controller.signal,
|
|
319
301
|
});
|
|
320
302
|
if (!response.ok)
|
|
@@ -402,7 +384,7 @@ export function verifyAssetChecksum(buffer, manifestText, assetName) {
|
|
|
402
384
|
* Escape a value for embedding in a PowerShell single-quoted literal: only
|
|
403
385
|
* `''` needs escaping there (same convention as `buildPsScript` in
|
|
404
386
|
* src/utils/clipboard.ts). Extract/archive paths derive from environment
|
|
405
|
-
* variables (`
|
|
387
|
+
* variables (`DSH_CLI_STANDALONE_CACHE`), so an unescaped `'` closes the
|
|
406
388
|
* literal and turns the rest of the path into executable command text.
|
|
407
389
|
* @param value - Raw string to embed between single quotes.
|
|
408
390
|
* @returns The value with every `'` doubled.
|
|
@@ -518,7 +500,7 @@ async function fetchChecksumManifest(checksumUrl, maxManifestBytes = MAX_CHECKSU
|
|
|
518
500
|
const timeout = setTimeout(() => controller.abort(), STANDALONE_DOWNLOAD_TIMEOUT_MS);
|
|
519
501
|
try {
|
|
520
502
|
const response = await fetch(checksumUrl, {
|
|
521
|
-
headers: { 'user-agent': 'dsh-
|
|
503
|
+
headers: { 'user-agent': 'dsh-cli-updater' },
|
|
522
504
|
redirect: 'follow',
|
|
523
505
|
signal: controller.signal,
|
|
524
506
|
});
|
|
@@ -576,7 +558,7 @@ async function fetchChecksumManifest(checksumUrl, maxManifestBytes = MAX_CHECKSU
|
|
|
576
558
|
*/
|
|
577
559
|
export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress, checksumUrl, options = {}) {
|
|
578
560
|
const maxAssetBytes = options.maxAssetBytes ?? MAX_ASSET_BYTES;
|
|
579
|
-
const tempDir = join(process.env.
|
|
561
|
+
const tempDir = join(process.env.DSH_CLI_STANDALONE_CACHE ?? join(homedir(), '.cache', 'dsh-cli-standalone'), `.update-${Date.now()}-${process.pid}`);
|
|
580
562
|
try {
|
|
581
563
|
const currentBinary = getStandaloneBinaryPath();
|
|
582
564
|
const targetDir = dirname(currentBinary);
|
|
@@ -590,7 +572,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
|
|
|
590
572
|
let response;
|
|
591
573
|
try {
|
|
592
574
|
response = await fetch(downloadUrl, {
|
|
593
|
-
headers: { 'user-agent': 'dsh-
|
|
575
|
+
headers: { 'user-agent': 'dsh-cli-updater' },
|
|
594
576
|
redirect: 'follow',
|
|
595
577
|
signal: controller.signal,
|
|
596
578
|
});
|
|
@@ -682,7 +664,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
|
|
|
682
664
|
if (!treeCheck.ok) {
|
|
683
665
|
throw new Error(`unsafe release archive rejected: ${treeCheck.reason ?? 'unknown extraction anomaly'}`);
|
|
684
666
|
}
|
|
685
|
-
const binaryName = process.platform === 'win32' ? 'dsh-
|
|
667
|
+
const binaryName = process.platform === 'win32' ? 'dsh-cli.exe' : 'dsh-cli';
|
|
686
668
|
const newBinaryPath = join(extractDir, binaryName);
|
|
687
669
|
if (!existsSync(newBinaryPath)) {
|
|
688
670
|
throw new Error('No executable binary found in release archive');
|
|
@@ -727,7 +709,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
|
|
|
727
709
|
}
|
|
728
710
|
}
|
|
729
711
|
else {
|
|
730
|
-
const stagedTarget = join(targetDir, `.dsh-
|
|
712
|
+
const stagedTarget = join(targetDir, `.dsh-cli-new-${process.pid}`);
|
|
731
713
|
copyFileSync(newBinaryPath, stagedTarget);
|
|
732
714
|
chmodSync(stagedTarget, 0o755);
|
|
733
715
|
renameSync(stagedTarget, currentBinary);
|
|
@@ -759,8 +741,8 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
|
|
|
759
741
|
* say "installing X now, official latest is Y" instead of silently
|
|
760
742
|
* upgrading to yesterday's version.
|
|
761
743
|
*/
|
|
762
|
-
export async function
|
|
763
|
-
const current =
|
|
744
|
+
export async function resolveCliUpdateTarget() {
|
|
745
|
+
const current = installedCliVersion();
|
|
764
746
|
const currentVersion = current === undefined ? null : valid(current);
|
|
765
747
|
if (currentVersion === null)
|
|
766
748
|
return { kind: 'unknown' };
|
|
@@ -803,8 +785,8 @@ export async function resolveTuiUpdateTarget() {
|
|
|
803
785
|
* are intentionally treated as "no result" so an offline launch never delays
|
|
804
786
|
* or blocks the interactive TUI.
|
|
805
787
|
*/
|
|
806
|
-
export async function
|
|
807
|
-
const target = await
|
|
788
|
+
export async function checkForCliUpdate() {
|
|
789
|
+
const target = await resolveCliUpdateTarget();
|
|
808
790
|
return target.kind === 'update'
|
|
809
791
|
? {
|
|
810
792
|
current: target.current,
|
|
@@ -861,7 +843,7 @@ function runProcess(command, args, options = {}) {
|
|
|
861
843
|
});
|
|
862
844
|
}
|
|
863
845
|
/** Build the profile-manager command, preferring a preflight-pinned version. */
|
|
864
|
-
export function
|
|
846
|
+
export function cliUpdatePluginArgs(profile, targetVersion) {
|
|
865
847
|
return targetVersion === undefined
|
|
866
848
|
? ['plugin', '--profile', profile, 'update', '--latest', PACKAGE_NAME]
|
|
867
849
|
: ['plugin', '--profile', profile, 'update', `${PACKAGE_NAME}@${targetVersion}`];
|
|
@@ -894,7 +876,7 @@ function allowBuildsKeyLine(key) {
|
|
|
894
876
|
}
|
|
895
877
|
/**
|
|
896
878
|
* Make sure the profile's pnpm-workspace.yaml carries explicit `false`
|
|
897
|
-
* allowBuilds entries for the dsh-
|
|
879
|
+
* allowBuilds entries for the dsh-cli chain's postinstall-only deps, so a
|
|
898
880
|
* pnpm ≥11 update is not killed by ERR_PNPM_IGNORED_BUILDS. Best effort and
|
|
899
881
|
* idempotent: existing entries are never overwritten (an explicit user
|
|
900
882
|
* decision wins), a missing `allowBuilds:` block is appended, and a missing
|
|
@@ -1324,15 +1306,15 @@ export function removeStalePackageInstall(profile) {
|
|
|
1324
1306
|
}
|
|
1325
1307
|
/**
|
|
1326
1308
|
* Best-effort migrate the GLOBAL launcher to the delegating shim (0.8.7):
|
|
1327
|
-
* after a successful profile update, copy this package's `bin/dsh-
|
|
1309
|
+
* after a successful profile update, copy this package's `bin/dsh-cli.js`
|
|
1328
1310
|
* and `package.json` over the global install so the launcher can never lag
|
|
1329
1311
|
* the profile again — the shim delegates all logic to the profile copy it
|
|
1330
1312
|
* just updated. Single-file-safe by contract: the new bin imports nothing
|
|
1331
1313
|
* from lib/ (see its header), so overwriting it inside an older global
|
|
1332
1314
|
* install cannot dangle a missing helper.
|
|
1333
1315
|
*
|
|
1334
|
-
* Locating the global dir relies on argv[1] being the global `dsh-
|
|
1335
|
-
* (true when booted through the `dsh-
|
|
1316
|
+
* Locating the global dir relies on argv[1] being the global `dsh-cli.js`
|
|
1317
|
+
* (true when booted through the `dsh-cli` command). Source checkouts and
|
|
1336
1318
|
* direct `dsh --profile` boots resolve nothing — the migration is a silent
|
|
1337
1319
|
* no-op there. Write failures (permissions, locked files) are equally
|
|
1338
1320
|
* silent: the launcher-alignment warning remains the fallback diagnosis.
|
|
@@ -1341,7 +1323,7 @@ export function removeStalePackageInstall(profile) {
|
|
|
1341
1323
|
*/
|
|
1342
1324
|
export function migrateGlobalLauncher() {
|
|
1343
1325
|
const launcherBin = process.argv[1];
|
|
1344
|
-
if (launcherBin === undefined || !launcherBin.endsWith('dsh-
|
|
1326
|
+
if (launcherBin === undefined || !launcherBin.endsWith('dsh-cli.js'))
|
|
1345
1327
|
return false;
|
|
1346
1328
|
// Walk up from the bin to the containing package; accept it only when it
|
|
1347
1329
|
// is OUR package and not the profile copy we are running from (junction
|
|
@@ -1367,11 +1349,11 @@ export function migrateGlobalLauncher() {
|
|
|
1367
1349
|
// tmp + rename keeps each file atomic; a crash mid-migration leaves
|
|
1368
1350
|
// either the old or the new file, never a truncated one.
|
|
1369
1351
|
const replace = (target, source) => {
|
|
1370
|
-
const staged = `${target}.dsh-
|
|
1352
|
+
const staged = `${target}.dsh-cli-migrate`;
|
|
1371
1353
|
writeFileSync(staged, readFileSync(source));
|
|
1372
1354
|
renameSync(staged, target);
|
|
1373
1355
|
};
|
|
1374
|
-
replace(join(dir, 'bin', 'dsh-
|
|
1356
|
+
replace(join(dir, 'bin', 'dsh-cli.js'), join(ownDir, 'bin', 'dsh-cli.js'));
|
|
1375
1357
|
replace(manifest, join(ownDir, 'package.json'));
|
|
1376
1358
|
return true;
|
|
1377
1359
|
}
|
|
@@ -1389,7 +1371,7 @@ export function migrateGlobalLauncher() {
|
|
|
1389
1371
|
/**
|
|
1390
1372
|
* Install-only half of `/update`: run `dsh plugin add`, refuse boot-deadlock
|
|
1391
1373
|
* targets, verify the profile actually advanced, and migrate the global
|
|
1392
|
-
* launcher. No restart — `
|
|
1374
|
+
* launcher. No restart — `updateCliAndRestart` layers the session-preserving
|
|
1393
1375
|
* restart on top, and the `dsh-cli update` CLI stops here.
|
|
1394
1376
|
*
|
|
1395
1377
|
* @param profile - The dsh profile to update.
|
|
@@ -1397,15 +1379,15 @@ export function migrateGlobalLauncher() {
|
|
|
1397
1379
|
* undefined when that check failed and pnpm should resolve latest.
|
|
1398
1380
|
* @returns The update exit code plus the before/after versions.
|
|
1399
1381
|
*/
|
|
1400
|
-
export async function
|
|
1382
|
+
export async function updateCli(profile, targetVersion) {
|
|
1401
1383
|
// Stamp the pre-update version BEFORE pnpm runs: it reads this package's
|
|
1402
1384
|
// manifest from disk, which the update replaces on the fly — a
|
|
1403
1385
|
// post-update read already sees the NEW version, and the restarted
|
|
1404
1386
|
// process then compares new-vs-new and false-alarms "version did not
|
|
1405
1387
|
// advance" on every successful update (issue #307's screenshots).
|
|
1406
|
-
const updatedFrom =
|
|
1388
|
+
const updatedFrom = installedCliVersion() ?? '';
|
|
1407
1389
|
if (isStandaloneRuntime()) {
|
|
1408
|
-
const target = await
|
|
1390
|
+
const target = await resolveCliUpdateTarget();
|
|
1409
1391
|
const latestVersion = targetVersion ?? (target.kind === 'update' ? target.latest : undefined);
|
|
1410
1392
|
const downloadUrl = (target.kind === 'update' && target.downloadUrl)
|
|
1411
1393
|
? target.downloadUrl
|
|
@@ -1426,7 +1408,7 @@ export async function updateTui(profile, targetVersion) {
|
|
|
1426
1408
|
return { code: 0, updatedFrom, installed: latestVersion };
|
|
1427
1409
|
}
|
|
1428
1410
|
const dsh = process.platform === 'win32' ? 'dsh.cmd' : 'dsh';
|
|
1429
|
-
const updateArgs =
|
|
1411
|
+
const updateArgs = cliUpdatePluginArgs(profile, targetVersion);
|
|
1430
1412
|
// pnpm ≥11 hard-fails installs whose dependency tree carries un-allowlisted
|
|
1431
1413
|
// build scripts (ERR_PNPM_IGNORED_BUILDS). The dsh-auth chain pulls in
|
|
1432
1414
|
// postinstall-only deps (@google/genai/protobufjs via pi-ai), so pre-seed
|
|
@@ -1490,7 +1472,7 @@ export async function updateTui(profile, targetVersion) {
|
|
|
1490
1472
|
// #183/#307. Refuse the restart when the version JUST moved there; a user
|
|
1491
1473
|
// who was already on it keeps their restart (their combo demonstrably
|
|
1492
1474
|
// boots) and gets the repair hint on the next /update instead.
|
|
1493
|
-
const installedNow =
|
|
1475
|
+
const installedNow = installedCliVersion();
|
|
1494
1476
|
if (installedNow !== undefined && installedNow !== updatedFrom && isBootDeadlockTarget(installedNow)) {
|
|
1495
1477
|
process.stderr.write(`dsh-cli: update landed on ${installedNow}, which can permanently deadlock boot under older launcher patches ` +
|
|
1496
1478
|
`(#183/#307) — NOT restarting into it. Repair with:\n` +
|
|
@@ -1504,10 +1486,10 @@ export async function updateTui(profile, targetVersion) {
|
|
|
1504
1486
|
// node_modules, and if the mismatch survives, stop before restarting into
|
|
1505
1487
|
// a mixed state and hand the user the exact repair command instead.
|
|
1506
1488
|
if (targetVersion !== undefined) {
|
|
1507
|
-
let installed =
|
|
1489
|
+
let installed = installedCliVersion();
|
|
1508
1490
|
if (installed !== targetVersion) {
|
|
1509
1491
|
await runProcess(dsh, ['plugin', '--profile', profile, 'install'], { shell: true });
|
|
1510
|
-
installed =
|
|
1492
|
+
installed = installedCliVersion();
|
|
1511
1493
|
}
|
|
1512
1494
|
if (installed !== targetVersion) {
|
|
1513
1495
|
process.stderr.write(`dsh-cli: update completed but the profile still runs ${installed ?? 'an unreadable version'} ` +
|
|
@@ -1523,10 +1505,10 @@ export async function updateTui(profile, targetVersion) {
|
|
|
1523
1505
|
if (migrateGlobalLauncher()) {
|
|
1524
1506
|
process.stderr.write('dsh-cli: global launcher aligned to the delegating shim (no manual npm i -g needed anymore).\n');
|
|
1525
1507
|
}
|
|
1526
|
-
return { code: 0, updatedFrom, installed:
|
|
1508
|
+
return { code: 0, updatedFrom, installed: installedCliVersion() };
|
|
1527
1509
|
}
|
|
1528
1510
|
/**
|
|
1529
|
-
* Update the installed dsh-
|
|
1511
|
+
* Update the installed dsh-cli package and restart the same launcher while
|
|
1530
1512
|
* preserving the active session. The TUI must already be unmounted before
|
|
1531
1513
|
* this is called so pnpm output cannot corrupt the rendered terminal frame.
|
|
1532
1514
|
*
|
|
@@ -1543,8 +1525,8 @@ export async function updateTui(profile, targetVersion) {
|
|
|
1543
1525
|
* check, or undefined when that check failed and pnpm should resolve latest.
|
|
1544
1526
|
* @returns Exit codes for the update run and the replacement process.
|
|
1545
1527
|
*/
|
|
1546
|
-
export async function
|
|
1547
|
-
const outcome = await
|
|
1528
|
+
export async function updateCliAndRestart(sessionId, profile, targetVersion) {
|
|
1529
|
+
const outcome = await updateCli(profile, targetVersion);
|
|
1548
1530
|
const { updatedFrom } = outcome;
|
|
1549
1531
|
if (outcome.code !== 0)
|
|
1550
1532
|
return { updateCode: outcome.code, restartCode: outcome.code };
|
|
@@ -1555,7 +1537,7 @@ export async function updateTuiAndRestart(sessionId, profile, targetVersion) {
|
|
|
1555
1537
|
// child's keypresses, and capture a fast-death stderr report. The old
|
|
1556
1538
|
// plain inherit spawn raced the interpreter for input on Windows
|
|
1557
1539
|
// Terminal (issue #483: "cannot type anything after /update").
|
|
1558
|
-
const restartCode = await
|
|
1540
|
+
const restartCode = await restartCli(sessionId, {
|
|
1559
1541
|
env: { [UPDATED_FROM_ENV]: updatedFrom },
|
|
1560
1542
|
kind: 'update',
|
|
1561
1543
|
});
|
|
@@ -1571,7 +1553,7 @@ export async function updateTuiAndRestart(sessionId, profile, targetVersion) {
|
|
|
1571
1553
|
* @returns Process exit code: 0 on success or already-latest, 1 otherwise.
|
|
1572
1554
|
*/
|
|
1573
1555
|
export async function cliUpdate(profile) {
|
|
1574
|
-
const target = await
|
|
1556
|
+
const target = await resolveCliUpdateTarget();
|
|
1575
1557
|
if (target.kind === 'latest') {
|
|
1576
1558
|
process.stdout.write(`dsh-cli: already the latest version (${target.current}).\n`);
|
|
1577
1559
|
return 0;
|
|
@@ -1579,7 +1561,7 @@ export async function cliUpdate(profile) {
|
|
|
1579
1561
|
if (isStandaloneRuntime()) {
|
|
1580
1562
|
if (target.kind === 'update') {
|
|
1581
1563
|
process.stdout.write(`dsh-cli: updating standalone binary ${target.current} → ${target.latest}…\n`);
|
|
1582
|
-
const outcome = await
|
|
1564
|
+
const outcome = await updateCli(profile, target.latest);
|
|
1583
1565
|
if (outcome.code === 0) {
|
|
1584
1566
|
process.stdout.write(`dsh-cli: standalone binary updated successfully (${outcome.updatedFrom || target.current} → ${outcome.installed}).\n`);
|
|
1585
1567
|
}
|
|
@@ -1608,12 +1590,12 @@ export async function cliUpdate(profile) {
|
|
|
1608
1590
|
else {
|
|
1609
1591
|
process.stdout.write('dsh-cli: version check failed (offline or unreadable install) — falling back to `--latest`.\n');
|
|
1610
1592
|
}
|
|
1611
|
-
const outcome = await
|
|
1593
|
+
const outcome = await updateCli(profile, targetVersion);
|
|
1612
1594
|
if (outcome.code === 0) {
|
|
1613
1595
|
// A preflight-less run (`--latest` fallback) can "succeed" as a pnpm
|
|
1614
1596
|
// no-op: same manifest before and after. Say so instead of printing a
|
|
1615
1597
|
// vacuous `updated X → X` — the /update path surfaces the same state via
|
|
1616
|
-
// the
|
|
1598
|
+
// the DSH_CLI_UPDATED_FROM stamp on restart.
|
|
1617
1599
|
if (targetVersion === undefined && outcome.installed !== undefined && outcome.installed === outcome.updatedFrom) {
|
|
1618
1600
|
process.stdout.write(`dsh-cli: version did not advance (still ${outcome.installed}) — already the latest, or the registry has no newer release yet.\n`);
|
|
1619
1601
|
}
|
|
@@ -1623,7 +1605,7 @@ export async function cliUpdate(profile) {
|
|
|
1623
1605
|
}
|
|
1624
1606
|
return outcome.code;
|
|
1625
1607
|
}
|
|
1626
|
-
export async function
|
|
1608
|
+
export async function restartCli(sessionId, options = {}) {
|
|
1627
1609
|
const kind = options.kind ?? 'restart';
|
|
1628
1610
|
const tag = kind === 'update' ? 'update-restart' : 'restart';
|
|
1629
1611
|
const argv = [...process.execArgv, ...process.argv.slice(1)];
|
|
@@ -1643,8 +1625,8 @@ export async function restartTui(sessionId, options = {}) {
|
|
|
1643
1625
|
env: {
|
|
1644
1626
|
...process.env,
|
|
1645
1627
|
// The replacement resumes the current session through the launcher
|
|
1646
|
-
// contract (
|
|
1647
|
-
|
|
1628
|
+
// contract (DSH_CLI_RESUME_SESSION; see src/sessionHistory.ts).
|
|
1629
|
+
DSH_CLI_RESUME_SESSION: sessionId,
|
|
1648
1630
|
// Marks the replacement so its own boot logs to restart.log without
|
|
1649
1631
|
// noisy logging on every ordinary launch (/restart only).
|
|
1650
1632
|
...(kind === 'restart' ? { [RESTART_CHILD_ENV]: '1' } : {}),
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* to stored secrets. dsh resolves those refs into a session at launch, so an
|
|
7
7
|
* environment-only check reports "missing" for a key that works. This module
|
|
8
8
|
* only ever answers "is a ref declared": the value is never read, formatted, or
|
|
9
|
-
* logged. The launcher keeps a mirror of this check in `bin/dsh-
|
|
9
|
+
* logged. The launcher keeps a mirror of this check in `bin/dsh-cli.js` (it is
|
|
10
10
|
* dependency-free and cannot import `lib/`); the two must not diverge.
|
|
11
|
-
* @module dsh-
|
|
11
|
+
* @module dsh-cli/utils/credentials
|
|
12
12
|
*/
|
|
13
13
|
import { readFileSync } from 'node:fs';
|
|
14
14
|
import { homedir } from 'node:os';
|