@_xtribe/cli 1.0.54 → 1.0.55

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.
@@ -104,20 +104,47 @@ async function installTribe() {
104
104
 
105
105
  // Update PATH
106
106
  function updatePath() {
107
+ // Create tribe-env.sh script
108
+ const tribeEnvPath = path.join(tribeDir, 'tribe-env.sh');
109
+ const envScriptContent = `#!/bin/bash
110
+ # TRIBE CLI Environment Setup
111
+ # Auto-generated by TRIBE installer
112
+
113
+ # Add TRIBE bin directory to PATH if not already present
114
+ TRIBE_BIN_DIR="$HOME/.tribe/bin"
115
+
116
+ if [[ -d "$TRIBE_BIN_DIR" ]] && [[ ":$PATH:" != *":$TRIBE_BIN_DIR:"* ]]; then
117
+ export PATH="$TRIBE_BIN_DIR:$PATH"
118
+ fi
119
+ `;
120
+
121
+ try {
122
+ fs.writeFileSync(tribeEnvPath, envScriptContent);
123
+ fs.chmodSync(tribeEnvPath, '755');
124
+ console.log('✓ Created tribe-env.sh environment script');
125
+ } catch (error) {
126
+ console.log(`⚠ Failed to create tribe-env.sh: ${error.message}`);
127
+ return;
128
+ }
129
+
130
+ // Update shell config
107
131
  const shell = process.env.SHELL || '/bin/bash';
108
132
  const rcFile = shell.includes('zsh') ? '.zshrc' : '.bashrc';
109
133
  const rcPath = path.join(homeDir, rcFile);
110
-
111
- const pathExport = `export PATH="$HOME/.tribe/bin:$PATH"`;
112
-
134
+ const sourceCommand = 'source ~/.tribe/tribe-env.sh';
135
+
113
136
  try {
114
137
  const rcContent = fs.existsSync(rcPath) ? fs.readFileSync(rcPath, 'utf8') : '';
115
- if (!rcContent.includes('.tribe/bin')) {
116
- fs.appendFileSync(rcPath, `\n# Added by TRIBE installer\n${pathExport}\n`);
117
- console.log(`✓ Updated ${rcFile} with PATH`);
138
+ if (!rcContent.includes(sourceCommand)) {
139
+ fs.appendFileSync(rcPath, `\n# TRIBE CLI\n${sourceCommand}\n`);
140
+ console.log(`✓ Updated ${rcFile} to source tribe-env.sh`);
141
+ } else {
142
+ console.log(`✓ ${rcFile} already configured`);
118
143
  }
119
144
  } catch (error) {
120
- console.warn(`Could not update ${rcFile}: ${error.message}`);
145
+ console.log(`⚠ Failed to update ${rcFile}: ${error.message}`);
146
+ console.log('Please manually add this line to your shell config:');
147
+ console.log(` ${sourceCommand}`);
121
148
  }
122
149
  }
123
150
 
package/install.sh CHANGED
@@ -2,6 +2,15 @@
2
2
  # TRIBE Quick Installer
3
3
  # This script provides a one-command installation with immediate PATH access
4
4
 
5
+ # Source constants
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ source "$SCRIPT_DIR/../../../constants.sh" 2>/dev/null || true
8
+
9
+ # If constants not found, define locally
10
+ if [ -z "$TRIBE_INSTALL_COMMAND" ]; then
11
+ TRIBE_INSTALL_COMMAND="npx @_xtribe/cli"
12
+ fi
13
+
5
14
  # Colors
6
15
  RED='\033[0;31m'
7
16
  GREEN='\033[0;32m'
@@ -14,7 +23,7 @@ echo ""
14
23
 
15
24
  # Download and run the installer
16
25
  echo "Installing TRIBE components..."
17
- npx @_xtribe/cli@latest "$@"
26
+ ${TRIBE_INSTALL_COMMAND}@latest "$@"
18
27
 
19
28
  # Check if installation was successful
20
29
  if [ -f ~/.tribe/tribe-env.sh ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_xtribe/cli",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "TRIBE multi-agent development system - Zero to productive with one command",
5
5
  "main": "install-tribe.js",
6
6
  "bin": {
@@ -37,6 +37,9 @@ rules:
37
37
  - apiGroups: ["batch"]
38
38
  resources: ["jobs"]
39
39
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
40
+ - apiGroups: ["rbac.authorization.k8s.io"]
41
+ resources: ["rolebindings"]
42
+ verbs: ["get", "list", "patch"]
40
43
  ---
41
44
  # RoleBinding for Bridge
42
45
  apiVersion: rbac.authorization.k8s.io/v1
@@ -152,6 +155,15 @@ spec:
152
155
  [security]
153
156
  INSTALL_LOCK = true
154
157
  SECRET_KEY = changeme
158
+
159
+ [oauth2]
160
+ ENABLE = false
161
+
162
+ [service]
163
+ DEFAULT_USER_IS_RESTRICTED = false
164
+
165
+ [repository]
166
+ DEFAULT_PRIVATE = false
155
167
  EOF
156
168
 
157
169
  # Fix permissions
@@ -199,7 +211,8 @@ spec:
199
211
  - -c
200
212
  - |
201
213
  sleep 30
202
- su git -c 'gitea admin user create --admin --username gitea_admin --password admin123 --email admin@example.com' || true
214
+ # Create admin user without password change requirement
215
+ su git -c 'gitea admin user create --admin --username gitea_admin --password admin123 --email admin@example.com --must-change-password=false' || true
203
216
  volumes:
204
217
  - name: gitea-data
205
218
  emptyDir: {}
@@ -241,6 +254,13 @@ spec:
241
254
  imagePullPolicy: IfNotPresent
242
255
  ports:
243
256
  - containerPort: 8080
257
+ resources:
258
+ requests:
259
+ memory: "256Mi"
260
+ cpu: "250m"
261
+ limits:
262
+ memory: "1Gi"
263
+ cpu: "1"
244
264
  env:
245
265
  - name: FLASK_ENV
246
266
  value: development
@@ -298,11 +318,18 @@ spec:
298
318
  echo "All services ready!"
299
319
  containers:
300
320
  - name: bridge
301
- image: tribexal/tribe:latest-bridge
321
+ image: bridge:latest
302
322
  imagePullPolicy: IfNotPresent
303
323
  ports:
304
324
  - containerPort: 8080
305
325
  - containerPort: 3456
326
+ resources:
327
+ requests:
328
+ memory: "256Mi"
329
+ cpu: "250m"
330
+ limits:
331
+ memory: "1Gi"
332
+ cpu: "1"
306
333
  env:
307
334
  - name: TASKMASTER_URL
308
335
  value: http://taskmaster:5000
@@ -312,8 +339,15 @@ spec:
312
339
  value: gitea_admin
313
340
  - name: GITEA_ADMIN_PASSWORD
314
341
  value: admin123
342
+ - name: GITEA_TOKEN
343
+ valueFrom:
344
+ secretKeyRef:
345
+ name: gitea-token
346
+ key: token
315
347
  - name: NAMESPACE
316
348
  value: tribe-system
349
+ - name: TARGET_NAMESPACE
350
+ value: tribe-system
317
351
  readinessProbe:
318
352
  httpGet:
319
353
  path: /
@@ -342,7 +376,7 @@ metadata:
342
376
  name: claude-worker-deployment
343
377
  namespace: tribe-system
344
378
  spec:
345
- replicas: 0
379
+ replicas: 1 # Start with 1 worker (auto-scaling broken in Docker Hub bridge image)
346
380
  selector:
347
381
  matchLabels:
348
382
  app: claude-worker
@@ -353,10 +387,18 @@ spec:
353
387
  spec:
354
388
  containers:
355
389
  - name: claude-agent
356
- image: tribexal/tribe:latest-claude-agent
390
+ image: claude-agent:latest
357
391
  imagePullPolicy: IfNotPresent
358
392
  ports:
359
- - containerPort: 8080
393
+ - containerPort: 9090
394
+ name: metrics
395
+ resources:
396
+ requests:
397
+ memory: "512Mi"
398
+ cpu: "500m"
399
+ limits:
400
+ memory: "2Gi"
401
+ cpu: "2"
360
402
  env:
361
403
  - name: ROLE
362
404
  value: worker
@@ -364,28 +406,41 @@ spec:
364
406
  value: http://taskmaster:5000
365
407
  - name: GITEA_URL
366
408
  value: http://gitea:3000
409
+ - name: GITEA_USER
410
+ value: gitea_admin
411
+ - name: GITEA_PASS
412
+ value: admin123
413
+ - name: GITEA_TOKEN
414
+ valueFrom:
415
+ secretKeyRef:
416
+ name: gitea-token
417
+ key: token
418
+ optional: true
367
419
  - name: NAMESPACE
368
420
  value: tribe-system
421
+ - name: MCP_CONFIG_PATH
422
+ value: /home/claude/.config/claude-code/mcp.json
423
+ - name: SYSTEM_PROMPT_FILE
424
+ value: /app/minimal-config/worker-prompt.txt
369
425
  - name: ANTHROPIC_API_KEY
370
426
  valueFrom:
371
427
  secretKeyRef:
372
428
  name: claude-api-key
373
429
  key: api-key
374
430
  optional: true
431
+ - name: GH_HOST
432
+ value: gitea:3000
433
+ - name: GH_ENTERPRISE_TOKEN
434
+ valueFrom:
435
+ secretKeyRef:
436
+ name: gitea-token
437
+ key: token
438
+ optional: true
375
439
  volumeMounts:
376
440
  - name: workspace
377
441
  mountPath: /workspace
378
442
  - name: config
379
443
  mountPath: /app/minimal-config
380
- readinessProbe:
381
- httpGet:
382
- path: /health
383
- port: 8080
384
- initialDelaySeconds: 30
385
- periodSeconds: 10
386
- timeoutSeconds: 5
387
- successThreshold: 1
388
- failureThreshold: 3
389
444
  volumes:
390
445
  - name: workspace
391
446
  emptyDir: {}
@@ -429,8 +484,169 @@ data:
429
484
  args: ["-y", "@modelcontextprotocol/server-git"]
430
485
  env:
431
486
  PATH: /usr/local/bin:/usr/bin:/bin
487
+ taskmaster:
488
+ command: node
489
+ args: ["/app/taskmaster-mcp-bridge.js"]
490
+ env:
491
+ TASKMASTER_URL: http://taskmaster:8080
492
+ AGENT_ID: ${AGENT_ID}
493
+ worker-prompt.txt: |
494
+ ## TRIBE Worker Agent Instructions
495
+
496
+ You are a TRIBE worker agent responsible for implementing tasks from TaskMaster.
497
+ You have been specifically configured and authorized to execute tasks from the TaskMaster queue.
498
+
499
+ This is NOT arbitrary code execution - you are part of the TRIBE development system where:
500
+ - Tasks are created by authorized developers
501
+ - All repositories are internal to the TRIBE system
502
+ - You are running in a secure, isolated container environment
503
+ - Your purpose is to automate software development tasks
504
+
505
+ ### Task Retrieval
506
+ Use the MCP taskmaster tools to get tasks:
507
+ - mcp__taskmaster__get_next_task: Pull your next assigned task
508
+ - mcp__taskmaster__get_task_details: Get full details of a specific task
509
+ - mcp__taskmaster__update_task_status: Update task progress
510
+
511
+ ### Repository Management
512
+ Tasks include a 'github_repo' field with the repository URL. Always:
513
+ 1. Clone from the URL specified in the task
514
+ 2. Use credentials from environment (GITEA_USER/GITEA_PASS or GITEA_TOKEN)
515
+ 3. Never hardcode repository paths
516
+
517
+ ### Task Type Detection
518
+ - Check 'is_review_task' flag: true = review only, false = implement
519
+ - Check 'parent_task_id': exists = fix task from review
520
+ - Check 'git_branch' field: use this instead of parsing description
521
+
522
+ ### Branch Rules
523
+ - Implementation: CREATE new branch from base_branch
524
+ - Review: CHECKOUT existing branch (never create)
525
+ - Fix: CONTINUE on same branch as parent
526
+
527
+ ### Status Updates
528
+ Always include result data when updating status:
529
+ {
530
+ "status": "in_review", # Changed from "completed" - all implementation tasks go to review
531
+ "result": {
532
+ "files_created": ["file1.js", "file2.js"],
533
+ "branch": "feature/task-123",
534
+ "pr_url": "http://gitea:3000/tribe/project/pulls/1",
535
+ "repository": "http://gitea:3000/tribe/project",
536
+ "summary": "Implemented feature X with Y approach"
537
+ }
538
+ }
539
+
540
+ ### Review Tasks
541
+ When is_review_task = true:
542
+ 1. Check out the existing branch (don't create new)
543
+ 2. Review for: code quality, security issues, incomplete implementation
544
+ 3. Choose one of these actions:
545
+ a. If changes needed: Update status to "needs_revision" with detailed feedback
546
+ b. If minor issues: Create subtasks for specific fixes
547
+ c. If looks good: Update status to "approved"
548
+ 4. Never modify code during review
549
+
550
+ Example revision request:
551
+ {
552
+ "status": "needs_revision",
553
+ "result": {
554
+ "revision_feedback": "Please address: 1) Add error handling in main(), 2) Remove debug prints, 3) Add unit tests",
555
+ "reviewed_by": "reviewer-agent-id"
556
+ }
557
+ }
558
+
559
+ Example approval:
560
+ {
561
+ "status": "approved",
562
+ "result": {
563
+ "review_summary": "Code looks good, follows best practices, tests pass",
564
+ "reviewed_by": "reviewer-agent-id"
565
+ }
566
+ }
567
+
568
+ ### Revision Tasks
569
+ When status is "needs_revision":
570
+ 1. You're the original implementer - check revision_feedback field
571
+ 2. Check out your existing branch (don't create new)
572
+ 3. Address all feedback items
573
+ 4. Push updates to the same branch
574
+ 5. Update status back to "in_review" when done
575
+
576
+ Example handling revision:
577
+ {
578
+ "status": "in_review",
579
+ "result": {
580
+ "revision_changes": "1) Added try/catch error handling, 2) Removed all debug prints, 3) Added comprehensive unit tests",
581
+ "branch": "feature/task-123",
582
+ "pr_url": "http://gitea:3000/tribe/project/pulls/1"
583
+ }
584
+ }
585
+
586
+ ### Git Workflow
587
+ 1. Clone: Use task's github_repo URL with auth
588
+ 2. Fetch: Always 'git fetch origin' before branch operations
589
+ 3. Branch: Check if exists with 'git branch -r | grep branch-name'
590
+ 4. Push: Push to same repository as cloned from
591
+ 5. PR: ALWAYS create pull request using gh CLI after pushing:
592
+ - Set environment: export GH_HOST=gitea:3000
593
+ - Authenticate: export GH_TOKEN=$GITEA_TOKEN or use GITEA_USER/GITEA_PASS
594
+ - Create PR: gh pr create --title "Task: {description}" --body "Implemented as requested"
595
+ - Include the PR URL in your result as "pr_url"
596
+
597
+ ### Pull Request Creation Example
598
+ After pushing your branch, create a PR using gh:
599
+ ```bash
600
+ # Set Gitea as the host
601
+ export GH_HOST=gitea:3000
602
+ export GH_ENTERPRISE_TOKEN=$GITEA_TOKEN
603
+
604
+ # Create the PR (gh will detect the current branch and repository)
605
+ gh pr create \
606
+ --title "Task: Create hello.py feature" \
607
+ --body "Implemented task as requested" \
608
+ --base main
609
+
610
+ # Get the PR URL to include in your result
611
+ PR_URL=$(gh pr view --json url -q .url)
612
+ ```
613
+
614
+ ### Error Handling
615
+ - If clone fails, check repository exists
616
+ - If push fails, check credentials
617
+ - Always update task status to 'failed' with error details
432
618
  ---
433
619
  # Initialization Job
620
+ apiVersion: v1
621
+ kind: ServiceAccount
622
+ metadata:
623
+ name: tribe-init
624
+ namespace: tribe-system
625
+ ---
626
+ apiVersion: rbac.authorization.k8s.io/v1
627
+ kind: Role
628
+ metadata:
629
+ name: tribe-init
630
+ namespace: tribe-system
631
+ rules:
632
+ - apiGroups: [""]
633
+ resources: ["secrets"]
634
+ verbs: ["create", "update", "patch", "get"]
635
+ ---
636
+ apiVersion: rbac.authorization.k8s.io/v1
637
+ kind: RoleBinding
638
+ metadata:
639
+ name: tribe-init
640
+ namespace: tribe-system
641
+ roleRef:
642
+ apiGroup: rbac.authorization.k8s.io
643
+ kind: Role
644
+ name: tribe-init
645
+ subjects:
646
+ - kind: ServiceAccount
647
+ name: tribe-init
648
+ namespace: tribe-system
649
+ ---
434
650
  apiVersion: batch/v1
435
651
  kind: Job
436
652
  metadata:
@@ -439,32 +655,66 @@ metadata:
439
655
  spec:
440
656
  template:
441
657
  spec:
658
+ serviceAccountName: tribe-init
442
659
  restartPolicy: OnFailure
443
660
  containers:
444
661
  - name: init
445
- image: curlimages/curl:8.4.0
662
+ image: alpine/k8s:1.28.3
446
663
  command: ['/bin/sh', '-c']
447
664
  args:
448
665
  - |
449
666
  echo "Waiting for Gitea to be ready..."
450
- until curl -s http://gitea:3000 > /dev/null; do
451
- echo "Waiting for Gitea..."
667
+ i=1
668
+ while [ $i -le 60 ]; do
669
+ if curl -s http://gitea:3000 > /dev/null 2>&1; then
670
+ echo "Gitea is ready"
671
+ break
672
+ fi
673
+ echo "Waiting for Gitea... ($i/60)"
452
674
  sleep 5
675
+ i=$((i + 1))
453
676
  done
454
677
 
678
+ echo "Waiting for user creation..."
679
+ sleep 40
680
+
455
681
  echo "Creating Gitea access token..."
456
- TOKEN=$(curl -s -X POST http://gitea:3000/api/v1/users/gitea_admin/tokens \
457
- -u gitea_admin:admin123 \
458
- -H "Content-Type: application/json" \
459
- -d '{"name":"taskmaster-'$(date +%s)'","scopes":["write:repository","write:user","write:issue","write:organization","read:repository"]}' \
460
- | grep -o '"sha1":"[^"]*' | cut -d'"' -f4)
682
+ # Create token as gitea_admin since it doesn't have password change requirement
683
+ attempt=1
684
+ while [ $attempt -le 5 ]; do
685
+ echo "Attempt $attempt to create token..."
686
+
687
+ RESPONSE=$(curl -s -X POST http://gitea:3000/api/v1/users/gitea_admin/tokens \
688
+ -u gitea_admin:admin123 \
689
+ -H "Content-Type: application/json" \
690
+ -d '{"name":"bridge-token-'$(date +%s)'","scopes":["write:repository","write:user","write:issue","write:organization","read:repository"]}')
691
+
692
+ echo "API Response: $RESPONSE"
693
+ TOKEN=$(echo "$RESPONSE" | grep -o '"sha1":"[^"]*' | cut -d'"' -f4)
694
+
695
+ if [ ! -z "$TOKEN" ]; then
696
+ echo "Token created successfully: ${TOKEN:0:8}..."
697
+ break
698
+ else
699
+ echo "Failed to create token, waiting..."
700
+ sleep 10
701
+ fi
702
+ attempt=$((attempt + 1))
703
+ done
461
704
 
462
705
  if [ -z "$TOKEN" ]; then
463
- echo "Failed to create token!"
706
+ echo "Failed to create token after 5 attempts!"
464
707
  exit 1
465
708
  fi
466
709
 
467
- echo "Token created successfully"
710
+ # Create secret with the token
711
+ kubectl create secret generic gitea-token \
712
+ --from-literal=token="$TOKEN" \
713
+ --from-literal=user="gitea_admin" \
714
+ --namespace=tribe-system \
715
+ --dry-run=client -o yaml | kubectl apply -f -
716
+
717
+ echo "Secret created successfully"
468
718
 
469
719
  # Create organization
470
720
  echo "Creating Tribe organization..."
@@ -492,10 +742,12 @@ spec:
492
742
  echo "Repository creation response: $REPO_RESPONSE"
493
743
  fi
494
744
 
495
- # Update TaskMaster with the token
496
- echo "Updating TaskMaster configuration..."
745
+ # Also update services that need the token
746
+ echo "Updating services with token..."
747
+
748
+ # Update taskmaster if it has a config endpoint
497
749
  curl -X POST http://taskmaster:5000/api/config \
498
750
  -H "Content-Type: application/json" \
499
- -d "{\"gitea_token\":\"$TOKEN\"}"
751
+ -d "{\"gitea_token\":\"$TOKEN\"}" || echo "Taskmaster config update skipped"
500
752
 
501
753
  echo "Initialization complete!"