red64-cli 0.1.0 → 0.3.0

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.
Files changed (125) hide show
  1. package/README.md +1 -2
  2. package/dist/cli/parseArgs.d.ts.map +1 -1
  3. package/dist/cli/parseArgs.js +5 -0
  4. package/dist/cli/parseArgs.js.map +1 -1
  5. package/dist/components/init/CompleteStep.d.ts.map +1 -1
  6. package/dist/components/init/CompleteStep.js +2 -2
  7. package/dist/components/init/CompleteStep.js.map +1 -1
  8. package/dist/components/init/TestCheckStep.d.ts +16 -0
  9. package/dist/components/init/TestCheckStep.d.ts.map +1 -0
  10. package/dist/components/init/TestCheckStep.js +120 -0
  11. package/dist/components/init/TestCheckStep.js.map +1 -0
  12. package/dist/components/init/index.d.ts +1 -0
  13. package/dist/components/init/index.d.ts.map +1 -1
  14. package/dist/components/init/index.js +1 -0
  15. package/dist/components/init/index.js.map +1 -1
  16. package/dist/components/init/types.d.ts +9 -0
  17. package/dist/components/init/types.d.ts.map +1 -1
  18. package/dist/components/screens/InitScreen.d.ts.map +1 -1
  19. package/dist/components/screens/InitScreen.js +69 -6
  20. package/dist/components/screens/InitScreen.js.map +1 -1
  21. package/dist/components/screens/ListScreen.d.ts.map +1 -1
  22. package/dist/components/screens/ListScreen.js +28 -3
  23. package/dist/components/screens/ListScreen.js.map +1 -1
  24. package/dist/components/screens/StartScreen.d.ts.map +1 -1
  25. package/dist/components/screens/StartScreen.js +212 -13
  26. package/dist/components/screens/StartScreen.js.map +1 -1
  27. package/dist/components/ui/ArtifactsSidebar.d.ts +19 -0
  28. package/dist/components/ui/ArtifactsSidebar.d.ts.map +1 -0
  29. package/dist/components/ui/ArtifactsSidebar.js +51 -0
  30. package/dist/components/ui/ArtifactsSidebar.js.map +1 -0
  31. package/dist/components/ui/FeatureSidebar.d.ts.map +1 -1
  32. package/dist/components/ui/FeatureSidebar.js +1 -1
  33. package/dist/components/ui/FeatureSidebar.js.map +1 -1
  34. package/dist/components/ui/index.d.ts +1 -0
  35. package/dist/components/ui/index.d.ts.map +1 -1
  36. package/dist/components/ui/index.js +1 -0
  37. package/dist/components/ui/index.js.map +1 -1
  38. package/dist/services/ClaudeErrorDetector.js +3 -3
  39. package/dist/services/ClaudeErrorDetector.js.map +1 -1
  40. package/dist/services/ConfigService.d.ts +1 -0
  41. package/dist/services/ConfigService.d.ts.map +1 -1
  42. package/dist/services/ConfigService.js.map +1 -1
  43. package/dist/services/ProjectDetector.d.ts +28 -0
  44. package/dist/services/ProjectDetector.d.ts.map +1 -0
  45. package/dist/services/ProjectDetector.js +236 -0
  46. package/dist/services/ProjectDetector.js.map +1 -0
  47. package/dist/services/TestRunner.d.ts +46 -0
  48. package/dist/services/TestRunner.d.ts.map +1 -0
  49. package/dist/services/TestRunner.js +85 -0
  50. package/dist/services/TestRunner.js.map +1 -0
  51. package/dist/services/index.d.ts +2 -0
  52. package/dist/services/index.d.ts.map +1 -1
  53. package/dist/services/index.js +2 -0
  54. package/dist/services/index.js.map +1 -1
  55. package/dist/types/index.d.ts +13 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/index.js.map +1 -1
  58. package/framework/.red64/settings/templates/specs/gap-analysis.md +163 -0
  59. package/framework/agents/claude/.claude/agents/red64/spec-impl.md +131 -2
  60. package/framework/agents/claude/.claude/agents/red64/validate-gap.md +13 -7
  61. package/framework/agents/claude/.claude/commands/red64/spec-impl.md +24 -0
  62. package/framework/agents/claude/.claude/commands/red64/validate-gap.md +4 -0
  63. package/framework/agents/codex/.codex/agents/red64/spec-impl.md +131 -2
  64. package/framework/agents/codex/.codex/agents/red64/validate-gap.md +13 -7
  65. package/framework/agents/codex/.codex/commands/red64/spec-impl.md +24 -0
  66. package/framework/agents/codex/.codex/commands/red64/validate-gap.md +4 -0
  67. package/framework/stacks/generic/feedback.md +80 -0
  68. package/framework/stacks/nextjs/accessibility.md +437 -0
  69. package/framework/stacks/nextjs/api.md +431 -0
  70. package/framework/stacks/nextjs/coding-style.md +282 -0
  71. package/framework/stacks/nextjs/commenting.md +226 -0
  72. package/framework/stacks/nextjs/components.md +411 -0
  73. package/framework/stacks/nextjs/conventions.md +333 -0
  74. package/framework/stacks/nextjs/css.md +310 -0
  75. package/framework/stacks/nextjs/error-handling.md +442 -0
  76. package/framework/stacks/nextjs/feedback.md +124 -0
  77. package/framework/stacks/nextjs/migrations.md +332 -0
  78. package/framework/stacks/nextjs/models.md +362 -0
  79. package/framework/stacks/nextjs/queries.md +410 -0
  80. package/framework/stacks/nextjs/responsive.md +338 -0
  81. package/framework/stacks/nextjs/tech-stack.md +177 -0
  82. package/framework/stacks/nextjs/test-writing.md +475 -0
  83. package/framework/stacks/nextjs/validation.md +467 -0
  84. package/framework/stacks/python/api.md +468 -0
  85. package/framework/stacks/python/authentication.md +342 -0
  86. package/framework/stacks/python/code-quality.md +283 -0
  87. package/framework/stacks/python/code-refactoring.md +315 -0
  88. package/framework/stacks/python/coding-style.md +462 -0
  89. package/framework/stacks/python/conventions.md +399 -0
  90. package/framework/stacks/python/error-handling.md +512 -0
  91. package/framework/stacks/python/feedback.md +92 -0
  92. package/framework/stacks/python/implement-ai-llm.md +468 -0
  93. package/framework/stacks/python/migrations.md +388 -0
  94. package/framework/stacks/python/models.md +399 -0
  95. package/framework/stacks/python/python.md +232 -0
  96. package/framework/stacks/python/queries.md +451 -0
  97. package/framework/stacks/python/structure.md +245 -58
  98. package/framework/stacks/python/tech.md +92 -35
  99. package/framework/stacks/python/testing.md +380 -0
  100. package/framework/stacks/python/validation.md +471 -0
  101. package/framework/stacks/rails/authentication.md +176 -0
  102. package/framework/stacks/rails/code-quality.md +287 -0
  103. package/framework/stacks/rails/code-refactoring.md +299 -0
  104. package/framework/stacks/rails/feedback.md +130 -0
  105. package/framework/stacks/rails/implement-ai-llm-with-rubyllm.md +342 -0
  106. package/framework/stacks/rails/rails.md +301 -0
  107. package/framework/stacks/rails/rails8-best-practices.md +498 -0
  108. package/framework/stacks/rails/rails8-css.md +573 -0
  109. package/framework/stacks/rails/structure.md +140 -0
  110. package/framework/stacks/rails/tech.md +108 -0
  111. package/framework/stacks/react/code-quality.md +521 -0
  112. package/framework/stacks/react/components.md +625 -0
  113. package/framework/stacks/react/data-fetching.md +586 -0
  114. package/framework/stacks/react/feedback.md +110 -0
  115. package/framework/stacks/react/forms.md +694 -0
  116. package/framework/stacks/react/performance.md +640 -0
  117. package/framework/stacks/react/product.md +22 -9
  118. package/framework/stacks/react/state-management.md +472 -0
  119. package/framework/stacks/react/structure.md +351 -44
  120. package/framework/stacks/react/tech.md +219 -30
  121. package/framework/stacks/react/testing.md +690 -0
  122. package/package.json +1 -1
  123. package/framework/stacks/node/product.md +0 -27
  124. package/framework/stacks/node/structure.md +0 -82
  125. package/framework/stacks/node/tech.md +0 -63
