@vibesdotdev/bin 1.0.0 → 1.0.1

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/vibes +43 -7
  2. package/package.json +1 -1
package/bin/vibes CHANGED
@@ -20,21 +20,45 @@ const fs = require('fs');
20
20
  const path = require('path');
21
21
 
22
22
  const binDir = __dirname;
23
+ const installerPath = path.join(binDir, '..', 'scripts', 'postinstall.js');
23
24
  const exePath = path.join(binDir, 'vibes.exe');
24
25
 
26
+ function runInstaller() {
27
+ const result = spawnSync(process.execPath, [installerPath], {
28
+ stdio: 'inherit',
29
+ windowsHide: false
30
+ });
31
+ if (result.error) {
32
+ process.stderr.write(`Failed to run installer: ${result.error.message}\n`);
33
+ process.exit(1);
34
+ }
35
+ if (result.status !== 0) {
36
+ process.exit(result.status === null ? 1 : result.status);
37
+ }
38
+ }
39
+
25
40
  function reportMissingBinary() {
26
41
  process.stderr.write('Error: vibes binary not installed.\n');
27
42
  process.stderr.write('\n');
28
- process.stderr.write('The postinstall script did not complete. To fix, re-run install:\n');
29
- process.stderr.write(' npm rebuild -g @vibesdotdev/bin\n');
30
- process.stderr.write(' or\n');
31
- process.stderr.write(' bun pm trust @vibesdotdev/bin && bun install -g @vibesdotdev/bin\n');
43
+ process.stderr.write('The installer could not place the platform binary.\n');
32
44
  process.stderr.write('\n');
33
45
  process.stderr.write('If the problem persists, see https://github.com/vibesdotdev/monorepo/issues\n');
34
46
  process.exit(1);
35
47
  }
36
48
 
49
+ function isStillNodeShim(filePath) {
50
+ try {
51
+ const content = fs.readFileSync(filePath, 'utf8');
52
+ return content.includes('Cross-platform launcher for the vibes CLI binary');
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
57
+
37
58
  if (process.platform === 'win32') {
59
+ if (!fs.existsSync(exePath)) {
60
+ runInstaller();
61
+ }
38
62
  if (!fs.existsSync(exePath)) {
39
63
  reportMissingBinary();
40
64
  }
@@ -49,6 +73,18 @@ if (process.platform === 'win32') {
49
73
  process.exit(result.status === null ? 1 : result.status);
50
74
  }
51
75
 
52
- // On macOS/Linux, postinstall is expected to have replaced this file with the
53
- // actual binary. If we get here, the replacement never happened.
54
- reportMissingBinary();
76
+ runInstaller();
77
+
78
+ if (isStillNodeShim(path.join(binDir, 'vibes'))) {
79
+ reportMissingBinary();
80
+ }
81
+
82
+ const result = spawnSync(path.join(binDir, 'vibes'), process.argv.slice(2), {
83
+ stdio: 'inherit',
84
+ windowsHide: false
85
+ });
86
+ if (result.error) {
87
+ process.stderr.write(`Failed to spawn vibes: ${result.error.message}\n`);
88
+ process.exit(1);
89
+ }
90
+ process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibesdotdev/bin",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Vibes CLI - the command-line interface for the Vibes platform",
5
5
  "license": "MIT",
6
6
  "repository": {