@alterset/alterspec-client 0.24.0 → 0.26.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/assets/prompts/_shared.md +31 -4
- package/assets/prompts/task-context.md +34 -13
- package/assets/prompts/task-next.md +2 -1
- package/developer-guide.md +15 -1
- package/dist/cli.js +50 -7
- package/dist/cli.js.map +1 -1
- package/dist/work.d.ts +139 -17
- package/dist/work.js +19 -7
- package/dist/work.js.map +1 -1
- package/dist/work.schema.json +258 -0
- package/package.json +1 -1
|
@@ -32,6 +32,23 @@ dispatcher's pages.
|
|
|
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
34
|
this task, and never ask a question of this task about a sentence a later change wrote.
|
|
35
|
+
- **A claim about the code is checked, never trusted.** Three things in a brief say what the code already does: an
|
|
36
|
+
item marked `w 0, nothing to build on this track`, a task summary that opens with "Nothing to build" (a weight
|
|
37
|
+
reasoned "as built"), and the "Built already" section. None of them was read from the code: the first two are the
|
|
38
|
+
sign-off's judgement, the third is computed from dates (the asking task was done after the answer). On one
|
|
39
|
+
product they were wrong, in both directions, on fifteen tasks of sixty-four. So before you skip or cover such an
|
|
40
|
+
item, read the code against the item's text and write or run its test. When the code has the behaviour, the
|
|
41
|
+
test stays and the item is covered like any other (a `w 0` item is never named in `Alterspec-Covers`, it
|
|
42
|
+
carries no weight, but its test still proves it). When the code lacks it and the item is your track's, build it,
|
|
43
|
+
say in the commit's body that the brief called it built, and put one line in `unclear`. A `w 0` item whose text
|
|
44
|
+
names only another channel is that track's behaviour: read it and build nothing. When you can't tell which it
|
|
45
|
+
is, ask with `/alterspec-spec-ask`.
|
|
46
|
+
- **News is read at the boundaries, never in the middle of an item.** Answers to your questions, the later changes
|
|
47
|
+
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
|
|
49
|
+
points you build: don't re-read the brief or the export to see whether something moved, and don't call `whoami`
|
|
50
|
+
for it. What `followed_by` and `overlaps` name is said once, at the start, and left. A corrected assumption found
|
|
51
|
+
at a boundary is rework before the next item.
|
|
35
52
|
- **The CLI does the deterministic work**: which commit to send, the task's brief and checklist, the items its commits cover, the commit that brought it in. Never work these out yourself.
|
|
36
53
|
- **Feedback is how the spec gets better, and it never restates a question.** Once per task, when its checklist
|
|
37
54
|
is covered, call `feedback` with three short lists. What you asked is on the task already, with its answer: the
|
|
@@ -39,13 +56,23 @@ dispatcher's pages.
|
|
|
39
56
|
hand.
|
|
40
57
|
- `unclear`: what in the spec cost you work and was **not** a question, each line naming the spec IDs it is
|
|
41
58
|
about (a sentence that took three readings, a term used for two things, a fact that sat far from where it was
|
|
42
|
-
needed
|
|
43
|
-
every difficulty was asked sends an empty
|
|
59
|
+
needed, a brief that called built what the code didn't hold). Never a question that was asked:
|
|
60
|
+
no `Q-<n>` on these lines and no question said again. A task whose every difficulty was asked sends an empty
|
|
61
|
+
`unclear`.
|
|
44
62
|
- `decided`: one line per assumption you built on, and the line is its `Q-<n>` and nothing more: no object ID
|
|
45
|
-
and no retelling, so the line closes with its question.
|
|
46
|
-
it now, before the feedback, and send the number you get.
|
|
63
|
+
and no retelling, so the line closes with its question. Never prose: a decision without a `Q-<n>` was taken
|
|
64
|
+
silently; ask it now, before the feedback, and send the number you get.
|
|
47
65
|
- `opened`: what you had to read beyond the brief, and why, naming the IDs. It is read by whoever builds the
|
|
48
66
|
brief, as a count of how often each ID was opened, not by the product side: name the object, not a complaint.
|
|
67
|
+
Never a finding (what you found goes to `unclear`), never a file the brief itself gave you.
|
|
68
|
+
|
|
69
|
+
Three lines as they should read:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
unclear: RULE-NTF-007, CAP-NTF-001-AC-04, CAP-NTF-001-AC-17: the 60th day falls on a different side in each.
|
|
73
|
+
opened: _generated/rule-matrix.md, the row of RULE-058: which capabilities trigger it; the brief gave the rule, not its reach.
|
|
74
|
+
decided: Q-198
|
|
75
|
+
```
|
|
49
76
|
|
|
50
77
|
No code and no copied spec text; empty lists are fine, an invented complaint is not. Skip it when the dispatcher
|
|
51
78
|
has no `feedback` tool.
|
|
@@ -7,15 +7,20 @@ there are several, the one whose branch this checkout is on (`git branch --show-
|
|
|
7
7
|
or whose `Alterspec-Task` trailer the last commit carries; when that doesn't settle it, ask which.
|
|
8
8
|
|
|
9
9
|
1. Start as `_shared.md` says (`whoami`, `export-head`).
|
|
10
|
-
2. Run `alterspec-client context <task>` and read the brief. When
|
|
10
|
+
2. Run `alterspec-client context <task>` and read the brief. When the change belongs to an initiative, the brief
|
|
11
|
+
opens with it ("Initiative: …"): the whole the change is part of, the idea and the problem it solves. Read it to
|
|
12
|
+
understand why the work exists and to name things the way the whole does; it adds nothing to build, and its other
|
|
13
|
+
changes are their own tasks. When it says "Start from `task/…`", a done predecessor
|
|
11
14
|
of this track is pushed there and not in the main branch yet: the task's work is based on that branch, not on
|
|
12
15
|
main (the developer fetches it and bases their branch on `origin/<branch>`); say so in one line before any commit.
|
|
13
16
|
When the change has questions it opens with them, on
|
|
14
17
|
every track (each names the task it was asked on): say in one line each one the product side answered since, and
|
|
15
18
|
take up a corrected assumption first. When the dispatcher says this change carries answers this track built
|
|
16
|
-
already ("Built already"), the
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
already ("Built already"), the mark comes from dates (the asking task was done after the answer), not from the
|
|
20
|
+
code: read each checklist item against the code first; where the code says what the spec now says, add the test
|
|
21
|
+
that is missing and cover the item as it passes; where it doesn't, build it, whatever the mark said, and say so
|
|
22
|
+
in the commit's body (`_shared.md`, "A claim about the code is checked"). The same reading settles the answers
|
|
23
|
+
the brief marks as not built here: the code may hold them already. Then the task's checklist: its items, what
|
|
19
24
|
each is and which the dispatcher holds covered already; that is the work, and its progress. Then why the change
|
|
20
25
|
was made, what changed, the one-time data change when the proposal declares one (what the release does once to the
|
|
21
26
|
records the product already holds; on the backend it is the `CHG-NNN#data-change` item), the delta of each of the
|
|
@@ -45,27 +50,43 @@ or whose `Alterspec-Task` trailer the last commit carries; when that doesn't set
|
|
|
45
50
|
3. Call `touch` with the task, then `task` with it. `followed_by` lists the later tasks on this track whose objects
|
|
46
51
|
overlap this one's; say them in one line, e.g. "CHG-015/BE, after yours, changes some of the same objects; it will
|
|
47
52
|
be its own task." Build what this change says, not what later ones do.
|
|
48
|
-
4.
|
|
53
|
+
4. **The question pass, before any code.** Walk the checklist and, for each item, name what you would have to
|
|
54
|
+
decide that the brief doesn't state: the edge of each input (empty, the last one, a record gone meanwhile),
|
|
55
|
+
which refusal wins when two apply, a default, an order, a limit, what happens to records that already exist, the
|
|
56
|
+
wording of a text. Group them by matter (the same rule, entity or moment) and ask each matter once with
|
|
57
|
+
`/alterspec-spec-ask`, its cases as numbered parts, with `--task` and `--item`. Then plan the work with the
|
|
58
|
+
answers: an `open` matter's items go last, an `assumed` one is built on its assumption. A question that surfaces
|
|
59
|
+
while building is still asked before the commit that stands on it (step 7), but there should be few: the pass is
|
|
60
|
+
where the product side gets your questions in one batch, while they are cheap to answer, and where you stop
|
|
61
|
+
being interrupted by their answers.
|
|
62
|
+
5. Work from the brief. Open a file the brief names only when you need it, at the path the brief gives (an
|
|
49
63
|
absolute one is the pinned copy of an object changed since), and its shards (one per section
|
|
50
64
|
or item, under `_shards/`) rather than the whole file when one section is enough. Never read the export
|
|
51
65
|
wholesale. An object "not in the export now" was removed or isn't signed off: build nothing for it, and say so.
|
|
52
|
-
|
|
66
|
+
Between the start and a commit, read nothing to see whether something moved: news is read at the boundaries
|
|
67
|
+
(`_shared.md`).
|
|
68
|
+
6. Build it here, in this repository's own technology and conventions. The spec says what the product does; how is
|
|
53
69
|
the developer's. A mockup page is the agreed look and behaviour of a screen, a working example to follow, not code
|
|
54
70
|
to copy. When the spec is silent, ambiguous or says two things, ask with `/alterspec-spec-ask` as
|
|
55
71
|
`_shared.md` says and go on with what its answer allows; when the spec and the code disagree, tell the developer.
|
|
56
72
|
Never fill a gap with an invented business rule.
|
|
57
|
-
|
|
58
|
-
product's behaviour that the brief didn't state. Each one has a `Q-<n>` from `/alterspec-spec-ask
|
|
59
|
-
now, before the commit, as `_shared.md` says; the commit's body names the `Q-<n>`
|
|
60
|
-
|
|
73
|
+
7. Before each commit of the task, look at what you built for it and name to yourself every choice about the
|
|
74
|
+
product's behaviour that the brief didn't state. Each one has a `Q-<n>` from `/alterspec-spec-ask` (most from the
|
|
75
|
+
pass of step 4), or you ask it now, before the commit, as `_shared.md` says; the commit's body names the `Q-<n>`
|
|
76
|
+
it stands on.
|
|
77
|
+
8. Work through the checklist, the heavy items first (their weight `w`, when the brief shows one, is how much
|
|
61
78
|
behaviour each is; it is the sign-off's, never yours to set or send). An item marked `w 0, nothing to build on this track` is
|
|
62
|
-
another track's behaviour that your track only reads
|
|
63
|
-
|
|
79
|
+
one of two things, and the brief doesn't say which: another track's behaviour that your track only reads (its
|
|
80
|
+
text names only another channel: read it, build nothing), or behaviour the sign-off holds this track to have
|
|
81
|
+
already (as built). Read the code against the item either way, as `_shared.md` says: when it has the behaviour,
|
|
82
|
+
its test stays; when it lacks it and the item is yours, build it and say in the commit's body that the weight
|
|
83
|
+
called it built. Never name a `w 0` item in `Alterspec-Covers`; when you can't tell whose the item is, ask with
|
|
84
|
+
`/alterspec-spec-ask`. A criterion item is your track's part of
|
|
64
85
|
it (`Then` on the backend, `Shown` on a UI track); leave the part the brief gives to another task. A contract state item comes with its mockup link
|
|
65
86
|
(`…/SCR-….html?state=<state>`): open that page in that state to see what you build (sign in as one of the
|
|
66
87
|
screen's roles on the channel's `index.html` first; the session stays). For each item, make its
|
|
67
88
|
tests pass, then commit with the trailers of `_shared.md`: `Alterspec-Task: <task>` always, `Alterspec-Covers`
|
|
68
89
|
with the items whose tests pass on that commit. The hook reports them. When the work is merged into the main
|
|
69
90
|
branch, the developer types `/alterspec-task-done <task>`; never report it done yourself.
|
|
70
|
-
|
|
91
|
+
9. When every checklist item is covered, send your `feedback` once, as `_shared.md` says, while you still remember
|
|
71
92
|
what the work cost (nothing you asked is said again: `decided` is the bare `Q-<n>` of each assumption); then tell the developer the task is ready for `/alterspec-task-done <task>` once it is merged.
|
|
@@ -26,7 +26,8 @@ CHG-052/BE", "take CHG-052/BE").
|
|
|
26
26
|
(`git fetch origin <branch>` first). A null `branch` means the main branch, as usual.
|
|
27
27
|
6. The tasks it assigned:
|
|
28
28
|
- **One**: continue with `.alterspec-client/prompts/task-context.md` for that task, here, on whatever branch the
|
|
29
|
-
developer is on (when it starts from a predecessor's branch, say so before any commit is made)
|
|
29
|
+
developer is on (when it starts from a predecessor's branch, say so before any commit is made), starting with
|
|
30
|
+
its question pass before any code.
|
|
30
31
|
- **Several**: list each task with its title and, when it has one, the branch it starts from, and say: type
|
|
31
32
|
`/alterspec-task-context <task>` where you want to work on it. Work on none of them in this session.
|
|
32
33
|
- **None**: say so, with the reasons. Stop.
|
package/developer-guide.md
CHANGED
|
@@ -32,6 +32,10 @@ You connect to it with the **alterspec client** (`@alterset/alterspec-client`, p
|
|
|
32
32
|
the product side at the sign-off (or taken from the spec's own titles). The brief opens with the title and the
|
|
33
33
|
summary and shows each item's label in bold before what the item is; the dispatcher's lists show the same words
|
|
34
34
|
with the ID beside them. They are for reading. Build from the brief's spec text, never from a label.
|
|
35
|
+
- A change may belong to an **initiative**: the whole it is part of, written by the product side as prose (the
|
|
36
|
+
idea, the problem it solves, what it covers). The brief opens with it, under "Initiative: …", and the dispatcher
|
|
37
|
+
groups changes and tasks by it. It says why the work exists; it is never work of its own, has no status and
|
|
38
|
+
orders nothing: the checklist is still the task.
|
|
35
39
|
- An acceptance criterion may have two outcomes: **Then**, what the system guarantees, and **Shown**, what the
|
|
36
40
|
person sees on the screen. The backend builds and tests the Then, a UI track the Shown, and each task's checklist
|
|
37
41
|
holds the criterion only for its own part; the brief shows you yours and says when the other part is another
|
|
@@ -214,9 +218,16 @@ server. Then talk to it in plain words; the skills do the rest.
|
|
|
214
218
|
|
|
215
219
|
1. "Give me work." Claude takes a task and shows the brief and its checklist. Work on it in the branch (or worktree) you
|
|
216
220
|
choose, made the way you make them: the client creates no branch, no worktree and no commit in your repository.
|
|
221
|
+
Before any code, Claude walks the checklist and asks the product side every question it can see, one per
|
|
222
|
+
matter, in one batch through `/alterspec-spec-ask`; the answers usually arrive while it plans, and the rest of
|
|
223
|
+
the task runs without waiting for anyone.
|
|
217
224
|
2. Build it with Claude in your own technology. The spec says what, never how; a mockup shows the agreed look and
|
|
218
225
|
behaviour, it is not code to copy. When the spec is silent or says two things, Claude asks through `/alterspec-spec-ask` and
|
|
219
|
-
goes on with what the answer allows; when the spec and the code disagree, Claude asks you.
|
|
226
|
+
goes on with what the answer allows; when the spec and the code disagree, Claude asks you. A brief's "Built
|
|
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
|
+
or from dates: Claude reads the code against the item before it skips or covers it, and builds what the code
|
|
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`.
|
|
220
231
|
3. Claude ends every commit of the task with a trailer:
|
|
221
232
|
|
|
222
233
|
```
|
|
@@ -365,6 +376,9 @@ when one of yours was fixed since you last looked.
|
|
|
365
376
|
- **Only you move your task on.** Going away for a while? Release it. An admin can force a release only when you are
|
|
366
377
|
gone, and that is logged.
|
|
367
378
|
- **Keep the client current.** Run `init` again now and then (or when your admin says so); it updates the skills.
|
|
379
|
+
- **One task at a time, in order, on `task/<chg>-<track>`.** Taking several at once or out of order is allowed, but
|
|
380
|
+
the dispatcher then warns of shared objects, and the warnings are usually right. The branch name the client
|
|
381
|
+
recognises by itself spares you the trailer when a commit forgets it.
|
|
368
382
|
- **Tell Claude about the spec outside the skills too.** The skills explain the export only while they run. Copy the
|
|
369
383
|
block in [`agent-instructions.md`](agent-instructions.md) (in this package) into your `CLAUDE.md` or wherever you
|
|
370
384
|
keep your agent's instructions, with your export clone's path.
|
package/dist/cli.js
CHANGED
|
@@ -23,6 +23,7 @@ var WorkSummary = words(WORD_CAPS.summary);
|
|
|
23
23
|
var WorkLabel = words(WORD_CAPS.label);
|
|
24
24
|
var WorkName = words(WORD_CAPS.name);
|
|
25
25
|
var ChangeRef = z.string().regex(/^CHG-\d{3,}$/);
|
|
26
|
+
var InitiativeRef = z.string().regex(/^INI-[A-Z0-9]+(?:-[A-Z0-9]+)*$/);
|
|
26
27
|
var Day = z.iso.date();
|
|
27
28
|
var WorkTrackSchema = z.object({
|
|
28
29
|
code: TrackCode,
|
|
@@ -87,9 +88,12 @@ var WorkChangeSchema = z.object({
|
|
|
87
88
|
/** The change map's level. */
|
|
88
89
|
level: z.number().int().min(1),
|
|
89
90
|
/** One per track the change is on; empty = no work. */
|
|
90
|
-
tasks: z.array(WorkTaskSchema)
|
|
91
|
+
tasks: z.array(WorkTaskSchema),
|
|
92
|
+
/** The initiative the change belongs to (format 8): its entry in `initiatives`. Absent: none. */
|
|
93
|
+
initiative: InitiativeRef.optional()
|
|
91
94
|
}).strict();
|
|
92
|
-
var
|
|
95
|
+
var WorkInitiativeSchema = z.object({ id: InitiativeRef, title: z.string().min(1) }).strict();
|
|
96
|
+
var WORK_FORMAT = 8;
|
|
93
97
|
var WorkSchema = z.object({
|
|
94
98
|
format: z.literal(WORK_FORMAT),
|
|
95
99
|
/** The alterspec version that wrote the export. */
|
|
@@ -104,14 +108,18 @@ var WorkSchema = z.object({
|
|
|
104
108
|
* The title of every object a task's `objects` names, by key, as the spec holds it now (format 5); an object
|
|
105
109
|
* the spec no longer holds, and a file, has no entry. Absent when no object has one.
|
|
106
110
|
*/
|
|
107
|
-
names: z.record(z.string().min(1), WorkName).optional()
|
|
111
|
+
names: z.record(z.string().min(1), WorkName).optional(),
|
|
112
|
+
/** The initiatives the changes name, by ID (format 8). Absent when no change names one. */
|
|
113
|
+
initiatives: z.array(WorkInitiativeSchema).optional()
|
|
108
114
|
}).strict();
|
|
115
|
+
var WorkChangeV7Schema = WorkChangeSchema.omit({ initiative: true }).strict();
|
|
116
|
+
var WorkV7Schema = WorkSchema.omit({ initiatives: true }).extend({ format: z.literal(7), changes: z.array(WorkChangeV7Schema) }).strict();
|
|
109
117
|
var WorkTaskV6Schema = WorkTaskSchema.omit({ weight: true }).strict();
|
|
110
|
-
var WorkChangeV6Schema =
|
|
118
|
+
var WorkChangeV6Schema = WorkChangeV7Schema.extend({
|
|
111
119
|
tasks: z.array(WorkTaskV6Schema),
|
|
112
120
|
weight: WorkWeight.optional()
|
|
113
121
|
}).strict();
|
|
114
|
-
var WorkV6Schema =
|
|
122
|
+
var WorkV6Schema = WorkV7Schema.extend({
|
|
115
123
|
format: z.literal(6),
|
|
116
124
|
changes: z.array(WorkChangeV6Schema)
|
|
117
125
|
}).strict();
|
|
@@ -119,7 +127,7 @@ var WorkTaskV5Schema = WorkTaskV6Schema.extend({
|
|
|
119
127
|
weights: z.record(z.string().min(1), WorkWeight).optional()
|
|
120
128
|
}).strict();
|
|
121
129
|
var WorkChangeV5Schema = WorkChangeV6Schema.extend({ tasks: z.array(WorkTaskV5Schema) }).strict();
|
|
122
|
-
var WorkV5Schema =
|
|
130
|
+
var WorkV5Schema = WorkV7Schema.extend({
|
|
123
131
|
format: z.literal(5),
|
|
124
132
|
changes: z.array(WorkChangeV5Schema)
|
|
125
133
|
}).strict();
|
|
@@ -148,6 +156,7 @@ var AnyWorkSchema = z.discriminatedUnion("format", [
|
|
|
148
156
|
WorkV4Schema,
|
|
149
157
|
WorkV5Schema,
|
|
150
158
|
WorkV6Schema,
|
|
159
|
+
WorkV7Schema,
|
|
151
160
|
WorkSchema
|
|
152
161
|
]);
|
|
153
162
|
|
|
@@ -469,6 +478,11 @@ var DecisionId = idOf("decision", "decision");
|
|
|
469
478
|
var ChangeId = idOf("change", "change");
|
|
470
479
|
var AcceptanceId = idOf("acceptance", "acceptance criterion");
|
|
471
480
|
var ScreenActionId = idOf("screenAction", "screen action");
|
|
481
|
+
var INITIATIVE_ID = `INI-${NAME}`;
|
|
482
|
+
var INITIATIVE_REGEX = new RegExp(`^${INITIATIVE_ID}$`);
|
|
483
|
+
var InitiativeId = z3.string().regex(INITIATIVE_REGEX, {
|
|
484
|
+
message: `must be an initiative ID matching ^${INITIATIVE_ID}$, e.g. INI-ONBOARDING`
|
|
485
|
+
});
|
|
472
486
|
var ChannelCode = z3.string().regex(new RegExp(`^${CHANNEL_CODE}$`), { message: "must be 2\u20135 uppercase letters, e.g. WEB or MOB" });
|
|
473
487
|
var AnyId = z3.string().refine(
|
|
474
488
|
(v) => Object.keys(ID_REGEX).some((k) => k !== "screenAction" && ID_REGEX[k].test(v)),
|
|
@@ -597,6 +611,12 @@ var ChangeSchema = z5.object({
|
|
|
597
611
|
* (draft → final). Written by the CLI at sign-off.
|
|
598
612
|
*/
|
|
599
613
|
drafted_as: z5.record(z5.string(), z5.string()).optional(),
|
|
614
|
+
/**
|
|
615
|
+
* The initiative the change belongs to, if any: the envelope (`spec/initiatives/<INI>.md`) that says why it
|
|
616
|
+
* exists. Grouping only: no status, no gate, outside the delta and every fingerprint. Written by
|
|
617
|
+
* `change new --initiative` and `change initiative`, on an archived proposal too.
|
|
618
|
+
*/
|
|
619
|
+
initiative: InitiativeId.optional(),
|
|
600
620
|
/** The first 16 hex of the sha256 of the change's `delta.json`, written with it at sign-off, never rewritten. */
|
|
601
621
|
delta: z5.string().regex(/^[0-9a-f]{16}$/).optional(),
|
|
602
622
|
/**
|
|
@@ -785,11 +805,13 @@ var ROOT_DOCS = {
|
|
|
785
805
|
var APPLICATION = ROOT_DOCS.application;
|
|
786
806
|
var MODULES_DIR = "modules";
|
|
787
807
|
var CHANGES_DIR = "changes";
|
|
808
|
+
var INITIATIVES_DIR = "initiatives";
|
|
788
809
|
var moduleDir = (code) => `${MODULES_DIR}/${code.replace(/^MOD-/, "").toLowerCase()}`;
|
|
789
810
|
var moduleDirOf = (id) => {
|
|
790
811
|
const code = codeInId(id);
|
|
791
812
|
return code ? moduleDir(code) : void 0;
|
|
792
813
|
};
|
|
814
|
+
var initiativePath = (id) => `${INITIATIVES_DIR}/${id}.md`;
|
|
793
815
|
var screenDir = (screenId) => `${moduleDirOf(screenId)}/screens/${screenId}`;
|
|
794
816
|
var contractPath = (screenId, code) => `${screenDir(screenId)}/experience/${code.toLowerCase()}.md`;
|
|
795
817
|
var EXPERIENCE_DIR = "experience";
|
|
@@ -876,7 +898,14 @@ function readExport(dir) {
|
|
|
876
898
|
const path = itemShardPath(file, key);
|
|
877
899
|
return has(path) ? path : void 0;
|
|
878
900
|
},
|
|
879
|
-
index
|
|
901
|
+
index,
|
|
902
|
+
initiative(id) {
|
|
903
|
+
const work = parsed.data;
|
|
904
|
+
const title = "initiatives" in work ? work.initiatives?.find((i) => i.id === id)?.title : void 0;
|
|
905
|
+
const text = read(initiativePath(id));
|
|
906
|
+
if (!title || text === void 0) return void 0;
|
|
907
|
+
return { id, title, body: splitFrontMatter(text).body };
|
|
908
|
+
}
|
|
880
909
|
};
|
|
881
910
|
}
|
|
882
911
|
function idsIn(text, kinds) {
|
|
@@ -1802,8 +1831,11 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1802
1831
|
const items = work.items;
|
|
1803
1832
|
const weights = work.weights;
|
|
1804
1833
|
const words2 = work;
|
|
1834
|
+
const initiativeId = change.initiative;
|
|
1835
|
+
const initiative = initiativeId ? x.initiative(initiativeId) : void 0;
|
|
1805
1836
|
const ctx = {
|
|
1806
1837
|
task: task.id,
|
|
1838
|
+
...initiative ? { initiative: { ...initiative, path: initiativePath(initiative.id) } } : {},
|
|
1807
1839
|
...words2.title ? { title: words2.title } : {},
|
|
1808
1840
|
...words2.summary ? { summary: words2.summary } : {},
|
|
1809
1841
|
...words2.weight === void 0 ? {} : { weight: words2.weight },
|
|
@@ -2067,6 +2099,16 @@ var fence = (text, lang = "") => {
|
|
|
2067
2099
|
${text}
|
|
2068
2100
|
${ticks}`;
|
|
2069
2101
|
};
|
|
2102
|
+
function initiativeSection(i) {
|
|
2103
|
+
const prose = i.body.replace(/<!--[^]*?-->/g, "").replace(/^\s*# .*\n/, "").replace(/^(#{2,5}) /gm, "#$1 ").replace(/\n{3,}/g, "\n\n").trim();
|
|
2104
|
+
return [
|
|
2105
|
+
`## Initiative: ${i.title}`,
|
|
2106
|
+
"",
|
|
2107
|
+
`The whole this change is part of (\`${i.path}\`): why the work exists. It adds nothing to build beyond the checklist.`,
|
|
2108
|
+
"",
|
|
2109
|
+
...prose ? [prose, ""] : []
|
|
2110
|
+
];
|
|
2111
|
+
}
|
|
2070
2112
|
function renderContext(c) {
|
|
2071
2113
|
const out = [
|
|
2072
2114
|
`# ${c.task}: ${c.title ?? c.change.title}`,
|
|
@@ -2074,6 +2116,7 @@ function renderContext(c) {
|
|
|
2074
2116
|
// The words the lists show for the task: what a person calls it, never what to build from.
|
|
2075
2117
|
...c.summary ? [c.summary, ""] : [],
|
|
2076
2118
|
...c.title ? [`Change: ${c.change.title}.`, ""] : [],
|
|
2119
|
+
...c.initiative ? initiativeSection(c.initiative) : [],
|
|
2077
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}.`
|
|
2078
2121
|
];
|
|
2079
2122
|
const movedSince = (c.changedSince ?? []).filter((e) => !e.entered);
|