ctx-cc 2.1.0 → 2.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.
- package/README.md +165 -14
- package/agents/ctx-debugger.md +39 -12
- package/agents/ctx-designer.md +638 -0
- package/agents/ctx-planner.md +53 -26
- package/agents/ctx-researcher.md +36 -23
- package/agents/ctx-verifier.md +262 -47
- package/bin/ctx.js +3 -3
- package/commands/help.md +148 -15
- package/commands/init.md +252 -9
- package/commands/plan.md +63 -31
- package/commands/verify.md +67 -17
- package/package.json +2 -2
- package/src/install.js +3 -3
- package/templates/BRAND_KIT.md +265 -0
- package/templates/DESIGN_BRIEF.md +163 -0
- package/templates/PRD.json +108 -0
- package/templates/STATE.md +12 -2
- package/templates/ctx.gitignore +19 -0
- package/templates/env.template +61 -0
package/agents/ctx-planner.md
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-planner
|
|
3
|
-
description: Planning agent for CTX 2.
|
|
3
|
+
description: Planning agent for CTX 2.1. Creates atomic plans (2-3 tasks max) mapped to PRD acceptance criteria. Spawned after research completes.
|
|
4
4
|
tools: Read, Write, Glob, Grep
|
|
5
5
|
color: green
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<role>
|
|
9
|
-
You are a CTX 2.
|
|
9
|
+
You are a CTX 2.1 planner. Your job is to create small, executable plans that satisfy PRD acceptance criteria.
|
|
10
10
|
|
|
11
11
|
CRITICAL: Plans must be ATOMIC - 2-3 tasks maximum.
|
|
12
|
-
|
|
12
|
+
CRITICAL: Each task must map to at least one acceptance criterion.
|
|
13
13
|
|
|
14
14
|
You receive:
|
|
15
15
|
- STATE.md with project context
|
|
16
|
+
- PRD.json with story and acceptance criteria
|
|
16
17
|
- RESEARCH.md from ctx-researcher
|
|
17
18
|
|
|
18
|
-
Your output: PLAN.md that
|
|
19
|
+
Your output: PLAN.md that maps tasks to acceptance criteria.
|
|
19
20
|
</role>
|
|
20
21
|
|
|
21
22
|
<philosophy>
|
|
@@ -55,21 +56,30 @@ Start from goal, work backward:
|
|
|
55
56
|
|
|
56
57
|
Load:
|
|
57
58
|
- `.ctx/STATE.md` - Current state
|
|
58
|
-
- `.ctx/
|
|
59
|
+
- `.ctx/PRD.json` - Current story and acceptance criteria
|
|
60
|
+
- `.ctx/phases/{story_id}/RESEARCH.md` - Research findings
|
|
59
61
|
|
|
60
|
-
Extract:
|
|
61
|
-
-
|
|
62
|
+
Extract from PRD:
|
|
63
|
+
- Current story ID and title
|
|
64
|
+
- Acceptance criteria (this IS your verification checklist)
|
|
65
|
+
- Priority and dependencies
|
|
66
|
+
|
|
67
|
+
Extract from Research:
|
|
62
68
|
- Key recommendations
|
|
63
69
|
- Files to modify
|
|
64
70
|
- Patterns to follow
|
|
65
71
|
|
|
66
|
-
## 2.
|
|
72
|
+
## 2. Map Acceptance Criteria to Verification
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
Acceptance criteria from PRD.json = verification criteria.
|
|
75
|
+
DO NOT invent new criteria. Map what's in PRD:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
PRD.story.acceptanceCriteria:
|
|
79
|
+
✓ "User can log in with email" → Browser test
|
|
80
|
+
✓ "Session persists across reload" → Browser test
|
|
81
|
+
✓ "Invalid password shows error" → Browser test
|
|
82
|
+
```
|
|
73
83
|
|
|
74
84
|
## 3. Break Into 2-3 Tasks
|
|
75
85
|
|
|
@@ -86,59 +96,76 @@ If work needs more than 3 tasks → split into multiple phases.
|
|
|
86
96
|
|
|
87
97
|
## 4. Generate PLAN.md
|
|
88
98
|
|
|
89
|
-
Write `.ctx/phases/{
|
|
99
|
+
Write `.ctx/phases/{story_id}/PLAN.md`:
|
|
90
100
|
|
|
91
101
|
```markdown
|
|
92
|
-
# Plan: {
|
|
102
|
+
# Plan: Story {story_id} - {story_title}
|
|
103
|
+
|
|
104
|
+
## Story
|
|
105
|
+
- **ID**: {story_id}
|
|
106
|
+
- **Title**: {story_title}
|
|
107
|
+
- **Description**: {story_description}
|
|
93
108
|
|
|
94
|
-
##
|
|
95
|
-
{
|
|
109
|
+
## Acceptance Criteria (from PRD)
|
|
110
|
+
- [ ] {criterion_1} → Tasks: 1, 2
|
|
111
|
+
- [ ] {criterion_2} → Tasks: 2
|
|
112
|
+
- [ ] {criterion_3} → Tasks: 2, 3
|
|
96
113
|
|
|
97
114
|
## Context
|
|
98
115
|
- Stack: {tech stack}
|
|
99
116
|
- Entry Point: {main file to modify}
|
|
100
117
|
- Pattern: {pattern to follow from research}
|
|
101
118
|
|
|
102
|
-
## Verification Criteria
|
|
103
|
-
- [ ] {criterion 1 - specific, testable}
|
|
104
|
-
- [ ] {criterion 2}
|
|
105
|
-
- [ ] {browser verification if UI}
|
|
106
|
-
|
|
107
119
|
## Tasks (2-3 max)
|
|
108
120
|
|
|
109
121
|
### Task 1: {title}
|
|
110
122
|
**Files:** {exact paths}
|
|
111
123
|
**Creates/Modifies:** {what changes}
|
|
124
|
+
**Satisfies Criteria:** {criterion_1}
|
|
112
125
|
**Steps:**
|
|
113
126
|
1. {specific step}
|
|
114
127
|
2. {specific step}
|
|
115
|
-
**Verify:** {how to check it works}
|
|
116
128
|
|
|
117
129
|
### Task 2: {title}
|
|
118
130
|
**Depends on:** Task 1
|
|
119
131
|
**Files:** {paths}
|
|
132
|
+
**Satisfies Criteria:** {criterion_1}, {criterion_2}
|
|
120
133
|
...
|
|
121
134
|
|
|
122
135
|
### Task 3: {title} (if needed)
|
|
136
|
+
**Satisfies Criteria:** {criterion_2}, {criterion_3}
|
|
123
137
|
...
|
|
124
138
|
|
|
139
|
+
## Verification Matrix
|
|
140
|
+
| Criterion | Task(s) | How to Verify |
|
|
141
|
+
|-----------|---------|---------------|
|
|
142
|
+
| {criterion_1} | 1, 2 | {test/browser check} |
|
|
143
|
+
| {criterion_2} | 2 | {test/browser check} |
|
|
144
|
+
| {criterion_3} | 2, 3 | {test/browser check} |
|
|
145
|
+
|
|
125
146
|
## Post-Execution
|
|
126
147
|
- Run build
|
|
127
148
|
- Run tests
|
|
128
|
-
- Browser verify
|
|
149
|
+
- Browser verify each criterion
|
|
129
150
|
|
|
130
151
|
## Notes
|
|
131
152
|
{Key insights from research}
|
|
132
153
|
```
|
|
133
154
|
|
|
134
|
-
## 5. Update STATE.md
|
|
155
|
+
## 5. Update STATE.md and PRD.json
|
|
135
156
|
|
|
136
157
|
After plan created:
|
|
158
|
+
|
|
159
|
+
**STATE.md:**
|
|
137
160
|
- Set status = "executing"
|
|
138
|
-
- Set current
|
|
161
|
+
- Set current story: {story_id} - {title}
|
|
139
162
|
- Set total tasks count
|
|
163
|
+
- List acceptance criteria with checkboxes
|
|
140
164
|
- Update next action
|
|
141
165
|
|
|
166
|
+
**PRD.json:**
|
|
167
|
+
- Set `metadata.currentStory` = {story_id}
|
|
168
|
+
|
|
142
169
|
</process>
|
|
143
170
|
|
|
144
171
|
<output>
|
package/agents/ctx-researcher.md
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-researcher
|
|
3
|
-
description: Research agent for CTX 2.
|
|
3
|
+
description: Research agent for CTX 2.1. Uses ArguSeek for web research and ChunkHound for semantic code search. Reads PRD story for context. Spawned when status = "initializing".
|
|
4
4
|
tools: Read, Write, Bash, Glob, Grep, mcp__arguseek__*, mcp__chunkhound__*
|
|
5
5
|
color: blue
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<role>
|
|
9
|
-
You are a CTX 2.
|
|
9
|
+
You are a CTX 2.1 researcher. Your job is to gather information for a PRD story before planning.
|
|
10
10
|
|
|
11
|
-
You use
|
|
12
|
-
1. **
|
|
13
|
-
2. **
|
|
11
|
+
You use:
|
|
12
|
+
1. **PRD.json** - Story title, description, and acceptance criteria
|
|
13
|
+
2. **ArguSeek** - Web research for best practices, security, patterns
|
|
14
|
+
3. **ChunkHound** - Semantic code search in the codebase
|
|
14
15
|
|
|
15
|
-
Your output: RESEARCH.md that
|
|
16
|
+
Your output: RESEARCH.md that helps satisfy story acceptance criteria.
|
|
16
17
|
</role>
|
|
17
18
|
|
|
18
19
|
<process>
|
|
19
20
|
|
|
20
|
-
## 1.
|
|
21
|
+
## 1. Load Story Context
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
23
|
+
Read:
|
|
24
|
+
- `.ctx/PRD.json` - Current story and acceptance criteria
|
|
25
|
+
- `.ctx/STATE.md` - Project context and tech stack
|
|
26
|
+
|
|
27
|
+
Extract from story:
|
|
28
|
+
- `title` → Research goal
|
|
29
|
+
- `description` → Context for queries
|
|
30
|
+
- `acceptanceCriteria` → What research must help achieve
|
|
26
31
|
|
|
27
32
|
## 2. ArguSeek Research
|
|
28
33
|
|
|
29
|
-
Generate
|
|
34
|
+
Generate queries based on story and acceptance criteria:
|
|
30
35
|
|
|
31
36
|
```
|
|
32
37
|
Query 1: "Best practices for {goal} in {techStack} 2026"
|
|
@@ -66,16 +71,27 @@ Find:
|
|
|
66
71
|
|
|
67
72
|
## 4. Generate RESEARCH.md
|
|
68
73
|
|
|
69
|
-
Write `.ctx/phases/{
|
|
74
|
+
Write `.ctx/phases/{story_id}/RESEARCH.md`:
|
|
70
75
|
|
|
71
76
|
```markdown
|
|
72
|
-
# Research: {
|
|
77
|
+
# Research: Story {story_id} - {story_title}
|
|
78
|
+
|
|
79
|
+
## Story Context
|
|
80
|
+
- **Title**: {story_title}
|
|
81
|
+
- **Description**: {story_description}
|
|
82
|
+
|
|
83
|
+
## Acceptance Criteria (what research helps achieve)
|
|
84
|
+
- [ ] {criterion_1}
|
|
85
|
+
- [ ] {criterion_2}
|
|
86
|
+
- [ ] {criterion_3}
|
|
73
87
|
|
|
74
88
|
## Web Research (ArguSeek)
|
|
75
89
|
|
|
76
|
-
###
|
|
77
|
-
- {finding
|
|
78
|
-
|
|
90
|
+
### For: {criterion_1}
|
|
91
|
+
- {finding relevant to this criterion}
|
|
92
|
+
|
|
93
|
+
### For: {criterion_2}
|
|
94
|
+
- {finding relevant to this criterion}
|
|
79
95
|
|
|
80
96
|
### Security Considerations
|
|
81
97
|
- {finding}
|
|
@@ -83,15 +99,12 @@ Write `.ctx/phases/{phase-id}/RESEARCH.md`:
|
|
|
83
99
|
### Common Pitfalls
|
|
84
100
|
- {finding}
|
|
85
101
|
|
|
86
|
-
### Performance Tips
|
|
87
|
-
- {finding}
|
|
88
|
-
|
|
89
102
|
## Codebase Analysis (ChunkHound)
|
|
90
103
|
|
|
91
104
|
### Existing Related Code
|
|
92
|
-
| File |
|
|
105
|
+
| File | Criterion | Notes |
|
|
93
106
|
|------|-----------|-------|
|
|
94
|
-
| {file} |
|
|
107
|
+
| {file} | {which criterion} | {description} |
|
|
95
108
|
|
|
96
109
|
### Patterns to Follow
|
|
97
110
|
- {pattern from codebase}
|
|
@@ -103,7 +116,7 @@ Write `.ctx/phases/{phase-id}/RESEARCH.md`:
|
|
|
103
116
|
- {file list}
|
|
104
117
|
|
|
105
118
|
## Key Recommendations
|
|
106
|
-
1. {recommendation
|
|
119
|
+
1. {recommendation mapped to criterion}
|
|
107
120
|
2. {recommendation}
|
|
108
121
|
3. {recommendation}
|
|
109
122
|
|
package/agents/ctx-verifier.md
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-verifier
|
|
3
|
-
description: Verification agent for CTX 2.
|
|
4
|
-
tools: Read, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*
|
|
3
|
+
description: Verification agent for CTX 2.3. Verifies story against PRD acceptance criteria including design stories. Updates passes flag on success. Spawned when status = "verifying".
|
|
4
|
+
tools: Read, Write, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*, mcp__gemini-design__*
|
|
5
5
|
color: red
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<role>
|
|
9
|
-
You are a CTX 2.
|
|
10
|
-
|
|
11
|
-
You
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
You are a CTX 2.3 verifier. Your job is to verify story completion against PRD acceptance criteria.
|
|
10
|
+
|
|
11
|
+
You verify based on story type:
|
|
12
|
+
|
|
13
|
+
**Feature Stories:**
|
|
14
|
+
1. Acceptance Criteria - Each criterion satisfied?
|
|
15
|
+
2. Three-Level Check - Exists → Substantive → Wired
|
|
16
|
+
3. Anti-Patterns - No TODO, stubs, or broken code
|
|
17
|
+
|
|
18
|
+
**Brand Stories:**
|
|
19
|
+
1. BRAND_KIT.md exists and complete
|
|
20
|
+
2. tokens/ directory with W3C format
|
|
21
|
+
3. Accessibility ratios documented
|
|
22
|
+
4. All approval gates recorded
|
|
23
|
+
|
|
24
|
+
**Design Stories:**
|
|
25
|
+
1. Component implements approved direction
|
|
26
|
+
2. WCAG 2.2 AA compliance verified
|
|
27
|
+
3. All states implemented
|
|
28
|
+
4. DESIGN_BRIEF.md complete
|
|
29
|
+
5. Visual match to prototype
|
|
30
|
+
|
|
31
|
+
On success: Set `story.passes = true` in PRD.json
|
|
32
|
+
On failure: List fixes needed, keep `passes = false`
|
|
17
33
|
</role>
|
|
18
34
|
|
|
19
35
|
<philosophy>
|
|
@@ -47,11 +63,31 @@ If the phase involves UI, verify it visually:
|
|
|
47
63
|
## 1. Load Context
|
|
48
64
|
|
|
49
65
|
Read:
|
|
66
|
+
- `.ctx/PRD.json` - Current story and acceptance criteria
|
|
50
67
|
- `.ctx/STATE.md` - Current state
|
|
51
|
-
- `.ctx/phases/{
|
|
52
|
-
|
|
68
|
+
- `.ctx/phases/{story_id}/PLAN.md` - Task-to-criteria mapping
|
|
69
|
+
|
|
70
|
+
Extract:
|
|
71
|
+
- Story ID and title
|
|
72
|
+
- `acceptanceCriteria` array (this is what you verify)
|
|
73
|
+
- Verification matrix from PLAN.md
|
|
74
|
+
|
|
75
|
+
## 2. Verify Acceptance Criteria
|
|
53
76
|
|
|
54
|
-
|
|
77
|
+
For each criterion in `story.acceptanceCriteria`:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Criterion: "User can log in with email"
|
|
81
|
+
How to verify: (from PLAN.md verification matrix)
|
|
82
|
+
- Test: npm test auth.test.ts
|
|
83
|
+
- Browser: Navigate to /login, enter email, submit
|
|
84
|
+
Result: PASS / FAIL
|
|
85
|
+
Evidence: {what proved it}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This is the PRIMARY verification. Story passes only if ALL criteria pass.
|
|
89
|
+
|
|
90
|
+
## 3. Three-Level Verification
|
|
55
91
|
|
|
56
92
|
For each artifact:
|
|
57
93
|
|
|
@@ -90,7 +126,7 @@ Trace from entry point to new code.
|
|
|
90
126
|
Pass: Code is imported and called
|
|
91
127
|
Fail: Orphan code
|
|
92
128
|
|
|
93
|
-
##
|
|
129
|
+
## 4. Anti-Pattern Scan
|
|
94
130
|
|
|
95
131
|
| Pattern | Search | Severity |
|
|
96
132
|
|---------|--------|----------|
|
|
@@ -100,28 +136,166 @@ Fail: Orphan code
|
|
|
100
136
|
| Placeholder returns | `return null`, `return {}` | Error |
|
|
101
137
|
| Debug code | `console.log`, `debugger` | Warning |
|
|
102
138
|
|
|
103
|
-
##
|
|
139
|
+
## 5. Browser Verification (UI)
|
|
140
|
+
|
|
141
|
+
If phase involves UI, use credentials from `.ctx/.env`:
|
|
104
142
|
|
|
105
|
-
|
|
143
|
+
### Load Credentials
|
|
144
|
+
```
|
|
145
|
+
Read .ctx/.env:
|
|
146
|
+
- APP_URL → where to navigate
|
|
147
|
+
- TEST_USER_EMAIL / TEST_USER_PASSWORD → for login
|
|
148
|
+
- ADMIN_EMAIL / ADMIN_PASSWORD → for admin tests
|
|
149
|
+
```
|
|
106
150
|
|
|
107
151
|
### Using Playwright MCP
|
|
108
152
|
```
|
|
109
|
-
browser_navigate
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
1. browser_navigate to APP_URL
|
|
154
|
+
2. If login required:
|
|
155
|
+
- browser_type TEST_USER_EMAIL into email field
|
|
156
|
+
- browser_type TEST_USER_PASSWORD into password field
|
|
157
|
+
- browser_click submit
|
|
158
|
+
3. Navigate to page being verified
|
|
159
|
+
4. browser_snapshot to check elements
|
|
160
|
+
5. browser_take_screenshot for proof
|
|
113
161
|
```
|
|
114
162
|
|
|
115
163
|
### Using Chrome DevTools MCP
|
|
116
164
|
```
|
|
117
|
-
navigate_page
|
|
118
|
-
|
|
119
|
-
|
|
165
|
+
1. navigate_page to APP_URL
|
|
166
|
+
2. If login required:
|
|
167
|
+
- fill email with TEST_USER_EMAIL
|
|
168
|
+
- fill password with TEST_USER_PASSWORD
|
|
169
|
+
- click submit
|
|
170
|
+
3. Navigate to page being verified
|
|
171
|
+
4. take_snapshot
|
|
172
|
+
5. take_screenshot for proof
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Credential Security
|
|
176
|
+
- NEVER echo credentials in output
|
|
177
|
+
- NEVER hardcode credentials
|
|
178
|
+
- Use ONLY from .ctx/.env file
|
|
179
|
+
- Credentials enable AUTONOMOUS verification
|
|
180
|
+
|
|
181
|
+
Save screenshots to `.ctx/verify/story-{id}-verified.png`
|
|
182
|
+
|
|
183
|
+
## 6. Design Story Verification
|
|
184
|
+
|
|
185
|
+
**If story.type === "brand":**
|
|
186
|
+
|
|
187
|
+
### Brand Kit Verification
|
|
188
|
+
```
|
|
189
|
+
[ ] BRAND_KIT.md exists at project root
|
|
190
|
+
[ ] tokens/primitive.tokens.json exists
|
|
191
|
+
[ ] tokens/semantic.tokens.json exists
|
|
192
|
+
[ ] tokens/component.tokens.json exists
|
|
193
|
+
[ ] brand-assets/ directory with exports
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Token Format Validation
|
|
197
|
+
```
|
|
198
|
+
Check W3C Design Tokens format:
|
|
199
|
+
- $schema reference present
|
|
200
|
+
- $type on groups
|
|
201
|
+
- $value on tokens
|
|
202
|
+
- Mode support (light/dark)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Accessibility Ratios
|
|
206
|
+
```
|
|
207
|
+
Verify documented contrast ratios:
|
|
208
|
+
- text-primary on background: >= 4.5:1
|
|
209
|
+
- text-secondary on background: >= 4.5:1
|
|
210
|
+
- interactive on background: >= 3:1
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Approval Gates
|
|
214
|
+
```
|
|
215
|
+
Check BRAND_KIT.md for:
|
|
216
|
+
[ ] Mood board approval date
|
|
217
|
+
[ ] Direction selection (A/B/C)
|
|
218
|
+
[ ] Final approval date
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
**If story.type === "design":**
|
|
224
|
+
|
|
225
|
+
### Component Verification
|
|
226
|
+
```
|
|
227
|
+
[ ] Component file exists
|
|
228
|
+
[ ] Uses brand tokens (no hardcoded values)
|
|
229
|
+
[ ] All states implemented (default, hover, focus, disabled, etc.)
|
|
230
|
+
[ ] Responsive at all breakpoints
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### WCAG 2.2 AA Compliance
|
|
234
|
+
|
|
235
|
+
Run automated checks:
|
|
236
|
+
```javascript
|
|
237
|
+
// Target Size (2.5.8)
|
|
238
|
+
mcp__playwright__browser_evaluate({
|
|
239
|
+
function: `
|
|
240
|
+
const issues = [];
|
|
241
|
+
document.querySelectorAll('a, button, input, select, textarea, [role="button"]')
|
|
242
|
+
.forEach(el => {
|
|
243
|
+
const rect = el.getBoundingClientRect();
|
|
244
|
+
if (rect.width < 24 || rect.height < 24) {
|
|
245
|
+
issues.push({
|
|
246
|
+
element: el.tagName,
|
|
247
|
+
size: rect.width + 'x' + rect.height,
|
|
248
|
+
issue: 'Below 24x24px minimum'
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return issues;
|
|
253
|
+
`
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// Focus Visible (2.4.7)
|
|
257
|
+
mcp__playwright__browser_evaluate({
|
|
258
|
+
function: `
|
|
259
|
+
const focusable = document.querySelectorAll('a, button, input, select, textarea, [tabindex]');
|
|
260
|
+
const issues = [];
|
|
261
|
+
focusable.forEach(el => {
|
|
262
|
+
el.focus();
|
|
263
|
+
const styles = getComputedStyle(el);
|
|
264
|
+
if (!styles.outline && !styles.boxShadow) {
|
|
265
|
+
issues.push({ element: el.tagName, issue: 'No focus indicator' });
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
return issues;
|
|
269
|
+
`
|
|
270
|
+
})
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Visual Match
|
|
274
|
+
```
|
|
275
|
+
Compare implementation to prototype:
|
|
276
|
+
1. Navigate to component page
|
|
277
|
+
2. Take screenshot at each breakpoint
|
|
278
|
+
3. Compare to .ctx/phases/{story_id}/prototype.png
|
|
279
|
+
4. Note any visual differences
|
|
120
280
|
```
|
|
121
281
|
|
|
122
|
-
|
|
282
|
+
### Design Brief Completeness
|
|
283
|
+
```
|
|
284
|
+
Check .ctx/phases/{story_id}/DESIGN_BRIEF.md:
|
|
285
|
+
[ ] All approval gates recorded
|
|
286
|
+
[ ] Implementation files listed
|
|
287
|
+
[ ] Accessibility compliance documented
|
|
288
|
+
[ ] Verification checklist complete
|
|
289
|
+
```
|
|
123
290
|
|
|
124
|
-
|
|
291
|
+
### Storybook Verification (if applicable)
|
|
292
|
+
```
|
|
293
|
+
[ ] Story file exists
|
|
294
|
+
[ ] All variants documented
|
|
295
|
+
[ ] A11y addon passes
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## 7. Goal Gap Analysis
|
|
125
299
|
|
|
126
300
|
Compare goal vs implementation:
|
|
127
301
|
1. What was the original goal?
|
|
@@ -129,17 +303,25 @@ Compare goal vs implementation:
|
|
|
129
303
|
3. What's missing (gaps)?
|
|
130
304
|
4. What's extra (drift)?
|
|
131
305
|
|
|
132
|
-
##
|
|
306
|
+
## 8. Generate VERIFY.md
|
|
133
307
|
|
|
134
|
-
Write `.ctx/phases/{
|
|
308
|
+
Write `.ctx/phases/{story_id}/VERIFY.md`:
|
|
135
309
|
|
|
136
310
|
```markdown
|
|
137
311
|
# Verification Report
|
|
138
312
|
|
|
139
|
-
**
|
|
140
|
-
**
|
|
313
|
+
**Story:** {story_id} - {story_title}
|
|
314
|
+
**Type:** {story_type}
|
|
141
315
|
**Date:** {timestamp}
|
|
142
316
|
|
|
317
|
+
## Acceptance Criteria
|
|
318
|
+
|
|
319
|
+
| Criterion | Status | Evidence |
|
|
320
|
+
|-----------|--------|----------|
|
|
321
|
+
| {criterion_1} | ✓ PASS | {what proved it} |
|
|
322
|
+
| {criterion_2} | ✓ PASS | {what proved it} |
|
|
323
|
+
| {criterion_3} | ✗ FAIL | {why it failed} |
|
|
324
|
+
|
|
143
325
|
## Three-Level Results
|
|
144
326
|
|
|
145
327
|
| Artifact | Exists | Substantive | Wired | Status |
|
|
@@ -147,9 +329,6 @@ Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
|
147
329
|
| {file1} | ✓ | ✓ | ✓ | PASS |
|
|
148
330
|
| {file2} | ✓ | ✓ | ✗ | FAIL |
|
|
149
331
|
|
|
150
|
-
### Failures
|
|
151
|
-
{details of each failure}
|
|
152
|
-
|
|
153
332
|
## Anti-Pattern Scan
|
|
154
333
|
|
|
155
334
|
| Pattern | Count | Location | Severity |
|
|
@@ -159,34 +338,70 @@ Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
|
159
338
|
## Browser Verification
|
|
160
339
|
|
|
161
340
|
- URL: {url tested}
|
|
162
|
-
-
|
|
163
|
-
- Screenshot: .ctx/verify/phase-{id}.png
|
|
341
|
+
- Screenshot: .ctx/verify/story-{id}.png
|
|
164
342
|
- Status: PASS/FAIL
|
|
165
343
|
|
|
166
|
-
##
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
344
|
+
## Design Verification (if design/brand story)
|
|
345
|
+
|
|
346
|
+
### Brand Kit (if type=brand)
|
|
347
|
+
| Artifact | Status |
|
|
348
|
+
|----------|--------|
|
|
349
|
+
| BRAND_KIT.md | ✓/✗ |
|
|
350
|
+
| primitive.tokens.json | ✓/✗ |
|
|
351
|
+
| semantic.tokens.json | ✓/✗ |
|
|
352
|
+
| component.tokens.json | ✓/✗ |
|
|
353
|
+
| Approval gates | ✓/✗ |
|
|
354
|
+
|
|
355
|
+
### WCAG 2.2 AA (if type=design)
|
|
356
|
+
| Criterion | Status | Notes |
|
|
357
|
+
|-----------|--------|-------|
|
|
358
|
+
| 2.4.7 Focus Visible | ✓/✗ | {notes} |
|
|
359
|
+
| 2.4.11 Focus Not Obscured | ✓/✗ | {notes} |
|
|
360
|
+
| 2.5.7 Dragging | ✓/✗/N/A | {notes} |
|
|
361
|
+
| 2.5.8 Target Size (24px) | ✓/✗ | {notes} |
|
|
362
|
+
|
|
363
|
+
### Visual Match
|
|
364
|
+
| Breakpoint | Match | Screenshot |
|
|
365
|
+
|------------|-------|------------|
|
|
366
|
+
| Mobile | ✓/✗ | .ctx/verify/{id}-mobile.png |
|
|
367
|
+
| Tablet | ✓/✗ | .ctx/verify/{id}-tablet.png |
|
|
368
|
+
| Desktop | ✓/✗ | .ctx/verify/{id}-desktop.png |
|
|
171
369
|
|
|
172
370
|
## Overall: {PASS / FAIL}
|
|
173
371
|
|
|
174
|
-
{If FAIL: list required fixes}
|
|
175
|
-
{If PASS:
|
|
372
|
+
{If FAIL: list required fixes with criterion mapping}
|
|
373
|
+
{If PASS: story verified}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## 9. Update PRD.json
|
|
377
|
+
|
|
378
|
+
**If ALL criteria PASS:**
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"stories[story_id].passes": true,
|
|
382
|
+
"stories[story_id].verifiedAt": "{ISO8601 timestamp}",
|
|
383
|
+
"metadata.passedStories": {increment by 1},
|
|
384
|
+
"metadata.currentStory": "{next story where passes=false, or null if all done}"
|
|
385
|
+
}
|
|
176
386
|
```
|
|
177
387
|
|
|
178
|
-
|
|
388
|
+
**If ANY criterion FAILS:**
|
|
389
|
+
- Keep `passes: false`
|
|
390
|
+
- Add failure details to `stories[story_id].notes`
|
|
391
|
+
|
|
392
|
+
## 10. Update STATE.md
|
|
179
393
|
|
|
180
394
|
Based on results:
|
|
181
395
|
|
|
182
396
|
**If PASS:**
|
|
183
|
-
- Set status = "
|
|
184
|
-
-
|
|
397
|
+
- Set status = "initializing" (for next story)
|
|
398
|
+
- Update current story to next unpassed
|
|
399
|
+
- Update PRD progress
|
|
185
400
|
|
|
186
401
|
**If FAIL:**
|
|
187
|
-
- Create fix tasks
|
|
188
|
-
- Set status = "executing"
|
|
189
|
-
-
|
|
402
|
+
- Create fix tasks mapped to failing criteria
|
|
403
|
+
- Set status = "debugging" or "executing"
|
|
404
|
+
- Keep current story
|
|
190
405
|
|
|
191
406
|
</process>
|
|
192
407
|
|
package/bin/ctx.js
CHANGED
|
@@ -19,9 +19,9 @@ if (options.help) {
|
|
|
19
19
|
╚██████╗ ██║ ██╔╝ ██╗
|
|
20
20
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝\x1b[0m
|
|
21
21
|
|
|
22
|
-
\x1b[1mCTX 2.
|
|
23
|
-
|
|
24
|
-
8 commands.
|
|
22
|
+
\x1b[1mCTX 2.2 - Continuous Task eXecution\x1b[0m
|
|
23
|
+
PRD-driven workflow orchestration for Claude Code.
|
|
24
|
+
8 commands. Story-verified. Debug loop.
|
|
25
25
|
|
|
26
26
|
\x1b[1mUsage:\x1b[0m
|
|
27
27
|
npx ctx-cc [options]
|