Files
msd-core/scripts/lib/alias-drift-families.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

47 lines
2.4 KiB
JavaScript

'use strict';
/**
* Single source of truth for the command-alias drift surface.
*
* Two parallel surfaces consume this: `scripts/check-alias-drift.cjs`, which
* validates the built alias artifacts, and `.githooks/pre-commit`, which decides
* when to run that validation. Until #2725 the hook's watched-path list had
* drifted from the checker's family table until every pattern named either the
* retired `sdk/` tree (ADR-0174) or a gitignored build output, so the guard was
* silently inert. Both surfaces derive from this list now, and
* `tests/precommit-alias-drift-hook.test.cjs` fails if they diverge again.
*/
/**
* Alias families the drift check validates. `router` is the module basename,
* shared by the `src/<router>.cts` source and the `msd-core/bin/lib/<router>.cjs`
* artifact it compiles to.
*/
const FAMILIES = Object.freeze([
{ commandAliases: 'STATE_COMMAND_ALIASES', subcommands: 'STATE_SUBCOMMANDS', router: 'state-command-router' },
{ commandAliases: 'VERIFY_COMMAND_ALIASES', subcommands: 'VERIFY_SUBCOMMANDS', router: 'verify-command-router' },
{ commandAliases: 'INIT_COMMAND_ALIASES', subcommands: 'INIT_SUBCOMMANDS', router: 'init-command-router' },
{ commandAliases: 'PHASE_COMMAND_ALIASES', subcommands: 'PHASE_SUBCOMMANDS', router: 'phase-command-router' },
{ commandAliases: 'PHASES_COMMAND_ALIASES', subcommands: 'PHASES_SUBCOMMANDS', router: 'phases-command-router' },
{ commandAliases: 'VALIDATE_COMMAND_ALIASES', subcommands: 'VALIDATE_SUBCOMMANDS', router: 'validate-command-router' },
{ commandAliases: 'ROADMAP_COMMAND_ALIASES', subcommands: 'ROADMAP_SUBCOMMANDS', router: 'roadmap-command-router' },
{ commandAliases: 'EVAL_COMMAND_ALIASES', subcommands: 'EVAL_SUBCOMMANDS', router: 'eval-command-router' },
].map(Object.freeze));
/** Basename of the generated alias table every family is checked against. */
const ALIAS_TABLE = 'command-aliases';
/**
* Repo-relative TRACKED sources whose edit should re-run the drift check.
*
* Deliberately the `src/*.cts` sources, never the `msd-core/bin/lib/*.cjs`
* build outputs they compile to: those are gitignored, so
* `git diff --cached --name-only` can never list them and a pre-commit guard
* keyed on them can never fire (#2725).
*/
function stagedSourcePaths() {
return [`src/${ALIAS_TABLE}.cts`, ...FAMILIES.map((family) => `src/${family.router}.cts`)];
}
module.exports = { FAMILIES, ALIAS_TABLE, stagedSourcePaths };