feat(enforce): complete enforcement loop with script/CI generators and docs update#11
Merged
feat(enforce): complete enforcement loop with script/CI generators and docs update#11
Conversation
…hecks Implements ENF Step 1+2: a structured JSON reporter for CI/agent consumption (--format json flag) and architecture layer boundary enforcement that detects cross-layer imports in Python and JS/TS files. Reporter converts ValidationResult into a Pydantic EnforcementReport model with fix suggestions and ADR references. Architecture checks parse "source -> target" boundary rules and use regex-based import detection with glob/directory-name file filtering. Enriches Violation dataclass with adr_title and fix_suggestion fields across all check types to support actionable output.
Implements Steps 3-4 of the enforcement loop: ScriptGenerator produces standalone stdlib-only Python validation scripts from ADR policies (import, pattern, architecture, structure checks) with a validate_all.py runner outputting JSON per EnforcementReport schema. Uses chr() to embed regex patterns safely in f-string-generated code. CIWorkflowGenerator produces GitHub Actions YAML that runs enforcement, posts structured PR comments, and fails on violations. Uses managed-file headers for safe overwrites. Adds generate-scripts and generate-ci CLI commands and integrates script generation into the approval workflow. 26 new tests covering both generators via subprocess execution.
…mpletion Staged enforcement, complete enforcement loop, and DX polish are all implemented. Update CHANGELOG, ROADMAP, README, and TECHNICAL to accurately describe current capabilities instead of listing them as planned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ADR enforcement currently requires manual setup of validation scripts and CI pipelines. Teams approve ADRs but have no automated path from policy definitions to running checks in CI. This closes the loop: approved ADRs automatically produce runnable enforcement infrastructure. Project documentation still referenced enforcement as planned — it now accurately reflects the current state.
Approach
Built in three layers:
Reporter + Architecture checks — A structured JSON reporter (
EnforcementReportPydantic model) gives CI and agents machine-readable output with fix suggestions and ADR references. Architecture layer boundary enforcement detects cross-layer imports in Python and JS/TS using regex-based import parsing with glob/directory-name file filtering. Enriched theViolationdataclass withadr_titleandfix_suggestionacross all check types.Script + CI workflow generators —
ScriptGeneratorproduces standalone stdlib-only Python validation scripts from ADR policies (import, pattern, architecture, structure checks) with avalidate_all.pyrunner outputting JSON per theEnforcementReportschema.CIWorkflowGeneratorproduces GitHub Actions YAML that runs enforcement, posts structured PR comments, and fails on violations. Both use managed-file headers for safe regeneration.Documentation update — Updated CHANGELOG, ROADMAP, README, and TECHNICAL to reflect the completed enforcement loop, staged enforcement, and DX polish as implemented (not planned). Restructured ROADMAP: moved 3 completed items to "Recently Completed", new "Up Next" = pattern linter adapters + config enforcement. Updated policy schema status table, added enforcement CLI commands to TECHNICAL, fixed test count (187→309), added 2 FAQ entries about staged enforcement and CI generation.
Key trade-off: generated scripts use only stdlib so they run anywhere without installing adr-kit as a dependency in the target project's CI.
What Was Tested
Risks