@opengsd/gsd-core 1.9.0 → 1.10.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +2 -3
- package/.opencode/plugins/gsd-core.js +8 -1
- package/agents/gsd-code-fixer.md +131 -34
- package/agents/gsd-debugger.md +12 -246
- package/agents/gsd-executor.md +7 -5
- package/agents/gsd-integration-checker.md +3 -0
- package/agents/gsd-plan-checker.md +9 -0
- package/agents/gsd-planner.md +5 -8
- package/agents/gsd-roadmapper.md +21 -3
- package/agents/gsd-verifier.md +14 -70
- package/bin/install.js +503 -341
- package/commands/gsd/mempalace-capture.md +1 -1
- package/commands/gsd/new-milestone.md +1 -1
- package/commands/gsd/plan-phase.md +1 -1
- package/gsd-core/bin/gsd-tools.cjs +607 -63
- package/gsd-core/bin/lib/active-workstream-store.cjs +25 -0
- package/gsd-core/bin/lib/agent-install-check.cjs +38 -6
- package/gsd-core/bin/lib/api-coverage.cjs +120 -0
- package/gsd-core/bin/lib/audit.cjs +89 -1
- package/gsd-core/bin/lib/broken-windows.cjs +36 -6
- package/gsd-core/bin/lib/capability-registry.cjs +96 -110
- package/gsd-core/bin/lib/capability-validator.cjs +12 -2
- package/gsd-core/bin/lib/check-command-router.cjs +43 -1
- package/gsd-core/bin/lib/command-aliases.cjs +72 -0
- package/gsd-core/bin/lib/commands.cjs +26 -25
- package/gsd-core/bin/lib/commonjs-marker.cjs +136 -0
- package/gsd-core/bin/lib/config-loader.cjs +1 -0
- package/gsd-core/bin/lib/config.cjs +12 -1
- package/gsd-core/bin/lib/context-composer.cjs +278 -0
- package/gsd-core/bin/lib/context-predicates.cjs +506 -0
- package/gsd-core/bin/lib/core-utils.cjs +91 -12
- package/gsd-core/bin/lib/docs.cjs +3 -2
- package/gsd-core/bin/lib/external-job.cjs +19 -4
- package/gsd-core/bin/lib/frontmatter.cjs +84 -12
- package/gsd-core/bin/lib/gate-predicate-evaluator.cjs +57 -6
- package/gsd-core/bin/lib/git-base-branch.cjs +58 -15
- package/gsd-core/bin/lib/graphify.cjs +142 -27
- package/gsd-core/bin/lib/gsd2-import.cjs +27 -4
- package/gsd-core/bin/lib/host-integration.cjs +13 -1
- package/gsd-core/bin/lib/init-command-router.cjs +83 -8
- package/gsd-core/bin/lib/init.cjs +1021 -57
- package/gsd-core/bin/lib/install-engine.cjs +64 -10
- package/gsd-core/bin/lib/install-profiles.cjs +27 -1
- package/gsd-core/bin/lib/installer-migration-authoring.cjs +3 -1
- package/gsd-core/bin/lib/installer-migration-report.cjs +4 -0
- package/gsd-core/bin/lib/installer-migrations/007-retire-config-root-commonjs-marker.cjs +149 -0
- package/gsd-core/bin/lib/installer-migrations/008-cursor-retire-commands-surface.cjs +55 -0
- package/gsd-core/bin/lib/installer-migrations/009-pi-retire-reserved-hooks-dir.cjs +199 -0
- package/gsd-core/bin/lib/installer-migrations.cjs +87 -1
- package/gsd-core/bin/lib/io.cjs +28 -3
- package/gsd-core/bin/lib/markdown-sectionizer.cjs +6 -0
- package/gsd-core/bin/lib/mcp-catalog.cjs +518 -0
- package/gsd-core/bin/lib/mcp-server.cjs +135 -3
- package/gsd-core/bin/lib/milestone.cjs +106 -51
- package/gsd-core/bin/lib/phase-id.cjs +63 -0
- package/gsd-core/bin/lib/phase-locator.cjs +138 -45
- package/gsd-core/bin/lib/phase.cjs +260 -25
- package/gsd-core/bin/lib/plan-dependency-graph.cjs +232 -0
- package/gsd-core/bin/lib/planning-workspace.cjs +4 -0
- package/gsd-core/bin/lib/project-root.cjs +48 -0
- package/gsd-core/bin/lib/prompt-budget.cjs +128 -165
- package/gsd-core/bin/lib/retired-artifact-cleanup.cjs +80 -0
- package/gsd-core/bin/lib/review-lane-descriptor.cjs +99 -0
- package/gsd-core/bin/lib/review-lane-runner.cjs +30 -6
- package/gsd-core/bin/lib/roadmap-command-router.cjs +42 -9
- package/gsd-core/bin/lib/roadmap-parser.cjs +100 -18
- package/gsd-core/bin/lib/roadmap.cjs +37 -7
- package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +195 -62
- package/gsd-core/bin/lib/runtime-artifact-layout.cjs +15 -3
- package/gsd-core/bin/lib/runtime-homes.cjs +154 -41
- package/gsd-core/bin/lib/runtime-hooks-surface.cjs +105 -41
- package/gsd-core/bin/lib/section-manifest.cjs +209 -0
- package/gsd-core/bin/lib/shell-command-projection.cjs +113 -27
- package/gsd-core/bin/lib/smart-entry.cjs +12 -0
- package/gsd-core/bin/lib/state-transition.cjs +73 -8
- package/gsd-core/bin/lib/state.cjs +151 -62
- package/gsd-core/bin/lib/surface.cjs +12 -1
- package/gsd-core/bin/lib/uat-predicate.cjs +11 -1
- package/gsd-core/bin/lib/uat.cjs +320 -21
- package/gsd-core/bin/lib/unusable-input.cjs +9 -0
- package/gsd-core/bin/lib/verification.cjs +29 -12
- package/gsd-core/bin/lib/verify.cjs +29 -5
- package/gsd-core/bin/lib/workflow-fragments.cjs +557 -0
- package/gsd-core/bin/lib/workstream-inventory-builder.cjs +181 -18
- package/gsd-core/bin/lib/workstream-inventory.cjs +519 -27
- package/gsd-core/bin/lib/workstream.cjs +6 -0
- package/gsd-core/bin/lib/worktree-base-ref.cjs +50 -6
- package/gsd-core/bin/lib/worktree-safety.cjs +276 -118
- package/gsd-core/bin/shared/config-schema.manifest.json +2 -0
- package/gsd-core/references/artifact-types.md +10 -3
- package/gsd-core/references/autonomous-ui-design-contract.md +42 -0
- package/gsd-core/references/debugger-techniques.md +255 -0
- package/gsd-core/references/research-documentation-lookup.md +5 -3
- package/gsd-core/references/specless-probe-fallback.md +7 -6
- package/gsd-core/references/verifier-wiring-patterns.md +100 -0
- package/gsd-core/references/worktree-branch-check.md +2 -2
- package/gsd-core/templates/summary-complex.md +2 -0
- package/gsd-core/templates/summary-minimal.md +2 -0
- package/gsd-core/templates/summary-standard.md +2 -0
- package/gsd-core/templates/summary.md +2 -0
- package/gsd-core/workflows/audit-milestone.md +3 -0
- package/gsd-core/workflows/autonomous/steps/converge-banner.md +1 -0
- package/gsd-core/workflows/autonomous/steps/converge-dispatch-bg.md +11 -0
- package/gsd-core/workflows/autonomous/steps/converge-dispatch-inline.md +7 -0
- package/gsd-core/workflows/autonomous/steps/converge-fail-fast.md +21 -0
- package/gsd-core/workflows/autonomous/steps/converge-loop.md +7 -0
- package/gsd-core/workflows/autonomous.md +32 -69
- package/gsd-core/workflows/code-review/steps/dispatch-fix.md +39 -0
- package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +83 -0
- package/gsd-core/workflows/code-review.md +42 -145
- package/gsd-core/workflows/complete-milestone/steps/git-tag.md +29 -0
- package/gsd-core/workflows/complete-milestone.md +23 -81
- package/gsd-core/workflows/debug.md +9 -12
- package/gsd-core/workflows/diagnose-issues.md +22 -0
- package/gsd-core/workflows/discovery-phase.md +4 -4
- package/gsd-core/workflows/discuss-phase-assumptions/steps/auto-advance-dispatch.md +15 -0
- package/gsd-core/workflows/discuss-phase-assumptions.md +5 -16
- package/gsd-core/workflows/docs-update/steps/dispatch-monorepo-packages.md +51 -0
- package/gsd-core/workflows/docs-update.md +8 -51
- package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +34 -2
- package/gsd-core/workflows/execute-phase/steps/gap-closure-artifacts.md +50 -0
- package/gsd-core/workflows/execute-phase/steps/partial-wave.md +31 -0
- package/gsd-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +19 -0
- package/gsd-core/workflows/execute-phase/steps/regression-gate-run.md +42 -0
- package/gsd-core/workflows/execute-phase/steps/regression-gate.md +43 -37
- package/gsd-core/workflows/execute-phase.md +65 -137
- package/gsd-core/workflows/execute-plan.md +1 -1
- package/gsd-core/workflows/help/modes/full.md +6 -1
- package/gsd-core/workflows/ingest-docs.md +2 -1
- package/gsd-core/workflows/new-milestone/steps/project-md-milestone-write.md +16 -0
- package/gsd-core/workflows/new-milestone/steps/reset-phase-safety.md +19 -0
- package/gsd-core/workflows/new-milestone.md +21 -38
- package/gsd-core/workflows/new-project/steps/auto-mode-config.md +176 -0
- package/gsd-core/workflows/new-project/steps/auto-mode-detection.md +32 -0
- package/gsd-core/workflows/new-project/steps/codebase-map-offer.md +18 -0
- package/gsd-core/workflows/new-project.md +13 -226
- package/gsd-core/workflows/plan-phase/steps/adr-ingest-express-path.md +15 -0
- package/gsd-core/workflows/plan-phase/steps/chunked-planning-mode.md +110 -0
- package/gsd-core/workflows/plan-phase/steps/prd-express-gate.md +8 -0
- package/gsd-core/workflows/plan-phase/steps/research-only-early-exit.md +17 -0
- package/gsd-core/workflows/plan-phase/steps/research-only-modifiers.md +16 -0
- package/gsd-core/workflows/plan-phase/steps/reviews-prerequisite.md +17 -0
- package/gsd-core/workflows/plan-phase/steps/stall-detection-helpers.md +149 -0
- package/gsd-core/workflows/plan-phase.md +49 -193
- package/gsd-core/workflows/progress/steps/forensic-audit.md +125 -0
- package/gsd-core/workflows/progress/steps/mvp-display.md +18 -0
- package/gsd-core/workflows/progress.md +11 -153
- package/gsd-core/workflows/quick/steps/discussion-phase.md +124 -0
- package/gsd-core/workflows/quick/steps/plan-checker-loop.md +111 -0
- package/gsd-core/workflows/quick/steps/quick-verification.md +46 -0
- package/gsd-core/workflows/quick/steps/research-phase.md +72 -0
- package/gsd-core/workflows/quick/steps/worktree-pre-dispatch-commit.md +37 -0
- package/gsd-core/workflows/quick.md +20 -390
- package/gsd-core/workflows/resume-project.md +3 -0
- package/gsd-core/workflows/review/steps/reviewer-instances-note-1.md +4 -0
- package/gsd-core/workflows/review/steps/reviewer-instances-note-2.md +3 -0
- package/gsd-core/workflows/review.md +15 -8
- package/gsd-core/workflows/section-manifest.json +219 -0
- package/gsd-core/workflows/sketch.md +1 -1
- package/gsd-core/workflows/spec-phase.md +17 -14
- package/gsd-core/workflows/spike-wrap-up.md +20 -5
- package/gsd-core/workflows/spike.md +50 -16
- package/gsd-core/workflows/sync-skills.md +49 -11
- package/gsd-core/workflows/transition/steps/workstream-collision-check.md +17 -0
- package/gsd-core/workflows/transition.md +8 -21
- package/gsd-core/workflows/ui-phase.md +8 -7
- package/gsd-core/workflows/update/steps/channel-banner.md +7 -0
- package/gsd-core/workflows/update.md +18 -7
- package/gsd-core/workflows/verify-phase.md +4 -7
- package/gsd-core/workflows/verify-work/steps/automated-ui-verification.md +36 -0
- package/gsd-core/workflows/verify-work/steps/mvp-uat-framing.md +21 -0
- package/gsd-core/workflows/verify-work.md +8 -58
- package/hooks/dist/gsd-agent-isolation-guard.js +428 -0
- package/hooks/dist/gsd-check-update-worker.js +14 -5
- package/hooks/dist/gsd-cursor-subagent-start.js +532 -26
- package/hooks/dist/gsd-read-injection-scanner.js +7 -0
- package/hooks/dist/gsd-statusline.js +72 -6
- package/hooks/dist/gsd-worktree-path-guard.js +2 -1
- package/hooks/dist/gsd-write-guard.js +359 -0
- package/hooks/dist/lib/isolation-sentinel.js +268 -0
- package/hooks/dist/managed-hooks-registry.cjs +2 -0
- package/hooks/gsd-agent-isolation-guard.js +428 -0
- package/hooks/gsd-check-update-worker.js +14 -5
- package/hooks/gsd-cursor-subagent-start.js +532 -26
- package/hooks/gsd-read-injection-scanner.js +7 -0
- package/hooks/gsd-statusline.js +72 -6
- package/hooks/gsd-worktree-path-guard.js +2 -1
- package/hooks/gsd-write-guard.js +359 -0
- package/hooks/hooks.json +12 -0
- package/hooks/lib/isolation-sentinel.js +268 -0
- package/hooks/managed-hooks-registry.cjs +2 -0
- package/package.json +14 -5
- package/pi/gsd.cjs +57 -12
- package/scripts/build-hooks.js +9 -0
- package/scripts/changeset/lint.cjs +9 -2
- package/scripts/changeset/serialize.cjs +5 -1
- package/scripts/gen-capability-matrix.cjs +1 -1
- package/scripts/gen-context-index.cjs +448 -0
- package/scripts/gen-inventory-manifest.cjs +101 -1
- package/scripts/gen-prompt-budget-parity-corpus.cjs +645 -0
- package/scripts/gen-registry.cjs +39 -15
- package/scripts/gen-section-manifest.cjs +638 -0
- package/scripts/generate-package-identity.cjs +4 -2
- package/scripts/lint-allow-test-rule-refs.allowlist.json +17 -31
- package/scripts/lint-compiled-artifact-sync.cjs +6 -1
- package/scripts/lint-docs-command-form.cjs +195 -0
- package/scripts/lint-docs-required.cjs +9 -1
- package/scripts/lint-emitted-drift-ack.cjs +215 -20
- package/scripts/lint-example-parser-parity.cjs +395 -0
- package/scripts/lint-test-file-count.allowlist.json +27 -1
- package/scripts/mutation-matrix.cjs +13 -0
- package/scripts/prompt-injection-scan.sh +27 -6
- package/scripts/registry-schema.cjs +323 -94
- package/scripts/run-tests.cjs +3 -2
- package/scripts/validate-registry.cjs +10 -6
- package/skills/gsd-autonomous/SKILL.md +1 -1
- package/skills/gsd-execute-phase/SKILL.md +1 -1
- package/skills/gsd-mempalace-capture/SKILL.md +1 -1
- package/skills/gsd-new-milestone/SKILL.md +1 -1
- package/skills/gsd-plan-phase/SKILL.md +2 -2
- package/vscode/package.json +1 -1
- package/scripts/gen-emitted-baseline.cjs +0 -145
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* gen-context-index.cjs — generates docs/CONTEXT-INDEX.json from the
|
|
6
|
+
* predicate declarations (`` `CLASS.subkey=value` `` lines) in the
|
|
7
|
+
* repo-root CONTEXT.md.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node scripts/gen-context-index.cjs # print to stdout
|
|
11
|
+
* node scripts/gen-context-index.cjs --write # write docs/CONTEXT-INDEX.json
|
|
12
|
+
* node scripts/gen-context-index.cjs --check # exit 1 if committed file is stale
|
|
13
|
+
* node scripts/gen-context-index.cjs --check --json # same, + typed report on stdout
|
|
14
|
+
* node scripts/gen-context-index.cjs --write --context-path <p> --index-path <p>
|
|
15
|
+
* # override the two hardcoded
|
|
16
|
+
* # repo-root paths (tests use
|
|
17
|
+
* # this to point the real CLI at
|
|
18
|
+
* # a temp fixture tree with no fs
|
|
19
|
+
* # monkeypatching required)
|
|
20
|
+
*
|
|
21
|
+
* ADR-1671 ("Dynamic context management platform", #2928) Phase 1 commits 1+3.
|
|
22
|
+
* The generated artifact is plain JSON (docs/CONTEXT-INDEX.json), mirroring
|
|
23
|
+
* docs/INVENTORY-MANIFEST.json's precedent: a committed, generated,
|
|
24
|
+
* `--check`-guarded JSON manifest that is NOT runtime code. It previously
|
|
25
|
+
* lived at gsd-core/bin/lib/context-index.cjs — a shipped runtime module is
|
|
26
|
+
* the wrong place for ~120 KB of arbitrary CONTEXT.md prose: it tripped both
|
|
27
|
+
* tests/cline-install.test.cjs's leaked-`.claude`-path guard and
|
|
28
|
+
* tests/package-name-single-source.test.cjs's hardcoded-package-name guard,
|
|
29
|
+
* both true positives against runtime-code content scanning. Moving the
|
|
30
|
+
* artifact to docs/ (never scanned as runtime code) fixes both without
|
|
31
|
+
* weakening either guard.
|
|
32
|
+
*
|
|
33
|
+
* Depends on the COMPILED gsd-core/bin/lib/context-predicates.cjs
|
|
34
|
+
* (src/context-predicates.cts, built by `npm run build:lib`). This is safe
|
|
35
|
+
* for CI: `.github/workflows/test.yml` runs `build:lib` before `lint:ci`.
|
|
36
|
+
*
|
|
37
|
+
* `--check --json` (CONTRIBUTING.md "Prohibited: Raw Text Matching on Test
|
|
38
|
+
* Outputs"): emits `{ ok, reason, duplicates, count, classes }` — `reason` is
|
|
39
|
+
* always one of the frozen `REASON` values (exported below) so tests assert
|
|
40
|
+
* `report.reason === REASON.FAIL_X` instead of regex-matching the prose the
|
|
41
|
+
* non-JSON mode still prints for human operators. The human-readable output
|
|
42
|
+
* is unchanged.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const fs = require('node:fs');
|
|
46
|
+
const path = require('node:path');
|
|
47
|
+
|
|
48
|
+
const { ExitError, runMain } = require('./lib/cli-exit.cjs');
|
|
49
|
+
|
|
50
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
51
|
+
const CONTEXT_PREDICATES_LIB_PATH = path.join(ROOT, 'gsd-core', 'bin', 'lib', 'context-predicates.cjs');
|
|
52
|
+
const CONTEXT_PATH = path.join(ROOT, 'CONTEXT.md');
|
|
53
|
+
const INDEX_PATH = path.join(ROOT, 'docs', 'CONTEXT-INDEX.json');
|
|
54
|
+
|
|
55
|
+
// ─── Typed reason enum (CONTRIBUTING.md "Prohibited: Raw Text Matching") ───────
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Stable reason codes for `checkReport`'s `reason` field. Tests assert via
|
|
59
|
+
* `assert.equal(report.reason, REASON.X)` rather than regex-matching the
|
|
60
|
+
* human-readable prose the non-JSON `--check` mode still writes to
|
|
61
|
+
* stdout/stderr, so the diagnostic surface is a typed enum, not free text.
|
|
62
|
+
*
|
|
63
|
+
* Adding a new reason requires updating this map AND the tests' shape
|
|
64
|
+
* assertion that locks the documented set of codes
|
|
65
|
+
* (`Object.keys(REASON).sort()`).
|
|
66
|
+
*/
|
|
67
|
+
const REASON = Object.freeze({
|
|
68
|
+
OK_UP_TO_DATE: 'ok_up_to_date',
|
|
69
|
+
FAIL_STALE: 'fail_stale',
|
|
70
|
+
FAIL_INDEX_MISSING: 'fail_index_missing',
|
|
71
|
+
FAIL_INDEX_UNPARSEABLE: 'fail_index_unparseable',
|
|
72
|
+
FAIL_DUPLICATE_IDS: 'fail_duplicate_ids',
|
|
73
|
+
FAIL_CONTEXT_MISSING: 'fail_context_missing',
|
|
74
|
+
FAIL_CONTEXT_UNREADABLE: 'fail_context_unreadable',
|
|
75
|
+
FAIL_LIB_NOT_BUILT: 'fail_lib_not_built',
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// ─── Loaders ──────────────────────────────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Load the compiled context-predicates library. The artifact is a gitignored
|
|
82
|
+
* tsc build output of src/context-predicates.cts and only exists after
|
|
83
|
+
* `npm run build:lib`. Throws a clean ExitError (never a bare
|
|
84
|
+
* MODULE_NOT_FOUND stack) naming the remedy when it is missing.
|
|
85
|
+
*
|
|
86
|
+
* @returns {{ parsePredicates: Function, selectPredicates: Function, buildIndex: Function }}
|
|
87
|
+
*/
|
|
88
|
+
function loadContextPredicatesLib() {
|
|
89
|
+
try {
|
|
90
|
+
delete require.cache[require.resolve(CONTEXT_PREDICATES_LIB_PATH)];
|
|
91
|
+
return require(CONTEXT_PREDICATES_LIB_PATH);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
throw new ExitError(
|
|
94
|
+
1,
|
|
95
|
+
`Cannot load ${path.relative(ROOT, CONTEXT_PREDICATES_LIB_PATH)}: ${err && err.message}\n` +
|
|
96
|
+
'Run:\n npm run build:lib\n',
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Read a CONTEXT.md-shaped markdown file. Throws a clean ExitError naming the
|
|
103
|
+
* path (never a bare stack trace) when it is missing or unreadable.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} [contextPath] - defaults to the real repo-root CONTEXT.md.
|
|
106
|
+
* @returns {string}
|
|
107
|
+
*/
|
|
108
|
+
function readContextMarkdown(contextPath = CONTEXT_PATH) {
|
|
109
|
+
try {
|
|
110
|
+
return fs.readFileSync(contextPath, 'utf8');
|
|
111
|
+
} catch (err) {
|
|
112
|
+
throw new ExitError(1, `Cannot read ${path.relative(ROOT, contextPath)}: ${err && err.message}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Build a fresh ContextIndex from the given CONTEXT.md-shaped content.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} [contextPath] - defaults to the real repo-root CONTEXT.md.
|
|
120
|
+
* @returns {object}
|
|
121
|
+
*/
|
|
122
|
+
function buildFreshIndex(contextPath = CONTEXT_PATH) {
|
|
123
|
+
const { parsePredicates, buildIndex } = loadContextPredicatesLib();
|
|
124
|
+
const markdown = readContextMarkdown(contextPath);
|
|
125
|
+
const { predicates } = parsePredicates(markdown);
|
|
126
|
+
return buildIndex(predicates);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ─── Serialization ────────────────────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Serialize a ContextIndex to the committed plain-JSON artifact text
|
|
133
|
+
* (docs/CONTEXT-INDEX.json). Plain JSON — not a CommonJS module — because
|
|
134
|
+
* this is a generated data manifest (mirroring docs/INVENTORY-MANIFEST.json),
|
|
135
|
+
* not runtime code: it must never be `require()`-able from a shipped
|
|
136
|
+
* gsd-core/bin/lib/*.cjs module, which is exactly the mistake that leaked
|
|
137
|
+
* ~120 KB of CONTEXT.md prose (including `.claude/hooks/...` path literals
|
|
138
|
+
* and hardcoded package-name strings) into runtime-code content scanning.
|
|
139
|
+
*
|
|
140
|
+
* @param {object} index
|
|
141
|
+
* @returns {string}
|
|
142
|
+
*/
|
|
143
|
+
function serializeIndex(index) {
|
|
144
|
+
return JSON.stringify(index, null, 2) + '\n';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Normalize line endings to LF for CRLF-agnostic full-content comparison.
|
|
149
|
+
*
|
|
150
|
+
* @param {string} content
|
|
151
|
+
* @returns {string}
|
|
152
|
+
*/
|
|
153
|
+
function normalizeLineEndings(content) {
|
|
154
|
+
return content.replace(/\r/g, '');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Extract the sorted list of duplicate predicate ids from a built index.
|
|
159
|
+
*
|
|
160
|
+
* @param {{ duplicates: Array<{ id: string, count: number }> }} index
|
|
161
|
+
* @returns {string[]}
|
|
162
|
+
*/
|
|
163
|
+
function duplicateIds(index) {
|
|
164
|
+
return index.duplicates.map((d) => d.id);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ─── Typed check report ───────────────────────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Empty-report shape shared by every early-exit branch below, so callers
|
|
171
|
+
* (JSON mode, tests) always see the same four data fields regardless of
|
|
172
|
+
* which reason fired.
|
|
173
|
+
*
|
|
174
|
+
* @returns {{ duplicates: Array, count: number, classes: object }}
|
|
175
|
+
*/
|
|
176
|
+
function emptyReportFields() {
|
|
177
|
+
return { duplicates: [], count: 0, classes: {} };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Compute the full `--check` result as a typed, non-throwing report — the
|
|
182
|
+
* structured intermediate representation CONTRIBUTING.md's "Prohibited: Raw
|
|
183
|
+
* Text Matching on Test Outputs" section requires alongside the human prose
|
|
184
|
+
* `main()` still prints. Never throws; every failure mode is a `reason` code
|
|
185
|
+
* from the frozen `REASON` enum.
|
|
186
|
+
*
|
|
187
|
+
* @param {string} [contextPath] - defaults to the real repo-root CONTEXT.md.
|
|
188
|
+
* @param {string} [indexPath] - defaults to the real committed index.
|
|
189
|
+
* @returns {{ ok: boolean, reason: string, duplicates: Array<{id:string,count:number}>, count: number, classes: object, message: string }}
|
|
190
|
+
*/
|
|
191
|
+
function checkReport(contextPath = CONTEXT_PATH, indexPath = INDEX_PATH) {
|
|
192
|
+
let markdown;
|
|
193
|
+
try {
|
|
194
|
+
markdown = fs.readFileSync(contextPath, 'utf8');
|
|
195
|
+
} catch (err) {
|
|
196
|
+
const reason = err && err.code === 'ENOENT' ? REASON.FAIL_CONTEXT_MISSING : REASON.FAIL_CONTEXT_UNREADABLE;
|
|
197
|
+
return {
|
|
198
|
+
ok: false,
|
|
199
|
+
reason,
|
|
200
|
+
...emptyReportFields(),
|
|
201
|
+
message: `Cannot read ${path.relative(ROOT, contextPath)}: ${err && err.message}`,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let parsePredicates;
|
|
206
|
+
let buildIndex;
|
|
207
|
+
try {
|
|
208
|
+
delete require.cache[require.resolve(CONTEXT_PREDICATES_LIB_PATH)];
|
|
209
|
+
({ parsePredicates, buildIndex } = require(CONTEXT_PREDICATES_LIB_PATH));
|
|
210
|
+
} catch (err) {
|
|
211
|
+
return {
|
|
212
|
+
ok: false,
|
|
213
|
+
reason: REASON.FAIL_LIB_NOT_BUILT,
|
|
214
|
+
...emptyReportFields(),
|
|
215
|
+
message: `Cannot load ${path.relative(ROOT, CONTEXT_PREDICATES_LIB_PATH)}: ${err && err.message}\n` +
|
|
216
|
+
'Run:\n npm run build:lib\n',
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const { predicates } = parsePredicates(markdown);
|
|
221
|
+
const live = buildIndex(predicates);
|
|
222
|
+
const dups = duplicateIds(live);
|
|
223
|
+
|
|
224
|
+
if (dups.length > 0) {
|
|
225
|
+
return {
|
|
226
|
+
ok: false,
|
|
227
|
+
reason: REASON.FAIL_DUPLICATE_IDS,
|
|
228
|
+
duplicates: live.duplicates,
|
|
229
|
+
count: live.count,
|
|
230
|
+
classes: live.classes,
|
|
231
|
+
message: 'CONTEXT.md has duplicate predicate id(s): ' + dups.join(', ') + '\n' +
|
|
232
|
+
'Each predicate id must be declared exactly once.\n',
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!fs.existsSync(indexPath)) {
|
|
237
|
+
return {
|
|
238
|
+
ok: false,
|
|
239
|
+
reason: REASON.FAIL_INDEX_MISSING,
|
|
240
|
+
duplicates: live.duplicates,
|
|
241
|
+
count: live.count,
|
|
242
|
+
classes: live.classes,
|
|
243
|
+
message: `${path.relative(ROOT, indexPath)} does not exist. Run:\n node scripts/gen-context-index.cjs --write\n`,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let committedIndex;
|
|
248
|
+
try {
|
|
249
|
+
const committedText = fs.readFileSync(indexPath, 'utf8');
|
|
250
|
+
committedIndex = JSON.parse(committedText);
|
|
251
|
+
if (!committedIndex || typeof committedIndex !== 'object' || !Array.isArray(committedIndex.predicates)) {
|
|
252
|
+
throw new Error('parsed JSON does not have the expected ContextIndex shape');
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
return {
|
|
256
|
+
ok: false,
|
|
257
|
+
reason: REASON.FAIL_INDEX_UNPARSEABLE,
|
|
258
|
+
duplicates: live.duplicates,
|
|
259
|
+
count: live.count,
|
|
260
|
+
classes: live.classes,
|
|
261
|
+
message: `${path.relative(ROOT, indexPath)} is unparseable: ${err && err.message}\n` +
|
|
262
|
+
'Run:\n node scripts/gen-context-index.cjs --write\n',
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Comparing parsed JSON (rather than raw file text) is inherently
|
|
267
|
+
// CRLF-agnostic: JSON.parse treats \r\n and \n as equivalent insignificant
|
|
268
|
+
// whitespace between tokens, and predicate values never contain embedded
|
|
269
|
+
// newlines (the parser only extracts single-physical-line declarations).
|
|
270
|
+
if (JSON.stringify(committedIndex) !== JSON.stringify(live)) {
|
|
271
|
+
return {
|
|
272
|
+
ok: false,
|
|
273
|
+
reason: REASON.FAIL_STALE,
|
|
274
|
+
duplicates: live.duplicates,
|
|
275
|
+
count: live.count,
|
|
276
|
+
classes: live.classes,
|
|
277
|
+
message: `${path.relative(ROOT, indexPath)} is stale. Run:\n node scripts/gen-context-index.cjs --write\n`,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
ok: true,
|
|
283
|
+
reason: REASON.OK_UP_TO_DATE,
|
|
284
|
+
duplicates: live.duplicates,
|
|
285
|
+
count: live.count,
|
|
286
|
+
classes: live.classes,
|
|
287
|
+
message: `${path.relative(ROOT, indexPath)} is up to date.\n`,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// ─── Argument parsing ─────────────────────────────────────────────────────────
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* True when `value` cannot be accepted as a `--context-path`/`--index-path`
|
|
295
|
+
* argument: absent (no more argv), empty string, or flag-shaped (starts with
|
|
296
|
+
* `-`, so a dangling `--context-path` immediately followed by the NEXT flag
|
|
297
|
+
* is rejected rather than silently swallowing that flag as a literal path).
|
|
298
|
+
*
|
|
299
|
+
* @param {string|undefined} value
|
|
300
|
+
* @returns {boolean}
|
|
301
|
+
*/
|
|
302
|
+
function isMissingPathValue(value) {
|
|
303
|
+
return value === undefined || value === '' || value.startsWith('-');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Parse CLI arguments into a structured options object.
|
|
308
|
+
*
|
|
309
|
+
* `--context-path` / `--index-path` override the two hardcoded repo-root
|
|
310
|
+
* paths — added so tests can point the real CLI at a temp fixture tree
|
|
311
|
+
* directly, with no fs monkeypatching required.
|
|
312
|
+
*
|
|
313
|
+
* Two usage-error conditions (DEFECT.GEN-CONTEXT-INDEX-PARSEARGS-GATE-BYPASS,
|
|
314
|
+
* MAJOR review finding) collapse into `mode: 'unknown'`, the same clean,
|
|
315
|
+
* no-stack-trace usage-error path `main()` already uses for an unrecognized
|
|
316
|
+
* flag:
|
|
317
|
+
* (a) `--check` and `--write` given together — previously the LAST one
|
|
318
|
+
* seen silently won, so `--check --write` exited 0 and REWROTE the
|
|
319
|
+
* committed index instead of gating. Conflicting mode flags are now a
|
|
320
|
+
* hard usage error regardless of order.
|
|
321
|
+
* (b) a missing/empty/flag-shaped value for `--context-path` /
|
|
322
|
+
* `--index-path` — previously `path.resolve(argv[++i] ?? '')`
|
|
323
|
+
* resolved to the current working directory, and in `--write` mode
|
|
324
|
+
* that later threw an uncaught, uncleaned `EISDIR` stack trace from
|
|
325
|
+
* `fs.writeFileSync` (CONTRIBUTING.md: no stack trace in non-debug
|
|
326
|
+
* failure output). Rejected up front instead, before any I/O.
|
|
327
|
+
*
|
|
328
|
+
* @param {string[]} argv - process.argv.slice(2)
|
|
329
|
+
* @returns {{ mode: 'check'|'write'|'default'|'unknown', json: boolean, contextPath: string, indexPath: string, unknownArg?: string, usageMessage?: string }}
|
|
330
|
+
*/
|
|
331
|
+
function parseArgs(argv) {
|
|
332
|
+
const opts = { mode: 'default', json: false, contextPath: CONTEXT_PATH, indexPath: INDEX_PATH };
|
|
333
|
+
let sawCheck = false;
|
|
334
|
+
let sawWrite = false;
|
|
335
|
+
|
|
336
|
+
for (let i = 0; i < argv.length; i++) {
|
|
337
|
+
const arg = argv[i];
|
|
338
|
+
if (arg === '--check') {
|
|
339
|
+
sawCheck = true;
|
|
340
|
+
opts.mode = 'check';
|
|
341
|
+
} else if (arg === '--write') {
|
|
342
|
+
sawWrite = true;
|
|
343
|
+
opts.mode = 'write';
|
|
344
|
+
} else if (arg === '--json') {
|
|
345
|
+
opts.json = true;
|
|
346
|
+
} else if (arg === '--context-path' || arg === '--index-path') {
|
|
347
|
+
const value = argv[i + 1];
|
|
348
|
+
if (isMissingPathValue(value)) {
|
|
349
|
+
return {
|
|
350
|
+
...opts,
|
|
351
|
+
mode: 'unknown',
|
|
352
|
+
unknownArg: arg,
|
|
353
|
+
usageMessage: `${arg} requires a non-empty path argument (got ${value === undefined ? 'nothing' : JSON.stringify(value)})`,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
i++;
|
|
357
|
+
if (arg === '--context-path') opts.contextPath = path.resolve(value);
|
|
358
|
+
else opts.indexPath = path.resolve(value);
|
|
359
|
+
} else {
|
|
360
|
+
opts.mode = 'unknown';
|
|
361
|
+
opts.unknownArg = arg;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (sawCheck && sawWrite) {
|
|
366
|
+
return {
|
|
367
|
+
...opts,
|
|
368
|
+
mode: 'unknown',
|
|
369
|
+
usageMessage: '--check and --write are mutually exclusive',
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return opts;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
377
|
+
|
|
378
|
+
function main() {
|
|
379
|
+
const opts = parseArgs(process.argv.slice(2));
|
|
380
|
+
|
|
381
|
+
if (opts.mode === 'unknown') {
|
|
382
|
+
process.stderr.write('Usage: gen-context-index.cjs [--write|--check] [--json] [--context-path <path>] [--index-path <path>]\n');
|
|
383
|
+
if (opts.usageMessage) process.stderr.write(`${opts.usageMessage}\n`);
|
|
384
|
+
throw new ExitError(1);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (opts.mode === 'default') {
|
|
388
|
+
process.stdout.write(serializeIndex(buildFreshIndex(opts.contextPath)) + '\n');
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (opts.mode === 'check') {
|
|
393
|
+
const report = checkReport(opts.contextPath, opts.indexPath);
|
|
394
|
+
|
|
395
|
+
if (opts.json) {
|
|
396
|
+
process.stdout.write(JSON.stringify({
|
|
397
|
+
ok: report.ok,
|
|
398
|
+
reason: report.reason,
|
|
399
|
+
duplicates: report.duplicates,
|
|
400
|
+
count: report.count,
|
|
401
|
+
classes: report.classes,
|
|
402
|
+
}) + '\n');
|
|
403
|
+
} else if (report.ok) {
|
|
404
|
+
process.stdout.write(report.message);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (!report.ok) {
|
|
408
|
+
// JSON mode already carries the structured report on stdout — do not
|
|
409
|
+
// duplicate the prose onto stderr, but the exit code must still be 1.
|
|
410
|
+
throw new ExitError(1, opts.json ? undefined : report.message);
|
|
411
|
+
}
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// opts.mode === 'write'
|
|
416
|
+
const index = buildFreshIndex(opts.contextPath);
|
|
417
|
+
fs.mkdirSync(path.dirname(opts.indexPath), { recursive: true });
|
|
418
|
+
fs.writeFileSync(opts.indexPath, serializeIndex(index), 'utf8');
|
|
419
|
+
const dupCount = index.duplicates.length;
|
|
420
|
+
process.stdout.write(
|
|
421
|
+
`Wrote ${path.relative(ROOT, opts.indexPath)}\n` +
|
|
422
|
+
` ${index.count} predicates, ${Object.keys(index.classes).length} classes, ` +
|
|
423
|
+
`${dupCount} duplicate id${dupCount !== 1 ? 's' : ''}\n`,
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// ─── Exports (for tests) ──────────────────────────────────────────────────────
|
|
428
|
+
|
|
429
|
+
module.exports = {
|
|
430
|
+
loadContextPredicatesLib,
|
|
431
|
+
readContextMarkdown,
|
|
432
|
+
buildFreshIndex,
|
|
433
|
+
serializeIndex,
|
|
434
|
+
normalizeLineEndings,
|
|
435
|
+
duplicateIds,
|
|
436
|
+
checkReport,
|
|
437
|
+
parseArgs,
|
|
438
|
+
REASON,
|
|
439
|
+
CONTEXT_PREDICATES_LIB_PATH,
|
|
440
|
+
CONTEXT_PATH,
|
|
441
|
+
INDEX_PATH,
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
// ─── CLI entry point ──────────────────────────────────────────────────────────
|
|
445
|
+
|
|
446
|
+
if (require.main === module) {
|
|
447
|
+
runMain(main);
|
|
448
|
+
}
|
|
@@ -60,6 +60,93 @@ const FAMILIES = [
|
|
|
60
60
|
},
|
|
61
61
|
];
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* One-level-nested families (#2996, epic #1671 Phase 6.5).
|
|
65
|
+
*
|
|
66
|
+
* `buildManifest`'s flat `readdirSync` + `isFile()` walk cannot see a workflow's
|
|
67
|
+
* own sub-files, so `gsd-core/workflows/<wf>/steps/*.md` (the fragment tree
|
|
68
|
+
* extracted by Phases 6.1-6.3) and `gsd-core/workflows/<wf>/modes/*.md` (the
|
|
69
|
+
* #717 progressive-disclosure pattern) shipped invisible to both the manifest
|
|
70
|
+
* and `docs/INVENTORY.md` — exactly the `DEFECT.INVENTORY-DRIFT` class.
|
|
71
|
+
*
|
|
72
|
+
* Keyed by `<parent>/<subdir>/<file>` rather than a bare basename ON PURPOSE:
|
|
73
|
+
* two workflows may each own a `regression-gate.md`, and a step file may share a
|
|
74
|
+
* name with a top-level workflow. A basename key would let one silently
|
|
75
|
+
* overwrite the other, and because the manifest is compared by JSON equality a
|
|
76
|
+
* collision would read as "up to date".
|
|
77
|
+
*
|
|
78
|
+
* Recursion is bounded at exactly one level, by named subdirectory. It is not a
|
|
79
|
+
* general recursive walk.
|
|
80
|
+
*/
|
|
81
|
+
const NESTED_FAMILIES = [
|
|
82
|
+
{
|
|
83
|
+
name: 'workflow_modes',
|
|
84
|
+
root: path.join(ROOT, 'gsd-core', 'workflows'),
|
|
85
|
+
subdir: 'modes',
|
|
86
|
+
filter: (f) => f.endsWith('.md'),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'workflow_steps',
|
|
90
|
+
root: path.join(ROOT, 'gsd-core', 'workflows'),
|
|
91
|
+
subdir: 'steps',
|
|
92
|
+
filter: (f) => f.endsWith('.md'),
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Collect `<root>/<parent>/<subdir>/<file>` entries as POSIX-relative keys.
|
|
98
|
+
*
|
|
99
|
+
* A parent that has no such subdirectory contributes nothing, and an EMPTY
|
|
100
|
+
* subdirectory contributes nothing — never an empty-array key, which would be a
|
|
101
|
+
* committed diff that signals nothing. `statSync().isDirectory()` is checked
|
|
102
|
+
* before every `readdirSync` so a plain FILE named `steps` cannot throw.
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* `fs.statSync` throws on a dangling symlink and on an EACCES-denied path. An
|
|
106
|
+
* entry we cannot stat is, for inventory purposes, not a countable file — the
|
|
107
|
+
* same disposition as "not a directory" below. Swallowing the throw here keeps
|
|
108
|
+
* one unreadable entry from taking down `--check` for the entire repo, which is
|
|
109
|
+
* a manifest generator's worst failure mode: it turns a local filesystem oddity
|
|
110
|
+
* into a red gate on every PR.
|
|
111
|
+
*/
|
|
112
|
+
function statOrNull(p) {
|
|
113
|
+
try {
|
|
114
|
+
return fs.statSync(p);
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function collectNested({ root, subdir, filter }) {
|
|
121
|
+
if (!fs.existsSync(root)) return [];
|
|
122
|
+
const out = [];
|
|
123
|
+
let parents;
|
|
124
|
+
try {
|
|
125
|
+
parents = fs.readdirSync(root);
|
|
126
|
+
} catch {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
for (const parent of parents) {
|
|
130
|
+
const parentStat = statOrNull(path.join(root, parent));
|
|
131
|
+
if (!parentStat || !parentStat.isDirectory()) continue;
|
|
132
|
+
const nestedDir = path.join(root, parent, subdir);
|
|
133
|
+
const nestedStat = statOrNull(nestedDir);
|
|
134
|
+
if (!nestedStat || !nestedStat.isDirectory()) continue;
|
|
135
|
+
let files;
|
|
136
|
+
try {
|
|
137
|
+
files = fs.readdirSync(nestedDir);
|
|
138
|
+
} catch {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
for (const file of files) {
|
|
142
|
+
const fileStat = statOrNull(path.join(nestedDir, file));
|
|
143
|
+
if (!fileStat || !fileStat.isFile() || !filter(file)) continue;
|
|
144
|
+
out.push([parent, subdir, file].join('/'));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return out.sort();
|
|
148
|
+
}
|
|
149
|
+
|
|
63
150
|
function buildManifest() {
|
|
64
151
|
const manifest = { families: {} };
|
|
65
152
|
for (const { name, dir, filter, toName } of FAMILIES) {
|
|
@@ -69,6 +156,9 @@ function buildManifest() {
|
|
|
69
156
|
.map(toName)
|
|
70
157
|
.sort();
|
|
71
158
|
}
|
|
159
|
+
for (const family of NESTED_FAMILIES) {
|
|
160
|
+
manifest.families[family.name] = collectNested(family);
|
|
161
|
+
}
|
|
72
162
|
return manifest;
|
|
73
163
|
}
|
|
74
164
|
|
|
@@ -109,4 +199,14 @@ function main() {
|
|
|
109
199
|
}
|
|
110
200
|
}
|
|
111
201
|
|
|
112
|
-
|
|
202
|
+
/* c8 ignore next 3 -- CLI entry guard; this repo measures coverage with c8, which does not honor istanbul pragmas */
|
|
203
|
+
if (require.main === module) {
|
|
204
|
+
runMain(main);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Single source of truth for the family tables (#2996). `tests/inventory-manifest-sync.test.cjs`
|
|
208
|
+
// previously carried its own duplicate copy of FAMILIES, which is the
|
|
209
|
+
// `DEFECT.GENERATIVE-FIX` divergence class: adding a family here while the test kept
|
|
210
|
+
// its own list meant the test silently verified fewer families than shipped, and still
|
|
211
|
+
// passed. The test now imports these, so the two surfaces cannot drift.
|
|
212
|
+
module.exports = { FAMILIES, NESTED_FAMILIES, collectNested, buildManifest };
|