@_xtribe/cli 1.0.0-beta.5 → 1.0.0-beta.6

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 CHANGED
@@ -1,177 +1,123 @@
1
- # @_xtribe/cli
1
+ # TRIBE CLI - Zero to Productive in One Command
2
2
 
3
- Complete TRIBE multi-agent development environment installer.
3
+ TRIBE is an AI-powered multi-agent development system that manages your entire development workflow. From project creation to task implementation and PR reviews, TRIBE's AI agents handle it all.
4
4
 
5
- ## Quick Start
5
+ ## 🚀 One-Command Installation
6
6
 
7
7
  ```bash
8
8
  npx @_xtribe/cli
9
9
  ```
10
10
 
11
- This single command installs:
12
- - ✅ Docker CLI
13
- - ✅ Colima (lightweight container runtime for macOS)
14
- - ✅ Lima (virtualization layer)
15
- - ✅ KIND (Kubernetes in Docker)
16
- - ✅ kubectl (Kubernetes CLI)
17
- - ✅ TRIBE CLI (multi-agent orchestration)
11
+ That's it! This single command will:
12
+ - ✅ Install all required tools (Docker, Kubernetes, kubectl)
13
+ - ✅ Set up Colima container runtime (macOS)
14
+ - ✅ Deploy the complete TRIBE cluster
15
+ - ✅ Configure everything automatically
16
+ - ✅ Guide you through creating your first project
18
17
 
19
- ## After Installation
18
+ ## 🎯 What is TRIBE?
20
19
 
21
- Start the container runtime:
20
+ TRIBE is a complete development ecosystem where AI agents:
21
+ - 📝 Implement features based on your descriptions
22
+ - 🔧 Fix bugs autonomously
23
+ - 🔀 Create pull requests
24
+ - 👀 Handle code reviews
25
+ - 🚀 Manage the entire development lifecycle
22
26
 
23
- ```bash
24
- # Option 1: Use installed Colima
25
- colima start --cpu 2 --memory 4
26
-
27
- # Option 2: Use Docker Desktop
28
- # Download from: https://docs.docker.com/desktop/install/mac-install/
27
+ ## 💡 Quick Start
29
28
 
30
- # Option 3: Use Homebrew (recommended)
31
- brew install colima docker
32
- colima start
33
- ```
34
-
35
- Then start your TRIBE development environment:
29
+ After installation, just run:
36
30
 
37
31
  ```bash
38
- tribe start
39
- tribe status
40
- tribe deploy-task --prompt "Create REST API" --repo "https://github.com/your/repo"
32
+ tribe
41
33
  ```
42
34
 
43
- ## What is TRIBE?
44
-
45
- TRIBE (Task-Review-Iterate-Branch-Execute) is a multi-agent AI development system that automates software development workflows using multiple Claude AI agents working in parallel.
46
-
47
- ## System Requirements
48
-
49
- - macOS or Linux
50
- - Node.js 16+
51
- - Internet connection for downloads
52
-
53
- ## Support
35
+ The interactive CLI will:
36
+ 1. **First time?** Guide you through creating your first project
37
+ 2. **Returning?** Show your projects, tasks, and agent activity
54
38
 
55
- - Issues: https://github.com/0zen/0zen/issues
56
- - Documentation: https://github.com/0zen/0zen
57
-
58
- ## License
59
-
60
- MIT
61
-
62
- ## Overview
63
-
64
- The TRIBE CLI GUI provides both interactive and non-interactive modes for:
65
- - Listing and viewing tasks
66
- - Managing projects
67
- - Monitoring agents
68
- - Creating new tasks (interactive mode)
69
-
70
- ## Installation
39
+ ### Creating Tasks
71
40
 
72
41
  ```bash
73
- cd sdk/cmd/cli-gui
74
- go build -o cli-gui .
42
+ tribe create-task
43
+ # Select project, describe what you want built
44
+ # An AI agent picks it up and implements it!
75
45
  ```
76
46
 
77
- ## Usage
78
-
79
- ### Interactive Mode
80
-
81
- Simply run the CLI without arguments:
47
+ ### Reviewing PRs
82
48
 
83
49
  ```bash
84
- ./cli-gui
50
+ tribe review-task
51
+ # See PRs created by agents
52
+ # Review diffs, add comments, merge
85
53
  ```
86
54
 
87
- This will present a menu-driven interface where you can:
88
- 1. List all tasks
89
- 2. List all projects
90
- 3. List all agents
91
- 4. Create a new task
92
- 5. View task details
55
+ ## 🛠️ System Requirements
93
56
 
94
- ### Non-Interactive Mode
57
+ - **macOS** or **Linux**
58
+ - **4GB RAM** minimum (8GB recommended)
59
+ - **20GB disk space**
60
+ - **Node.js 16+**
95
61
 
