@alterset/alterspec-client 0.26.0 → 0.27.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.
@@ -31,7 +31,9 @@ dispatcher's pages.
31
31
  - **A task is built to what its change saw.** The brief (`alterspec-client context <task>`) gives every object as
32
32
  the task's change saw it at its sign-off, however many changes touched it since; the export's own files are the
33
33
  spec as it is now. What later changes did is listed at the brief's end as their tasks' work: never build it in
34
- this task, and never ask a question of this task about a sentence a later change wrote.
34
+ this task, and never ask a question of this task about a sentence a later change wrote. Where a later change
35
+ removed or reworded a line of your task's own hunks, the brief says so under "Checked", from the deltas: you
36
+ compare nothing.
35
37
  - **A claim about the code is checked, never trusted.** Three things in a brief say what the code already does: an
36
38
  item marked `w 0, nothing to build on this track`, a task summary that opens with "Nothing to build" (a weight
37
39
  reasoned "as built"), and the "Built already" section. None of them was read from the code: the first two are the
@@ -45,7 +47,8 @@ dispatcher's pages.
45
47
  is, ask with `/alterspec-spec-ask`.
46
48
  - **News is read at the boundaries, never in the middle of an item.** Answers to your questions, the later changes
47
49
  under "Changed since", `followed_by` and `overlaps` are read when a skill starts (`context`, `task`), before each
48
- commit (`alterspec-client questions <task>`, for your own `Q-<n>`) and in `/alterspec-task-done`. Between those
50
+ commit (`alterspec-client context <task> --checklist`: this task's questions with their answers and its
51
+ checklist, nothing else) and in `/alterspec-task-done`. Between those
49
52
  points you build: don't re-read the brief or the export to see whether something moved, and don't call `whoami`
50
53
  for it. What `followed_by` and `overlaps` name is said once, at the start, and left. A corrected assumption found
51
54
  at a boundary is rework before the next item.
@@ -37,10 +37,10 @@ or whose `Alterspec-Task` trailer the last commit carries; when that doesn't set
37
37
  with its task on this track, and what each touched. Every text and path the brief gives for such an object is
38
38
  the object as this change saw it (an absolute path under `.alterspec-client/pins/` is that pinned copy; the
39
39
  export's own file carries the later changes too). Build to the brief. What a later change added is built in
40
- that change's task, never here; say the later tasks in one line and leave them. One exception: before you build
41
- one of this task's own objects that is listed there, compare the file the brief gives with the export's, and
42
- don't build a line a later change removed or reversed: build that item as the later change says and say so in
43
- the commit's body. What is marked **new** moved since you last read the brief; its diff is shown once.
40
+ that change's task, never here; say the later tasks in one line and leave them. One exception, and the brief does the
41
+ checking: under "Checked" it says, for each object this task changes, whether a later change removed or
42
+ reworded a line of this task's hunks. When it names lines, build those as the later change says and say so in
43
+ the commit's body; otherwise build to the brief and compare nothing. What is marked **new** moved since you last read the brief; its diff is shown once.
44
44
  **A bug's task** (`BUG-<n>/<track>`) has a shorter brief: it opens with the bug's words (what was expected, what
45
45
  happened, how to see it) and the items it cites, which are its checklist; then the objects those items belong to,
46
46
  where each is in the export now, and the changes the bug originates in. There is no delta: the product deviates
@@ -64,7 +64,10 @@ or whose `Alterspec-Task` trailer the last commit carries; when that doesn't set
64
64
  or item, under `_shards/`) rather than the whole file when one section is enough. Never read the export
65
65
  wholesale. An object "not in the export now" was removed or isn't signed off: build nothing for it, and say so.
66
66
  Between the start and a commit, read nothing to see whether something moved: news is read at the boundaries
