/** * `openlore update` — upgrade openlore to the latest published version * (change: add-zero-interaction-onboarding). * * The explicit companion to the passive update notifier. It detects HOW openlore * was installed (Homebrew / global npm / npx) and runs the correct upgrade, or * with --check just reports whether a newer version exists. Deterministic, no * LLM. The only network call is the npm dist-tag lookup (shared with the * notifier), and it fails soft. */ import { Command } from 'commander'; import { type PlatformCommandRuntime } from '../../utils/platform-command.js'; export type InstallMethod = 'homebrew' | 'npm-global' | 'npm-local' | 'npx' | 'unknown'; /** * Deterministic local evidence used to tell a global npm install apart from a * project-local one — the one distinction the module path alone cannot make * (a Windows global prefix and a project's `node_modules/openlore/` are * path-shaped alike). Every field is gathered from a local command or file read; * absent fields mean "no evidence", never "false". */ export interface InstallEvidence { /** Global `node_modules` root(s) from `npm root -g` (normalized). */ npmGlobalRoots?: string[]; /** True iff the project enclosing this install declares an `openlore` dependency. */ declaredAsProjectDependency?: boolean; } /** * Infer how the running openlore was installed from the executing module path * plus deterministic local evidence. Pure function of its inputs so it is * unit-testable; the impure evidence gathering lives in `gatherInstallEvidence`. * * Global-vs-local is decided by evidence, not a substring guess: a path under a * proven `npm root -g` (or a POSIX `lib/node_modules` global prefix) is global; a * `node_modules/openlore/` whose enclosing project declares the dependency is * local. Contradictory or absent evidence yields `'unknown'` — the command then * defers to the human rather than mutating the wrong install. */ export declare function detectInstallMethod(modulePath: string, evidence?: InstallEvidence): InstallMethod; /** * Gather the deterministic local evidence `detectInstallMethod` needs. Impure * (one local subprocess + one file read), fail-soft, no network. */ export declare function gatherInstallEvidence(modulePath: string, platform?: NodeJS.Platform, runtime?: PlatformCommandRuntime): Promise; /** * The shell command that upgrades each install method (null = nothing to run). * `npm-local` returns the per-project command, but `runUpdate` only PRINTS it — * a local dependency is never mutated for the user. */ export declare function upgradeCommandFor(method: InstallMethod, platform?: NodeJS.Platform, runtime?: PlatformCommandRuntime): { cmd: string; args: string[]; } | null; /** * The command to SHOW the user for `method`. * * `update` only ever REPORTS a command — the upgrade itself runs through `spawn` with an argv * and no shell — so what matters here is that the line is runnable if a user pastes it, not * that it is character-for-character what was spawned. * * On Windows it therefore prints the plain package-manager command rather than the resolved * invocation: the resolved form is not a command in PowerShell (see * PLAIN_UPGRADE_INSTRUCTION), and it is the same upgrade either way. That also means this * function cannot throw — a path that `formatPlatformCommand` refuses never reaches it — and * that no `$`-shaped path is ever printed into a shell whose expansion rules differ from the * POSIX ones the refusal models (change: harden-windows-hook-quoting). * * POSIX keeps the resolved, single-quoted form, which is both exact and paste-safe there. * * Exported as a test seam: `runUpdate` reaches this only after a network round-trip. */ export declare function printableCommand(invocation: { command: string; args: string[]; }, platform: NodeJS.Platform, method: InstallMethod): string; interface UpdateOpts { check?: boolean; dryRun?: boolean; } export declare function runUpdate(opts: UpdateOpts, platform?: NodeJS.Platform, runtime?: PlatformCommandRuntime): Promise; export declare const updateCommand: Command; export {}; //# sourceMappingURL=update.d.ts.map