gcf-aif-ext 0.16.1 → 0.18.4
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 +31 -8
- package/commands/gcf.js +205 -30
- package/extension.json +1 -1
- package/hooks/pre-commit.js +4 -2
- package/lib/agent-permissions.js +2 -2
- package/lib/audit-core.js +11 -5
- package/lib/board.js +40 -8
- package/lib/bundle.js +58 -13
- package/lib/config-set.js +2 -2
- package/lib/design-check.js +37 -9
- package/lib/design-parts.js +787 -0
- package/lib/design.js +2 -0
- package/lib/domain.js +372 -36
- package/lib/git.js +13 -6
- package/lib/id.js +47 -0
- package/lib/inbox-categories.js +228 -0
- package/lib/inbox.js +238 -86
- package/lib/lessons.js +11 -3
- package/lib/migrate.js +3 -3
- package/lib/unit-ops.js +6 -2
- package/lib/work-ops.js +41 -9
- package/package.json +1 -1
- package/profiles/game.md +2 -2
- package/profiles/pillars.md +3 -3
- package/skills/gcf-adopt/SKILL.md +1 -1
- package/skills/gcf-card/SKILL.md +2 -2
- package/skills/gcf-chat/SKILL.md +5 -5
- package/skills/gcf-debate/SKILL.md +2 -2
- package/skills/gcf-ingest/SKILL.md +5 -3
- package/skills/gcf-init/SKILL.md +13 -9
- package/skills/gcf-triage/SKILL.md +7 -7
- package/skills/gcf-vision/SKILL.md +8 -3
- package/templates/PILLARS.md +2 -0
- package/templates/agents-block.md +13 -6
package/README.md
CHANGED
|
@@ -50,13 +50,36 @@ Updating preserves `gcf/`, `cnlp.config.json` and the pre-commit hook. Run `ai-f
|
|
|
50
50
|
|
|
51
51
|
On Windows, run `extension add` and `extension update` from PowerShell or cmd, not Git Bash: the installer unpacks with `tar`, and Git Bash's GNU tar reads `C:\…` as a remote host (`Cannot connect to C: resolve failed`). The Windows `tar.exe` handles it.
|
|
52
52
|
|
|
53
|
+
### 0.18.4
|
|
54
|
+
|
|
55
|
+
- The `attach` move's field is of the new kind `file` (Board-PRD §5.4): gcf-board 0.16.3 picks it in the system's file dialog instead of a text box for a path. A board before 0.16.3 shows it as a text box, as before. The command itself is unchanged.
|
|
56
|
+
|
|
57
|
+
### 0.18.3
|
|
58
|
+
|
|
59
|
+
- The model and effort that hold when nothing is set are Opus / High (Board-PRD decision 36): the help of an item's model and effort, the settings `agent.model` / `agent.effort` and the AGENTS.md block say so. Run `ai-factory gcf init` after the update. Update together with gcf-harness-aif-ext 0.18.1 and gcf-board 0.16.0.
|
|
60
|
+
|
|
61
|
+
### 0.18.1
|
|
62
|
+
|
|
63
|
+
- The inbox groups in `gcf board --json` say their order (`order`: `rank` or `newest`) and which one holds Later (`holds_later`); each question carries `origin: agent` (the designer's round 6 gaps).
|
|
64
|
+
|
|
65
|
+
### 0.18.0
|
|
66
|
+
|
|
67
|
+
Update together with gcf-board 0.15.0 (`gcf board --json` is `schema: 4`; each refuses the other's old schema) and the gcf-harness-aif-ext released with it. Then run `ai-factory gcf init` (the AGENTS.md block learns the categories and `item new --title`) and, once, `ai-factory gcf inbox migrate`.
|
|
68
|
+
|
|
69
|
+
- **The inbox by categories** (Board-PRD decision 32). An entry's frontmatter is `category`, `detail`, `origin`, `later`, `item`, `at`; `source` and `tags` are gone. The category is one of a fixed vocabulary, the core's base and the domain's layer merged (`ai-factory gcf inbox categories [--json]` prints it with who may file each); the project's layer is reserved. `inbox add [--category <c>] [--detail <word>] [--origin you|agent|automation] [--item <id>]`: the operator's entry with no category is a `note`, an agent must name one; the origin defaults to who makes the move (an agent's run or session is `agent` and may claim no other). `inbox category <in-id> [--category] [--detail]` replaces `inbox tag`: the operator moves an entry to any category but `decision`, `assumption` and `unsorted`, an agent only to one it may file; the origin never changes. `inbox later <in-id> [--off]` puts an entry away to Later and back; `decision`, `failure` and `assumption` never go there. The domain's moves are `inbox-add`, `inbox-category`, `inbox-later`, `inbox-back`, `inbox-drop`; an agent may propose the first three and `inbox-drop`.
|
|
70
|
+
- `inbox migrate [--json]` writes the entries from before the categories in the new format, in one commit `gcf(inbox): N entries to categories`, and lists what did not fit: `playtest` stays, `ci` → `failure`, `agent` → `unsorted`, `operator` → `note`, a lesson → `lesson` with its kind as the detail and its `item`, the tag `later` → the flag, the first other tag → the detail, the rest dropped. A second run changes nothing. Until it runs, the core reads an old entry the way the migration would write it, and the audit names it (`inbox.unmigrated`), as it names an unknown category and every `unsorted` entry.
|
|
71
|
+
- Lessons are entries of the category `lesson`, their kind the detail. `gcf board --json`: `inbox[]` is `{id, category, detail, origin, later, item, at, title, text, attachments?}`; `inbox_repeats` lists each lesson kind met in 3 items or more, Later left out; each question carries `category` (`decision` for D1, `assumption` for D2); `domain.sections.inbox` carries `groups` and `categories`; an item's `lessons` counts only the category `lesson`.
|
|
72
|
+
- **Ids from titles** (Board-PRD decision 34). `item new [id] --title <text>`: without an id the core makes it from the title (Cyrillic transliterated, about four words and 32 characters, `-2`, `-3`… when the id was ever used, `<type>-<n>` when nothing is left) and prints `<id> gcf/work/<id>.md` first; `--from` gives the title too. `item new` always holds the main lock. `--dry-run` prints the id and writes nothing. `--parent` takes one live feature. `design save --kind unit --system <s> --type <t> --title <text>` with no name makes a new unit's id the same way and prints it first (domain move `design-new-unit`). A pillar has an optional `name`; a new pillar's id comes from it; a changed name renames the id after the save, in a second commit `gcf(pillar): rename <a> → <b>`.
|
|
73
|
+
- **Agent drafts in the design** (Board-PRD decision 35): the starts `draft-glossary`, `draft-system` (takes a subsystem) and `name-pillars`; the pillars interview starts from candidates when `PILLARS.md` is empty. A form save over an agent's unrecorded draft of the part's own file takes the draft into its commit. `design discard [file…]` (move `design-discard`) takes an unrecorded draft back: the vision, the glossary, the pillars and `design/` files as the last commit has them, a new file deleted.
|
|
74
|
+
- The model and effort pickers' help speaks of Default (`default`): the project's `agent.model|effort`, else Opus / High, the agent's default (Board-PRD decisions 33, 36).
|
|
75
|
+
|
|
53
76
|
### 0.16.1
|
|
54
77
|
|
|
55
78
|
Update together with gcf-harness-aif-ext 0.16.1 and gcf-board 0.12.1; run `ai-factory gcf init` after it (the AGENTS.md block learns the new proposals and `item mode`).
|
|
56
79
|
|
|
57
80
|
- An item's own run mode (Board-PRD decision 28): `ai-factory gcf item mode <id> --run main|worktree|default` sets `run_mode:` in its file over the project's `run_mode` (`default` takes it off); refused while a run drives the item; commit `gcf(item): <id> runs in <mode>`. `gcf board --json` carries `items[].run_mode` and the domain move `mode`.
|
|
58
81
|
- `gcf integrate` merges nothing while a harness main run works in the checkout (`.gcf-session/runs/.main-run.lock`): "a main run works in the main checkout (pid N): integrate after it ends". The branches wait; the harness merges them when that run ends.
|
|
59
|
-
- The project chat's agent proposes more moves (`propose: true` in `gcf board --json`): `block`, `drop`, `depends`, `inbox-add`, `inbox-
|
|
82
|
+
- The project chat's agent proposes more moves (`propose: true` in `gcf board --json`): `block`, `drop`, `depends`, `inbox-add`, `inbox-drop` beside `item-new` (with 0.18.0 also `inbox-category` and `inbox-later`). The board shows each as a card the operator makes with one click (Board-PRD decision 27); the gcf-chat skill calls the `propose_<move>` tool instead of running the command.
|
|
60
83
|
|
|
61
84
|
### 0.15.0
|
|
62
85
|
|
|
@@ -91,9 +114,9 @@ Update together with gcf-harness-aif-ext 0.12.0 and gcf-board 0.6.0 (docs/Sessio
|
|
|
91
114
|
|
|
92
115
|
### 0.11.1
|
|
93
116
|
|
|
94
|
-
- The inbox is one file an entry: `gcf/inbox/in-<8 hex>.md` with frontmatter
|
|
117
|
+
- The inbox is one file an entry: `gcf/inbox/in-<8 hex>.md` with frontmatter and the text as markdown of any number of lines; its first non-empty line is the title. Pictures go by hand into `gcf/inbox/in-<id>/attachments/`, linked from the text. `inbox add` takes the text one way: an argument, `--text=`, or `--text-file <path|->` (`-` reads stdin; use it for several lines: from cmd.exe the `.cmd` shim cuts an argument at a newline). `gcf inbox` and the board read list the entries sorted by `at`. `inbox drop` and `item new --from` refuse on a `work/` branch; `drop` deletes the entry with its pictures. `item new --from` without `--title` takes the entry's title and puts the rest, quoted (`> `), in a `note:` block (with another `--title` the whole text), and moves its pictures to `gcf/work/<id>/attachments/`. No `merge=union` any more: branches add different files, and `gcf integrate` merges an entry a `work/` branch added. The audit reports `inbox: {legacy, bad_names, untitled, broken_links, orphan_dirs}`. An old `gcf/inbox.md` is read by nothing: the audit and `gcf inbox` say so; move its lines with `inbox add` (or by hand) and delete it — there is no migration.
|
|
95
118
|
- `chat:` in `gcf/config.yml`: `ask` (`d1` by default, `all`, `none`: what a harness run's agent asks the operator by a question card) and `answer_timeout_min` (15; 0: nobody watches, the default answer goes at once). `gcf config set chat.ask --value=all` and `chat.answer_timeout_min` set them; `gcf board --json` carries `chat`, and a setting of kind `mode` its `options`. gcf-harness-aif-ext 0.11.1 reads them.
|
|
96
|
-
- `ai-factory gcf item agent <id> --model <m> --effort <e>` sets the model and effort of an item's runs (`default` takes one off: the
|
|
119
|
+
- `ai-factory gcf item agent <id> --model <m> --effort <e>` sets the model and effort of an item's runs (`default` takes one off: the project's setting holds, else Opus / High); refused while a run drives the item, committed `gcf(item)`; the item's next run takes them. The board offers it as the item move **model / effort**, and as **change** beside those fields.
|
|
97
120
|
- `ai-factory gcf item attach <id> --file <path>` gives an item a file (a chat picture, a reference): copied into `gcf/work/<id>/attachments/` under its own name (`-2`, `-3`… on a clash) and committed alone, `gcf(attach): <id>`, also while the item runs, as long as `gcf/` has no uncommitted changes (a main-mode session edits the item file, and the commit gate then refuses; a worktree run sees the file only in its next run). A link, a file over 10 MB and a `work/` branch are refused. The board offers it as the item move **attach**; the AGENTS.md block tells agents to read an item's attachments.
|
|
98
121
|
|
|
99
122
|
### 0.10.3
|
|
@@ -135,7 +158,7 @@ Update together with gcf-harness-aif-ext 0.12.0 and gcf-board 0.6.0 (docs/Sessio
|
|
|
135
158
|
|
|
136
159
|
### 0.7.10
|
|
137
160
|
|
|
138
|
-
- Lessons: what got in an agent's way, asked at the end of its session (Methodology §5.2.2). `gcf lessons prompt <id>` prints the questions: tools and their workarounds, project rules that are missing or conflict, trouble with GCF itself, and, with `lessons.template` in `gcf/config.yml`, what the project's template should learn; `lessons.questions` adds the operator's own, `lessons.off: true` turns them off. `gcf lessons add <id>` records each answer as an inbox entry with
|
|
161
|
+
- Lessons: what got in an agent's way, asked at the end of its session (Methodology §5.2.2). `gcf lessons prompt <id>` prints the questions: tools and their workarounds, project rules that are missing or conflict, trouble with GCF itself, and, with `lessons.template` in `gcf/config.yml`, what the project's template should learn; `lessons.questions` adds the operator's own, `lessons.off: true` turns them off. `gcf lessons add <id>` records each answer as an inbox entry with its kind and its item; `gcf board --json` gives each item its `lessons` count. The harness 0.9.2 asks them in a turn of its own after each session, so they stay out of the agent's working context; `/gcf-run` without the harness asks them at its end. `/gcf-triage` proposes a fix for each.
|
|
139
162
|
|
|
140
163
|
- `gcf verify` kills a `dod.test` or `dod.build` command that runs longer than `dod_timeout_min` minutes (60 by default, 0 for no limit), with every process it started, and fails the DoD: `dod.test timed out after 60 min (dod_timeout_min), killed: <command>`. Before, a hung engine held the check, and a run with it, for hours.
|
|
141
164
|
- `gcf prioritize` takes an item made with `gcf item new` and never committed, and commits it with its rank. Before, it refused the item as an uncommitted file. An item with uncommitted edits is still refused.
|
|
@@ -213,7 +236,7 @@ The run layer of the methodology. Update both extensions together — `gcf-harne
|
|
|
213
236
|
|
|
214
237
|
- `gcf verify <id>` — the auto-DoD in code: the commit gate's checks, the item's `live:` delta against `LIVE.md`, then `dod.build` and `dod.test`. Fill both in `gcf/config.yml`; an empty one fails, `none` says the project has no such step.
|
|
215
238
|
- `gcf phase` and `gcf phase next [--reason]` — the project phase (prototype → vertical-slice → alpha → beta → release → live), kept as `phase:` in the `LIVE.md` frontmatter, with exit criteria checked in code. `item new` and `take` refuse a type the phase does not take. **A project with no phase yet is in prototype, and a prototype takes no `asset` item**: move the phase on (`gcf phase next --reason "…"`) if your game is past it. A `phases:` list in `config.yml` replaces the set.
|
|
216
|
-
- A release item carries `version:` and `channel:` (`item new <id> --type release --release 1.0.0 --channel steam`); its end writes the `release:` block of `LIVE.md`. `item new --milestone <name>` tags an item.
|
|
239
|
+
- A release item carries `version:` and `channel:` (`item new <id> --type release --release 1.0.0 --channel steam`); its end writes the `release:` block of `LIVE.md`. `item new --milestone <name>` tags an item with a milestone of `game.md` (any slug without `game.md`); `design check` reports (does not block) an item whose milestone `game.md` does not list, and the board read gives the list as `design.milestones`.
|
|
217
240
|
- `gcf playtest session [--build]` — the build of main and a checklist per item: what to check, how to get there, what to feel.
|
|
218
241
|
- `gcf worktree <id>`, `gcf verify <id> --mark`, `gcf integrate [<id>…]` — an item in its own worktree, the `GCF-Verified` trailer, the merge into main and the item's move. Every committed move now holds `.gcf-session/main.lock`.
|
|
219
242
|
- `gcf board [--json]` — everything a board shows in one read.
|
|
@@ -275,12 +298,12 @@ Removal leaves `gcf/` and `cnlp.config.json` in place. It also leaves the pre-co
|
|
|
275
298
|
|
|
276
299
|
**A deterministic core** behind `ai-factory gcf …`:
|
|
277
300
|
|
|
278
|
-
- work items — `take <ids...> [--feature <id>]`, `item new <
|
|
279
|
-
- inbox and snapshot — `inbox [add <text> | add --text-file <path|-> |
|
|
301
|
+
- work items — `take <ids...> [--feature <id>]`, `item new [id] --title <text> --type <type>`, `submit`, `close`, `verdict <id> keep|tune|kill`, `decide <id> go|no|wontfix|known|close|continue|kill`, `block`, `unblock`, `drop`, `done`, `where`
|
|
302
|
+
- inbox and snapshot — `inbox [add <text> [--category <c>] [--detail <word>] | add --text-file <path|-> | category <in-id> | later <in-id> [--off] | categories | drop <in-id> | migrate]`, `live`, `live check`
|
|
280
303
|
- runs and play — `context`, `plan check <id>`, `verify <id>`, `playtest`, `playtest session [--build]`, `audit`
|
|
281
304
|
- project phase and board — `phase`, `phase next [--reason]`, `board [--json]` (everything a board shows, in one read)
|
|
282
305
|
- branches — `worktree <id>`, `verify <id> --mark`, `integrate [<id>...]`: a run in its own worktree, the `GCF-Verified` trailer, the merge into main and the move; every committed move holds `.gcf-session/main.lock`
|
|
283
|
-
- design and sources — `design check`, `design export`, `design import`, `design migrate`, `anchor`, `section`, `quotes`, `lint`
|
|
306
|
+
- design and sources — `design check`, `design export`, `design import`, `design part`, `design save`, `design discard`, `design commit`, `design migrate`, `anchor`, `section`, `quotes`, `lint`
|
|
284
307
|
- setup — `init`, `index`, `hooks-install`
|
|
285
308
|
|
|
286
309
|
Every move of an item makes one commit `gcf(<move>): <id>` with every file it touched — the item, history or graveyard, `LIVE.md`, the systems documents, the parent feature, a removal item, the archived plan. `take`, `item new` and `inbox` do not commit. These are plain Node scripts with no LLM in the loop: the same functions the skills call, the pre-commit gate runs, and the harness gates against.
|
package/commands/gcf.js
CHANGED
|
@@ -222,7 +222,7 @@ function registerInit(gcf, program) {
|
|
|
222
222
|
console.log(`frozen: restamped to guard live: too, commit them: ${restamped.join(', ')}`);
|
|
223
223
|
console.log(
|
|
224
224
|
'gcf/ ready. Write PILLARS.md through /gcf-init, then import a GDD with /gcf-ingest ' +
|
|
225
|
-
|
|
225
|
+
"or start the design with /gcf-vision; the board's Design screen starts each of them.",
|
|
226
226
|
);
|
|
227
227
|
await offerHarness(program, opts);
|
|
228
228
|
});
|
|
@@ -361,7 +361,7 @@ function sessionText(s) {
|
|
|
361
361
|
'',
|
|
362
362
|
'after play: a verdict per item — /gcf-verdict <id> keep|tune|kill;',
|
|
363
363
|
...(s.decisions.length ? ['a decision — /gcf-verdict <id> go|no;'] : []),
|
|
364
|
-
'free notes — ai-factory gcf inbox add --
|
|
364
|
+
'free notes — ai-factory gcf inbox add --category playtest "<note>"',
|
|
365
365
|
].join('\n');
|
|
366
366
|
}
|
|
367
367
|
|
|
@@ -563,12 +563,19 @@ function registerDesign(gcf) {
|
|
|
563
563
|
console.log(`bundle written → ${opts.out}`);
|
|
564
564
|
});
|
|
565
565
|
design
|
|
566
|
-
.command('import
|
|
566
|
+
.command('import [bundle]')
|
|
567
567
|
.description('Bring an edited bundle back: 3-way by base hash, conflicts reported, no commit')
|
|
568
|
+
.option('--bundle-file <path>', 'the bundle from a file, - for stdin')
|
|
569
|
+
.option('--commit', 'commit what it applied (gcf(design)): for a caller with no console')
|
|
568
570
|
.option('--json', 'machine output')
|
|
569
571
|
.action(async (bundle, opts) => {
|
|
572
|
+
if ((bundle === undefined) === (opts.bundleFile === undefined))
|
|
573
|
+
throw new Error('give the bundle once: as the argument or --bundle-file <path|->');
|
|
574
|
+
const text = readTextFile(bundle ?? opts.bundleFile);
|
|
570
575
|
const { importBundle } = await lib('bundle');
|
|
571
|
-
const r =
|
|
576
|
+
const r = opts.commit
|
|
577
|
+
? await (await lib('design-parts')).importDesign(process.cwd(), text)
|
|
578
|
+
: await importBundle(process.cwd(), text);
|
|
572
579
|
out(opts.json, r, (x) =>
|
|
573
580
|
[
|
|
574
581
|
...x.applied.map((a) => `applied ${a}`),
|
|
@@ -580,9 +587,91 @@ function registerDesign(gcf) {
|
|
|
580
587
|
);
|
|
581
588
|
if (r.report.some((p) => p.outcome !== 'deleted')) process.exitCode = 1;
|
|
582
589
|
});
|
|
590
|
+
registerDesignParts(design);
|
|
583
591
|
registerMigrate(design);
|
|
584
592
|
}
|
|
585
593
|
|
|
594
|
+
/** The fields of `design save`: a JSON object, key → value, from a file or stdin. */
|
|
595
|
+
function fieldsOf(file) {
|
|
596
|
+
const fields = JSON.parse(readTextFile(file));
|
|
597
|
+
if (!fields || typeof fields !== 'object' || Array.isArray(fields))
|
|
598
|
+
throw new Error('the fields are a JSON object: field key → value');
|
|
599
|
+
|
|
600
|
+
return fields;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function registerDesignParts(design) {
|
|
604
|
+
const parts = () => lib('design-parts');
|
|
605
|
+
design
|
|
606
|
+
.command('part <kind> <name>')
|
|
607
|
+
.description(
|
|
608
|
+
'One part of the design as a form shows it: doc (game, glossary, pillars), system or unit',
|
|
609
|
+
)
|
|
610
|
+
.option('--type <type>', 'a unit not written yet: the type whose fields it gets')
|
|
611
|
+
.option('--json', 'machine output')
|
|
612
|
+
.action(async (kind, name, o) => {
|
|
613
|
+
const p = await (await parts()).designPart(process.cwd(), kind, name, { type: o.type });
|
|
614
|
+
out(o.json, p, (x) => `${x.file ?? '(new)'} base=${x.base ?? 'none'}\n${x.text}`);
|
|
615
|
+
});
|
|
616
|
+
design
|
|
617
|
+
.command('save [name]')
|
|
618
|
+
.description(
|
|
619
|
+
'Write one part from a form or as text: refused when it changed since its read, when a ' +
|
|
620
|
+
'pillar id leaves, or on a new blocking finding (commit gcf(design))',
|
|
621
|
+
)
|
|
622
|
+
.requiredOption('--kind <kind>', 'doc | system | unit')
|
|
623
|
+
.option('--base <hash>', 'the base its read (design part) gave; an existing part needs it')
|
|
624
|
+
.option('--system <name>', 'a new unit: the subsystem file it goes into')
|
|
625
|
+
.option('--type <type>', 'a new unit: its type')
|
|
626
|
+
.option('--title <text>', 'a new unit: its title; its id comes from it when no name is given')
|
|
627
|
+
.option('--fields-file <path>', 'the edited fields as JSON (key → value), - for stdin')
|
|
628
|
+
.option('--text-file <path>', 'the whole part as text, - for stdin')
|
|
629
|
+
.option('--no-commit', 'skip the commit (tests only)')
|
|
630
|
+
.action(async (name, o) => {
|
|
631
|
+
const r = await (
|
|
632
|
+
await parts()
|
|
633
|
+
).saveDesignPart(process.cwd(), o.kind, name, {
|
|
634
|
+
fields: o.fieldsFile === undefined ? null : fieldsOf(o.fieldsFile),
|
|
635
|
+
text: o.textFile === undefined ? null : readTextFile(o.textFile),
|
|
636
|
+
base: o.base ?? null,
|
|
637
|
+
system: o.system ?? null,
|
|
638
|
+
type: o.type ?? null,
|
|
639
|
+
title: o.title ?? null,
|
|
640
|
+
commit: o.commit,
|
|
641
|
+
});
|
|
642
|
+
// A new unit's id first: the caller gave a title and reads the id from here.
|
|
643
|
+
if (!name) console.log(r.id);
|
|
644
|
+
console.log(
|
|
645
|
+
r.applied.length ? `saved ${r.applied.join(', ')}${shortHash(r.hash)}` : 'nothing changed',
|
|
646
|
+
);
|
|
647
|
+
});
|
|
648
|
+
design
|
|
649
|
+
.command('discard [files...]')
|
|
650
|
+
.description(
|
|
651
|
+
"Take back an agent's draft not recorded: the vision, glossary, pillars or design/ files " +
|
|
652
|
+
'as the last commit has them; all of them when none is named',
|
|
653
|
+
)
|
|
654
|
+
.action(async (files) => {
|
|
655
|
+
const r = await (await parts()).discardDesign(process.cwd(), files ?? []);
|
|
656
|
+
console.log(r.files.length ? `discarded ${r.files.join(', ')}` : 'nothing to discard');
|
|
657
|
+
});
|
|
658
|
+
design
|
|
659
|
+
.command('commit')
|
|
660
|
+
.description(
|
|
661
|
+
'Record what a design session wrote (PILLARS, game, glossary, design/, backlog, ' +
|
|
662
|
+
'questions, source/) in one commit gcf(design); refused on a blocking finding',
|
|
663
|
+
)
|
|
664
|
+
.option('-m, --message <text>', 'what the session did, one line')
|
|
665
|
+
.action(async (o) => {
|
|
666
|
+
const r = await (await parts()).commitDesign(process.cwd(), { message: o.message });
|
|
667
|
+
console.log(
|
|
668
|
+
r.files.length
|
|
669
|
+
? `recorded ${r.files.length} file(s)${shortHash(r.hash)}: ${r.files.join(', ')}`
|
|
670
|
+
: 'nothing to record',
|
|
671
|
+
);
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
|
|
586
675
|
function registerMigrate(design) {
|
|
587
676
|
design
|
|
588
677
|
.command('migrate')
|
|
@@ -688,8 +777,11 @@ function registerMoves(gcf) {
|
|
|
688
777
|
function registerItem(gcf) {
|
|
689
778
|
const item = gcf.command('item').description('Work items in gcf/work/ (Methodology §3)');
|
|
690
779
|
item
|
|
691
|
-
.command('new
|
|
692
|
-
.description(
|
|
780
|
+
.command('new [id]')
|
|
781
|
+
.description(
|
|
782
|
+
'Create a work item in ready (or blocked), no commit; its id comes from --title unless ' +
|
|
783
|
+
'given; a design unit uses take',
|
|
784
|
+
)
|
|
693
785
|
.requiredOption(
|
|
694
786
|
'--type <type>',
|
|
695
787
|
'feature | tech | bug | spike | asset | content | perf | release',
|
|
@@ -709,15 +801,17 @@ function registerItem(gcf) {
|
|
|
709
801
|
.option('--priority <rank>', 'its rank: 1, 2, 3… (lower runs sooner)')
|
|
710
802
|
.option(
|
|
711
803
|
'--model <name>',
|
|
712
|
-
|
|
804
|
+
'the model its run uses, e.g. opus (default: agent.model of gcf/config.yml, else opus)',
|
|
713
805
|
)
|
|
714
806
|
.option(
|
|
715
807
|
'--effort <level>',
|
|
716
|
-
|
|
808
|
+
'the effort its run uses, e.g. high (default: agent.effort of gcf/config.yml, else high)',
|
|
717
809
|
)
|
|
718
810
|
.option('--note <text>', "what its run should know: the item's note:, up to 4000 characters")
|
|
719
811
|
.option('--note-file <path>', 'the note from a file, - for stdin: several lines')
|
|
720
812
|
.option('--commit', 'commit it (gcf(item)): for a caller with no console, e.g. a board')
|
|
813
|
+
.option('--dry-run', 'print the id it would take and the checks; write nothing')
|
|
814
|
+
.option('--proposal <key>', "the board's proposal it makes, <thread>/<id>: its commit names it")
|
|
721
815
|
.action(async (id, o) => {
|
|
722
816
|
if (o.note !== undefined && o.noteFile !== undefined)
|
|
723
817
|
throw new Error('give the note once: --note=<text> or --note-file <path|->');
|
|
@@ -742,8 +836,11 @@ function registerItem(gcf) {
|
|
|
742
836
|
note: o.noteFile === undefined ? o.note : readTextFile(o.noteFile),
|
|
743
837
|
priority: o.priority === undefined ? undefined : Number(o.priority),
|
|
744
838
|
commit: o.commit === true,
|
|
839
|
+
dryRun: o.dryRun === true,
|
|
840
|
+
proposal: o.proposal,
|
|
745
841
|
});
|
|
746
|
-
|
|
842
|
+
// The id first: a caller that gave a title reads it from here.
|
|
843
|
+
console.log(`${r.id} ${r.item}${shortHash(r.hash)}`);
|
|
747
844
|
});
|
|
748
845
|
registerAttach(item);
|
|
749
846
|
registerAgent(item);
|
|
@@ -983,23 +1080,86 @@ async function refuseOnWork(what) {
|
|
|
983
1080
|
throw new Error(`${what} on main: a work/ branch records no inbox move`);
|
|
984
1081
|
}
|
|
985
1082
|
|
|
986
|
-
|
|
1083
|
+
/** The inbox's vocabulary of this project: the base and the domain's layer merged. */
|
|
1084
|
+
const vocabulary = async () => (await lib('domain')).inboxVocabulary();
|
|
1085
|
+
|
|
1086
|
+
/** Who may file a category, as `inbox categories` says it. */
|
|
1087
|
+
function filedBy(c) {
|
|
1088
|
+
if (c.set_by.includes('question')) return 'an open question only';
|
|
1089
|
+
|
|
1090
|
+
return c.set_by.length ? `filed by ${c.set_by.join(', ')}` : 'from before the categories';
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
function registerInboxSort(inbox) {
|
|
987
1094
|
inbox
|
|
988
|
-
.command('
|
|
989
|
-
.description('
|
|
990
|
-
.option('--
|
|
991
|
-
.option('--
|
|
1095
|
+
.command('category <in-id>')
|
|
1096
|
+
.description('Give an entry another category or detail; where it came from stays')
|
|
1097
|
+
.option('--category <category>', 'the new category (ai-factory gcf inbox categories)')
|
|
1098
|
+
.option('--detail <word>', 'one lowercase word after it; empty clears it')
|
|
992
1099
|
.option('--commit', 'commit it (gcf(inbox)): for a caller with no console, e.g. a board')
|
|
993
1100
|
.action(async (id, o) => {
|
|
994
|
-
await refuseOnWork('
|
|
995
|
-
const {
|
|
1101
|
+
await refuseOnWork('sort an entry');
|
|
1102
|
+
const { planCategory } = await lib('inbox');
|
|
996
1103
|
const { gcfRoot } = await lib('gcf-paths');
|
|
997
|
-
const plan = await
|
|
998
|
-
|
|
999
|
-
|
|
1104
|
+
const plan = await planCategory(gcfRoot(), id, {
|
|
1105
|
+
category: o.category,
|
|
1106
|
+
detail: o.detail,
|
|
1107
|
+
vocab: await vocabulary(),
|
|
1000
1108
|
});
|
|
1001
|
-
const hash = await inboxMove(o.commit, `gcf(inbox):
|
|
1002
|
-
|
|
1109
|
+
const hash = await inboxMove(o.commit, `gcf(inbox): sort ${id}`, plan, 'inbox-category');
|
|
1110
|
+
const { category, detail } = plan.entry;
|
|
1111
|
+
console.log(`${id} is ${category}${detail ? `:${detail}` : ''}${shortHash(hash)}`);
|
|
1112
|
+
});
|
|
1113
|
+
inbox
|
|
1114
|
+
.command('later <in-id>')
|
|
1115
|
+
.description('Put an entry away to Later, or take it back with --off')
|
|
1116
|
+
.option('--off', 'take it back from Later')
|
|
1117
|
+
.option('--commit', 'commit it (gcf(inbox)): for a caller with no console, e.g. a board')
|
|
1118
|
+
.action(async (id, o) => {
|
|
1119
|
+
await refuseOnWork('put an entry away');
|
|
1120
|
+
const { planLater } = await lib('inbox');
|
|
1121
|
+
const { gcfRoot } = await lib('gcf-paths');
|
|
1122
|
+
const plan = await planLater(gcfRoot(), id, !o.off, await vocabulary());
|
|
1123
|
+
const [key, what] = o.off ? ['inbox-back', 'back'] : ['inbox-later', 'later'];
|
|
1124
|
+
const hash = await inboxMove(o.commit, `gcf(inbox): ${what} ${id}`, plan, key);
|
|
1125
|
+
console.log(`${id} ${o.off ? 'back from Later' : 'in Later'}${shortHash(hash)}`);
|
|
1126
|
+
});
|
|
1127
|
+
inbox
|
|
1128
|
+
.command('categories')
|
|
1129
|
+
.description('The categories an entry may have, and who may file each')
|
|
1130
|
+
.option('--json', 'machine output: the groups and the categories')
|
|
1131
|
+
.action(async (o) => {
|
|
1132
|
+
out(o.json, await vocabulary(), (v) =>
|
|
1133
|
+
v.categories
|
|
1134
|
+
.map((c) => {
|
|
1135
|
+
const details = c.details ? `; detail: ${c.details.join(' | ')}` : '';
|
|
1136
|
+
|
|
1137
|
+
return `${c.id} — ${c.label}: ${c.help} (${filedBy(c)}${details})`;
|
|
1138
|
+
})
|
|
1139
|
+
.join('\n'),
|
|
1140
|
+
);
|
|
1141
|
+
});
|
|
1142
|
+
inbox
|
|
1143
|
+
.command('migrate')
|
|
1144
|
+
.description('Write the entries from before the categories as they have them; one commit')
|
|
1145
|
+
.option('--json', 'machine output')
|
|
1146
|
+
.action(async (o) => {
|
|
1147
|
+
await refuseOnWork('migrate the inbox');
|
|
1148
|
+
const { planMigrate } = await lib('inbox');
|
|
1149
|
+
const { gcfRoot } = await lib('gcf-paths');
|
|
1150
|
+
const plan = await planMigrate(gcfRoot());
|
|
1151
|
+
const n = plan.migrated.length;
|
|
1152
|
+
// Nothing old left: no commit, so a second run changes nothing.
|
|
1153
|
+
const hash = n
|
|
1154
|
+
? await inboxMove(true, `gcf(inbox): ${n} entries to categories`, plan, 'inbox-migrate')
|
|
1155
|
+
: null;
|
|
1156
|
+
const line = (m) =>
|
|
1157
|
+
`${m.id} → ${m.category}${m.dropped.length ? ` (dropped: ${m.dropped.join(', ')})` : ''}`;
|
|
1158
|
+
out(o.json, { migrated: plan.migrated, hash }, (r) =>
|
|
1159
|
+
n
|
|
1160
|
+
? [...r.migrated.map(line), `migrated ${n}${shortHash(hash)}`].join('\n')
|
|
1161
|
+
: 'nothing to migrate',
|
|
1162
|
+
);
|
|
1003
1163
|
});
|
|
1004
1164
|
}
|
|
1005
1165
|
|
|
@@ -1068,12 +1228,13 @@ function registerInbox(gcf) {
|
|
|
1068
1228
|
l.length
|
|
1069
1229
|
? l
|
|
1070
1230
|
.map((e) => {
|
|
1071
|
-
const
|
|
1231
|
+
const category = e.detail ? `${e.category}:${e.detail}` : e.category;
|
|
1072
1232
|
const more = e.text.split('\n').length - 1;
|
|
1073
1233
|
const lines = more ? ` (+${more} lines)` : '';
|
|
1074
|
-
const
|
|
1234
|
+
const about = e.item ? ` (item: ${e.item})` : '';
|
|
1235
|
+
const later = e.later ? ' (later)' : '';
|
|
1075
1236
|
|
|
1076
|
-
return `${e.id} [${
|
|
1237
|
+
return `${e.id} [${category}, ${e.origin}] ${e.title}${lines}${about}${later}`;
|
|
1077
1238
|
})
|
|
1078
1239
|
.join('\n')
|
|
1079
1240
|
: 'inbox empty',
|
|
@@ -1082,22 +1243,32 @@ function registerInbox(gcf) {
|
|
|
1082
1243
|
inbox
|
|
1083
1244
|
.command('add [text]')
|
|
1084
1245
|
.description('Add an entry: gcf/inbox/in-<id>.md; its first line is its title')
|
|
1085
|
-
.option('--
|
|
1246
|
+
.option('--category <category>', "what it asks of the operator; note when it is the operator's")
|
|
1247
|
+
.option('--detail <word>', 'one lowercase word after the category: asset, static-analysis')
|
|
1248
|
+
.option('--origin <origin>', 'you | agent | automation; by default who runs it')
|
|
1249
|
+
.option('--item <id>', 'the item it is about: a request, a finding')
|
|
1086
1250
|
// A text that starts with a hyphen ("-5 fps on level 3") reads as a flag at every level of
|
|
1087
1251
|
// ai-factory's commands, `--` included: as `--text=<text>` it stays one value.
|
|
1088
1252
|
.option('--text <text>', 'the entry, when it starts with a hyphen')
|
|
1089
1253
|
.option('--text-file <path>', 'the entry from a file, - for stdin: several lines')
|
|
1090
|
-
.option('--tags <tags>', 'its tags, comma-separated: idea, later, ui:hud')
|
|
1091
1254
|
.option('--commit', 'commit it (gcf(inbox)): for a caller with no console, e.g. a board')
|
|
1092
1255
|
.action(async (arg, o) => {
|
|
1093
1256
|
const text = entryText(arg, o);
|
|
1094
1257
|
const { planAdd } = await lib('inbox');
|
|
1095
1258
|
const { gcfRoot } = await lib('gcf-paths');
|
|
1096
|
-
const
|
|
1259
|
+
const { moveBy } = await lib('git');
|
|
1260
|
+
const plan = planAdd(gcfRoot(), text, {
|
|
1261
|
+
// Quick capture's default is the operator's: an agent names its category.
|
|
1262
|
+
category: o.category ?? (moveBy() === 'operator' ? 'note' : undefined),
|
|
1263
|
+
detail: o.detail,
|
|
1264
|
+
origin: o.origin,
|
|
1265
|
+
item: o.item,
|
|
1266
|
+
vocab: await vocabulary(),
|
|
1267
|
+
});
|
|
1097
1268
|
const hash = await inboxMove(o.commit, 'gcf(inbox): add', plan, 'inbox-add');
|
|
1098
1269
|
console.log(`${plan.entry.id}${shortHash(hash)}`);
|
|
1099
1270
|
});
|
|
1100
|
-
|
|
1271
|
+
registerInboxSort(inbox);
|
|
1101
1272
|
registerInboxDrop(inbox);
|
|
1102
1273
|
}
|
|
1103
1274
|
|
|
@@ -1449,10 +1620,14 @@ function registerPillar(gcf) {
|
|
|
1449
1620
|
.command('pillar')
|
|
1450
1621
|
.description('Revise PILLARS.md where units and items cite it (the human decides)');
|
|
1451
1622
|
pillar
|
|
1452
|
-
.command('rename <from>
|
|
1623
|
+
.command('rename <from> [to]')
|
|
1453
1624
|
.description('Rename a pillar id in PILLARS.md, units and items (commit gcf(pillar))')
|
|
1625
|
+
.option('--to <id>', 'the new id, for a caller that passes options only (a board)')
|
|
1454
1626
|
.option('--no-commit', 'skip the commit (tests only)')
|
|
1455
|
-
.action(async (from,
|
|
1627
|
+
.action(async (from, arg, o) => {
|
|
1628
|
+
if ((arg === undefined) === (o.to === undefined))
|
|
1629
|
+
throw new Error('give the new id once: as the argument or --to <id>');
|
|
1630
|
+
const to = arg ?? o.to;
|
|
1456
1631
|
const r = await (await lib('pillars')).renamePillar(process.cwd(), from, to, o);
|
|
1457
1632
|
console.log(`renamed ${from} → ${to}${shortHash(r.hash)}`);
|
|
1458
1633
|
});
|
package/extension.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/lee-to/ai-factory/2.x/schemas/extension.schema.json",
|
|
3
3
|
"name": "gcf-aif-ext",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.4",
|
|
5
5
|
"description": "Game Context Framework for AI Factory",
|
|
6
6
|
"skills": [
|
|
7
7
|
"skills/gcf-init",
|
package/hooks/pre-commit.js
CHANGED
|
@@ -31,8 +31,10 @@ function git(args) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// gcf/.metrics is left out: `gcf audit` and `gcf context` append to it on every run, and the
|
|
34
|
-
// gate reads none of it.
|
|
35
|
-
|
|
34
|
+
// gate reads none of it. So is an unfinished import's held anchor map (`source/*.import.json`):
|
|
35
|
+
// it lives until `gcf anchor --done`, and the design moves of that import must still commit.
|
|
36
|
+
// Hooks run from the repository root, so the pathspecs are relative.
|
|
37
|
+
const scope = ['--', 'gcf', ':(exclude)gcf/.metrics', ':(exclude,glob)gcf/source/*.import.json'];
|
|
36
38
|
const staged = git(['diff', '--cached', '--name-only', ...scope]);
|
|
37
39
|
if (staged === '') process.exit(0); // this commit does not touch gcf/
|
|
38
40
|
if (staged !== null) {
|
package/lib/agent-permissions.js
CHANGED
|
@@ -266,8 +266,8 @@ function choices(agent) {
|
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
268
|
* The project's model and effort (`agent.model`, `agent.effort`): what an item or a thread
|
|
269
|
-
* without its own pick runs on; null, or `default` written by hand, leaves it to the agent
|
|
270
|
-
* word each, as an item's.
|
|
269
|
+
* without its own pick runs on; null, or `default` written by hand, leaves it to the agent's
|
|
270
|
+
* defaults (Opus, High: Board-PRD decision 36). One word each, as an item's.
|
|
271
271
|
*/
|
|
272
272
|
function picksOf(agent) {
|
|
273
273
|
const pick = (k) => {
|
package/lib/audit-core.js
CHANGED
|
@@ -6,6 +6,7 @@ import { listItems, listSystems, readConfig, tokensEst, legacyCards } from './gc
|
|
|
6
6
|
import { lint } from './linter.js';
|
|
7
7
|
import { drifted } from './index-gen.js';
|
|
8
8
|
import { designCheck, recordsIn } from './design-check.js';
|
|
9
|
+
import { PILLARS_MAX } from './design.js';
|
|
9
10
|
import { buildLedger } from './ledger.js';
|
|
10
11
|
import { STORED } from './transitions.js';
|
|
11
12
|
import { openDepends } from './work-ops.js';
|
|
@@ -13,6 +14,7 @@ import { runHolder } from './main-lock.js';
|
|
|
13
14
|
import { markOwner, ownerOf, sessionActive } from './session-mark.js';
|
|
14
15
|
import { fieldOf } from './question-fields.js';
|
|
15
16
|
import { inboxProblems } from './inbox.js';
|
|
17
|
+
import { inboxVocabulary } from './domain.js';
|
|
16
18
|
|
|
17
19
|
function git(args, cwd) {
|
|
18
20
|
// A blame of a long file overflows the 1 MiB default, and an overflow reads as a git failure.
|
|
@@ -69,7 +71,8 @@ function runningOf(projectDir, id) {
|
|
|
69
71
|
* priority: number | null, running: boolean, running_by: string | null}>} [items]
|
|
70
72
|
* @property {{blocking: number, units: number, ready: number}} [design]
|
|
71
73
|
* @property {{legacy: boolean, bad_names: string[], untitled: string[], broken_links: string[],
|
|
72
|
-
* orphan_dirs: string[]
|
|
74
|
+
* orphan_dirs: string[], unmigrated: string[], unknown_category: string[],
|
|
75
|
+
* unsorted: string[]}} inbox
|
|
73
76
|
*/
|
|
74
77
|
|
|
75
78
|
/**
|
|
@@ -109,7 +112,7 @@ export async function audit(projectDir) {
|
|
|
109
112
|
index_drift: await drifted(root),
|
|
110
113
|
illegal_status: [],
|
|
111
114
|
stale_questions: staleQuestions(projectDir, root, config),
|
|
112
|
-
inbox: await inboxProblems(root),
|
|
115
|
+
inbox: await inboxProblems(root, inboxVocabulary()),
|
|
113
116
|
};
|
|
114
117
|
// The harness gate reads everything from this one report — it never parses gcf/ itself.
|
|
115
118
|
report.schema = config.schema;
|
|
@@ -201,9 +204,6 @@ export function wipOf(items, config) {
|
|
|
201
204
|
return { count, limit: config.wip_built_limit, over: count > config.wip_built_limit };
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
// GCF-PRD §5.3: no more than 7 pillars.
|
|
205
|
-
const PILLARS_MAX = 7;
|
|
206
|
-
|
|
207
207
|
async function pillarsOf(root, config) {
|
|
208
208
|
const pillarsFile = path.join(root, 'PILLARS.md');
|
|
209
209
|
if (!existsSync(pillarsFile)) return null;
|
|
@@ -386,6 +386,12 @@ const inboxAlerts = (i) => [
|
|
|
386
386
|
i.untitled.length && `${i.untitled.length} inbox entr(ies) without a title line`,
|
|
387
387
|
i.broken_links.length && `${i.broken_links.length} inbox picture link(s) lead nowhere`,
|
|
388
388
|
i.orphan_dirs.length && `${i.orphan_dirs.length} inbox picture folder(s) without their entry`,
|
|
389
|
+
i.unmigrated.length &&
|
|
390
|
+
`${i.unmigrated.length} inbox entr(ies) from before the categories: ai-factory gcf inbox migrate`,
|
|
391
|
+
i.unknown_category.length &&
|
|
392
|
+
`${i.unknown_category.length} inbox entr(ies) of a category the vocabulary lacks: ` +
|
|
393
|
+
i.unknown_category.join(', '),
|
|
394
|
+
i.unsorted.length && `${i.unsorted.length} unsorted inbox entr(ies): give each a category`,
|
|
389
395
|
];
|
|
390
396
|
|
|
391
397
|
/** @param {AuditReport} report */
|
package/lib/board.js
CHANGED
|
@@ -16,16 +16,18 @@ import { runHolder } from './main-lock.js';
|
|
|
16
16
|
import { ITEM_TYPES } from './validate-item.js';
|
|
17
17
|
import { movesOf } from './transitions.js';
|
|
18
18
|
import { domainOf, hasHarness, RUNS_FROM } from './domain.js';
|
|
19
|
+
import { lessonRepeats } from './inbox-categories.js';
|
|
19
20
|
import { openDepends } from './work-ops.js';
|
|
20
21
|
import { listQuestions } from './questions.js';
|
|
21
22
|
import { sessionActive } from './session-mark.js';
|
|
22
23
|
import { agentOf } from './agent-permissions.js';
|
|
23
24
|
import { projectSettings } from './config-set.js';
|
|
24
|
-
import { designUnits } from './design-check.js';
|
|
25
|
+
import { designCheck, designUnits } from './design-check.js';
|
|
26
|
+
import { designState } from './design-parts.js';
|
|
25
27
|
|
|
26
28
|
// The version of the JSON below (Methodology §11): a board refuses one it does not know. Bump it
|
|
27
29
|
// when a field changes meaning or goes away; a new field does not bump it.
|
|
28
|
-
export const BOARD_SCHEMA =
|
|
30
|
+
export const BOARD_SCHEMA = 4;
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Plan progress `{tasks, done}` from its checkboxes and the plan's project path, both null
|
|
@@ -255,8 +257,8 @@ const needsOf = (ledger, depends) =>
|
|
|
255
257
|
});
|
|
256
258
|
|
|
257
259
|
/** The live design units for the board's pickers: the design check's summary of each. */
|
|
258
|
-
const unitsOf =
|
|
259
|
-
|
|
260
|
+
const unitsOf = (units) =>
|
|
261
|
+
units.map((u) => ({
|
|
260
262
|
id: u.id,
|
|
261
263
|
title: u.title,
|
|
262
264
|
type: u.type,
|
|
@@ -367,14 +369,18 @@ export async function board(projectDir) {
|
|
|
367
369
|
);
|
|
368
370
|
for (const i of items) i.since_at = times.get(i.since) ?? null;
|
|
369
371
|
const inbox = await listInbox(root);
|
|
370
|
-
// Where agents struggle: the lessons in the inbox each item's sessions left.
|
|
371
|
-
|
|
372
|
+
// Where agents struggle: the lessons in the inbox each item's sessions left. A request or a
|
|
373
|
+
// finding about the item names it too: it is no lesson.
|
|
374
|
+
for (const i of items)
|
|
375
|
+
i.lessons = inbox.filter((e) => e.category === 'lesson' && e.item === i.id).length;
|
|
372
376
|
// The reverse of depends: the items on the board that wait for this one.
|
|
373
377
|
for (const i of items)
|
|
374
378
|
i.needed_by = items.filter((o) => o.depends.includes(i.id)).map((o) => o.id);
|
|
375
379
|
|
|
376
380
|
const config = await readConfig(root);
|
|
377
381
|
const live = await readLive(root);
|
|
382
|
+
const questions = await listQuestions(root);
|
|
383
|
+
const { units, design } = await designOf(projectDir, ledger, questions);
|
|
378
384
|
|
|
379
385
|
return {
|
|
380
386
|
schema: BOARD_SCHEMA,
|
|
@@ -403,9 +409,35 @@ export async function board(projectDir) {
|
|
|
403
409
|
items,
|
|
404
410
|
wip: wipOf(ledger.items, config),
|
|
405
411
|
inbox,
|
|
406
|
-
|
|
412
|
+
// A lesson kind met in 3 runs or more: it rises to Needs you (decision 32).
|
|
413
|
+
inbox_repeats: lessonRepeats(inbox),
|
|
414
|
+
// The class stays in the file; the screen shows the category (§2.7, decision 32). An agent
|
|
415
|
+
// writes every question record: its origin is one.
|
|
416
|
+
questions: questions.map((q) => ({
|
|
417
|
+
...q,
|
|
418
|
+
category: /^D1\b/.test(q.class ?? '') ? 'decision' : 'assumption',
|
|
419
|
+
origin: 'agent',
|
|
420
|
+
})),
|
|
407
421
|
history: await historyOf(root),
|
|
408
422
|
graveyard: await graveyardOf(root),
|
|
409
|
-
units:
|
|
423
|
+
units: unitsOf(units),
|
|
424
|
+
design,
|
|
410
425
|
};
|
|
411
426
|
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The units and the design block (Board-PRD §5.24) from one design check. A check that cannot
|
|
430
|
+
* run (an unreadable file) leaves the units the pickers need and says why in the block.
|
|
431
|
+
*/
|
|
432
|
+
async function designOf(projectDir, ledger, questions) {
|
|
433
|
+
try {
|
|
434
|
+
const report = await designCheck(projectDir, { ledger });
|
|
435
|
+
|
|
436
|
+
return {
|
|
437
|
+
units: report.units,
|
|
438
|
+
design: await designState(projectDir, { report, questions, items: ledger.items.length }),
|
|
439
|
+
};
|
|
440
|
+
} catch (e) {
|
|
441
|
+
return { units: await designUnits(projectDir, ledger), design: { error: e.message } };
|
|
442
|
+
}
|
|
443
|
+
}
|