@nolrm/contextkit 0.11.0 → 0.12.4

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Context Engineering for AI Development
4
4
 
5
- Give your AI assistants (Cursor, Claude, Copilot, Codex, Gemini, Aider, Continue, Windsurf) structured context through markdown files. ContextKit creates a knowledge base that ensures AI generates code matching your exact patterns, style, and architecture—no more hallucinated code or mismatched conventions.
5
+ Give your AI assistants (Cursor, Claude, Copilot, Codex, OpenCode, Gemini, Aider, Continue, Windsurf) structured context through markdown files. ContextKit creates a knowledge base that ensures AI generates code matching your exact patterns, style, and architecture—no more hallucinated code or mismatched conventions.
6
6
 
7
7
  ContextKit is a CLI tool that provides **context-engineering** capabilities by creating `.contextkit/` directories with project standards, guidelines, and patterns that AI assistants read automatically.
8
8
 
@@ -21,7 +21,7 @@ Update `.md` files as your project evolves; the AI follows.
21
21
 
22
22
  ## Multi-Platform Support
23
23
 
24
- Works with: **Cursor** • **Claude Code** • **GitHub Copilot** • **Codex CLI** • **Gemini CLI** • **Aider** • **Continue** • **Windsurf**
24
+ Works with: **Cursor** • **Claude Code** • **GitHub Copilot** • **Codex CLI** • **OpenCode** • **Gemini CLI** • **Aider** • **Continue** • **Windsurf**
25
25
 
26
26
  Each platform gets auto-loaded bridge files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.windsurfrules`, etc.) so your AI tools read project standards automatically. Claude Code uses `@` imports in CLAUDE.md to load standards content directly into context — no extra token cost from manual file reads.
27
27
 
@@ -32,15 +32,19 @@ Each platform gets auto-loaded bridge files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.m
32
32
  **Requirements:** Node.js 14.x+ (16.x+ recommended) and npm/yarn. Optional: Git for hooks, AI tools for usage.
33
33
 
34
34
  ```bash
35
- # Step 1: Install globally (recommended)
35
+ # Step 1: Install the CLI globally (one-time, any machine)
36
36
  npm i -g @nolrm/contextkit
37
37
 
38
- # Step 2: Navigate to your project and install
38
+ # Step 2: Initialize in your project (once per project)
39
39
  cd your-project
40
40
  contextkit install # interactive — prompts "Which AI tool?"
41
41
  contextkit install claude # or specify your platform directly
42
42
  ```
43
43
 
44
+ > **Project-level only.** `ck install` creates `.contextkit/` in your current directory and commits it with your project. There is no global mode — your standards live in git, not on your machine. This keeps them portable, CI-compatible, and shared with your team.
45
+
46
+ > **Tip:** Need to share standards across projects? Push your `.contextkit/` to a shared repo and pull it with `ck pull`.
47
+
44
48
  This creates `.contextkit/` with skeleton context files (blank templates to be filled by AI):
45
49
 
46
50
  ```
@@ -76,6 +80,7 @@ ck claude # creates CLAUDE.md + .claude/rules/
76
80
  ck cursor # creates .cursor/rules/ (scoped .mdc files)
77
81
  ck copilot # creates .github/copilot-instructions.md
78
82
  ck codex # creates AGENTS.md
83
+ ck opencode # creates AGENTS.md
79
84
  ck gemini # creates GEMINI.md + .gemini/settings.json
80
85
  ck aider # creates CONVENTIONS.md + .aider/rules.md
81
86
  ck continue # creates .continue/rules/ + config.yaml
@@ -136,6 +141,11 @@ claude "create checkout flow for customer"
136
141
  codex "create checkout flow for customer"
137
142
  ```
138
143
 
144
+ **OpenCode** — reads `AGENTS.md` automatically
145
+ ```bash
146
+ opencode "create checkout flow for customer"
147
+ ```
148
+
139
149
  **CLI** (Chat with AI)
140
150
  ```bash
141
151
  ck ai "create a button"
@@ -284,7 +294,7 @@ Hooks are optional and can be skipped with `ck install --no-hooks`.
284
294
  - 🧠 **Context Engineering** - Structured MD files your AI reads automatically
285
295
  - 🔍 **Smart Analysis** - AI generates standards content based on your codebase
286
296
  - 🌍 **Project Agnostic** - Works with React, Vue, Node.js, PHP, Python, Rust, monorepos—any project type
