linersh 0.5.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.
Files changed (95) hide show
  1. package/README.md +168 -0
  2. package/bin/liner.js +126 -0
  3. package/dist/App.js +195 -0
  4. package/dist/App.js.map +1 -0
  5. package/dist/agents/detect.js +102 -0
  6. package/dist/agents/detect.js.map +1 -0
  7. package/dist/agents/events.js +8 -0
  8. package/dist/agents/events.js.map +1 -0
  9. package/dist/agents/jtbd-clarify.js +144 -0
  10. package/dist/agents/jtbd-clarify.js.map +1 -0
  11. package/dist/agents/parsers.js +316 -0
  12. package/dist/agents/parsers.js.map +1 -0
  13. package/dist/agents/prompts.js +301 -0
  14. package/dist/agents/prompts.js.map +1 -0
  15. package/dist/agents/run-log.js +71 -0
  16. package/dist/agents/run-log.js.map +1 -0
  17. package/dist/agents/runner.js +180 -0
  18. package/dist/agents/runner.js.map +1 -0
  19. package/dist/agents/types.js +2 -0
  20. package/dist/agents/types.js.map +1 -0
  21. package/dist/bin-resolver.js +92 -0
  22. package/dist/bin-resolver.js.map +1 -0
  23. package/dist/browser-support.js +62 -0
  24. package/dist/browser-support.js.map +1 -0
  25. package/dist/colors.js +105 -0
  26. package/dist/colors.js.map +1 -0
  27. package/dist/components/Header.js +17 -0
  28. package/dist/components/Header.js.map +1 -0
  29. package/dist/components/KeyHints.js +10 -0
  30. package/dist/components/KeyHints.js.map +1 -0
  31. package/dist/components/LabeledBox.js +53 -0
  32. package/dist/components/LabeledBox.js.map +1 -0
  33. package/dist/components/NextSteps.js +18 -0
  34. package/dist/components/NextSteps.js.map +1 -0
  35. package/dist/config.js +88 -0
  36. package/dist/config.js.map +1 -0
  37. package/dist/editor.js +40 -0
  38. package/dist/editor.js.map +1 -0
  39. package/dist/gates.js +121 -0
  40. package/dist/gates.js.map +1 -0
  41. package/dist/index.js +17 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/ipc.js +136 -0
  44. package/dist/ipc.js.map +1 -0
  45. package/dist/phases.js +348 -0
  46. package/dist/phases.js.map +1 -0
  47. package/dist/progress.js +185 -0
  48. package/dist/progress.js.map +1 -0
  49. package/dist/screens/AgentSetup.js +217 -0
  50. package/dist/screens/AgentSetup.js.map +1 -0
  51. package/dist/screens/BootSplash.js +159 -0
  52. package/dist/screens/BootSplash.js.map +1 -0
  53. package/dist/screens/BrowserSetup.js +181 -0
  54. package/dist/screens/BrowserSetup.js.map +1 -0
  55. package/dist/screens/CompileView.js +297 -0
  56. package/dist/screens/CompileView.js.map +1 -0
  57. package/dist/screens/FramingConfirmReview.js +193 -0
  58. package/dist/screens/FramingConfirmReview.js.map +1 -0
  59. package/dist/screens/Gate1Review.js +143 -0
  60. package/dist/screens/Gate1Review.js.map +1 -0
  61. package/dist/screens/Gate2Review.js +158 -0
  62. package/dist/screens/Gate2Review.js.map +1 -0
  63. package/dist/screens/ImportPrompt.js +65 -0
  64. package/dist/screens/ImportPrompt.js.map +1 -0
  65. package/dist/screens/LocalFilePicker.js +139 -0
  66. package/dist/screens/LocalFilePicker.js.map +1 -0
  67. package/dist/screens/NewMixtapeWizard.js +662 -0
  68. package/dist/screens/NewMixtapeWizard.js.map +1 -0
  69. package/dist/screens/NewProjectPrompt.js +66 -0
  70. package/dist/screens/NewProjectPrompt.js.map +1 -0
  71. package/dist/screens/PhaseRunner.js +1119 -0
  72. package/dist/screens/PhaseRunner.js.map +1 -0
  73. package/dist/screens/ProcessManifest.js +158 -0
  74. package/dist/screens/ProcessManifest.js.map +1 -0
  75. package/dist/screens/ProjectHub.js +546 -0
  76. package/dist/screens/ProjectHub.js.map +1 -0
  77. package/dist/screens/Settings.js +72 -0
  78. package/dist/screens/Settings.js.map +1 -0
  79. package/dist/screens/SourceModal.js +269 -0
  80. package/dist/screens/SourceModal.js.map +1 -0
  81. package/dist/screens/TapeBrowser.js +277 -0
  82. package/dist/screens/TapeBrowser.js.map +1 -0
  83. package/dist/screens/TapeDraftReview.js +440 -0
  84. package/dist/screens/TapeDraftReview.js.map +1 -0
  85. package/dist/screens/TapeEditor.js +310 -0
  86. package/dist/screens/TapeEditor.js.map +1 -0
  87. package/dist/screens/cassette-art.js +72 -0
  88. package/dist/screens/cassette-art.js.map +1 -0
  89. package/dist/store.js +10 -0
  90. package/dist/store.js.map +1 -0
  91. package/dist/types.js +3 -0
  92. package/dist/types.js.map +1 -0
  93. package/dist/yaml-io.js +345 -0
  94. package/dist/yaml-io.js.map +1 -0
  95. package/package.json +54 -0
