@_xtribe/cli 2.1.3 → 2.1.4

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/install-tribe.js +105 -32
  2. package/package.json +1 -1
package/install-tribe.js CHANGED
@@ -39,10 +39,6 @@ function showWelcome() {
39
39
  console.log(chalk.gray('Master AI Engineering Through Practice\n'));
40
40
  }
41
41
 
42
- function showInstallationSummary() {
43
- console.log(chalk.green.bold('✓ Ready!'));
44
- console.log('Type ' + chalk.cyan.bold('tribe') + ' to get started');
45
- }
46
42
 
47
43
  async function downloadFile(url, dest) {
48
44
  return new Promise((resolve, reject) => {
@@ -70,20 +66,20 @@ async function installTribeCLI() {
70
66
  // Check if update needed
71
67
  const exists = fs.existsSync(tribeDest);
72
68
  const spinner = ora(exists ? 'Updating CLI...' : 'Installing CLI...').start();
73
-
69
+
74
70
  try {
75
71
  // Remove existing if present
76
72
  if (exists) {
77
73
  fs.unlinkSync(tribeDest);
78
74
  }
79
-
75
+
80
76
  // Download from GitHub
81
77
  const githubRepo = 'TRIBE-INC/releases';
82
78
  const downloadUrl = `https://github.com/${githubRepo}/releases/latest/download/tribe-${platform}-${arch}`;
83
-
79
+
84
80
  await downloadFile(downloadUrl, tribeDest);
85
81
  fs.chmodSync(tribeDest, '755');
86
-
82
+
87
83
  // Remove macOS quarantine if needed
88
84
  if (platform === 'darwin') {
89
85
  try {
@@ -92,7 +88,7 @@ async function installTribeCLI() {
92
88
  // Not critical
93
89
  }
94
90
  }
95
-
91
+
96
92
  spinner.succeed('CLI ready');
97
93
  return true;
98
94
  } catch (error) {
@@ -101,9 +97,43 @@ async function installTribeCLI() {
101
97
  }
102
98
  }
103
99
 
100
+ async function installTribeCLIQuiet() {
101
+ const tribeDest = path.join(tribeBinDir, 'tribe');
102
+
103
+ // Check if update needed
104
+ const exists = fs.existsSync(tribeDest);
105
+
106
+ try {
107
+ // Remove existing if present
108
+ if (exists) {
109
+ fs.unlinkSync(tribeDest);
110
+ }
111
+
112
+ // Download from GitHub
113
+ const githubRepo = 'TRIBE-INC/releases';
114
+ const downloadUrl = `https://github.com/${githubRepo}/releases/latest/download/tribe-${platform}-${arch}`;
115
+
116
+ await downloadFile(downloadUrl, tribeDest);
117
+ fs.chmodSync(tribeDest, '755');
118
+
119
+ // Remove macOS quarantine if needed
120
+ if (platform === 'darwin') {
121
+ try {
122
+ execSync(`xattr -d com.apple.quarantine "${tribeDest}"`, { stdio: 'ignore' });
123
+ } catch {
124
+ // Not critical
125
+ }
126
+ }
127
+
128
+ return true;
129
+ } catch (error) {
130
+ throw error;
131
+ }
132
+ }
133
+
104
134
  async function setupPath() {
105
135
  const spinner = ora('Setting up PATH...').start();
106
-
136
+
107
137
  try {
108
138
  // Create PATH script
109
139
  const envScript = `#!/bin/bash
@@ -112,23 +142,23 @@ TRIBE_BIN_DIR="$HOME/.tribe/bin"
112
142
  if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
113
143
  export PATH="$TRIBE_BIN_DIR:$PATH"
114
144
  fi`;
115
-
145
+
116
146
  const envScriptPath = path.join(tribeDir, 'tribe-env.sh');
117
147
  fs.writeFileSync(envScriptPath, envScript);
118
148
  fs.chmodSync(envScriptPath, '755');
119
-
149
+
120
150
  // Try to add to shell config
121
151
  const shellConfig = process.env.SHELL?.includes('zsh') ? '.zshrc' : '.bashrc';
122
152
  const rcPath = path.join(homeDir, shellConfig);
123
153
  const sourceLine = 'source ~/.tribe/tribe-env.sh';
124
-
154
+
125
155
  if (fs.existsSync(rcPath)) {
126
156
  const content = fs.readFileSync(rcPath, 'utf8');
127
157
  if (!content.includes(sourceLine)) {
128
158
  fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceLine}\n`);
129
159
  }
130
160
  }
131
-
161
+
132
162
  spinner.succeed('Environment ready');
133
163
  return true;
134
164
  } catch (error) {
@@ -139,9 +169,41 @@ fi`;
139
169
  }
140
170
  }
141
171
 
172
+ async function setupPathQuiet() {
173
+ try {
174
+ // Create PATH script
175
+ const envScript = `#!/bin/bash
176
+ # TRIBE CLI Environment
177
+ TRIBE_BIN_DIR="$HOME/.tribe/bin"
178
+ if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
179
+ export PATH="$TRIBE_BIN_DIR:$PATH"
180
+ fi`;
181
+
182
+ const envScriptPath = path.join(tribeDir, 'tribe-env.sh');
183
+ fs.writeFileSync(envScriptPath, envScript);
184
+ fs.chmodSync(envScriptPath, '755');
185
+
186
+ // Try to add to shell config
187
+ const shellConfig = process.env.SHELL?.includes('zsh') ? '.zshrc' : '.bashrc';
188
+ const rcPath = path.join(homeDir, shellConfig);
189
+ const sourceLine = 'source ~/.tribe/tribe-env.sh';
190
+
191
+ if (fs.existsSync(rcPath)) {
192
+ const content = fs.readFileSync(rcPath, 'utf8');
193
+ if (!content.includes(sourceLine)) {
194
+ fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceLine}\n`);
195
+ }
196
+ }
197
+
198
+ return true;
199
+ } catch (error) {
200
+ throw new Error('PATH setup failed: ' + error.message);
201
+ }
202
+ }
203
+
142
204
  async function main() {
143
205
  const args = process.argv.slice(2);
144
-
206
+
145
207
  // Handle help
146
208
  if (args.includes('--help') || args.includes('-h')) {
147
209
  console.log(chalk.bold('TRIBE Telemetry Installer\n'));
@@ -152,27 +214,38 @@ async function main() {
152
214
  console.log(' --version Show version');
153
215
  process.exit(0);
154
216
  }
155
-
217
+
156
218
  // Show welcome
157
219
  showWelcome();
158
-
159
- // Install TRIBE CLI
160
- const success = await installTribeCLI();
161
- if (!success) {
162
- console.error(chalk.red('\n❌ Installation failed'));
163
- console.log(chalk.yellow('Please check your internet connection and try again'));
220
+
221
+ // Single spinner for entire installation
222
+ const spinner = ora('Installing...').start();
223
+
224
+ try {
225
+ // Install TRIBE CLI
226
+ spinner.text = 'Installing CLI...';
227
+ const success = await installTribeCLIQuiet();
228
+ if (!success) {
229
+ spinner.fail('Installation failed');
230
+ console.log(chalk.yellow('Please check your internet connection and try again'));
231
+ process.exit(1);
232
+ }
233
+
234
+ // Setup PATH
235
+ spinner.text = 'Setting up environment...';
236
+ await setupPathQuiet();
237
+
238
+ spinner.succeed('Ready!');
239
+
240
+ // Show completion
241
+ console.log('Type ' + chalk.cyan.bold('tribe') + ' to get started');
242
+
243
+ } catch (error) {
244
+ spinner.fail('Installation failed');
245
+ console.error(chalk.red(error.message));
164
246
  process.exit(1);
165
247
  }
166
-
167
- // Setup PATH
168
- await setupPath();
169
-
170
- // Show completion
171
- console.log('');
172
- showInstallationSummary();
173
-
174
- // Final message - included in showInstallationSummary now
175
-
248
+
176
249
  process.exit(0);
177
250
  }
178
251
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_xtribe/cli",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
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": {