gcf-aif-ext 0.22.0 → 0.23.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 +19 -2
- package/commands/gcf.js +67 -0
- package/extension.json +1 -1
- package/lib/agent-permissions.js +18 -10
- package/lib/audit-core.js +2 -1
- package/lib/changes.js +26 -7
- package/lib/design-parts.js +13 -5
- package/lib/domain.js +35 -4
- package/lib/git.js +8 -1
- package/lib/id.js +1 -0
- package/lib/inbox-categories.js +1 -0
- package/lib/inbox.js +6 -1
- package/lib/integrate.js +76 -16
- package/lib/lessons.js +2 -1
- package/lib/main-lock.js +1 -1
- package/lib/migrate.js +1 -0
- package/lib/milestone-state.js +2 -1
- package/lib/systems-doc.js +50 -2
- package/lib/transitions.js +2 -0
- package/lib/work-ops.js +201 -8
- package/package.json +1 -1
- package/skills/gcf-chat/SKILL.md +16 -9
- package/skills/gcf-triage/SKILL.md +9 -7
- package/templates/agents-block.md +55 -23
package/README.md
CHANGED
|
@@ -50,6 +50,23 @@ 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.23.0
|
|
54
|
+
|
|
55
|
+
- `gcf item amend <id>` fixes a live card's text from every stored status but `unplayed`, the status unchanged: `--text` (`--text-file`) replaces the blocks it names, a key alone takes one out; `--add` adds to `notes:`; `--title`; `--from <in-id>` takes an inbox entry in the same commit, its pictures one by one. `provenance:` and `tuning:` cannot be named; a unit's block must be in its profile. `--dry-run --json` writes nothing and gives `{base, title, text, changes}`; `--base <hash>` refuses a card changed since (`gcf-refusal: {"code":"stale"}`). The operator's: a run and a thread are refused, the deny group `human-moves` holds it, and a chat agent proposes it (`propose_amend`). Refused during this card's run or session (`{"code":"running"}`). Findings on the new text come from the pre-commit gate, with its rollback. The domain's `preview` and `hint` tell a board.
|
|
56
|
+
- A resumed worktree takes main's card over what a stopped run wrote into its copy, saved or not; other files' conflicts read as before. A `work/<id>` branch whose folder was deleted syncs with main too.
|
|
57
|
+
- `item new --from <in> --note <text>`: the note goes over the entry's text, not beside it, so a board's form does not double it. The entry's links follow its pictures.
|
|
58
|
+
- The domain's `inbox-add` has the `item` field: an agent's proposal may name its card.
|
|
59
|
+
- gcf-chat, gcf-triage and the `AGENTS.md` block: a decision about a live item goes into its card by `propose_amend`, never the inbox or a new item; a decision against a slot replaces the slot. Run `ai-factory gcf init` once to take the new block.
|
|
60
|
+
|
|
61
|
+
### 0.22.2
|
|
62
|
+
|
|
63
|
+
- A refusal in a terminal is its words and its machine line on stderr, exit 1: no `file:///…` and no node stack over them. A bug (any error type but a plain `Error`) keeps its stack. An older board or harness reads it as before.
|
|
64
|
+
- The `AGENTS.md` block keeps cnlp's line rules: no line past 250 characters, no passive, no open bound; a test holds it. `gcf_*` block names stay the project's to declare. Run `ai-factory gcf init` after the update to take the new text.
|
|
65
|
+
|
|
66
|
+
### 0.22.1
|
|
67
|
+
|
|
68
|
+
- An agent may read the history of past runs: the deny group `human-moves` held `ai-factory gcf-harness run*`, which also caught `gcf-harness runs`, the very command `AGENTS.md` tells it to use. The rule is now `ai-factory gcf-harness run *`. A session started after the update takes it; nothing to re-run in the project.
|
|
69
|
+
|
|
53
70
|
### 0.22.0
|
|
54
71
|
|
|
55
72
|
- **`gcf changes`**: what is not committed, anywhere in the project, read only. `gcf changes [--worktree <id>] [--json]` lists the main checkout or a run's worktree: each file's status against the base (a worktree's base is where it left the main checkout, so what the run committed on its branch shows too, with its state `branch`, `open` or `both`), and what a board's click does (`text`, `image`, `binary`, `listed`). `gcf changes diff --path <p>` gives a text file's diff, and `gcf changes file --path <p> --side base|now --json` a picture's bytes as base64. `gcf/.metrics/` and `.gcf-session/` are never listed.
|
|
@@ -95,7 +112,7 @@ On Windows, run `extension add` and `extension update` from PowerShell or cmd, n
|
|
|
95
112
|
### 0.19.0
|
|
96
113
|
|
|
97
114
|
Autonomy (docs/Autonomy-Plan.md): the agent works by itself, the operator plays the milestones.
|
|
98
|
-
- The core holds the operator's moves: `verdict`, `decide` (but under the gates), `drop` of a work item, `unblock`, `question answer`, `config set`, `permissions`, `phase next`, `pillar`, `hooks-install` and `item
|
|
115
|
+
- The core holds the operator's moves: `verdict`, `decide` (but under the gates), `drop` of a work item, `unblock`, `question answer`, `config set`, `permissions`, `phase next`, `pillar`, `hooks-install`, `item gates` and `item amend` refuse a harness run and a board thread (`GCF-By: thread`). A console session and the operator pass.
|
|
99
116
|
- `gates:` in `gcf/config.yml`: `milestone` wait|go, `verdict` wait|defer (a mechanic's or resource's submit closes it unplayed), `decision` wait|agent (a run decides go or no of its own spike, with `--reason`), `question` wait|assume. A card's `skip_gates`: `ai-factory gcf item gates <id> --to skip|wait|project`. `config set --pair key=value …` sets several keys in one commit.
|
|
100
117
|
- A soft unit whose delta modifies or removes a capability no longer refuses its close: it waits for a verdict, `gate_why: modifies <capability>`.
|
|
101
118
|
- `--assume "<question> = <value>"` on `submit`, `close`, `decide` files a D2 in the move's commit; `ai-factory gcf question add --class D1|D2 …` files one alone. `decide`'s reason goes into its commit.
|
|
@@ -373,7 +390,7 @@ Removal leaves `gcf/` and `cnlp.config.json` in place. It also leaves the pre-co
|
|
|
373
390
|
|
|
374
391
|
**A deterministic core** behind `ai-factory gcf …`:
|
|
375
392
|
|
|
376
|
-
- 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`
|
|
393
|
+
- 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`, `item amend <id> [--text <blocks>] [--add <lines>] [--title <text>] [--from <in-id>] [--dry-run --json]`
|
|
377
394
|
- 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`
|
|
378
395
|
- runs and play — `context`, `plan check <id>`, `verify <id>`, `playtest`, `playtest session [--build]`, `audit`
|
|
379
396
|
- project phase and board — `phase`, `phase next [--reason]`, `board [--json]` (everything a board shows, in one read)
|
package/commands/gcf.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// CLI wrapper over the deterministic core (GCF-PRD §10.1): harness and human call
|
|
2
2
|
// the same functions. Registered by AIF via extension.json `commands`.
|
|
3
|
+
import { inspect } from 'node:util';
|
|
3
4
|
import { mkdir, copyFile, readFile, writeFile } from 'node:fs/promises';
|
|
4
5
|
import { existsSync, readFileSync } from 'node:fs';
|
|
5
6
|
import { spawnSync } from 'node:child_process';
|
|
@@ -1041,9 +1042,54 @@ function registerItem(gcf) {
|
|
|
1041
1042
|
});
|
|
1042
1043
|
registerAttach(item);
|
|
1043
1044
|
registerAgent(item);
|
|
1045
|
+
registerAmend(item);
|
|
1044
1046
|
registerHistory(item);
|
|
1045
1047
|
}
|
|
1046
1048
|
|
|
1049
|
+
function registerAmend(item) {
|
|
1050
|
+
item
|
|
1051
|
+
.command('amend <id>')
|
|
1052
|
+
.description(
|
|
1053
|
+
"Fix a live card's text, any status but unplayed: its status stays, its next run reads it " +
|
|
1054
|
+
'(commit)',
|
|
1055
|
+
)
|
|
1056
|
+
.option('--text <blocks>', 'the blocks to replace, in block syntax; a key alone takes it out')
|
|
1057
|
+
.option('--text-file <path>', 'the blocks from a file, - for stdin')
|
|
1058
|
+
.option('--add <lines>', 'lines to add to notes:, up to 4000 characters')
|
|
1059
|
+
.option('--title <text>', 'the new title')
|
|
1060
|
+
.option(
|
|
1061
|
+
'--from <in-id>',
|
|
1062
|
+
'the inbox entry it takes: erased; its words go to notes: unless --add',
|
|
1063
|
+
)
|
|
1064
|
+
.option('--base <hash>', "the preview's base: refused when the card changed since")
|
|
1065
|
+
.option('--dry-run', 'show what would change; write nothing; a run may hold the card')
|
|
1066
|
+
.option('--json', 'with --dry-run: {base, title, text, changes: [{block, old, new}]}')
|
|
1067
|
+
.option('--no-commit', 'skip the commit (tests only)')
|
|
1068
|
+
.action(async (id, o) => {
|
|
1069
|
+
if (o.text !== undefined && o.textFile !== undefined)
|
|
1070
|
+
throw new Error('give the text once: --text=<blocks> or --text-file <path|->');
|
|
1071
|
+
// A preview changes nothing: a board shows it for an agent's proposal too.
|
|
1072
|
+
if (!o.dryRun) await operatorOnly('item amend');
|
|
1073
|
+
const r = await (
|
|
1074
|
+
await lib('work-ops')
|
|
1075
|
+
).amendItem(process.cwd(), id, {
|
|
1076
|
+
text: o.textFile === undefined ? o.text : readTextFile(o.textFile),
|
|
1077
|
+
add: o.add,
|
|
1078
|
+
title: o.title,
|
|
1079
|
+
from: o.from,
|
|
1080
|
+
base: o.base,
|
|
1081
|
+
dryRun: o.dryRun === true,
|
|
1082
|
+
commit: o.commit,
|
|
1083
|
+
});
|
|
1084
|
+
if (o.json) console.log(JSON.stringify(r, null, 2));
|
|
1085
|
+
else if (o.dryRun)
|
|
1086
|
+
console.log(
|
|
1087
|
+
r.changes.map((c) => `${c.block}: ${c.new.length} lines`).join('\n') || 'no change',
|
|
1088
|
+
);
|
|
1089
|
+
else console.log(`amended ${id}${shortHash(r.hash)}`);
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1047
1093
|
function registerHistory(item) {
|
|
1048
1094
|
item
|
|
1049
1095
|
.command('history <id>')
|
|
@@ -1960,8 +2006,29 @@ function registerPillar(gcf) {
|
|
|
1960
2006
|
});
|
|
1961
2007
|
}
|
|
1962
2008
|
|
|
2009
|
+
let plainRefusals = false;
|
|
2010
|
+
|
|
2011
|
+
/**
|
|
2012
|
+
* A move's refusal is its words on stderr, with its machine line, not node's stack over them; a
|
|
2013
|
+
* bug (any other error type) keeps its report: its stack, what a rollback could not restore.
|
|
2014
|
+
* Past the action: a caller that awaits the parse catches the error first, and another
|
|
2015
|
+
* extension's commands never get here.
|
|
2016
|
+
*/
|
|
2017
|
+
function refuseInWords() {
|
|
2018
|
+
if (plainRefusals) return;
|
|
2019
|
+
plainRefusals = true;
|
|
2020
|
+
const fail = (e) => {
|
|
2021
|
+
const words = e instanceof Error && e.name !== 'Error' ? inspect(e) : (e?.message ?? String(e));
|
|
2022
|
+
process.stderr.write(`${words}\n`, () => process.exit(1));
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
process.on('uncaughtException', fail);
|
|
2026
|
+
process.on('unhandledRejection', fail);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
1963
2029
|
export function register(program) {
|
|
1964
2030
|
const gcf = program.command('gcf').description('Game Context Framework core');
|
|
2031
|
+
gcf.hook('preAction', refuseInWords);
|
|
1965
2032
|
registerPillar(gcf);
|
|
1966
2033
|
registerInit(gcf, program);
|
|
1967
2034
|
registerIndex(gcf);
|
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.23.0",
|
|
5
5
|
"description": "Game Context Framework for AI Factory",
|
|
6
6
|
"skills": [
|
|
7
7
|
"skills/gcf-init",
|
package/lib/agent-permissions.js
CHANGED
|
@@ -130,7 +130,8 @@ export const DENY_GROUPS = [
|
|
|
130
130
|
// The stash stack is the checkout's and every worktree's: a pop may take the operator's.
|
|
131
131
|
id: 'git-discard',
|
|
132
132
|
label:
|
|
133
|
-
'uncommitted work: reset --hard, clean, checkout or restore of all, stash
|
|
133
|
+
'uncommitted work: reset --hard, clean, checkout or restore of all, stash ' +
|
|
134
|
+
'(list and show are free)',
|
|
134
135
|
on: true,
|
|
135
136
|
rules: shell(
|
|
136
137
|
'git reset --hard*',
|
|
@@ -179,7 +180,7 @@ export const DENY_GROUPS = [
|
|
|
179
180
|
{
|
|
180
181
|
id: 'human-moves',
|
|
181
182
|
label:
|
|
182
|
-
"the human's GCF moves: verdict, answer, unblock, a card's gates, phase, pillars, " +
|
|
183
|
+
"the human's GCF moves: verdict, answer, unblock, a card's gates or text, phase, pillars, " +
|
|
183
184
|
'settings, permissions, setup, hand edits (decide the core holds by the gates)',
|
|
184
185
|
on: true,
|
|
185
186
|
rules: shell(
|
|
@@ -187,6 +188,7 @@ export const DENY_GROUPS = [
|
|
|
187
188
|
'ai-factory gcf question answer*',
|
|
188
189
|
'ai-factory gcf unblock*',
|
|
189
190
|
'ai-factory gcf item gates*',
|
|
191
|
+
'ai-factory gcf item amend*',
|
|
190
192
|
'ai-factory gcf phase next*',
|
|
191
193
|
'ai-factory gcf pillar*',
|
|
192
194
|
'ai-factory gcf permissions*',
|
|
@@ -196,7 +198,8 @@ export const DENY_GROUPS = [
|
|
|
196
198
|
'ai-factory gcf edits commit*',
|
|
197
199
|
'ai-factory gcf edits discard*',
|
|
198
200
|
'ai-factory gcf-harness init*',
|
|
199
|
-
|
|
201
|
+
// The space keeps `gcf-harness runs`, the history of past runs, a read the agent may make.
|
|
202
|
+
'ai-factory gcf-harness run *',
|
|
200
203
|
// The autopilot's card session: an agent starts none.
|
|
201
204
|
'ai-factory gcf-harness card*',
|
|
202
205
|
'ai-factory gcf-harness stop*',
|
|
@@ -365,6 +368,17 @@ function checkChange(change, current) {
|
|
|
365
368
|
if (missing) throw new Error(`${missing} is not one of your own deny rules: turn its group off`);
|
|
366
369
|
}
|
|
367
370
|
|
|
371
|
+
/** An old group id in the file gives its value to the parts not written yet, and leaves. */
|
|
372
|
+
function retireAliases(doc) {
|
|
373
|
+
for (const old of Object.keys(ALIASES)) {
|
|
374
|
+
if (!doc.hasIn(['agent', 'groups', old])) continue;
|
|
375
|
+
for (const p of ALIASES[old])
|
|
376
|
+
if (!doc.hasIn(['agent', 'groups', p]))
|
|
377
|
+
doc.setIn(['agent', 'groups', p], doc.getIn(['agent', 'groups', old]));
|
|
378
|
+
doc.deleteIn(['agent', 'groups', old]);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
368
382
|
/**
|
|
369
383
|
* Turn groups on or off, add or remove a custom rule; commit gcf(permissions). Only the
|
|
370
384
|
* `agent:` section changes: the rest of config.yml keeps its keys and comments. The file is
|
|
@@ -386,13 +400,7 @@ export async function setPermissions(projectDir, change, { commit = true } = {})
|
|
|
386
400
|
for (const p of partsOf(id)) doc.setIn(['agent', 'groups', p], true);
|
|
387
401
|
for (const id of change.off ?? [])
|
|
388
402
|
for (const p of partsOf(id)) doc.setIn(['agent', 'groups', p], false);
|
|
389
|
-
|
|
390
|
-
if (doc.hasIn(['agent', 'groups', old])) {
|
|
391
|
-
for (const p of ALIASES[old])
|
|
392
|
-
if (!doc.hasIn(['agent', 'groups', p]))
|
|
393
|
-
doc.setIn(['agent', 'groups', p], doc.getIn(['agent', 'groups', old]));
|
|
394
|
-
doc.deleteIn(['agent', 'groups', old]);
|
|
395
|
-
}
|
|
403
|
+
retireAliases(doc);
|
|
396
404
|
|
|
397
405
|
const deny = [...new Set([...current.deny_extra, ...(change.deny ?? [])])].filter(
|
|
398
406
|
(r) => !change.undeny?.some((u) => sameRule(parseRule(u), parseRule(r))),
|
package/lib/audit-core.js
CHANGED
|
@@ -403,7 +403,8 @@ const inboxAlerts = (i) => [
|
|
|
403
403
|
i.broken_links.length && `${i.broken_links.length} inbox picture link(s) lead nowhere`,
|
|
404
404
|
i.orphan_dirs.length && `${i.orphan_dirs.length} inbox picture folder(s) without their entry`,
|
|
405
405
|
i.unmigrated.length &&
|
|
406
|
-
`${i.unmigrated.length} inbox entr(ies) from before the categories: ai-factory gcf inbox
|
|
406
|
+
`${i.unmigrated.length} inbox entr(ies) from before the categories: ai-factory gcf inbox ` +
|
|
407
|
+
`migrate`,
|
|
407
408
|
i.unknown_category.length &&
|
|
408
409
|
`${i.unknown_category.length} inbox entr(ies) of a category the vocabulary lacks: ` +
|
|
409
410
|
i.unknown_category.join(', '),
|
package/lib/changes.js
CHANGED
|
@@ -143,6 +143,7 @@ function doubleStar(glob, i) {
|
|
|
143
143
|
return atStart && glob[i + 2] === '/' ? ['(?:.*/)?', 3] : ['.*', 2];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// Every class git's wildmatch knows, as it reads them: ASCII only.
|
|
146
147
|
const CLASSES = {
|
|
147
148
|
alpha: 'a-zA-Z',
|
|
148
149
|
digit: '0-9',
|
|
@@ -150,10 +151,19 @@ const CLASSES = {
|
|
|
150
151
|
upper: 'A-Z',
|
|
151
152
|
lower: 'a-z',
|
|
152
153
|
xdigit: '0-9a-fA-F',
|
|
153
|
-
space: '\\
|
|
154
|
+
space: ' \\t\\n\\r',
|
|
155
|
+
blank: ' \\t',
|
|
154
156
|
punct: '!-\\/:-@\\[-`{-~',
|
|
157
|
+
graph: '!-~',
|
|
158
|
+
print: ' -~',
|
|
159
|
+
cntrl: '\\x00-\\x1f\\x7f',
|
|
155
160
|
};
|
|
156
161
|
|
|
162
|
+
const NAMED_CLASS = /\[:([^\]]*):\]/g;
|
|
163
|
+
|
|
164
|
+
/** A name as git's wildmatch reads it, byte by byte: one letter outside ASCII is several. */
|
|
165
|
+
const asBytes = (s) => Buffer.from(s, 'utf8').toString('latin1');
|
|
166
|
+
|
|
157
167
|
/** Where the bracket at `i` ends, past `[:digit:]` inside it; a first `]` is its own letter. */
|
|
158
168
|
function bracketEnd(glob, i) {
|
|
159
169
|
let at = glob[i + 1] === '!' || glob[i + 1] === '^' ? i + 2 : i + 1;
|
|
@@ -166,14 +176,19 @@ function bracketEnd(glob, i) {
|
|
|
166
176
|
return at < glob.length ? at : -1;
|
|
167
177
|
}
|
|
168
178
|
|
|
169
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* A bracket as a regex: it never takes a `/`, as git's does not. A class git does not know stops
|
|
181
|
+
* its whole pattern there, whatever else the bracket holds.
|
|
182
|
+
*/
|
|
170
183
|
function bracket(glob, i, end) {
|
|
171
184
|
const inner = glob.slice(i + 1, end);
|
|
185
|
+
const named = [...inner.matchAll(NAMED_CLASS)].map((m) => m[1]);
|
|
186
|
+
if (named.some((n) => !Object.hasOwn(CLASSES, n))) return '(?!)';
|
|
172
187
|
const not = /^[!^]/.test(inner);
|
|
173
188
|
const body = (not ? inner.slice(1) : inner)
|
|
174
|
-
.replace(
|
|
189
|
+
.replace(NAMED_CLASS, (_, n) => `\0${n}\0`)
|
|
175
190
|
.replace(/[\\[\]]/g, '\\$&')
|
|
176
|
-
.replace(/\0(\w+)\0/g, (_, n) => CLASSES[n]
|
|
191
|
+
.replace(/\0(\w+)\0/g, (_, n) => CLASSES[n]);
|
|
177
192
|
|
|
178
193
|
return `(?!/)[${not ? '^' : ''}${body}]`;
|
|
179
194
|
}
|
|
@@ -199,7 +214,7 @@ function globPiece(glob, i) {
|
|
|
199
214
|
* @returns {(p: string) => boolean}
|
|
200
215
|
*/
|
|
201
216
|
export function globTest(written) {
|
|
202
|
-
const glob = written.replace(/^(?:\.\/)+/, '');
|
|
217
|
+
const glob = asBytes(written).replace(/^(?:\.\/)+/, '');
|
|
203
218
|
const folder = glob.endsWith('/');
|
|
204
219
|
const bare = folder ? glob.slice(0, -1) : glob;
|
|
205
220
|
const asName = (p) => p.startsWith(`${bare}/`) || (!folder && p === bare);
|
|
@@ -213,9 +228,13 @@ export function globTest(written) {
|
|
|
213
228
|
try {
|
|
214
229
|
const test = new RegExp(`^${re}$`);
|
|
215
230
|
|
|
216
|
-
return (
|
|
231
|
+
return (name) => {
|
|
232
|
+
const p = asBytes(name);
|
|
233
|
+
|
|
234
|
+
return asName(p) || (!folder && test.test(p));
|
|
235
|
+
};
|
|
217
236
|
} catch {
|
|
218
|
-
return asName;
|
|
237
|
+
return (name) => asName(asBytes(name));
|
|
219
238
|
}
|
|
220
239
|
}
|
|
221
240
|
|
package/lib/design-parts.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The design as parts a board edits field by field (Board-PRD §5.24): PILLARS.md, game.md,
|
|
2
|
-
// the project's GLOSSARY.md, a subsystem's purpose, a unit. A part reads as the fields its CNL-P
|
|
2
|
+
// the project's GLOSSARY.md, a subsystem's purpose, a unit. A part reads as the fields its CNL-P
|
|
3
|
+
// profile
|
|
3
4
|
// declares; a save writes the edited fields back into the part's text and brings it in as a
|
|
4
5
|
// one-part bundle (lib/bundle.js), so a form edit passes the same three-way check and the same
|
|
5
6
|
// design check a designer's import does. The board writes no file of gcf/ itself.
|
|
@@ -312,6 +313,7 @@ function changedKeys(before, after) {
|
|
|
312
313
|
|
|
313
314
|
return new Map(blocksOf(lf(t)).map((b) => [b.key, raw.slice(b.start - 1, b.end).join('\n')]));
|
|
314
315
|
};
|
|
316
|
+
|
|
315
317
|
const a = read(before);
|
|
316
318
|
const b = read(after);
|
|
317
319
|
|
|
@@ -348,6 +350,7 @@ function pillarIds(part, given) {
|
|
|
348
350
|
|
|
349
351
|
return { ...p, id };
|
|
350
352
|
}
|
|
353
|
+
|
|
351
354
|
const was = before.find((b) => b.id === p.id);
|
|
352
355
|
if (oneLine(was?.name) && oneLine(p.name) && oneLine(was.name) !== oneLine(p.name)) {
|
|
353
356
|
const to = deriveId(oneLine(p.name), (x) => x !== p.id && taken.has(x), 'pillar');
|
|
@@ -379,7 +382,8 @@ async function refuseLooseForRename(projectDir, renames) {
|
|
|
379
382
|
];
|
|
380
383
|
if (loose.length)
|
|
381
384
|
throw new Error(
|
|
382
|
-
`a new pillar name renames its id where it is cited: record or
|
|
385
|
+
`a new pillar name renames its id where it is cited: record or ` +
|
|
386
|
+
`discard ${loose.join(', ')} first`,
|
|
383
387
|
);
|
|
384
388
|
}
|
|
385
389
|
|
|
@@ -416,7 +420,8 @@ async function saveUnlocked(
|
|
|
416
420
|
let part = await designPart(projectDir, kind, name, { type });
|
|
417
421
|
if (part.exists && !base)
|
|
418
422
|
throw new Error(
|
|
419
|
-
`${kind} ${name} exists: pass --base from gcf design part, so an edit made since is
|
|
423
|
+
`${kind} ${name} exists: pass --base from gcf design part, so an edit made since is ` +
|
|
424
|
+
`not overwritten`,
|
|
420
425
|
);
|
|
421
426
|
const owner = part.system ?? system;
|
|
422
427
|
if (kind === 'unit' && !part.exists && !SLUG_RE.test(String(owner ?? '')))
|
|
@@ -441,6 +446,7 @@ async function saveUnlocked(
|
|
|
441
446
|
part = await designPart(projectDir, kind, name, { type });
|
|
442
447
|
base = part.base;
|
|
443
448
|
}
|
|
449
|
+
|
|
444
450
|
let next = text === null ? null : lf(text).trim();
|
|
445
451
|
if (next === null) {
|
|
446
452
|
const start = part.exists
|
|
@@ -540,7 +546,8 @@ async function bundleMove(
|
|
|
540
546
|
const drafts = unrecorded.filter((f) => own.includes(f));
|
|
541
547
|
if (commit && loose.length)
|
|
542
548
|
throw new Error(
|
|
543
|
-
`${loose.join(', ')} holds changes not recorded yet: record the design first (gcf
|
|
549
|
+
`${loose.join(', ')} holds changes not recorded yet: record the design first (gcf ` +
|
|
550
|
+
`design commit)`,
|
|
544
551
|
);
|
|
545
552
|
let result = { applied: [], report: [] };
|
|
546
553
|
try {
|
|
@@ -628,7 +635,8 @@ async function commitUnlocked(projectDir, { message = null, commit = true } = {}
|
|
|
628
635
|
if (blocking.length) {
|
|
629
636
|
const first = blocking.slice(0, 3).map((i) => `${i.file}:${i.line} ${i.check} ${i.message}`);
|
|
630
637
|
throw new Error(
|
|
631
|
-
`the design check has ${blocking.length} blocking finding(s), fix them
|
|
638
|
+
`the design check has ${blocking.length} blocking finding(s), fix them ` +
|
|
639
|
+
`first:\n${first.join('\n')}`,
|
|
632
640
|
);
|
|
633
641
|
}
|
|
634
642
|
|
package/lib/domain.js
CHANGED
|
@@ -232,11 +232,35 @@ const ITEM_SPECS = {
|
|
|
232
232
|
],
|
|
233
233
|
rare: true,
|
|
234
234
|
},
|
|
235
|
+
// `text` goes on stdin, `add` as an argument: a board sends one field on stdin. `base`: the
|
|
236
|
+
// board fills it from the preview it showed, so a card edited meanwhile is not overwritten.
|
|
237
|
+
amend: {
|
|
238
|
+
label: 'amend',
|
|
239
|
+
help: "Fix the card's text: its next run reads it; its status stays",
|
|
240
|
+
args: ['gcf', 'item', 'amend', '{id}'],
|
|
241
|
+
fields: [
|
|
242
|
+
{ key: 'text', label: 'Blocks to replace', kind: 'longtext', stdin: true },
|
|
243
|
+
{ key: 'add', label: 'Lines to add to notes', kind: 'longtext', max: NOTE_MAX },
|
|
244
|
+
text('title', 'Title'),
|
|
245
|
+
text('from', 'Inbox entry it takes: erased'),
|
|
246
|
+
text('base', 'Read at', { hidden: true }),
|
|
247
|
+
],
|
|
248
|
+
rare: true,
|
|
249
|
+
propose: true,
|
|
250
|
+
// `--dry-run --json` says what it would change: a board shows that before the move.
|
|
251
|
+
preview: true,
|
|
252
|
+
// A human fixing a built card: the fix reaches its next run, not the code it has.
|
|
253
|
+
hint: {
|
|
254
|
+
status: ['awaiting-verdict', 'awaiting-decision', 'parked'],
|
|
255
|
+
text: 'Its code stays as built: the text changes what its next run reads.',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
235
258
|
attach: {
|
|
236
259
|
label: 'attach',
|
|
237
260
|
help: 'Give the item a file (a chat image, a reference): committed in its attachments',
|
|
238
261
|
args: ['gcf', 'item', 'attach', '{id}'],
|
|
239
|
-
// `file`: the board picks it on the operator's machine and sends its bytes; the core gets a
|
|
262
|
+
// `file`: the board picks it on the operator's machine and sends its bytes; the core gets a
|
|
263
|
+
// path.
|
|
240
264
|
fields: [{ key: 'file', label: 'File', kind: 'file', required: true }],
|
|
241
265
|
rare: true,
|
|
242
266
|
},
|
|
@@ -257,7 +281,9 @@ const RUN = {
|
|
|
257
281
|
// shows the proposal, the operator's click makes it.
|
|
258
282
|
const NEW_ITEM = {
|
|
259
283
|
label: 'create',
|
|
260
|
-
help:
|
|
284
|
+
help:
|
|
285
|
+
'A new work item, committed; its id comes from the title; the core refuses a type ' +
|
|
286
|
+
'the phase does not take',
|
|
261
287
|
args: ['gcf', 'item', 'new', '--commit'],
|
|
262
288
|
propose: true,
|
|
263
289
|
fields: [
|
|
@@ -332,7 +358,8 @@ const PART_FIELDS = [
|
|
|
332
358
|
];
|
|
333
359
|
|
|
334
360
|
// The design's moves (Board-PRD §5.24): a part saved from its form or as text, a session's
|
|
335
|
-
// files recorded, a designer's bundle brought back, a new unit, a draft discarded, a pillar
|
|
361
|
+
// files recorded, a designer's bundle brought back, a new unit, a draft discarded, a pillar
|
|
362
|
+
// retired, a unit dropped.
|
|
336
363
|
// Every save goes through the import's three-way check and the design check.
|
|
337
364
|
const DESIGN_SPECS = {
|
|
338
365
|
'design-save': {
|
|
@@ -494,7 +521,9 @@ const STARTS = {
|
|
|
494
521
|
// operator records it, edits it in the form, or discards it.
|
|
495
522
|
'draft-glossary': {
|
|
496
523
|
label: 'Draft with agent',
|
|
497
|
-
help:
|
|
524
|
+
help:
|
|
525
|
+
'A draft of the glossary from the vision and the units: you record it, edit or ' +
|
|
526
|
+
'discard it',
|
|
498
527
|
skill: 'gcf-vision',
|
|
499
528
|
say: 'Draft GLOSSARY.md from the vision and the design units. Write it, do not record it.',
|
|
500
529
|
edits: DESIGN_EDITS,
|
|
@@ -639,6 +668,8 @@ const BLOCK_SPECS = {
|
|
|
639
668
|
{ key: 'text', label: 'Text', kind: 'longtext', required: true },
|
|
640
669
|
CATEGORY('note'),
|
|
641
670
|
DETAIL,
|
|
671
|
+
// Goes with the entry; a board shows it beside the item's name.
|
|
672
|
+
text('item', 'The item it is about', { help: 'A live item, by its id' }),
|
|
642
673
|
],
|
|
643
674
|
propose: true,
|
|
644
675
|
},
|
package/lib/git.js
CHANGED
|
@@ -23,9 +23,11 @@ export function inParts(specs) {
|
|
|
23
23
|
part = [];
|
|
24
24
|
n = 0;
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
part.push(s);
|
|
27
28
|
n += s.length + 1;
|
|
28
29
|
}
|
|
30
|
+
|
|
29
31
|
if (part.length) parts.push(part);
|
|
30
32
|
|
|
31
33
|
return parts;
|
|
@@ -169,11 +171,13 @@ export function restoreFromHead(projectDir, files) {
|
|
|
169
171
|
const r = git(...args);
|
|
170
172
|
if (r.status !== 0) throw new Error(`git ${args.join(' ')}: ${r.stderr.trim()}`);
|
|
171
173
|
};
|
|
174
|
+
|
|
172
175
|
for (const f of files) {
|
|
173
176
|
if (git('cat-file', '-e', `HEAD:./${f}`).status === 0) {
|
|
174
177
|
must('checkout', 'HEAD', '--', literal(projectDir, f));
|
|
175
178
|
continue;
|
|
176
179
|
}
|
|
180
|
+
|
|
177
181
|
must('rm', '--cached', '-q', '--ignore-unmatch', '--', literal(projectDir, f));
|
|
178
182
|
rmSync(path.join(projectDir, f), { force: true });
|
|
179
183
|
}
|
|
@@ -250,7 +254,8 @@ function commitRefusal(message, out) {
|
|
|
250
254
|
'gate',
|
|
251
255
|
{ problems },
|
|
252
256
|
`cannot record ${message}: the gate refuses ${problems.join('; ')}\n` +
|
|
253
|
-
'Nothing was committed. What it names has to change first (the agent can do it), then
|
|
257
|
+
'Nothing was committed. What it names has to change first (the agent can do it), then ' +
|
|
258
|
+
'try again.',
|
|
254
259
|
);
|
|
255
260
|
}
|
|
256
261
|
|
|
@@ -301,6 +306,7 @@ export function commitPaths(projectDir, message, paths, move = {}) {
|
|
|
301
306
|
'commit or discard them, then try again',
|
|
302
307
|
);
|
|
303
308
|
}
|
|
309
|
+
|
|
304
310
|
if (res.status !== 0) throw commitRefusal(message, out);
|
|
305
311
|
|
|
306
312
|
return spawnSync('git', ['rev-parse', 'HEAD'], {
|
|
@@ -329,6 +335,7 @@ export function snapshotIndex(cwd, files) {
|
|
|
329
335
|
if (res.status !== 0) return null;
|
|
330
336
|
stdout += res.stdout;
|
|
331
337
|
}
|
|
338
|
+
|
|
332
339
|
const prefix = spawnSync('git', ['rev-parse', '--show-prefix'], {
|
|
333
340
|
cwd,
|
|
334
341
|
encoding: 'utf8',
|
package/lib/id.js
CHANGED
package/lib/inbox-categories.js
CHANGED
|
@@ -159,6 +159,7 @@ export function mergeVocabulary(base, domain = [], project = []) {
|
|
|
159
159
|
if (!groups.has(r.group)) throw new Error(`inbox category ${r.id}: no group ${r.group}`);
|
|
160
160
|
seen.set(r.id, layer);
|
|
161
161
|
}
|
|
162
|
+
|
|
162
163
|
const rows = [
|
|
163
164
|
...base.map((r) => ({ ...r, layer: 'base' })),
|
|
164
165
|
...domain.map((r) => ({ ...r, layer: 'domain' })),
|
package/lib/inbox.js
CHANGED
|
@@ -91,6 +91,7 @@ export function fromOld({ source, tags = [], kind, item }) {
|
|
|
91
91
|
rest.shift();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
|
|
94
95
|
const lostLater = words.includes('later') && !laterOk ? ['later (never on its category)'] : [];
|
|
95
96
|
|
|
96
97
|
return {
|
|
@@ -341,7 +342,10 @@ export async function planCategory(
|
|
|
341
342
|
const actor = actorOrigin(by);
|
|
342
343
|
if (questionOnly(c) || !c.set_by.length)
|
|
343
344
|
throw new Error(
|
|
344
|
-
`no entry moves into ${c.id}:
|
|
345
|
+
`no entry moves into ${c.id}: ` +
|
|
346
|
+
(c.set_by.length
|
|
347
|
+
? 'it is an open question'
|
|
348
|
+
: 'it is for entries from before the categories'),
|
|
345
349
|
);
|
|
346
350
|
if (actor === 'agent' && !c.set_by.includes('agent'))
|
|
347
351
|
throw new Error(
|
|
@@ -419,6 +423,7 @@ export async function planTake(root, id, toDir) {
|
|
|
419
423
|
|
|
420
424
|
return {
|
|
421
425
|
entry,
|
|
426
|
+
pictures: moves.map((m) => m[1]),
|
|
422
427
|
files: [...drop.files, ...moves.map((m) => m[1])],
|
|
423
428
|
inputs: drop.files,
|
|
424
429
|
apply: async () => {
|