@@ -46,6 +46,16 @@ Execute implementation tasks for feature using Test-Driven Development.
46
46
  **Read all necessary context**:
47
47
  - `.red64/specs/{feature}/spec.json`, `requirements.md`, `design.md`, `tasks.md`
48
48
  - **Entire `.red64/steering/` directory** for complete project memory
49
+ - **`.red64/steering/feedback.md`** - CRITICAL: Contains project-specific test, lint, and dev server commands
50
+
51
+ **Parse feedback.md for commands**:
52
+ Extract these values from the YAML blocks in `feedback.md`:
53
+ - `test`: Primary test command (e.g., `pnpm test:run`, `uv run pytest`)
54
+ - `lint`: Primary lint command (e.g., `pnpm lint`, `uv run ruff check .`)
55
+ - `dev_server`: Dev server command (e.g., `pnpm dev`, `bin/rails server`)
56
+ - `dev_port`: Dev server port (e.g., `3000`, `5173`, `8000`)
57
+ - `dev_url`: Dev server base URL (e.g., `http://localhost:3000`)
58
+ - `ui_verification_enabled`: Whether to use agent-browser for UI tasks
49
59
 
50
60
  **Validate approvals**:
51
61
  - Verify tasks are approved in spec.json (stop if not, see Safety & Fallback)
