@narumitw/pi-starship 0.52.3 → 0.54.0
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/README.md +93 -68
- package/dist/chunks/{chunk-6D6VEVE5.js → chunk-OZDBEKV2.js} +124 -25
- package/dist/chunks/chunk-OZDBEKV2.js.map +7 -0
- package/dist/chunks/{commands-T73QN435.js → commands-Z3V7LRUY.js} +3 -2
- package/dist/chunks/{commands-T73QN435.js.map → commands-Z3V7LRUY.js.map} +2 -2
- package/dist/index.ts +27 -6
- package/dist/index.ts.map +3 -3
- package/package.json +5 -8
- package/src/config.ts +9 -0
- package/src/effective-config.ts +1 -0
- package/src/format/style.ts +14 -6
- package/src/modules/activity.ts +57 -4
- package/src/modules/catalog.ts +1 -1
- package/src/modules/provider.ts +19 -1
- package/src/modules/render.ts +2 -1
- package/src/modules/thinking.ts +24 -0
- package/src/modules/types.ts +3 -0
- package/src/pi-starship.ts +24 -3
- package/src/runtime/github-pr.ts +2 -1
- package/dist/chunks/chunk-6D6VEVE5.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands.ts", "../../src/command-configuration.ts", "../../src/command-preview.ts", "../../src/effective-config.ts", "../../src/presets/bracketed-segments.ts", "../../src/presets/catppuccin-powerline.ts", "../../src/presets/gruvbox-rainbow.ts", "../../src/presets/jetpack.ts", "../../src/presets/minimal.ts", "../../src/presets/nerd-font-symbols.ts", "../../src/presets/no-empty-icons.ts", "../../src/presets/no-nerd-font.ts", "../../src/presets/no-runtime-versions.ts", "../../src/presets/pastel-powerline.ts", "../../src/presets/plain-text-symbols.ts", "../../src/presets/pure-preset.ts", "../../src/presets/tokyo-night.ts", "../../src/presets/catalog.ts", "../../src/command-inspector.ts", "../../src/command-preset-picker.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ExtensionAPI, ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport {\n\ttype ConfigurationCommandOptions,\n\tconfigurationMenuScreen,\n\tconfigurationOverviewScreen,\n\tconfigurationPresentation,\n\teffectiveConfigurationScreen,\n\treloadConfiguration,\n\tsettingsDocumentScreen,\n\ttype WorkflowOwner,\n} from \"./command-configuration.js\";\nimport { completeStarshipArguments, STARSHIP_SUBCOMMANDS } from \"./command-contract.js\";\nimport { formatFooterExplanation } from \"./command-inspector.js\";\nimport { showPresetPicker } from \"./command-preset-picker.js\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport {\n\tatomicRestoreConfigDocument,\n\tatomicSaveConfigDocument,\n\tBUILT_IN_EXAMPLE,\n\ttype LoadedStarshipConfig,\n\tremoveConfigDocumentIfMatches,\n\tvalidateConfigDocument,\n} from \"./config.js\";\nimport { inspectUnavailableModules, type StatuslineInspection } from \"./modules/inspection.js\";\nimport {\n\tgetStarshipPreset,\n\tpresetForDocument,\n\tSTARSHIP_PRESETS,\n\ttype StarshipPreset,\n} from \"./presets/catalog.js\";\n\nconst MAIN_ACTIONS = {\n\tcustomize: \"customize\",\n\tpresets: \"presets\",\n\texplain: \"explain\",\n\tmodules: \"modules\",\n\tconfiguration: \"configuration\",\n\thelp: \"help\",\n\trestore: \"restore\",\n} as const;\n\nconst PREVIEW_ACTIONS = {\n\tcontinue: \"continue\",\n\tedit: \"edit\",\n\tcancel: \"cancel\",\n} as const;\n\nexport interface StarshipCommandOptions extends ConfigurationCommandOptions {\n\tgetInspection?(): StatuslineInspection | undefined;\n\tpreview?(loaded: LoadedStarshipConfig | undefined, ctx: ExtensionCommandContext): void;\n\tsave?: (settingsPath: string, rawDocument: string) => LoadedStarshipConfig;\n\trestore?: (settingsPath: string, rawDocument: string) => void;\n\tvalidate?: (settingsPath: string, rawDocument: string) => LoadedStarshipConfig;\n\tgetMenuOwner?(): WorkflowOwner;\n}\n\ntype ReviewIntent =\n\t| { kind: \"customize\" }\n\t| { kind: \"restore\" }\n\t| { kind: \"preset\"; preset: StarshipPreset };\n\nexport function registerStarshipCommand(pi: ExtensionAPI, options: StarshipCommandOptions) {\n\tpi.registerCommand(\"starship\", {\n\t\tdescription: \"Customize or inspect the native Starship-style footer\",\n\t\tgetArgumentCompletions: completeStarshipArguments,\n\t\thandler: (args, ctx) => handleStarshipCommand(args, ctx, options),\n\t});\n}\n\nexport async function handleStarshipCommand(\n\targs: string,\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n) {\n\tconst normalized = args.trim();\n\tif (!normalized) {\n\t\tif (ctx.mode === \"tui\") await showMainMenu(ctx, options);\n\t\telse showHelp(ctx, options.settingsPath);\n\t\treturn;\n\t}\n\n\tconst [subcommand = \"\", ...trailing] = normalized.split(/\\s+/u);\n\tconst route = subcommand.toLowerCase();\n\tif (trailing.length > 0 || !STARSHIP_SUBCOMMANDS.some((item) => item.value === route)) {\n\t\tif (canNotify(ctx)) {\n\t\t\tconst reason =\n\t\t\t\ttrailing.length > 0\n\t\t\t\t\t? `Unexpected arguments for /starship ${safeText(route)}.`\n\t\t\t\t\t: `Unknown /starship subcommand: ${safeText(route)}.`;\n\t\t\tctx.ui.notify(`${reason} Usage: /starship [settings|status|help]`, \"warning\");\n\t\t}\n\t\treturn;\n\t}\n\tswitch (route) {\n\t\tcase \"settings\":\n\t\t\tawait editSettings(ctx, options);\n\t\t\treturn;\n\t\tcase \"status\":\n\t\t\tshowStatus(ctx, options);\n\t\t\treturn;\n\t\tcase \"help\":\n\t\t\tshowHelp(ctx, options.settingsPath);\n\t\t\treturn;\n\t}\n}\n\nasync function showMainMenu(ctx: ExtensionCommandContext, options: StarshipCommandOptions) {\n\tconst fallbackController = new AbortController();\n\tconst owner = options.getMenuOwner?.() ?? {\n\t\tsignal: fallbackController.signal,\n\t\tisCurrent: () => !fallbackController.signal.aborted,\n\t};\n\ttype Screen =\n\t\t| \"main\"\n\t\t| \"explain\"\n\t\t| \"modules\"\n\t\t| \"configuration\"\n\t\t| \"configuration-overview\"\n\t\t| \"configuration-effective\"\n\t\t| \"configuration-document\"\n\t\t| \"help\";\n\ttype Action = \"customize\" | \"presets\" | \"configuration-reload\" | \"restore\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionCommandContext>({\n\t\tstart: \"main\",\n\t\tscreens: {\n\t\t\tmain: () => {\n\t\t\t\tconst loaded = options.getLoaded();\n\t\t\t\tconst presentation = configurationPresentation(loaded);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"actions\",\n\t\t\t\t\ttitle: \"pi-starship\",\n\t\t\t\t\tlines: [`${presentation.state} \u00B7 ${presentation.health}`],\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.customize,\n\t\t\t\t\t\t\tlabel: \"Customize footer\",\n\t\t\t\t\t\t\tdescription: `${presentation.state} \u00B7 preview before applying`,\n\t\t\t\t\t\t\taction: \"customize\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.presets,\n\t\t\t\t\t\t\tlabel: \"Presets\",\n\t\t\t\t\t\t\tdescription: \"Browse and live-preview bundled footer starting points\",\n\t\t\t\t\t\t\taction: \"presets\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.explain,\n\t\t\t\t\t\t\tlabel: \"Explain footer\",\n\t\t\t\t\t\t\tdescription: \"Why each visible module appears\",\n\t\t\t\t\t\t\tto: \"explain\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.modules,\n\t\t\t\t\t\t\tlabel: \"Modules\",\n\t\t\t\t\t\t\tdescription: \"Browse supported modules and current states\",\n\t\t\t\t\t\t\tto: \"modules\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.configuration,\n\t\t\t\t\t\t\tlabel: \"Configuration\",\n\t\t\t\t\t\t\tdescription: presentation.health,\n\t\t\t\t\t\t\tto: \"configuration\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.help,\n\t\t\t\t\t\t\tlabel: \"Help\",\n\t\t\t\t\t\t\tdescription: \"Formats, modules, and commands\",\n\t\t\t\t\t\t\tto: \"help\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.restore,\n\t\t\t\t\t\t\tlabel: \"Restore built-in\u2026\",\n\t\t\t\t\t\t\tdescription: presentation.restoreDescription,\n\t\t\t\t\t\t\tdisabled: presentation.restoreDisabled,\n\t\t\t\t\t\t\taction: \"restore\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\thint: \"close\",\n\t\t\t\t};\n\t\t\t},\n\t\t\texplain: () => ({\n\t\t\t\tkind: \"review\",\n\t\t\t\ttitle: \"Explain footer\",\n\t\t\t\tcontent: formatFooterExplanation(options.getInspection?.()),\n\t\t\t\tformat: { kind: \"text\" },\n\t\t\t\tviewportSize: \"adaptive\",\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t\tmodules: () => {\n\t\t\t\tconst inspection =\n\t\t\t\t\toptions.getInspection?.() ?? inspectUnavailableModules(options.getLoaded().config);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"browse\",\n\t\t\t\t\ttitle: \"Modules\",\n\t\t\t\t\titems: inspection.modules.map((module) => ({\n\t\t\t\t\t\tid: module.name,\n\t\t\t\t\t\tlabel: module.name,\n\t\t\t\t\t\tstatusText: module.state,\n\t\t\t\t\t\tdescription: module.description,\n\t\t\t\t\t\tsearchText: [...module.variables, ...module.styleFields, ...module.displayRules].join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdetails: [\n\t\t\t\t\t\t\t`Root: ${module.rootReferenced ? \"Referenced\" : \"Not referenced\"}`,\n\t\t\t\t\t\t\t`Reachable: ${module.reachable ? \"Yes\" : \"No\"}`,\n\t\t\t\t\t\t\t...modulePreviewDetails(module.preview),\n\t\t\t\t\t\t\t`Reason: ${module.reason}`,\n\t\t\t\t\t\t\t`Variables: ${module.variables.join(\", \") || \"none\"}`,\n\t\t\t\t\t\t\t`Style fields: ${module.styleFields.join(\", \") || \"none\"}`,\n\t\t\t\t\t\t\t`Display rules: ${module.displayRules.join(\" \u00B7 \") || \"none\"}`,\n\t\t\t\t\t\t],\n\t\t\t\t\t})),\n\t\t\t\t\tviewportSize: \"adaptive\",\n\t\t\t\t\thint: \"back\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tconfiguration: () => configurationMenuScreen(options.getLoaded()),\n\t\t\t\"configuration-overview\": () =>\n\t\t\t\tconfigurationOverviewScreen(options.getLoaded(), options.settingsPath),\n\t\t\t\"configuration-effective\": () => effectiveConfigurationScreen(options.getLoaded()),\n\t\t\t\"configuration-document\": () =>\n\t\t\t\tsettingsDocumentScreen(options.getLoaded(), options.settingsPath),\n\t\t\thelp: () => ({\n\t\t\t\tkind: \"detail\",\n\t\t\t\ttitle: \"pi-starship help\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Customize footer opens the TOML editor, then previews and confirms before saving.\",\n\t\t\t\t\t\"Presets live-previews the cursor in the footer; Enter confirms apply and e customizes first.\",\n\t\t\t\t\t\"Explain footer breaks down the modules currently showing from the existing snapshot.\",\n\t\t\t\t\t\"Modules searches every supported module and explains its current read-only state.\",\n\t\t\t\t\t\"Configuration separates overview, effective TOML, loaded settings text, and safe disk reload.\",\n\t\t\t\t\t`Settings: ${safeText(options.settingsPath)}`,\n\t\t\t\t\t\"Docs: https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship\",\n\t\t\t\t],\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t},\n\t\tactions: {\n\t\t\tcustomize: async () => {\n\t\t\t\tconst result = await editSettings(ctx, options);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\tpresets: async () => {\n\t\t\t\tconst result = await choosePreset(ctx, options, owner);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\t\"configuration-reload\": async () => {\n\t\t\t\tconst result = await reloadConfiguration(ctx, options, owner);\n\t\t\t\treturn result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\trestore: async () => {\n\t\t\t\tconst presentation = configurationPresentation(options.getLoaded());\n\t\t\t\tif (presentation.restoreDisabled) {\n\t\t\t\t\tctx.ui.notify(presentation.restoreDescription, \"info\");\n\t\t\t\t\treturn { kind: \"stay\" };\n\t\t\t\t}\n\t\t\t\tconst result = await restoreBuiltIn(ctx, options);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t},\n\t});\n\ttry {\n\t\tawait runMenu(ctx, menu, {\n\t\t\tgetState: () => undefined,\n\t\t\tsignal: owner.signal,\n\t\t\tisCurrent: owner.isCurrent,\n\t\t});\n\t} finally {\n\t\tfallbackController.abort(new DOMException(\"Starship menu closed\", \"AbortError\"));\n\t}\n}\n\nasync function editSettings(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tif (ctx.mode !== \"tui\") {\n\t\tif (ctx.hasUI) ctx.ui.notify(`Edit settings manually: ${options.settingsPath}`, \"info\");\n\t\treturn \"cancel\";\n\t}\n\tlet draft = options.getLoaded().rawDocument ?? BUILT_IN_EXAMPLE;\n\twhile (true) {\n\t\tconst edited = await ctx.ui.editor(\"Customize footer \u2014 close to preview\", draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t\tlet validated: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tvalidated = (options.validate ?? validateConfigDocument)(options.settingsPath, draft);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(`Footer draft is invalid: ${safeText(formatError(error))}`, \"error\");\n\t\t\tconst action = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\t\"Configuration needs attention\",\n\t\t\t\t() => [safeText(formatError(error)), \"The current footer has not changed.\"],\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.edit, label: \"Continue editing\" },\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.cancel, label: \"Discard draft\" },\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (action?.kind === \"closed\") return \"close\";\n\t\t\tif (selectedPreviewAction(action) === PREVIEW_ACTIONS.edit) continue;\n\t\t\treturn \"cancel\";\n\t\t}\n\n\t\tconst result = await reviewAndApply(ctx, options, validated, { kind: \"customize\" }, owner);\n\t\tif (result === \"edit\") continue;\n\t\treturn result;\n\t}\n}\n\nasync function choosePreset(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\towner: WorkflowOwner,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst activePreset = presetForDocument(options.getLoaded().rawDocument);\n\tconst selection = await showPresetPicker(ctx, {\n\t\tpresets: STARSHIP_PRESETS,\n\t\tactivePresetId: activePreset?.id,\n\t\tinitialPresetId: activePreset?.id ?? STARSHIP_PRESETS[0]?.id,\n\t\tsignal: owner.signal,\n\t\tisCurrent: owner.isCurrent,\n\t\tpreview(preset) {\n\t\t\tconst loaded = (options.validate ?? validateConfigDocument)(\n\t\t\t\toptions.settingsPath,\n\t\t\t\tpreset.rawDocument,\n\t\t\t);\n\t\t\toptions.preview?.(loaded, ctx);\n\t\t},\n\t});\n\tif (!isCurrentOwner(owner)) {\n\t\toptions.preview?.(undefined, ctx);\n\t\treturn \"cancel\";\n\t}\n\tif (selection.kind === \"back\" || selection.kind === \"close\") {\n\t\toptions.preview?.(undefined, ctx);\n\t\treturn selection.kind === \"close\" ? \"close\" : \"cancel\";\n\t}\n\n\tconst preset = getStarshipPreset(selection.presetId);\n\ttry {\n\t\treturn await applyPreset(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tpreset,\n\t\t\tselection.kind === \"customize\" ? \"customize\" : \"confirm\",\n\t\t);\n\t} finally {\n\t\toptions.preview?.(undefined, ctx);\n\t}\n}\n\nasync function applyPreset(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tpreset: StarshipPreset,\n\tstart: \"review\" | \"confirm\" | \"customize\" = \"review\",\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tlet draft = preset.rawDocument;\n\tif (start === \"customize\") {\n\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t}\n\twhile (true) {\n\t\tlet validated: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tvalidated = (options.validate ?? validateConfigDocument)(options.settingsPath, draft);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(`Preset draft is invalid: ${safeText(formatError(error))}`, \"error\");\n\t\t\tconst action = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\t\"Preset needs attention\",\n\t\t\t\t() => [safeText(formatError(error)), \"The current footer has not changed.\"],\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.edit, label: \"Continue editing\" },\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.cancel, label: \"Choose another preset\" },\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (action?.kind === \"closed\") return \"close\";\n\t\t\tif (selectedPreviewAction(action) !== PREVIEW_ACTIONS.edit) return \"cancel\";\n\t\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\t\tdraft = edited;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = await reviewAndApply(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tvalidated,\n\t\t\t{ kind: \"preset\", preset },\n\t\t\towner,\n\t\t\tstart === \"confirm\",\n\t\t);\n\t\tif (result !== \"edit\") return result;\n\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t}\n}\n\nasync function restoreBuiltIn(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tconst validated = (options.validate ?? validateConfigDocument)(\n\t\toptions.settingsPath,\n\t\tBUILT_IN_EXAMPLE,\n\t);\n\tconst result = await reviewAndApply(ctx, options, validated, { kind: \"restore\" }, owner);\n\treturn result === \"edit\" ? \"cancel\" : result;\n}\n\nasync function reviewAndApply(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tvalidated: LoadedStarshipConfig,\n\tintent: ReviewIntent,\n\towner: WorkflowOwner,\n\tskipReview = false,\n): Promise<\"applied\" | \"edit\" | \"cancel\" | \"close\"> {\n\tlet reviewRequired = !skipReview;\n\twhile (true) {\n\t\tconst directAttempt = !reviewRequired;\n\t\tif (reviewRequired) {\n\t\t\tconst selection = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\treviewTitle(intent),\n\t\t\t\t(width) => reviewPreviewBody(ctx, options, validated, width, intent),\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.continue, label: continueLabel(intent) },\n\t\t\t\t\t...(intent.kind === \"restore\"\n\t\t\t\t\t\t? []\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: PREVIEW_ACTIONS.edit,\n\t\t\t\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\t\t\t\tintent.kind === \"preset\" ? \"Customize before applying\" : \"Continue editing\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: PREVIEW_ACTIONS.cancel,\n\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\tintent.kind === \"restore\"\n\t\t\t\t\t\t\t\t? \"Cancel\"\n\t\t\t\t\t\t\t\t: intent.kind === \"preset\"\n\t\t\t\t\t\t\t\t\t? \"Choose another preset\"\n\t\t\t\t\t\t\t\t\t: \"Discard draft\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (selection?.kind === \"closed\") return \"close\";\n\t\t\tconst selected = selectedPreviewAction(selection);\n\t\t\tif (selected === PREVIEW_ACTIONS.edit) return \"edit\";\n\t\t\tif (selected !== PREVIEW_ACTIONS.continue) return \"cancel\";\n\t\t}\n\t\treviewRequired = true;\n\n\t\tconst confirmed = await ctx.ui.confirm(\n\t\t\tconfirmationTitle(intent),\n\t\t\tconfirmationMessage(options.settingsPath, intent),\n\t\t);\n\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\tif (!confirmed) {\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst save = options.save ?? atomicSaveConfigDocument;\n\t\tconst previous = options.getLoaded();\n\t\tlet saved: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tsaved = save(options.settingsPath, validated.rawDocument ?? BUILT_IN_EXAMPLE);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`Footer settings were not saved: ${safeText(formatError(error))}. The previous footer remains active.`,\n\t\t\t\t\"error\",\n\t\t\t);\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\toptions.apply(saved, ctx);\n\t\t} catch (error) {\n\t\t\tconst rollbackError = restorePreviousConfiguration(ctx, options, previous, saved);\n\t\t\tctx.ui.notify(\n\t\t\t\trollbackError\n\t\t\t\t\t? `Footer settings could not be applied: ${safeText(formatError(error))}. Restoring the previous configuration also failed: ${safeText(formatError(rollbackError))}.`\n\t\t\t\t\t: `Footer settings could not be applied: ${safeText(formatError(error))}. The previous configuration was restored.`,\n\t\t\t\t\"error\",\n\t\t\t);\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst warningSuffix =\n\t\t\tsaved.diagnostics.length > 0\n\t\t\t\t? ` (${saved.diagnostics.length} warning${saved.diagnostics.length === 1 ? \"\" : \"s\"})`\n\t\t\t\t: \"\";\n\t\tctx.ui.notify(`${successMessage(intent)}${warningSuffix}.`, \"info\");\n\t\treturn \"applied\";\n\t}\n}\n\nfunction reviewTitle(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Footer preview\";\n\t\tcase \"restore\":\n\t\t\treturn \"Restore preview\";\n\t\tcase \"preset\":\n\t\t\treturn `${intent.preset.label} preset preview`;\n\t}\n}\n\nfunction continueLabel(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Apply changes\u2026\";\n\t\tcase \"restore\":\n\t\t\treturn \"Replace with built-in\u2026\";\n\t\tcase \"preset\":\n\t\t\treturn `Apply ${intent.preset.label} preset\u2026`;\n\t}\n}\n\nfunction confirmationTitle(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Apply footer changes?\";\n\t\tcase \"restore\":\n\t\t\treturn \"Restore built-in footer?\";\n\t\tcase \"preset\":\n\t\t\treturn `Apply ${intent.preset.label} preset?`;\n\t}\n}\n\nfunction confirmationMessage(settingsPath: string, intent: ReviewIntent): string {\n\tif (intent.kind === \"customize\") return \"Save this configuration and apply it immediately?\";\n\tconst replacement =\n\t\tintent.kind === \"restore\" ? \"the built-in configuration\" : `the ${intent.preset.label} preset`;\n\treturn `Replace ${safeText(settingsPath)} entirely with ${replacement}? All custom settings, unknown fields, and comments will be removed. No backup is kept after success.`;\n}\n\nfunction successMessage(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Footer settings saved and applied\";\n\t\tcase \"restore\":\n\t\t\treturn \"Built-in footer restored and applied\";\n\t\tcase \"preset\":\n\t\t\treturn `${intent.preset.label} preset saved and applied`;\n\t}\n}\n\nfunction modulePreviewDetails(preview: string): string[] {\n\tconst lines = preview ? preview.split(\"\\n\") : [\"(no current preview)\"];\n\treturn lines.map((line, index) => `${index === 0 ? \"Preview: \" : \" \"}${line}`);\n}\n\nfunction workflowOwner(options: StarshipCommandOptions): WorkflowOwner {\n\tif (options.getMenuOwner) return options.getMenuOwner();\n\tconst controller = new AbortController();\n\treturn { signal: controller.signal, isCurrent: () => true };\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n\treturn !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction restorePreviousConfiguration(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tprevious: LoadedStarshipConfig,\n\tsaved: LoadedStarshipConfig,\n): unknown {\n\ttry {\n\t\tif (saved.rawDocument === undefined || saved.fileIdentity === undefined) {\n\t\t\tthrow new Error(\"The saved settings document identity is unavailable\");\n\t\t}\n\t\tremoveConfigDocumentIfMatches(options.settingsPath, saved.rawDocument, saved.fileIdentity);\n\t\tif (previous.rawDocument !== undefined) {\n\t\t\t(options.restore ?? atomicRestoreConfigDocument)(options.settingsPath, previous.rawDocument);\n\t\t}\n\t\toptions.apply(previous, ctx);\n\t\treturn undefined;\n\t} catch (error) {\n\t\treturn error;\n\t}\n}\n\nfunction reviewPreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n\tintent: ReviewIntent,\n): string[] {\n\tif (intent.kind === \"restore\") return restorePreviewBody(ctx, options, loaded, width);\n\tif (intent.kind === \"customize\") return previewBody(ctx, options, loaded, width);\n\tconst current = configurationPresentation(options.getLoaded());\n\treturn [\n\t\t`Preset: ${intent.preset.label}`,\n\t\t`Requirement: ${intent.preset.requiresNerdFont ? \"Nerd Font\" : \"No special font\"}`,\n\t\t`Current: ${current.state}`,\n\t\t`Path: ${safeText(options.settingsPath)}`,\n\t\t\"Applying replaces the entire settings document, including custom settings, unknown fields, and comments.\",\n\t\t\"No backup is kept after a successful apply.\",\n\t\t\"\",\n\t\t...previewBody(ctx, options, loaded, width),\n\t];\n}\n\nfunction restorePreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tconst current = configurationPresentation(options.getLoaded());\n\treturn [\n\t\t`Current: ${current.state}`,\n\t\t`Path: ${safeText(options.settingsPath)}`,\n\t\t\"The entire settings document will be replaced, including custom settings, unknown fields, and comments.\",\n\t\t\"No backup is kept after a successful restore.\",\n\t\t\"\",\n\t\t...previewBody(ctx, options, loaded, width),\n\t];\n}\n\nfunction previewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tlet lines: string[];\n\ttry {\n\t\tlines = options.renderPreview?.(loaded, width, ctx) ?? [\n\t\t\t\"Live preview is unavailable until the footer is ready.\",\n\t\t\t\"The draft is valid and can still be applied.\",\n\t\t];\n\t} catch (error) {\n\t\tlines = [`Preview unavailable: ${safeText(formatError(error))}`];\n\t}\n\tconst warning =\n\t\tloaded.diagnostics.length === 0\n\t\t\t? \"Draft validation: Healthy\"\n\t\t\t: `Draft validation: ${loaded.diagnostics.length} warning${loaded.diagnostics.length === 1 ? \"\" : \"s\"}`;\n\treturn [...lines, \"\", warning];\n}\n\nfunction selectedPreviewAction<Value extends string>(\n\tresult: PreviewMenuResult<Value> | undefined,\n): Value | null {\n\treturn result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction showStatus(ctx: ExtensionCommandContext, options: StarshipCommandOptions) {\n\tif (!canNotify(ctx)) return;\n\tconst loaded = options.getLoaded();\n\tconst diagnostics = loaded.diagnostics\n\t\t.slice(0, 5)\n\t\t.map((item) => `${safeText(item.path || \"root\")}: ${safeText(item.message)}`)\n\t\t.join(\"; \");\n\tctx.ui.notify(\n\t\t[\n\t\t\t`pi-starship source: ${loaded.source}`,\n\t\t\t`path: ${options.settingsPath}`,\n\t\t\tdiagnostics ? `warnings: ${diagnostics}` : \"warnings: none\",\n\t\t].join(\"\\n\"),\n\t\tloaded.diagnostics.length > 0 ? \"warning\" : \"info\",\n\t);\n}\n\nfunction showHelp(ctx: ExtensionCommandContext, settingsPath: string) {\n\tif (!canNotify(ctx)) return;\n\tctx.ui.notify(\n\t\t[\n\t\t\t\"/starship \u2014 customize, live-preview presets, explain, or inspect the footer in TUI mode\",\n\t\t\t\"/starship settings \u2014 customize, preview, and apply TOML\",\n\t\t\t\"/starship status \u2014 show source, path, and warnings\",\n\t\t\t\"/starship help \u2014 show this help\",\n\t\t\t`Settings: ${settingsPath}`,\n\t\t\t\"Format/module docs: https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship\",\n\t\t].join(\"\\n\"),\n\t\t\"info\",\n\t);\n}\n\nfunction canNotify(ctx: ExtensionCommandContext): boolean {\n\treturn ctx.mode === \"tui\" || ctx.hasUI;\n}\n\nfunction safeText(value: string): string {\n\treturn Array.from(value, (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\tconst unsafe =\n\t\t\tcodePoint <= 0x08 ||\n\t\t\t(codePoint >= 0x0b && codePoint <= 0x1f) ||\n\t\t\t(codePoint >= 0x7f && codePoint <= 0x9f);\n\t\treturn unsafe ? `\\\\u${codePoint.toString(16).padStart(4, \"0\")}` : character;\n\t}).join(\"\");\n}\n\nfunction formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { sanitizeTerminalText } from \"@narumitw/pi-tui-kit/terminal-text\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport { BUILT_IN_EXAMPLE, type LoadedStarshipConfig, loadStarshipConfig } from \"./config.js\";\nimport { serializeEffectiveConfig } from \"./effective-config.js\";\nimport { presetForDocument } from \"./presets/catalog.js\";\n\nconst RELOAD_ACTIONS = {\n\tapply: \"apply\",\n\tcancel: \"cancel\",\n} as const;\n\nexport interface WorkflowOwner {\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n}\n\nexport interface ConfigurationCommandOptions {\n\tgetLoaded(): LoadedStarshipConfig;\n\tgetLoadedRevision?(): number;\n\tapply(loaded: LoadedStarshipConfig, ctx: ExtensionCommandContext): void;\n\tsettingsPath: string;\n\trenderPreview?(\n\t\tloaded: LoadedStarshipConfig,\n\t\twidth: number,\n\t\tctx: ExtensionCommandContext,\n\t): string[];\n\tread?: (settingsPath: string) => LoadedStarshipConfig;\n}\n\nexport interface ConfigurationPresentation {\n\tstate: string;\n\tsource: string;\n\thealth: string;\n\trestoreDisabled: boolean;\n\trestoreDescription: string;\n}\n\nexport function configurationPresentation(loaded: LoadedStarshipConfig): ConfigurationPresentation {\n\tconst healthyMissing = isHealthyMissing(loaded);\n\tconst savedBuiltIn = loaded.source === \"user\" && loaded.rawDocument === BUILT_IN_EXAMPLE;\n\tconst activePreset = presetForDocument(loaded.rawDocument);\n\tconst fallback = loaded.source === \"built-in\" && loaded.diagnostics.length > 0;\n\treturn {\n\t\tstate: healthyMissing\n\t\t\t? \"Built-in defaults\"\n\t\t\t: savedBuiltIn\n\t\t\t\t? \"Saved built-in configuration\"\n\t\t\t\t: activePreset\n\t\t\t\t\t? `${activePreset.label} preset`\n\t\t\t\t\t: fallback\n\t\t\t\t\t\t? \"Built-in fallback\"\n\t\t\t\t\t\t: \"Custom configuration\",\n\t\tsource: healthyMissing\n\t\t\t? \"No settings file\"\n\t\t\t: activePreset\n\t\t\t\t? \"Bundled preset\"\n\t\t\t\t: loaded.source === \"user\"\n\t\t\t\t\t? \"User file\"\n\t\t\t\t\t: \"Built-in fallback\",\n\t\thealth: configurationHealth(loaded),\n\t\trestoreDisabled: healthyMissing || savedBuiltIn,\n\t\trestoreDescription: healthyMissing\n\t\t\t? \"Already using defaults \u00B7 no file to replace\"\n\t\t\t: savedBuiltIn\n\t\t\t\t? \"Built-in configuration already saved\"\n\t\t\t\t: fallback\n\t\t\t\t\t? \"Preview before replacing invalid settings\"\n\t\t\t\t\t: \"Preview before replacing the document\",\n\t};\n}\n\nexport function configurationMenuScreen(loaded: LoadedStarshipConfig) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"actions\" as const,\n\t\ttitle: \"Configuration\",\n\t\tlines: [`${presentation.state} \u00B7 ${presentation.health}`],\n\t\titems: [\n\t\t\t{\n\t\t\t\tid: \"configuration-overview\",\n\t\t\t\tlabel: \"Overview\",\n\t\t\t\tdescription: \"State, source, path, health, and warnings\",\n\t\t\t\tto: \"configuration-overview\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-effective\",\n\t\t\t\tlabel: \"Effective configuration\",\n\t\t\t\tdescription: \"Normalized public TOML currently in use\",\n\t\t\t\tto: \"configuration-effective\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-document\",\n\t\t\t\tlabel: \"Settings document\",\n\t\t\t\tdescription: isHealthyMissing(loaded)\n\t\t\t\t\t? \"No settings file \u00B7 built-in defaults are active\"\n\t\t\t\t\t: \"Exact loaded UTF-8 text \u00B7 read-only\",\n\t\t\t\tto: \"configuration-document\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-reload\",\n\t\t\t\tlabel: \"Reload from disk\u2026\",\n\t\t\t\tdescription: \"Validate and preview external changes\",\n\t\t\t\taction: \"configuration-reload\" as const,\n\t\t\t},\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function configurationOverviewScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"detail\" as const,\n\t\ttitle: \"Configuration overview\",\n\t\tlines: [\n\t\t\t`State: ${presentation.state}`,\n\t\t\t`Source: ${presentation.source}`,\n\t\t\t`Path: ${sanitizeTerminalText(settingsPath)}`,\n\t\t\t...diagnosticLines(loaded, true),\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function effectiveConfigurationScreen(loaded: LoadedStarshipConfig) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"review\" as const,\n\t\ttitle: \"Effective configuration\",\n\t\tlines: [\n\t\t\t`${presentation.state} \u00B7 ${presentation.health}`,\n\t\t\t\"Normalized public TOML; comments and unknown fields are intentionally excluded.\",\n\t\t],\n\t\tcontent: serializeEffectiveConfig(loaded.config),\n\t\tformat: { kind: \"code\" as const, language: \"toml\" },\n\t\tviewportSize: \"adaptive\" as const,\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function settingsDocumentScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n\tconst path = sanitizeTerminalText(settingsPath);\n\tif (loaded.rawDocument !== undefined) {\n\t\treturn {\n\t\t\tkind: \"review\" as const,\n\t\t\ttitle: \"Settings document\",\n\t\t\tlines: [\"Exact loaded UTF-8 text \u00B7 display controls sanitized \u00B7 read-only\", `Path: ${path}`],\n\t\t\tcontent: loaded.rawDocument,\n\t\t\tformat: { kind: \"code\" as const, language: \"toml\" },\n\t\t\tviewportSize: \"adaptive\" as const,\n\t\t\thint: \"back\" as const,\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"detail\" as const,\n\t\ttitle: \"Settings document\",\n\t\tlines: [\n\t\t\t...(isHealthyMissing(loaded)\n\t\t\t\t? [\n\t\t\t\t\t\t\"No settings document exists.\",\n\t\t\t\t\t\t\"Built-in defaults are active; this read created no file.\",\n\t\t\t\t\t]\n\t\t\t\t: [\"The settings document could not be loaded.\", ...diagnosticLines(loaded, false)]),\n\t\t\t`Path: ${path}`,\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport async function reloadConfiguration(\n\tctx: ExtensionCommandContext,\n\toptions: ConfigurationCommandOptions,\n\towner: WorkflowOwner,\n): Promise<\"applied\" | \"stay\" | \"close\"> {\n\tif (!isCurrentOwner(owner)) return \"stay\";\n\tconst previous = options.getLoaded();\n\tconst revision = options.getLoadedRevision?.();\n\tconst candidate = readReloadCandidate(options);\n\tif (!candidate.ok) {\n\t\tctx.ui.notify(`Footer reload was blocked: ${safeError(candidate.error)}`, \"error\");\n\t\treturn \"stay\";\n\t}\n\tif (sameLoadedDocument(previous, candidate.loaded)) {\n\t\tctx.ui.notify(\"The current disk configuration is already loaded.\", \"info\");\n\t\treturn \"stay\";\n\t}\n\n\tconst selection = await showPreviewActionMenu(\n\t\tctx,\n\t\t\"Reload preview\",\n\t\t(width) => reloadPreviewBody(ctx, options, candidate.loaded, width),\n\t\t[\n\t\t\t{ value: RELOAD_ACTIONS.apply, label: \"Apply reloaded configuration\u2026\" },\n\t\t\t{ value: RELOAD_ACTIONS.cancel, label: \"Cancel\" },\n\t\t],\n\t\towner.signal,\n\t\towner.isCurrent,\n\t);\n\tif (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return \"stay\";\n\tif (selection?.kind === \"closed\") return \"close\";\n\tif (selectedReloadAction(selection) !== RELOAD_ACTIONS.apply) return \"stay\";\n\n\tconst confirmed = await ctx.ui.confirm(\n\t\t\"Apply configuration from disk?\",\n\t\tcandidate.loaded.rawDocument === undefined\n\t\t\t? \"Use built-in defaults for this session? No settings file will be created.\"\n\t\t\t: \"Apply the validated settings document to this session without changing its bytes?\",\n\t);\n\tif (!isCurrentOwner(owner) || activeRevisionChanged(options, revision) || !confirmed) {\n\t\treturn \"stay\";\n\t}\n\n\tconst fresh = readReloadCandidate(options);\n\tif (!fresh.ok) {\n\t\tctx.ui.notify(\n\t\t\t`Footer reload was blocked after confirmation: ${safeError(fresh.error)}. The previous footer remains active.`,\n\t\t\t\"error\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\tif (!sameLoadedDocument(candidate.loaded, fresh.loaded)) {\n\t\tctx.ui.notify(\n\t\t\t\"The settings document changed after preview. The previous footer remains active; reload again to review the latest version.\",\n\t\t\t\"warning\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\n\ttry {\n\t\toptions.apply(fresh.loaded, ctx);\n\t} catch (error) {\n\t\tlet rollbackError: unknown;\n\t\ttry {\n\t\t\toptions.apply(previous, ctx);\n\t\t} catch (rollback) {\n\t\t\trollbackError = rollback;\n\t\t}\n\t\tctx.ui.notify(\n\t\t\trollbackError\n\t\t\t\t? `Footer reload failed: ${safeError(error)}. Restoring the previous configuration also failed: ${safeError(rollbackError)}.`\n\t\t\t\t: `Footer reload failed: ${safeError(error)}. The previous configuration was restored.`,\n\t\t\t\"error\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\n\tconst warnings = fresh.loaded.diagnostics.length;\n\tctx.ui.notify(\n\t\twarnings === 0\n\t\t\t? \"Footer configuration reloaded and applied.\"\n\t\t\t: `Footer configuration reloaded and applied with ${warnings} warning${warnings === 1 ? \"\" : \"s\"}.`,\n\t\t\"info\",\n\t);\n\treturn \"applied\";\n}\n\nfunction readReloadCandidate(\n\toptions: ConfigurationCommandOptions,\n): { ok: true; loaded: LoadedStarshipConfig } | { ok: false; error: string } {\n\tlet loaded: LoadedStarshipConfig;\n\ttry {\n\t\tloaded = (options.read ?? loadStarshipConfig)(options.settingsPath);\n\t} catch (error) {\n\t\treturn { ok: false, error: formatError(error) };\n\t}\n\tconst errors = loaded.diagnostics.filter((item) => item.severity === \"error\");\n\tif (errors.length > 0) {\n\t\treturn { ok: false, error: errors.map((item) => item.message).join(\"; \") };\n\t}\n\treturn { ok: true, loaded };\n}\n\nfunction reloadPreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: ConfigurationCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tconst presentation = configurationPresentation(loaded);\n\tlet preview: string[];\n\ttry {\n\t\tpreview = options.renderPreview?.(loaded, width, ctx) ?? [\n\t\t\t\"Live preview is unavailable until the footer is ready.\",\n\t\t];\n\t} catch (error) {\n\t\tpreview = [`Preview unavailable: ${safeError(formatError(error))}`];\n\t}\n\treturn [\n\t\t`Candidate: ${presentation.state}`,\n\t\t`Source: ${presentation.source}`,\n\t\t`Path: ${sanitizeTerminalText(options.settingsPath)}`,\n\t\tloaded.rawDocument === undefined\n\t\t\t? \"Applying uses built-in defaults and creates no settings file.\"\n\t\t\t: \"Applying changes only the active session; the settings document bytes stay unchanged.\",\n\t\t...diagnosticLines(loaded, true),\n\t\t\"\",\n\t\t...preview,\n\t];\n}\n\nexport function diagnosticLines(loaded: LoadedStarshipConfig, includeSummary: boolean): string[] {\n\tconst diagnostics = loaded.diagnostics\n\t\t.slice(0, 8)\n\t\t.map(\n\t\t\t(item) =>\n\t\t\t\t`${sanitizeTerminalText(item.path || \"root\")}: ${sanitizeTerminalText(item.message)}`,\n\t\t);\n\tconst remaining = loaded.diagnostics.length - diagnostics.length;\n\treturn [\n\t\t...(includeSummary ? [`Health: ${configurationHealth(loaded)}`] : []),\n\t\t...(diagnostics.length > 0 ? diagnostics : [\"No configuration warnings.\"]),\n\t\t...(remaining > 0 ? [`${remaining} additional warnings not shown.`] : []),\n\t];\n}\n\nfunction configurationHealth(loaded: LoadedStarshipConfig): string {\n\tconst errors = loaded.diagnostics.filter((item) => item.severity === \"error\").length;\n\tif (errors > 0) return `${errors} error${errors === 1 ? \"\" : \"s\"}`;\n\tconst warnings = loaded.diagnostics.length;\n\treturn warnings === 0 ? \"Healthy\" : `${warnings} warning${warnings === 1 ? \"\" : \"s\"}`;\n}\n\nfunction isHealthyMissing(loaded: LoadedStarshipConfig): boolean {\n\treturn (\n\t\tloaded.source === \"built-in\" &&\n\t\tloaded.rawDocument === undefined &&\n\t\tloaded.diagnostics.length === 0\n\t);\n}\n\nfunction sameLoadedDocument(left: LoadedStarshipConfig, right: LoadedStarshipConfig): boolean {\n\treturn (\n\t\tleft.source === right.source &&\n\t\tleft.rawDocument === right.rawDocument &&\n\t\tJSON.stringify(left.diagnostics) === JSON.stringify(right.diagnostics)\n\t);\n}\n\nfunction activeRevisionChanged(\n\toptions: ConfigurationCommandOptions,\n\trevision: number | undefined,\n): boolean {\n\treturn revision !== undefined && options.getLoadedRevision?.() !== revision;\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n\treturn !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction selectedReloadAction(\n\tresult: PreviewMenuResult<(typeof RELOAD_ACTIONS)[keyof typeof RELOAD_ACTIONS]> | undefined,\n) {\n\treturn result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction safeError(value: unknown): string {\n\treturn sanitizeTerminalText(typeof value === \"string\" ? value : formatError(value));\n}\n\nfunction formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { ExtensionCommandContext, KeybindingsManager } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from \"@earendil-works/pi-tui\";\nimport { runCustomInteraction } from \"@narumitw/pi-tui-kit\";\n\nconst RESERVED_HOST_ROWS = 3;\n\nexport interface PreviewMenuItem<Value extends string> {\n\tvalue: Value;\n\tlabel: string;\n}\n\nexport type PreviewMenuResult<Value extends string> =\n\t| { kind: \"selected\"; value: Value }\n\t| { kind: \"cancelled\" }\n\t| { kind: \"closed\" };\n\nexport async function showPreviewActionMenu<Value extends string>(\n\tctx: ExtensionCommandContext,\n\ttitle: string,\n\tbody: (width: number) => readonly string[],\n\titems: readonly PreviewMenuItem<Value>[],\n\tsignal?: AbortSignal,\n\tisCurrent: () => boolean = () => !signal?.aborted,\n): Promise<PreviewMenuResult<Value> | undefined> {\n\tif (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n\tconst result = await runCustomInteraction<PreviewMenuResult<Value>>(ctx, {\n\t\tsignal,\n\t\tisCurrent,\n\t\tcreate: ({ tui, theme, keybindings, complete }) => {\n\t\t\tlet selectedIndex = 0;\n\t\t\tlet scrollOffset = 0;\n\t\t\tlet lastMaximumScroll = 0;\n\t\t\tlet lastViewportSize = 1;\n\t\t\tlet disposed = false;\n\n\t\t\tconst requestRender = () => {\n\t\t\t\tif (!disposed) tui.requestRender();\n\t\t\t};\n\t\t\tconst moveSelection = (delta: number) => {\n\t\t\t\tif (items.length === 0) return;\n\t\t\t\tselectedIndex = (selectedIndex + delta + items.length) % items.length;\n\t\t\t\trequestRender();\n\t\t\t};\n\t\t\tconst movePreview = (offset: number) => {\n\t\t\t\tscrollOffset = Math.max(0, Math.min(offset, lastMaximumScroll));\n\t\t\t\trequestRender();\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\trender(width: number): string[] {\n\t\t\t\t\tconst safeWidth = Math.max(1, width);\n\t\t\t\t\tconst terminalRows = Number.isFinite(tui.terminal.rows)\n\t\t\t\t\t\t? Math.floor(tui.terminal.rows)\n\t\t\t\t\t\t: 24;\n\t\t\t\t\tconst availableRows = Math.max(1, terminalRows - RESERVED_HOST_ROWS);\n\t\t\t\t\tconst bodyLines = body(safeWidth).flatMap((line) =>\n\t\t\t\t\t\tline ? wrapTextWithAnsi(line, safeWidth) : [\"\"],\n\t\t\t\t\t);\n\t\t\t\t\tconst layout = allocateLayout(availableRows, items.length, bodyLines.length);\n\t\t\t\t\tlastViewportSize = layout.previewRows;\n\t\t\t\t\tlastMaximumScroll = Math.max(0, bodyLines.length - layout.previewRows);\n\t\t\t\t\tscrollOffset = Math.max(0, Math.min(scrollOffset, lastMaximumScroll));\n\t\t\t\t\tconst actionStart = actionWindowStart(selectedIndex, items.length, layout.actionRows);\n\t\t\t\t\tconst actionLines = items\n\t\t\t\t\t\t.slice(actionStart, actionStart + layout.actionRows)\n\t\t\t\t\t\t.map((item, index) => {\n\t\t\t\t\t\t\tconst absoluteIndex = actionStart + index;\n\t\t\t\t\t\t\tconst prefix = absoluteIndex === selectedIndex ? \"\u2192 \" : \" \";\n\t\t\t\t\t\t\treturn theme.fg(\n\t\t\t\t\t\t\t\tabsoluteIndex === selectedIndex ? \"accent\" : \"text\",\n\t\t\t\t\t\t\t\t`${prefix}${safeDisplayText(item.label)}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\tconst position = layout.positionRows\n\t\t\t\t\t\t? [theme.fg(\"dim\", previewPosition(scrollOffset, layout.previewRows, bodyLines.length))]\n\t\t\t\t\t\t: [];\n\t\t\t\t\tconst lines = [\n\t\t\t\t\t\t...(layout.titleRows ? [theme.fg(\"accent\", theme.bold(safeDisplayText(title)))] : []),\n\t\t\t\t\t\t...bodyLines.slice(scrollOffset, scrollOffset + layout.previewRows),\n\t\t\t\t\t\t...position,\n\t\t\t\t\t\t...actionLines,\n\t\t\t\t\t\t...(layout.hintRows ? [theme.fg(\"dim\", previewHint(keybindings))] : []),\n\t\t\t\t\t];\n\t\t\t\t\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n\t\t\t\t},\n\t\t\t\tinvalidate() {},\n\t\t\t\thandleInput(data: string) {\n\t\t\t\t\tif (disposed) return;\n\t\t\t\t\tif (matchesKey(data, Key.ctrl(\"c\"))) {\n\t\t\t\t\t\tcomplete({ kind: \"closed\" });\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\t\t\tcomplete({ kind: \"cancelled\" });\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.up\")) {\n\t\t\t\t\t\tmoveSelection(-1);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.down\")) {\n\t\t\t\t\t\tmoveSelection(1);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.pageUp\")) {\n\t\t\t\t\t\tmovePreview(scrollOffset - lastViewportSize);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.pageDown\")) {\n\t\t\t\t\t\tmovePreview(scrollOffset + lastViewportSize);\n\t\t\t\t\t} else if (matchesKey(data, Key.home)) {\n\t\t\t\t\t\tmovePreview(0);\n\t\t\t\t\t} else if (matchesKey(data, Key.end)) {\n\t\t\t\t\t\tmovePreview(lastMaximumScroll);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\t\t\t\tconst item = items[selectedIndex];\n\t\t\t\t\t\tif (item) complete({ kind: \"selected\", value: item.value });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) return;\n\t\t\t\t\tdisposed = true;\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t});\n\tif (result.kind === \"completed\") return result.value;\n\tif (result.kind === \"error\") throw result.error;\n\tif (result.kind === \"stale\" && (signal?.aborted || !isCurrent())) return { kind: \"closed\" };\n\treturn undefined;\n}\n\ninterface PreviewLayout {\n\ttitleRows: number;\n\tpreviewRows: number;\n\tpositionRows: number;\n\tactionRows: number;\n\thintRows: number;\n}\n\nfunction allocateLayout(\n\tavailableRows: number,\n\tactionCount: number,\n\tbodyLineCount: number,\n): PreviewLayout {\n\tif (availableRows === 1) {\n\t\treturn { titleRows: 0, previewRows: 0, positionRows: 0, actionRows: 1, hintRows: 0 };\n\t}\n\tconst titleRows = availableRows >= 3 ? 1 : 0;\n\tconst hintRows = availableRows >= 3 ? 1 : 0;\n\tconst minimumPreviewRows = bodyLineCount > 0 && availableRows >= 4 ? 1 : 0;\n\tconst availableActionRows = Math.max(\n\t\t1,\n\t\tavailableRows - titleRows - hintRows - minimumPreviewRows,\n\t);\n\tconst actionRows = Math.min(Math.max(1, actionCount), availableActionRows);\n\tlet previewRows = Math.max(0, availableRows - titleRows - hintRows - actionRows);\n\tconst positionRows = previewRows >= 2 && bodyLineCount > previewRows ? 1 : 0;\n\tpreviewRows -= positionRows;\n\treturn { titleRows, previewRows, positionRows, actionRows, hintRows };\n}\n\nfunction actionWindowStart(selectedIndex: number, itemCount: number, viewportSize: number): number {\n\tif (itemCount <= viewportSize) return 0;\n\treturn Math.max(0, Math.min(selectedIndex, itemCount - viewportSize));\n}\n\nfunction previewPosition(offset: number, viewportSize: number, lineCount: number): string {\n\tif (lineCount === 0) return \"0/0\";\n\treturn `${offset + 1}-${Math.min(lineCount, offset + viewportSize)}/${lineCount}`;\n}\n\nfunction previewHint(keybindings: Pick<KeybindingsManager, \"getKeys\">): string {\n\tconst up = bindingText(keybindings, \"tui.select.up\");\n\tconst down = bindingText(keybindings, \"tui.select.down\");\n\tconst confirm = bindingText(keybindings, \"tui.select.confirm\");\n\tconst cancel = bindingText(keybindings, \"tui.select.cancel\", \"ctrl+c\");\n\tconst pageUp = bindingText(keybindings, \"tui.select.pageUp\");\n\tconst pageDown = bindingText(keybindings, \"tui.select.pageDown\");\n\treturn [\n\t\t...(up || down ? [`${[up, down].filter(Boolean).join(\"/\")} navigate`] : []),\n\t\t...(confirm ? [`${confirm} select`] : []),\n\t\t...(cancel ? [`${cancel} discard`] : []),\n\t\t\"ctrl+c close\",\n\t\t...(pageUp || pageDown ? [`${[pageUp, pageDown].filter(Boolean).join(\"/\")} preview`] : []),\n\t].join(\" \u2022 \");\n}\n\nfunction bindingText(\n\tkeybindings: Pick<KeybindingsManager, \"getKeys\">,\n\tbinding: Parameters<KeybindingsManager[\"getKeys\"]>[0],\n\texcluded?: string,\n): string {\n\treturn keybindings\n\t\t.getKeys(binding)\n\t\t.filter((key) => key !== excluded)\n\t\t.map((key) => {\n\t\t\tif (key === \"up\") return \"\u2191\";\n\t\t\tif (key === \"down\") return \"\u2193\";\n\t\t\tif (key === \"escape\") return \"esc\";\n\t\t\tif (key === \"return\") return \"enter\";\n\t\t\treturn safeDisplayText(key);\n\t\t})\n\t\t.join(\"/\");\n}\n\nfunction safeDisplayText(value: string): string {\n\treturn Array.from(stripVTControlCharacters(value), (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\tconst control = codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f);\n\t\treturn control ? \"\" : character;\n\t}).join(\"\");\n}\n", "import { stringify, type TomlTable, type TomlValue } from \"smol-toml\";\nimport type { StarshipConfig } from \"./config.js\";\nimport { MODULE_DEFINITIONS } from \"./modules/catalog.js\";\nimport type { ModuleOptionValue } from \"./modules/types.js\";\n\nexport function projectEffectiveConfig(config: StarshipConfig): TomlTable {\n\tconst projected: TomlTable = {\n\t\tformat: config.format,\n\t};\n\tif (config.palette !== undefined) projected.palette = config.palette;\n\tprojected.palettes = Object.fromEntries(\n\t\tsortedEntries(config.palettes).map(([name, colors]) => [name, sortedRecord(colors)]),\n\t);\n\tfor (const definition of MODULE_DEFINITIONS) {\n\t\tconst module = config.modules[definition.name];\n\t\tconst table: TomlTable = {\n\t\t\tformat: module.format,\n\t\t\tsymbol: module.symbol,\n\t\t};\n\t\tif (definition.styleDefaults) {\n\t\t\tfor (const field of Object.keys(definition.styleDefaults)) {\n\t\t\t\ttable[field] = module.styles[field] ?? \"\";\n\t\t\t}\n\t\t} else if (!definition.displayDefaults) {\n\t\t\ttable.style = module.style;\n\t\t}\n\t\tif (definition.displayDefaults) {\n\t\t\ttable.display = module.display.map((entry) => ({ ...entry }));\n\t\t}\n\t\ttable.disabled = module.disabled;\n\t\tfor (const key of Object.keys(definition.options ?? {})) {\n\t\t\ttable[key] = cloneOptionValue(module.options[key]);\n\t\t}\n\t\tif (definition.name === \"extension_status\") {\n\t\t\ttable.separator = config.extensionStatus.separator;\n\t\t\ttable.max_statuses = config.extensionStatus.maxStatuses;\n\t\t\ttable.icons = sortedRecord(config.extensionStatus.icons);\n\t\t}\n\t\tprojected[definition.name] = table;\n\t}\n\treturn projected;\n}\n\nexport function serializeEffectiveConfig(config: StarshipConfig): string {\n\treturn stringify(projectEffectiveConfig(config));\n}\n\nfunction cloneOptionValue(value: ModuleOptionValue | undefined): TomlValue {\n\tif (value === undefined) throw new Error(\"Missing normalized module option\");\n\tif (Array.isArray(value)) return [...(value as readonly string[])];\n\tif (typeof value === \"object\") {\n\t\treturn sortedRecord(value as Readonly<Record<string, string>>);\n\t}\n\treturn value;\n}\n\nfunction sortedRecord(values: Readonly<Record<string, string>>): Record<string, string> {\n\treturn Object.fromEntries(sortedEntries(values));\n}\n\nfunction sortedEntries<Value>(values: Readonly<Record<string, Value>>): Array<[string, Value]> {\n\treturn Object.entries(values).sort(([left], [right]) =>\n\t\tleft < right ? -1 : left > right ? 1 : 0,\n\t);\n}\n", "export const BRACKETED_SEGMENTS_PRESET = String.raw`# Font-safe bracketed segments inspired by Starship.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = '[\\[$symbol\\]]($style) '\nstyle = \"bold white\"\n\n[model]\nformat = '[\\[$symbol $model\\]]($style) '\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = '[\\[$symbol $level\\]]($style) '\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = '[\\[$symbol $path\\]]($style) '\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = '[\\[$symbol $branch\\]]($style) '\nsymbol = \"git\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = '[\\[$all_status( $ahead_behind)\\]]($style) '\nstyle = \"red bold\"\n\n[activity]\nformat = '[\\[$text\\]]($style) '\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = '[\\[$symbol $percentage\\]]($style) '\nsymbol = \"ctx\"\n\n[time]\nformat = '[\\[$time\\]]($style)'\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const CATPPUCCIN_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Catppuccin Powerline preset.\nformat = \"[\uE0B6](red)$brand$model[\uE0B0](bg:peach fg:red)$directory[\uE0B0](bg:yellow fg:peach)$git_branch$git_status[\uE0B0](fg:yellow bg:green)$thinking$activity[\uE0B0](fg:green bg:sapphire)$context[\uE0B0](fg:sapphire bg:lavender)$time[\uE0B4](fg:lavender)\"\npalette = \"catppuccin_mocha\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:crust bg:red bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:red bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:peach bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:crust bg:green bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:crust bg:green bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:crust bg:sapphire bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"sapphire\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:lavender bold\"\n\n[palettes.catppuccin_mocha]\nred = \"#f38ba8\"\npeach = \"#fab387\"\nyellow = \"#f9e2af\"\ngreen = \"#a6e3a1\"\nsapphire = \"#74c7ec\"\nlavender = \"#b4befe\"\ncrust = \"#11111b\"\n\n[palettes.catppuccin_frappe]\nred = \"#e78284\"\npeach = \"#ef9f76\"\nyellow = \"#e5c890\"\ngreen = \"#a6d189\"\nsapphire = \"#85c1dc\"\nlavender = \"#babbf1\"\ncrust = \"#232634\"\n\n[palettes.catppuccin_latte]\nred = \"#d20f39\"\npeach = \"#fe640b\"\nyellow = \"#df8e1d\"\ngreen = \"#40a02b\"\nsapphire = \"#209fb5\"\nlavender = \"#7287fd\"\ncrust = \"#dce0e8\"\n\n[palettes.catppuccin_macchiato]\nred = \"#ed8796\"\npeach = \"#f5a97f\"\nyellow = \"#eed49f\"\ngreen = \"#a6da95\"\nsapphire = \"#7dc4e4\"\nlavender = \"#b7bdf8\"\ncrust = \"#181926\"\n`;\n", "export const GRUVBOX_RAINBOW_PRESET = `# Pi-native adaptation of Starship's Gruvbox Rainbow preset.\nformat = \"[\uE0B6](color_orange)$brand$model[\uE0B0](bg:color_yellow fg:color_orange)$directory[\uE0B0](fg:color_yellow bg:color_aqua)$git_branch$git_status[\uE0B0](fg:color_aqua bg:color_blue)$thinking$activity[\uE0B0](fg:color_blue bg:color_bg3)$context[\uE0B0](fg:color_bg3 bg:color_bg1)$time[\uE0B4](fg:color_bg1)\"\npalette = \"gruvbox_dark\"\n\n[palettes.gruvbox_dark]\ncolor_fg0 = \"#fbf1c7\"\ncolor_bg1 = \"#3c3836\"\ncolor_bg3 = \"#665c54\"\ncolor_blue = \"#458588\"\ncolor_aqua = \"#689d6a\"\ncolor_green = \"#98971a\"\ncolor_orange = \"#d65d0e\"\ncolor_purple = \"#b16286\"\ncolor_red = \"#cc241d\"\ncolor_yellow = \"#d79921\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_yellow bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:color_fg0 bg:color_bg3 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"color_bg3\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_bg1 bold\"\n`;\n", "export const JETPACK_PRESET = `# Pi-native adaptation of Starship's Jetpack preset.\n# Left-side session activity and right-side workspace context meet at $fill.\nformat = \"$activity$context$fill$directory$git_branch$git_state$git_status$time\"\n\n[activity]\nformat = \"[\u25C4 $text ]($style)\"\nsymbol = \"\"\nstyle = \"italic white\"\n\n[context]\nformat = \"[\u25EF $percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold purple\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"italic blue\"\ntruncation_length = 2\ntruncation_symbol = \"\u25A1 \"\nhome_symbol = \"\u2302\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style)\"\nsymbol = \"\u25B3 \"\nstyle = \"italic bright-blue\"\ntruncation_length = 11\ntruncation_symbol = \"\u22EF\"\n\n[git_state]\nformat = \"([\u23AA$state $progress_current/$progress_total\u23A5]($style))\"\nsymbol = \"\"\nstyle = \"italic bright-purple\"\n\n[git_status]\nformat = \"([\u23AA$all_status$ahead_behind\u23A5]($style))\"\nstyle = \"bold italic bright-blue\"\n\n[time]\nformat = \"[ $time]($style)\"\nsymbol = \"\"\nstyle = \"italic dimmed white\"\n`;\n", "export const MINIMAL_PRESET = `# A compact, font-safe Pi footer.\nformat = \"$model$directory$git_branch$activity\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[git:$branch]($style) \"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[activity]\nformat = \"[$text]($style)\"\nsymbol = \"*\"\nstyle = \"bold yellow\"\n`;\n", "export const NERD_FONT_SYMBOLS_PRESET = `# Balanced Pi footer with Nerd Font symbols.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nsymbol = \"\uE285\"\n\n[model]\nsymbol = \"\uDB81\uDEA9\"\n\n[thinking]\nsymbol = \"\uDB81\uDD1F\"\n\n[directory]\nsymbol = \"\uDB80\uDE4B\"\n\n[git_branch]\nsymbol = \"\uF418\"\n\n[activity]\nsymbol = \"\uDB81\uDC6E\"\n\n[context]\nsymbol = \"\uDB80\uDF5B\"\n\n[time]\nsymbol = \"\uF43A\"\n`;\n", "export const NO_EMPTY_ICONS_PRESET = `# Pi-native adaptation of Starship's No Empty Icons preset.\n# Each label lives inside the same conditional group as its value.\nformat = \"$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[model]\nformat = \"([model $model]($style) )\"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"([thinking $level]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"([in $path]($style) )\"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"([on $branch]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"([$all_status$ahead_behind]($style) )\"\nstyle = \"red bold\"\n\n[activity]\nformat = \"([while $text]($style) )\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"([using $percentage context]($style) )\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"([at $time]($style))\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_NERD_FONT_PRESET = `# Pi-native adaptation of Starship's No Nerd Font preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u2726\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"\u25C6\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"\u25C7\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"\u2302\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"\u2387\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\u25CF\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"\u25CC\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"\u25F4\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_RUNTIME_VERSIONS_PRESET = `# Pi-native adaptation of Starship's No Runtime Versions preset.\n# Model and thinking modules retain presence symbols while hiding version-like details.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u03C0\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol]($style) \"\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol]($style) \"\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style) \"\nsymbol = \"git:\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$symbol]($style) \"\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const PASTEL_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Pastel Powerline preset.\nformat = \"[\uE0B6](#9A348E)$brand$model[\uE0B0](bg:#DA627D fg:#9A348E)$directory[\uE0B0](fg:#DA627D bg:#FCA17D)$git_branch$git_status[\uE0B0](fg:#FCA17D bg:#86BBD8)$thinking$activity[\uE0B0](fg:#86BBD8 bg:#06969A)$context[\uE0B0](fg:#06969A bg:#33658A)$time[\uE0B4](fg:#33658A)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#DA627D bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#ffffff bg:#06969A bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#06969A\"\nhidden = false\n\n[time]\nformat = \"[ \u2665 $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#33658A bold\"\n`;\n", "export const PLAIN_TEXT_SYMBOLS_PRESET = `# Pi-native adaptation of Starship's Plain Text Symbols preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"pi\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"model\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"thinking\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"git\"\nstyle = \"bold purple\"\ntruncation_symbol = \"...\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"active\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"context\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"time\"\nstyle = \"bold yellow\"\n`;\n", "export const PURE_PRESET = `# Pi-native adaptation of Starship's Pure preset.\nformat = \"$directory$git_branch$git_state$git_status$activity\\\\n$model$thinking$context$fill$time\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"blue\"\n\n[git_branch]\nformat = \"[$branch]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_state]\nformat = '([($state( $progress_current/$progress_total))]($style) )'\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_status]\nformat = \"[(*$all_status)](218) [$ahead_behind]($style) \"\nstyle = \"cyan\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\"\nstyle = \"yellow\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[thinking]\nformat = \"[$level]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[context]\nformat = \"[$percentage]($style)\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bright-black\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bright-black\"\n`;\n", "export const TOKYO_NIGHT_PRESET = `# Pi-native adaptation of Starship's Tokyo Night preset.\nformat = \"[\u2591\u2592\u2593](#a3aed2)$brand$model[\uE0B4](bg:#769ff0 fg:#a3aed2)$directory[\uE0B4](fg:#769ff0 bg:#394260)$git_branch$git_status[\uE0B4](fg:#394260 bg:#212736)$thinking$activity[\uE0B4](fg:#212736 bg:#1d2230)$context$time[\uE0B4](fg:#1d2230)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#e3e5e5 bg:#769ff0 bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#a0a9cb bg:#1d2230 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#1d2230\"\nhidden = false\n\n[time]\nformat = \"[\uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#a0a9cb bg:#1d2230 bold\"\n`;\n", "import { BRACKETED_SEGMENTS_PRESET } from \"./bracketed-segments.js\";\nimport { CATPPUCCIN_POWERLINE_PRESET } from \"./catppuccin-powerline.js\";\nimport { GRUVBOX_RAINBOW_PRESET } from \"./gruvbox-rainbow.js\";\nimport { JETPACK_PRESET } from \"./jetpack.js\";\nimport { MINIMAL_PRESET } from \"./minimal.js\";\nimport { NERD_FONT_SYMBOLS_PRESET } from \"./nerd-font-symbols.js\";\nimport { NO_EMPTY_ICONS_PRESET } from \"./no-empty-icons.js\";\nimport { NO_NERD_FONT_PRESET } from \"./no-nerd-font.js\";\nimport { NO_RUNTIME_VERSIONS_PRESET } from \"./no-runtime-versions.js\";\nimport { PASTEL_POWERLINE_PRESET } from \"./pastel-powerline.js\";\nimport { PLAIN_TEXT_SYMBOLS_PRESET } from \"./plain-text-symbols.js\";\nimport { PURE_PRESET } from \"./pure-preset.js\";\nimport { TOKYO_NIGHT_PRESET } from \"./tokyo-night.js\";\n\nexport interface StarshipPreset {\n\tid:\n\t\t| \"minimal\"\n\t\t| \"bracketed-segments\"\n\t\t| \"catppuccin-powerline\"\n\t\t| \"gruvbox-rainbow\"\n\t\t| \"jetpack\"\n\t\t| \"nerd-font-symbols\"\n\t\t| \"no-empty-icons\"\n\t\t| \"no-nerd-font\"\n\t\t| \"no-runtime-versions\"\n\t\t| \"pastel-powerline\"\n\t\t| \"plain-text-symbols\"\n\t\t| \"pure-preset\"\n\t\t| \"tokyo-night\";\n\tlabel: string;\n\tdescription: string;\n\trequiresNerdFont: boolean;\n\trawDocument: string;\n}\n\nexport const STARSHIP_PRESETS = [\n\t{\n\t\tid: \"minimal\",\n\t\tlabel: \"Minimal\",\n\t\tdescription: \"Compact Pi essentials \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: MINIMAL_PRESET,\n\t},\n\t{\n\t\tid: \"bracketed-segments\",\n\t\tlabel: \"Bracketed Segments\",\n\t\tdescription: \"Balanced Pi and Git details in brackets \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: BRACKETED_SEGMENTS_PRESET,\n\t},\n\t{\n\t\tid: \"catppuccin-powerline\",\n\t\tlabel: \"Catppuccin Powerline\",\n\t\tdescription: \"Mocha connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: CATPPUCCIN_POWERLINE_PRESET,\n\t},\n\t{\n\t\tid: \"gruvbox-rainbow\",\n\t\tlabel: \"Gruvbox Rainbow\",\n\t\tdescription: \"Warm Gruvbox connected segments \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: GRUVBOX_RAINBOW_PRESET,\n\t},\n\t{\n\t\tid: \"jetpack\",\n\t\tlabel: \"Jetpack\",\n\t\tdescription: \"Airy geometric left/right layout \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: JETPACK_PRESET,\n\t},\n\t{\n\t\tid: \"nerd-font-symbols\",\n\t\tlabel: \"Nerd Font Symbols\",\n\t\tdescription: \"Balanced default layout with icon-rich symbols \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: NERD_FONT_SYMBOLS_PRESET,\n\t},\n\t{\n\t\tid: \"no-empty-icons\",\n\t\tlabel: \"No Empty Icons\",\n\t\tdescription: \"Conditional labels never appear without values \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_EMPTY_ICONS_PRESET,\n\t},\n\t{\n\t\tid: \"no-nerd-font\",\n\t\tlabel: \"No Nerd Font\",\n\t\tdescription: \"Portable Unicode symbols without private-use glyphs \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_NERD_FONT_PRESET,\n\t},\n\t{\n\t\tid: \"no-runtime-versions\",\n\t\tlabel: \"No Runtime Versions\",\n\t\tdescription: \"Presence indicators without model or thinking details \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_RUNTIME_VERSIONS_PRESET,\n\t},\n\t{\n\t\tid: \"pastel-powerline\",\n\t\tlabel: \"Pastel Powerline\",\n\t\tdescription: \"Pastel connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: PASTEL_POWERLINE_PRESET,\n\t},\n\t{\n\t\tid: \"plain-text-symbols\",\n\t\tlabel: \"Plain Text Symbols\",\n\t\tdescription: \"Plain words replace pictograms \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: PLAIN_TEXT_SYMBOLS_PRESET,\n\t},\n\t{\n\t\tid: \"pure-preset\",\n\t\tlabel: \"Pure Preset\",\n\t\tdescription: \"Clean two-line workspace and session context \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: PURE_PRESET,\n\t},\n\t{\n\t\tid: \"tokyo-night\",\n\t\tlabel: \"Tokyo Night\",\n\t\tdescription: \"Cool connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: TOKYO_NIGHT_PRESET,\n\t},\n] as const satisfies readonly StarshipPreset[];\n\nexport function getStarshipPreset(id: StarshipPreset[\"id\"]): StarshipPreset {\n\tconst preset = STARSHIP_PRESETS.find((candidate) => candidate.id === id);\n\tif (!preset) throw new Error(`Unknown pi-starship preset: ${id}`);\n\treturn preset;\n}\n\nexport function presetForDocument(rawDocument: string | undefined): StarshipPreset | undefined {\n\treturn STARSHIP_PRESETS.find((preset) => preset.rawDocument === rawDocument);\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { StatuslineInspection } from \"./modules/inspection.js\";\n\nexport function formatFooterExplanation(inspection: StatuslineInspection | undefined): string {\n\tif (!inspection) {\n\t\treturn safeLines([\n\t\t\t\"Footer inspection is unavailable until the TUI footer is ready.\",\n\t\t\t\"No collection work was started.\",\n\t\t]);\n\t}\n\tif (inspection.showing.length === 0) {\n\t\treturn safeLines([\n\t\t\t\"No modules are currently showing.\",\n\t\t\t\"Open Modules to inspect empty, disabled, or unreachable modules.\",\n\t\t]);\n\t}\n\treturn safeLines(\n\t\tinspection.showing.flatMap((module, index) => [\n\t\t\t...(index > 0 ? [\"\"] : []),\n\t\t\tmodule.name,\n\t\t\t...previewLines(module.preview),\n\t\t\tmodule.description,\n\t\t]),\n\t);\n}\n\nfunction previewLines(preview: string): string[] {\n\tconst lines = preview ? preview.split(\"\\n\") : [\"(no text)\"];\n\treturn lines.map((line, index) => `${index === 0 ? \"Value: \" : \" \"}${line}`);\n}\n\nfunction safeLines(lines: readonly string[]): string {\n\treturn lines.map(safeDisplayText).join(\"\\n\");\n}\n\nfunction safeDisplayText(value: string): string {\n\treturn Array.from(stripVTControlCharacters(value), (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\treturn codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? \"\" : character;\n\t}).join(\"\");\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { runLiveChoice } from \"@narumitw/pi-tui-kit\";\nimport type { StarshipPreset } from \"./presets/catalog.js\";\n\nexport type PresetPickerResult =\n\t| { kind: \"apply\"; presetId: StarshipPreset[\"id\"] }\n\t| { kind: \"customize\"; presetId: StarshipPreset[\"id\"] }\n\t| { kind: \"back\" }\n\t| { kind: \"close\" };\n\nexport interface PresetPickerOptions {\n\tpresets: readonly StarshipPreset[];\n\tactivePresetId?: StarshipPreset[\"id\"];\n\tinitialPresetId?: StarshipPreset[\"id\"];\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tpreview(preset: StarshipPreset): void;\n}\n\nexport async function showPresetPicker(\n\tctx: ExtensionCommandContext,\n\toptions: PresetPickerOptions,\n): Promise<PresetPickerResult> {\n\tconst current =\n\t\toptions.presets.find((preset) => preset.id === options.activePresetId)?.label ??\n\t\t\"Custom configuration\";\n\tconst result = await runLiveChoice(ctx, {\n\t\ttitle: `Presets \u00B7 current: ${current}`,\n\t\titems: options.presets.map((preset) => ({\n\t\t\tid: preset.id,\n\t\t\tlabel: preset.label,\n\t\t\tdescription:\n\t\t\t\tpreset.id === options.activePresetId\n\t\t\t\t\t? `Currently applied \u00B7 ${preset.description}`\n\t\t\t\t\t: preset.description,\n\t\t\tdetails: [\n\t\t\t\t`Selected: ${preset.label} \u00B7 ${preset.requiresNerdFont ? \"requires Nerd Font\" : \"font-safe\"}`,\n\t\t\t],\n\t\t\tconfirmationDisabled: preset.id === options.activePresetId,\n\t\t\tconfirmationDisabledReason: \"Already applied; press e to customize\",\n\t\t})),\n\t\tcurrentItemId: options.activePresetId,\n\t\tinitialItemId: options.initialPresetId ?? options.activePresetId,\n\t\tviewportSize: Math.min(options.presets.length, 10),\n\t\thint: \"back\",\n\t\tnavigationLabel: \"live preview\",\n\t\tconfirmLabel: \"apply\",\n\t\tshortcuts: [{ id: \"customize\", keys: [\"e\", \"shift+e\"], label: \"customize\" }],\n\t\tonSelectionChange: ({ item }) => {\n\t\t\tconst preset = options.presets.find((candidate) => candidate.id === item.id);\n\t\t\tif (preset) options.preview(preset);\n\t\t},\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n\tif (result.kind === \"selected\") return { kind: \"apply\", presetId: result.itemId };\n\tif (result.kind === \"shortcut\") {\n\t\treturn { kind: \"customize\", presetId: result.itemId };\n\t}\n\tif (result.kind === \"closed\" && result.reason === \"back\") return { kind: \"back\" };\n\treturn { kind: \"close\" };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,4BAA4B;;;ACDrC,SAAS,gCAAgC;AAEzC,SAAS,KAAK,YAAY,iBAAiB,wBAAwB;AACnE,SAAS,4BAA4B;AAErC,IAAM,qBAAqB;AAY3B,eAAsB,sBACrB,KACA,OACA,MACA,OACA,QACA,YAA2B,MAAM,CAAC,QAAQ,SACM;AAChD,MAAI,QAAQ,WAAW,CAAC,UAAU,EAAG,QAAO,EAAE,MAAM,SAAS;AAC7D,QAAM,SAAS,MAAM,qBAA+C,KAAK;AAAA,IACxE;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,EAAE,KAAK,OAAO,aAAa,SAAS,MAAM;AAClD,UAAI,gBAAgB;AACpB,UAAI,eAAe;AACnB,UAAI,oBAAoB;AACxB,UAAI,mBAAmB;AACvB,UAAI,WAAW;AAEf,YAAM,gBAAgB,MAAM;AAC3B,YAAI,CAAC,SAAU,KAAI,cAAc;AAAA,MAClC;AACA,YAAM,gBAAgB,CAAC,UAAkB;AACxC,YAAI,MAAM,WAAW,EAAG;AACxB,yBAAiB,gBAAgB,QAAQ,MAAM,UAAU,MAAM;AAC/D,sBAAc;AAAA,MACf;AACA,YAAM,cAAc,CAAC,WAAmB;AACvC,uBAAe,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,iBAAiB,CAAC;AAC9D,sBAAc;AAAA,MACf;A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AAEA,SAAS,UAAU,KAAuC;AACzD,SAAO,IAAI,SAAS,SAAS,IAAI;AAClC;AAEA,SAAS,SAAS,OAAuB;AACxC,SAAO,MAAM,KAAK,OAAO,CAAC,cAAc;AACvC,UAAM,YAAY,UAAU,YAAY,CAAC,KAAK;AAC9C,UAAM,SACL,aAAa,KACZ,aAAa,MAAQ,aAAa,MAClC,aAAa,OAAQ,aAAa;AACpC,WAAO,SAAS,MAAM,UAAU,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,KAAK;AAAA,EACnE,CAAC,EAAE,KAAK,EAAE;AACX;AAEA,SAASA,aAAY,OAAwB;AAC5C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC7D;",
|
|
4
|
+
"sourcesContent": ["import type { ExtensionAPI, ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport {\n\ttype ConfigurationCommandOptions,\n\tconfigurationMenuScreen,\n\tconfigurationOverviewScreen,\n\tconfigurationPresentation,\n\teffectiveConfigurationScreen,\n\treloadConfiguration,\n\tsettingsDocumentScreen,\n\ttype WorkflowOwner,\n} from \"./command-configuration.js\";\nimport { completeStarshipArguments, STARSHIP_SUBCOMMANDS } from \"./command-contract.js\";\nimport { formatFooterExplanation } from \"./command-inspector.js\";\nimport { showPresetPicker } from \"./command-preset-picker.js\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport {\n\tatomicRestoreConfigDocument,\n\tatomicSaveConfigDocument,\n\tBUILT_IN_EXAMPLE,\n\ttype LoadedStarshipConfig,\n\tremoveConfigDocumentIfMatches,\n\tvalidateConfigDocument,\n} from \"./config.js\";\nimport { inspectUnavailableModules, type StatuslineInspection } from \"./modules/inspection.js\";\nimport {\n\tgetStarshipPreset,\n\tpresetForDocument,\n\tSTARSHIP_PRESETS,\n\ttype StarshipPreset,\n} from \"./presets/catalog.js\";\n\nconst MAIN_ACTIONS = {\n\tcustomize: \"customize\",\n\tpresets: \"presets\",\n\texplain: \"explain\",\n\tmodules: \"modules\",\n\tconfiguration: \"configuration\",\n\thelp: \"help\",\n\trestore: \"restore\",\n} as const;\n\nconst PREVIEW_ACTIONS = {\n\tcontinue: \"continue\",\n\tedit: \"edit\",\n\tcancel: \"cancel\",\n} as const;\n\nexport interface StarshipCommandOptions extends ConfigurationCommandOptions {\n\tgetInspection?(): StatuslineInspection | undefined;\n\tpreview?(loaded: LoadedStarshipConfig | undefined, ctx: ExtensionCommandContext): void;\n\tsave?: (settingsPath: string, rawDocument: string) => LoadedStarshipConfig;\n\trestore?: (settingsPath: string, rawDocument: string) => void;\n\tvalidate?: (settingsPath: string, rawDocument: string) => LoadedStarshipConfig;\n\tgetMenuOwner?(): WorkflowOwner;\n}\n\ntype ReviewIntent =\n\t| { kind: \"customize\" }\n\t| { kind: \"restore\" }\n\t| { kind: \"preset\"; preset: StarshipPreset };\n\nexport function registerStarshipCommand(pi: ExtensionAPI, options: StarshipCommandOptions) {\n\tpi.registerCommand(\"starship\", {\n\t\tdescription: \"Customize or inspect the native Starship-style footer\",\n\t\tgetArgumentCompletions: completeStarshipArguments,\n\t\thandler: (args, ctx) => handleStarshipCommand(args, ctx, options),\n\t});\n}\n\nexport async function handleStarshipCommand(\n\targs: string,\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n) {\n\tconst normalized = args.trim();\n\tif (!normalized) {\n\t\tif (ctx.mode === \"tui\") await showMainMenu(ctx, options);\n\t\telse showHelp(ctx, options.settingsPath);\n\t\treturn;\n\t}\n\n\tconst [subcommand = \"\", ...trailing] = normalized.split(/\\s+/u);\n\tconst route = subcommand.toLowerCase();\n\tif (trailing.length > 0 || !STARSHIP_SUBCOMMANDS.some((item) => item.value === route)) {\n\t\tif (canNotify(ctx)) {\n\t\t\tconst reason =\n\t\t\t\ttrailing.length > 0\n\t\t\t\t\t? `Unexpected arguments for /starship ${safeText(route)}.`\n\t\t\t\t\t: `Unknown /starship subcommand: ${safeText(route)}.`;\n\t\t\tctx.ui.notify(`${reason} Usage: /starship [settings|status|help]`, \"warning\");\n\t\t}\n\t\treturn;\n\t}\n\tswitch (route) {\n\t\tcase \"settings\":\n\t\t\tawait editSettings(ctx, options);\n\t\t\treturn;\n\t\tcase \"status\":\n\t\t\tshowStatus(ctx, options);\n\t\t\treturn;\n\t\tcase \"help\":\n\t\t\tshowHelp(ctx, options.settingsPath);\n\t\t\treturn;\n\t}\n}\n\nasync function showMainMenu(ctx: ExtensionCommandContext, options: StarshipCommandOptions) {\n\tconst fallbackController = new AbortController();\n\tconst owner = options.getMenuOwner?.() ?? {\n\t\tsignal: fallbackController.signal,\n\t\tisCurrent: () => !fallbackController.signal.aborted,\n\t};\n\ttype Screen =\n\t\t| \"main\"\n\t\t| \"explain\"\n\t\t| \"modules\"\n\t\t| \"configuration\"\n\t\t| \"configuration-overview\"\n\t\t| \"configuration-effective\"\n\t\t| \"configuration-document\"\n\t\t| \"help\";\n\ttype Action = \"customize\" | \"presets\" | \"configuration-reload\" | \"restore\";\n\tconst menu = defineMenu<undefined, Screen, Action, ExtensionCommandContext>({\n\t\tstart: \"main\",\n\t\tscreens: {\n\t\t\tmain: () => {\n\t\t\t\tconst loaded = options.getLoaded();\n\t\t\t\tconst presentation = configurationPresentation(loaded);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"actions\",\n\t\t\t\t\ttitle: \"pi-starship\",\n\t\t\t\t\tlines: [`${presentation.state} \u00B7 ${presentation.health}`],\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.customize,\n\t\t\t\t\t\t\tlabel: \"Customize footer\",\n\t\t\t\t\t\t\tdescription: `${presentation.state} \u00B7 preview before applying`,\n\t\t\t\t\t\t\taction: \"customize\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.presets,\n\t\t\t\t\t\t\tlabel: \"Presets\",\n\t\t\t\t\t\t\tdescription: \"Browse and live-preview bundled footer starting points\",\n\t\t\t\t\t\t\taction: \"presets\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.explain,\n\t\t\t\t\t\t\tlabel: \"Explain footer\",\n\t\t\t\t\t\t\tdescription: \"Why each visible module appears\",\n\t\t\t\t\t\t\tto: \"explain\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.modules,\n\t\t\t\t\t\t\tlabel: \"Modules\",\n\t\t\t\t\t\t\tdescription: \"Browse supported modules and current states\",\n\t\t\t\t\t\t\tto: \"modules\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.configuration,\n\t\t\t\t\t\t\tlabel: \"Configuration\",\n\t\t\t\t\t\t\tdescription: presentation.health,\n\t\t\t\t\t\t\tto: \"configuration\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.help,\n\t\t\t\t\t\t\tlabel: \"Help\",\n\t\t\t\t\t\t\tdescription: \"Formats, modules, and commands\",\n\t\t\t\t\t\t\tto: \"help\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: MAIN_ACTIONS.restore,\n\t\t\t\t\t\t\tlabel: \"Restore built-in\u2026\",\n\t\t\t\t\t\t\tdescription: presentation.restoreDescription,\n\t\t\t\t\t\t\tdisabled: presentation.restoreDisabled,\n\t\t\t\t\t\t\taction: \"restore\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\thint: \"close\",\n\t\t\t\t};\n\t\t\t},\n\t\t\texplain: () => ({\n\t\t\t\tkind: \"review\",\n\t\t\t\ttitle: \"Explain footer\",\n\t\t\t\tcontent: formatFooterExplanation(options.getInspection?.()),\n\t\t\t\tformat: { kind: \"text\" },\n\t\t\t\tviewportSize: \"adaptive\",\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t\tmodules: () => {\n\t\t\t\tconst inspection =\n\t\t\t\t\toptions.getInspection?.() ?? inspectUnavailableModules(options.getLoaded().config);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"browse\",\n\t\t\t\t\ttitle: \"Modules\",\n\t\t\t\t\titems: inspection.modules.map((module) => ({\n\t\t\t\t\t\tid: module.name,\n\t\t\t\t\t\tlabel: module.name,\n\t\t\t\t\t\tstatusText: module.state,\n\t\t\t\t\t\tdescription: module.description,\n\t\t\t\t\t\tsearchText: [...module.variables, ...module.styleFields, ...module.displayRules].join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdetails: [\n\t\t\t\t\t\t\t`Root: ${module.rootReferenced ? \"Referenced\" : \"Not referenced\"}`,\n\t\t\t\t\t\t\t`Reachable: ${module.reachable ? \"Yes\" : \"No\"}`,\n\t\t\t\t\t\t\t...modulePreviewDetails(module.preview),\n\t\t\t\t\t\t\t`Reason: ${module.reason}`,\n\t\t\t\t\t\t\t`Variables: ${module.variables.join(\", \") || \"none\"}`,\n\t\t\t\t\t\t\t`Style fields: ${module.styleFields.join(\", \") || \"none\"}`,\n\t\t\t\t\t\t\t`Display rules: ${module.displayRules.join(\" \u00B7 \") || \"none\"}`,\n\t\t\t\t\t\t],\n\t\t\t\t\t})),\n\t\t\t\t\tviewportSize: \"adaptive\",\n\t\t\t\t\thint: \"back\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tconfiguration: () => configurationMenuScreen(options.getLoaded()),\n\t\t\t\"configuration-overview\": () =>\n\t\t\t\tconfigurationOverviewScreen(options.getLoaded(), options.settingsPath),\n\t\t\t\"configuration-effective\": () => effectiveConfigurationScreen(options.getLoaded()),\n\t\t\t\"configuration-document\": () =>\n\t\t\t\tsettingsDocumentScreen(options.getLoaded(), options.settingsPath),\n\t\t\thelp: () => ({\n\t\t\t\tkind: \"detail\",\n\t\t\t\ttitle: \"pi-starship help\",\n\t\t\t\tlines: [\n\t\t\t\t\t\"Customize footer opens the TOML editor, then previews and confirms before saving.\",\n\t\t\t\t\t\"Presets live-previews the cursor in the footer; Enter confirms apply and e customizes first.\",\n\t\t\t\t\t\"Explain footer breaks down the modules currently showing from the existing snapshot.\",\n\t\t\t\t\t\"Modules searches every supported module and explains its current read-only state.\",\n\t\t\t\t\t\"Configuration separates overview, effective TOML, loaded settings text, and safe disk reload.\",\n\t\t\t\t\t`Settings: ${safeText(options.settingsPath)}`,\n\t\t\t\t\t\"Docs: https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship\",\n\t\t\t\t],\n\t\t\t\thint: \"back\",\n\t\t\t}),\n\t\t},\n\t\tactions: {\n\t\t\tcustomize: async () => {\n\t\t\t\tconst result = await editSettings(ctx, options);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\tpresets: async () => {\n\t\t\t\tconst result = await choosePreset(ctx, options, owner);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\t\"configuration-reload\": async () => {\n\t\t\t\tconst result = await reloadConfiguration(ctx, options, owner);\n\t\t\t\treturn result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t\trestore: async () => {\n\t\t\t\tconst presentation = configurationPresentation(options.getLoaded());\n\t\t\t\tif (presentation.restoreDisabled) {\n\t\t\t\t\tctx.ui.notify(presentation.restoreDescription, \"info\");\n\t\t\t\t\treturn { kind: \"stay\" };\n\t\t\t\t}\n\t\t\t\tconst result = await restoreBuiltIn(ctx, options);\n\t\t\t\treturn result === \"applied\" || result === \"close\" ? { kind: \"close\" } : { kind: \"stay\" };\n\t\t\t},\n\t\t},\n\t});\n\ttry {\n\t\tawait runMenu(ctx, menu, {\n\t\t\tgetState: () => undefined,\n\t\t\tsignal: owner.signal,\n\t\t\tisCurrent: owner.isCurrent,\n\t\t});\n\t} finally {\n\t\tfallbackController.abort(new DOMException(\"Starship menu closed\", \"AbortError\"));\n\t}\n}\n\nasync function editSettings(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tif (ctx.mode !== \"tui\") {\n\t\tif (ctx.hasUI) ctx.ui.notify(`Edit settings manually: ${options.settingsPath}`, \"info\");\n\t\treturn \"cancel\";\n\t}\n\tlet draft = options.getLoaded().rawDocument ?? BUILT_IN_EXAMPLE;\n\twhile (true) {\n\t\tconst edited = await ctx.ui.editor(\"Customize footer \u2014 close to preview\", draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t\tlet validated: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tvalidated = (options.validate ?? validateConfigDocument)(options.settingsPath, draft);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(`Footer draft is invalid: ${safeText(formatError(error))}`, \"error\");\n\t\t\tconst action = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\t\"Configuration needs attention\",\n\t\t\t\t() => [safeText(formatError(error)), \"The current footer has not changed.\"],\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.edit, label: \"Continue editing\" },\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.cancel, label: \"Discard draft\" },\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (action?.kind === \"closed\") return \"close\";\n\t\t\tif (selectedPreviewAction(action) === PREVIEW_ACTIONS.edit) continue;\n\t\t\treturn \"cancel\";\n\t\t}\n\n\t\tconst result = await reviewAndApply(ctx, options, validated, { kind: \"customize\" }, owner);\n\t\tif (result === \"edit\") continue;\n\t\treturn result;\n\t}\n}\n\nasync function choosePreset(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\towner: WorkflowOwner,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst activePreset = presetForDocument(options.getLoaded().rawDocument);\n\tconst selection = await showPresetPicker(ctx, {\n\t\tpresets: STARSHIP_PRESETS,\n\t\tactivePresetId: activePreset?.id,\n\t\tinitialPresetId: activePreset?.id ?? STARSHIP_PRESETS[0]?.id,\n\t\tsignal: owner.signal,\n\t\tisCurrent: owner.isCurrent,\n\t\tpreview(preset) {\n\t\t\tconst loaded = (options.validate ?? validateConfigDocument)(\n\t\t\t\toptions.settingsPath,\n\t\t\t\tpreset.rawDocument,\n\t\t\t);\n\t\t\toptions.preview?.(loaded, ctx);\n\t\t},\n\t});\n\tif (!isCurrentOwner(owner)) {\n\t\toptions.preview?.(undefined, ctx);\n\t\treturn \"cancel\";\n\t}\n\tif (selection.kind === \"back\" || selection.kind === \"close\") {\n\t\toptions.preview?.(undefined, ctx);\n\t\treturn selection.kind === \"close\" ? \"close\" : \"cancel\";\n\t}\n\n\tconst preset = getStarshipPreset(selection.presetId);\n\ttry {\n\t\treturn await applyPreset(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tpreset,\n\t\t\tselection.kind === \"customize\" ? \"customize\" : \"confirm\",\n\t\t);\n\t} finally {\n\t\toptions.preview?.(undefined, ctx);\n\t}\n}\n\nasync function applyPreset(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tpreset: StarshipPreset,\n\tstart: \"review\" | \"confirm\" | \"customize\" = \"review\",\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tlet draft = preset.rawDocument;\n\tif (start === \"customize\") {\n\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t}\n\twhile (true) {\n\t\tlet validated: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tvalidated = (options.validate ?? validateConfigDocument)(options.settingsPath, draft);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(`Preset draft is invalid: ${safeText(formatError(error))}`, \"error\");\n\t\t\tconst action = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\t\"Preset needs attention\",\n\t\t\t\t() => [safeText(formatError(error)), \"The current footer has not changed.\"],\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.edit, label: \"Continue editing\" },\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.cancel, label: \"Choose another preset\" },\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (action?.kind === \"closed\") return \"close\";\n\t\t\tif (selectedPreviewAction(action) !== PREVIEW_ACTIONS.edit) return \"cancel\";\n\t\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\t\tdraft = edited;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = await reviewAndApply(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tvalidated,\n\t\t\t{ kind: \"preset\", preset },\n\t\t\towner,\n\t\t\tstart === \"confirm\",\n\t\t);\n\t\tif (result !== \"edit\") return result;\n\t\tconst edited = await ctx.ui.editor(`Customize ${preset.label} preset`, draft);\n\t\tif (!isCurrentOwner(owner) || edited === undefined) return \"cancel\";\n\t\tdraft = edited;\n\t}\n}\n\nasync function restoreBuiltIn(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n): Promise<\"applied\" | \"cancel\" | \"close\"> {\n\tconst owner = workflowOwner(options);\n\tif (!isCurrentOwner(owner)) return \"cancel\";\n\tconst validated = (options.validate ?? validateConfigDocument)(\n\t\toptions.settingsPath,\n\t\tBUILT_IN_EXAMPLE,\n\t);\n\tconst result = await reviewAndApply(ctx, options, validated, { kind: \"restore\" }, owner);\n\treturn result === \"edit\" ? \"cancel\" : result;\n}\n\nasync function reviewAndApply(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tvalidated: LoadedStarshipConfig,\n\tintent: ReviewIntent,\n\towner: WorkflowOwner,\n\tskipReview = false,\n): Promise<\"applied\" | \"edit\" | \"cancel\" | \"close\"> {\n\tlet reviewRequired = !skipReview;\n\twhile (true) {\n\t\tconst directAttempt = !reviewRequired;\n\t\tif (reviewRequired) {\n\t\t\tconst selection = await showPreviewActionMenu(\n\t\t\t\tctx,\n\t\t\t\treviewTitle(intent),\n\t\t\t\t(width) => reviewPreviewBody(ctx, options, validated, width, intent),\n\t\t\t\t[\n\t\t\t\t\t{ value: PREVIEW_ACTIONS.continue, label: continueLabel(intent) },\n\t\t\t\t\t...(intent.kind === \"restore\"\n\t\t\t\t\t\t? []\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: PREVIEW_ACTIONS.edit,\n\t\t\t\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\t\t\t\tintent.kind === \"preset\" ? \"Customize before applying\" : \"Continue editing\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: PREVIEW_ACTIONS.cancel,\n\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\tintent.kind === \"restore\"\n\t\t\t\t\t\t\t\t? \"Cancel\"\n\t\t\t\t\t\t\t\t: intent.kind === \"preset\"\n\t\t\t\t\t\t\t\t\t? \"Choose another preset\"\n\t\t\t\t\t\t\t\t\t: \"Discard draft\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\towner.signal,\n\t\t\t\towner.isCurrent,\n\t\t\t);\n\t\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\t\tif (selection?.kind === \"closed\") return \"close\";\n\t\t\tconst selected = selectedPreviewAction(selection);\n\t\t\tif (selected === PREVIEW_ACTIONS.edit) return \"edit\";\n\t\t\tif (selected !== PREVIEW_ACTIONS.continue) return \"cancel\";\n\t\t}\n\t\treviewRequired = true;\n\n\t\tconst confirmed = await ctx.ui.confirm(\n\t\t\tconfirmationTitle(intent),\n\t\t\tconfirmationMessage(options.settingsPath, intent),\n\t\t);\n\t\tif (!isCurrentOwner(owner)) return \"cancel\";\n\t\tif (!confirmed) {\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst save = options.save ?? atomicSaveConfigDocument;\n\t\tconst previous = options.getLoaded();\n\t\tlet saved: LoadedStarshipConfig;\n\t\ttry {\n\t\t\tsaved = save(options.settingsPath, validated.rawDocument ?? BUILT_IN_EXAMPLE);\n\t\t} catch (error) {\n\t\t\tctx.ui.notify(\n\t\t\t\t`Footer settings were not saved: ${safeText(formatError(error))}. The previous footer remains active.`,\n\t\t\t\t\"error\",\n\t\t\t);\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\toptions.apply(saved, ctx);\n\t\t} catch (error) {\n\t\t\tconst rollbackError = restorePreviousConfiguration(ctx, options, previous, saved);\n\t\t\tctx.ui.notify(\n\t\t\t\trollbackError\n\t\t\t\t\t? `Footer settings could not be applied: ${safeText(formatError(error))}. Restoring the previous configuration also failed: ${safeText(formatError(rollbackError))}.`\n\t\t\t\t\t: `Footer settings could not be applied: ${safeText(formatError(error))}. The previous configuration was restored.`,\n\t\t\t\t\"error\",\n\t\t\t);\n\t\t\tif (directAttempt) return \"cancel\";\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst warningSuffix =\n\t\t\tsaved.diagnostics.length > 0\n\t\t\t\t? ` (${saved.diagnostics.length} warning${saved.diagnostics.length === 1 ? \"\" : \"s\"})`\n\t\t\t\t: \"\";\n\t\tctx.ui.notify(`${successMessage(intent)}${warningSuffix}.`, \"info\");\n\t\treturn \"applied\";\n\t}\n}\n\nfunction reviewTitle(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Footer preview\";\n\t\tcase \"restore\":\n\t\t\treturn \"Restore preview\";\n\t\tcase \"preset\":\n\t\t\treturn `${intent.preset.label} preset preview`;\n\t}\n}\n\nfunction continueLabel(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Apply changes\u2026\";\n\t\tcase \"restore\":\n\t\t\treturn \"Replace with built-in\u2026\";\n\t\tcase \"preset\":\n\t\t\treturn `Apply ${intent.preset.label} preset\u2026`;\n\t}\n}\n\nfunction confirmationTitle(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Apply footer changes?\";\n\t\tcase \"restore\":\n\t\t\treturn \"Restore built-in footer?\";\n\t\tcase \"preset\":\n\t\t\treturn `Apply ${intent.preset.label} preset?`;\n\t}\n}\n\nfunction confirmationMessage(settingsPath: string, intent: ReviewIntent): string {\n\tif (intent.kind === \"customize\") return \"Save this configuration and apply it immediately?\";\n\tconst replacement =\n\t\tintent.kind === \"restore\" ? \"the built-in configuration\" : `the ${intent.preset.label} preset`;\n\treturn `Replace ${safeText(settingsPath)} entirely with ${replacement}? All custom settings, unknown fields, and comments will be removed. No backup is kept after success.`;\n}\n\nfunction successMessage(intent: ReviewIntent): string {\n\tswitch (intent.kind) {\n\t\tcase \"customize\":\n\t\t\treturn \"Footer settings saved and applied\";\n\t\tcase \"restore\":\n\t\t\treturn \"Built-in footer restored and applied\";\n\t\tcase \"preset\":\n\t\t\treturn `${intent.preset.label} preset saved and applied`;\n\t}\n}\n\nfunction modulePreviewDetails(preview: string): string[] {\n\tconst lines = preview ? preview.split(\"\\n\") : [\"(no current preview)\"];\n\treturn lines.map((line, index) => `${index === 0 ? \"Preview: \" : \" \"}${line}`);\n}\n\nfunction workflowOwner(options: StarshipCommandOptions): WorkflowOwner {\n\tif (options.getMenuOwner) return options.getMenuOwner();\n\tconst controller = new AbortController();\n\treturn { signal: controller.signal, isCurrent: () => true };\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n\treturn !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction restorePreviousConfiguration(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tprevious: LoadedStarshipConfig,\n\tsaved: LoadedStarshipConfig,\n): unknown {\n\ttry {\n\t\tif (saved.rawDocument === undefined || saved.fileIdentity === undefined) {\n\t\t\tthrow new Error(\"The saved settings document identity is unavailable\");\n\t\t}\n\t\tremoveConfigDocumentIfMatches(options.settingsPath, saved.rawDocument, saved.fileIdentity);\n\t\tif (previous.rawDocument !== undefined) {\n\t\t\t(options.restore ?? atomicRestoreConfigDocument)(options.settingsPath, previous.rawDocument);\n\t\t}\n\t\toptions.apply(previous, ctx);\n\t\treturn undefined;\n\t} catch (error) {\n\t\treturn error;\n\t}\n}\n\nfunction reviewPreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n\tintent: ReviewIntent,\n): string[] {\n\tif (intent.kind === \"restore\") return restorePreviewBody(ctx, options, loaded, width);\n\tif (intent.kind === \"customize\") return previewBody(ctx, options, loaded, width);\n\tconst current = configurationPresentation(options.getLoaded());\n\treturn [\n\t\t`Preset: ${intent.preset.label}`,\n\t\t`Requirement: ${intent.preset.requiresNerdFont ? \"Nerd Font\" : \"No special font\"}`,\n\t\t`Current: ${current.state}`,\n\t\t`Path: ${safeText(options.settingsPath)}`,\n\t\t\"Applying replaces the entire settings document, including custom settings, unknown fields, and comments.\",\n\t\t\"No backup is kept after a successful apply.\",\n\t\t\"\",\n\t\t...previewBody(ctx, options, loaded, width),\n\t];\n}\n\nfunction restorePreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tconst current = configurationPresentation(options.getLoaded());\n\treturn [\n\t\t`Current: ${current.state}`,\n\t\t`Path: ${safeText(options.settingsPath)}`,\n\t\t\"The entire settings document will be replaced, including custom settings, unknown fields, and comments.\",\n\t\t\"No backup is kept after a successful restore.\",\n\t\t\"\",\n\t\t...previewBody(ctx, options, loaded, width),\n\t];\n}\n\nfunction previewBody(\n\tctx: ExtensionCommandContext,\n\toptions: StarshipCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tlet lines: string[];\n\ttry {\n\t\tlines = options.renderPreview?.(loaded, width, ctx) ?? [\n\t\t\t\"Live preview is unavailable until the footer is ready.\",\n\t\t\t\"The draft is valid and can still be applied.\",\n\t\t];\n\t} catch (error) {\n\t\tlines = [`Preview unavailable: ${safeText(formatError(error))}`];\n\t}\n\tconst warning =\n\t\tloaded.diagnostics.length === 0\n\t\t\t? \"Draft validation: Healthy\"\n\t\t\t: `Draft validation: ${loaded.diagnostics.length} warning${loaded.diagnostics.length === 1 ? \"\" : \"s\"}`;\n\treturn [...lines, \"\", warning];\n}\n\nfunction selectedPreviewAction<Value extends string>(\n\tresult: PreviewMenuResult<Value> | undefined,\n): Value | null {\n\treturn result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction showStatus(ctx: ExtensionCommandContext, options: StarshipCommandOptions) {\n\tif (!canNotify(ctx)) return;\n\tconst loaded = options.getLoaded();\n\tconst diagnostics = loaded.diagnostics\n\t\t.slice(0, 5)\n\t\t.map((item) => `${safeText(item.path || \"root\")}: ${safeText(item.message)}`)\n\t\t.join(\"; \");\n\tctx.ui.notify(\n\t\t[\n\t\t\t`pi-starship source: ${loaded.source}`,\n\t\t\t`path: ${options.settingsPath}`,\n\t\t\tdiagnostics ? `warnings: ${diagnostics}` : \"warnings: none\",\n\t\t].join(\"\\n\"),\n\t\tloaded.diagnostics.length > 0 ? \"warning\" : \"info\",\n\t);\n}\n\nfunction showHelp(ctx: ExtensionCommandContext, settingsPath: string) {\n\tif (!canNotify(ctx)) return;\n\tctx.ui.notify(\n\t\t[\n\t\t\t\"/starship \u2014 customize, live-preview presets, explain, or inspect the footer in TUI mode\",\n\t\t\t\"/starship settings \u2014 customize, preview, and apply TOML\",\n\t\t\t\"/starship status \u2014 show source, path, and warnings\",\n\t\t\t\"/starship help \u2014 show this help\",\n\t\t\t`Settings: ${settingsPath}`,\n\t\t\t\"Format/module docs: https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-starship\",\n\t\t].join(\"\\n\"),\n\t\t\"info\",\n\t);\n}\n\nfunction canNotify(ctx: ExtensionCommandContext): boolean {\n\treturn ctx.mode === \"tui\" || ctx.hasUI;\n}\n\nfunction safeText(value: string): string {\n\treturn Array.from(value, (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\tconst unsafe =\n\t\t\tcodePoint <= 0x08 ||\n\t\t\t(codePoint >= 0x0b && codePoint <= 0x1f) ||\n\t\t\t(codePoint >= 0x7f && codePoint <= 0x9f);\n\t\treturn unsafe ? `\\\\u${codePoint.toString(16).padStart(4, \"0\")}` : character;\n\t}).join(\"\");\n}\n\nfunction formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { sanitizeTerminalText } from \"@narumitw/pi-tui-kit/terminal-text\";\nimport { type PreviewMenuResult, showPreviewActionMenu } from \"./command-preview.js\";\nimport { BUILT_IN_EXAMPLE, type LoadedStarshipConfig, loadStarshipConfig } from \"./config.js\";\nimport { serializeEffectiveConfig } from \"./effective-config.js\";\nimport { presetForDocument } from \"./presets/catalog.js\";\n\nconst RELOAD_ACTIONS = {\n\tapply: \"apply\",\n\tcancel: \"cancel\",\n} as const;\n\nexport interface WorkflowOwner {\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n}\n\nexport interface ConfigurationCommandOptions {\n\tgetLoaded(): LoadedStarshipConfig;\n\tgetLoadedRevision?(): number;\n\tapply(loaded: LoadedStarshipConfig, ctx: ExtensionCommandContext): void;\n\tsettingsPath: string;\n\trenderPreview?(\n\t\tloaded: LoadedStarshipConfig,\n\t\twidth: number,\n\t\tctx: ExtensionCommandContext,\n\t): string[];\n\tread?: (settingsPath: string) => LoadedStarshipConfig;\n}\n\nexport interface ConfigurationPresentation {\n\tstate: string;\n\tsource: string;\n\thealth: string;\n\trestoreDisabled: boolean;\n\trestoreDescription: string;\n}\n\nexport function configurationPresentation(loaded: LoadedStarshipConfig): ConfigurationPresentation {\n\tconst healthyMissing = isHealthyMissing(loaded);\n\tconst savedBuiltIn = loaded.source === \"user\" && loaded.rawDocument === BUILT_IN_EXAMPLE;\n\tconst activePreset = presetForDocument(loaded.rawDocument);\n\tconst fallback = loaded.source === \"built-in\" && loaded.diagnostics.length > 0;\n\treturn {\n\t\tstate: healthyMissing\n\t\t\t? \"Built-in defaults\"\n\t\t\t: savedBuiltIn\n\t\t\t\t? \"Saved built-in configuration\"\n\t\t\t\t: activePreset\n\t\t\t\t\t? `${activePreset.label} preset`\n\t\t\t\t\t: fallback\n\t\t\t\t\t\t? \"Built-in fallback\"\n\t\t\t\t\t\t: \"Custom configuration\",\n\t\tsource: healthyMissing\n\t\t\t? \"No settings file\"\n\t\t\t: activePreset\n\t\t\t\t? \"Bundled preset\"\n\t\t\t\t: loaded.source === \"user\"\n\t\t\t\t\t? \"User file\"\n\t\t\t\t\t: \"Built-in fallback\",\n\t\thealth: configurationHealth(loaded),\n\t\trestoreDisabled: healthyMissing || savedBuiltIn,\n\t\trestoreDescription: healthyMissing\n\t\t\t? \"Already using defaults \u00B7 no file to replace\"\n\t\t\t: savedBuiltIn\n\t\t\t\t? \"Built-in configuration already saved\"\n\t\t\t\t: fallback\n\t\t\t\t\t? \"Preview before replacing invalid settings\"\n\t\t\t\t\t: \"Preview before replacing the document\",\n\t};\n}\n\nexport function configurationMenuScreen(loaded: LoadedStarshipConfig) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"actions\" as const,\n\t\ttitle: \"Configuration\",\n\t\tlines: [`${presentation.state} \u00B7 ${presentation.health}`],\n\t\titems: [\n\t\t\t{\n\t\t\t\tid: \"configuration-overview\",\n\t\t\t\tlabel: \"Overview\",\n\t\t\t\tdescription: \"State, source, path, health, and warnings\",\n\t\t\t\tto: \"configuration-overview\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-effective\",\n\t\t\t\tlabel: \"Effective configuration\",\n\t\t\t\tdescription: \"Normalized public TOML currently in use\",\n\t\t\t\tto: \"configuration-effective\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-document\",\n\t\t\t\tlabel: \"Settings document\",\n\t\t\t\tdescription: isHealthyMissing(loaded)\n\t\t\t\t\t? \"No settings file \u00B7 built-in defaults are active\"\n\t\t\t\t\t: \"Exact loaded UTF-8 text \u00B7 read-only\",\n\t\t\t\tto: \"configuration-document\" as const,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"configuration-reload\",\n\t\t\t\tlabel: \"Reload from disk\u2026\",\n\t\t\t\tdescription: \"Validate and preview external changes\",\n\t\t\t\taction: \"configuration-reload\" as const,\n\t\t\t},\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function configurationOverviewScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"detail\" as const,\n\t\ttitle: \"Configuration overview\",\n\t\tlines: [\n\t\t\t`State: ${presentation.state}`,\n\t\t\t`Source: ${presentation.source}`,\n\t\t\t`Path: ${sanitizeTerminalText(settingsPath)}`,\n\t\t\t...diagnosticLines(loaded, true),\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function effectiveConfigurationScreen(loaded: LoadedStarshipConfig) {\n\tconst presentation = configurationPresentation(loaded);\n\treturn {\n\t\tkind: \"review\" as const,\n\t\ttitle: \"Effective configuration\",\n\t\tlines: [\n\t\t\t`${presentation.state} \u00B7 ${presentation.health}`,\n\t\t\t\"Normalized public TOML; comments and unknown fields are intentionally excluded.\",\n\t\t],\n\t\tcontent: serializeEffectiveConfig(loaded.config),\n\t\tformat: { kind: \"code\" as const, language: \"toml\" },\n\t\tviewportSize: \"adaptive\" as const,\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport function settingsDocumentScreen(loaded: LoadedStarshipConfig, settingsPath: string) {\n\tconst path = sanitizeTerminalText(settingsPath);\n\tif (loaded.rawDocument !== undefined) {\n\t\treturn {\n\t\t\tkind: \"review\" as const,\n\t\t\ttitle: \"Settings document\",\n\t\t\tlines: [\"Exact loaded UTF-8 text \u00B7 display controls sanitized \u00B7 read-only\", `Path: ${path}`],\n\t\t\tcontent: loaded.rawDocument,\n\t\t\tformat: { kind: \"code\" as const, language: \"toml\" },\n\t\t\tviewportSize: \"adaptive\" as const,\n\t\t\thint: \"back\" as const,\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"detail\" as const,\n\t\ttitle: \"Settings document\",\n\t\tlines: [\n\t\t\t...(isHealthyMissing(loaded)\n\t\t\t\t? [\n\t\t\t\t\t\t\"No settings document exists.\",\n\t\t\t\t\t\t\"Built-in defaults are active; this read created no file.\",\n\t\t\t\t\t]\n\t\t\t\t: [\"The settings document could not be loaded.\", ...diagnosticLines(loaded, false)]),\n\t\t\t`Path: ${path}`,\n\t\t],\n\t\thint: \"back\" as const,\n\t};\n}\n\nexport async function reloadConfiguration(\n\tctx: ExtensionCommandContext,\n\toptions: ConfigurationCommandOptions,\n\towner: WorkflowOwner,\n): Promise<\"applied\" | \"stay\" | \"close\"> {\n\tif (!isCurrentOwner(owner)) return \"stay\";\n\tconst previous = options.getLoaded();\n\tconst revision = options.getLoadedRevision?.();\n\tconst candidate = readReloadCandidate(options);\n\tif (!candidate.ok) {\n\t\tctx.ui.notify(`Footer reload was blocked: ${safeError(candidate.error)}`, \"error\");\n\t\treturn \"stay\";\n\t}\n\tif (sameLoadedDocument(previous, candidate.loaded)) {\n\t\tctx.ui.notify(\"The current disk configuration is already loaded.\", \"info\");\n\t\treturn \"stay\";\n\t}\n\n\tconst selection = await showPreviewActionMenu(\n\t\tctx,\n\t\t\"Reload preview\",\n\t\t(width) => reloadPreviewBody(ctx, options, candidate.loaded, width),\n\t\t[\n\t\t\t{ value: RELOAD_ACTIONS.apply, label: \"Apply reloaded configuration\u2026\" },\n\t\t\t{ value: RELOAD_ACTIONS.cancel, label: \"Cancel\" },\n\t\t],\n\t\towner.signal,\n\t\towner.isCurrent,\n\t);\n\tif (!isCurrentOwner(owner) || activeRevisionChanged(options, revision)) return \"stay\";\n\tif (selection?.kind === \"closed\") return \"close\";\n\tif (selectedReloadAction(selection) !== RELOAD_ACTIONS.apply) return \"stay\";\n\n\tconst confirmed = await ctx.ui.confirm(\n\t\t\"Apply configuration from disk?\",\n\t\tcandidate.loaded.rawDocument === undefined\n\t\t\t? \"Use built-in defaults for this session? No settings file will be created.\"\n\t\t\t: \"Apply the validated settings document to this session without changing its bytes?\",\n\t);\n\tif (!isCurrentOwner(owner) || activeRevisionChanged(options, revision) || !confirmed) {\n\t\treturn \"stay\";\n\t}\n\n\tconst fresh = readReloadCandidate(options);\n\tif (!fresh.ok) {\n\t\tctx.ui.notify(\n\t\t\t`Footer reload was blocked after confirmation: ${safeError(fresh.error)}. The previous footer remains active.`,\n\t\t\t\"error\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\tif (!sameLoadedDocument(candidate.loaded, fresh.loaded)) {\n\t\tctx.ui.notify(\n\t\t\t\"The settings document changed after preview. The previous footer remains active; reload again to review the latest version.\",\n\t\t\t\"warning\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\n\ttry {\n\t\toptions.apply(fresh.loaded, ctx);\n\t} catch (error) {\n\t\tlet rollbackError: unknown;\n\t\ttry {\n\t\t\toptions.apply(previous, ctx);\n\t\t} catch (rollback) {\n\t\t\trollbackError = rollback;\n\t\t}\n\t\tctx.ui.notify(\n\t\t\trollbackError\n\t\t\t\t? `Footer reload failed: ${safeError(error)}. Restoring the previous configuration also failed: ${safeError(rollbackError)}.`\n\t\t\t\t: `Footer reload failed: ${safeError(error)}. The previous configuration was restored.`,\n\t\t\t\"error\",\n\t\t);\n\t\treturn \"stay\";\n\t}\n\n\tconst warnings = fresh.loaded.diagnostics.length;\n\tctx.ui.notify(\n\t\twarnings === 0\n\t\t\t? \"Footer configuration reloaded and applied.\"\n\t\t\t: `Footer configuration reloaded and applied with ${warnings} warning${warnings === 1 ? \"\" : \"s\"}.`,\n\t\t\"info\",\n\t);\n\treturn \"applied\";\n}\n\nfunction readReloadCandidate(\n\toptions: ConfigurationCommandOptions,\n): { ok: true; loaded: LoadedStarshipConfig } | { ok: false; error: string } {\n\tlet loaded: LoadedStarshipConfig;\n\ttry {\n\t\tloaded = (options.read ?? loadStarshipConfig)(options.settingsPath);\n\t} catch (error) {\n\t\treturn { ok: false, error: formatError(error) };\n\t}\n\tconst errors = loaded.diagnostics.filter((item) => item.severity === \"error\");\n\tif (errors.length > 0) {\n\t\treturn { ok: false, error: errors.map((item) => item.message).join(\"; \") };\n\t}\n\treturn { ok: true, loaded };\n}\n\nfunction reloadPreviewBody(\n\tctx: ExtensionCommandContext,\n\toptions: ConfigurationCommandOptions,\n\tloaded: LoadedStarshipConfig,\n\twidth: number,\n): string[] {\n\tconst presentation = configurationPresentation(loaded);\n\tlet preview: string[];\n\ttry {\n\t\tpreview = options.renderPreview?.(loaded, width, ctx) ?? [\n\t\t\t\"Live preview is unavailable until the footer is ready.\",\n\t\t];\n\t} catch (error) {\n\t\tpreview = [`Preview unavailable: ${safeError(formatError(error))}`];\n\t}\n\treturn [\n\t\t`Candidate: ${presentation.state}`,\n\t\t`Source: ${presentation.source}`,\n\t\t`Path: ${sanitizeTerminalText(options.settingsPath)}`,\n\t\tloaded.rawDocument === undefined\n\t\t\t? \"Applying uses built-in defaults and creates no settings file.\"\n\t\t\t: \"Applying changes only the active session; the settings document bytes stay unchanged.\",\n\t\t...diagnosticLines(loaded, true),\n\t\t\"\",\n\t\t...preview,\n\t];\n}\n\nexport function diagnosticLines(loaded: LoadedStarshipConfig, includeSummary: boolean): string[] {\n\tconst diagnostics = loaded.diagnostics\n\t\t.slice(0, 8)\n\t\t.map(\n\t\t\t(item) =>\n\t\t\t\t`${sanitizeTerminalText(item.path || \"root\")}: ${sanitizeTerminalText(item.message)}`,\n\t\t);\n\tconst remaining = loaded.diagnostics.length - diagnostics.length;\n\treturn [\n\t\t...(includeSummary ? [`Health: ${configurationHealth(loaded)}`] : []),\n\t\t...(diagnostics.length > 0 ? diagnostics : [\"No configuration warnings.\"]),\n\t\t...(remaining > 0 ? [`${remaining} additional warnings not shown.`] : []),\n\t];\n}\n\nfunction configurationHealth(loaded: LoadedStarshipConfig): string {\n\tconst errors = loaded.diagnostics.filter((item) => item.severity === \"error\").length;\n\tif (errors > 0) return `${errors} error${errors === 1 ? \"\" : \"s\"}`;\n\tconst warnings = loaded.diagnostics.length;\n\treturn warnings === 0 ? \"Healthy\" : `${warnings} warning${warnings === 1 ? \"\" : \"s\"}`;\n}\n\nfunction isHealthyMissing(loaded: LoadedStarshipConfig): boolean {\n\treturn (\n\t\tloaded.source === \"built-in\" &&\n\t\tloaded.rawDocument === undefined &&\n\t\tloaded.diagnostics.length === 0\n\t);\n}\n\nfunction sameLoadedDocument(left: LoadedStarshipConfig, right: LoadedStarshipConfig): boolean {\n\treturn (\n\t\tleft.source === right.source &&\n\t\tleft.rawDocument === right.rawDocument &&\n\t\tJSON.stringify(left.diagnostics) === JSON.stringify(right.diagnostics)\n\t);\n}\n\nfunction activeRevisionChanged(\n\toptions: ConfigurationCommandOptions,\n\trevision: number | undefined,\n): boolean {\n\treturn revision !== undefined && options.getLoadedRevision?.() !== revision;\n}\n\nfunction isCurrentOwner(owner: WorkflowOwner): boolean {\n\treturn !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction selectedReloadAction(\n\tresult: PreviewMenuResult<(typeof RELOAD_ACTIONS)[keyof typeof RELOAD_ACTIONS]> | undefined,\n) {\n\treturn result?.kind === \"selected\" ? result.value : null;\n}\n\nfunction safeError(value: unknown): string {\n\treturn sanitizeTerminalText(typeof value === \"string\" ? value : formatError(value));\n}\n\nfunction formatError(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { ExtensionCommandContext, KeybindingsManager } from \"@earendil-works/pi-coding-agent\";\nimport { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from \"@earendil-works/pi-tui\";\nimport { runCustomInteraction } from \"@narumitw/pi-tui-kit\";\n\nconst RESERVED_HOST_ROWS = 3;\n\nexport interface PreviewMenuItem<Value extends string> {\n\tvalue: Value;\n\tlabel: string;\n}\n\nexport type PreviewMenuResult<Value extends string> =\n\t| { kind: \"selected\"; value: Value }\n\t| { kind: \"cancelled\" }\n\t| { kind: \"closed\" };\n\nexport async function showPreviewActionMenu<Value extends string>(\n\tctx: ExtensionCommandContext,\n\ttitle: string,\n\tbody: (width: number) => readonly string[],\n\titems: readonly PreviewMenuItem<Value>[],\n\tsignal?: AbortSignal,\n\tisCurrent: () => boolean = () => !signal?.aborted,\n): Promise<PreviewMenuResult<Value> | undefined> {\n\tif (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n\tconst result = await runCustomInteraction<PreviewMenuResult<Value>>(ctx, {\n\t\tsignal,\n\t\tisCurrent,\n\t\tcreate: ({ tui, theme, keybindings, complete }) => {\n\t\t\tlet selectedIndex = 0;\n\t\t\tlet scrollOffset = 0;\n\t\t\tlet lastMaximumScroll = 0;\n\t\t\tlet lastViewportSize = 1;\n\t\t\tlet disposed = false;\n\n\t\t\tconst requestRender = () => {\n\t\t\t\tif (!disposed) tui.requestRender();\n\t\t\t};\n\t\t\tconst moveSelection = (delta: number) => {\n\t\t\t\tif (items.length === 0) return;\n\t\t\t\tselectedIndex = (selectedIndex + delta + items.length) % items.length;\n\t\t\t\trequestRender();\n\t\t\t};\n\t\t\tconst movePreview = (offset: number) => {\n\t\t\t\tscrollOffset = Math.max(0, Math.min(offset, lastMaximumScroll));\n\t\t\t\trequestRender();\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\trender(width: number): string[] {\n\t\t\t\t\tconst safeWidth = Math.max(1, width);\n\t\t\t\t\tconst terminalRows = Number.isFinite(tui.terminal.rows)\n\t\t\t\t\t\t? Math.floor(tui.terminal.rows)\n\t\t\t\t\t\t: 24;\n\t\t\t\t\tconst availableRows = Math.max(1, terminalRows - RESERVED_HOST_ROWS);\n\t\t\t\t\tconst bodyLines = body(safeWidth).flatMap((line) =>\n\t\t\t\t\t\tline ? wrapTextWithAnsi(line, safeWidth) : [\"\"],\n\t\t\t\t\t);\n\t\t\t\t\tconst layout = allocateLayout(availableRows, items.length, bodyLines.length);\n\t\t\t\t\tlastViewportSize = layout.previewRows;\n\t\t\t\t\tlastMaximumScroll = Math.max(0, bodyLines.length - layout.previewRows);\n\t\t\t\t\tscrollOffset = Math.max(0, Math.min(scrollOffset, lastMaximumScroll));\n\t\t\t\t\tconst actionStart = actionWindowStart(selectedIndex, items.length, layout.actionRows);\n\t\t\t\t\tconst actionLines = items\n\t\t\t\t\t\t.slice(actionStart, actionStart + layout.actionRows)\n\t\t\t\t\t\t.map((item, index) => {\n\t\t\t\t\t\t\tconst absoluteIndex = actionStart + index;\n\t\t\t\t\t\t\tconst prefix = absoluteIndex === selectedIndex ? \"\u2192 \" : \" \";\n\t\t\t\t\t\t\treturn theme.fg(\n\t\t\t\t\t\t\t\tabsoluteIndex === selectedIndex ? \"accent\" : \"text\",\n\t\t\t\t\t\t\t\t`${prefix}${safeDisplayText(item.label)}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\tconst position = layout.positionRows\n\t\t\t\t\t\t? [theme.fg(\"dim\", previewPosition(scrollOffset, layout.previewRows, bodyLines.length))]\n\t\t\t\t\t\t: [];\n\t\t\t\t\tconst lines = [\n\t\t\t\t\t\t...(layout.titleRows ? [theme.fg(\"accent\", theme.bold(safeDisplayText(title)))] : []),\n\t\t\t\t\t\t...bodyLines.slice(scrollOffset, scrollOffset + layout.previewRows),\n\t\t\t\t\t\t...position,\n\t\t\t\t\t\t...actionLines,\n\t\t\t\t\t\t...(layout.hintRows ? [theme.fg(\"dim\", previewHint(keybindings))] : []),\n\t\t\t\t\t];\n\t\t\t\t\treturn lines.map((line) => truncateToWidth(line, safeWidth, \"\"));\n\t\t\t\t},\n\t\t\t\tinvalidate() {},\n\t\t\t\thandleInput(data: string) {\n\t\t\t\t\tif (disposed) return;\n\t\t\t\t\tif (matchesKey(data, Key.ctrl(\"c\"))) {\n\t\t\t\t\t\tcomplete({ kind: \"closed\" });\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\t\t\t\tcomplete({ kind: \"cancelled\" });\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.up\")) {\n\t\t\t\t\t\tmoveSelection(-1);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.down\")) {\n\t\t\t\t\t\tmoveSelection(1);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.pageUp\")) {\n\t\t\t\t\t\tmovePreview(scrollOffset - lastViewportSize);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.pageDown\")) {\n\t\t\t\t\t\tmovePreview(scrollOffset + lastViewportSize);\n\t\t\t\t\t} else if (matchesKey(data, Key.home)) {\n\t\t\t\t\t\tmovePreview(0);\n\t\t\t\t\t} else if (matchesKey(data, Key.end)) {\n\t\t\t\t\t\tmovePreview(lastMaximumScroll);\n\t\t\t\t\t} else if (keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\t\t\t\tconst item = items[selectedIndex];\n\t\t\t\t\t\tif (item) complete({ kind: \"selected\", value: item.value });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) return;\n\t\t\t\t\tdisposed = true;\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t});\n\tif (result.kind === \"completed\") return result.value;\n\tif (result.kind === \"error\") throw result.error;\n\tif (result.kind === \"stale\" && (signal?.aborted || !isCurrent())) return { kind: \"closed\" };\n\treturn undefined;\n}\n\ninterface PreviewLayout {\n\ttitleRows: number;\n\tpreviewRows: number;\n\tpositionRows: number;\n\tactionRows: number;\n\thintRows: number;\n}\n\nfunction allocateLayout(\n\tavailableRows: number,\n\tactionCount: number,\n\tbodyLineCount: number,\n): PreviewLayout {\n\tif (availableRows === 1) {\n\t\treturn { titleRows: 0, previewRows: 0, positionRows: 0, actionRows: 1, hintRows: 0 };\n\t}\n\tconst titleRows = availableRows >= 3 ? 1 : 0;\n\tconst hintRows = availableRows >= 3 ? 1 : 0;\n\tconst minimumPreviewRows = bodyLineCount > 0 && availableRows >= 4 ? 1 : 0;\n\tconst availableActionRows = Math.max(\n\t\t1,\n\t\tavailableRows - titleRows - hintRows - minimumPreviewRows,\n\t);\n\tconst actionRows = Math.min(Math.max(1, actionCount), availableActionRows);\n\tlet previewRows = Math.max(0, availableRows - titleRows - hintRows - actionRows);\n\tconst positionRows = previewRows >= 2 && bodyLineCount > previewRows ? 1 : 0;\n\tpreviewRows -= positionRows;\n\treturn { titleRows, previewRows, positionRows, actionRows, hintRows };\n}\n\nfunction actionWindowStart(selectedIndex: number, itemCount: number, viewportSize: number): number {\n\tif (itemCount <= viewportSize) return 0;\n\treturn Math.max(0, Math.min(selectedIndex, itemCount - viewportSize));\n}\n\nfunction previewPosition(offset: number, viewportSize: number, lineCount: number): string {\n\tif (lineCount === 0) return \"0/0\";\n\treturn `${offset + 1}-${Math.min(lineCount, offset + viewportSize)}/${lineCount}`;\n}\n\nfunction previewHint(keybindings: Pick<KeybindingsManager, \"getKeys\">): string {\n\tconst up = bindingText(keybindings, \"tui.select.up\");\n\tconst down = bindingText(keybindings, \"tui.select.down\");\n\tconst confirm = bindingText(keybindings, \"tui.select.confirm\");\n\tconst cancel = bindingText(keybindings, \"tui.select.cancel\", \"ctrl+c\");\n\tconst pageUp = bindingText(keybindings, \"tui.select.pageUp\");\n\tconst pageDown = bindingText(keybindings, \"tui.select.pageDown\");\n\treturn [\n\t\t...(up || down ? [`${[up, down].filter(Boolean).join(\"/\")} navigate`] : []),\n\t\t...(confirm ? [`${confirm} select`] : []),\n\t\t...(cancel ? [`${cancel} discard`] : []),\n\t\t\"ctrl+c close\",\n\t\t...(pageUp || pageDown ? [`${[pageUp, pageDown].filter(Boolean).join(\"/\")} preview`] : []),\n\t].join(\" \u2022 \");\n}\n\nfunction bindingText(\n\tkeybindings: Pick<KeybindingsManager, \"getKeys\">,\n\tbinding: Parameters<KeybindingsManager[\"getKeys\"]>[0],\n\texcluded?: string,\n): string {\n\treturn keybindings\n\t\t.getKeys(binding)\n\t\t.filter((key) => key !== excluded)\n\t\t.map((key) => {\n\t\t\tif (key === \"up\") return \"\u2191\";\n\t\t\tif (key === \"down\") return \"\u2193\";\n\t\t\tif (key === \"escape\") return \"esc\";\n\t\t\tif (key === \"return\") return \"enter\";\n\t\t\treturn safeDisplayText(key);\n\t\t})\n\t\t.join(\"/\");\n}\n\nfunction safeDisplayText(value: string): string {\n\treturn Array.from(stripVTControlCharacters(value), (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\tconst control = codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f);\n\t\treturn control ? \"\" : character;\n\t}).join(\"\");\n}\n", "import { stringify, type TomlTable, type TomlValue } from \"smol-toml\";\nimport type { StarshipConfig } from \"./config.js\";\nimport { MODULE_DEFINITIONS } from \"./modules/catalog.js\";\nimport type { ModuleOptionValue } from \"./modules/types.js\";\n\nexport function projectEffectiveConfig(config: StarshipConfig): TomlTable {\n\tconst projected: TomlTable = {\n\t\tformat: config.format,\n\t};\n\tif (config.palette !== undefined) projected.palette = config.palette;\n\tprojected.palettes = Object.fromEntries(\n\t\tsortedEntries(config.palettes).map(([name, colors]) => [name, sortedRecord(colors)]),\n\t);\n\tfor (const definition of MODULE_DEFINITIONS) {\n\t\tconst module = config.modules[definition.name];\n\t\tconst table: TomlTable = {\n\t\t\tformat: module.format,\n\t\t\tsymbol: module.symbol,\n\t\t};\n\t\tif (definition.styleDefaults) {\n\t\t\tif (definition.fallbackStyle) table.style = module.style;\n\t\t\tfor (const field of Object.keys(definition.styleDefaults)) {\n\t\t\t\ttable[field] = module.styles[field] ?? \"\";\n\t\t\t}\n\t\t} else if (!definition.displayDefaults) {\n\t\t\ttable.style = module.style;\n\t\t}\n\t\tif (definition.displayDefaults) {\n\t\t\ttable.display = module.display.map((entry) => ({ ...entry }));\n\t\t}\n\t\ttable.disabled = module.disabled;\n\t\tfor (const key of Object.keys(definition.options ?? {})) {\n\t\t\ttable[key] = cloneOptionValue(module.options[key]);\n\t\t}\n\t\tif (definition.name === \"extension_status\") {\n\t\t\ttable.separator = config.extensionStatus.separator;\n\t\t\ttable.max_statuses = config.extensionStatus.maxStatuses;\n\t\t\ttable.icons = sortedRecord(config.extensionStatus.icons);\n\t\t}\n\t\tprojected[definition.name] = table;\n\t}\n\treturn projected;\n}\n\nexport function serializeEffectiveConfig(config: StarshipConfig): string {\n\treturn stringify(projectEffectiveConfig(config));\n}\n\nfunction cloneOptionValue(value: ModuleOptionValue | undefined): TomlValue {\n\tif (value === undefined) throw new Error(\"Missing normalized module option\");\n\tif (Array.isArray(value)) return [...(value as readonly string[])];\n\tif (typeof value === \"object\") {\n\t\treturn sortedRecord(value as Readonly<Record<string, string>>);\n\t}\n\treturn value;\n}\n\nfunction sortedRecord(values: Readonly<Record<string, string>>): Record<string, string> {\n\treturn Object.fromEntries(sortedEntries(values));\n}\n\nfunction sortedEntries<Value>(values: Readonly<Record<string, Value>>): Array<[string, Value]> {\n\treturn Object.entries(values).sort(([left], [right]) =>\n\t\tleft < right ? -1 : left > right ? 1 : 0,\n\t);\n}\n", "export const BRACKETED_SEGMENTS_PRESET = String.raw`# Font-safe bracketed segments inspired by Starship.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = '[\\[$symbol\\]]($style) '\nstyle = \"bold white\"\n\n[model]\nformat = '[\\[$symbol $model\\]]($style) '\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = '[\\[$symbol $level\\]]($style) '\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = '[\\[$symbol $path\\]]($style) '\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = '[\\[$symbol $branch\\]]($style) '\nsymbol = \"git\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = '[\\[$all_status( $ahead_behind)\\]]($style) '\nstyle = \"red bold\"\n\n[activity]\nformat = '[\\[$text\\]]($style) '\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = '[\\[$symbol $percentage\\]]($style) '\nsymbol = \"ctx\"\n\n[time]\nformat = '[\\[$time\\]]($style)'\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const CATPPUCCIN_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Catppuccin Powerline preset.\nformat = \"[\uE0B6](red)$brand$model[\uE0B0](bg:peach fg:red)$directory[\uE0B0](bg:yellow fg:peach)$git_branch$git_status[\uE0B0](fg:yellow bg:green)$thinking$activity[\uE0B0](fg:green bg:sapphire)$context[\uE0B0](fg:sapphire bg:lavender)$time[\uE0B4](fg:lavender)\"\npalette = \"catppuccin_mocha\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:crust bg:red bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:red bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:peach bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:crust bg:yellow bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:crust bg:green bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:crust bg:green bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:crust bg:sapphire bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"sapphire\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:crust bg:lavender bold\"\n\n[palettes.catppuccin_mocha]\nred = \"#f38ba8\"\npeach = \"#fab387\"\nyellow = \"#f9e2af\"\ngreen = \"#a6e3a1\"\nsapphire = \"#74c7ec\"\nlavender = \"#b4befe\"\ncrust = \"#11111b\"\n\n[palettes.catppuccin_frappe]\nred = \"#e78284\"\npeach = \"#ef9f76\"\nyellow = \"#e5c890\"\ngreen = \"#a6d189\"\nsapphire = \"#85c1dc\"\nlavender = \"#babbf1\"\ncrust = \"#232634\"\n\n[palettes.catppuccin_latte]\nred = \"#d20f39\"\npeach = \"#fe640b\"\nyellow = \"#df8e1d\"\ngreen = \"#40a02b\"\nsapphire = \"#209fb5\"\nlavender = \"#7287fd\"\ncrust = \"#dce0e8\"\n\n[palettes.catppuccin_macchiato]\nred = \"#ed8796\"\npeach = \"#f5a97f\"\nyellow = \"#eed49f\"\ngreen = \"#a6da95\"\nsapphire = \"#7dc4e4\"\nlavender = \"#b7bdf8\"\ncrust = \"#181926\"\n`;\n", "export const GRUVBOX_RAINBOW_PRESET = `# Pi-native adaptation of Starship's Gruvbox Rainbow preset.\nformat = \"[\uE0B6](color_orange)$brand$model[\uE0B0](bg:color_yellow fg:color_orange)$directory[\uE0B0](fg:color_yellow bg:color_aqua)$git_branch$git_status[\uE0B0](fg:color_aqua bg:color_blue)$thinking$activity[\uE0B0](fg:color_blue bg:color_bg3)$context[\uE0B0](fg:color_bg3 bg:color_bg1)$time[\uE0B4](fg:color_bg1)\"\npalette = \"gruvbox_dark\"\n\n[palettes.gruvbox_dark]\ncolor_fg0 = \"#fbf1c7\"\ncolor_bg1 = \"#3c3836\"\ncolor_bg3 = \"#665c54\"\ncolor_blue = \"#458588\"\ncolor_aqua = \"#689d6a\"\ncolor_green = \"#98971a\"\ncolor_orange = \"#d65d0e\"\ncolor_purple = \"#b16286\"\ncolor_red = \"#cc241d\"\ncolor_yellow = \"#d79921\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_orange bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_yellow bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:color_fg0 bg:color_aqua bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:color_fg0 bg:color_blue bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:color_fg0 bg:color_bg3 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"color_bg3\"\nhidden = false\n\n[time]\nformat = \"[ \uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:color_fg0 bg:color_bg1 bold\"\n`;\n", "export const JETPACK_PRESET = `# Pi-native adaptation of Starship's Jetpack preset.\n# Left-side session activity and right-side workspace context meet at $fill.\nformat = \"$activity$context$fill$directory$git_branch$git_state$git_status$time\"\n\n[activity]\nformat = \"[\u25C4 $text ]($style)\"\nsymbol = \"\"\nstyle = \"italic white\"\n\n[context]\nformat = \"[\u25EF $percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold purple\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"italic blue\"\ntruncation_length = 2\ntruncation_symbol = \"\u25A1 \"\nhome_symbol = \"\u2302\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style)\"\nsymbol = \"\u25B3 \"\nstyle = \"italic bright-blue\"\ntruncation_length = 11\ntruncation_symbol = \"\u22EF\"\n\n[git_state]\nformat = \"([\u23AA$state $progress_current/$progress_total\u23A5]($style))\"\nsymbol = \"\"\nstyle = \"italic bright-purple\"\n\n[git_status]\nformat = \"([\u23AA$all_status$ahead_behind\u23A5]($style))\"\nstyle = \"bold italic bright-blue\"\n\n[time]\nformat = \"[ $time]($style)\"\nsymbol = \"\"\nstyle = \"italic dimmed white\"\n`;\n", "export const MINIMAL_PRESET = `# A compact, font-safe Pi footer.\nformat = \"$model$directory$git_branch$activity\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[git:$branch]($style) \"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[activity]\nformat = \"[$text]($style)\"\nsymbol = \"*\"\nstyle = \"bold yellow\"\n`;\n", "export const NERD_FONT_SYMBOLS_PRESET = `# Balanced Pi footer with Nerd Font symbols.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nsymbol = \"\uE285\"\n\n[model]\nsymbol = \"\uDB81\uDEA9\"\n\n[thinking]\nsymbol = \"\uDB81\uDD1F\"\n\n[directory]\nsymbol = \"\uDB80\uDE4B\"\n\n[git_branch]\nsymbol = \"\uF418\"\n\n[activity]\nsymbol = \"\uDB81\uDC6E\"\n\n[context]\nsymbol = \"\uDB80\uDF5B\"\n\n[time]\nsymbol = \"\uF43A\"\n`;\n", "export const NO_EMPTY_ICONS_PRESET = `# Pi-native adaptation of Starship's No Empty Icons preset.\n# Each label lives inside the same conditional group as its value.\nformat = \"$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[model]\nformat = \"([model $model]($style) )\"\nsymbol = \"\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"([thinking $level]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"([in $path]($style) )\"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"([on $branch]($style) )\"\nsymbol = \"\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"([$all_status$ahead_behind]($style) )\"\nstyle = \"red bold\"\n\n[activity]\nformat = \"([while $text]($style) )\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"([using $percentage context]($style) )\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"([at $time]($style))\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_NERD_FONT_PRESET = `# Pi-native adaptation of Starship's No Nerd Font preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u2726\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"\u25C6\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"\u25C7\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"\u2302\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"\u2387\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\u25CF\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"\u25CC\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"\u25F4\"\nstyle = \"bold yellow\"\n`;\n", "export const NO_RUNTIME_VERSIONS_PRESET = `# Pi-native adaptation of Starship's No Runtime Versions preset.\n# Model and thinking modules retain presence symbols while hiding version-like details.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"\u03C0\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol]($style) \"\nsymbol = \"AI\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol]($style) \"\nsymbol = \"think\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol$branch]($style) \"\nsymbol = \"git:\"\nstyle = \"bold purple\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$symbol]($style) \"\nsymbol = \"run\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$percentage]($style) \"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bold yellow\"\n`;\n", "export const PASTEL_POWERLINE_PRESET = `# Pi-native adaptation of Starship's Pastel Powerline preset.\nformat = \"[\uE0B6](#9A348E)$brand$model[\uE0B0](bg:#DA627D fg:#9A348E)$directory[\uE0B0](fg:#DA627D bg:#FCA17D)$git_branch$git_status[\uE0B0](fg:#FCA17D bg:#86BBD8)$thinking$activity[\uE0B0](fg:#86BBD8 bg:#06969A)$context[\uE0B0](fg:#06969A bg:#33658A)$time[\uE0B4](fg:#33658A)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#9A348E bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#DA627D bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#1f1f1f bg:#FCA17D bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#1f1f1f bg:#86BBD8 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#ffffff bg:#06969A bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#06969A\"\nhidden = false\n\n[time]\nformat = \"[ \u2665 $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#ffffff bg:#33658A bold\"\n`;\n", "export const PLAIN_TEXT_SYMBOLS_PRESET = `# Pi-native adaptation of Starship's Plain Text Symbols preset.\nformat = \"$brand$model$thinking$directory$git_branch$git_status$activity$context$time\"\n\n[brand]\nformat = \"[$symbol]($style) \"\nsymbol = \"pi\"\nstyle = \"bold white\"\n\n[model]\nformat = \"[$symbol $model]($style) \"\nsymbol = \"model\"\nstyle = \"bold blue\"\n\n[thinking]\nformat = \"[$symbol $level]($style) \"\nsymbol = \"thinking\"\nstyle = \"bold purple\"\n\n[directory]\nformat = \"[$symbol $path]($style) \"\nsymbol = \"dir\"\nstyle = \"cyan bold\"\n\n[git_branch]\nformat = \"[$symbol $branch]($style) \"\nsymbol = \"git\"\nstyle = \"bold purple\"\ntruncation_symbol = \"...\"\n\n[git_status]\nformat = \"[$all_status( $ahead_behind)]($style) \"\nstyle = \"red bold\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"active\"\nstyle = \"bold yellow\"\n\n[context]\nformat = \"[$symbol $percentage]($style) \"\nsymbol = \"context\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bold green\"\nhidden = false\n\n[time]\nformat = \"[$symbol $time]($style)\"\nsymbol = \"time\"\nstyle = \"bold yellow\"\n`;\n", "export const PURE_PRESET = `# Pi-native adaptation of Starship's Pure preset.\nformat = \"$directory$git_branch$git_state$git_status$activity\\\\n$model$thinking$context$fill$time\"\n\n[directory]\nformat = \"[$path]($style) \"\nsymbol = \"\"\nstyle = \"blue\"\n\n[git_branch]\nformat = \"[$branch]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_state]\nformat = '([($state( $progress_current/$progress_total))]($style) )'\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[git_status]\nformat = \"[(*$all_status)](218) [$ahead_behind]($style) \"\nstyle = \"cyan\"\n\n[activity]\nformat = \"[$text]($style) \"\nsymbol = \"\"\nstyle = \"yellow\"\n\n[model]\nformat = \"[$model]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[thinking]\nformat = \"[$level]($style) \"\nsymbol = \"\"\nstyle = \"bright-black\"\n\n[context]\nformat = \"[$percentage]($style)\"\nsymbol = \"\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"bright-black\"\nhidden = false\n\n[fill]\nsymbol = \" \"\nstyle = \"none\"\n\n[time]\nformat = \"[$time]($style)\"\nsymbol = \"\"\nstyle = \"bright-black\"\n`;\n", "export const TOKYO_NIGHT_PRESET = `# Pi-native adaptation of Starship's Tokyo Night preset.\nformat = \"[\u2591\u2592\u2593](#a3aed2)$brand$model[\uE0B4](bg:#769ff0 fg:#a3aed2)$directory[\uE0B4](fg:#769ff0 bg:#394260)$git_branch$git_status[\uE0B4](fg:#394260 bg:#212736)$thinking$activity[\uE0B4](fg:#212736 bg:#1d2230)$context$time[\uE0B4](fg:#1d2230)\"\n\n[brand]\nformat = \"[ $symbol ]($style)\"\nsymbol = \"\uE285\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[model]\nformat = \"[$model ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#090c0c bg:#a3aed2 bold\"\n\n[directory]\nformat = \"[ $path ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#e3e5e5 bg:#769ff0 bold\"\ntruncation_length = 3\ntruncation_symbol = \"\u2026/\"\n\n[git_branch]\nformat = \"[ $symbol $branch ]($style)\"\nsymbol = \"\uF418\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[git_status]\nformat = \"[$all_status$ahead_behind ]($style)\"\nstyle = \"fg:#769ff0 bg:#394260 bold\"\n\n[thinking]\nformat = \"[ $symbol $level ]($style)\"\nsymbol = \"\uDB81\uDD1F\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[activity]\nformat = \"[ $text ]($style)\"\nsymbol = \"\uDB81\uDC6E\"\nstyle = \"fg:#769ff0 bg:#212736 bold\"\n\n[context]\nformat = \"[ $symbol $percentage ](fg:#a0a9cb bg:#1d2230 bold)\"\nsymbol = \"\uDB80\uDF5B\"\n\n[[context.display]]\nthreshold = 0\nstyle = \"#1d2230\"\nhidden = false\n\n[time]\nformat = \"[\uF43A $time ]($style)\"\nsymbol = \"\"\nstyle = \"fg:#a0a9cb bg:#1d2230 bold\"\n`;\n", "import { BRACKETED_SEGMENTS_PRESET } from \"./bracketed-segments.js\";\nimport { CATPPUCCIN_POWERLINE_PRESET } from \"./catppuccin-powerline.js\";\nimport { GRUVBOX_RAINBOW_PRESET } from \"./gruvbox-rainbow.js\";\nimport { JETPACK_PRESET } from \"./jetpack.js\";\nimport { MINIMAL_PRESET } from \"./minimal.js\";\nimport { NERD_FONT_SYMBOLS_PRESET } from \"./nerd-font-symbols.js\";\nimport { NO_EMPTY_ICONS_PRESET } from \"./no-empty-icons.js\";\nimport { NO_NERD_FONT_PRESET } from \"./no-nerd-font.js\";\nimport { NO_RUNTIME_VERSIONS_PRESET } from \"./no-runtime-versions.js\";\nimport { PASTEL_POWERLINE_PRESET } from \"./pastel-powerline.js\";\nimport { PLAIN_TEXT_SYMBOLS_PRESET } from \"./plain-text-symbols.js\";\nimport { PURE_PRESET } from \"./pure-preset.js\";\nimport { TOKYO_NIGHT_PRESET } from \"./tokyo-night.js\";\n\nexport interface StarshipPreset {\n\tid:\n\t\t| \"minimal\"\n\t\t| \"bracketed-segments\"\n\t\t| \"catppuccin-powerline\"\n\t\t| \"gruvbox-rainbow\"\n\t\t| \"jetpack\"\n\t\t| \"nerd-font-symbols\"\n\t\t| \"no-empty-icons\"\n\t\t| \"no-nerd-font\"\n\t\t| \"no-runtime-versions\"\n\t\t| \"pastel-powerline\"\n\t\t| \"plain-text-symbols\"\n\t\t| \"pure-preset\"\n\t\t| \"tokyo-night\";\n\tlabel: string;\n\tdescription: string;\n\trequiresNerdFont: boolean;\n\trawDocument: string;\n}\n\nexport const STARSHIP_PRESETS = [\n\t{\n\t\tid: \"minimal\",\n\t\tlabel: \"Minimal\",\n\t\tdescription: \"Compact Pi essentials \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: MINIMAL_PRESET,\n\t},\n\t{\n\t\tid: \"bracketed-segments\",\n\t\tlabel: \"Bracketed Segments\",\n\t\tdescription: \"Balanced Pi and Git details in brackets \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: BRACKETED_SEGMENTS_PRESET,\n\t},\n\t{\n\t\tid: \"catppuccin-powerline\",\n\t\tlabel: \"Catppuccin Powerline\",\n\t\tdescription: \"Mocha connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: CATPPUCCIN_POWERLINE_PRESET,\n\t},\n\t{\n\t\tid: \"gruvbox-rainbow\",\n\t\tlabel: \"Gruvbox Rainbow\",\n\t\tdescription: \"Warm Gruvbox connected segments \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: GRUVBOX_RAINBOW_PRESET,\n\t},\n\t{\n\t\tid: \"jetpack\",\n\t\tlabel: \"Jetpack\",\n\t\tdescription: \"Airy geometric left/right layout \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: JETPACK_PRESET,\n\t},\n\t{\n\t\tid: \"nerd-font-symbols\",\n\t\tlabel: \"Nerd Font Symbols\",\n\t\tdescription: \"Balanced default layout with icon-rich symbols \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: NERD_FONT_SYMBOLS_PRESET,\n\t},\n\t{\n\t\tid: \"no-empty-icons\",\n\t\tlabel: \"No Empty Icons\",\n\t\tdescription: \"Conditional labels never appear without values \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_EMPTY_ICONS_PRESET,\n\t},\n\t{\n\t\tid: \"no-nerd-font\",\n\t\tlabel: \"No Nerd Font\",\n\t\tdescription: \"Portable Unicode symbols without private-use glyphs \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_NERD_FONT_PRESET,\n\t},\n\t{\n\t\tid: \"no-runtime-versions\",\n\t\tlabel: \"No Runtime Versions\",\n\t\tdescription: \"Presence indicators without model or thinking details \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: NO_RUNTIME_VERSIONS_PRESET,\n\t},\n\t{\n\t\tid: \"pastel-powerline\",\n\t\tlabel: \"Pastel Powerline\",\n\t\tdescription: \"Pastel connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: PASTEL_POWERLINE_PRESET,\n\t},\n\t{\n\t\tid: \"plain-text-symbols\",\n\t\tlabel: \"Plain Text Symbols\",\n\t\tdescription: \"Plain words replace pictograms \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: PLAIN_TEXT_SYMBOLS_PRESET,\n\t},\n\t{\n\t\tid: \"pure-preset\",\n\t\tlabel: \"Pure Preset\",\n\t\tdescription: \"Clean two-line workspace and session context \u00B7 font-safe\",\n\t\trequiresNerdFont: false,\n\t\trawDocument: PURE_PRESET,\n\t},\n\t{\n\t\tid: \"tokyo-night\",\n\t\tlabel: \"Tokyo Night\",\n\t\tdescription: \"Cool connected color blocks \u00B7 requires Nerd Font\",\n\t\trequiresNerdFont: true,\n\t\trawDocument: TOKYO_NIGHT_PRESET,\n\t},\n] as const satisfies readonly StarshipPreset[];\n\nexport function getStarshipPreset(id: StarshipPreset[\"id\"]): StarshipPreset {\n\tconst preset = STARSHIP_PRESETS.find((candidate) => candidate.id === id);\n\tif (!preset) throw new Error(`Unknown pi-starship preset: ${id}`);\n\treturn preset;\n}\n\nexport function presetForDocument(rawDocument: string | undefined): StarshipPreset | undefined {\n\treturn STARSHIP_PRESETS.find((preset) => preset.rawDocument === rawDocument);\n}\n", "import { stripVTControlCharacters } from \"node:util\";\nimport type { StatuslineInspection } from \"./modules/inspection.js\";\n\nexport function formatFooterExplanation(inspection: StatuslineInspection | undefined): string {\n\tif (!inspection) {\n\t\treturn safeLines([\n\t\t\t\"Footer inspection is unavailable until the TUI footer is ready.\",\n\t\t\t\"No collection work was started.\",\n\t\t]);\n\t}\n\tif (inspection.showing.length === 0) {\n\t\treturn safeLines([\n\t\t\t\"No modules are currently showing.\",\n\t\t\t\"Open Modules to inspect empty, disabled, or unreachable modules.\",\n\t\t]);\n\t}\n\treturn safeLines(\n\t\tinspection.showing.flatMap((module, index) => [\n\t\t\t...(index > 0 ? [\"\"] : []),\n\t\t\tmodule.name,\n\t\t\t...previewLines(module.preview),\n\t\t\tmodule.description,\n\t\t]),\n\t);\n}\n\nfunction previewLines(preview: string): string[] {\n\tconst lines = preview ? preview.split(\"\\n\") : [\"(no text)\"];\n\treturn lines.map((line, index) => `${index === 0 ? \"Value: \" : \" \"}${line}`);\n}\n\nfunction safeLines(lines: readonly string[]): string {\n\treturn lines.map(safeDisplayText).join(\"\\n\");\n}\n\nfunction safeDisplayText(value: string): string {\n\treturn Array.from(stripVTControlCharacters(value), (character) => {\n\t\tconst codePoint = character.codePointAt(0) ?? 0;\n\t\treturn codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? \"\" : character;\n\t}).join(\"\");\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { runLiveChoice } from \"@narumitw/pi-tui-kit\";\nimport type { StarshipPreset } from \"./presets/catalog.js\";\n\nexport type PresetPickerResult =\n\t| { kind: \"apply\"; presetId: StarshipPreset[\"id\"] }\n\t| { kind: \"customize\"; presetId: StarshipPreset[\"id\"] }\n\t| { kind: \"back\" }\n\t| { kind: \"close\" };\n\nexport interface PresetPickerOptions {\n\tpresets: readonly StarshipPreset[];\n\tactivePresetId?: StarshipPreset[\"id\"];\n\tinitialPresetId?: StarshipPreset[\"id\"];\n\tsignal: AbortSignal;\n\tisCurrent(): boolean;\n\tpreview(preset: StarshipPreset): void;\n}\n\nexport async function showPresetPicker(\n\tctx: ExtensionCommandContext,\n\toptions: PresetPickerOptions,\n): Promise<PresetPickerResult> {\n\tconst current =\n\t\toptions.presets.find((preset) => preset.id === options.activePresetId)?.label ??\n\t\t\"Custom configuration\";\n\tconst result = await runLiveChoice(ctx, {\n\t\ttitle: `Presets \u00B7 current: ${current}`,\n\t\titems: options.presets.map((preset) => ({\n\t\t\tid: preset.id,\n\t\t\tlabel: preset.label,\n\t\t\tdescription:\n\t\t\t\tpreset.id === options.activePresetId\n\t\t\t\t\t? `Currently applied \u00B7 ${preset.description}`\n\t\t\t\t\t: preset.description,\n\t\t\tdetails: [\n\t\t\t\t`Selected: ${preset.label} \u00B7 ${preset.requiresNerdFont ? \"requires Nerd Font\" : \"font-safe\"}`,\n\t\t\t],\n\t\t\tconfirmationDisabled: preset.id === options.activePresetId,\n\t\t\tconfirmationDisabledReason: \"Already applied; press e to customize\",\n\t\t})),\n\t\tcurrentItemId: options.activePresetId,\n\t\tinitialItemId: options.initialPresetId ?? options.activePresetId,\n\t\tviewportSize: Math.min(options.presets.length, 10),\n\t\thint: \"back\",\n\t\tnavigationLabel: \"live preview\",\n\t\tconfirmLabel: \"apply\",\n\t\tshortcuts: [{ id: \"customize\", keys: [\"e\", \"shift+e\"], label: \"customize\" }],\n\t\tonSelectionChange: ({ item }) => {\n\t\t\tconst preset = options.presets.find((candidate) => candidate.id === item.id);\n\t\t\tif (preset) options.preview(preset);\n\t\t},\n\t\tsignal: options.signal,\n\t\tisCurrent: options.isCurrent,\n\t});\n\tif (result.kind === \"selected\") return { kind: \"apply\", presetId: result.itemId };\n\tif (result.kind === \"shortcut\") {\n\t\treturn { kind: \"customize\", presetId: result.itemId };\n\t}\n\tif (result.kind === \"closed\" && result.reason === \"back\") return { kind: \"back\" };\n\treturn { kind: \"close\" };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,4BAA4B;;;ACDrC,SAAS,gCAAgC;AAEzC,SAAS,KAAK,YAAY,iBAAiB,wBAAwB;AACnE,SAAS,4BAA4B;AAErC,IAAM,qBAAqB;AAY3B,eAAsB,sBACrB,KACA,OACA,MACA,OACA,QACA,YAA2B,MAAM,CAAC,QAAQ,SACM;AAChD,MAAI,QAAQ,WAAW,CAAC,UAAU,EAAG,QAAO,EAAE,MAA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