96
- Perfect for scripting and automation:
62
+ ## 📚 Common Commands
97
63
 
98
64
  ```bash
99
- # List all tasks
100
- ./cli-gui --non-interactive --cmd list-tasks
101
-
102
- # List all projects
103
- ./cli-gui --non-interactive --cmd list-projects
104
-
105
- # List all agents
106
- ./cli-gui --non-interactive --cmd list-agents
107
-
108
- # View task details
109
- ./cli-gui --non-interactive --cmd task-details --task-id task-8e4999d6
110
-
111
- # Get JSON output
112
- ./cli-gui --non-interactive --cmd list-tasks --format json
65
+ tribe # Interactive mode
66
+ tribe status # Check system status
67
+ tribe create-task # Create a new task
68
+ tribe review-task # Review agent PRs
69
+ tribe list-projects # Show all projects
70
+ tribe list-agents # Show agent status
113
71
  ```
114
72
 
115
- ### Environment Variables
73
+ ## 🔧 Architecture
116
74
 
117
- Configure API endpoints using environment variables:
75
+ TRIBE runs a local Kubernetes cluster with:
76
+ - **Bridge** - API gateway and orchestrator
77
+ - **TaskMaster** - Task queue and agent coordinator
78
+ - **Claude Agents** - AI workers powered by Claude
79
+ - **Gitea** - Local Git server for repositories
80
+ - **PostgreSQL** - Database for state management
118
81
 
119
- ```bash
120
- export TASKMASTER_URL=http://localhost:8080
121
- export BRIDGE_URL=http://localhost:3456
122
- export GITEA_URL=http://localhost:3000
123
- ```
82
+ ## 🤝 Contributing
124
83
 
