gcf-aif-ext 0.15.0 → 0.18.3
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 +34 -7
- package/commands/gcf.js +218 -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 +41 -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 +406 -36
- package/lib/git.js +13 -6
- package/lib/history.js +1 -0
- package/lib/id.js +47 -0
- package/lib/inbox-categories.js +228 -0
- package/lib/inbox.js +238 -86
- package/lib/integrate.js +14 -2
- package/lib/lessons.js +11 -3
- package/lib/main-lock.js +17 -0
- package/lib/migrate.js +3 -3
- package/lib/transitions.js +2 -0
- package/lib/unit-ops.js +6 -2
- package/lib/validate-item.js +3 -0
- package/lib/work-ops.js +81 -10
- package/package.json +1 -1
- package/profiles/game.md +2 -2
- package/profiles/pillars.md +3 -3
- package/schemas/item.schema.json +1 -0
- package/skills/gcf-adopt/SKILL.md +1 -1
- package/skills/gcf-card/SKILL.md +2 -2
- package/skills/gcf-chat/SKILL.md +8 -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 +14 -6
package/lib/id.js
CHANGED
|
@@ -15,6 +15,53 @@ export function slugify(name) {
|
|
|
15
15
|
return slug;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// Cyrillic to Latin, one way for good: an id is frozen once made, and a test holds this table
|
|
19
|
+
// (Board-PRD decision 34). Ukrainian and Belarusian letters too.
|
|
20
|
+
// prettier-ignore
|
|
21
|
+
const CYRILLIC = {
|
|
22
|
+
а: 'a', б: 'b', в: 'v', г: 'g', ґ: 'g', д: 'd', е: 'e', ё: 'e', є: 'ie', ж: 'zh', з: 'z',
|
|
23
|
+
и: 'i', і: 'i', ї: 'i', й: 'i', к: 'k', л: 'l', м: 'm', н: 'n', о: 'o', п: 'p', р: 'r',
|
|
24
|
+
с: 's', т: 't', у: 'u', ў: 'u', ф: 'f', х: 'kh', ц: 'ts', ч: 'ch', ш: 'sh', щ: 'shch',
|
|
25
|
+
ъ: '', ы: 'y', ь: '', э: 'e', ю: 'iu', я: 'ia',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** `s` in Latin letters: Cyrillic by the table, accents dropped (`é` → `e`). */
|
|
29
|
+
export const transliterate = (s) =>
|
|
30
|
+
[...String(s).toLowerCase().normalize('NFD').replace(/\p{M}/gu, '').normalize('NFC')]
|
|
31
|
+
.map((ch) => CYRILLIC[ch] ?? ch)
|
|
32
|
+
.join('');
|
|
33
|
+
|
|
34
|
+
// About four words: an id names, a title describes.
|
|
35
|
+
const ID_WORDS = 4;
|
|
36
|
+
const ID_CHARS = 32;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The id the system makes from a title (Board-PRD decision 34): transliterated, slugged, cut at
|
|
40
|
+
* a word to 4 words and 32 characters, `-2`, `-3`… while `known(id)` (an id is never reused).
|
|
41
|
+
* A title with nothing to slug gets `<type>-<n>`, the lowest n free.
|
|
42
|
+
* @param {string} title
|
|
43
|
+
* @param {(id: string) => boolean} known
|
|
44
|
+
* @param {string} type
|
|
45
|
+
*/
|
|
46
|
+
export function deriveId(title, known, type) {
|
|
47
|
+
const words = transliterate(title)
|
|
48
|
+
.split(/[^a-z0-9]+/)
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.slice(0, ID_WORDS);
|
|
51
|
+
while (words.length > 1 && words.join('-').length > ID_CHARS) words.pop();
|
|
52
|
+
const base = words.join('-').slice(0, ID_CHARS).replace(/-+$/, '');
|
|
53
|
+
if (!base) {
|
|
54
|
+
let n = 1;
|
|
55
|
+
while (known(`${type}-${n}`)) n++;
|
|
56
|
+
|
|
57
|
+
return `${type}-${n}`;
|
|
58
|
+
}
|
|
59
|
+
let id = base;
|
|
60
|
+
for (let n = 2; known(id); n++) id = `${base}-${n}`;
|
|
61
|
+
|
|
62
|
+
return id;
|
|
63
|
+
}
|
|
64
|
+
|
|
18
65
|
export function isValidId(id) {
|
|
19
66
|
return ID_RE.test(String(id ?? ''));
|
|
20
67
|
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// The inbox's categories (Board-PRD §2.6, decision 32): what a record asks of the operator, one
|
|
2
|
+
// per record from a fixed vocabulary. The vocabulary is data in layers merged in the read: this
|
|
3
|
+
// base fits any product, a domain adds its own rows (lib/domain.js: a game's playtest and tune),
|
|
4
|
+
// a project's rows in gcf/config.yml are reserved. The core checks every add and change against
|
|
5
|
+
// the merged list; the board draws from it and hard-codes none of it.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The screen's groups, top to bottom: Needs you leads and alone counts, the rest waits folded.
|
|
9
|
+
* `order`: `rank` (then the oldest first) or `newest` (the newest first); `holds_later`: the
|
|
10
|
+
* group that holds every record put away to Later, whatever its category.
|
|
11
|
+
*/
|
|
12
|
+
export const GROUPS = [
|
|
13
|
+
{
|
|
14
|
+
id: 'needs-you',
|
|
15
|
+
label: 'Needs you',
|
|
16
|
+
help: 'Only you can move these on: the work, or an agent, waits for you',
|
|
17
|
+
folded: false,
|
|
18
|
+
counts: true,
|
|
19
|
+
order: 'rank',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'to-sort',
|
|
23
|
+
label: 'To sort',
|
|
24
|
+
help: 'Raw input about the product: make an item of it, or erase it',
|
|
25
|
+
folded: false,
|
|
26
|
+
counts: false,
|
|
27
|
+
order: 'rank',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'agent-feedback',
|
|
31
|
+
label: 'Agent feedback',
|
|
32
|
+
help: "What got in the agents' way, and what they assumed: read when you have time",
|
|
33
|
+
folded: true,
|
|
34
|
+
counts: false,
|
|
35
|
+
order: 'rank',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'ideas',
|
|
39
|
+
label: 'Ideas & notes',
|
|
40
|
+
help: 'Your shelf: ideas and notes to turn into work later',
|
|
41
|
+
folded: true,
|
|
42
|
+
counts: false,
|
|
43
|
+
order: 'newest',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'later',
|
|
47
|
+
label: 'Later',
|
|
48
|
+
help: 'What you put away: nothing here asks for you now',
|
|
49
|
+
folded: true,
|
|
50
|
+
counts: false,
|
|
51
|
+
order: 'rank',
|
|
52
|
+
holds_later: true,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
/** Where a record comes from: the channel, not its writer's choice. */
|
|
57
|
+
export const ORIGINS = ['you', 'agent', 'automation'];
|
|
58
|
+
|
|
59
|
+
/** The kinds of an agent's lesson (lib/lessons.js asks one question each): a lesson's details. */
|
|
60
|
+
export const LESSON_KINDS = ['tool', 'rules', 'framework', 'template', 'other'];
|
|
61
|
+
|
|
62
|
+
/** A detail: one lowercase word after the category (`lesson:framework`, `request:asset`). */
|
|
63
|
+
export const DETAIL = /^[a-z0-9][a-z0-9-]{0,29}$/;
|
|
64
|
+
|
|
65
|
+
// `set_by`: the origins that may file it; `question`: a question record only (D1, D2), never an
|
|
66
|
+
// entry. `details`: the closed list, or null for a free one. `later`: whether Later may hold it.
|
|
67
|
+
const row = (id, label, help, rank, group, setBy, { details = null, later = true } = {}) => ({
|
|
68
|
+
id,
|
|
69
|
+
label,
|
|
70
|
+
help,
|
|
71
|
+
rank,
|
|
72
|
+
group,
|
|
73
|
+
set_by: setBy,
|
|
74
|
+
details,
|
|
75
|
+
later,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** The framework's base: any product. */
|
|
79
|
+
export const BASE_CATEGORIES = [
|
|
80
|
+
row(
|
|
81
|
+
'decision',
|
|
82
|
+
'Decision needed',
|
|
83
|
+
'A question only you can answer; the work it holds waits for your answer',
|
|
84
|
+
1,
|
|
85
|
+
'needs-you',
|
|
86
|
+
['question'],
|
|
87
|
+
{ later: false },
|
|
88
|
+
),
|
|
89
|
+
row(
|
|
90
|
+
'failure',
|
|
91
|
+
'Check failed',
|
|
92
|
+
'An automatic check broke on the main line: a CI job, a build, a scheduled test',
|
|
93
|
+
2,
|
|
94
|
+
'needs-you',
|
|
95
|
+
['automation'],
|
|
96
|
+
{ later: false },
|
|
97
|
+
),
|
|
98
|
+
row(
|
|
99
|
+
'request',
|
|
100
|
+
'Agent request',
|
|
101
|
+
'What only a person can give: a file, an asset, an account, an access',
|
|
102
|
+
3,
|
|
103
|
+
'needs-you',
|
|
104
|
+
['agent'],
|
|
105
|
+
),
|
|
106
|
+
row('bug', 'Bug', 'The product does what a rule or a test says it must not', 4, 'to-sort', [
|
|
107
|
+
'you',
|
|
108
|
+
'agent',
|
|
109
|
+
'automation',
|
|
110
|
+
]),
|
|
111
|
+
row(
|
|
112
|
+
'finding',
|
|
113
|
+
'Finding',
|
|
114
|
+
"A remark about the code or the project: a risk, debt, an analyzer's warning, a slow path",
|
|
115
|
+
6,
|
|
116
|
+
'to-sort',
|
|
117
|
+
['agent', 'automation'],
|
|
118
|
+
),
|
|
119
|
+
row(
|
|
120
|
+
'unsorted',
|
|
121
|
+
'Not sorted',
|
|
122
|
+
'An entry from before the categories: give it one',
|
|
123
|
+
7,
|
|
124
|
+
'to-sort',
|
|
125
|
+
[],
|
|
126
|
+
),
|
|
127
|
+
row('lesson', 'Lesson', "What got in an agent's way in its run", 8, 'agent-feedback', ['agent'], {
|
|
128
|
+
details: LESSON_KINDS,
|
|
129
|
+
}),
|
|
130
|
+
// No Later either (the operator, 2026-10-22): it waits folded already, an answer moves it.
|
|
131
|
+
row(
|
|
132
|
+
'assumption',
|
|
133
|
+
'Assumption to check',
|
|
134
|
+
'A decision an agent took and works with; overrule it if it is wrong',
|
|
135
|
+
9,
|
|
136
|
+
'agent-feedback',
|
|
137
|
+
['question'],
|
|
138
|
+
{ later: false },
|
|
139
|
+
),
|
|
140
|
+
row('idea', 'Idea', 'A change someone proposes, not decided', 10, 'ideas', ['you', 'agent']),
|
|
141
|
+
row('note', 'Note', 'A reminder, a plan, a reference', 11, 'ideas', ['you']),
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The vocabulary of layers merged, each row with its `layer`, by rank. A domain or a project row
|
|
146
|
+
* that names a base id, or a group the base lacks, is a mistake of its author: thrown.
|
|
147
|
+
*/
|
|
148
|
+
export function mergeVocabulary(base, domain = [], project = []) {
|
|
149
|
+
const groups = new Set(GROUPS.map((g) => g.id));
|
|
150
|
+
const seen = new Map();
|
|
151
|
+
for (const [layer, rows] of [
|
|
152
|
+
['base', base],
|
|
153
|
+
['domain', domain],
|
|
154
|
+
['project', project],
|
|
155
|
+
])
|
|
156
|
+
for (const r of rows) {
|
|
157
|
+
if (seen.has(r.id))
|
|
158
|
+
throw new Error(`inbox category ${r.id} of the ${layer} is named by the ${seen.get(r.id)}`);
|
|
159
|
+
if (!groups.has(r.group)) throw new Error(`inbox category ${r.id}: no group ${r.group}`);
|
|
160
|
+
seen.set(r.id, layer);
|
|
161
|
+
}
|
|
162
|
+
const rows = [
|
|
163
|
+
...base.map((r) => ({ ...r, layer: 'base' })),
|
|
164
|
+
...domain.map((r) => ({ ...r, layer: 'domain' })),
|
|
165
|
+
...project.map((r) => ({ ...r, layer: 'project' })),
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
return { groups: GROUPS, categories: rows.sort((a, b) => a.rank - b.rank) };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The base alone: what the core files without a domain (an agent's lessons). */
|
|
172
|
+
export const BASE_VOCABULARY = mergeVocabulary(BASE_CATEGORIES);
|
|
173
|
+
|
|
174
|
+
/** Whether a category belongs to question records only: no entry is filed or moved into it. */
|
|
175
|
+
export const questionOnly = (c) => c.set_by.includes('question');
|
|
176
|
+
|
|
177
|
+
/** The categories `origin` may file, by id. */
|
|
178
|
+
export const fileableBy = (vocab, origin) =>
|
|
179
|
+
vocab.categories.filter((c) => c.set_by.includes(origin)).map((c) => c.id);
|
|
180
|
+
|
|
181
|
+
/** Category `id` of the vocabulary, or the refusal that lists the ones there are. */
|
|
182
|
+
export function categoryOf(vocab, id) {
|
|
183
|
+
const c = vocab.categories.find((x) => x.id === id);
|
|
184
|
+
if (!c)
|
|
185
|
+
throw new Error(
|
|
186
|
+
`no inbox category ${id}: ${vocab.categories.map((x) => x.id).join(' | ')} ` +
|
|
187
|
+
'(ai-factory gcf inbox categories)',
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
return c;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Refuse a detail that is not one lowercase word, or not of its category's closed list. */
|
|
194
|
+
export function checkDetail(c, detail) {
|
|
195
|
+
if (detail == null) return;
|
|
196
|
+
if (!DETAIL.test(detail))
|
|
197
|
+
throw new Error(`detail "${detail}" must be one lowercase word up to 30: letters, digits, -`);
|
|
198
|
+
if (c.details && !c.details.includes(detail))
|
|
199
|
+
throw new Error(`a ${c.id}'s detail is ${c.details.join(' | ')}`);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Who makes the move as an origin: an agent's run or session is `agent`, else `you`. */
|
|
203
|
+
export const actorOrigin = (by) => (by === 'operator' ? 'you' : 'agent');
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The lesson kinds met in at least `min` different items, Later left out: an obstacle that
|
|
207
|
+
* repeats is the operator's to remove now (decision 32). Each with its items and records.
|
|
208
|
+
*/
|
|
209
|
+
export function lessonRepeats(entries, min = 3) {
|
|
210
|
+
const by = new Map();
|
|
211
|
+
for (const e of entries) {
|
|
212
|
+
if (e.category !== 'lesson' || e.later || !e.detail || !e.item) continue;
|
|
213
|
+
const r = by.get(e.detail) ?? { items: new Set(), records: [] };
|
|
214
|
+
r.items.add(e.item);
|
|
215
|
+
r.records.push(e.id);
|
|
216
|
+
by.set(e.detail, r);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return [...by]
|
|
220
|
+
.filter(([, r]) => r.items.size >= min)
|
|
221
|
+
.map(([detail, r]) => ({
|
|
222
|
+
category: 'lesson',
|
|
223
|
+
detail,
|
|
224
|
+
count: r.items.size,
|
|
225
|
+
items: [...r.items],
|
|
226
|
+
records: r.records,
|
|
227
|
+
}));
|
|
228
|
+
}
|