@nolrm/contextkit 0.7.4 โ†’ 0.8.1

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
@@ -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/ # example component template
50
+ templates/ # skeleton template files (component, test, story, hook, api)
51
51
  ```
52
52
 
53
53
  **Generate content with AI** (recommended):
@@ -31,6 +31,13 @@ class InstallCommand {
31
31
  console.log('');
32
32
  }
33
33
 
34
+ // Clean up legacy pre-commit hook (replaced by pre-push only)
35
+ const legacyPreCommit = '.contextkit/hooks/pre-commit.sh';
36
+ if (await fs.pathExists(legacyPreCommit)) {
37
+ await fs.remove(legacyPreCommit);
38
+ console.log(chalk.yellow('๐Ÿงน Removed legacy pre-commit hook (replaced by pre-push)'));
39
+ }
40
+
34
41
  const requestedPlatform = options.platform;
35
42
  const isPlatformSpecific = !!requestedPlatform;
36
43
 
@@ -178,8 +185,8 @@ class InstallCommand {
178
185
  console.log('โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€');
179
186
  console.log(chalk.blue('โš™๏ธ Git Hooks Setup'));
180
187
  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.');
188
+ console.log('ContextKit can install **pre-push** and **commit-msg** hooks');
189
+ console.log('to automatically run tests, linting, and type checks before pushing.');
183
190
  console.log('');
184
191
  console.log('');
185
192
 
@@ -403,6 +410,55 @@ This file is loaded when HTML-related tasks are detected:
403
410
  }
404
411
  }
405
412
 
413
+ async createSkeletonTemplates() {
414
+ const skeletonFiles = {
415
+ 'templates/component.md': `# Component Template
416
+
417
+ <!-- Content will be generated by running: ck analyze -->
418
+
419
+ Your canonical component/module pattern will be generated based on your project's framework, language, and conventions.
420
+
421
+ Run \`ck analyze\` to generate this content, or manually add your component pattern below.
422
+ `,
423
+ 'templates/test.md': `# Test Template
424
+
425
+ <!-- Content will be generated by running: ck analyze -->
426
+
427
+ Your canonical test file pattern will be generated based on your project's testing framework and conventions.
428
+
429
+ Run \`ck analyze\` to generate this content, or manually add your test pattern below.
430
+ `,
431
+ 'templates/story.md': `# Story/Demo Template
432
+
433
+ <!-- Content will be generated by running: ck analyze -->
434
+
435
+ Your canonical story/demo pattern will be generated based on your project's documentation and showcase conventions.
436
+
437
+ Run \`ck analyze\` to generate this content, or manually add your story/demo pattern below.
438
+ `,
439
+ 'templates/hook.md': `# Hook/Composable/Helper Template
440
+
441
+ <!-- Content will be generated by running: ck analyze -->
442
+
443
+ Your canonical hook, composable, or helper pattern will be generated based on your project's framework and conventions.
444
+
445
+ Run \`ck analyze\` to generate this content, or manually add your pattern below.
446
+ `,
447
+ 'templates/api.md': `# API Service/Client Template
448
+
449
+ <!-- Content will be generated by running: ck analyze -->
450
+
451
+ Your canonical API service or client pattern will be generated based on your project's architecture and conventions.
452
+
453
+ Run \`ck analyze\` to generate this content, or manually add your API pattern below.
454
+ `
455
+ };
456
+
457
+ for (const [relativePath, content] of Object.entries(skeletonFiles)) {
458
+ await fs.writeFile(`.contextkit/${relativePath}`, content);
459
+ }
460
+ }
461
+
406
462
  async downloadFiles(projectType, options = {}, detectedTools = {}) {
407
463
  try {
408
464
  // Create skeleton standards files (will be customized by analyze)
@@ -451,11 +507,7 @@ This file is loaded when HTML-related tasks are detected:
451
507
  '.contextkit/commands/analyze.md'
452
508
  );
453
509
 
454
- // Download hooks
455
- await this.downloadManager.downloadFile(
456
- `${this.repoUrl}/hooks/pre-commit.sh`,
457
- '.contextkit/hooks/pre-commit.sh'
458
- );
510
+ // Download hooks (pre-push and commit-msg only, no pre-commit)
459
511
  await this.downloadManager.downloadFile(
460
512
  `${this.repoUrl}/hooks/pre-push.sh`,
461
513
  '.contextkit/hooks/pre-push.sh'
@@ -487,27 +539,8 @@ This file is loaded when HTML-related tasks are detected:
487
539
  '.contextkit/types/typescript-strict.json'
488
540
  );
489
541
 
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
- );
542
+ // Create skeleton template files (will be customized by analyze)
543
+ await this.createSkeletonTemplates();
511
544
 
512
545
  // Download scripts
513
546
  await this.downloadManager.downloadFile(
@@ -516,7 +549,6 @@ This file is loaded when HTML-related tasks are detected:
516
549
  );
517
550
 
518
551
  // Make scripts executable
519
- await fs.chmod('.contextkit/hooks/pre-commit.sh', '755');
520
552
  await fs.chmod('.contextkit/hooks/pre-push.sh', '755');
521
553
  await fs.chmod('.contextkit/hooks/commit-msg.sh', '755');
522
554
  await fs.chmod('.contextkit/hooks/setup-hooks.sh', '755');