287
- - 🤖 **Multi-Platform** - Works with Cursor, Claude Code, Copilot, Codex, Gemini, Aider, Continue, Windsurf
297
+ - 🤖 **Multi-Platform** - Works with Cursor, Claude Code, Copilot, Codex, OpenCode, Gemini, Aider, Continue, Windsurf
288
298
  - 🛡️ **Safe Install** - Backs up existing files with rollback support
289
299
  - ⚡ **Zero Config** - Auto-detects project type and package manager
290
300
  - ✅ **Policy Enforcement** - Configurable validation with `ck check`
@@ -303,6 +313,7 @@ ck claude # add Claude Code integration (CLAUDE.md + rules)
303
313
  ck cursor # add Cursor integration (scoped .mdc rules)
304
314
  ck copilot # add GitHub Copilot integration
305
315
  ck codex # add Codex CLI integration (AGENTS.md)
316
+ ck opencode # add OpenCode integration (AGENTS.md)
306
317
  ck gemini # add Gemini CLI integration (GEMINI.md)
307
318
  ck aider # add Aider integration (CONVENTIONS.md)
308
319
  ck continue # add Continue integration
package/bin/contextkit.js CHANGED
@@ -22,7 +22,7 @@ program
22
22
  // Install command
23
23
  program
24
24
  .command('install [platform]')
25
- .description('Install ContextKit in current project')
25
+ .description('Initialize ContextKit in the current project directory (run once per project, not global)')
26
26
  .option('--no-hooks', 'Skip Git hooks installation')
27
27
  .option('--non-interactive', 'Skip interactive prompts')
28
28
  .action(async (platform, options) => {
@@ -275,6 +275,19 @@ program
275
275
  }
276
276
  });
277
277
 
278
+ program
279
+ .command('opencode')
280
+ .description('Install OpenCode integration only')
281
+ .option('--non-interactive', 'Skip interactive prompts')
282
+ .action(async (options) => {
283
+ try {
284
+ await install({ platform: 'opencode', ...options });
285
+ } catch (error) {
286
+ console.error(chalk.red('Installation failed:'), error.message);
287
+ process.exit(1);
288
+ }
289
+ });
290
+
278
291
  program
279
292
  .command('copilot')
280
293
  .description('Install GitHub Copilot integration only')
@@ -36,6 +36,15 @@ class InstallCommand {
36
36
  console.log(chalk.yellow('🧹 Removed legacy pre-commit hook (replaced by pre-push)'));
37
37
  }
38
38
 
39
+ // Warn if run outside a project directory
40
+ const hasGit = await this._findFileUpward('.git', 3);
41
+ const hasPkg = await fs.pathExists('package.json');
42
+ if (!hasGit && !hasPkg) {
43
+ console.log(chalk.yellow('⚠️ No project detected (no .git or package.json found in this directory).'));
44
+ console.log(chalk.yellow(' Make sure you are inside your project before running `ck install`.'));
45
+ console.log('');
46
+ }
47
+
39
48
  const requestedPlatform = options.platform;
40
49
  const isFullInstall = !!options.fullInstall;
41
50
 
@@ -127,7 +136,7 @@ class InstallCommand {
127
136
 
128
137
  if (!integration) {
129
138
  console.log(chalk.red(`❌ Unknown platform: ${platform}`));
130
- console.log(chalk.yellow('💡 Available: claude, cursor, copilot, codex, gemini, aider, continue, windsurf'));
139
+ console.log(chalk.yellow('💡 Available: claude, cursor, copilot, codex, opencode, gemini, aider, continue, windsurf'));
131
140
  return;
132
141
  }
133
142
 
@@ -178,6 +187,7 @@ class InstallCommand {
178
187
  { name: 'Cursor', value: 'cursor' },
179
188
  { name: 'Copilot (GitHub)', value: 'copilot' },
180
189
  { name: 'Codex (OpenAI)', value: 'codex' },
190
+ { name: 'OpenCode', value: 'opencode' },
181
191
  { name: 'Gemini', value: 'gemini' },
182
192
  { name: 'Windsurf', value: 'windsurf' },
183
193
  { name: 'Aider', value: 'aider' },
@@ -1515,7 +1525,7 @@ If standards are still skeletons, warn that @imports in CLAUDE.md are loading em
1515
1525
  console.log(''.padEnd(48, '─'));
1516
1526
  console.log(`ck status → Check installation & integrations`);
1517
1527
  console.log(`ck ai <cmd> → Use AI with project context`);
1518
- console.log(`ck <platform> → Add platform (claude, cursor, copilot, codex, gemini, aider, continue, windsurf)`);
1528
+ console.log(`ck <platform> → Add platform (claude, cursor, copilot, codex, opencode, gemini, aider, continue, windsurf)`);
1519
1529
  console.log('');
1520
1530
  console.log(`Docs → ${chalk.blue('https://contextkit-docs.vercel.app')}`);
1521
1531
  console.log(`Issues → ${chalk.blue('https://github.com/nolrm/contextkit/issues')}`);
@@ -1573,6 +1583,17 @@ If standards are still skeletons, warn that @imports in CLAUDE.md are loading em
1573
1583
  console.log(chalk.magenta('✨ Done! Your AI now understands your project.'));
1574
1584
  console.log('');
1575
1585
  }
1586
+
1587
+ async _findFileUpward(name, maxLevels) {
1588
+ let dir = process.cwd();
1589
+ for (let i = 0; i <= maxLevels; i++) {
1590
+ if (await fs.pathExists(path.join(dir, name))) return true;
1591
+ const parent = path.dirname(dir);
1592
+ if (parent === dir) break;
1593
+ dir = parent;
1594
+ }
1595
+ return false;
1596
+ }
1576
1597
  }
