@nolrm/contextkit 0.7.3 → 0.8.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 +1 -1
- package/lib/commands/check.js +2 -2
- package/lib/commands/install.js +56 -26
- package/lib/commands/publish.js +5 -5
- package/lib/commands/update.js +1 -21
- package/lib/integrations/aider-integration.js +4 -4
- package/lib/integrations/claude-integration.js +4 -4
- package/lib/integrations/copilot-integration.js +3 -3
- package/lib/integrations/cursor-integration.js +5 -5
- package/lib/integrations/windsurf-integration.js +4 -4
- package/lib/utils/git-hooks.js +4 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ This creates `.contextkit/` with skeleton context files (blank templates to be f
|
|
|
47
47
|
standards/ # Skeleton files: code-style.md, testing.md, architecture.md, ai-guidelines.md, workflows.md
|
|
48
48
|
# Real files: glossary.md (universal), README.md (overview)
|
|
49
49
|
commands/ # analyze.md (project analysis & customization)
|
|
50
|
-
templates/ #
|
|
50
|
+
templates/ # skeleton template files (component, test, story, hook, api)
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
**Generate content with AI** (recommended):
|
package/lib/commands/check.js
CHANGED
|
@@ -56,8 +56,8 @@ class CheckCommand {
|
|
|
56
56
|
|
|
57
57
|
async checkManifest(config) {
|
|
58
58
|
// Check manifest schema
|
|
59
|
-
if (!config.
|
|
60
|
-
this.warnings.push('Manifest missing "
|
|
59
|
+
if (!config.ck) {
|
|
60
|
+
this.warnings.push('Manifest missing "ck" field (should be 1)');
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (!config.version) {
|
package/lib/commands/install.js
CHANGED
|
@@ -403,6 +403,55 @@ This file is loaded when HTML-related tasks are detected:
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
async createSkeletonTemplates() {
|
|
407
|
+
const skeletonFiles = {
|
|
408
|
+
'templates/component.md': `# Component Template
|
|
409
|
+
|
|
410
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
411
|
+
|
|
412
|
+
Your canonical component/module pattern will be generated based on your project's framework, language, and conventions.
|
|
413
|
+
|
|
414
|
+
Run \`ck analyze\` to generate this content, or manually add your component pattern below.
|
|
415
|
+
`,
|
|
416
|
+
'templates/test.md': `# Test Template
|
|
417
|
+
|
|
418
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
419
|
+
|
|
420
|
+
Your canonical test file pattern will be generated based on your project's testing framework and conventions.
|
|
421
|
+
|
|
422
|
+
Run \`ck analyze\` to generate this content, or manually add your test pattern below.
|
|
423
|
+
`,
|
|
424
|
+
'templates/story.md': `# Story/Demo Template
|
|
425
|
+
|
|
426
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
427
|
+
|
|
428
|
+
Your canonical story/demo pattern will be generated based on your project's documentation and showcase conventions.
|
|
429
|
+
|
|
430
|
+
Run \`ck analyze\` to generate this content, or manually add your story/demo pattern below.
|
|
431
|
+
`,
|
|
432
|
+
'templates/hook.md': `# Hook/Composable/Helper Template
|
|
433
|
+
|
|
434
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
435
|
+
|
|
436
|
+
Your canonical hook, composable, or helper pattern will be generated based on your project's framework and conventions.
|
|
437
|
+
|
|
438
|
+
Run \`ck analyze\` to generate this content, or manually add your pattern below.
|
|
439
|
+
`,
|
|
440
|
+
'templates/api.md': `# API Service/Client Template
|
|
441
|
+
|
|
442
|
+
<!-- Content will be generated by running: ck analyze -->
|
|
443
|
+
|
|
444
|
+
Your canonical API service or client pattern will be generated based on your project's architecture and conventions.
|
|
445
|
+
|
|
446
|
+
Run \`ck analyze\` to generate this content, or manually add your API pattern below.
|
|
447
|
+
`
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
for (const [relativePath, content] of Object.entries(skeletonFiles)) {
|
|
451
|
+
await fs.writeFile(`.contextkit/${relativePath}`, content);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
406
455
|
async downloadFiles(projectType, options = {}, detectedTools = {}) {
|
|
407
456
|
try {
|
|
408
457
|
// Create skeleton standards files (will be customized by analyze)
|
|
@@ -487,27 +536,8 @@ This file is loaded when HTML-related tasks are detected:
|
|
|
487
536
|
'.contextkit/types/typescript-strict.json'
|
|
488
537
|
);
|
|
489
538
|
|
|
490
|
-
//
|
|
491
|
-
await this.
|
|
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
|
-
);
|
|
539
|
+
// Create skeleton template files (will be customized by analyze)
|
|
540
|
+
await this.createSkeletonTemplates();
|
|
511
541
|
|
|
512
542
|
// Download scripts
|
|
513
543
|
await this.downloadManager.downloadFile(
|
|
@@ -631,11 +661,11 @@ claude "read .contextkit/context.md to see available standards, then create a bu
|
|
|
631
661
|
- \`.contextkit/instructions/core/auto-corrections-log.md\` - Auto-logging instructions
|
|
632
662
|
|
|
633
663
|
### Templates
|
|
634
|
-
- \`.contextkit/templates/component.
|
|
635
|
-
- \`.contextkit/templates/test.
|
|
636
|
-
- \`.contextkit/templates/story.
|
|
637
|
-
- \`.contextkit/templates/hook.
|
|
638
|
-
- \`.contextkit/templates/api.
|
|
664
|
+
- \`.contextkit/templates/component.md\`
|
|
665
|
+
- \`.contextkit/templates/test.md\`
|
|
666
|
+
- \`.contextkit/templates/story.md\`
|
|
667
|
+
- \`.contextkit/templates/hook.md\`
|
|
668
|
+
- \`.contextkit/templates/api.md\`
|
|
639
669
|
|
|
640
670
|
### Tracking
|
|
641
671
|
- \`.contextkit/corrections.md\` - AI performance corrections log
|
package/lib/commands/publish.js
CHANGED
|
@@ -49,7 +49,7 @@ class PublishCommand {
|
|
|
49
49
|
'.git'
|
|
50
50
|
];
|
|
51
51
|
|
|
52
|
-
await this.
|
|
52
|
+
await this.copyContextKitFiles('.contextkit', packageDir, excludePatterns);
|
|
53
53
|
|
|
54
54
|
// Create package.json for the published package
|
|
55
55
|
const config = await this.loadConfig();
|
|
@@ -57,8 +57,8 @@ class PublishCommand {
|
|
|
57
57
|
name: name,
|
|
58
58
|
version: version,
|
|
59
59
|
description: `ContextKit configuration for ${config.project_name || 'project'}`,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
contextKit: {
|
|
61
|
+
ck: config.ck || 1,
|
|
62
62
|
profile: config.profile,
|
|
63
63
|
generated_at: new Date().toISOString(),
|
|
64
64
|
published_at: new Date().toISOString()
|
|
@@ -140,7 +140,7 @@ ${version} - Published ${new Date().toISOString().split('T')[0]}
|
|
|
140
140
|
console.log(chalk.dim(`Registry location: ${this.registryPath}`));
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
async
|
|
143
|
+
async copyContextKitFiles(sourceDir, targetDir, excludePatterns) {
|
|
144
144
|
const files = await fs.readdir(sourceDir, { withFileTypes: true });
|
|
145
145
|
|
|
146
146
|
for (const file of files) {
|
|
@@ -158,7 +158,7 @@ ${version} - Published ${new Date().toISOString().split('T')[0]}
|
|
|
158
158
|
|
|
159
159
|
if (file.isDirectory()) {
|
|
160
160
|
await fs.ensureDir(targetPath);
|
|
161
|
-
await this.
|
|
161
|
+
await this.copyContextKitFiles(sourcePath, targetPath, excludePatterns);
|
|
162
162
|
} else {
|
|
163
163
|
await fs.copy(sourcePath, targetPath);
|
|
164
164
|
}
|
package/lib/commands/update.js
CHANGED
|
@@ -255,27 +255,7 @@ class UpdateCommand {
|
|
|
255
255
|
'.contextkit/types/typescript-strict.json'
|
|
256
256
|
);
|
|
257
257
|
|
|
258
|
-
//
|
|
259
|
-
await this.downloadManager.downloadFile(
|
|
260
|
-
`${this.repoUrl}/templates/component.tsx`,
|
|
261
|
-
'.contextkit/templates/component.tsx'
|
|
262
|
-
);
|
|
263
|
-
await this.downloadManager.downloadFile(
|
|
264
|
-
`${this.repoUrl}/templates/test.tsx`,
|
|
265
|
-
'.contextkit/templates/test.tsx'
|
|
266
|
-
);
|
|
267
|
-
await this.downloadManager.downloadFile(
|
|
268
|
-
`${this.repoUrl}/templates/story.tsx`,
|
|
269
|
-
'.contextkit/templates/story.tsx'
|
|
270
|
-
);
|
|
271
|
-
await this.downloadManager.downloadFile(
|
|
272
|
-
`${this.repoUrl}/templates/hook.ts`,
|
|
273
|
-
'.contextkit/templates/hook.ts'
|
|
274
|
-
);
|
|
275
|
-
await this.downloadManager.downloadFile(
|
|
276
|
-
`${this.repoUrl}/templates/api.ts`,
|
|
277
|
-
'.contextkit/templates/api.ts'
|
|
278
|
-
);
|
|
258
|
+
// Templates are user-owned skeleton files — not overwritten during update
|
|
279
259
|
|
|
280
260
|
// Download scripts
|
|
281
261
|
await this.downloadManager.downloadFile(
|
|
@@ -47,10 +47,10 @@ ${this.getStandardsBlock()}
|
|
|
47
47
|
|
|
48
48
|
## Templates
|
|
49
49
|
|
|
50
|
-
- @.contextkit/templates/component.
|
|
51
|
-
- @.contextkit/templates/test.
|
|
52
|
-
- @.contextkit/templates/hook.
|
|
53
|
-
- @.contextkit/templates/api.
|
|
50
|
+
- @.contextkit/templates/component.md — Component template
|
|
51
|
+
- @.contextkit/templates/test.md — Test template
|
|
52
|
+
- @.contextkit/templates/hook.md — Custom hook template
|
|
53
|
+
- @.contextkit/templates/api.md — API service template
|
|
54
54
|
|
|
55
55
|
## Always Include
|
|
56
56
|
|
|
@@ -88,7 +88,7 @@ globs:
|
|
|
88
88
|
When writing or modifying tests, follow:
|
|
89
89
|
- \`.contextkit/standards/testing.md\` for test patterns and requirements
|
|
90
90
|
- All test cases MUST use numbered descriptions (e.g., \`it("1. renders correctly")\`)
|
|
91
|
-
- Reference \`.contextkit/templates/test.
|
|
91
|
+
- Reference \`.contextkit/templates/test.md\` for test template patterns
|
|
92
92
|
`;
|
|
93
93
|
await this.writeGeneratedFile('.claude/rules/contextkit-testing.md', testingRule);
|
|
94
94
|
|
|
@@ -106,9 +106,9 @@ globs:
|
|
|
106
106
|
|
|
107
107
|
When writing or modifying source code, follow:
|
|
108
108
|
- \`.contextkit/standards/code-style.md\` for coding conventions
|
|
109
|
-
- \`.contextkit/templates/component.
|
|
110
|
-
- \`.contextkit/templates/hook.
|
|
111
|
-
- \`.contextkit/templates/api.
|
|
109
|
+
- \`.contextkit/templates/component.md\` for component patterns
|
|
110
|
+
- \`.contextkit/templates/hook.md\` for custom hook patterns
|
|
111
|
+
- \`.contextkit/templates/api.md\` for API service patterns
|
|
112
112
|
`;
|
|
113
113
|
await this.writeGeneratedFile('.claude/rules/contextkit-code-style.md', codeStyleRule);
|
|
114
114
|
|
|
@@ -25,7 +25,7 @@ ${this.getStandardsBlock()}
|
|
|
25
25
|
- Follow coding conventions in \`.contextkit/standards/code-style.md\`
|
|
26
26
|
- Use numbered test cases as defined in \`.contextkit/standards/testing.md\`
|
|
27
27
|
- Check \`.contextkit/standards/glossary.md\` for project-specific terminology
|
|
28
|
-
- Reference \`.contextkit/templates/\` for code generation patterns`;
|
|
28
|
+
- Reference \`.contextkit/templates/\` for code generation patterns (skeleton .md files)`;
|
|
29
29
|
|
|
30
30
|
await this.writeBridgeFile('.github/copilot-instructions.md', bridgeContent);
|
|
31
31
|
|
|
@@ -51,8 +51,8 @@ ${this.getStandardsBlock()}
|
|
|
51
51
|
settings['github.copilot.chat.codeGeneration.instructions'] = [
|
|
52
52
|
{ file: '.github/copilot-instructions.md' }
|
|
53
53
|
];
|
|
54
|
-
settings['
|
|
55
|
-
settings['
|
|
54
|
+
settings['contextKit.standardsPath'] = '.contextkit/standards';
|
|
55
|
+
settings['contextKit.templatesPath'] = '.contextkit/templates';
|
|
56
56
|
|
|
57
57
|
await fs.writeJson(settingsPath, settings, { spaces: 2 });
|
|
58
58
|
}
|
|
@@ -95,7 +95,7 @@ describe("ComponentName", () => {
|
|
|
95
95
|
|
|
96
96
|
## Templates
|
|
97
97
|
|
|
98
|
-
- @.contextkit/templates/test.
|
|
98
|
+
- @.contextkit/templates/test.md — Test template
|
|
99
99
|
`;
|
|
100
100
|
await this.writeGeneratedFile('.cursor/rules/contextkit-testing.mdc', testingRule);
|
|
101
101
|
|
|
@@ -112,9 +112,9 @@ Reference: @.contextkit/standards/code-style.md
|
|
|
112
112
|
|
|
113
113
|
## Templates
|
|
114
114
|
|
|
115
|
-
- @.contextkit/templates/component.
|
|
116
|
-
- @.contextkit/templates/story.
|
|
117
|
-
- @.contextkit/templates/hook.
|
|
115
|
+
- @.contextkit/templates/component.md — Component template
|
|
116
|
+
- @.contextkit/templates/story.md — Story/demo template
|
|
117
|
+
- @.contextkit/templates/hook.md — Custom hook template
|
|
118
118
|
|
|
119
119
|
## Commands
|
|
120
120
|
|
|
@@ -135,7 +135,7 @@ Reference: @.contextkit/standards/architecture.md
|
|
|
135
135
|
|
|
136
136
|
## Templates
|
|
137
137
|
|
|
138
|
-
- @.contextkit/templates/api.
|
|
138
|
+
- @.contextkit/templates/api.md — API service template
|
|
139
139
|
|
|
140
140
|
## Commands
|
|
141
141
|
|
|
@@ -59,10 +59,10 @@ This project uses ContextKit for structured development standards.
|
|
|
59
59
|
|
|
60
60
|
## Templates
|
|
61
61
|
|
|
62
|
-
- \`.contextkit/templates/component.
|
|
63
|
-
- \`.contextkit/templates/test.
|
|
64
|
-
- \`.contextkit/templates/hook.
|
|
65
|
-
- \`.contextkit/templates/api.
|
|
62
|
+
- \`.contextkit/templates/component.md\` — Component template
|
|
63
|
+
- \`.contextkit/templates/test.md\` — Test template
|
|
64
|
+
- \`.contextkit/templates/hook.md\` — Custom hook template
|
|
65
|
+
- \`.contextkit/templates/api.md\` — API service template
|
|
66
66
|
|
|
67
67
|
## Commands
|
|
68
68
|
|
package/lib/utils/git-hooks.js
CHANGED
|
@@ -154,7 +154,6 @@ fi
|
|
|
154
154
|
|
|
155
155
|
// Add new hooks
|
|
156
156
|
const hooks = [
|
|
157
|
-
{ name: 'pre-commit', script: '.contextkit/hooks/pre-commit.sh' },
|
|
158
157
|
{ name: 'pre-push', script: '.contextkit/hooks/pre-push.sh' },
|
|
159
158
|
{ name: 'commit-msg', script: '.contextkit/hooks/commit-msg.sh' }
|
|
160
159
|
];
|
|
@@ -184,8 +183,8 @@ ${scriptPath}
|
|
|
184
183
|
}
|
|
185
184
|
|
|
186
185
|
async backupExistingHooks() {
|
|
187
|
-
const hooks = ['pre-
|
|
188
|
-
|
|
186
|
+
const hooks = ['pre-push', 'commit-msg'];
|
|
187
|
+
|
|
189
188
|
for (const hook of hooks) {
|
|
190
189
|
const hookPath = `${this.hooksDir}/${hook}`;
|
|
191
190
|
if (fs.existsSync(hookPath)) {
|
|
@@ -208,8 +207,8 @@ ${scriptPath}
|
|
|
208
207
|
async uninstallHooks() {
|
|
209
208
|
console.log(chalk.yellow('🪝 Removing Git hooks...'));
|
|
210
209
|
|
|
211
|
-
const hooks = ['pre-
|
|
212
|
-
|
|
210
|
+
const hooks = ['pre-push', 'commit-msg'];
|
|
211
|
+
|
|
213
212
|
for (const hook of hooks) {
|
|
214
213
|
const hookPath = `${this.hooksDir}/${hook}`;
|
|
215
214
|
const backupPath = `${hookPath}.backup`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolrm/contextkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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": {
|