aicp-tracker 1.0.4 → 1.0.7

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.
Files changed (2) hide show
  1. package/bin/setup.js +8 -6
  2. package/package.json +1 -1
package/bin/setup.js CHANGED
@@ -4,6 +4,8 @@
4
4
  // Runs on `npm install` (postinstall). Skipped in CI environments.
5
5
  if (process.env.CI || process.env.npm_config_yes) process.exit(0);
6
6
 
7
+ const path = require('path');
8
+
7
9
  // Skip if already fully configured (upgrade path — no prompts needed)
8
10
  const isPostinstall = process.env.npm_lifecycle_event === 'postinstall';
9
11
  if (isPostinstall) {
@@ -11,11 +13,12 @@ if (isPostinstall) {
11
13
  try { existing = require('../src/config').load(); } catch {}
12
14
  if (existing?.apiKey && existing?.vcsUrl) process.exit(0);
13
15
 
14
- // Interactive prompts are unreliable in the postinstall context across npm
15
- // versions and platforms. The wizard runs on first `aicp-tracker start` instead.
16
- console.log('\n\x1b[1m AI Code Pulse Tracker installed.\x1b[0m');
17
- console.log(' Run \x1b[1maicp-tracker start\x1b[0m to activate tracking.\n');
18
- process.exit(0);
16
+ // spawnSync with stdio:'inherit' passes the real terminal descriptors to the child,
17
+ // giving enquirer a proper TTY without opening a separate window.
18
+ const { spawnSync } = require('child_process');
19
+ const wizardPath = path.resolve(__dirname, 'aicp-tracker.js');
20
+ const result = spawnSync(process.execPath, [wizardPath, 'setup'], { stdio: 'inherit' });
21
+ process.exit(result.status || 0);
19
22
  }
20
23
 
21
24
  // ── When called directly (aicp-tracker setup) ─────────────────────────────────
@@ -24,7 +27,6 @@ const { prompt } = require('enquirer');
24
27
  const { execSync } = require('child_process');
25
28
  const fs = require('fs');
26
29
  const os = require('os');
27
- const path = require('path');
28
30
  const config = require('../src/config');
29
31
  const daemon = require('../src/daemon');
30
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicp-tracker",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "AI Code Pulse — Claude Code usage tracker for JIRA cost attribution",
5
5
  "main": "src/daemon.js",
6
6
  "bin": {