gnosys 5.9.1 → 5.9.3
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/dist/cli.js +311 -143
- package/dist/cli.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/archive.d.ts.map +1 -1
- package/dist/lib/archive.js.map +1 -1
- package/dist/lib/bootstrap.d.ts.map +1 -1
- package/dist/lib/chat/index.d.ts.map +1 -1
- package/dist/lib/chat/index.js +5 -0
- package/dist/lib/chat/index.js.map +1 -1
- package/dist/lib/cleanup.d.ts +52 -0
- package/dist/lib/cleanup.d.ts.map +1 -0
- package/dist/lib/cleanup.js +168 -0
- package/dist/lib/cleanup.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +7 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/dashboard.d.ts.map +1 -1
- package/dist/lib/dashboard.js.map +1 -1
- package/dist/lib/db.d.ts +0 -13
- package/dist/lib/db.d.ts.map +1 -1
- package/dist/lib/db.js +0 -31
- package/dist/lib/db.js.map +1 -1
- package/dist/lib/dbSearch.d.ts.map +1 -1
- package/dist/lib/dbSearch.js +0 -1
- package/dist/lib/dbSearch.js.map +1 -1
- package/dist/lib/dream.d.ts.map +1 -1
- package/dist/lib/dream.js +1 -1
- package/dist/lib/dream.js.map +1 -1
- package/dist/lib/export.d.ts.map +1 -1
- package/dist/lib/federated.d.ts.map +1 -1
- package/dist/lib/federated.js +23 -65
- package/dist/lib/federated.js.map +1 -1
- package/dist/lib/hybridSearch.d.ts.map +1 -1
- package/dist/lib/hybridSearch.js.map +1 -1
- package/dist/lib/import.d.ts.map +1 -1
- package/dist/lib/import.js +2 -1
- package/dist/lib/import.js.map +1 -1
- package/dist/lib/lensing.d.ts +0 -9
- package/dist/lib/lensing.d.ts.map +1 -1
- package/dist/lib/lensing.js +0 -15
- package/dist/lib/lensing.js.map +1 -1
- package/dist/lib/maintenance.d.ts.map +1 -1
- package/dist/lib/maintenance.js +0 -39
- package/dist/lib/maintenance.js.map +1 -1
- package/dist/lib/migrate.js.map +1 -1
- package/dist/lib/paths.d.ts +8 -2
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +15 -4
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/portfolio.d.ts.map +1 -1
- package/dist/lib/portfolio.js +0 -23
- package/dist/lib/portfolio.js.map +1 -1
- package/dist/lib/projectIdentity.d.ts +9 -5
- package/dist/lib/projectIdentity.d.ts.map +1 -1
- package/dist/lib/projectIdentity.js +19 -22
- package/dist/lib/projectIdentity.js.map +1 -1
- package/dist/lib/remoteWizard.d.ts.map +1 -1
- package/dist/lib/remoteWizard.js +112 -52
- package/dist/lib/remoteWizard.js.map +1 -1
- package/dist/lib/rulesGen.d.ts +1 -4
- package/dist/lib/rulesGen.d.ts.map +1 -1
- package/dist/lib/rulesGen.js +2 -10
- package/dist/lib/rulesGen.js.map +1 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/lib/setup/coldStart.d.ts +71 -0
- package/dist/lib/setup/coldStart.d.ts.map +1 -0
- package/dist/lib/setup/coldStart.js +122 -0
- package/dist/lib/setup/coldStart.js.map +1 -0
- package/dist/lib/setup/configSetRender.d.ts +26 -0
- package/dist/lib/setup/configSetRender.d.ts.map +1 -0
- package/dist/lib/setup/configSetRender.js +103 -0
- package/dist/lib/setup/configSetRender.js.map +1 -0
- package/dist/lib/setup/dreamRender.d.ts +44 -0
- package/dist/lib/setup/dreamRender.d.ts.map +1 -0
- package/dist/lib/setup/dreamRender.js +55 -0
- package/dist/lib/setup/dreamRender.js.map +1 -0
- package/dist/lib/setup/modelsRender.d.ts +25 -0
- package/dist/lib/setup/modelsRender.d.ts.map +1 -0
- package/dist/lib/setup/modelsRender.js +33 -0
- package/dist/lib/setup/modelsRender.js.map +1 -0
- package/dist/lib/setup/remoteRender.d.ts +43 -0
- package/dist/lib/setup/remoteRender.d.ts.map +1 -0
- package/dist/lib/setup/remoteRender.js +65 -0
- package/dist/lib/setup/remoteRender.js.map +1 -0
- package/dist/lib/setup/routingRender.d.ts +44 -0
- package/dist/lib/setup/routingRender.d.ts.map +1 -0
- package/dist/lib/setup/routingRender.js +97 -0
- package/dist/lib/setup/routingRender.js.map +1 -0
- package/dist/lib/setup/sections/ides.d.ts +8 -0
- package/dist/lib/setup/sections/ides.d.ts.map +1 -1
- package/dist/lib/setup/sections/ides.js +49 -27
- package/dist/lib/setup/sections/ides.js.map +1 -1
- package/dist/lib/setup/sections/preferences.d.ts +8 -0
- package/dist/lib/setup/sections/preferences.d.ts.map +1 -1
- package/dist/lib/setup/sections/preferences.js +40 -19
- package/dist/lib/setup/sections/preferences.js.map +1 -1
- package/dist/lib/setup/sections/routing.d.ts +0 -1
- package/dist/lib/setup/sections/routing.d.ts.map +1 -1
- package/dist/lib/setup/sections/routing.js +49 -29
- package/dist/lib/setup/sections/routing.js.map +1 -1
- package/dist/lib/setup/summary.d.ts +33 -19
- package/dist/lib/setup/summary.d.ts.map +1 -1
- package/dist/lib/setup/summary.js +135 -105
- package/dist/lib/setup/summary.js.map +1 -1
- package/dist/lib/setup/syncProjectsRender.d.ts +56 -0
- package/dist/lib/setup/syncProjectsRender.d.ts.map +1 -0
- package/dist/lib/setup/syncProjectsRender.js +168 -0
- package/dist/lib/setup/syncProjectsRender.js.map +1 -0
- package/dist/lib/setup/ui/diff.d.ts +19 -0
- package/dist/lib/setup/ui/diff.d.ts.map +1 -0
- package/dist/lib/setup/ui/diff.js +34 -0
- package/dist/lib/setup/ui/diff.js.map +1 -0
- package/dist/lib/setup/ui/footer.d.ts +11 -0
- package/dist/lib/setup/ui/footer.d.ts.map +1 -0
- package/dist/lib/setup/ui/footer.js +21 -0
- package/dist/lib/setup/ui/footer.js.map +1 -0
- package/dist/lib/setup/ui/header.d.ts +24 -0
- package/dist/lib/setup/ui/header.d.ts.map +1 -0
- package/dist/lib/setup/ui/header.js +49 -0
- package/dist/lib/setup/ui/header.js.map +1 -0
- package/dist/lib/setup/ui/index.d.ts +26 -0
- package/dist/lib/setup/ui/index.d.ts.map +1 -0
- package/dist/lib/setup/ui/index.js +18 -0
- package/dist/lib/setup/ui/index.js.map +1 -0
- package/dist/lib/setup/ui/menu.d.ts +27 -0
- package/dist/lib/setup/ui/menu.d.ts.map +1 -0
- package/dist/lib/setup/ui/menu.js +75 -0
- package/dist/lib/setup/ui/menu.js.map +1 -0
- package/dist/lib/setup/ui/panel.d.ts +23 -0
- package/dist/lib/setup/ui/panel.d.ts.map +1 -0
- package/dist/lib/setup/ui/panel.js +53 -0
- package/dist/lib/setup/ui/panel.js.map +1 -0
- package/dist/lib/setup/ui/prompt.d.ts +27 -0
- package/dist/lib/setup/ui/prompt.d.ts.map +1 -0
- package/dist/lib/setup/ui/prompt.js +38 -0
- package/dist/lib/setup/ui/prompt.js.map +1 -0
- package/dist/lib/setup/ui/safePrompt.d.ts +24 -0
- package/dist/lib/setup/ui/safePrompt.d.ts.map +1 -0
- package/dist/lib/setup/ui/safePrompt.js +71 -0
- package/dist/lib/setup/ui/safePrompt.js.map +1 -0
- package/dist/lib/setup/ui/spinner.d.ts +28 -0
- package/dist/lib/setup/ui/spinner.d.ts.map +1 -0
- package/dist/lib/setup/ui/spinner.js +87 -0
- package/dist/lib/setup/ui/spinner.js.map +1 -0
- package/dist/lib/setup/ui/status.d.ts +21 -0
- package/dist/lib/setup/ui/status.d.ts.map +1 -0
- package/dist/lib/setup/ui/status.js +49 -0
- package/dist/lib/setup/ui/status.js.map +1 -0
- package/dist/lib/setup/ui/title.d.ts +14 -0
- package/dist/lib/setup/ui/title.d.ts.map +1 -0
- package/dist/lib/setup/ui/title.js +24 -0
- package/dist/lib/setup/ui/title.js.map +1 -0
- package/dist/lib/setup/ui/tokens.d.ts +66 -0
- package/dist/lib/setup/ui/tokens.d.ts.map +1 -0
- package/dist/lib/setup/ui/tokens.js +87 -0
- package/dist/lib/setup/ui/tokens.js.map +1 -0
- package/dist/lib/setup.d.ts +7 -0
- package/dist/lib/setup.d.ts.map +1 -1
- package/dist/lib/setup.js +204 -230
- package/dist/lib/setup.js.map +1 -1
- package/dist/lib/store.d.ts +0 -4
- package/dist/lib/store.d.ts.map +1 -1
- package/dist/lib/store.js +0 -6
- package/dist/lib/store.js.map +1 -1
- package/dist/lib/tags.d.ts +0 -2
- package/dist/lib/tags.d.ts.map +1 -1
- package/dist/lib/tags.js +0 -10
- package/dist/lib/tags.js.map +1 -1
- package/dist/lib/trace.d.ts.map +1 -1
- package/dist/lib/webIngest.d.ts.map +1 -1
- package/dist/lib/webIngest.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,23 +7,17 @@
|
|
|
7
7
|
* directly via `gnosys setup routing` or from the summary-first menu.
|
|
8
8
|
*/
|
|
9
9
|
import { loadConfig, updateConfig, resolveTaskModel, getProviderModel, } from "../../config.js";
|
|
10
|
-
|
|
10
|
+
import { safeQuestion } from "../ui/safePrompt.js";
|
|
11
|
+
import { Header } from "../ui/header.js";
|
|
12
|
+
import { Title } from "../ui/title.js";
|
|
13
|
+
import { Footer } from "../ui/footer.js";
|
|
14
|
+
import { printStatus } from "../ui/status.js";
|
|
15
|
+
import { classifyCost, renderRoutingTable, renderRoutingDiff, } from "../routingRender.js";
|
|
11
16
|
const DIM = "\x1b[2m";
|
|
12
|
-
const GREEN = "\x1b[32m";
|
|
13
17
|
const RESET = "\x1b[0m";
|
|
14
|
-
const CHECK = `${GREEN}✓${RESET}`;
|
|
15
|
-
export const TASK_DESCRIPTIONS = {
|
|
16
|
-
structuring: "adding memories, tagging",
|
|
17
|
-
synthesis: "Q&A answers, ask",
|
|
18
|
-
// v5.8.0 (#2): chat is its own task — was lumped under synthesis before.
|
|
19
|
-
chat: "interactive chat TUI",
|
|
20
|
-
vision: "images, PDFs",
|
|
21
|
-
transcription: "audio files",
|
|
22
|
-
dream: "idle consolidation",
|
|
23
|
-
};
|
|
24
18
|
const TASKS = ["structuring", "synthesis", "chat", "vision", "transcription"];
|
|
25
19
|
async function ask(rl, prompt) {
|
|
26
|
-
return (await rl
|
|
20
|
+
return (await safeQuestion(rl, prompt)).trim();
|
|
27
21
|
}
|
|
28
22
|
async function askYesNo(rl, prompt, defaultYes) {
|
|
29
23
|
const hint = defaultYes ? " [Y/n] " : " [y/N] ";
|
|
@@ -63,18 +57,22 @@ function buildEffectiveRouting(cfg) {
|
|
|
63
57
|
};
|
|
64
58
|
return out;
|
|
65
59
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Build the table-row payload from current routing data. Marks any
|
|
62
|
+
* task whose effective provider/model differs from the snapshot as
|
|
63
|
+
* `changed` so the renderer can highlight it (▶ in accent-hi).
|
|
64
|
+
*/
|
|
65
|
+
function buildTaskRows(routing, baseline, dreamEnabled) {
|
|
66
|
+
const rows = [];
|
|
71
67
|
for (const t of [...TASKS, "dream"]) {
|
|
72
68
|
const r = routing[t];
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
69
|
+
const uses = `${r.provider} / ${r.model}`;
|
|
70
|
+
const cost = t === "dream" && !dreamEnabled ? "free" : classifyCost(r.provider, r.model);
|
|
71
|
+
const base = baseline[t];
|
|
72
|
+
const changed = !base || base.provider !== r.provider || base.model !== r.model;
|
|
73
|
+
rows.push({ task: t, uses, cost, changed });
|
|
76
74
|
}
|
|
77
|
-
|
|
75
|
+
return rows;
|
|
78
76
|
}
|
|
79
77
|
/**
|
|
80
78
|
* Run the task-routing wizard. Reads current config, walks the 3-way choice
|
|
@@ -86,14 +84,16 @@ export async function runRoutingSetup(opts) {
|
|
|
86
84
|
const provider = cfg.llm.defaultProvider;
|
|
87
85
|
const model = getProviderModel(cfg, provider);
|
|
88
86
|
console.log("");
|
|
89
|
-
console.log(
|
|
87
|
+
console.log(Header(["gnosys", "setup", "routing"]));
|
|
90
88
|
console.log("");
|
|
91
|
-
console.log(
|
|
92
|
-
console.log(`(${BOLD}${provider} / ${model}${RESET}). Override per-task or keep defaults.`);
|
|
89
|
+
console.log(Title("Task routing", "each task can use a different model — overrides the default"));
|
|
93
90
|
console.log("");
|
|
94
91
|
const dreamEnabled = !!cfg.dream?.enabled;
|
|
95
|
-
const
|
|
96
|
-
|
|
92
|
+
const baseline = buildEffectiveRouting(cfg);
|
|
93
|
+
// Initial table: nothing has changed yet, so every row is `changed: false`.
|
|
94
|
+
const initialRows = buildTaskRows(baseline, baseline, dreamEnabled);
|
|
95
|
+
console.log(renderRoutingTable(initialRows));
|
|
96
|
+
console.log("");
|
|
97
97
|
const choice = await askChoice(opts.rl, "What would you like to do?", [
|
|
98
98
|
`Keep defaults (all tasks use ${provider})`,
|
|
99
99
|
"Customize individual tasks",
|
|
@@ -112,7 +112,7 @@ export async function runRoutingSetup(opts) {
|
|
|
112
112
|
if (choice === 1) {
|
|
113
113
|
// Customize each task
|
|
114
114
|
for (const t of TASKS) {
|
|
115
|
-
const current =
|
|
115
|
+
const current = baseline[t];
|
|
116
116
|
const keep = await askYesNo(opts.rl, `Keep ${t} → ${current.provider} / ${current.model}?`, true);
|
|
117
117
|
if (!keep) {
|
|
118
118
|
const p = await ask(opts.rl, ` Provider for ${t} (e.g. anthropic, openai, xai, ollama): `);
|
|
@@ -155,8 +155,28 @@ export async function runRoutingSetup(opts) {
|
|
|
155
155
|
model: dreamModel,
|
|
156
156
|
},
|
|
157
157
|
});
|
|
158
|
+
// v5.9.3 Screen 4 — re-render the table with `▶` markers on changed rows
|
|
159
|
+
// followed by a Diff() block summarizing what shipped. Then a final
|
|
160
|
+
// status line that names the saved file.
|
|
161
|
+
const updatedCfg = await loadConfig(opts.directory);
|
|
162
|
+
const updatedRouting = buildEffectiveRouting(updatedCfg);
|
|
163
|
+
const finalRows = buildTaskRows(updatedRouting, baseline, dreamEnabledNew);
|
|
164
|
+
console.log("");
|
|
165
|
+
console.log(renderRoutingTable(finalRows));
|
|
166
|
+
console.log("");
|
|
167
|
+
const diffEntries = [];
|
|
168
|
+
for (const t of [...TASKS, "dream"]) {
|
|
169
|
+
const before = baseline[t];
|
|
170
|
+
const after = updatedRouting[t];
|
|
171
|
+
const fromStr = `${before.provider} / ${before.model}`;
|
|
172
|
+
const toStr = `${after.provider} / ${after.model}`;
|
|
173
|
+
diffEntries.push({ task: t, from: fromStr, to: toStr === fromStr ? null : toStr });
|
|
174
|
+
}
|
|
175
|
+
console.log(renderRoutingDiff(diffEntries));
|
|
158
176
|
console.log("");
|
|
159
|
-
|
|
177
|
+
printStatus("ok", "routing saved", `${opts.directory}/.gnosys/gnosys.json`);
|
|
178
|
+
// Footer hint (right-aligned) for any follow-up navigation in the menu flow.
|
|
179
|
+
console.log(Footer("press enter to return"));
|
|
160
180
|
return true;
|
|
161
181
|
}
|
|
162
182
|
//# sourceMappingURL=routing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../../../src/lib/setup/sections/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../../../src/lib/setup/sections/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,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,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,QAAQ,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACnD,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,sBAAsB,CAAC,CAAC;IAC5E,6EAA6E;IAC7E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,42 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Setup summary-first wizard (v5.
|
|
2
|
+
* Setup summary-first wizard (v5.9.3 redesign).
|
|
3
3
|
*
|
|
4
|
-
* When the user runs `gnosys setup` and a config already exists, the
|
|
5
|
-
* screen is the current settings summary. The user picks a
|
|
6
|
-
* to edit just that piece, returns to the
|
|
7
|
-
* the changed line
|
|
4
|
+
* When the user runs `gnosys setup` and a config already exists, the
|
|
5
|
+
* first screen is the current settings summary. The user picks a
|
|
6
|
+
* numbered option to edit just that piece, returns to the panel with
|
|
7
|
+
* `✓` next to the changed line for the rest of this sitting, and exits
|
|
8
|
+
* with `done` (Enter or `done`).
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* v5.9.3 changes:
|
|
11
|
+
* - Uses Phase A atoms: Header, Panel, Status, Footer, Prompt
|
|
12
|
+
* - Re-reads config from the ACTIVE store path (.gnosys/ if project
|
|
13
|
+
* scope, else ~/.gnosys/) before re-render — fixes the stale-display
|
|
14
|
+
* bug where switching provider via section 3 left the panel showing
|
|
15
|
+
* the old value because loadConfig was reading from project root
|
|
16
|
+
* rather than .gnosys/.
|
|
17
|
+
* - `[D]one` / `[E]xit` collapsed to single "done" action.
|
|
18
|
+
* - `maybeOfferProviderRepair` reworked to column-aligned detection
|
|
19
|
+
* block with no "pre-v5.8.4" history leak.
|
|
12
20
|
*/
|
|
13
21
|
import { Interface as ReadlineInterface } from "readline/promises";
|
|
14
22
|
import { type GnosysConfig } from "../config.js";
|
|
23
|
+
declare function resolveActiveStorePath(projectDir: string): string;
|
|
15
24
|
/** Each summary line is a section the user can navigate into. */
|
|
16
25
|
export interface SummarySection {
|
|
17
|
-
/** Number key shown in the menu. */
|
|
18
26
|
key: string;
|
|
19
|
-
/** Label shown on the summary line (left side). */
|
|
20
27
|
label: string;
|
|
21
|
-
/** Current value — printed on the right side, dim. */
|
|
22
28
|
describe: (cfg: GnosysConfig) => string | Promise<string>;
|
|
23
|
-
/** Run when user picks this line. Returns true if a change was committed. */
|
|
24
29
|
edit: (rl: ReadlineInterface, cfg: GnosysConfig, projectDir: string) => Promise<boolean>;
|
|
25
30
|
}
|
|
31
|
+
export declare function buildSections(): SummarySection[];
|
|
26
32
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
33
|
+
* Render the panel body — one menu-shaped row per section. Returns the
|
|
34
|
+
* row strings (already colored) ready to hand to Panel().
|
|
29
35
|
*/
|
|
30
|
-
|
|
36
|
+
declare function renderPanelRows(cfg: GnosysConfig, sections: SummarySection[]): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Build the `trailing` map of `✓` marks for sections edited this sitting.
|
|
39
|
+
*/
|
|
40
|
+
declare function buildTrailingMap(updated: Set<string>, sections: SummarySection[]): Record<number, string>;
|
|
31
41
|
export interface SummaryOptions {
|
|
32
|
-
/** Project directory the wizard operates on (default: cwd). */
|
|
33
42
|
directory?: string;
|
|
34
|
-
/** Optional pre-existing readline; useful when caller is already prompting. */
|
|
35
43
|
rl?: ReadlineInterface;
|
|
36
44
|
}
|
|
37
45
|
/**
|
|
38
|
-
* Run the summary-first wizard. Loops until the user picks
|
|
39
|
-
*
|
|
46
|
+
* Run the summary-first wizard. Loops until the user picks "done"
|
|
47
|
+
* (Enter or `done`). Returns true if any section was edited.
|
|
40
48
|
*/
|
|
41
49
|
export declare function runSummaryWizard(opts?: SummaryOptions): Promise<boolean>;
|
|
50
|
+
export declare const __test: {
|
|
51
|
+
resolveActiveStorePath: typeof resolveActiveStorePath;
|
|
52
|
+
renderPanelRows: typeof renderPanelRows;
|
|
53
|
+
buildTrailingMap: typeof buildTrailingMap;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
42
56
|
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/summary.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAmB,SAAS,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAIpF,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AA4BtB,iBAAS,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI1D;AAiED,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,EAAE,CAAC,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1F;AAED,wBAAgB,aAAa,IAAI,cAAc,EAAE,CAmGhD;AAcD;;;GAGG;AACH,iBAAe,eAAe,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAW/F;AAED;;GAEG;AACH,iBAAS,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQlG;AAID,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,iBAAiB,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CA2DlF;AAGD,eAAO,MAAM,MAAM;;;;CAAgE,CAAC"}
|
|
@@ -1,33 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Setup summary-first wizard (v5.
|
|
2
|
+
* Setup summary-first wizard (v5.9.3 redesign).
|
|
3
3
|
*
|
|
4
|
-
* When the user runs `gnosys setup` and a config already exists, the
|
|
5
|
-
* screen is the current settings summary. The user picks a
|
|
6
|
-
* to edit just that piece, returns to the
|
|
7
|
-
* the changed line
|
|
4
|
+
* When the user runs `gnosys setup` and a config already exists, the
|
|
5
|
+
* first screen is the current settings summary. The user picks a
|
|
6
|
+
* numbered option to edit just that piece, returns to the panel with
|
|
7
|
+
* `✓` next to the changed line for the rest of this sitting, and exits
|
|
8
|
+
* with `done` (Enter or `done`).
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* v5.9.3 changes:
|
|
11
|
+
* - Uses Phase A atoms: Header, Panel, Status, Footer, Prompt
|
|
12
|
+
* - Re-reads config from the ACTIVE store path (.gnosys/ if project
|
|
13
|
+
* scope, else ~/.gnosys/) before re-render — fixes the stale-display
|
|
14
|
+
* bug where switching provider via section 3 left the panel showing
|
|
15
|
+
* the old value because loadConfig was reading from project root
|
|
16
|
+
* rather than .gnosys/.
|
|
17
|
+
* - `[D]one` / `[E]xit` collapsed to single "done" action.
|
|
18
|
+
* - `maybeOfferProviderRepair` reworked to column-aligned detection
|
|
19
|
+
* block with no "pre-v5.8.4" history leak.
|
|
12
20
|
*/
|
|
13
21
|
import { createInterface } from "readline/promises";
|
|
14
22
|
import { stdin, stdout } from "process";
|
|
23
|
+
import fsSync from "fs";
|
|
24
|
+
import path from "path";
|
|
15
25
|
import { loadConfig, resolveTaskModel, updateConfig, } from "../config.js";
|
|
16
26
|
import { GnosysDB } from "../db.js";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
27
|
+
import { getGnosysHome } from "../paths.js";
|
|
28
|
+
import { safeQuestion } from "./ui/safePrompt.js";
|
|
29
|
+
import { Header } from "./ui/header.js";
|
|
30
|
+
import { Panel } from "./ui/panel.js";
|
|
31
|
+
import { Status } from "./ui/status.js";
|
|
32
|
+
import { Footer } from "./ui/footer.js";
|
|
33
|
+
import { c, color, glyph } from "./ui/tokens.js";
|
|
34
|
+
// Read once at module init — used by Header().
|
|
35
|
+
const PKG_VERSION = (() => {
|
|
36
|
+
try {
|
|
37
|
+
const url = new URL("../../../package.json", import.meta.url);
|
|
38
|
+
const raw = fsSync.readFileSync(url, "utf-8");
|
|
39
|
+
return `v${JSON.parse(raw).version ?? "0.0.0"}`;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
// ─── Active store path ─────────────────────────────────────────────────────
|
|
46
|
+
//
|
|
47
|
+
// loadConfig() reads `<storePath>/gnosys.json`. The active store is either
|
|
48
|
+
// `<projectDir>/.gnosys/` (if that gnosys.json exists) or `~/.gnosys/`
|
|
49
|
+
// (global). Always prefer the project-level one when present so writes by
|
|
50
|
+
// the section editors are visible to the summary re-render.
|
|
51
|
+
function resolveActiveStorePath(projectDir) {
|
|
52
|
+
const projectStore = path.join(projectDir, ".gnosys");
|
|
53
|
+
if (fsSync.existsSync(path.join(projectStore, "gnosys.json")))
|
|
54
|
+
return projectStore;
|
|
55
|
+
return getGnosysHome();
|
|
56
|
+
}
|
|
57
|
+
// ─── Provider-revert repair ────────────────────────────────────────────────
|
|
25
58
|
//
|
|
26
59
|
// Detect the "gnosys.json says anthropic but no Anthropic key exists AND
|
|
27
|
-
// another provider has a key" pattern.
|
|
28
|
-
// pre-v5.8.4 updateConfig bug that silently seeded `defaultProvider:
|
|
29
|
-
// anthropic` into ~/.gnosys/gnosys.json whenever any setup section was
|
|
30
|
-
// written to a fresh store. Offer one-keystroke repair.
|
|
60
|
+
// another provider has a key" pattern. Offer one-keystroke repair.
|
|
31
61
|
const PROVIDERS_WITH_KEYS = ["anthropic", "openai", "xai", "groq", "mistral"];
|
|
32
62
|
async function maybeOfferProviderRepair(cfg, projectDir, rl) {
|
|
33
63
|
if (cfg.llm.defaultProvider !== "anthropic")
|
|
@@ -35,7 +65,7 @@ async function maybeOfferProviderRepair(cfg, projectDir, rl) {
|
|
|
35
65
|
const { getApiKeyForProvider } = await import("../setup.js");
|
|
36
66
|
const anthropicKey = await getApiKeyForProvider("anthropic");
|
|
37
67
|
if (anthropicKey)
|
|
38
|
-
return;
|
|
68
|
+
return;
|
|
39
69
|
const candidates = [];
|
|
40
70
|
for (const p of PROVIDERS_WITH_KEYS) {
|
|
41
71
|
if (p === "anthropic")
|
|
@@ -45,67 +75,54 @@ async function maybeOfferProviderRepair(cfg, projectDir, rl) {
|
|
|
45
75
|
candidates.push(p);
|
|
46
76
|
}
|
|
47
77
|
if (candidates.length === 0)
|
|
48
|
-
return;
|
|
49
|
-
// Pick the strongest candidate. Order in PROVIDERS_WITH_KEYS is the priority.
|
|
78
|
+
return;
|
|
50
79
|
const suggestion = candidates[0];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
const others = candidates.slice(1);
|
|
81
|
+
// Header for the provider-check sub-screen.
|
|
82
|
+
process.stdout.write(`${Header(["gnosys", "setup", "provider-check"], { version: PKG_VERSION })}\n\n`);
|
|
83
|
+
process.stdout.write(`${Status("warn", "default provider mismatch")}\n\n`);
|
|
84
|
+
// Column-aligned detection block.
|
|
85
|
+
const indent = " ";
|
|
86
|
+
const label = (s) => color(c.textDim, s.padEnd(20));
|
|
87
|
+
process.stdout.write(`${indent}${label("gnosys.json says")}${color(c.text, "anthropic")}\n`);
|
|
88
|
+
process.stdout.write(`${indent}${label("anthropic key")}${color(c.textMid, "not found in env or keychain")}\n`);
|
|
89
|
+
process.stdout.write(`${indent}${label("key found for")}${color(c.accentHi, suggestion)}\n`);
|
|
90
|
+
if (others.length > 0) {
|
|
91
|
+
process.stdout.write(`${indent}${label("")}${color(c.textDim, `(also available: ${others.join(", ")})`)}\n`);
|
|
92
|
+
}
|
|
93
|
+
process.stdout.write("\n");
|
|
94
|
+
const answer = (await safeQuestion(rl, ` ${color(c.accent, glyph.prompt)} switch the default to ${color(c.accentHi, suggestion)}? [Y/n] `))
|
|
95
|
+
.trim()
|
|
96
|
+
.toLowerCase();
|
|
59
97
|
if (answer === "n" || answer === "no") {
|
|
60
|
-
|
|
98
|
+
process.stdout.write(`${Status("warn", "keeping anthropic as the default", "edit via section 1 to change")}\n`);
|
|
61
99
|
return;
|
|
62
100
|
}
|
|
63
101
|
try {
|
|
64
|
-
|
|
65
|
-
// override lands at the right scope.
|
|
66
|
-
const { getGnosysHome } = await import("../paths.js");
|
|
67
|
-
const fs = await import("fs/promises");
|
|
68
|
-
const path = await import("path");
|
|
69
|
-
// Prefer project-level if it has a gnosys.json, else global.
|
|
70
|
-
const projectStore = path.join(projectDir, ".gnosys");
|
|
71
|
-
let storePath = getGnosysHome();
|
|
72
|
-
try {
|
|
73
|
-
const stat = await fs.stat(path.join(projectStore, "gnosys.json"));
|
|
74
|
-
if (stat.isFile())
|
|
75
|
-
storePath = projectStore;
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// fall back to global
|
|
79
|
-
}
|
|
102
|
+
const storePath = resolveActiveStorePath(projectDir);
|
|
80
103
|
await updateConfig(storePath, { llm: { defaultProvider: suggestion } });
|
|
81
|
-
|
|
104
|
+
process.stdout.write(`${Status("ok", `default switched · ${suggestion} is now the active provider`)}\n`);
|
|
82
105
|
}
|
|
83
106
|
catch (err) {
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
process.stdout.write(`${Status("warn", `failed to repair: ${err instanceof Error ? err.message : String(err)}`)}\n`);
|
|
108
|
+
process.stdout.write(`${Status("warn", "run 'gnosys setup models' to change manually", "fallback")}\n`);
|
|
86
109
|
}
|
|
87
110
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Build the section list. Each `edit` calls into existing wizards via
|
|
90
|
-
* dynamic import — keeps this file decoupled from the legacy setup.ts.
|
|
91
|
-
*/
|
|
92
111
|
export function buildSections() {
|
|
93
112
|
return [
|
|
94
113
|
{
|
|
95
114
|
key: "1",
|
|
96
|
-
label: "
|
|
115
|
+
label: "provider",
|
|
97
116
|
describe: (cfg) => cfg.llm.defaultProvider,
|
|
98
117
|
edit: async (rl, _cfg, projectDir) => {
|
|
99
118
|
const { runModelsSetup } = await import("../setup.js");
|
|
100
|
-
// v5.8.4: pass the summary's readline through so we don't open a
|
|
101
|
-
// second one and double every keystroke.
|
|
102
119
|
await runModelsSetup({ directory: projectDir, rl });
|
|
103
120
|
return true;
|
|
104
121
|
},
|
|
105
122
|
},
|
|
106
123
|
{
|
|
107
124
|
key: "2",
|
|
108
|
-
label: "
|
|
125
|
+
label: "models",
|
|
109
126
|
describe: async (cfg) => {
|
|
110
127
|
const synth = resolveTaskModel(cfg, "synthesis");
|
|
111
128
|
return `${synth.provider} / ${synth.model}`;
|
|
@@ -118,7 +135,7 @@ export function buildSections() {
|
|
|
118
135
|
},
|
|
119
136
|
{
|
|
120
137
|
key: "3",
|
|
121
|
-
label: "
|
|
138
|
+
label: "task routing",
|
|
122
139
|
describe: async (cfg) => {
|
|
123
140
|
const provs = new Set([
|
|
124
141
|
resolveTaskModel(cfg, "structuring").provider,
|
|
@@ -130,8 +147,8 @@ export function buildSections() {
|
|
|
130
147
|
},
|
|
131
148
|
{
|
|
132
149
|
key: "4",
|
|
133
|
-
label: "
|
|
134
|
-
describe: async (
|
|
150
|
+
label: "ide integrations",
|
|
151
|
+
describe: async () => {
|
|
135
152
|
const { detectIDEs } = await import("../setup.js");
|
|
136
153
|
const ides = await detectIDEs(process.cwd());
|
|
137
154
|
return ides.length === 0 ? "none" : `${ides.length} configured`;
|
|
@@ -140,7 +157,7 @@ export function buildSections() {
|
|
|
140
157
|
},
|
|
141
158
|
{
|
|
142
159
|
key: "5",
|
|
143
|
-
label: "
|
|
160
|
+
label: "multi-machine sync",
|
|
144
161
|
describe: () => {
|
|
145
162
|
try {
|
|
146
163
|
const db = GnosysDB.openLocal();
|
|
@@ -165,7 +182,7 @@ export function buildSections() {
|
|
|
165
182
|
},
|
|
166
183
|
{
|
|
167
184
|
key: "6",
|
|
168
|
-
label: "
|
|
185
|
+
label: "dream mode",
|
|
169
186
|
describe: (cfg) => {
|
|
170
187
|
if (!cfg.dream?.enabled)
|
|
171
188
|
return "disabled";
|
|
@@ -181,7 +198,7 @@ export function buildSections() {
|
|
|
181
198
|
},
|
|
182
199
|
{
|
|
183
200
|
key: "7",
|
|
184
|
-
label: "
|
|
201
|
+
label: "user preferences",
|
|
185
202
|
describe: async () => {
|
|
186
203
|
const { listUserPreferences } = await import("./sections/preferences.js");
|
|
187
204
|
const prefs = await listUserPreferences();
|
|
@@ -194,23 +211,46 @@ export function buildSections() {
|
|
|
194
211
|
},
|
|
195
212
|
];
|
|
196
213
|
}
|
|
197
|
-
// ─── Section editors that don't yet have standalone wizards ────────────────
|
|
198
|
-
/**
|
|
199
|
-
* Per-task routing editor. The legacy `runSetup` walks all 5 tasks in step 4
|
|
200
|
-
* — this lets the user revisit the choice without redoing provider/models.
|
|
201
|
-
*/
|
|
202
214
|
async function editRouting(rl, projectDir) {
|
|
203
215
|
const { runRoutingSetup } = await import("./sections/routing.js");
|
|
204
216
|
return runRoutingSetup({ rl, directory: projectDir });
|
|
205
217
|
}
|
|
206
|
-
/** IDE selection editor — same prompt as step 5 in the linear wizard. */
|
|
207
218
|
async function editIDEs(rl, projectDir) {
|
|
208
219
|
const { runIdesSetup } = await import("./sections/ides.js");
|
|
209
220
|
return runIdesSetup({ rl, directory: projectDir });
|
|
210
221
|
}
|
|
222
|
+
// ─── Rendering ─────────────────────────────────────────────────────────────
|
|
211
223
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
224
|
+
* Render the panel body — one menu-shaped row per section. Returns the
|
|
225
|
+
* row strings (already colored) ready to hand to Panel().
|
|
226
|
+
*/
|
|
227
|
+
async function renderPanelRows(cfg, sections) {
|
|
228
|
+
const labelW = Math.max(...sections.map((s) => s.label.length));
|
|
229
|
+
const rows = [];
|
|
230
|
+
for (const s of sections) {
|
|
231
|
+
const value = await s.describe(cfg);
|
|
232
|
+
const numTxt = color(c.textDim, s.key);
|
|
233
|
+
const labelTxt = color(c.text, s.label.padEnd(labelW));
|
|
234
|
+
const valueTxt = color(c.textMid, value);
|
|
235
|
+
rows.push(` ${numTxt} ${labelTxt} ${valueTxt}`);
|
|
236
|
+
}
|
|
237
|
+
return rows;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Build the `trailing` map of `✓` marks for sections edited this sitting.
|
|
241
|
+
*/
|
|
242
|
+
function buildTrailingMap(updated, sections) {
|
|
243
|
+
const trailing = {};
|
|
244
|
+
sections.forEach((s, idx) => {
|
|
245
|
+
if (updated.has(s.key)) {
|
|
246
|
+
trailing[idx] = color(c.ok, glyph.ok);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return trailing;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Run the summary-first wizard. Loops until the user picks "done"
|
|
253
|
+
* (Enter or `done`). Returns true if any section was edited.
|
|
214
254
|
*/
|
|
215
255
|
export async function runSummaryWizard(opts = {}) {
|
|
216
256
|
const projectDir = opts.directory ?? process.cwd();
|
|
@@ -222,47 +262,35 @@ export async function runSummaryWizard(opts = {}) {
|
|
|
222
262
|
let revertCheckDone = false;
|
|
223
263
|
try {
|
|
224
264
|
while (true) {
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// is the fingerprint of the pre-v5.8.4 updateConfig bug that silently
|
|
231
|
-
// seeded `defaultProvider: anthropic` into ~/.gnosys/gnosys.json when
|
|
232
|
-
// any section was written to a fresh store. Offer one-keystroke repair.
|
|
265
|
+
// Always re-read from the ACTIVE store path so any section edit is
|
|
266
|
+
// reflected immediately. The previous bug used the projectDir root,
|
|
267
|
+
// which didn't contain gnosys.json — only the .gnosys/ subdir did.
|
|
268
|
+
const storePath = resolveActiveStorePath(projectDir);
|
|
269
|
+
const cfg = await loadConfig(storePath);
|
|
233
270
|
if (!revertCheckDone) {
|
|
234
271
|
revertCheckDone = true;
|
|
235
272
|
await maybeOfferProviderRepair(cfg, projectDir, rl);
|
|
236
273
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
console.log("");
|
|
249
|
-
console.log(` Pick a number to edit · ${BOLD}D${RESET}one · ${BOLD}E${RESET}xit`);
|
|
250
|
-
const answer = (await rl.question("> ")).trim().toLowerCase();
|
|
251
|
-
if (!answer || answer === "d" || answer === "done") {
|
|
252
|
-
return anyChange;
|
|
253
|
-
}
|
|
254
|
-
if (answer === "e" || answer === "exit") {
|
|
255
|
-
if (anyChange) {
|
|
256
|
-
console.log(`${DIM}(any changes already committed during section edits stay applied)${RESET}`);
|
|
257
|
-
}
|
|
274
|
+
// Render header + panel.
|
|
275
|
+
process.stdout.write("\n");
|
|
276
|
+
process.stdout.write(`${Header(["gnosys", "setup"], { version: PKG_VERSION })}\n\n`);
|
|
277
|
+
const rows = await renderPanelRows(cfg, sections);
|
|
278
|
+
const trailing = buildTrailingMap(updated, sections);
|
|
279
|
+
process.stdout.write(`${Panel("gnosys settings", rows, { trailing })}\n\n`);
|
|
280
|
+
process.stdout.write(`${Footer(`1–${sections.length} · edit enter · done`)}\n`);
|
|
281
|
+
const answer = (await safeQuestion(rl, ` ${color(c.accent, glyph.prompt)} `))
|
|
282
|
+
.trim()
|
|
283
|
+
.toLowerCase();
|
|
284
|
+
if (!answer || answer === "done") {
|
|
258
285
|
return anyChange;
|
|
259
286
|
}
|
|
260
287
|
const section = sections.find((s) => s.key === answer);
|
|
261
288
|
if (!section) {
|
|
262
|
-
|
|
289
|
+
process.stdout.write(`${Status("warn", `unknown choice: ${answer}`)}\n`);
|
|
263
290
|
continue;
|
|
264
291
|
}
|
|
265
|
-
|
|
292
|
+
// Pass a fresh config snapshot to the editor.
|
|
293
|
+
const cfgForEdit = await loadConfig(storePath);
|
|
266
294
|
try {
|
|
267
295
|
const changed = await section.edit(rl, cfgForEdit, projectDir);
|
|
268
296
|
if (changed) {
|
|
@@ -271,7 +299,7 @@ export async function runSummaryWizard(opts = {}) {
|
|
|
271
299
|
}
|
|
272
300
|
}
|
|
273
301
|
catch (err) {
|
|
274
|
-
|
|
302
|
+
process.stdout.write(`${Status("fail", `section editor failed: ${err instanceof Error ? err.message : String(err)}`)}\n`);
|
|
275
303
|
}
|
|
276
304
|
}
|
|
277
305
|
}
|
|
@@ -280,4 +308,6 @@ export async function runSummaryWizard(opts = {}) {
|
|
|
280
308
|
rl.close();
|
|
281
309
|
}
|
|
282
310
|
}
|
|
311
|
+
// Internal helpers exported for tests.
|
|
312
|
+
export const __test = { resolveActiveStorePath, renderPanelRows, buildTrailingMap };
|
|
283
313
|
//# sourceMappingURL=summary.js.map
|