ctx-cc 3.4.0 → 3.4.2

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.
@@ -1,169 +1,68 @@
1
1
  ---
2
2
  name: ctx:map-codebase
3
- description: Comprehensive codebase analysis using 4 parallel mapper agents. Run before starting a new project on existing code.
3
+ description: Analyze codebase with parallel mapper agents to produce .ctx/codebase/ documents
4
+ argument-hint: "[--refresh]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Write
11
+ - Task
12
+ - TaskOutput
4
13
  ---
5
14
 
6
15
  <objective>
7
- Analyze an existing codebase comprehensively using 4 specialized parallel agents.
16
+ Analyze existing codebase using parallel ctx-*-mapper agents to produce structured codebase documents.
8
17
 
9
- This command is essential for "brownfield" projects where CTX is being added to existing code.
10
- It produces documentation that informs all future planning and execution.
11
- </objective>
12
-
13
- <usage>
14
- ```
15
- /ctx map-codebase # Full analysis with all 4 mappers
16
- /ctx map-codebase --tech # Only tech stack analysis
17
- /ctx map-codebase --arch # Only architecture analysis
18
- /ctx map-codebase --quality # Only quality analysis
19
- /ctx map-codebase --concerns # Only concerns analysis
20
- /ctx map-codebase --refresh # Force re-analysis (ignore cache)
21
- ```
22
- </usage>
23
-
24
- <parallel_agents>
25
-
26
- ## The 4 Mapper Agents
27
-
28
- ```
29
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
30
- │ TECH │ │ ARCH │ │ QUALITY │ │ CONCERNS │
31
- │ MAPPER │ │ MAPPER │ │ MAPPER │ │ MAPPER │
32
- │ │ │ │ │ │ │ │
33
- │ Stack │ │ Patterns │ │ Test cov │ │ Security │
34
- │ Frameworks │ │ Data flow │ │ Lint status │ │ Tech debt │
35
- │ Dependencies│ │ Modules │ │ Type safety │ │ Performance │
36
- │ Versions │ │ Entry pts │ │ Code smells │ │ Risks │
37
- └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
38
- │ │ │ │
39
- ▼ ▼ ▼ ▼
40
- TECH.md ARCH.md QUALITY.md CONCERNS.md
41
- │ │ │ │
42
- └────────────────┴────────────────┴────────────────┘
43
-
44
-
45
- SUMMARY.md
46
- ```
47
-
48
- All 4 agents run in PARALLEL for speed, then results are synthesized.
49
-
50
- </parallel_agents>
51
-
52
- <workflow>
53
-
54
- ## Step 1: Check Prerequisites
55
-
56
- - Ensure we're in a git repository (or at least a code directory)
57
- - Check for existing analysis in `.ctx/codebase/`
58
- - If exists and not `--refresh`: Show cached results
59
-
60
- ## Step 2: Spawn Parallel Mappers
61
-
62
- Spawn all 4 agents simultaneously using Task tool:
63
-
64
- ```
65
- Task(subagent_type="ctx-tech-mapper", prompt="Analyze tech stack...", run_in_background=true)
66
- Task(subagent_type="ctx-arch-mapper", prompt="Analyze architecture...", run_in_background=true)
67
- Task(subagent_type="ctx-quality-mapper", prompt="Analyze quality...", run_in_background=true)
68
- Task(subagent_type="ctx-concerns-mapper", prompt="Analyze concerns...", run_in_background=true)
69
- ```
70
-
71
- ## Step 3: Wait for Completion
72
-
73
- Use TaskOutput to wait for all 4 mappers:
74
- - Each mapper writes its output to `.ctx/codebase/{TYPE}.md`
75
- - Collect results as they complete
76
- - Show progress to user
77
-
78
- ## Step 4: Synthesize Results
79
-
80
- After all mappers complete, create SUMMARY.md:
81
- - Executive summary of findings
82
- - Key metrics
83
- - Recommendations for CTX workflow
84
- - Suggested first phase
18
+ Each mapper agent explores a focus area and **writes documents directly** to `.ctx/codebase/`. The orchestrator only receives confirmations, keeping context usage minimal.
85
19
 
