@_xtribe/cli 2.1.2 ā 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.
- package/install-tribe.js +111 -83
- package/package.json +1 -1
package/install-tribe.js
CHANGED
|
@@ -36,51 +36,9 @@ if (!fs.existsSync(tribeBinDir)) {
|
|
|
36
36
|
function showWelcome() {
|
|
37
37
|
console.clear();
|
|
38
38
|
console.log(chalk.cyan(asciiArt));
|
|
39
|
-
console.log(chalk.
|
|
40
|
-
console.log(chalk.bold('Your Personal AI Engineering Coach ⢠Build Skills That Matter\n'));
|
|
41
|
-
|
|
42
|
-
console.log('TRIBE Tutor teaches you to master AI tools through hands-on learning:');
|
|
43
|
-
console.log(' š ' + chalk.cyan('Context engineering mastery') + ' - Learn what context gets better results');
|
|
44
|
-
console.log(' šÆ ' + chalk.cyan('Personalized coaching') + ' - Tailored lessons from your real usage');
|
|
45
|
-
console.log(' š§ ' + chalk.cyan('Skill development') + ' - From basic prompts to expert context engineering');
|
|
46
|
-
console.log(' ā” ' + chalk.cyan('Maximum impact') + ' - Focus on techniques that actually matter\n');
|
|
47
|
-
|
|
48
|
-
console.log(chalk.yellow('š Everyone can learn AI engineering - we make it simple and practical'));
|
|
49
|
-
console.log(chalk.gray(`\nPlatform: ${platform} (${arch}) ⢠Node: ${process.version}\n`));
|
|
39
|
+
console.log(chalk.gray('Master AI Engineering Through Practice\n'));
|
|
50
40
|
}
|
|
51
41
|
|
|
52
|
-
function showInstallationSummary() {
|
|
53
|
-
console.log('\n' + 'ā'.repeat(70));
|
|
54
|
-
console.log(chalk.green.bold('\nš Your AI Engineering Coach is Ready!\n'));
|
|
55
|
-
|
|
56
|
-
console.log(chalk.cyan.bold('š Personalized Learning System Activated'));
|
|
57
|
-
console.log(chalk.gray(' Watching your AI workflow to create custom lessons just for you'));
|
|
58
|
-
console.log(chalk.gray(' š Privacy-first: We analyze patterns, not your code content\n'));
|
|
59
|
-
|
|
60
|
-
console.log(chalk.bold('ā” How Your Skills Will Grow:'));
|
|
61
|
-
console.log(' š ' + chalk.green('Learn from real examples') + ' - Your own coding sessions become lessons');
|
|
62
|
-
console.log(' šÆ ' + chalk.green('Practice with purpose') + ' - Focus on what actually improves your work');
|
|
63
|
-
console.log(' š§ ' + chalk.green('Build expert intuition') + ' - Understand why some approaches work better\n');
|
|
64
|
-
|
|
65
|
-
console.log(chalk.bold.magenta('š ļø AI Engineering Skills You\'ll Master:'));
|
|
66
|
-
console.log(' š¤ Claude context engineering ⢠┠Cursor workflow design ⢠š Multi-tool context switching ⢠š» Advanced prompt architecture\n');
|
|
67
|
-
|
|
68
|
-
console.log(chalk.bold('šÆ Your Learning Path:'));
|
|
69
|
-
console.log(chalk.cyan.bold(' 1. tribe login') + chalk.gray(' # Start your personalized curriculum'));
|
|
70
|
-
console.log(chalk.cyan.bold(' 2. code normally') + chalk.gray(' # Every session teaches us about your style'));
|
|
71
|
-
console.log(chalk.cyan.bold(' 3. tribe insights') + chalk.gray(' # Get custom lessons based on your progress\n'));
|
|
72
|
-
|
|
73
|
-
console.log(chalk.bold('š Skills You\'ll Develop:'));
|
|
74
|
-
console.log(' šØ ' + chalk.yellow('Context engineering that gets better results every time'));
|
|
75
|
-
console.log(' ā” ' + chalk.yellow('Workflow patterns that maximize your speed and context quality'));
|
|
76
|
-
console.log(' šÆ ' + chalk.yellow('Context switching - when to use what tools and why'));
|
|
77
|
-
console.log(' š§ ' + chalk.yellow('AI engineering intuition that compounds over time\n'));
|
|
78
|
-
|
|
79
|
-
console.log(chalk.gray('Learning Dashboard: ') + chalk.cyan('https://tribecode.ai/tribe/learn'));
|
|
80
|
-
console.log(chalk.gray('Skill Progression: ') + chalk.cyan('https://tribecode.ai/tribe/progress'));
|
|
81
|
-
console.log(chalk.gray('Privacy & Security: ') + chalk.cyan('https://tribecode.ai/docs/privacy-security'));
|
|
82
|
-
console.log('\n' + 'ā'.repeat(70) + '\n');
|
|
83
|
-
}
|
|
84
42
|
|
|
85
43
|
async function downloadFile(url, dest) {
|
|
86
44
|
return new Promise((resolve, reject) => {
|
|
@@ -104,24 +62,24 @@ async function downloadFile(url, dest) {
|
|
|
104
62
|
|
|
105
63
|
async function installTribeCLI() {
|
|
106
64
|
const tribeDest = path.join(tribeBinDir, 'tribe');
|
|
107
|
-
|
|
65
|
+
|
|
108
66
|
// Check if update needed
|
|
109
67
|
const exists = fs.existsSync(tribeDest);
|
|
110
|
-
const spinner = ora(exists ? '
|
|
111
|
-
|
|
68
|
+
const spinner = ora(exists ? 'Updating CLI...' : 'Installing CLI...').start();
|
|
69
|
+
|
|
112
70
|
try {
|
|
113
71
|
// Remove existing if present
|
|
114
72
|
if (exists) {
|
|
115
73
|
fs.unlinkSync(tribeDest);
|
|
116
74
|
}
|
|
117
|
-
|
|
75
|
+
|
|
118
76
|
// Download from GitHub
|
|
119
77
|
const githubRepo = 'TRIBE-INC/releases';
|
|
120
78
|
const downloadUrl = `https://github.com/${githubRepo}/releases/latest/download/tribe-${platform}-${arch}`;
|
|
121
|
-
|
|
79
|
+
|
|
122
80
|
await downloadFile(downloadUrl, tribeDest);
|
|
123
81
|
fs.chmodSync(tribeDest, '755');
|
|
124
|
-
|
|
82
|
+
|
|
125
83
|
// Remove macOS quarantine if needed
|
|
126
84
|
if (platform === 'darwin') {
|
|
127
85
|
try {
|
|
@@ -130,8 +88,8 @@ async function installTribeCLI() {
|
|
|
130
88
|
// Not critical
|
|
131
89
|
}
|
|
132
90
|
}
|
|
133
|
-
|
|
134
|
-
spinner.succeed(
|
|
91
|
+
|
|
92
|
+
spinner.succeed('CLI ready');
|
|
135
93
|
return true;
|
|
136
94
|
} catch (error) {
|
|
137
95
|
spinner.fail(`Installation failed: ${error.message}`);
|
|
@@ -139,9 +97,43 @@ async function installTribeCLI() {
|
|
|
139
97
|
}
|
|
140
98
|
}
|
|
141
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
|
+
|
|
142
134
|
async function setupPath() {
|
|
143
|
-
const spinner = ora('
|
|
144
|
-
|
|
135
|
+
const spinner = ora('Setting up PATH...').start();
|
|
136
|
+
|
|
145
137
|
try {
|
|
146
138
|
// Create PATH script
|
|
147
139
|
const envScript = `#!/bin/bash
|
|
@@ -150,24 +142,24 @@ TRIBE_BIN_DIR="$HOME/.tribe/bin"
|
|
|
150
142
|
if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
|
|
151
143
|
export PATH="$TRIBE_BIN_DIR:$PATH"
|
|
152
144
|
fi`;
|
|
153
|
-
|
|
145
|
+
|
|
154
146
|
const envScriptPath = path.join(tribeDir, 'tribe-env.sh');
|
|
155
147
|
fs.writeFileSync(envScriptPath, envScript);
|
|
156
148
|
fs.chmodSync(envScriptPath, '755');
|
|
157
|
-
|
|
149
|
+
|
|
158
150
|
// Try to add to shell config
|
|
159
151
|
const shellConfig = process.env.SHELL?.includes('zsh') ? '.zshrc' : '.bashrc';
|
|
160
152
|
const rcPath = path.join(homeDir, shellConfig);
|
|
161
153
|
const sourceLine = 'source ~/.tribe/tribe-env.sh';
|
|
162
|
-
|
|
154
|
+
|
|
163
155
|
if (fs.existsSync(rcPath)) {
|
|
164
156
|
const content = fs.readFileSync(rcPath, 'utf8');
|
|
165
157
|
if (!content.includes(sourceLine)) {
|
|
166
158
|
fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceLine}\n`);
|
|
167
159
|
}
|
|
168
160
|
}
|
|
169
|
-
|
|
170
|
-
spinner.succeed('
|
|
161
|
+
|
|
162
|
+
spinner.succeed('Environment ready');
|
|
171
163
|
return true;
|
|
172
164
|
} catch (error) {
|
|
173
165
|
spinner.warn('PATH setup needs manual configuration');
|
|
@@ -177,9 +169,41 @@ fi`;
|
|
|
177
169
|
}
|
|
178
170
|
}
|
|
179
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
|
+
|
|
180
204
|
async function main() {
|
|
181
205
|
const args = process.argv.slice(2);
|
|
182
|
-
|
|
206
|
+
|
|
183
207
|
// Handle help
|
|
184
208
|
if (args.includes('--help') || args.includes('-h')) {
|
|
185
209
|
console.log(chalk.bold('TRIBE Telemetry Installer\n'));
|
|
@@ -190,34 +214,38 @@ async function main() {
|
|
|
190
214
|
console.log(' --version Show version');
|
|
191
215
|
process.exit(0);
|
|
192
216
|
}
|
|
193
|
-
|
|
217
|
+
|
|
194
218
|
// Show welcome
|
|
195
219
|
showWelcome();
|
|
196
|
-
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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));
|
|
205
246
|
process.exit(1);
|
|
206
247
|
}
|
|
207
|
-
|
|
208
|
-
// Setup PATH
|
|
209
|
-
await setupPath();
|
|
210
|
-
|
|
211
|
-
// Show summary
|
|
212
|
-
showInstallationSummary();
|
|
213
|
-
|
|
214
|
-
// Final message
|
|
215
|
-
console.log(chalk.green.bold('š Your AI Engineering Journey Starts Now!\n'));
|
|
216
|
-
console.log(chalk.magenta.bold('š Run ') + chalk.cyan.bold('tribe login') + chalk.magenta.bold(' to begin your personalized learning path'));
|
|
217
|
-
console.log(chalk.gray(' Every coding session becomes a lesson. Every challenge becomes growth.\n'));
|
|
218
|
-
console.log(chalk.yellow('š Master AI engineering step by step - because it really doesn\'t have to be hard'));
|
|
219
|
-
console.log();
|
|
220
|
-
|
|
248
|
+
|
|
221
249
|
process.exit(0);
|
|
222
250
|
}
|
|
223
251
|
|