@@ -81,17 +91,136 @@ For each selected task, follow Kent Beck's TDD cycle:
81
91
  - No regressions in existing functionality
82
92
  - Code coverage maintained or improved
83
93
 
94
+ 5. **FEEDBACK LOOP - Self-Correction**:
95
+ After each implementation change, run the feedback loop using commands from `feedback.md`:
96
+
97
+ **Testing Feedback** (MANDATORY):
98
+ ```bash
99
+ # Use the 'test' command from .red64/steering/feedback.md
100
+ # Examples by stack:
101
+ # - React/Next.js: pnpm test:run
102
+ # - Python: uv run pytest
103
+ # - Rails: bin/rails test
104
+ {test_command_from_feedback_md}
105
+ ```
106
+ - Parse test output for failures
107
+ - If tests fail: Fix issues before proceeding
108
+ - Never mark implementation complete with failing tests
109
+
110
+ **Linting Feedback** (when available):
111
+ ```bash
112
+ # Use the 'lint' command from .red64/steering/feedback.md
113
+ # Examples by stack:
114
+ # - React/Next.js: pnpm lint
115
+ # - Python: uv run ruff check .
116
+ # - Rails: bundle exec rubocop
117
+ {lint_command_from_feedback_md}
118
+ ```
119
+ - Fix critical/error-level issues
120
+ - Warnings are advisory (log but proceed)
121
+
122
+ **UI Verification** (for UI-related tasks - see UI Verification Protocol below):
123
+ - Check `ui_verification_enabled` in feedback.md (skip if false)
124
+ - Required when task involves: components, pages, layouts, styles, visual elements
125
+ - Use agent-browser for screenshot capture and accessibility analysis
126
+
84
127
  **Note**: Do NOT update task checkboxes in tasks.md. The orchestrator handles task completion tracking.
85
128
 
129
+ ## UI Verification Protocol
130
+
131
+ When implementing UI-related tasks (components, pages, layouts, styles, visual elements), use **agent-browser** for verification:
132
+
133
+ ### When to Use UI Verification
134
+ - Task creates or modifies React/Vue/Angular components
135
+ - Task involves styling changes (CSS, Tailwind, styled-components)
136
+ - Task mentions visual elements, layouts, or design specs
137
+ - Design.md includes mockups, wireframes, or visual references
138
+
139
+ ### UI Verification Steps
140
+
141
+ 1. **Start Development Server** (if not running):
142
+ ```bash
143
+ # Use 'dev_server' command from .red64/steering/feedback.md
144
+ # Examples by stack:
145
+ # - React: pnpm dev (port 5173)
146
+ # - Next.js: pnpm dev (port 3000)
147
+ # - Python/FastAPI: uv run uvicorn src.app.main:app --reload (port 8000)
148
+ # - Rails: bin/rails server (port 3000)
149
+ {dev_server_command_from_feedback_md} &>/dev/null &
150
+ # Wait for server to be ready
151
+ sleep 5
152
+ ```
153
+
154
+ 2. **Navigate to Feature**:
155
+ ```bash
156
+ # Use 'dev_url' from .red64/steering/feedback.md as base URL
157
+ agent-browser goto {dev_url_from_feedback_md}/path/to/feature
158
+ ```
159
+
160
+ 3. **Capture Screenshot**:
161
+ ```bash
162
+ agent-browser screenshot --full-page /tmp/ui-capture-$(date +%s).png
163
+ ```
164
+
165
+ 4. **Get Accessibility Tree** (for structural verification):
166
+ ```bash
167
+ agent-browser snapshot > /tmp/accessibility-tree.json
168
+ ```
169
+
170
+ 5. **Analyze and Compare**:
171
+ - Read the captured screenshot
172
+ - Compare against design specifications in design.md
173
+ - Check accessibility tree for proper element structure
174
+ - Verify interactive elements are accessible
175
+
176
+ 6. **Fix Visual Discrepancies**:
177
+ - If UI doesn't match design spec: fix code and repeat steps 2-5
178
+ - If accessibility issues found: add proper ARIA labels, semantic HTML
179
+ - Continue until UI matches specification
180
+
181
+ ### Agent-Browser Commands Reference
182
+
183
+ | Command | Purpose |
184
+ |---------|---------|
185
+ | `agent-browser goto <url>` | Navigate to URL |
186
+ | `agent-browser screenshot [--full-page] <path>` | Capture screenshot |
187
+ | `agent-browser snapshot` | Get AI-optimized accessibility tree |
188
+ | `agent-browser click <element-ref>` | Click on element |
189
+ | `agent-browser type <element-ref> <text>` | Type into input |
190
+ | `agent-browser scroll <direction>` | Scroll page |
191
+
192
+ ### UI Verification Loop
193
+
194
+ ```
195
+ ┌─────────────────────────────────────────────────────────┐
196
+ │ 1. Implement UI code changes │
197
+ │ 2. Start dev server (if not running) │
198
+ │ 3. Navigate: agent-browser goto <url> │
199
+ │ 4. Capture: agent-browser screenshot /tmp/ui.png │
200
+ │ 5. Analyze screenshot vs. design spec │
201
+ │ 6. If visual mismatch: │
202
+ │ - Identify discrepancies │
203
+ │ - Fix code │
204
+ │ - Goto step 3 │
205
+ │ 7. Capture accessibility tree for structure check │
206
+ │ 8. Fix accessibility issues if found │
207
+ │ 9. Run tests to ensure no regressions │
208
+ │ 10. Mark implementation complete │
209
+ └─────────────────────────────────────────────────────────┘
210
+ ```
211
+
86
212
  ## Critical Constraints
