@nolrm/contextkit 0.13.5 → 0.14.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.
@@ -1,7 +1,6 @@
1
1
  const chalk = require('chalk');
2
2
  const ora = require('ora');
3
3
  const fs = require('fs-extra');
4
- const path = require('path');
5
4
 
6
5
  const DownloadManager = require('../utils/download');
7
6
  const ProjectDetector = require('../utils/project-detector');
@@ -22,7 +21,7 @@ class UpdateCommand {
22
21
  console.log(chalk.magenta('🔄 Updating ContextKit...'));
23
22
 
24
23
  // Check if ContextKit is installed
25
- if (!await fs.pathExists('.contextkit/config.yml')) {
24
+ if (!(await fs.pathExists('.contextkit/config.yml'))) {
26
25
  console.log(chalk.red('❌ No ContextKit installation found in current directory'));
27
26
  console.log(chalk.yellow('💡 Run: contextkit install'));
28
27
  return;
@@ -36,7 +35,9 @@ class UpdateCommand {
36
35
  }
37
36
 
38
37
  if (updateInfo.hasUpdate) {
39
- console.log(chalk.blue(`📦 Updating from ${updateInfo.currentVersion} to ${updateInfo.latestVersion}`));
38
+ console.log(
39
+ chalk.blue(`📦 Updating from ${updateInfo.currentVersion} to ${updateInfo.latestVersion}`)
40
+ );
40
41
  }
41
42
 
42
43
  // Create backup
@@ -75,7 +76,7 @@ class UpdateCommand {
75
76
  // Update Git hooks if they were enabled
76
77
  const hookChoices = {
77
78
  prePush: config.features?.pre_push_hook || config.features?.git_hooks || false,
78
- commitMsg: config.features?.commit_msg_hook || config.features?.git_hooks || false
79
+ commitMsg: config.features?.commit_msg_hook || config.features?.git_hooks || false,
79
80
  };
80
81
  if (hookChoices.prePush || hookChoices.commitMsg) {
81
82
  await this.gitHooksManager.installHooks(packageManager, hookChoices);
@@ -88,7 +89,6 @@ class UpdateCommand {
88
89
  await this.updateConfigVersion(updateInfo.latestVersion || '1.0.0');
89
90
 
90
91
  console.log(chalk.green('✅ ContextKit updated successfully!'));
91
-
92
92
  } catch (error) {
93
93
  console.log(chalk.red('❌ Update failed, restoring from backup...'));
94
94
  await this.restoreFromBackup(backupPath);
@@ -104,25 +104,28 @@ class UpdateCommand {
104
104
  async checkForUpdates() {
105
105
  try {
106
106
  const axios = require('axios');
107
- const response = await axios.get('https://api.github.com/repos/nolrm/contextkit/releases/latest', {
108
- timeout: 5000
109
- });
110
-
107
+ const response = await axios.get(
108
+ 'https://api.github.com/repos/nolrm/contextkit/releases/latest',
109
+ {
110
+ timeout: 5000,
111
+ }
112
+ );
113
+
111
114
  const latestVersion = response.data.tag_name.replace('v', '');
112
115
  const currentVersion = await this.getCurrentVersion();
113
116
  const hasUpdate = this.isNewerVersion(latestVersion, currentVersion);
114
-
117
+
115
118
  return {
116
119
  hasUpdate,
117
120
  currentVersion,
118
- latestVersion
121
+ latestVersion,
119
122
  };
120
123
  } catch (error) {
121
124
  return {
122
125
  hasUpdate: true, // Assume update available if we can't check
123
126
  currentVersion: await this.getCurrentVersion(),
124
127
  latestVersion: 'latest',
125
- error: error.message
128
+ error: error.message,
126
129
  };
127
130
  }
128
131
  }
@@ -139,22 +142,22 @@ class UpdateCommand {
139
142
  isNewerVersion(latest, current) {
140
143
  const latestParts = latest.split('.').map(Number);
141
144
  const currentParts = current.split('.').map(Number);
142
-
145
+
143
146
  for (let i = 0; i < Math.max(latestParts.length, currentParts.length); i++) {
144
147
  const latestPart = latestParts[i] || 0;
145
148
  const currentPart = currentParts[i] || 0;
146
-
149
+
147
150
  if (latestPart > currentPart) return true;
148
151
  if (latestPart < currentPart) return false;
149
152
  }
150
-
153
+
151
154
  return false;
152
155
  }
153
156
 
154
157
  async createBackup() {
155
158
  const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
156
159
  const backupPath = `.contextkit-backup-${timestamp}`;
157
-
160
+
158
161
  await fs.copy('.contextkit', backupPath);
159
162
  return backupPath;
160
163
  }
@@ -167,7 +170,7 @@ class UpdateCommand {
167
170
  async parseConfig() {
168
171
  const configContent = await fs.readFile('.contextkit/config.yml', 'utf8');
169
172
  const config = {};
170
-
173
+
171
174
  // Simple YAML parsing for our config format
172
175
  const lines = configContent.split('\n');
173
176
  for (const line of lines) {
@@ -207,7 +210,8 @@ class UpdateCommand {
207
210
  config.features.commit_msg_hook = trimmed.split('commit_msg_hook:')[1].trim() === 'true';
208
211
  } else if (trimmed.startsWith('squad_ci_workflow:')) {
209
212
  config.features = config.features || {};
210
- config.features.squad_ci_workflow = trimmed.split('squad_ci_workflow:')[1].trim() === 'true';
213
+ config.features.squad_ci_workflow =
214
+ trimmed.split('squad_ci_workflow:')[1].trim() === 'true';
211
215
  }
212
216
  }
213
217
 
@@ -223,7 +227,7 @@ class UpdateCommand {
223
227
  `${this.repoUrl}/standards/README.md`,
224
228
  '.contextkit/standards/README.md'
225
229
  );
226
-
230
+
227
231
  // Keep glossary updated (universal file)
228
232
  await this.downloadManager.downloadFile(
229
233
  `${this.repoUrl}/standards/glossary.md`,
@@ -232,104 +236,116 @@ class UpdateCommand {
232
236
 
233
237
  // Download commands
234
238
  await this.downloadManager.downloadFile(
235
- `${this.repoUrl}/commands/analyze.md`,
236
- '.contextkit/commands/analyze.md'
239
+ `${this.repoUrl}/commands/dev/analyze.md`,
240
+ '.contextkit/commands/dev/analyze.md'
237
241
  );
238
242
  await this.downloadManager.downloadFile(
239
- `${this.repoUrl}/commands/review.md`,
240
- '.contextkit/commands/review.md'
243
+ `${this.repoUrl}/commands/dev/review.md`,
244
+ '.contextkit/commands/dev/review.md'
241
245
  );
242
246
  await this.downloadManager.downloadFile(
243
- `${this.repoUrl}/commands/fix.md`,
244
- '.contextkit/commands/fix.md'
247
+ `${this.repoUrl}/commands/dev/fix.md`,
248
+ '.contextkit/commands/dev/fix.md'
245
249
  );
246
250
  await this.downloadManager.downloadFile(
247
- `${this.repoUrl}/commands/refactor.md`,
248
- '.contextkit/commands/refactor.md'
251
+ `${this.repoUrl}/commands/dev/refactor.md`,
252
+ '.contextkit/commands/dev/refactor.md'
249
253
  );
250
254
  await this.downloadManager.downloadFile(
251
- `${this.repoUrl}/commands/run-tests.md`,
252
- '.contextkit/commands/run-tests.md'
255
+ `${this.repoUrl}/commands/dev/run-tests.md`,
256
+ '.contextkit/commands/dev/run-tests.md'
253
257
  );
254
258
  await this.downloadManager.downloadFile(
255
- `${this.repoUrl}/commands/add-documentation.md`,
256
- '.contextkit/commands/add-documentation.md'
259
+ `${this.repoUrl}/commands/docs/add-documentation.md`,
260
+ '.contextkit/commands/docs/add-documentation.md'
257
261
  );
258
262
  await this.downloadManager.downloadFile(
259
- `${this.repoUrl}/commands/quality-check.md`,
260
- '.contextkit/commands/quality-check.md'
263
+ `${this.repoUrl}/commands/dev/quality-check.md`,
264
+ '.contextkit/commands/dev/quality-check.md'
261
265
  );
262
266
  await this.downloadManager.downloadFile(
263
- `${this.repoUrl}/commands/create-feature.md`,
264
- '.contextkit/commands/create-feature.md'
267
+ `${this.repoUrl}/commands/dev/create-feature.md`,
268
+ '.contextkit/commands/dev/create-feature.md'
265
269
  );
266
270
  await this.downloadManager.downloadFile(
267
- `${this.repoUrl}/commands/create-component.md`,
268
- '.contextkit/commands/create-component.md'
271
+ `${this.repoUrl}/commands/dev/create-component.md`,
272
+ '.contextkit/commands/dev/create-component.md'
269
273
  );
270
274
  await this.downloadManager.downloadFile(
271
- `${this.repoUrl}/commands/spec.md`,
272
- '.contextkit/commands/spec.md'
275
+ `${this.repoUrl}/commands/dev/spec.md`,
276
+ '.contextkit/commands/dev/spec.md'
273
277
  );
274
278
 
275
279
  // Download squad commands
276
280
  await this.downloadManager.downloadFile(
277
- `${this.repoUrl}/commands/squad.md`,
278
- '.contextkit/commands/squad.md'
281
+ `${this.repoUrl}/commands/squad/squad.md`,
282
+ '.contextkit/commands/squad/squad.md'
279
283
  );
280
284
  await this.downloadManager.downloadFile(
281
- `${this.repoUrl}/commands/squad-architect.md`,
282
- '.contextkit/commands/squad-architect.md'
285
+ `${this.repoUrl}/commands/squad/squad-architect.md`,
286
+ '.contextkit/commands/squad/squad-architect.md'
283
287
  );
284
288
  await this.downloadManager.downloadFile(
285
- `${this.repoUrl}/commands/squad-dev.md`,
286
- '.contextkit/commands/squad-dev.md'
289
+ `${this.repoUrl}/commands/squad/squad-dev.md`,
290
+ '.contextkit/commands/squad/squad-dev.md'
287
291
  );
288
292
  await this.downloadManager.downloadFile(
289
- `${this.repoUrl}/commands/squad-test.md`,
290
- '.contextkit/commands/squad-test.md'
293
+ `${this.repoUrl}/commands/squad/squad-test.md`,
294
+ '.contextkit/commands/squad/squad-test.md'
291
295
  );
292
296
  await this.downloadManager.downloadFile(
293
- `${this.repoUrl}/commands/squad-review.md`,
294
- '.contextkit/commands/squad-review.md'
297
+ `${this.repoUrl}/commands/squad/squad-review.md`,
298
+ '.contextkit/commands/squad/squad-review.md'
295
299
  );
296
300
  await this.downloadManager.downloadFile(
297
- `${this.repoUrl}/commands/squad-auto.md`,
298
- '.contextkit/commands/squad-auto.md'
301
+ `${this.repoUrl}/commands/squad/squad-auto.md`,
302
+ '.contextkit/commands/squad/squad-auto.md'
299
303
  );
300
304
  await this.downloadManager.downloadFile(
301
- `${this.repoUrl}/commands/squad-auto-parallel.md`,
302
- '.contextkit/commands/squad-auto-parallel.md'
305
+ `${this.repoUrl}/commands/squad/squad-auto-parallel.md`,
306
+ '.contextkit/commands/squad/squad-auto-parallel.md'
303
307
  );
304
308
  await this.downloadManager.downloadFile(
305
- `${this.repoUrl}/commands/squad-reset.md`,
306
- '.contextkit/commands/squad-reset.md'
309
+ `${this.repoUrl}/commands/squad/squad-reset.md`,
310
+ '.contextkit/commands/squad/squad-reset.md'
307
311
  );
308
312
  await this.downloadManager.downloadFile(
309
- `${this.repoUrl}/commands/squad-doc.md`,
310
- '.contextkit/commands/squad-doc.md'
313
+ `${this.repoUrl}/commands/squad/squad-doc.md`,
314
+ '.contextkit/commands/squad/squad-doc.md'
311
315
  );
312
316
  await this.downloadManager.downloadFile(
313
- `${this.repoUrl}/commands/squad-ci.md`,
314
- '.contextkit/commands/squad-ci.md'
317
+ `${this.repoUrl}/commands/squad/squad-ci.md`,
318
+ '.contextkit/commands/squad/squad-ci.md'
315
319
  );
316
320
  await this.downloadManager.downloadFile(
317
- `${this.repoUrl}/commands/health-check.md`,
318
- '.contextkit/commands/health-check.md'
321
+ `${this.repoUrl}/commands/dev/health-check.md`,
322
+ '.contextkit/commands/dev/health-check.md'
319
323
  );
320
324
 
321
325
  // Download doc family commands
322
326
  await this.downloadManager.downloadFile(
323
- `${this.repoUrl}/commands/doc-arch.md`,
324
- '.contextkit/commands/doc-arch.md'
327
+ `${this.repoUrl}/commands/docs/doc-arch.md`,
328
+ '.contextkit/commands/docs/doc-arch.md'
329
+ );
330
+ await this.downloadManager.downloadFile(
331
+ `${this.repoUrl}/commands/docs/doc-feature.md`,
332
+ '.contextkit/commands/docs/doc-feature.md'
333
+ );
334
+ await this.downloadManager.downloadFile(
335
+ `${this.repoUrl}/commands/docs/doc-component.md`,
336
+ '.contextkit/commands/docs/doc-component.md'
337
+ );
338
+ await this.downloadManager.downloadFile(
339
+ `${this.repoUrl}/commands/agents/context-budget.md`,
340
+ '.contextkit/commands/agents/context-budget.md'
325
341
  );
326
342
  await this.downloadManager.downloadFile(
327
- `${this.repoUrl}/commands/doc-feature.md`,
328
- '.contextkit/commands/doc-feature.md'
343
+ `${this.repoUrl}/commands/agents/agent-push-checklist.md`,
344
+ '.contextkit/commands/agents/agent-push-checklist.md'
329
345
  );
330
346
  await this.downloadManager.downloadFile(
331
- `${this.repoUrl}/commands/doc-component.md`,
332
- '.contextkit/commands/doc-component.md'
347
+ `${this.repoUrl}/commands/agents/standards-aware.md`,
348
+ '.contextkit/commands/agents/standards-aware.md'
333
349
  );
334
350
 
335
351
  // Update CI squad workflow if the user opted in
@@ -422,15 +438,15 @@ paths:
422
438
 
423
439
  # Commands
424
440
  commands:
425
- analyze: "${config.commands?.analyze || '@.contextkit/commands/analyze.md'}"
426
- review: "${config.commands?.review || '@.contextkit/commands/review.md'}"
427
- fix: "${config.commands?.fix || '@.contextkit/commands/fix.md'}"
428
- refactor: "${config.commands?.refactor || '@.contextkit/commands/refactor.md'}"
429
- run_tests: "${config.commands?.run_tests || '@.contextkit/commands/run-tests.md'}"
430
- add_docs: "${config.commands?.add_docs || '@.contextkit/commands/add-documentation.md'}"
431
- quality_check: "${config.commands?.quality_check || '@.contextkit/commands/quality-check.md'}"
432
- create_component: "${config.commands?.create_component || '@.contextkit/commands/create-component.md'}"
433
- create_feature: "${config.commands?.create_feature || '@.contextkit/commands/create-feature.md'}"
441
+ analyze: "${config.commands?.analyze || '@.contextkit/commands/dev/analyze.md'}"
442
+ review: "${config.commands?.review || '@.contextkit/commands/dev/review.md'}"
443
+ fix: "${config.commands?.fix || '@.contextkit/commands/dev/fix.md'}"
444
+ refactor: "${config.commands?.refactor || '@.contextkit/commands/dev/refactor.md'}"
445
+ run_tests: "${config.commands?.run_tests || '@.contextkit/commands/dev/run-tests.md'}"
446
+ add_docs: "${config.commands?.add_docs || '@.contextkit/commands/docs/add-documentation.md'}"
447
+ quality_check: "${config.commands?.quality_check || '@.contextkit/commands/dev/quality-check.md'}"
448
+ create_component: "${config.commands?.create_component || '@.contextkit/commands/dev/create-component.md'}"
449
+ create_feature: "${config.commands?.create_feature || '@.contextkit/commands/dev/create-feature.md'}"
434
450
  `;
435
451
 
436
452
  await fs.writeFile('.contextkit/config.yml', configContent);
@@ -462,6 +478,32 @@ commands:
462
478
 
463
479
  async removeLegacyFiles() {
464
480
  const legacyFiles = [
481
+ // Removed in 0.14.0 — commands reorganised into dev/ squad/ docs/ agents/ subdirs
482
+ '.contextkit/commands/analyze.md',
483
+ '.contextkit/commands/review.md',
484
+ '.contextkit/commands/fix.md',
485
+ '.contextkit/commands/refactor.md',
486
+ '.contextkit/commands/run-tests.md',
487
+ '.contextkit/commands/add-documentation.md',
488
+ '.contextkit/commands/quality-check.md',
489
+ '.contextkit/commands/create-feature.md',
490
+ '.contextkit/commands/create-component.md',
491
+ '.contextkit/commands/spec.md',
492
+ '.contextkit/commands/health-check.md',
493
+ '.contextkit/commands/squad.md',
494
+ '.contextkit/commands/squad-architect.md',
495
+ '.contextkit/commands/squad-dev.md',
496
+ '.contextkit/commands/squad-test.md',
497
+ '.contextkit/commands/squad-review.md',
498
+ '.contextkit/commands/squad-auto.md',
499
+ '.contextkit/commands/squad-auto-parallel.md',
500
+ '.contextkit/commands/squad-reset.md',
501
+ '.contextkit/commands/squad-doc.md',
502
+ '.contextkit/commands/squad-ci.md',
503
+ '.contextkit/commands/doc-arch.md',
504
+ '.contextkit/commands/doc-feature.md',
505
+ '.contextkit/commands/doc-component.md',
506
+ // Older legacy
465
507
  '.contextkit/commands/squad-peer-review.md',
466
508
  ];
467
509
  for (const file of legacyFiles) {
@@ -473,10 +515,7 @@ commands:
473
515
 
474
516
  async updateConfigVersion(version) {
475
517
  const configContent = await fs.readFile('.contextkit/config.yml', 'utf8');
476
- const updatedContent = configContent.replace(
477
- /version: "[^"]*"/,
478
- `version: "${version}"`
479
- );
518
+ const updatedContent = configContent.replace(/version: "[^"]*"/, `version: "${version}"`);
480
519
  await fs.writeFile('.contextkit/config.yml', updatedContent);
481
520
  }
482
521
  }
package/lib/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  const install = require('./commands/install');
2
2
  const update = require('./commands/update');
3
3
  const status = require('./commands/status');
4
+ const GatesCommand = require('./commands/gates');
4
5
 
5
6
  module.exports = {
6
7
  install,
7
8
  update,
8
- status
9
+ status,
10
+ gates: GatesCommand,
9
11
  };
@@ -71,7 +71,7 @@ ${this.getStandardsBlock()}
71
71
  .contextkit/instructions/meta/
72
72
  `;
73
73
  // Only create if doesn't exist (don't overwrite user customizations)
74
- if (!await fs.pathExists('.aiderignore')) {
74
+ if (!(await fs.pathExists('.aiderignore'))) {
75
75
  await fs.writeFile('.aiderignore', aiderignore);
76
76
  }
77
77
  }
@@ -2,7 +2,8 @@ const chalk = require('chalk');
2
2
  const fs = require('fs-extra');
3
3
  const path = require('path');
4
4
 
5
- const MARKER = '<!-- Generated by ContextKit (@nolrm/contextkit) https://www.npmjs.com/package/@nolrm/contextkit -->';
5
+ const MARKER =
6
+ '<!-- Generated by ContextKit (@nolrm/contextkit) https://www.npmjs.com/package/@nolrm/contextkit -->';
6
7
  const MARKER_END = '<!-- End ContextKit -->';
7
8
  const LEGACY_MARKER_V1 = '<!-- Generated by ContextKit -->';
8
9
  const LEGACY_MARKER = '<!-- Generated by Vibe Kit -->';
@@ -64,13 +65,19 @@ class BaseIntegration {
64
65
  const hasLegacyMarker = existing.includes(LEGACY_MARKER);
65
66
 
66
67
  if (hasCurrentMarker || hasLegacyMarkerV1 || hasLegacyMarker) {
67
- const activeMarker = hasCurrentMarker ? MARKER : (hasLegacyMarkerV1 ? LEGACY_MARKER_V1 : LEGACY_MARKER);
68
- const activeMarkerEnd = hasLegacyMarker && !hasCurrentMarker && !hasLegacyMarkerV1 ? LEGACY_MARKER_END : MARKER_END;
68
+ const activeMarker = hasCurrentMarker
69
+ ? MARKER
70
+ : hasLegacyMarkerV1
71
+ ? LEGACY_MARKER_V1
72
+ : LEGACY_MARKER;
73
+ const activeMarkerEnd =
74
+ hasLegacyMarker && !hasCurrentMarker && !hasLegacyMarkerV1
75
+ ? LEGACY_MARKER_END
76
+ : MARKER_END;
69
77
  const before = existing.substring(0, existing.indexOf(activeMarker));
70
78
  const afterMarkerEnd = existing.indexOf(activeMarkerEnd);
71
- const after = afterMarkerEnd !== -1
72
- ? existing.substring(afterMarkerEnd + activeMarkerEnd.length)
73
- : '';
79
+ const after =
80
+ afterMarkerEnd !== -1 ? existing.substring(afterMarkerEnd + activeMarkerEnd.length) : '';
74
81
  await fs.writeFile(filePath, before + markedContent + after);
75
82
  } else {
76
83
  // Append below existing content