gcf-aif-ext 0.3.0 → 0.4.1
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 +63 -11
- package/commands/gcf.js +321 -43
- package/extension.json +22 -5
- package/hooks/pre-commit.js +60 -31
- package/injections/commit-status.md +7 -5
- package/injections/plan-context.md +8 -5
- package/injections/review-pillars.md +4 -3
- package/lib/agents-block.js +66 -0
- package/lib/anchors.js +27 -4
- package/lib/audit-core.js +135 -48
- package/lib/bundle.js +7 -4
- package/lib/context.js +33 -25
- package/lib/design-check.js +149 -40
- package/lib/design.js +2 -2
- package/lib/gcf-paths.js +13 -2
- package/lib/id.js +2 -2
- package/lib/inbox.js +54 -0
- package/lib/index-gen.js +23 -8
- package/lib/ledger.js +19 -17
- package/lib/linter.js +2 -1
- package/lib/live.js +191 -0
- package/lib/pillars.js +113 -0
- package/lib/plan-check.js +31 -0
- package/lib/playtest-list.js +8 -4
- package/lib/systems-doc.js +16 -1
- package/lib/transitions.js +36 -21
- package/lib/unit-ops.js +125 -97
- package/lib/validate-item.js +244 -0
- package/lib/verdict-fs.js +67 -128
- package/lib/work-ops.js +759 -0
- package/package.json +4 -3
- package/profiles/pillars.md +1 -1
- package/profiles/system.md +1 -1
- package/profiles/unit-constraint.md +10 -0
- package/profiles/unit-entity.md +10 -0
- package/profiles/unit-mechanic.md +6 -1
- package/profiles/unit-resource.md +6 -1
- package/profiles/unit-rule.md +10 -0
- package/schemas/item.schema.json +105 -0
- package/skills/gcf-adopt/SKILL.md +2 -2
- package/skills/gcf-audit/SKILL.md +3 -3
- package/skills/gcf-card/SKILL.md +27 -20
- package/skills/gcf-ingest/SKILL.md +3 -3
- package/skills/gcf-init/SKILL.md +8 -5
- package/skills/gcf-triage/SKILL.md +35 -0
- package/skills/gcf-verdict/SKILL.md +19 -16
- package/templates/agents-block.md +28 -0
- package/templates/config.yml +7 -0
- package/templates/{card.md → item.md} +10 -3
- package/lib/validate-card.js +0 -93
- package/schemas/card.schema.json +0 -46
package/lib/validate-card.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// Runtime mirror of schemas/card.schema.json for the pre-commit hook (no ajv in
|
|
2
|
-
// production deps). The parity test keeps the two in agreement.
|
|
3
|
-
const FIELDS = [
|
|
4
|
-
'schema',
|
|
5
|
-
'id',
|
|
6
|
-
'type',
|
|
7
|
-
'title',
|
|
8
|
-
'status',
|
|
9
|
-
'system',
|
|
10
|
-
'depends',
|
|
11
|
-
'pillars',
|
|
12
|
-
'source',
|
|
13
|
-
'reopens',
|
|
14
|
-
'tune_count',
|
|
15
|
-
'built_at',
|
|
16
|
-
'created',
|
|
17
|
-
];
|
|
18
|
-
const OPTIONAL = ['title', 'reopens', 'built_at'];
|
|
19
|
-
const REQUIRED = FIELDS.filter((f) => !OPTIONAL.includes(f));
|
|
20
|
-
const SLUG = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
21
|
-
const slugList = (v) => Array.isArray(v) && v.every((s) => SLUG.test(s));
|
|
22
|
-
const text = (v) => (typeof v === 'string' && v.length > 0) || 'must be a non-empty string';
|
|
23
|
-
|
|
24
|
-
const RULES = {
|
|
25
|
-
// Schema 1 cards (`card-NNN` ids, `slug`, `route`) predate the Design Model: say how to move.
|
|
26
|
-
schema: (v) =>
|
|
27
|
-
v === 2 ||
|
|
28
|
-
(v === 1
|
|
29
|
-
? 'schema 1 card: rename the file to cards/<slug>.md, set id: <slug>, drop slug and route, ' +
|
|
30
|
-
'add type: mechanic and pillars: [], set schema: 2'
|
|
31
|
-
: 'schema must be 2'),
|
|
32
|
-
id: (v) => SLUG.test(v) || 'id must be a lowercase hyphen slug',
|
|
33
|
-
type: (v) =>
|
|
34
|
-
['mechanic', 'resource'].includes(v) ||
|
|
35
|
-
'type must be mechanic or resource (a hard unit never becomes a card)',
|
|
36
|
-
title: (v) => text(v) === true || `title ${text(v)}`,
|
|
37
|
-
status: (v) =>
|
|
38
|
-
['proposed', 'built', 'tuning'].includes(v) ||
|
|
39
|
-
`status "${v}" is not storable (П1: terminal statuses never live in a file)`,
|
|
40
|
-
system: (v) => (slugList(v) && v.length >= 1) || 'system must list >=1 subsystem slugs',
|
|
41
|
-
depends: (v) => slugList(v) || 'depends must list unit ids',
|
|
42
|
-
pillars: (v) => slugList(v) || 'pillars must list pillar ids',
|
|
43
|
-
source: (v) => /^(GDD#[A-Za-z0-9_-]+|manual)$/.test(v) || 'source must be GDD#<id> or manual',
|
|
44
|
-
reopens: (v) => text(v) === true || `reopens ${text(v)}`,
|
|
45
|
-
tune_count: (v) => (Number.isInteger(v) && v >= 0) || 'tune_count must be an integer >= 0',
|
|
46
|
-
built_at: (v) =>
|
|
47
|
-
v === null ||
|
|
48
|
-
v === undefined ||
|
|
49
|
-
/^[0-9a-f]{7,40}$/.test(v) ||
|
|
50
|
-
'built_at must be null or a commit hash',
|
|
51
|
-
created: (v) => /^\d{4}-\d{2}-\d{2}$/.test(dateStr(v)) || 'created must be YYYY-MM-DD',
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const dateStr = (v) => (v instanceof Date ? v.toISOString().slice(0, 10) : String(v));
|
|
55
|
-
|
|
56
|
-
const UNTIL_OK = /^\[until:\s*(verdict\([a-z0-9-]+\)|retune\([a-z0-9-]+\)|manual\([^)]*\))\]$/;
|
|
57
|
-
|
|
58
|
-
/** Validate card frontmatter. Returns a list of one-line errors (empty = valid). */
|
|
59
|
-
export function validateCard(data) {
|
|
60
|
-
const errors = [];
|
|
61
|
-
if (data.schema !== undefined && data.schema !== 2) return [RULES.schema(data.schema)];
|
|
62
|
-
for (const key of REQUIRED) if (!(key in data)) errors.push(`missing field: ${key}`);
|
|
63
|
-
for (const key of Object.keys(data)) {
|
|
64
|
-
if (!FIELDS.includes(key))
|
|
65
|
-
errors.push(
|
|
66
|
-
`unknown field: ${key}` +
|
|
67
|
-
(key === 'until' ? ' (until: is a line annotation, not frontmatter)' : ''),
|
|
68
|
-
);
|
|
69
|
-
else if (key in RULES) {
|
|
70
|
-
const res = RULES[key](data[key]);
|
|
71
|
-
if (res !== true) errors.push(res);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return errors;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Validate every `[until: ...]` annotation in a body against the trigger grammar (§7.3). */
|
|
79
|
-
export function validateUntil(body) {
|
|
80
|
-
const errors = [];
|
|
81
|
-
const lines = String(body).split('\n');
|
|
82
|
-
lines.forEach((line, i) => {
|
|
83
|
-
for (const m of line.matchAll(/\[until:[^\]]*\]/g)) {
|
|
84
|
-
if (!UNTIL_OK.test(m[0]))
|
|
85
|
-
errors.push(
|
|
86
|
-
`line ${i + 1}: bad until annotation ${m[0]} ` +
|
|
87
|
-
'(use verdict(<id>), retune(system) or manual(text))',
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return errors;
|
|
93
|
-
}
|
package/schemas/card.schema.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://github.com/VirtualMaestro/GCF/schemas/card.schema.json",
|
|
4
|
-
"title": "GCF card frontmatter",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"required": [
|
|
8
|
-
"schema",
|
|
9
|
-
"id",
|
|
10
|
-
"type",
|
|
11
|
-
"status",
|
|
12
|
-
"system",
|
|
13
|
-
"depends",
|
|
14
|
-
"pillars",
|
|
15
|
-
"source",
|
|
16
|
-
"tune_count",
|
|
17
|
-
"created"
|
|
18
|
-
],
|
|
19
|
-
"properties": {
|
|
20
|
-
"schema": { "const": 2 },
|
|
21
|
-
"id": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
22
|
-
"type": { "enum": ["mechanic", "resource"] },
|
|
23
|
-
"title": { "type": "string", "minLength": 1 },
|
|
24
|
-
"status": { "enum": ["proposed", "built", "tuning"] },
|
|
25
|
-
"system": {
|
|
26
|
-
"type": "array",
|
|
27
|
-
"minItems": 1,
|
|
28
|
-
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" }
|
|
29
|
-
},
|
|
30
|
-
"depends": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" }
|
|
33
|
-
},
|
|
34
|
-
"pillars": {
|
|
35
|
-
"type": "array",
|
|
36
|
-
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" }
|
|
37
|
-
},
|
|
38
|
-
"source": { "type": "string", "pattern": "^(GDD#[A-Za-z0-9_-]+|manual)$" },
|
|
39
|
-
"reopens": { "type": "string", "minLength": 1 },
|
|
40
|
-
"tune_count": { "type": "integer", "minimum": 0 },
|
|
41
|
-
"built_at": {
|
|
42
|
-
"anyOf": [{ "type": "null" }, { "type": "string", "pattern": "^[0-9a-f]{7,40}$" }]
|
|
43
|
-
},
|
|
44
|
-
"created": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
|
|
45
|
-
}
|
|
46
|
-
}
|