@_xtribe/cli 2.1.6 → 2.1.8

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/package.json +3 -1
  2. package/tribe.js +44 -0
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@_xtribe/cli",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "TRIBE - Track, measure and optimize your AI coding agents to become 10x faster",
5
5
  "main": "install-tribe.js",
6
6
  "bin": {
7
+ "tribe": "./tribe.js",
7
8
  "cli": "./index.js",
8
9
  "install-tribe": "./install-tribe.js",
9
10
  "setup-path": "./setup-path.js"
@@ -37,6 +38,7 @@
37
38
  },
38
39
  "files": [
39
40
  "index.js",
41
+ "tribe.js",
40
42
  "install-tribe.js",
41
43
  "install-tribe-minimal.js",
42
44
  "install-tribe-autolaunch.js",
package/tribe.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * TRIBE CLI wrapper for npm users
5
+ * This tries to run the installed tribe binary, or installs it if not found
6
+ */
7
+
8
+ const { spawn, execSync } = require('child_process');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const os = require('os');
12
+
13
+ const homeDir = os.homedir();
14
+ const tribeDir = path.join(homeDir, '.tribe');
15
+ const tribeBinPath = path.join(tribeDir, 'bin', 'tribe');
16
+
17
+ // Check if tribe is already installed
18
+ if (fs.existsSync(tribeBinPath)) {
19
+ // Run the installed tribe binary
20
+ const child = spawn(tribeBinPath, process.argv.slice(2), {
21
+ stdio: 'inherit',
22
+ env: process.env
23
+ });
24
+
25
+ child.on('exit', (code) => {
26
+ process.exit(code || 0);
27
+ });
28
+ } else {
29
+ // Tribe not installed, run installer first
30
+ console.log('šŸš€ TRIBE CLI not found. Installing...\n');
31
+
32
+ const installerPath = path.join(__dirname, 'install-tribe.js');
33
+ const child = spawn(process.execPath, [installerPath, ...process.argv.slice(2)], {
34
+ stdio: 'inherit',
35
+ env: process.env
36
+ });
37
+
38
+ child.on('exit', (code) => {
39
+ if (code === 0) {
40
+ console.log('\nāœ… Installation complete! You can now run: tribe');
41
+ }
42
+ process.exit(code || 0);
43
+ });
44
+ }