create-claude-context 1.0.0 → 1.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/LICENSE +21 -21
- package/README.md +146 -146
- package/bin/create-claude-context.js +61 -61
- package/lib/detector.js +373 -373
- package/lib/index.js +170 -170
- package/lib/installer.js +371 -362
- package/lib/placeholder.js +208 -208
- package/lib/prompts.js +287 -287
- package/lib/spinner.js +60 -60
- package/lib/validate.js +147 -147
- package/package.json +59 -59
- package/templates/CLAUDE.md.template +235 -235
- package/templates/base/README.md +257 -257
- package/templates/base/RPI_WORKFLOW_PLAN.md +320 -320
- package/templates/base/agents/api-developer.md +76 -76
- package/templates/base/agents/context-engineer.md +525 -525
- package/templates/base/agents/core-architect.md +76 -76
- package/templates/base/agents/database-ops.md +76 -76
- package/templates/base/agents/deployment-ops.md +76 -76
- package/templates/base/agents/integration-hub.md +76 -76
- package/templates/base/analytics/README.md +114 -114
- package/templates/base/automation/config.json +58 -0
- package/templates/base/automation/generators/code-mapper.js +308 -0
- package/templates/base/automation/generators/index-builder.js +321 -0
- package/templates/base/automation/hooks/post-commit.sh +83 -0
- package/templates/base/automation/hooks/pre-commit.sh +103 -0
- package/templates/base/ci-templates/README.md +108 -108
- package/templates/base/ci-templates/github-actions/context-check.yml +144 -144
- package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -105
- package/templates/base/commands/analytics.md +238 -238
- package/templates/base/commands/auto-sync.md +172 -0
- package/templates/base/commands/collab.md +194 -194
- package/templates/base/commands/help.md +450 -450
- package/templates/base/commands/rpi-implement.md +115 -115
- package/templates/base/commands/rpi-plan.md +93 -93
- package/templates/base/commands/rpi-research.md +88 -88
- package/templates/base/commands/session-resume.md +144 -0
- package/templates/base/commands/session-save.md +112 -0
- package/templates/base/commands/validate-all.md +77 -77
- package/templates/base/commands/verify-docs-current.md +86 -86
- package/templates/base/config/base.json +57 -57
- package/templates/base/config/environments/development.json +13 -13
- package/templates/base/config/environments/production.json +17 -17
- package/templates/base/config/environments/staging.json +13 -13
- package/templates/base/config/local.json.example +21 -21
- package/templates/base/context/.meta/generated-at.json +18 -0
- package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -156
- package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -94
- package/templates/base/context/FILE_OWNERSHIP.md +57 -0
- package/templates/base/context/INTEGRATION_POINTS.md +92 -0
- package/templates/base/context/KNOWN_GOTCHAS.md +195 -195
- package/templates/base/context/TESTING_MAP.md +95 -0
- package/templates/base/context/WORKFLOW_INDEX.md +129 -129
- package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -294
- package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -255
- package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -44
- package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -38
- package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -39
- package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -39
- package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -38
- package/templates/base/knowledge/README.md +98 -98
- package/templates/base/knowledge/sessions/README.md +88 -88
- package/templates/base/knowledge/sessions/TEMPLATE.md +150 -150
- package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -144
- package/templates/base/knowledge/shared/decisions/README.md +49 -49
- package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -123
- package/templates/base/knowledge/shared/patterns/README.md +62 -62
- package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -120
- package/templates/base/plans/PLAN_TEMPLATE.md +250 -250
- package/templates/base/research/RESEARCH_TEMPLATE.md +153 -153
- package/templates/base/schemas/agent.schema.json +141 -141
- package/templates/base/schemas/anchors.schema.json +54 -0
- package/templates/base/schemas/automation.schema.json +93 -0
- package/templates/base/schemas/command.schema.json +134 -134
- package/templates/base/schemas/hashes.schema.json +40 -0
- package/templates/base/schemas/manifest.schema.json +117 -117
- package/templates/base/schemas/plan.schema.json +136 -136
- package/templates/base/schemas/research.schema.json +115 -115
- package/templates/base/schemas/roles.schema.json +34 -0
- package/templates/base/schemas/session.schema.json +77 -0
- package/templates/base/schemas/settings.schema.json +244 -244
- package/templates/base/schemas/staleness.schema.json +53 -0
- package/templates/base/schemas/team-config.schema.json +42 -0
- package/templates/base/schemas/workflow.schema.json +126 -126
- package/templates/base/session/checkpoints/.gitkeep +2 -0
- package/templates/base/session/current/state.json +20 -0
- package/templates/base/session/history/.gitkeep +2 -0
- package/templates/base/settings.json +79 -57
- package/templates/base/standards/COMPATIBILITY.md +219 -219
- package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -280
- package/templates/base/standards/QUALITY_CHECKLIST.md +211 -211
- package/templates/base/standards/README.md +66 -66
- package/templates/base/sync/anchors.json +6 -0
- package/templates/base/sync/hashes.json +6 -0
- package/templates/base/sync/staleness.json +10 -0
- package/templates/base/team/README.md +168 -168
- package/templates/base/team/config.json +79 -79
- package/templates/base/team/roles.json +145 -145
- package/templates/base/tools/bin/claude-context.js +151 -151
- package/templates/base/tools/lib/anchor-resolver.js +276 -0
- package/templates/base/tools/lib/config-loader.js +363 -363
- package/templates/base/tools/lib/detector.js +350 -350
- package/templates/base/tools/lib/diagnose.js +206 -206
- package/templates/base/tools/lib/drift-detector.js +373 -0
- package/templates/base/tools/lib/errors.js +199 -199
- package/templates/base/tools/lib/index.js +36 -24
- package/templates/base/tools/lib/init.js +192 -192
- package/templates/base/tools/lib/logger.js +230 -230
- package/templates/base/tools/lib/placeholder.js +201 -201
- package/templates/base/tools/lib/session-manager.js +354 -0
- package/templates/base/tools/lib/validate.js +521 -521
- package/templates/base/tools/package.json +49 -49
package/lib/installer.js
CHANGED
|
@@ -1,362 +1,371 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Context Engineering - File Installer
|
|
3
|
-
*
|
|
4
|
-
* Handles copying template files and creating directory structure.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Directory structure for .claude/
|
|
12
|
-
*/
|
|
13
|
-
const DIRECTORY_STRUCTURE = [
|
|
14
|
-
'agents',
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'indexes
|
|
25
|
-
'indexes/
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'knowledge
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (!
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
${techStack.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
###
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Claude Context Engineering - File Installer
|
|
3
|
+
*
|
|
4
|
+
* Handles copying template files and creating directory structure.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Directory structure for .claude/
|
|
12
|
+
*/
|
|
13
|
+
const DIRECTORY_STRUCTURE = [
|
|
14
|
+
'agents',
|
|
15
|
+
'automation',
|
|
16
|
+
'automation/generators',
|
|
17
|
+
'automation/hooks',
|
|
18
|
+
'commands',
|
|
19
|
+
'config',
|
|
20
|
+
'config/environments',
|
|
21
|
+
'context',
|
|
22
|
+
'context/workflows',
|
|
23
|
+
'context/.meta',
|
|
24
|
+
'indexes',
|
|
25
|
+
'indexes/agents',
|
|
26
|
+
'indexes/code',
|
|
27
|
+
'indexes/routing',
|
|
28
|
+
'indexes/search',
|
|
29
|
+
'indexes/workflows',
|
|
30
|
+
'knowledge',
|
|
31
|
+
'knowledge/sessions',
|
|
32
|
+
'knowledge/shared',
|
|
33
|
+
'knowledge/shared/decisions',
|
|
34
|
+
'knowledge/shared/patterns',
|
|
35
|
+
'plans',
|
|
36
|
+
'plans/active',
|
|
37
|
+
'plans/completed',
|
|
38
|
+
'research',
|
|
39
|
+
'research/active',
|
|
40
|
+
'research/completed',
|
|
41
|
+
'schemas',
|
|
42
|
+
'session',
|
|
43
|
+
'session/current',
|
|
44
|
+
'session/history',
|
|
45
|
+
'session/checkpoints',
|
|
46
|
+
'standards',
|
|
47
|
+
'sync',
|
|
48
|
+
'team',
|
|
49
|
+
'ci-templates',
|
|
50
|
+
'ci-templates/github-actions',
|
|
51
|
+
'tools',
|
|
52
|
+
'tools/bin',
|
|
53
|
+
'tools/lib',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Create the .claude directory structure
|
|
58
|
+
*/
|
|
59
|
+
async function createDirectoryStructure(targetDir, config = {}) {
|
|
60
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
61
|
+
|
|
62
|
+
// Create main .claude directory
|
|
63
|
+
if (!fs.existsSync(claudeDir)) {
|
|
64
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let dirsCreated = 0;
|
|
68
|
+
|
|
69
|
+
// Filter directories based on features
|
|
70
|
+
let dirsToCreate = [...DIRECTORY_STRUCTURE];
|
|
71
|
+
|
|
72
|
+
if (!config.features?.ci) {
|
|
73
|
+
dirsToCreate = dirsToCreate.filter(d => !d.startsWith('ci-templates'));
|
|
74
|
+
}
|
|
75
|
+
if (!config.features?.team) {
|
|
76
|
+
dirsToCreate = dirsToCreate.filter(d => !d.startsWith('team') && !d.includes('knowledge'));
|
|
77
|
+
}
|
|
78
|
+
if (!config.features?.analytics) {
|
|
79
|
+
dirsToCreate = dirsToCreate.filter(d => !d.startsWith('analytics'));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Create each directory
|
|
83
|
+
for (const dir of dirsToCreate) {
|
|
84
|
+
const fullPath = path.join(claudeDir, dir);
|
|
85
|
+
if (!fs.existsSync(fullPath)) {
|
|
86
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
87
|
+
dirsCreated++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return dirsCreated;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Copy template files from the bundled templates
|
|
96
|
+
*/
|
|
97
|
+
async function copyTemplates(targetDir, config = {}) {
|
|
98
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
99
|
+
const templatesDir = path.join(__dirname, '..', 'templates', 'base');
|
|
100
|
+
|
|
101
|
+
let filesCopied = 0;
|
|
102
|
+
|
|
103
|
+
// Check if templates exist
|
|
104
|
+
if (!fs.existsSync(templatesDir)) {
|
|
105
|
+
// If no bundled templates, create minimal files
|
|
106
|
+
filesCopied = await createMinimalFiles(claudeDir, config);
|
|
107
|
+
return filesCopied;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Copy all files from templates
|
|
111
|
+
filesCopied = await copyDirectory(templatesDir, claudeDir);
|
|
112
|
+
|
|
113
|
+
return filesCopied;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Recursively copy a directory
|
|
118
|
+
*/
|
|
119
|
+
async function copyDirectory(src, dest) {
|
|
120
|
+
let count = 0;
|
|
121
|
+
|
|
122
|
+
if (!fs.existsSync(src)) {
|
|
123
|
+
return count;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
127
|
+
|
|
128
|
+
for (const entry of entries) {
|
|
129
|
+
const srcPath = path.join(src, entry.name);
|
|
130
|
+
const destPath = path.join(dest, entry.name);
|
|
131
|
+
|
|
132
|
+
if (entry.isDirectory()) {
|
|
133
|
+
if (!fs.existsSync(destPath)) {
|
|
134
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
135
|
+
}
|
|
136
|
+
count += await copyDirectory(srcPath, destPath);
|
|
137
|
+
} else {
|
|
138
|
+
// Copy file
|
|
139
|
+
fs.copyFileSync(srcPath, destPath);
|
|
140
|
+
count++;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return count;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Create minimal files when no templates are bundled
|
|
149
|
+
*/
|
|
150
|
+
async function createMinimalFiles(claudeDir, config = {}) {
|
|
151
|
+
let count = 0;
|
|
152
|
+
|
|
153
|
+
// README.md
|
|
154
|
+
const readmeContent = `# .claude Configuration - ${config.projectName || 'Project'}
|
|
155
|
+
|
|
156
|
+
This directory contains the Claude Context Engineering system.
|
|
157
|
+
|
|
158
|
+
## Quick Start
|
|
159
|
+
|
|
160
|
+
1. Load workflow index: Read \`.claude/context/WORKFLOW_INDEX.md\`
|
|
161
|
+
2. Use RPI workflow: /rpi-research → /rpi-plan → /rpi-implement
|
|
162
|
+
3. Validate changes: /verify-docs-current
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
- **Agents**: ${config.features?.agents ? '6 specialized agents' : 'disabled'}
|
|
167
|
+
- **Commands**: ${config.features?.rpi ? 'RPI workflow + validation' : 'basic'}
|
|
168
|
+
- **Context Budget**: 200k tokens max, target <40%
|
|
169
|
+
|
|
170
|
+
*Generated by create-claude-context*
|
|
171
|
+
`;
|
|
172
|
+
fs.writeFileSync(path.join(claudeDir, 'README.md'), readmeContent);
|
|
173
|
+
count++;
|
|
174
|
+
|
|
175
|
+
// settings.json
|
|
176
|
+
const settingsContent = {
|
|
177
|
+
'$schema': './schemas/settings.schema.json',
|
|
178
|
+
version: '1.0.0',
|
|
179
|
+
project: {
|
|
180
|
+
name: config.projectName || 'my-project',
|
|
181
|
+
status: 'development'
|
|
182
|
+
},
|
|
183
|
+
context: {
|
|
184
|
+
maxTokens: 200000,
|
|
185
|
+
targetUtilization: 0.4
|
|
186
|
+
},
|
|
187
|
+
validation: {
|
|
188
|
+
lineAccuracyThreshold: 60,
|
|
189
|
+
onCommit: true
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
fs.writeFileSync(
|
|
193
|
+
path.join(claudeDir, 'settings.json'),
|
|
194
|
+
JSON.stringify(settingsContent, null, 2)
|
|
195
|
+
);
|
|
196
|
+
count++;
|
|
197
|
+
|
|
198
|
+
// WORKFLOW_INDEX.md
|
|
199
|
+
const workflowIndexContent = `# Workflow Index
|
|
200
|
+
|
|
201
|
+
## Primary Workflows
|
|
202
|
+
|
|
203
|
+
| Workflow | Entry Point | Description |
|
|
204
|
+
|----------|-------------|-------------|
|
|
205
|
+
| *To be discovered* | - | Run @context-engineer to populate |
|
|
206
|
+
|
|
207
|
+
## Quick Reference
|
|
208
|
+
|
|
209
|
+
- Use \`/rpi-research\` to discover workflows
|
|
210
|
+
- Use \`@context-engineer\` for initial setup
|
|
211
|
+
|
|
212
|
+
*Run @context-engineer "Discover workflows for this codebase" to populate this index.*
|
|
213
|
+
`;
|
|
214
|
+
fs.writeFileSync(
|
|
215
|
+
path.join(claudeDir, 'context', 'WORKFLOW_INDEX.md'),
|
|
216
|
+
workflowIndexContent
|
|
217
|
+
);
|
|
218
|
+
count++;
|
|
219
|
+
|
|
220
|
+
// RPI_WORKFLOW_PLAN.md
|
|
221
|
+
const rpiContent = `# RPI (Research, Plan, Implement) Workflow
|
|
222
|
+
|
|
223
|
+
## Phase 1: RESEARCH (/rpi-research)
|
|
224
|
+
- Explore codebase using parallel agents
|
|
225
|
+
- Output: Research document in \`.claude/research/active/\`
|
|
226
|
+
|
|
227
|
+
## Phase 2: PLAN (/rpi-plan)
|
|
228
|
+
- Create implementation blueprint with file:line precision
|
|
229
|
+
- Output: Plan document in \`.claude/plans/active/\`
|
|
230
|
+
|
|
231
|
+
## Phase 3: IMPLEMENT (/rpi-implement)
|
|
232
|
+
- Execute with atomic changes
|
|
233
|
+
- ONE CHANGE → ONE TEST → ONE COMMIT
|
|
234
|
+
|
|
235
|
+
## Context Budget
|
|
236
|
+
- Research: 25-30%
|
|
237
|
+
- Plan: 20-25%
|
|
238
|
+
- Implement: 30-40%
|
|
239
|
+
`;
|
|
240
|
+
fs.writeFileSync(path.join(claudeDir, 'RPI_WORKFLOW_PLAN.md'), rpiContent);
|
|
241
|
+
count++;
|
|
242
|
+
|
|
243
|
+
// Create placeholder files for research and plans
|
|
244
|
+
const researchTemplate = `# Research Template
|
|
245
|
+
|
|
246
|
+
Use this template for RPI Research phase.
|
|
247
|
+
|
|
248
|
+
## Objective
|
|
249
|
+
[What you're researching]
|
|
250
|
+
|
|
251
|
+
## Files Explored
|
|
252
|
+
| File | Lines | Findings |
|
|
253
|
+
|------|-------|----------|
|
|
254
|
+
|
|
255
|
+
## Summary
|
|
256
|
+
[150 words max]
|
|
257
|
+
`;
|
|
258
|
+
fs.writeFileSync(
|
|
259
|
+
path.join(claudeDir, 'research', 'RESEARCH_TEMPLATE.md'),
|
|
260
|
+
researchTemplate
|
|
261
|
+
);
|
|
262
|
+
count++;
|
|
263
|
+
|
|
264
|
+
const planTemplate = `# Plan Template
|
|
265
|
+
|
|
266
|
+
Use this template for RPI Plan phase.
|
|
267
|
+
|
|
268
|
+
## Research Summary
|
|
269
|
+
[From Phase 1]
|
|
270
|
+
|
|
271
|
+
## Files to Modify
|
|
272
|
+
| File | Lines | Change | Risk |
|
|
273
|
+
|------|-------|--------|------|
|
|
274
|
+
|
|
275
|
+
## Steps
|
|
276
|
+
1. Step 1
|
|
277
|
+
2. Step 2
|
|
278
|
+
|
|
279
|
+
## Rollback Plan
|
|
280
|
+
- Revert: \`git revert HEAD\`
|
|
281
|
+
`;
|
|
282
|
+
fs.writeFileSync(
|
|
283
|
+
path.join(claudeDir, 'plans', 'PLAN_TEMPLATE.md'),
|
|
284
|
+
planTemplate
|
|
285
|
+
);
|
|
286
|
+
count++;
|
|
287
|
+
|
|
288
|
+
return count;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Create CLAUDE.md at project root
|
|
293
|
+
*/
|
|
294
|
+
async function createClaudeMd(targetDir, config = {}, techStack = {}) {
|
|
295
|
+
const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
|
|
296
|
+
|
|
297
|
+
// Check for template
|
|
298
|
+
const templatePath = path.join(__dirname, '..', 'templates', 'CLAUDE.md.template');
|
|
299
|
+
|
|
300
|
+
let content;
|
|
301
|
+
|
|
302
|
+
if (fs.existsSync(templatePath)) {
|
|
303
|
+
content = fs.readFileSync(templatePath, 'utf8');
|
|
304
|
+
} else {
|
|
305
|
+
// Create minimal CLAUDE.md
|
|
306
|
+
content = `# CLAUDE.md - ${config.projectName || 'Project'}
|
|
307
|
+
|
|
308
|
+
This file provides guidance to Claude Code when working with this repository.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Project Identity
|
|
313
|
+
|
|
314
|
+
**Platform:** ${config.projectName || 'Project'} application
|
|
315
|
+
**Tech Stack:** ${techStack.summary || techStack.stack || 'Not detected'}
|
|
316
|
+
**Status:** Development
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Essential Commands
|
|
321
|
+
|
|
322
|
+
### Development
|
|
323
|
+
\`\`\`bash
|
|
324
|
+
${techStack.commands?.install || 'npm install'}
|
|
325
|
+
${techStack.commands?.dev || 'npm run dev'}
|
|
326
|
+
\`\`\`
|
|
327
|
+
|
|
328
|
+
### Testing
|
|
329
|
+
\`\`\`bash
|
|
330
|
+
${techStack.commands?.test || 'npm test'}
|
|
331
|
+
\`\`\`
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Navigation Rules
|
|
336
|
+
|
|
337
|
+
### High-Level Task
|
|
338
|
+
1. Start: [.claude/context/WORKFLOW_INDEX.md](./.claude/context/WORKFLOW_INDEX.md)
|
|
339
|
+
2. Load relevant workflow
|
|
340
|
+
3. Implement with context
|
|
341
|
+
|
|
342
|
+
### Feature Development
|
|
343
|
+
1. /rpi-research - Explore codebase
|
|
344
|
+
2. /rpi-plan - Create blueprint
|
|
345
|
+
3. /rpi-implement - Execute with tests
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Documentation System
|
|
350
|
+
|
|
351
|
+
**Navigation:** 3-level chain (CLAUDE.md → Category → Domain → Detail)
|
|
352
|
+
**Validation:** Run /verify-docs-current after modifications
|
|
353
|
+
**RPI Workflow:** /rpi-research → /rpi-plan → /rpi-implement
|
|
354
|
+
|
|
355
|
+
See: [.claude/RPI_WORKFLOW_PLAN.md](./.claude/RPI_WORKFLOW_PLAN.md)
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
*Generated by create-claude-context*
|
|
360
|
+
`;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
fs.writeFileSync(claudeMdPath, content);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
module.exports = {
|
|
367
|
+
createDirectoryStructure,
|
|
368
|
+
copyTemplates,
|
|
369
|
+
createClaudeMd,
|
|
370
|
+
DIRECTORY_STRUCTURE,
|
|
371
|
+
};
|