1577
1598
 
1578
1599
  async function install(options) {
@@ -2,6 +2,7 @@ const ClaudeIntegration = require('./claude-integration');
2
2
  const CursorIntegration = require('./cursor-integration');
3
3
  const CopilotIntegration = require('./copilot-integration');
4
4
  const CodexIntegration = require('./codex-integration');
5
+ const OpencodeIntegration = require('./opencode-integration');
5
6
  const GeminiIntegration = require('./gemini-integration');
6
7
  const AiderIntegration = require('./aider-integration');
7
8
  const ContinueIntegration = require('./continue-integration');
@@ -13,6 +14,7 @@ const INTEGRATIONS = {
13
14
  copilot: CopilotIntegration,
14
15
  vscode: CopilotIntegration, // backward compat alias
15
16
  codex: CodexIntegration,
17
+ opencode: OpencodeIntegration,
16
18
  gemini: GeminiIntegration,
17
19
  aider: AiderIntegration,
18
20
  continue: ContinueIntegration,
@@ -27,7 +29,7 @@ function getIntegration(name) {
27
29
 
28
30
  function getAllIntegrationNames() {
29
31
  // Return unique names (exclude aliases like vscode)
30
- return ['claude', 'cursor', 'copilot', 'codex', 'gemini', 'aider', 'continue', 'windsurf'];
32
+ return ['claude', 'cursor', 'copilot', 'codex', 'opencode', 'gemini', 'aider', 'continue', 'windsurf'];
31
33
  }
32
34
 
33
35
  module.exports = { getIntegration, getAllIntegrationNames, INTEGRATIONS };
@@ -0,0 +1,45 @@
1
+ const chalk = require('chalk');
2
+ const BaseIntegration = require('./base-integration');
3
+
4
+ class OpencodeIntegration extends BaseIntegration {
5
+ constructor() {
6
+ super();
7
+ this.name = 'opencode';
8
+ this.displayName = 'OpenCode';
9
+ this.bridgeFiles = ['AGENTS.md'];
10
+ this.generatedFiles = [];
11
+ this.platformDir = '';
12
+ }
13
+
14
+ async generateFiles() {
15
+ // Bridge file: AGENTS.md (auto-loaded by OpenCode)
16
+ const bridgeContent = `# Project Standards (ContextKit)
17
+
18
+ This project uses [ContextKit](https://github.com/nolrm/contextkit) for AI development standards.
19
+
20
+ ${this.getStandardsBlock()}
21
+
22
+ ## Corrections Log
23
+
24
+ - \`.contextkit/corrections.md\` — Track AI performance improvements
25
+
26
+ ## Quick Reference
27
+
28
+ Before writing code, check the relevant standards files above. Always follow the project's established patterns and conventions.`;
29
+
30
+ await this.writeBridgeFile('AGENTS.md', bridgeContent);
31
+ }
32
+
33
+ showUsage() {
34
+ console.log('');
35
+ console.log(chalk.bold(' OpenCode Usage:'));
36
+ console.log(' AGENTS.md is auto-loaded by OpenCode');
37
+ console.log(' Just run: opencode "create a button component"');
38
+ console.log(' Standards are automatically included via AGENTS.md');
39
+ console.log('');
40
+ console.log(chalk.dim(' Files created:'));
41
+ console.log(chalk.dim(' AGENTS.md (bridge - auto-loaded)'));
42
+ }
43
+ }
44
+
45
+ module.exports = OpencodeIntegration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolrm/contextkit",
3
- "version": "0.11.0",
3
+ "version": "0.12.4",
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": {