87
213
  - **TDD Mandatory**: Tests MUST be written before implementation code
88
214
  - **Task Scope**: Implement only what the specific task requires
89
215
  - **Test Coverage**: All new code must have tests
90
216
  - **No Regressions**: Existing tests must continue to pass
91
217
  - **Design Alignment**: Implementation must follow design.md specifications
218
+ - **Feedback Loop**: Run tests after EVERY implementation change; fix failures before proceeding
219
+ - **UI Verification**: For UI-related tasks, use agent-browser to capture and verify visual output
92
220
 
93
221
  ## Tool Guidance
94
- - **Read first**: Load all context before implementation
222
+ - **Read feedback.md first**: Parse `.red64/steering/feedback.md` to get project-specific test, lint, and dev server commands
223
+ - **Read all context**: Load specs and steering before implementation
95
224
  - **Test first**: Write tests before code
96
225
  - Use **WebSearch/WebFetch** for library documentation when needed
97
226
 
@@ -117,4 +246,4 @@ Provide brief summary in the language specified in spec.json:
117
246
  - **Action**: Debug and fix, then re-run
118
247
 
119
248
  **Note**: You execute tasks autonomously. Return final report only when complete.
120
- think
249
+ think
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: validate-gap-agent
3
3
  description: Analyze implementation gap between requirements and existing codebase
4
- tools: Read, Grep, Glob, WebSearch, WebFetch
4
+ tools: Read, Write, Edit, Grep, Glob, WebSearch, WebFetch
5
5
  model: inherit
6
6
  color: yellow
7
7
  ---
@@ -49,6 +49,7 @@ Analyze implementation gap for feature based on approved requirements and existi
49
49
 
50
50
  2. **Read Analysis Guidelines**:
51
51
  - Read `.red64/settings/rules/gap-analysis.md` for comprehensive analysis framework
52
+ - Read `.red64/settings/templates/specs/gap-analysis.md` for document structure
52
53
 
53
54
  3. **Execute Gap Analysis**:
54
55
  - Follow gap-analysis.md framework for thorough investigation
@@ -57,11 +58,15 @@ Analyze implementation gap for feature based on approved requirements and existi
57
58
  - Evaluate multiple implementation approaches (extend/new/hybrid)
58
59
  - Use language specified in spec.json for output
59
60
 
60
- 4. **Generate Analysis Document**:
61
- - Create comprehensive gap analysis following the output guidelines in gap-analysis.md
61
+ 4. **Write Analysis Document**:
62
+ - **Write gap analysis to `.red64/specs/{feature}/gap-analysis.md`** using the template structure
63
+ - Include: Requirement-to-Asset Map, Options A/B/C, Effort/Risk assessments, Recommendations
62
64
  - Present multiple viable options with trade-offs
63
65
  - Flag areas requiring further research
64
66
 
67
+ 5. **Update Metadata**:
68
+ - Edit `.red64/specs/{feature}/spec.json` to set `phase: "gap-analyzed"` if needed
69
+
65
70
  ## Important Constraints
66
71
  - **Information over Decisions**: Provide analysis and options, not final implementation choices
67
72
  - **Multiple Options**: Present viable alternatives when applicable
@@ -69,22 +74,23 @@ Analyze implementation gap for feature based on approved requirements and existi
69
74
  - **Explicit Gaps**: Clearly flag areas needing research or investigation
70
75
 
71
76
  ## Tool Guidance
72
- - **Read first**: Load all context (spec, steering, rules) before analysis
77
+ - **Read first**: Load all context (spec, steering, rules, templates) before analysis
73
78
  - **Grep extensively**: Search codebase for patterns, conventions, and integration points
74
79
  - **WebSearch/WebFetch**: Research external dependencies and best practices when needed