67
- (`_shared.md`).
67
+ (`_shared.md`); `alterspec-client context <task> --checklist` is the brief to re-read during the work (this
68
+ task's questions and checklist, nothing else). Under "Reach" each rule comes with its row of the rule matrix
69
+ (who triggers, reads, lists and covers it, where its message shows): `_generated/rule-matrix.md` need not be
70
+ opened for it.
68
71
  6. Build it here, in this repository's own technology and conventions. The spec says what the product does; how is
69
72
  the developer's. A mockup page is the agreed look and behaviour of a screen, a working example to follow, not code
70
73
  to copy. When the spec is silent, ambiguous or says two things, ask with `/alterspec-spec-ask` as
@@ -227,7 +227,8 @@ server. Then talk to it in plain words; the skills do the rest.
227
227
  already", a summary's "Nothing to build" or an item's `w 0` is a claim about your code, made from the spec side
228
228
  or from dates: Claude reads the code against the item before it skips or covers it, and builds what the code
229
229
  turns out to lack. Between the start and a commit Claude reads nothing to see whether the spec moved: answers
230
- and later changes are looked at when a skill starts, before a commit and at `/alterspec-task-done`.
230
+ and later changes are looked at when a skill starts, before a commit and at `/alterspec-task-done`
231
+ (`alterspec-client context <task> --checklist` prints the task's questions and checklist alone).
231
232
  3. Claude ends every commit of the task with a trailer:
232
233
 
233
234
  ```
@@ -262,9 +263,10 @@ sentence a later change wrote is asked on that change's task.
262
263
  ignores itself in git and is rewritten every time the brief is made; delete it whenever you like.
263
264
  - When the brief is read again and something moved in between, it marks it **new** and shows once what the new
264
265
  changes did.
265
- - One exception to "not your work": before building one of your task's own objects that later changes touched,
266
- Claude compares the two texts and doesn't build a line a later change removed or reversed; it builds that item
267
- as the later change says and says so in the commit.
266
+ - One exception to "not your work", and the brief does the checking: under "Checked" it says, for each object
267
+ your task changes, whether a later change removed or reworded a line of your task's own hunks. Claude builds
268
+ such a line as the later change says and says so in the commit; otherwise it builds to the brief and compares
269
+ nothing.
268
270
  - An object that was signed off only after your task's change (the brief says so) is shown as the export holds it
269
271
  now: the export never had its earlier text.
270
272
 
@@ -375,6 +377,11 @@ when one of yours was fixed since you last looked.
375
377
  widen or narrow the task yourself.
376
378
  - **Only you move your task on.** Going away for a while? Release it. An admin can force a release only when you are
377
379
  gone, and that is logged.
380
+ - **The checklist is the dispatcher's list.** When the dispatcher answers, the brief's items, weights and labels are
381
+ the ones it holds, so `Alterspec-Covers` names what it accepts; the brief computes them from the export only when
382
+ it can't be asked. A bug's task lists the cites of its own track.
383
+ - **A rule's reach is in the brief.** Under Reach, a rule comes with its row of the rule matrix (who triggers,
384
+ reads, lists and covers it, where its message shows); the matrix itself need not be opened.
378
385
  - **Keep the client current.** Run `init` again now and then (or when your admin says so); it updates the skills.
379
386
  - **One task at a time, in order, on `task/<chg>-<track>`.** Taking several at once or out of order is allowed, but
380
387
  the dispatcher then warns of shared objects, and the warnings are usually right. The branch name the client
package/dist/cli.js CHANGED
@@ -821,6 +821,7 @@ var patternsPath = (code) => `${surfaceDir(code)}/patterns.md`;
821
821
  var designSystemPath = (code) => `${surfaceDir(code)}/design-system.md`;
822
822
  var OPERATIONS_FILE = "_generated/operations.md";
823
823
  var INDEX_FILE = "_generated/index.json";
824
+ var RULE_MATRIX_FILE = "_generated/rule-matrix.md";
824
825
  var CONTRACT = new RegExp(
825
826
  `^modules/[^/]+/screens/(?<screen>${SCREEN_ID})/experience/(?<code>[a-z]{2,5})\\.md$`
826
827
  );
@@ -1765,6 +1766,31 @@ function lifecycleOf(x, id) {
1765
1766
  const transitions = (e.transitions ?? []).map((t) => `${t.from}->${t.to}${t.by === "time" ? ` by time${t.at ? ` at ${t.at}` : ""}` : ""}`).join(", ");
1766
1767
  return `states ${states}${transitions ? `; transitions ${transitions}` : "; no transitions"}`;
1767
1768
  }
1769
+ var linesOf2 = (key, text) => new Set(
1770
+ forDiff(key, text).split("\n").map((l) => l.trim()).filter((l) => l && l !== "---")
1771
+ );
1772
+ var MATRIX_ROW = /^- \*\*(Triggered by|Reads the guarded entity|Listed by, without triggering a guard|Covered by|Message shown on)/;
1773
+ var matrices = /* @__PURE__ */ new WeakMap();
1774
+ function matrixOf(x) {
1775
+ const known = matrices.get(x);
1776
+ if (known) return known;
1777
+ const m = { legend: [], rows: /* @__PURE__ */ new Map() };
1778
+ const text = x.read(RULE_MATRIX_FILE);
1779
+ if (text) {
1780
+ const [head, ...blocks] = text.split(/^(?=## )/m);
1781
+ const legend = head.split("How to read a rule:")[1] ?? "";
1782
+ const bullets2 = legend.split(/^(?=- )/m).map((b) => b.trimEnd());
1783
+ for (const b of bullets2) if (MATRIX_ROW.test(b)) m.legend.push(...b.split("\n"));
1784
+ for (const block of blocks) {
1785
+ const id = block.slice(3).split(/\s/)[0];
1786
+ if (!id) continue;
1787
+ const rows = block.split("\n").filter((l) => MATRIX_ROW.test(l)).map((l) => l.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1"));
1788
+ if (rows.length) m.rows.set(id, rows);
1789
+ }
1790
+ }
1791
+ matrices.set(x, m);
1792
+ return m;
1793
+ }
1768
1794
  function reachOf(x, id, kind, changed) {
1769
1795
  const index = x.index();
1770
1796
  if (!index) return void 0;
@@ -1787,13 +1813,15 @@ function reachOf(x, id, kind, changed) {
1787
1813
  ).map((chunk) => chunk.slice(4).split(/\s/)[0]);
1788
1814
  });
1789
1815
  const screens2 = [...new Set(caps2.flatMap((c) => c.screens ?? []))].filter((sid) => x.sources.has(sid));
1816
+ const matrix = matrixOf(x).rows.get(id) ?? [];
1790
1817
  return {
1791
1818
  id,
1792
1819
  kind,
1793
1820
  ...title ? { title } : {},
1794
1821
  capabilities: caps2.map((c) => piece(c.id, c.title)),
1795
1822
  criteria,
1796
- screens: screens2.map(screenPiece)
1823
+ screens: screens2.map(screenPiece),
1824
+ ...matrix.length ? { matrix } : {}
1797
1825
  };
1798
1826
  }
1799
1827
  const caps = index.capabilities.filter((c) => (c.roles ?? []).some((r) => r.role === id));
@@ -1828,9 +1856,16 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
1828
1856
  const delta = x.delta(task.change);
1829
1857
  const entries = new Map(delta?.objects.map((e) => [e.key, e]));
1830
1858
  const lost = new Map(delta?.unrecoverable?.map((u) => [u.key, u.why]));
1831
- const items = work.items;
1832
- const weights = work.weights;
1859
+ const exported = work;
1860
+ const items = state.items?.length ? state.items.map((i) => i.item) : exported.items;
1861
+ const weights = state.items?.length ? Object.fromEntries(
1862
+ state.items.flatMap((i) => {
1863
+ const w = i.weight ?? exported.weights?.[i.item];
1864
+ return w === void 0 ? [] : [[i.item, w]];
1865
+ })
1866
+ ) : exported.weights;
1833
1867
  const words2 = work;
1868
+ const labelOf = (item) => state.items?.find((i) => i.item === item)?.label ?? words2.labels?.[item];
1834
1869
  const initiativeId = change.initiative;
1835
1870
  const initiative = initiativeId ? x.initiative(initiativeId) : void 0;
1836
1871
  const ctx = {
@@ -1851,7 +1886,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
1851
1886
  what: itemWhat(x, item, entries.get(itemObject(item)), task.track),
1852
1887
  ...covered ? { covered } : {},
1853
1888
  ...weight === void 0 ? {} : { weight },
1854
- ...words2.labels?.[item] ? { label: words2.labels[item] } : {}
1889
+ ...labelOf(item) ? { label: labelOf(item) } : {}
1855
1890
  };
1856
1891
  }),
1857
1892
  known: state.covered !== void 0,
@@ -2019,6 +2054,10 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
2019
2054
  ...roles.map((id) => reachOf(current, id, "role", changed))
2020
2055
  ].filter((r) => !!r);
2021
2056
  if (!ctx.reach.length) delete ctx.reach;
2057
+ if (ctx.reach?.some((r) => r.matrix?.length)) {
2058
+ const legend = matrixOf(current).legend;
2059
+ if (legend.length) ctx.matrixLegend = legend;
2060
+ }
2022
2061
  const glossary = x.fileOf("term:");
2023
2062
  const writtenText = written.join("\n");
2024
2063
  ctx.terms = (glossary && x.has(glossary) ? x.shards(glossary) : []).filter((path) => !/\/\d{2}-[^/]*$/.test(path)).flatMap((path) => {
@@ -2047,6 +2086,24 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
2047
2086
  }
2048
2087
  const title = key.includes(":") ? void 0 : titleOf(current, key);
2049
2088
  const pinned = pinnedPath(x, key);
2089
+ const mine = entries.get(key);
2090
+ let checked = false;
2091
+ let lost2;
2092
+ if (changed.has(key) && mine && !mine.binary && !s.absent) {
2093
+ checked = true;
2094
+ const wroteBefore = linesOf2(key, mine.exported.before ? mine.before : void 0);
2095
+ const wrote = [...linesOf2(key, mine.exported.after ? mine.after : void 0)].filter(
2096
+ (l) => !wroteBefore.has(l)
2097
+ );
2098
+ lost2 = s.later.flatMap((l) => {
2099
+ if (l.entry.binary) return [];
2100
+ const kept = linesOf2(key, l.entry.exported.after ? l.entry.after : void 0);
2101
+ const gone = [...linesOf2(key, l.entry.exported.before ? l.entry.before : void 0)].filter(
2102
+ (line) => wrote.includes(line) && !kept.has(line)
2103
+ );
2104
+ return gone.length ? [{ change: l.change, lines: gone }] : [];
2105
+ });
2106
+ }
2050
2107
  return [
2051
2108
  {
2052
2109
  key,
@@ -2056,7 +2113,9 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
2056
2113
  ...pinned ? { pinned: at(pinned) } : {},
2057
2114
  ...diff ? { diff } : {},
2058
2115
  ...now === void 0 ? { gone: true } : {},
2059
- ...s.absent ? { entered: true } : {}
2116
+ ...s.absent ? { entered: true } : {},
2117
+ ...checked ? { checked: true } : {},
2118
+ ...lost2?.length ? { lost: lost2 } : {}
2060
2119
  }
2061
2120
  ];
2062
2121
  });
@@ -2088,6 +2147,7 @@ function pinFiles(current, c) {
2088
2147
  var textAfter = (e) => e.exported.after ? e.after : void 0;
2089
2148
  var DIFF_LINES = 40;
2090
2149
  var NEW_DIFFS = 12;
2150
+ var LOST_LINES = 8;
2091
2151
  function clippedDiff(diff) {
2092
2152
  const lines = diff.split("\n");
2093
2153
  return lines.length <= DIFF_LINES ? diff : `${lines.slice(0, DIFF_LINES).join("\n")}
@@ -2109,34 +2169,8 @@ function initiativeSection(i) {
2109
2169
  ...prose ? [prose, ""] : []
2110
2170
  ];
2111
2171
  }
2112
- function renderContext(c) {
2113
- const out = [
2114
- `# ${c.task}: ${c.title ?? c.change.title}`,
2115
- "",
2116
- // The words the lists show for the task: what a person calls it, never what to build from.
2117
- ...c.summary ? [c.summary, ""] : [],
2118
- ...c.title ? [`Change: ${c.change.title}.`, ""] : [],
2119
- ...c.initiative ? initiativeSection(c.initiative) : [],
2120
- `Track ${c.track.code} (${c.track.kind}${c.track.channels.length ? `: ${c.track.channels.join(", ")}` : ""}). Change ${c.change.id}, signed off ${c.change.signed_off}, level ${c.change.level}. ` + (c.weight === void 0 ? "" : `Task weight ${c.weight} of 100. `) + `Paths are relative to the export, ${c.export}.`
2121
- ];
2122
- const movedSince = (c.changedSince ?? []).filter((e) => !e.entered);
2123
- if (movedSince.length) {
2124
- const n = movedSince.length;
2125
- const fresh = movedSince.filter((e) => e.changes.some((ch) => ch.fresh)).length;
2126
- out.push(
2127
- "",
2128
- `This brief is the spec as ${c.change.id} saw it at its sign-off. ${n === 1 ? "One object it names was" : `${n} objects it names were`} changed since by later changes${fresh ? ` (${fresh} new since you last read this brief)` : ""}: those are the later changes\u2019 tasks, listed under "Changed since" at the end, never this task\u2019s work.` + (c.pins ? ` An absolute path under ${c.pins} is such an object as ${c.change.id} saw it.` : "")
2129
- );
2130
- }
2131
- if (c.after.length) out.push("", `Waits for: ${c.after.map((a) => `${a.change}/${a.track}`).join(", ")}.`);
2132
- if (c.startFrom?.length)
2133
- out.push(
2134
- "",
2135
- `Start from ${c.startFrom.map((s) => `\`${s.branch}\` (${s.id}${s.commit ? ` done at ${s.commit.slice(0, 12)}` : ""})`).join(", then ")}, not from the main branch: the predecessor's work is pushed there and not merged yet (fetch it and base your branch on \`origin/${c.startFrom[c.startFrom.length - 1].branch}\`).`
2136
- );
2137
- out.push("");
2138
- if (c.questions?.length) out.push(...questionsSection(c.questions));
2139
- if (c.answers?.length) out.push(...answersSection(c.answers));
2172
+ function checklistSection(c) {
2173
+ const out = [];
2140
2174
  if (!c.checklist)
2141
2175
  out.push("This export has no checklist (work.json format 1): the task\u2019s progress is its status only.");
2142
2176
  else {
@@ -2166,6 +2200,51 @@ function renderContext(c) {
2166
2200
  )
2167
2201
  );
2168
2202
  }
