mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-05 16:13:08 +08:00
- Introduced `document-standards.md` to define YAML frontmatter schema, naming conventions, and content structure for spec-generator outputs. - Created `quality-gates.md` outlining per-phase quality gate criteria and scoring dimensions for spec-generator outputs. - Added templates for architecture documents, epics and stories, product briefs, and requirements PRD to streamline documentation in respective phases.
3.0 KiB
3.0 KiB
prefix, inner_loop, message_types
| prefix | inner_loop | message_types | ||||||
|---|---|---|---|---|---|---|---|---|
| TDVAL | false |
|
Tech Debt Validator
Cleanup result validator. Run test suite, type checks, lint checks, and quality analysis to verify debt cleanup introduced no regressions. Compare before/after debt scores, produce validation-report.json.
Phase 2: Load Context
| Input | Source | Required |
|---|---|---|
| Session path | task description (regex: session:\s*(.+)) |
Yes |
| .msg/meta.json | /.msg/meta.json | Yes |
| Fix log | /fixes/fix-log.json | No |
- Extract session path from task description
- Read .msg/meta.json for: worktree.path, debt_inventory, fix_results, debt_score_before
- Determine command prefix:
cd "<worktree-path>" &&if worktree exists - Read fix-log.json for modified files list
- Detect available validation tools in worktree:
| Signal | Tool | Method |
|---|---|---|
| package.json + npm | npm test | Test suite |
| pytest available | python -m pytest | Test suite |
| npx tsc available | npx tsc --noEmit | Type check |
| npx eslint available | npx eslint | Lint check |
Phase 3: Run Validation Checks
Execute 4-layer validation (all commands in worktree):
1. Test Suite:
- Run
npm testorpython -m pytestin worktree - PASS if no FAIL/error/failed keywords; FAIL with regression count otherwise
- Skip with "no-tests" if no test runner available
2. Type Check:
- Run
npx tsc --noEmitin worktree - Count
error TSoccurrences for error count
3. Lint Check:
- Run
npx eslint --no-error-on-unmatched-pattern <modified-files>in worktree - Count error occurrences
4. Quality Analysis (optional, when > 5 modified files):
- Use gemini CLI to compare code quality before/after
- Assess complexity, duplication, naming quality improvements
Debt Score Calculation:
- debt_score_after = debt items NOT in modified files (remaining unfixed items)
- improvement_percentage = ((before - after) / before) * 100
Auto-fix attempt (when total_regressions <= 3):
- Use CLI tool to fix regressions in worktree:
Bash({ command: `cd "${worktreePath}" && ccw cli -p "PURPOSE: Fix regressions found in validation TASK: ${regressionDetails} MODE: write CONTEXT: @${modifiedFiles.join(' @')} EXPECTED: Fixed regressions CONSTRAINTS: Fix only regressions | Preserve debt cleanup changes | No suppressions" --tool gemini --mode write`, run_in_background: false }) - Re-run checks after fix attempt
Phase 4: Compare & Report
- Calculate: total_regressions = test_regressions + type_errors + lint_errors; passed = (total_regressions === 0)
- Write
<session>/validation/validation-report.jsonwith: validation_date, passed, regressions, checks (per-check status), debt_score_before, debt_score_after, improvement_percentage - Update .msg/meta.json with
validation_resultsanddebt_score_after - Select message type:
validation_completeif passed,regression_foundif not