75
- - **Write last**: Generate analysis only after complete investigation
80
+ - **Write last**: Write gap-analysis.md only after complete investigation
76
81
 
77
82
  ## Output Description
78
83
  Provide output in the language specified in spec.json with:
79
84
 
80
85
  1. **Analysis Summary**: Brief overview (3-5 bullets) of scope, challenges, and recommendations
81
- 2. **Document Status**: Confirm analysis approach used
86
+ 2. **Document Status**: Confirm gap-analysis.md was created at `.red64/specs/{feature}/gap-analysis.md`
82
87
  3. **Next Steps**: Guide user on proceeding to design phase
83
88
 
84
89
  **Format Requirements**:
85
90
  - Use Markdown headings for clarity
86
91
  - Keep summary concise (under 300 words)
87
- - Detailed analysis follows gap-analysis.md output guidelines
92
+ - Include the full path to the generated gap-analysis.md file
93
+ - Detailed analysis is in the generated document
88
94
 
89
95
  ## Safety & Fallback
90
96
 
@@ -25,6 +25,19 @@ If validation fails, inform user to complete tasks generation first.
25
25
  - If `$2` provided: Parse task numbers (e.g., "1.1", "1,2,3")
26
26
  - Otherwise: Read `.red64/specs/$1/tasks.md` and find all unchecked tasks (`- [ ]`)
27
27
 
28
+ ## Detect UI-Related Tasks
29
+
30
+ Before invoking the subagent, analyze the tasks to determine if they involve UI work:
31
+
32
+ **UI Detection Keywords** (in task description or design.md):
33
+ - Component, page, layout, view, screen
34
+ - Style, CSS, Tailwind, styled-components
35
+ - Button, form, input, modal, dialog
36
+ - Visual, UI, UX, design, mockup
37
+ - Frontend, client-side, browser
38
+
39
+ If UI-related keywords detected, set `UI Mode: enabled` in the prompt.
40
+
28
41
  ## Invoke Subagent
29
42
 
30
43
  Delegate TDD implementation to spec-tdd-impl-agent:
