@narumitw/pi-starship 0.62.0 → 0.63.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 +10 -9
- package/dist/chunks/{chunk-HPZTMIZS.ts → chunk-63R6R5DH.ts} +41 -8
- package/dist/chunks/chunk-63R6R5DH.ts.map +7 -0
- package/dist/chunks/{chunk-PWTSHSP3.ts → chunk-A65IOGL6.ts} +6 -7
- package/dist/chunks/chunk-A65IOGL6.ts.map +7 -0
- package/dist/chunks/{chunk-43VIENBN.ts → chunk-Y24TJYG6.ts} +7 -7
- package/dist/chunks/{chunk-43VIENBN.ts.map → chunk-Y24TJYG6.ts.map} +2 -2
- package/dist/chunks/{command-configuration-menu-S2LXCOJG.ts → command-configuration-menu-YOLN2SPR.ts} +3 -3
- package/dist/chunks/{command-settings-chat-O34BEU4X.ts → command-settings-chat-5AHP3JGV.ts} +162 -79
- package/dist/chunks/command-settings-chat-5AHP3JGV.ts.map +7 -0
- package/dist/chunks/{commands-ZYIJVIEJ.ts → commands-IOG2PL67.ts} +23 -19
- package/dist/chunks/commands-IOG2PL67.ts.map +7 -0
- package/dist/index.ts +114 -58
- package/dist/index.ts.map +3 -3
- package/package.json +1 -1
- package/skills/configure-pi-starship/SKILL.md +3 -1
- package/skills/configure-pi-starship/references/configuration.md +14 -12
- package/src/command-commit.ts +41 -7
- package/src/command-configuration.ts +6 -10
- package/src/command-settings-chat.ts +2 -44
- package/src/commands.ts +22 -26
- package/src/config.ts +6 -6
- package/src/pi-starship.ts +154 -88
- package/src/settings-chat-transcript.ts +54 -2
- package/src/settings-chat-ui.ts +150 -50
- package/dist/chunks/chunk-HPZTMIZS.ts.map +0 -7
- package/dist/chunks/chunk-PWTSHSP3.ts.map +0 -7
- package/dist/chunks/command-settings-chat-O34BEU4X.ts.map +0 -7
- package/dist/chunks/commands-ZYIJVIEJ.ts.map +0 -7
- /package/dist/chunks/{command-configuration-menu-S2LXCOJG.ts.map → command-configuration-menu-YOLN2SPR.ts.map} +0 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The extension parses and renders the footer itself, so it does not need the `sta
|
|
|
10
10
|
|
|
11
11
|
## ✨ Features
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- Keeps Pi's native footer until settings are saved and offers Starship presets plus a Pi-native Minimal preset.
|
|
14
14
|
- Supports root and module formats, conditional groups, `$all`, styles, palettes, and width-aware `$fill` alignment.
|
|
15
15
|
- Selects provider, model, and thinking styles from exact runtime values with ordered module rules.
|
|
16
16
|
- Provides Pi, model, usage, Git, pull request, package, language, environment, deployment, cloud, and execution modules, with usage totals including persisted cache warming.
|
|
@@ -48,7 +48,7 @@ Do not enable this with `@narumitw/pi-statusline`: both own Pi's footer, and Pi
|
|
|
48
48
|
|
|
49
49
|
## 🚀 Quick start
|
|
50
50
|
|
|
51
|
-
Start Pi with the extension to
|
|
51
|
+
Start Pi with the extension to keep Pi's native footer without creating a settings file.
|
|
52
52
|
Run `/starship` and choose **Configure with agent** for edits and explanations, or choose a preset.
|
|
53
53
|
|
|
54
54
|
The bundled configuration skill is manual-only and is not available for automatic model invocation.
|
|
@@ -76,7 +76,7 @@ It does not cover general TOML, shell Starship configuration, extension source d
|
|
|
76
76
|
All routes support TUI and RPC with the exceptions above and reject unknown or trailing arguments.
|
|
77
77
|
Print and JSON modes produce no command output; the footer runs only in TUI mode.
|
|
78
78
|
Profiles, history, preset selection, configuration chat, and Gist sharing and import are menu-only, not extra subcommands.
|
|
79
|
-
|
|
79
|
+
**Restore built-in…** archives the exact settings bytes in History, removes the active settings document, and returns to Pi's native footer. It requires an existing document, including a saved built-in Starship example.
|
|
80
80
|
Configuration shows source, path, health, and warnings above its reload, Gist, and History operations. Configured selection page-up/page-down actions scroll long summaries without changing the selected operation.
|
|
81
81
|
|
|
82
82
|
## ⚙️ Settings
|
|
@@ -109,7 +109,7 @@ See [Configuration and format](./skills/configure-pi-starship/references/configu
|
|
|
109
109
|
Use `/starship` for interactive configuration, preview, diagnostics, presets, and recovery.
|
|
110
110
|
Manual file edits load at the next `session_start`, including `/reload`.
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
The built-in Starship example remains an editing seed; saving it enables a Starship footer, not Pi's native footer.
|
|
113
113
|
Module references cover bounded regex substitutions/context rules, component version formats, Git templates/controls, clock zones/ranges, Python argv alternatives, environment detectors, requirement styling, and private-package visibility.
|
|
114
114
|
The six Jujutsu/system modules require explicit `disabled = false` plus a root reference or `$all`; see [module behavior](./skills/configure-pi-starship/references/modules.md#jujutsu-modules).
|
|
115
115
|
|
|
@@ -131,23 +131,24 @@ These tool limits are not an operating-system sandbox for extension code.
|
|
|
131
131
|
The native editor retains editing, newline, submission, and large-paste behavior.
|
|
132
132
|
While the agent runs, normal submission queues a steering message for the next assistant turn; `app.message.followUp` queues a message after the current task finishes.
|
|
133
133
|
The default follow-up key is Alt+Enter, or Ctrl+Q on Windows and WSL; when idle, it submits normally.
|
|
134
|
+
Tool output starts expanded. Press Ctrl+O to collapse or expand all tool output in this conversation; this follows Pi's `app.tools.expand` keybinding and does not change the main conversation.
|
|
134
135
|
Pending messages appear in gray above the editor, with a count on its upper border; the view shows at most three pending rows.
|
|
135
136
|
Use `app.message.dequeue` (Alt+Up, or Alt+Q on Windows and WSL) to restore queued messages to the editor.
|
|
136
137
|
These message shortcuts use Pi's configured bindings and native precedence, including explicit history actions taking priority.
|
|
137
|
-
The configured cancel action stops an active response and restores undelivered messages to the editor; when idle, it
|
|
138
|
+
The configured cancel action stops an active response and restores undelivered messages to the editor; when idle, it leaves the conversation open without opening a menu.
|
|
138
139
|
Failed or aborted responses also restore undelivered messages without restarting automatically.
|
|
139
|
-
Editor actions win conflicting cancel bindings, and Escape remains a
|
|
140
|
+
Editor actions win conflicting cancel bindings, and Escape remains a stop fallback unless assigned to an editor action.
|
|
140
141
|
Ctrl+C discards the entire flow, including when cancellation is remapped, and restores the current session's active footer.
|
|
141
142
|
The fullscreen chat reuses Pi's native user, assistant, and tool message components, including Markdown, user-message backgrounds, and message spacing.
|
|
142
143
|
The editor and footer preview stay at the bottom while the transcript grows above them.
|
|
143
144
|
Short gray labels on the editor borders show draft status and controls.
|
|
144
145
|
The full-width preview has no extra separator, with its last line at the terminal bottom, matching the saved footer's position.
|
|
145
146
|
At short heights, error details yield first; if the whole preview cannot fit beside the editor, it is hidden rather than clipped.
|
|
146
|
-
The view shows recent output with expanded, read-only tool results
|
|
147
|
-
Choose **Continue** in
|
|
147
|
+
The view shows recent output with expanded, read-only tool results.
|
|
148
|
+
Choose **Continue** in the exact-draft save review; cancelling discards the temporary draft but keeps any previously saved profile.
|
|
148
149
|
|
|
149
150
|
**The agent never writes the active settings file or profiles.** When idle with a valid draft, press **Ctrl+S** to save it as a profile; the gray editor-border hint shows the active save key.
|
|
150
|
-
If Ctrl+S conflicts with a native editing, cancel, or message action, **F2** is used instead. If both are reserved,
|
|
151
|
+
If Ctrl+S conflicts with a native editing, cancel, or message action, **F2** is used instead. If both are reserved, saving is unavailable until one shortcut is free; no save shortcut is shown.
|
|
151
152
|
Review the exact draft and enter a profile name; invalid or existing names require another name, without overwriting profiles.
|
|
152
153
|
After the profile is saved, a separate confirmation asks whether to apply it to the current footer without reload, retaining the previous active document in History.
|
|
153
154
|
Declining closes the chat, keeps the saved profile, and leaves active settings unchanged; an application failure also retains the profile.
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
readProfile,
|
|
13
13
|
renameProfile,
|
|
14
14
|
saveProfile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Y24TJYG6.ts";
|
|
16
16
|
import {
|
|
17
17
|
BUILT_IN_EXAMPLE,
|
|
18
18
|
ConfigPublicationError,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
readConfigDocumentSnapshot,
|
|
23
23
|
removeConfigDocumentIfMatches,
|
|
24
24
|
validateConfigDocument
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-A65IOGL6.ts";
|
|
26
26
|
|
|
27
27
|
// src/command-commit.ts
|
|
28
28
|
import { withFileMutationQueue } from "@earendil-works/pi-coding-agent";
|
|
@@ -37,9 +37,12 @@ function commitOwnerCurrent(options, owner, expected) {
|
|
|
37
37
|
const loaded = options.getLoaded();
|
|
38
38
|
return !owner.signal.aborted && owner.isCurrent() && loaded.rawDocument === expected.previous.rawDocument && loaded.source === expected.previous.source && JSON.stringify(loaded.diagnostics) === JSON.stringify(expected.previous.diagnostics) && options.getLoadedRevision?.() === expected.revision;
|
|
39
39
|
}
|
|
40
|
-
async function commitActiveDocument(ctx, options, candidate, owner, expected, allowInvalid = false, checkCandidate) {
|
|
40
|
+
async function commitActiveDocument(ctx, options, candidate, owner, expected, allowInvalid = false, checkCandidate, restoreNative = false) {
|
|
41
41
|
const raw = candidate.rawDocument;
|
|
42
|
-
if (
|
|
42
|
+
if (restoreNative) {
|
|
43
|
+
if (raw !== void 0 || candidate.source !== "built-in" || candidate.diagnostics.length > 0)
|
|
44
|
+
throw new Error("The native footer candidate is invalid");
|
|
45
|
+
} else if (raw === void 0) throw new Error("The candidate settings document is unavailable");
|
|
43
46
|
return withFileMutationQueue(options.settingsPath, async () => {
|
|
44
47
|
if (!commitOwnerCurrent(options, owner, expected)) return "cancel";
|
|
45
48
|
checkCandidate?.();
|
|
@@ -53,8 +56,10 @@ async function commitActiveDocument(ctx, options, candidate, owner, expected, al
|
|
|
53
56
|
const invalid = expected.previous.diagnostics.some((item) => item.severity === "error");
|
|
54
57
|
if (invalid && !allowInvalid)
|
|
55
58
|
throw new Error("The active settings document is invalid. Use explicit repair or recovery before replacing it.");
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
if (raw !== void 0) {
|
|
60
|
+
validateConfigDocument(options.settingsPath, raw);
|
|
61
|
+
if (previousBytes?.equals(Buffer.from(raw))) return "applied";
|
|
62
|
+
}
|
|
58
63
|
let recoveryPath;
|
|
59
64
|
if (previousBytes !== void 0) {
|
|
60
65
|
recoveryPath = (options.archive ?? archiveConfigDocument)(options.settingsPath, previousBytes).path;
|
|
@@ -68,8 +73,26 @@ async function commitActiveDocument(ctx, options, candidate, owner, expected, al
|
|
|
68
73
|
}
|
|
69
74
|
let saved;
|
|
70
75
|
try {
|
|
71
|
-
|
|
76
|
+
if (raw === void 0) {
|
|
77
|
+
if (previousBytes !== void 0) {
|
|
78
|
+
if (!expected.disk.fileIdentity) throw new Error("The settings document identity is unavailable");
|
|
79
|
+
removeConfigDocumentIfMatches(
|
|
80
|
+
options.settingsPath,
|
|
81
|
+
previousBytes.toString("utf8"),
|
|
82
|
+
expected.disk.fileIdentity
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
saved = candidate;
|
|
86
|
+
} else {
|
|
87
|
+
saved = options.save ? options.save(options.settingsPath, raw) : atomicSaveConfigDocument(options.settingsPath, raw, {}, expected.disk);
|
|
88
|
+
}
|
|
72
89
|
} catch (error) {
|
|
90
|
+
if (restoreNative) {
|
|
91
|
+
const rollback = restorePrevious(ctx, options, owner, expected, void 0, void 0, false);
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Pi native footer was not restored: ${message(error)}. ${rollback}${recoveryNote(recoveryPath)}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
73
96
|
if (error instanceof ConfigPublicationError) {
|
|
74
97
|
const rollback = restorePrevious(ctx, options, owner, expected, raw, error.fileIdentity, false);
|
|
75
98
|
throw new Error(`Footer settings were not saved: ${message(error)}. ${rollback}${recoveryNote(recoveryPath)}`);
|
|
@@ -100,6 +123,16 @@ function restorePrevious(ctx, options, owner, expected, raw, identity, restoreRu
|
|
|
100
123
|
if (current2.rawDocument !== expected.previous.rawDocument && current2.rawDocument !== raw) {
|
|
101
124
|
throw new Error("The active runtime changed; stale restoration was blocked");
|
|
102
125
|
}
|
|
126
|
+
if (raw === void 0) {
|
|
127
|
+
const disk = readConfigDocumentSnapshot(options.settingsPath);
|
|
128
|
+
if (disk.rawBytes !== void 0) {
|
|
129
|
+
assertConfigDocumentUnchanged(options.settingsPath, expected.disk);
|
|
130
|
+
} else if (expected.disk.rawBytes !== void 0) {
|
|
131
|
+
atomicRestoreConfigDocument(options.settingsPath, expected.disk.rawBytes, {}, disk);
|
|
132
|
+
}
|
|
133
|
+
if (restoreRuntime) options.apply(expected.previous, ctx);
|
|
134
|
+
return "The previous configuration was restored.";
|
|
135
|
+
}
|
|
103
136
|
if (!identity) throw new Error("The saved settings document identity is unavailable");
|
|
104
137
|
assertConfigDocumentUnchanged(options.settingsPath, { rawBytes: Buffer.from(raw), fileIdentity: identity });
|
|
105
138
|
if (expected.disk.rawBytes === void 0) {
|
|
@@ -643,4 +676,4 @@ export {
|
|
|
643
676
|
showHistory,
|
|
644
677
|
saveAsProfile
|
|
645
678
|
};
|
|
646
|
-
//# sourceMappingURL=chunk-
|
|
679
|
+
//# sourceMappingURL=chunk-63R6R5DH.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/command-commit.ts", "../../src/command-profiles.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ExtensionCommandContext, withFileMutationQueue } from \"@earendil-works/pi-coding-agent\";\nimport type { ConfigurationCommandOptions, WorkflowOwner } from \"./command-configuration.js\";\nimport {\n assertConfigDocumentUnchanged,\n atomicRestoreConfigDocument,\n atomicSaveConfigDocument,\n type ConfigDocumentSnapshot,\n ConfigPublicationError,\n type LoadedStarshipConfig,\n readConfigDocumentSnapshot,\n removeConfigDocumentIfMatches,\n validateConfigDocument,\n} from \"./config.js\";\nimport { archiveConfigDocument } from \"./profile-store.js\";\n\nexport interface CommitOptions extends ConfigurationCommandOptions {\n save?: (settingsPath: string, rawDocument: string) => LoadedStarshipConfig;\n restore?: (settingsPath: string, rawDocument: string) => void;\n archive?: typeof archiveConfigDocument;\n}\n\nexport interface CommitExpectation {\n previous: LoadedStarshipConfig;\n revision: number | undefined;\n disk: ConfigDocumentSnapshot;\n}\n\nexport function captureCommitExpectation(options: ConfigurationCommandOptions): CommitExpectation {\n return {\n previous: options.getLoaded(),\n revision: options.getLoadedRevision?.(),\n disk: readConfigDocumentSnapshot(options.settingsPath),\n };\n}\n\nexport function commitOwnerCurrent(\n options: ConfigurationCommandOptions,\n owner: WorkflowOwner,\n expected: CommitExpectation,\n): boolean {\n const loaded = options.getLoaded();\n return (\n !owner.signal.aborted &&\n owner.isCurrent() &&\n loaded.rawDocument === expected.previous.rawDocument &&\n loaded.source === expected.previous.source &&\n JSON.stringify(loaded.diagnostics) === JSON.stringify(expected.previous.diagnostics) &&\n options.getLoadedRevision?.() === expected.revision\n );\n}\n\n/** The queue has asynchronous admission; the owned file/runtime transaction has no await boundary. */\nexport async function commitActiveDocument(\n ctx: ExtensionCommandContext,\n options: CommitOptions,\n candidate: LoadedStarshipConfig,\n owner: WorkflowOwner,\n expected: CommitExpectation,\n allowInvalid = false,\n checkCandidate?: () => void,\n restoreNative = false,\n): Promise<\"applied\" | \"cancel\"> {\n const raw = candidate.rawDocument;\n if (restoreNative) {\n if (raw !== undefined || candidate.source !== \"built-in\" || candidate.diagnostics.length > 0)\n throw new Error(\"The native footer candidate is invalid\");\n } else if (raw === undefined) throw new Error(\"The candidate settings document is unavailable\");\n return withFileMutationQueue(options.settingsPath, async () => {\n if (!commitOwnerCurrent(options, owner, expected)) return \"cancel\";\n checkCandidate?.();\n assertConfigDocumentUnchanged(options.settingsPath, expected.disk);\n const previousBytes = expected.disk.rawBytes;\n if (expected.previous.rawDocument !== previousBytes?.toString(\"utf8\")) {\n throw new Error(\n \"The active file differs from the loaded document. Reload and review it before replacing settings.\",\n );\n }\n const invalid = expected.previous.diagnostics.some((item) => item.severity === \"error\");\n if (invalid && !allowInvalid)\n throw new Error(\"The active settings document is invalid. Use explicit repair or recovery before replacing it.\");\n // Always validate again at the publication boundary, not only in the preview layer.\n if (raw !== undefined) {\n validateConfigDocument(options.settingsPath, raw);\n if (previousBytes?.equals(Buffer.from(raw))) return \"applied\";\n }\n\n let recoveryPath: string | undefined;\n if (previousBytes !== undefined) {\n recoveryPath = (options.archive ?? archiveConfigDocument)(options.settingsPath, previousBytes).path;\n }\n // A recovery publication can fail or observe an external edit. Never publish over that edit.\n try {\n assertConfigDocumentUnchanged(options.settingsPath, expected.disk);\n if (!commitOwnerCurrent(options, owner, expected)) return \"cancel\";\n checkCandidate?.();\n } catch (error) {\n throw new Error(`${message(error)}.${recoveryNote(recoveryPath)}`);\n }\n let saved: LoadedStarshipConfig;\n try {\n if (raw === undefined) {\n if (previousBytes !== undefined) {\n if (!expected.disk.fileIdentity) throw new Error(\"The settings document identity is unavailable\");\n removeConfigDocumentIfMatches(\n options.settingsPath,\n previousBytes.toString(\"utf8\"),\n expected.disk.fileIdentity,\n );\n }\n saved = candidate;\n } else {\n saved = options.save\n ? options.save(options.settingsPath, raw)\n : atomicSaveConfigDocument(options.settingsPath, raw, {}, expected.disk);\n }\n } catch (error) {\n if (restoreNative) {\n const rollback = restorePrevious(ctx, options, owner, expected, undefined, undefined, false);\n throw new Error(\n `Pi native footer was not restored: ${message(error)}. ${rollback}${recoveryNote(recoveryPath)}`,\n );\n }\n if (error instanceof ConfigPublicationError) {\n const rollback = restorePrevious(ctx, options, owner, expected, raw, error.fileIdentity, false);\n throw new Error(`Footer settings were not saved: ${message(error)}. ${rollback}${recoveryNote(recoveryPath)}`);\n }\n throw new Error(\n `Footer settings were not saved: ${message(error)}. The previous footer remains active.${recoveryNote(recoveryPath)}`,\n );\n }\n try {\n if (\n owner.signal.aborted ||\n !(owner.isSessionCurrent?.() ?? owner.isCurrent()) ||\n options.getLoadedRevision?.() !== expected.revision\n ) {\n throw new Error(\"The configuration owner changed during publication\");\n }\n options.apply(saved, ctx);\n } catch (error) {\n const rollback = restorePrevious(ctx, options, owner, expected, raw, saved.fileIdentity, true);\n throw new Error(\n `Footer settings could not be applied: ${message(error)}. ${rollback}${recoveryNote(recoveryPath)}`,\n );\n }\n return \"applied\";\n });\n}\n\nfunction restorePrevious(\n ctx: ExtensionCommandContext,\n options: CommitOptions,\n owner: WorkflowOwner,\n expected: CommitExpectation,\n raw: string | undefined,\n identity: LoadedStarshipConfig[\"fileIdentity\"],\n restoreRuntime: boolean,\n): string {\n try {\n if (owner.signal.aborted || !(owner.isSessionCurrent?.() ?? owner.isCurrent()))\n throw new Error(\"The session owner changed; stale restoration was blocked\");\n const current = options.getLoaded();\n if (current.rawDocument !== expected.previous.rawDocument && current.rawDocument !== raw) {\n throw new Error(\"The active runtime changed; stale restoration was blocked\");\n }\n if (raw === undefined) {\n const disk = readConfigDocumentSnapshot(options.settingsPath);\n if (disk.rawBytes !== undefined) {\n assertConfigDocumentUnchanged(options.settingsPath, expected.disk);\n } else if (expected.disk.rawBytes !== undefined) {\n atomicRestoreConfigDocument(options.settingsPath, expected.disk.rawBytes, {}, disk);\n }\n if (restoreRuntime) options.apply(expected.previous, ctx);\n return \"The previous configuration was restored.\";\n }\n if (!identity) throw new Error(\"The saved settings document identity is unavailable\");\n assertConfigDocumentUnchanged(options.settingsPath, { rawBytes: Buffer.from(raw), fileIdentity: identity });\n if (expected.disk.rawBytes === undefined) {\n removeConfigDocumentIfMatches(options.settingsPath, raw, identity);\n } else if (options.restore && expected.disk.rawBytes.equals(Buffer.from(expected.previous.rawDocument ?? \"\"))) {\n options.restore(options.settingsPath, expected.previous.rawDocument ?? \"\");\n } else {\n atomicRestoreConfigDocument(\n options.settingsPath,\n expected.disk.rawBytes,\n {},\n { rawBytes: Buffer.from(raw), fileIdentity: identity },\n );\n }\n if (restoreRuntime) options.apply(expected.previous, ctx);\n return \"The previous configuration was restored.\";\n } catch (error) {\n return `Restoring the previous configuration also failed: ${message(error)}. Active path: ${options.settingsPath}.`;\n }\n}\n\nfunction recoveryNote(path: string | undefined): string {\n return path ? ` Recovery copy retained: ${path}.` : \"\";\n}\n\nfunction message(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey } from \"@earendil-works/pi-tui\";\nimport { defineMenu, runLiveChoice, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { sanitizeTerminalText } from \"@narumitw/pi-tui-kit/terminal-text\";\nimport type { WorkflowOwner } from \"./command-configuration.js\";\nimport type { StarshipCommandOptions } from \"./commands.js\";\nimport { BUILT_IN_EXAMPLE, type LoadedStarshipConfig, validateConfigDocument } from \"./config.js\";\nimport {\n createProfile,\n deleteHistory,\n deleteProfile,\n duplicateProfile,\n type HistoryDocument,\n listHistory,\n listProfiles,\n type ProfileDocument,\n readHistory,\n readProfile,\n renameProfile,\n saveProfile,\n} from \"./profile-store.js\";\n\nexport type ProfileApplyCandidate = (\n loaded: LoadedStarshipConfig,\n owner: WorkflowOwner,\n checkCandidate: () => void,\n name: string,\n) => Promise<\"applied\" | \"stay\" | \"close\">;\n\ntype Document = ProfileDocument | HistoryDocument;\ntype Exit = \"back\" | \"close\";\ninterface Action {\n id: string;\n label: string;\n description?: string;\n disabled?: boolean;\n disabledReason?: string;\n}\ninterface Candidate {\n loaded?: LoadedStarshipConfig;\n lines: string[];\n}\n\nconst PREVIEW_NOTICE = \"Preview uses the current runtime snapshot only; unavailable module data can be empty.\";\nconst SAVE_CURRENT = \"save-current\";\nclass FlowEnded extends Error {}\n\n/** Profiles are independent copies. Only applyCandidate may replace active settings. */\nexport async function showProfiles(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n owner: WorkflowOwner,\n applyCandidate: ProfileApplyCandidate,\n): Promise<Exit> {\n return browseDocuments(ctx, options, owner, applyCandidate, \"profile\");\n}\n\nexport async function showHistory(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n owner: WorkflowOwner,\n applyCandidate: ProfileApplyCandidate,\n): Promise<Exit> {\n return browseDocuments(ctx, options, owner, applyCandidate, \"history\");\n}\n\n/** Reusable by reviewed preset/Gist candidates; never writes the active file. */\nexport async function saveAsProfile(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n owner: WorkflowOwner,\n raw: string,\n): Promise<ProfileDocument | \"close\" | undefined> {\n if (!interactive(ctx) || !current(owner)) return undefined;\n const flow = createFlow(ctx, options, owner);\n try {\n candidateFor(options, raw, true);\n const saved = await saveNamedCopy(ctx, options, flow, raw);\n flow.ensure();\n return saved;\n } catch (error) {\n if (flow.signal.aborted || !flow.sessionCurrent()) return \"close\";\n report(ctx, flow, error);\n return undefined;\n } finally {\n flow.dispose();\n }\n}\n\nasync function browseDocuments(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n owner: WorkflowOwner,\n applyCandidate: ProfileApplyCandidate,\n kind: Document[\"kind\"],\n): Promise<Exit> {\n if (!interactive(ctx) || !current(owner)) return \"close\";\n const flow = createFlow(ctx, options, owner);\n let selectedId: string | undefined;\n try {\n while (flow.current()) {\n let interacted = false;\n try {\n const documents: Document[] =\n kind === \"profile\" ? listProfiles(options.settingsPath) : listHistory(options.settingsPath);\n const active = options.getLoaded();\n const matches = documents.filter(\n (document) => document.rawDocument !== undefined && document.rawDocument === active.rawDocument,\n );\n const candidates = new Map(\n documents.map((document) => [documentId(document), candidateFor(options, document.rawDocument)]),\n );\n const selection = await runLiveChoice(ctx, {\n title: kind === \"profile\" ? \"Profiles\" : \"History\",\n lines: [\n active.rawDocument === undefined && active.diagnostics.length === 0\n ? \"Active: Built-in defaults\"\n : active.diagnostics.some((item) => item.severity === \"error\")\n ? \"Active: Invalid settings document \u00B7 replacement requires explicit recovery\"\n : \"Active: Independent settings document\",\n ...(kind === \"profile\" && matches.length === 0 ? [\"Current settings are not saved as a profile\"] : []),\n PREVIEW_NOTICE,\n ],\n items: [\n ...(kind === \"profile\"\n ? [\n {\n id: SAVE_CURRENT,\n label: \"Save current as\u2026\",\n description: \"Copy exact loaded TOML; keep active settings unchanged\",\n },\n ]\n : []),\n ...documents.map((document) => ({\n id: documentId(document),\n label: safe(document.name),\n description: [\n ...(document.kind === \"history\"\n ? [safe(document.createdAt), ...(document.legacy ? [\"Legacy \u00B7 read-only\"] : [])]\n : []),\n ...(document.rawDocument !== undefined && document.rawDocument === active.rawDocument\n ? [\"Matches active settings\"]\n : []),\n ...(!candidates.get(documentId(document))?.loaded ? [\"Invalid document \u00B7 review or repair\"] : []),\n ].join(\" \u00B7 \"),\n details: [\n `Selected: ${safe(document.name)}`,\n `Path: ${safe(document.path)}`,\n ...(candidates.get(documentId(document))?.lines ?? []),\n ],\n })),\n ],\n initialItemId: selectedId,\n enableSearch: true,\n viewportSize: 10,\n hint: \"back\",\n confirmLabel: \"actions\",\n navigationLabel: \"live preview\",\n signal: flow.signal,\n isCurrent: flow.current,\n onSelectionChange: ({ item, signal }) => {\n if (signal.aborted || !flow.current()) return;\n selectedId = item.id;\n flow.preview(candidates.get(item.id)?.loaded);\n },\n });\n flow.ensure();\n interacted = true;\n if (selection.kind !== \"selected\") {\n return selection.kind === \"closed\" && selection.reason === \"back\" ? \"back\" : \"close\";\n }\n selectedId = selection.itemId;\n if (selectedId === SAVE_CURRENT) {\n flow.preview(undefined);\n const loaded = options.getLoaded();\n if (loaded.diagnostics.some((item) => item.severity === \"error\")) {\n throw new Error(\n \"Cannot save unreadable or malformed active settings as a profile. Repair the settings document first.\",\n );\n }\n const raw = loaded.rawDocument ?? BUILT_IN_EXAMPLE;\n candidateFor(options, raw, true);\n const saved = await saveNamedCopy(ctx, options, flow, raw);\n flow.ensure();\n if (saved) selectedId = documentId(saved);\n continue;\n }\n const document = documents.find((item) => documentId(item) === selectedId);\n if (!document) continue;\n flow.ensure(document);\n const outcome = await documentActions(ctx, options, flow, document, applyCandidate);\n flow.ensure();\n if (outcome === \"close\") return \"close\";\n if (outcome) selectedId = documentId(outcome);\n } catch (error) {\n if (error instanceof FlowEnded || !flow.current()) return \"close\";\n flow.preview(undefined);\n report(ctx, flow, error);\n if (!interacted) return \"close\";\n }\n }\n return \"close\";\n } finally {\n flow.dispose();\n }\n}\n\nasync function documentActions(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n flow: ReturnType<typeof createFlow>,\n document: Document,\n applyCandidate: ProfileApplyCandidate,\n): Promise<Document | \"close\" | undefined> {\n const candidate = candidateFor(options, document.rawDocument);\n const profile = document.kind === \"profile\";\n const activeInvalid = profile && options.getLoaded().diagnostics.some((item) => item.severity === \"error\");\n const action = await actionScreen(ctx, flow, {\n title: `${profile ? \"Profile\" : \"Recovery copy\"}: ${safe(document.name)}`,\n lines: [\n `Path: ${safe(document.path)}`,\n ...(document.kind === \"history\"\n ? [`Recovery time: ${safe(document.createdAt)}`, \"A recovery copy is not proof that an application succeeded.\"]\n : []),\n ...(document.kind === \"history\" && document.legacy\n ? [\"Legacy backup \u00B7 read-only; restore copies bytes without changing this backup.\"]\n : []),\n ...(document.readError ? [safe(document.readError)] : []),\n ...candidate.lines,\n PREVIEW_NOTICE,\n ],\n raw: document.rawDocument,\n actions: [\n {\n id: \"apply\",\n label: profile ? \"Apply\u2026\" : \"Restore\u2026\",\n disabled: !candidate.loaded || activeInvalid,\n disabledReason: activeInvalid\n ? \"Repair active settings or use explicit recovery first\"\n : \"Invalid TOML cannot be applied\",\n },\n ...(profile\n ? [\n { id: \"edit\", label: \"Edit TOML\u2026\" },\n { id: \"rename\", label: \"Rename\u2026\" },\n { id: \"duplicate\", label: \"Duplicate\u2026\" },\n ]\n : [\n {\n id: \"save-as\",\n label: \"Save as a profile\u2026\",\n disabled: !candidate.loaded,\n disabledReason: \"Invalid TOML cannot be saved as a validated profile\",\n },\n ]),\n {\n id: \"delete\",\n label: \"Delete\u2026\",\n disabled: document.kind === \"history\" && document.legacy,\n disabledReason: \"Legacy backups are read-only\",\n },\n ],\n });\n flow.ensure(document);\n if (action === \"close\") return \"close\";\n if (action === \"back\") return undefined;\n if (action === \"apply\" && candidate.loaded) {\n const result = await applyReviewedCandidate(flow, candidate.loaded, applyCandidate, document);\n flow.ensure(document);\n return result === \"close\" ? \"close\" : document;\n }\n if (action === \"edit\" && profile) {\n const result = await editProfile(ctx, options, flow, document, applyCandidate);\n flow.ensure();\n return result;\n }\n if (action === \"rename\" && profile) {\n const name = await flow.dialog(() =>\n ctx.ui.input(`Rename profile: ${safe(document.name)}`, \"New profile name\", { signal: flow.signal }),\n );\n flow.ensure(document);\n if (name === undefined) return document;\n return renameProfile(options.settingsPath, document.name, name, document);\n }\n if (action === \"duplicate\" || (action === \"save-as\" && document.rawDocument !== undefined)) {\n const saved = await saveNamedCopy(ctx, options, flow, document.rawDocument, document);\n flow.ensure(document);\n return action === \"duplicate\" || document.kind === \"history\" ? document : (saved ?? document);\n }\n if (action === \"delete\" && !(document.kind === \"history\" && document.legacy)) {\n const confirmed = await flow.dialog(() =>\n ctx.ui.confirm(\n `Delete ${profile ? \"profile\" : \"recovery copy\"}: ${safe(document.name)}?`,\n `Path: ${safe(document.path)}\\n${profile ? \"This deletes only the saved profile. The active settings copy remains unchanged.\" : \"This permanently deletes only this recovery copy. Active settings remain unchanged.\"}`,\n { signal: flow.signal },\n ),\n );\n flow.ensure(document);\n if (confirmed) {\n if (document.kind === \"profile\") deleteProfile(options.settingsPath, document.name, document);\n else deleteHistory(options.settingsPath, document.name, document);\n }\n }\n return undefined;\n}\n\nasync function editProfile(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n flow: ReturnType<typeof createFlow>,\n original: ProfileDocument,\n applyCandidate: ProfileApplyCandidate,\n): Promise<ProfileDocument | \"close\"> {\n let draft = original.rawDocument ?? \"\";\n if (original.rawDocument === undefined) {\n const repair = await flow.dialog(() =>\n ctx.ui.confirm(\n `Repair invalid UTF-8 profile: ${safe(original.name)}?`,\n `Path: ${safe(original.path)}\\nThe original bytes cannot be edited as TOML text. Open an empty repair draft? Saving replaces these invalid bytes; the saved copy stays unchanged until you select Save profile. Duplicate it first to keep the original bytes.`,\n { signal: flow.signal },\n ),\n );\n flow.ensure(original);\n if (!repair) return original;\n }\n while (flow.current()) {\n // Pi's editor has no signal or public dismissal API. Drain it, then reject\n // stale completion. The owner abort listener clears the footer immediately.\n const edited = await flow.dialog(() => ctx.ui.editor(`Edit profile: ${safe(original.name)}`, draft));\n flow.ensure(original);\n if (edited === undefined) return original;\n draft = edited;\n const candidate = candidateFor(options, draft);\n flow.preview(candidate.loaded);\n const action = await actionScreen(ctx, flow, {\n title: candidate.loaded ? \"Profile draft preview\" : \"Profile draft needs attention\",\n lines: [\n \"Save profile changes only the saved copy, even when it matches active settings.\",\n ...candidate.lines,\n PREVIEW_NOTICE,\n ],\n raw: draft,\n actions: [\n {\n id: \"save\",\n label: \"Save profile\",\n disabled: !candidate.loaded,\n disabledReason: \"Repair the draft before saving\",\n },\n {\n id: \"save-apply\",\n label: \"Save profile and apply\u2026\",\n description: \"Two operations: a failed apply retains the saved profile\",\n disabled: !candidate.loaded,\n disabledReason: \"Repair the draft before saving\",\n },\n { id: \"continue\", label: \"Continue editing\" },\n { id: \"discard\", label: \"Discard draft\" },\n ],\n });\n flow.ensure(original);\n if (action === \"close\") return \"close\";\n if (action === \"discard\") return original;\n if (action === \"continue\" || action === \"back\") continue;\n if (!candidate.loaded || (action !== \"save\" && action !== \"save-apply\")) continue;\n const saved = saveProfile(options.settingsPath, original.name, draft, original);\n ctx.ui.notify(`Profile saved: ${safe(saved.name)}. Active settings are unchanged.`, \"info\");\n if (action === \"save-apply\") {\n try {\n const result = await applyReviewedCandidate(flow, candidate.loaded, applyCandidate, saved);\n flow.ensure(saved);\n if (result === \"close\") return \"close\";\n if (result !== \"applied\")\n ctx.ui.notify(\n \"The profile was saved. Application did not complete; review the configuration result before retrying.\",\n \"warning\",\n );\n } catch (error) {\n if (!flow.current()) throw error;\n ctx.ui.notify(\n `The saved profile was retained, but application did not complete: ${safeError(error)}. Review active settings before retrying.`,\n \"error\",\n );\n }\n }\n return saved;\n }\n throw new FlowEnded();\n}\n\nasync function applyReviewedCandidate(\n flow: ReturnType<typeof createFlow>,\n loaded: LoadedStarshipConfig,\n applyCandidate: ProfileApplyCandidate,\n document: Document,\n) {\n flow.ensure(document);\n const result = await applyCandidate(\n loaded,\n {\n signal: flow.signal,\n // The shared commit policy captures the active revision before applying.\n // A successful apply changes it; session ownership must remain valid after it.\n isCurrent: () => !flow.signal.aborted && flow.sessionCurrent(),\n isSessionCurrent: flow.sessionCurrent,\n },\n () => flow.ensure(document),\n document.name,\n );\n // Only this operation may advance the loaded revision. Other awaits must keep\n // the reviewed active revision; failed or cancelled applies cannot adopt it.\n if (result === \"applied\") flow.adoptAppliedRevision();\n flow.ensure(document);\n flow.preview(undefined);\n return result;\n}\n\nasync function saveNamedCopy(\n ctx: ExtensionCommandContext,\n options: StarshipCommandOptions,\n flow: ReturnType<typeof createFlow>,\n raw: string | undefined,\n source?: Document,\n): Promise<ProfileDocument | undefined> {\n while (flow.current()) {\n const name = await flow.dialog(() =>\n ctx.ui.input(\"Save as a profile\", \"Profile name (without .toml)\", { signal: flow.signal }),\n );\n flow.ensure(source);\n if (name === undefined) return undefined;\n try {\n const saved =\n source?.kind === \"profile\"\n ? duplicateProfile(options.settingsPath, source.name, name, source)\n : createProfile(options.settingsPath, name, requireText(raw));\n ctx.ui.notify(`Profile saved: ${safe(saved.name)}. Active settings are unchanged.`, \"info\");\n return saved;\n } catch (error) {\n report(ctx, flow, error);\n }\n }\n throw new FlowEnded();\n}\n\nasync function actionScreen(\n ctx: ExtensionCommandContext,\n flow: ReturnType<typeof createFlow>,\n screen: { title: string; lines: string[]; actions: Action[]; raw: string | undefined },\n): Promise<string> {\n let selected: string | undefined;\n const menu = defineMenu<undefined, \"actions\" | \"document\", \"select\">({\n start: \"actions\",\n screens: {\n actions: () => ({\n kind: \"actions\",\n title: screen.title,\n lines: screen.lines,\n items: [\n {\n id: \"review\",\n label: \"Review TOML\",\n to: \"document\",\n disabled: screen.raw === undefined,\n disabledReason: \"The document is not valid UTF-8\",\n },\n ...screen.actions.map((action) => ({ ...action, action: \"select\" as const })),\n ],\n hint: \"back\",\n }),\n document: () => ({\n kind: \"review\",\n title: screen.title,\n lines: [\"Exact UTF-8 text \u00B7 display controls sanitized \u00B7 read-only\"],\n content: screen.raw ?? \"The document is not valid UTF-8; no decoded fallback is shown.\",\n format: { kind: \"code\", language: \"toml\" },\n enableSearch: true,\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: {\n select: ({ itemId }) => {\n flow.ensure();\n selected = itemId;\n return { kind: \"close\" };\n },\n },\n });\n const result = await runMenu(ctx, menu, { getState: () => undefined, signal: flow.signal, isCurrent: flow.current });\n flow.ensure();\n return selected ?? (result.kind === \"closed\" && result.reason === \"back\" ? \"back\" : \"close\");\n}\n\nfunction createFlow(ctx: ExtensionCommandContext, options: StarshipCommandOptions, owner: WorkflowOwner) {\n const controller = new AbortController();\n const signal = AbortSignal.any([controller.signal, owner.signal]);\n let revision = options.getLoadedRevision?.();\n let activeDocument = activeFingerprint(options.getLoaded());\n let previewOwned = false;\n const isCurrent = () =>\n !signal.aborted &&\n owner.isCurrent() &&\n (revision === undefined\n ? activeFingerprint(options.getLoaded()) === activeDocument\n : options.getLoadedRevision?.() === revision);\n const clearPreview = () => {\n if (!previewOwned) return;\n previewOwned = false;\n // The session owner, not a captured footer snapshot, decides whether cleanup\n // can touch the UI, even after command cancellation. Runtime lifecycle\n // cleanup owns a replaced session.\n if (owner.isSessionCurrent?.() ?? owner.isCurrent()) {\n try {\n options.preview?.(undefined, ctx);\n } catch (error) {\n ctx.ui.notify(`Could not clear the footer preview: ${safeError(error)}`, \"error\");\n }\n }\n };\n const matches = (expected?: Document) => {\n if (!isCurrent()) return false;\n if (!expected) return true;\n try {\n const fresh =\n expected.kind === \"profile\"\n ? readProfile(options.settingsPath, expected.name)\n : readHistory(options.settingsPath, expected.name);\n return (\n fresh.rawDocument === expected.rawDocument &&\n fresh.identity.dev === expected.identity.dev &&\n fresh.identity.ino === expected.identity.ino &&\n fresh.identity.size === expected.identity.size &&\n fresh.identity.mtimeNs === expected.identity.mtimeNs &&\n fresh.identity.ctimeNs === expected.identity.ctimeNs &&\n fresh.rawBytes.equals(expected.rawBytes)\n );\n } catch {\n return false;\n }\n };\n const ensure = (expected?: Document) => {\n if (!isCurrent()) throw new FlowEnded();\n if (!matches(expected))\n throw new Error(\"The selected document changed or was removed. Review the latest copy before trying again.\");\n };\n signal.addEventListener(\"abort\", clearPreview, { once: true });\n return {\n signal,\n current: isCurrent,\n sessionCurrent: () => owner.isSessionCurrent?.() ?? owner.isCurrent(),\n ensure,\n preview(loaded: LoadedStarshipConfig | undefined) {\n ensure();\n if (!loaded) {\n clearPreview();\n return;\n }\n previewOwned = true;\n try {\n options.preview?.(loaded, ctx);\n } catch (error) {\n clearPreview();\n throw error;\n }\n },\n async dialog<Value>(run: () => Promise<Value>): Promise<Value> {\n ensure();\n // Native dialogs collapse Escape and Ctrl+C into one result. Observe only\n // hard cancellation; never consume, rewrite, or forward editor content.\n const unsubscribe = ctx.ui.onTerminalInput((data) => {\n if (!isKeyRelease(data) && matchesKey(data, Key.ctrl(\"c\"))) {\n // Abort after native input dispatch, before its promise continuation.\n // Synchronous abort could restore focus and leak this key to Pi's editor.\n queueMicrotask(() => controller.abort());\n }\n return undefined;\n });\n let released = false;\n const release = () => {\n if (released) return;\n released = true;\n unsubscribe();\n };\n signal.addEventListener(\"abort\", release, { once: true });\n try {\n if (signal.aborted) release();\n ensure();\n const result = await run();\n ensure();\n return result;\n } finally {\n signal.removeEventListener(\"abort\", release);\n release();\n }\n },\n adoptAppliedRevision() {\n if (signal.aborted || !(owner.isSessionCurrent?.() ?? owner.isCurrent())) throw new FlowEnded();\n revision = options.getLoadedRevision?.();\n activeDocument = activeFingerprint(options.getLoaded());\n },\n dispose() {\n try {\n clearPreview();\n } finally {\n signal.removeEventListener(\"abort\", clearPreview);\n controller.abort();\n }\n },\n };\n}\n\nfunction candidateFor(options: StarshipCommandOptions, raw: string | undefined, required = false): Candidate {\n try {\n if (raw === undefined) throw new Error(\"The document is not valid UTF-8; no decoded fallback is shown.\");\n const loaded = (options.validate ?? validateConfigDocument)(options.settingsPath, raw);\n if (loaded.diagnostics.some((item) => item.severity === \"error\"))\n throw new Error(loaded.diagnostics.map((item) => item.message).join(\"; \"));\n return {\n loaded,\n lines:\n loaded.diagnostics.length === 0\n ? [\"No configuration warnings.\"]\n : loaded.diagnostics.map((item) => `${safe(item.path || \"root\")}: ${safe(item.message)}`),\n };\n } catch (error) {\n if (required) throw error;\n return { lines: [`Invalid TOML: ${safeError(error)}`, \"No candidate footer preview is shown.\"] };\n }\n}\n\nfunction requireText(raw: string | undefined): string {\n if (raw === undefined) throw new Error(\"The document is not valid UTF-8; no decoded fallback can be saved.\");\n return raw;\n}\n\nfunction activeFingerprint(loaded: LoadedStarshipConfig) {\n return JSON.stringify([loaded.source, loaded.rawDocument, loaded.diagnostics]);\n}\n\nfunction current(owner: WorkflowOwner) {\n return !owner.signal.aborted && owner.isCurrent();\n}\n\nfunction interactive(ctx: ExtensionCommandContext) {\n if (ctx.mode === \"tui\" && ctx.hasUI) return true;\n if (ctx.hasUI) ctx.ui.notify(\"Profiles and History require TUI mode.\", \"info\");\n return false;\n}\n\nfunction documentId(document: Document) {\n return `${document.kind}:${document.name}`;\n}\n\nfunction report(ctx: ExtensionCommandContext, flow: ReturnType<typeof createFlow>, error: unknown) {\n if (!(error instanceof FlowEnded) && flow.current()) ctx.ui.notify(safeError(error), \"error\");\n}\n\nfunction safeError(error: unknown) {\n return safe(error instanceof Error ? error.message : String(error));\n}\n\nfunction safe(value: string) {\n return sanitizeTerminalText(value);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAuC,6BAA6B;AA2B7D,SAAS,yBAAyB,SAAyD;AAChG,SAAO;AAAA,IACL,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU,QAAQ,oBAAoB;AAAA,IACtC,MAAM,2BAA2B,QAAQ,YAAY;AAAA,EACvD;AACF;AAEO,SAAS,mBACd,SACA,OACA,UACS;AACT,QAAM,SAAS,QAAQ,UAAU;AACjC,SACE,CAAC,MAAM,OAAO,WACd,MAAM,UAAU,KAChB,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C,MAAM,OAAO,WAAW,MAAM,UAAU;AAClD;AAEA,SAAS,YAAY,KAA8B;AACjD,MAAI,IAAI,SAAS,SAAS,IAAI,MAAO,QAAO;AAC5C,MAAI,IAAI,MAAO,KAAI,GAAG,OAAO,0CAA0C,MAAM;AAC7E,SAAO;AACT;AAEA,SAAS,WAAW,UAAoB;AACtC,SAAO,GAAG,SAAS,IAAI,IAAI,SAAS,IAAI;AAC1C;AAEA,SAAS,OAAO,KAA8B,MAAqC,OAAgB;AACjG,MAAI,EAAE,iBAAiB,cAAc,KAAK,QAAQ,EAAG,KAAI,GAAG,OAAO,UAAU,KAAK,GAAG,OAAO;AAC9F;AAEA,SAAS,UAAU,OAAgB;AACjC,SAAO,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AACpE;AAEA,SAAS,KAAK,OAAe;AAC3B,SAAO,qBAAqB,KAAK;AACnC;",
|
|
6
|
+
"names": ["current", "document"]
|
|
7
|
+
}
|
|
@@ -2083,6 +2083,9 @@ ${BUILT_IN_FORMAT_DOCUMENT}
|
|
|
2083
2083
|
function settingsFilePath(agentDir) {
|
|
2084
2084
|
return join(agentDir, CONFIG_FILE_NAME);
|
|
2085
2085
|
}
|
|
2086
|
+
function nativeFooterConfig(settingsPath) {
|
|
2087
|
+
return { config: cloneBuiltInConfig(), source: "built-in", settingsPath, diagnostics: [] };
|
|
2088
|
+
}
|
|
2086
2089
|
function loadStarshipConfig(settingsPath) {
|
|
2087
2090
|
let rawDocument;
|
|
2088
2091
|
let snapshot;
|
|
@@ -2093,12 +2096,7 @@ function loadStarshipConfig(settingsPath) {
|
|
|
2093
2096
|
rawDocument = rawBytes.toString("utf8");
|
|
2094
2097
|
} catch (error) {
|
|
2095
2098
|
if (error.code === "ENOENT" && !existsSync(settingsPath)) {
|
|
2096
|
-
return
|
|
2097
|
-
config: cloneBuiltInConfig(),
|
|
2098
|
-
source: "built-in",
|
|
2099
|
-
settingsPath,
|
|
2100
|
-
diagnostics: []
|
|
2101
|
-
};
|
|
2099
|
+
return nativeFooterConfig(settingsPath);
|
|
2102
2100
|
}
|
|
2103
2101
|
return {
|
|
2104
2102
|
config: cloneBuiltInConfig(),
|
|
@@ -2687,6 +2685,7 @@ export {
|
|
|
2687
2685
|
MODULE_NAMES,
|
|
2688
2686
|
BUILT_IN_EXAMPLE,
|
|
2689
2687
|
settingsFilePath,
|
|
2688
|
+
nativeFooterConfig,
|
|
2690
2689
|
loadStarshipConfig,
|
|
2691
2690
|
readConfigDocumentSnapshot,
|
|
2692
2691
|
assertConfigDocumentUnchanged,
|
|
@@ -2697,4 +2696,4 @@ export {
|
|
|
2697
2696
|
removeConfigDocumentIfMatches,
|
|
2698
2697
|
activePalette
|
|
2699
2698
|
};
|
|
2700
|
-
//# sourceMappingURL=chunk-
|
|
2699
|
+
//# sourceMappingURL=chunk-A65IOGL6.ts.map
|