@rockcarver/frodo-cli 5.0.0-6 → 5.0.0-7
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 +24 -0
- package/dist/AuthoringPrintState-vyWOD1Wt.cjs +124 -0
- package/dist/AuthoringPrintState-vyWOD1Wt.cjs.map +1 -0
- package/dist/ColorTheme-DEHDqYXV.cjs +172418 -0
- package/dist/ColorTheme-DEHDqYXV.cjs.map +1 -0
- package/dist/Console--leD9RdR.cjs +4655 -0
- package/dist/Console--leD9RdR.cjs.map +1 -0
- package/dist/DefaultsStore-RlEkAWqT.cjs +155 -0
- package/dist/DefaultsStore-RlEkAWqT.cjs.map +1 -0
- package/dist/EntityPickers-szvN8rXt.cjs +143 -0
- package/dist/EntityPickers-szvN8rXt.cjs.map +1 -0
- package/dist/EscapableSelectPrompt-Us2SkS12.cjs +2356 -0
- package/dist/EscapableSelectPrompt-Us2SkS12.cjs.map +1 -0
- package/dist/FrodoCommand-gFM6WHXw.cjs +15475 -0
- package/dist/FrodoCommand-gFM6WHXw.cjs.map +1 -0
- package/dist/RealmOps-CQwmHsxG.cjs +341 -0
- package/dist/RealmOps-CQwmHsxG.cjs.map +1 -0
- package/dist/RealmPickers-7b9g8ZTE.cjs +138 -0
- package/dist/RealmPickers-7b9g8ZTE.cjs.map +1 -0
- package/dist/ResolveInteractiveInputs-CQBVc_CT.cjs +1843 -0
- package/dist/ResolveInteractiveInputs-CQBVc_CT.cjs.map +1 -0
- package/dist/app.cjs +2 -2
- package/package.json +3 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResolveInteractiveInputs-CQBVc_CT.cjs","names":["canPrompt","ExitPromptError","createPrompt","useState","usePrefix","isEnterKey","c","c","createPrompt","useState","usePrefix","useRef","isEnterKey","armEscapeGrace","EXIT_ALL","isUpKey","isDownKey","c","renderNavigationMenu","navigationMenuItems","stripAnsi","renderFramedBox","createPrompt","useState","usePrefix","useMemo","useRef","isEnterKey","armEscapeGrace","EXIT_ALL","isUpKey","isDownKey","isSpaceKey","c","usePagination","renderNavigationMenu","navigationMenuItems","stripAnsi","descriptionPanelLines","renderFramedBox","frodo","canPrompt","state","promptsRendered","editableOptionsHint","escapableSelect","EXIT_ALL","EXIT_ALL_SIGNAL","ESCAPE","RIGHT","hasEntityPick","applicableCommandDefaults","optionMissingUserValue","editableOptionalOptions","editableOptionGroups","sortEditableOptions","editableOptionGroupOf"],"sources":["../src/utils/interactive/PromptGate.ts","../src/utils/interactive/CommandPreview.ts","../src/utils/interactive/ConnectionPagePrompt.ts","../src/utils/interactive/ChoiceSections.ts","../src/utils/interactive/EscapableMultiSelectPrompt.ts","../src/utils/interactive/PositionalArgs.ts","../src/utils/SettingsStore.ts","../src/cli/ResolveInteractiveInputs.ts"],"sourcesContent":["/**\n * Central gate deciding whether frodo may prompt interactively, plus the\n * terminal prompts built on `@inquirer/core` for gap-filling missing\n * command input (docs/INTERACTIVE-COMMANDS.md).\n *\n * ## The gate\n *\n * Re-exported from `PromptGateState.ts` (which holds its full\n * documentation and stays importable from unit tests -- this file pulls\n * in the frodo-lib-importing ColorTheme, and this CLI's Jest setup cannot\n * load frodo-lib; see src/app.commandWiring.test.ts's header comment).\n *\n * ## The prompts\n *\n * Deliberately hand-built on `@inquirer/core` (same pattern as the\n * existing exemplars `EscapableSelectPrompt.ts`/`JourneyDebugPrompt.ts`)\n * rather than adding `@inquirer/input`/`@inquirer/password`: the packaged\n * prompts throw `ExitPromptError` on Escape and EOF, while the gap-fill\n * layer needs Escape to resolve to a sentinel so callers can fall through\n * to their pre-existing missing-input error paths -- which is exactly the\n * contract the existing hand-built prompts already established.\n */\n\nimport {\n createPrompt,\n ExitPromptError,\n isEnterKey,\n useKeypress,\n usePrefix,\n useState,\n} from '@inquirer/core';\nimport c from '../ColorTheme';\nimport { canPrompt, notePromptRendered } from './PromptGateState';\n\nexport {\n canPrompt,\n notePromptRendered,\n promptsRendered,\n setNeverPrompt,\n} from './PromptGateState';\n\n/**\n * The empty-string result of `promptInput`/`promptPassword`. The prompts\n * resolve with `''` in two cases that callers must tell apart, so this\n * sentinel is what they branch on: the user pressed Enter on an empty\n * line (meaning \"I have nothing to type\", e.g. no password), versus\n * `undefined`, which means prompting was disallowed by the gate and the\n * caller should simply fall through to its pre-existing missing-input\n * error path without printing anything prompt-related.\n *\n * Escape ALSO resolves with `''` -- for gap-fills, \"never mind, I'll type\n * the flag myself\" and \"there is no password\" have the same practical\n * outcome (no value supplied, command proceeds to its existing error), so\n * a separate escape sentinel would only add API surface. `promptInput`\n * renders `(no input)` after resolving so the transcript shows what\n * happened.\n */\nexport const EMPTY_INPUT = '';\n\nexport type TextInputConfig = {\n message: string;\n /**\n * Value applied when the user presses Enter on an empty line (shown as\n * a muted hint). When omitted, Enter-on-empty resolves `''` and the\n * caller decides what that means.\n */\n default?: string;\n};\n\n/**\n * A `promptInput`/`promptPassword` result: `undefined` (gate refused --\n * caller falls through silently to its existing missing-input path),\n * `''` (user aborted/declined -- caller treats as missing input with its\n * existing error), or a non-empty string.\n */\nexport type TextInputResult = string | undefined;\n\n/**\n * Read a line of free-form text. Paste-safe and editable (the readline\n * buffer does the editing; the prompt only reads it), unlike accumulating\n * individual keypresses by hand.\n */\nexport async function promptInput(\n config: TextInputConfig\n): Promise<TextInputResult> {\n if (!canPrompt()) return undefined;\n return runTextPrompt(config, { suppress: false });\n}\n\n/**\n * Read a line of text without echoing it (passwords, passphrases, and\n * similar secrets). Same result contract as `promptInput`.\n */\nexport async function promptPassword(\n config: TextInputConfig\n): Promise<TextInputResult> {\n if (!canPrompt()) return undefined;\n return runTextPrompt(config, { suppress: true });\n}\n\n/**\n * Terminal conditions outside the user's in-prompt choices: stdin EOF\n * (Ctrl-D, e.g. the driver's shutdown write) and Ctrl-C both reject the\n * prompt with @inquirer/core's ExitPromptError. For gap-fills both mean\n * \"no value supplied\" and must degrade to the declined result (`''`) so\n * the caller falls through to its pre-existing missing-input error --\n * never a raw stack trace. (Escape is handled in-prompt, so it never\n * reaches this wrapper.)\n */\nasync function runTextPrompt(\n config: TextInputConfig,\n opts: { suppress: boolean }\n): Promise<string> {\n notePromptRendered();\n try {\n return await textPrompt(config, opts);\n } catch (error) {\n if (error instanceof ExitPromptError) return EMPTY_INPUT;\n throw error;\n }\n}\n\nfunction textPrompt(\n config: TextInputConfig,\n { suppress }: { suppress: boolean }\n): Promise<string> {\n const TextPrompt = createPrompt(\n (cfg: TextInputConfig, done: (value: string) => void) => {\n // The readline buffer (`rl.line`) is the source of truth for the\n // typed text -- editing (backspace, ctrl+u, paste) is readline's\n // job. It is mirrored into state on every keystroke because of an\n // ordering subtlety verified against the installed @inquirer/core:\n // when Enter arrives, readline has ALREADY consumed and cleared its\n // buffer, so reading `rl.line` inside the Enter branch sees `''`\n // (the typed text only ever visible on non-Enter keypresses). The\n // mirror is written by the keypress immediately before Enter in\n // stream order, so reading state there sees the completed line.\n const [value, setValue] = useState('');\n const [status, setStatus] = useState<'idle' | 'done' | 'declined'>(\n 'idle'\n );\n const prefix = usePrefix({\n status: status === 'declined' ? 'done' : status,\n });\n\n useKeypress((key, rl) => {\n if (isEnterKey(key)) {\n // rl.line is already consumed at this point (see above); use the\n // mirror, falling back defensively for a bare first-keystroke\n // Enter.\n const line = value || rl.line || '';\n if (line.length === 0 && cfg.default !== undefined) {\n setValue(cfg.default);\n setStatus('done');\n done(cfg.default);\n } else if (line.length === 0) {\n // Enter on an empty line with no default: a deliberate \"no\n // value\". Same resolution as Escape (see EMPTY_INPUT), but\n // rendered distinctly so the transcript shows the user\n // actively declined rather than backed out.\n setStatus('declined');\n done('');\n } else {\n setValue(line);\n setStatus('done');\n done(line);\n }\n } else if (key.name === 'escape') {\n setStatus('declined');\n done('');\n } else {\n // Everything else (typing, backspace, ctrl+u, paste...) is\n // handled by the underlying readline instance itself. Mirroring\n // `rl.line` into state drives the redraw AND keeps the\n // completed line available to the Enter branch above.\n setValue(rl.line);\n }\n });\n\n const defaultHint =\n cfg.default !== undefined && !suppress\n ? ` ${c.muted(`(${cfg.default})`)}`\n : '';\n\n if (status === 'declined') {\n return `${prefix} ${config.message} ${c.muted('(no input)')}`;\n }\n if (status === 'done') {\n const shown = suppress ? '*'.repeat(value.length) : value;\n return `${prefix} ${config.message} ${c.positive(shown)}`;\n }\n\n // Idle view: readline's native echo of the buffer is muted (see\n // create-prompt's output.mute()), so the typed characters would not\n // appear at all unless the view renders them. A suppressed prompt\n // shows one asterisk per typed character instead of the text.\n const shown = suppress ? '*'.repeat(value.length) : value;\n return `${prefix} ${config.message}${defaultHint}${shown ? ` ${c.command(shown)}` : ''}`;\n }\n );\n return TextPrompt(config, { clearPromptOnDone: true });\n}\n","/**\n * The command preview (docs/INTERACTIVE-COMMANDS.md): the\n * command being authored, rendered live inside the interactive prompts\n * as a footer line -- red + cursive while mandatory input is missing,\n * green/white upright when validated and ready. On the final `<enter>`\n * the resolver prints the full command once more, not cleaned away, so\n * it stays scrollable/copyable: the authoring-tool moment.\n *\n * Zero-import module (EditableOptions pattern): pure commander\n * serialization, importable from any prompt module without dragging\n * frodo-lib graphs into tests that mock frodo-lib wholesale. The\n * resolver computes the readiness input (it owns the mandatory/one-of\n * registries); this module only renders.\n */\n\nimport type { Command, Option } from 'commander';\nimport c from '../ColorTheme';\n\n/**\n * frodo-lib's sentinel default for \"no realm chosen yet\" and its\n * per-deployment-type translations (the same mapping frodo-lib's\n * determineDefaultRealm applies during auth). Zero-import constraint:\n * the map is duplicated here rather than imported from frodo-lib --\n * if the lib map ever changes, this copy MUST change with it (the test\n * below pins the values).\n */\nconst DEFAULT_REALM_KEY = '__default__realm__';\nconst DEPLOYMENT_TYPE_REALM_MAP: Record<string, string> = {\n classic: '/',\n cloud: 'alpha',\n forgeops: '/',\n};\n\n/**\n * The deployment type the resolver knows for this process (set from the\n * CLI side via setDeploymentTypeForPreview -- the resolution pass and\n * profile loading may resolve it in either order relative to the first\n * prompt render). Undefined = not yet known.\n */\nlet previewDeploymentType: string | undefined;\n\n/**\n * Records the deployment type for sentinel translation in the preview.\n * Called by the resolution pass when the deployment type is (or becomes)\n * known: CLI-provided (-m/--type), connection-profile-carried, or\n * persisted.\n */\nexport function setDeploymentTypeForPreview(type: string | undefined): void {\n previewDeploymentType = type;\n}\n\n/**\n * Translates a positional value for serialization. The realm sentinel\n * NEVER displays: with a known deployment type it becomes that type's\n * default realm (alpha on cloud, / on classic/forgeops -- the SAME\n * translation frodo-lib applies during auth, so the printed command is\n * exactly what the run will execute; printing the TRANSLATED value is\n * deliberate -- defaults can change between frodo versions, and a CI\n * pipeline that copy-pasted the printed command must keep reading and\n * writing the realm it was authored against, pinning the value now\n * beats a silent realm change on upgrade). Before the type is known\n * (e.g. the profile picker footer, where no host has been picked yet)\n * the positional is OMITTED entirely -- the sentinel is an\n * implementation detail no user ever typed or should ever see, and the\n * live footer is a status display, not a copy-paste surface; by the\n * final authoring print the type is always resolved, so the pipeline\n * guarantee is unaffected.\n */\nfunction serializePositionalValue(argumentName: string, value: string): string {\n if (argumentName === 'password') return '********';\n if (argumentName === 'realm' && value === DEFAULT_REALM_KEY) {\n const translated =\n previewDeploymentType && DEPLOYMENT_TYPE_REALM_MAP[previewDeploymentType];\n return translated ?? '';\n }\n return value;\n}\n\n/** Options that are machinery, not configuration -- never serialized. */\nconst NON_SERIALIZABLE_OPTIONS = new Set([\n 'help',\n 'help-more',\n 'help-all',\n 'version',\n // The prompting switch is a dual option pair (--prompt + --no-prompt)\n // sharing the `prompt` attribute -- both name() spellings excluded.\n 'prompt',\n 'no-prompt',\n 'edit',\n 'save-defaults',\n]);\n\n/**\n * What the resolver knows about the command's completeness: labels of\n * mandatory options still without values, whether any registered one-of\n * group is unsatisfied, and whether the connection level is resolved\n * (env/profile/interactive all count -- the connection positionals can\n * legitimately stay empty while the connection is fully resolved, so the\n * resolver owns this truth; see isCommandReady).\n */\nexport type CommandReadiness = {\n missingMandatoryOptionLabels: string[];\n oneOfUnsatisfied: boolean;\n /**\n * Connection-level resolution per the resolver. Optional so ad-hoc\n * callers (tests, the final print) can omit it: omitted means \"the\n * caller isn't tracking connection state\" -- ready.\n */\n connectionResolved?: boolean;\n};\n\n/**\n * Serializes the command as it would be typed on the command line today\n * -- every valued option as its flag (value placeholder included),\n * valued positional arguments in order. Secrets (the password\n * positional) are masked; values are shell-safe by inspection but NOT\n * shell-quoted -- this is a preview, not an eval string.\n */\nexport function serializeCommand(command: Command): string {\n const parts: string[] = [commandPath(command)];\n\n const args: string[] = [];\n command.registeredArguments.forEach((argument, index) => {\n const value = command.processedArgs?.[index];\n if (typeof value !== 'string' || value.length === 0) return;\n const serialized = serializePositionalValue(argument.name(), value);\n // A positional the serializer declines (the realm sentinel before\n // the deployment type is known) drops out entirely -- never a bare\n // placeholder in the token stream.\n if (serialized.length === 0) return;\n args.push(serialized);\n });\n // Positionals come after the command word, before options -- but\n // commander's own usage puts them at the end of the token stream as\n // typed; keep argv order: positionals first (as typed), then options.\n parts.push(...args);\n\n for (const option of command.options as Option[]) {\n if (NON_SERIALIZABLE_OPTIONS.has(option.name())) continue;\n const value = command.getOptionValue(option.attributeName());\n // A `false` value means \"unset\" for a plain option -- but for a\n // negatable one (--no-cache) it's the user's authored negative form\n // and serializes as the flag itself.\n if (\n value === undefined ||\n value === '' ||\n (!option.negate && value === false)\n )\n continue;\n // Only what the USER provided this invocation: commander defaults\n // (--retry nothing, --no-cache...) are runtime detail, not authored\n // input -- the preview is a copy-paste source, so it shows exactly\n // the tokens a user would type.\n if (command.getOptionValueSource(option.attributeName()) === 'default')\n continue;\n if (value === true || option.negate) {\n // Boolean flags, and the user-typed negative form (--no-cache,\n // value false), serialize as the flag alone -- \"--no-cache false\"\n // is not a re-typable token.\n parts.push(option.flags.split(/[, ]+/)[0]);\n } else if (Array.isArray(value)) {\n // ListOption families collect repeats into an array -- copy-paste\n // fidelity needs the repeated-flag form, not String() joining\n // (--env a=1,b=2 is not a valid re-type).\n const longFlag = option.flags\n .split(/[, ]+/)\n .find((token) => token.startsWith('--'));\n for (const entry of value) {\n parts.push(`${longFlag ?? option.flags} ${String(entry)}`);\n }\n } else {\n const longFlag = option.flags\n .split(/[, ]+/)\n .find((token) => token.startsWith('--'));\n parts.push(`${longFlag ?? option.flags} ${String(value)}`);\n }\n }\n return parts.join(' ');\n}\n\n/**\n * The `frodo x y z` path of the command (root name + ancestors + this).\n */\nfunction commandPath(command: Command): string {\n const names: string[] = [];\n for (\n let cursor: Command | undefined = command;\n cursor;\n cursor = cursor.parent\n ) {\n names.unshift(cursor.name());\n }\n return names.join(' ');\n}\n\n/**\n * Whether the command still has mandatory input to collect (red+cursive\n * in the preview) or is validated and ready (green/white): a deferred\n * mandatory option, an unsatisfied one-of group, or -- per the resolver's\n * readiness input -- an unresolved connection. Positional values are NOT\n * sniffed here: host/username/password can legitimately resolve from\n * env/profile without ever landing in the command object (the resolver's\n * own fallbacks), so only the resolver can say whether the connection\n * level is satisfied.\n */\nexport function isCommandReady(\n _command: Command,\n readiness: CommandReadiness\n): boolean {\n if (readiness.missingMandatoryOptionLabels.length > 0) return false;\n if (readiness.oneOfUnsatisfied) return false;\n return readiness.connectionResolved !== false;\n}\n\n/**\n * The preview footer line for the prompts: colored per readiness state\n * (red + cursive = still missing mandatory input; green/white = ready).\n */\nexport function renderCommandPreview(\n command: Command,\n readiness: CommandReadiness\n): string {\n const serialized = serializeCommand(command);\n if (isCommandReady(command, readiness)) {\n return c.positive(serialized);\n }\n return c.italic(c.negative(serialized));\n}\n\n/**\n * The default highlighted-value→option-value mapping: pass-through for\n * strings (value pickers), otherwise undefined (entity objects, the\n * \"enter manually\" sentinel -- the callback renders the committed state).\n */\nfunction defaultToValue(highlighted: unknown): string | undefined {\n return typeof highlighted === 'string' ? highlighted : undefined;\n}\n\n/**\n * LIVE preview footer (the footer shows what the\n * user is INFLUENCING, not what they last committed). Returns a callback\n * for a prompt's `preview` config that re-renders on every highlight\n * change: the highlighted value is serialized into a SHADOW copy of the\n * command's positional (the real command object is untouched -- only\n * <enter> commits), so arrowing through e.g. a realm list moves the\n * footer's realm token in real time. When nothing is highlighted\n * (filtered to no matches) the callback falls back to the command's\n * committed state.\n *\n * Options picks pass `undefined` as the positional name and use the\n * option-name variant below instead; this helper is for positionals\n * (realm, host...).\n */\nexport function livePositionalPreview(\n command: Command,\n positionalName: string,\n readiness: CommandReadiness\n): (highlighted: unknown) => string {\n const index = command.registeredArguments.findIndex(\n (argument) => argument.name() === positionalName\n );\n return (highlighted) => {\n const value = defaultToValue(highlighted);\n if (index !== -1 && command.processedArgs && value) {\n // Shadow the positional for THIS render only. The committed value\n // is restored implicitly: the next render re-invokes with the new\n // highlight, and the command object itself is never written.\n const committed = command.processedArgs[index];\n command.processedArgs[index] = value;\n try {\n return renderCommandPreview(command, readiness);\n } finally {\n command.processedArgs[index] = committed;\n }\n }\n return renderCommandPreview(command, readiness);\n };\n}\n\n/**\n * LIVE preview for an entity/option/value picker: the highlighted\n * choice's value (after `toValue`) is serialized into a SHADOW copy of\n * the named OPTION (source 'cli', the same source the real apply uses)\n * for this render only. Restoring writes the previous value+source back\n * verbatim: for a never-set option that is (undefined, undefined), which\n * is exactly commander's pristine state (getOptionValue -> undefined,\n * serializer skips it). `toValue` maps the highlighted choice to the\n * option's value form -- identity for value pickers, the entity's label\n * for entity pickers (whose choice values are the raw entities, exactly\n * what the real apply writes); a mapping to undefined/empty renders the\n * committed state.\n */\nexport function liveOptionPreview(\n command: Command,\n optionName: string,\n readiness: CommandReadiness,\n toValue: (highlighted: unknown) => string | undefined = defaultToValue\n): (highlighted: unknown) => string {\n return (highlighted) => {\n const value = toValue(highlighted);\n if (value && value.length > 0) {\n const committed = command.getOptionValue(optionName);\n const committedSource = command.getOptionValueSource(optionName);\n command.setOptionValueWithSource(optionName, value, 'cli');\n try {\n return renderCommandPreview(command, readiness);\n } finally {\n command.setOptionValueWithSource(\n optionName,\n committed as never,\n committedSource as never\n );\n }\n }\n return renderCommandPreview(command, readiness);\n };\n}\n\n/**\n * LIVE preview for the invocation editor (a MULTI-select): the callback\n * receives the currently SELECTED attribute names (the space-toggled\n * set), and the footer renders each as its flag -- booleans commit `true`\n * on the editor's pick, valued options still need their value step, so\n * they serialize as the flag with the value placeholder the user is\n * about to fill (\"--type <type>\"). The real command object is never\n * written here: every shadow is applied for THIS render and restored in\n * the finally. An empty selection renders the committed state.\n */\nexport function liveMultiOptionPreview(\n command: Command,\n readiness: CommandReadiness\n): (selectedAttributeNames: unknown[]) => string {\n return (selectedAttributeNames) => {\n if (!Array.isArray(selectedAttributeNames)) {\n return renderCommandPreview(command, readiness);\n }\n const shadows: {\n optionName: string;\n committed: unknown;\n committedSource: string | undefined;\n }[] = [];\n for (const attributeName of selectedAttributeNames) {\n if (typeof attributeName !== 'string') continue;\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n if (!option) continue;\n // Booleans serialize as the flag alone; valued options as the\n // flag + placeholder -- but ONLY while no user value stands: an\n // option whose value IS committed this invocation (source 'cli',\n // inline editor or the command line) serializes its REAL value --\n // the footer must not un-see a value the user already gave (it\n // would render `--retry <strategy>` beside a committed `network`).\n const boolean = !/<[^>]+>|\\[[^\\]]+\\]/.test(option.flags);\n const committed = command.getOptionValue(attributeName);\n const committedSource = command.getOptionValueSource(attributeName);\n const hasUserValue =\n committedSource === 'cli' &&\n committed !== undefined &&\n (!Array.isArray(committed) || committed.length > 0);\n shadows.push({\n optionName: attributeName,\n committed,\n committedSource,\n });\n // A valued option with a real user value: leave it as-is (the\n // serializer renders the value, arrays as repeated flags).\n if (!boolean && hasUserValue) continue;\n // The placeholder token straight from the flags spec (\"<type>\",\n // \"[file]\") -- the serializer emits `${longFlag} ${value}`, so a\n // value of \"<type>\" renders \"--type <type>\": the flag with the\n // value slot the user is about to fill.\n // value slot the user is about to fill.\n const placeholder =\n option.flags\n .split(/[, ]+/)\n .filter((token) => /^[<[].*>?\\]?$/.test(token))\n .join(' ') || 'value';\n command.setOptionValueWithSource(\n attributeName,\n boolean ? true : placeholder,\n 'cli'\n );\n }\n try {\n return renderCommandPreview(command, readiness);\n } finally {\n for (const shadow of shadows.reverse()) {\n command.setOptionValueWithSource(\n shadow.optionName,\n shadow.committed as never,\n shadow.committedSource as never\n );\n }\n }\n };\n}\n","import {\n createPrompt,\n isDownKey,\n isEnterKey,\n isUpKey,\n useEffect,\n useKeypress,\n usePrefix,\n useRef,\n useState,\n} from '@inquirer/core';\nimport c from '../ColorTheme';\nimport { armEscapeGrace, EXIT_ALL } from './ExitAll';\nimport {\n navigationMenuItems,\n renderFramedBox,\n renderNavigationMenu,\n stripAnsi,\n} from './NavigationMenu';\nimport { notePromptRendered } from './PromptGateState';\n\n/**\n * Resolved by `connectionPage` when the user presses Escape on the page\n * (not inside a row editor): \"don't touch connection args\". The caller\n * falls back to its pre-existing behavior (today: the sequential\n * prompts; for an already-resolved visit, just conclude).\n */\nexport const PAGE_ESCAPE = Symbol('connectionPage:escape');\n\n/** The masked rendering of a password row's stored value. */\nconst PASSWORD_MASK = '••••••••';\n\nexport type ConnectionPageRow = {\n /** Stable identifier the caller maps values back from. */\n key: 'host' | 'username' | 'password';\n label: string;\n /**\n * Current value as resolved by the caller so far (profile, env, CLI).\n * Password rows render masked regardless.\n */\n value?: string;\n /** Where the value came from, e.g. \"from profile prod\". */\n note?: string;\n};\n\nexport type ConnectionPageConfig = {\n message: string;\n rows: ConnectionPageRow[];\n /**\n * Command preview: the command being authored, rendered as a\n * footer line (pre-rendered by CommandPreview.ts).\n */\n preview?: string;\n /**\n * Called when the user commits an edit to the host row -- the\n * credential rows' profile context keys on the host, so the caller\n * re-resolves their annotations. Receives the new host, returns the\n * updated rows (same keys; values/notes refreshed).\n */\n onHostChange?: (host: string) => Promise<ConnectionPageRow[]>;\n};\n\n/**\n * The connection page (docs/INTERACTIVE-COMMANDS.md): a\n * single-page form for host + username + password showing RESOLVED\n * current values with their provenance, replacing the sequential\n * prompts when connection input is missing and reachable via → when\n * everything is already resolved.\n *\n * Key language (docs/INTERACTIVE-COMMANDS.md): ↑↓ between rows, `<enter>` on a row opens its\n * inline editor (typing edits; `<enter>` commits, `<esc>` cancels the\n * edit), `<enter>` on the Done row concludes the page, `<esc>` on the\n * page declines it entirely (PAGE_ESCAPE). The password row masks its\n * value and draft both when stored and while typing; an empty commit on\n * a password row KEEPS the stored value (a masked row you didn't mean\n * to change must not become blank).\n *\n * Host edits re-resolve the credential rows via `onHostChange` (the\n * profile lookup keys on the host); the page shows a resolving state\n * and ignores keys until it completes.\n *\n * Hand-built on @inquirer/core for the same reasons as the other prompts\n * in this directory: the packaged prompts can't express Escape-as-\n * sentinel, and a form is exactly the kind of interaction the packaged\n * set has no answer for.\n */\ntype ConnectionPageFn = (\n config: ConnectionPageConfig\n) => Promise<\n | { host?: string; username?: string; password?: string }\n | typeof PAGE_ESCAPE\n | typeof EXIT_ALL\n>;\n\nconst connectionPageImpl = createPrompt(\n (config: ConnectionPageConfig, done: (value: unknown) => void) => {\n const [rows, setRows] = useState<ConnectionPageRow[]>(config.rows);\n // The Done row sits after the field rows.\n const doneIndex = config.rows.length;\n const [active, setActive] = useState(0);\n const [status, setStatus] = useState<'idle' | 'done' | 'escaped'>('idle');\n const [editing, setEditing] = useState<null | ConnectionPageRow['key']>(\n null\n );\n const [draft, setDraft] = useState('');\n const [resolving, setResolving] = useState(false);\n const prefix = usePrefix({\n status: status === 'escaped' ? 'done' : status,\n });\n // readline consumes its buffer when Enter fires (verified pattern in\n // textPrompt); the draft mirror is the source of truth for commits.\n const draftRef = useRef('');\n // The double-ESC grace (see ExitAll.ts): the first ESC opens a short\n // window instead of acting; a second ESC inside it exits all, an\n // expired window (or any other key) performs the single-ESC action.\n const escapeGraceRef = useRef<\n ReturnType<typeof armEscapeGrace> | undefined\n >(undefined);\n const [escapeGraceOpen, setEscapeGraceOpen] = useState(false);\n const resolvingRef = useRef(false);\n\n // Grace teardown on unmount.\n useEffect(() => () => escapeGraceRef.current?.dispose(), []);\n\n useEffect(() => {\n draftRef.current = draft;\n }, [draft]);\n\n const commitRow = async (key: ConnectionPageRow['key'], value: string) => {\n setEditing(null);\n setDraft('');\n if (key === 'host' && config.onHostChange) {\n // The credential rows' provenance keys on the host: re-resolve\n // before accepting more input.\n setResolving(true);\n resolvingRef.current = true;\n try {\n const updated = await config.onHostChange(value);\n setRows(updated);\n } catch {\n // Re-resolution is best-effort; keep the current rows.\n }\n setResolving(false);\n resolvingRef.current = false;\n } else {\n setRows((previous) =>\n previous.map((row) => (row.key === key ? { ...row, value } : row))\n );\n }\n };\n\n const conclude = () => {\n setStatus('done');\n const result: Record<string, string | undefined> = {};\n for (const row of rows) result[row.key] = row.value;\n done(result);\n };\n\n useKeypress((key, rl) => {\n if (resolvingRef.current) return; // host re-resolution in flight\n if (editing !== null) {\n if (isEnterKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n // readline already consumed its buffer (textPrompt pattern);\n // read the mirror.\n const line = draft || rl.line || '';\n if (editing === 'password' && line.length === 0) {\n // Empty commit on the masked row = keep the stored value.\n void commitRow(\n editing,\n rows.find((r) => r.key === 'password')?.value ?? ''\n );\n } else {\n void commitRow(editing, line);\n }\n } else if (key.name === 'escape') {\n // Double-ESC inside the row editor: exit all (see ExitAll.ts\n // grace); a single press closes the editor (\"back one level\").\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n setEditing(null);\n setDraft('');\n setStatus('escaped');\n done(EXIT_ALL);\n },\n onGraceExpire: () => {\n setEscapeGraceOpen(false);\n setEditing(null);\n setDraft('');\n rl.clearLine(0);\n },\n });\n return;\n } else {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setDraft(rl.line);\n }\n return;\n }\n if (key.name === 'escape') {\n // Double-ESC exits all the way (see ExitAll.ts grace); a single\n // press (after the grace expires) declines the page as before.\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n setEscapeGraceOpen(false);\n setStatus('escaped');\n done(EXIT_ALL);\n },\n onGraceExpire: () => {\n setEscapeGraceOpen(false);\n setStatus('escaped');\n done(PAGE_ESCAPE);\n },\n });\n return;\n } else if (isEnterKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n if (active === doneIndex) {\n conclude();\n } else {\n const row = rows[active];\n setEditing(row.key);\n setDraft('');\n rl.clearLine(0);\n }\n } else if (isUpKey(key) || isDownKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n const offset = isUpKey(key) ? -1 : 1;\n setActive(\n active + offset < 0 ? doneIndex : (active + offset) % (doneIndex + 1)\n );\n }\n // Other keys on the page (not editing a row) are ignored -- a form\n // has no type-to-filter.\n });\n\n const renderValue = (row: ConnectionPageRow, isEditing: boolean) => {\n if (isEditing) {\n return row.key === 'password' ? '•'.repeat(draft.length) : draft;\n }\n if (row.value === undefined || row.value === '') {\n return c.muted('(not set)');\n }\n return row.key === 'password' ? c.muted(PASSWORD_MASK) : row.value;\n };\n\n if (status === 'escaped') {\n return `${prefix} ${config.message} ${c.muted('(cancelled)')}`;\n }\n if (status === 'done') {\n return `${prefix} ${config.message} ${c.positive('saved for this invocation')}`;\n }\n\n const resolvingNote = resolving\n ? c.muted(' (re-resolving credentials...)')\n : '';\n // The navigation menu (see NavigationMenu.ts): framed box at the\n // TOP; the page's enter has two roles (edit a row / conclude on\n // Done), so the item names both. The rows + Done form the page's\n // framed panel (panel per surface -- see EscapableSelectPrompt).\n const menu = renderNavigationMenu(\n navigationMenuItems({\n enter: 'edit / done',\n escape: 'cancel page',\n })\n );\n const rowLines = [\n ...rows.map((row, index) => {\n const isEditing = editing === row.key;\n const cursor = isEditing ? '›' : index === active ? '›' : ' ';\n const note = !isEditing && row.note ? c.muted(` (${row.note})`) : '';\n const line = `${cursor} ${row.label}: ${renderValue(row, isEditing)}${note}`;\n return {\n text: index === active || isEditing ? c.command(line) : line,\n plain: `${cursor} ${row.label}: ${stripAnsi(renderValue(row, isEditing))}${row.note && !isEditing ? ` (${row.note})` : ''}`,\n };\n }),\n (() => {\n const cursor = active === doneIndex ? '›' : ' ';\n const line = `${cursor} Done — run with these values`;\n return {\n text: c.command(line),\n plain: line,\n };\n })(),\n ];\n if (escapeGraceOpen) {\n rowLines.push({\n text: c.muted('esc again to exit all -- or wait to cancel the page'),\n plain: 'esc again to exit all -- or wait to cancel the page',\n });\n }\n const panel = renderFramedBox({\n title: {\n text: `${prefix} ${config.message}${resolvingNote}`,\n plain: `? ${config.message}${resolvingNote}`,\n },\n lines: rowLines,\n });\n const lines = [menu, panel, config.preview];\n return lines.filter(Boolean).join('\\n');\n }\n);\n\nexport const connectionPage = ((config) => {\n notePromptRendered();\n // Erase-on-conclude: see EscapableSelectPrompt's wrapper comment.\n return connectionPageImpl(config, { clearPromptOnDone: true });\n}) as unknown as ConnectionPageFn;\n","/**\n * The grouped editor's row model: how a multiselect's flat choice list\n * becomes collapsible sections. Pure and zero-import -- the same\n * discipline as EditableOptions/NavigationMenu -- so the shape (what is\n * visible, what is folded, what a header advertises) is unit-testable\n * without rendering a prompt, and the prompt module only draws what\n * this computes.\n *\n * The model (user decision 2026-10-13): the command's own options\n * (choices without a `group`) always render flat at the top; every\n * shared group renders as one HEADER row, expanded or collapsed --\n * `[space]` on the header toggles it in place. Typing a filter\n * flattens the list to the cross-group name matches (headers drop\n * out): type-to-find must reach into collapsed groups.\n */\n\n/** A choice that may fold under a collapsible group. */\nexport type SectionChoice<Value> = {\n value: Value;\n name: string;\n description?: string;\n /** The group id this choice belongs to; absent = the command's own. */\n group?: string;\n};\n\n/** One collapsible section (from EditableOptions' group helpers). */\nexport type SectionGroup = {\n /** The help-group heading this section folds (the grouping key). */\n id: string;\n /** The header label, e.g. 'Connection options'. */\n label: string;\n};\n\n/** One renderable row: a header, or a choice under one. */\nexport type SectionRow<Value> =\n | { kind: 'choice'; choice: SectionChoice<Value>; indent: boolean }\n | {\n kind: 'header';\n group: SectionGroup;\n /** Choices in the group (the header's always-shown count). */\n count: number;\n /** How many of them are marked (shown on a collapsed header). */\n selectedCount: number;\n expanded: boolean;\n };\n\n/**\n * Builds the rows the prompt renders. With a query: the flat\n * case-insensitive name matches across ALL choices, no headers,\n * unindented (the pre-grouping behavior -- nothing hides from\n * type-to-find). Without: own choices, then per group (config order)\n * its header, and its choices -- indented -- only while expanded.\n * Empty groups never render.\n *\n * `groups` omitted/empty keeps the exact pre-grouping behavior for\n * every caller that has not adopted sections (choice `group` ids are\n * then ignored): one flat list.\n */\nexport function buildSectionRows<Value>(options: {\n choices: SectionChoice<Value>[];\n groups?: SectionGroup[];\n expanded: ReadonlySet<string>;\n query?: string;\n selected?: ReadonlySet<Value>;\n}): SectionRow<Value>[] {\n const { choices, selected } = options;\n const query = options.query ?? '';\n if (query.length > 0) {\n const needle = query.toLowerCase();\n return choices\n .filter((choice) => choice.name.toLowerCase().includes(needle))\n .map((choice) => ({ kind: 'choice' as const, choice, indent: false }));\n }\n const groups = options.groups ?? [];\n if (groups.length === 0) {\n // No sections adopted: flat list, every choice a top-level row.\n return choices.map((choice) => ({\n kind: 'choice' as const,\n choice,\n indent: false,\n }));\n }\n // Section order: the config's, then any group ids the choices carry\n // that the config missed (defensive -- a choice must never vanish\n // because its group id fell out of the config), alphabetically.\n const known = new Set(groups.map((group) => group.id));\n const extra = [\n ...new Set(\n choices\n .map((choice) => choice.group)\n .filter(\n (group): group is string => group !== undefined && !known.has(group)\n )\n ),\n ].sort((a, b) => a.localeCompare(b));\n const ordered: SectionGroup[] = [\n ...groups,\n ...extra.map((id) => ({ id, label: id })),\n ];\n\n const byGroup = new Map<string, SectionChoice<Value>[]>();\n const own: SectionChoice<Value>[] = [];\n for (const choice of choices) {\n if (choice.group === undefined) own.push(choice);\n else {\n const bucket = byGroup.get(choice.group);\n if (bucket) bucket.push(choice);\n else byGroup.set(choice.group, [choice]);\n }\n }\n\n const rows: SectionRow<Value>[] = own.map((choice) => ({\n kind: 'choice' as const,\n choice,\n indent: false,\n }));\n for (const group of ordered) {\n const members = byGroup.get(group.id);\n if (!members || members.length === 0) continue; // empty group: silence\n const expanded = options.expanded.has(group.id);\n rows.push({\n kind: 'header',\n group,\n count: members.length,\n selectedCount: selected\n ? members.filter((choice) => selected.has(choice.value)).length\n : 0,\n expanded,\n });\n if (expanded) {\n for (const choice of members) {\n rows.push({ kind: 'choice', choice, indent: true });\n }\n }\n }\n return rows;\n}\n\n/**\n * The groups that start EXPANDED: every group holding a choice the\n * user has already set (the editor's `defaultValues` -- CLI/env/saved\n * default/previous commit). State must never hide behind a collapsed\n * header; own options need no expansion.\n */\nexport function initialExpanded<Value>(\n groups: SectionGroup[],\n choices: SectionChoice<Value>[],\n defaultValues: ReadonlyArray<Value>\n): Set<string> {\n const valued = new Set(defaultValues);\n const expanded = new Set<string>();\n for (const choice of choices) {\n if (choice.group !== undefined && valued.has(choice.value)) {\n expanded.add(choice.group);\n }\n }\n // Only group ids the config actually knows -- an unknown id would\n // render no header to collapse again.\n const known = new Set(groups.map((group) => group.id));\n return new Set([...expanded].filter((id) => known.has(id)));\n}\n\n/** The row index of the choice with this value (-1 when absent). */\nexport function rowIndexOf<Value>(\n rows: SectionRow<Value>[],\n value: Value\n): number {\n return rows.findIndex(\n (row) => row.kind === 'choice' && row.choice.value === value\n );\n}\n","import {\n createPrompt,\n isDownKey,\n isEnterKey,\n isSpaceKey,\n isUpKey,\n useEffect,\n useKeypress,\n useMemo,\n usePagination,\n usePrefix,\n useRef,\n useState,\n} from '@inquirer/core';\nimport type { InquirerReadline } from '@inquirer/type';\nimport c from '../ColorTheme';\nimport {\n buildSectionRows,\n initialExpanded,\n rowIndexOf,\n type SectionChoice,\n type SectionGroup,\n type SectionRow,\n} from './ChoiceSections';\nimport { armEscapeGrace, EXIT_ALL } from './ExitAll';\nimport {\n descriptionPanelLines,\n navigationMenuItems,\n renderFramedBox,\n renderNavigationMenu,\n stripAnsi,\n} from './NavigationMenu';\nimport { notePromptRendered } from './PromptGateState';\n\n/**\n * Distinct return value `escapableMultiSelect` resolves with when the user\n * presses Escape instead of committing -- callers branch on this to back\n * out (skip the editor entirely) instead of treating it as a real\n * selection. Nothing selected + Enter commits the empty set (a deliberate\n * \"run with defaults\"), distinct from Escape's \"don't touch this step\".\n * The ← key (query empty) is an alias for Escape -- the \"return\n * to the segment that invoked this editor\" key; with text typed it stays\n * readline cursor movement.\n */\nexport const MULTISEL_ESCAPE = Symbol('escapableMultiSelect:escape');\n\nexport type EscapableMultiSelectChoice<Value> = {\n value: Value;\n name: string;\n description?: string;\n /**\n * The collapsible section this choice folds under (the invocation\n * editor's shared-option groups). Absent = the command's own options,\n * which render flat and always visible. Sections only engage when the\n * config also passes `groups` -- a lone group id changes nothing.\n */\n group?: string;\n};\n\nexport type EscapableMultiSelectConfig<Value> = {\n message: string;\n choices: EscapableMultiSelectChoice<Value>[];\n /**\n * The collapsible sections, in render order (the invocation editor\n * passes the -hh help order). Omitted: the exact pre-grouping flat\n * list -- grouping is strictly opt-in per config.\n */\n groups?: SectionGroup[];\n /** Members pre-selected when the prompt opens. */\n defaultValues?: Value[];\n pageSize?: number;\n /**\n * Command preview footer, like escapableSelect's -- with one widening:\n * the function form receives the CURRENTLY SELECTED values (the space-\n * toggled set, in choice order) INSTEAD of the highlighted one, so the\n * footer reflects what the user has MARKED, not merely what the cursor\n * sits on -- a multiselect's influence on the command is the set, not\n * the cursor. Empty array when nothing is selected: fall back to the\n * committed state.\n */\n preview?: string | ((selected: unknown[]) => string);\n /**\n * Members that need a VALUE before they can be marked (the invocation\n * editor's valued options): <space> on one switches this prompt into\n * an INLINE value editor (same readline-mirror pattern as the\n * connection page -- no nested prompt, no second readline over stdin;\n * the previous async-hook design nested a second @inquirer prompt\n * inside the keypress handler and the two readlines fought over stdin,\n * freezing the frame). An option that declares commander `.choices()`\n * (`choicesFor`) gets an in-frame PICKER (↑↓ + enter); the rest get\n * free text. The option is marked only once a real value is committed;\n * <esc> rejects (an option that needs a value cannot be marked without\n * one). `onValue` receives the member and its collected value as soon\n * as <enter> commits it.\n */\n needsValue?: (value: Value) => boolean;\n /** The enum members of a valued option, when it has any. */\n choicesFor?: (value: Value) => string[] | undefined;\n /**\n * The option's current value (commander's, as text) -- the inline\n * editor starts there (picker cursor on it, text draft pre-filled)\n * instead of from empty.\n */\n currentValueFor?: (value: Value) => string | undefined;\n onValue?: (value: Value, collected: string) => void;\n};\n\n/**\n * A small sibling of the packaged `@inquirer/checkbox`, differing in one\n * core way: Escape resolves with the `MULTISEL_ESCAPE` sentinel instead of\n * doing nothing, so the editor can back out without committing. The\n * packaged checkbox has no Escape keybinding and no way to configure one\n * (same rationale as EscapableSelectPrompt for not adopting the packaged\n * prompt family).\n *\n * Interaction contract (the user's stated paradigm):\n * - ↑/↓ navigate (clamped at the ends -- a list with a beginning and an\n * end, not an endless loop)\n * - <space> toggles the highlighted entry; on a member that needs a\n * value, it opens the inline value editor instead\n * - <enter> commits the currently-selected set (possibly empty)\n * - Escape backs out without committing (MULTISEL_ESCAPE)\n * - type-to-search filters live, cursor resets to top on query change,\n * two-stage Escape (clear query first, then back out) -- identical to\n * EscapableSelectPrompt's contract\n */\n// Same createPrompt-generics note as EscapableSelectPrompt: the view is\n// written loosely against `unknown` and the export carries a precise\n// hand-written generic type.\ntype EscapableMultiSelectFn = <Value>(\n config: EscapableMultiSelectConfig<Value>\n) => Promise<Value[] | typeof MULTISEL_ESCAPE | typeof EXIT_ALL>;\n\nconst escapableMultiSelectImpl = createPrompt(\n (\n config: EscapableMultiSelectConfig<unknown>,\n done: (value: unknown) => void\n ) => {\n const { pageSize = 20, choices } = config;\n const [status, setStatus] = useState<'idle' | 'done' | 'escaped'>('idle');\n const prefix = usePrefix({\n status: status === 'escaped' ? 'done' : status,\n });\n\n const [query, setQuery] = useState('');\n // Which sections are expanded right now. Starts from the config's\n // defaultValues: a group holding an option the user already set\n // (CLI/env/saved default) opens expanded -- state never hides\n // behind a collapsed header.\n const [expandedState, setExpandedState] = useState<Set<string>>(() =>\n (config.groups?.length ?? 0) > 0\n ? initialExpanded(\n config.groups ?? [],\n choices,\n config.defaultValues ?? []\n )\n : new Set<string>()\n );\n const [selected, setSelected] = useState<Set<unknown>>(\n () => new Set(config.defaultValues ?? [])\n );\n // INLINE value editing (see the needsValue config doc for why NOT a\n // nested prompt): the highlighted member being valued right now, the\n // mode it edits in (a PICKER for options with commander `.choices()`,\n // free TEXT otherwise), the readline-mirror draft, and the picker's\n // cursor.\n const [editing, setEditing] = useState<unknown>(null);\n const [editingChoices, setEditingChoices] = useState<string[]>([]);\n const [draft, setDraft] = useState('');\n const [pickerActive, setPickerActive] = useState(0);\n\n // The sectioned row model (ChoiceSections.ts): with a query the\n // list FLATTENS to the cross-group name matches (type-to-find must\n // reach into collapsed groups); without one, own options then\n // header rows + the expanded groups' children. When the config\n // passes no groups this is the pre-grouping flat list.\n const rows = useMemo(\n () =>\n buildSectionRows({\n choices: choices as SectionChoice<unknown>[],\n groups: config.groups,\n expanded: expandedState,\n query,\n selected,\n }) as SectionRow<unknown>[],\n // `selected` intentionally re-derives rows: a collapsed header's\n // \"N selected\" badge must update on every toggle.\n [choices, config.groups, query, selected, expandedState]\n );\n\n // Cursor resets to the top of the FILTERED list whenever the query\n // TEXT changes (useEffect, not a render-time write -- see\n // EscapableSelectPrompt's TDZ note). Text-compared, not\n // reference-compared: closeInlineEditor's setQuery('') after a\n // value commit must NOT yank the cursor to the top when the query\n // was already empty (that was the \"cursor is nowhere\" report --\n // the cursor flew to row 0 on every value commit, and with the\n // color-only cursor nothing showed where it went).\n const lastQueryRef = useRef(query);\n useEffect(() => {\n if (lastQueryRef.current === query) return;\n lastQueryRef.current = query;\n setActive(0);\n }, [query]);\n\n // A render-time mirror for the keypress closure (hooks state is\n // otherwise stale there); re-assigned every render, read-only in\n // handlers.\n const expandedRef2 = expandedState;\n const [active, setActive] = useState(0);\n // Headers are cursor stops; a \"highlighted choice\" exists only when\n // the cursor sits on a choice row.\n const highlighted = rows[active];\n const highlightedChoice =\n highlighted?.kind === 'choice' ? highlighted.choice : undefined;\n\n // Leaving the inline value editor: clear editing state, reset the\n // filter query (the buffer was scrubbed -- the query MIRROR must go\n // with it, or the list stays filtered by a query that no longer\n // exists -- the \"cannot navigate anywhere\" report: a one-row\n // filtered list clamps the cursor no matter what the arrows do),\n // scrub the readline buffer, and put the cursor BACK on the option\n // that was just edited or rejected -- the user's question \"where am\n // I\" must have a visible, correct answer (the › glyph + the option's\n // description in the panel).\n // The double-ESC grace (see ExitAll.ts): the first ESC opens a short\n // window instead of acting; a second ESC inside it exits all, an\n // expired window (or any other key) performs the per-branch\n // single-ESC action. Works from inside the value editor too -- two\n // fast ESCs there reject the value AND leave everything.\n const escapeGraceRef = useRef<\n ReturnType<typeof armEscapeGrace> | undefined\n >(undefined);\n const [escapeGraceOpen, setEscapeGraceOpen] = useState(false);\n // The [LEFT]-with-uncommitted-selections guard's inline explanation\n // (see the keypress handler). Any other key clears it.\n const [leftGuard, setLeftGuard] = useState('');\n\n // Grace teardown on unmount (a timer firing after the prompt\n // resolved would call a stale handler).\n useEffect(() => () => escapeGraceRef.current?.dispose(), []);\n\n const closeInlineEditor = (rl: InquirerReadline, returnTo?: unknown) => {\n setEditing(null);\n setEditingChoices([]);\n setDraft('');\n setPickerActive(0);\n // Pre-seed the query-ref so the cursor-reset effect sees the\n // reset as already-applied and does not clobber the setActive\n // below (a query 'retry' -> '' change would otherwise fire the\n // effect AFTER this handler and yank the cursor to row 0).\n lastQueryRef.current = '';\n setQuery('');\n if (returnTo !== undefined) {\n // Row-model lookup, not raw choices.findIndex: with sections the\n // choice may sit under a header, so its group must be expanded\n // for a row to exist to land on. (Without groups the flat rows\n // make this exactly the old behavior.)\n const groupId = choices.find(\n (choice) => choice.value === returnTo\n )?.group;\n if (groupId !== undefined && !expandedRef2.has(groupId)) {\n setExpandedState((previous) => {\n const next = new Set(previous);\n next.add(groupId);\n return next;\n });\n }\n const index = rowIndexOf(\n buildSectionRows({\n choices: choices as SectionChoice<unknown>[],\n groups: config.groups,\n expanded:\n groupId !== undefined && !expandedRef2.has(groupId)\n ? new Set([...expandedRef2, groupId])\n : expandedRef2,\n query: '',\n selected,\n }) as SectionRow<unknown>[],\n returnTo\n );\n if (index >= 0) setActive(index);\n }\n // Replay readline's own ctrl+u binding: buffer + cursor + display\n // all clear together (the declared InquirerReadline type only\n // lists write(data: string), but the runtime object is a real\n // readline.Interface -- see create-prompt's createInterface).\n (\n rl.write as InquirerReadline['write'] & {\n (data: null, key: { ctrl: boolean; name: string }): void;\n }\n )(null, { ctrl: true, name: 'u' });\n rl.clearLine(0);\n };\n\n useKeypress((key, rl) => {\n if (editing !== null) {\n // The inline value editor owns every key until it concludes.\n if (editingChoices.length > 0) {\n // PICKER mode: an enum option's value comes from its declared\n // choices -- free typing is not an input here, so the keys are\n // the list's, not readline's.\n if (isEnterKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n const value = editingChoices[pickerActive] ?? editingChoices[0];\n config.onValue?.(editing, value);\n setSelected((previous) => {\n const next = new Set(previous);\n next.add(editing);\n return next;\n });\n closeInlineEditor(rl, editing);\n return;\n }\n if (key.name === 'escape') {\n // Double-ESC inside the value editor: exit all the way out\n // (reject + unwind) via the shared grace (see ExitAll.ts);\n // a single press (grace expiry or another key) rejects the\n // value (\"back one level\" -- nothing changes).\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n closeInlineEditor(rl, editing);\n setStatus('escaped');\n done(EXIT_ALL);\n },\n // Grace expired with no second press: reject the value.\n onGraceExpire: () => {\n setEscapeGraceOpen(false);\n closeInlineEditor(rl, editing);\n },\n });\n return;\n }\n if (isUpKey(key) || isDownKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n const offset = isUpKey(key) ? -1 : 1;\n setPickerActive((previous) =>\n Math.min(\n editingChoices.length - 1,\n Math.max(0, previous + offset)\n )\n );\n return;\n }\n return;\n }\n if (isEnterKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n // readline already consumed its buffer (textPrompt pattern);\n // read the mirror.\n const line = draft || rl.line || '';\n if (line.trim().length === 0) return; // empty = no value yet\n config.onValue?.(editing, line);\n setSelected((previous) => {\n const next = new Set(previous);\n next.add(editing);\n return next;\n });\n closeInlineEditor(rl, editing);\n return;\n }\n if (key.name === 'escape') {\n // Double-ESC inside the value editor: exit all (see the picker\n // branch above); a single press rejects the value.\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n closeInlineEditor(rl, editing);\n setStatus('escaped');\n done(EXIT_ALL);\n },\n onGraceExpire: () => {\n setEscapeGraceOpen(false);\n closeInlineEditor(rl, editing);\n },\n });\n return;\n }\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setDraft(rl.line);\n return;\n }\n if (\n key.name === 'escape' ||\n (key.name === 'left' &&\n // Segment navigation only when the filter query is\n // empty; with text typed, ←/→ stay readline cursor movement.\n rl.line.length === 0)\n ) {\n // Two-stage escape with an active query.\n if (rl.line.length > 0) {\n rl.clearLine(0);\n setQuery('');\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n return;\n }\n // UNCOMMITTED SELECTIONS GUARD (user rule 2026-10-13: \"LEFT\n // navigation disabled if options are selected but not\n // committed\"): selections marked in this editor session that\n // are NOT part of the command's pre-editor state are\n // uncommitted -- leaving now would either silently discard\n // them (the dismissed-editor report) or leak them as if\n // committed. [LEFT] does nothing (an inline hint says why);\n // [ESC] still backs out, and it RESETS: every uncommitted mark\n // is cleared before resolving (dismiss = nothing authored).\n const uncommitted = [...selected].filter(\n (value) => !config.defaultValues?.includes(value as never)\n );\n if (uncommitted.length > 0) {\n if (key.name === 'left') {\n setLeftGuard(\n `select or reset first -- ${uncommitted.length} option${uncommitted.length === 1 ? '' : 's'} not committed ([ESC] resets, [ENTER] commits)`\n );\n return;\n }\n // ESC: open the normal grace window, but its single-ESC\n // action resets the uncommitted marks before resolving.\n const resetThenResolve = () => {\n setSelected((previous) => {\n const next = new Set(previous);\n for (const value of uncommitted) next.delete(value);\n return next;\n });\n setStatus('escaped');\n done(MULTISEL_ESCAPE);\n };\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n setEscapeGraceOpen(false);\n setStatus('escaped');\n done(EXIT_ALL);\n },\n onGraceExpire: resetThenResolve,\n });\n return;\n }\n // Double-ESC exits ALL the way out (see ExitAll.ts grace); ← and\n // single ESC keep \"back one level\" (single ESC after the grace\n // expires).\n if (key.name === 'escape') {\n if (escapeGraceRef.current) {\n const grace = escapeGraceRef.current;\n escapeGraceRef.current = undefined;\n grace.secondEscape();\n return;\n }\n setEscapeGraceOpen(true);\n escapeGraceRef.current = armEscapeGrace({\n onSecondEscape: () => {\n setEscapeGraceOpen(false);\n setStatus('escaped');\n done(EXIT_ALL);\n },\n onGraceExpire: () => {\n setEscapeGraceOpen(false);\n setStatus('escaped');\n done(MULTISEL_ESCAPE);\n },\n });\n return;\n }\n // ←: not part of the gesture.\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setStatus('escaped');\n done(MULTISEL_ESCAPE);\n } else if (isEnterKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setLeftGuard('');\n // Commit whatever is selected -- an empty set is a valid outcome\n // (\"run with defaults\"), unlike select where nothing-picked is a\n // no-op.\n setStatus('done');\n done([...selected]);\n } else if (isSpaceKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setLeftGuard('');\n if (!highlighted) return;\n // The toggle is not text input: scrub the buffer so the space\n // never leaks into the filter query (or blocks the [LEFT]\n // buffer-empty check -- user report 2026-10-13: after marking,\n // LEFT mirrored a polluted buffer and the guard never fired;\n // typing 'curl' filtered on ' curl' and found nothing).\n // Same replay mechanism as closeInlineEditor.\n (\n rl.write as InquirerReadline['write'] & {\n (data: null, key: { ctrl: boolean; name: string }): void;\n }\n )(null, { ctrl: true, name: 'u' });\n rl.clearLine(0);\n if (highlighted.kind === 'header') {\n // [space] on a section header expands/collapses it in place;\n // the cursor stays on the header either way.\n const id = highlighted.group.id;\n setExpandedState((previous) => {\n const next = new Set(previous);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n return;\n }\n const togglingOn = !selected.has(highlighted.choice.value);\n if (togglingOn) {\n // Selecting an option expands its section, so clearing the\n // filter (or scrolling up) never hides what was just picked.\n const groupId = highlighted.choice.group;\n if (groupId !== undefined && !expandedRef2.has(groupId)) {\n setExpandedState((previous) => {\n const next = new Set(previous);\n next.add(groupId);\n return next;\n });\n }\n }\n const togglingOnValue = !selected.has(highlighted.choice.value);\n if (togglingOnValue && config.needsValue?.(highlighted.choice.value)) {\n // A valued option cannot be marked without its real value:\n // switch into the inline value editor instead of marking.\n // A PICKER for options with declared choices, free text\n // otherwise. The value starts at the option's current value\n // (picker cursor on it; text draft pre-filled) -- \"just wanted\n // to change one thing\" costs an edit, not a retyping session.\n // The readline buffer is scrubbed too: the filter query that\n // brought the cursor here would otherwise survive as a\n // prefix of the typed value (see closeInlineEditor for the\n // replay mechanism).\n const choicesFor =\n config.choicesFor?.(highlighted.choice.value) ?? undefined;\n const current =\n config.currentValueFor?.(highlighted.choice.value) ?? '';\n setEditing(highlighted.choice.value);\n setEditingChoices(choicesFor ?? []);\n setPickerActive(\n choicesFor ? Math.max(0, choicesFor.indexOf(current)) : 0\n );\n setDraft(current);\n (\n rl.write as InquirerReadline['write'] & {\n (data: null, key: { ctrl: boolean; name: string }): void;\n }\n )(null, { ctrl: true, name: 'u' });\n rl.clearLine(0);\n return;\n }\n setSelected((previous) => {\n const next = new Set(previous);\n if (next.has(highlighted.choice.value)) {\n next.delete(highlighted.choice.value);\n } else {\n next.add(highlighted.choice.value);\n }\n return next;\n });\n } else if (isUpKey(key) || isDownKey(key)) {\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setLeftGuard('');\n if (rows.length === 0) return;\n const offset = isUpKey(key) ? -1 : 1;\n // Clamp at the ends -- a list with a beginning and an end, not\n // an endless loop (matches EscapableSelectPrompt). FUNCTIONAL\n // update: several keypresses can arrive inside one render\n // cycle -- a closure over `active` would compute every step\n // from the same stale value and eat the extra moves.\n setActive((previous) =>\n Math.min(rows.length - 1, Math.max(0, previous + offset))\n );\n } else {\n // Everything else is readline's business (typing, paste,\n // backspace, ctrl+u); mirror the buffer into the query -- same\n // pattern as EscapableSelectPrompt. Any non-ESC key breaks the\n // double-ESC streak.\n escapeGraceRef.current?.otherKey();\n escapeGraceRef.current = undefined;\n setLeftGuard('');\n setQuery(rl.line);\n }\n });\n\n if (status === 'escaped') {\n return `${prefix} ${config.message} ${c.muted('(cancelled)')}`;\n }\n if (status === 'done') {\n const picked = choices.filter((choice) => selected.has(choice.value));\n const summary =\n picked.length === 0\n ? c.muted('(none -- run with defaults)')\n : c.positive(picked.map((choice) => choice.name).join(', '));\n return `${prefix} ${config.message} ${summary}`;\n }\n\n const page = usePagination({\n items: rows,\n active,\n renderItem: ({ item, isActive }) => {\n if (item.kind === 'header') {\n // The twisty sits in the marker column so the cursor column\n // (›) stays aligned with the choice rows; a collapsed header\n // with selections shows the badge -- nothing readable hides.\n const twisty = item.expanded ? '▾' : '▸';\n const badge =\n !item.expanded && item.selectedCount > 0\n ? ` · ${item.selectedCount} selected`\n : '';\n const line = `${twisty} ${item.group.label} (${item.count})${badge}`;\n return isActive ? c.command(line) : line;\n }\n const marker = selected.has(item.choice.value) ? '◉' : '○';\n // The cursor gets a GLYPH (› between marker and name), not just\n // color -- color alone is invisible when the cursor sits on an\n // already-marked row (user feedback 2026-10-12: after the value\n // editor closed, \"the cursor is nowhere\"). The single-select's\n // '› ' pattern, married to the multiselect's ◉/○ column.\n const cursor = isActive ? '› ' : ' ';\n const line = `${marker} ${cursor}${item.indent ? ' ' : ''}${item.choice.name}`;\n return isActive ? c.command(line) : line;\n },\n pageSize,\n loop: false,\n });\n\n const queryEcho = query.length > 0 ? c.command(` query: ${query}`) : '';\n // PANEL PER SURFACE (user feedback 2026-10-12): the Navigate box is\n // PERMANENT at the top -- it swaps its key hints to the active\n // surface (list vs value editor) instead of disappearing, so the\n // frame layout never jumps and the keys never lie. The question +\n // list + description form one framed panel; the inline value editor\n // is its own framed box UNDER the panel (the old bottom collector\n // was easy to miss; directly beneath the list it edits is where the\n // eye finds it -- and the description stays beside its list).\n const editingName =\n editing !== null\n ? (choices.find((choice) => choice.value === editing)?.name ??\n String(editing))\n : '';\n const menu = renderNavigationMenu(\n navigationMenuItems(\n editing !== null\n ? {\n // Value-editor surface: typing does not filter (a picker\n // owns the values; a text draft IS the value).\n enter: editingChoices.length > 0 ? 'pick' : 'commit value',\n escape: 'rejects',\n }\n : {\n filter: true,\n space:\n highlighted?.kind === 'header'\n ? highlighted.expanded\n ? 'collapse'\n : 'expand'\n : 'select',\n enter: 'commit',\n left: true,\n escape: 'back · [ESC]×2 exit all',\n }\n )\n );\n\n // The question+list panel: list rows, then the highlighted option's\n // description trailing INSIDE the panel (description at the bottom,\n // option at the top = the two halves of the decision frames apart).\n const panelLines: { text: string; plain: string }[] = [];\n if (leftGuard) {\n panelLines.push({\n text: c.negative(leftGuard),\n plain: leftGuard,\n });\n } else if (escapeGraceOpen) {\n panelLines.push({\n text: c.muted('esc again to exit all -- or wait to go back one level'),\n plain: 'esc again to exit all -- or wait to go back one level',\n });\n }\n if (rows.length > 0) {\n for (const row of page.split('\\n')) {\n panelLines.push({ text: row, plain: stripAnsi(row) });\n }\n } else {\n panelLines.push({\n text: c.muted('(no matches -- backspace to edit)'),\n plain: '(no matches -- backspace to edit)',\n });\n }\n if (highlighted?.kind === 'header') {\n // A header's panel description: the group's options as flags, so\n // \"what is inside?\" costs one cursor move, not an expand.\n const members = choices.filter(\n (choice) =>\n (choice as { group?: string }).group === highlighted.group.id\n );\n panelLines.push({ text: '', plain: '' });\n panelLines.push(\n ...descriptionPanelLines(\n `${highlighted.group.label}: ${members\n .map((choice) => choice.name)\n .join(', ')}`\n )\n );\n } else if (highlightedChoice?.description) {\n panelLines.push({ text: '', plain: '' });\n panelLines.push(...descriptionPanelLines(highlightedChoice.description));\n }\n const panel = renderFramedBox({\n title: {\n text: `${prefix} ${config.message}${queryEcho}`,\n plain: `? ${config.message}${queryEcho}`,\n },\n lines: panelLines,\n });\n\n // The inline value editor: its own framed box directly under the\n // panel. An enum option renders its choices as a picker list; a\n // free text option renders the draft with readline's echo muted.\n const valueBox =\n editing === null\n ? ''\n : editingChoices.length > 0\n ? renderFramedBox({\n title: `Value for ${editingName}`,\n lines: editingChoices.map((choice, index) => {\n const marker = index === pickerActive ? '›' : ' ';\n const line = `${marker} ${choice}`;\n return {\n text: index === pickerActive ? c.command(line) : line,\n plain: line,\n };\n }),\n })\n : renderFramedBox({\n title: `Value for ${editingName}`,\n lines: [\n {\n text: c.command(draft || '(type a value)'),\n plain: draft || '(type a value)',\n },\n ],\n });\n\n const lines = [\n menu,\n panel,\n ...(editing !== null ? [valueBox] : []),\n typeof config.preview === 'function'\n ? config.preview(\n choices\n .filter((choice) => selected.has(choice.value))\n .map((choice) => choice.value)\n )\n : config.preview,\n ].filter(Boolean);\n return lines.join('\\n');\n }\n);\n\nexport const escapableMultiSelect = ((config) => {\n notePromptRendered();\n // Erase-on-conclude: see EscapableSelectPrompt's wrapper comment.\n return escapableMultiSelectImpl(config, { clearPromptOnDone: true });\n}) as unknown as EscapableMultiSelectFn;\n","/**\n * Positional-argument read/write helpers, split from\n * ResolveInteractiveInputs.ts into a zero-import module (the\n * CommandPreview/ActiveActionCommandState pattern): pure commander, no\n * frodo-lib, so both the resolver and the unit tests (which cannot import\n * the resolver's frodo-lib-heavy graph under this Jest setup -- see\n * src/app.commandWiring.test.ts's header comment) and the post-auth realm\n * picker's write-back share one implementation.\n */\n\nimport type { Command } from 'commander';\n\n/**\n * Index of the default positional argument of that name on this command\n * (commands omit default args via the FrodoCommand omits list, so the\n * index differs per command), or -1 when the command doesn't declare it.\n */\nexport function positionalIndex(command: Command, name: string): number {\n return command.registeredArguments.findIndex(\n (argument) => argument.name() === name\n );\n}\n\nexport function positionalValue(\n command: Command,\n name: string\n): string | undefined {\n const index = positionalIndex(command, name);\n if (index === -1) return undefined;\n const value = command.processedArgs?.[index];\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/**\n * Writes `value` into BOTH surfaces the CLI reads for a positional:\n *\n * - `processedArgs` is what the action handler's positional parameters\n * are sliced from (commander's action() wrapper slices\n * this.processedArgs).\n * - `args` (raw, options-removed user args) is what\n * handleDefaultArgsAndOpts iterates to copy default arguments into\n * frodo-lib state INSIDE the action body -- it does NOT read\n * processedArgs, so a processedArgs-only injection would be\n * overwritten with `undefined` the moment the action starts.\n * Verified against commander's _processArguments (fills processedArgs\n * from args, never writes back) and this repo's\n * handleDefaultArgsAndOpts (iterates command.args).\n *\n * `args` holds only user-supplied positional values; a gap-fill by\n * definition fills a position the user left empty, so extending/padding\n * with the injected value is safe. Pad with nulls for any inner\n * positions the user skipped (rare: inner default args are optional),\n * since args is positional.\n */\nexport function setPositionalValue(\n command: Command,\n name: string,\n value: string\n): void {\n const index = positionalIndex(command, name);\n if (index === -1) return;\n if (command.processedArgs) {\n command.processedArgs[index] = value;\n }\n if (Array.isArray(command.args)) {\n while (command.args.length < index) {\n command.args.push(null);\n }\n if (index === command.args.length) {\n command.args.push(value);\n } else if (command.args[index] == null) {\n command.args[index] = value;\n }\n }\n}\n","import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * CLI-level settings persisted at ~/.frodo/Settings.json. Deliberately\n * tiny and separate from connection profiles (frodo-lib's encrypted\n * Connections.json): these are plain user preferences, not secrets.\n * Currently two settings -- the invocation editor's guided mode and the\n * per-command defaults store's neighbors live here (see\n * docs/INTERACTIVE-COMMANDS.md). Missing/corrupt file = defaults, so\n * the CLI never fails over a bad settings file.\n */\nexport type FrodoSettings = {\n /**\n * When true, every interactive-session command runs the optional-options\n * invocation editor by default (same as passing --edit each time).\n */\n guidedMode?: boolean;\n};\n\nconst SETTINGS_FILENAME = 'Settings.json';\n\nexport function getSettingsPath(): string {\n return path.join(os.homedir(), '.frodo', SETTINGS_FILENAME);\n}\n\nexport function readSettings(): FrodoSettings {\n try {\n const parsed = JSON.parse(fs.readFileSync(getSettingsPath(), 'utf8'));\n return typeof parsed === 'object' && parsed !== null ? parsed : {};\n } catch {\n return {};\n }\n}\n\nexport function writeSettings(settings: FrodoSettings): void {\n const file = getSettingsPath();\n fs.mkdirSync(path.dirname(file), { recursive: true });\n fs.writeFileSync(file, JSON.stringify(settings, null, 2));\n}\n\n/**\n * Whether the invocation editor should run by default on this invocation:\n * the persisted guided-mode toggle, with --no-prompt / FRODO_NO_PROMPT /\n * FRODO_TEST still gating everything downstream (the editor itself runs\n * behind canPrompt, so those environments ignore guided mode exactly as\n * they ignore --edit).\n */\nexport function guidedModeEnabled(): boolean {\n return readSettings().guidedMode === true;\n}\n\nexport function setGuidedMode(enabled: boolean): void {\n const settings = readSettings();\n settings.guidedMode = enabled;\n writeSettings(settings);\n}\n","/**\n * The \"zero-touch\" resolution pass: fills missing command input\n * interactively before the action body runs (see\n * docs/INTERACTIVE-COMMANDS.md). Wired from FrodoCommand's preAction\n * hook; never modifies frodo-lib.\n *\n * Two resolver kinds run here, connection arguments first (the host gives\n * the later prompts their context), then deferred mandatory options:\n *\n * 1. Connection arguments. Missing `host` (dropdown of saved connection\n * profiles, single profile silently assumed, free-text entry when none\n * exist -- see runInteractivePreferredCredentialPicker for the\n * precedent), missing `username`/`password` -- but ONLY when no saved\n * profile can supply credentials for the resolved host, since frodo-lib\n * already falls back to profile-stored credentials on its own\n * (AuthenticateOps loadConnectionProfile); prompting when a profile\n * would answer anyway would be pure friction. `--browser`/`--device`\n * likewise suppress the username/password prompts (their flow is the\n * interactive part) but not the host prompt, which those flows still\n * need.\n *\n * 2. Deferred mandatory options. Commander's\n * `missingMandatoryOptionValue()` normally throws during parsing --\n * BEFORE the preAction hook chain runs. FrodoCommand overrides it to\n * record the violation instead, which makes all 57 existing\n * `makeOptionMandatory()` call sites prompt-capable with zero syntax\n * change. Options carrying commander `choices()` are offered as a\n * dropdown instead of free typing.\n *\n * Everything here is gap-filling, and every gap-fill writes into the\n * command's own `processedArgs`/option values -- NOT into frodo-lib state\n * -- because `handleDefaultArgsAndOpts` (which copies positional args into\n * state) runs INSIDE the action body, after this pass; writing state here\n * would be overwritten by `undefined` a moment later. A fully-specified\n * invocation reaches the action untouched, and outside the prompt gate\n * (see PromptGate) the pass degrades to exactly the old error behavior.\n */\n\nimport fs from 'fs';\nimport { frodo, state } from '@rockcarver/frodo-lib';\nimport type { Command, Option } from 'commander';\nimport { printMessage, successMessage, verboseMessage } from '../utils/Console';\nimport {\n armAuthoringPrint,\n setAuthoringPrintFlush,\n} from '../utils/interactive/AuthoringPrintState';\nimport {\n liveMultiOptionPreview,\n liveOptionPreview,\n livePositionalPreview,\n renderCommandPreview,\n setDeploymentTypeForPreview,\n type CommandReadiness,\n} from '../utils/interactive/CommandPreview';\nimport {\n connectionPage,\n PAGE_ESCAPE,\n} from '../utils/interactive/ConnectionPagePrompt';\nimport {\n applicableCommandDefaults,\n optionMissingUserValue,\n} from '../utils/interactive/DefaultsStore';\nimport {\n editableOptionalOptions,\n editableOptionGroupOf,\n editableOptionGroups,\n editableOptionsHint,\n sortEditableOptions,\n} from '../utils/interactive/EditableOptions';\nimport { hasEntityPick } from '../utils/interactive/EntityPickers';\nimport {\n escapableMultiSelect,\n MULTISEL_ESCAPE,\n} from '../utils/interactive/EscapableMultiSelectPrompt';\nimport {\n escapableSelect,\n ESCAPE,\n RIGHT,\n type EscapableSelectChoice,\n type EscapableSelectConfig,\n} from '../utils/interactive/EscapableSelectPrompt';\nimport { EXIT_ALL, EXIT_ALL_SIGNAL } from '../utils/interactive/ExitAll';\nimport {\n positionalIndex,\n positionalValue,\n setPositionalValue,\n} from '../utils/interactive/PositionalArgs';\nimport {\n canPrompt,\n promptInput,\n promptPassword,\n promptsRendered,\n} from '../utils/interactive/PromptGate';\nimport { noteRealmProvenance } from '../utils/interactive/RealmPickers';\nimport { guidedModeEnabled } from '../utils/SettingsStore';\n\nconst { getConnectionProfilesPath, getConnectionProfileByHost } = frodo.conn;\nconst { probeDeploymentType } = frodo.login;\nconst { isValidUrl } = frodo.utils;\n\n// The active-action-command registry lives in its own zero-import module\n// (ActiveActionCommandState) so ops-layer importers (AuthenticateOps's\n// post-auth realm picker) don't drag this file's frodo-lib-importing\n// graph into tests that mock frodo-lib wholesale. Re-exported here for\n// the resolution pass's own use.\nexport {\n setActiveActionCommand,\n getActiveActionCommand,\n} from '../utils/interactive/ActiveActionCommandState';\n\n/**\n * A mandatory-option violation that commander's parse recorded instead of\n * throwing on. Lives here rather than on the command instance so the\n * deferred state survives the parse->hook handoff regardless of how\n * commander clones or nests commands.\n */\nconst pendingMandatoryViolations = new WeakMap<Command, string[]>();\n\n/**\n * Whether the connection level (host/username/password) resolved for this\n * command this session -- set by resolveConnectionArgs, whether the values\n * came from argv, env fallbacks, saved profiles, or the prompts. The\n * preview's readiness keys on THIS, not on the positionals: env/profile\n * resolution leaves the command object's positionals empty while the\n * connection is fully resolved. Lives beside pendingMandatoryViolations\n * for the same parse->hook handoff reasons.\n */\nconst connectionReadiness = new WeakMap<Command, boolean>();\n\n/**\n * Option-requiredness rule registered on a command via `requireOneOf`\n * (at least one member present) or `requireAllOf` (every member present --\n * pairwise-required members, e.g. esv secret version activate's `-i` +\n * `-v`). Weaker than `makeOptionMandatory`: instead of \"this one option\n * must always be present\", it says \"one of / all of these options must be\n * present\" -- the shape of the `Unrecognized combination of options or no\n * options...` dead-ends that 113 command action bodies enforce only AFTER\n * authenticating. Evaluated in the resolution pass (below), where a\n * violation becomes an interactive prompt on a prompt-capable session and\n * commander's own error otherwise.\n */\nexport type OptionRequirementSpec = {\n /** Long names (no dashes) of the group's member options. */\n options: string[];\n /**\n * Whether every member (true) or at least one member (false) must be\n * present. OPTIONAL -- set by the requireOneOf/requireAllOf wrappers\n * (requireOneOf defaults it to false, requireAllOf to true); callers\n * never pass it.\n */\n all?: boolean;\n /**\n * Human-readable purpose shown in prompts/errors, e.g. \"what to\n * delete\". Derived from the command description when omitted.\n */\n purpose?: string;\n};\n\n/**\n * Pre-requireAllOf spelling kept as an alias so the part-1/part-2 call\n * sites keep compiling while they migrate to the split methods.\n */\nexport type OneOfGroupSpec = OptionRequirementSpec;\n\nconst pendingOneOfGroups = new WeakMap<\n Command,\n (OptionRequirementSpec & { all: boolean })[]\n>();\n\n/**\n * Registers option-requiredness groups on a command for resolution-pass\n * evaluation. Called from FrodoCommand.requireOneOf/requireAllOf.\n */\nexport function deferOneOfGroups(\n command: Command,\n groups: (OptionRequirementSpec & { all: boolean })[]\n): void {\n pendingOneOfGroups.set(command, [\n ...(pendingOneOfGroups.get(command) ?? []),\n ...groups,\n ]);\n}\n\n/**\n * The option-requiredness groups registered on a command (empty when\n * none). Read by FrodoStubHelp to render the rule in help output -- the\n * help annotation and the resolver consume the same metadata.\n */\nexport function getOneOfGroups(\n command: Command\n): (OptionRequirementSpec & { all: boolean })[] {\n return pendingOneOfGroups.get(command) ?? [];\n}\n\n/**\n * Records a mandatory option that was missing at parse time, instead of\n * throwing. Called from FrodoCommand's `missingMandatoryOptionValue`\n * override. `optionLabel` is the option's full flags string (e.g.\n * `-s, --schema <schema>`), matching what commander's own error message\n * embeds.\n */\nexport function deferMissingMandatoryOption(\n command: Command,\n optionLabel: string\n): void {\n const pending = pendingMandatoryViolations.get(command) ?? [];\n pending.push(optionLabel);\n pendingMandatoryViolations.set(command, pending);\n}\n\n/**\n * The CommanderError code commander itself uses for this failure; the\n * re-throw preserves it so scripts can match on it.\n */\nexport const MISSING_MANDATORY_OPTION_CODE =\n 'commander.missingMandatoryOptionValue';\n\n/**\n * Rebuilds commander's exact error message for a deferred violation (see\n * missingMandatoryOptionValue in commander's lib/command.js).\n */\nfunction missingMandatoryOptionMessage(optionLabel: string): string {\n return `error: required option '${optionLabel}' not specified`;\n}\n\n/**\n * Runs the interactive resolution pass for `command` (the leaf command\n * about to execute).\n *\n * When prompting is disallowed, any deferred mandatory violation is\n * re-thrown with commander's own message/code (identical to pre-Phase-1\n * behavior -- commander would have thrown during parsing) and everything\n * else is a no-op. When the user backs out of a prompt (Escape/empty\n * Enter), any deferred violations are re-thrown the same way (matching\n * the old parse order, where the mandatory check ran first) and missing\n * connection args are left for the action's getTokens() to fail on\n * exactly as before.\n */\nexport async function resolveInteractiveInputs(\n command: Command\n): Promise<void> {\n const violations = pendingMandatoryViolations.get(command) ?? [];\n\n if (!canPrompt()) {\n if (violations.length > 0) {\n throwMissingMandatory(command, violations[0]);\n }\n const unsatisfiedGroups = findUnsatisfiedOneOfGroups(command);\n if (unsatisfiedGroups.length > 0) {\n throwOneOfUnsatisfied(command, unsatisfiedGroups[0]);\n }\n return;\n }\n\n // Interactive: connection args first (they give the mandatory-option\n // prompts their tenant context), then mandatory options, then one-of\n // groups (which may prompt for a member option; after that step the\n // action's getTokens may still fail on auth, exactly as before).\n // Either step bailing out falls back to the pre-Phase-1 error\n // semantics.\n // Persisted per-command defaults fill in BEFORE any prompt or\n // resolution -- a saved value reads as authored input (source 'cli')\n // for everything downstream (the editor's (current: x) display, the\n // preview footer, the serializer's copy-paste tokens), while an\n // explicit flag or env var on THIS invocation keeps precedence (the\n // gate skips options that already carry a non-default source).\n applyPersistedDefaults(command);\n // The realm provenance MUST be noted before any prompt: frodo-lib maps\n // the sentinel default to the deployment type's realm during auth, so\n // \"user chose\" is only distinguishable from \"mapped default\" here.\n noteRealmProvenance();\n // Sentinel translation for the command preview: the realm positional's\n // sentinel default must print as the deployment type's default realm\n // (alpha on cloud, / otherwise -- the same mapping frodo-lib applies at\n // auth). Known eagerly from -m/--type / FRODO_DEPLOYMENT (state) and\n // re-set after profile resolution (the profile may carry the type).\n setDeploymentTypeForPreview(state.getDeploymentType());\n // The editor trigger (explicit --prompt or guided mode) also flags the\n // session as explicitly interactive for the print gate below: the user\n // ASKED for the flow even when nothing was pending. Value must be\n // true, not merely source 'cli' -- --no-prompt also carries source\n // 'cli' (and is already filtered out by the !canPrompt() early return,\n // but the value check keeps this independent of that ordering).\n const explicitlyInteractive =\n (command.getOptionValue('prompt') === true &&\n command.getOptionValueSource('prompt') === 'cli') ||\n guidedModeEnabled();\n // The connection is UNRESOLVED while its own prompts are open (the\n // profile picker, the credentials page): record that BEFORE they run so\n // their footers render red. Recording only the outcome left every\n // connection-stage gap green -- an unset flag reads as \"ready\", and\n // nothing else is mandatory for most commands, so the footer was never\n // red there. When nothing needs prompting the flag flips to its real\n // value immediately, with no frame in between.\n connectionReadiness.set(command, false);\n const connectionResolved = await resolveConnectionArgs(command);\n connectionReadiness.set(command, connectionResolved);\n const mandatoryResolved = connectionResolved\n ? await resolveMandatoryOptions(command)\n : false;\n if (!connectionResolved || !mandatoryResolved) {\n if (violations.length > 0) {\n throwMissingMandatory(command, violations[0]);\n }\n return;\n }\n const oneOfResolved = await resolveOneOfGroups(command);\n if (!oneOfResolved) {\n const unsatisfied = findUnsatisfiedOneOfGroups(command);\n if (unsatisfied.length > 0) {\n throwOneOfUnsatisfied(command, unsatisfied[0]);\n }\n }\n // The invocation editor runs LAST: by now gap-filled\n // mandatory/one-of values are visible, so the editor only offers what is\n // still unspecified. Backing out keeps every value resolved above.\n // Trigger: an explicit --prompt (commander source\n // 'cli' -- the default true doesn't count) or the persisted guided-mode\n // settings toggle (frodo settings guided) -- both are opt-in; default\n // runs keep today's behavior. (--edit retired: commander rejects it as\n // an unknown option.)\n if (explicitlyInteractive) {\n await runInvocationEditor(command);\n }\n\n // The authoring-tool moment, DEFERRED to just before the command's\n // own output: after an interactive-assisted resolution, the command as\n // it will run prints exactly once, directly ABOVE the action's results\n // (user: the print is a header for the results, not a footer after\n // them). Flush sites, chosen so every flow's print lands at its last\n // command-mutating moment:\n //\n // - getTokens wrapper (AuthenticateOps): after the post-auth realm pick\n // concludes -- every auth command's action output starts after its\n // getTokens returns, so the print sits directly above the results.\n // SKIPPED when the command has entity picks pending (the picks may\n // still change the command; resolveEntityPicks flushes instead).\n // - resolveEntityPicks (EntityPickers): after the last entity pick\n // concludes -- the pick-after-auth commands (esv variable set, secret\n // store mapping delete) print here, with the picked values in.\n // - postAction hook (FrodoCommand): the fallback for commands whose\n // interactive flow ends elsewhere (settings/conn/stub commands -- no\n // auth, no picks); a no-op for anything the first two sites already\n // flushed.\n //\n // Flows that never reach a flush site (cancelled pickers, unsatisfied\n // one-of groups, failed auth) print nothing -- an abandoned session\n // leaves nothing behind.\n //\n // Armed UNCONDITIONALLY (registration is free); the PRINT GATE lives in\n // the flush closure, evaluated at flush time -- NOT here. It must be\n // evaluated late: the post-auth realm picker renders AFTER this pass\n // ends, so a gate evaluated now would miss a session whose only prompt\n // was that picker (env-resolved connection + realm pick -- the exact\n // frodo journey list flow that motivated the deferral). The gate itself\n // is unchanged: at least one prompt rendered this process, or the user\n // explicitly requested the flow (--prompt / guided mode). Fully\n // specified non-TTY runs (e2e snapshots) render no prompts and never\n // pass the gate, so output is byte-identical.\n armAuthoringPrint();\n setAuthoringPrintFlush(() => {\n if (promptsRendered() === 0 && !explicitlyInteractive) return;\n // Green (theme `positive`): the print sits directly above the\n // action's results and must be distinguishable from them at a\n // glance (user decision 2026-10-12, reversing #793's plain-color\n // experiment -- plain text read as more output). Ready-state green\n // is semantically right too: the flushed command is by definition\n // validated and about to run.\n printMessage(\n renderCommandPreview(command, {\n missingMandatoryOptionLabels: [],\n oneOfUnsatisfied: false,\n }),\n 'text'\n );\n });\n}\n\n/**\n * Emits commander's exact mandatory-option failure: same message, same\n * CommanderError code, same stderr output and exit path as pre-Phase-1.\n */\nfunction throwMissingMandatory(command: Command, optionLabel: string): never {\n command.error(missingMandatoryOptionMessage(optionLabel), {\n code: MISSING_MANDATORY_OPTION_CODE,\n });\n}\n\n/**\n * Commander-style failure for an unsatisfied one-of group. The message\n * mirrors commander's own error shape (message + help + exit 1), which is\n * also the UX the replaced `Unrecognized combination` else-branches had\n * (they printed, showed help, and exited 1).\n */\nfunction throwOneOfUnsatisfied(\n command: Command,\n group: OptionRequirementSpec\n): never {\n const members = group.options\n .map((name) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === name\n );\n return option ? option.flags : `--${name}`;\n })\n .join(group.all ? ' + ' : ' | ');\n command.error(\n `error: ${\n group.all\n ? `all of '${members}' are required`\n : `one of '${members}' is required`\n }${group.purpose ? ` to choose ${group.purpose}` : ''}`,\n { code: ONE_OF_UNSATISFIED_CODE }\n );\n}\n\n/**\n * The CommanderError code for an unsatisfied one-of group. Namespaced like\n * commander's own codes (`commander.missingArgument`,\n * `commander.missingMandatoryOptionValue`) so scripts can match on it, but\n * distinct from any commander code since this rule is frodo-specific.\n */\nexport const ONE_OF_UNSATISFIED_CODE = 'frodo.oneOfUnsatisfied';\n\n/**\n * The `→` routing for pickers inside the resolution pass: runs\n * `escapableSelect` with the command's discoverability hint attached,\n * and when the user presses → (resolve `RIGHT`), opens the invocation\n * editor, then re-prompts -- so a user who landed in a mandatory/one-of/\n * profile picker can discover and edit everything else from there (the\n * segment navigation described in docs/INTERACTIVE-COMMANDS.md). Without\n * a hint (nothing to configure) this is exactly `escapableSelect`: the\n * → key stays readline's business and the loop never engages.\n *\n * Re-prompting after the editor keeps the picker's own contract intact\n * (the caller sees a plain value or ESCAPE); the editor's ←/Esc re-enter\n * this loop, where the user can still decline with Escape.\n */\nasync function selectWithEditorRouting<Value>(\n command: Command,\n config: EscapableSelectConfig<Value>\n): Promise<Value | typeof ESCAPE> {\n const hint = editableOptionsHint(command);\n // Preview discipline: callers pass their own (a LIVE callback when the\n // pick maps onto a command token); the default stays the static\n // committed-state render, refreshed per picker OPEN so it reflects\n // values filled since the last prompt.\n const preview = config.preview ?? commandPreviewFor(command);\n for (;;) {\n const choice = await escapableSelect<Value>({\n ...config,\n hint,\n preview,\n });\n // EXIT_ALL resolves INSIDE the prompt (the grace window holds both\n // presses in one instance) and THROWS straight out of this loop --\n // it never reaches the caller (the resolver's callers branch on\n // ESCAPE only).\n if (choice === EXIT_ALL) throw EXIT_ALL_SIGNAL;\n if (choice === ESCAPE) return ESCAPE;\n if (choice !== RIGHT) return choice;\n // The editor THROWS EXIT_ALL_SIGNAL on a double-ESC inside it (the\n // signal propagates through this loop untouched); its plain return\n // (values committed or the value step declined) just loops back into\n // this picker -- the user can still ESC it to leave the segment.\n await runInvocationEditor(command);\n }\n}\n\n/**\n * The command preview footer for `command`'s prompts: the\n * command-so-far, red + cursive while mandatory input is missing, green/\n * white when validated and ready. Readiness derives from this module's\n * registries (deferred mandatory violations, one-of groups, connection\n * resolution); undefined when prompting is disallowed (the preview is an\n * interactive affordance only).\n */\nexport function commandPreviewFor(command: Command): string | undefined {\n if (!canPrompt()) return undefined;\n const readiness = commandReadinessFor(command);\n return readiness ? renderCommandPreview(command, readiness) : undefined;\n}\n\n/**\n * The resolver's current readiness input for `command` (the data behind\n * commandPreviewFor's render), for callers building LIVE preview\n * callbacks (livePositionalPreview/liveOptionPreview need the readiness\n * at every re-render, not a one-shot string). Undefined when prompting\n * is disallowed -- same gate as commandPreviewFor.\n */\nexport function commandReadinessFor(\n command: Command\n): CommandReadiness | undefined {\n if (!canPrompt()) return undefined;\n // Freshness: the deferred-mandatory registry records what parser time\n // found -- a value filled SINCE (by this pass's own prompts or the\n // invocation editor) must not keep the footer red. Recompute per call:\n // an option is \"still missing\" only when its label is registered AND\n // the option still holds no value.\n const registered = pendingMandatoryViolations.get(command) ?? [];\n const missingMandatoryOptionLabels = registered.filter((label) => {\n const option = command.options.find(\n (candidate) => candidate.flags === label\n );\n if (!option) return true;\n const value = command.getOptionValue(option.attributeName());\n return value === undefined || value === false || value === '';\n });\n const oneOfUnsatisfied = findUnsatisfiedOneOfGroups(command).length > 0;\n // Before the resolution pass has reached the connection step there is\n // no connection truth yet (the map is empty) -- leave it unset:\n // readiness then hinges on the mandatory/one-of state alone. From the\n // step onward the map holds false while the connection's own prompts\n // are open, then the outcome.\n const connectionResolved = connectionReadiness.get(command);\n return {\n missingMandatoryOptionLabels,\n oneOfUnsatisfied,\n ...(connectionResolved !== undefined ? { connectionResolved } : {}),\n };\n}\n\n/**\n * LIVE preview callbacks for `command`'s pickers (the footer shows what\n * the user is INFLUENCING -- arrowing through a list re-renders the\n * command with the highlighted value shadowed in). Built fresh per\n * picker open so the readiness snapshot (mandatory/one-of state at that\n * moment) is current; the callbacks stay valid across the picker's\n * renders. Undefined when prompting is disallowed -- same gate as\n * commandPreviewFor.\n */\nexport function livePositionalPreviewFor(\n command: Command,\n positionalName: string\n): ((highlighted: unknown) => string) | undefined {\n const readiness = commandReadinessFor(command);\n if (!readiness) return undefined;\n return livePositionalPreview(command, positionalName, readiness);\n}\n\nexport function liveOptionPreviewFor(\n command: Command,\n optionName: string,\n toValue?: (highlighted: unknown) => string | undefined\n): ((highlighted: unknown) => string) | undefined {\n const readiness = commandReadinessFor(command);\n if (!readiness) return undefined;\n return liveOptionPreview(command, optionName, readiness, toValue);\n}\n\n/**\n * Prompts for a value from a closed choice set. A ONE-item set auto-commits\n * (a single choice is no choice; commander would accept only that value\n * anyway -- the plan's single-option refinement); otherwise a searchable\n * dropdown. Returns ESCAPE only from the interactive picker, so a\n * single-choice set can never decline. With `optionName`, the picker's\n * footer is LIVE: arrowing through the values re-renders the command with\n * the highlighted value shadowed into that option.\n */\nasync function selectFromChoices(\n command: Command,\n message: string,\n choices: string[],\n optionName?: string\n): Promise<string | typeof ESCAPE> {\n if (choices.length === 1) {\n verboseMessage(`Only one value available: ${choices[0]}`);\n return choices[0];\n }\n return selectWithEditorRouting(command, {\n message,\n ...(optionName\n ? { preview: liveOptionPreviewFor(command, optionName) }\n : {}),\n choices: choices.map((choiceValue) => ({\n name: choiceValue,\n value: choiceValue,\n })),\n });\n}\n\n/**\n * Prompts for each deferred mandatory option violation. Options with a\n * closed value set (commander `choices()`) get a dropdown; everything\n * else free text. Returns false as soon as the user declines one (Escape\n * or empty Enter) -- the caller then restores the old error semantics.\n */\nasync function resolveMandatoryOptions(command: Command): Promise<boolean> {\n const violations = pendingMandatoryViolations.get(command) ?? [];\n for (const violation of violations) {\n const option = command.options.find((candidate) => {\n return candidate.flags === violation;\n });\n if (!option) {\n // Should not happen (the label came from the option itself), but\n // degrade to the old error rather than guessing.\n throwMissingMandatory(command, violation);\n }\n const attributeName = option.attributeName();\n\n // Entity-pickable options are deferred to the action body's post-auth\n // dropdown (resolveEntityPicks) -- free-texting an id here would defeat\n // the picker's purpose. Leave the violation unresolved; the action\n // resolves it after getTokens (or errors non-interactively).\n if (hasEntityPick(command, attributeName)) {\n verboseMessage(\n `${option.flags} will be offered from the target system after login.`\n );\n continue;\n }\n\n let value: string | undefined;\n if (option.argChoices && option.argChoices.length > 0) {\n const choice = await selectFromChoices(\n command,\n `Choose a value for ${option.flags}:`,\n option.argChoices,\n option.attributeName()\n );\n if (choice === ESCAPE) return false;\n value = choice;\n } else {\n const answer = await promptInput({\n message: `Enter a value for ${option.flags}:`,\n });\n if (!answer) return false;\n value = answer;\n }\n command.setOptionValueWithSource(attributeName, value, 'cli');\n verboseMessage(`Using ${value} for ${option.flags}.`);\n }\n return true;\n}\n\n/**\n * Whether an option-requiredness group is satisfied by the current option\n * values: every member for requireAllOf groups, at least one for\n * requireOneOf groups. Values are read via getOptionValue so injected\n * gap-fills count.\n */\nfunction groupSatisfied(\n command: Command,\n group: OptionRequirementSpec\n): boolean {\n const defined = (name: string): boolean => {\n const value = command.getOptionValue(name);\n return value !== undefined && value !== false && value !== '';\n };\n return group.all ? group.options.every(defined) : group.options.some(defined);\n}\n\n/**\n * All registered option-requiredness groups the current invocation does\n * not satisfy.\n */\nfunction findUnsatisfiedOneOfGroups(command: Command): OptionRequirementSpec[] {\n const groups = pendingOneOfGroups.get(command) ?? [];\n return groups.filter((group) => !groupSatisfied(command, group));\n}\n\n/**\n * Interactive resolution of unsatisfied one-of groups: the user picks WHICH\n * member to supply (dropdown over the group's members, defaulting to the\n * first), then a value step matched to the member's type -- dropdown for\n * commander `choices()`, free text otherwise (booleans resolve by the pick\n * itself). Mirrors resolveMandatoryOptions' decline semantics: Escape or\n * empty Enter returns false and the caller restores the error.\n */\nasync function resolveOneOfGroups(command: Command): Promise<boolean> {\n const unsatisfied = findUnsatisfiedOneOfGroups(command);\n for (const group of unsatisfied) {\n const memberOptions = group.options\n .map((name) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === name\n );\n return option ? { name, option } : undefined;\n })\n .filter(\n (member): member is { name: string; option: Option } =>\n member !== undefined\n );\n if (memberOptions.length === 0) continue;\n\n const subject = group.purpose ?? 'what to act on';\n // LIVE footer: each row IS an option of the group, so the shadow\n // dispatches per highlight -- the highlighted member's own option\n // gains a placeholder showing the flag as present. The pick itself\n // is a boolean-resolution (selecting the member satisfies the group);\n // the value step below fills it for valued members. `true` shadowed\n // with source 'cli' serializes the flag alone -- exactly the token\n // the committed pick produces for boolean members.\n const readiness = commandReadinessFor(command);\n const picked = await selectWithEditorRouting(command, {\n message: `Choose ${subject}:`,\n ...(readiness\n ? {\n preview: (highlighted: unknown) => {\n const member = memberOptions.find(\n (candidate) => candidate.name === highlighted\n );\n if (!member) return renderCommandPreview(command, readiness);\n // Boolean members shadow `true` (the flag alone serializes\n // -- the exact committed token); valued members shadow\n // nothing (their flag needs a value the NEXT step collects\n // -- a fake value would lie in the footer).\n const isBoolean = !/<[^>]+>|\\[[^\\]]+\\]/.test(member.option.flags);\n return liveOptionPreview(\n command,\n member.name,\n readiness,\n isBoolean ? () => 'true' : () => undefined\n )(highlighted);\n },\n }\n : {}),\n choices: memberOptions.map((member): EscapableSelectChoice<string> => ({\n value: member.name,\n name: `${member.option.flags}${member.option.description ? ` -- ${member.option.description}` : ''}`,\n })),\n });\n if (picked === ESCAPE) return false;\n\n const chosen = memberOptions.find((member) => member.name === picked)!;\n\n // Entity-pickable members are deferred to the action body's post-auth\n // dropdown (resolveEntityPicks) -- see resolveMandatoryOptions.\n if (hasEntityPick(command, chosen.name)) {\n verboseMessage(\n `${chosen.option.flags} will be offered from the target system after login.`\n );\n continue;\n }\n\n if (chosen.option.argChoices && chosen.option.argChoices.length > 0) {\n const value = await selectFromChoices(\n command,\n `Choose a value for ${chosen.option.flags}:`,\n chosen.option.argChoices,\n chosen.name\n );\n if (value === ESCAPE) return false;\n command.setOptionValueWithSource(chosen.name, value, 'cli');\n } else if (!/<[^>]+>|\\[[^\\]]+\\]/.test(chosen.option.flags)) {\n // Boolean flag: the flags carry no value placeholder (<value> /\n // [value]), so the pick itself is the value -- no second prompt.\n command.setOptionValueWithSource(chosen.name, true, 'cli');\n } else {\n const answer = await promptInput({\n message: `Enter a value for ${chosen.option.flags}:`,\n });\n if (!answer) return false;\n command.setOptionValueWithSource(chosen.name, answer, 'cli');\n }\n verboseMessage(`Using ${chosen.option.flags}.`);\n }\n return true;\n}\n\n/**\n * Whether the invocation carries an explicit interactive-auth mode\n * (--browser/--device). Read from the parsed option values, NOT from\n * frodo-lib state: `handleDefaultArgsAndOpts` sets authMode from these\n * same options inside the action body, i.e. after this pass runs.\n */\nfunction isInteractiveAuthMode(command: Command): boolean {\n return (\n !!command.getOptionValue('browser') || !!command.getOptionValue('device')\n );\n}\n\n/**\n * Reads the saved connection profiles file directly (no auth, no network)\n * to enumerate candidates for the host dropdown. Returns a sorted list;\n * empty when the file is missing or unreadable.\n */\nfunction listSavedProfiles(): { host: string; alias?: string }[] {\n const filename = getConnectionProfilesPath();\n let connectionsData: Record<string, { alias?: string }>;\n try {\n connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n } catch {\n return [];\n }\n return Object.keys(connectionsData)\n .sort()\n .map((host) => ({ host, alias: connectionsData[host].alias }));\n}\n\n// Distinct from any real host string so it can't collide with one.\nconst ENTER_MANUALLY = Symbol('resolveConnectionArgs:enterManually');\n\n/**\n * Prompts for the missing connection-level positional arguments: host,\n * then username/password -- the latter only when no saved profile can\n * supply credentials for the resolved host. Returns false when the user\n * declines a prompt (Escape or empty Enter); the caller then restores the\n * pre-Phase-1 error semantics.\n *\n * Skipped per-argument when: the command doesn't declare the argument,\n * the value is already present (positional arg, or env var via frodo-lib\n * state's own env fallback), or --browser/--device makes the\n * username/password prompts redundant.\n */\nasync function resolveConnectionArgs(command: Command): Promise<boolean> {\n // -- host -------------------------------------------------------------\n if (\n positionalIndex(command, 'host') !== -1 &&\n !positionalValue(command, 'host') &&\n !state.getHost() // env fallback (FRODO_HOST)\n ) {\n const profiles = listSavedProfiles();\n let picked: string | undefined;\n\n if (profiles.length === 1) {\n // Single profile: no menu -- mirror the established convention\n // (runInteractivePreferredCredentialPicker). Announced only under\n // --verbose, since this runs inside an otherwise-quiet command.\n picked = profiles[0].host;\n verboseMessage(\n `No host given; using the only saved connection profile: ${picked}`\n );\n } else if (profiles.length > 1) {\n // LIVE footer: the highlighted profile's host shadows the host\n // positional -- the footer shows the command's host token (and the\n // connection page's later prompts) moving with the cursor. The\n // \"enter manually\" sentinel maps to undefined (committed state).\n const readiness = commandReadinessFor(command);\n const choice = await selectWithEditorRouting<\n string | typeof ENTER_MANUALLY\n >(command, {\n message: 'Choose a connection profile:',\n ...(readiness\n ? { preview: livePositionalPreview(command, 'host', readiness) }\n : {}),\n // Filter matches host AND alias (case-insensitive) -- typing part\n // of a hostname or the alias both find the profile.\n search: ({ value, name }, query) => {\n const needle = query.toLowerCase();\n if (value === ENTER_MANUALLY) return name.length === 0;\n return (\n value.toLowerCase().includes(needle) ||\n (profiles.find((p) => p.host === value)?.alias ?? '')\n .toLowerCase()\n .includes(needle)\n );\n },\n choices: [\n {\n value: ENTER_MANUALLY,\n name: 'Enter a host manually...',\n description: 'Type an AM base URL (or a profile substring).',\n },\n ...profiles.map(\n (\n profile\n ): EscapableSelectChoice<string | typeof ENTER_MANUALLY> => ({\n value: profile.host,\n name: profile.alias\n ? `${profile.host} (${profile.alias})`\n : profile.host,\n })\n ),\n ],\n });\n if (choice === ESCAPE) return false;\n if (choice === ENTER_MANUALLY) {\n const answer = await promptInput({\n message: 'AM base URL (or profile alias/substring):',\n });\n if (!answer) return false;\n picked = answer;\n } else {\n picked = choice;\n }\n } else {\n // No saved profiles at all: free-text entry, same as the \"enter\n // manually\" path above.\n const answer = await promptInput({\n message: 'AM base URL:',\n });\n if (!answer) return false;\n picked = answer;\n }\n setPositionalValue(command, 'host', picked);\n // The picked profile's deployment type feeds the preview's sentinel\n // translation (frodo-lib itself only loads the profile into state\n // later, during auth). The lookup below covers all host origins.\n }\n // Refresh the preview's deployment type when the host is known but the\n // type isn't yet: the saved profile may carry it (the user didn't pass\n // -m/--type, and lib loads the profile into state only during auth --\n // too late for the preview). No profile: probe the host ANONYMOUSLY\n // (frodo.login.probeDeploymentType -- two unauthenticated POSTs to\n // /oauth2/authorize, ~200ms) so new-host flows (frodo login <host>,\n // frodo conn save <host>, env-var connections) get the type BEFORE any\n // login: the realm sentinel translates in the preview/footer, realm\n // pickers pre-highlight the right default, cloud-only gating reads\n // correctly. The probed type is written into state (not just the\n // preview) because pre-auth prompt machinery reads\n // state.getDeploymentType(); it MUST match what auth later determines,\n // and the probe's evidence (built-in admin client existence) is the\n // same signal determineDeploymentType uses post-auth, so they agree by\n // construction. Probe failure (unreachable host, non-AM endpoint)\n // keeps the current behavior: preview keeps the untranslated sentinel,\n // and the run proceeds exactly as before the probe existed.\n {\n const host = positionalValue(command, 'host') ?? state.getHost();\n if (!state.getDeploymentType() && host) {\n try {\n const profile = await getConnectionProfileByHost(host);\n setDeploymentTypeForPreview(profile.deploymentType);\n } catch {\n // No profile for this host: the anonymous probe is the only\n // remaining signal. Only probe under the prompting gate (non-\n // interactive runs must stay byte-identical AND latency-free).\n if (canPrompt() && isValidUrl(host)) {\n try {\n const probe = await probeDeploymentType(host);\n state.setDeploymentType(probe.deploymentType);\n setDeploymentTypeForPreview(probe.deploymentType);\n } catch {\n // Unreachable / not an AM host: as if the probe didn't\n // exist -- untranslated sentinel, pre-existing semantics.\n }\n }\n }\n }\n }\n\n // -- username / password ----------------------------------------------\n // Prompted ONLY when frodo-lib's own resolution can't answer: a saved\n // profile for the (now-resolved) host supplies stored credentials on\n // its own (AuthenticateOps loadConnectionProfile), so prompting would\n // be pure friction. No profile (new host, or host given as a URL with\n // nothing saved): prompt bare, so e.g. `frodo login <new-host>` and\n // `frodo conn save <new-host>` become fully interactive.\n const usernameNeeded =\n positionalIndex(command, 'username') !== -1 &&\n !positionalValue(command, 'username') &&\n !state.getUsername() && // env fallback (FRODO_USERNAME)\n !isInteractiveAuthMode(command);\n const passwordNeeded =\n positionalIndex(command, 'password') !== -1 &&\n !positionalValue(command, 'password') &&\n !state.getPassword() && // env fallback (FRODO_PASSWORD)\n !isInteractiveAuthMode(command);\n\n if (!usernameNeeded && !passwordNeeded) return true;\n\n const host = positionalValue(command, 'host') ?? state.getHost();\n if (!host) return true; // host unresolved; the action fails on it as before\n\n let savedUsername: string | undefined;\n let profileNote: string | undefined;\n try {\n const profile = await getConnectionProfileByHost(host);\n // frodo-lib will authenticate from the profile alone when it carries\n // any usable credential (user/svcacct/amster); a bare profile entry\n // (host saved without credentials -- possible via earlier frodo\n // versions and manual edits) answers nothing, so the prompts still\n // run for it. A username-only entry prefills the username prompt.\n if (\n (profile.username && profile.password) ||\n profile.svcacctId ||\n profile.amsterPrivateKey\n ) {\n return true;\n }\n savedUsername = profile.username ?? undefined;\n profileNote = profile.alias\n ? `from profile ${profile.alias}`\n : 'from profile';\n } catch {\n // No profile for this host (or unreadable): fall through to prompts.\n }\n\n // The connection PAGE replaces the sequential username-then-\n // password prompts. Rows carry the resolved current values + provenance\n // (a username-only profile prefills the username row as before; env\n // fallbacks show as \"(from FRODO_USERNAME)\" etc.); an empty commit on\n // the masked password row keeps the stored value. Escape on the page\n // falls back to today's sequential prompts (unchanged behavior).\n const result = await connectionPage({\n message: 'Connection:',\n preview: commandPreviewFor(command),\n rows: [\n {\n key: 'host',\n label: 'host',\n value: host,\n note: profileNote ?? undefined,\n },\n {\n key: 'username',\n label: 'username',\n value: positionalValue(command, 'username') ?? state.getUsername(),\n note: state.getUsername()\n ? 'from FRODO_USERNAME'\n : (profileNote ?? undefined),\n },\n {\n key: 'password',\n label: 'password',\n value: positionalValue(command, 'password') ?? state.getPassword(),\n note: state.getPassword()\n ? 'from FRODO_PASSWORD'\n : (profileNote ?? undefined),\n },\n ],\n onHostChange: async (newHost) => {\n setPositionalValue(command, 'host', newHost);\n // Re-resolve the credential rows' profile context for the new host\n // (the lookup keys on the host).\n let note: string | undefined;\n let savedUser: string | undefined;\n try {\n const profile = await getConnectionProfileByHost(newHost);\n note = profile.alias ? `from profile ${profile.alias}` : 'from profile';\n savedUser = profile.username ?? undefined;\n } catch {\n note = undefined;\n }\n return [\n { key: 'host', label: 'host', value: newHost, note },\n {\n key: 'username',\n label: 'username',\n value: positionalValue(command, 'username') ?? savedUser,\n note,\n },\n {\n key: 'password',\n label: 'password',\n value: undefined,\n note,\n },\n ];\n },\n });\n if (result === EXIT_ALL) {\n // Exit-all unwinds the whole interactive resolution -- no fallback\n // prompts, the command does not run. THROW: the session ends (the\n // signal travels through the resolver, the preAction hook chain and\n // the action body to app.ts's top-level catch).\n throw EXIT_ALL_SIGNAL;\n }\n if (result === PAGE_ESCAPE) {\n // Page declined: fall back to the pre-page sequential prompts.\n if (usernameNeeded) {\n const answer = await promptInput({\n message: 'Username:',\n default: savedUsername,\n });\n if (!answer) return false;\n setPositionalValue(command, 'username', answer);\n }\n if (passwordNeeded) {\n const answer = await promptPassword({ message: 'Password:' });\n if (!answer) return false;\n setPositionalValue(command, 'password', answer);\n }\n return true;\n }\n if (result.username) setPositionalValue(command, 'username', result.username);\n if (result.password) setPositionalValue(command, 'password', result.password);\n return true;\n}\n\n/**\n * The invocation editor: lists the command's optional\n * options that are NOT already specified on this invocation (gap-filled\n * mandatory/one-of values from the earlier steps don't re-appear), with\n * their help descriptions. Space toggles, enter commits; each selected\n * option then gets a value step matched to its type (dropdown for\n * commander choices(), free text otherwise -- booleans commit on toggle).\n * Unselected options keep their built-in defaults; committed values apply\n * to THIS invocation only (plain option values, no persistence -- that is\n * Defaults.json -- see DefaultsStore).\n *\n * Escape backs out of the value step without committing that option; the\n * multiselect's Escape (or ←) backs out of the editor entirely (committed\n * nothing beyond what the earlier steps resolved). No editor on a\n * non-interactive session: --edit is meaningless there and the command\n * must behave exactly as without it (FRODO_TEST e2e determinism).\n */\n\n// The editor's candidate list + the discoverability hint live in a zero-import\n// module (EditableOptions) so picker modules in utils/interactive/ can\n// attach the same hint without importing this file's graph (see the\n// ActiveActionCommandState split for the layering rationale). Re-exported\n// for the editor's own use.\nexport {\n editableOptionGroupOf,\n editableOptionGroups,\n editableOptionalOptions,\n editableOptionsHint,\n} from '../utils/interactive/EditableOptions';\n\n// The positional read/write helpers live in a zero-import module\n// (PositionalArgs) shared with the post-auth realm picker's write-back;\n// re-exported here under the historical name for any other consumers.\nexport { setPositionalValue as setPositionalValueForCommand } from '../utils/interactive/PositionalArgs';\n\n/**\n * Public entry for utils/interactive picker modules (EntityPickers,\n * RealmPickers): their `→` key opens this editor, then re-prompts. Kept\n * as a named export because those modules import this file lazily (the\n * cycle is otherwise static: this file imports their registries).\n */\nexport async function runInvocationEditorForCommand(\n command: Command\n): Promise<void> {\n await runInvocationEditor(command);\n}\n\n/**\n * Applies the command's persisted defaults (~/.frodo/\n * Defaults.json) to every option the user did NOT provide this\n * invocation (flag or env -- the precedence gate is\n * optionMissingUserValue: source undefined or 'default'). Values land\n * with source 'cli': persisted defaults are user-authored\n * configuration, and everything downstream (editor display, preview\n * footer, the eventual-command serializer) must treat them as real\n * input. Interactive only -- non-interactive runs keep byte-identical\n * behavior (built-in defaults).\n */\nfunction applyPersistedDefaults(command: Command): void {\n if (!canPrompt()) return;\n const persisted = applicableCommandDefaults(command);\n for (const option of command.options) {\n const value = persisted[option.attributeName()];\n if (value === undefined) continue;\n if (!optionMissingUserValue(command, option)) continue;\n // Type guard: a persisted value must fit the option's collector\n // shape -- arrays only for repeat-collecting options (ListOption\n // family), everything else scalar. A mismatched entry (the option's\n // definition changed since the save) is skipped, not applied.\n const collectsArrays =\n Array.isArray(command.getOptionValue(option.attributeName())) ||\n Array.isArray(option.defaultValue);\n if (Array.isArray(value) !== collectsArrays) continue;\n command.setOptionValueWithSource(option.attributeName(), value, 'cli');\n verboseMessage(\n `Using saved default ${option.flags} ${String(value)} (frodo settings defaults to change).`\n );\n }\n}\n\nasync function runInvocationEditor(command: Command): Promise<void> {\n // THROWS EXIT_ALL_SIGNAL on a double-ESC inside the editor (either the\n // multiselect's list escape or a value step's) -- the signal propagates\n // through every caller to app.ts's top-level handler.\n const candidates = editableOptionalOptions(command);\n if (candidates.length === 0) {\n verboseMessage('No optional options left to edit.');\n return;\n }\n\n // Pre-select every option that already holds a user-authored value\n // (CLI/env/persisted-default source 'cli', or a previous commit in\n // this same editor loop): re-opening the editor via → must show the\n // selections that are already in the command, not an empty slate --\n // the user's markers ARE the command state. Commander defaults stay\n // unmarked (they are not the user's input).\n const preselected = candidates\n .filter(\n (option) => command.getOptionValueSource(option.attributeName()) === 'cli'\n )\n .map((option) => option.attributeName());\n\n // The per-option value step, shared by both paths that can collect a\n // value: the <space> side step (below) and the post-commit loop.\n // Returns undefined when the user declines (escape / empty enter) --\n // the caller leaves the option untouched. `committed` records every\n // value actually written, for the --save-defaults partial save.\n const runValueStep = async (\n attributeName: string\n ): Promise<string | true | typeof EXIT_ALL | undefined> => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n if (!option) return undefined;\n // Re-editing a valued option pre-fills the value step with\n // the current value (Escape keeps it) -- \"just wanted to peek\" costs\n // one Esc, not a retyping session.\n const current = command.getOptionValue(attributeName);\n const currentText =\n current === undefined || current === false ? undefined : String(current);\n if (option.argChoices && option.argChoices.length > 0) {\n const value = await escapableSelect<string>({\n message: `Choose a value for ${option.flags}:`,\n preview: liveOptionPreviewFor(command, attributeName),\n choices: option.argChoices.map(\n (choiceValue): EscapableSelectChoice<string> => ({\n name: choiceValue,\n value: choiceValue,\n })\n ),\n default: currentText,\n });\n if (value === EXIT_ALL) return EXIT_ALL;\n if (value === ESCAPE || value === RIGHT) return undefined;\n command.setOptionValueWithSource(attributeName, value, 'cli');\n return value;\n }\n if (!/<[^>]+>|\\[[^\\]]+\\]/.test(option.flags)) {\n // Boolean flag: selected = true, no value step.\n command.setOptionValueWithSource(attributeName, true, 'cli');\n return true;\n }\n const answer = await promptInput({\n message: `Enter a value for ${option.flags}:`,\n default: currentText,\n });\n if (!answer) return undefined;\n command.setOptionValueWithSource(attributeName, answer, 'cli');\n return answer;\n };\n\n const committed: Record<string, unknown> = {};\n\n const picked = await escapableMultiSelect<string>({\n message: `Optional options for '${command.name()}' (space to select):`,\n defaultValues: preselected,\n // LIVE footer over the SELECTION (not the cursor): every space-\n // toggled option renders as its flag -- booleans as the flag alone,\n // valued options as flag + value placeholder while being valued.\n // The committed state shows when nothing is selected.\n preview: (() => {\n const readiness = commandReadinessFor(command);\n if (!readiness) return undefined;\n return liveMultiOptionPreview(command, readiness);\n })(),\n // Space on a VALUED option opens the prompt's INLINE value editor\n // (user feedback 2026-10-12: marking --retry showed a <placeholder>\n // and required a second enter to reach the value menu -- and the\n // first nested-prompt design froze the frame: two readlines over\n // stdin). The option is marked only once a real value is committed;\n // esc rejects the mark. Booleans have no value step and toggle\n // directly.\n needsValue: (attributeName) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n return !!option && /<[^>]+>|\\[[^\\]]+\\]/.test(option.flags);\n },\n // Enum options (commander `.choices()`, e.g. --retry <strategy>)\n // get an in-frame PICKER instead of free text (user feedback\n // 2026-10-12: free-typing an enum value is both wrong-shaped and\n // invisible).\n choicesFor: (attributeName) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n return option?.argChoices && option.argChoices.length > 0\n ? option.argChoices.map(String)\n : undefined;\n },\n // The value editor starts at the option's current value (a picker\n // cursor lands on it; the text draft pre-fills) -- same\n // \"pre-fill the value step\" contract runValueStep's re-edit\n // already honors.\n currentValueFor: (attributeName) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n if (!option) return undefined;\n const current = command.getOptionValue(attributeName);\n // Array collectors have no single current text to start from --\n // a repeated mark APPENDS (mirroring repeated flags), so the\n // editor starts empty every time.\n if (current === undefined || current === false || Array.isArray(current))\n return undefined;\n return String(current);\n },\n onValue: (attributeName, value) => {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n );\n if (!option) return;\n // Array-collecting options (ListOption family) accumulate:\n // a repeated mark appends, mirroring repeated CLI flags.\n const collectsArrays = Array.isArray(option.defaultValue);\n if (collectsArrays) {\n const existing = command.getOptionValue(attributeName);\n command.setOptionValueWithSource(\n attributeName,\n [...(Array.isArray(existing) ? existing : []), value],\n 'cli'\n );\n } else {\n command.setOptionValueWithSource(attributeName, value, 'cli');\n }\n committed[attributeName] = command.getOptionValue(attributeName);\n verboseMessage(`Using ${option.flags} ${value}.`);\n },\n // The GROUPED editor (user decision 2026-10-13): the command's own\n // options flat on top, every shared help group a collapsible\n // section (the -hh order). A group holding an option the user\n // already set (defaultValues below, source 'cli') starts expanded,\n // so authored state never hides behind a collapsed header.\n groups: editableOptionGroups(candidates),\n choices: sortEditableOptions(candidates).map((option) => {\n // Already-valued options are editable too --\n // shown with their current value so the user can tell them apart.\n // Distinguish a commander default (never user-typed) from a value\n // that came from this invocation's CLI/env.\n const current = command.getOptionValue(option.attributeName());\n const sourced =\n current === undefined || current === false\n ? undefined\n : command.getOptionValueSource(option.attributeName()) === 'default'\n ? ` (default: ${current})`\n : ` (current: ${current})`;\n return {\n value: option.attributeName(),\n name: option.flags,\n group: editableOptionGroupOf(option),\n description: option.description\n ? `${option.description}${sourced ?? ''}`\n : sourced?.trim(),\n };\n }),\n });\n if (picked === EXIT_ALL) {\n // Exit-all unwinds the whole interactive resolution (see the\n // runInvocationEditor contract below). THROW the signal -- the\n // editor can be opened from inside any routing loop or the action\n // body, so only a throw reaches the top-level handler.\n throw EXIT_ALL_SIGNAL;\n }\n if (picked === MULTISEL_ESCAPE) {\n verboseMessage('Invocation editor dismissed; values unchanged.');\n return;\n }\n // With --save-defaults, every value committed in THIS editor\n // session (set/changed below) persists as the command's defaults. Only\n // options actually committed are saved -- a dismissed editor or an\n // untouched option changes nothing on disk.\n const savingDefaults =\n command.getOptionValue('saveDefaults') === true &&\n command.getOptionValueSource('saveDefaults') === 'cli';\n\n for (const attributeName of picked) {\n // Options valued INLINE (the multiselect's onValue committed the\n // value AND marked the option, source 'cli') are done -- running\n // the value step again would ask twice for the same value. A\n // boolean flag also sets source 'cli' at toggle time, so the\n // source check covers both; the value step is only for options\n // still without a user value.\n const alreadyValued =\n command.getOptionValueSource(attributeName) === 'cli' &&\n command.getOptionValue(attributeName) !== undefined;\n if (alreadyValued) {\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n )!;\n verboseMessage(`Using ${option.flags}.`);\n continue;\n }\n const value = await runValueStep(attributeName);\n if (value === EXIT_ALL) throw EXIT_ALL_SIGNAL; // exit-all unwinds to the shell\n if (value === undefined) continue;\n committed[attributeName] = value;\n const option = command.options.find(\n (candidate) => candidate.attributeName() === attributeName\n )!;\n verboseMessage(`Using ${option.flags}.`);\n }\n\n // The editor can open from INSIDE getTokens (a picker's [⏵] key),\n // which is after the action body's handleDefaultArgsAndOpts copy ran\n // -- so options committed here (--curlirize/--debug/--verbose...)\n // reached the command object but never frodo-lib's state (user report\n // 2026-10-13: --curlirize selected in the editor produced no curl\n // output). Replay the state handlers for everything the editor left\n // authored. Host/realm/user/password are skipped (the resolver owns\n // connection state; re-feeding it would clobber a resolved\n // connection).\n if (picked.length > 0) {\n const { replayEditorOptionStates } = await import('./FrodoCommand');\n replayEditorOptionStates(command);\n }\n\n // Persist what this session committed (partial save -- only\n // the editor's own commits; gap-filled mandatory values and\n // connection args are per-invocation, not preferences).\n if (savingDefaults && Object.keys(committed).length > 0) {\n const { saveCommandDefaults } =\n await import('../utils/interactive/DefaultsStore');\n saveCommandDefaults(command, committed);\n successMessage(\n `Saved ${Object.keys(committed).length} option${\n Object.keys(committed).length === 1 ? '' : 's'\n } as defaults for '${commandStorePath(command)}'.`\n );\n }\n}\n\n/** The `frodo x y z` path -- the store's key (DefaultsStore's own helper,\n * re-imported lazily beside its save call). */\nfunction commandStorePath(command: Command): string {\n const names: string[] = [];\n for (\n let cursor: Command | undefined = command;\n cursor;\n cursor = cursor.parent\n ) {\n names.unshift(cursor.name());\n }\n return names.join(' ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkFA,eAAsB,YACpB,QAC0B;CAC1B,IAAI,CAACA,8BAAAA,UAAU,GAAG,OAAO,KAAA;CACzB,OAAO,cAAc,QAAQ,EAAE,UAAU,MAAM,CAAC;AAClD;;;;;AAMA,eAAsB,eACpB,QAC0B;CAC1B,IAAI,CAACA,8BAAAA,UAAU,GAAG,OAAO,KAAA;CACzB,OAAO,cAAc,QAAQ,EAAE,UAAU,KAAK,CAAC;AACjD;;;;;;;;;;AAWA,eAAe,cACb,QACA,MACiB;CACjB,8BAAA,mBAAmB;CACnB,IAAI;EACF,OAAO,MAAM,WAAW,QAAQ,IAAI;CACtC,SAAS,OAAO;EACd,IAAI,iBAAiBC,8BAAAA,iBAAiB,OAAA;EACtC,MAAM;CACR;AACF;AAEA,SAAS,WACP,QACA,EAAE,YACe;CA2EjB,OA1EmBC,8BAAAA,cAChB,KA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KAAK,CAAC;CAE7B,OAAO,MAAM,KAAK,GAAG;AACvB"}
|
package/dist/app.cjs
CHANGED
|
@@ -19134,7 +19134,7 @@ function setup$101() {
|
|
|
19134
19134
|
}
|
|
19135
19135
|
//#endregion
|
|
19136
19136
|
//#region package.json
|
|
19137
|
-
var version$1 = "5.0.0-
|
|
19137
|
+
var version$1 = "5.0.0-7";
|
|
19138
19138
|
//#endregion
|
|
19139
19139
|
//#region node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
|
|
19140
19140
|
var __create = Object.create;
|
|
@@ -43961,7 +43961,7 @@ const { getVersion, getBuildTimestamp, getAllVersions } = require_ColorTheme.fro
|
|
|
43961
43961
|
* rather than a tsup build, since no bundler ever substitutes the
|
|
43962
43962
|
* identifier there.
|
|
43963
43963
|
*/
|
|
43964
|
-
const getCliBuildTimestamp = () => "2026-10-
|
|
43964
|
+
const getCliBuildTimestamp = () => "2026-10-14T12:50:29.185Z";
|
|
43965
43965
|
const VERSION_CACHE_FILE = `${os.default.homedir()}/.frodo/Versions.json`;
|
|
43966
43966
|
const VERSION_CHECK_INTERVAL = 86400;
|
|
43967
43967
|
const ENDPOINTS = [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-cli",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,13 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"main": "dist/launch.cjs",
|
|
34
34
|
"files": [
|
|
35
|
-
"dist
|
|
36
|
-
"dist
|
|
37
|
-
"dist/launch.cjs",
|
|
38
|
-
"dist/launch.cjs.map",
|
|
39
|
-
"dist/loader.cjs",
|
|
40
|
-
"dist/loader.cjs.map",
|
|
41
|
-
"dist/rolldown-runtime-*.cjs",
|
|
35
|
+
"dist/*.cjs",
|
|
36
|
+
"dist/*.cjs.map",
|
|
42
37
|
"LICENSE",
|
|
43
38
|
"README.md",
|
|
44
39
|
"CHANGELOG.md"
|