@@ -45,6 +58,17 @@ File patterns to read:
45
58
  - .red64/steering/*.md
46
59
 
47
60
  TDD Mode: strict (test-first)
61
+ UI Mode: {enabled if UI-related, disabled otherwise}
62
+
63
+ ## Feedback Requirements
64
+ After EVERY implementation change:
65
+ 1. Run project tests: Use command from .red64/steering/feedback.md
66
+ 2. Fix any test failures before proceeding
67
+ 3. If UI Mode enabled: Use agent-browser for visual verification
68
+ - Start dev server if not running
69
+ - Capture screenshots of implemented UI
70
+ - Compare against design specifications
71
+ - Fix visual discrepancies before marking complete
48
72
  """
49
73
  )
50
74
  ```
@@ -35,6 +35,10 @@ File patterns to read:
35
35
  - .red64/specs/$1/requirements.md
36
36
  - .red64/steering/*.md
37
37
  - .red64/settings/rules/gap-analysis.md
38
+ - .red64/settings/templates/specs/gap-analysis.md
39
+
40
+ Output:
41
+ - Write gap analysis document to: .red64/specs/$1/gap-analysis.md
38
42
  """
39
43
  )
40
44
  ```
@@ -46,6 +46,16 @@ Execute implementation tasks for feature using Test-Driven Development.
46
46
  **Read all necessary context**:
47
47
  - `.red64/specs/{feature}/spec.json`, `requirements.md`, `design.md`, `tasks.md`
48
48
  - **Entire `.red64/steering/` directory** for complete project memory
49
+ - **`.red64/steering/feedback.md`** - CRITICAL: Contains project-specific test, lint, and dev server commands
50
+
51
+ **Parse feedback.md for commands**:
52
+ Extract these values from the YAML blocks in `feedback.md`:
53
+ - `test`: Primary test command (e.g., `pnpm test:run`, `uv run pytest`)
54
+ - `lint`: Primary lint command (e.g., `pnpm lint`, `uv run ruff check .`)
55
+ - `dev_server`: Dev server command (e.g., `pnpm dev`, `bin/rails server`)
56
+ - `dev_port`: Dev server port (e.g., `3000`, `5173`, `8000`)
57
+ - `dev_url`: Dev server base URL (e.g., `http://localhost:3000`)
58
+ - `ui_verification_enabled`: Whether to use agent-browser for UI tasks
49
59
 
50
60
  **Validate approvals**:
51
61
  - Verify tasks are approved in spec.json (stop if not, see Safety & Fallback)
@@ -81,17 +91,136 @@ For each selected task, follow Kent Beck's TDD cycle:
81
91
  - No regressions in existing functionality
82
92
  - Code coverage maintained or improved
83
93
 
94
+ 5. **FEEDBACK LOOP - Self-Correction**:
95
+ After each implementation change, run the feedback loop using commands from `feedback.md`:
96
+
97
+ **Testing Feedback** (MANDATORY):
98
+ ```bash
99
+ # Use the 'test' command from .red64/steering/feedback.md
100
+ # Examples by stack:
101
+ # - React/Next.js: pnpm test:run
102
+ # - Python: uv run pytest
103
+ # - Rails: bin/rails test
104
+ {test_command_from_feedback_md}
105
+ ```
106
+ - Parse test output for failures
107
+ - If tests fail: Fix issues before proceeding
108
+ - Never mark implementation complete with failing tests
109
+
110
+ **Linting Feedback** (when available):
111
+ ```bash
112
+ # Use the 'lint' command from .red64/steering/feedback.md
113
+ # Examples by stack:
114
+ # - React/Next.js: pnpm lint
115
+ # - Python: uv run ruff check .
116
+ # - Rails: bundle exec rubocop
117
+ {lint_command_from_feedback_md}
118
+ ```
119
+ - Fix critical/error-level issues
120
+ - Warnings are advisory (log but proceed)
121
+
122
+ **UI Verification** (for UI-related tasks - see UI Verification Protocol below):
123
+ - Check `ui_verification_enabled` in feedback.md (skip if false)
124
+ - Required when task involves: components, pages, layouts, styles, visual elements
125
+ - Use agent-browser for screenshot capture and accessibility analysis
126
+
84
127
  **Note**: Do NOT update task checkboxes in tasks.md. The orchestrator handles task completion tracking.
85
128
 
129
+ ## UI Verification Protocol
130
+
131
+ When implementing UI-related tasks (components, pages, layouts, styles, visual elements), use **agent-browser** for verification:
132
+
133
+ ### When to Use UI Verification
134
+ - Task creates or modifies React/Vue/Angular components
135
+ - Task involves styling changes (CSS, Tailwind, styled-components)
136
+ - Task mentions visual elements, layouts, or design specs
137
+ - Design.md includes mockups, wireframes, or visual references
138
+
139
+ ### UI Verification Steps
140
+
141
+ 1. **Start Development Server** (if not running):
142
+ ```bash
143
+ # Use 'dev_server' command from .red64/steering/feedback.md
144
+ # Examples by stack:
145
+ # - React: pnpm dev (port 5173)
146
+ # - Next.js: pnpm dev (port 3000)
147
+ # - Python/FastAPI: uv run uvicorn src.app.main:app --reload (port 8000)
148
+ # - Rails: bin/rails server (port 3000)
149
+ {dev_server_command_from_feedback_md} &>/dev/null &
150
+ # Wait for server to be ready
151
+ sleep 5
152
+ ```
153
+
154
+ 2. **Navigate to Feature**:
155
+ ```bash
156
+ # Use 'dev_url' from .red64/steering/feedback.md as base URL
157
+ agent-browser goto {dev_url_from_feedback_md}/path/to/feature
158
+ ```
159
+
160
+ 3. **Capture Screenshot**:
161
+ ```bash
162
+ agent-browser screenshot --full-page /tmp/ui-capture-$(date +%s).png
163
+ ```
164
+
165
+ 4. **Get Accessibility Tree** (for structural verification):
166
+ ```bash
167
+ agent-browser snapshot > /tmp/accessibility-tree.json
168
+ ```
169
+
170
+ 5. **Analyze and Compare**:
171
+ - Read the captured screenshot
172
+ - Compare against design specifications in design.md
173
+ - Check accessibility tree for proper element structure
174
+ - Verify interactive elements are accessible
175
+
176
+ 6. **Fix Visual Discrepancies**:
177
+ - If UI doesn't match design spec: fix code and repeat steps 2-5
178
+ - If accessibility issues found: add proper ARIA labels, semantic HTML
179
+ - Continue until UI matches specification
180
+
181
+ ### Agent-Browser Commands Reference
182
+
183
+ | Command | Purpose |
184
+ |---------|---------|
185
+ | `agent-browser goto <url>` | Navigate to URL |
186
+ | `agent-browser screenshot [--full-page] <path>` | Capture screenshot |
187
+ | `agent-browser snapshot` | Get AI-optimized accessibility tree |
188
+ | `agent-browser click <element-ref>` | Click on element |
189
+ | `agent-browser type <element-ref> <text>` | Type into input |
190
+ | `agent-browser scroll <direction>` | Scroll page |
191
+
192
+ ### UI Verification Loop
193
+
194
+ ```
195
+ ┌─────────────────────────────────────────────────────────┐
196
+ │ 1. Implement UI code changes │
197
+ │ 2. Start dev server (if not running) │
198
+ │ 3. Navigate: agent-browser goto <url> │
199
+ │ 4. Capture: agent-browser screenshot /tmp/ui.png │
200
+ │ 5. Analyze screenshot vs. design spec │
201
+ │ 6. If visual mismatch: │
202
+ │ - Identify discrepancies │
203
+ │ - Fix code │
204
+ │ - Goto step 3 │
205
+ │ 7. Capture accessibility tree for structure check │
206
+ │ 8. Fix accessibility issues if found │
207
+ │ 9. Run tests to ensure no regressions │
208
+ │ 10. Mark implementation complete │
209
+ └─────────────────────────────────────────────────────────┘
210
+ ```
211
+
86
212
  ## Critical Constraints
87
213
  - **TDD Mandatory**: Tests MUST be written before implementation code
88
214
  - **Task Scope**: Implement only what the specific task requires
89
215
  - **Test Coverage**: All new code must have tests
90
216
  - **No Regressions**: Existing tests must continue to pass
91
217
  - **Design Alignment**: Implementation must follow design.md specifications
218
+ - **Feedback Loop**: Run tests after EVERY implementation change; fix failures before proceeding
219
+ - **UI Verification**: For UI-related tasks, use agent-browser to capture and verify visual output
92
220
 
93
221
  ## Tool Guidance
94
- - **Read first**: Load all context before implementation
222
+ - **Read feedback.md first**: Parse `.red64/steering/feedback.md` to get project-specific test, lint, and dev server commands
223
+ - **Read all context**: Load specs and steering before implementation
95
224
  - **Test first**: Write tests before code
96
225
  - Use **WebSearch/WebFetch** for library documentation when needed
97
226
 
@@ -117,4 +246,4 @@ Provide brief summary in the language specified in spec.json:
117
246
  - **Action**: Debug and fix, then re-run
118
247
 
119
248
  **Note**: You execute tasks autonomously. Return final report only when complete.
120
- think
249
+ think
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: validate-gap-agent
3
3
  description: Analyze implementation gap between requirements and existing codebase
4
- tools: Read, Grep, Glob, WebSearch, WebFetch
4
+ tools: Read, Write, Edit, Grep, Glob, WebSearch, WebFetch
5
5
  model: inherit
6
6
  color: yellow
7
7
  ---
@@ -49,6 +49,7 @@ Analyze implementation gap for feature based on approved requirements and existi
49
49
 
50
50
  2. **Read Analysis Guidelines**:
51
51
  - Read `.red64/settings/rules/gap-analysis.md` for comprehensive analysis framework
52
+ - Read `.red64/settings/templates/specs/gap-analysis.md` for document structure
52
53
 
53
54
  3. **Execute Gap Analysis**:
54
55
  - Follow gap-analysis.md framework for thorough investigation
@@ -57,11 +58,15 @@ Analyze implementation gap for feature based on approved requirements and existi
57
58
  - Evaluate multiple implementation approaches (extend/new/hybrid)
58
59
  - Use language specified in spec.json for output
59
60
 
60
- 4. **Generate Analysis Document**:
61
- - Create comprehensive gap analysis following the output guidelines in gap-analysis.md
61
+ 4. **Write Analysis Document**:
62
+ - **Write gap analysis to `.red64/specs/{feature}/gap-analysis.md`** using the template structure
63
+ - Include: Requirement-to-Asset Map, Options A/B/C, Effort/Risk assessments, Recommendations
62
64
  - Present multiple viable options with trade-offs
63
65
  - Flag areas requiring further research
64
66
 
67
+ 5. **Update Metadata**:
68
+ - Edit `.red64/specs/{feature}/spec.json` to set `phase: "gap-analyzed"` if needed
69
+
65
70
  ## Important Constraints
66
71
  - **Information over Decisions**: Provide analysis and options, not final implementation choices
67
72
  - **Multiple Options**: Present viable alternatives when applicable
@@ -69,22 +74,23 @@ Analyze implementation gap for feature based on approved requirements and existi
69
74
  - **Explicit Gaps**: Clearly flag areas needing research or investigation
70
75
 
71
76
  ## Tool Guidance
72
- - **Read first**: Load all context (spec, steering, rules) before analysis
77
+ - **Read first**: Load all context (spec, steering, rules, templates) before analysis
73
78
  - **Grep extensively**: Search codebase for patterns, conventions, and integration points
74
79
  - **WebSearch/WebFetch**: Research external dependencies and best practices when needed
75
- - **Write last**: Generate analysis only after complete investigation
80
+ - **Write last**: Write gap-analysis.md only after complete investigation
76
81
 
77
82
  ## Output Description
78
83
  Provide output in the language specified in spec.json with:
79
84
 
80
85
  1. **Analysis Summary**: Brief overview (3-5 bullets) of scope, challenges, and recommendations
81
- 2. **Document Status**: Confirm analysis approach used
86
+ 2. **Document Status**: Confirm gap-analysis.md was created at `.red64/specs/{feature}/gap-analysis.md`
82
87
  3. **Next Steps**: Guide user on proceeding to design phase
83
88
 
84
89
  **Format Requirements**:
85
90
  - Use Markdown headings for clarity
86
91
  - Keep summary concise (under 300 words)
87
- - Detailed analysis follows gap-analysis.md output guidelines
92
+ - Include the full path to the generated gap-analysis.md file
93
+ - Detailed analysis is in the generated document
88
94
 
89
95
  ## Safety & Fallback
90
96
 
@@ -25,6 +25,19 @@ If validation fails, inform user to complete tasks generation first.
25
25
  - If `$2` provided: Parse task numbers (e.g., "1.1", "1,2,3")
26
26
  - Otherwise: Read `.red64/specs/$1/tasks.md` and find all unchecked tasks (`- [ ]`)
27
27
 
28
+ ## Detect UI-Related Tasks
29
+
30
+ Before invoking the subagent, analyze the tasks to determine if they involve UI work:
31
+
32
+ **UI Detection Keywords** (in task description or design.md):
33
+ - Component, page, layout, view, screen
34
+ - Style, CSS, Tailwind, styled-components
35
+ - Button, form, input, modal, dialog
36
+ - Visual, UI, UX, design, mockup
37
+ - Frontend, client-side, browser
38
+
39
+ If UI-related keywords detected, set `UI Mode: enabled` in the prompt.
40
+
28
41
  ## Invoke Subagent
29
42
 
30
43
  Delegate TDD implementation to spec-tdd-impl-agent:
@@ -45,6 +58,17 @@ File patterns to read:
45
58
  - .red64/steering/*.md
46
59
 
47
60
  TDD Mode: strict (test-first)
61
+ UI Mode: {enabled if UI-related, disabled otherwise}
62
+
63
+ ## Feedback Requirements
64
+ After EVERY implementation change:
65
+ 1. Run project tests: Use command from .red64/steering/feedback.md
66
+ 2. Fix any test failures before proceeding
67
+ 3. If UI Mode enabled: Use agent-browser for visual verification
68
+ - Start dev server if not running
69
+ - Capture screenshots of implemented UI
70
+ - Compare against design specifications
71
+ - Fix visual discrepancies before marking complete
48
72
  """
49
73
  )
50
74
  ```
@@ -35,6 +35,10 @@ File patterns to read:
35
35
  - .red64/specs/$1/requirements.md
36
36
  - .red64/steering/*.md
37
37
  - .red64/settings/rules/gap-analysis.md
38
+ - .red64/settings/templates/specs/gap-analysis.md
39
+
40
+ Output:
41
+ - Write gap analysis document to: .red64/specs/$1/gap-analysis.md
38
42
  """
39
43
  )
40
44
  ```
@@ -0,0 +1,80 @@
1
+ # Feedback Configuration
2
+
3
+ Project-specific commands for automated feedback during implementation.
4
+
5
+ ---
6
+
7
+ ## Test Commands
8
+
9
+ Commands to run tests during implementation. The agent will use these to verify code changes.
10
+
11
+ ```yaml
12
+ # Primary test command (REQUIRED)
13
+ test: npm test
14
+
15
+ # Test with coverage report
16
+ test_coverage: npm test -- --coverage
17
+
18
+ # Run specific test file (use {file} as placeholder)
19
+ test_file: npm test -- {file}
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Linting Commands
25
+
26
+ Commands for code quality checks.
27
+
28
+ ```yaml
29
+ # Primary lint command
30
+ lint: npm run lint
31
+
32
+ # Lint with auto-fix
33
+ lint_fix: npm run lint -- --fix
34
+
35
+ # Type checking (if applicable)
36
+ type_check: npm run type-check
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Development Server
42
+
43
+ Commands for starting the development server (required for UI verification).
44
+
45
+ ```yaml
46
+ # Start dev server
47
+ dev_server: npm run dev
48
+
49
+ # Dev server port
50
+ dev_port: 3000
51
+
52
+ # Dev server base URL
53
+ dev_url: http://localhost:3000
54
+ ```
55
+
56
+ ---
57
+
58
+ ## UI Verification
59
+
60
+ Settings for agent-browser UI verification.
61
+
62
+ ```yaml
63
+ # Enable UI verification for this project
64
+ ui_verification_enabled: true
65
+
66
+ # Default wait time after navigation (milliseconds)
67
+ navigation_wait: 3000
68
+
69
+ # Screenshot directory
70
+ screenshot_dir: /tmp/ui-captures
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Notes
76
+
77
+ - Update these commands to match your project's setup
78
+ - The agent reads this file to determine how to run tests and verify UI
79
+ - If a command doesn't apply, leave it empty or remove the line
80
+ - All commands should be runnable from the project root directory