#!/usr/bin/env node /** * `token-optimizer-update` -- is this copy behind, and upgrade it if it is. * * WHY A SEPARATE BIN RATHER THAN A FLAG ON `doctor`. `doctor` reports; it must * stay safe to run on anything at any time. Upgrading changes what is * installed, so it is its own command that a person types on purpose. Nothing * in the server, the daemon or a hook calls this. * * WHAT IT WILL NOT DO. Four of the six install methods are refused by name -- * an npx cache entry, a Claude Code plugin, a source checkout, and an install * this package did not place -- because running `npm install` for those would * either do nothing while reporting success or overwrite a developer's tree. * The refusal names the method and what to run instead. See `apply.ts`. * * NO NETWORK WRITES, NO TELEMETRY. The only request is the registry lookup * that `checkForUpdate` already makes for `doctor`. */ import type { UpdateReport } from './check.js'; import type { ApplyOptions, UpgradeResult } from './apply.js'; import { UpgradeOutcome } from './apply.js'; interface Options { readonly dryRun: boolean; readonly force: boolean; readonly checkOnly: boolean; readonly json: boolean; readonly help: boolean; } /** * Parse argv, refusing a flag this command does not have. * * An unknown flag is an error rather than ignored noise: `--dryrun` silently * ignored is an upgrade the reader did not ask for, performed because of a * typo. */ export declare function parseArguments(args: readonly string[]): Options | string; /** * The exit code for an outcome. * * `Planned` and `AlreadyCurrent` are zero: the command did what was asked. * `NotOurs` is 2 rather than 1 so a script can tell "this install is not mine * to upgrade" -- which no retry fixes -- from "the upgrade failed", which one * might. */ export declare function exitCode(outcome: UpgradeOutcome): number; /** * The three things this command does to the outside world, injectable. * * The registry lookup, the package-manager spawn and the writing are passed in * rather than reached for so a test can drive every branch of this function * without a network request, a spawned `npm`, or output on the real stdout. * Nothing in production passes these -- the defaults are the real ones -- so * the shipped path is the same code the tests exercise, minus the seams. */ export interface MainDependencies { readonly check?: () => Promise; readonly apply?: (report: UpdateReport, options: ApplyOptions) => Promise; readonly write?: (text: string) => void; } export declare function main(args: readonly string[], dependencies?: MainDependencies): Promise; export {}; //# sourceMappingURL=cli.d.ts.map