86
- ## Step 5: Update State
87
-
88
- - Create/update `.ctx/codebase/` directory
89
- - Store analysis timestamp
90
- - Link from STATE.md
91
-
92
- </workflow>
93
-
94
- <output_structure>
95
-
96
- ```
97
- .ctx/codebase/
98
- ├── TECH.md # Tech stack analysis
99
- ├── ARCH.md # Architecture analysis
100
- ├── QUALITY.md # Quality metrics
101
- ├── CONCERNS.md # Security, performance, tech debt
102
- ├── SUMMARY.md # Executive summary
103
- └── metadata.json # Analysis timestamp, versions
104
- ```
105
-
106
- </output_structure>
107
-
108
- <output_format>
109
- ```
110
- [CTX] Codebase Analysis
111
-
112
- Spawning 4 parallel mappers...
113
- [■■■■■■■■■■] TECH ✓ 12s
114
- [■■■■■■■■■■] ARCH ✓ 15s
115
- [■■■■■■■■■■] QUALITY ✓ 18s
116
- [■■■■■■■■■■] CONCERNS ✓ 14s
117
-
118
- Synthesizing results...
119
-
120
- ═══════════════════════════════════════════════════════
121
- CODEBASE SUMMARY
122
- ═══════════════════════════════════════════════════════
123
-
124
- Tech Stack:
125
- Language: TypeScript (92%), JavaScript (8%)
126
- Framework: Next.js 14, React 18
127
- Database: PostgreSQL + Prisma
128
- Testing: Jest, Playwright
129
-
130
- Architecture:
131
- Pattern: Monolith with modular structure
132
- Entry: src/app/page.tsx, src/server/index.ts
133
- Modules: 12 feature modules
134
- API Style: REST + Server Actions
135
-
136
- Quality:
137
- Test Coverage: 67%
138
- Type Safety: Strong (strict mode)
139
- Lint Status: 12 warnings, 0 errors
140
- Code Smells: 3 files need attention
141
-
142
- Concerns:
143
- Security: 2 medium issues (see CONCERNS.md)
144
- Performance: N+1 query in users module
145
- Tech Debt: Auth module needs refactor
20
+ Output: .ctx/codebase/ folder with 5 structured documents about the codebase state.
21
+ </objective>
146
22
 
147
- Recommendations:
148
- 1. Address security issues before new features
149
- 2. Improve test coverage to 80%
150
- 3. Refactor auth module
23
+ <execution_context>
24
+ @~/.claude/ctx/workflows/map-codebase.md
25
+ </execution_context>
151
26
 
152
- Saved to: .ctx/codebase/
27
+ <context>
28
+ Flags: $ARGUMENTS (--refresh to force re-analysis)
153
29
 
154
- Next: Run /ctx init to start project with this context
155
- ```
156
- </output_format>
30
+ **This command can run:**
31
+ - Before /ctx:init (brownfield codebases) - creates codebase map first
32
+ - After /ctx:init (greenfield codebases) - updates codebase map as code evolves
33
+ - Anytime to refresh codebase understanding
34
+ </context>
157
35
 
158
36
  <when_to_use>
159
- **Always run before:**
160
- - Adding CTX to an existing codebase
161
- - Starting major refactoring work
162
- - Onboarding to unfamiliar codebase
163
- - Security or quality audit
164
-
165
- **Can skip when:**
166
- - Greenfield project (no existing code)
167
- - Small utility or script
168
- - Analysis already done and code unchanged
37
+ **Use map-codebase for:**
38
+ - Brownfield projects before initialization (understand existing code first)
39
+ - Refreshing codebase map after significant changes
40
+ - Onboarding to an unfamiliar codebase
41
+ - Before major refactoring (understand current state)
42
+
43
+ **Skip map-codebase for:**
44
+ - Greenfield projects with no code yet (nothing to map)
45
+ - Trivial codebases (<5 files)
169
46
  </when_to_use>
47
+
48
+ <process>
49
+ 1. Check if .ctx/codebase/ already exists (offer to refresh or skip)
50
+ 2. Create .ctx/codebase/ directory structure
51
+ 3. Spawn 4 parallel mapper agents:
52
+ - ctx-tech-mapper → writes TECH.md
53
+ - ctx-arch-mapper → writes ARCH.md
54
+ - ctx-quality-mapper → writes QUALITY.md
55
+ - ctx-concerns-mapper → writes CONCERNS.md
56
+ 4. Wait for agents to complete, collect confirmations (NOT document contents)
57
+ 5. Verify all 4 documents exist with line counts
58
+ 6. Create SUMMARY.md with synthesis
59
+ 7. Offer next steps (typically: /ctx:init)
60
+ </process>
61
+
62
+ <success_criteria>
63
+ - [ ] .ctx/codebase/ directory created
64
+ - [ ] All 4 codebase documents written by mapper agents
65
+ - [ ] SUMMARY.md created with key findings
66
+ - [ ] Parallel agents completed without errors
67
+ - [ ] User knows next steps
68
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "CTX 3.3 (Continuous Task eXecution) - AI that learns your preferences. Learning system, predictive planning, self-healing deployments (Sentry/LogRocket), voice control for hands-free development.",
5
5
  "keywords": [
6
6
  "claude",
@@ -30,7 +30,8 @@
30
30
  "commands/",
31
31
  "agents/",
32
32
  "references/",
33
- "templates/"
33
+ "templates/",
34
+ "workflows/"
34
35
  ],
