@mai0313/vibe-coding-tracker 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/vct.js CHANGED
@@ -3,25 +3,24 @@
3
3
  const { spawn } = require('child_process');
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
- const os = require('os');
7
6
 
8
- // Determine platform-specific binary name and archive format
7
+ // Determine platform-specific directory and binary name
9
8
  function getPlatformInfo() {
10
9
  const platform = process.platform;
11
10
  const arch = process.arch;
12
11
 
13
12
  const platformMap = {
14
13
  darwin: {
15
- x64: { friendlyId: 'macos-x64', ext: 'tar.gz' },
16
- arm64: { friendlyId: 'macos-arm64', ext: 'tar.gz' },
14
+ x64: { dir: 'macos-x64', binary: 'vibe_coding_tracker' },
15
+ arm64: { dir: 'macos-arm64', binary: 'vibe_coding_tracker' },
17
16
  },
18
17
  linux: {
19
- x64: { friendlyId: 'linux-x64-gnu', ext: 'tar.gz' },
20
- arm64: { friendlyId: 'linux-arm64-gnu', ext: 'tar.gz' },
18
+ x64: { dir: 'linux-x64-gnu', binary: 'vibe_coding_tracker' },
19
+ arm64: { dir: 'linux-arm64-gnu', binary: 'vibe_coding_tracker' },
21
20
  },
22
21
  win32: {
23
- x64: { friendlyId: 'windows-x64', ext: 'zip' },
24
- arm64: { friendlyId: 'windows-arm64', ext: 'zip' },
22
+ x64: { dir: 'windows-x64', binary: 'vibe_coding_tracker.exe' },
23
+ arm64: { dir: 'windows-arm64', binary: 'vibe_coding_tracker.exe' },
25
24
  },
26
25
  };
27
26
 
@@ -30,25 +29,12 @@ function getPlatformInfo() {
30
29
  process.exit(1);
31
30
  }
32
31
 
33
- const info = platformMap[platform][arch];
34
- return {
35
- binaryName: platform === 'win32' ? 'vibe_coding_tracker.exe' : 'vibe_coding_tracker',
36
- ...info
37
- };
32
+ return platformMap[platform][arch];
38
33
  }
39
34
 
40
- // Extract binary from archive on first run
41
- function extractBinary() {
42
- const info = getPlatformInfo();
43
- const binDir = path.join(__dirname);
44
- const binaryPath = path.join(binDir, info.binaryName);
45
-
46
- // If binary already exists, return its path
47
- if (fs.existsSync(binaryPath)) {
48
- return binaryPath;
49
- }
50
-
51
- // Find the archive in binaries directory
35
+ // Find the binary for current platform
36
+ function findBinary() {
37
+ const platformInfo = getPlatformInfo();
52
38
  const packageRoot = path.join(__dirname, '..');
53
39
  const binariesDir = path.join(packageRoot, 'binaries');
54
40
 
@@ -58,48 +44,30 @@ function extractBinary() {
58
44
  process.exit(1);
59
45
  }
60
46
 
61
- // Find matching archive
62
- const files = fs.readdirSync(binariesDir);
63
- const archivePattern = `${info.friendlyId}.${info.ext}`;
64
- const archiveFile = files.find(f => f.includes(info.friendlyId) && f.endsWith(info.ext));
47
+ // Look for the binary in platform-specific subdirectory
48
+ const platformDir = path.join(binariesDir, platformInfo.dir);
49
+ const binaryPath = path.join(platformDir, platformInfo.binary);
65
50
 
66
- if (!archiveFile) {
67
- console.error(`Error: Binary archive not found for ${archivePattern}`);
51
+ if (!fs.existsSync(binaryPath)) {
52
+ console.error(`Error: Binary not found for your platform: ${platformInfo.dir}/${platformInfo.binary}`);
68
53
  console.error('Please reinstall the package.');
69
54
  process.exit(1);
70
55
  }
71
56
 
72
- const archivePath = path.join(binariesDir, archiveFile);
73
-
74
- // Extract binary
75
- try {
76
- if (info.ext === 'tar.gz') {
77
- const tar = require('tar');
78
- tar.extract({
79
- file: archivePath,
80
- cwd: binDir,
81
- sync: true,
82
- });
83
- } else if (info.ext === 'zip') {
84
- const AdmZip = require('adm-zip');
85
- const zip = new AdmZip(archivePath);
86
- zip.extractEntryTo(info.binaryName, binDir, false, true);
87
- }
88
-
89
- // Make binary executable on Unix-like systems
90
- if (process.platform !== 'win32') {
57
+ // Make binary executable on Unix-like systems
58
+ if (process.platform !== 'win32') {
59
+ try {
91
60
  fs.chmodSync(binaryPath, 0o755);
61
+ } catch (err) {
62
+ // Ignore error if already executable
92
63
  }
93
- } catch (err) {
94
- console.error('Failed to extract binary:', err);
95
- process.exit(1);
96
64
  }
97
65
 
98
66
  return binaryPath;
99
67
  }
100
68
 
101
- // Get or extract binary
102
- const binaryPath = extractBinary();
69
+ // Get binary path
70
+ const binaryPath = findBinary();
103
71
 
104
72
  // Forward all arguments to the binary
105
73
  const args = process.argv.slice(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mai0313/vibe-coding-tracker",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Vibe Coding Tracker - AI coding assistant telemetry/usage parser, aggregate JSONL events into CodeAnalysis results",
5
5
  "author": "Wei Lee <mai@mai0313.com>",
6
6
  "license": "MIT",
@@ -43,9 +43,5 @@
43
43
  "bin/",
44
44
  "binaries/",
45
45
  "README.md"
46
- ],
47
- "dependencies": {
48
- "adm-zip": "^0.5.10",
49
- "tar": "^7.4.3"
50
- }
46
+ ]
51
47
  }