Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 5e15aa4

Browse files
jacoponeclaude
andcommitted
feat: brownkit v0.2.1 — legacy code remediation toolkit
Complete implementation of brownkit, a spec-kit plugin for legacy code assessment, remediation, and graduation workflows. Core features: - Phase-based workflow engine (assessment → structure → testing → quality → validation → graduation) with state machine transitions - Language detection and plugin system (Python, JavaScript, Rust, Go) - Orchestrators for each phase with checkpoint/interruption recovery - Metrics collection, complexity analysis, and graduation gates - Speckit integration module with workflow enforcement - CLI with slash commands for all workflow phases - Comprehensive test suite (unit, contract, integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa90027 commit 5e15aa4

261 files changed

Lines changed: 45687 additions & 35 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# BrownKit: Assess
2+
3+
**Execute comprehensive brownfield project assessment.**
4+
5+
This command initiates the BrownKit workflow by analyzing the current project's structure, test coverage, code quality, and technical debt. This is the **entry point** for the brownfield-to-Spec-Kit transformation workflow.
6+
7+
## What This Command Does
8+
9+
1. **Enforces Workflow**: Validates this is the correct phase to execute
10+
2. **Project Analysis**: Scans codebase for structure, tests, and quality metrics
11+
3. **Baseline Metrics**: Establishes baseline for future regression detection
12+
4. **Planning Foundation**: Generates data needed for remediation planning
13+
5. **State Initialization**: Creates `.specify/memory/state.json` with results
14+
15+
## Workflow Position
16+
17+
```
18+
[YOU ARE HERE] → PLANNING → REMEDIATION → VALIDATION → GRADUATION → SPEC-KIT READY
19+
ASSESSMENT
20+
```
21+
22+
This phase can always be executed, even if state doesn't exist (it initializes the workflow).
23+
24+
## Assessment Dimensions
25+
26+
### 1. Structure Analysis
27+
- File organization and directory structure
28+
- Module dependencies and coupling
29+
- Dead code detection
30+
- Duplicate code identification
31+
32+
### 2. Testing Analysis
33+
- Test coverage percentage
34+
- Test types present (unit, integration, e2e)
35+
- Test quality and assertions
36+
- Missing test areas
37+
38+
### 3. Quality Analysis
39+
- Cyclomatic complexity (functions, classes, modules)
40+
- Code smells and anti-patterns
41+
- Linting violations
42+
- Security vulnerabilities
43+
44+
### 4. Build & CI Analysis
45+
- Build system configuration
46+
- CI/CD pipeline status
47+
- Deployment readiness
48+
- Documentation quality
49+
50+
## Expected Output
51+
52+
After completion, you'll see:
53+
- **Assessment summary** with key metrics
54+
- **Baseline metrics** recorded in state
55+
- **Recommended next steps** for planning
56+
- **State file** created at `.specify/memory/state.json`
57+
58+
## Next Steps
59+
60+
After assessment completes successfully:
61+
1. Review the assessment report
62+
2. Run `/brownkit.plan` to create remediation plan
63+
3. The workflow enforcer will guide you through remaining phases
64+
65+
## Technical Details
66+
67+
- **Command**: `brownfield assess` (CLI) or orchestrator
68+
- **Output**: `.specify/memory/state.json`
69+
- **Prerequisites**: None (entry point)
70+
- **Duration**: 2-5 minutes depending on codebase size
71+
72+
## Error Handling
73+
74+
If this command fails:
75+
- Check that you're in a project root directory
76+
- Ensure basic language tools are available (pytest, jest, cargo, go, etc.)
77+
- Review error output for specific issues
78+
- Re-run after addressing issues
79+
80+
---
81+
82+
**Note**: This command can be re-run multiple times. Each run updates the state with latest metrics, allowing you to track improvement over time.
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# BrownKit: Graduate
2+
3+
**Graduate to Spec-Kit readiness by generating project constitution.**
4+
5+
This command marks the successful completion of the BrownKit workflow by generating a project constitution that encodes all quality standards, testing requirements, and architectural constraints. The constitution becomes the foundation for Spec-Kit's specification-driven development.
6+
7+
## What This Command Does
8+
9+
1. **Enforces Workflow**: Validates all readiness gates passed before graduation
10+
2. **Constitution Generation**: Creates `constitution.md` from graduation metrics
11+
3. **Spec-Kit Integration**: Verifies Spec-Kit compatibility and initializes integration
12+
4. **Workflow Completion**: Marks project as SPEC_KIT_READY
13+
5. **Monitoring Setup**: Establishes baseline for post-graduation regression detection
14+
15+
## Workflow Position
16+
17+
```
18+
ASSESSMENT → PLANNING → REMEDIATION → VALIDATION → [YOU ARE HERE] → SPEC-KIT READY
19+
GRADUATION
20+
```
21+
22+
**Prerequisites**: All 7 readiness gates must pass validation.
23+
24+
## Graduation Process
25+
26+
### 1. Pre-Graduation Checks
27+
- ✅ All 7 readiness gates passed
28+
- ✅ Validation completed without regressions
29+
- ✅ Build and CI passing
30+
- ✅ No critical security issues
31+
32+
### 2. Constitution Generation
33+
The constitution encodes your project's quality standards:
34+
35+
**Structure Standards**:
36+
- Directory organization rules
37+
- Module coupling constraints
38+
- Dead code tolerance (0%)
39+
40+
**Testing Requirements**:
41+
- Minimum coverage percentage (from achieved metrics)
42+
- Required test types (unit, integration, e2e)
43+
- Test quality standards (assertions per test)
44+
45+
**Quality Gates**:
46+
- Maximum cyclomatic complexity (CCN threshold)
47+
- Linting rules and violation tolerance
48+
- Code smell detection rules
49+
50+
**Security Standards**:
51+
- Vulnerability tolerance by severity
52+
- Secrets detection requirements
53+
- Dependency update policy
54+
55+
**Build & CI Requirements**:
56+
- Build success criteria
57+
- CI pipeline requirements
58+
- Pre-commit hook configuration
59+
60+
### 3. Spec-Kit Compatibility Check
61+
Verifies:
62+
-`.claude/commands/speckit.specify.md` exists (Spec-Kit installed)
63+
-`.specify/memory/` directory writable
64+
- ✅ Slash commands available
65+
- ⚠️ Warns if constitution already exists (offers backup)
66+
67+
### 4. Constitution File Creation
68+
Generated file: `.specify/memory/constitution.md`
69+
70+
**Content includes**:
71+
```markdown
72+
# Project Constitution
73+
74+
Generated: YYYY-MM-DD
75+
Language: Python/JavaScript/Rust/Go
76+
Baseline: [graduation metrics]
77+
78+
## Quality Standards
79+
[Encoded from validation metrics]
80+
81+
## Testing Requirements
82+
[Coverage targets, test types, quality gates]
83+
84+
## Security Requirements
85+
[Vulnerability thresholds, secrets policy]
86+
87+
## Build & CI Requirements
88+
[Build configuration, pipeline requirements]
89+
90+
## Regression Thresholds
91+
[Post-graduation monitoring thresholds]
92+
```
93+
94+
## Expected Output
95+
96+
After graduation, you'll see:
97+
- **✅ Graduation successful** message
98+
- **Constitution path**: `.specify/memory/constitution.md`
99+
- **Spec-Kit status**: Integration details
100+
- **Next steps**: Using Spec-Kit for new features
101+
- **Monitoring setup**: Regression detection active
102+
103+
## Graduation Report
104+
105+
```
106+
🎓 Graduation Report
107+
====================
108+
109+
Phase: SPEC_KIT_READY
110+
Date: 2025-10-26
111+
112+
Readiness Gates: 7/7 passed (100%)
113+
✅ Structure Gate
114+
✅ Testing Gate
115+
✅ Quality Gate
116+
✅ Security Gate
117+
✅ Build Gate
118+
✅ CI Gate
119+
✅ Documentation Gate
120+
121+
Constitution: .specify/memory/constitution.md
122+
Spec-Kit: Installed (v1.2.3)
123+
124+
Improvements Achieved:
125+
Test Coverage: 45% → 85% (+40%)
126+
Complexity Avg: 18.3 → 8.2 (-55%)
127+
Critical Vulns: 3 → 0 (-100%)
128+
Build Status: failing → passing
129+
130+
Your project is now Spec-Kit ready!
131+
```
132+
133+
## Next Steps
134+
135+
After graduation:
136+
1. Review the generated constitution
137+
2. Use `/speckit.specify` to create feature specifications
138+
3. Monitor for regressions with `/brownkit.monitor`
139+
4. All new features follow Spec-Kit workflow
140+
141+
## Spec-Kit Workflow
142+
143+
With graduation complete, use Spec-Kit for new development:
144+
145+
```
146+
/speckit.specify → /speckit.clarify → /speckit.plan → /speckit.implement
147+
```
148+
149+
The constitution ensures all new code maintains quality standards.
150+
151+
## Technical Details
152+
153+
- **Command**: `brownfield graduate` (CLI) or orchestrator
154+
- **Input**: Validation results + graduation metrics
155+
- **Output**: `.specify/memory/constitution.md`
156+
- **Prerequisites**: All 7 readiness gates passed
157+
- **Duration**: 1-2 minutes
158+
159+
## Error Handling
160+
161+
If graduation fails:
162+
163+
### Not All Gates Passed:
164+
- Review which gates failed
165+
- Return to `/brownkit.validate` to see detailed report
166+
- Address remaining issues via remediation
167+
- Validate again before graduating
168+
169+
### Spec-Kit Not Installed:
170+
- Install Spec-Kit following documentation
171+
- Ensure `.claude/commands/speckit.specify.md` exists
172+
- Re-run graduation
173+
174+
### Constitution Already Exists:
175+
- BrownKit will offer to backup existing constitution
176+
- Confirm overwrite or cancel
177+
- Review backup before proceeding
178+
179+
## Post-Graduation Monitoring
180+
181+
After graduation, BrownKit enters monitoring mode:
182+
- **Regression detection**: Tracks metrics against baseline
183+
- **Alert thresholds**: Warns when metrics degrade
184+
- **Re-entry triggers**: Critical regressions trigger workflow re-entry
185+
- **Use `/brownkit.monitor`** to check post-graduation health
186+
187+
---
188+
189+
**Note**: Graduation is the final step of BrownKit workflow. Once graduated, the project uses Spec-Kit for all new features while BrownKit monitors for quality regressions.

0 commit comments

Comments
 (0)