* feat(#961): capability command mechanism — commandFamilies index + default-case dispatch (ADR-857 phase 4d-impl-1) Build the capability command mechanism per ADR-959: the `commands` declaration field on the feature role, the registry commandFamilies index, and a real dispatchCapabilityCommand consulted in runCommand's default case (replacing the dead _dispatchNonFamily shim's role). The registry DISCOVERS a standard route*Command (no rebuilt handler table). On a default-case command, dispatch enforces a bare-.cjs-basename, resolves the module under gsd-core/bin/lib/, asserts confinement, requires the resolved path, and own-property-guards the router export before calling it. A require.main===module guard makes gsd-tools.cjs importable for tests; the CLI path is unchanged. Additive: commandFamilies is empty today, so the default case is behavior- preserving for every command; the 10 dead _dispatchNonFamily sites are untouched (future migration markers). The graphify cutover is the separate next step. Closes #961 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#961): surface capability router failures structurally + enforce sync contract Review follow-up: dispatchCapabilityCommand now wraps the router invocation so an unexpected (non-ExitError) throw is converted to a structured, attributed error(msg, SDK_FAIL_FAST) — honoring --json-errors — instead of escaping as a raw stack trace; an intentional ExitError propagates unchanged. An async router (returns a thenable) is rejected loudly with a structured error (the contract is synchronous, like the 12 host routers). Not shipped as "consistent with existing behavior": the host's pre-existing version of this gap is filed as #965. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
285 lines
5.3 KiB
JavaScript
285 lines
5.3 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* capability-registry.cjs — generated by scripts/gen-capability-registry.cjs
|
|
* DO NOT EDIT BY HAND. Run: node scripts/gen-capability-registry.cjs --write
|
|
* ADR-894 §5 — role-partitioned Capability Registry.
|
|
*/
|
|
|
|
const capabilities = {
|
|
"ui": {
|
|
"id": "ui",
|
|
"role": "feature",
|
|
"title": "UI design contracts",
|
|
"description": "UI-SPEC design contract + retrospective UI audit for frontend phases.",
|
|
"tier": "full",
|
|
"requires": [],
|
|
"skills": [
|
|
"ui-phase",
|
|
"ui-review"
|
|
],
|
|
"agents": [
|
|
"gsd-ui-checker",
|
|
"gsd-ui-auditor"
|
|
],
|
|
"hooks": [],
|
|
"config": {
|
|
"workflow.ui_phase": {
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Enable the UI design-contract gate during planning."
|
|
},
|
|
"workflow.ui_review": {
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Enable the retrospective UI audit."
|
|
},
|
|
"workflow.ui_safety_gate": {
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Block execution on unmet UI-SPEC contracts."
|
|
}
|
|
},
|
|
"steps": [
|
|
{
|
|
"point": "plan:pre",
|
|
"ref": {
|
|
"skill": "ui-phase"
|
|
},
|
|
"produces": [
|
|
"UI-SPEC.md"
|
|
],
|
|
"consumes": [
|
|
"CONTEXT.md"
|
|
],
|
|
"when": "workflow.ui_phase",
|
|
"onError": "skip"
|
|
},
|
|
{
|
|
"point": "verify:post",
|
|
"ref": {
|
|
"skill": "ui-review"
|
|
},
|
|
"produces": [
|
|
"UI-REVIEW.md"
|
|
],
|
|
"consumes": [
|
|
"UI-SPEC.md"
|
|
],
|
|
"when": "workflow.ui_review",
|
|
"onError": "skip"
|
|
}
|
|
],
|
|
"contributions": [],
|
|
"gates": [
|
|
{
|
|
"point": "execute:wave:post",
|
|
"check": {
|
|
"query": "ui.safety-gate"
|
|
},
|
|
"when": "workflow.ui_safety_gate",
|
|
"blocking": true,
|
|
"onError": "halt"
|
|
}
|
|
]
|
|
}
|
|
};
|
|
|
|
const bySkill = {
|
|
"ui-phase": "ui",
|
|
"ui-review": "ui"
|
|
};
|
|
|
|
const byAgent = {
|
|
"gsd-ui-checker": "ui",
|
|
"gsd-ui-auditor": "ui"
|
|
};
|
|
|
|
const byLoopPoint = {
|
|
"discuss:pre": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"discuss:post": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"plan:pre": {
|
|
"steps": [
|
|
{
|
|
"capId": "ui",
|
|
"point": "plan:pre",
|
|
"ref": {
|
|
"skill": "ui-phase"
|
|
},
|
|
"produces": [
|
|
"UI-SPEC.md"
|
|
],
|
|
"consumes": [
|
|
"CONTEXT.md"
|
|
],
|
|
"when": "workflow.ui_phase",
|
|
"onError": "skip"
|
|
}
|
|
],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"plan:post": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"execute:pre": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"execute:wave:pre": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"execute:wave:post": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": [
|
|
{
|
|
"capId": "ui",
|
|
"point": "execute:wave:post",
|
|
"check": {
|
|
"query": "ui.safety-gate"
|
|
},
|
|
"when": "workflow.ui_safety_gate",
|
|
"blocking": true,
|
|
"onError": "halt"
|
|
}
|
|
]
|
|
},
|
|
"execute:post": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"verify:pre": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"verify:post": {
|
|
"steps": [
|
|
{
|
|
"capId": "ui",
|
|
"point": "verify:post",
|
|
"ref": {
|
|
"skill": "ui-review"
|
|
},
|
|
"produces": [
|
|
"UI-REVIEW.md"
|
|
],
|
|
"consumes": [
|
|
"UI-SPEC.md"
|
|
],
|
|
"when": "workflow.ui_review",
|
|
"onError": "skip"
|
|
}
|
|
],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"ship:pre": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
},
|
|
"ship:post": {
|
|
"steps": [],
|
|
"contributions": [],
|
|
"gates": []
|
|
}
|
|
};
|
|
|
|
const configKeys = {
|
|
"workflow.ui_phase": "ui",
|
|
"workflow.ui_review": "ui",
|
|
"workflow.ui_safety_gate": "ui"
|
|
};
|
|
|
|
const configSchema = {
|
|
"workflow.ui_phase": {
|
|
"owner": "ui",
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Enable the UI design-contract gate during planning."
|
|
},
|
|
"workflow.ui_review": {
|
|
"owner": "ui",
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Enable the retrospective UI audit."
|
|
},
|
|
"workflow.ui_safety_gate": {
|
|
"owner": "ui",
|
|
"type": "boolean",
|
|
"default": true,
|
|
"description": "Block execution on unmet UI-SPEC contracts."
|
|
}
|
|
};
|
|
|
|
const runtimes = {};
|
|
|
|
const commandFamilies = {};
|
|
|
|
const capabilityClusters = {
|
|
"ui": [
|
|
"ui-phase",
|
|
"ui-review"
|
|
]
|
|
};
|
|
|
|
const profileMembership = {
|
|
"ui": {
|
|
"tier": "full",
|
|
"profiles": [
|
|
"full"
|
|
]
|
|
}
|
|
};
|
|
|
|
const _requiresGraph = {
|
|
"ui": []
|
|
};
|
|
|
|
function requiresClosure(id) {
|
|
const visited = new Set();
|
|
const queue = [id];
|
|
while (queue.length > 0) {
|
|
const current = queue.shift();
|
|
const reqs = _requiresGraph[current] || [];
|
|
for (const req of reqs) {
|
|
if (!visited.has(req)) {
|
|
visited.add(req);
|
|
queue.push(req);
|
|
}
|
|
}
|
|
}
|
|
return visited;
|
|
}
|
|
|
|
module.exports = {
|
|
version: '1',
|
|
capabilities,
|
|
bySkill,
|
|
byAgent,
|
|
byLoopPoint,
|
|
configKeys,
|
|
configSchema,
|
|
runtimes,
|
|
commandFamilies,
|
|
capabilityClusters,
|
|
profileMembership,
|
|
requiresClosure,
|
|
};
|