@alterset/alterspec-client 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/assets/prompts/agents/spec-answerer.md +8 -2
- package/assets/prompts/spec-ask.md +16 -1
- package/developer-guide.md +12 -2
- package/dist/cli.js +229 -12
- package/dist/cli.js.map +1 -1
- package/dist/work.js +5 -1
- package/dist/work.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,8 +26,10 @@ reference.
|
|
|
26
26
|
- **Track**: a stream of build work. It is not a channel. `BE` is the backend (every API channel included). Every
|
|
27
27
|
other track is one design, named by the code of the channel that owns it (`BO`, `MOB`). A channel that shares
|
|
28
28
|
another's design is built in that channel's track.
|
|
29
|
-
- **Checklist**: a task's items, such as acceptance criteria (`CAP-CAT-001-AC-03`), screen actions (`SCR-PRC-01.A02`)
|
|
30
|
-
|
|
29
|
+
- **Checklist**: a task's items, such as acceptance criteria (`CAP-CAT-001-AC-03`), screen actions (`SCR-PRC-01.A02`),
|
|
30
|
+
experience states (`UX-SCR-PRC-01-WEB#error`) and, of an object changed as a whole, the parts of its text that
|
|
31
|
+
changed (`ENT-USER#lifecycle`, `NFR-019#sign-in-succeeded`, `RULE-056#front-matter`). Progress counts the items
|
|
32
|
+
your commits cover.
|
|
31
33
|
- **Then and Shown**: a criterion's `Then` is what the system guarantees (the backend's), its `Shown` what the screen
|
|
32
34
|
shows (a UI track's). A task's checklist holds a criterion for its own part only; one without `Shown` is all the
|
|
33
35
|
backend's.
|
|
@@ -102,10 +104,14 @@ You talk to Claude Code; the skills call the dispatcher and the CLI for you.
|
|
|
102
104
|
2. **Build from the brief.** `/alterspec-task-context [task]` reads the task's brief from the export:
|
|
103
105
|
- the checklist, with the items the dispatcher already holds covered and what changed in each;
|
|
104
106
|
- why the change was made;
|
|
105
|
-
- the before and after of each object
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
- the before and after of each object, and what moved since the sign-off: the later changes that touched it and
|
|
108
|
+
whether the export's current text is still this delta's after (when not, build to the current file);
|
|
109
|
+
- for `BE`: the changed acceptance criteria on the checklist and the operations, whole; the rules, events,
|
|
110
|
+
quality requirements and integrations the checklist's criteria or the change's text name, whole; the others
|
|
111
|
+
the capabilities name, as paths;
|
|
112
|
+
- for `BE`: the entities the capabilities work with, as paths, each with its lifecycle in one line;
|
|
113
|
+
- the reach of the rules it carries whole and the roles it touches: which capabilities enforce or hold them,
|
|
114
|
+
which criteria cover them, which screens they are on;
|
|
109
115
|
- the decisions and glossary terms the change's text names, whole; the other decisions its objects name, as
|
|
110
116
|
paths;
|
|
111
117
|
- for a UI track: the screens, their experience contracts, the mockup pages and the design system.
|
|
@@ -31,7 +31,11 @@ the export silent**, the neighbours (each with why it is there) and the views. S
|
|
|
31
31
|
- what is recorded, required or allowed in a field: the entity's attributes (kind, required, editable,
|
|
32
32
|
constraints), states and transitions;
|
|
33
33
|
- when, in what order, who is next: flows, events (who emits, who consumes), transitions by time;
|
|
34
|
-
- why it is so: the decisions, and the proposal of the change that last touched it
|
|
34
|
+
- why it is so: the decisions, and the proposal of the change that last touched it. An archived proposal
|
|
35
|
+
(`changes/archive/<CHG>/proposal.md`, or `modules/<mod>/changes/archive/<CHG>/proposal.md` for a module's change; its "What changes" rows and examples) is the record of why and what moved;
|
|
36
|
+
it is not the spec. It never makes an outcome `spec` on its own, and where it and an object differ, the object
|
|
37
|
+
(the rule, the criterion, the entity) is what the product does: answer from the object and say in one line that
|
|
38
|
+
the proposal reads otherwise. Two **objects** that differ are still `open`;
|
|
35
39
|
- what another system may do: `_generated/operations.md`.
|
|
36
40
|
- **Follow a link only when the answer depends on it**: a neighbour is there because the export links it, not
|
|
37
41
|
because it must be read. Grep only for a word the reading list could not resolve, and only under `_shards/`.
|
|
@@ -61,7 +65,9 @@ Exactly one of three outcomes. Which one is decided by what you can cite, never
|
|
|
61
65
|
the work if the product side decides otherwise.
|
|
62
66
|
- **`open`**: the export doesn't say and no reading is clearly the cautious one, or the readings differ in what a
|
|
63
67
|
person may see or do, what is charged, what is recorded or deleted, or who is told. Never assume those. Say what
|
|
64
|
-
exactly is undecided, as a question a product person can answer in a sentence, with the IDs it concerns.
|
|
68
|
+
exactly is undecided, as a question a product person can answer in a sentence, with the IDs it concerns. When
|
|
69
|
+
the question has several parts, keep them numbered in the question and answer each part with its own outcome's
|
|
70
|
+
words, so a product person can confirm part (1) and decide part (2) in one answer.
|
|
65
71
|
|
|
66
72
|
**Silence is proven, not felt.** `assumed` and `open` are allowed only after you opened every path under "open
|
|
67
73
|
before calling the export silent". If you are sent back with paths you didn't open, read them and answer again.
|
|
@@ -6,7 +6,12 @@ Arguments: the question. It is the developer's, or your own when the spec leaves
|
|
|
6
6
|
(silent, ambiguous, or saying two things), or when you are about to decide something about the product's behaviour
|
|
7
7
|
that the brief doesn't state: then ask here instead of stopping the developer or deciding silently. For a decision
|
|
8
8
|
you are about to take, say in the question which way you would go and why; the answerer weighs it against the
|
|
9
|
-
export, and when the export is silent it is what gets recorded as the assumption.
|
|
9
|
+
export, and when the export is silent it is what gets recorded as the assumption. A question is about one
|
|
10
|
+
matter and carries every case of it you can see as numbered parts (the moment a limit counts from, what happens to
|
|
11
|
+
a thing in flight when it ends, what is recorded then): one question the product side answers once, not one per
|
|
12
|
+
case asked as each comes up. A wish of the developer's about how the product should behave or look, with no spec
|
|
13
|
+
text it reads two ways and no item waiting on it, is not a question: say so, and the developer brings it to the
|
|
14
|
+
product side as a proposal.
|
|
10
15
|
|
|
11
16
|
You edit nothing in the export. The answer comes from the export, never from this repository's code.
|
|
12
17
|
|
|
@@ -25,6 +30,16 @@ the item too. Without one, a question about the product as a whole is asked with
|
|
|
25
30
|
<ID...>`. When one of them is this question and the product side
|
|
26
31
|
answered it, say that answer with its `Q-<n>` and stop: nothing is asked or recorded twice, and a product
|
|
27
32
|
person's answer the export doesn't hold yet stands over the export's silence. A failure here stops nothing.
|
|
33
|
+
**One question per matter.** When one of them is still open, cites the same object (the same rule, entity,
|
|
34
|
+
integration or moment) and this question is the next case of it (a follow-up to your own question, an edge the
|
|
35
|
+
first one didn't name), this is not a new question: it is a new numbered part of that one. Go on through steps
|
|
36
|
+
3 to 6 for the new part alone and, at step 7, record it as one question that restates the open one with its
|
|
37
|
+
parts numbered, naming the earlier `Q-<n>` first in its text ("Extends Q-124: (1) … (2) …") and passing
|
|
38
|
+
`extends: Q-<n>` when the dispatcher's `ask` takes it; the product side then answers the matter once. And a
|
|
39
|
+
limit: once three of your questions about one cited object are open on the task, ask nothing more about that
|
|
40
|
+
object. Write the cases still undecided into one consolidated question the same way, build everything else on the
|
|
41
|
+
assumptions already recorded, and leave the items those cases hold uncovered. Fifty questions on one task about
|
|
42
|
+
one e-mail's five moments were answered by nobody; one question with five parts would have been.
|
|
28
43
|
3. Run `alterspec-client lookup --question "<the question, in full>"`, with `--task <task>` and `--item <item>`
|
|
29
44
|
whenever the question concerns one. It prints what the question is about, the shards to read first, the ones
|
|
30
45
|
that must be opened before the export may be called silent, the neighbours and the views. When it says the
|
package/developer-guide.md
CHANGED
|
@@ -175,7 +175,7 @@ server. Then talk to it in plain words; the skills do the rest.
|
|
|
175
175
|
| You say or type | What happens |
|
|
176
176
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
177
177
|
| "give me work" / `/alterspec-task-next` | takes the next available task on your track and shows the brief; it creates no branch or worktree, you work wherever you like |
|
|
178
|
-
| "let's work on my task" / `/alterspec-task-context` | the task's brief from the spec: why, the checklist, the one-time data change if any, the objects it changes (before and after) and where the export uses them, the changed acceptance criteria, the rules, events, decisions and glossary terms they and the change name (the rest, and the entities, as paths); for a UI track also the screens, their contracts, mockups and design system |
|
|
178
|
+
| "let's work on my task" / `/alterspec-task-context` | the task's brief from the spec: why, the checklist (each part of an object named by its section or line), the one-time data change if any, the objects it changes (before and after), what moved since the sign-off and where the export uses them, the reach of its rules and roles, the changed acceptance criteria, the rules, events, quality requirements, integrations, decisions and glossary terms they and the change name (the rest, and the entities with their lifecycles, as paths); for a UI track also the screens, their contracts, mockups and design system |
|
|
179
179
|
| "what am I on?" / `/alterspec-task-status` | your tasks with progress and ETA, what's available on your tracks, what is blocked and by what |
|
|
180
180
|
| "what does RULE-… say?" / `/alterspec-spec-ask` | answers about the product from the spec, citing IDs; what the spec doesn't say is recorded as an assumption or an open question for the product side; Claude uses it by itself when a task's spec is undecided |
|
|
181
181
|
| `/alterspec-task-done CHG-023/BE` | after your branch is pushed: reports the task done with its head commit and the branch (or, once merged, the commit on the main branch); refused while nothing is pushed |
|
|
@@ -242,6 +242,14 @@ task is yours yet: ask about `CHG-028/BE` while it waits behind another task and
|
|
|
242
242
|
its next holder's brief, not among the questions about no task. Name the task, or Claude takes the one the work is
|
|
243
243
|
about.
|
|
244
244
|
|
|
245
|
+
One question per matter. A question carries every case of its matter as numbered parts (the moment a limit counts
|
|
246
|
+
from, what happens to a thing in flight when it ends, what is recorded then), and a follow-up to Claude's own open
|
|
247
|
+
question extends that question instead of adding a new one, so the product side answers the matter once. After
|
|
248
|
+
three open questions about one object on a task, Claude asks nothing more about it: it writes the cases still
|
|
249
|
+
undecided into one question and builds everything else on the assumptions already recorded. A wish about how the
|
|
250
|
+
product should behave or look, with nothing in the spec read two ways and no item waiting on it, is not a question:
|
|
251
|
+
bring it to the product side as a proposal.
|
|
252
|
+
|
|
245
253
|
How an answer is found: the client first looks whether the question was asked before, then computes where the spec
|
|
246
254
|
would answer it (`lookup`: what the question names, by ID, by the glossary's words and their synonyms, by title; the
|
|
247
255
|
sections to read first; the rules, decisions and "out of scope" lines about it) and gives that reading list to the
|
|
@@ -266,7 +274,9 @@ recorded: then an open question is yours to carry, as before.
|
|
|
266
274
|
- **The trailer names the task.** Progress is read from the `Alterspec-Task` trailer of your commits, on any branch;
|
|
267
275
|
the hook takes the task from the last commit's trailer (or from a `task/<chg>-<track>` branch).
|
|
268
276
|
- **A UI task waits for its `BE` task.** "Nothing available" on a UI track usually means the backend part isn't done
|
|
269
|
-
yet; `/alterspec-task-status` says what blocks what.
|
|
277
|
+
yet; `/alterspec-task-status` says what blocks what. On a track, a task waits only for the earlier tasks that
|
|
278
|
+
changed an item of its checklist, wrote what it changes again, or added an object it names; the rest of the
|
|
279
|
+
lineage runs beside it.
|
|
270
280
|
- **The scope is the spec's.** If something in the spec is undecided or looks wrong, it is a question (above); don't
|
|
271
281
|
widen or narrow the task yourself.
|
|
272
282
|
- **Only you move your task on.** Going away for a while? Release it. An admin can force a release only when you are
|
package/dist/cli.js
CHANGED
|
@@ -33,7 +33,11 @@ var WorkTaskSchema = z.object({
|
|
|
33
33
|
* Sorted, never empty.
|
|
34
34
|
*/
|
|
35
35
|
items: z.array(z.string().min(1)).min(1),
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The tasks this one waits for, resolved and reduced: the same change's `BE` task, and the track's tasks of the
|
|
38
|
+
* changes it builds on that did the same work (an item of both, a line of a whole object this task edits again,
|
|
39
|
+
* or an object this task names that entered the export with the earlier change).
|
|
40
|
+
*/
|
|
37
41
|
after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict())
|
|
38
42
|
}).strict();
|
|
39
43
|
var WorkChangeSchema = z.object({
|
|
@@ -681,6 +685,75 @@ function dataChangeText(sectionText2) {
|
|
|
681
685
|
return text && !/^none\b/i.test(text) ? text : void 0;
|
|
682
686
|
}
|
|
683
687
|
|
|
688
|
+
// ../src/changes/parts.ts
|
|
689
|
+
var FRONT_MATTER_PART = "front-matter";
|
|
690
|
+
var itemObject = (item) => item.startsWith("file:") ? item : item.replace(/-AC-\d{2}$/, "").replace(/[.#][^.#]*$/, "");
|
|
691
|
+
var forWork = (text) => text.replace(/^[^\S\n]*<!--[\s\S]*?-->[^\S\n]*\n/gm, "").replace(/<!--[\s\S]*?-->/g, "").replace(/^version:[^\S\n]*\d+[^\S\n]*\n/m, "").replace(/^(?:reviewed|dry|page):[^\n]*\n/gm, "");
|
|
692
|
+
function objectParts(text, kind) {
|
|
693
|
+
const out = /* @__PURE__ */ new Map();
|
|
694
|
+
const put = (label, heading, body2) => {
|
|
695
|
+
const base = label === "front-matter" ? FRONT_MATTER_PART : slug(heading);
|
|
696
|
+
let key = base;
|
|
697
|
+
for (let n = 2; out.has(key); n++) key = `${base}-${n}`;
|
|
698
|
+
out.set(key, { label, heading, text: body2 });
|
|
699
|
+
};
|
|
700
|
+
const t = forWork(text);
|
|
701
|
+
if (kind === "doc") {
|
|
702
|
+
const { raw, body: body2 } = splitFrontMatter(t);
|
|
703
|
+
if (raw) put("front-matter", FRONT_MATTER_PART, raw);
|
|
704
|
+
for (const s of headed(body2, "## ").sections) put("section", s.heading, s.text);
|
|
705
|
+
return out;
|
|
706
|
+
}
|
|
707
|
+
const yaml = /^```ya?ml\n([\s\S]*?)\n```[^\S\n]*$/m.exec(t);
|
|
708
|
+
if (yaml) put("front-matter", FRONT_MATTER_PART, yaml[1]);
|
|
709
|
+
const body = yaml ? t.slice(yaml.index + yaml[0].length) : t.replace(/^## [^\n]*\n?/, "");
|
|
710
|
+
const { sections } = headed(body, "### ");
|
|
711
|
+
if (sections.length) for (const s of sections) put("section", s.heading, s.text);
|
|
712
|
+
else for (const b of bullets(body)) put("line", b.heading, b.text);
|
|
713
|
+
return out;
|
|
714
|
+
}
|
|
715
|
+
function headed(text, marker) {
|
|
716
|
+
const sections = [];
|
|
717
|
+
let intro = "";
|
|
718
|
+
let fence2 = false;
|
|
719
|
+
for (const l of text.split("\n")) {
|
|
720
|
+
if (/^(?:```|~~~)/.test(l)) fence2 = !fence2;
|
|
721
|
+
if (!fence2 && l.startsWith(marker) && /\S/.test(l.slice(marker.length))) {
|
|
722
|
+
sections.push({ heading: l.slice(marker.length).trim(), text: "" });
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
if (sections.length) sections[sections.length - 1].text += `${l}
|
|
726
|
+
`;
|
|
727
|
+
else intro += `${l}
|
|
728
|
+
`;
|
|
729
|
+
}
|
|
730
|
+
return { intro, sections };
|
|
731
|
+
}
|
|
732
|
+
var BULLET = /^(?:[-*+]|\d+[.)])\s+(.*)$/;
|
|
733
|
+
function bullets(text) {
|
|
734
|
+
const out = [];
|
|
735
|
+
let current;
|
|
736
|
+
let fence2 = false;
|
|
737
|
+
for (const l of text.split("\n")) {
|
|
738
|
+
if (/^(?:```|~~~)/.test(l)) {
|
|
739
|
+
fence2 = !fence2;
|
|
740
|
+
current = void 0;
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
if (fence2) continue;
|
|
744
|
+
const m = BULLET.exec(l);
|
|
745
|
+
if (m) {
|
|
746
|
+
current = { heading: lead(m[1]), text: `${l}
|
|
747
|
+
` };
|
|
748
|
+
out.push(current);
|
|
749
|
+
} else if (current && /^\s+\S/.test(l)) current.text += `${l}
|
|
750
|
+
`;
|
|
751
|
+
else current = void 0;
|
|
752
|
+
}
|
|
753
|
+
return out;
|
|
754
|
+
}
|
|
755
|
+
var lead = (s) => s.replace(/\*\*|__|`/g, "").split(/:\s|:$|\s[—–-]\s|\.\s|\.$/)[0].trim().split(/\s+/).slice(0, 8).join(" ");
|
|
756
|
+
|
|
684
757
|
// ../src/lib/diff.ts
|
|
685
758
|
var linesOf = (text) => text === "" ? [] : text.replace(/\n$/, "").split("\n");
|
|
686
759
|
function diffLines(a, b) {
|
|
@@ -1119,22 +1192,26 @@ function withSections(diff, before, after) {
|
|
|
1119
1192
|
}).join("\n");
|
|
1120
1193
|
}
|
|
1121
1194
|
var BOOKKEEPING = /^(reviewed|page|dry|status|version|signed_off|base):/;
|
|
1195
|
+
var firstAddedLine = (a, b) => diffLines(a, b).filter((l) => l.op === "+").map(
|
|
1196
|
+
(l) => l.text.replace(/^\s*(?:[-*]|#+|\d+\.)\s+/, "").replace(/\*\*/g, "").trim()
|
|
1197
|
+
).find((t) => t && !/^(---|```)/.test(t) && !BOOKKEEPING.test(t));
|
|
1198
|
+
var clipped = (line) => line && line.length > 200 ? `${line.slice(0, 199)}\u2026` : line;
|
|
1122
1199
|
function firstAdded(key, entry) {
|
|
1123
|
-
const added = (a, b) => diffLines(a, b).filter((l) => l.op === "+").map(
|
|
1124
|
-
(l) => l.text.replace(/^\s*(?:[-*]|#+|\d+\.)\s+/, "").replace(/\*\*/g, "").trim()
|
|
1125
|
-
).find((t) => t && !/^(---|```)/.test(t) && !BOOKKEEPING.test(t));
|
|
1126
1200
|
const before = forDiff(key, entry.before);
|
|
1127
1201
|
const after = forDiff(key, entry.after);
|
|
1128
|
-
|
|
1129
|
-
|
|
1202
|
+
return clipped(
|
|
1203
|
+
firstAddedLine(splitFrontMatter(before).body, splitFrontMatter(after).body) ?? firstAddedLine(splitFrontMatter(before).raw ?? "", splitFrontMatter(after).raw ?? "")
|
|
1204
|
+
);
|
|
1130
1205
|
}
|
|
1131
|
-
function objectBrief(x, key, entry, why) {
|
|
1206
|
+
function objectBrief(x, key, entry, why, later = []) {
|
|
1132
1207
|
const file = x.fileOf(key);
|
|
1133
1208
|
const held = file !== void 0 && x.has(file);
|
|
1134
1209
|
const brief = { key, ...held ? { file } : {} };
|
|
1135
1210
|
if (held && x.shards(file).length) brief.shards = x.shards(file)[0].replace(/\/[^/]+$/, "");
|
|
1136
1211
|
if (why) brief.unrecoverable = why;
|
|
1137
1212
|
if (!entry) return brief;
|
|
1213
|
+
const differs = held && entry.exported.after && entry.after !== void 0 && !entry.binary && forDiff(key, entry.after).trim() !== forDiff(key, x.read(file)).trim();
|
|
1214
|
+
if (later.length || differs) brief.since = { changes: later, differs: !!differs };
|
|
1138
1215
|
brief.change = exportChange(entry);
|
|
1139
1216
|
if (entry.status) brief.status = entry.status;
|
|
1140
1217
|
if (entry.before !== void 0 || entry.after !== void 0) {
|
|
@@ -1223,6 +1300,18 @@ function itemWhat(x, item, entry, track) {
|
|
|
1223
1300
|
if (item.startsWith("term:")) return `glossary term "${item.slice(5)}"`;
|
|
1224
1301
|
if (DATA_CHANGE_RE.test(item))
|
|
1225
1302
|
return `the one-time change to the records the product already holds (the proposal's "${DATA_CHANGE_SECTION}", below)`;
|
|
1303
|
+
const part = /^([^#]+)#([^#]+)$/.exec(item);
|
|
1304
|
+
if (part && !/^UX-/.test(item)) {
|
|
1305
|
+
const [, key, slug2] = part;
|
|
1306
|
+
const k = idKind(key);
|
|
1307
|
+
const owner = `${k && KIND_WORDS[k] ? `${KIND_WORDS[k]} ` : ""}${named(x, key)}`;
|
|
1308
|
+
const kind2 = entry?.kind === "item" ? "item" : "doc";
|
|
1309
|
+
const after = entry?.after !== void 0 ? objectParts(entry.after, kind2).get(slug2) : void 0;
|
|
1310
|
+
const before = entry?.before !== void 0 ? objectParts(entry.before, kind2).get(slug2) : void 0;
|
|
1311
|
+
const label = !after ? `the part "${slug2}"` : after.label === "front-matter" ? "the front-matter" : after.label === "section" ? `the section "${after.heading}"` : `the line "${after.heading}"`;
|
|
1312
|
+
const line2 = after ? clipped(firstAddedLine(before?.text ?? "", after.text)) : void 0;
|
|
1313
|
+
return `${label} of ${owner}${line2 ? `: "${line2}"` : ""}`;
|
|
1314
|
+
}
|
|
1226
1315
|
const kind = idKind(item);
|
|
1227
1316
|
const what = `${kind && KIND_WORDS[kind] ? `${KIND_WORDS[kind]} ` : ""}${named(x, item)}`;
|
|
1228
1317
|
if (!entry) return what;
|
|
@@ -1285,6 +1374,60 @@ function whereUsed(x, objects, entries, changed) {
|
|
|
1285
1374
|
}
|
|
1286
1375
|
return out;
|
|
1287
1376
|
}
|
|
1377
|
+
function laterChanges(x, change, key) {
|
|
1378
|
+
const order = x.work.changes.map((c) => c.id);
|
|
1379
|
+
const at = order.indexOf(change);
|
|
1380
|
+
const touched = x.sources.get(key)?.changed_by ?? [];
|
|
1381
|
+
return touched.filter((c) => order.indexOf(c) > at).sort((a, b) => order.indexOf(a) - order.indexOf(b));
|
|
1382
|
+
}
|
|
1383
|
+
function lifecycleOf(x, id) {
|
|
1384
|
+
const e = x.index()?.entities.find((e2) => e2.id === id);
|
|
1385
|
+
if (!e?.states?.length) return void 0;
|
|
1386
|
+
const states = e.states.map((s) => s === e.initial_state ? `${s} (initial)` : s).join(", ");
|
|
1387
|
+
const transitions = (e.transitions ?? []).map((t) => `${t.from}->${t.to}${t.by === "time" ? ` by time${t.at ? ` at ${t.at}` : ""}` : ""}`).join(", ");
|
|
1388
|
+
return `states ${states}${transitions ? `; transitions ${transitions}` : "; no transitions"}`;
|
|
1389
|
+
}
|
|
1390
|
+
function reachOf(x, id, kind, changed) {
|
|
1391
|
+
const index = x.index();
|
|
1392
|
+
if (!index) return void 0;
|
|
1393
|
+
const piece = (pid, title2, scope) => ({
|
|
1394
|
+
id: pid,
|
|
1395
|
+
path: x.fileOf(pid) ?? "",
|
|
1396
|
+
...title2 ? { title: title2 } : {},
|
|
1397
|
+
...changed.has(pid) ? { changed: true } : {},
|
|
1398
|
+
...scope ? { scope } : {}
|
|
1399
|
+
});
|
|
1400
|
+
const screenPiece = (sid) => piece(sid, index.screens.find((s) => s.id === sid)?.title ?? titleOf(x, sid));
|
|
1401
|
+
const title = titleOf(x, id);
|
|
1402
|
+
if (kind === "rule") {
|
|
1403
|
+
const caps2 = index.capabilities.filter((c) => (c.rules ?? []).includes(id));
|
|
1404
|
+
const criteria = caps2.flatMap((c) => {
|
|
1405
|
+
const file = x.fileOf(c.id);
|
|
1406
|
+
const text = file && x.has(file) ? sectionText(x, x.sectionShard(file, "Acceptance criteria")) : void 0;
|
|
1407
|
+
return (text ?? "").split(/^(?=### )/m).filter(
|
|
1408
|
+
(chunk) => chunk.startsWith("### ") && new RegExp(`^\\s*[-*]?\\s*\\**Covers:?\\**[^\\n]*\\b${id}\\b`, "m").test(chunk)
|
|
1409
|
+
).map((chunk) => chunk.slice(4).split(/\s/)[0]);
|
|
1410
|
+
});
|
|
1411
|
+
const screens2 = [...new Set(caps2.flatMap((c) => c.screens ?? []))].filter((sid) => x.sources.has(sid));
|
|
1412
|
+
return {
|
|
1413
|
+
id,
|
|
1414
|
+
kind,
|
|
1415
|
+
...title ? { title } : {},
|
|
1416
|
+
capabilities: caps2.map((c) => piece(c.id, c.title)),
|
|
1417
|
+
criteria,
|
|
1418
|
+
screens: screens2.map(screenPiece)
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
const caps = index.capabilities.filter((c) => (c.roles ?? []).some((r) => r.role === id));
|
|
1422
|
+
const screens = index.screens.filter((s) => (s.roles ?? []).some((r) => r.role === id));
|
|
1423
|
+
return {
|
|
1424
|
+
id,
|
|
1425
|
+
kind,
|
|
1426
|
+
...title ? { title } : {},
|
|
1427
|
+
capabilities: caps.map((c) => piece(c.id, c.title, c.roles?.find((r) => r.role === id)?.scope)),
|
|
1428
|
+
screens: screens.map((s) => piece(s.id, s.title))
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1288
1431
|
function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
1289
1432
|
const change = x.work.changes.find((c) => c.id === task.change);
|
|
1290
1433
|
if (!change) throw new ContextError(`${task.change} is not in this export's work.json: pull the export.`);
|
|
@@ -1310,7 +1453,7 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1310
1453
|
const covered = state.covered?.get(item);
|
|
1311
1454
|
return {
|
|
1312
1455
|
item,
|
|
1313
|
-
what: itemWhat(x, item, entries.get(item), task.track),
|
|
1456
|
+
what: itemWhat(x, item, entries.get(itemObject(item)), task.track),
|
|
1314
1457
|
...covered ? { covered } : {}
|
|
1315
1458
|
};
|
|
1316
1459
|
}),
|
|
@@ -1336,7 +1479,9 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1336
1479
|
...dataChangeOf(sectionText(x, x.sectionShard(proposal, DATA_CHANGE_SECTION)))
|
|
1337
1480
|
},
|
|
1338
1481
|
...delta ? { delta: proposal.replace(/proposal\.md$/, "delta.md") } : {},
|
|
1339
|
-
objects: work.objects.map(
|
|
1482
|
+
objects: work.objects.map(
|
|
1483
|
+
(key) => objectBrief(x, key, entries.get(key), lost.get(key), laterChanges(x, change.id, key))
|
|
1484
|
+
)
|
|
1340
1485
|
};
|
|
1341
1486
|
const added = work.objects.flatMap((key) => {
|
|
1342
1487
|
const e = entries.get(key);
|
|
@@ -1403,6 +1548,13 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1403
1548
|
};
|
|
1404
1549
|
ctx.rules = carried("rule");
|
|
1405
1550
|
ctx.events = carried("event");
|
|
1551
|
+
const whole = (kind) => {
|
|
1552
|
+
const bearing2 = idsIn(written.join("\n"), [kind]);
|
|
1553
|
+
const own = work.objects.filter((k) => idKind(k) === kind);
|
|
1554
|
+
return [.../* @__PURE__ */ new Set([...own, ...bearing2])].flatMap((id) => piece(id, true));
|
|
1555
|
+
};
|
|
1556
|
+
ctx.nfr = whole("nfr");
|
|
1557
|
+
ctx.integrations = whole("integration");
|
|
1406
1558
|
ctx.entities = [
|
|
1407
1559
|
.../* @__PURE__ */ new Set([
|
|
1408
1560
|
...work.objects.filter((k) => idKind(k) === "entity"),
|
|
@@ -1412,7 +1564,16 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1412
1564
|
const file = x.fileOf(id);
|
|
1413
1565
|
if (!file || !x.has(file)) return [];
|
|
1414
1566
|
const title = titleOf(x, id);
|
|
1415
|
-
|
|
1567
|
+
const note = lifecycleOf(x, id);
|
|
1568
|
+
return [
|
|
1569
|
+
{
|
|
1570
|
+
id,
|
|
1571
|
+
path: file,
|
|
1572
|
+
...title ? { title } : {},
|
|
1573
|
+
...changed.has(id) ? { changed: true } : {},
|
|
1574
|
+
...note ? { note } : {}
|
|
1575
|
+
}
|
|
1576
|
+
];
|
|
1416
1577
|
});
|
|
1417
1578
|
ctx.operations = x.has(OPERATIONS_FILE) ? capabilities.flatMap((id) => {
|
|
1418
1579
|
const path = x.shards(OPERATIONS_FILE).find((p) => new RegExp(`/\\d{2}-${slug(id)}(-|\\.md$)`).test(p));
|
|
@@ -1442,6 +1603,18 @@ function taskContext(x, task, exportDir2, state = {}, questions) {
|
|
|
1442
1603
|
const bearing = idsIn(written.join("\n"), ["decision"]);
|
|
1443
1604
|
const named2 = idsIn(work.objects.map((k) => entries.get(k)?.after ?? "").join("\n"), ["decision"]);
|
|
1444
1605
|
ctx.decisions = [.../* @__PURE__ */ new Set([...bearing, ...named2])].flatMap((id) => piece(id, bearing.includes(id)));
|
|
1606
|
+
const rules = [
|
|
1607
|
+
.../* @__PURE__ */ new Set([
|
|
1608
|
+
...work.objects.filter((k) => idKind(k) === "rule"),
|
|
1609
|
+
...(ctx.rules ?? []).filter((r) => r.text).map((r) => r.id)
|
|
1610
|
+
])
|
|
1611
|
+
];
|
|
1612
|
+
const roles = work.objects.filter((k) => idKind(k) === "role");
|
|
1613
|
+
ctx.reach = [
|
|
1614
|
+
...rules.map((id) => reachOf(x, id, "rule", changed)),
|
|
1615
|
+
...roles.map((id) => reachOf(x, id, "role", changed))
|
|
1616
|
+
].filter((r) => !!r);
|
|
1617
|
+
if (!ctx.reach.length) delete ctx.reach;
|
|
1445
1618
|
const glossary = x.fileOf("term:");
|
|
1446
1619
|
const writtenText = written.join("\n");
|
|
1447
1620
|
ctx.terms = (glossary && x.has(glossary) ? x.shards(glossary) : []).filter((path) => !/\/\d{2}-[^/]*$/.test(path)).flatMap((path) => {
|
|
@@ -1509,6 +1682,13 @@ function renderContext(c) {
|
|
|
1509
1682
|
const status = o.status && o.status.before !== o.status.after ? `, ${o.status.before ?? "\u2014"} \u2192 ${o.status.after ?? "\u2014"}` : "";
|
|
1510
1683
|
out.push(`### ${o.key}`, "", `${o.change ?? "no delta entry"}${status}; ${where}.`);
|
|
1511
1684
|
if (o.unrecoverable) out.push("", `The delta could not recover it: ${o.unrecoverable}.`);
|
|
1685
|
+
if (o.since) {
|
|
1686
|
+
const later = o.since.changes.length ? `Changed since this sign-off by ${o.since.changes.join(", ")} (later in the change map; their deltas are next to their proposals). ` : "";
|
|
1687
|
+
out.push(
|
|
1688
|
+
"",
|
|
1689
|
+
o.since.differs ? `${later}The current text differs from this delta\u2019s after: build to the current file, the checklist follows the current text.` : `${later}The current text still equals this delta\u2019s after.`
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1512
1692
|
if (o.diff) out.push("", o.diff.startsWith("@@") ? fence(o.diff, "diff") : o.diff);
|
|
1513
1693
|
out.push("");
|
|
1514
1694
|
}
|
|
@@ -1538,6 +1718,33 @@ function renderContext(c) {
|
|
|
1538
1718
|
}
|
|
1539
1719
|
out.push("");
|
|
1540
1720
|
}
|
|
1721
|
+
if (c.reach?.length) {
|
|
1722
|
+
out.push(
|
|
1723
|
+
"## Reach",
|
|
1724
|
+
"",
|
|
1725
|
+
"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.",
|
|
1726
|
+
""
|
|
1727
|
+
);
|
|
1728
|
+
const list2 = (ps) => ps.map((p) => `${p.id}${p.scope ? ` (${p.scope})` : ""}${p.changed ? " (this task changes it)" : ""}`).join(", ");
|
|
1729
|
+
for (const r of c.reach) {
|
|
1730
|
+
const name = `${r.id}${r.title ? ` ${r.title}` : ""}`;
|
|
1731
|
+
if (r.kind === "rule") {
|
|
1732
|
+
const parts = [
|
|
1733
|
+
r.capabilities.length ? `enforced by ${list2(r.capabilities)}` : "no capability lists it",
|
|
1734
|
+
r.criteria?.length ? `covered by ${r.criteria.join(", ")}` : "no criterion covers it",
|
|
1735
|
+
r.screens.length ? `on ${list2(r.screens)}` : "on no screen"
|
|
1736
|
+
];
|
|
1737
|
+
out.push(`- ${name}: ${parts.join("; ")}.`);
|
|
1738
|
+
} else {
|
|
1739
|
+
const parts = [
|
|
1740
|
+
r.capabilities.length ? `may perform ${list2(r.capabilities)}` : "may perform no capability",
|
|
1741
|
+
r.screens.length ? `on ${list2(r.screens)}` : "on no screen"
|
|
1742
|
+
];
|
|
1743
|
+
out.push(`- ${name}: ${parts.join("; ")}.`);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
out.push("");
|
|
1747
|
+
}
|
|
1541
1748
|
const pieces = (title, list2, intro) => {
|
|
1542
1749
|
if (!list2?.length) return;
|
|
1543
1750
|
out.push(`## ${title}`, "");
|
|
@@ -1552,7 +1759,7 @@ function renderContext(c) {
|
|
|
1552
1759
|
);
|
|
1553
1760
|
for (const p of list2.filter((p2) => !p2.text))
|
|
1554
1761
|
out.push(
|
|
1555
|
-
`- ${p.id}${p.title ? ` ${p.title}` : ""}: \`${p.path}\`${p.changed ? " (this task changes it: its delta is above)" : ""}`
|
|
1762
|
+
`- ${p.id}${p.title ? ` ${p.title}` : ""}: \`${p.path}\`${p.changed ? " (this task changes it: its delta is above)" : ""}${p.note ? `; ${p.note}` : ""}`
|
|
1556
1763
|
);
|
|
1557
1764
|
out.push("");
|
|
1558
1765
|
};
|
|
@@ -1574,7 +1781,17 @@ function renderContext(c) {
|
|
|
1574
1781
|
pieces(
|
|
1575
1782
|
"Entities",
|
|
1576
1783
|
c.entities,
|
|
1577
|
-
"The entities the task\u2019s capabilities work with; open one for its attributes
|
|
1784
|
+
"The entities the task\u2019s capabilities work with, each with its lifecycle; open one for its attributes."
|
|
1785
|
+
);
|
|
1786
|
+
pieces(
|
|
1787
|
+
"Quality requirements",
|
|
1788
|
+
c.nfr,
|
|
1789
|
+
"The quality requirements the task touches or the change\u2019s text names, whole (one the task adds is whole in its delta above)."
|
|
1790
|
+
);
|
|
1791
|
+
pieces(
|
|
1792
|
+
"Integrations",
|
|
1793
|
+
c.integrations,
|
|
1794
|
+
"The integrations the task touches or the change\u2019s text names, whole (one the task adds is whole in its delta above)."
|
|
1578
1795
|
);
|
|
1579
1796
|
pieces("Operations for other systems", c.operations);
|
|
1580
1797
|
pieces(
|