devforgeai 1.0.5 → 1.0.7
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.md +120 -0
- package/bin/devforgeai.js +0 -0
- package/package.json +9 -1
- package/src/CLAUDE.md +699 -0
- package/src/claude/hooks/phase-completion-gate.sh +0 -0
- package/src/claude/scripts/README.md +396 -0
- package/src/claude/scripts/audit-command-skill-overlap.sh +67 -0
- package/src/claude/scripts/check-hooks-fast.sh +70 -0
- package/src/claude/scripts/devforgeai-validate +6 -0
- package/src/claude/scripts/devforgeai_cli/README.md +531 -0
- package/src/claude/scripts/devforgeai_cli/__init__.py +12 -0
- package/src/claude/scripts/devforgeai_cli/cli.py +716 -0
- package/src/claude/scripts/devforgeai_cli/commands/__init__.py +1 -0
- package/src/claude/scripts/devforgeai_cli/commands/check_hooks.py +384 -0
- package/src/claude/scripts/devforgeai_cli/commands/invoke_hooks.py +149 -0
- package/src/claude/scripts/devforgeai_cli/commands/phase_commands.py +731 -0
- package/src/claude/scripts/devforgeai_cli/commands/validate_installation.py +412 -0
- package/src/claude/scripts/devforgeai_cli/context_extraction.py +426 -0
- package/src/claude/scripts/devforgeai_cli/feedback/AC_TO_TEST_MAPPING.md +636 -0
- package/src/claude/scripts/devforgeai_cli/feedback/DELIVERY_SUMMARY.txt +329 -0
- package/src/claude/scripts/devforgeai_cli/feedback/README_TEST_SPECS.md +486 -0
- package/src/claude/scripts/devforgeai_cli/feedback/TEST_IMPLEMENTATION_GUIDE.md +529 -0
- package/src/claude/scripts/devforgeai_cli/feedback/TEST_SPECIFICATIONS.md +2652 -0
- package/src/claude/scripts/devforgeai_cli/feedback/TEST_SPECS_INDEX.md +398 -0
- package/src/claude/scripts/devforgeai_cli/feedback/__init__.py +34 -0
- package/src/claude/scripts/devforgeai_cli/feedback/adaptive_questioning_engine.py +581 -0
- package/src/claude/scripts/devforgeai_cli/feedback/aggregation.py +179 -0
- package/src/claude/scripts/devforgeai_cli/feedback/commands.py +535 -0
- package/src/claude/scripts/devforgeai_cli/feedback/config_defaults.py +58 -0
- package/src/claude/scripts/devforgeai_cli/feedback/config_manager.py +423 -0
- package/src/claude/scripts/devforgeai_cli/feedback/config_models.py +192 -0
- package/src/claude/scripts/devforgeai_cli/feedback/config_schema.py +140 -0
- package/src/claude/scripts/devforgeai_cli/feedback/coverage.json +1 -0
- package/src/claude/scripts/devforgeai_cli/feedback/feature_flag.py +152 -0
- package/src/claude/scripts/devforgeai_cli/feedback/feedback_indexer.py +394 -0
- package/src/claude/scripts/devforgeai_cli/feedback/hot_reload.py +226 -0
- package/src/claude/scripts/devforgeai_cli/feedback/longitudinal.py +115 -0
- package/src/claude/scripts/devforgeai_cli/feedback/models.py +67 -0
- package/src/claude/scripts/devforgeai_cli/feedback/question_router.py +236 -0
- package/src/claude/scripts/devforgeai_cli/feedback/retrospective.py +233 -0
- package/src/claude/scripts/devforgeai_cli/feedback/skip_tracker.py +177 -0
- package/src/claude/scripts/devforgeai_cli/feedback/skip_tracking.py +221 -0
- package/src/claude/scripts/devforgeai_cli/feedback/template_engine.py +549 -0
- package/src/claude/scripts/devforgeai_cli/feedback/validation.py +163 -0
- package/src/claude/scripts/devforgeai_cli/headless/__init__.py +30 -0
- package/src/claude/scripts/devforgeai_cli/headless/answer_models.py +206 -0
- package/src/claude/scripts/devforgeai_cli/headless/answer_resolver.py +204 -0
- package/src/claude/scripts/devforgeai_cli/headless/exceptions.py +36 -0
- package/src/claude/scripts/devforgeai_cli/headless/pattern_matcher.py +156 -0
- package/src/claude/scripts/devforgeai_cli/hooks.py +313 -0
- package/src/claude/scripts/devforgeai_cli/metrics/__init__.py +46 -0
- package/src/claude/scripts/devforgeai_cli/metrics/command_metrics.py +142 -0
- package/src/claude/scripts/devforgeai_cli/metrics/failure_modes.py +152 -0
- package/src/claude/scripts/devforgeai_cli/metrics/story_segmentation.py +181 -0
- package/src/claude/scripts/devforgeai_cli/orchestrate_hooks.py +780 -0
- package/src/claude/scripts/devforgeai_cli/phase_state.py +1229 -0
- package/src/claude/scripts/devforgeai_cli/session/__init__.py +30 -0
- package/src/claude/scripts/devforgeai_cli/session/checkpoint.py +268 -0
- package/src/claude/scripts/devforgeai_cli/tests/__init__.py +1 -0
- package/src/claude/scripts/devforgeai_cli/tests/conftest.py +29 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/TEST_EXECUTION_GUIDE.md +298 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/__init__.py +3 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_adaptive_questioning_engine.py +2171 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_aggregation.py +476 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_config_defaults.py +133 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_config_manager.py +592 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_config_models.py +373 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_config_schema.py +130 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_configuration_management.py +1355 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_edge_cases.py +308 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_feature_flag.py +307 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_feedback_indexer.py +384 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_hot_reload.py +580 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_integration.py +402 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_models.py +105 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_question_routing.py +262 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_retrospective.py +333 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_skip_tracker.py +410 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_skip_tracking.py +159 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_skip_tracking_integration.py +1155 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_template_engine.py +1389 -0
- package/src/claude/scripts/devforgeai_cli/tests/feedback/test_validation_comprehensive.py +210 -0
- package/src/claude/scripts/devforgeai_cli/tests/fixtures/autonomous-deferral-story.md +46 -0
- package/src/claude/scripts/devforgeai_cli/tests/fixtures/missing-impl-notes.md +31 -0
- package/src/claude/scripts/devforgeai_cli/tests/fixtures/valid-deferral-story.md +46 -0
- package/src/claude/scripts/devforgeai_cli/tests/fixtures/valid-story-complete.md +48 -0
- package/src/claude/scripts/devforgeai_cli/tests/manual_test_invoke_hooks.sh +200 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/DELIVERABLES.md +518 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/TEST_SUMMARY.md +468 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/__init__.py +6 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/fixtures/corrupted-checkpoint.json +1 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/fixtures/missing-fields-checkpoint.json +4 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/fixtures/valid-checkpoint.json +15 -0
- package/src/claude/scripts/devforgeai_cli/tests/session/test_checkpoint.py +851 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_check_hooks.py +1886 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_depends_on_normalizer.py +171 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_dod_validator.py +97 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_invoke_hooks.py +1902 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_phase_commands.py +320 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_phase_commands_error_handling.py +1021 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_phase_commands_import.py +697 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_phase_state.py +2187 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_skip_tracking.py +2141 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_skip_tracking_coverage_gap.py +195 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_subagent_enforcement.py +539 -0
- package/src/claude/scripts/devforgeai_cli/tests/test_validate_installation.py +361 -0
- package/src/claude/scripts/devforgeai_cli/utils/__init__.py +11 -0
- package/src/claude/scripts/devforgeai_cli/utils/depends_on_normalizer.py +149 -0
- package/src/claude/scripts/devforgeai_cli/utils/markdown_parser.py +219 -0
- package/src/claude/scripts/devforgeai_cli/utils/story_analyzer.py +249 -0
- package/src/claude/scripts/devforgeai_cli/utils/yaml_parser.py +152 -0
- package/src/claude/scripts/devforgeai_cli/validators/__init__.py +27 -0
- package/src/claude/scripts/devforgeai_cli/validators/ast_grep_validator.py +373 -0
- package/src/claude/scripts/devforgeai_cli/validators/context_validator.py +180 -0
- package/src/claude/scripts/devforgeai_cli/validators/dod_validator.py +309 -0
- package/src/claude/scripts/devforgeai_cli/validators/git_validator.py +107 -0
- package/src/claude/scripts/devforgeai_cli/validators/grep_fallback.py +300 -0
- package/src/claude/scripts/install_hooks.sh +186 -0
- package/src/claude/scripts/invoke_feedback_hooks.sh +59 -0
- package/src/claude/scripts/migrate-ac-headers.sh +122 -0
- package/src/claude/scripts/plan_file_kb.sh +704 -0
- package/src/claude/scripts/requirements.txt +8 -0
- package/src/claude/scripts/session_catalog.sh +543 -0
- package/src/claude/scripts/setup.py +55 -0
- package/src/claude/scripts/start-devforgeai.sh +16 -0
- package/src/claude/scripts/statusline.sh +27 -0
- package/src/claude/scripts/validate_deferrals.py +344 -0
- package/src/claude/skills/designing-systems/scripts/__pycache__/detect_anti_patterns.cpython-312.pyc +0 -0
- package/src/claude/skills/designing-systems/scripts/__pycache__/validate_all_context.cpython-312.pyc +0 -0
- package/src/claude/skills/designing-systems/scripts/__pycache__/validate_architecture.cpython-312.pyc +0 -0
- package/src/claude/skills/designing-systems/scripts/__pycache__/validate_dependencies.cpython-312.pyc +0 -0
- package/src/claude/skills/devforgeai-story-creation/scripts/__pycache__/migrate_story_v1_to_v2.cpython-312.pyc +0 -0
- package/src/claude/skills/devforgeai-story-creation/scripts/tests/__pycache__/measure_accuracy.cpython-312.pyc +0 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
# DevForgeAI CLI - Workflow Validators
|
|
2
|
+
|
|
3
|
+
**Version:** 0.1.0
|
|
4
|
+
**Purpose:** Automated validation tools for DevForgeAI spec-driven development
|
|
5
|
+
**Status:** Production ready
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
DevForgeAI CLI provides fast, deterministic validators that prevent workflow violations and enforce quality gates in spec-driven development.
|
|
12
|
+
|
|
13
|
+
**Key Features:**
|
|
14
|
+
- ✅ **Autonomous deferral detection** - Prevents DoD items deferred without user approval
|
|
15
|
+
- ✅ **Pre-commit integration** - Blocks commits with violations
|
|
16
|
+
- ✅ **Fast validation** - <100ms per check (vs ~5,000 tokens for AI validation)
|
|
17
|
+
- ✅ **Git-aware** - Validates Git availability before workflows
|
|
18
|
+
- ✅ **Context enforcement** - Ensures 6 context files exist
|
|
19
|
+
|
|
20
|
+
**Based on industry research:**
|
|
21
|
+
- SpecDriven AI: spec_validator.py pattern
|
|
22
|
+
- GitHub DoD Checker: checkbox validation approach
|
|
23
|
+
- Pre-commit framework: standard hook integration
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
### Quick Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Navigate to DevForgeAI project
|
|
33
|
+
cd /path/to/devforgeai
|
|
34
|
+
|
|
35
|
+
# Install CLI package
|
|
36
|
+
pip install --break-system-packages -e .claude/scripts/
|
|
37
|
+
|
|
38
|
+
# Install pre-commit hooks
|
|
39
|
+
bash .claude/scripts/install_hooks.sh
|
|
40
|
+
|
|
41
|
+
# Verify installation
|
|
42
|
+
devforgeai --version
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Requirements
|
|
46
|
+
|
|
47
|
+
- Python 3.8+
|
|
48
|
+
- PyYAML 6.0+
|
|
49
|
+
- Git (for pre-commit hooks)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
### validate-dod - DoD Completion Validator
|
|
56
|
+
|
|
57
|
+
**Purpose:** Detect autonomous deferrals and validate user approval markers
|
|
58
|
+
|
|
59
|
+
**Usage:**
|
|
60
|
+
```bash
|
|
61
|
+
devforgeai validate-dod devforgeai/specs/Stories/STORY-001.story.md
|
|
62
|
+
|
|
63
|
+
# JSON output
|
|
64
|
+
devforgeai validate-dod STORY-001.story.md --format=json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**What it validates:**
|
|
68
|
+
- ✅ All DoD `[x]` items have Implementation Notes entry
|
|
69
|
+
- ✅ Status consistency (DoD `[x]` must match Impl `[x]` or have justification)
|
|
70
|
+
- ✅ Deferred items have user approval markers
|
|
71
|
+
- ✅ Referenced stories/ADRs exist
|
|
72
|
+
- ❌ **BLOCKS: Autonomous deferrals** (DoD `[x]` + Impl `[ ]` without approval)
|
|
73
|
+
|
|
74
|
+
**Exit codes:**
|
|
75
|
+
- `0` - Valid (all DoD items complete or properly justified)
|
|
76
|
+
- `1` - Violations found (details in output)
|
|
77
|
+
- `2` - Error (file not found, invalid format, etc.)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### check-git - Git Availability Validator
|
|
82
|
+
|
|
83
|
+
**Purpose:** Validate Git repository before DevForgeAI workflows
|
|
84
|
+
|
|
85
|
+
**Usage:**
|
|
86
|
+
```bash
|
|
87
|
+
devforgeai check-git
|
|
88
|
+
|
|
89
|
+
# Check specific directory
|
|
90
|
+
devforgeai check-git --directory=/path/to/project
|
|
91
|
+
|
|
92
|
+
# JSON output
|
|
93
|
+
devforgeai check-git --format=json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**What it checks:**
|
|
97
|
+
- ✅ Directory is inside Git working tree
|
|
98
|
+
- ✅ Git command available
|
|
99
|
+
- ❌ **BLOCKS: Non-Git directories** (prevents RCA-006 errors)
|
|
100
|
+
|
|
101
|
+
**Exit codes:**
|
|
102
|
+
- `0` - Git available
|
|
103
|
+
- `1` - Git not available
|
|
104
|
+
- `2` - Error (Git not installed, etc.)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### validate-context - Context Files Validator
|
|
109
|
+
|
|
110
|
+
**Purpose:** Ensure all 6 DevForgeAI context files exist
|
|
111
|
+
|
|
112
|
+
**Usage:**
|
|
113
|
+
```bash
|
|
114
|
+
devforgeai validate-context
|
|
115
|
+
|
|
116
|
+
# Check specific directory
|
|
117
|
+
devforgeai validate-context --directory=/path/to/project
|
|
118
|
+
|
|
119
|
+
# JSON output
|
|
120
|
+
devforgeai validate-context --format=json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**What it validates:**
|
|
124
|
+
- ✅ All 6 context files exist: tech-stack.md, source-tree.md, dependencies.md, coding-standards.md, architecture-constraints.md, anti-patterns.md
|
|
125
|
+
- ✅ Files are non-empty (not placeholders)
|
|
126
|
+
- ⚠️ **WARNS:** Files <100 bytes (likely incomplete)
|
|
127
|
+
|
|
128
|
+
**Exit codes:**
|
|
129
|
+
- `0` - All files valid
|
|
130
|
+
- `1` - Missing or empty files
|
|
131
|
+
- `2` - Error
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### ast-grep scan - Semantic Code Analysis (STORY-115)
|
|
136
|
+
|
|
137
|
+
**Purpose:** Detect security vulnerabilities and anti-patterns using AST-based analysis
|
|
138
|
+
|
|
139
|
+
**Usage:**
|
|
140
|
+
```bash
|
|
141
|
+
# Basic scan with grep fallback
|
|
142
|
+
devforgeai ast-grep scan ./src --fallback
|
|
143
|
+
|
|
144
|
+
# Scan with category filter
|
|
145
|
+
devforgeai ast-grep scan ./src --category security --format json
|
|
146
|
+
|
|
147
|
+
# Scan specific language
|
|
148
|
+
devforgeai ast-grep scan ./tests --language python --format markdown
|
|
149
|
+
|
|
150
|
+
# Full options
|
|
151
|
+
devforgeai ast-grep scan <path> \
|
|
152
|
+
--category security \
|
|
153
|
+
--language python \
|
|
154
|
+
--format json \
|
|
155
|
+
--fallback
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**What it detects:**
|
|
159
|
+
- ✅ **SQL injection** - String concatenation in queries
|
|
160
|
+
- ✅ **Hardcoded secrets** - API keys, passwords, tokens in code
|
|
161
|
+
- ✅ **AWS credentials** - Access keys, secret keys
|
|
162
|
+
- ⚠️ **Accuracy:** 90-95% with ast-grep, 60-75% with grep fallback
|
|
163
|
+
|
|
164
|
+
**Options:**
|
|
165
|
+
- `--category` - Filter by: security, anti-patterns, complexity, architecture
|
|
166
|
+
- `--language` - Filter by: python, csharp, typescript, javascript
|
|
167
|
+
- `--format` - Output format: text (default), json, markdown
|
|
168
|
+
- `--fallback` - Force grep-based analysis (skip ast-grep)
|
|
169
|
+
|
|
170
|
+
**Auto-Install Behavior:**
|
|
171
|
+
```bash
|
|
172
|
+
# If ast-grep not installed, you'll be prompted:
|
|
173
|
+
ast-grep Not Found
|
|
174
|
+
==================================
|
|
175
|
+
Options:
|
|
176
|
+
1) Install now (pip install ast-grep-cli)
|
|
177
|
+
2) Use fallback (grep-based analysis)
|
|
178
|
+
3) Skip
|
|
179
|
+
|
|
180
|
+
Select option [1-3]:
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Configuration:**
|
|
184
|
+
```yaml
|
|
185
|
+
# devforgeai/ast-grep/config.yaml
|
|
186
|
+
fallback_mode: false # Use grep by default?
|
|
187
|
+
min_version: "0.40.0" # Minimum ast-grep version
|
|
188
|
+
max_version: "1.0.0" # Maximum version (exclusive)
|
|
189
|
+
allow_auto_install: false # Skip prompt and auto-install?
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Exit codes:**
|
|
193
|
+
- `0` - No violations found (or scan skipped)
|
|
194
|
+
- `1` - Violations detected
|
|
195
|
+
- `2` - Error (invalid arguments, scan failed)
|
|
196
|
+
|
|
197
|
+
**Example Output (JSON):**
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"violations": [
|
|
201
|
+
{
|
|
202
|
+
"file": "app.py",
|
|
203
|
+
"line": 42,
|
|
204
|
+
"column": 5,
|
|
205
|
+
"rule_id": "SEC-001",
|
|
206
|
+
"severity": "CRITICAL",
|
|
207
|
+
"message": "Potential SQL injection via string concatenation",
|
|
208
|
+
"evidence": "query = \"SELECT * FROM users WHERE id = \" + user_id",
|
|
209
|
+
"analysis_method": "grep-fallback",
|
|
210
|
+
"category": "security"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"analysis_method": "grep-fallback",
|
|
214
|
+
"summary": {
|
|
215
|
+
"total_violations": 1,
|
|
216
|
+
"by_severity": {"CRITICAL": 1},
|
|
217
|
+
"accuracy_note": "60-75% vs 90-95% with ast-grep"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Pre-Commit Integration
|
|
225
|
+
|
|
226
|
+
### How It Works
|
|
227
|
+
|
|
228
|
+
The pre-commit hook automatically runs `validate-dod` on all staged `.story.md` files before allowing commit.
|
|
229
|
+
|
|
230
|
+
**Installation:**
|
|
231
|
+
```bash
|
|
232
|
+
bash .claude/scripts/install_hooks.sh
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Workflow:**
|
|
236
|
+
```bash
|
|
237
|
+
# Developer makes changes
|
|
238
|
+
git add devforgeai/specs/Stories/STORY-042.story.md
|
|
239
|
+
|
|
240
|
+
# Attempt commit
|
|
241
|
+
git commit -m "feat: Implement feature"
|
|
242
|
+
|
|
243
|
+
# Hook runs automatically:
|
|
244
|
+
🔍 DevForgeAI Validators Running...
|
|
245
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
246
|
+
📋 Validating: devforgeai/specs/Stories/STORY-042.story.md
|
|
247
|
+
✅ Passed
|
|
248
|
+
✅ All validators passed - commit allowed
|
|
249
|
+
|
|
250
|
+
# If violations:
|
|
251
|
+
❌ COMMIT BLOCKED - Fix violations
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Bypass (not recommended):**
|
|
255
|
+
```bash
|
|
256
|
+
git commit --no-verify
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Example Scenarios
|
|
262
|
+
|
|
263
|
+
### Scenario 1: Valid Story (All DoD Complete)
|
|
264
|
+
|
|
265
|
+
**Story file:**
|
|
266
|
+
```markdown
|
|
267
|
+
## Definition of Done
|
|
268
|
+
- [x] Unit tests written
|
|
269
|
+
- [x] Code reviewed
|
|
270
|
+
|
|
271
|
+
## Implementation Notes
|
|
272
|
+
- [x] Unit tests written - Completed: Created tests
|
|
273
|
+
- [x] Code reviewed - Completed: Passed review
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Validator result:**
|
|
277
|
+
```
|
|
278
|
+
✅ story.md: All DoD items validated
|
|
279
|
+
Exit code: 0
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Scenario 2: Autonomous Deferral (VIOLATION)
|
|
285
|
+
|
|
286
|
+
**Story file:**
|
|
287
|
+
```markdown
|
|
288
|
+
## Definition of Done
|
|
289
|
+
- [x] Unit tests written
|
|
290
|
+
- [x] Performance benchmarks ← Marked complete
|
|
291
|
+
|
|
292
|
+
## Implementation Notes
|
|
293
|
+
- [x] Unit tests written - Completed
|
|
294
|
+
- [ ] Performance benchmarks - Deferred to STORY-XXX ← Actually deferred
|
|
295
|
+
← NO user approval!
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Validator result:**
|
|
299
|
+
```
|
|
300
|
+
❌ VALIDATION FAILED
|
|
301
|
+
|
|
302
|
+
CRITICAL VIOLATIONS:
|
|
303
|
+
• Performance benchmarks
|
|
304
|
+
Error: AUTONOMOUS DEFERRAL DETECTED
|
|
305
|
+
DoD: [x] | Impl: [ ]
|
|
306
|
+
Found: Deferred to STORY-XXX
|
|
307
|
+
Fix: Add user approval marker
|
|
308
|
+
|
|
309
|
+
GIT COMMIT BLOCKED
|
|
310
|
+
Exit code: 1
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
### Scenario 3: Valid Deferral (User Approved)
|
|
316
|
+
|
|
317
|
+
**Story file:**
|
|
318
|
+
```markdown
|
|
319
|
+
## Definition of Done
|
|
320
|
+
- [x] Performance benchmarks
|
|
321
|
+
|
|
322
|
+
## Implementation Notes
|
|
323
|
+
- [ ] Performance benchmarks - Deferred to STORY-042
|
|
324
|
+
**User Approved:** YES (via AskUserQuestion 2025-11-04)
|
|
325
|
+
**Rationale:** Requires load test environment
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Validator result:**
|
|
329
|
+
```
|
|
330
|
+
✅ story.md: All DoD items validated
|
|
331
|
+
Exit code: 0
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Validation Rules
|
|
337
|
+
|
|
338
|
+
### What Triggers CRITICAL Violations
|
|
339
|
+
|
|
340
|
+
1. **Autonomous Deferral:**
|
|
341
|
+
- DoD: `[x]` (marked complete)
|
|
342
|
+
- Impl: `[ ]` (actually deferred)
|
|
343
|
+
- Missing: User approval marker
|
|
344
|
+
|
|
345
|
+
2. **Missing from Implementation Notes:**
|
|
346
|
+
- DoD: `[x]` (marked complete)
|
|
347
|
+
- Impl: NOT FOUND (no entry)
|
|
348
|
+
|
|
349
|
+
### Valid Approval Markers
|
|
350
|
+
|
|
351
|
+
Deferred items MUST have one of:
|
|
352
|
+
|
|
353
|
+
1. **Explicit approval:**
|
|
354
|
+
```markdown
|
|
355
|
+
**User approved:** YES
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
2. **Story reference:**
|
|
359
|
+
```markdown
|
|
360
|
+
Deferred to STORY-042
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
3. **ADR reference:**
|
|
364
|
+
```markdown
|
|
365
|
+
Out of scope: ADR-023 documents scope change
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
4. **External blocker:**
|
|
369
|
+
```markdown
|
|
370
|
+
Blocked by: API v2 release (external)
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Integration with DevForgeAI Workflows
|
|
376
|
+
|
|
377
|
+
### /dev Command Integration
|
|
378
|
+
|
|
379
|
+
The `/dev` slash command can call validators before invoking development skill:
|
|
380
|
+
|
|
381
|
+
```markdown
|
|
382
|
+
## Phase 0c: Validation
|
|
383
|
+
Bash(command="devforgeai check-git")
|
|
384
|
+
Bash(command="devforgeai validate-context")
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### implementing-stories Skill
|
|
388
|
+
|
|
389
|
+
The skill already has interactive checkpoints (Layer 2 - AskUserQuestion).
|
|
390
|
+
The CLI validator provides Layer 1 (fast deterministic checks).
|
|
391
|
+
|
|
392
|
+
**Three-layer defense:**
|
|
393
|
+
1. **Layer 1:** CLI validator (fast, <100ms, blocks commits)
|
|
394
|
+
2. **Layer 2:** AskUserQuestion (interactive, mandatory user approval)
|
|
395
|
+
3. **Layer 3:** deferral-validator subagent (comprehensive AI analysis)
|
|
396
|
+
|
|
397
|
+
Combined: 99% violation detection, zero autonomous deferrals possible.
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Troubleshooting
|
|
402
|
+
|
|
403
|
+
### "Implementation Notes section missing"
|
|
404
|
+
|
|
405
|
+
**Cause:** Story file doesn't have `## Implementation Notes` section
|
|
406
|
+
|
|
407
|
+
**Fix:**
|
|
408
|
+
```markdown
|
|
409
|
+
## Implementation Notes
|
|
410
|
+
|
|
411
|
+
**Developer:** DevForgeAI AI Agent
|
|
412
|
+
**Implemented:** 2025-XX-XX
|
|
413
|
+
|
|
414
|
+
- [x] DoD Item 1 - Completed: Description
|
|
415
|
+
- [ ] DoD Item 2 - Deferred to STORY-XXX
|
|
416
|
+
**User approved:** YES
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### "AUTONOMOUS DEFERRAL DETECTED"
|
|
420
|
+
|
|
421
|
+
**Cause:** DoD marked `[x]` but Implementation Notes shows `[ ]` without user approval
|
|
422
|
+
|
|
423
|
+
**Fix Option 1 - Add approval marker:**
|
|
424
|
+
```markdown
|
|
425
|
+
- [ ] Item - Deferred to STORY-XXX
|
|
426
|
+
**User approved:** YES (via AskUserQuestion 2025-11-04)
|
|
427
|
+
**Rationale:** [user-provided reason]
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Fix Option 2 - Complete the work:**
|
|
431
|
+
Change Implementation Notes to:
|
|
432
|
+
```markdown
|
|
433
|
+
- [x] Item - Completed: [description]
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### "Referenced story STORY-XXX does not exist"
|
|
437
|
+
|
|
438
|
+
**Cause:** Justification references story that doesn't exist
|
|
439
|
+
|
|
440
|
+
**Fix:**
|
|
441
|
+
- Create the referenced story: `/create-story`
|
|
442
|
+
- OR update reference to existing story
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Development
|
|
447
|
+
|
|
448
|
+
### Running Tests
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# Install test dependencies
|
|
452
|
+
pip install --break-system-packages pytest pytest-cov
|
|
453
|
+
|
|
454
|
+
# Run tests
|
|
455
|
+
pytest .claude/scripts/devforgeai_cli/tests/ -v
|
|
456
|
+
|
|
457
|
+
# With coverage
|
|
458
|
+
pytest .claude/scripts/devforgeai_cli/tests/ --cov=devforgeai_cli --cov-report=term
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Project Structure
|
|
462
|
+
|
|
463
|
+
```
|
|
464
|
+
.claude/scripts/devforgeai_cli/
|
|
465
|
+
├── __init__.py # Package metadata
|
|
466
|
+
├── cli.py # CLI entry point
|
|
467
|
+
├── validators/
|
|
468
|
+
│ ├── __init__.py
|
|
469
|
+
│ ├── dod_validator.py # DoD completion validator (200 lines)
|
|
470
|
+
│ ├── git_validator.py # Git availability checker (107 lines)
|
|
471
|
+
│ └── context_validator.py # Context files validator (124 lines)
|
|
472
|
+
├── utils/
|
|
473
|
+
│ ├── __init__.py
|
|
474
|
+
│ ├── markdown_parser.py # Markdown extraction (177 lines)
|
|
475
|
+
│ ├── yaml_parser.py # YAML frontmatter parsing (133 lines)
|
|
476
|
+
│ └── story_analyzer.py # Story analysis functions (147 lines)
|
|
477
|
+
└── tests/
|
|
478
|
+
├── __init__.py
|
|
479
|
+
├── test_dod_validator.py
|
|
480
|
+
├── test_git_validator.py
|
|
481
|
+
├── test_context_validator.py
|
|
482
|
+
└── fixtures/
|
|
483
|
+
├── valid-story-complete.md
|
|
484
|
+
├── autonomous-deferral-story.md
|
|
485
|
+
├── valid-deferral-story.md
|
|
486
|
+
└── missing-impl-notes.md
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Total:** ~1,100 lines of production code
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## Contributing
|
|
494
|
+
|
|
495
|
+
### Adding New Validators
|
|
496
|
+
|
|
497
|
+
1. Create validator in `validators/`
|
|
498
|
+
2. Follow pattern: `validate()` returns `(is_valid, violations)`
|
|
499
|
+
3. Add to `cli.py` subparsers
|
|
500
|
+
4. Create tests in `tests/`
|
|
501
|
+
5. Update documentation
|
|
502
|
+
|
|
503
|
+
### Testing Validators
|
|
504
|
+
|
|
505
|
+
```python
|
|
506
|
+
def test_new_validator():
|
|
507
|
+
from devforgeai_cli.validators.new_validator import validate_something
|
|
508
|
+
|
|
509
|
+
is_valid, violations = validate_something(test_input)
|
|
510
|
+
|
|
511
|
+
assert is_valid == expected_result
|
|
512
|
+
assert len(violations) == expected_count
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## License
|
|
518
|
+
|
|
519
|
+
See LICENSE.txt in DevForgeAI project root.
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Support
|
|
524
|
+
|
|
525
|
+
**Issues:** https://github.com/bankielewicz/DevForgeAI/issues
|
|
526
|
+
**Documentation:** See `devforgeai/specs/` in DevForgeAI repository
|
|
527
|
+
**Research:** `devforgeai/specs/research/validation-approaches-research-2024-2025.md`
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
**DevForgeAI CLI v0.1.0 - Preventing technical debt through automated validation**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DevForgeAI CLI - Workflow Validators
|
|
3
|
+
|
|
4
|
+
Automated validation tools for DevForgeAI spec-driven development.
|
|
5
|
+
|
|
6
|
+
Core validators:
|
|
7
|
+
- validate-dod: DoD completion and autonomous deferral detection
|
|
8
|
+
- check-git: Git availability validation
|
|
9
|
+
- validate-context: Context file existence checking
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|