2203
+ return out;
2204
+ }
2205
+ function renderChecklist(c) {
2206
+ const out = [
2207
+ `# ${c.task}: ${c.title ?? c.change.title}`,
2208
+ "",
2209
+ ...c.summary ? [c.summary, ""] : [],
2210
+ ...c.weight === void 0 ? [] : [`Task weight ${c.weight} of 100.`, ""],
2211
+ ...c.questions?.length ? questionsSection(c.questions) : [],
2212
+ ...c.answers?.length ? answersSection(c.answers) : [],
2213
+ ...checklistSection(c),
2214
+ "",
2215
+ `This task\u2019s questions and checklist only; the full brief is \`alterspec-client context ${c.task}\`.`
2216
+ ];
2217
+ return out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
2218
+ }
2219
+ function renderContext(c) {
2220
+ const out = [
2221
+ `# ${c.task}: ${c.title ?? c.change.title}`,
2222
+ "",
2223
+ // The words the lists show for the task: what a person calls it, never what to build from.
2224
+ ...c.summary ? [c.summary, ""] : [],
2225
+ ...c.title ? [`Change: ${c.change.title}.`, ""] : [],
2226
+ ...c.initiative ? initiativeSection(c.initiative) : [],
2227
+ `Track ${c.track.code} (${c.track.kind}${c.track.channels.length ? `: ${c.track.channels.join(", ")}` : ""}). Change ${c.change.id}, signed off ${c.change.signed_off}, level ${c.change.level}. ` + (c.weight === void 0 ? "" : `Task weight ${c.weight} of 100. `) + `Paths are relative to the export, ${c.export}.`
2228
+ ];
2229
+ const movedSince = (c.changedSince ?? []).filter((e) => !e.entered);
2230
+ if (movedSince.length) {
2231
+ const n = movedSince.length;
2232
+ const fresh = movedSince.filter((e) => e.changes.some((ch) => ch.fresh)).length;
2233
+ out.push(
2234
+ "",
2235
+ `This brief is the spec as ${c.change.id} saw it at its sign-off. ${n === 1 ? "One object it names was" : `${n} objects it names were`} changed since by later changes${fresh ? ` (${fresh} new since you last read this brief)` : ""}: those are the later changes\u2019 tasks, listed under "Changed since" at the end, never this task\u2019s work.` + (c.pins ? ` An absolute path under ${c.pins} is such an object as ${c.change.id} saw it.` : "")
2236
+ );
2237
+ }
2238
+ if (c.after.length) out.push("", `Waits for: ${c.after.map((a) => `${a.change}/${a.track}`).join(", ")}.`);
2239
+ if (c.startFrom?.length)
2240
+ out.push(
2241
+ "",
2242
+ `Start from ${c.startFrom.map((s) => `\`${s.branch}\` (${s.id}${s.commit ? ` done at ${s.commit.slice(0, 12)}` : ""})`).join(", then ")}, not from the main branch: the predecessor's work is pushed there and not merged yet (fetch it and base your branch on \`origin/${c.startFrom[c.startFrom.length - 1].branch}\`).`
2243
+ );
2244
+ out.push("");
2245
+ if (c.questions?.length) out.push(...questionsSection(c.questions));
2246
+ if (c.answers?.length) out.push(...answersSection(c.answers));
2247
+ out.push(...checklistSection(c));
2169
2248
  out.push("", `## Why (${c.proposal.path})`, "", c.proposal.why || "(none written)");