@@ -631,11 +663,11 @@ claude "read .contextkit/context.md to see available standards, then create a bu
631
663
  - \`.contextkit/instructions/core/auto-corrections-log.md\` - Auto-logging instructions
632
664
 
633
665
  ### 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\`
666
+ - \`.contextkit/templates/component.md\`
667
+ - \`.contextkit/templates/test.md\`
668
+ - \`.contextkit/templates/story.md\`
669
+ - \`.contextkit/templates/hook.md\`
670
+ - \`.contextkit/templates/api.md\`
639
671
 
640
672
  ### Tracking
641
673
  - \`.contextkit/corrections.md\` - AI performance corrections log
@@ -45,6 +45,13 @@ class UpdateCommand {
45
45
  const projectType = this.projectDetector.detectProjectType();
46
46
  const packageManager = this.projectDetector.detectPackageManager();
47
47
 
48
+ // Clean up legacy pre-commit hook (replaced by pre-push only)
49
+ const legacyPreCommit = '.contextkit/hooks/pre-commit.sh';
50
+ if (await fs.pathExists(legacyPreCommit)) {
51
+ await fs.remove(legacyPreCommit);
52
+ console.log(chalk.yellow('๐Ÿงน Removed legacy pre-commit hook (replaced by pre-push)'));
53
+ }
54
+
48
55
  // Download latest files
49
56
  await this.downloadFiles(projectType);
50
57
 
@@ -219,11 +226,7 @@ class UpdateCommand {
219
226
  '.contextkit/commands/analyze.md'
220
227
  );
221
228
 
222
- // Download hooks
223
- await this.downloadManager.downloadFile(
224
- `${this.repoUrl}/hooks/pre-commit.sh`,
225
- '.contextkit/hooks/pre-commit.sh'
226
- );
229
+ // Download hooks (pre-push and commit-msg only, no pre-commit)
227
230
  await this.downloadManager.downloadFile(
228
231
  `${this.repoUrl}/hooks/pre-push.sh`,
229
232
  '.contextkit/hooks/pre-push.sh'
@@ -255,27 +258,7 @@ class UpdateCommand {
255
258
  '.contextkit/types/typescript-strict.json'
256
259
  );
257
260
 
258
- // Download templates
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
- );
261
+ // Templates are user-owned skeleton files โ€” not overwritten during update
279
262
 
280
263
  // Download scripts
281
264
  await this.downloadManager.downloadFile(
@@ -284,7 +267,6 @@ class UpdateCommand {
284
267
  );
285
268
 
286
269
  // Make scripts executable
287
- await fs.chmod('.contextkit/hooks/pre-commit.sh', '755');
288
270
  await fs.chmod('.contextkit/hooks/pre-push.sh', '755');
289
271
  await fs.chmod('.contextkit/hooks/commit-msg.sh', '755');
290
272
  await fs.chmod('.contextkit/hooks/setup-hooks.sh', '755');
@@ -47,10 +47,10 @@ ${this.getStandardsBlock()}
47
47
 
48
48
  ## Templates
49
49
 
50
- - @.contextkit/templates/component.tsx โ€” Component template
51
- - @.contextkit/templates/test.tsx โ€” Test template
52
- - @.contextkit/templates/hook.ts โ€” Custom hook template
53
- - @.contextkit/templates/api.ts โ€” API service template
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.tsx\` for test template patterns
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.tsx\` for component patterns
110
- - \`.contextkit/templates/hook.ts\` for custom hook patterns
111
- - \`.contextkit/templates/api.ts\` for API service patterns
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
 
@@ -95,7 +95,7 @@ describe("ComponentName", () => {
95
95
 
96
96
  ## Templates
97
97
 
98
- - @.contextkit/templates/test.tsx โ€” Test template
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.tsx โ€” Component template
116
- - @.contextkit/templates/story.tsx โ€” Storybook template
117
- - @.contextkit/templates/hook.ts โ€” Custom hook template
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.ts โ€” API service template
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.tsx\` โ€” Component template
63
- - \`.contextkit/templates/test.tsx\` โ€” Test template
64
- - \`.contextkit/templates/hook.ts\` โ€” Custom hook template
65
- - \`.contextkit/templates/api.ts\` โ€” API service template
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
 
@@ -152,6 +152,16 @@ fi
152
152
  // Backup existing hooks
153
153
  await this.backupExistingHooks();
154
154
 
155
+ // Remove legacy pre-commit hook if it exists (replaced by pre-push)
156
+ const legacyPreCommitHook = `${this.hooksDir}/pre-commit`;
157
+ if (fs.existsSync(legacyPreCommitHook)) {
158
+ const content = await fs.readFile(legacyPreCommitHook, 'utf8');
159
+ if (content.includes('.contextkit/') || content.includes('.vibe-kit/')) {
160
+ await fs.remove(legacyPreCommitHook);
161
+ console.log(chalk.yellow('๐Ÿงน Removed legacy pre-commit hook (replaced by pre-push)'));
162
+ }
163
+ }
164
+
155
165
  // Add new hooks
156
166
  const hooks = [
157
167
  { name: 'pre-push', script: '.contextkit/hooks/pre-push.sh' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolrm/contextkit",
3
- "version": "0.7.4",
3
+ "version": "0.8.1",
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": {