feat(#985): intel command cutover — commands-only capability, last first-party family (ADR-857 phase 4d-impl-4) (#988)
* feat(#985): intel command cutover — commands-only capability, last first-party family (ADR-857 phase 4d-impl-4) Migrate the intel CLI command family from a hardcoded gsd-tools.cjs case arm to a registry-dispatched Capability (commandFamilies mechanism, #961), mirroring the graphify (#972) and audit (#984) cutovers. New src/intel-command-router.cts exports routeIntelCommand reproducing all 9 subcommands verbatim (incl. the status timeAgo non-raw post-processing), lazily requiring intel.cjs inside the route fn. capabilities/intel/capability.json declares the intel command family; commands-only (skills:[]), declares the existing intel.enabled gate (default false — behavior unchanged). Behavior-CHANGING (dispatch path) but equivalence-proven: CLI output identical; existing intel.test.cjs passes unchanged. Completes the first-party command- family cutover sequence (graphify/audit/intel). Closes #985 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(#985): compute expected planningDir via path.join in intel cutover unit tests (Windows CI) The intel-command-cutover unit-mock assertions hardcoded a POSIX `/.planning` expectation while the router builds it with path.join(cwd, '.planning') → backslashes on Windows, so the planningDir-arg assertions (query/status/diff/ snapshot/validate/update/api-surface) failed only on windows-latest CI. Compute the expectation with path.join (cross-platform); production router unchanged. 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>
This commit is contained in:
@@ -1436,56 +1436,6 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
|
||||
break;
|
||||
}
|
||||
|
||||
// ─── Intel ────────────────────────────────────────────────────────────
|
||||
|
||||
case 'intel': {
|
||||
const intel = require('./lib/intel.cjs');
|
||||
const subcommand = args[1];
|
||||
if (subcommand === 'query') {
|
||||
const term = args[2];
|
||||
if (!term) error('Usage: gsd-tools intel query <term>', ERROR_REASON.USAGE);
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelQuery(term, planningDir), raw);
|
||||
} else if (subcommand === 'status') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
const status = intel.intelStatus(planningDir);
|
||||
if (!raw && status.files) {
|
||||
for (const file of Object.values(status.files)) {
|
||||
if (file.updated_at) {
|
||||
file.updated_at = core.timeAgo(new Date(file.updated_at));
|
||||
}
|
||||
}
|
||||
}
|
||||
core.output(status, raw);
|
||||
} else if (subcommand === 'diff') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelDiff(planningDir), raw);
|
||||
} else if (subcommand === 'snapshot') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelSnapshot(planningDir), raw);
|
||||
} else if (subcommand === 'patch-meta') {
|
||||
const filePath = args[2];
|
||||
if (!filePath) error('Usage: gsd-tools intel patch-meta <file-path>', ERROR_REASON.USAGE);
|
||||
core.output(intel.intelPatchMeta(path.resolve(cwd, filePath)), raw);
|
||||
} else if (subcommand === 'validate') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelValidate(planningDir), raw);
|
||||
} else if (subcommand === 'extract-exports') {
|
||||
const filePath = args[2];
|
||||
if (!filePath) error('Usage: gsd-tools intel extract-exports <file-path>', ERROR_REASON.USAGE);
|
||||
core.output(intel.intelExtractExports(path.resolve(cwd, filePath)), raw);
|
||||
} else if (subcommand === 'update') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelUpdate(planningDir), raw);
|
||||
} else if (subcommand === 'api-surface') {
|
||||
const planningDir = path.join(cwd, '.planning');
|
||||
core.output(intel.intelApiSurface(planningDir), raw);
|
||||
} else {
|
||||
error('Unknown intel subcommand. Available: query, status, update, diff, snapshot, patch-meta, validate, extract-exports, api-surface', ERROR_REASON.SDK_UNKNOWN_COMMAND);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// ─── Documentation ────────────────────────────────────────────────────
|
||||
|
||||
case 'docs-init': {
|
||||
|
||||
@@ -64,6 +64,34 @@ const capabilities = {
|
||||
"contributions": [],
|
||||
"gates": []
|
||||
},
|
||||
"intel": {
|
||||
"id": "intel",
|
||||
"role": "feature",
|
||||
"title": "Codebase intelligence",
|
||||
"description": "Code-intelligence store for codebase querying, diff, snapshot, and API-surface extraction; exposes `gsd-tools intel` subcommands (query, status, update, diff, snapshot, patch-meta, validate, extract-exports, api-surface) and backs `/gsd-map-codebase` and `gsd-intel-updater`.",
|
||||
"tier": "full",
|
||||
"requires": [],
|
||||
"skills": [],
|
||||
"agents": [],
|
||||
"config": {
|
||||
"intel.enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enable the intel code-intelligence command."
|
||||
}
|
||||
},
|
||||
"commands": [
|
||||
{
|
||||
"family": "intel",
|
||||
"module": "intel-command-router.cjs",
|
||||
"router": "routeIntelCommand"
|
||||
}
|
||||
],
|
||||
"hooks": [],
|
||||
"steps": [],
|
||||
"contributions": [],
|
||||
"gates": []
|
||||
},
|
||||
"ui": {
|
||||
"id": "ui",
|
||||
"role": "feature",
|
||||
@@ -261,6 +289,7 @@ const byLoopPoint = {
|
||||
|
||||
const configKeys = {
|
||||
"graphify.enabled": "graphify",
|
||||
"intel.enabled": "intel",
|
||||
"workflow.ui_phase": "ui",
|
||||
"workflow.ui_review": "ui",
|
||||
"workflow.ui_safety_gate": "ui"
|
||||
@@ -273,6 +302,12 @@ const configSchema = {
|
||||
"default": false,
|
||||
"description": "Enable the graphify knowledge-graph command + skill."
|
||||
},
|
||||
"intel.enabled": {
|
||||
"owner": "intel",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enable the intel code-intelligence command."
|
||||
},
|
||||
"workflow.ui_phase": {
|
||||
"owner": "ui",
|
||||
"type": "boolean",
|
||||
@@ -310,6 +345,11 @@ const commandFamilies = {
|
||||
"capId": "graphify",
|
||||
"module": "graphify-command-router.cjs",
|
||||
"router": "routeGraphifyCommand"
|
||||
},
|
||||
"intel": {
|
||||
"capId": "intel",
|
||||
"module": "intel-command-router.cjs",
|
||||
"router": "routeIntelCommand"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -341,6 +381,7 @@ const profileMembership = {
|
||||
const _requiresGraph = {
|
||||
"audit": [],
|
||||
"graphify": [],
|
||||
"intel": [],
|
||||
"ui": []
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user