projectstore-claude 0.30.4 → 0.30.6
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/node_modules/projectstore/.claude-plugin/marketplace.json +2 -2
- package/node_modules/projectstore/.claude-plugin/plugin.json +6 -2
- package/node_modules/projectstore/.mcp.json +1 -2
- package/node_modules/projectstore/README.md +65 -16
- package/node_modules/projectstore/agents/archaeologist.md +1 -1
- package/node_modules/projectstore/agents/librarian.md +1 -1
- package/node_modules/projectstore/agents/planner.md +1 -1
- package/node_modules/projectstore/commands/doctor.md +14 -11
- package/node_modules/projectstore/commands/reconcile.md +1 -1
- package/node_modules/projectstore/commands/review.md +2 -2
- package/node_modules/projectstore/commands/story.md +1 -1
- package/node_modules/projectstore/docs/getting-started.md +3 -4
- package/node_modules/projectstore/docs/harnesses.md +1 -1
- package/node_modules/projectstore/docs/how-it-works.md +7 -0
- package/node_modules/projectstore/docs/images/icon.png +0 -0
- package/node_modules/projectstore/harnesses/claude-code.json +61 -11
- package/node_modules/projectstore/harnesses/codex.json +45 -15
- package/node_modules/projectstore/hooks/band.tsx +19 -8
- package/node_modules/projectstore/hooks/hooks.json +6 -6
- package/node_modules/projectstore/hooks/session-start.mjs +55 -24
- package/node_modules/projectstore/hooks/session-stop.mjs +43 -20
- package/node_modules/projectstore/package.json +11 -12
- package/node_modules/projectstore/scripts/band-shared.mjs +17 -2
- package/node_modules/projectstore/scripts/band.mjs +20 -2
- package/node_modules/projectstore/scripts/binding.mjs +1 -1
- package/node_modules/projectstore/scripts/build-adapters.mjs +45 -4
- package/node_modules/projectstore/scripts/cli.mjs +74 -1373
- package/node_modules/projectstore/scripts/convergence.mjs +59 -16
- package/node_modules/projectstore/scripts/doctor.mjs +199 -36
- package/node_modules/projectstore/scripts/harness.mjs +88 -6
- package/node_modules/projectstore/scripts/install-handlers.mjs +925 -0
- package/node_modules/projectstore/scripts/install-harness.mjs +129 -2081
- package/node_modules/projectstore/scripts/install-layout.mjs +453 -0
- package/node_modules/projectstore/scripts/install-preview.mjs +747 -0
- package/node_modules/projectstore/scripts/lib.mjs +387 -107
- package/node_modules/projectstore/scripts/mcp-server.mjs +33 -0
- package/node_modules/projectstore/scripts/mcp.mjs +60 -60
- package/node_modules/projectstore/scripts/model-spec.mjs +24 -0
- package/node_modules/projectstore/scripts/models.mjs +6 -10
- package/node_modules/projectstore/scripts/query.mjs +7 -6
- package/node_modules/projectstore/scripts/read-verbs.mjs +277 -0
- package/node_modules/projectstore/scripts/setup.mjs +62 -12
- package/node_modules/projectstore/scripts/statusline-launcher.mjs +36 -3
- package/node_modules/projectstore/scripts/surfaces.mjs +18 -5
- package/node_modules/projectstore/scripts/touch-session.mjs +30 -15
- package/node_modules/projectstore/scripts/verbs.mjs +1202 -0
- package/node_modules/projectstore/scripts/version-guard.mjs +57 -7
- package/package.json +3 -3
- package/node_modules/projectstore/docs/images/loop-light.svg +0 -94
- package/node_modules/projectstore/docs/images/team-light.svg +0 -79
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
// projectstore — install-preview.mjs: PLAN, the badge, the update notice and
|
|
2
|
+
// the APPLY lines (presentation spec contracts 6–8).
|
|
3
|
+
//
|
|
4
|
+
// Moved out of install-harness.mjs as it was (the story "The installer is
|
|
5
|
+
// split into modules under 200 KiB each, with every export and every test
|
|
6
|
+
// unchanged"). Pure: renderPreview, badgeLine and noticeText return strings,
|
|
7
|
+
// and applyReporter writes only to the stream it is handed. The installer
|
|
8
|
+
// re-exports all four under the names its callers import, and its DONE and
|
|
9
|
+
// STOPPED screens (renderDone) read the row helpers from here.
|
|
10
|
+
//
|
|
11
|
+
// A leaf: it imports neither the installer nor any module that reads the
|
|
12
|
+
// registry, fetches a shell or runs a host command.
|
|
13
|
+
|
|
14
|
+
import { dirname, basename } from "node:path";
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
import {
|
|
17
|
+
painter,
|
|
18
|
+
icon as termIcon,
|
|
19
|
+
stepReporter,
|
|
20
|
+
wrap,
|
|
21
|
+
plain,
|
|
22
|
+
badge as badgeText,
|
|
23
|
+
heading,
|
|
24
|
+
rowLines,
|
|
25
|
+
commandBlock,
|
|
26
|
+
PLAIN,
|
|
27
|
+
} from "./term.mjs";
|
|
28
|
+
import { loadHarness } from "./harness.mjs";
|
|
29
|
+
import { rel, isConsequence, isWrite } from "./install-handlers.mjs";
|
|
30
|
+
|
|
31
|
+
// ─── preview ───────────────────────────────────────────────────────────
|
|
32
|
+
//
|
|
33
|
+
// PLAN (presentation spec contract 7, which revises the layout clauses of
|
|
34
|
+
// install spec contract 18): the badge, the project path, a summary line of
|
|
35
|
+
// counts, then the rows grouped under each run harness's display name, in run
|
|
36
|
+
// order. A row is one aligned line — glyph, action word, target, note — and
|
|
37
|
+
// beneath it what the reader consents to (install spec contract 9: every path
|
|
38
|
+
// written and every host argv, with the files it touches), the reason when
|
|
39
|
+
// there is one, and a consequence the reader must know. Internal words —
|
|
40
|
+
// kinds, provenance states, entry markers, roadmap ids — and each step's why
|
|
41
|
+
// are behind `--verbose`. Groups and counts are computed here, never added to
|
|
42
|
+
// the plan: plan --json keeps its keys. Colour and glyphs are the caller's
|
|
43
|
+
// stream's (`caps`, term.mjs); the default is plain text in Unicode.
|
|
44
|
+
const unicodeGlyph = (name) => termIcon({ ascii: false }, name);
|
|
45
|
+
|
|
46
|
+
// Every action a plan item can carry, as its glyph. A write never wears the
|
|
47
|
+
// skip glyph: `add` and `replace-entry` are changes as much as `create` and
|
|
48
|
+
// `update`.
|
|
49
|
+
// A copy from another marketplace turned off for this checkout is a channel
|
|
50
|
+
// switch, `disable` (the converge story; contract 7's `switch` word, ⇄).
|
|
51
|
+
const ACTION_ICON = {
|
|
52
|
+
create: "create",
|
|
53
|
+
add: "create",
|
|
54
|
+
update: "update",
|
|
55
|
+
"replace-entry": "update",
|
|
56
|
+
migrate: "migrate",
|
|
57
|
+
disable: "switch",
|
|
58
|
+
cleanup: "cleanup",
|
|
59
|
+
remove: "remove",
|
|
60
|
+
prune: "remove",
|
|
61
|
+
skip: "skip",
|
|
62
|
+
refuse: "refuse",
|
|
63
|
+
};
|
|
64
|
+
// …and as a person's word (contract 7's table). A registration's write takes
|
|
65
|
+
// `register`; a skip reads `unchanged` when the item is current and carries
|
|
66
|
+
// no reason, and `skipped` otherwise — deferred, opted out, unsupported, or
|
|
67
|
+
// left in place: a current row with a reason is one the run did not act on
|
|
68
|
+
// for that reason (uninstall keeping a user-global registration, a host CLI
|
|
69
|
+
// not on PATH), and the reason beneath it is what the reader acts on.
|
|
70
|
+
const ACTION_WORD = {
|
|
71
|
+
create: "add",
|
|
72
|
+
add: "add",
|
|
73
|
+
update: "update",
|
|
74
|
+
"replace-entry": "update",
|
|
75
|
+
migrate: "update",
|
|
76
|
+
disable: "switch",
|
|
77
|
+
cleanup: "remove",
|
|
78
|
+
remove: "remove",
|
|
79
|
+
prune: "remove",
|
|
80
|
+
refuse: "refused",
|
|
81
|
+
};
|
|
82
|
+
// Each word's colour role (contract 3): a refusal's ▲, a channel switch and a
|
|
83
|
+
// removal are attention; red is for what failed.
|
|
84
|
+
const WORD_ROLE = {
|
|
85
|
+
add: "done",
|
|
86
|
+
register: "done",
|
|
87
|
+
update: "action",
|
|
88
|
+
switch: "attention",
|
|
89
|
+
remove: "attention",
|
|
90
|
+
refused: "attention",
|
|
91
|
+
unchanged: "explanation",
|
|
92
|
+
skipped: "explanation",
|
|
93
|
+
};
|
|
94
|
+
// APPLY says a word while its step runs and once it has (contract 8).
|
|
95
|
+
const WORD_TENSES = {
|
|
96
|
+
add: ["adding", "added"],
|
|
97
|
+
register: ["registering", "registered"],
|
|
98
|
+
update: ["updating", "updated"],
|
|
99
|
+
switch: ["switching", "switched"],
|
|
100
|
+
remove: ["removing", "removed"],
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const CURRENT_STATES = new Set(["current", "ours-current", "ours"]);
|
|
104
|
+
const isUnchanged = (i) => i.action === "skip" && !i.deferred && !i.reason && CURRENT_STATES.has(i.state);
|
|
105
|
+
// A surface this harness does not have: folded into one line per harness.
|
|
106
|
+
const isUnsupported = (i) => i.action === "skip" && i.state === "unsupported";
|
|
107
|
+
// A row of something another project wrote last (install spec contract 12):
|
|
108
|
+
// never collapsed, and its note says whose it is.
|
|
109
|
+
const writtenElsewhere = (i) => i.state === "current" && Boolean(i.writtenBy) && !i.sameProject;
|
|
110
|
+
// A row that writes nothing and asks nothing of the reader collapses into
|
|
111
|
+
// one line per group naming it (contract 7).
|
|
112
|
+
const isQuiet = (i) => isUnchanged(i) && !writtenElsewhere(i) && !(i.steps || []).length;
|
|
113
|
+
// The registration row a fetched shell's registry lines sit beneath, when the
|
|
114
|
+
// run fetched one from a registry that is not the user's.
|
|
115
|
+
const fetchedFor = (p, i) =>
|
|
116
|
+
p.fetchedFrom &&
|
|
117
|
+
i.kind === "registration" &&
|
|
118
|
+
!String(i.surface).endsWith("_others") &&
|
|
119
|
+
p.fetchedFrom.harnesses.includes(i.harness)
|
|
120
|
+
? p.fetchedFrom
|
|
121
|
+
: null;
|
|
122
|
+
|
|
123
|
+
function actionWord(i) {
|
|
124
|
+
if (i.action === "skip") return isUnchanged(i) ? "unchanged" : "skipped";
|
|
125
|
+
if (i.kind === "registration" && ["create", "add", "update"].includes(i.action)) return "register";
|
|
126
|
+
return ACTION_WORD[i.action] || "update";
|
|
127
|
+
}
|
|
128
|
+
const glyphName = (i) => ACTION_ICON[i.action] || (isWrite(i) ? "update" : "skip");
|
|
129
|
+
// The surface key in words: `agents_block` reads "agents block".
|
|
130
|
+
export const surfaceWords = (key) => String(key).replace(/_/g, " ");
|
|
131
|
+
// What a row names: a registration by its plugin id — its paths are the
|
|
132
|
+
// consent lines beneath it — anything else by its path, project-relative.
|
|
133
|
+
export function rowTarget(p, i, home = homedir()) {
|
|
134
|
+
// …and the keep (kind `channel`) by the key of the copy it keeps.
|
|
135
|
+
if ((i.kind === "registration" || i.kind === "channel") && i.entry) return i.entry;
|
|
136
|
+
if (i.path === null) return `${i.surface} [${i.harness}, no filesystem path]`;
|
|
137
|
+
// Setup's vault and state directories, as directories; a vault outside the
|
|
138
|
+
// project — beside it, usually — by its path from home, as the project's.
|
|
139
|
+
if (i.kind === "vault") {
|
|
140
|
+
const r = rel(p.projectDir, i.path);
|
|
141
|
+
return `${r === i.path ? tilde(i.path, home) : r}/`;
|
|
142
|
+
}
|
|
143
|
+
if (i.kind === "state") return `${rel(p.projectDir, i.path)}/`;
|
|
144
|
+
return rel(p.projectDir, i.path);
|
|
145
|
+
}
|
|
146
|
+
// The heading of the group of rows that belong to no harness: setup's vault
|
|
147
|
+
// (presentation spec contract 7's VAULT group, first when present).
|
|
148
|
+
export const VAULT_GROUP = "Vault";
|
|
149
|
+
function rowNote(i, { verbose, glyph }) {
|
|
150
|
+
const words = writtenElsewhere(i) ? `last written by ${i.writtenBy}` : surfaceWords(i.surface);
|
|
151
|
+
if (!verbose) return words;
|
|
152
|
+
return `${words} ${glyph("dot")} ${i.kind}${i.entry && i.kind !== "registration" ? ` [${i.entry}]` : ""}`;
|
|
153
|
+
}
|
|
154
|
+
// --verbose's line beneath a row: the provenance state, the reason and the
|
|
155
|
+
// plan's own action, as install spec contract 18 wrote them.
|
|
156
|
+
function transitionText(i, glyph) {
|
|
157
|
+
let state = writtenElsewhere(i) ? `current, last written by ${i.writtenBy}` : i.state;
|
|
158
|
+
// A reason with commands gives its prose here; the commands follow, alone.
|
|
159
|
+
const reason = i.advice ? i.advice.text : i.reason;
|
|
160
|
+
if (reason && i.action !== "refuse") state += ` (${reason})`;
|
|
161
|
+
// A dry run's unchanged registration: right by every host fact, its
|
|
162
|
+
// payload digest still to compare. Said only where the reasoning is.
|
|
163
|
+
if (i.digestDeferred) state += " (the payload digest is compared when install or upgrade fetches the shell)";
|
|
164
|
+
return `${state} ${glyph("transition")} ${i.action}${i.action === "refuse" && i.reason ? ": " + i.reason : ""}`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// One step of an item as the lines it shows: always the action and its target,
|
|
168
|
+
// then — under --verbose — why it runs.
|
|
169
|
+
function stepLines(p, st, { verbose, paint, width = 0, glyph = unicodeGlyph, home = homedir() }) {
|
|
170
|
+
const r = (x) => rel(p.projectDir, x);
|
|
171
|
+
// A path outside the project — setup's vault, beside it usually — from
|
|
172
|
+
// home, as its row and its APPLY lines name it.
|
|
173
|
+
const t = (x) => tilde(r(x), home);
|
|
174
|
+
const to = ` ${glyph("transition")} `;
|
|
175
|
+
const lead = " ";
|
|
176
|
+
const sub = " ";
|
|
177
|
+
const why =
|
|
178
|
+
verbose && st.why
|
|
179
|
+
? wrap(st.why, width, sub)
|
|
180
|
+
.split("\n")
|
|
181
|
+
.map((l, k) => (k ? "" : sub) + paint("explanation", l))
|
|
182
|
+
: [];
|
|
183
|
+
// A consent line (install spec contract 9): the step's verb and what it
|
|
184
|
+
// touches, in the explanation role (presentation spec contracts 3 and 7).
|
|
185
|
+
const said = (text) => `${lead}${paint("explanation", text)}`;
|
|
186
|
+
switch (st.kind) {
|
|
187
|
+
case "host": {
|
|
188
|
+
// The keep step's argv is whole (its bin is the Node that runs us), and
|
|
189
|
+
// its touches are the kept copy's planned writes, each with its action.
|
|
190
|
+
const out = [said(`$ ${(st.bin ? [st.bin, ...st.argv] : st.argv).join(" ")}`)];
|
|
191
|
+
if (st.touches.length)
|
|
192
|
+
out.push(
|
|
193
|
+
`${sub}${paint("explanation", `touches ${st.touches.map((t) => (typeof t === "string" ? r(t) : `${t.path ? r(t.path) : t.surface} (${t.action})`)).join(", ")}`)}`,
|
|
194
|
+
);
|
|
195
|
+
return [...out, ...why];
|
|
196
|
+
}
|
|
197
|
+
// The fetch a dry run would run first (the shell-fetch story's rule 6),
|
|
198
|
+
// with the fetch glyph (presentation spec contract 4).
|
|
199
|
+
case "fetch":
|
|
200
|
+
return [
|
|
201
|
+
`${lead}${paint("action", glyph("fetch"))} ${paint("explanation", [st.bin, ...st.argv].join(" "))}`,
|
|
202
|
+
...why,
|
|
203
|
+
];
|
|
204
|
+
case "note":
|
|
205
|
+
return wrap(`note: ${st.why}`, width, sub)
|
|
206
|
+
.split("\n")
|
|
207
|
+
.map((l, k) => (k ? l : lead + paint("attention", "note:") + l.slice(5)));
|
|
208
|
+
case "write":
|
|
209
|
+
return [
|
|
210
|
+
said(`write ${st.path}${st.manifestOnly ? " (manifest only)" : ` (${st.files} files + the manifest)`}`),
|
|
211
|
+
...why,
|
|
212
|
+
];
|
|
213
|
+
// A dry run names no file count: the payload is counted after the fetch.
|
|
214
|
+
case "portable-write":
|
|
215
|
+
return [
|
|
216
|
+
said(
|
|
217
|
+
`stage ${st.path} (${Array.isArray(st.files) ? `${st.files.length} payload files` : "the fetched payload"} + catalogue + ownership)`,
|
|
218
|
+
),
|
|
219
|
+
...why,
|
|
220
|
+
];
|
|
221
|
+
case "rmdir-state":
|
|
222
|
+
return [
|
|
223
|
+
said(
|
|
224
|
+
`remove ${r(st.path)}/ once empty${st.left?.length ? ` ${glyph("dash")} ${st.left.join(", ")} stay${st.left.length === 1 ? "s" : ""} and keep${st.left.length === 1 ? "s" : ""} it` : ""}`,
|
|
225
|
+
),
|
|
226
|
+
...why,
|
|
227
|
+
];
|
|
228
|
+
case "portable-remove":
|
|
229
|
+
case "remove":
|
|
230
|
+
return [said(`remove ${st.path}`), ...why];
|
|
231
|
+
case "unregister":
|
|
232
|
+
return [said(`edit ${r(st.path)} [${st.pointer}.${st.name}]${to}removed`), ...why];
|
|
233
|
+
// The channel switch's record in the binding (the converge story's rules
|
|
234
|
+
// 2 and 4): its time is the apply's, unknown to a preview.
|
|
235
|
+
case "mark":
|
|
236
|
+
return [said(`edit ${r(st.path)} [${st.key}]${to}by "setup", at the time of apply`), ...why];
|
|
237
|
+
case "unmark":
|
|
238
|
+
return [said(`edit ${r(st.path)} [${st.key}]${to}removed`), ...why];
|
|
239
|
+
// A `binding` item's value (the setup story's status-line flag).
|
|
240
|
+
case "set":
|
|
241
|
+
return [said(`edit ${r(st.path)} [${st.key}]${to}${JSON.stringify(st.value)}`), ...why];
|
|
242
|
+
// Setup's vault (rule 10), the binding plan's own steps: every path is in
|
|
243
|
+
// the default view. A scaffold step's paths are the vault's, beneath the
|
|
244
|
+
// row that names it.
|
|
245
|
+
case "mkdir":
|
|
246
|
+
return [said(`create ${t(st.path)}/`), ...why];
|
|
247
|
+
case "bind":
|
|
248
|
+
return [
|
|
249
|
+
said(
|
|
250
|
+
`write ${r(st.path)} (${st.from ? `the binding of ${st.from}${st.drop?.length ? `, without ${st.drop.join(" and ")}` : ""}` : `vault_path, layout ${st.layout}, language ${st.language}`})`,
|
|
251
|
+
),
|
|
252
|
+
...why,
|
|
253
|
+
];
|
|
254
|
+
case "git-init":
|
|
255
|
+
return [
|
|
256
|
+
said(`$ ${st.argv.join(" ")}`),
|
|
257
|
+
`${sub}${paint("explanation", `in ${t(st.path)}, with no commit`)}`,
|
|
258
|
+
...why,
|
|
259
|
+
];
|
|
260
|
+
case "scaffold":
|
|
261
|
+
return [said(`create ${st.rels.join(" and ")}`), ...why];
|
|
262
|
+
case "ensure":
|
|
263
|
+
return [said(`ensure ${r(st.path)}/`), ...why];
|
|
264
|
+
case "move-state":
|
|
265
|
+
return [said(`move ${r(st.from)}/${to}${r(st.to)}/ (${st.files} entries)`), ...why];
|
|
266
|
+
case "merge-log":
|
|
267
|
+
return [said(`merge ${r(st.from)}${to}${r(st.to)}`), ...why];
|
|
268
|
+
case "delete":
|
|
269
|
+
return [said(`delete ${r(st.path)}`), ...why];
|
|
270
|
+
case "move-marker":
|
|
271
|
+
return [said(`move ${r(st.from)}${to}${r(st.to)}`), ...why];
|
|
272
|
+
case "move-binding":
|
|
273
|
+
return [said(`move ${r(st.from)}${to}${r(st.to)} (agents${to}${r(st.overlay)})`), ...why];
|
|
274
|
+
case "remove-legacy-launcher":
|
|
275
|
+
case "rmdir-legacy":
|
|
276
|
+
case "remove-legacy-runtime":
|
|
277
|
+
return [said(`remove ${r(st.path)}`), ...why];
|
|
278
|
+
default:
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const displayName = (id) => loadHarness(id)?.display_name || id;
|
|
284
|
+
// The harnesses a plan names, by their display names — for the badge.
|
|
285
|
+
function displayNames(p) {
|
|
286
|
+
return p.harnesses.map(displayName).join(", ") || "(no harness)";
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const tilde = (path, home = homedir()) =>
|
|
290
|
+
path === home || path.startsWith(home + "/") ? "~" + path.slice(home.length) : path;
|
|
291
|
+
|
|
292
|
+
// The badge (presentation spec contract 7): `projectstore <verb> · <display
|
|
293
|
+
// names>`, the first line of a verb's output. A run that fetches prints it
|
|
294
|
+
// before the fetch line, and its preview then leaves it out (`badge: false`),
|
|
295
|
+
// so it is printed once.
|
|
296
|
+
export function badgeLine(p, { verb = null, caps: c = PLAIN } = {}) {
|
|
297
|
+
return badgeText(c, `projectstore ${verb || p.mode}`, [displayNames(p)]);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// The update notice in the badge's slot (the converge story's rule 8;
|
|
301
|
+
// presentation spec contracts 6 and 7): the note glyph, the text in the
|
|
302
|
+
// explanation role, then the command alone on its line after a blank one, in
|
|
303
|
+
// the action role, and a blank line before the preview.
|
|
304
|
+
export function noticeText(n, c = PLAIN) {
|
|
305
|
+
const paint = painter(c);
|
|
306
|
+
return (
|
|
307
|
+
[
|
|
308
|
+
` ${paint("attention", termIcon(c, "note"))} ${paint("explanation", n.text)}`,
|
|
309
|
+
...commandBlock(c, [n.command], { indent: 4 }),
|
|
310
|
+
"",
|
|
311
|
+
].join("\n") + "\n"
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// The summary line: the counts by kind of change, each in its word's role.
|
|
316
|
+
// Unsupported rows are not counted: they are the harness's, not the run's.
|
|
317
|
+
const COUNTED = [
|
|
318
|
+
["add", (n) => `${n} to add`],
|
|
319
|
+
["register", (n) => `${n} to register`],
|
|
320
|
+
["update", (n) => `${n} to update`],
|
|
321
|
+
["switch", (n) => `${n} to switch`],
|
|
322
|
+
["remove", (n) => `${n} to remove`],
|
|
323
|
+
["unchanged", (n) => `${n} unchanged`],
|
|
324
|
+
["skipped", (n) => `${n} skipped`],
|
|
325
|
+
];
|
|
326
|
+
function planSummary(p, c) {
|
|
327
|
+
if (!p.ok) return heading(c, "Plan", [["refused", "attention"]]);
|
|
328
|
+
const n = {};
|
|
329
|
+
for (const i of p.items) if (!isUnsupported(i)) n[actionWord(i)] = (n[actionWord(i)] || 0) + 1;
|
|
330
|
+
const counts = COUNTED.filter(([w]) => n[w]).map(([w, say]) => [say(n[w]), WORD_ROLE[w]]);
|
|
331
|
+
return heading(c, "Plan", counts.length ? counts : [["nothing to change", "explanation"]]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// `home` shortens the project path to ~ (the caller's home; a test's fixed
|
|
335
|
+
// one); everything else the screen needs is in `p`. `header` is a caller's
|
|
336
|
+
// lines beneath the project path — setup's, naming the git work tree's top
|
|
337
|
+
// when it runs in a subfolder (the setup story, rule 4).
|
|
338
|
+
export function renderPreview(
|
|
339
|
+
p,
|
|
340
|
+
{ verbose = false, verb = null, caps: c = PLAIN, badge = true, home = homedir(), header = [] } = {},
|
|
341
|
+
) {
|
|
342
|
+
const paint = painter(c);
|
|
343
|
+
const glyph = (name) => termIcon(c, name);
|
|
344
|
+
const width = c.live ? c.width : 0;
|
|
345
|
+
const writes = p.items.filter(isWrite);
|
|
346
|
+
// A text's lines, each of its own lines wrapped on its own, returned without
|
|
347
|
+
// the indent for the caller to lay out. wrap indents only the lines it
|
|
348
|
+
// breaks, so a line the text carried itself must never lose the indent's
|
|
349
|
+
// width of characters (a refusal's "--harness claude-code" read "laude-code").
|
|
350
|
+
const textLines = (text, indent) =>
|
|
351
|
+
String(text)
|
|
352
|
+
.split("\n")
|
|
353
|
+
.flatMap((para) =>
|
|
354
|
+
wrap(para, width, indent)
|
|
355
|
+
.split("\n")
|
|
356
|
+
.map((l, k) => (k ? l.slice(indent.length) : l)),
|
|
357
|
+
);
|
|
358
|
+
// Prose, wrapped to the terminal with every line indented; a path or a
|
|
359
|
+
// command inside it is one word and never broken (term.mjs wrap).
|
|
360
|
+
const prose = (indent, text, role = "explanation") => textLines(text, indent).map((l) => indent + paint(role, l));
|
|
361
|
+
const lines = [
|
|
362
|
+
...(badge ? [badgeLine(p, { verb, caps: c })] : []),
|
|
363
|
+
` ${paint("explanation", tilde(p.projectDir, home))}`,
|
|
364
|
+
...(header || []).flatMap((h) => prose(" ", h)),
|
|
365
|
+
"",
|
|
366
|
+
];
|
|
367
|
+
if (verbose) {
|
|
368
|
+
for (const [h, r] of Object.entries(p.plannedAgainst || {}))
|
|
369
|
+
lines.push(
|
|
370
|
+
...prose(
|
|
371
|
+
" ",
|
|
372
|
+
`${h}: the surfaces below are planned against the host's install path ${r}, not this package at ${p.root}.`,
|
|
373
|
+
),
|
|
374
|
+
"",
|
|
375
|
+
);
|
|
376
|
+
for (const r of p.reports) lines.push(...r.split("\n").flatMap((l) => (l.trim() ? prose(" ", l) : [""])), "");
|
|
377
|
+
}
|
|
378
|
+
lines.push(planSummary(p, c));
|
|
379
|
+
// An emptied state directory is pruned with the launcher removed from it;
|
|
380
|
+
// said once, beneath the first such row.
|
|
381
|
+
let pruneSaid = false;
|
|
382
|
+
const beneath = (i) => {
|
|
383
|
+
const out = [];
|
|
384
|
+
// A user-scope registration reaches past this project: contract 7's
|
|
385
|
+
// consequence line, on the line beneath its row, before anything else.
|
|
386
|
+
if (isWrite(i) && i.kind === "registration" && i.scope === "user")
|
|
387
|
+
out.push(
|
|
388
|
+
...prose(
|
|
389
|
+
" ",
|
|
390
|
+
`user-wide: the plugin is ${i.action === "remove" ? "removed" : "registered"} for every project ${displayName(i.harness)} opens, not only this one`,
|
|
391
|
+
),
|
|
392
|
+
);
|
|
393
|
+
// …and a channel switch's (the converge story's rule 2), carried as its
|
|
394
|
+
// note step: first, before the reason and the consent lines.
|
|
395
|
+
for (const st of (i.steps || []).filter(isConsequence)) out.push(...prose(" ", st.why));
|
|
396
|
+
if (verbose) out.push(...prose(" ", transitionText(i, glyph)));
|
|
397
|
+
else if (i.reason && !isUnsupported(i))
|
|
398
|
+
out.push(
|
|
399
|
+
...prose(" ", i.advice ? i.advice.text : i.reason, i.action === "refuse" ? "attention" : "explanation"),
|
|
400
|
+
);
|
|
401
|
+
// The reason's ways out (the converge story): each lead, then its command
|
|
402
|
+
// alone on its line after a blank one (contract 6), and a blank line after.
|
|
403
|
+
if (i.advice?.blocks?.length) {
|
|
404
|
+
for (const b of i.advice.blocks)
|
|
405
|
+
out.push(...prose(" ", b.lead), ...commandBlock(c, [b.command], { indent: 10 }), "");
|
|
406
|
+
}
|
|
407
|
+
// A shell this run fetched from a registry that is not the user's (the
|
|
408
|
+
// converge story's rule 8, as amended 2026-10-09): both named. Neutral
|
|
409
|
+
// words: the fetch's URL can come from the project's .npmrc or from the
|
|
410
|
+
// run's own environment (`npx --registry`), and either reads the same.
|
|
411
|
+
const from = fetchedFor(p, i);
|
|
412
|
+
if (from)
|
|
413
|
+
out.push(
|
|
414
|
+
...prose(" ", `fetched from ${from.registry}`),
|
|
415
|
+
...prose(" ", `your npm's own registry is ${from.user}`),
|
|
416
|
+
);
|
|
417
|
+
for (const st of (i.steps || []).filter((x) => !isConsequence(x)))
|
|
418
|
+
out.push(...stepLines(p, st, { verbose, paint, width, glyph, home }));
|
|
419
|
+
if (i.kind === "registration" && i.home && i.surface && !i.surface.endsWith("_others"))
|
|
420
|
+
out.push(` ${paint("explanation", `(harness home ${i.home}${i.scope ? `, scope ${i.scope}` : ""})`)}`);
|
|
421
|
+
if (i.deleteIfEmpty && typeof i.after === "string" && !i.after.trim())
|
|
422
|
+
out.push(` ${paint("explanation", "(the file would hold nothing else and is removed)")}`);
|
|
423
|
+
if (!pruneSaid && i.action === "remove" && i.kind === "exclusive") {
|
|
424
|
+
pruneSaid = true;
|
|
425
|
+
out.push(` ${paint("explanation", `(an emptied ${rel(p.projectDir, dirname(i.path))}/ is pruned)`)}`);
|
|
426
|
+
}
|
|
427
|
+
return out;
|
|
428
|
+
};
|
|
429
|
+
// The run's one agents block, named again where each other harness's row
|
|
430
|
+
// would have been (contract 7; the story "One run plans the agents block
|
|
431
|
+
// once…", rule 1): in that harness's group, before its first item at or
|
|
432
|
+
// after the recorded index, else at the group's end. Not a step and not an
|
|
433
|
+
// item: nothing is planned there.
|
|
434
|
+
const sameBlock = () =>
|
|
435
|
+
` ${paint("explanation", glyph("skip"))} ${p.sharedBlock.file} ${glyph("dash")} the same block as ${p.sharedBlock.display}, above`;
|
|
436
|
+
const hostLines = (h) => {
|
|
437
|
+
const from = h.entry ? `from the registration ${h.entry}` : "from the host's own plugin system";
|
|
438
|
+
return wrap(`${h.display} installs ${h.rows.join(", ")} itself, ${from}`, width, " ")
|
|
439
|
+
.split("\n")
|
|
440
|
+
.map((l, k) =>
|
|
441
|
+
k
|
|
442
|
+
? ` ${paint("explanation", l.slice(4))}`
|
|
443
|
+
: ` ${paint("explanation", glyph("skip"))} ${paint("explanation", l)}`,
|
|
444
|
+
);
|
|
445
|
+
};
|
|
446
|
+
// The VAULT group first, when setup plans one: the rows of no harness.
|
|
447
|
+
const ids = [
|
|
448
|
+
...(p.items.some((i) => i.harness === null) ? [null] : []),
|
|
449
|
+
...p.harnesses,
|
|
450
|
+
...new Set(p.items.map((i) => i.harness).filter((h) => h !== null && !p.harnesses.includes(h))),
|
|
451
|
+
];
|
|
452
|
+
for (const id of ids) {
|
|
453
|
+
const entries = p.items.map((i, at) => ({ i, at })).filter((e) => e.i.harness === id);
|
|
454
|
+
const others = (p.sharedBlock?.others || []).filter((o) => o.harness === id).sort((a, b) => a.at - b.at);
|
|
455
|
+
const host = (p.hostManaged || []).filter((h) => h.harness === id);
|
|
456
|
+
if (!entries.length && !others.length && !host.length) continue;
|
|
457
|
+
const folded = verbose ? [] : entries.filter((e) => isUnsupported(e.i));
|
|
458
|
+
// A registration this run fetched from another registry keeps its row, so
|
|
459
|
+
// the registry lines beneath it show on every run, not only on a change.
|
|
460
|
+
const quiet = verbose ? [] : entries.filter((e) => isQuiet(e.i) && !fetchedFor(p, e.i));
|
|
461
|
+
const shown = entries.filter((e) => !folded.includes(e) && !quiet.includes(e));
|
|
462
|
+
const specs = shown.map(({ i }) => ({
|
|
463
|
+
glyph: glyphName(i),
|
|
464
|
+
role: WORD_ROLE[actionWord(i)],
|
|
465
|
+
action: actionWord(i),
|
|
466
|
+
target: rowTarget(p, i, home),
|
|
467
|
+
note: rowNote(i, { verbose, glyph }),
|
|
468
|
+
}));
|
|
469
|
+
if (quiet.length)
|
|
470
|
+
specs.push({
|
|
471
|
+
glyph: "unchanged",
|
|
472
|
+
role: "explanation",
|
|
473
|
+
action: "unchanged",
|
|
474
|
+
target: paint("explanation", quiet.map((e) => surfaceWords(e.i.surface)).join(", ")),
|
|
475
|
+
});
|
|
476
|
+
// Unsupported rows keep one line per harness (contract 18), named in
|
|
477
|
+
// words as the unchanged line names its rows; --verbose lists each with
|
|
478
|
+
// the manifest's reason.
|
|
479
|
+
if (folded.length)
|
|
480
|
+
specs.push({
|
|
481
|
+
glyph: "unchanged",
|
|
482
|
+
role: "explanation",
|
|
483
|
+
action: "skipped",
|
|
484
|
+
target: paint(
|
|
485
|
+
"explanation",
|
|
486
|
+
`not on ${displayName(id)}: ${folded.map((e) => surfaceWords(e.i.surface)).join(", ")}`,
|
|
487
|
+
),
|
|
488
|
+
note: "--verbose says why",
|
|
489
|
+
});
|
|
490
|
+
const drawn = rowLines(c, specs);
|
|
491
|
+
lines.push("", paint("emphasis", id === null ? VAULT_GROUP : displayName(id)));
|
|
492
|
+
const pending = [...others];
|
|
493
|
+
shown.forEach(({ i, at }, k) => {
|
|
494
|
+
while (pending.length && pending[0].at <= at) {
|
|
495
|
+
pending.shift();
|
|
496
|
+
lines.push(sameBlock());
|
|
497
|
+
}
|
|
498
|
+
lines.push(...drawn[k], ...beneath(i));
|
|
499
|
+
});
|
|
500
|
+
for (const _ of pending) lines.push(sameBlock());
|
|
501
|
+
for (const extra of drawn.slice(shown.length)) lines.push(...extra);
|
|
502
|
+
for (const h of host) lines.push(...hostLines(h));
|
|
503
|
+
}
|
|
504
|
+
if (p.refusals.length) lines.push("");
|
|
505
|
+
// A plan-level refusal: its message in the attention role, as an item's
|
|
506
|
+
// refusal reason is (presentation spec contract 3 as amended 2026-10-11).
|
|
507
|
+
p.refusals.forEach((r, k) => {
|
|
508
|
+
const lead = ` ${paint("attention", glyph("refuse"))} ${paint("attention", "refused")} `;
|
|
509
|
+
const pad = " ".repeat(plain(lead).length);
|
|
510
|
+
// The stop (the converge story's rule 6) carries its commands apart from
|
|
511
|
+
// its words: each is printed alone on its line after a blank one, with
|
|
512
|
+
// nothing after it (contract 6), the way a person copies it.
|
|
513
|
+
const stop = k === 0 && p.stop ? p.stop : null;
|
|
514
|
+
// The same for a refusal that names its ways out (the channel "git" with
|
|
515
|
+
// nothing to keep): its prose, then each lead and its command alone.
|
|
516
|
+
const advice = k === 0 && !stop && p.refusalAdvice ? p.refusalAdvice : null;
|
|
517
|
+
const [first, ...rest] = textLines(stop ? stop.lead : advice ? advice.text : r, pad);
|
|
518
|
+
lines.push(lead + paint("attention", first), ...rest.map((l) => pad + paint("attention", l)));
|
|
519
|
+
if (stop)
|
|
520
|
+
lines.push(
|
|
521
|
+
...commandBlock(c, [stop.commands[0]], { indent: 4 }),
|
|
522
|
+
"",
|
|
523
|
+
...prose(" ", stop.between),
|
|
524
|
+
...commandBlock(c, stop.commands.slice(1), { indent: 4 }),
|
|
525
|
+
);
|
|
526
|
+
if (advice)
|
|
527
|
+
for (const b of advice.blocks)
|
|
528
|
+
lines.push("", ...prose(" ", b.lead), ...commandBlock(c, [b.command], { indent: 4 }));
|
|
529
|
+
});
|
|
530
|
+
// The closing lines, in a person's words: only what is listed is written,
|
|
531
|
+
// and a $ line is the host's own CLI at work.
|
|
532
|
+
const closing = [];
|
|
533
|
+
if (p.ok && writes.length)
|
|
534
|
+
closing.push(
|
|
535
|
+
...prose(
|
|
536
|
+
" ",
|
|
537
|
+
`Only the entries listed above are written ${glyph("dash")} nothing else in those files is read, rewritten or removed.`,
|
|
538
|
+
),
|
|
539
|
+
);
|
|
540
|
+
if (p.items.some((i) => (i.steps || []).some((s) => s.kind === "host" && s.name !== "keep")))
|
|
541
|
+
closing.push(
|
|
542
|
+
...prose(" ", "Each $ line runs the host's own CLI, which writes the host-owned files named after it."),
|
|
543
|
+
);
|
|
544
|
+
if (p.items.some((i) => isWrite(i) && (i.steps || []).some((s) => s.kind === "host" && s.name === "keep")))
|
|
545
|
+
closing.push(
|
|
546
|
+
...prose(
|
|
547
|
+
" ",
|
|
548
|
+
"The kept copy's $ line runs that copy's own projectstore, which writes the files named after it.",
|
|
549
|
+
),
|
|
550
|
+
);
|
|
551
|
+
if (closing.length) lines.push("", ...closing);
|
|
552
|
+
if (!p.ok) lines.push("", ` ${paint("attention", "Nothing will be written: resolve the refusals above first.")}`);
|
|
553
|
+
// A plan that wrote nothing because part of it could not be planned never
|
|
554
|
+
// reads as converged (the converge story's keep, a copy with work pending).
|
|
555
|
+
else if (!writes.length)
|
|
556
|
+
lines.push(
|
|
557
|
+
"",
|
|
558
|
+
p.incomplete
|
|
559
|
+
? " Nothing will be written: one surface could not be planned (see above)."
|
|
560
|
+
: " Nothing to change.",
|
|
561
|
+
);
|
|
562
|
+
else if (p.incomplete) lines.push("", " One surface could not be planned (see above); the rest proceeds.");
|
|
563
|
+
return lines.join("\n") + "\n";
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// APPLY, one line per step as it finishes (presentation spec contract 8):
|
|
567
|
+
// the glyph, what was done in the past tense — "added CLAUDE.md", having read
|
|
568
|
+
// "adding CLAUDE.md" while it ran on a terminal — and the duration. An item
|
|
569
|
+
// with steps — a registration, the layout move — prints its own line as it
|
|
570
|
+
// starts ("registering …"), one line per step beneath it — each host
|
|
571
|
+
// command, staging write, write and move — and, once all of them have run,
|
|
572
|
+
// its finished line in the past tense ("registered …") with the item's whole
|
|
573
|
+
// time, so a transcript never ends on a line that reads as still running.
|
|
574
|
+
// No heading: the plan's last line and the question are above it. `now` is
|
|
575
|
+
// the test's clock; `home` shortens paths to ~.
|
|
576
|
+
export function applyReporter(out, c, p, { now = Date.now, home = homedir() } = {}) {
|
|
577
|
+
const paint = painter(c);
|
|
578
|
+
const glyph = (name) => termIcon(c, name);
|
|
579
|
+
const item = stepReporter(out, c, { indent: 2, now });
|
|
580
|
+
const step = stepReporter(out, c, { indent: 6, now });
|
|
581
|
+
const said = (i) => {
|
|
582
|
+
const word = actionWord(i);
|
|
583
|
+
const [running, done] = WORD_TENSES[word] || [word, word];
|
|
584
|
+
const target = rowTarget(p, i, home);
|
|
585
|
+
return { word, running: `${running} ${target}`, done: `${done} ${target}` };
|
|
586
|
+
};
|
|
587
|
+
// The mark too: a skip prints its reason (the project not bound, the switch
|
|
588
|
+
// not done) beneath the line it started.
|
|
589
|
+
// …and the keep, whose $ line and the kept copy's own items print beneath it.
|
|
590
|
+
// …and setup's vault, whose binding, git and scaffold steps print beneath it.
|
|
591
|
+
const stepped = (i) =>
|
|
592
|
+
i.kind === "registration" ||
|
|
593
|
+
i.kind === "layout" ||
|
|
594
|
+
i.kind === "binding" ||
|
|
595
|
+
i.kind === "channel" ||
|
|
596
|
+
i.kind === "vault";
|
|
597
|
+
const began = new Map();
|
|
598
|
+
return {
|
|
599
|
+
onItem(i, phase, r) {
|
|
600
|
+
const s = said(i);
|
|
601
|
+
if (stepped(i)) {
|
|
602
|
+
if (phase === "start") {
|
|
603
|
+
began.set(i, now());
|
|
604
|
+
out.write(` ${paint(WORD_ROLE[s.word], glyph(glyphName(i)))} ${s.running}\n`);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
const t0 = began.get(i) ?? now();
|
|
608
|
+
began.delete(i);
|
|
609
|
+
if (phase === "abort") step.abort();
|
|
610
|
+
else if (r && (r.action === "skipped" || r.action === "skip"))
|
|
611
|
+
out.write(
|
|
612
|
+
` ${paint("explanation", glyph("skip"))} ${paint("explanation", `${r.action === "skip" ? "nothing to do" : "skipped"}: ${r.reason || "an earlier item failed"}`)}\n`,
|
|
613
|
+
);
|
|
614
|
+
else if (r && r.failed) out.write(` ${paint("error", glyph("fail"))} ${paint("error", "stopped")}\n`);
|
|
615
|
+
else item.finish(s.done, t0);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (phase === "start") item.start(s.running);
|
|
619
|
+
else if (phase === "abort") item.abort();
|
|
620
|
+
else {
|
|
621
|
+
// An item that failed or was skipped keeps the words it ran under.
|
|
622
|
+
const failed = Boolean(r && (r.failed || r.action === "skipped"));
|
|
623
|
+
item.end(!failed, r && r.action === "skipped" ? "skipped" : "", failed ? {} : { label: s.done });
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
onStep(st, phase, r) {
|
|
627
|
+
const l = stepLabel(p, st, { home, glyph });
|
|
628
|
+
if (!l) return;
|
|
629
|
+
if (phase === "start") {
|
|
630
|
+
step.start(l.running);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const ok = r ? r.ok : true;
|
|
634
|
+
const kept = Boolean(r && r.kept);
|
|
635
|
+
// A step that failed without stopping the run (setup's git init) is ▲,
|
|
636
|
+
// in its own words.
|
|
637
|
+
if (r && r.warn) {
|
|
638
|
+
step.end(true, "", { warn: true, label: r.warn });
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
// A step that left its target in place did not do its verb; one that
|
|
642
|
+
// says why in its own words (a git init skipped) needs no note.
|
|
643
|
+
const own = r && r.label ? r.label : null;
|
|
644
|
+
step.end(ok, kept && !own ? "kept" : "", ok ? { kept, label: own || (kept ? l.base : l.done) } : {});
|
|
645
|
+
},
|
|
646
|
+
// The wrapped spawn prints each host command as a step. Its `unwrapped`
|
|
647
|
+
// is the caller's own spawn, for an item that reports its commands as its
|
|
648
|
+
// own steps (setup's vault: `$ git init --quiet`).
|
|
649
|
+
spawn(inner) {
|
|
650
|
+
const wrapped = (bin, argv, o) => {
|
|
651
|
+
step.start(`$ ${basename(String(bin))} ${argv.join(" ")}`);
|
|
652
|
+
let r;
|
|
653
|
+
try {
|
|
654
|
+
r = inner(bin, argv, o);
|
|
655
|
+
} catch (e) {
|
|
656
|
+
step.abort();
|
|
657
|
+
throw e;
|
|
658
|
+
}
|
|
659
|
+
step.end(!r.error && r.status === 0);
|
|
660
|
+
return r;
|
|
661
|
+
};
|
|
662
|
+
Object.defineProperty(wrapped, "unwrapped", { value: inner });
|
|
663
|
+
return wrapped;
|
|
664
|
+
},
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// A step as its APPLY line names it: the verb and the target, short — the
|
|
669
|
+
// full form, file counts and entry pointers, was in PLAN. `base` is the plain
|
|
670
|
+
// verb, for a step that left its target in place.
|
|
671
|
+
const STEP_TENSES = {
|
|
672
|
+
stage: ["staging", "staged"],
|
|
673
|
+
lift: ["lifting", "lifted"],
|
|
674
|
+
write: ["writing", "wrote"],
|
|
675
|
+
edit: ["editing", "edited"],
|
|
676
|
+
ensure: ["ensuring", "ensured"],
|
|
677
|
+
move: ["moving", "moved"],
|
|
678
|
+
merge: ["merging", "merged"],
|
|
679
|
+
remove: ["removing", "removed"],
|
|
680
|
+
create: ["creating", "created"],
|
|
681
|
+
};
|
|
682
|
+
function stepLabel(p, st, { home = homedir(), glyph = unicodeGlyph } = {}) {
|
|
683
|
+
const r = (x) => tilde(rel(p.projectDir, x), home);
|
|
684
|
+
const to = ` ${glyph("transition")} `;
|
|
685
|
+
const said = (verb, rest) => ({
|
|
686
|
+
base: `${verb} ${rest}`,
|
|
687
|
+
running: `${STEP_TENSES[verb][0]} ${rest}`,
|
|
688
|
+
done: `${STEP_TENSES[verb][1]} ${rest}`,
|
|
689
|
+
});
|
|
690
|
+
switch (st.kind) {
|
|
691
|
+
case "portable-write":
|
|
692
|
+
return said("stage", r(st.path));
|
|
693
|
+
case "recover":
|
|
694
|
+
return said(
|
|
695
|
+
"lift",
|
|
696
|
+
`${r(st.path)} ${glyph("dash")} the previous state proved${st.lifted ? `; it held: ${String(st.lifted).split("\n")[0]}` : ""}`,
|
|
697
|
+
);
|
|
698
|
+
case "write":
|
|
699
|
+
return said("write", r(st.path));
|
|
700
|
+
case "unregister":
|
|
701
|
+
return said("edit", `${r(st.path)} [${st.pointer}.${st.name}]`);
|
|
702
|
+
case "mark":
|
|
703
|
+
case "unmark":
|
|
704
|
+
case "set":
|
|
705
|
+
return said("edit", `${r(st.path)} [${st.key}]`);
|
|
706
|
+
case "ensure":
|
|
707
|
+
return said("ensure", `${r(st.path)}/`);
|
|
708
|
+
// Setup's vault (rule 10): the directory, the binding, git, the scaffold
|
|
709
|
+
// — a scaffold step's paths are the vault's, beneath the vault's line.
|
|
710
|
+
case "mkdir":
|
|
711
|
+
return said("create", `${r(st.path)}/`);
|
|
712
|
+
case "bind":
|
|
713
|
+
return said("write", r(st.path));
|
|
714
|
+
case "git-init": {
|
|
715
|
+
const line = `$ ${st.argv.join(" ")}`;
|
|
716
|
+
return { base: line, running: line, done: line };
|
|
717
|
+
}
|
|
718
|
+
case "scaffold":
|
|
719
|
+
return said("create", st.rels.join(" and "));
|
|
720
|
+
case "move-state":
|
|
721
|
+
return said("move", `${r(st.from)}/${to}${r(st.to)}/`);
|
|
722
|
+
case "merge-log":
|
|
723
|
+
return said("merge", `${r(st.from)}${to}${r(st.to)}`);
|
|
724
|
+
case "move-marker":
|
|
725
|
+
case "move-binding":
|
|
726
|
+
return said("move", `${r(st.from)}${to}${r(st.to)}`);
|
|
727
|
+
case "delete":
|
|
728
|
+
case "portable-remove":
|
|
729
|
+
case "remove":
|
|
730
|
+
case "remove-legacy-launcher":
|
|
731
|
+
case "rmdir-legacy":
|
|
732
|
+
case "remove-legacy-runtime":
|
|
733
|
+
return said("remove", r(st.path));
|
|
734
|
+
case "rmdir-state":
|
|
735
|
+
return said("remove", `${r(st.path)}/`);
|
|
736
|
+
// An item the kept copy applied (the converge story's rule 5), in this
|
|
737
|
+
// run's words for its action; one the preview did not list says so.
|
|
738
|
+
case "kept": {
|
|
739
|
+
const word = ACTION_WORD[st.action] || "update";
|
|
740
|
+
const [running, done] = WORD_TENSES[word] || [word, word];
|
|
741
|
+
const target = `${st.path ? r(st.path) : st.surface}${st.unplanned ? " (not in the preview)" : ""}`;
|
|
742
|
+
return { base: `${word} ${target}`, running: `${running} ${target}`, done: `${done} ${target}` };
|
|
743
|
+
}
|
|
744
|
+
default:
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
}
|