@nolrm/contextkit 0.9.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,8 @@ npm i -g @nolrm/contextkit
37
37
 
38
38
  # Step 2: Navigate to your project and install
39
39
  cd your-project
40
- contextkit install
40
+ contextkit install # interactive — prompts "Which AI tool?"
41
+ contextkit install claude # or specify your platform directly
41
42
  ```
42
43
 
43
44
  This creates `.contextkit/` with skeleton context files (blank templates to be filled by AI):
@@ -67,10 +68,10 @@ ck analyze
67
68
  Perfect for teams where members use different AI tools:
68
69
 
69
70
  ```bash
70
- # First team member (any tool) - sets up the project
71
- contextkit install
71
+ # First team member - sets up the project with their tool
72
+ contextkit install claude # or: contextkit install (interactive picker)
72
73
 
73
- # Each team member adds their platform
74
+ # Each additional team member adds their platform
74
75
  ck claude # creates CLAUDE.md + .claude/rules/
75
76
  ck cursor # creates .cursor/rules/ (scoped .mdc files)
76
77
  ck copilot # creates .github/copilot-instructions.md
@@ -161,6 +162,7 @@ ContextKit installs reusable slash commands for supported platforms:
161
162
  | `/squad-review` | Review the full pipeline and give a verdict |
162
163
  | `/squad-batch` | Kick off multiple tasks at once (batch PO specs) |
163
164
  | `/squad-run` | Auto-run the remaining pipeline for batch tasks |
165
+ | `/ck` | Health check — verify setup, standards, and integrations |
164
166
 
165
167
  **Claude Code** — available as `/analyze`, `/review`, etc. in `.claude/commands/`
166
168
  **Cursor** — available as slash commands in Chat via `.cursor/prompts/`
@@ -273,7 +275,7 @@ Hooks are optional and can be skipped with `ck install --no-hooks`.
273
275
  - 🌍 **Project Agnostic** - Works with React, Vue, Node.js, PHP, Python, Rust, monorepos—any project type
274
276
  - 🤖 **Multi-Platform** - Works with Cursor, Claude Code, Copilot, Codex, Gemini, Aider, Continue, Windsurf
275
277
  - 🛡️ **Safe Install** - Backs up existing files with rollback support
276
- - ⚡ **Zero Config** - Auto-detects package managers and AI tools
278
+ - ⚡ **Zero Config** - Auto-detects project type and package manager
277
279
  - ✅ **Policy Enforcement** - Configurable validation with `ck check`
278
280
  - 📝 **Corrections Tracking** - Track AI performance issues with corrections log
279
281
  - 🔄 **Workflow Orchestration** - Structured workflows with `ck run`
@@ -284,7 +286,8 @@ Hooks are optional and can be skipped with `ck install --no-hooks`.
284
286
 