2170
2249
  out.push("", "## What changes", "", c.proposal.what || "(none written)");
2171
2250
  if (c.proposal.dataChange)
@@ -2230,6 +2309,13 @@ function renderContext(c) {
2230
2309
  "Where the export enforces, holds or shows the rules and roles this task touches or names; a capability or screen not in the export isn\u2019t listed.",
2231
2310
  ""
2232
2311
  );
2312
+ if (c.matrixLegend?.length)
2313
+ out.push(
2314
+ `Under a rule, its row of the rule matrix (\`${RULE_MATRIX_FILE}\`), so the matrix need not be opened. How to read it:`,
2315
+ "",
2316
+ ...c.matrixLegend,
2317
+ ""
2318
+ );
2233
2319
  const list2 = (ps) => ps.map((p) => `${p.id}${p.scope ? ` (${p.scope})` : ""}${p.changed ? " (this task changes it)" : ""}`).join(", ");
2234
2320
  for (const r of c.reach) {
2235
2321
  const name = `${r.id}${r.title ? ` ${r.title}` : ""}`;
@@ -2240,6 +2326,7 @@ function renderContext(c) {
2240
2326
  r.screens.length ? `on ${list2(r.screens)}` : "on no screen"
2241
2327
  ];
2242
2328
  out.push(`- ${name}: ${parts.join("; ")}.`);
2329
+ for (const line of r.matrix ?? []) out.push(` ${line}`);
2243
2330
  } else {
2244
2331
  const parts = [
2245
2332
  r.capabilities.length ? `may perform ${list2(r.capabilities)}` : "may perform no capability",
@@ -2328,7 +2415,7 @@ function renderContext(c) {
2328
2415
  const names = (e) => `${e.key}${e.title ? ` ${e.title}` : ""}${e.own ? " (this task changes it)" : ""}`;
2329
2416
  if (movedSince.length) {
2330
2417
  out.push(
2331
- `Later changes touched what this brief names. Build this task to the text above: what a later change added is built in its own task. Before you build one of this task\u2019s objects listed here, compare the file the brief gives for it with the export\u2019s: a line a later change removed or reversed is not built twice (build that item as the later change says and say so in the commit).`,
2418
+ `Later changes touched what this brief names. Build this task to the text above: what a later change added is built in its own task.` + (movedSince.some((e) => e.own) ? ' For the objects this task changes, whether a later change removed or reworded a line of this task\u2019s hunks is checked here, under "Checked": compare nothing yourself.' : ""),
2332
2419
  "",
2333
2420
  ...(c.later ?? []).map(
2334
2421
  (l) => `- ${l.id}${l.title ? ` "${l.title}"` : ""}: ${l.task ? `its task ${l.task}` : "no task on this track"}${l.delta ? `; \`${l.delta}\`` : ""}`
@@ -2341,6 +2428,27 @@ function renderContext(c) {
2341
2428
  ),
2342
2429
  ""
2343
2430
  );
2431
+ const own = movedSince.filter((e) => e.own);
2432
+ if (own.length)
2433
+ out.push(
2434
+ "Checked: this task\u2019s own lines against the later changes\u2019 deltas.",
2435
+ "",
2436
+ ...own.map((e) => {
2437
+ if (!e.checked)
2438
+ return `- ${names(e)}: not checked (a binary file, or the export did not hold it then): compare the pinned file with the export\u2019s.`;
2439
+ if (!e.lost?.length)
2440
+ return `- ${names(e)}: no line of this task\u2019s hunks was removed or reworded by ${e.changes.map((ch) => ch.id).join(", ")}. Build it as the brief says.`;
2441
+ return [
2442
+ `- ${names(e)}: build these lines as the later change says, not as the brief has them, and say so in the commit\u2019s body:`,
2443
+ ...e.lost.flatMap((l) => [
2444
+ ` - ${l.change} removed or reworded ${l.lines.length === 1 ? "one line" : `${l.lines.length} lines`}:`,
2445
+ ...l.lines.slice(0, LOST_LINES).map((line) => ` - \`${line.replace(/`/g, "'")}\``),
2446
+ ...l.lines.length > LOST_LINES ? [` - and ${l.lines.length - LOST_LINES} more (see its delta)`] : []
2447
+ ])
2448
+ ].join("\n");
2449
+ }),
2450
+ ""
2451
+ );
2344
2452
  const fresh = movedSince.filter((e) => e.diff);
2345
2453
  if (fresh.length) {
2346
2454
  out.push(
@@ -2463,6 +2571,8 @@ async function bugTaskState(session, task) {
2463
2571
  bug,
2464
2572
  objects: z8.array(z8.string()).catch([]).parse(answer.objects),
2465
2573
  after: (answer.after ?? []).flatMap((a) => a.id ? [a.id] : []),
2574
+ // The task's items are the bug's cites on this track, not every track's.
2575
+ ...items.length ? { items: items.map((i) => ({ item: i.item })) } : {},
2466
2576
  covered: new Map(items.flatMap((i) => i.covered_commit ? [[i.item, i.covered_commit]] : [])),
2467
2577
  ...from.length ? { startFrom: from } : {}
2468
2578
  };
@@ -2476,9 +2586,8 @@ function bugContext(x, task, exportDir2, state, questions) {
2476
2586
  kind: "ui",
2477
2587
  channels: []
2478
2588
  };
2479
- const keys = [
2480
- ...new Set(state.objects.length ? state.objects : state.bug.cites.map((c) => objectOfItem(c, [])))
2481
- ];
2589
+ const cites = state.items?.length ? state.items.map((i) => i.item) : state.bug.cites;
2590
+ const keys = [...new Set(state.objects.length ? state.objects : cites.map((c) => objectOfItem(c, [])))];
2482
2591
  const objects = keys.map((key) => {
2483
2592
  const file = x.fileOf(key);
2484
2593
  const held = file !== void 0 && x.has(file);
@@ -2497,7 +2606,7 @@ function bugContext(x, task, exportDir2, state, questions) {
2497
2606
  after: state.after,
2498
2607
  ...state.startFrom?.length ? { startFrom: state.startFrom } : {},
2499
2608
  checklist: {
2500
- items: state.bug.cites.map((item) => {
2609
+ items: cites.map((item) => {
2501
2610
  const covered = state.covered?.get(item);
2502
2611
  return { item, what: itemWhat(x, item, void 0, task.track), ...covered ? { covered } : {} };
2503
2612
  })
@@ -2539,7 +2648,7 @@ function renderBugContext(c) {
2539
2648
  "",
2540
2649
  `## Checklist (${done} of ${c.checklist.items.length} covered)`,
2541
2650
  "",
2542
- "The cited items. Name an item in `Alterspec-Covers` on the commit with which its tests pass again.",
2651
+ "The cited items on this track. Name an item in `Alterspec-Covers` on the commit with which its tests pass again.",
2543
2652
  "",
2544
2653
  ...c.checklist.items.map(
2545
2654
  (i) => `- [${i.covered ? "x" : " "}] \`${i.item}\`: ${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
@@ -3550,6 +3659,15 @@ async function coveredState(loaded, task) {
3550
3659
  const from = startFrom(task.track, answer.after);
3551
3660
  return {
3552
3661
  covered: new Map(items.flatMap((i) => i.covered_commit ? [[i.item, i.covered_commit]] : [])),
3662
+ // The dispatcher's list is the checklist: its first item list stands (its spec, section 9), so the brief and
3663
+ // the `Alterspec-Covers` it accepts name the same items.
3664
+ ...items.length ? {
3665
+ items: items.map((i) => ({
3666
+ item: i.item,
3667
+ ...typeof i.weight === "number" ? { weight: i.weight } : {},
3668
+ ...typeof i.label === "string" && i.label ? { label: i.label } : {}
3669
+ }))
3670
+ } : {},
3553
3671
  ...answers ? { answers } : {},
3554
3672
  ...from.length ? { startFrom: from } : {}
3555
3673
  };
@@ -3658,7 +3776,10 @@ program.command("export-head").description("pull the export clone and print its
3658
3776
  process.stdout.write(JSON.stringify(head, null, 2) + "\n");
3659
3777
  })
3660
3778
  );
3661
- program.command("context").description("print a task\u2019s brief, assembled from the export").argument("<task>", "the task, e.g. CHG-012/BE or BUG-3/BE").option("--json", "print it as JSON").option("--stats", "print its size by section instead").action(
3779
+ program.command("context").description("print a task\u2019s brief, assembled from the export").argument("<task>", "the task, e.g. CHG-012/BE or BUG-3/BE").option("--json", "print it as JSON").option("--stats", "print its size by section instead").option(
3780
+ "--checklist",
3781
+ "print only the task\u2019s questions and checklist, for re-reading during the work (a bug\u2019s brief whole)"
3782
+ ).action(
3662
3783
  run(async (id, opts) => {
3663
3784
  const loaded = loadConfig();
3664
3785
  approveWorktree(loaded);
@@ -3692,12 +3813,12 @@ program.command("context").description("print a task\u2019s brief, assembled fro
3692
3813
  await changeQuestions(sessionOf(loaded), tasks),
3693
3814
  { pins, shown: readShown(process.cwd(), task) }
3694
3815
  );
3695
- if (!opts.stats) {
3816
+ if (!opts.stats && !opts.checklist) {
3696
3817
  writePins(pins, pinFiles(x, ctx));
3697
3818
  writeShown(process.cwd(), task, shownOf(ctx));
3698
3819
  }
3699
3820
  process.stdout.write(
3700
- opts.stats ? contextStats(renderContext(ctx)) : opts.json ? JSON.stringify(ctx, null, 2) + "\n" : renderContext(ctx)
3821
+ opts.stats ? contextStats(renderContext(ctx)) : opts.json ? JSON.stringify(ctx, null, 2) + "\n" : opts.checklist ? renderChecklist(ctx) : renderContext(ctx)
3701
3822
  );
3702
3823
  })
3703
3824
  );