@nolrm/contextkit 0.7.3
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 -0
- package/README.md +216 -0
- package/bin/contextkit.js +324 -0
- package/bin/vibe-kit.js +3 -0
- package/install-fallback.sh +59 -0
- package/lib/commands/ai.js +147 -0
- package/lib/commands/analyze.js +544 -0
- package/lib/commands/check.js +290 -0
- package/lib/commands/dashboard.js +383 -0
- package/lib/commands/install.js +1454 -0
- package/lib/commands/note.js +120 -0
- package/lib/commands/publish.js +184 -0
- package/lib/commands/pull.js +191 -0
- package/lib/commands/run.js +232 -0
- package/lib/commands/status.js +253 -0
- package/lib/commands/update.js +376 -0
- package/lib/index.js +9 -0
- package/lib/integrations/aider-integration.js +93 -0
- package/lib/integrations/base-integration.js +123 -0
- package/lib/integrations/claude-integration.js +141 -0
- package/lib/integrations/codex-integration.js +45 -0
- package/lib/integrations/continue-integration.js +99 -0
- package/lib/integrations/copilot-integration.js +73 -0
- package/lib/integrations/cursor-integration.js +162 -0
- package/lib/integrations/gemini-integration.js +62 -0
- package/lib/integrations/index.js +33 -0
- package/lib/integrations/windsurf-integration.js +88 -0
- package/lib/utils/download.js +50 -0
- package/lib/utils/git-hooks.js +228 -0
- package/lib/utils/project-detector.js +110 -0
- package/lib/utils/status-manager.js +107 -0
- package/lib/utils/tool-detector.js +137 -0
- package/package.json +85 -0
|
@@ -0,0 +1,1454 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const ora = require('ora');
|
|
3
|
+
const inquirer = require('inquirer');
|
|
4
|
+
const fs = require('fs-extra');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const axios = require('axios');
|
|
7
|
+
|
|
8
|
+
const DownloadManager = require('../utils/download');
|
|
9
|
+
const ProjectDetector = require('../utils/project-detector');
|
|
10
|
+
const GitHooksManager = require('../utils/git-hooks');
|
|
11
|
+
const StatusManager = require('../utils/status-manager');
|
|
12
|
+
const ToolDetector = require('../utils/tool-detector');
|
|
13
|
+
|
|
14
|
+
class InstallCommand {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.downloadManager = new DownloadManager();
|
|
17
|
+
this.projectDetector = new ProjectDetector();
|
|
18
|
+
this.gitHooksManager = new GitHooksManager();
|
|
19
|
+
this.statusManager = new StatusManager();
|
|
20
|
+
this.toolDetector = new ToolDetector();
|
|
21
|
+
this.repoUrl = 'https://raw.githubusercontent.com/nolrm/contextkit/main';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async install(options = {}) {
|
|
25
|
+
// Migrate legacy .vibe-kit/ directory
|
|
26
|
+
if (await fs.pathExists('.vibe-kit') && !await fs.pathExists('.contextkit')) {
|
|
27
|
+
console.log(chalk.yellow('Found legacy .vibe-kit/ directory'));
|
|
28
|
+
console.log(chalk.yellow('Renaming to .contextkit/...'));
|
|
29
|
+
await fs.move('.vibe-kit', '.contextkit');
|
|
30
|
+
console.log(chalk.green('✅ Migrated .vibe-kit/ → .contextkit/'));
|
|
31
|
+
console.log('');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const requestedPlatform = options.platform;
|
|
35
|
+
const isPlatformSpecific = !!requestedPlatform;
|
|
36
|
+
|
|
37
|
+
// Handle platform-specific installation
|
|
38
|
+
if (isPlatformSpecific) {
|
|
39
|
+
const isInstalled = await this.isAlreadyInstalled();
|
|
40
|
+
|
|
41
|
+
if (!isInstalled) {
|
|
42
|
+
console.log(chalk.red('❌ .contextkit is not installed'));
|
|
43
|
+
console.log(chalk.yellow('💡 Run: contextkit install'));
|
|
44
|
+
console.log(chalk.dim(' This installs the base .contextkit directory'));
|
|
45
|
+
console.log(chalk.dim(' Then you can run: contextkit ' + requestedPlatform));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// .contextkit exists, just add the platform integration
|
|
50
|
+
console.log(chalk.green('✓ .contextkit already exists'));
|
|
51
|
+
console.log(chalk.blue(`🔧 Adding ${requestedPlatform} integration...`));
|
|
52
|
+
console.log('');
|
|
53
|
+
await this.installPlatformIntegration(requestedPlatform);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Full installation
|
|
58
|
+
console.log(chalk.magenta('🎵 Installing ContextKit...'));
|
|
59
|
+
console.log('');
|
|
60
|
+
|
|
61
|
+
// Detect project type
|
|
62
|
+
const projectType = this.projectDetector.detectProjectType();
|
|
63
|
+
const packageManager = this.projectDetector.detectPackageManager();
|
|
64
|
+
|
|
65
|
+
console.log(chalk.green(`🧩 Detected project: ${projectType}`));
|
|
66
|
+
console.log(chalk.green(`📦 Package manager: ${packageManager}`));
|
|
67
|
+
|
|
68
|
+
// Detect AI tools
|
|
69
|
+
const detectedTools = await this.toolDetector.detectAll();
|
|
70
|
+
const summary = this.toolDetector.getSummary();
|
|
71
|
+
|
|
72
|
+
if (summary && summary.count > 0) {
|
|
73
|
+
const tools = [...summary.editors, ...summary.cli].join(', ');
|
|
74
|
+
console.log(chalk.green(`🧠 AI tools detected: ${tools}`));
|
|
75
|
+
} else {
|
|
76
|
+
console.log(chalk.yellow('⚠️ No AI tools detected'));
|
|
77
|
+
console.log(chalk.blue('💡 Universal context files will still be installed'));
|
|
78
|
+
}
|
|
79
|
+
console.log('');
|
|
80
|
+
|
|
81
|
+
// Check if already installed
|
|
82
|
+
if (await this.isAlreadyInstalled()) {
|
|
83
|
+
const { shouldContinue } = await this.promptReinstall();
|
|
84
|
+
if (!shouldContinue) {
|
|
85
|
+
console.log(chalk.yellow('⏭️ Installation cancelled'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Create directory structure
|
|
91
|
+
await this.createDirectoryStructure();
|
|
92
|
+
|
|
93
|
+
// Download files
|
|
94
|
+
await this.downloadFiles(projectType, options, detectedTools);
|
|
95
|
+
|
|
96
|
+
// Ask about Git hooks
|
|
97
|
+
let installHooks = true;
|
|
98
|
+
if (!options.nonInteractive && !options.noHooks) {
|
|
99
|
+
installHooks = await this.promptGitHooks();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Install Git hooks if requested
|
|
103
|
+
if (installHooks) {
|
|
104
|
+
await this.gitHooksManager.installHooks(packageManager);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Create configuration
|
|
108
|
+
await this.createConfiguration(projectType, installHooks);
|
|
109
|
+
|
|
110
|
+
// Create status tracking
|
|
111
|
+
await this.createStatusFile(projectType, packageManager, installHooks);
|
|
112
|
+
|
|
113
|
+
// Success message
|
|
114
|
+
this.showSuccessMessage(installHooks, detectedTools, projectType, packageManager);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async installPlatformIntegration(platform) {
|
|
118
|
+
try {
|
|
119
|
+
const { getIntegration } = require('../integrations');
|
|
120
|
+
const integration = getIntegration(platform);
|
|
121
|
+
|
|
122
|
+
if (!integration) {
|
|
123
|
+
console.log(chalk.red(`❌ Unknown platform: ${platform}`));
|
|
124
|
+
console.log(chalk.yellow('💡 Available: claude, cursor, copilot, codex, gemini, aider, continue, windsurf'));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
await integration.install();
|
|
129
|
+
|
|
130
|
+
console.log('');
|
|
131
|
+
console.log(chalk.green(`🎉 ${integration.displayName} integration installed!`));
|
|
132
|
+
|
|
133
|
+
integration.showUsage();
|
|
134
|
+
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.log(chalk.red(`❌ Failed to install ${platform} integration`));
|
|
137
|
+
console.log(chalk.yellow(error.message));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
showPlatformUsage(platform) {
|
|
142
|
+
const { getIntegration } = require('../integrations');
|
|
143
|
+
const integration = getIntegration(platform);
|
|
144
|
+
if (integration) {
|
|
145
|
+
integration.showUsage();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async isAlreadyInstalled() {
|
|
150
|
+
return await fs.pathExists('.contextkit/config.yml');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async promptReinstall() {
|
|
154
|
+
const { shouldContinue } = await inquirer.prompt([
|
|
155
|
+
{
|
|
156
|
+
type: 'confirm',
|
|
157
|
+
name: 'shouldContinue',
|
|
158
|
+
message: 'ContextKit is already installed. Do you want to reinstall?',
|
|
159
|
+
default: false
|
|
160
|
+
}
|
|
161
|
+
]);
|
|
162
|
+
return { shouldContinue };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async promptGitHooks() {
|
|
166
|
+
// Check for non-interactive mode
|
|
167
|
+
if (process.env.CI === 'true' || process.env.NON_INTERACTIVE === 'true') {
|
|
168
|
+
console.log(chalk.yellow('🤖 Non-interactive mode detected, skipping Git hooks'));
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!await fs.pathExists('package.json')) {
|
|
173
|
+
console.log(chalk.yellow('⚠️ Skipping Git hooks setup (no package.json found)'));
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
console.log('');
|
|
178
|
+
console.log('──────────────────────────────────────────────');
|
|
179
|
+
console.log(chalk.blue('⚙️ Git Hooks Setup'));
|
|
180
|
+
console.log('──────────────────────────────────────────────');
|
|
181
|
+
console.log('ContextKit can install **pre-commit** and **pre-push** hooks');
|
|
182
|
+
console.log('to automatically run tests, linting, and type checks before commits.');
|
|
183
|
+
console.log('');
|
|
184
|
+
console.log('');
|
|
185
|
+
|
|
186
|
+
const { installHooks } = await inquirer.prompt([
|
|
187
|
+
{
|
|
188
|
+
type: 'confirm',
|
|
189
|
+
name: 'installHooks',
|
|
190
|
+
message: 'Do you want to enable Git hooks?',
|
|
191
|
+
default: false
|
|
192
|
+
}
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
if (installHooks) {
|
|
196
|
+
console.log(chalk.green('✅ Git hooks enabled'));
|
|
197
|
+
} else {
|
|
198
|
+
console.log(chalk.yellow('⏭️ Skipping Git hooks for now'));
|
|
199
|
+
console.log(chalk.blue('💡 You can enable them anytime with: `ck update --hooks`'));
|
|
200
|
+
}
|
|
201
|
+
console.log('');
|
|
202
|
+
|
|
203
|
+
return installHooks;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async createDirectoryStructure() {
|
|
207
|
+
console.log(chalk.blue('📁 Creating structure...'));
|
|
208
|
+
|
|
209
|
+
const directories = [
|
|
210
|
+
'.contextkit/standards',
|
|
211
|
+
'.contextkit/standards/code-style', // Granular code style files
|
|
212
|
+
'.contextkit/product', // Product context (mission, roadmap, decisions)
|
|
213
|
+
'.contextkit/instructions', // Workflow instructions
|
|
214
|
+
'.contextkit/instructions/meta', // Meta instructions (pre-flight/post-flight)
|
|
215
|
+
'.contextkit/instructions/core', // Core workflow instructions
|
|
216
|
+
'.contextkit/hooks',
|
|
217
|
+
'.contextkit/types',
|
|
218
|
+
'.contextkit/commands',
|
|
219
|
+
'.contextkit/templates',
|
|
220
|
+
'.contextkit/scripts',
|
|
221
|
+
'.contextkit/integrations',
|
|
222
|
+
'.contextkit/policies' // Policy enforcement configs
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
for (const dir of directories) {
|
|
226
|
+
await fs.ensureDir(dir);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Platform directories are now created lazily by each integration's install()
|
|
230
|
+
|
|
231
|
+
console.log(chalk.green('✅ .contextkit/ directory created'));
|
|
232
|
+
console.log(chalk.green('✅ Standards, templates, and commands installed'));
|
|
233
|
+
console.log('');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async createSkeletonStandards() {
|
|
237
|
+
const skeletonFiles = {
|
|
238
|
+
'standards/code-style.md': `# Code Style
|
|
239
|
+
|
|
240
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
241
|
+
|
|
242
|
+
Your code style standards will be automatically generated based on your codebase patterns, conventions, and existing code.
|
|
243
|
+
|
|
244
|
+
Run \`ck analyze\` to generate this content.
|
|
245
|
+
|
|
246
|
+
## Conditional Loading
|
|
247
|
+
|
|
248
|
+
This file can be split into granular files for better organization:
|
|
249
|
+
- \`code-style/css-style.md\` - CSS-specific standards
|
|
250
|
+
- \`code-style/typescript-style.md\` - TypeScript-specific standards
|
|
251
|
+
- \`code-style/javascript-style.md\` - JavaScript-specific standards
|
|
252
|
+
- \`code-style/html-style.md\` - HTML-specific standards
|
|
253
|
+
|
|
254
|
+
Use conditional loading tags:
|
|
255
|
+
\`\`\`markdown
|
|
256
|
+
<!-- when:css -->
|
|
257
|
+
### CSS Conventions
|
|
258
|
+
[CSS-specific content]
|
|
259
|
+
|
|
260
|
+
<!-- when:typescript -->
|
|
261
|
+
### TypeScript Conventions
|
|
262
|
+
[TypeScript-specific content]
|
|
263
|
+
\`\`\`
|
|
264
|
+
`,
|
|
265
|
+
|
|
266
|
+
'standards/testing.md': `# Testing Standards
|
|
267
|
+
|
|
268
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
269
|
+
|
|
270
|
+
Your testing standards will be automatically generated based on your existing test patterns and testing framework.
|
|
271
|
+
|
|
272
|
+
Run \`ck analyze\` to generate this content.
|
|
273
|
+
|
|
274
|
+
## ⭐ REQUIRED: Numbered Test Cases
|
|
275
|
+
|
|
276
|
+
**All test cases MUST use numbered descriptions for easy tracking and debugging:**
|
|
277
|
+
|
|
278
|
+
\`\`\`typescript
|
|
279
|
+
describe("ComponentName", () => {
|
|
280
|
+
it("1. renders basic component", () => {
|
|
281
|
+
// test implementation
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it("2. handles user interactions", () => {
|
|
285
|
+
// test implementation
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it("3. displays correct content", () => {
|
|
289
|
+
// test implementation
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
\`\`\`
|
|
293
|
+
|
|
294
|
+
**Benefits:**
|
|
295
|
+
- Easy identification of failing tests
|
|
296
|
+
- Simple reference in discussions and bug reports
|
|
297
|
+
- Consistent organization across all test files
|
|
298
|
+
- Quick debugging and maintenance
|
|
299
|
+
`,
|
|
300
|
+
|
|
301
|
+
'standards/architecture.md': `# Architecture
|
|
302
|
+
|
|
303
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
304
|
+
|
|
305
|
+
Your architecture patterns will be documented based on your project structure and organization.
|
|
306
|
+
|
|
307
|
+
Run \`ck analyze\` to generate this content.`,
|
|
308
|
+
|
|
309
|
+
'standards/ai-guidelines.md': `# AI Guidelines
|
|
310
|
+
|
|
311
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
312
|
+
|
|
313
|
+
Guidelines for AI assistance will be defined based on your project's needs and patterns.
|
|
314
|
+
|
|
315
|
+
Run \`ck analyze\` to generate this content.`,
|
|
316
|
+
|
|
317
|
+
'standards/workflows.md': `# Workflows
|
|
318
|
+
|
|
319
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
320
|
+
|
|
321
|
+
Development workflows and processes will be documented based on your project's practices.
|
|
322
|
+
|
|
323
|
+
Run \`ck analyze\` to generate this content.`
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// Create granular code-style skeleton files
|
|
327
|
+
const granularCodeStyleFiles = {
|
|
328
|
+
'standards/code-style/css-style.md': `# CSS Style Guide
|
|
329
|
+
|
|
330
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
331
|
+
|
|
332
|
+
CSS-specific coding standards will be generated based on your project's styling patterns.
|
|
333
|
+
|
|
334
|
+
Run \`ck analyze\` to generate this content.
|
|
335
|
+
|
|
336
|
+
## Conditional Loading
|
|
337
|
+
|
|
338
|
+
This file is loaded when CSS-related tasks are detected:
|
|
339
|
+
\`\`\`markdown
|
|
340
|
+
<!-- when:css -->
|
|
341
|
+
[CSS-specific content]
|
|
342
|
+
\`\`\`
|
|
343
|
+
`,
|
|
344
|
+
|
|
345
|
+
'standards/code-style/typescript-style.md': `# TypeScript Style Guide
|
|
346
|
+
|
|
347
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
348
|
+
|
|
349
|
+
TypeScript-specific coding standards will be generated based on your project's TypeScript patterns.
|
|
350
|
+
|
|
351
|
+
Run \`ck analyze\` to generate this content.
|
|
352
|
+
|
|
353
|
+
## Conditional Loading
|
|
354
|
+
|
|
355
|
+
This file is loaded when TypeScript-related tasks are detected:
|
|
356
|
+
\`\`\`markdown
|
|
357
|
+
<!-- when:typescript -->
|
|
358
|
+
[TypeScript-specific content]
|
|
359
|
+
\`\`\`
|
|
360
|
+
`,
|
|
361
|
+
|
|
362
|
+
'standards/code-style/javascript-style.md': `# JavaScript Style Guide
|
|
363
|
+
|
|
364
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
365
|
+
|
|
366
|
+
JavaScript-specific coding standards will be generated based on your project's JavaScript patterns.
|
|
367
|
+
|
|
368
|
+
Run \`ck analyze\` to generate this content.
|
|
369
|
+
|
|
370
|
+
## Conditional Loading
|
|
371
|
+
|
|
372
|
+
This file is loaded when JavaScript-related tasks are detected:
|
|
373
|
+
\`\`\`markdown
|
|
374
|
+
<!-- when:javascript -->
|
|
375
|
+
[JavaScript-specific content]
|
|
376
|
+
\`\`\`
|
|
377
|
+
`,
|
|
378
|
+
|
|
379
|
+
'standards/code-style/html-style.md': `# HTML Style Guide
|
|
380
|
+
|
|
381
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
382
|
+
|
|
383
|
+
HTML-specific coding standards will be generated based on your project's HTML patterns.
|
|
384
|
+
|
|
385
|
+
Run \`ck analyze\` to generate this content.
|
|
386
|
+
|
|
387
|
+
## Conditional Loading
|
|
388
|
+
|
|
389
|
+
This file is loaded when HTML-related tasks are detected:
|
|
390
|
+
\`\`\`markdown
|
|
391
|
+
<!-- when:html -->
|
|
392
|
+
[HTML-specific content]
|
|
393
|
+
\`\`\`
|
|
394
|
+
`
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
for (const [relativePath, content] of Object.entries(skeletonFiles)) {
|
|
398
|
+
await fs.writeFile(`.contextkit/${relativePath}`, content);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
for (const [relativePath, content] of Object.entries(granularCodeStyleFiles)) {
|
|
402
|
+
await fs.writeFile(`.contextkit/${relativePath}`, content);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async downloadFiles(projectType, options = {}, detectedTools = {}) {
|
|
407
|
+
try {
|
|
408
|
+
// Create skeleton standards files (will be customized by analyze)
|
|
409
|
+
console.log(chalk.blue('📝 Creating skeleton standards files...'));
|
|
410
|
+
await this.createSkeletonStandards();
|
|
411
|
+
|
|
412
|
+
console.log(chalk.green('✅ Skeleton files created'));
|
|
413
|
+
console.log(chalk.yellow('💡 Run: ck analyze to generate content based on your codebase'));
|
|
414
|
+
console.log('');
|
|
415
|
+
|
|
416
|
+
// Download base files
|
|
417
|
+
await this.downloadManager.downloadFile(
|
|
418
|
+
`${this.repoUrl}/standards/README.md`,
|
|
419
|
+
'.contextkit/standards/README.md'
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
// Download the actual glossary (keep it as-is, universal across all projects)
|
|
423
|
+
await this.downloadManager.downloadFile(
|
|
424
|
+
`${this.repoUrl}/standards/glossary.md`,
|
|
425
|
+
'.contextkit/standards/glossary.md'
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
// Download commands
|
|
429
|
+
await this.downloadManager.downloadFile(
|
|
430
|
+
`${this.repoUrl}/commands/create-feature.md`,
|
|
431
|
+
'.contextkit/commands/create-feature.md'
|
|
432
|
+
);
|
|
433
|
+
await this.downloadManager.downloadFile(
|
|
434
|
+
`${this.repoUrl}/commands/create-component.md`,
|
|
435
|
+
'.contextkit/commands/create-component.md'
|
|
436
|
+
);
|
|
437
|
+
await this.downloadManager.downloadFile(
|
|
438
|
+
`${this.repoUrl}/commands/run-tests.md`,
|
|
439
|
+
'.contextkit/commands/run-tests.md'
|
|
440
|
+
);
|
|
441
|
+
await this.downloadManager.downloadFile(
|
|
442
|
+
`${this.repoUrl}/commands/add-documentation.md`,
|
|
443
|
+
'.contextkit/commands/add-documentation.md'
|
|
444
|
+
);
|
|
445
|
+
await this.downloadManager.downloadFile(
|
|
446
|
+
`${this.repoUrl}/commands/quality-check.md`,
|
|
447
|
+
'.contextkit/commands/quality-check.md'
|
|
448
|
+
);
|
|
449
|
+
await this.downloadManager.downloadFile(
|
|
450
|
+
`${this.repoUrl}/commands/analyze.md`,
|
|
451
|
+
'.contextkit/commands/analyze.md'
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
// Download hooks
|
|
455
|
+
await this.downloadManager.downloadFile(
|
|
456
|
+
`${this.repoUrl}/hooks/pre-commit.sh`,
|
|
457
|
+
'.contextkit/hooks/pre-commit.sh'
|
|
458
|
+
);
|
|
459
|
+
await this.downloadManager.downloadFile(
|
|
460
|
+
`${this.repoUrl}/hooks/pre-push.sh`,
|
|
461
|
+
'.contextkit/hooks/pre-push.sh'
|
|
462
|
+
);
|
|
463
|
+
await this.downloadManager.downloadFile(
|
|
464
|
+
`${this.repoUrl}/hooks/commit-msg.sh`,
|
|
465
|
+
'.contextkit/hooks/commit-msg.sh'
|
|
466
|
+
);
|
|
467
|
+
await this.downloadManager.downloadFile(
|
|
468
|
+
`${this.repoUrl}/hooks/setup-hooks.sh`,
|
|
469
|
+
'.contextkit/hooks/setup-hooks.sh'
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
// Download types
|
|
473
|
+
await this.downloadManager.downloadFile(
|
|
474
|
+
`${this.repoUrl}/types/strict.tsconfig.json`,
|
|
475
|
+
'.contextkit/types/strict.tsconfig.json'
|
|
476
|
+
);
|
|
477
|
+
await this.downloadManager.downloadFile(
|
|
478
|
+
`${this.repoUrl}/types/global.d.ts`,
|
|
479
|
+
'.contextkit/types/global.d.ts'
|
|
480
|
+
);
|
|
481
|
+
await this.downloadManager.downloadFile(
|
|
482
|
+
`${this.repoUrl}/types/type-check.sh`,
|
|
483
|
+
'.contextkit/types/type-check.sh'
|
|
484
|
+
);
|
|
485
|
+
await this.downloadManager.downloadFile(
|
|
486
|
+
`${this.repoUrl}/types/typescript-strict.json`,
|
|
487
|
+
'.contextkit/types/typescript-strict.json'
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
// Download templates
|
|
491
|
+
await this.downloadManager.downloadFile(
|
|
492
|
+
`${this.repoUrl}/templates/component.tsx`,
|
|
493
|
+
'.contextkit/templates/component.tsx'
|
|
494
|
+
);
|
|
495
|
+
await this.downloadManager.downloadFile(
|
|
496
|
+
`${this.repoUrl}/templates/test.tsx`,
|
|
497
|
+
'.contextkit/templates/test.tsx'
|
|
498
|
+
);
|
|
499
|
+
await this.downloadManager.downloadFile(
|
|
500
|
+
`${this.repoUrl}/templates/story.tsx`,
|
|
501
|
+
'.contextkit/templates/story.tsx'
|
|
502
|
+
);
|
|
503
|
+
await this.downloadManager.downloadFile(
|
|
504
|
+
`${this.repoUrl}/templates/hook.ts`,
|
|
505
|
+
'.contextkit/templates/hook.ts'
|
|
506
|
+
);
|
|
507
|
+
await this.downloadManager.downloadFile(
|
|
508
|
+
`${this.repoUrl}/templates/api.ts`,
|
|
509
|
+
'.contextkit/templates/api.ts'
|
|
510
|
+
);
|
|
511
|
+
|
|
512
|
+
// Download scripts
|
|
513
|
+
await this.downloadManager.downloadFile(
|
|
514
|
+
`${this.repoUrl}/legacy/update.sh`,
|
|
515
|
+
'.contextkit/scripts/update.sh'
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
// Make scripts executable
|
|
519
|
+
await fs.chmod('.contextkit/hooks/pre-commit.sh', '755');
|
|
520
|
+
await fs.chmod('.contextkit/hooks/pre-push.sh', '755');
|
|
521
|
+
await fs.chmod('.contextkit/hooks/commit-msg.sh', '755');
|
|
522
|
+
await fs.chmod('.contextkit/hooks/setup-hooks.sh', '755');
|
|
523
|
+
await fs.chmod('.contextkit/types/type-check.sh', '755');
|
|
524
|
+
await fs.chmod('.contextkit/scripts/update.sh', '755');
|
|
525
|
+
} catch (error) {
|
|
526
|
+
console.log(chalk.red('❌ Failed to download files'));
|
|
527
|
+
throw error;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// Create new Phase 1 files (product context, corrections log, meta instructions)
|
|
531
|
+
await this.createProductContext();
|
|
532
|
+
await this.createCorrectionsLog();
|
|
533
|
+
await this.createMetaInstructions();
|
|
534
|
+
await this.createPolicyFile();
|
|
535
|
+
|
|
536
|
+
// Install platform integrations
|
|
537
|
+
await this.installPlatformIntegrations(detectedTools);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
async installPlatformIntegrations(detectedTools = {}) {
|
|
541
|
+
console.log(chalk.blue('🔧 Installing integrations...'));
|
|
542
|
+
|
|
543
|
+
try {
|
|
544
|
+
const { getIntegration } = require('../integrations');
|
|
545
|
+
|
|
546
|
+
// Map detected tools to integration names
|
|
547
|
+
const toolToIntegration = {
|
|
548
|
+
cursor: 'cursor',
|
|
549
|
+
continue: 'continue',
|
|
550
|
+
aider: 'aider',
|
|
551
|
+
aider_cli: 'aider',
|
|
552
|
+
vscode: 'copilot',
|
|
553
|
+
claude_cli: 'claude',
|
|
554
|
+
gemini_cli: 'gemini',
|
|
555
|
+
windsurf: 'windsurf',
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const installed = new Set();
|
|
559
|
+
for (const [tool, integrationName] of Object.entries(toolToIntegration)) {
|
|
560
|
+
if (detectedTools[tool] && !installed.has(integrationName)) {
|
|
561
|
+
const integration = getIntegration(integrationName);
|
|
562
|
+
if (integration) {
|
|
563
|
+
await integration.install();
|
|
564
|
+
installed.add(integrationName);
|
|
565
|
+
console.log(chalk.green(` ✅ ${integration.displayName}`));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Always install CLI helpers
|
|
571
|
+
await this.installCLIHelpers();
|
|
572
|
+
|
|
573
|
+
console.log(chalk.green('✅ Platform integrations complete'));
|
|
574
|
+
console.log('');
|
|
575
|
+
} catch (error) {
|
|
576
|
+
console.log(chalk.red('❌ Failed to install platform integrations'));
|
|
577
|
+
console.log(chalk.yellow(error.message));
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Platform integration methods have been moved to lib/integrations/
|
|
582
|
+
|
|
583
|
+
async installCLIHelpers() {
|
|
584
|
+
// Create universal context.md file that references ALL standards
|
|
585
|
+
// CLI tools can read this single file to understand what context is available
|
|
586
|
+
const context = `# ContextKit - Context Entry Point
|
|
587
|
+
|
|
588
|
+
**Single file to reference for ALL context:** \`.contextkit/context.md\`
|
|
589
|
+
|
|
590
|
+
This file tells you what context files are available. Cursor/VS Code auto-load all files.
|
|
591
|
+
For CLI tools, this is your quick reference of what standards exist.
|
|
592
|
+
|
|
593
|
+
## Quick Usage
|
|
594
|
+
|
|
595
|
+
\`\`\`bash
|
|
596
|
+
# Claude, Gemini, Codex
|
|
597
|
+
claude "read .contextkit/context.md to see available standards, then create a button"
|
|
598
|
+
\`\`\`
|
|
599
|
+
|
|
600
|
+
## Available Context Files
|
|
601
|
+
|
|
602
|
+
### Standards
|
|
603
|
+
- \`.contextkit/standards/README.md\` - Standards overview
|
|
604
|
+
- \`.contextkit/standards/glossary.md\` - **Project terms & shortcuts**
|
|
605
|
+
- \`.contextkit/standards/code-style.md\` - Coding conventions
|
|
606
|
+
- \`.contextkit/standards/code-style/css-style.md\` - CSS-specific standards
|
|
607
|
+
- \`.contextkit/standards/code-style/typescript-style.md\` - TypeScript-specific standards
|
|
608
|
+
- \`.contextkit/standards/testing.md\` - Test patterns
|
|
609
|
+
- \`.contextkit/standards/architecture.md\` - Architecture decisions
|
|
610
|
+
- \`.contextkit/standards/ai-guidelines.md\` - AI behavior rules
|
|
611
|
+
- \`.contextkit/standards/workflows.md\` - Development workflows
|
|
612
|
+
|
|
613
|
+
### Product Context
|
|
614
|
+
- \`.contextkit/product/mission.md\` - Product vision and purpose
|
|
615
|
+
- \`.contextkit/product/mission-lite.md\` - Condensed mission for AI context
|
|
616
|
+
- \`.contextkit/product/roadmap.md\` - Development phases and features
|
|
617
|
+
- \`.contextkit/product/decisions.md\` - Architecture Decision Records (ADRs)
|
|
618
|
+
- \`.contextkit/product/context.md\` - Domain-specific context
|
|
619
|
+
|
|
620
|
+
### Commands
|
|
621
|
+
- \`.contextkit/commands/analyze.md\` - Analyze & customize standards
|
|
622
|
+
- \`.contextkit/commands/create-component.md\` - Create component
|
|
623
|
+
- \`.contextkit/commands/create-feature.md\` - Create feature
|
|
624
|
+
- \`.contextkit/commands/run-tests.md\` - Run tests
|
|
625
|
+
- \`.contextkit/commands/quality-check.md\` - Quality checks
|
|
626
|
+
- \`.contextkit/commands/add-documentation.md\` - Add documentation
|
|
627
|
+
|
|
628
|
+
### Instructions
|
|
629
|
+
- \`.contextkit/instructions/meta/pre-flight.md\` - Pre-flight checks
|
|
630
|
+
- \`.contextkit/instructions/meta/post-flight.md\` - Post-flight verification
|
|
631
|
+
- \`.contextkit/instructions/core/auto-corrections-log.md\` - Auto-logging instructions
|
|
632
|
+
|
|
633
|
+
### Templates
|
|
634
|
+
- \`.contextkit/templates/component.tsx\`
|
|
635
|
+
- \`.contextkit/templates/test.tsx\`
|
|
636
|
+
- \`.contextkit/templates/story.tsx\`
|
|
637
|
+
- \`.contextkit/templates/hook.ts\`
|
|
638
|
+
- \`.contextkit/templates/api.ts\`
|
|
639
|
+
|
|
640
|
+
### Tracking
|
|
641
|
+
- \`.contextkit/corrections.md\` - AI performance corrections log
|
|
642
|
+
|
|
643
|
+
## Conditional Loading
|
|
644
|
+
|
|
645
|
+
ContextKit supports conditional loading based on task context:
|
|
646
|
+
|
|
647
|
+
\`\`\`markdown
|
|
648
|
+
<!-- when:react -->
|
|
649
|
+
### React Conventions
|
|
650
|
+
Components use PascalCase and named exports.
|
|
651
|
+
|
|
652
|
+
<!-- when:css -->
|
|
653
|
+
### CSS Conventions
|
|
654
|
+
Use SCSS modules with BEM naming.
|
|
655
|
+
|
|
656
|
+
<!-- context-check:general-formatting -->
|
|
657
|
+
IF this section already in context:
|
|
658
|
+
SKIP: Re-reading
|
|
659
|
+
ELSE:
|
|
660
|
+
READ: The following formatting rules
|
|
661
|
+
\`\`\`
|
|
662
|
+
|
|
663
|
+
## How to Use
|
|
664
|
+
|
|
665
|
+
**In Cursor/VS Code:** Everything auto-loads! Just work normally.
|
|
666
|
+
|
|
667
|
+
**In CLI tools (Claude, Gemini, Codex):**
|
|
668
|
+
\`\`\`bash
|
|
669
|
+
# Reference specific files you need:
|
|
670
|
+
claude "read .contextkit/standards/glossary.md and create a @btn for @customer login"
|
|
671
|
+
|
|
672
|
+
# Or reference multiple files:
|
|
673
|
+
claude "read .contextkit/standards/README.md .contextkit/standards/glossary.md and create a button"
|
|
674
|
+
|
|
675
|
+
# Include product context:
|
|
676
|
+
claude "read .contextkit/product/mission-lite.md .contextkit/standards/code-style.md and create a feature"
|
|
677
|
+
\`\`\`
|
|
678
|
+
`;
|
|
679
|
+
|
|
680
|
+
await fs.writeFile('.contextkit/context.md', context);
|
|
681
|
+
await fs.writeFile('.contextkit/CONTEXT.md', context); // Keep uppercase for backward compatibility
|
|
682
|
+
|
|
683
|
+
// Create CLI wrapper script
|
|
684
|
+
const cliScript = `#!/bin/bash
|
|
685
|
+
# ContextKit AI CLI wrapper
|
|
686
|
+
# Usage: .contextkit/scripts/ai-cli.sh "your prompt"
|
|
687
|
+
|
|
688
|
+
CONTEXT_FILE=".contextkit/context.md"
|
|
689
|
+
AI_TOOL="\${AI_TOOL:-aider}"
|
|
690
|
+
PROMPT="\$@"
|
|
691
|
+
|
|
692
|
+
if [ ! -f "$CONTEXT_FILE" ]; then
|
|
693
|
+
echo "❌ ContextKit not initialized. Run: contextkit install"
|
|
694
|
+
exit 1
|
|
695
|
+
fi
|
|
696
|
+
|
|
697
|
+
CONTEXT=\$(cat "$CONTEXT_FILE")
|
|
698
|
+
|
|
699
|
+
case "$AI_TOOL" in
|
|
700
|
+
"aider")
|
|
701
|
+
echo "$PROMPT" | aider
|
|
702
|
+
;;
|
|
703
|
+
"claude")
|
|
704
|
+
echo "$CONTEXT
|
|
705
|
+
|
|
706
|
+
User: $PROMPT" | claude
|
|
707
|
+
;;
|
|
708
|
+
*)
|
|
709
|
+
echo "$CONTEXT
|
|
710
|
+
|
|
711
|
+
User: $PROMPT"
|
|
712
|
+
;;
|
|
713
|
+
esac
|
|
714
|
+
`;
|
|
715
|
+
|
|
716
|
+
await fs.writeFile('.contextkit/scripts/ai-cli.sh', cliScript);
|
|
717
|
+
await fs.chmod('.contextkit/scripts/ai-cli.sh', '755');
|
|
718
|
+
|
|
719
|
+
console.log(chalk.green('✅ CLI helpers installed'));
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
async createConfiguration(projectType, gitHooksEnabled) {
|
|
723
|
+
const projectName = path.basename(process.cwd());
|
|
724
|
+
|
|
725
|
+
const config = {
|
|
726
|
+
version: '1.0.0',
|
|
727
|
+
project_name: projectName,
|
|
728
|
+
project_type: projectType,
|
|
729
|
+
features: {
|
|
730
|
+
testing: true,
|
|
731
|
+
documentation: true,
|
|
732
|
+
code_review: true,
|
|
733
|
+
linting: true,
|
|
734
|
+
type_safety: true,
|
|
735
|
+
git_hooks: gitHooksEnabled
|
|
736
|
+
},
|
|
737
|
+
paths: {
|
|
738
|
+
components: 'src/components',
|
|
739
|
+
tests: 'src/__tests__',
|
|
740
|
+
stories: 'src/stories',
|
|
741
|
+
docs: 'docs'
|
|
742
|
+
},
|
|
743
|
+
commands: {
|
|
744
|
+
create_component: '@.contextkit/commands/create-component.md',
|
|
745
|
+
create_feature: '@.contextkit/commands/create-feature.md',
|
|
746
|
+
run_tests: '@.contextkit/commands/run-tests.md',
|
|
747
|
+
add_docs: '@.contextkit/commands/add-documentation.md',
|
|
748
|
+
quality_check: '@.contextkit/commands/quality-check.md',
|
|
749
|
+
analyze: '@.contextkit/commands/analyze.md'
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
const now = new Date().toISOString();
|
|
754
|
+
const isMonorepo = await fs.pathExists('packages') || await fs.pathExists('apps') ||
|
|
755
|
+
(await fs.pathExists('package.json') &&
|
|
756
|
+
(await fs.readJson('package.json').catch(() => ({}))).workspaces);
|
|
757
|
+
|
|
758
|
+
await fs.writeFile('.contextkit/config.yml',
|
|
759
|
+
`# ContextKit Configuration
|
|
760
|
+
ck: 1
|
|
761
|
+
version: "${config.version}"
|
|
762
|
+
updated: "${now.split('T')[0]}"
|
|
763
|
+
project_name: "${config.project_name}"
|
|
764
|
+
project_type: "${config.project_type}"
|
|
765
|
+
profile: "${config.project_type}" # react, vue, node, nextjs, etc.
|
|
766
|
+
is_monorepo: ${isMonorepo}
|
|
767
|
+
|
|
768
|
+
# Analysis scope (for monorepos)
|
|
769
|
+
# Set during 'ck analyze' - tracks which packages were analyzed
|
|
770
|
+
analysis_scope: null # frontend, backend, both, or current
|
|
771
|
+
analyzed_packages: [] # List of package paths that were analyzed
|
|
772
|
+
|
|
773
|
+
# Required standards (enforcement)
|
|
774
|
+
required:
|
|
775
|
+
- standards/code-style.md
|
|
776
|
+
- standards/testing.md
|
|
777
|
+
|
|
778
|
+
# Optional standards (warn if missing)
|
|
779
|
+
optional:
|
|
780
|
+
- standards/architecture.md
|
|
781
|
+
- standards/workflows.md
|
|
782
|
+
- standards/ai-guidelines.md
|
|
783
|
+
- product/mission.md
|
|
784
|
+
|
|
785
|
+
# Conditional loading rules
|
|
786
|
+
conditionals:
|
|
787
|
+
- when: react
|
|
788
|
+
load: [standards/code-style.md, standards/testing.md]
|
|
789
|
+
- when: css
|
|
790
|
+
load: [standards/code-style/css-style.md]
|
|
791
|
+
- when: typescript
|
|
792
|
+
load: [standards/code-style/typescript-style.md]
|
|
793
|
+
|
|
794
|
+
# Features
|
|
795
|
+
features:
|
|
796
|
+
testing: ${config.features.testing}
|
|
797
|
+
documentation: ${config.features.documentation}
|
|
798
|
+
code_review: ${config.features.code_review}
|
|
799
|
+
linting: ${config.features.linting}
|
|
800
|
+
type_safety: ${config.features.type_safety}
|
|
801
|
+
git_hooks: ${config.features.git_hooks}
|
|
802
|
+
|
|
803
|
+
# Paths (customize for your project)
|
|
804
|
+
paths:
|
|
805
|
+
components: "${config.paths.components}"
|
|
806
|
+
tests: "${config.paths.tests}"
|
|
807
|
+
stories: "${config.paths.stories}"
|
|
808
|
+
docs: "${config.paths.docs}"
|
|
809
|
+
|
|
810
|
+
# Commands
|
|
811
|
+
commands:
|
|
812
|
+
create_component: "${config.commands.create_component}"
|
|
813
|
+
create_feature: "${config.commands.create_feature}"
|
|
814
|
+
run_tests: "${config.commands.run_tests}"
|
|
815
|
+
add_docs: "${config.commands.add_docs}"
|
|
816
|
+
quality_check: "${config.commands.quality_check}"
|
|
817
|
+
analyze: "${config.commands.analyze}"
|
|
818
|
+
|
|
819
|
+
# Metadata for tracking
|
|
820
|
+
metadata:
|
|
821
|
+
generated_by: contextkit@${require('../../package.json').version}
|
|
822
|
+
generated_at: "${now}"
|
|
823
|
+
last_analyzed: null
|
|
824
|
+
`
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
async createStatusFile(projectType, packageManager, gitHooksEnabled) {
|
|
829
|
+
try {
|
|
830
|
+
const status = this.statusManager.getDefaultStatus();
|
|
831
|
+
status.project_type = projectType;
|
|
832
|
+
status.package_manager = packageManager;
|
|
833
|
+
status.features.git_hooks = gitHooksEnabled;
|
|
834
|
+
|
|
835
|
+
await this.statusManager.saveStatus(status);
|
|
836
|
+
console.log(chalk.green('✅ Status tracking initialized'));
|
|
837
|
+
} catch (error) {
|
|
838
|
+
console.log(chalk.yellow('⚠️ Warning: Could not create status file'), error.message);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
async createProductContext() {
|
|
843
|
+
console.log(chalk.blue('📦 Creating product context files...'));
|
|
844
|
+
|
|
845
|
+
const missionContent = `# Product Mission
|
|
846
|
+
|
|
847
|
+
<!-- Content will be generated by running: ck analyze or manually fill this in -->
|
|
848
|
+
|
|
849
|
+
## Pitch
|
|
850
|
+
|
|
851
|
+
[PRODUCT_NAME] is a [PRODUCT_TYPE] that helps [TARGET_USERS] [SOLVE_PROBLEM] by providing [KEY_VALUE_PROPOSITION].
|
|
852
|
+
|
|
853
|
+
## Users
|
|
854
|
+
|
|
855
|
+
### Primary Customers
|
|
856
|
+
|
|
857
|
+
- [CUSTOMER_SEGMENT_1]: [DESCRIPTION]
|
|
858
|
+
- [CUSTOMER_SEGMENT_2]: [DESCRIPTION]
|
|
859
|
+
|
|
860
|
+
### User Personas
|
|
861
|
+
|
|
862
|
+
**[USER_TYPE]** ([AGE_RANGE])
|
|
863
|
+
- **Role:** [JOB_TITLE]
|
|
864
|
+
- **Context:** [BUSINESS_CONTEXT]
|
|
865
|
+
- **Pain Points:** [PAIN_POINT_1], [PAIN_POINT_2]
|
|
866
|
+
- **Goals:** [GOAL_1], [GOAL_2]
|
|
867
|
+
|
|
868
|
+
## The Problem
|
|
869
|
+
|
|
870
|
+
### [PROBLEM_TITLE]
|
|
871
|
+
|
|
872
|
+
[PROBLEM_DESCRIPTION]. [QUANTIFIABLE_IMPACT].
|
|
873
|
+
|
|
874
|
+
**Our Solution:** [SOLUTION_DESCRIPTION]
|
|
875
|
+
|
|
876
|
+
## Differentiators
|
|
877
|
+
|
|
878
|
+
### [DIFFERENTIATOR_TITLE]
|
|
879
|
+
|
|
880
|
+
Unlike [COMPETITOR_OR_ALTERNATIVE], we provide [SPECIFIC_ADVANTAGE]. This results in [MEASURABLE_BENEFIT].
|
|
881
|
+
|
|
882
|
+
## Key Features
|
|
883
|
+
|
|
884
|
+
### Core Features
|
|
885
|
+
|
|
886
|
+
- **[FEATURE_NAME]:** [USER_BENEFIT_DESCRIPTION]
|
|
887
|
+
|
|
888
|
+
### Collaboration Features
|
|
889
|
+
|
|
890
|
+
- **[FEATURE_NAME]:** [USER_BENEFIT_DESCRIPTION]
|
|
891
|
+
`;
|
|
892
|
+
|
|
893
|
+
const missionLiteContent = `# Product Mission (Lite)
|
|
894
|
+
|
|
895
|
+
<!-- Condensed mission for efficient AI context usage -->
|
|
896
|
+
|
|
897
|
+
[ELEVATOR_PITCH_FROM_MISSION_MD]
|
|
898
|
+
|
|
899
|
+
[1-3_SENTENCES_SUMMARIZING_VALUE_TARGET_USERS_AND_PRIMARY_DIFFERENTIATOR]
|
|
900
|
+
|
|
901
|
+
<!-- This file should be kept concise for AI context efficiency -->
|
|
902
|
+
`;
|
|
903
|
+
|
|
904
|
+
const roadmapContent = `# Product Roadmap
|
|
905
|
+
|
|
906
|
+
## Current Phase: [PHASE_NAME]
|
|
907
|
+
|
|
908
|
+
### Completed Features ✅
|
|
909
|
+
|
|
910
|
+
- **[FEATURE]:** [DESCRIPTION]
|
|
911
|
+
|
|
912
|
+
### In Progress 🚧
|
|
913
|
+
|
|
914
|
+
- **[FEATURE]:** [DESCRIPTION]
|
|
915
|
+
|
|
916
|
+
### Upcoming Features 📋
|
|
917
|
+
|
|
918
|
+
- **[FEATURE]:** [DESCRIPTION]
|
|
919
|
+
|
|
920
|
+
## Technical Debt & Improvements
|
|
921
|
+
|
|
922
|
+
### High Priority 🔴
|
|
923
|
+
|
|
924
|
+
- **[ITEM]:** [DESCRIPTION]
|
|
925
|
+
|
|
926
|
+
### Medium Priority 🟡
|
|
927
|
+
|
|
928
|
+
- **[ITEM]:** [DESCRIPTION]
|
|
929
|
+
|
|
930
|
+
### Low Priority 🟢
|
|
931
|
+
|
|
932
|
+
- **[ITEM]:** [DESCRIPTION]
|
|
933
|
+
|
|
934
|
+
## Success Metrics
|
|
935
|
+
|
|
936
|
+
### Code Quality
|
|
937
|
+
|
|
938
|
+
- **Test Coverage:** Target [X]%+
|
|
939
|
+
- **TypeScript Coverage:** [X]% for new code
|
|
940
|
+
- **Linting Errors:** Zero in CI
|
|
941
|
+
|
|
942
|
+
### Performance
|
|
943
|
+
|
|
944
|
+
- **Page Load Time:** < [X] seconds
|
|
945
|
+
- **Bundle Size:** < [X]KB
|
|
946
|
+
- **Build Time:** < [X] minutes
|
|
947
|
+
|
|
948
|
+
## Future Vision
|
|
949
|
+
|
|
950
|
+
### [QUARTER/YEAR]: [THEME]
|
|
951
|
+
|
|
952
|
+
- [FEATURE_OR_GOAL]
|
|
953
|
+
`;
|
|
954
|
+
|
|
955
|
+
const decisionsContent = `# Technical Decisions
|
|
956
|
+
|
|
957
|
+
<!-- Architecture Decision Records (ADRs) -->
|
|
958
|
+
|
|
959
|
+
## Architecture Decisions
|
|
960
|
+
|
|
961
|
+
### [DECISION_NAME] ([DATE])
|
|
962
|
+
|
|
963
|
+
**Decision:** [DESCRIPTION]
|
|
964
|
+
|
|
965
|
+
**Rationale:**
|
|
966
|
+
- [REASON_1]
|
|
967
|
+
- [REASON_2]
|
|
968
|
+
|
|
969
|
+
**Alternatives Considered:** [ALTERNATIVE_1], [ALTERNATIVE_2]
|
|
970
|
+
|
|
971
|
+
**Status:** ✅ Implemented | 🚧 In Progress | 📋 Planned
|
|
972
|
+
|
|
973
|
+
## Technology Decisions
|
|
974
|
+
|
|
975
|
+
### [TECHNOLOGY_CHOICE] ([DATE])
|
|
976
|
+
|
|
977
|
+
**Decision:** [DESCRIPTION]
|
|
978
|
+
|
|
979
|
+
**Rationale:**
|
|
980
|
+
- [REASON_1]
|
|
981
|
+
- [REASON_2]
|
|
982
|
+
|
|
983
|
+
**Alternatives Considered:** [ALTERNATIVE_1], [ALTERNATIVE_2]
|
|
984
|
+
|
|
985
|
+
**Status:** ✅ Implemented | 🚧 In Progress | 📋 Planned
|
|
986
|
+
|
|
987
|
+
## Code Quality Decisions
|
|
988
|
+
|
|
989
|
+
### [QUALITY_DECISION] ([DATE])
|
|
990
|
+
|
|
991
|
+
**Decision:** [DESCRIPTION]
|
|
992
|
+
|
|
993
|
+
**Rationale:**
|
|
994
|
+
- [REASON_1]
|
|
995
|
+
- [REASON_2]
|
|
996
|
+
|
|
997
|
+
**Status:** ✅ Implemented | 🚧 In Progress | 📋 Planned
|
|
998
|
+
|
|
999
|
+
## Future Decisions to Make
|
|
1000
|
+
|
|
1001
|
+
### [FUTURE_DECISION] ([TIMELINE])
|
|
1002
|
+
|
|
1003
|
+
**Decision:** [DESCRIPTION]
|
|
1004
|
+
|
|
1005
|
+
**Options:**
|
|
1006
|
+
- [OPTION_1]
|
|
1007
|
+
- [OPTION_2]
|
|
1008
|
+
|
|
1009
|
+
**Factors:** [CONSIDERATION_1], [CONSIDERATION_2]
|
|
1010
|
+
`;
|
|
1011
|
+
|
|
1012
|
+
const contextContent = `# Product Context
|
|
1013
|
+
|
|
1014
|
+
<!-- Domain-specific context for AI understanding -->
|
|
1015
|
+
|
|
1016
|
+
## Domain Terminology
|
|
1017
|
+
|
|
1018
|
+
- **[TERM]:** [DEFINITION]
|
|
1019
|
+
- **[TERM]:** [DEFINITION]
|
|
1020
|
+
|
|
1021
|
+
## Business Rules
|
|
1022
|
+
|
|
1023
|
+
- **[RULE]:** [DESCRIPTION]
|
|
1024
|
+
- **[RULE]:** [DESCRIPTION]
|
|
1025
|
+
|
|
1026
|
+
## Key Integrations
|
|
1027
|
+
|
|
1028
|
+
- **[INTEGRATION]:** [DESCRIPTION]
|
|
1029
|
+
- **[INTEGRATION]:** [DESCRIPTION]
|
|
1030
|
+
|
|
1031
|
+
## Important Constraints
|
|
1032
|
+
|
|
1033
|
+
- **[CONSTRAINT]:** [DESCRIPTION]
|
|
1034
|
+
- **[CONSTRAINT]:** [DESCRIPTION]
|
|
1035
|
+
`;
|
|
1036
|
+
|
|
1037
|
+
await fs.writeFile('.contextkit/product/mission.md', missionContent);
|
|
1038
|
+
await fs.writeFile('.contextkit/product/mission-lite.md', missionLiteContent);
|
|
1039
|
+
await fs.writeFile('.contextkit/product/roadmap.md', roadmapContent);
|
|
1040
|
+
await fs.writeFile('.contextkit/product/decisions.md', decisionsContent);
|
|
1041
|
+
await fs.writeFile('.contextkit/product/context.md', contextContent);
|
|
1042
|
+
|
|
1043
|
+
console.log(chalk.green('✅ Product context files created'));
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
async createCorrectionsLog() {
|
|
1047
|
+
console.log(chalk.blue('📝 Creating corrections log system...'));
|
|
1048
|
+
|
|
1049
|
+
const correctionsContent = `# ContextKit Corrections Log
|
|
1050
|
+
|
|
1051
|
+
## Description
|
|
1052
|
+
|
|
1053
|
+
This log tracks corrections and improvements to **ContextKit performance** based on real development experience. It captures patterns, preferences, and issues with the AI assistant's behavior to continuously refine the ContextKit configuration and improve development efficiency.
|
|
1054
|
+
|
|
1055
|
+
## Usage Instructions
|
|
1056
|
+
|
|
1057
|
+
### For Developers
|
|
1058
|
+
|
|
1059
|
+
- **Read before starting** - Check recent sessions for known ContextKit issues or preferences
|
|
1060
|
+
- **Report ContextKit issues** - When the AI makes mistakes, doesn't follow standards, or behaves inefficiently, note them here
|
|
1061
|
+
- **Track ContextKit patterns** - Look for recurring AI behavior issues that indicate rule updates are needed
|
|
1062
|
+
|
|
1063
|
+
### For AI Assistant
|
|
1064
|
+
|
|
1065
|
+
- **Update in real-time** - Add ContextKit performance corrections and preferences as they're discovered
|
|
1066
|
+
- **Track frequency** - Note how often ContextKit issues occur to identify trending problems
|
|
1067
|
+
- **Categorize properly** - Use HIGH/MEDIUM/LOW priority levels for ContextKit improvements
|
|
1068
|
+
|
|
1069
|
+
### Categories
|
|
1070
|
+
|
|
1071
|
+
- **Rule Updates**: Fixes to existing ContextKit rules and standards
|
|
1072
|
+
- **AI Behavior**: Issues with AI assistant behavior, efficiency, or decision-making
|
|
1073
|
+
- **Preferences**: Developer preferences for AI assistant behavior and output
|
|
1074
|
+
- **Trend Indicators**: Patterns in AI performance that need attention (🔥 hot issues, 📈 growing patterns, ⚠️ alerts)
|
|
1075
|
+
|
|
1076
|
+
## Quick Stats
|
|
1077
|
+
|
|
1078
|
+
- **Total Sessions**: 0
|
|
1079
|
+
- **Rule Updates**: 0
|
|
1080
|
+
- **New Preferences**: 0
|
|
1081
|
+
- **Trending Issues**: 0
|
|
1082
|
+
|
|
1083
|
+
## Recent Sessions
|
|
1084
|
+
|
|
1085
|
+
<!-- Add session entries here as you work -->
|
|
1086
|
+
|
|
1087
|
+
### YYYY-MM-DD - [Task/Feature Name]
|
|
1088
|
+
|
|
1089
|
+
**Changes**: [X files, Y test cases]
|
|
1090
|
+
|
|
1091
|
+
#### Rule Updates
|
|
1092
|
+
|
|
1093
|
+
- [Current Rule] → [Fixed Rule] [PRIORITY] [Frequency: Xx this week]
|
|
1094
|
+
|
|
1095
|
+
#### AI Behavior
|
|
1096
|
+
|
|
1097
|
+
- [Category] | [Issue] [PRIORITY] [Context: ...]
|
|
1098
|
+
|
|
1099
|
+
#### Preferences
|
|
1100
|
+
|
|
1101
|
+
- [Category] | [Preference] [PRIORITY] [Context: User request/Pattern observed]
|
|
1102
|
+
|
|
1103
|
+
#### Trend Indicators
|
|
1104
|
+
|
|
1105
|
+
- 🔥 [Issue]: X occurrences in Y days
|
|
1106
|
+
- 📈 [Pattern]: X new preferences this week
|
|
1107
|
+
- ⚠️ [Alert]: [Description]
|
|
1108
|
+
|
|
1109
|
+
## Cumulative Improvements
|
|
1110
|
+
|
|
1111
|
+
### High Priority
|
|
1112
|
+
|
|
1113
|
+
- [No high priority items yet]
|
|
1114
|
+
|
|
1115
|
+
### Medium Priority
|
|
1116
|
+
|
|
1117
|
+
- [No medium priority items yet]
|
|
1118
|
+
|
|
1119
|
+
### Low Priority
|
|
1120
|
+
|
|
1121
|
+
- [No low priority items yet]
|
|
1122
|
+
|
|
1123
|
+
## Session Template
|
|
1124
|
+
|
|
1125
|
+
### YYYY-MM-DD - [Task/Feature Name]
|
|
1126
|
+
|
|
1127
|
+
**Changes**: [X files, Y test cases]
|
|
1128
|
+
|
|
1129
|
+
#### Rule Updates
|
|
1130
|
+
|
|
1131
|
+
- [Current Rule] → [Fixed Rule] [PRIORITY] [Frequency: Xx this week]
|
|
1132
|
+
|
|
1133
|
+
#### AI Behavior
|
|
1134
|
+
|
|
1135
|
+
- [Category] | [Issue] [PRIORITY] [Context: ...]
|
|
1136
|
+
|
|
1137
|
+
#### Preferences
|
|
1138
|
+
|
|
1139
|
+
- [Category] | [Preference] [PRIORITY] [Context: User request/Pattern observed]
|
|
1140
|
+
|
|
1141
|
+
#### Trend Indicators
|
|
1142
|
+
|
|
1143
|
+
- 🔥 [Issue]: X occurrences in Y days
|
|
1144
|
+
- 📈 [Pattern]: X new preferences this week
|
|
1145
|
+
- ⚠️ [Alert]: [Description]
|
|
1146
|
+
|
|
1147
|
+
---
|
|
1148
|
+
|
|
1149
|
+
_This log tracks corrections and improvements to ContextKit rules based on real development experience._
|
|
1150
|
+
`;
|
|
1151
|
+
|
|
1152
|
+
const autoCorrectionsContent = `---
|
|
1153
|
+
description: Automatic Corrections Log Updates for ContextKit Performance Tracking
|
|
1154
|
+
globs:
|
|
1155
|
+
alwaysApply: true
|
|
1156
|
+
version: 1.0
|
|
1157
|
+
encoding: UTF-8
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
# Automatic Corrections Log Updates
|
|
1161
|
+
|
|
1162
|
+
## Overview
|
|
1163
|
+
|
|
1164
|
+
Automatically track and log ContextKit performance issues during development sessions to continuously improve AI assistant effectiveness.
|
|
1165
|
+
|
|
1166
|
+
## Automatic Triggers
|
|
1167
|
+
|
|
1168
|
+
### During Development Sessions
|
|
1169
|
+
|
|
1170
|
+
**Standards Violations** - Automatically log when:
|
|
1171
|
+
|
|
1172
|
+
- AI doesn't follow ContextKit testing standards initially
|
|
1173
|
+
- AI doesn't apply coding standards without prompting
|
|
1174
|
+
- AI misses established patterns or conventions
|
|
1175
|
+
|
|
1176
|
+
**Inefficient Behavior** - Automatically log when:
|
|
1177
|
+
|
|
1178
|
+
- AI requires multiple iterations for simple tasks
|
|
1179
|
+
- AI needs user guidance on basic concepts
|
|
1180
|
+
- AI makes repeated mistakes in the same session
|
|
1181
|
+
|
|
1182
|
+
**Positive Behaviors** - Automatically log when:
|
|
1183
|
+
|
|
1184
|
+
- AI proactively applies ContextKit standards
|
|
1185
|
+
- AI correctly identifies issues or patterns
|
|
1186
|
+
- AI solves problems efficiently on first attempt
|
|
1187
|
+
|
|
1188
|
+
### Update Process
|
|
1189
|
+
|
|
1190
|
+
1. **Session Review**: At the end of each development session, review for ContextKit performance patterns
|
|
1191
|
+
2. **Automatic Logging**: Update \`.contextkit/corrections.md\` without prompting
|
|
1192
|
+
3. **Categorization**: Classify issues as Rule Updates, AI Behavior, or Preferences
|
|
1193
|
+
4. **Trend Tracking**: Note frequency and patterns for continuous improvement
|
|
1194
|
+
|
|
1195
|
+
### Implementation
|
|
1196
|
+
|
|
1197
|
+
- **No User Prompt Required**: This happens automatically as part of the workflow
|
|
1198
|
+
- **Real-time Updates**: Log issues as they're discovered during development
|
|
1199
|
+
- **Pattern Recognition**: Track recurring issues to identify systemic problems
|
|
1200
|
+
- **Positive Reinforcement**: Document good behaviors to reinforce them
|
|
1201
|
+
|
|
1202
|
+
## Example Automatic Updates
|
|
1203
|
+
|
|
1204
|
+
### Standards Violation
|
|
1205
|
+
|
|
1206
|
+
\`\`\`
|
|
1207
|
+
- Testing | AI didn't follow ContextKit testing standards initially [HIGH]
|
|
1208
|
+
[Context: Had to correct AI to use numbered test cases]
|
|
1209
|
+
\`\`\`
|
|
1210
|
+
|
|
1211
|
+
### Inefficient Behavior
|
|
1212
|
+
|
|
1213
|
+
\`\`\`
|
|
1214
|
+
- TypeScript | AI needed multiple iterations to fix type errors [MEDIUM]
|
|
1215
|
+
[Context: Required guidance on enum types and const assertions]
|
|
1216
|
+
\`\`\`
|
|
1217
|
+
|
|
1218
|
+
### Positive Behavior
|
|
1219
|
+
|
|
1220
|
+
\`\`\`
|
|
1221
|
+
- Testing | AI correctly identified potential bug during testing [LOW]
|
|
1222
|
+
[Context: Good behavior - documented finding]
|
|
1223
|
+
\`\`\`
|
|
1224
|
+
|
|
1225
|
+
## Benefits
|
|
1226
|
+
|
|
1227
|
+
- **Continuous Improvement**: Automatically identify and fix ContextKit performance issues
|
|
1228
|
+
- **No Manual Overhead**: Eliminates need for user prompts to track issues
|
|
1229
|
+
- **Pattern Recognition**: Build up data on recurring problems
|
|
1230
|
+
- **Standards Enforcement**: Ensure ContextKit standards are consistently applied
|
|
1231
|
+
`;
|
|
1232
|
+
|
|
1233
|
+
await fs.writeFile('.contextkit/corrections.md', correctionsContent);
|
|
1234
|
+
await fs.writeFile('.contextkit/instructions/core/auto-corrections-log.md', autoCorrectionsContent);
|
|
1235
|
+
|
|
1236
|
+
console.log(chalk.green('✅ Corrections log system created'));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
async createMetaInstructions() {
|
|
1240
|
+
console.log(chalk.blue('📋 Creating meta instructions...'));
|
|
1241
|
+
|
|
1242
|
+
const preFlightContent = `---
|
|
1243
|
+
description: Common Pre-Flight Steps for ContextKit Instructions
|
|
1244
|
+
globs:
|
|
1245
|
+
alwaysApply: false
|
|
1246
|
+
version: 1.0
|
|
1247
|
+
encoding: UTF-8
|
|
1248
|
+
---
|
|
1249
|
+
|
|
1250
|
+
# Pre-Flight Rules
|
|
1251
|
+
|
|
1252
|
+
- IMPORTANT: For any step that specifies a subagent in the subagent="" XML attribute you MUST use the specified subagent to perform the instructions for that step.
|
|
1253
|
+
|
|
1254
|
+
- Process XML blocks sequentially
|
|
1255
|
+
|
|
1256
|
+
- Read and execute every numbered step in the process_flow EXACTLY as the instructions specify.
|
|
1257
|
+
|
|
1258
|
+
- If you need clarification on any details of your current task, stop and ask the user specific numbered questions and then continue once you have all of the information you need.
|
|
1259
|
+
|
|
1260
|
+
- Use exact templates as provided
|
|
1261
|
+
`;
|
|
1262
|
+
|
|
1263
|
+
const postFlightContent = `---
|
|
1264
|
+
description: Common Post-Flight Steps for ContextKit Instructions
|
|
1265
|
+
globs:
|
|
1266
|
+
alwaysApply: false
|
|
1267
|
+
version: 1.0
|
|
1268
|
+
encoding: UTF-8
|
|
1269
|
+
---
|
|
1270
|
+
|
|
1271
|
+
# Post-Flight Rules
|
|
1272
|
+
|
|
1273
|
+
After completing all steps in a process_flow, always review your work and verify:
|
|
1274
|
+
|
|
1275
|
+
- Every numbered step has read, executed, and delivered according to its instructions.
|
|
1276
|
+
|
|
1277
|
+
- All steps that specified a subagent should be used, did in fact delegate those tasks to the specified subagent. IF they did not, see why the subagent was not used and report your findings to the user.
|
|
1278
|
+
|
|
1279
|
+
- IF you notice a step wasn't executed according to it's instructions, report your findings and explain which part of the instructions were misread or skipped and why.
|
|
1280
|
+
|
|
1281
|
+
## Automatic Corrections Log Updates
|
|
1282
|
+
|
|
1283
|
+
After completing any development session, automatically update the corrections log if any of the following occurred:
|
|
1284
|
+
|
|
1285
|
+
### ContextKit Performance Issues
|
|
1286
|
+
|
|
1287
|
+
- **Standards Violations**: If you didn't follow ContextKit standards initially (testing, coding, etc.)
|
|
1288
|
+
- **Inefficient Behavior**: If you required multiple iterations for simple tasks
|
|
1289
|
+
- **Missing Context**: If you needed user guidance on established patterns
|
|
1290
|
+
- **Rule Gaps**: If you discovered gaps in ContextKit rules or instructions
|
|
1291
|
+
|
|
1292
|
+
### Positive Behaviors
|
|
1293
|
+
|
|
1294
|
+
- **Good Practices**: If you correctly identified issues or followed best practices
|
|
1295
|
+
- **Efficient Solutions**: If you solved problems quickly and effectively
|
|
1296
|
+
- **Standards Compliance**: If you proactively applied ContextKit standards
|
|
1297
|
+
|
|
1298
|
+
### Update Process
|
|
1299
|
+
|
|
1300
|
+
1. **Identify Issues**: Review the session for ContextKit performance patterns
|
|
1301
|
+
2. **Categorize**: Classify as Rule Updates, AI Behavior, or Preferences
|
|
1302
|
+
3. **Update Log**: Add entries to \`.contextkit/corrections.md\` automatically
|
|
1303
|
+
4. **No Prompt Required**: This should happen as part of the natural workflow
|
|
1304
|
+
|
|
1305
|
+
### Example Triggers
|
|
1306
|
+
|
|
1307
|
+
- ✅ User had to correct you on testing standards → Add to corrections log
|
|
1308
|
+
- ✅ You needed multiple attempts to fix TypeScript errors → Add to corrections log
|
|
1309
|
+
- ✅ You correctly identified a code issue → Add positive behavior note
|
|
1310
|
+
- ✅ You followed ContextKit standards from the start → Add positive behavior note
|
|
1311
|
+
`;
|
|
1312
|
+
|
|
1313
|
+
await fs.writeFile('.contextkit/instructions/meta/pre-flight.md', preFlightContent);
|
|
1314
|
+
await fs.writeFile('.contextkit/instructions/meta/post-flight.md', postFlightContent);
|
|
1315
|
+
|
|
1316
|
+
console.log(chalk.green('✅ Meta instructions created'));
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
async createPolicyFile() {
|
|
1320
|
+
console.log(chalk.blue('⚖️ Creating policy file...'));
|
|
1321
|
+
|
|
1322
|
+
const policyContent = `# ContextKit Policy Configuration
|
|
1323
|
+
|
|
1324
|
+
## Enforcement Levels
|
|
1325
|
+
|
|
1326
|
+
- **off**: No enforcement (informational only)
|
|
1327
|
+
- **warn**: Show warnings but don't block
|
|
1328
|
+
- **block**: Block commits/actions if policy violated
|
|
1329
|
+
|
|
1330
|
+
## Policy Rules
|
|
1331
|
+
|
|
1332
|
+
enforcement:
|
|
1333
|
+
testing:
|
|
1334
|
+
numbered_cases: warn # off | warn | block
|
|
1335
|
+
coverage_threshold: 80 # warn if below
|
|
1336
|
+
code_style:
|
|
1337
|
+
typescript_strict: warn
|
|
1338
|
+
naming_conventions: warn
|
|
1339
|
+
standards:
|
|
1340
|
+
freshness_days: 90 # warn if older
|
|
1341
|
+
required_files: block
|
|
1342
|
+
`;
|
|
1343
|
+
|
|
1344
|
+
await fs.writeFile('.contextkit/policies/policy.yml', policyContent);
|
|
1345
|
+
|
|
1346
|
+
console.log(chalk.green('✅ Policy file created'));
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
showSuccessMessage(gitHooksEnabled, detectedTools = {}, projectType = '', packageManager = '') {
|
|
1350
|
+
console.log('');
|
|
1351
|
+
console.log(chalk.green('🎉 ContextKit v1.0.0 successfully installed!'));
|
|
1352
|
+
console.log('');
|
|
1353
|
+
|
|
1354
|
+
// Show which platform integrations were configured
|
|
1355
|
+
const { getIntegration } = require('../integrations');
|
|
1356
|
+
const toolToIntegration = {
|
|
1357
|
+
cursor: 'cursor',
|
|
1358
|
+
continue: 'continue',
|
|
1359
|
+
aider: 'aider',
|
|
1360
|
+
aider_cli: 'aider',
|
|
1361
|
+
vscode: 'copilot',
|
|
1362
|
+
claude_cli: 'claude',
|
|
1363
|
+
gemini_cli: 'gemini',
|
|
1364
|
+
windsurf: 'windsurf',
|
|
1365
|
+
};
|
|
1366
|
+
const installedPlatforms = new Set();
|
|
1367
|
+
for (const [tool, name] of Object.entries(toolToIntegration)) {
|
|
1368
|
+
if (detectedTools[tool]) installedPlatforms.add(name);
|
|
1369
|
+
}
|
|
1370
|
+
if (installedPlatforms.size > 0) {
|
|
1371
|
+
console.log(chalk.blue('🔌 Platform integrations:'));
|
|
1372
|
+
for (const name of installedPlatforms) {
|
|
1373
|
+
const integration = getIntegration(name);
|
|
1374
|
+
if (integration) {
|
|
1375
|
+
const files = [...integration.bridgeFiles, ...integration.generatedFiles];
|
|
1376
|
+
console.log(` ${integration.displayName}: ${files.join(', ')}`);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
console.log('');
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// Quick Reference
|
|
1383
|
+
console.log(''.padEnd(48, '─'));
|
|
1384
|
+
console.log(chalk.bold('📖 Quick Reference'));
|
|
1385
|
+
console.log(''.padEnd(48, '─'));
|
|
1386
|
+
console.log(`ck status → Check installation & integrations`);
|
|
1387
|
+
console.log(`ck ai <cmd> → Use AI with project context`);
|
|
1388
|
+
console.log(`ck <platform> → Add platform (claude, cursor, copilot, codex, gemini, aider, continue, windsurf)`);
|
|
1389
|
+
console.log('');
|
|
1390
|
+
console.log(`Docs → ${chalk.blue('https://contextkit-docs.vercel.app')}`);
|
|
1391
|
+
console.log(`Issues → ${chalk.blue('https://github.com/nolrm/contextkit/issues')}`);
|
|
1392
|
+
console.log('');
|
|
1393
|
+
|
|
1394
|
+
// Next Step Section
|
|
1395
|
+
console.log(''.padEnd(48, '─'));
|
|
1396
|
+
console.log(chalk.bold('🚀 NEXT STEP — GENERATE STANDARDS'));
|
|
1397
|
+
console.log(''.padEnd(48, '─'));
|
|
1398
|
+
|
|
1399
|
+
if (detectedTools.cursor) {
|
|
1400
|
+
console.log(chalk.bold('In Cursor Chat:'));
|
|
1401
|
+
console.log(` @.contextkit/commands/analyze.md`);
|
|
1402
|
+
console.log('');
|
|
1403
|
+
console.log('Or via CLI:');
|
|
1404
|
+
console.log(chalk.yellow('👉'), `ck analyze`);
|
|
1405
|
+
} else {
|
|
1406
|
+
console.log(chalk.yellow('👉'), `ck analyze`);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
console.log('');
|
|
1410
|
+
console.log('This will:');
|
|
1411
|
+
console.log(' • Scan your codebase and detect patterns');
|
|
1412
|
+
console.log(' • Generate content for `.contextkit/standards/*.md` based on YOUR code');
|
|
1413
|
+
console.log(' • Extract domain terms and project conventions');
|
|
1414
|
+
console.log(' • Document your actual architecture and patterns');
|
|
1415
|
+
console.log('');
|
|
1416
|
+
console.log(chalk.blue('💡 The standards files are currently empty/skeleton'));
|
|
1417
|
+
console.log(chalk.blue(' Run analyze to populate them with YOUR project details'));
|
|
1418
|
+
console.log('');
|
|
1419
|
+
|
|
1420
|
+
// After Analyze Section
|
|
1421
|
+
console.log(''.padEnd(48, '─'));
|
|
1422
|
+
console.log(chalk.bold('💡 After Analyze — Try This'));
|
|
1423
|
+
console.log(''.padEnd(48, '─'));
|
|
1424
|
+
|
|
1425
|
+
// Platform-specific examples
|
|
1426
|
+
if (detectedTools.cursor) {
|
|
1427
|
+
console.log(chalk.bold('In Cursor Chat'));
|
|
1428
|
+
console.log(`@.contextkit/commands/create-component.md`);
|
|
1429
|
+
console.log(chalk.dim('"Create a Button component for customer checkout"'));
|
|
1430
|
+
console.log('');
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
console.log(chalk.bold('In CLI'));
|
|
1434
|
+
console.log(`ck ai "create a Button component for customer checkout"`);
|
|
1435
|
+
console.log('');
|
|
1436
|
+
|
|
1437
|
+
if (detectedTools.claude_cli || detectedTools.gemini_cli) {
|
|
1438
|
+
const toolName = detectedTools.claude_cli ? 'Claude' : 'Gemini';
|
|
1439
|
+
console.log(chalk.bold(`In ${toolName} CLI`));
|
|
1440
|
+
console.log(`read .contextkit/commands/analyze.md and execute`);
|
|
1441
|
+
console.log('');
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
console.log(chalk.magenta('✨ Done! Your AI now understands your project.'));
|
|
1445
|
+
console.log('');
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
async function install(options) {
|
|
1450
|
+
const installer = new InstallCommand();
|
|
1451
|
+
await installer.install(options);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
module.exports = install;
|