@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,141 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const BaseIntegration = require('./base-integration');
|
|
3
|
+
|
|
4
|
+
class ClaudeIntegration extends BaseIntegration {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.name = 'claude';
|
|
8
|
+
this.displayName = 'Claude Code';
|
|
9
|
+
this.bridgeFiles = ['CLAUDE.md'];
|
|
10
|
+
this.generatedFiles = [
|
|
11
|
+
'.claude/rules/contextkit-standards.md',
|
|
12
|
+
'.claude/rules/contextkit-testing.md',
|
|
13
|
+
'.claude/rules/contextkit-code-style.md',
|
|
14
|
+
'.claude/commands/analyze.md',
|
|
15
|
+
];
|
|
16
|
+
this.platformDir = '.claude/rules';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async install() {
|
|
20
|
+
await super.install();
|
|
21
|
+
const fs = require('fs-extra');
|
|
22
|
+
await fs.ensureDir('.claude/commands');
|
|
23
|
+
await this.removeLegacyFiles();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async removeLegacyFiles() {
|
|
27
|
+
const fs = require('fs-extra');
|
|
28
|
+
const legacyFiles = [
|
|
29
|
+
'.claude/rules/vibe-kit-standards.md',
|
|
30
|
+
'.claude/rules/vibe-kit-testing.md',
|
|
31
|
+
'.claude/rules/vibe-kit-code-style.md',
|
|
32
|
+
];
|
|
33
|
+
for (const file of legacyFiles) {
|
|
34
|
+
if (await fs.pathExists(file)) {
|
|
35
|
+
await fs.remove(file);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async generateFiles() {
|
|
41
|
+
// Bridge file: CLAUDE.md (auto-loaded every session)
|
|
42
|
+
const bridgeContent = `# Project Standards (ContextKit)
|
|
43
|
+
|
|
44
|
+
This project uses [ContextKit](https://github.com/nolrm/contextkit) for AI development standards.
|
|
45
|
+
|
|
46
|
+
${this.getStandardsBlock()}
|
|
47
|
+
|
|
48
|
+
## Corrections Log
|
|
49
|
+
|
|
50
|
+
- \`.contextkit/corrections.md\` — Track AI performance improvements
|
|
51
|
+
|
|
52
|
+
## Quick Reference
|
|
53
|
+
|
|
54
|
+
Before writing code, check the relevant standards files above. Always follow the project's established patterns and conventions.`;
|
|
55
|
+
|
|
56
|
+
await this.writeBridgeFile('CLAUDE.md', bridgeContent);
|
|
57
|
+
|
|
58
|
+
// Rule: always-apply standards pointer
|
|
59
|
+
const standardsRule = `---
|
|
60
|
+
description: ContextKit project standards - always loaded
|
|
61
|
+
alwaysApply: true
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# ContextKit Standards
|
|
65
|
+
|
|
66
|
+
This project uses ContextKit for structured development standards.
|
|
67
|
+
|
|
68
|
+
Always reference the following before generating code:
|
|
69
|
+
- \`.contextkit/standards/code-style.md\` for coding conventions
|
|
70
|
+
- \`.contextkit/standards/architecture.md\` for architecture patterns
|
|
71
|
+
- \`.contextkit/standards/ai-guidelines.md\` for AI behavior rules
|
|
72
|
+
- \`.contextkit/standards/glossary.md\` for project terminology
|
|
73
|
+
- \`.contextkit/product/mission-lite.md\` for product context
|
|
74
|
+
`;
|
|
75
|
+
await this.writeGeneratedFile('.claude/rules/contextkit-standards.md', standardsRule);
|
|
76
|
+
|
|
77
|
+
// Rule: testing standards (scoped to test files)
|
|
78
|
+
const testingRule = `---
|
|
79
|
+
description: ContextKit testing standards for test files
|
|
80
|
+
globs:
|
|
81
|
+
- "**/*.test.*"
|
|
82
|
+
- "**/*.spec.*"
|
|
83
|
+
- "**/__tests__/**"
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
# Testing Standards
|
|
87
|
+
|
|
88
|
+
When writing or modifying tests, follow:
|
|
89
|
+
- \`.contextkit/standards/testing.md\` for test patterns and requirements
|
|
90
|
+
- All test cases MUST use numbered descriptions (e.g., \`it("1. renders correctly")\`)
|
|
91
|
+
- Reference \`.contextkit/templates/test.tsx\` for test template patterns
|
|
92
|
+
`;
|
|
93
|
+
await this.writeGeneratedFile('.claude/rules/contextkit-testing.md', testingRule);
|
|
94
|
+
|
|
95
|
+
// Rule: code style (scoped to source files)
|
|
96
|
+
const codeStyleRule = `---
|
|
97
|
+
description: ContextKit code style for source files
|
|
98
|
+
globs:
|
|
99
|
+
- "src/**"
|
|
100
|
+
- "lib/**"
|
|
101
|
+
- "app/**"
|
|
102
|
+
- "packages/**"
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
# Code Style
|
|
106
|
+
|
|
107
|
+
When writing or modifying source code, follow:
|
|
108
|
+
- \`.contextkit/standards/code-style.md\` for coding conventions
|
|
109
|
+
- \`.contextkit/templates/component.tsx\` for component patterns
|
|
110
|
+
- \`.contextkit/templates/hook.ts\` for custom hook patterns
|
|
111
|
+
- \`.contextkit/templates/api.ts\` for API service patterns
|
|
112
|
+
`;
|
|
113
|
+
await this.writeGeneratedFile('.claude/rules/contextkit-code-style.md', codeStyleRule);
|
|
114
|
+
|
|
115
|
+
// Command: analyze
|
|
116
|
+
const analyzeCommand = `# Analyze Project
|
|
117
|
+
|
|
118
|
+
Read \`.contextkit/commands/analyze.md\` and execute the analysis workflow for this project.
|
|
119
|
+
|
|
120
|
+
Scan the codebase structure, detect frameworks and patterns, then generate customized standards files in \`.contextkit/standards/\`.
|
|
121
|
+
`;
|
|
122
|
+
await this.writeGeneratedFile('.claude/commands/analyze.md', analyzeCommand);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
showUsage() {
|
|
126
|
+
console.log('');
|
|
127
|
+
console.log(chalk.bold(' Claude Code Usage:'));
|
|
128
|
+
console.log(' CLAUDE.md is auto-loaded every session');
|
|
129
|
+
console.log(' .claude/rules/ are loaded based on file context');
|
|
130
|
+
console.log(' Use /analyze slash command for project analysis');
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log(chalk.dim(' Files created:'));
|
|
133
|
+
console.log(chalk.dim(' CLAUDE.md (bridge - auto-loaded)'));
|
|
134
|
+
console.log(chalk.dim(' .claude/rules/contextkit-standards.md (always apply)'));
|
|
135
|
+
console.log(chalk.dim(' .claude/rules/contextkit-testing.md (test files)'));
|
|
136
|
+
console.log(chalk.dim(' .claude/rules/contextkit-code-style.md (source files)'));
|
|
137
|
+
console.log(chalk.dim(' .claude/commands/analyze.md (slash command)'));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
module.exports = ClaudeIntegration;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const BaseIntegration = require('./base-integration');
|
|
3
|
+
|
|
4
|
+
class CodexIntegration extends BaseIntegration {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.name = 'codex';
|
|
8
|
+
this.displayName = 'OpenAI Codex CLI';
|
|
9
|
+
this.bridgeFiles = ['AGENTS.md'];
|
|
10
|
+
this.generatedFiles = [];
|
|
11
|
+
this.platformDir = '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async generateFiles() {
|
|
15
|
+
// Bridge file: AGENTS.md (auto-loaded by Codex CLI)
|
|
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(' Codex CLI Usage:'));
|
|
36
|
+
console.log(' AGENTS.md is auto-loaded by Codex CLI');
|
|
37
|
+
console.log(' Just run: codex "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 = CodexIntegration;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const BaseIntegration = require('./base-integration');
|
|
4
|
+
|
|
5
|
+
class ContinueIntegration extends BaseIntegration {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.name = 'continue';
|
|
9
|
+
this.displayName = 'Continue';
|
|
10
|
+
this.generatedFiles = [
|
|
11
|
+
'.continue/rules/contextkit-standards.md',
|
|
12
|
+
'.continue/config.yaml',
|
|
13
|
+
];
|
|
14
|
+
this.bridgeFiles = [];
|
|
15
|
+
this.platformDir = '.continue/rules';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async install() {
|
|
19
|
+
await super.install();
|
|
20
|
+
// Remove old vibe-kit-named files
|
|
21
|
+
const legacyFile = '.continue/rules/vibe-kit-standards.md';
|
|
22
|
+
if (await fs.pathExists(legacyFile)) {
|
|
23
|
+
await fs.remove(legacyFile);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async generateFiles() {
|
|
28
|
+
// Rule file with frontmatter
|
|
29
|
+
const standardsRule = `---
|
|
30
|
+
description: ContextKit project standards
|
|
31
|
+
alwaysApply: true
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# ContextKit Standards
|
|
35
|
+
|
|
36
|
+
This project uses ContextKit for structured development standards.
|
|
37
|
+
|
|
38
|
+
## References
|
|
39
|
+
|
|
40
|
+
- \`.contextkit/standards/code-style.md\` — Coding conventions
|
|
41
|
+
- \`.contextkit/standards/testing.md\` — Testing patterns (numbered test cases required)
|
|
42
|
+
- \`.contextkit/standards/architecture.md\` — Architecture patterns
|
|
43
|
+
- \`.contextkit/standards/ai-guidelines.md\` — AI behavior rules
|
|
44
|
+
- \`.contextkit/standards/glossary.md\` — Project terminology
|
|
45
|
+
|
|
46
|
+
## Commands
|
|
47
|
+
|
|
48
|
+
- \`.contextkit/commands/analyze.md\` — Analyze and customize standards
|
|
49
|
+
- \`.contextkit/commands/create-component.md\` — Create components
|
|
50
|
+
- \`.contextkit/commands/create-feature.md\` — Create features
|
|
51
|
+
- \`.contextkit/commands/run-tests.md\` — Run tests
|
|
52
|
+
- \`.contextkit/commands/quality-check.md\` — Quality checks
|
|
53
|
+
`;
|
|
54
|
+
await this.writeGeneratedFile('.continue/rules/contextkit-standards.md', standardsRule);
|
|
55
|
+
|
|
56
|
+
// config.yaml (new YAML format)
|
|
57
|
+
const configYaml = `# Continue Configuration (ContextKit)
|
|
58
|
+
# See: https://docs.continue.dev/reference
|
|
59
|
+
|
|
60
|
+
name: ContextKit Standards
|
|
61
|
+
|
|
62
|
+
rules:
|
|
63
|
+
- rules/contextkit-standards.md
|
|
64
|
+
|
|
65
|
+
context:
|
|
66
|
+
- provider: file
|
|
67
|
+
params:
|
|
68
|
+
files:
|
|
69
|
+
- .contextkit/standards/code-style.md
|
|
70
|
+
- .contextkit/standards/testing.md
|
|
71
|
+
- .contextkit/standards/architecture.md
|
|
72
|
+
- .contextkit/standards/ai-guidelines.md
|
|
73
|
+
- .contextkit/standards/glossary.md
|
|
74
|
+
- .contextkit/product/mission-lite.md
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
// Only write config.yaml if neither config.yaml nor config.json exists
|
|
78
|
+
if (!await fs.pathExists('.continue/config.yaml') && !await fs.pathExists('.continue/config.json')) {
|
|
79
|
+
await this.writeGeneratedFile('.continue/config.yaml', configYaml);
|
|
80
|
+
} else if (await fs.pathExists('.continue/config.yaml')) {
|
|
81
|
+
// Update existing yaml
|
|
82
|
+
await this.writeGeneratedFile('.continue/config.yaml', configYaml);
|
|
83
|
+
}
|
|
84
|
+
// If config.json exists, leave it alone (user may have custom config)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
showUsage() {
|
|
88
|
+
console.log('');
|
|
89
|
+
console.log(chalk.bold(' Continue Usage:'));
|
|
90
|
+
console.log(' Rules auto-load from .continue/rules/');
|
|
91
|
+
console.log(' Continue will include ContextKit context automatically');
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log(chalk.dim(' Files created:'));
|
|
94
|
+
console.log(chalk.dim(' .continue/rules/contextkit-standards.md (always apply)'));
|
|
95
|
+
console.log(chalk.dim(' .continue/config.yaml (configuration)'));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = ContinueIntegration;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const BaseIntegration = require('./base-integration');
|
|
4
|
+
|
|
5
|
+
class CopilotIntegration extends BaseIntegration {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.name = 'copilot';
|
|
9
|
+
this.displayName = 'GitHub Copilot';
|
|
10
|
+
this.bridgeFiles = ['.github/copilot-instructions.md'];
|
|
11
|
+
this.generatedFiles = [];
|
|
12
|
+
this.platformDir = '.github';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async generateFiles() {
|
|
16
|
+
// Bridge file: .github/copilot-instructions.md (auto-loaded by Copilot Chat)
|
|
17
|
+
const bridgeContent = `# Copilot Instructions (ContextKit)
|
|
18
|
+
|
|
19
|
+
This project uses [ContextKit](https://github.com/nolrm/contextkit) for AI development standards.
|
|
20
|
+
|
|
21
|
+
${this.getStandardsBlock()}
|
|
22
|
+
|
|
23
|
+
## Key Rules
|
|
24
|
+
|
|
25
|
+
- Follow coding conventions in \`.contextkit/standards/code-style.md\`
|
|
26
|
+
- Use numbered test cases as defined in \`.contextkit/standards/testing.md\`
|
|
27
|
+
- Check \`.contextkit/standards/glossary.md\` for project-specific terminology
|
|
28
|
+
- Reference \`.contextkit/templates/\` for code generation patterns`;
|
|
29
|
+
|
|
30
|
+
await this.writeBridgeFile('.github/copilot-instructions.md', bridgeContent);
|
|
31
|
+
|
|
32
|
+
// Merge VS Code settings for copilot
|
|
33
|
+
await this.mergeVSCodeSettings();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async mergeVSCodeSettings() {
|
|
37
|
+
const settingsPath = '.vscode/settings.json';
|
|
38
|
+
let settings = {};
|
|
39
|
+
|
|
40
|
+
await fs.ensureDir('.vscode');
|
|
41
|
+
|
|
42
|
+
if (await fs.pathExists(settingsPath)) {
|
|
43
|
+
try {
|
|
44
|
+
settings = await fs.readJson(settingsPath);
|
|
45
|
+
} catch {
|
|
46
|
+
settings = {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Add copilot instruction reference
|
|
51
|
+
settings['github.copilot.chat.codeGeneration.instructions'] = [
|
|
52
|
+
{ file: '.github/copilot-instructions.md' }
|
|
53
|
+
];
|
|
54
|
+
settings['vibeKit.standardsPath'] = '.contextkit/standards';
|
|
55
|
+
settings['vibeKit.templatesPath'] = '.contextkit/templates';
|
|
56
|
+
|
|
57
|
+
await fs.writeJson(settingsPath, settings, { spaces: 2 });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
showUsage() {
|
|
61
|
+
console.log('');
|
|
62
|
+
console.log(chalk.bold(' GitHub Copilot Usage:'));
|
|
63
|
+
console.log(' .github/copilot-instructions.md is auto-loaded by Copilot Chat');
|
|
64
|
+
console.log(' In Copilot Chat: @.contextkit Create a button component');
|
|
65
|
+
console.log(' Or: @.contextkit/standards Create a login form');
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log(chalk.dim(' Files created:'));
|
|
68
|
+
console.log(chalk.dim(' .github/copilot-instructions.md (auto-loaded)'));
|
|
69
|
+
console.log(chalk.dim(' .vscode/settings.json (updated with copilot config)'));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = CopilotIntegration;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const BaseIntegration = require('./base-integration');
|
|
4
|
+
|
|
5
|
+
class CursorIntegration extends BaseIntegration {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.name = 'cursor';
|
|
9
|
+
this.displayName = 'Cursor';
|
|
10
|
+
this.generatedFiles = [
|
|
11
|
+
'.cursor/rules/contextkit-standards.mdc',
|
|
12
|
+
'.cursor/rules/contextkit-testing.mdc',
|
|
13
|
+
'.cursor/rules/contextkit-components.mdc',
|
|
14
|
+
'.cursor/rules/contextkit-api.mdc',
|
|
15
|
+
];
|
|
16
|
+
this.bridgeFiles = [];
|
|
17
|
+
this.platformDir = '.cursor/rules';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async install() {
|
|
21
|
+
await super.install();
|
|
22
|
+
// Remove old monolithic rule file if present
|
|
23
|
+
await this.removeLegacyFiles();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async removeLegacyFiles() {
|
|
27
|
+
const legacyFiles = [
|
|
28
|
+
'.cursor/rules/contextkit.mdc',
|
|
29
|
+
'.cursor/rules/vibe-kit.mdc',
|
|
30
|
+
'.cursor/rules/vibe-kit-standards.mdc',
|
|
31
|
+
'.cursor/rules/vibe-kit-testing.mdc',
|
|
32
|
+
'.cursor/rules/vibe-kit-components.mdc',
|
|
33
|
+
'.cursor/rules/vibe-kit-api.mdc',
|
|
34
|
+
];
|
|
35
|
+
for (const file of legacyFiles) {
|
|
36
|
+
if (await fs.pathExists(file)) {
|
|
37
|
+
await fs.remove(file);
|
|
38
|
+
console.log(chalk.yellow(` Removed legacy ${file}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async generateFiles() {
|
|
44
|
+
// Standards rule (always apply)
|
|
45
|
+
const standardsRule = `---
|
|
46
|
+
description: ContextKit project standards
|
|
47
|
+
globs: "**/*.{ts,tsx,js,jsx,py,rs,go}"
|
|
48
|
+
alwaysApply: true
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# ContextKit Standards
|
|
52
|
+
|
|
53
|
+
This project uses ContextKit for structured development standards.
|
|
54
|
+
|
|
55
|
+
## References
|
|
56
|
+
|
|
57
|
+
- @.contextkit/standards/code-style.md — Coding conventions
|
|
58
|
+
- @.contextkit/standards/architecture.md — Architecture patterns
|
|
59
|
+
- @.contextkit/standards/ai-guidelines.md — AI behavior rules
|
|
60
|
+
- @.contextkit/standards/glossary.md — Project terminology
|
|
61
|
+
- @.contextkit/product/mission-lite.md — Product context
|
|
62
|
+
|
|
63
|
+
## Workflow
|
|
64
|
+
|
|
65
|
+
1. Check standards before generating code
|
|
66
|
+
2. Follow project patterns and conventions
|
|
67
|
+
3. Include proper testing (numbered test cases)
|
|
68
|
+
4. Ensure type safety
|
|
69
|
+
5. Run quality checks
|
|
70
|
+
`;
|
|
71
|
+
await this.writeGeneratedFile('.cursor/rules/contextkit-standards.mdc', standardsRule);
|
|
72
|
+
|
|
73
|
+
// Testing rule (scoped to test files)
|
|
74
|
+
const testingRule = `---
|
|
75
|
+
description: ContextKit testing standards
|
|
76
|
+
globs: "**/*.test.*, **/*.spec.*, **/__tests__/**"
|
|
77
|
+
alwaysApply: false
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
# Testing Standards
|
|
81
|
+
|
|
82
|
+
Reference: @.contextkit/standards/testing.md
|
|
83
|
+
|
|
84
|
+
## Required Pattern: Numbered Test Cases
|
|
85
|
+
|
|
86
|
+
All test cases MUST use numbered descriptions:
|
|
87
|
+
|
|
88
|
+
\`\`\`typescript
|
|
89
|
+
describe("ComponentName", () => {
|
|
90
|
+
it("1. renders basic component", () => { /* ... */ });
|
|
91
|
+
it("2. handles user interactions", () => { /* ... */ });
|
|
92
|
+
it("3. displays correct content", () => { /* ... */ });
|
|
93
|
+
});
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
## Templates
|
|
97
|
+
|
|
98
|
+
- @.contextkit/templates/test.tsx — Test template
|
|
99
|
+
`;
|
|
100
|
+
await this.writeGeneratedFile('.cursor/rules/contextkit-testing.mdc', testingRule);
|
|
101
|
+
|
|
102
|
+
// Components rule
|
|
103
|
+
const componentsRule = `---
|
|
104
|
+
description: ContextKit component standards
|
|
105
|
+
globs: "**/components/**"
|
|
106
|
+
alwaysApply: false
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# Component Standards
|
|
110
|
+
|
|
111
|
+
Reference: @.contextkit/standards/code-style.md
|
|
112
|
+
|
|
113
|
+
## Templates
|
|
114
|
+
|
|
115
|
+
- @.contextkit/templates/component.tsx — Component template
|
|
116
|
+
- @.contextkit/templates/story.tsx — Storybook template
|
|
117
|
+
- @.contextkit/templates/hook.ts — Custom hook template
|
|
118
|
+
|
|
119
|
+
## Commands
|
|
120
|
+
|
|
121
|
+
- @.contextkit/commands/create-component.md — Create component workflow
|
|
122
|
+
`;
|
|
123
|
+
await this.writeGeneratedFile('.cursor/rules/contextkit-components.mdc', componentsRule);
|
|
124
|
+
|
|
125
|
+
// API rule
|
|
126
|
+
const apiRule = `---
|
|
127
|
+
description: ContextKit API and services standards
|
|
128
|
+
globs: "**/api/**, **/services/**"
|
|
129
|
+
alwaysApply: false
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# API & Services Standards
|
|
133
|
+
|
|
134
|
+
Reference: @.contextkit/standards/architecture.md
|
|
135
|
+
|
|
136
|
+
## Templates
|
|
137
|
+
|
|
138
|
+
- @.contextkit/templates/api.ts — API service template
|
|
139
|
+
|
|
140
|
+
## Commands
|
|
141
|
+
|
|
142
|
+
- @.contextkit/commands/create-feature.md — Create feature workflow
|
|
143
|
+
`;
|
|
144
|
+
await this.writeGeneratedFile('.cursor/rules/contextkit-api.mdc', apiRule);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
showUsage() {
|
|
148
|
+
console.log('');
|
|
149
|
+
console.log(chalk.bold(' Cursor Usage:'));
|
|
150
|
+
console.log(' Rules auto-load based on file context');
|
|
151
|
+
console.log(' In Cursor Chat: @.contextkit/commands/analyze.md');
|
|
152
|
+
console.log(' Or: @.contextkit Create a button component');
|
|
153
|
+
console.log('');
|
|
154
|
+
console.log(chalk.dim(' Files created:'));
|
|
155
|
+
console.log(chalk.dim(' .cursor/rules/contextkit-standards.mdc (always apply)'));
|
|
156
|
+
console.log(chalk.dim(' .cursor/rules/contextkit-testing.mdc (test files)'));
|
|
157
|
+
console.log(chalk.dim(' .cursor/rules/contextkit-components.mdc (components)'));
|
|
158
|
+
console.log(chalk.dim(' .cursor/rules/contextkit-api.mdc (API/services)'));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = CursorIntegration;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const BaseIntegration = require('./base-integration');
|
|
4
|
+
|
|
5
|
+
class GeminiIntegration extends BaseIntegration {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.name = 'gemini';
|
|
9
|
+
this.displayName = 'Google Gemini CLI';
|
|
10
|
+
this.bridgeFiles = ['GEMINI.md'];
|
|
11
|
+
this.generatedFiles = ['.gemini/settings.json'];
|
|
12
|
+
this.platformDir = '.gemini';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async generateFiles() {
|
|
16
|
+
// Bridge file: GEMINI.md (auto-loaded by Gemini CLI)
|
|
17
|
+
const bridgeContent = `# Project Standards (ContextKit)
|
|
18
|
+
|
|
19
|
+
This project uses [ContextKit](https://github.com/nolrm/contextkit) for AI development standards.
|
|
20
|
+
|
|
21
|
+
${this.getStandardsBlock()}
|
|
22
|
+
|
|
23
|
+
## Corrections Log
|
|
24
|
+
|
|
25
|
+
- \`.contextkit/corrections.md\` — Track AI performance improvements
|
|
26
|
+
|
|
27
|
+
## Quick Reference
|
|
28
|
+
|
|
29
|
+
Before writing code, check the relevant standards files above. Always follow the project's established patterns and conventions.`;
|
|
30
|
+
|
|
31
|
+
await this.writeBridgeFile('GEMINI.md', bridgeContent);
|
|
32
|
+
|
|
33
|
+
// Gemini settings
|
|
34
|
+
const settings = {
|
|
35
|
+
"description": "ContextKit - Context Engineering",
|
|
36
|
+
"contextFiles": [
|
|
37
|
+
".contextkit/standards/code-style.md",
|
|
38
|
+
".contextkit/standards/testing.md",
|
|
39
|
+
".contextkit/standards/architecture.md",
|
|
40
|
+
".contextkit/standards/ai-guidelines.md",
|
|
41
|
+
".contextkit/standards/glossary.md",
|
|
42
|
+
".contextkit/product/mission-lite.md"
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
await this.writeGeneratedFile('.gemini/settings.json', JSON.stringify(settings, null, 2) + '\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
showUsage() {
|
|
50
|
+
console.log('');
|
|
51
|
+
console.log(chalk.bold(' Gemini CLI Usage:'));
|
|
52
|
+
console.log(' GEMINI.md is auto-loaded by Gemini CLI');
|
|
53
|
+
console.log(' Just run: gemini "create a button component"');
|
|
54
|
+
console.log(' Standards are automatically included via GEMINI.md');
|
|
55
|
+
console.log('');
|
|
56
|
+
console.log(chalk.dim(' Files created:'));
|
|
57
|
+
console.log(chalk.dim(' GEMINI.md (bridge - auto-loaded)'));
|
|
58
|
+
console.log(chalk.dim(' .gemini/settings.json (configuration)'));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = GeminiIntegration;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const ClaudeIntegration = require('./claude-integration');
|
|
2
|
+
const CursorIntegration = require('./cursor-integration');
|
|
3
|
+
const CopilotIntegration = require('./copilot-integration');
|
|
4
|
+
const CodexIntegration = require('./codex-integration');
|
|
5
|
+
const GeminiIntegration = require('./gemini-integration');
|
|
6
|
+
const AiderIntegration = require('./aider-integration');
|
|
7
|
+
const ContinueIntegration = require('./continue-integration');
|
|
8
|
+
const WindsurfIntegration = require('./windsurf-integration');
|
|
9
|
+
|
|
10
|
+
const INTEGRATIONS = {
|
|
11
|
+
claude: ClaudeIntegration,
|
|
12
|
+
cursor: CursorIntegration,
|
|
13
|
+
copilot: CopilotIntegration,
|
|
14
|
+
vscode: CopilotIntegration, // backward compat alias
|
|
15
|
+
codex: CodexIntegration,
|
|
16
|
+
gemini: GeminiIntegration,
|
|
17
|
+
aider: AiderIntegration,
|
|
18
|
+
continue: ContinueIntegration,
|
|
19
|
+
windsurf: WindsurfIntegration,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getIntegration(name) {
|
|
23
|
+
const IntegrationClass = INTEGRATIONS[name];
|
|
24
|
+
if (!IntegrationClass) return null;
|
|
25
|
+
return new IntegrationClass();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getAllIntegrationNames() {
|
|
29
|
+
// Return unique names (exclude aliases like vscode)
|
|
30
|
+
return ['claude', 'cursor', 'copilot', 'codex', 'gemini', 'aider', 'continue', 'windsurf'];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = { getIntegration, getAllIntegrationNames, INTEGRATIONS };
|