@nolrm/contextkit 0.8.0 โ 0.8.2
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/lib/commands/install.js +10 -8
- package/lib/commands/update.js +8 -6
- package/lib/utils/git-hooks.js +11 -1
- package/package.json +1 -1
package/lib/commands/install.js
CHANGED
|
@@ -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-
|
|
182
|
-
console.log('to automatically run tests, linting, and type checks before
|
|
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
|
|
|
@@ -500,11 +507,7 @@ Run \`ck analyze\` to generate this content, or manually add your API pattern be
|
|
|
500
507
|
'.contextkit/commands/analyze.md'
|
|
501
508
|
);
|
|
502
509
|
|
|
503
|
-
// Download hooks
|
|
504
|
-
await this.downloadManager.downloadFile(
|
|
505
|
-
`${this.repoUrl}/hooks/pre-commit.sh`,
|
|
506
|
-
'.contextkit/hooks/pre-commit.sh'
|
|
507
|
-
);
|
|
510
|
+
// Download hooks (pre-push and commit-msg only, no pre-commit)
|
|
508
511
|
await this.downloadManager.downloadFile(
|
|
509
512
|
`${this.repoUrl}/hooks/pre-push.sh`,
|
|
510
513
|
'.contextkit/hooks/pre-push.sh'
|
|
@@ -546,7 +549,6 @@ Run \`ck analyze\` to generate this content, or manually add your API pattern be
|
|
|
546
549
|
);
|
|
547
550
|
|
|
548
551
|
// Make scripts executable
|
|
549
|
-
await fs.chmod('.contextkit/hooks/pre-commit.sh', '755');
|
|
550
552
|
await fs.chmod('.contextkit/hooks/pre-push.sh', '755');
|
|
551
553
|
await fs.chmod('.contextkit/hooks/commit-msg.sh', '755');
|
|
552
554
|
await fs.chmod('.contextkit/hooks/setup-hooks.sh', '755');
|
package/lib/commands/update.js
CHANGED
|
@@ -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'
|
|
@@ -264,7 +267,6 @@ class UpdateCommand {
|
|
|
264
267
|
);
|
|
265
268
|
|
|
266
269
|
// Make scripts executable
|
|
267
|
-
await fs.chmod('.contextkit/hooks/pre-commit.sh', '755');
|
|
268
270
|
await fs.chmod('.contextkit/hooks/pre-push.sh', '755');
|
|
269
271
|
await fs.chmod('.contextkit/hooks/commit-msg.sh', '755');
|
|
270
272
|
await fs.chmod('.contextkit/hooks/setup-hooks.sh', '755');
|
package/lib/utils/git-hooks.js
CHANGED
|
@@ -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' },
|
|
@@ -173,7 +183,7 @@ fi
|
|
|
173
183
|
const hookContent = `#!/usr/bin/env sh
|
|
174
184
|
. "$(dirname -- "$0")/_/husky.sh"
|
|
175
185
|
|
|
176
|
-
${scriptPath}
|
|
186
|
+
${scriptPath} "$@"
|
|
177
187
|
`;
|
|
178
188
|
|
|
179
189
|
await fs.writeFile(hookPath, hookContent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolrm/contextkit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
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": {
|