/** * Best-effort npm latest check. Failures stay quiet. The TUI may offer to * install the version it just read, by number: `dsh plugin --profile * add dsh-ssh-tui@`. A bare package name lets pnpm keep the lockfile * pin (e.g. 0.3.7), and `@latest` is resolved a second time at install — under * pnpm's `minimumReleaseAge` that second lookup can quietly land on yesterday's * release while still exiting 0. */ import { spawn } from 'node:child_process'; export declare const PLUGIN_PACKAGE = "dsh-ssh-tui"; export declare function compareSemver(a: string, b: string): number; export declare function resolvePluginProfileName(env?: NodeJS.ProcessEnv): string; /** * The install command for one already-resolved version. * * The version is the number `checkForPluginUpdate` read from the registry, not * the `latest` dist-tag: handing pnpm the tag makes it resolve the release a * second time, and a release younger than `minimumReleaseAge` is then skipped * without an error. A caller with no resolved version passes `@latest`, which * is still better than a bare name. * @param profile - the profile the plugin is installed into. * @param version - the exact version to install. * @returns the command, safe to show the user and to run. */ export declare function pluginUpgradeCommand(profile?: string, version?: string): string; export declare function formatUpdateNotice(current: string, latest: string, profile?: string): string; export declare function fetchLatestNpmVersion(fetchImpl?: typeof fetch): Promise; export interface PluginUpdateInfo { current: string; latest: string; profile: string; command: string; notice: string; } export declare function checkForPluginUpdate(current: string): Promise; /** * How to re-run the dsh CLI that hosts this process. * * `spawn('dsh', …)` works on POSIX and fails on Windows with * `spawn dsh ENOENT`: a global install there is a `dsh.cmd` shim, and * CreateProcess does not apply `PATHEXT` to a bare name. Re-running the CLI we * are already inside — the same node binary and the same entry script — needs no * PATH lookup and no shell at all. The shell fallback is for the case where our * own entry is not visible (a bundled CLI), where Windows *does* need a shell for * the `.cmd` shim to resolve. */ export interface DshInvocation { command: string; /** Arguments that must precede the subcommand (node needs its entry script). */ prefix: string[]; shell: boolean; } export declare function resolveDshInvocation(options?: { execPath?: string; argv?: readonly string[]; platform?: NodeJS.Platform; exists?: (path: string) => boolean; }): DshInvocation; /** * The profile argument as the shell path needs it. * * `shell: true` joins argv with spaces and escapes nothing (Node documents * this), so a profile whose name contains whitespace would arrive as two * arguments. The no-shell path passes it through untouched, so this only has to * hold the fallback together. */ export declare function shellSafeProfile(profile: string): string; export declare function installPluginLatest(profile?: string, version?: string, deps?: { invocation?: DshInvocation; spawnFn?: typeof spawn; }): Promise<{ ok: boolean; output: string; }>;