285
287
  ```bash
286
288
  # Installation & Setup
287
- ck install # set up .contextkit in this repo
289
+ ck install # set up .contextkit + pick AI tool interactively
290
+ ck install claude # set up .contextkit + Claude (no prompt)
288
291
  ck claude # add Claude Code integration (CLAUDE.md + rules)
289
292
  ck cursor # add Cursor integration (scoped .mdc rules)
290
293
  ck copilot # add GitHub Copilot integration
package/bin/contextkit.js CHANGED
@@ -21,13 +21,13 @@ program
21
21
 
22
22
  // Install command
23
23
  program
24
- .command('install')
24
+ .command('install [platform]')
25
25
  .description('Install ContextKit in current project')
26
26
  .option('--no-hooks', 'Skip Git hooks installation')
27
27
  .option('--non-interactive', 'Skip interactive prompts')
28
- .action(async (options) => {
28
+ .action(async (platform, options) => {
29
29
  try {
30
- await install(options);
30
+ await install({ ...options, ...(platform ? { platform, fullInstall: true } : { fullInstall: true }) });
31
31
  } catch (error) {
32
32
  console.error(chalk.red('Installation failed:'), error.message);
33
33
  process.exit(1);
@@ -9,7 +9,6 @@ const DownloadManager = require('../utils/download');
9
9
  const ProjectDetector = require('../utils/project-detector');
10
10
  const GitHooksManager = require('../utils/git-hooks');
11
11
  const StatusManager = require('../utils/status-manager');
12
- const ToolDetector = require('../utils/tool-detector');
13
12
 
14
13
  class InstallCommand {
15
14
  constructor() {
@@ -17,7 +16,6 @@ class InstallCommand {
17
16
  this.projectDetector = new ProjectDetector();
18
17
  this.gitHooksManager = new GitHooksManager();
19
18
  this.statusManager = new StatusManager();
20
- this.toolDetector = new ToolDetector();
21
19
  this.repoUrl = 'https://raw.githubusercontent.com/nolrm/contextkit/main';
22
20
  }
23
21
 
@@ -39,12 +37,12 @@ class InstallCommand {
39
37
  }
40
38
 
41
39
  const requestedPlatform = options.platform;
42
- const isPlatformSpecific = !!requestedPlatform;
40
+ const isFullInstall = !!options.fullInstall;
43
41
 
44
- // Handle platform-specific installation
45
- if (isPlatformSpecific) {
42
+ // Handle platform-specific installation (e.g., `ck claude`)
43
+ if (requestedPlatform && !isFullInstall) {
46
44
  const isInstalled = await this.isAlreadyInstalled();
47
-
45
+
48
46
  if (!isInstalled) {
49
47
  console.log(chalk.red('❌ .contextkit is not installed'));
50
48
  console.log(chalk.yellow('💡 Run: contextkit install'));
@@ -52,7 +50,7 @@ class InstallCommand {
52
50
  console.log(chalk.dim(' Then you can run: contextkit ' + requestedPlatform));
53
51
  return;
54
52
  }
55
-
53
+
56
54
  // .contextkit exists, just add the platform integration
57
55
  console.log(chalk.green('✓ .contextkit already exists'));
58
56
  console.log(chalk.blue(`🔧 Adding ${requestedPlatform} integration...`));
@@ -60,29 +58,17 @@ class InstallCommand {
60
58
  await this.installPlatformIntegration(requestedPlatform);
61
59
  return;
62
60
  }
63
-
61
+
64
62
  // Full installation
65
63
  console.log(chalk.magenta('🎵 Installing ContextKit...'));
66
64
  console.log('');
67
-
65
+
68
66
  // Detect project type
69
67
  const projectType = this.projectDetector.detectProjectType();
70
68
  const packageManager = this.projectDetector.detectPackageManager();
71
-
69
+
72
70
  console.log(chalk.green(`🧩 Detected project: ${projectType}`));
73
71
  console.log(chalk.green(`📦 Package manager: ${packageManager}`));
74
-
75
- // Detect AI tools
76
- const detectedTools = await this.toolDetector.detectAll();
77
- const summary = this.toolDetector.getSummary();
78
-
79
- if (summary && summary.count > 0) {
80
- const tools = [...summary.editors, ...summary.cli].join(', ');
81
- console.log(chalk.green(`🧠 AI tools detected: ${tools}`));
82
- } else {
83
- console.log(chalk.yellow('⚠️ No AI tools detected'));
84
- console.log(chalk.blue('💡 Universal context files will still be installed'));
85
- }
86
72
  console.log('');
87
73
 
88
74
  // Check if already installed
@@ -98,7 +84,7 @@ class InstallCommand {
98
84
  await this.createDirectoryStructure();
99
85
 
100
86
  // Download files
101
- await this.downloadFiles(projectType, options, detectedTools);
87
+ await this.downloadFiles(projectType, options);
102
88
 
103
89
  // Ask about Git hooks
104
90
  let hookChoices = { prePush: true, commitMsg: true };
@@ -119,8 +105,19 @@ class InstallCommand {
119
105
  // Create status tracking
120
106
  await this.createStatusFile(projectType, packageManager, hookChoices);
121
107
 
108
+ // Determine which platform to install
109
+ let chosenPlatform = requestedPlatform || null;
110
+ if (!chosenPlatform && !options.nonInteractive) {
111
+ chosenPlatform = await this.promptPlatformChoice();
112
+ }
113
+
114
+ // Install chosen platform integration
115
+ if (chosenPlatform) {
116
+ await this.installPlatformIntegration(chosenPlatform);
117
+ }
118
+
122
119
  // Success message
123
- this.showSuccessMessage(hookChoices, detectedTools, projectType, packageManager);
120
+ this.showSuccessMessage(hookChoices, chosenPlatform, projectType, packageManager);
124
121
  }
125
122
 
126
123
  async installPlatformIntegration(platform) {
@@ -171,6 +168,26 @@ class InstallCommand {
171
168
  return { shouldContinue };
172
169
  }
173
170
 
171
+ async promptPlatformChoice() {
172
+ const { platform } = await inquirer.prompt([{
173
+ type: 'list',
174
+ name: 'platform',
175
+ message: 'Which AI tool are you using?',
176
+ choices: [
177
+ { name: 'Claude Code', value: 'claude' },
178
+ { name: 'Cursor', value: 'cursor' },
179
+ { name: 'Copilot (GitHub)', value: 'copilot' },
180
+ { name: 'Codex (OpenAI)', value: 'codex' },
181
+ { name: 'Gemini', value: 'gemini' },
182
+ { name: 'Windsurf', value: 'windsurf' },
183
+ { name: 'Aider', value: 'aider' },
184
+ { name: 'Continue', value: 'continue' },
185
+ { name: 'Skip (base only)', value: null },
186
+ ]
187
+ }]);
188
+ return platform;
189
+ }
190
+
174
191
  async promptGitHooks() {
175
192
  // Check for non-interactive mode
176
193
  if (process.env.CI === 'true' || process.env.NON_INTERACTIVE === 'true') {
@@ -491,7 +508,7 @@ Run \`ck analyze\` to generate this content, or manually add your API pattern be
491
508
  }
492
509
  }
493
510
 
494
- async downloadFiles(projectType, options = {}, detectedTools = {}) {
511
+ async downloadFiles(projectType, options = {}) {
495
512
  try {
496
513
  // Create skeleton standards files (will be customized by analyze)
497
514
  console.log(chalk.blue('📝 Creating skeleton standards files...'));
@@ -638,54 +655,12 @@ Run \`ck analyze\` to generate this content, or manually add your API pattern be
638
655
  await this.createCorrectionsLog();
639
656
  await this.createMetaInstructions();
640
657
  await this.createPolicyFile();
658
+ await this.createHealthCheckCommand();
641
659
 
642
- // Install platform integrations
643
- await this.installPlatformIntegrations(detectedTools);
644
- }
645
-
646
- async installPlatformIntegrations(detectedTools = {}) {
647
- console.log(chalk.blue('🔧 Installing integrations...'));
648
-
649
- try {
650
- const { getIntegration } = require('../integrations');
651
-
652
- // Map detected tools to integration names
653
- const toolToIntegration = {
654
- cursor: 'cursor',
655
- continue: 'continue',
656
- aider: 'aider',
657
- aider_cli: 'aider',
658
- vscode: 'copilot',
659
- claude_cli: 'claude',
660
- gemini_cli: 'gemini',
661
- windsurf: 'windsurf',
662
- };
663
-
664
- const installed = new Set();
665
- for (const [tool, integrationName] of Object.entries(toolToIntegration)) {
666
- if (detectedTools[tool] && !installed.has(integrationName)) {
667
- const integration = getIntegration(integrationName);
668
- if (integration) {
669
- await integration.install();
670
- installed.add(integrationName);
671
- console.log(chalk.green(` ✅ ${integration.displayName}`));
672
- }
673
- }
674
- }
675
-
676
- // Always install CLI helpers
677
- await this.installCLIHelpers();
678
-
679
- console.log(chalk.green('✅ Platform integrations complete'));
680
- console.log('');
681
- } catch (error) {
682
- console.log(chalk.red('❌ Failed to install platform integrations'));
683
- console.log(chalk.yellow(error.message));
684
- }
660
+ // Install CLI helpers
661
+ await this.installCLIHelpers();
685
662
  }
686
663
 
687
- // Platform integration methods have been moved to lib/integrations/
688
-
689
664
  async installCLIHelpers() {
690
665
  // Create universal context.md file that references ALL standards
691
666
  // CLI tools can read this single file to understand what context is available
@@ -1461,37 +1436,73 @@ enforcement:
1461
1436
  console.log(chalk.green('✅ Policy file created'));
1462
1437
  }
1463
1438
 
1464
- showSuccessMessage(hookChoices, detectedTools = {}, projectType = '', packageManager = '') {
1439
+ async createHealthCheckCommand() {
1440
+ const healthCheckContent = `# ContextKit Health Check
1441
+
1442
+ Check this project's ContextKit setup and report status.
1443
+
1444
+ ## Steps
1445
+
1446
+ 1. Check if \`.contextkit/\` directory exists. If not → STOP and tell user: "Run \`ck install\` to set up ContextKit."
1447
+
1448
+ 2. Read \`.contextkit/config.yml\` and check the \`last_analyzed\` field.
1449
+
1450
+ 3. Check each standards file for skeleton markers. Read these files and check if they contain \`<!-- Content will be generated by running: ck analyze -->\`:
1451
+ - \`.contextkit/standards/code-style.md\`
1452
+ - \`.contextkit/standards/testing.md\`
1453
+ - \`.contextkit/standards/architecture.md\`
1454
+ - \`.contextkit/standards/ai-guidelines.md\`
1455
+ - \`.contextkit/standards/workflows.md\`
1456
+ - \`.contextkit/standards/glossary.md\`
1457
+
1458
+ 4. Check product files for placeholder content (e.g., \`[ELEVATOR_PITCH_FROM_MISSION_MD]\`):
1459
+ - \`.contextkit/product/mission-lite.md\`
1460
+ - \`.contextkit/product/decisions.md\`
1461
+ - \`.contextkit/product/roadmap.md\`
1462
+
1463
+ 5. Check which platform integrations exist:
1464
+ - \`CLAUDE.md\` → Claude Code
1465
+ - \`.cursor/rules/\` → Cursor
1466
+ - \`AGENTS.md\` → Codex
1467
+ - \`GEMINI.md\` → Gemini
1468
+ - \`CONVENTIONS.md\` → Aider
1469
+ - \`.windsurfrules\` → Windsurf
1470
+ - \`.github/copilot-instructions.md\` → Copilot
1471
+
1472
+ 6. Report findings as a status summary table and list recommended next steps.
1473
+
1474
+ ## Output Format
1475
+
1476
+ | Area | Status | Action |
1477
+ |------|--------|--------|
1478
+ | Installation | OK/Missing | \`ck install\` |
1479
+ | Standards | Populated/Skeleton | \`ck analyze\` or \`/analyze\` |
1480
+ | Product context | Populated/Placeholder | Edit \`.contextkit/product/\` files |
1481
+ | Integrations | List active | \`ck <platform>\` to add more |
1482
+
1483
+ ## Token Note
1484
+
1485
+ If standards are still skeletons, warn that @imports in CLAUDE.md are loading empty files — wasting context tokens. Run \`/analyze\` to populate them.
1486
+ `;
1487
+
1488
+ await fs.writeFile('.contextkit/commands/health-check.md', healthCheckContent);
1489
+ }
1490
+
1491
+ showSuccessMessage(hookChoices, platform = null, projectType = '', packageManager = '') {
1465
1492
  console.log('');
1466
1493
  console.log(chalk.green('🎉 ContextKit v1.0.0 successfully installed!'));
1467
1494
  console.log('');
1468
1495
 
1469
- // Show which platform integrations were configured
1470
- const { getIntegration } = require('../integrations');
1471
- const toolToIntegration = {
1472
- cursor: 'cursor',
1473
- continue: 'continue',
1474
- aider: 'aider',
1475
- aider_cli: 'aider',
1476
- vscode: 'copilot',
1477
- claude_cli: 'claude',
1478
- gemini_cli: 'gemini',
1479
- windsurf: 'windsurf',
1480
- };
1481
- const installedPlatforms = new Set();
1482
- for (const [tool, name] of Object.entries(toolToIntegration)) {
1483
- if (detectedTools[tool]) installedPlatforms.add(name);
1484
- }
1485
- if (installedPlatforms.size > 0) {
1486
- console.log(chalk.blue('🔌 Platform integrations:'));
1487
- for (const name of installedPlatforms) {
1488
- const integration = getIntegration(name);
1489
- if (integration) {
1490
- const files = [...integration.bridgeFiles, ...integration.generatedFiles];
1491
- console.log(` ${integration.displayName}: ${files.join(', ')}`);
1492
- }
1496
+ // Show which platform was installed
1497
+ if (platform) {
1498
+ const { getIntegration } = require('../integrations');
1499
+ const integration = getIntegration(platform);
1500
+ if (integration) {
1501
+ const files = [...integration.bridgeFiles, ...integration.generatedFiles];
1502
+ console.log(chalk.blue('🔌 Platform integration:'));
1503
+ console.log(` ${integration.displayName}: ${files.join(', ')}`);
1504
+ console.log('');
1493
1505
  }
1494
- console.log('');
1495
1506
  }
1496
1507
 
1497
1508
  // Quick Reference
@@ -1511,7 +1522,7 @@ enforcement:
1511
1522
  console.log(chalk.bold('🚀 NEXT STEP — GENERATE STANDARDS'));
1512
1523
  console.log(''.padEnd(48, '─'));
1513
1524
 
1514
- if (detectedTools.cursor) {
1525
+ if (platform === 'cursor') {
1515
1526
  console.log(chalk.bold('In Cursor Chat:'));
1516
1527
  console.log(` @.contextkit/commands/analyze.md`);
1517
1528
  console.log('');
@@ -1537,8 +1548,7 @@ enforcement:
1537
1548
  console.log(chalk.bold('💡 After Analyze — Try This'));
1538
1549
  console.log(''.padEnd(48, '─'));
1539
1550
 
1540
- // Platform-specific examples
1541
- if (detectedTools.cursor) {
1551
+ if (platform === 'cursor') {
1542
1552
  console.log(chalk.bold('In Cursor Chat'));
1543
1553
  console.log(`@.contextkit/commands/create-component.md`);
1544
1554
  console.log(chalk.dim('"Create a Button component for customer checkout"'));
@@ -1549,8 +1559,8 @@ enforcement:
1549
1559
  console.log(`ck ai "create a Button component for customer checkout"`);
1550
1560
  console.log('');
1551
1561
 
1552
- if (detectedTools.claude_cli || detectedTools.gemini_cli) {
1553
- const toolName = detectedTools.claude_cli ? 'Claude' : 'Gemini';
1562
+ if (platform === 'claude' || platform === 'gemini') {
1563
+ const toolName = platform === 'claude' ? 'Claude' : 'Gemini';
1554
1564
  console.log(chalk.bold(`In ${toolName} CLI`));
1555
1565
  console.log(`read .contextkit/commands/analyze.md and execute`);
1556
1566
  console.log('');
@@ -24,6 +24,7 @@ class ClaudeIntegration extends BaseIntegration {
24
24
  '.claude/commands/squad-review.md',
25
25
  '.claude/commands/squad-batch.md',
26
26
  '.claude/commands/squad-run.md',
27
+ '.claude/commands/ck.md',
27
28
  ];
28
29
  this.platformDir = '.claude/rules';
29
30
  }
@@ -240,6 +241,13 @@ Create handoff files for multiple tasks and write PO specs for each one. Pass al
240
241
  Read \`.contextkit/commands/squad-run.md\` and execute the pipeline runner workflow.
241
242
 
242
243
  Process all batch tasks through the remaining pipeline steps (Architect, Dev, Test, Review) sequentially.
244
+ `);
245
+
246
+ await this.writeGeneratedFile('.claude/commands/ck.md', `# ContextKit Health Check
247
+
248
+ Read \`.contextkit/commands/health-check.md\` and execute the health check workflow.
249
+
250
+ Check project setup, standards status, and integrations. Report what needs attention.
243
251
  `);
244
252
  }
245
253
 
@@ -265,6 +273,9 @@ Process all batch tasks through the remaining pipeline steps (Architect, Dev, Te
265
273
  console.log(chalk.dim(' /squad-review — Review and write verdict'));
266
274
  console.log(chalk.dim(' /squad-batch — Batch kickoff: PO specs for multiple tasks'));
267
275
  console.log(chalk.dim(' /squad-run — Auto-run pipeline for batch tasks'));
276
+ console.log(chalk.dim(''));
277
+ console.log(chalk.dim(' Health check:'));
278
+ console.log(chalk.dim(' /ck — Check project setup and standards status'));
268
279
  }
269
280
  }
270
281
 
@@ -25,6 +25,7 @@ class CursorIntegration extends BaseIntegration {
25
25
  '.cursor/prompts/squad-review.md',
26
26
  '.cursor/prompts/squad-batch.md',
27
27
  '.cursor/prompts/squad-run.md',
28
+ '.cursor/prompts/ck.md',
28
29
  ];
29
30
  this.bridgeFiles = [];
30
31
  this.platformDir = '.cursor/rules';
@@ -248,6 +249,13 @@ Create handoff files for multiple tasks and write PO specs for each one. Pass al
248
249
  Read \`.contextkit/commands/squad-run.md\` and execute the pipeline runner workflow.
249
250
 
250
251
  Process all batch tasks through the remaining pipeline steps (Architect, Dev, Test, Review) sequentially.
252
+ `);
253
+
254
+ await this.writeGeneratedFile('.cursor/prompts/ck.md', `# ContextKit Health Check
255
+
256
+ Read \`.contextkit/commands/health-check.md\` and execute the health check workflow.
257
+
258
+ Check project setup, standards status, and integrations. Report what needs attention.
251
259
  `);
252
260
  }
253
261
 
@@ -272,6 +280,9 @@ Process all batch tasks through the remaining pipeline steps (Architect, Dev, Te
272
280
  console.log(chalk.dim(' /squad-review — Review and write verdict'));
273
281
  console.log(chalk.dim(' /squad-batch — Batch kickoff: PO specs for multiple tasks'));
274
282
  console.log(chalk.dim(' /squad-run — Auto-run pipeline for batch tasks'));
283
+ console.log(chalk.dim(''));
284
+ console.log(chalk.dim(' Health check:'));
285
+ console.log(chalk.dim(' /ck — Check project setup and standards status'));
275
286
  }
276
287
  }
277
288
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolrm/contextkit",
3
- "version": "0.9.6",
3
+ "version": "0.10.0",
4
4
  "description": "ContextKit - Context Engineering for AI Development. Provide rich context to AI through structured MD files with standards, code guides, and documentation. Works with Cursor, Claude, Aider, VS Code Copilot, and more.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {