@llipe.com/dev-tasks 0.11.0 → 0.16.1
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/agents/developer.md +105 -43
- package/.claude/agents/github-ops.md +48 -4
- package/.claude/agents/housekeeping.md +44 -7
- package/.claude/agents/qa-engineer.md +24 -11
- package/.claude/agents/researcher.md +26 -6
- package/.claude/agents/technical-writer.md +61 -6
- package/.claude/agents/ux-engineer.md +1 -0
- package/.claude/agents/verifier.md +48 -6
- package/.claude/commands/developer.md +2 -266
- package/.claude/commands/infra-engineer.md +92 -0
- package/.claude/commands/planner.md +44 -23
- package/.claude/commands/product-engineer.md +21 -9
- package/.claude/commands/researcher.md +4 -5
- package/.claude/commands/technical-writer.md +1 -1
- package/.claude/hooks/branch-guard.sh +30 -0
- package/.claude/hooks/git-guard.sh +483 -22
- package/.claude/skills/activity-codebase-research/SKILL.md +4 -11
- package/.claude/skills/activity-generate-spec/SKILL.md +34 -10
- package/.claude/skills/activity-grill/SKILL.md +150 -0
- package/.claude/skills/activity-init/SKILL.md +121 -71
- package/.claude/skills/activity-refine/SKILL.md +75 -15
- package/.claude/skills/activity-test-standards/SKILL.md +25 -0
- package/.claude/skills/aws-ops/SKILL.md +155 -0
- package/.claude/skills/deploy-ops/SKILL.md +121 -0
- package/.claude/skills/fly-ops/SKILL.md +138 -0
- package/.claude/skills/git-ops/SKILL.md +27 -7
- package/.claude/skills/implement/SKILL.md +49 -4
- package/.claude/skills/memo-cli-usage/REFERENCE.md +230 -17
- package/.claude/skills/memo-cli-usage/SKILL.md +66 -13
- package/.claude/skills/plan/SKILL.md +43 -1
- package/.claude/skills/supabase-ops/SKILL.md +109 -0
- package/.github/agents/developer.agent.md +70 -19
- package/.github/agents/github-ops.agent.md +46 -4
- package/.github/agents/housekeeping.agent.md +43 -7
- package/.github/agents/infra-engineer.agent.md +139 -0
- package/.github/agents/planner.agent.md +25 -4
- package/.github/agents/product-engineer.agent.md +21 -9
- package/.github/agents/qa-engineer.agent.md +23 -11
- package/.github/agents/researcher.agent.md +25 -6
- package/.github/agents/technical-writer.agent.md +60 -6
- package/.github/agents/verifier.agent.md +46 -5
- package/.github/instructions/implement.instructions.md +49 -4
- package/.github/instructions/plan.instructions.md +43 -1
- package/.github/prompts/infra-engineer.prompt.md +12 -0
- package/.github/prompts/product-engineer-init.prompt.md +5 -6
- package/.github/prompts/researcher.prompt.md +4 -5
- package/.github/prompts/technical-writer.prompt.md +1 -1
- package/.github/skills/activity-codebase-research/SKILL.md +4 -16
- package/.github/skills/activity-generate-spec/SKILL.md +34 -10
- package/.github/skills/activity-grill/SKILL.md +145 -0
- package/.github/skills/activity-init/SKILL.md +120 -70
- package/.github/skills/activity-refine/SKILL.md +75 -15
- package/.github/skills/activity-test-standards/SKILL.md +25 -0
- package/.github/skills/aws-ops/SKILL.md +150 -0
- package/.github/skills/deploy-ops/SKILL.md +116 -0
- package/.github/skills/fly-ops/SKILL.md +133 -0
- package/.github/skills/git-ops/SKILL.md +27 -7
- package/.github/skills/memo-cli-usage/REFERENCE.md +230 -17
- package/.github/skills/memo-cli-usage/SKILL.md +66 -13
- package/.github/skills/supabase-ops/SKILL.md +104 -0
- package/.kiro/agents/developer.md +71 -20
- package/.kiro/agents/github-ops.md +46 -4
- package/.kiro/agents/housekeeping.md +44 -8
- package/.kiro/agents/infra-engineer.md +102 -0
- package/.kiro/agents/planner.md +33 -15
- package/.kiro/agents/product-engineer.md +24 -12
- package/.kiro/agents/qa-engineer.md +24 -12
- package/.kiro/agents/researcher.md +26 -7
- package/.kiro/agents/technical-writer.md +63 -9
- package/.kiro/agents/verifier.md +47 -6
- package/.kiro/skills/activity-codebase-research/SKILL.md +4 -11
- package/.kiro/skills/activity-generate-spec/SKILL.md +34 -10
- package/.kiro/skills/activity-grill/SKILL.md +150 -0
- package/.kiro/skills/activity-init/SKILL.md +121 -71
- package/.kiro/skills/activity-refine/SKILL.md +75 -15
- package/.kiro/skills/activity-test-standards/SKILL.md +25 -0
- package/.kiro/skills/aws-ops/SKILL.md +155 -0
- package/.kiro/skills/deploy-ops/SKILL.md +121 -0
- package/.kiro/skills/fly-ops/SKILL.md +138 -0
- package/.kiro/skills/git-ops/SKILL.md +27 -7
- package/.kiro/skills/memo-cli-usage/REFERENCE.md +230 -17
- package/.kiro/skills/memo-cli-usage/SKILL.md +66 -13
- package/.kiro/skills/supabase-ops/SKILL.md +109 -0
- package/.kiro/steering/implement.md +49 -4
- package/.kiro/steering/plan.md +43 -1
- package/AGENTS.md +60 -109
- package/AGENTS.md.template +124 -0
- package/CHANGELOG.md +163 -0
- package/CLAUDE.md +23 -18
- package/CLAUDE.md.template +103 -0
- package/README.md +168 -146
- package/TESTING.md +84 -148
- package/bundle-manifest.json +43 -2
- package/dist/bin/dev-tasks.js +65 -3
- package/dist/bin/dev-tasks.js.map +1 -1
- package/dist/{adapters/cli → bin}/parse-args.d.ts +2 -6
- package/dist/bin/parse-args.d.ts.map +1 -0
- package/dist/{adapters/cli → bin}/parse-args.js +2 -18
- package/dist/bin/parse-args.js.map +1 -0
- package/dist/core/checks/decision-log-format.d.ts +44 -0
- package/dist/core/checks/decision-log-format.d.ts.map +1 -0
- package/dist/core/checks/decision-log-format.js +171 -0
- package/dist/core/checks/decision-log-format.js.map +1 -0
- package/dist/core/checks/docs-structure.d.ts +82 -0
- package/dist/core/checks/docs-structure.d.ts.map +1 -0
- package/dist/core/checks/docs-structure.js +285 -0
- package/dist/core/checks/docs-structure.js.map +1 -0
- package/dist/core/checks/glossary.d.ts +178 -0
- package/dist/core/checks/glossary.d.ts.map +1 -0
- package/dist/core/checks/glossary.js +651 -0
- package/dist/core/checks/glossary.js.map +1 -0
- package/dist/core/checks/index.d.ts +19 -0
- package/dist/core/checks/index.d.ts.map +1 -0
- package/dist/core/checks/index.js +16 -0
- package/dist/core/checks/index.js.map +1 -0
- package/dist/core/checks/run.d.ts +22 -0
- package/dist/core/checks/run.d.ts.map +1 -0
- package/dist/core/checks/run.js +51 -0
- package/dist/core/checks/run.js.map +1 -0
- package/dist/core/distribution/doctor.d.ts +46 -1
- package/dist/core/distribution/doctor.d.ts.map +1 -1
- package/dist/core/distribution/doctor.js +161 -2
- package/dist/core/distribution/doctor.js.map +1 -1
- package/dist/core/distribution/index.d.ts +9 -3
- package/dist/core/distribution/index.d.ts.map +1 -1
- package/dist/core/distribution/index.js +5 -2
- package/dist/core/distribution/index.js.map +1 -1
- package/dist/core/distribution/install-if-absent.d.ts +46 -0
- package/dist/core/distribution/install-if-absent.d.ts.map +1 -0
- package/dist/core/distribution/install-if-absent.js +81 -0
- package/dist/core/distribution/install-if-absent.js.map +1 -0
- package/dist/core/distribution/install.d.ts.map +1 -1
- package/dist/core/distribution/install.js +5 -0
- package/dist/core/distribution/install.js.map +1 -1
- package/dist/core/distribution/migrate-docs.d.ts +64 -0
- package/dist/core/distribution/migrate-docs.d.ts.map +1 -0
- package/dist/core/distribution/migrate-docs.js +139 -0
- package/dist/core/distribution/migrate-docs.js.map +1 -0
- package/dist/core/distribution/profiles.d.ts +49 -0
- package/dist/core/distribution/profiles.d.ts.map +1 -1
- package/dist/core/distribution/profiles.js +45 -0
- package/dist/core/distribution/profiles.js.map +1 -1
- package/dist/core/distribution/update.d.ts +14 -0
- package/dist/core/distribution/update.d.ts.map +1 -1
- package/dist/core/distribution/update.js +77 -3
- package/dist/core/distribution/update.js.map +1 -1
- package/dist/core/distribution/workspace.d.ts +84 -0
- package/dist/core/distribution/workspace.d.ts.map +1 -0
- package/dist/core/distribution/workspace.js +276 -0
- package/dist/core/distribution/workspace.js.map +1 -0
- package/dist/core/exit-codes.d.ts +15 -35
- package/dist/core/exit-codes.d.ts.map +1 -1
- package/dist/core/exit-codes.js +15 -36
- package/dist/core/exit-codes.js.map +1 -1
- package/dist/core/index.d.ts +1 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -7
- package/dist/core/index.js.map +1 -1
- package/package.json +17 -32
- package/templates/claude/settings.json +48 -0
- package/templates/domain/ubiquitous-language.md +28 -0
- package/templates/infra/environments.yaml +16 -0
- package/templates/infra/redaction-patterns.txt +47 -0
- package/templates/runbooks/README.md +14 -0
- package/templates/runbooks/runbook-template.md +40 -0
- package/templates/scripts/deploy-status.sh +89 -0
- package/templates/scripts/deploy-verify.sh +85 -0
- package/templates/scripts/deploy.sh +284 -0
- package/templates/scripts/release.sh +170 -0
- package/templates/scripts/rollback.sh +109 -0
- package/templates/workflows/deploy-dev.yml +66 -0
- package/templates/workflows/deploy-prod.yml +66 -0
- package/templates/workflows/rollback.yml +77 -0
- package/.claude/skills/activity-contract-validation/SKILL.md +0 -167
- package/.github/skills/activity-contract-validation/SKILL.md +0 -167
- package/.kiro/skills/activity-contract-validation/SKILL.md +0 -167
- package/dist/adapters/cli/catalog-build.d.ts +0 -30
- package/dist/adapters/cli/catalog-build.d.ts.map +0 -1
- package/dist/adapters/cli/catalog-build.js +0 -73
- package/dist/adapters/cli/catalog-build.js.map +0 -1
- package/dist/adapters/cli/catalog-query.d.ts +0 -13
- package/dist/adapters/cli/catalog-query.d.ts.map +0 -1
- package/dist/adapters/cli/catalog-query.js +0 -329
- package/dist/adapters/cli/catalog-query.js.map +0 -1
- package/dist/adapters/cli/catalog-scaffold.d.ts +0 -24
- package/dist/adapters/cli/catalog-scaffold.d.ts.map +0 -1
- package/dist/adapters/cli/catalog-scaffold.js +0 -46
- package/dist/adapters/cli/catalog-scaffold.js.map +0 -1
- package/dist/adapters/cli/catalog-validate.d.ts +0 -35
- package/dist/adapters/cli/catalog-validate.d.ts.map +0 -1
- package/dist/adapters/cli/catalog-validate.js +0 -122
- package/dist/adapters/cli/catalog-validate.js.map +0 -1
- package/dist/adapters/cli/ctx-assemble.d.ts +0 -19
- package/dist/adapters/cli/ctx-assemble.d.ts.map +0 -1
- package/dist/adapters/cli/ctx-assemble.js +0 -293
- package/dist/adapters/cli/ctx-assemble.js.map +0 -1
- package/dist/adapters/cli/ctx-fetch.d.ts +0 -49
- package/dist/adapters/cli/ctx-fetch.d.ts.map +0 -1
- package/dist/adapters/cli/ctx-fetch.js +0 -267
- package/dist/adapters/cli/ctx-fetch.js.map +0 -1
- package/dist/adapters/cli/extract-all.d.ts +0 -31
- package/dist/adapters/cli/extract-all.d.ts.map +0 -1
- package/dist/adapters/cli/extract-all.js +0 -374
- package/dist/adapters/cli/extract-all.js.map +0 -1
- package/dist/adapters/cli/extract-asyncapi.d.ts +0 -26
- package/dist/adapters/cli/extract-asyncapi.d.ts.map +0 -1
- package/dist/adapters/cli/extract-asyncapi.js +0 -142
- package/dist/adapters/cli/extract-asyncapi.js.map +0 -1
- package/dist/adapters/cli/extract-component.d.ts +0 -24
- package/dist/adapters/cli/extract-component.d.ts.map +0 -1
- package/dist/adapters/cli/extract-component.js +0 -198
- package/dist/adapters/cli/extract-component.js.map +0 -1
- package/dist/adapters/cli/extract-detect.d.ts +0 -19
- package/dist/adapters/cli/extract-detect.d.ts.map +0 -1
- package/dist/adapters/cli/extract-detect.js +0 -98
- package/dist/adapters/cli/extract-detect.js.map +0 -1
- package/dist/adapters/cli/extract-openapi.d.ts +0 -29
- package/dist/adapters/cli/extract-openapi.d.ts.map +0 -1
- package/dist/adapters/cli/extract-openapi.js +0 -111
- package/dist/adapters/cli/extract-openapi.js.map +0 -1
- package/dist/adapters/cli/extract-schema.d.ts +0 -15
- package/dist/adapters/cli/extract-schema.d.ts.map +0 -1
- package/dist/adapters/cli/extract-schema.js +0 -39
- package/dist/adapters/cli/extract-schema.js.map +0 -1
- package/dist/adapters/cli/index.d.ts +0 -6
- package/dist/adapters/cli/index.d.ts.map +0 -1
- package/dist/adapters/cli/index.js +0 -5
- package/dist/adapters/cli/index.js.map +0 -1
- package/dist/adapters/cli/init.d.ts +0 -37
- package/dist/adapters/cli/init.d.ts.map +0 -1
- package/dist/adapters/cli/init.js +0 -336
- package/dist/adapters/cli/init.js.map +0 -1
- package/dist/adapters/cli/parse-args.d.ts.map +0 -1
- package/dist/adapters/cli/parse-args.js.map +0 -1
- package/dist/adapters/cli/scope-gate.d.ts +0 -25
- package/dist/adapters/cli/scope-gate.d.ts.map +0 -1
- package/dist/adapters/cli/scope-gate.js +0 -157
- package/dist/adapters/cli/scope-gate.js.map +0 -1
- package/dist/adapters/cli/scope.d.ts +0 -26
- package/dist/adapters/cli/scope.d.ts.map +0 -1
- package/dist/adapters/cli/scope.js +0 -172
- package/dist/adapters/cli/scope.js.map +0 -1
- package/dist/adapters/cli/validate-component.d.ts +0 -24
- package/dist/adapters/cli/validate-component.d.ts.map +0 -1
- package/dist/adapters/cli/validate-component.js +0 -62
- package/dist/adapters/cli/validate-component.js.map +0 -1
- package/dist/adapters/cli/verify-contract-diff.d.ts +0 -21
- package/dist/adapters/cli/verify-contract-diff.d.ts.map +0 -1
- package/dist/adapters/cli/verify-contract-diff.js +0 -69
- package/dist/adapters/cli/verify-contract-diff.js.map +0 -1
- package/dist/adapters/cli/verify-drift.d.ts +0 -24
- package/dist/adapters/cli/verify-drift.d.ts.map +0 -1
- package/dist/adapters/cli/verify-drift.js +0 -103
- package/dist/adapters/cli/verify-drift.js.map +0 -1
- package/dist/adapters/cli/verify-impact.d.ts +0 -23
- package/dist/adapters/cli/verify-impact.d.ts.map +0 -1
- package/dist/adapters/cli/verify-impact.js +0 -119
- package/dist/adapters/cli/verify-impact.js.map +0 -1
- package/dist/adapters/mcp/index.d.ts +0 -5
- package/dist/adapters/mcp/index.d.ts.map +0 -1
- package/dist/adapters/mcp/index.js +0 -2
- package/dist/adapters/mcp/index.js.map +0 -1
- package/dist/bin/dt.d.ts +0 -7
- package/dist/bin/dt.d.ts.map +0 -1
- package/dist/bin/dt.js +0 -647
- package/dist/bin/dt.js.map +0 -1
- package/dist/core/catalog/build.d.ts +0 -143
- package/dist/core/catalog/build.d.ts.map +0 -1
- package/dist/core/catalog/build.js +0 -475
- package/dist/core/catalog/build.js.map +0 -1
- package/dist/core/catalog/checks/index.d.ts +0 -18
- package/dist/core/catalog/checks/index.d.ts.map +0 -1
- package/dist/core/catalog/checks/index.js +0 -18
- package/dist/core/catalog/checks/index.js.map +0 -1
- package/dist/core/catalog/checks/v01-schema.d.ts +0 -17
- package/dist/core/catalog/checks/v01-schema.d.ts.map +0 -1
- package/dist/core/catalog/checks/v01-schema.js +0 -57
- package/dist/core/catalog/checks/v01-schema.js.map +0 -1
- package/dist/core/catalog/checks/v02-v03-identity.d.ts +0 -14
- package/dist/core/catalog/checks/v02-v03-identity.d.ts.map +0 -1
- package/dist/core/catalog/checks/v02-v03-identity.js +0 -60
- package/dist/core/catalog/checks/v02-v03-identity.js.map +0 -1
- package/dist/core/catalog/checks/v04-referential-integrity.d.ts +0 -7
- package/dist/core/catalog/checks/v04-referential-integrity.d.ts.map +0 -1
- package/dist/core/catalog/checks/v04-referential-integrity.js +0 -32
- package/dist/core/catalog/checks/v04-referential-integrity.js.map +0 -1
- package/dist/core/catalog/checks/v05-domain-existence.d.ts +0 -6
- package/dist/core/catalog/checks/v05-domain-existence.d.ts.map +0 -1
- package/dist/core/catalog/checks/v05-domain-existence.js +0 -23
- package/dist/core/catalog/checks/v05-domain-existence.js.map +0 -1
- package/dist/core/catalog/checks/v06-v07-paths.d.ts +0 -29
- package/dist/core/catalog/checks/v06-v07-paths.d.ts.map +0 -1
- package/dist/core/catalog/checks/v06-v07-paths.js +0 -107
- package/dist/core/catalog/checks/v06-v07-paths.js.map +0 -1
- package/dist/core/catalog/checks/v08-v10-contracts.d.ts +0 -13
- package/dist/core/catalog/checks/v08-v10-contracts.d.ts.map +0 -1
- package/dist/core/catalog/checks/v08-v10-contracts.js +0 -70
- package/dist/core/catalog/checks/v08-v10-contracts.js.map +0 -1
- package/dist/core/catalog/checks/v11-manual-fields.d.ts +0 -16
- package/dist/core/catalog/checks/v11-manual-fields.d.ts.map +0 -1
- package/dist/core/catalog/checks/v11-manual-fields.js +0 -60
- package/dist/core/catalog/checks/v11-manual-fields.js.map +0 -1
- package/dist/core/catalog/checks/v12-cycles.d.ts +0 -8
- package/dist/core/catalog/checks/v12-cycles.d.ts.map +0 -1
- package/dist/core/catalog/checks/v12-cycles.js +0 -28
- package/dist/core/catalog/checks/v12-cycles.js.map +0 -1
- package/dist/core/catalog/checks/v13-orphan-contracts.d.ts +0 -7
- package/dist/core/catalog/checks/v13-orphan-contracts.d.ts.map +0 -1
- package/dist/core/catalog/checks/v13-orphan-contracts.js +0 -33
- package/dist/core/catalog/checks/v13-orphan-contracts.js.map +0 -1
- package/dist/core/catalog/checks/v14-v15-lifecycle.d.ts +0 -8
- package/dist/core/catalog/checks/v14-v15-lifecycle.d.ts.map +0 -1
- package/dist/core/catalog/checks/v14-v15-lifecycle.js +0 -42
- package/dist/core/catalog/checks/v14-v15-lifecycle.js.map +0 -1
- package/dist/core/catalog/checks/v16-deprecated-consumers.d.ts +0 -7
- package/dist/core/catalog/checks/v16-deprecated-consumers.d.ts.map +0 -1
- package/dist/core/catalog/checks/v16-deprecated-consumers.js +0 -47
- package/dist/core/catalog/checks/v16-deprecated-consumers.js.map +0 -1
- package/dist/core/catalog/checks/v17-low-confidence.d.ts +0 -7
- package/dist/core/catalog/checks/v17-low-confidence.d.ts.map +0 -1
- package/dist/core/catalog/checks/v17-low-confidence.js +0 -32
- package/dist/core/catalog/checks/v17-low-confidence.js.map +0 -1
- package/dist/core/catalog/checks/v18-low-payload.d.ts +0 -7
- package/dist/core/catalog/checks/v18-low-payload.d.ts.map +0 -1
- package/dist/core/catalog/checks/v18-low-payload.js +0 -33
- package/dist/core/catalog/checks/v18-low-payload.js.map +0 -1
- package/dist/core/catalog/checks/v19-domain-membership.d.ts +0 -8
- package/dist/core/catalog/checks/v19-domain-membership.d.ts.map +0 -1
- package/dist/core/catalog/checks/v19-domain-membership.js +0 -55
- package/dist/core/catalog/checks/v19-domain-membership.js.map +0 -1
- package/dist/core/catalog/coverage.d.ts +0 -39
- package/dist/core/catalog/coverage.d.ts.map +0 -1
- package/dist/core/catalog/coverage.js +0 -62
- package/dist/core/catalog/coverage.js.map +0 -1
- package/dist/core/catalog/graph.d.ts +0 -49
- package/dist/core/catalog/graph.d.ts.map +0 -1
- package/dist/core/catalog/graph.js +0 -114
- package/dist/core/catalog/graph.js.map +0 -1
- package/dist/core/catalog/index-model.d.ts +0 -96
- package/dist/core/catalog/index-model.d.ts.map +0 -1
- package/dist/core/catalog/index-model.js +0 -8
- package/dist/core/catalog/index-model.js.map +0 -1
- package/dist/core/catalog/index.d.ts +0 -5
- package/dist/core/catalog/index.d.ts.map +0 -1
- package/dist/core/catalog/index.js +0 -2
- package/dist/core/catalog/index.js.map +0 -1
- package/dist/core/catalog/queries.d.ts +0 -69
- package/dist/core/catalog/queries.d.ts.map +0 -1
- package/dist/core/catalog/queries.js +0 -165
- package/dist/core/catalog/queries.js.map +0 -1
- package/dist/core/catalog/resolve.d.ts +0 -47
- package/dist/core/catalog/resolve.d.ts.map +0 -1
- package/dist/core/catalog/resolve.js +0 -318
- package/dist/core/catalog/resolve.js.map +0 -1
- package/dist/core/catalog/scaffold.d.ts +0 -31
- package/dist/core/catalog/scaffold.d.ts.map +0 -1
- package/dist/core/catalog/scaffold.js +0 -141
- package/dist/core/catalog/scaffold.js.map +0 -1
- package/dist/core/catalog/validate-component.d.ts +0 -50
- package/dist/core/catalog/validate-component.d.ts.map +0 -1
- package/dist/core/catalog/validate-component.js +0 -105
- package/dist/core/catalog/validate-component.js.map +0 -1
- package/dist/core/catalog/validate.d.ts +0 -71
- package/dist/core/catalog/validate.d.ts.map +0 -1
- package/dist/core/catalog/validate.js +0 -103
- package/dist/core/catalog/validate.js.map +0 -1
- package/dist/core/context/assemble.d.ts +0 -126
- package/dist/core/context/assemble.d.ts.map +0 -1
- package/dist/core/context/assemble.js +0 -197
- package/dist/core/context/assemble.js.map +0 -1
- package/dist/core/context/cache.d.ts +0 -60
- package/dist/core/context/cache.d.ts.map +0 -1
- package/dist/core/context/cache.js +0 -236
- package/dist/core/context/cache.js.map +0 -1
- package/dist/core/context/exit-codes.d.ts +0 -28
- package/dist/core/context/exit-codes.d.ts.map +0 -1
- package/dist/core/context/exit-codes.js +0 -28
- package/dist/core/context/exit-codes.js.map +0 -1
- package/dist/core/context/fetch.d.ts +0 -55
- package/dist/core/context/fetch.d.ts.map +0 -1
- package/dist/core/context/fetch.js +0 -112
- package/dist/core/context/fetch.js.map +0 -1
- package/dist/core/context/index.d.ts +0 -11
- package/dist/core/context/index.d.ts.map +0 -1
- package/dist/core/context/index.js +0 -8
- package/dist/core/context/index.js.map +0 -1
- package/dist/core/context/init.d.ts +0 -179
- package/dist/core/context/init.d.ts.map +0 -1
- package/dist/core/context/init.js +0 -532
- package/dist/core/context/init.js.map +0 -1
- package/dist/core/context/layers/architecture-layer.d.ts +0 -13
- package/dist/core/context/layers/architecture-layer.d.ts.map +0 -1
- package/dist/core/context/layers/architecture-layer.js +0 -24
- package/dist/core/context/layers/architecture-layer.js.map +0 -1
- package/dist/core/context/layers/contracts-layer.d.ts +0 -13
- package/dist/core/context/layers/contracts-layer.d.ts.map +0 -1
- package/dist/core/context/layers/contracts-layer.js +0 -83
- package/dist/core/context/layers/contracts-layer.js.map +0 -1
- package/dist/core/context/layers/conventions-delta-layer.d.ts +0 -13
- package/dist/core/context/layers/conventions-delta-layer.d.ts.map +0 -1
- package/dist/core/context/layers/conventions-delta-layer.js +0 -37
- package/dist/core/context/layers/conventions-delta-layer.js.map +0 -1
- package/dist/core/context/layers/flow-layer.d.ts +0 -14
- package/dist/core/context/layers/flow-layer.d.ts.map +0 -1
- package/dist/core/context/layers/flow-layer.js +0 -61
- package/dist/core/context/layers/flow-layer.js.map +0 -1
- package/dist/core/context/layers/index-layer.d.ts +0 -13
- package/dist/core/context/layers/index-layer.d.ts.map +0 -1
- package/dist/core/context/layers/index-layer.js +0 -77
- package/dist/core/context/layers/index-layer.js.map +0 -1
- package/dist/core/context/layers/primary-layer.d.ts +0 -16
- package/dist/core/context/layers/primary-layer.d.ts.map +0 -1
- package/dist/core/context/layers/primary-layer.js +0 -61
- package/dist/core/context/layers/primary-layer.js.map +0 -1
- package/dist/core/context/layers/secondary-layer.d.ts +0 -19
- package/dist/core/context/layers/secondary-layer.d.ts.map +0 -1
- package/dist/core/context/layers/secondary-layer.js +0 -52
- package/dist/core/context/layers/secondary-layer.js.map +0 -1
- package/dist/core/context/session-lock.d.ts +0 -114
- package/dist/core/context/session-lock.d.ts.map +0 -1
- package/dist/core/context/session-lock.js +0 -90
- package/dist/core/context/session-lock.js.map +0 -1
- package/dist/core/context/tokens.d.ts +0 -35
- package/dist/core/context/tokens.d.ts.map +0 -1
- package/dist/core/context/tokens.js +0 -88
- package/dist/core/context/tokens.js.map +0 -1
- package/dist/core/extract/asyncapi/declared.d.ts +0 -19
- package/dist/core/extract/asyncapi/declared.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/declared.js +0 -168
- package/dist/core/extract/asyncapi/declared.js.map +0 -1
- package/dist/core/extract/asyncapi/index.d.ts +0 -12
- package/dist/core/extract/asyncapi/index.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/index.js +0 -8
- package/dist/core/extract/asyncapi/index.js.map +0 -1
- package/dist/core/extract/asyncapi/payloads.d.ts +0 -20
- package/dist/core/extract/asyncapi/payloads.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/payloads.js +0 -421
- package/dist/core/extract/asyncapi/payloads.js.map +0 -1
- package/dist/core/extract/asyncapi/topics.d.ts +0 -27
- package/dist/core/extract/asyncapi/topics.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/topics.js +0 -368
- package/dist/core/extract/asyncapi/topics.js.map +0 -1
- package/dist/core/extract/asyncapi/types.d.ts +0 -129
- package/dist/core/extract/asyncapi/types.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/types.js +0 -5
- package/dist/core/extract/asyncapi/types.js.map +0 -1
- package/dist/core/extract/asyncapi/validate.d.ts +0 -29
- package/dist/core/extract/asyncapi/validate.d.ts.map +0 -1
- package/dist/core/extract/asyncapi/validate.js +0 -156
- package/dist/core/extract/asyncapi/validate.js.map +0 -1
- package/dist/core/extract/component.d.ts +0 -204
- package/dist/core/extract/component.d.ts.map +0 -1
- package/dist/core/extract/component.js +0 -258
- package/dist/core/extract/component.js.map +0 -1
- package/dist/core/extract/detect.d.ts +0 -35
- package/dist/core/extract/detect.d.ts.map +0 -1
- package/dist/core/extract/detect.js +0 -89
- package/dist/core/extract/detect.js.map +0 -1
- package/dist/core/extract/index.d.ts +0 -12
- package/dist/core/extract/index.d.ts.map +0 -1
- package/dist/core/extract/index.js +0 -6
- package/dist/core/extract/index.js.map +0 -1
- package/dist/core/extract/ladder.d.ts +0 -79
- package/dist/core/extract/ladder.d.ts.map +0 -1
- package/dist/core/extract/ladder.js +0 -70
- package/dist/core/extract/ladder.js.map +0 -1
- package/dist/core/extract/openapi/index.d.ts +0 -43
- package/dist/core/extract/openapi/index.d.ts.map +0 -1
- package/dist/core/extract/openapi/index.js +0 -142
- package/dist/core/extract/openapi/index.js.map +0 -1
- package/dist/core/extract/openapi/route1.d.ts +0 -36
- package/dist/core/extract/openapi/route1.d.ts.map +0 -1
- package/dist/core/extract/openapi/route1.js +0 -333
- package/dist/core/extract/openapi/route1.js.map +0 -1
- package/dist/core/extract/openapi/route2-introspect.d.ts +0 -18
- package/dist/core/extract/openapi/route2-introspect.d.ts.map +0 -1
- package/dist/core/extract/openapi/route2-introspect.js +0 -249
- package/dist/core/extract/openapi/route2-introspect.js.map +0 -1
- package/dist/core/extract/openapi/route2.d.ts +0 -69
- package/dist/core/extract/openapi/route2.d.ts.map +0 -1
- package/dist/core/extract/openapi/route2.js +0 -211
- package/dist/core/extract/openapi/route2.js.map +0 -1
- package/dist/core/extract/openapi/route3.d.ts +0 -26
- package/dist/core/extract/openapi/route3.d.ts.map +0 -1
- package/dist/core/extract/openapi/route3.js +0 -737
- package/dist/core/extract/openapi/route3.js.map +0 -1
- package/dist/core/extract/openapi/types.d.ts +0 -125
- package/dist/core/extract/openapi/types.d.ts.map +0 -1
- package/dist/core/extract/openapi/types.js +0 -5
- package/dist/core/extract/openapi/types.js.map +0 -1
- package/dist/core/extract/openapi/validate.d.ts +0 -29
- package/dist/core/extract/openapi/validate.d.ts.map +0 -1
- package/dist/core/extract/openapi/validate.js +0 -200
- package/dist/core/extract/openapi/validate.js.map +0 -1
- package/dist/core/extract/orm/drizzle.d.ts +0 -20
- package/dist/core/extract/orm/drizzle.d.ts.map +0 -1
- package/dist/core/extract/orm/drizzle.js +0 -283
- package/dist/core/extract/orm/drizzle.js.map +0 -1
- package/dist/core/extract/orm/information-schema.d.ts +0 -26
- package/dist/core/extract/orm/information-schema.d.ts.map +0 -1
- package/dist/core/extract/orm/information-schema.js +0 -142
- package/dist/core/extract/orm/information-schema.js.map +0 -1
- package/dist/core/extract/orm/prisma.d.ts +0 -23
- package/dist/core/extract/orm/prisma.d.ts.map +0 -1
- package/dist/core/extract/orm/prisma.js +0 -234
- package/dist/core/extract/orm/prisma.js.map +0 -1
- package/dist/core/extract/orm/typeorm.d.ts +0 -22
- package/dist/core/extract/orm/typeorm.d.ts.map +0 -1
- package/dist/core/extract/orm/typeorm.js +0 -269
- package/dist/core/extract/orm/typeorm.js.map +0 -1
- package/dist/core/extract/orm/types.d.ts +0 -97
- package/dist/core/extract/orm/types.d.ts.map +0 -1
- package/dist/core/extract/orm/types.js +0 -6
- package/dist/core/extract/orm/types.js.map +0 -1
- package/dist/core/extract/prompt.d.ts +0 -21
- package/dist/core/extract/prompt.d.ts.map +0 -1
- package/dist/core/extract/prompt.js +0 -79
- package/dist/core/extract/prompt.js.map +0 -1
- package/dist/core/extract/provider.d.ts +0 -121
- package/dist/core/extract/provider.d.ts.map +0 -1
- package/dist/core/extract/provider.js +0 -6
- package/dist/core/extract/provider.js.map +0 -1
- package/dist/core/extract/providers/node-ts.d.ts +0 -69
- package/dist/core/extract/providers/node-ts.d.ts.map +0 -1
- package/dist/core/extract/providers/node-ts.js +0 -320
- package/dist/core/extract/providers/node-ts.js.map +0 -1
- package/dist/core/extract/render/schema-md.d.ts +0 -16
- package/dist/core/extract/render/schema-md.d.ts.map +0 -1
- package/dist/core/extract/render/schema-md.js +0 -140
- package/dist/core/extract/render/schema-md.js.map +0 -1
- package/dist/core/extract/report.d.ts +0 -125
- package/dist/core/extract/report.d.ts.map +0 -1
- package/dist/core/extract/report.js +0 -52
- package/dist/core/extract/report.js.map +0 -1
- package/dist/core/extract/schema.d.ts +0 -34
- package/dist/core/extract/schema.d.ts.map +0 -1
- package/dist/core/extract/schema.js +0 -146
- package/dist/core/extract/schema.js.map +0 -1
- package/dist/core/extract/workspaces.d.ts +0 -33
- package/dist/core/extract/workspaces.d.ts.map +0 -1
- package/dist/core/extract/workspaces.js +0 -193
- package/dist/core/extract/workspaces.js.map +0 -1
- package/dist/core/providers/index.d.ts +0 -6
- package/dist/core/providers/index.d.ts.map +0 -1
- package/dist/core/providers/index.js +0 -2
- package/dist/core/providers/index.js.map +0 -1
- package/dist/core/providers/tracker.d.ts +0 -74
- package/dist/core/providers/tracker.d.ts.map +0 -1
- package/dist/core/providers/tracker.js +0 -38
- package/dist/core/providers/tracker.js.map +0 -1
- package/dist/core/scope/calibration.d.ts +0 -25
- package/dist/core/scope/calibration.d.ts.map +0 -1
- package/dist/core/scope/calibration.js +0 -52
- package/dist/core/scope/calibration.js.map +0 -1
- package/dist/core/scope/closure.d.ts +0 -31
- package/dist/core/scope/closure.d.ts.map +0 -1
- package/dist/core/scope/closure.js +0 -68
- package/dist/core/scope/closure.js.map +0 -1
- package/dist/core/scope/gate.d.ts +0 -41
- package/dist/core/scope/gate.d.ts.map +0 -1
- package/dist/core/scope/gate.js +0 -165
- package/dist/core/scope/gate.js.map +0 -1
- package/dist/core/scope/index.d.ts +0 -18
- package/dist/core/scope/index.d.ts.map +0 -1
- package/dist/core/scope/index.js +0 -12
- package/dist/core/scope/index.js.map +0 -1
- package/dist/core/scope/partition.d.ts +0 -36
- package/dist/core/scope/partition.d.ts.map +0 -1
- package/dist/core/scope/partition.js +0 -78
- package/dist/core/scope/partition.js.map +0 -1
- package/dist/core/scope/prompt.d.ts +0 -39
- package/dist/core/scope/prompt.d.ts.map +0 -1
- package/dist/core/scope/prompt.js +0 -123
- package/dist/core/scope/prompt.js.map +0 -1
- package/dist/core/scope/scoping.d.ts +0 -52
- package/dist/core/scope/scoping.d.ts.map +0 -1
- package/dist/core/scope/scoping.js +0 -99
- package/dist/core/scope/scoping.js.map +0 -1
- package/dist/core/scope/types.d.ts +0 -77
- package/dist/core/scope/types.d.ts.map +0 -1
- package/dist/core/scope/types.js +0 -5
- package/dist/core/scope/types.js.map +0 -1
- package/dist/core/scope/validate.d.ts +0 -47
- package/dist/core/scope/validate.d.ts.map +0 -1
- package/dist/core/scope/validate.js +0 -90
- package/dist/core/scope/validate.js.map +0 -1
- package/dist/core/verify/asyncapi-diff.d.ts +0 -34
- package/dist/core/verify/asyncapi-diff.d.ts.map +0 -1
- package/dist/core/verify/asyncapi-diff.js +0 -209
- package/dist/core/verify/asyncapi-diff.js.map +0 -1
- package/dist/core/verify/contract-diff.d.ts +0 -39
- package/dist/core/verify/contract-diff.d.ts.map +0 -1
- package/dist/core/verify/contract-diff.js +0 -63
- package/dist/core/verify/contract-diff.js.map +0 -1
- package/dist/core/verify/drift.d.ts +0 -47
- package/dist/core/verify/drift.d.ts.map +0 -1
- package/dist/core/verify/drift.js +0 -122
- package/dist/core/verify/drift.js.map +0 -1
- package/dist/core/verify/impact.d.ts +0 -22
- package/dist/core/verify/impact.d.ts.map +0 -1
- package/dist/core/verify/impact.js +0 -93
- package/dist/core/verify/impact.js.map +0 -1
- package/dist/core/verify/index.d.ts +0 -10
- package/dist/core/verify/index.d.ts.map +0 -1
- package/dist/core/verify/index.js +0 -9
- package/dist/core/verify/index.js.map +0 -1
- package/dist/core/verify/openapi-diff.d.ts +0 -29
- package/dist/core/verify/openapi-diff.d.ts.map +0 -1
- package/dist/core/verify/openapi-diff.js +0 -291
- package/dist/core/verify/openapi-diff.js.map +0 -1
- package/dist/core/verify/types.d.ts +0 -138
- package/dist/core/verify/types.d.ts.map +0 -1
- package/dist/core/verify/types.js +0 -5
- package/dist/core/verify/types.js.map +0 -1
- package/schemas/component.schema.json +0 -203
- package/schemas/flow.schema.json +0 -75
- package/schemas/scope-output.schema.json +0 -62
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ubiquitous-language structure check (S-002; specification §5, §8.2).
|
|
3
|
+
*
|
|
4
|
+
* `docs/domain/ubiquitous-language.md` is the repository's vocabulary,
|
|
5
|
+
* and a vocabulary file nothing validates rots the way every other
|
|
6
|
+
* unchecked document does. This module is the check: a term missing one
|
|
7
|
+
* of its five fields, a `Status` outside the two allowed forms, a
|
|
8
|
+
* `superseded by` pointing at a term that is not in the file, the same
|
|
9
|
+
* term twice, a bounded context that maps to nothing in the package
|
|
10
|
+
* map, or a term a changelog row says was added and the body no longer
|
|
11
|
+
* has — each fails `lint` (D-66). Two conditions only report: a
|
|
12
|
+
* `docs/tech.md` with no package map at all (once for the file, never
|
|
13
|
+
* once per term) and an `Origin` citing a decision log that is not
|
|
14
|
+
* present locally, which is what an archived log looks like from here.
|
|
15
|
+
*
|
|
16
|
+
* Zero terms is valid. It is the state of every fresh install, and
|
|
17
|
+
* `status: unfilled` means "no vocabulary established yet", never
|
|
18
|
+
* permission to invent one (D-66, D-68).
|
|
19
|
+
*
|
|
20
|
+
* HAND-PARSED, like its two siblings in this directory (D-49): no
|
|
21
|
+
* `yaml`, no Markdown library, no `typescript`. The module ships to
|
|
22
|
+
* consumers inside `dist/core/`, where devDependencies are absent, and
|
|
23
|
+
* the `verifier` is a second caller in consumer repositories. It is
|
|
24
|
+
* invoked as `tsx core/checks/run.ts`, never a compiled `dist/` path
|
|
25
|
+
* (D-48).
|
|
26
|
+
*
|
|
27
|
+
* The split between the two exported functions is the reason both
|
|
28
|
+
* exist. `checkGlossaryContent()` is pure over `(markdown, packageMap)`
|
|
29
|
+
* so every structural rule is testable as a string in, findings out.
|
|
30
|
+
* `checkGlossary()` owns the filesystem: reading the two files,
|
|
31
|
+
* resolving `feature#D-NN` origins against `workstream/`, and — when
|
|
32
|
+
* the glossary is simply absent — returning nothing at all, because a
|
|
33
|
+
* consumer who has not run `dev-tasks update` yet is `doctor`'s
|
|
34
|
+
* business, not `lint`'s (D-67, D-75).
|
|
35
|
+
*/
|
|
36
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { parseFrontmatter } from "./docs-structure.js";
|
|
39
|
+
import { readPackageMap } from "../distribution/workspace.js";
|
|
40
|
+
/** The one glossary, at the root of the repository (D-16). */
|
|
41
|
+
export const GLOSSARY_FILE = "docs/domain/ubiquitous-language.md";
|
|
42
|
+
/** The five frontmatter keys, asserted by presence only (D-75). */
|
|
43
|
+
const FRONTMATTER_KEYS = ["version", "name", "description", "status", "owner"];
|
|
44
|
+
/** The five fields every term carries, `none` included (FR-18). */
|
|
45
|
+
const TERM_FIELDS = ["Definition", "Forbidden synonyms", "Invariants", "Origin", "Status"];
|
|
46
|
+
/** `superseded by <Term> (<feature#D-NN>)` — the only non-`active` Status. */
|
|
47
|
+
const SUPERSEDED = /^superseded by\s+(.+?)\s+\(\s*([A-Za-z0-9._/-]+#D-\d+)\s*\)$/;
|
|
48
|
+
/**
|
|
49
|
+
* One `Origin` element that names a decision rather than a file:
|
|
50
|
+
* `feature#D-NN`.
|
|
51
|
+
*
|
|
52
|
+
* Anchored, and applied per comma-separated element rather than to the
|
|
53
|
+
* whole field. An `Origin` names its sources the way a person would —
|
|
54
|
+
* `FR-1, shared-understanding#D-01`, or a bare PRD path — and anchoring
|
|
55
|
+
* to the whole field meant none of this repository's eight Origins
|
|
56
|
+
* matched, not one, so the archived-origin rule had never fired since
|
|
57
|
+
* S-002 and all four `#D-NN` citations here were invisible (S-006 F-1).
|
|
58
|
+
* Comma lists are simply the most common shape (four of the eight).
|
|
59
|
+
* Elements that are not decisions — a PRD path, `FR-4`, `ADR-006`,
|
|
60
|
+
* prose — still match nothing, which is what keeps this to decision
|
|
61
|
+
* citations only.
|
|
62
|
+
*/
|
|
63
|
+
const DECISION_ORIGIN = /^([A-Za-z0-9._-]+)#D-\d+$/;
|
|
64
|
+
/** The decision citations of one `Origin` field, in document order. */
|
|
65
|
+
function decisionCitations(origin) {
|
|
66
|
+
const found = [];
|
|
67
|
+
for (const element of origin.split(",")) {
|
|
68
|
+
const citation = element.trim();
|
|
69
|
+
const decision = citation.match(DECISION_ORIGIN);
|
|
70
|
+
if (decision !== null)
|
|
71
|
+
found.push({ citation, feature: decision[1] });
|
|
72
|
+
}
|
|
73
|
+
return found;
|
|
74
|
+
}
|
|
75
|
+
/** LF and no BOM, before anything below looks at a single line. */
|
|
76
|
+
function normalize(content) {
|
|
77
|
+
return content.replace(/^/, "").replace(/\r\n/g, "\n");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Walk the body into contexts, terms, and the changelog's `+term` list.
|
|
81
|
+
*
|
|
82
|
+
* Fenced code blocks are skipped (D-74). The PRD's own Data
|
|
83
|
+
* Requirements section shows the file's shape inside a fence — a parser
|
|
84
|
+
* that reads fences finds a `### <Term>` with no bullets there and
|
|
85
|
+
* fails the document that documents the format.
|
|
86
|
+
*/
|
|
87
|
+
function parseGlossary(markdown) {
|
|
88
|
+
const lines = normalize(markdown).split("\n");
|
|
89
|
+
const terms = [];
|
|
90
|
+
const contexts = [];
|
|
91
|
+
const changelogTerms = [];
|
|
92
|
+
let fenced = false;
|
|
93
|
+
let context = null;
|
|
94
|
+
let current = null;
|
|
95
|
+
let inChangelog = false;
|
|
96
|
+
for (const line of lines) {
|
|
97
|
+
const trimmed = line.trim();
|
|
98
|
+
if (/^(```|~~~)/.test(trimmed)) {
|
|
99
|
+
fenced = !fenced;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (fenced)
|
|
103
|
+
continue;
|
|
104
|
+
const context2 = trimmed.match(/^##\s+Bounded Context:\s*(.+?)\s*$/);
|
|
105
|
+
if (context2) {
|
|
106
|
+
context = context2[1];
|
|
107
|
+
if (!contexts.includes(context))
|
|
108
|
+
contexts.push(context);
|
|
109
|
+
current = null;
|
|
110
|
+
inChangelog = false;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (/^##\s/.test(trimmed) && !/^###/.test(trimmed)) {
|
|
114
|
+
context = null;
|
|
115
|
+
current = null;
|
|
116
|
+
inChangelog = /^##\s+Changelog\s*$/.test(trimmed);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const heading3 = trimmed.match(/^###\s+(.+?)\s*$/);
|
|
120
|
+
if (heading3) {
|
|
121
|
+
current = { name: heading3[1], context, fields: new Map() };
|
|
122
|
+
terms.push(current);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (inChangelog && trimmed.startsWith("|")) {
|
|
126
|
+
for (const cell of trimmed.split("|")) {
|
|
127
|
+
for (const part of cell.split(",")) {
|
|
128
|
+
const item = part.trim();
|
|
129
|
+
if (item.startsWith("+") && item.length > 1)
|
|
130
|
+
changelogTerms.push(item.slice(1).trim());
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (current === null)
|
|
136
|
+
continue;
|
|
137
|
+
const bullet = trimmed.match(/^[-*]\s*([A-Za-z][A-Za-z ]*?)\s*:\s*(.*)$/);
|
|
138
|
+
if (bullet) {
|
|
139
|
+
const key = bullet[1];
|
|
140
|
+
if (TERM_FIELDS.includes(key) && !current.fields.has(key)) {
|
|
141
|
+
current.fields.set(key, bullet[2].trim());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return { terms, contexts, changelogTerms };
|
|
146
|
+
}
|
|
147
|
+
function finding(rule, message) {
|
|
148
|
+
return { rule, file: GLOSSARY_FILE, message };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Check one glossary's already-read content against a package map.
|
|
152
|
+
*
|
|
153
|
+
* Pure: no filesystem, no clock, no environment. `packageMap` is null
|
|
154
|
+
* when `docs/tech.md` has no `## Package Map` section — that is one
|
|
155
|
+
* finding about the map, not a verdict on any context heading, so
|
|
156
|
+
* context resolution is skipped entirely rather than failing every
|
|
157
|
+
* heading for a table that was never written (D-66).
|
|
158
|
+
*/
|
|
159
|
+
export function checkGlossaryContent(markdown, packageMap) {
|
|
160
|
+
const failures = [];
|
|
161
|
+
const staleness = [];
|
|
162
|
+
const parsed = parseFrontmatter(markdown);
|
|
163
|
+
if (parsed === null) {
|
|
164
|
+
failures.push(finding("glossary-frontmatter", `${GLOSSARY_FILE} has no frontmatter block.`));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
for (const key of FRONTMATTER_KEYS) {
|
|
168
|
+
const value = parsed.values[key];
|
|
169
|
+
if (value === undefined || value.length === 0) {
|
|
170
|
+
failures.push(finding("glossary-frontmatter", `${GLOSSARY_FILE} is missing frontmatter key '${key}'.`));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const glossary = parseGlossary(markdown);
|
|
175
|
+
const names = new Set(glossary.terms.map((t) => t.name.toLowerCase()));
|
|
176
|
+
const seen = new Set();
|
|
177
|
+
for (const term of glossary.terms) {
|
|
178
|
+
const key = term.name.toLowerCase();
|
|
179
|
+
if (seen.has(key)) {
|
|
180
|
+
failures.push(finding("glossary-term-duplicate", `${GLOSSARY_FILE}: term '${term.name}' appears more than once. One term means one thing here.`));
|
|
181
|
+
}
|
|
182
|
+
seen.add(key);
|
|
183
|
+
for (const field of TERM_FIELDS) {
|
|
184
|
+
const value = term.fields.get(field);
|
|
185
|
+
if (value === undefined || value.length === 0) {
|
|
186
|
+
failures.push(finding("glossary-field-missing", `${GLOSSARY_FILE}: term '${term.name}' is missing '${field}'. All five fields are present, 'none' included.`));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const status = term.fields.get("Status");
|
|
190
|
+
if (status !== undefined && status.length > 0 && status !== "active") {
|
|
191
|
+
const superseded = status.match(SUPERSEDED);
|
|
192
|
+
if (superseded === null) {
|
|
193
|
+
failures.push(finding("glossary-status-invalid", `${GLOSSARY_FILE}: term '${term.name}' has Status '${status}', expected 'active' or 'superseded by <Term> (<feature#D-NN>)'.`));
|
|
194
|
+
}
|
|
195
|
+
else if (!names.has(superseded[1].toLowerCase())) {
|
|
196
|
+
failures.push(finding("glossary-superseded-dangling", `${GLOSSARY_FILE}: term '${term.name}' is superseded by '${superseded[1]}', which is not a term in this file.`));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (packageMap === null) {
|
|
201
|
+
staleness.push(finding("glossary-package-map-absent", `${GLOSSARY_FILE}: docs/tech.md has no package map, so bounded contexts cannot be resolved. Run activity-init to record one.`));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Exact match, both ways (D-74). A context that differs by case is
|
|
205
|
+
// a second name for the same thing, which is the drift this file
|
|
206
|
+
// exists to prevent.
|
|
207
|
+
const known = new Set();
|
|
208
|
+
for (const row of packageMap) {
|
|
209
|
+
known.add(row.name);
|
|
210
|
+
if (row.boundedContext !== null)
|
|
211
|
+
known.add(row.boundedContext);
|
|
212
|
+
}
|
|
213
|
+
for (const context of glossary.contexts) {
|
|
214
|
+
if (!known.has(context)) {
|
|
215
|
+
failures.push(finding("glossary-context-unresolved", `${GLOSSARY_FILE}: bounded context '${context}' matches no package name and no Bounded context value in the docs/tech.md package map.`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Append-only, without git: a term the changelog says a version added
|
|
220
|
+
// and the body no longer carries was deleted, and terms are
|
|
221
|
+
// superseded, never deleted (FR-19).
|
|
222
|
+
const reported = new Set();
|
|
223
|
+
for (const added of glossary.changelogTerms) {
|
|
224
|
+
const key = added.toLowerCase();
|
|
225
|
+
if (key.length === 0 || names.has(key) || reported.has(key))
|
|
226
|
+
continue;
|
|
227
|
+
reported.add(key);
|
|
228
|
+
failures.push(finding("glossary-term-removed", `${GLOSSARY_FILE}: term '${added}' was added in a changelog row but is not in the file. Terms are superseded, never deleted.`));
|
|
229
|
+
}
|
|
230
|
+
return { failures, staleness };
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Check the glossary in a repository: the file, its package map, and
|
|
234
|
+
* the origins its terms cite.
|
|
235
|
+
*
|
|
236
|
+
* An absent glossary produces nothing (D-75). The repository may simply
|
|
237
|
+
* predate the file; `doctor` already warns about that, and two tools
|
|
238
|
+
* answering the same question is two tools to disagree the first time
|
|
239
|
+
* one of them changes (D-67).
|
|
240
|
+
*/
|
|
241
|
+
export function checkGlossary(repoRoot) {
|
|
242
|
+
const path = join(repoRoot, GLOSSARY_FILE);
|
|
243
|
+
if (!existsSync(path))
|
|
244
|
+
return { failures: [], staleness: [] };
|
|
245
|
+
const markdown = readFileSync(path, "utf-8");
|
|
246
|
+
const result = checkGlossaryContent(markdown, readPackageMap(repoRoot));
|
|
247
|
+
// Origin resolution needs the filesystem, which is why it lives here
|
|
248
|
+
// and not in the pure function (D-75). A `feature#D-NN` whose log is
|
|
249
|
+
// gone is an archived log, not a defect: the reference is reported so
|
|
250
|
+
// it can be re-pointed, and never fails the gate (D-66).
|
|
251
|
+
const seen = new Set();
|
|
252
|
+
for (const term of parseGlossary(markdown).terms) {
|
|
253
|
+
const origin = term.fields.get("Origin");
|
|
254
|
+
if (origin === undefined)
|
|
255
|
+
continue;
|
|
256
|
+
for (const { citation, feature } of decisionCitations(origin)) {
|
|
257
|
+
if (seen.has(feature))
|
|
258
|
+
continue;
|
|
259
|
+
seen.add(feature);
|
|
260
|
+
if (!existsSync(join(repoRoot, "workstream", `decisions-${feature}.md`))) {
|
|
261
|
+
result.staleness.push(finding("glossary-origin-unresolved", `${GLOSSARY_FILE}: Origin '${citation}' cites workstream/decisions-${feature}.md, which is not present locally (an archived log reads this way).`));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return result;
|
|
266
|
+
}
|
|
267
|
+
/* -------------------------------------------------------------------------
|
|
268
|
+
* `## Vocabulary` in PRDs and specifications (S-003; §5, §8.3, D-65, D-71)
|
|
269
|
+
* ---------------------------------------------------------------------- */
|
|
270
|
+
/** Where PRDs live, and the only tree `lint` walks for §8.3. */
|
|
271
|
+
export const REQUIREMENTS_DIR = "docs/requirements";
|
|
272
|
+
/** The one line a document with no domain concept carries (spec §5). */
|
|
273
|
+
const NO_CONCEPTS = /^None\s*[—–-]\s*\S.*$/;
|
|
274
|
+
/** `conflict → D-NN`, `conflict -> feature#D-NN` — both arrows (D-74). */
|
|
275
|
+
const CONFLICT = /^conflict\s*(?:→|->)\s*(?:[A-Za-z0-9._/-]+#)?D-\d+$/i;
|
|
276
|
+
/** Cells whose content is a placeholder rather than an answer. */
|
|
277
|
+
const PLACEHOLDER = new Set(["", "—", "–", "-", "n/a", "na", "tbd", "?"]);
|
|
278
|
+
/**
|
|
279
|
+
* The lines of a level-2 section, or null when the section is absent.
|
|
280
|
+
*
|
|
281
|
+
* Fenced blocks are skipped in both directions (D-74): a `##
|
|
282
|
+
* Vocabulary` inside a fence does not open a section, and a fenced
|
|
283
|
+
* example inside a real section is not part of the section's content.
|
|
284
|
+
* Both halves are load-bearing and for the same reason. This
|
|
285
|
+
* specification's own §5 shows the Vocabulary table inside a fence; a
|
|
286
|
+
* parser that reads the opening fence declares every document
|
|
287
|
+
* describing the format compliant, and a parser that reads the fence
|
|
288
|
+
* body reports rows against a real document for an example it was shown
|
|
289
|
+
* — including a fenced `None —` line, which would pass the whole
|
|
290
|
+
* section on nothing.
|
|
291
|
+
*
|
|
292
|
+
* The section ends at the next ATX heading of depth 1 or 2. A `#` that
|
|
293
|
+
* did not close it made every table in the remainder of the file a
|
|
294
|
+
* Vocabulary table (§8.3 describes no such reach).
|
|
295
|
+
*/
|
|
296
|
+
function sectionLines(markdown, heading) {
|
|
297
|
+
const lines = normalize(markdown).split("\n");
|
|
298
|
+
let fenced = false;
|
|
299
|
+
let collecting = false;
|
|
300
|
+
const collected = [];
|
|
301
|
+
for (const line of lines) {
|
|
302
|
+
const trimmed = line.trim();
|
|
303
|
+
if (/^(```|~~~)/.test(trimmed)) {
|
|
304
|
+
fenced = !fenced;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (fenced)
|
|
308
|
+
continue;
|
|
309
|
+
if (/^#{1,2}(?!#)\s/.test(trimmed)) {
|
|
310
|
+
if (collecting)
|
|
311
|
+
return collected;
|
|
312
|
+
if (heading.test(trimmed)) {
|
|
313
|
+
collecting = true;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (collecting)
|
|
319
|
+
collected.push(line);
|
|
320
|
+
}
|
|
321
|
+
return collecting ? collected : null;
|
|
322
|
+
}
|
|
323
|
+
/** True for a Markdown table delimiter row: `| --- |`, `| - |`, `|:-:|`. */
|
|
324
|
+
function isDelimiterRow(line) {
|
|
325
|
+
return /^\|[\s:|-]+\|$/.test(line.trim());
|
|
326
|
+
}
|
|
327
|
+
/** Trim, fold non-breaking spaces, and drop the Markdown code ticks. */
|
|
328
|
+
function cell(value) {
|
|
329
|
+
return value.replace(/ /g, " ").replace(/`/g, "").trim();
|
|
330
|
+
}
|
|
331
|
+
function isEmpty(value) {
|
|
332
|
+
return PLACEHOLDER.has(value.toLowerCase());
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Check one document's `## Vocabulary` section against the glossary.
|
|
336
|
+
*
|
|
337
|
+
* Pure over `(markdown, glossaryMarkdown)`; `file` only names the
|
|
338
|
+
* document in the findings, so the same function serves `lint`'s walk,
|
|
339
|
+
* `activity-refine` before it presents a PRD, and
|
|
340
|
+
* `activity-generate-spec` before it presents a specification (D-75).
|
|
341
|
+
*
|
|
342
|
+
* Structural only (D-65). No prose is read: a document may say "widget"
|
|
343
|
+
* two hundred times and this function will never mention it. A checker
|
|
344
|
+
* that guesses which nouns are domain terms produces findings nobody
|
|
345
|
+
* can act on, and a gate nobody can act on is a gate everybody learns
|
|
346
|
+
* to skip.
|
|
347
|
+
*
|
|
348
|
+
* `glossaryMarkdown` is null when the repository has no glossary yet,
|
|
349
|
+
* and then `existing` rows are taken at their word — there is nothing
|
|
350
|
+
* to resolve against, and absence is `doctor`'s warning (D-67, D-75).
|
|
351
|
+
*
|
|
352
|
+
* Both rules are `failures`: AC-07 says an unaccounted term fails
|
|
353
|
+
* refinement (D-71).
|
|
354
|
+
*/
|
|
355
|
+
export function checkVocabularySection(markdown, glossaryMarkdown, file = "<document>") {
|
|
356
|
+
const failures = [];
|
|
357
|
+
const report = (rule, message) => {
|
|
358
|
+
failures.push({ rule, file, message });
|
|
359
|
+
};
|
|
360
|
+
const section = sectionLines(markdown, /^##(?!#)\s+Vocabulary\s*$/);
|
|
361
|
+
if (section === null) {
|
|
362
|
+
report("vocabulary-missing", `${file} has no '## Vocabulary' section. Every term the document uses must be listed as existing, proposed, or resolved by a decision.`);
|
|
363
|
+
return { failures, staleness: [] };
|
|
364
|
+
}
|
|
365
|
+
const known = new Set();
|
|
366
|
+
if (glossaryMarkdown !== null) {
|
|
367
|
+
for (const term of parseGlossary(glossaryMarkdown).terms)
|
|
368
|
+
known.add(term.name.toLowerCase());
|
|
369
|
+
}
|
|
370
|
+
// The sentinel stands for the whole section, and only then: spec §5
|
|
371
|
+
// says a document with no domain concept "carries the section with
|
|
372
|
+
// one line". Accepting it wherever it appears turned any prose
|
|
373
|
+
// opening with `None —` into a clean result before a single row was
|
|
374
|
+
// read, which is an author bypassing AC-07 by writing a sentence.
|
|
375
|
+
const content = section.filter((line) => line.trim().length > 0);
|
|
376
|
+
if (content.length === 1 && NO_CONCEPTS.test(content[0].trim())) {
|
|
377
|
+
return { failures, staleness: [] };
|
|
378
|
+
}
|
|
379
|
+
const rows = [];
|
|
380
|
+
for (const line of section) {
|
|
381
|
+
const trimmed = line.trim();
|
|
382
|
+
if (!trimmed.startsWith("|"))
|
|
383
|
+
continue;
|
|
384
|
+
if (isDelimiterRow(trimmed))
|
|
385
|
+
continue;
|
|
386
|
+
const cells = trimmed
|
|
387
|
+
.replace(/\|\s*$/, "")
|
|
388
|
+
.split("|")
|
|
389
|
+
.slice(1)
|
|
390
|
+
.map(cell);
|
|
391
|
+
if (cells.length === 0)
|
|
392
|
+
continue;
|
|
393
|
+
if (cells[0].toLowerCase() === "term")
|
|
394
|
+
continue;
|
|
395
|
+
rows.push(cells);
|
|
396
|
+
}
|
|
397
|
+
if (rows.length === 0) {
|
|
398
|
+
report("vocabulary-incomplete", `${file}: the '## Vocabulary' section has no rows. List the document's terms, or state 'None — this PRD introduces no domain concepts.'`);
|
|
399
|
+
return { failures, staleness: [] };
|
|
400
|
+
}
|
|
401
|
+
for (const cells of rows) {
|
|
402
|
+
const term = cells[0].length > 0 ? cells[0] : "(unnamed row)";
|
|
403
|
+
const status = (cells[1] ?? "").replace(/\s+/g, " ");
|
|
404
|
+
const lower = status.toLowerCase();
|
|
405
|
+
if (lower === "existing") {
|
|
406
|
+
if (glossaryMarkdown !== null && !known.has(term.toLowerCase())) {
|
|
407
|
+
report("vocabulary-incomplete", `${file}: row '${term}' is marked 'existing' but ${GLOSSARY_FILE} has no such term. Propose it instead, or correct the spelling.`);
|
|
408
|
+
}
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (lower === "proposed") {
|
|
412
|
+
if (known.has(term.toLowerCase())) {
|
|
413
|
+
report("vocabulary-incomplete", `${file}: row '${term}' is marked 'proposed' but ${GLOSSARY_FILE} already defines it. Use 'existing'.`);
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
const missing = ["bounded context", "definition", "forbidden synonyms"].filter((_label, index) => isEmpty(cells[index + 2] ?? ""));
|
|
417
|
+
if (missing.length > 0) {
|
|
418
|
+
report("vocabulary-incomplete", `${file}: proposed row '${term}' is missing ${missing.join(", ")}. A proposal carries all three, and 'none' is an answer.`);
|
|
419
|
+
}
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
if (CONFLICT.test(status))
|
|
423
|
+
continue;
|
|
424
|
+
report("vocabulary-incomplete", `${file}: row '${term}' has status '${status}', expected 'existing', 'proposed', or 'conflict → D-NN'.`);
|
|
425
|
+
}
|
|
426
|
+
return { failures, staleness: [] };
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Run the Vocabulary check over every PRD in `docs/requirements/`.
|
|
430
|
+
*
|
|
431
|
+
* The skip rule lives here rather than in the check, because it is
|
|
432
|
+
* about `lint`'s reach and not about what a Vocabulary section means
|
|
433
|
+
* (§8.3). A PRD with neither `## Vocabulary` nor `## Decisions`
|
|
434
|
+
* predates the grilling phases entirely: it was never interviewed, so
|
|
435
|
+
* failing it now would turn this gate red on every repository that
|
|
436
|
+
* adopted the harness before today, and a gate that is red on arrival
|
|
437
|
+
* is a gate its owners turn off.
|
|
438
|
+
*
|
|
439
|
+
* Specifications under `workstream/` are not walked. They are checked
|
|
440
|
+
* by `activity-generate-spec` before presentation (D-75), where the
|
|
441
|
+
* author is present to answer; `lint` has no business failing a
|
|
442
|
+
* working draft.
|
|
443
|
+
*/
|
|
444
|
+
export function checkVocabularyFiles(repoRoot) {
|
|
445
|
+
const dir = join(repoRoot, REQUIREMENTS_DIR);
|
|
446
|
+
if (!existsSync(dir))
|
|
447
|
+
return { failures: [], staleness: [] };
|
|
448
|
+
const glossaryPath = join(repoRoot, GLOSSARY_FILE);
|
|
449
|
+
const glossaryMarkdown = existsSync(glossaryPath) ? readFileSync(glossaryPath, "utf-8") : null;
|
|
450
|
+
const failures = [];
|
|
451
|
+
for (const entry of readdirSync(dir)
|
|
452
|
+
.filter((f) => f.endsWith(".md"))
|
|
453
|
+
.sort()) {
|
|
454
|
+
// A *directory* named `*.md` is legal and rare, and reading one
|
|
455
|
+
// throws EISDIR out of `lint` with a message that points nowhere
|
|
456
|
+
// near this file.
|
|
457
|
+
const path = join(dir, entry);
|
|
458
|
+
if (!statSync(path).isFile())
|
|
459
|
+
continue;
|
|
460
|
+
const markdown = readFileSync(path, "utf-8");
|
|
461
|
+
const hasVocabulary = sectionLines(markdown, /^##(?!#)\s+Vocabulary\s*$/) !== null;
|
|
462
|
+
const hasDecisions = sectionLines(markdown, /^##(?!#)\s+Decisions\b.*$/) !== null;
|
|
463
|
+
if (!hasVocabulary && !hasDecisions)
|
|
464
|
+
continue;
|
|
465
|
+
failures.push(...checkVocabularySection(markdown, glossaryMarkdown, `${REQUIREMENTS_DIR}/${entry}`)
|
|
466
|
+
.failures);
|
|
467
|
+
}
|
|
468
|
+
return { failures, staleness: [] };
|
|
469
|
+
}
|
|
470
|
+
/* -------------------------------------------------------------------------
|
|
471
|
+
* New exported identifiers against the forbidden synonyms (S-005;
|
|
472
|
+
* §8.6, FR-23, AC-15, D-60, D-63, D-64, D-73)
|
|
473
|
+
* ---------------------------------------------------------------------- */
|
|
474
|
+
/**
|
|
475
|
+
* `export <kind> <Identifier>`, with the diff's `+` optional (D-73).
|
|
476
|
+
*
|
|
477
|
+
* A line that begins with a space (an unchanged context line in a diff)
|
|
478
|
+
* or with `-` (a removed line) does not match, and that asymmetry is
|
|
479
|
+
* the point: the scan is about what a PR *adds*. Reporting a deletion
|
|
480
|
+
* would ask an author to fix vocabulary they just removed.
|
|
481
|
+
*
|
|
482
|
+
* `export default class Foo` is not matched. A regex cannot reach a
|
|
483
|
+
* default export's name without becoming a parser, and D-60 chose the
|
|
484
|
+
* regex over the compiler API because this module ships inside
|
|
485
|
+
* `dist/core/`, where `typescript` — a devDependency — is absent. The
|
|
486
|
+
* miss is documented in the specification's risk table and pinned by a
|
|
487
|
+
* test, so the next reader learns it is a choice.
|
|
488
|
+
*/
|
|
489
|
+
const EXPORT_DECLARATION = /^(?:\+\s*)?export\s+(?:async\s+)?(?:const|let|var|function|class|type|interface|enum)\s+([A-Za-z_$][\w$]*)/;
|
|
490
|
+
/** `export { a, b as c }` lists, including `export type { … }` re-exports. */
|
|
491
|
+
const EXPORT_LIST = /^(?:\+\s*)?export\s+(?:type\s+)?\{([^}]*)\}/;
|
|
492
|
+
/** `b as c` — `c` is what a consumer types, so `c` is the identifier (D-73). */
|
|
493
|
+
const ALIAS = /\bas\s+([A-Za-z_$][\w$]*)$/;
|
|
494
|
+
/** Cells that decline to name a synonym rather than naming one. */
|
|
495
|
+
const NO_SYNONYMS = new Set(["", "none", "—", "–", "-", "n/a", "na"]);
|
|
496
|
+
/**
|
|
497
|
+
* One word, lower-cased and de-pluralized — the same function on both
|
|
498
|
+
* sides of every comparison (D-73).
|
|
499
|
+
*
|
|
500
|
+
* The plural rule strips `es` only after `s`, `x`, `z`, `ch`, or `sh`
|
|
501
|
+
* (so `classes` → `class` and `boxes` → `box`), and otherwise a single
|
|
502
|
+
* trailing `s` not preceded by another `s` (so `types` → `type` and
|
|
503
|
+
* `staleness` is left alone). Applied naively in the other order it
|
|
504
|
+
* turns `types` into `typ`.
|
|
505
|
+
*
|
|
506
|
+
* It is wrong about English in places — `status` becomes `statu`, and
|
|
507
|
+
* `buses` → `bus` → `bu` means it is not idempotent on every input.
|
|
508
|
+
* Neither costs anything here: both sides are normalized exactly once
|
|
509
|
+
* by this function, so they agree. A normalizer that is wrong the same
|
|
510
|
+
* way twice still matches; two sides that disagree do not.
|
|
511
|
+
*
|
|
512
|
+
* Exported for the RT-1/RT-2 property fixtures, which test the two
|
|
513
|
+
* halves of the rule directly rather than inferring them from findings.
|
|
514
|
+
*/
|
|
515
|
+
export function normalizeVocabularyWord(word) {
|
|
516
|
+
const lower = word.toLowerCase();
|
|
517
|
+
if (/(?:s|x|z|ch|sh)es$/.test(lower))
|
|
518
|
+
return lower.slice(0, -2);
|
|
519
|
+
if (/[^s]s$/.test(lower))
|
|
520
|
+
return lower.slice(0, -1);
|
|
521
|
+
return lower;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Split an identifier into its words: PascalCase, camelCase,
|
|
525
|
+
* snake_case, SCREAMING_CASE, and the acronym boundary.
|
|
526
|
+
*
|
|
527
|
+
* `HTTPModule` splits at the acronym (`http`, `module`), `V2Loader`
|
|
528
|
+
* keeps the digit with its word (`v2`, `loader`), and `module2` stays
|
|
529
|
+
* whole — the specification normalizes case and plural, and nothing
|
|
530
|
+
* else, so a digit stripper would invent a rule no one wrote. A leading
|
|
531
|
+
* `_` or `$` is dropped before splitting.
|
|
532
|
+
*/
|
|
533
|
+
export function splitIdentifierWords(identifier) {
|
|
534
|
+
const cleaned = identifier.replace(/^[_$]+/, "");
|
|
535
|
+
const words = cleaned.match(/[A-Z]+(?![a-z])[0-9]*|[A-Z][a-z0-9]*|[a-z][a-z0-9]*|[0-9]+/g);
|
|
536
|
+
return (words ?? []).map((word) => word.toLowerCase());
|
|
537
|
+
}
|
|
538
|
+
/** Every exported identifier an added line declares, in source order. */
|
|
539
|
+
function exportedIdentifiers(line) {
|
|
540
|
+
const list = line.match(EXPORT_LIST);
|
|
541
|
+
if (list !== null) {
|
|
542
|
+
const names = [];
|
|
543
|
+
for (const raw of list[1].split(",")) {
|
|
544
|
+
const entry = raw.trim().replace(/^type\s+/, "");
|
|
545
|
+
if (entry.length === 0)
|
|
546
|
+
continue;
|
|
547
|
+
const alias = entry.match(ALIAS);
|
|
548
|
+
const name = alias === null ? entry : alias[1];
|
|
549
|
+
if (/^[A-Za-z_$][\w$]*$/.test(name))
|
|
550
|
+
names.push(name);
|
|
551
|
+
}
|
|
552
|
+
return names;
|
|
553
|
+
}
|
|
554
|
+
const declaration = line.match(EXPORT_DECLARATION);
|
|
555
|
+
return declaration === null ? [] : [declaration[1]];
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* The strings an identifier is compared against, in reporting order.
|
|
559
|
+
*
|
|
560
|
+
* Each word first, then every adjacent word pair joined, then the whole
|
|
561
|
+
* identifier joined (D-73). The joins are what let a multi-word synonym
|
|
562
|
+
* match at all: `product-context` normalizes to `productcontext`, which
|
|
563
|
+
* is what `productContext` joins to. Non-adjacent pairs are not
|
|
564
|
+
* candidates — `productLoaderContext` is not `product context`, and
|
|
565
|
+
* matching any two words in any order would flag half of any codebase.
|
|
566
|
+
*/
|
|
567
|
+
function matchCandidates(words) {
|
|
568
|
+
const candidates = [];
|
|
569
|
+
const add = (value) => {
|
|
570
|
+
const normalized = normalizeVocabularyWord(value);
|
|
571
|
+
if (normalized.length > 0 && !candidates.includes(normalized))
|
|
572
|
+
candidates.push(normalized);
|
|
573
|
+
};
|
|
574
|
+
for (const word of words)
|
|
575
|
+
add(word);
|
|
576
|
+
for (let i = 0; i + 1 < words.length; i += 1)
|
|
577
|
+
add(words[i] + words[i + 1]);
|
|
578
|
+
if (words.length > 1)
|
|
579
|
+
add(words.join(""));
|
|
580
|
+
return candidates;
|
|
581
|
+
}
|
|
582
|
+
/** Separators carry no meaning across the comparison: `-`, `_`, space. */
|
|
583
|
+
function normalizeSynonym(synonym) {
|
|
584
|
+
return normalizeVocabularyWord(synonym.replace(/[-_\s]+/g, ""));
|
|
585
|
+
}
|
|
586
|
+
/** Forbidden synonyms of every term, keyed by their normalized form. */
|
|
587
|
+
function forbiddenSynonyms(glossaryMarkdown) {
|
|
588
|
+
const map = new Map();
|
|
589
|
+
for (const entry of parseGlossary(glossaryMarkdown).terms) {
|
|
590
|
+
const field = entry.fields.get("Forbidden synonyms");
|
|
591
|
+
if (field === undefined)
|
|
592
|
+
continue;
|
|
593
|
+
for (const raw of field.split(",")) {
|
|
594
|
+
const synonym = cell(raw);
|
|
595
|
+
if (NO_SYNONYMS.has(synonym.toLowerCase()))
|
|
596
|
+
continue;
|
|
597
|
+
const key = normalizeSynonym(synonym);
|
|
598
|
+
if (key.length === 0)
|
|
599
|
+
continue;
|
|
600
|
+
const existing = map.get(key);
|
|
601
|
+
if (existing === undefined)
|
|
602
|
+
map.set(key, { display: synonym, terms: [entry.name] });
|
|
603
|
+
else if (!existing.terms.includes(entry.name))
|
|
604
|
+
existing.terms.push(entry.name);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return map;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Scan a PR's added lines for exports that use a forbidden synonym.
|
|
611
|
+
*
|
|
612
|
+
* The `verifier` already holds the diff in Audit Mode; this turns it
|
|
613
|
+
* into a finding on stated grounds — "this export says `product-context`,
|
|
614
|
+
* and the glossary forbids that for `foundation document`" — instead of
|
|
615
|
+
* a reviewer's judgment about someone else's naming.
|
|
616
|
+
*
|
|
617
|
+
* Forbidden synonyms only (D-64). An identifier that matches no synonym
|
|
618
|
+
* produces nothing, and so does one that matches a *canonical* term:
|
|
619
|
+
* `DecisionLog` is the right name when `decision log` is the term, and
|
|
620
|
+
* a check that flagged it would flag nearly every export in a codebase
|
|
621
|
+
* that took its own glossary seriously.
|
|
622
|
+
*
|
|
623
|
+
* Every finding lands in `staleness` and never in `failures` (D-63).
|
|
624
|
+
* `lint` does not call this function at all, so its exit code cannot
|
|
625
|
+
* move; the `verifier` narrates hits as advisory and they never block
|
|
626
|
+
* PR readiness in this release. Extraction is a regex (D-60), so some
|
|
627
|
+
* early noise is certain, and a noisy gate that blocks is a gate its
|
|
628
|
+
* owners switch off.
|
|
629
|
+
*/
|
|
630
|
+
export function checkExportedIdentifiers(addedLines, glossaryMarkdown) {
|
|
631
|
+
const synonyms = forbiddenSynonyms(glossaryMarkdown);
|
|
632
|
+
if (synonyms.size === 0)
|
|
633
|
+
return { failures: [], staleness: [] };
|
|
634
|
+
const staleness = [];
|
|
635
|
+
for (const line of addedLines) {
|
|
636
|
+
for (const identifier of exportedIdentifiers(line)) {
|
|
637
|
+
const words = splitIdentifierWords(identifier);
|
|
638
|
+
const reported = new Set();
|
|
639
|
+
for (const candidate of matchCandidates(words)) {
|
|
640
|
+
const hit = synonyms.get(candidate);
|
|
641
|
+
if (hit === undefined || reported.has(candidate))
|
|
642
|
+
continue;
|
|
643
|
+
reported.add(candidate);
|
|
644
|
+
const terms = hit.terms.map((name) => `'${name}'`).join(" and ");
|
|
645
|
+
staleness.push(finding("glossary-forbidden-synonym", `${GLOSSARY_FILE}: new export '${identifier}' matches '${candidate}', a forbidden synonym ('${hit.display}') of term ${terms}. Advisory only (D-63): it does not block this PR.`));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return { failures: [], staleness };
|
|
650
|
+
}
|
|
651
|
+
//# sourceMappingURL=glossary.js.map
|