ctx-cc 2.0.0 → 2.2.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 +110 -16
- package/agents/ctx-debugger.md +39 -12
- package/agents/ctx-planner.md +53 -26
- package/agents/ctx-researcher.md +36 -23
- package/agents/ctx-verifier.md +103 -45
- package/bin/ctx.js +3 -3
- package/commands/help.md +137 -101
- package/commands/init.md +185 -9
- package/commands/phase.md +149 -0
- package/commands/plan.md +125 -0
- package/commands/status.md +78 -0
- package/commands/verify.md +171 -0
- package/package.json +2 -2
- package/src/install.js +3 -3
- package/templates/PRD.json +77 -0
- package/templates/STATE.md +12 -2
- package/templates/ctx.gitignore +19 -0
- package/templates/env.template +61 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx:verify
|
|
3
|
+
description: Force verification of current story against PRD acceptance criteria
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Verify current story against PRD.json acceptance criteria. Runs three-level check + anti-pattern scan + browser verification. On success, marks story as `passes: true` in PRD.json.
|
|
8
|
+
</objective>
|
|
9
|
+
|
|
10
|
+
<usage>
|
|
11
|
+
```
|
|
12
|
+
/ctx verify # Verify current phase
|
|
13
|
+
/ctx verify --browser # Force browser verification even for non-UI
|
|
14
|
+
```
|
|
15
|
+
</usage>
|
|
16
|
+
|
|
17
|
+
<workflow>
|
|
18
|
+
## Step 1: Validate Project
|
|
19
|
+
If `.ctx/STATE.md` or `.ctx/PRD.json` doesn't exist:
|
|
20
|
+
- Error: "No project found. Run /ctx init first."
|
|
21
|
+
|
|
22
|
+
If no current story (all `passes: true`):
|
|
23
|
+
- Info: "All stories verified! PRD complete."
|
|
24
|
+
|
|
25
|
+
## Step 2: Load Context
|
|
26
|
+
Read:
|
|
27
|
+
- `.ctx/PRD.json` - current story and acceptance criteria
|
|
28
|
+
- `.ctx/STATE.md` - current state
|
|
29
|
+
- `.ctx/phases/{story_id}/PLAN.md` - task-to-criteria mapping
|
|
30
|
+
|
|
31
|
+
**Key data:**
|
|
32
|
+
- `story.acceptanceCriteria` → What to verify
|
|
33
|
+
- `plan.tasks[].criteria` → How tasks map to criteria
|
|
34
|
+
|
|
35
|
+
## Step 3: Three-Level Verification
|
|
36
|
+
Spawn **ctx-verifier** agent:
|
|
37
|
+
|
|
38
|
+
### Level 1: EXISTS
|
|
39
|
+
For each artifact in plan:
|
|
40
|
+
```bash
|
|
41
|
+
ls {file_path}
|
|
42
|
+
```
|
|
43
|
+
- Pass: File found
|
|
44
|
+
- Fail: File missing
|
|
45
|
+
|
|
46
|
+
### Level 2: SUBSTANTIVE
|
|
47
|
+
Check for stubs/placeholders:
|
|
48
|
+
```bash
|
|
49
|
+
grep -n "TODO" {file}
|
|
50
|
+
grep -n "not implemented" {file}
|
|
51
|
+
```
|
|
52
|
+
- Pass: Real, complete code
|
|
53
|
+
- Fail: Stub detected
|
|
54
|
+
|
|
55
|
+
### Level 3: WIRED
|
|
56
|
+
Trace imports from entry point:
|
|
57
|
+
```bash
|
|
58
|
+
grep -r "import.*{module}" --include="*.ts"
|
|
59
|
+
```
|
|
60
|
+
- Pass: Code is imported and used
|
|
61
|
+
- Fail: Orphan code (exists but unused)
|
|
62
|
+
|
|
63
|
+
## Step 4: Anti-Pattern Scan
|
|
64
|
+
Search for common issues:
|
|
65
|
+
| Pattern | Severity |
|
|
66
|
+
|---------|----------|
|
|
67
|
+
| `// TODO` | Warning |
|
|
68
|
+
| Empty catch blocks | Error |
|
|
69
|
+
| `console.log` (debug) | Warning |
|
|
70
|
+
| Placeholder returns | Error |
|
|
71
|
+
|
|
72
|
+
## Step 5: Browser Verification (if UI)
|
|
73
|
+
If phase involves UI or `--browser` flag:
|
|
74
|
+
|
|
75
|
+
1. Navigate to affected page
|
|
76
|
+
2. Take snapshot
|
|
77
|
+
3. Check expected elements
|
|
78
|
+
4. Take screenshot proof
|
|
79
|
+
5. Save to `.ctx/verify/phase-{id}.png`
|
|
80
|
+
|
|
81
|
+
## Step 6: Verify Acceptance Criteria
|
|
82
|
+
For each criterion in story.acceptanceCriteria:
|
|
83
|
+
- Check if criterion is satisfied
|
|
84
|
+
- Map to three-level results
|
|
85
|
+
- Document evidence
|
|
86
|
+
|
|
87
|
+
## Step 7: Generate Report
|
|
88
|
+
Write `.ctx/phases/{story_id}/VERIFY.md`:
|
|
89
|
+
```yaml
|
|
90
|
+
story: S001
|
|
91
|
+
title: "{{story_title}}"
|
|
92
|
+
result: PASS|FAIL
|
|
93
|
+
criteria:
|
|
94
|
+
- criterion: "{{criterion_1}}"
|
|
95
|
+
status: PASS|FAIL
|
|
96
|
+
evidence: "{{what proved it}}"
|
|
97
|
+
- criterion: "{{criterion_2}}"
|
|
98
|
+
status: PASS|FAIL
|
|
99
|
+
evidence: "{{what proved it}}"
|
|
100
|
+
timestamp: "{{ISO8601}}"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Step 8: Update PRD.json
|
|
104
|
+
If ALL criteria pass:
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"stories[current].passes": true,
|
|
108
|
+
"stories[current].verifiedAt": "{{timestamp}}",
|
|
109
|
+
"metadata.passedStories": "{{increment}}",
|
|
110
|
+
"metadata.currentStory": "{{next_unpassed_story_id or null}}"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If ANY criterion fails:
|
|
115
|
+
- Keep `passes: false`
|
|
116
|
+
- Add failure notes to `stories[current].notes`
|
|
117
|
+
|
|
118
|
+
## Step 9: Update STATE.md
|
|
119
|
+
Based on results:
|
|
120
|
+
- **PASS**:
|
|
121
|
+
- Set status to "initializing" for next story
|
|
122
|
+
- Update current story reference
|
|
123
|
+
- **FAIL**:
|
|
124
|
+
- Create fix tasks
|
|
125
|
+
- Set status = "debugging" or "executing"
|
|
126
|
+
</workflow>
|
|
127
|
+
|
|
128
|
+
<output_format>
|
|
129
|
+
```
|
|
130
|
+
[CTX Verify] Story: {story_id} - {title}
|
|
131
|
+
|
|
132
|
+
Acceptance Criteria:
|
|
133
|
+
✓ {criterion_1} - PASS
|
|
134
|
+
✓ {criterion_2} - PASS
|
|
135
|
+
✗ {criterion_3} - FAIL: {reason}
|
|
136
|
+
|
|
137
|
+
Three-Level Check:
|
|
138
|
+
✓ Exists: {pass}/{total}
|
|
139
|
+
✓ Substantive: {pass}/{total}
|
|
140
|
+
✓ Wired: {pass}/{total}
|
|
141
|
+
|
|
142
|
+
Anti-Pattern Scan:
|
|
143
|
+
Warnings: {count}
|
|
144
|
+
Errors: {count}
|
|
145
|
+
|
|
146
|
+
{If browser:}
|
|
147
|
+
Browser Verification:
|
|
148
|
+
URL: {url}
|
|
149
|
+
Status: PASS/FAIL
|
|
150
|
+
Screenshot: .ctx/verify/story-{id}.png
|
|
151
|
+
|
|
152
|
+
Overall: {PASS / FAIL}
|
|
153
|
+
|
|
154
|
+
{If FAIL:}
|
|
155
|
+
Fixes Required:
|
|
156
|
+
1. {fix_1} → [criterion 3]
|
|
157
|
+
2. {fix_2}
|
|
158
|
+
|
|
159
|
+
{If PASS:}
|
|
160
|
+
✓ Story {story_id} verified!
|
|
161
|
+
PRD Progress: {passed}/{total} stories ({percent}%)
|
|
162
|
+
|
|
163
|
+
Next Story: {next_story_id} - {next_title}
|
|
164
|
+
Run /ctx to start planning.
|
|
165
|
+
```
|
|
166
|
+
</output_format>
|
|
167
|
+
|
|
168
|
+
<key_principle>
|
|
169
|
+
Verification is STRICT. Better to catch issues now than in production.
|
|
170
|
+
A failing verification saves debugging time later.
|
|
171
|
+
</key_principle>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctx-cc",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "CTX 2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "CTX 2.2 (Continuous Task eXecution) - PRD-driven workflow orchestration for Claude Code. Story-verified, debug loop until 100% fixed.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
7
7
|
"claude-code",
|
package/src/install.js
CHANGED
|
@@ -28,9 +28,9 @@ function printBanner() {
|
|
|
28
28
|
╚██████╗ ██║ ██╔╝ ██╗
|
|
29
29
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝
|
|
30
30
|
`));
|
|
31
|
-
console.log(` ${bold('CTX 2.
|
|
32
|
-
console.log('
|
|
33
|
-
console.log('
|
|
31
|
+
console.log(` ${bold('CTX 2.2')} ${dim(`v${VERSION}`)}`);
|
|
32
|
+
console.log(' PRD-driven workflow orchestration for Claude Code.');
|
|
33
|
+
console.log(' 8 commands. Story-verified. Debug loop.\n');
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function copyDir(src, dest) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ctx.dev/schemas/prd.json",
|
|
3
|
+
"version": "2.0",
|
|
4
|
+
"project": {
|
|
5
|
+
"name": "{{project_name}}",
|
|
6
|
+
"description": "{{project_description}}",
|
|
7
|
+
"stack": "{{tech_stack}}",
|
|
8
|
+
"created": "{{timestamp}}"
|
|
9
|
+
},
|
|
10
|
+
"context": {
|
|
11
|
+
"problem": "{{what_problem_are_we_solving}}",
|
|
12
|
+
"targetUser": "{{who_is_this_for}}",
|
|
13
|
+
"successLooksLike": "{{how_will_we_know_its_done}}",
|
|
14
|
+
"outOfScope": [
|
|
15
|
+
"{{what_we_are_NOT_building}}"
|
|
16
|
+
],
|
|
17
|
+
"assumptions": [
|
|
18
|
+
"{{assumption_1}}",
|
|
19
|
+
"{{assumption_2}}"
|
|
20
|
+
],
|
|
21
|
+
"risks": [
|
|
22
|
+
"{{risk_1}}"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"constitution": {
|
|
26
|
+
"principles": [
|
|
27
|
+
"Code quality over speed",
|
|
28
|
+
"Test before ship",
|
|
29
|
+
"No secrets in code"
|
|
30
|
+
],
|
|
31
|
+
"always": [
|
|
32
|
+
"Run tests before committing",
|
|
33
|
+
"Use TypeScript strict mode",
|
|
34
|
+
"Handle errors explicitly"
|
|
35
|
+
],
|
|
36
|
+
"never": [
|
|
37
|
+
"Commit secrets or credentials",
|
|
38
|
+
"Skip error handling",
|
|
39
|
+
"Leave TODO comments in production"
|
|
40
|
+
],
|
|
41
|
+
"askFirst": [
|
|
42
|
+
"Database schema changes",
|
|
43
|
+
"New dependencies",
|
|
44
|
+
"API contract changes"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"testing": {
|
|
48
|
+
"requiresBrowser": false,
|
|
49
|
+
"requiresLogin": false,
|
|
50
|
+
"requiresAdmin": false,
|
|
51
|
+
"requiresAPI": false,
|
|
52
|
+
"notes": "{{testing_notes}}"
|
|
53
|
+
},
|
|
54
|
+
"stories": [
|
|
55
|
+
{
|
|
56
|
+
"id": "S001",
|
|
57
|
+
"title": "{{story_title}}",
|
|
58
|
+
"description": "{{story_description}}",
|
|
59
|
+
"acceptanceCriteria": [
|
|
60
|
+
"{{criterion_1}}",
|
|
61
|
+
"{{criterion_2}}",
|
|
62
|
+
"{{criterion_3}}"
|
|
63
|
+
],
|
|
64
|
+
"priority": 1,
|
|
65
|
+
"phase": 1,
|
|
66
|
+
"passes": false,
|
|
67
|
+
"verifiedAt": null,
|
|
68
|
+
"notes": ""
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"metadata": {
|
|
72
|
+
"totalStories": 0,
|
|
73
|
+
"passedStories": 0,
|
|
74
|
+
"currentStory": null,
|
|
75
|
+
"lastUpdated": "{{timestamp}}"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/templates/STATE.md
CHANGED
|
@@ -8,11 +8,21 @@
|
|
|
8
8
|
- **Stack**: {{tech_stack}}
|
|
9
9
|
- **Status**: {{status}} <!-- initializing | planning | executing | debugging | verifying | paused -->
|
|
10
10
|
|
|
11
|
+
## PRD Progress
|
|
12
|
+
- **Stories**: {{passed_stories}}/{{total_stories}} ({{percent}}%)
|
|
13
|
+
- **Current Story**: {{story_id}} - {{story_title}}
|
|
14
|
+
|
|
11
15
|
## Current Phase
|
|
12
|
-
- **ID**: {{phase_id}}
|
|
13
|
-
- **Goal**: {{
|
|
16
|
+
- **ID**: {{phase_id}} (maps to story {{story_id}})
|
|
17
|
+
- **Goal**: {{story_title}}
|
|
14
18
|
- **Progress**: {{completed_tasks}}/{{total_tasks}} tasks
|
|
15
19
|
|
|
20
|
+
## Acceptance Criteria (from PRD)
|
|
21
|
+
<!-- Current story's acceptance criteria -->
|
|
22
|
+
- [ ] {{criterion_1}}
|
|
23
|
+
- [ ] {{criterion_2}}
|
|
24
|
+
- [ ] {{criterion_3}}
|
|
25
|
+
|
|
16
26
|
## Active Task
|
|
17
27
|
- **Task**: {{current_task}}
|
|
18
28
|
- **Status**: {{task_status}} <!-- pending | in_progress | blocked | debugging | done -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CTX Secrets - NEVER COMMIT
|
|
2
|
+
.env
|
|
3
|
+
*.env
|
|
4
|
+
.env.*
|
|
5
|
+
!.env.example
|
|
6
|
+
|
|
7
|
+
# Credential files
|
|
8
|
+
credentials.json
|
|
9
|
+
secrets.json
|
|
10
|
+
*.secrets
|
|
11
|
+
*.pem
|
|
12
|
+
*.key
|
|
13
|
+
|
|
14
|
+
# Debug screenshots may contain sensitive data
|
|
15
|
+
debug/*.png
|
|
16
|
+
debug/*.jpg
|
|
17
|
+
|
|
18
|
+
# Checkpoint data may contain state
|
|
19
|
+
checkpoints/*.json
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# CTX Test Credentials
|
|
2
|
+
# Generated by /ctx init
|
|
3
|
+
# WARNING: DO NOT COMMIT THIS FILE
|
|
4
|
+
|
|
5
|
+
# ===========================================
|
|
6
|
+
# APP CONFIGURATION
|
|
7
|
+
# ===========================================
|
|
8
|
+
|
|
9
|
+
# Local development URL
|
|
10
|
+
APP_URL=http://localhost:3000
|
|
11
|
+
|
|
12
|
+
# Staging/preview URL (optional)
|
|
13
|
+
STAGING_URL=
|
|
14
|
+
|
|
15
|
+
# Production URL (optional - for smoke tests)
|
|
16
|
+
PRODUCTION_URL=
|
|
17
|
+
|
|
18
|
+
# ===========================================
|
|
19
|
+
# TEST USER CREDENTIALS
|
|
20
|
+
# ===========================================
|
|
21
|
+
|
|
22
|
+
# Primary test user (for normal user flows)
|
|
23
|
+
TEST_USER_EMAIL=
|
|
24
|
+
TEST_USER_PASSWORD=
|
|
25
|
+
|
|
26
|
+
# Admin user (for admin features)
|
|
27
|
+
ADMIN_EMAIL=
|
|
28
|
+
ADMIN_PASSWORD=
|
|
29
|
+
|
|
30
|
+
# Secondary test user (for multi-user tests)
|
|
31
|
+
TEST_USER_2_EMAIL=
|
|
32
|
+
TEST_USER_2_PASSWORD=
|
|
33
|
+
|
|
34
|
+
# ===========================================
|
|
35
|
+
# API KEYS & TOKENS
|
|
36
|
+
# ===========================================
|
|
37
|
+
|
|
38
|
+
# Primary API key (if applicable)
|
|
39
|
+
API_KEY=
|
|
40
|
+
|
|
41
|
+
# OAuth tokens (if applicable)
|
|
42
|
+
OAUTH_CLIENT_ID=
|
|
43
|
+
OAUTH_CLIENT_SECRET=
|
|
44
|
+
|
|
45
|
+
# Third-party service keys
|
|
46
|
+
# STRIPE_TEST_KEY=
|
|
47
|
+
# SENDGRID_API_KEY=
|
|
48
|
+
# AWS_ACCESS_KEY_ID=
|
|
49
|
+
# AWS_SECRET_ACCESS_KEY=
|
|
50
|
+
|
|
51
|
+
# ===========================================
|
|
52
|
+
# DATABASE (if direct DB testing needed)
|
|
53
|
+
# ===========================================
|
|
54
|
+
|
|
55
|
+
DATABASE_URL=
|
|
56
|
+
|
|
57
|
+
# ===========================================
|
|
58
|
+
# CUSTOM SECRETS
|
|
59
|
+
# Add project-specific secrets below
|
|
60
|
+
# ===========================================
|
|
61
|
+
|