@@ -0,0 +1,546 @@
1
+ import React, { useMemo, useState } from "react";
2
+ import { Box, Text, useInput, useStdin } from "ink";
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ const TAPE_DRAFT_REL = "working/07-tape-draft.yaml";
7
+ import { Header } from "../components/Header.js";
8
+ import { KeyHints } from "../components/KeyHints.js";
9
+ import { LabeledBox } from "../components/LabeledBox.js";
10
+ import { useApp } from "../store.js";
11
+ import { projectFolder } from "../yaml-io.js";
12
+ import { computePhases, everythingComplete, statusGlyph, statusColor, statusLabel, } from "../phases.js";
13
+ import { migrateProgress, progressFileExists, readProgress, } from "../progress.js";
14
+ import { runShare } from "../ipc.js";
15
+ import { detectAgents } from "../agents/detect.js";
16
+ import { resolveEditor } from "../editor.js";
17
+ import { CURRENT, ERROR, HIGHLIGHT, STRUCTURE, SUCCESS, WARNING } from "../colors.js";
18
+ const EMPIRICAL_TEMPLATE = `# Empirical test (Phase 8)
19
+
20
+ The only real test of whether the mixtape works.
21
+
22
+ ## Question
23
+
24
+ TODO — a substantive question that should benefit from this mixtape's JTBD.
25
+
26
+ ## Answer without mixtape
27
+
28
+ TODO — fresh AI conversation, no context. Save the response (or summary) here.
29
+
30
+ ## Answer with mixtape
31
+
32
+ TODO — fresh AI conversation, pasted MIXTAPE.md + relevant sources/*.md. Save the response here.
33
+
34
+ ## Verdict
35
+
36
+ TODO — is the with-mixtape answer meaningfully better? What's still missing?
37
+ `;
38
+ const PREVIEW_LINES = 14;
39
+ export function ProjectHub({ tape: initialTape, folder, }) {
40
+ const app = useApp();
41
+ const { setRawMode } = useStdin();
42
+ const project = useMemo(() => projectFolder(folder), [folder]);
43
+ const [tape, setTape] = useState(initialTape);
44
+ const [refreshTick, setRefreshTick] = useState(0);
45
+ // Read or migrate the progress cursor on mount. Migration runs once for
46
+ // projects that pre-date `.liner-progress.json` (e.g. created with an
47
+ // older TUI build); it walks the phase artifacts and sets step to the
48
+ // longest consecutive "done" prefix.
49
+ const [progress, setProgress] = useState(() => {
50
+ if (progressFileExists(folder))
51
+ return readProgress(folder);
52
+ return migrateProgress(folder, initialTape);
53
+ });
54
+ const phases = useMemo(() => computePhases(project, tape, progress),
55
+ // refreshTick is intentionally in the dep array so file changes re-derive
56
+ // status. eslint-disable-next-line react-hooks/exhaustive-deps
57
+ [project, tape, progress, refreshTick]);
58
+ // Current index IS the progress cursor — clamped so the all-done state
59
+ // (step >= TOTAL_STEPS) still has a sensible "last visible" phase to focus.
60
+ const currentIndex = Math.min(progress.step, phases.length - 1);
61
+ /** "focus" = single hero card. "toc" = full phase list with up/down navigation. */
62
+ const [viewMode, setViewMode] = useState("focus");
63
+ const [selected, setSelected] = useState(currentIndex);
64
+ // Detect once at mount whether any agent CLI is installed. Drives whether
65
+ // enter on agent-eligible phases runs the agent or falls back to $EDITOR.
66
+ const hasAgent = useMemo(() => detectAgents().length > 0, []);
67
+ const focusedPhase = viewMode === "focus" ? phases[currentIndex] : phases[selected];
68
+ const focusedIndex = viewMode === "focus" ? currentIndex : selected;
69
+ const allDone = everythingComplete(progress);
70
+ function refresh() {
71
+ // Re-read progress in case another screen advanced the cursor (gate
72
+ // accept, phase agent run, compile success). Without this the hub
73
+ // would show stale status until the user navigated away and back.
74
+ setProgress(readProgress(folder));
75
+ setRefreshTick((t) => t + 1);
76
+ }
77
+ function openInEditor(relPath, opts = {}) {
78
+ const full = join(folder, relPath);
79
+ if (!existsSync(full) && opts.template) {
80
+ writeFileSync(full, opts.template, "utf8");
81
+ }
82
+ const editor = resolveEditor();
83
+ setRawMode(false);
84
+ const child = spawn(editor, [full], { stdio: "inherit" });
85
+ child.on("close", () => {
86
+ setRawMode(true);
87
+ refresh();
88
+ app.setNotification({ kind: "info", message: `${relPath} updated.` });
89
+ });
90
+ child.on("error", (e) => {
91
+ setRawMode(true);
92
+ app.setNotification({
93
+ kind: "error",
94
+ message: `Could not launch ${editor}: ${e.message}`,
95
+ });
96
+ });
97
+ }
98
+ /**
99
+ * The primary action for a phase, invoked by Enter. Designed so the user
100
+ * almost never has to think — the most likely thing happens.
101
+ *
102
+ * - Agent-eligible phases: run the agent (or fall back to $EDITOR if no
103
+ * agent CLI is installed).
104
+ * - Gates: open the review screen (blocked if prerequisites missing).
105
+ * - Assembly: review the pending draft if one exists; otherwise run agent.
106
+ * - Compile: dedicated screen.
107
+ */
108
+ function enterPhase(phase) {
109
+ switch (phase.id) {
110
+ case "framing":
111
+ case "candidates":
112
+ case "evaluation":
113
+ case "quality":
114
+ case "synthesis":
115
+ case "empirical": {
116
+ runAgentOrFallback(phase);
117
+ return;
118
+ }
119
+ case "assembly": {
120
+ if (existsSync(join(folder, TAPE_DRAFT_REL))) {
121
+ app.navigate({ kind: "tapeDraft", tape, folder });
122
+ }
123
+ else {
124
+ runAgentOrFallback(phase);
125
+ }
126
+ return;
127
+ }
128
+ case "gate0": {
129
+ if (phase.status === "blocked") {
130
+ app.setNotification({
131
+ kind: "error",
132
+ message: "Confirm framing needs Phase 1 (knowledge map) first.",
133
+ });
134
+ return;
135
+ }
136
+ app.navigate({ kind: "gate0", tape, folder });
137
+ return;
138
+ }
139
+ case "gate1": {
140
+ if (phase.status === "blocked") {
141
+ app.setNotification({
142
+ kind: "error",
143
+ message: "Confirm candidates needs Phase 2 (long-list) first.",
144
+ });
145
+ return;
146
+ }
147
+ app.navigate({ kind: "gate1", tape, folder });
148
+ return;
149
+ }
150
+ case "gate2": {
151
+ if (phase.status === "blocked") {
152
+ app.setNotification({
153
+ kind: "error",
154
+ message: "Confirm evaluation needs Phases 4 and 5 first.",
155
+ });
156
+ return;
157
+ }
158
+ app.navigate({ kind: "gate2", tape, folder });
159
+ return;
160
+ }
161
+ case "compile": {
162
+ if (tape.sources.length === 0) {
163
+ app.setNotification({
164
+ kind: "error",
165
+ message: "Add sources in Phase 7 before compiling.",
166
+ });
167
+ return;
168
+ }
169
+ app.navigate({ kind: "compile", tape, folder });
170
+ return;
171
+ }
172
+ }
173
+ }
174
+ /**
175
+ * Run the configured agent for `phase` if one is installed, otherwise drop
176
+ * the curator into $EDITOR on the phase's artifact (or the source editor
177
+ * for assembly). Either way Enter "does something useful" — the agent vs.
178
+ * editor decision is hidden from the keymap.
179
+ */
180
+ function runAgentOrFallback(phase) {
181
+ if (hasAgent) {
182
+ app.navigate({ kind: "phaseRunner", tape, folder, phaseId: phase.id });
183
+ return;
184
+ }
185
+ app.setNotification({
186
+ kind: "info",
187
+ message: "No agent installed — opening the artifact in $EDITOR.",
188
+ });
189
+ editPhase(phase);
190
+ }
191
+ /**
192
+ * Explicit "edit by hand" path — Enter's escape hatch, bound to `e`.
193
+ * For assembly, "edit" means the source editor (the existing TapeEditor
194
+ * surface) rather than raw tape.yaml in $EDITOR.
195
+ */
196
+ function editPhase(phase) {
197
+ if (phase.id === "assembly") {
198
+ app.navigate({ kind: "editor", tape, folder });
199
+ return;
200
+ }
201
+ if (phase.id === "empirical") {
202
+ openInEditor("working/05-empirical-test.md", { template: EMPIRICAL_TEMPLATE });
203
+ return;
204
+ }
205
+ if (phase.artifact) {
206
+ openInEditor(phase.artifact);
207
+ return;
208
+ }
209
+ app.setNotification({
210
+ kind: "error",
211
+ message: `Phase ${phase.number} has no artifact to edit.`,
212
+ });
213
+ }
214
+ function share() {
215
+ void runShare(folder)
216
+ .then((archivePath) => {
217
+ app.setNotification({ kind: "info", message: `Shared → ${archivePath}` });
218
+ })
219
+ .catch((e) => {
220
+ app.setNotification({ kind: "error", message: e.message });
221
+ });
222
+ }
223
+ function actOnFocused() {
224
+ const phase = focusedPhase;
225
+ if (!phase)
226
+ return;
227
+ // In TOC mode, block entering anything past the current phase — even if
228
+ // its artifact happens to exist from a prior out-of-order run. The
229
+ // methodology is linear; jumping ahead leaves earlier phases empty and
230
+ // confuses the status display.
231
+ if (viewMode === "toc" && focusedIndex > currentIndex) {
232
+ app.setNotification({
233
+ kind: "error",
234
+ message: `Finish ${phases[currentIndex]?.label ?? "the current phase"} first.`,
235
+ });
236
+ return;
237
+ }
238
+ enterPhase(phase);
239
+ }
240
+ useInput((input, key) => {
241
+ if (input === "l") {
242
+ setViewMode((v) => (v === "focus" ? "toc" : "focus"));
243
+ if (viewMode === "focus")
244
+ setSelected(currentIndex);
245
+ return;
246
+ }
247
+ if (viewMode === "toc") {
248
+ if (key.upArrow || input === "k") {
249
+ setSelected((s) => Math.max(0, s - 1));
250
+ return;
251
+ }
252
+ if (key.downArrow || input === "j") {
253
+ setSelected((s) => Math.min(phases.length - 1, s + 1));
254
+ return;
255
+ }
256
+ }
257
+ if (key.return) {
258
+ actOnFocused();
259
+ }
260
+ else if (input === "e") {
261
+ if (focusedPhase)
262
+ editPhase(focusedPhase);
263
+ }
264
+ else if (input === "s") {
265
+ share();
266
+ }
267
+ else if (input === "p") {
268
+ app.navigate({ kind: "manifest", tape, folder });
269
+ }
270
+ else if (key.escape || input === "q") {
271
+ if (viewMode === "toc") {
272
+ setViewMode("focus");
273
+ return;
274
+ }
275
+ void app.refreshProjects();
276
+ app.navigate({ kind: "browser" });
277
+ }
278
+ });
279
+ return (React.createElement(Box, { flexDirection: "column" },
280
+ React.createElement(Header, { title: tape.title || "untitled mixtape", subtitle: `${folder}${tape.jtbd ? ` · ${truncate(tape.jtbd, 60)}` : ""}` }),
281
+ viewMode === "focus" ? (React.createElement(FocusView, { phase: focusedPhase ?? null, folder: folder, everythingDone: allDone })) : (React.createElement(TocView, { phases: phases, selected: selected, currentIndex: currentIndex, folder: folder, tape: tape, hasAgent: hasAgent })),
282
+ React.createElement(ProgressBar, { phases: phases, currentIndex: currentIndex, selected: viewMode === "toc" ? selected : null }),
283
+ app.notification ? (React.createElement(Box, { marginTop: 1 },
284
+ React.createElement(Text, { color: app.notification.kind === "error" ? ERROR : SUCCESS }, app.notification.message))) : null,
285
+ React.createElement(Box, { marginTop: 1 },
286
+ React.createElement(KeyHints, { hints: viewMode === "focus"
287
+ ? [
288
+ { key: "enter", label: hasAgent ? "run this phase" : "edit" },
289
+ { key: "e", label: "edit by hand" },
290
+ { key: "l", label: "list all phases" },
291
+ { key: "p", label: "process" },
292
+ { key: "s", label: "share" },
293
+ { key: "esc", label: "back" },
294
+ ]
295
+ : [
296
+ { key: "↑↓", label: "phase" },
297
+ { key: "enter", label: hasAgent ? "run" : "edit" },
298
+ { key: "e", label: "edit by hand" },
299
+ { key: "l", label: "back to focus" },
300
+ { key: "p", label: "process" },
301
+ { key: "s", label: "share" },
302
+ { key: "esc", label: "focus" },
303
+ ] }))));
304
+ }
305
+ // ---------------------------------------------------------------------------
306
+ // Focus view — single hero phase + actions. Default mode.
307
+ // ---------------------------------------------------------------------------
308
+ function FocusView({ phase, folder, everythingDone, }) {
309
+ if (!phase) {
310
+ return (React.createElement(Box, { marginBottom: 1 },
311
+ React.createElement(Text, { dimColor: true }, "No phases yet.")));
312
+ }
313
+ if (everythingDone) {
314
+ return (React.createElement(Box, { marginBottom: 1 },
315
+ React.createElement(LabeledBox, { label: "all done", color: SUCCESS },
316
+ React.createElement(Box, { marginBottom: 1 },
317
+ React.createElement(Text, { color: SUCCESS, bold: true }, "\u2713 every phase complete")),
318
+ React.createElement(Text, null,
319
+ "Press ",
320
+ React.createElement(Text, { color: STRUCTURE }, "l"),
321
+ " to revisit any phase, or",
322
+ " ",
323
+ React.createElement(Text, { color: STRUCTURE }, "s"),
324
+ " to share the mixtape."))));
325
+ }
326
+ const phaseStatusColor = statusColor(phase.status);
327
+ // One color for both border and chip — they're a single element visually
328
+ // (the chip is a solid section of the top border line). Picks:
329
+ // in_progress → CURRENT (yellow) — "you are here"
330
+ // complete → SUCCESS (green)
331
+ // anything else → STRUCTURE (cyan) — neutral / not_started
332
+ const boxColor = phase.status === "in_progress" ? CURRENT :
333
+ phase.status === "complete" ? SUCCESS :
334
+ STRUCTURE;
335
+ return (React.createElement(Box, { marginBottom: 1 },
336
+ React.createElement(LabeledBox, { label: chipLabelFor(phase), color: boxColor },
337
+ React.createElement(Box, { marginBottom: 1 },
338
+ React.createElement(Text, { color: phaseStatusColor },
339
+ statusGlyph(phase.status),
340
+ " ",
341
+ statusLabel(phase.status))),
342
+ React.createElement(Text, null, phase.summary),
343
+ phase.subSteps && phase.subSteps.length > 0 ? (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
344
+ React.createElement(SubStepList, { steps: phase.subSteps }))) : (React.createElement(Box, { marginTop: 1 },
345
+ React.createElement(Text, { dimColor: true }, phase.detail))),
346
+ phase.id === "assembly" && existsSync(join(folder, TAPE_DRAFT_REL)) ? (React.createElement(Box, { marginTop: 1 },
347
+ React.createElement(Text, { color: WARNING, bold: true }, "\u26A0 draft pending \u2014 "),
348
+ React.createElement(Text, null,
349
+ "press ",
350
+ React.createElement(Text, { color: STRUCTURE }, "enter"),
351
+ " to review."))) : null)));
352
+ }
353
+ /**
354
+ * Render a phase's sub-step checklist. Done steps get a green ✓ and stay
355
+ * fully colored; pending steps get a dim ○ and lighter text so the eye lands
356
+ * on what's already accomplished. Hints render dim after the main text.
357
+ */
358
+ function SubStepList({ steps }) {
359
+ return (React.createElement(Box, { flexDirection: "column" }, steps.map((step, i) => (React.createElement(Box, { key: i },
360
+ React.createElement(Text, { color: step.done ? SUCCESS : STRUCTURE, bold: step.done }, step.done ? "✓" : "○"),
361
+ React.createElement(Text, { dimColor: !step.done }, ` ${step.text}`),
362
+ step.hint ? (React.createElement(Text, { dimColor: true }, ` · ${step.hint}`)) : null)))));
363
+ }
364
+ // ---------------------------------------------------------------------------
365
+ // TOC view — full phase list. Behind `l`.
366
+ // ---------------------------------------------------------------------------
367
+ function TocView({ phases, selected, currentIndex, folder, tape, hasAgent, }) {
368
+ const selectedPhase = phases[selected];
369
+ return (React.createElement(Box, { flexDirection: "row", width: "100%", marginBottom: 1 },
370
+ React.createElement(Box, { flexDirection: "column", width: "38%", minWidth: 26, flexShrink: 0 }, phases.map((phase, i) => (React.createElement(PhaseRow, { key: phase.id, phase: phase, selected: i === selected, future: i > currentIndex })))),
371
+ React.createElement(Box, { width: 2, flexShrink: 0 },
372
+ React.createElement(Text, { dimColor: true }, "\u2502")),
373
+ React.createElement(Box, { flexDirection: "column", flexGrow: 1, minWidth: 20 }, selectedPhase ? (React.createElement(PhaseDetail, { phase: selectedPhase, folder: folder, tape: tape, hasAgent: hasAgent })) : null)));
374
+ }
375
+ // ---------------------------------------------------------------------------
376
+ // Progress bar — dense single-line summary.
377
+ // ---------------------------------------------------------------------------
378
+ function ProgressBar({ phases, currentIndex, selected, }) {
379
+ return (React.createElement(Box, { flexWrap: "wrap", columnGap: 1 },
380
+ React.createElement(Text, { dimColor: true }, "progress: "),
381
+ phases.map((p, i) => {
382
+ const isCurrent = i === currentIndex;
383
+ const isSelected = selected != null && i === selected;
384
+ const isPast = p.status === "complete";
385
+ const color = isPast ? SUCCESS : isCurrent ? STRUCTURE : undefined;
386
+ return (React.createElement(Text, { key: p.id, backgroundColor: isSelected ? STRUCTURE : undefined, color: isSelected ? "black" : color, bold: isCurrent || isSelected, dimColor: !isPast && !isCurrent && !isSelected },
387
+ phaseShortLabel(p),
388
+ statusGlyph(p.status)));
389
+ })));
390
+ }
391
+ function phaseShortLabel(phase) {
392
+ // For numeric phases, use the number; for special phases (gates, compile),
393
+ // the `number` field is already a single glyph (↳, →) — pass it through.
394
+ return phase.number;
395
+ }
396
+ /**
397
+ * Long-form label for the focus card chip + TOC detail header. Numbered phases
398
+ * read "Phase N — Label"; gates and compile (whose `number` is a glyph like
399
+ * `↳` or `→`) read just the label — no "Phase glyph —" awkwardness.
400
+ */
401
+ function chipLabelFor(phase) {
402
+ if (/^\d/.test(phase.number))
403
+ return `Phase ${phase.number} — ${phase.label}`;
404
+ return phase.label;
405
+ }
406
+ function PhaseRow({ phase, selected, future = false, }) {
407
+ const statusFg = statusColor(phase.status);
408
+ if (selected) {
409
+ return (React.createElement(Box, null,
410
+ React.createElement(Text, { backgroundColor: STRUCTURE, color: HIGHLIGHT, bold: true }, " ▶ "),
411
+ React.createElement(Text, { backgroundColor: STRUCTURE, color: statusFg ?? "black", bold: true },
412
+ statusGlyph(phase.status),
413
+ " "),
414
+ React.createElement(Text, { backgroundColor: STRUCTURE, color: HIGHLIGHT }, phase.number.padEnd(7, " ")),
415
+ React.createElement(Text, { backgroundColor: STRUCTURE, color: HIGHLIGHT, bold: true },
416
+ truncate(phase.label, 22),
417
+ future ? " 🔒" : "",
418
+ " ")));
419
+ }
420
+ return (React.createElement(Box, null,
421
+ React.createElement(Text, null, " "),
422
+ React.createElement(Text, { color: future ? undefined : statusFg, dimColor: future },
423
+ statusGlyph(phase.status),
424
+ " "),
425
+ React.createElement(Text, { dimColor: true }, phase.number.padEnd(7, " ")),
426
+ React.createElement(Text, { dimColor: future }, truncate(phase.label, 22))));
427
+ }
428
+ function PhaseDetail({ phase, folder, tape, hasAgent, }) {
429
+ return (React.createElement(Box, { flexDirection: "column" },
430
+ React.createElement(Box, null,
431
+ React.createElement(Text, { bold: true }, chipLabelFor(phase)),
432
+ React.createElement(Text, null, " "),
433
+ React.createElement(Text, { color: statusColor(phase.status) },
434
+ statusGlyph(phase.status),
435
+ " ",
436
+ statusLabel(phase.status))),
437
+ React.createElement(Box, { marginTop: 1 },
438
+ React.createElement(Text, null, phase.summary)),
439
+ phase.subSteps && phase.subSteps.length > 0 ? (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
440
+ React.createElement(SubStepList, { steps: phase.subSteps }))) : (React.createElement(Box, { marginTop: 1 },
441
+ React.createElement(Text, { dimColor: true }, phase.detail))),
442
+ phase.artifact ? (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
443
+ React.createElement(Text, { dimColor: true }, "artifact:"),
444
+ React.createElement(Text, { dimColor: true },
445
+ " ",
446
+ phase.artifact),
447
+ React.createElement(ArtifactPreview, { folder: folder, relPath: phase.artifact }))) : null,
448
+ phase.id === "assembly" && tape.sources.length > 0 ? (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
449
+ React.createElement(Text, { dimColor: true },
450
+ "sources on tape (",
451
+ tape.sources.length,
452
+ "):"),
453
+ tape.sources.slice(0, 6).map((s, i) => {
454
+ const label = s.type === "local_file" ? s.citation || s.path || "" : s.url;
455
+ return (React.createElement(Text, { key: i, dimColor: true },
456
+ i + 1,
457
+ ". ",
458
+ truncate(label, 60)));
459
+ }),
460
+ tape.sources.length > 6 ? (React.createElement(Text, { dimColor: true },
461
+ " \u2026 and ",
462
+ tape.sources.length - 6,
463
+ " more")) : null)) : null,
464
+ phase.id === "assembly" && existsSync(join(folder, TAPE_DRAFT_REL)) ? (React.createElement(Box, { marginTop: 1 },
465
+ React.createElement(Text, { color: WARNING, bold: true },
466
+ "\u26A0 draft pending \u2014",
467
+ " "),
468
+ React.createElement(Text, null,
469
+ "an agent run wrote",
470
+ " ",
471
+ React.createElement(Text, { color: STRUCTURE }, TAPE_DRAFT_REL),
472
+ ". Press",
473
+ " ",
474
+ React.createElement(Text, { color: STRUCTURE }, "enter"),
475
+ " to review."))) : null,
476
+ React.createElement(Box, { marginTop: 1, flexDirection: "column" },
477
+ React.createElement(Box, null,
478
+ React.createElement(Text, { color: STRUCTURE }, "enter"),
479
+ React.createElement(Text, null, " "),
480
+ React.createElement(Text, null, primaryActionLabel(phase, hasAgent, folder))),
481
+ phase.artifact && phase.id !== "compile" ? (React.createElement(Box, null,
482
+ React.createElement(Text, { color: STRUCTURE }, "e "),
483
+ React.createElement(Text, null,
484
+ " edit by hand (",
485
+ phase.artifact,
486
+ " in $EDITOR)"))) : null)));
487
+ }
488
+ function ArtifactPreview({ folder, relPath, }) {
489
+ const full = join(folder, relPath);
490
+ if (!existsSync(full)) {
491
+ return (React.createElement(Box, { marginTop: 1 },
492
+ React.createElement(Text, { dimColor: true }, " (file not on disk yet)")));
493
+ }
494
+ let text;
495
+ try {
496
+ text = readFileSync(full, "utf8");
497
+ }
498
+ catch {
499
+ return null;
500
+ }
501
+ const lines = text.split("\n").slice(0, PREVIEW_LINES);
502
+ if (lines.length === 0) {
503
+ return (React.createElement(Box, { marginTop: 1 },
504
+ React.createElement(Text, { dimColor: true }, " (empty)")));
505
+ }
506
+ return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
507
+ lines.map((line, i) => (React.createElement(Text, { key: i, dimColor: true },
508
+ " ",
509
+ truncate(line, 72) || " "))),
510
+ text.split("\n").length > PREVIEW_LINES ? (React.createElement(Text, { dimColor: true }, " \u2026")) : null));
511
+ }
512
+ /**
513
+ * What Enter does for this phase, expressed as a short human label.
514
+ * Designed to read aloud: "Enter: run Phase 1 with Claude" / "Enter: open Gate 1 review".
515
+ */
516
+ function primaryActionLabel(phase, hasAgent, folder) {
517
+ switch (phase.id) {
518
+ case "gate0":
519
+ return "review the knowledge map";
520
+ case "gate1":
521
+ return "review the candidate long-list";
522
+ case "gate2":
523
+ return "review evaluation + quality checks";
524
+ case "assembly":
525
+ if (existsSync(join(folder, TAPE_DRAFT_REL))) {
526
+ return "review the agent's proposed sources";
527
+ }
528
+ return hasAgent
529
+ ? "let the agent populate sources from the keep-list"
530
+ : "open the source editor";
531
+ case "compile":
532
+ return "start compile — fetches sources and writes MIXTAPE.md";
533
+ case "empirical":
534
+ return hasAgent
535
+ ? "run the empirical test with the agent"
536
+ : "open working/05-empirical-test.md";
537
+ default:
538
+ return hasAgent
539
+ ? `run Phase ${phase.number} with the agent`
540
+ : `open ${phase.artifact ?? "phase"} in $EDITOR`;
541
+ }
542
+ }
543
+ function truncate(s, n) {
544
+ return s.length > n ? s.slice(0, n - 1) + "…" : s;
545
+ }
546
+ //# sourceMappingURL=ProjectHub.js.map
@@ -0,0 +1 @@
1
+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AmC,CAAC;QAC1C;YACE,OAAO,QAAQ;gBACb,CAAC,CAAC,aAAa,KAAK,CAAC,MAAM,iBAAiB;gBAC5C,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,IAAI,OAAO,aAAa,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,72 @@
1
+ import React, { useMemo, useState } from "react";
2
+ import { Box, Text, useInput } from "ink";
3
+ import { getBrowserSupportStatus } from "../browser-support.js";
4
+ import { CURRENT, HEADING, STRUCTURE } from "../colors.js";
5
+ import { Header } from "../components/Header.js";
6
+ import { KeyHints } from "../components/KeyHints.js";
7
+ import { LabeledBox } from "../components/LabeledBox.js";
8
+ import { readConfig } from "../config.js";
9
+ import { useApp } from "../store.js";
10
+ export function Settings() {
11
+ const app = useApp();
12
+ const config = useMemo(() => readConfig(), []);
13
+ const browser = useMemo(() => getBrowserSupportStatus(), []);
14
+ const items = [
15
+ {
16
+ action: "agent",
17
+ label: "AI agent",
18
+ detail: config.agent ? `current: ${config.agent}` : "choose Claude Code or Codex",
19
+ },
20
+ {
21
+ action: "browser",
22
+ label: "Browser support",
23
+ detail: browser.ready ? "installed; manage or remove" : "not installed; optional setup",
24
+ },
25
+ ];
26
+ const [selected, setSelected] = useState(0);
27
+ function open(action) {
28
+ if (action === "agent")
29
+ app.navigate({ kind: "agentSetup" });
30
+ else
31
+ app.navigate({ kind: "browserSetup" });
32
+ }
33
+ useInput((input, key) => {
34
+ if (key.upArrow || input === "k") {
35
+ setSelected((i) => (i - 1 + items.length) % items.length);
36
+ }
37
+ else if (key.downArrow || input === "j") {
38
+ setSelected((i) => (i + 1) % items.length);
39
+ }
40
+ else if (key.return || input === " ") {
41
+ open(items[selected].action);
42
+ }
43
+ else if (input === "a") {
44
+ open("agent");
45
+ }
46
+ else if (input === "b") {
47
+ open("browser");
48
+ }
49
+ else if (key.escape || input === "h") {
50
+ app.home();
51
+ }
52
+ else if (input === "q") {
53
+ app.quit();
54
+ }
55
+ });
56
+ return (React.createElement(Box, { flexDirection: "column" },
57
+ React.createElement(Header, { title: "settings", subtitle: "agent and local browser support" }),
58
+ React.createElement(Box, { marginBottom: 1 },
59
+ React.createElement(LabeledBox, { label: "preferences", color: STRUCTURE }, items.map((item, index) => (React.createElement(Box, { key: item.action },
60
+ React.createElement(Text, { color: index === selected ? CURRENT : undefined, bold: index === selected }, index === selected ? "> " : " "),
61
+ React.createElement(Text, { color: STRUCTURE }, `[${item.action === "agent" ? "a" : "b"}]`),
62
+ React.createElement(Text, null, " "),
63
+ React.createElement(Text, { color: index === selected ? CURRENT : HEADING, bold: index === selected }, item.label.padEnd(18, " ")),
64
+ React.createElement(Text, { dimColor: true }, item.detail)))))),
65
+ React.createElement(KeyHints, { hints: [
66
+ { key: "↑↓", label: "select" },
67
+ { key: "enter", label: "open" },
68
+ { key: "esc", label: "home" },
69
+ { key: "q", label: "quit" },
70
+ ] })));
71
+ }
72
+ //# sourceMappingURL=Settings.js.map