Skip to content

feat(scripts): add ADR consistency lint infrastructure #1551

@WilliamBerryiii

Description

@WilliamBerryiii

Problem statement

Issue #1515 re-architects the ADR agent into a thin phase-gated planner backed by an adr-author skill and four applyTo-scoped instruction files. That work depends on lint infrastructure that does not yet exist in hve-core:

  • A frontmatter schema for ADRs (kebab-case, 4-digit monotonic ID, decision lifecycle states).
  • A configuration schema for per-project .adr-config.md files.
  • A linter that enforces the 6-rule supersession contract, lineage integrity, and the 7-kind ASR trigger taxonomy across MADR v4 documents.

This infrastructure is a discrete, independently shippable deliverable that should land first so the planner upgrade (issue #1515) can register the ADR frontmatter schema in schema-mapping.json and rely on the linter for hard-fail validation.

Scope (in)

  • Linter core: PowerShell module under scripts/linting/AdrConsistency/ containing the parser, rule engine, and CLI entry point (Invoke-AdrConsistencyLint.ps1).
  • Rule registry: scripts/linting/AdrConsistency/rules.json declaring the 9 consistency rules (kebab-case slug, 4-digit monotonic ID, frontmatter completeness, supersession lineage, ASR trigger taxonomy, decision-state transitions, etc.).
  • JSON schemas under scripts/linting/schemas/:
    • adr-frontmatter.schema.json — per-ADR YAML frontmatter contract.
    • adr-config.schema.json — per-project .adr-config.md 6-field schema.
    • adr-rules.schema.json — meta-schema for the rule registry itself.
  • Editor schema bindings: register the three schemas in .vscode/settings.json so VS Code provides inline validation while authoring ADRs.
  • Pester test suite: scripts/tests/linting/Test-AdrConsistency.Tests.ps1 with 16 paired pass/fail fixtures under scripts/tests/linting/fixtures/adr-consistency/ covering each rule.
  • npm script: wire lint:adr-consistency for opt-in invocation. Do not add it to the lint:all chain in this PR — that wiring is deferred until the ADR Planner upgrade lands and produces the first valid ADRs to lint against (issue feat(agents): upgrade ADR agent to standards-aligned thin planner + adr-author skill #1515).
  • Markdownlint / cspell / frontmatter-validator excludes: prevent fixture noise from polluting other linters.
  • Skill subdirectory registration: add templates to the recognized skill subdirectory list so ADR template assets land in a stable home.
  • Plugin regeneration: npm run plugin:generate outputs.

Scope (out, deferred)

Acceptance criteria

  • Invoke-AdrConsistencyLint.ps1 runs cleanly against the pass-fixture set and surfaces structured failures for each fail-fixture.
  • npm run lint:adr-consistency is wired in package.json and is not part of lint:all.
  • Pester tests in scripts/tests/linting/Test-AdrConsistency.Tests.ps1 pass under npm run test:ps.
  • Three schemas (adr-frontmatter, adr-config, adr-rules) are valid JSON Schema and registered in .vscode/settings.json.
  • npm run plugin:generate and npm run plugin:validate exit clean.
  • npm run lint:all exits clean (proves the new linter is correctly excluded from the default chain).
  • Conventional Commits compliant per .github/instructions/hve-core/commit-message.instructions.md.

References


🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.

Metadata

Metadata

Labels

enhancementNew feature or requestinfrastructureRepository infrastructure and tooling
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions