chekk 0.2.4 → 0.2.5

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/bin/chekk.js CHANGED
@@ -1,20 +1,62 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { execSync, spawn } from 'child_process';
3
4
  import { Command } from 'commander';
4
5
  import { run } from '../src/index.js';
5
6
 
6
- const program = new Command();
7
-
8
- program
9
- .name('chekk')
10
- .description('The engineering capability score. See how you prompt.')
11
- .version('0.2.4')
12
- .option('--offline', 'Skip AI prose generation, show data-driven output')
13
- .option('--verbose', 'Show detailed per-project and per-metric breakdowns')
14
- .option('--json', 'Output raw metrics as JSON')
15
- .option('--no-upload', 'Skip the claim prompt')
16
- .action(async (options) => {
17
- await run(options);
18
- });
19
-
20
- program.parse();
7
+ const LOCAL_VERSION = '0.2.5';
8
+
9
+ // ── Auto-update check ──
10
+ // If running from a cached npx install, check if there's a newer version
11
+ // and re-exec with @latest to ensure users always get the freshest build.
12
+ async function checkForUpdate() {
13
+ try {
14
+ const latest = execSync('npm view chekk version 2>/dev/null', {
15
+ encoding: 'utf-8',
16
+ timeout: 3000,
17
+ }).trim();
18
+
19
+ if (latest && latest !== LOCAL_VERSION && isNewer(latest, LOCAL_VERSION)) {
20
+ // Re-run with the latest version
21
+ const args = process.argv.slice(2);
22
+ const child = spawn('npx', ['--yes', `chekk@${latest}`, ...args], {
23
+ stdio: 'inherit',
24
+ shell: true,
25
+ });
26
+ child.on('exit', (code) => process.exit(code || 0));
27
+ return true; // signal that we're handing off
28
+ }
29
+ } catch {
30
+ // Network down or timeout — just run the local version
31
+ }
32
+ return false;
33
+ }
34
+
35
+ function isNewer(remote, local) {
36
+ const r = remote.split('.').map(Number);
37
+ const l = local.split('.').map(Number);
38
+ for (let i = 0; i < 3; i++) {
39
+ if ((r[i] || 0) > (l[i] || 0)) return true;
40
+ if ((r[i] || 0) < (l[i] || 0)) return false;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ const handedOff = await checkForUpdate();
46
+ if (!handedOff) {
47
+ const program = new Command();
48
+
49
+ program
50
+ .name('chekk')
51
+ .description('The engineering capability score. See how you prompt.')
52
+ .version(LOCAL_VERSION)
53
+ .option('--offline', 'Skip AI prose generation, show data-driven output')
54
+ .option('--verbose', 'Show detailed per-project and per-metric breakdowns')
55
+ .option('--json', 'Output raw metrics as JSON')
56
+ .option('--no-upload', 'Skip the claim prompt')
57
+ .action(async (options) => {
58
+ await run(options);
59
+ });
60
+
61
+ program.parse();
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chekk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "See how you prompt. Chekk analyzes your AI coding workflow and tells you what kind of engineer you are.",
5
5
  "bin": {
6
6
  "chekk": "./bin/chekk.js"
package/src/display.js CHANGED
@@ -90,7 +90,7 @@ export function displayHeader() {
90
90
  console.log();
91
91
  const lines = [
92
92
  '',
93
- ` ${bold.white('chekk')}${dim(' v0.2.4')}`,
93
+ ` ${bold.white('chekk')}${dim(' v0.2.5')}`,
94
94
  ` ${dim('the engineering capability score')}`,
95
95
  '',
96
96
  ];