35
36
  "engines": {
36
37
  "node": ">=18.0.0"
@@ -0,0 +1,256 @@
1
+ <ui_patterns>
2
+
3
+ Visual patterns for user-facing CTX output. All workflows @-reference this file.
4
+
5
+ ## Stage Banners
6
+
7
+ Use for major workflow transitions. 55-character width.
8
+
9
+ ```
10
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
11
+ CTX ► {STAGE NAME}
12
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
+ ```
14
+
15
+ **Stage names (uppercase):**
16
+ - `ANALYZING CODEBASE`
17
+ - `MAPPING COMPLETE`
18
+ - `INITIALIZING PROJECT`
19
+ - `RESEARCHING`
20
+ - `PLANNING PHASE {N}`
21
+ - `EXECUTING`
22
+ - `VERIFYING`
23
+ - `PHASE {N} COMPLETE ✓`
24
+ - `DEBUG MODE`
25
+ - `QA TESTING`
26
+ - `SHIP READY 🚀`
27
+
28
+ ---
29
+
30
+ ## Checkpoint Boxes
31
+
32
+ User action required. 55-character width.
33
+
34
+ ```
35
+ ╔═══════════════════════════════════════════════════════╗
36
+ ║ CHECKPOINT: {Type} ║
37
+ ╚═══════════════════════════════════════════════════════╝
38
+
39
+ {Content}
40
+
41
+ ───────────────────────────────────────────────────────
42
+ → {ACTION PROMPT}
43
+ ───────────────────────────────────────────────────────
44
+ ```
45
+
46
+ **Types:**
47
+ - `CHECKPOINT: Approval Required` → `→ Type "approved" or describe issues`
48
+ - `CHECKPOINT: Decision Required` → `→ Select an option`
49
+ - `CHECKPOINT: Action Required` → `→ Type "done" when complete`
50
+
51
+ ---
52
+
53
+ ## Status Symbols
54
+
55
+ ```
56
+ ✓ Complete / Passed / Verified
57
+ ✗ Failed / Missing / Blocked
58
+ ◆ In Progress / Active
59
+ ○ Pending / Queued
60
+ ⚡ Auto-completed
61
+ ⚠ Warning / Attention needed
62
+ 🚀 Ship ready (only in banner)
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Progress Bars
68
+
69
+ **Percentage-based:**
70
+ ```
71
+ Progress: ████████░░ 80%
72
+ ```
73
+
74
+ **For agent spawning:**
75
+ ```
76
+ Mapping: [████████████████████] TECH ✓ 12s
77
+ [████████████████████] ARCH ✓ 15s
78
+ [████████████████░░░░] QUALITY ◆ ...
79
+ [░░░░░░░░░░░░░░░░░░░░] CONCERNS ○
80
+ ```
81
+
82
+ **Task count:**
83
+ ```
84
+ Tasks: 2/4 complete
85
+ Phases: 1/5 complete
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Spawning Indicators
91
+
92
+ When spawning agents, show activity:
93
+
94
+ ```
95
+ ◆ Spawning 4 mappers in parallel...
96
+ → ctx-tech-mapper
97
+ → ctx-arch-mapper
98
+ → ctx-quality-mapper
99
+ → ctx-concerns-mapper
100
+
101
+ ✓ ctx-tech-mapper complete: TECH.md (156 lines)
102
+ ✓ ctx-arch-mapper complete: ARCH.md (203 lines)
103
+ ✓ ctx-quality-mapper complete: QUALITY.md (178 lines)
104
+ ✓ ctx-concerns-mapper complete: CONCERNS.md (145 lines)
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Summary Boxes
110
+
111
+ For displaying analysis results:
112
+
113
+ ```
114
+ ┌─────────────────────────────────────────────────────┐
115
+ │ CODEBASE SUMMARY │
116
+ ├─────────────────────────────────────────────────────┤
117
+ │ Tech: TypeScript, Next.js 14, Prisma │
118
+ │ Architecture: Modular monolith │
119
+ │ Quality: 67% coverage, 12 lint warnings │
120
+ │ Concerns: 3 security, 5 tech debt items │
121
+ └─────────────────────────────────────────────────────┘
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Next Up Block
127
+
128
+ Always at end of major completions.
129
+
130
+ ```
131
+ ───────────────────────────────────────────────────────
132
+
133
+ ## ▶ Next Up
134
+
135
+ **{Action}** — {one-line description}
136
+
137
+ `{copy-paste command}`
138
+
139
+ <sub>`/clear` first → fresh context window</sub>
140
+
141
+ ───────────────────────────────────────────────────────
142
+
143
+ **Also available:**
144
+ - `/ctx:alternative-1` — description
145
+ - `/ctx:alternative-2` — description
146
+
147
+ ───────────────────────────────────────────────────────
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Error Box
153
+
154
+ ```
155
+ ╔═══════════════════════════════════════════════════════╗
156
+ ║ ERROR ║
157
+ ╚═══════════════════════════════════════════════════════╝
158
+
159
+ {Error description}
160
+
161
+ **To fix:** {Resolution steps}
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Warning Box
167
+
168
+ ```
169
+ ┌─────────────────────────────────────────────────────┐
170
+ │ ⚠ WARNING │
171
+ ├─────────────────────────────────────────────────────┤
172
+ │ {Warning message} │
173
+ └─────────────────────────────────────────────────────┘
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Tables
179
+
180
+ For structured data display:
181
+
182
+ ```
183
+ | Phase | Status | Tasks | Progress |
184
+ |-------|--------|-------|----------|
185
+ | 1 | ✓ | 5/5 | 100% |
186
+ | 2 | ◆ | 2/4 | 50% |
187
+ | 3 | ○ | 0/3 | 0% |
188
+ ```
189
+
190
+ For concerns/issues:
191
+
192
+ ```
193
+ | Severity | Count | Category |
194
+ |----------|-------|-----------------|
195
+ | Critical | 0 | — |
196
+ | High | 2 | Security |
197
+ | Medium | 5 | Tech Debt |
198
+ | Low | 8 | Code Quality |
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Welcome Banner
204
+
205
+ First-time users:
206
+
207
+ ```
208
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
209
+ CTX ► WELCOME
210
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
211
+
212
+ I understood: "{user_request}"
213
+
214
+ {Brief explanation of what will happen next}
215
+
216
+ ───────────────────────────────────────────────────────
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Completion Banner
222
+
223
+ End of workflow:
224
+
225
+ ```
226
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
227
+ CTX ► {STAGE} COMPLETE ✓
228
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
229
+
230
+ {Summary of what was accomplished}
231
+
232
+ Files: {list of created/modified files}
233
+
234
+ ───────────────────────────────────────────────────────
235
+
236
+ ## ▶ Next Up
237
+
238
+ {Next action recommendation}
239
+
240
+ ───────────────────────────────────────────────────────
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Anti-Patterns (AVOID)
246
+
247
+ - Varying box/banner widths (use 55 chars consistently)
248
+ - Mixing banner styles (`===`, `---`, `***`)
249
+ - Skipping `CTX ►` prefix in banners
250
+ - Random emoji (only use defined symbols above)
251
+ - Missing Next Up block after completions
252
+ - Plain text output without structure
253
+ - Inconsistent indentation
254
+ - Missing progress indicators during long operations
255
+
256
+ </ui_patterns>
package/src/install.js CHANGED
@@ -162,6 +162,14 @@ export async function install(options) {
162
162
  console.log(green(` ✓`) + ` Installed templates (${count} files)`);
163
163
  }
164
164
 
165
+ // Copy workflows
166
+ const srcWorkflows = path.join(packageRoot, 'workflows');
167
+ const destWorkflows = path.join(ctxDir, 'workflows');
168
+ if (fs.existsSync(srcWorkflows)) {
169
+ const count = copyDir(srcWorkflows, destWorkflows);
170
+ console.log(green(` ✓`) + ` Installed workflows (${count} files)`);
171
+ }
172
+
165
173
  // Write VERSION file
166
174
  fs.writeFileSync(path.join(ctxDir, 'VERSION'), VERSION);
167
175
  console.log(green(` ✓`) + ` Wrote VERSION (${VERSION})`);