@_xtribe/cli 2.2.3 → 2.2.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.
- package/install-tribe.js +8 -58
- package/package.json +1 -1
package/install-tribe.js
CHANGED
|
@@ -7,6 +7,7 @@ const https = require('https');
|
|
|
7
7
|
const { execSync } = require('child_process');
|
|
8
8
|
const chalk = require('chalk');
|
|
9
9
|
const ora = require('ora');
|
|
10
|
+
const { EnhancedPathSetup } = require('./enhanced-path-setup');
|
|
10
11
|
|
|
11
12
|
// ASCII art for TRIBE
|
|
12
13
|
const asciiArt = `
|
|
@@ -162,69 +163,18 @@ async function installTribeCLIQuiet() {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
async function setupPath() {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// Create PATH script
|
|
169
|
-
const envScript = `#!/bin/bash
|
|
170
|
-
# TRIBE CLI Environment
|
|
171
|
-
TRIBE_BIN_DIR="$HOME/.tribe/bin"
|
|
172
|
-
if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
|
|
173
|
-
export PATH="$TRIBE_BIN_DIR:$PATH"
|
|
174
|
-
fi`;
|
|
175
|
-
|
|
176
|
-
const envScriptPath = path.join(tribeDir, 'tribe-env.sh');
|
|
177
|
-
fs.writeFileSync(envScriptPath, envScript);
|
|
178
|
-
fs.chmodSync(envScriptPath, '755');
|
|
179
|
-
|
|
180
|
-
// Try to add to shell config
|
|
181
|
-
const shellConfig = process.env.SHELL?.includes('zsh') ? '.zshrc' : '.bashrc';
|
|
182
|
-
const rcPath = path.join(homeDir, shellConfig);
|
|
183
|
-
const sourceLine = 'source ~/.tribe/tribe-env.sh';
|
|
184
|
-
|
|
185
|
-
if (fs.existsSync(rcPath)) {
|
|
186
|
-
const content = fs.readFileSync(rcPath, 'utf8');
|
|
187
|
-
if (!content.includes(sourceLine)) {
|
|
188
|
-
fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceLine}\n`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
spinner.succeed('Environment ready');
|
|
193
|
-
return true;
|
|
194
|
-
} catch (error) {
|
|
195
|
-
spinner.warn('PATH setup needs manual configuration');
|
|
196
|
-
console.log(chalk.yellow('\nTo use tribe command, run:'));
|
|
197
|
-
console.log(chalk.cyan(' source ~/.tribe/tribe-env.sh\n'));
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
166
|
+
const pathSetup = new EnhancedPathSetup();
|
|
167
|
+
const result = await pathSetup.setup();
|
|
168
|
+
return result.success;
|
|
200
169
|
}
|
|
201
170
|
|
|
202
171
|
async function setupPathQuiet() {
|
|
203
172
|
try {
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
|
|
209
|
-
export PATH="$TRIBE_BIN_DIR:$PATH"
|
|
210
|
-
fi`;
|
|
211
|
-
|
|
212
|
-
const envScriptPath = path.join(tribeDir, 'tribe-env.sh');
|
|
213
|
-
fs.writeFileSync(envScriptPath, envScript);
|
|
214
|
-
fs.chmodSync(envScriptPath, '755');
|
|
215
|
-
|
|
216
|
-
// Try to add to shell config
|
|
217
|
-
const shellConfig = process.env.SHELL?.includes('zsh') ? '.zshrc' : '.bashrc';
|
|
218
|
-
const rcPath = path.join(homeDir, shellConfig);
|
|
219
|
-
const sourceLine = 'source ~/.tribe/tribe-env.sh';
|
|
220
|
-
|
|
221
|
-
if (fs.existsSync(rcPath)) {
|
|
222
|
-
const content = fs.readFileSync(rcPath, 'utf8');
|
|
223
|
-
if (!content.includes(sourceLine)) {
|
|
224
|
-
fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceLine}\n`);
|
|
225
|
-
}
|
|
173
|
+
const pathSetup = new EnhancedPathSetup();
|
|
174
|
+
const result = await pathSetup.setup();
|
|
175
|
+
if (!result.success) {
|
|
176
|
+
throw new Error(result.error || 'PATH setup failed');
|
|
226
177
|
}
|
|
227
|
-
|
|
228
178
|
return true;
|
|
229
179
|
} catch (error) {
|
|
230
180
|
throw new Error('PATH setup failed: ' + error.message);
|