* test(3251): red — assert 14 missing commands in command-aliases.generated.cjs Parametrized test covering all 14 commands from issue #3251. Requires the CJS manifest and asserts structurally (never greps source). Currently fails because NON_FAMILY_COMMAND_ALIASES is not exported and all 14 are missing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(3251): add 14 missing commands to command-aliases.generated.cjs Adds NON_FAMILY_COMMAND_ALIASES export to command-aliases.generated.cjs and extends sdk/src/query/command-manifest.non-family.ts with the 10 commands that were registered in static catalogs but absent from the manifest source-of-truth: - check.decision-coverage-plan / check.decision-coverage-verify - frontmatter.get - phase.mvp-mode - progress.bar - stats.json - task.is-behavior-adding - todo.match-phase - uat.render-checkpoint - workstream.list The other 4 (frontmatter.set, learnings.copy, milestone.complete, requirements.mark-complete) were already in non-family.ts but unexported. Generator (sdk/scripts/gen-command-aliases.ts) now produces both the TS and CJS artifacts including the non-family section, sorted by canonical for determinism. Freshness check (sdk/scripts/check-command-aliases-fresh.mjs) verifies TS and CJS non-family parity against the manifest source-of-truth. Fixes #3251 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(3251): add changeset and CHANGELOG entry for PR #3305 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(gen-command-aliases): preserve TS type interfaces and annotations on regen (#3251) - Add FamilyCommandAlias and NonFamilyCommandAlias interface declarations to tsBody so regen never strips them - Replace JSON.stringify with single-line compact serialisers for TS output (matches committed file format) - Apply typed annotations (readonly FamilyCommandAlias[] / readonly NonFamilyCommandAlias[]) to all exported TS constants - CJS path unchanged: remains untyped pure-JS with JSON.stringify multi-line format - Regenerate sdk/src/query/command-aliases.generated.ts to sync with updated generator Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: drop redundant CHANGELOG.md edit (use .changeset/ fragment per CONTRIBUTING.md) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
106 lines
4.2 KiB
JavaScript
106 lines
4.2 KiB
JavaScript
#!/usr/bin/env node
|
|
import { createRequire } from 'node:module';
|
|
import { resolve, dirname } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
|
|
const {
|
|
STATE_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.state.js');
|
|
const {
|
|
VERIFY_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.verify.js');
|
|
const {
|
|
INIT_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.init.js');
|
|
const {
|
|
PHASE_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.phase.js');
|
|
const {
|
|
PHASES_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.phases.js');
|
|
const {
|
|
VALIDATE_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.validate.js');
|
|
const {
|
|
ROADMAP_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.roadmap.js');
|
|
|
|
const {
|
|
STATE_COMMAND_ALIASES,
|
|
VERIFY_COMMAND_ALIASES,
|
|
INIT_COMMAND_ALIASES,
|
|
PHASE_COMMAND_ALIASES,
|
|
PHASES_COMMAND_ALIASES,
|
|
VALIDATE_COMMAND_ALIASES,
|
|
ROADMAP_COMMAND_ALIASES,
|
|
NON_FAMILY_COMMAND_ALIASES,
|
|
} = await import('../dist/query/command-aliases.generated.js');
|
|
|
|
const {
|
|
NON_FAMILY_COMMAND_MANIFEST,
|
|
} = await import('../dist/query/command-manifest.non-family.js');
|
|
|
|
const cjsAliases = require(resolve(here, '..', '..', 'get-shit-done', 'bin', 'lib', 'command-aliases.generated.cjs'));
|
|
|
|
function toAliasEntries(manifest, family) {
|
|
const prefix = `${family}.`;
|
|
return manifest.map((entry) => ({
|
|
canonical: entry.canonical,
|
|
aliases: [...entry.aliases],
|
|
subcommand: entry.canonical.slice(prefix.length),
|
|
mutation: entry.mutation,
|
|
}));
|
|
}
|
|
|
|
function toNonFamilyAliasEntries(manifest) {
|
|
return [...manifest]
|
|
.sort((a, b) => a.canonical.localeCompare(b.canonical))
|
|
.map((entry) => ({
|
|
canonical: entry.canonical,
|
|
aliases: [...entry.aliases],
|
|
mutation: entry.mutation,
|
|
}));
|
|
}
|
|
|
|
function assertEqual(label, actual, expected) {
|
|
const a = JSON.stringify(actual);
|
|
const e = JSON.stringify(expected);
|
|
if (a !== e) {
|
|
throw new Error(
|
|
`${label} drift detected. Regenerate command alias artifacts and commit them.`,
|
|
);
|
|
}
|
|
}
|
|
|
|
const expectedState = toAliasEntries(STATE_COMMAND_MANIFEST, 'state');
|
|
const expectedVerify = toAliasEntries(VERIFY_COMMAND_MANIFEST, 'verify');
|
|
const expectedInit = toAliasEntries(INIT_COMMAND_MANIFEST, 'init');
|
|
const expectedPhase = toAliasEntries(PHASE_COMMAND_MANIFEST, 'phase');
|
|
const expectedPhases = toAliasEntries(PHASES_COMMAND_MANIFEST, 'phases');
|
|
const expectedValidate = toAliasEntries(VALIDATE_COMMAND_MANIFEST, 'validate');
|
|
const expectedRoadmap = toAliasEntries(ROADMAP_COMMAND_MANIFEST, 'roadmap');
|
|
const expectedNonFamily = toNonFamilyAliasEntries(NON_FAMILY_COMMAND_MANIFEST);
|
|
|
|
assertEqual('TS STATE_COMMAND_ALIASES', STATE_COMMAND_ALIASES, expectedState);
|
|
assertEqual('TS VERIFY_COMMAND_ALIASES', VERIFY_COMMAND_ALIASES, expectedVerify);
|
|
assertEqual('TS INIT_COMMAND_ALIASES', INIT_COMMAND_ALIASES, expectedInit);
|
|
assertEqual('TS PHASE_COMMAND_ALIASES', PHASE_COMMAND_ALIASES, expectedPhase);
|
|
assertEqual('TS PHASES_COMMAND_ALIASES', PHASES_COMMAND_ALIASES, expectedPhases);
|
|
assertEqual('TS VALIDATE_COMMAND_ALIASES', VALIDATE_COMMAND_ALIASES, expectedValidate);
|
|
assertEqual('TS ROADMAP_COMMAND_ALIASES', ROADMAP_COMMAND_ALIASES, expectedRoadmap);
|
|
assertEqual('TS NON_FAMILY_COMMAND_ALIASES', NON_FAMILY_COMMAND_ALIASES, expectedNonFamily);
|
|
|
|
assertEqual('CJS STATE_COMMAND_ALIASES', cjsAliases.STATE_COMMAND_ALIASES, expectedState);
|
|
assertEqual('CJS VERIFY_COMMAND_ALIASES', cjsAliases.VERIFY_COMMAND_ALIASES, expectedVerify);
|
|
assertEqual('CJS INIT_COMMAND_ALIASES', cjsAliases.INIT_COMMAND_ALIASES, expectedInit);
|
|
assertEqual('CJS PHASE_COMMAND_ALIASES', cjsAliases.PHASE_COMMAND_ALIASES, expectedPhase);
|
|
assertEqual('CJS PHASES_COMMAND_ALIASES', cjsAliases.PHASES_COMMAND_ALIASES, expectedPhases);
|
|
assertEqual('CJS VALIDATE_COMMAND_ALIASES', cjsAliases.VALIDATE_COMMAND_ALIASES, expectedValidate);
|
|
assertEqual('CJS ROADMAP_COMMAND_ALIASES', cjsAliases.ROADMAP_COMMAND_ALIASES, expectedRoadmap);
|
|
assertEqual('CJS NON_FAMILY_COMMAND_ALIASES', cjsAliases.NON_FAMILY_COMMAND_ALIASES, expectedNonFamily);
|
|
|
|
console.log('command alias artifacts are fresh');
|