@_xtribe/cli 2.0.3 β 2.0.5
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/README.md +51 -174
- package/index.js +20 -0
- package/install-tribe-autolaunch.js +272 -0
- package/install-tribe-minimal.js +171 -0
- package/install-tribe.js +162 -41
- package/install.sh +52 -0
- package/package.json +22 -22
- package/setup-path.js +105 -0
- package/tribe-deployment.yaml +761 -0
package/README.md
CHANGED
|
@@ -1,207 +1,84 @@
|
|
|
1
|
-
# TRIBE
|
|
1
|
+
# TRIBE CLI Installer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automate your TRIBE development environment with a single command. This npm package delivers the latest TRIBE CLI binary, bootstraps required dependencies (Colima, kubectl, container runtime), and wires the CLI into your shell `PATH` so you can start managing telemetry and authentication immediately.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
## Requirements
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- **Operating systems:** macOS (Intel/Apple Silicon) or Linux
|
|
8
|
+
- **Node.js:** v16 or newer (the installer runs via `npx`)
|
|
9
|
+
- **Docker alternative:** The installer provisions Colima automatically; you can skip it with `--skip-cluster` if you already have a configured runtime.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
npx @_xtribe/cli@latest
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
That's it! This single command sets up your entire AI development environment.
|
|
15
|
-
|
|
16
|
-
## π‘ Why TRIBE?
|
|
17
|
-
|
|
18
|
-
**The Problem:** Writing code takes time. Even with AI assistants, you're still copy-pasting, context-switching, and managing everything manually.
|
|
19
|
-
|
|
20
|
-
**The Solution:** TRIBE deploys a team of AI agents that work like real developers. They understand your requirements, write code, create pull requests, and even handle code reviewsβall running securely on your local machine.
|
|
21
|
-
|
|
22
|
-
## π― What Can TRIBE Do?
|
|
23
|
-
|
|
24
|
-
### Real Examples, Real Results
|
|
11
|
+
## Installation
|
|
25
12
|
|
|
26
13
|
```bash
|
|
27
|
-
|
|
28
|
-
tribe submit-prompt "Build a user management API with JWT auth, password reset, and email verification"
|
|
29
|
-
|
|
30
|
-
# Add features to existing code
|
|
31
|
-
tribe submit-prompt "Add rate limiting and request logging to all API endpoints"
|
|
32
|
-
|
|
33
|
-
# Fix bugs with context
|
|
34
|
-
tribe submit-prompt "Debug why user sessions expire after 5 minutes instead of 24 hours"
|
|
35
|
-
|
|
36
|
-
# Refactor legacy code
|
|
37
|
-
tribe submit-prompt "Refactor the payment processing module to use async/await instead of callbacks"
|
|
14
|
+
npx @_xtribe/cli@latest --version
|
|
38
15
|
```
|
|
39
16
|
|
|
40
|
-
|
|
41
|
-
- β
Break down your request into logical tasks
|
|
42
|
-
- β
Assign specialized agents to each task
|
|
43
|
-
- β
Write code in parallel across multiple feature branches
|
|
44
|
-
- β
Create pull requests with detailed descriptions
|
|
45
|
-
- β
Implement features with best practices
|
|
17
|
+
Running the installer will:
|
|
46
18
|
|
|
47
|
-
|
|
19
|
+
1. Detect your platform and download the matching TRIBE CLI binary.
|
|
20
|
+
2. Install or verify Colima, kubectl, and supporting services.
|
|
21
|
+
3. Place the CLI at `~/.tribe/bin/tribe` and configure your shell `PATH` via `~/.tribe/tribe-env.sh`.
|
|
22
|
+
4. Start the local container runtime (unless it is already running).
|
|
48
23
|
|
|
49
|
-
|
|
50
|
-
2. **Intelligent Task Breakdown** β TRIBE analyzes and creates an execution plan
|
|
51
|
-
3. **Parallel Agent Execution** β Multiple AI agents work simultaneously
|
|
52
|
-
4. **Code Implementation** β Agents write clean, tested code
|
|
53
|
-
5. **Pull Request Ready** β Review and merge when you're satisfied
|
|
24
|
+
> **Tip:** Source `~/.tribe/tribe-env.sh` to use the CLI immediately in the current shell.
|
|
54
25
|
|
|
55
|
-
##
|
|
26
|
+
## Usage
|
|
56
27
|
|
|
57
|
-
|
|
58
|
-
- **Claude Code CLI**: Install with `npm install -g @anthropic-ai/claude-code` and authenticate
|
|
59
|
-
- **Docker** or **Colima**: For running the local Kubernetes cluster
|
|
60
|
-
- **Node.js 16+**: Required for the CLI
|
|
61
|
-
|
|
62
|
-
### Installation
|
|
28
|
+
Launch the CLI with:
|
|
63
29
|
|
|
64
30
|
```bash
|
|
65
|
-
|
|
66
|
-
npx @_xtribe/cli@latest
|
|
67
|
-
|
|
68
|
-
# 2. Install and authenticate Claude Code CLI (if not already done)
|
|
69
|
-
npm install -g @anthropic-ai/claude-code
|
|
70
|
-
claude auth login
|
|
71
|
-
|
|
72
|
-
# 3. Start TRIBE
|
|
73
|
-
tribe start
|
|
31
|
+
tribe --help
|
|
74
32
|
```
|
|
75
33
|
|
|
76
|
-
###
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Interactive mode (recommended for beginners)
|
|
80
|
-
tribe
|
|
34
|
+
### Telemetry Commands
|
|
81
35
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
36
|
+
| Command | Description |
|
|
37
|
+
| -------------- | --------------------------------------------- |
|
|
38
|
+
| `tribe enable` | Start the tutor telemetry collector daemon. |
|
|
39
|
+
| `tribe disable`| Stop the collector and disable auto-start. |
|
|
40
|
+
| `tribe status` | Display OAuth status, collector health, and recent event counts. |
|
|
41
|
+
| `tribe logs` | Tail the telemetry collector log file. |
|
|
85
42
|
|
|
86
|
-
|
|
87
|
-
- Create a new repository
|
|
88
|
-
- Set up the project structure
|
|
89
|
-
- Implement all features
|
|
90
|
-
- Write tests
|
|
91
|
-
- Create documentation
|
|
43
|
+
### Authentication Commands
|
|
92
44
|
|
|
93
|
-
|
|
45
|
+
| Command | Description |
|
|
46
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
47
|
+
| `tribe login` | Launches the TRIBE OAuth flow (opens browser, handles callback, stores tokens in `~/.tribe/tutor/auth.json`). |
|
|
48
|
+
| `tribe logout` | Removes stored credentials and stops authenticated telemetry. |
|
|
94
49
|
|
|
95
|
-
|
|
96
|
-
# See what your agents are doing (multiple ways)
|
|
97
|
-
tribe tasks # Object-oriented syntax
|
|
98
|
-
tribe list-tasks # Traditional syntax
|
|
50
|
+
### Flags
|
|
99
51
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
52
|
+
- `-localhost` — Force localhost mode (auto-starts local tutor services instead of production).
|
|
53
|
+
- `-verbose` — Emit verbose installer or runtime logs for debugging.
|
|
54
|
+
- `-beta` — Enable advanced/beta commands when available.
|
|
103
55
|
|
|
104
|
-
|
|
105
|
-
tribe workers # Object-oriented syntax
|
|
106
|
-
tribe worker-status # Traditional syntax
|
|
107
|
-
```
|
|
56
|
+
Combine flags with commands, for example `tribe -verbose status`.
|
|
108
57
|
|
|
109
|
-
|
|
58
|
+
## Typical Workflow
|
|
110
59
|
|
|
111
60
|
```bash
|
|
112
|
-
#
|
|
113
|
-
|
|
61
|
+
# Install (or upgrade) the CLI
|
|
62
|
+
npx @_xtribe/cli@latest --version
|
|
114
63
|
|
|
115
|
-
#
|
|
116
|
-
|
|
64
|
+
# Authenticate and start telemetry
|
|
65
|
+
tribe login
|
|
66
|
+
tribe status
|
|
117
67
|
|
|
118
|
-
#
|
|
119
|
-
|
|
68
|
+
# Review logs when troubleshooting
|
|
69
|
+
tribe logs
|
|
120
70
|
```
|
|
121
71
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### π€ Autonomous Multi-Agent System
|
|
125
|
-
- **Specialized Agents**: Different agents for frontend, backend, testing, and documentation
|
|
126
|
-
- **Parallel Execution**: Multiple agents work simultaneously on different tasks
|
|
127
|
-
- **Smart Coordination**: Agents understand dependencies and work in the right order
|
|
128
|
-
|
|
129
|
-
### π Security & Privacy First
|
|
130
|
-
- **100% Local**: Your code never leaves your machine
|
|
131
|
-
- **Isolated Environment**: Runs in Kubernetes with proper resource limits
|
|
132
|
-
- **Full Control**: Review every line before merging
|
|
133
|
-
|
|
134
|
-
### π οΈ Developer-Friendly
|
|
135
|
-
- **Git-Native**: Each task creates a proper feature branch
|
|
136
|
-
- **Standard PRs**: Review changes like any other pull request
|
|
137
|
-
- **IDE Compatible**: Work with your favorite editor while agents code
|
|
138
|
-
|
|
139
|
-
### π Real-Time Monitoring
|
|
140
|
-
- **Live Progress**: See what each agent is working on
|
|
141
|
-
- **Task Tracking**: Monitor completion status
|
|
142
|
-
- **Performance Metrics**: Understand how your agents are performing
|
|
143
|
-
|
|
144
|
-
## π Use Cases
|
|
145
|
-
|
|
146
|
-
### Startups & MVPs
|
|
147
|
-
Build your MVP faster by describing features in plain English and letting TRIBE handle the implementation.
|
|
148
|
-
|
|
149
|
-
### Enterprise Development
|
|
150
|
-
Automate routine feature development, bug fixes, and refactoring tasks while your team focuses on architecture.
|
|
151
|
-
|
|
152
|
-
### Learning & Experimentation
|
|
153
|
-
See how experienced developers would implement your ideas by reviewing the code TRIBE generates.
|
|
154
|
-
|
|
155
|
-
## π§ Commands Reference
|
|
156
|
-
|
|
157
|
-
TRIBE supports both traditional and object-oriented command syntax:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
# Cluster Management
|
|
161
|
-
tribe start # Start TRIBE cluster
|
|
162
|
-
tribe stop # Stop TRIBE cluster
|
|
163
|
-
tribe status # Check system status
|
|
164
|
-
|
|
165
|
-
# Task Management (two ways)
|
|
166
|
-
tribe submit-prompt "description" # Create new project from prompt
|
|
167
|
-
tribe tasks # List all tasks (object-oriented)
|
|
168
|
-
tribe list-tasks # List all tasks (traditional)
|
|
169
|
-
tribe tasks <id> # Show task details (object-oriented)
|
|
170
|
-
tribe show-task <id> # Show task details (traditional)
|
|
171
|
-
|
|
172
|
-
# Project Management
|
|
173
|
-
tribe projects # List all projects (object-oriented)
|
|
174
|
-
tribe list-projects # List all projects (traditional)
|
|
175
|
-
|
|
176
|
-
# Worker Management
|
|
177
|
-
tribe workers # List workers (object-oriented)
|
|
178
|
-
tribe worker-status # Show worker status (traditional)
|
|
179
|
-
tribe scale-workers <count> # Scale agent count
|
|
180
|
-
|
|
181
|
-
# Advanced Object-Oriented Examples
|
|
182
|
-
tribe pods # List all pods
|
|
183
|
-
tribe pods <name> logs # View pod logs
|
|
184
|
-
tribe services <name> restart # Restart a service
|
|
185
|
-
|
|
186
|
-
# Code Management
|
|
187
|
-
tribe export-branches # Export all branches locally
|
|
188
|
-
tribe export-branch <name> # Export specific branch
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## π€ Community & Support
|
|
192
|
-
|
|
193
|
-
- **GitHub**: [github.com/TRIBE-INC/0zen](https://github.com/TRIBE-INC/0zen)
|
|
194
|
-
- **Issues**: [github.com/TRIBE-INC/0zen/issues](https://github.com/TRIBE-INC/0zen/issues)
|
|
195
|
-
- **Documentation**: [Full documentation in repository](https://github.com/TRIBE-INC/0zen/blob/main/README.md)
|
|
72
|
+
Successful authentication writes fresh tokens and the collector begins pushing events to `https://tutor.tribecode.ai`. Run `tribe status` any time to confirm the collector PID, uptime, and recent event totals.
|
|
196
73
|
|
|
197
|
-
##
|
|
74
|
+
## Troubleshooting
|
|
198
75
|
|
|
199
|
-
|
|
76
|
+
- **OAuth callback shows a blank page:** This is expected once the CLI captures the code. Check the terminal for `β
Authorization received` and rerun `tribe status` to confirm.
|
|
77
|
+
- **Collector reports `TOKEN_VALIDATION_FAILED`:** Refresh credentials with `tribe login` and ensure the collector restarts (`tribe disable && tribe enable`).
|
|
78
|
+
- **PATH not updated:** Source `~/.tribe/tribe-env.sh` or add `export PATH="$HOME/.tribe/bin:$PATH"` to your shell profile.
|
|
200
79
|
|
|
201
|
-
|
|
80
|
+
## Additional Resources
|
|
202
81
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
<p><em>Start building faster with TRIBE today</em></p>
|
|
207
|
-
</div>
|
|
82
|
+
- [TRIBE CLI & Platform Docs](https://github.com/TRIBE-INC/0zen) β architecture overviews, local setup, and troubleshooting guides.
|
|
83
|
+
- [TRIBE API Reference](https://github.com/TRIBE-INC/tribe-api) β REST endpoints for retrieving telemetry, session insights, and system metadata.
|
|
84
|
+
- [TRIBE Documentation Portal](https://docs.tribecode.ai/) β centralized guides, onboarding flows, and deep dives into telemetry processing.
|
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default entry point for npx @_xtribe/cli
|
|
5
|
+
* This runs the full installation process
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Execute the installer in a way that preserves require.main
|
|
9
|
+
const { spawn } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const installerPath = path.join(__dirname, 'install-tribe.js');
|
|
13
|
+
const child = spawn(process.execPath, [installerPath, ...process.argv.slice(2)], {
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
env: process.env
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
child.on('exit', (code) => {
|
|
19
|
+
process.exit(code || 0);
|
|
20
|
+
});
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { spawn, execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
// Import the existing installer
|
|
9
|
+
const originalInstaller = require('./install-tribe.js');
|
|
10
|
+
|
|
11
|
+
// Auto-launch specific functionality
|
|
12
|
+
const platform = os.platform();
|
|
13
|
+
const homeDir = os.homedir();
|
|
14
|
+
const tribeDir = path.join(homeDir, '.tribe');
|
|
15
|
+
const firstTimeMarker = path.join(tribeDir, '.first-install-complete');
|
|
16
|
+
|
|
17
|
+
// Color codes for output
|
|
18
|
+
const colors = {
|
|
19
|
+
reset: '\x1b[0m',
|
|
20
|
+
bright: '\x1b[1m',
|
|
21
|
+
green: '\x1b[32m',
|
|
22
|
+
yellow: '\x1b[33m',
|
|
23
|
+
blue: '\x1b[34m',
|
|
24
|
+
cyan: '\x1b[36m'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function log(message, color = '') {
|
|
28
|
+
console.log(color + message + colors.reset);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function sleep(ms) {
|
|
32
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check if we should auto-launch the interactive UI
|
|
37
|
+
*/
|
|
38
|
+
function shouldAutoLaunch() {
|
|
39
|
+
// Check for command line flags
|
|
40
|
+
const args = process.argv.slice(2);
|
|
41
|
+
const noLaunchFlag = args.includes('--no-launch') || args.includes('--no-auto');
|
|
42
|
+
const launchFlag = args.includes('--launch') || args.includes('--auto');
|
|
43
|
+
const simpleFlag = args.includes('--simple');
|
|
44
|
+
|
|
45
|
+
if (noLaunchFlag || simpleFlag) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (launchFlag) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Auto-launch conditions:
|
|
54
|
+
// 1. Interactive terminal (TTY)
|
|
55
|
+
const isTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
56
|
+
if (!isTTY) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 2. Not in CI environment
|
|
61
|
+
const isCI = process.env.CI === 'true' ||
|
|
62
|
+
process.env.CONTINUOUS_INTEGRATION === 'true' ||
|
|
63
|
+
process.env.GITHUB_ACTIONS === 'true';
|
|
64
|
+
if (isCI) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 3. First time install (no marker file exists)
|
|
69
|
+
const isFirstTime = !fs.existsSync(firstTimeMarker);
|
|
70
|
+
|
|
71
|
+
return isFirstTime;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get the path to the tribe binary
|
|
76
|
+
*/
|
|
77
|
+
function getTribeBinaryPath() {
|
|
78
|
+
const tribeBinDir = path.join(homeDir, '.tribe', 'bin');
|
|
79
|
+
const tribePath = path.join(tribeBinDir, 'tribe');
|
|
80
|
+
|
|
81
|
+
if (fs.existsSync(tribePath)) {
|
|
82
|
+
return tribePath;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Try global install
|
|
86
|
+
try {
|
|
87
|
+
return execSync('which tribe', { encoding: 'utf8' }).trim();
|
|
88
|
+
} catch {
|
|
89
|
+
throw new Error('Tribe binary not found');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Check if the Tribe cluster is running
|
|
95
|
+
*/
|
|
96
|
+
async function isClusterRunning() {
|
|
97
|
+
try {
|
|
98
|
+
const tribePath = getTribeBinaryPath();
|
|
99
|
+
const result = execSync(`${tribePath} --simple status`, { encoding: 'utf8' });
|
|
100
|
+
return result.includes('Cluster is running');
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Start the Tribe cluster
|
|
108
|
+
*/
|
|
109
|
+
async function startCluster() {
|
|
110
|
+
const tribePath = getTribeBinaryPath();
|
|
111
|
+
log('\nStarting Tribe cluster...', colors.cyan);
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
execSync(`${tribePath} --simple start`, { stdio: 'inherit' });
|
|
115
|
+
|
|
116
|
+
// Wait for cluster to be ready
|
|
117
|
+
log('Waiting for services to be ready...', colors.yellow);
|
|
118
|
+
let attempts = 0;
|
|
119
|
+
while (attempts < 30) {
|
|
120
|
+
await sleep(2000);
|
|
121
|
+
if (await isClusterRunning()) {
|
|
122
|
+
log('β
Cluster is ready!', colors.green);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
attempts++;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
throw new Error('Cluster failed to start in time');
|
|
129
|
+
} catch (error) {
|
|
130
|
+
log('Failed to start cluster: ' + error.message, colors.reset);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Display the first-time welcome experience
|
|
137
|
+
*/
|
|
138
|
+
async function showFirstTimeWelcome() {
|
|
139
|
+
console.log('\n' + colors.bright + colors.cyan + 'π Welcome to TRIBE!' + colors.reset);
|
|
140
|
+
console.log('\nYour AI development team is ready to help you build amazing software!\n');
|
|
141
|
+
|
|
142
|
+
console.log('Meet your AI agents:');
|
|
143
|
+
console.log(' π¨ ' + colors.bright + 'Pixel' + colors.reset + ' - Creative Design & UI/UX');
|
|
144
|
+
console.log(' β‘ ' + colors.bright + 'Spark' + colors.reset + ' - Implementation & Performance');
|
|
145
|
+
console.log(' π ' + colors.bright + 'Nova' + colors.reset + ' - Architecture & Strategy');
|
|
146
|
+
console.log(' π§ ' + colors.bright + 'Zen' + colors.reset + ' - Testing & Quality');
|
|
147
|
+
console.log(' π₯ ' + colors.bright + 'Blaze' + colors.reset + ' - DevOps & Infrastructure');
|
|
148
|
+
console.log(' π ' + colors.bright + 'Cosmos' + colors.reset + ' - Data & Analytics');
|
|
149
|
+
console.log(' π ' + colors.bright + 'Echo' + colors.reset + ' - API & Integration');
|
|
150
|
+
console.log(' βοΈ ' + colors.bright + 'Quantum' + colors.reset + ' - Security & Cryptography');
|
|
151
|
+
|
|
152
|
+
console.log('\n' + colors.yellow + 'Launching interactive mode...' + colors.reset);
|
|
153
|
+
await sleep(2000);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Launch the Tribe interactive UI
|
|
158
|
+
*/
|
|
159
|
+
async function launchTribeInteractive() {
|
|
160
|
+
const tribePath = getTribeBinaryPath();
|
|
161
|
+
|
|
162
|
+
// Clear the screen for a clean start
|
|
163
|
+
if (platform !== 'win32') {
|
|
164
|
+
process.stdout.write('\x1Bc');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Launch tribe in interactive mode (default when no args)
|
|
168
|
+
const child = spawn(tribePath, [], {
|
|
169
|
+
stdio: 'inherit',
|
|
170
|
+
env: {
|
|
171
|
+
...process.env,
|
|
172
|
+
TERM: process.env.TERM || 'xterm-256color'
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Handle child process exit
|
|
177
|
+
child.on('exit', (code) => {
|
|
178
|
+
if (code !== 0) {
|
|
179
|
+
console.error(`\nTribe exited with code ${code}`);
|
|
180
|
+
}
|
|
181
|
+
process.exit(code || 0);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Handle errors
|
|
185
|
+
child.on('error', (err) => {
|
|
186
|
+
console.error('Failed to launch Tribe:', err.message);
|
|
187
|
+
showManualInstructions();
|
|
188
|
+
process.exit(1);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Show manual launch instructions
|
|
194
|
+
*/
|
|
195
|
+
function showManualInstructions() {
|
|
196
|
+
console.log('\n' + colors.yellow + 'To start Tribe manually:' + colors.reset);
|
|
197
|
+
console.log(' ' + colors.green + 'tribe' + colors.reset + ' # Interactive mode');
|
|
198
|
+
console.log(' ' + colors.green + 'tribe --simple' + colors.reset + ' # Simple CLI mode');
|
|
199
|
+
console.log(' ' + colors.green + 'tribe --help' + colors.reset + ' # Show all options\n');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Mark first install as complete
|
|
204
|
+
*/
|
|
205
|
+
function markFirstInstallComplete() {
|
|
206
|
+
if (!fs.existsSync(tribeDir)) {
|
|
207
|
+
fs.mkdirSync(tribeDir, { recursive: true });
|
|
208
|
+
}
|
|
209
|
+
fs.writeFileSync(firstTimeMarker, new Date().toISOString());
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Main auto-launch handler
|
|
214
|
+
*/
|
|
215
|
+
async function handleAutoLaunch() {
|
|
216
|
+
// Only proceed if we should auto-launch
|
|
217
|
+
if (!shouldAutoLaunch()) {
|
|
218
|
+
showManualInstructions();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
// Check if this is first time
|
|
224
|
+
const isFirstTime = !fs.existsSync(firstTimeMarker);
|
|
225
|
+
|
|
226
|
+
// Show welcome for first-time users
|
|
227
|
+
if (isFirstTime) {
|
|
228
|
+
await showFirstTimeWelcome();
|
|
229
|
+
} else {
|
|
230
|
+
log('\nLaunching TRIBE interactive mode...', colors.cyan);
|
|
231
|
+
await sleep(1000);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Check and start cluster if needed (skip if --no-start was used)
|
|
235
|
+
const args = process.argv.slice(2);
|
|
236
|
+
const skipCluster = args.includes('--skip-cluster') || args.includes('--no-start');
|
|
237
|
+
|
|
238
|
+
if (!skipCluster && !await isClusterRunning()) {
|
|
239
|
+
const started = await startCluster();
|
|
240
|
+
if (!started) {
|
|
241
|
+
showManualInstructions();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Mark first install complete before launching
|
|
247
|
+
if (isFirstTime) {
|
|
248
|
+
markFirstInstallComplete();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Launch the interactive UI
|
|
252
|
+
await launchTribeInteractive();
|
|
253
|
+
|
|
254
|
+
} catch (error) {
|
|
255
|
+
console.error('\n' + colors.reset + 'Could not launch Tribe automatically.');
|
|
256
|
+
console.error('Error:', error.message);
|
|
257
|
+
showManualInstructions();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Export for use in main installer
|
|
262
|
+
module.exports = {
|
|
263
|
+
shouldAutoLaunch,
|
|
264
|
+
handleAutoLaunch,
|
|
265
|
+
showManualInstructions,
|
|
266
|
+
markFirstInstallComplete
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// If run directly (for testing)
|
|
270
|
+
if (require.main === module) {
|
|
271
|
+
handleAutoLaunch();
|
|
272
|
+
}
|