125
- ## Command-Line Options
84
+ TRIBE is open source! Visit our [GitHub repository](https://github.com/0zen/0zen) to contribute.
126
85
 
127
- - `--non-interactive`: Run in non-interactive mode
128
- - `--cmd <command>`: Command to execute (required in non-interactive mode)
129
- - `list-tasks`: List all tasks
130
- - `list-projects`: List all projects
131
- - `list-agents`: List all agents
132
- - `task-details`: View details of a specific task
133
- - `--task-id <id>`: Task ID (required for task-details command)
134
- - `--format <format>`: Output format (text or json, default: text)
86
+ ## 📖 Documentation
135
87
 
136
- ## Examples
88
+ For detailed documentation, visit the [TRIBE Flow Guide](https://github.com/0zen/0zen/blob/main/TRIBE-SYSTEM-FLOW-GUIDE.md).
137
89
 
138
- ### List tasks in JSON format
139
- ```bash
140
- ./cli-gui --non-interactive --cmd list-tasks --format json
141
- ```
90
+ ## 🆘 Troubleshooting
142
91
 
143
- ### View specific task details
92
+ ### Cluster not starting?
144
93
  ```bash
145
- ./cli-gui --non-interactive --cmd task-details --task-id task-123456
94
+ # Check if Colima is running
95
+ colima status
96
+
97
+ # Start manually if needed
98
+ colima start --kubernetes
99
+ tribe start
146
100
  ```
147
101
 
148
- ### Use with custom API endpoints
102
+ ### Port conflicts?
149
103
  ```bash
150
- TASKMASTER_URL=http://api.example.com:8080 ./cli-gui --non-interactive --cmd list-tasks
104
+ # Check what's using ports
105
+ lsof -i :30080
106
+ lsof -i :3456
151
107
  ```
152
108
 
153
- ## Testing with Mock Data
154
-
155
- To test without a running TRIBE cluster, you can use mock endpoints or run against a local instance.
156
-
157
- ## Development
158
-
159
- ### Adding New Commands
160
-
161
- 1. Add the command to the switch statement in `runNonInteractive()`
162
- 2. Implement the corresponding function
163
- 3. Add any necessary API methods to `api.go`
164
- 4. Update this README with the new command
109
+ ### Reset everything?
110
+ ```bash
111
+ # Stop cluster
112
+ colima stop
165
113
 
166
- ### Building for Different Platforms
114
+ # Remove TRIBE namespace
115
+ kubectl delete namespace tribe-system
167
116
 
168
- ```bash
169
- # Linux
170
- GOOS=linux GOARCH=amd64 go build -o cli-gui-linux .
117
+ # Start fresh
118
+ tribe start
119
+ ```
171
120
 
172
- # macOS
173
- GOOS=darwin GOARCH=amd64 go build -o cli-gui-macos .
121
+ ## 📄 License
174
122
 
175
- # Windows
176
- GOOS=windows GOARCH=amd64 go build -o cli-gui.exe .
177
- ```
123
+ MIT License - see [LICENSE](https://github.com/0zen/0zen/blob/main/LICENSE) for details.
package/install-tribe.js CHANGED
@@ -13,12 +13,18 @@ const platform = os.platform();
13
13
  const arch = os.arch();
14
14
  const homeDir = os.homedir();
15
15
  const binDir = path.join(homeDir, 'bin');
16
+ const tribeDir = path.join(homeDir, '.tribe');
16
17
 
17
18
  // Ensure local bin directory exists
18
19
  if (!fs.existsSync(binDir)) {
19
20
  fs.mkdirSync(binDir, { recursive: true });
20
21
  }
21
22
 
23
+ // Ensure TRIBE config directory exists
24
+ if (!fs.existsSync(tribeDir)) {
25
+ fs.mkdirSync(tribeDir, { recursive: true });
26
+ }
27
+
22
28
  const log = {
23
29
  success: (msg) => console.log(chalk.green('✓'), msg),
24
30
  error: (msg) => console.log(chalk.red('✗'), msg),
@@ -391,6 +397,17 @@ async function installTribeCli() {
391
397
  const spinner = ora('Installing TRIBE CLI...').start();
392
398
 
393
399
  try {
400
+ const tribeDest = path.join(binDir, 'tribe');
401
+
402
+ // First check if we have a bundled binary
403
+ const bundledBinary = path.join(__dirname, 'tribe');
404
+ if (fs.existsSync(bundledBinary)) {
405
+ fs.copyFileSync(bundledBinary, tribeDest);
406
+ fs.chmodSync(tribeDest, '755');
407
+ spinner.succeed('TRIBE CLI installed from bundled binary');
408
+ return true;
409
+ }
410
+
394
411
  // Check if we have local source
395
412
  const sourceFile = path.join(__dirname, 'cluster-cli.go');
396
413
  if (fs.existsSync(sourceFile)) {
@@ -398,7 +415,6 @@ async function installTribeCli() {
398
415
  try {
399
416
  execSync('go version', { stdio: 'ignore' });
400
417
  execSync(`cd ${__dirname} && go build -o tribe cluster-cli.go client.go`);
401
- const tribeDest = path.join(binDir, 'tribe');
402
418
  fs.copyFileSync(path.join(__dirname, 'tribe'), tribeDest);
403
419
  fs.chmodSync(tribeDest, '755');
404
420
  spinner.succeed('TRIBE CLI built from source');
@@ -408,9 +424,8 @@ async function installTribeCli() {
408
424
  }
409
425
  }
410
426
 
411
- // Try pre-built binary
427
+ // Try pre-built binary from GitHub
412
428
  const tribeUrl = `https://github.com/0zen/0zen/releases/latest/download/tribe-${platform}-${arch}`;
413
- const tribeDest = path.join(binDir, 'tribe');
414
429
 
415
430
  try {
416
431
  await downloadFile(tribeUrl, tribeDest);
@@ -418,14 +433,23 @@ async function installTribeCli() {
418
433
  spinner.succeed('TRIBE CLI installed');
419
434
  return true;
420
435
  } catch {
421
- // Fallback: copy local binary if it exists
422
- const localBinary = path.join(__dirname, 'tribe');
423
- if (fs.existsSync(localBinary)) {
424
- fs.copyFileSync(localBinary, tribeDest);
425
- fs.chmodSync(tribeDest, '755');
426
- spinner.succeed('TRIBE CLI installed from local binary');
427
- return true;
436
+ // Fallback: look for any existing tribe binary
437
+ const possiblePaths = [
438
+ path.join(__dirname, '..', 'tribe-cli'),
439
+ path.join(__dirname, '..', 'tribe'),
440
+ './tribe-cli',
441
+ './tribe'
442
+ ];
443
+
444
+ for (const possiblePath of possiblePaths) {
445
+ if (fs.existsSync(possiblePath)) {
446
+ fs.copyFileSync(possiblePath, tribeDest);
447
+ fs.chmodSync(tribeDest, '755');
448
+ spinner.succeed('TRIBE CLI installed from local binary');
449
+ return true;
450
+ }
428
451
  }
452
+
429
453
  throw new Error('No TRIBE CLI binary available');
430
454
  }
431
455
  } catch (error) {
@@ -565,6 +589,133 @@ async function verifyInstallation() {
565
589
  return Object.values(results).every(r => r) && containerWorking;
566
590
  }
567
591
 
592
+ async function checkClusterExists() {
593
+ try {
594
+ // Check if TRIBE namespace exists in any context
595
+ execSync('kubectl get namespace tribe-system', { stdio: 'ignore' });
596
+ return true;
597
+ } catch {
598
+ return false;
599
+ }
600
+ }
601
+
602
+ async function checkColimaRunning() {
603
+ try {
604
+ execSync('colima status', { stdio: 'ignore' });
605
+ return true;
606
+ } catch {
607
+ return false;
608
+ }
609
+ }
610
+
611
+ async function startColimaWithKubernetes() {
612
+ const spinner = ora('Starting Colima with Kubernetes...').start();
613
+
614
+ try {
615
+ // Check if already running
616
+ if (await checkColimaRunning()) {
617
+ spinner.succeed('Colima is already running');
618
+ return true;
619
+ }
620
+
621
+ // Start Colima with Kubernetes enabled
622
+ spinner.text = 'Starting Colima (this may take a few minutes on first run)...';
623
+ execSync('colima start --kubernetes --cpu 4 --memory 8 --disk 20', {
624
+ stdio: 'pipe',
625
+ env: { ...process.env, PATH: `${binDir}:${process.env.PATH}` }
626
+ });
627
+
628
+ // Verify it's working
629
+ execSync('kubectl version --client', { stdio: 'ignore' });
630
+ spinner.succeed('Colima started with Kubernetes');
631
+ return true;
632
+ } catch (error) {
633
+ spinner.fail('Failed to start Colima with Kubernetes');
634
+ log.error(error.message);
635
+ return false;
636
+ }
637
+ }
638
+
639
+ async function deployTribeCluster() {
640
+ const spinner = ora('Deploying TRIBE cluster...').start();
641
+
642
+ try {
643
+ // Create a marker file to indicate first-run deployment
644
+ const deploymentMarker = path.join(tribeDir, '.cluster-deployed');
645
+
646
+ // Check if we've already deployed
647
+ if (fs.existsSync(deploymentMarker)) {
648
+ // Check if cluster actually exists
649
+ if (await checkClusterExists()) {
650
+ spinner.succeed('TRIBE cluster already deployed');
651
+ return true;
652
+ }
653
+ // Marker exists but cluster doesn't - remove marker and redeploy
654
+ fs.unlinkSync(deploymentMarker);
655
+ }
656
+
657
+ // Copy deployment YAML to .tribe directory
658
+ const sourceYaml = path.join(__dirname, 'tribe-deployment.yaml');
659
+ const destYaml = path.join(tribeDir, 'tribe-deployment.yaml');
660
+
661
+ if (fs.existsSync(sourceYaml)) {
662
+ fs.copyFileSync(sourceYaml, destYaml);
663
+ log.info('Copied deployment configuration');
664
+ }
665
+
666
+ // Run tribe start command with deployment YAML path
667
+ spinner.text = 'Running TRIBE cluster deployment...';
668
+ const tribePath = path.join(binDir, 'tribe');
669
+
670
+ // Set environment variable for the deployment YAML location
671
+ const env = {
672
+ ...process.env,
673
+ PATH: `${binDir}:${process.env.PATH}`,
674
+ TRIBE_DEPLOYMENT_YAML: destYaml
675
+ };
676
+
677
+ // Execute tribe start
678
+ execSync(`${tribePath} start`, {
679
+ stdio: 'pipe',
680
+ env: env
681
+ });
682
+
683
+ // Create marker file
684
+ fs.writeFileSync(deploymentMarker, new Date().toISOString());
685
+
686
+ spinner.succeed('TRIBE cluster deployed successfully');
687
+ return true;
688
+ } catch (error) {
689
+ spinner.fail('Failed to deploy TRIBE cluster');
690
+ log.error(error.message);
691
+ log.info('You can manually deploy later with: tribe start');
692
+ return false;
693
+ }
694
+ }
695
+
696
+ async function promptForClusterSetup() {
697
+ // Simple prompt without external dependencies
698
+ return new Promise((resolve) => {
699
+ console.log('\n' + chalk.bold('🚀 TRIBE Cluster Setup'));
700
+ console.log('\nWould you like to set up the TRIBE cluster now?');
701
+ console.log('This will:');
702
+ console.log(' • Start Colima with Kubernetes');
703
+ console.log(' • Deploy all TRIBE services');
704
+ console.log(' • Set up port forwarding');
705
+ console.log('\n' + chalk.yellow('Note: This requires ~2GB disk space and may take a few minutes'));
706
+
707
+ process.stdout.write('\nSet up now? [Y/n]: ');
708
+
709
+ process.stdin.resume();
710
+ process.stdin.setEncoding('utf8');
711
+ process.stdin.once('data', (data) => {
712
+ process.stdin.pause();
713
+ const answer = data.toString().trim().toLowerCase();
714
+ resolve(answer === '' || answer === 'y' || answer === 'yes');
715
+ });
716
+ });
717
+ }
718
+
568
719
  async function main() {
569
720
  console.log(chalk.bold.blue('\n🚀 TRIBE CLI Complete Installer\n'));
570
721
 
@@ -597,17 +748,60 @@ async function main() {
597
748
  // Verify everything
598
749
  const verified = await verifyInstallation();
599
750
 
600
- console.log('\n' + chalk.bold('Next Steps:'));
601
751
  if (verified) {
602
- log.success('All components installed successfully! 🎉');
603
- console.log('');
604
- log.info('Quick start:');
605
- console.log(' tribe start # Start TRIBE cluster');
606
- console.log(' tribe status # Check cluster status');
607
- console.log(' tribe deploy-task # Deploy tasks to agents');
608
- console.log('');
609
- log.info('For help: tribe --help');
752
+ // Check if cluster already exists
753
+ const clusterExists = await checkClusterExists();
754
+
755
+ if (!clusterExists) {
756
+ // Prompt for cluster setup
757
+ const shouldSetup = await promptForClusterSetup();
758
+
759
+ if (shouldSetup) {
760
+ console.log('');
761
+
762
+ // Start Colima with Kubernetes if on macOS
763
+ if (platform === 'darwin') {
764
+ const colimaStarted = await startColimaWithKubernetes();
765
+ if (!colimaStarted) {
766
+ log.error('Failed to start Colima. Please run manually:');
767
+ console.log(' colima start --kubernetes');
768
+ console.log(' tribe start');
769
+ process.exit(1);
770
+ }
771
+ }
772
+
773
+ // Deploy TRIBE cluster
774
+ const deployed = await deployTribeCluster();
775
+
776
+ if (deployed) {
777
+ console.log('\n' + chalk.bold.green('✨ TRIBE is ready!'));
778
+ console.log('');
779
+ log.info('Quick start:');
780
+ console.log(' tribe # Launch interactive CLI');
781
+ console.log(' tribe status # Check cluster status');
782
+ console.log(' tribe create-task # Create a new task');
783
+ console.log('');
784
+ log.info('First time? The CLI will guide you through creating your first project!');
785
+ } else {
786
+ log.warning('Cluster deployment failed, but you can try manually:');
787
+ console.log(' tribe start');
788
+ }
789
+ } else {
790
+ console.log('\n' + chalk.bold('Setup Complete!'));
791
+ log.info('You can set up the cluster later with:');
792
+ console.log(' tribe start');
793
+ }
794
+ } else {
795
+ console.log('\n' + chalk.bold.green('✨ TRIBE is ready!'));
796
+ log.success('Cluster is already running');
797
+ console.log('');
798
+ log.info('Commands:');
799
+ console.log(' tribe # Launch interactive CLI');
800
+ console.log(' tribe status # Check status');
801
+ console.log(' tribe create-task # Create a new task');
802
+ }
610
803
  } else {
804
+ console.log('\n' + chalk.bold('Next Steps:'));
611
805
  log.warning('Some components need attention:');
612
806
  console.log('');
613
807
  // Check container runtime for guidance
@@ -626,6 +820,7 @@ async function main() {
626
820
  }
627
821
  console.log('');
628
822
  log.info('Restart your shell or run: source ~/.zshrc');
823
+ log.info('Then run: tribe start');
629
824
  }
630
825
  }
631
826
 
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@_xtribe/cli",
3
- "version": "1.0.0-beta.5",
4
- "description": "TRIBE multi-agent development system CLI installer",
3
+ "version": "1.0.0-beta.6",
4
+ "description": "TRIBE multi-agent development system - Zero to productive with one command",
5
5
  "main": "install-tribe.js",
6
- "bin": "./install-tribe.js",
6
+ "bin": {
7
+ "tribe": "install-tribe.js"
8
+ },
7
9
  "scripts": {
8
10
  "test": "echo \"Error: no test specified\" && exit 1"
9
11
  },
@@ -15,7 +17,9 @@
15
17
  "colima",
16
18
  "multi-agent",
17
19
  "ai",
18
- "development"
20
+ "development",
21
+ "autonomous",
22
+ "agents"
19
23
  ],
20
24
  "engines": {
21
25
  "node": ">=16.0.0"
@@ -32,6 +36,7 @@
32
36
  "files": [
33
37
  "install-tribe.js",
34
38
  "lima-guestagent.Linux-aarch64.gz",
39
+ "tribe-deployment.yaml",
35
40
  "tribe",
36
41
  "README.md",
37
42
  "package.json"
@@ -45,7 +50,7 @@
45
50
  },
46
51
  "repository": {
47
52
  "type": "git",
48
- "url": "https://github.com/0zen/0zen.git"
53
+ "url": "git+https://github.com/0zen/0zen.git"
49
54
  },
50
55
  "author": "0zen",
51
56
  "license": "MIT",
@@ -53,4 +58,4 @@
53
58
  "bugs": {
54
59
  "url": "https://github.com/0zen/0zen/issues"
55
60
  }
56
- }
61
+ }
package/tribe CHANGED
Binary file
@@ -0,0 +1,448 @@
1
+ ---
2
+ # TRIBE Complete Deployment - Bundled with NPM Package
3
+ # This file is automatically deployed by 'npx @_xtribe/cli'
4
+ ---
5
+ apiVersion: v1
6
+ kind: Namespace
7
+ metadata:
8
+ name: tribe-system
9
+ ---
10
+ # ServiceAccount for Bridge
11
+ apiVersion: v1
12
+ kind: ServiceAccount
13
+ metadata:
14
+ name: bridge
15
+ namespace: tribe-system
16
+ ---
17
+ # Role for Bridge
18
+ apiVersion: rbac.authorization.k8s.io/v1
19
+ kind: Role
20
+ metadata:
21
+ name: bridge-role
22
+ namespace: tribe-system
23
+ rules:
24
+ - apiGroups: [""]
25
+ resources: ["pods", "services", "pods/exec", "pods/log", "configmaps", "secrets", "namespaces"]
26
+ verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
27
+ - apiGroups: ["apps"]
28
+ resources: ["deployments", "replicasets"]
29
+ verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
30
+ - apiGroups: ["batch"]
31
+ resources: ["jobs"]
32
+ verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
33
+ ---
34
+ # RoleBinding for Bridge
35
+ apiVersion: rbac.authorization.k8s.io/v1
36
+ kind: RoleBinding
37
+ metadata:
38
+ name: bridge-rolebinding
39
+ namespace: tribe-system
40
+ subjects:
41
+ - kind: ServiceAccount
42
+ name: bridge
43
+ namespace: tribe-system
44
+ roleRef:
45
+ kind: Role
46
+ name: bridge-role
47
+ apiGroup: rbac.authorization.k8s.io
48
+ ---
49
+ # PostgreSQL
50
+ apiVersion: apps/v1
51
+ kind: Deployment
52
+ metadata:
53
+ name: postgres
54
+ namespace: tribe-system
55
+ spec:
56
+ replicas: 1
57
+ selector:
58
+ matchLabels:
59
+ app: postgres
60
+ template:
61
+ metadata:
62
+ labels:
63
+ app: postgres
64
+ spec:
65
+ containers:
66
+ - name: postgres
67
+ image: postgres:15
68
+ env:
69
+ - name: POSTGRES_DB
70
+ value: gitea
71
+ - name: POSTGRES_USER
72
+ value: gitea
73
+ - name: POSTGRES_PASSWORD
74
+ value: gitea
75
+ ports:
76
+ - containerPort: 5432
77
+ readinessProbe:
78
+ exec:
79
+ command:
80
+ - pg_isready
81
+ - -U
82
+ - gitea
83
+ initialDelaySeconds: 5
84
+ periodSeconds: 5
85
+ ---
86
+ apiVersion: v1
87
+ kind: Service
88
+ metadata:
89
+ name: postgres
90
+ namespace: tribe-system
91
+ spec:
92
+ selector:
93
+ app: postgres
94
+ ports:
95
+ - port: 5432
96
+ ---
97
+ # Gitea
98
+ apiVersion: apps/v1
99
+ kind: Deployment
100
+ metadata:
101
+ name: gitea
102
+ namespace: tribe-system
103
+ spec:
104
+ replicas: 1
105
+ selector:
106
+ matchLabels:
107
+ app: gitea
108
+ template:
109
+ metadata:
110
+ labels:
111
+ app: gitea
112
+ spec:
113
+ initContainers:
114
+ - name: wait-for-db
115
+ image: busybox:1.35
116
+ command: ['sh', '-c', 'until nc -z postgres 5432; do echo waiting for db; sleep 2; done']
117
+ - name: init-gitea
118
+ image: gitea/gitea:1.20.5
119
+ command: ['/bin/bash', '-c']
120
+ args:
121
+ - |
122
+ # Create app.ini
123
+ mkdir -p /data/gitea/conf
124
+ cat > /data/gitea/conf/app.ini << 'EOF'
125
+ APP_NAME = Gitea
126
+ RUN_MODE = prod
127
+
128
+ [database]
129
+ DB_TYPE = postgres
130
+ HOST = postgres:5432
131
+ NAME = gitea
132
+ USER = gitea
133
+ PASSWD = gitea
134
+
135
+ [server]
136
+ DOMAIN = gitea
137
+ ROOT_URL = http://gitea:3000/
138
+ HTTP_PORT = 3000
139
+
140
+ [service]
141
+ DISABLE_REGISTRATION = true
142
+
143
+ [security]
144
+ INSTALL_LOCK = true
145
+ SECRET_KEY = changeme
146
+ EOF
147
+
148
+ # Run migrations
149
+ gitea migrate
150
+
151
+ # Create admin user
152
+ gitea admin user create --admin --username gitea_admin --password admin123 --email admin@example.com || true
153
+ env:
154
+ - name: GITEA_WORK_DIR
155
+ value: /data
156
+ - name: GITEA_CUSTOM
157
+ value: /data/gitea
158
+ volumeMounts:
159
+ - name: gitea-data
160
+ mountPath: /data
161
+ containers:
162
+ - name: gitea
163
+ image: gitea/gitea:1.20.5
164
+ ports:
165
+ - containerPort: 3000
166
+ env:
167
+ - name: GITEA_WORK_DIR
168
+ value: /data
169
+ - name: GITEA_CUSTOM
170
+ value: /data/gitea
171
+ volumeMounts:
172
+ - name: gitea-data
173
+ mountPath: /data
174
+ readinessProbe:
175
+ httpGet:
176
+ path: /
177
+ port: 3000
178
+ initialDelaySeconds: 30
179
+ periodSeconds: 10
180
+ volumes:
181
+ - name: gitea-data
182
+ emptyDir: {}
183
+ ---
184
+ apiVersion: v1
185
+ kind: Service
186
+ metadata:
187
+ name: gitea
188
+ namespace: tribe-system
189
+ spec:
190
+ selector:
191
+ app: gitea
192
+ ports:
193
+ - port: 3000
194
+ ---
195
+ # TaskMaster
196
+ apiVersion: apps/v1
197
+ kind: Deployment
198
+ metadata:
199
+ name: taskmaster
200
+ namespace: tribe-system
201
+ spec:
202
+ replicas: 1
203
+ selector:
204
+ matchLabels:
205
+ app: taskmaster
206
+ template:
207
+ metadata:
208
+ labels:
209
+ app: taskmaster
210
+ spec:
211
+ initContainers:
212
+ - name: wait-for-db
213
+ image: busybox:1.35
214
+ command: ['sh', '-c', 'until nc -z postgres 5432; do echo waiting for db; sleep 2; done']
215
+ containers:
216
+ - name: taskmaster
217
+ image: taskmaster:latest
218
+ imagePullPolicy: IfNotPresent
219
+ ports:
220
+ - containerPort: 5000
221
+ env:
222
+ - name: FLASK_ENV
223
+ value: development
224
+ - name: DATABASE_URL
225
+ value: postgresql://gitea:gitea@postgres:5432/gitea
226
+ - name: GITEA_URL
227
+ value: http://gitea:3000
228
+ - name: GITEA_TOKEN
229
+ value: will-be-set-by-init-job
230
+ readinessProbe:
231
+ httpGet:
232
+ path: /
233
+ port: 5000
234
+ initialDelaySeconds: 10
235
+ periodSeconds: 5
236
+ ---
237
+ apiVersion: v1
238
+ kind: Service
239
+ metadata:
240
+ name: taskmaster
241
+ namespace: tribe-system
242
+ spec:
243
+ selector:
244
+ app: taskmaster
245
+ ports:
246
+ - port: 5000
247
+ ---
248
+ # Bridge
249
+ apiVersion: apps/v1
250
+ kind: Deployment
251
+ metadata:
252
+ name: bridge
253
+ namespace: tribe-system
254
+ spec:
255
+ replicas: 1
256
+ selector:
257
+ matchLabels:
258
+ app: bridge
259
+ template:
260
+ metadata:
261
+ labels:
262
+ app: bridge
263
+ spec:
264
+ serviceAccountName: bridge
265
+ initContainers:
266
+ - name: wait-for-services
267
+ image: busybox:1.35
268
+ command: ['sh', '-c']
269
+ args:
270
+ - |
271
+ echo "Waiting for services..."
272
+ until nc -z taskmaster 5000; do echo waiting for taskmaster; sleep 2; done
273
+ until nc -z gitea 3000; do echo waiting for gitea; sleep 2; done
274
+ echo "All services ready!"
275
+ containers:
276
+ - name: bridge
277
+ image: bridge:latest
278
+ imagePullPolicy: IfNotPresent
279
+ ports:
280
+ - containerPort: 8080
281
+ - containerPort: 3456
282
+ env:
283
+ - name: TASKMASTER_URL
284
+ value: http://taskmaster:5000
285
+ - name: GITEA_URL
286
+ value: http://gitea:3000
287
+ - name: GITEA_ADMIN_USER
288
+ value: gitea_admin
289
+ - name: GITEA_ADMIN_PASSWORD
290
+ value: admin123
291
+ - name: NAMESPACE
292
+ value: tribe-system
293
+ readinessProbe:
294
+ httpGet:
295
+ path: /health
296
+ port: 8080
297
+ initialDelaySeconds: 10
298
+ periodSeconds: 5
299
+ ---
300
+ apiVersion: v1
301
+ kind: Service
302
+ metadata:
303
+ name: bridge
304
+ namespace: tribe-system
305
+ spec:
306
+ selector:
307
+ app: bridge
308
+ ports:
309
+ - name: http
310
+ port: 8080
311
+ - name: websocket
312
+ port: 3456
313
+ ---
314
+ # Claude Worker Deployment (starts with 0 replicas)
315
+ apiVersion: apps/v1
316
+ kind: Deployment
317
+ metadata:
318
+ name: claude-worker-deployment
319
+ namespace: tribe-system
320
+ spec:
321
+ replicas: 0
322
+ selector:
323
+ matchLabels:
324
+ app: claude-worker
325
+ template:
326
+ metadata:
327
+ labels:
328
+ app: claude-worker
329
+ spec:
330
+ containers:
331
+ - name: claude-agent
332
+ image: claude-agent:latest
333
+ imagePullPolicy: IfNotPresent
334
+ env:
335
+ - name: ROLE
336
+ value: worker
337
+ - name: TASKMASTER_URL
338
+ value: http://taskmaster:5000
339
+ - name: GITEA_URL
340
+ value: http://gitea:3000
341
+ - name: NAMESPACE
342
+ value: tribe-system
343
+ - name: ANTHROPIC_API_KEY
344
+ valueFrom:
345
+ secretKeyRef:
346
+ name: claude-api-key
347
+ key: api-key
348
+ optional: true
349
+ volumeMounts:
350
+ - name: workspace
351
+ mountPath: /workspace
352
+ - name: config
353
+ mountPath: /app/minimal-config
354
+ readinessProbe:
355
+ exec:
356
+ command:
357
+ - /bin/sh
358
+ - -c
359
+ - test -f /tmp/worker-ready
360
+ initialDelaySeconds: 30
361
+ periodSeconds: 10
362
+ volumes:
363
+ - name: workspace
364
+ emptyDir: {}
365
+ - name: config
366
+ configMap:
367
+ name: claude-config
368
+ optional: true
369
+ ---
370
+ # NodePort service for easy access
371
+ apiVersion: v1
372
+ kind: Service
373
+ metadata:
374
+ name: bridge-nodeport
375
+ namespace: tribe-system
376
+ spec:
377
+ type: NodePort
378
+ selector:
379
+ app: bridge
380
+ ports:
381
+ - name: http
382
+ port: 8080
383
+ nodePort: 30080
384
+ - name: websocket
385
+ port: 3456
386
+ nodePort: 30456
387
+ ---
388
+ # ConfigMap for Claude agent configuration
389
+ apiVersion: v1
390
+ kind: ConfigMap
391
+ metadata:
392
+ name: claude-config
393
+ namespace: tribe-system
394
+ data:
395
+ config.yaml: |
396
+ mcp_servers:
397
+ filesystem:
398
+ command: npx
399
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]
400
+ git:
401
+ command: npx
402
+ args: ["-y", "@modelcontextprotocol/server-git"]
403
+ env:
404
+ PATH: /usr/local/bin:/usr/bin:/bin
405
+ ---
406
+ # Initialization Job
407
+ apiVersion: batch/v1
408
+ kind: Job
409
+ metadata:
410
+ name: tribe-init
411
+ namespace: tribe-system
412
+ spec:
413
+ template:
414
+ spec:
415
+ restartPolicy: OnFailure
416
+ containers:
417
+ - name: init
418
+ image: curlimages/curl:8.4.0
419
+ command: ['/bin/sh', '-c']
420
+ args:
421
+ - |
422
+ echo "Waiting for Gitea to be ready..."
423
+ until curl -s http://gitea:3000 > /dev/null; do
424
+ echo "Waiting for Gitea..."
425
+ sleep 5
426
+ done
427
+
428
+ echo "Creating Gitea access token..."
429
+ TOKEN=$(curl -s -X POST http://gitea:3000/api/v1/users/gitea_admin/tokens \
430
+ -u gitea_admin:admin123 \
431
+ -H "Content-Type: application/json" \
432
+ -d '{"name":"taskmaster-'$(date +%s)'","scopes":["write:repository","write:user","write:issue","write:organization","read:repository"]}' \
433
+ | grep -o '"sha1":"[^"]*' | cut -d'"' -f4)
434
+
435
+ if [ -z "$TOKEN" ]; then
436
+ echo "Failed to create token!"
437
+ exit 1
438
+ fi
439
+
440
+ echo "Token created successfully"
441
+
442
+ # Update TaskMaster with the token
443
+ echo "Updating TaskMaster configuration..."
444
+ curl -X POST http://taskmaster:5000/api/config \
445
+ -H "Content-Type: application/json" \
446
+ -d "{\"gitea_token\":\"$TOKEN\"}"
447
+
448
+ echo "Initialization complete!"