aidevops 2.55.2 → 2.57.0

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
@@ -57,7 +57,7 @@ The result: AI agents that work *with* your development process, not around it.
57
57
  [![GitHub commits since latest release](https://img.shields.io/github/commits-since/marcusquinn/aidevops/latest)](https://github.com/marcusquinn/aidevops/commits/main)
58
58
 
59
59
  <!-- Repository Stats -->
60
- [![Version](https://img.shields.io/badge/Version-2.55.2-blue)](https://github.com/marcusquinn/aidevops/releases)
60
+ [![Version](https://img.shields.io/badge/Version-2.57.0-blue)](https://github.com/marcusquinn/aidevops/releases)
61
61
  [![GitHub repo size](https://img.shields.io/github/repo-size/marcusquinn/aidevops?style=flat&color=blue)](https://github.com/marcusquinn/aidevops)
62
62
  [![Lines of code](https://img.shields.io/badge/Lines%20of%20Code-18%2C000%2B-brightgreen)](https://github.com/marcusquinn/aidevops)
63
63
  [![GitHub language count](https://img.shields.io/github/languages/count/marcusquinn/aidevops)](https://github.com/marcusquinn/aidevops)
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.55.2
1
+ 2.57.0
package/aidevops.sh CHANGED
@@ -3,7 +3,7 @@
3
3
  # AI DevOps Framework CLI
4
4
  # Usage: aidevops <command> [options]
5
5
  #
6
- # Version: 2.55.2
6
+ # Version: 2.57.0
7
7
 
8
8
  set -euo pipefail
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidevops",
3
- "version": "2.55.2",
3
+ "version": "2.57.0",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/setup.sh CHANGED
@@ -3,7 +3,7 @@
3
3
  # AI Assistant Server Access Framework Setup Script
4
4
  # Helps developers set up the framework for their infrastructure
5
5
  #
6
- # Version: 2.55.2
6
+ # Version: 2.57.0
7
7
  #
8
8
  # Quick Install (one-liner):
9
9
  # bash <(curl -fsSL https://aidevops.dev/install)
@@ -562,6 +562,132 @@ setup_git_clis() {
562
562
  return 0
563
563
  }
564
564
 
565
+ # Setup Worktrunk - Git worktree management for parallel AI agent workflows
566
+ setup_worktrunk() {
567
+ print_info "Setting up Worktrunk (git worktree management)..."
568
+
569
+ # Check if worktrunk (wt) is already installed
570
+ if command -v wt >/dev/null 2>&1; then
571
+ local wt_version
572
+ wt_version=$(wt --version 2>/dev/null | head -1 || echo "unknown")
573
+ print_success "Worktrunk already installed: $wt_version"
574
+
575
+ # Check if shell integration is installed
576
+ local shell_name
577
+ shell_name=$(basename "${SHELL:-/bin/bash}")
578
+ local shell_rc=""
579
+ case "$shell_name" in
580
+ zsh) shell_rc="$HOME/.zshrc" ;;
581
+ bash)
582
+ if [[ "$(uname)" == "Darwin" ]]; then
583
+ shell_rc="$HOME/.bash_profile"
584
+ else
585
+ shell_rc="$HOME/.bashrc"
586
+ fi
587
+ ;;
588
+ esac
589
+
590
+ if [[ -n "$shell_rc" ]] && [[ -f "$shell_rc" ]]; then
591
+ if ! grep -q "worktrunk" "$shell_rc" 2>/dev/null; then
592
+ print_info "Shell integration not detected"
593
+ read -r -p "Install Worktrunk shell integration (enables 'wt switch' to change directories)? (y/n): " install_shell
594
+ if [[ "$install_shell" == "y" ]]; then
595
+ if wt config shell install 2>/dev/null; then
596
+ print_success "Shell integration installed"
597
+ print_info "Restart your terminal or run: source $shell_rc"
598
+ else
599
+ print_warning "Shell integration failed - run manually: wt config shell install"
600
+ fi
601
+ fi
602
+ else
603
+ print_success "Shell integration already configured"
604
+ fi
605
+ fi
606
+ return 0
607
+ fi
608
+
609
+ # Worktrunk not installed - offer to install
610
+ print_info "Worktrunk makes git worktrees as easy as branches"
611
+ echo " • wt switch feat - Switch/create worktree (with cd)"
612
+ echo " • wt list - List worktrees with CI status"
613
+ echo " • wt merge - Squash/rebase/merge + cleanup"
614
+ echo " • Hooks for automated setup (npm install, etc.)"
615
+ echo ""
616
+ echo " Note: aidevops also includes worktree-helper.sh as a fallback"
617
+ echo ""
618
+
619
+ local pkg_manager
620
+ pkg_manager=$(detect_package_manager)
621
+
622
+ if [[ "$pkg_manager" == "brew" ]]; then
623
+ read -r -p "Install Worktrunk via Homebrew? (y/n): " install_wt
624
+
625
+ if [[ "$install_wt" == "y" ]]; then
626
+ print_info "Installing Worktrunk..."
627
+ if brew install max-sixty/worktrunk/wt 2>/dev/null; then
628
+ print_success "Worktrunk installed"
629
+
630
+ # Install shell integration
631
+ print_info "Installing shell integration..."
632
+ if wt config shell install 2>/dev/null; then
633
+ print_success "Shell integration installed"
634
+ print_info "Restart your terminal or source your shell config"
635
+ else
636
+ print_warning "Shell integration failed - run manually: wt config shell install"
637
+ fi
638
+
639
+ echo ""
640
+ print_info "Quick start:"
641
+ echo " wt switch feature/my-feature # Create/switch to worktree"
642
+ echo " wt list # List all worktrees"
643
+ echo " wt merge # Merge and cleanup"
644
+ echo ""
645
+ print_info "Documentation: ~/.aidevops/agents/tools/git/worktrunk.md"
646
+ else
647
+ print_warning "Homebrew installation failed"
648
+ echo " Try: cargo install worktrunk && wt config shell install"
649
+ fi
650
+ else
651
+ print_info "Skipped Worktrunk installation"
652
+ print_info "Install later: brew install max-sixty/worktrunk/wt"
653
+ print_info "Fallback available: ~/.aidevops/agents/scripts/worktree-helper.sh"
654
+ fi
655
+ elif command -v cargo >/dev/null 2>&1; then
656
+ read -r -p "Install Worktrunk via Cargo? (y/n): " install_wt
657
+
658
+ if [[ "$install_wt" == "y" ]]; then
659
+ print_info "Installing Worktrunk via Cargo..."
660
+ if cargo install worktrunk 2>/dev/null; then
661
+ print_success "Worktrunk installed"
662
+
663
+ # Install shell integration
664
+ if wt config shell install 2>/dev/null; then
665
+ print_success "Shell integration installed"
666
+ else
667
+ print_warning "Shell integration failed - run manually: wt config shell install"
668
+ fi
669
+ else
670
+ print_warning "Cargo installation failed"
671
+ fi
672
+ else
673
+ print_info "Skipped Worktrunk installation"
674
+ fi
675
+ else
676
+ print_warning "Worktrunk not installed"
677
+ echo ""
678
+ echo " Install options:"
679
+ echo " macOS/Linux (Homebrew): brew install max-sixty/worktrunk/wt"
680
+ echo " Cargo: cargo install worktrunk"
681
+ echo " Windows: winget install max-sixty.worktrunk"
682
+ echo ""
683
+ echo " After install: wt config shell install"
684
+ echo ""
685
+ print_info "Fallback available: ~/.aidevops/agents/scripts/worktree-helper.sh"
686
+ fi
687
+
688
+ return 0
689
+ }
690
+
565
691
  # Setup recommended tools (Tabby terminal, Zed editor)
566
692
  setup_recommended_tools() {
567
693
  print_info "Checking recommended development tools..."
@@ -2112,6 +2238,72 @@ setup_seo_mcps() {
2112
2238
  return 0
2113
2239
  }
2114
2240
 
2241
+ # Setup Google Analytics MCP (disabled by default)
2242
+ setup_google_analytics_mcp() {
2243
+ print_info "Setting up Google Analytics MCP..."
2244
+
2245
+ local opencode_config="$HOME/.config/opencode/opencode.json"
2246
+
2247
+ # Check if opencode.json exists
2248
+ if [[ ! -f "$opencode_config" ]]; then
2249
+ print_warning "OpenCode config not found at $opencode_config - skipping Google Analytics MCP"
2250
+ return 0
2251
+ fi
2252
+
2253
+ # Check if jq is available
2254
+ if ! command -v jq &> /dev/null; then
2255
+ print_warning "jq not found - cannot add Google Analytics MCP to config"
2256
+ print_info "Install jq and re-run setup, or manually add the MCP config"
2257
+ return 0
2258
+ fi
2259
+
2260
+ # Check if pipx is available
2261
+ if ! command -v pipx &> /dev/null; then
2262
+ print_warning "pipx not found - Google Analytics MCP requires pipx"
2263
+ print_info "Install pipx: brew install pipx (macOS) or pip install pipx"
2264
+ print_info "Then re-run setup to add Google Analytics MCP"
2265
+ return 0
2266
+ fi
2267
+
2268
+ # Check if google-analytics-mcp already exists in config
2269
+ if jq -e '.mcp["google-analytics-mcp"]' "$opencode_config" > /dev/null 2>&1; then
2270
+ print_info "Google Analytics MCP already configured in OpenCode"
2271
+ return 0
2272
+ fi
2273
+
2274
+ # Add google-analytics-mcp to opencode.json (disabled by default)
2275
+ local tmp_config
2276
+ tmp_config=$(mktemp)
2277
+
2278
+ if jq '.mcp["google-analytics-mcp"] = {
2279
+ "type": "local",
2280
+ "command": ["pipx", "run", "analytics-mcp"],
2281
+ "environment": {
2282
+ "GOOGLE_APPLICATION_CREDENTIALS": "",
2283
+ "GOOGLE_PROJECT_ID": ""
2284
+ },
2285
+ "enabled": false
2286
+ }' "$opencode_config" > "$tmp_config" 2>/dev/null; then
2287
+ mv "$tmp_config" "$opencode_config"
2288
+ print_success "Added Google Analytics MCP to OpenCode (disabled by default)"
2289
+ print_info "To enable: Set credentials and change enabled to true in opencode.json"
2290
+ print_info "Or use the google-analytics subagent which enables it automatically"
2291
+ else
2292
+ rm -f "$tmp_config"
2293
+ print_warning "Failed to add Google Analytics MCP to config"
2294
+ fi
2295
+
2296
+ # Show setup instructions
2297
+ print_info "Google Analytics MCP setup:"
2298
+ print_info " 1. Enable Google Analytics Admin & Data APIs in Google Cloud Console"
2299
+ print_info " 2. Configure ADC: gcloud auth application-default login --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"
2300
+ print_info " 3. Update GOOGLE_APPLICATION_CREDENTIALS path in opencode.json"
2301
+ print_info " 4. Set GOOGLE_PROJECT_ID in opencode.json"
2302
+ print_info "Documentation: ~/.aidevops/agents/services/analytics/google-analytics.md"
2303
+
2304
+ return 0
2305
+ }
2306
+
2115
2307
  # Check for tool updates after setup
2116
2308
  check_tool_updates() {
2117
2309
  print_info "Checking for tool updates..."
@@ -2240,6 +2432,7 @@ main() {
2240
2432
  confirm_step "Check optional dependencies (bun, node, python)" && check_optional_deps
2241
2433
  confirm_step "Setup recommended tools (Tabby, Zed, etc.)" && setup_recommended_tools
2242
2434
  confirm_step "Setup Git CLIs (gh, glab, tea)" && setup_git_clis
2435
+ confirm_step "Setup Worktrunk (git worktree management)" && setup_worktrunk
2243
2436
  confirm_step "Setup SSH key" && setup_ssh_key
2244
2437
  confirm_step "Setup configuration files" && setup_configs
2245
2438
  confirm_step "Set secure permissions on config files" && set_permissions
@@ -2262,6 +2455,7 @@ main() {
2262
2455
  confirm_step "Setup osgrep (local semantic search)" && setup_osgrep
2263
2456
  confirm_step "Setup Beads task management" && setup_beads
2264
2457
  confirm_step "Setup SEO MCP servers (DataForSEO, Serper)" && setup_seo_mcps
2458
+ confirm_step "Setup Google Analytics MCP" && setup_google_analytics_mcp
2265
2459
  confirm_step "Setup browser automation tools" && setup_browser_tools
2266
2460
  confirm_step "Setup AI orchestration frameworks info" && setup_ai_orchestration
2267
2461
  confirm_step "Setup OpenCode plugins" && setup_opencode_plugins
@@ -12,6 +12,10 @@ readonly YELLOW='\033[1;33m'
12
12
  readonly BLUE='\033[0;34m'
13
13
  readonly NC='\033[0m' # No Color
14
14
 
15
+ # Backup configuration
16
+ readonly BACKUP_KEEP_COUNT=5
17
+ readonly BACKUP_BASE_DIR="$HOME/.aidevops/template-backups"
18
+
15
19
  # Print functions
16
20
  print_info() { local msg="$1"; echo -e "${BLUE}[INFO]${NC} $msg"; return 0; }
17
21
  print_success() { local msg="$1"; echo -e "${GREEN}[SUCCESS]${NC} $msg"; return 0; }
@@ -28,15 +32,93 @@ if [[ ! -f "$REPO_ROOT/AGENTS.md" ]] || [[ ! -d "$REPO_ROOT/.agent" ]]; then
28
32
  exit 1
29
33
  fi
30
34
 
35
+ # Create a backup with rotation (keeps last N backups in centralized location)
36
+ # Usage: create_backup_with_rotation <source_path> <backup_name>
37
+ create_backup_with_rotation() {
38
+ local source_path="$1"
39
+ local backup_name="$2"
40
+ local backup_dir
41
+ # Use nanoseconds to avoid collisions on rapid successive invocations
42
+ backup_dir="$BACKUP_BASE_DIR/$backup_name/$(date +%Y%m%d_%H%M%S%N)"
43
+
44
+ # Validate source exists before attempting backup
45
+ if [[ -d "$source_path" ]]; then
46
+ mkdir -p "$backup_dir"
47
+ cp -R "$source_path" "$backup_dir/"
48
+ elif [[ -f "$source_path" ]]; then
49
+ mkdir -p "$backup_dir"
50
+ cp "$source_path" "$backup_dir/"
51
+ else
52
+ print_warning "Source path does not exist: $source_path"
53
+ return 1
54
+ fi
55
+
56
+ print_info "Backed up to $backup_dir"
57
+
58
+ # Rotate old backups (keep last N)
59
+ local backup_type_dir="$BACKUP_BASE_DIR/$backup_name"
60
+ local backup_count
61
+ backup_count=$(find "$backup_type_dir" -maxdepth 1 -type d -name "20*" 2>/dev/null | wc -l)
62
+
63
+ if (( backup_count > BACKUP_KEEP_COUNT )); then
64
+ local to_delete=$((backup_count - BACKUP_KEEP_COUNT))
65
+ # Delete oldest backups (sorted by name = sorted by date)
66
+ find "$backup_type_dir" -maxdepth 1 -type d -name "20*" -print0 2>/dev/null | sort -z | head -z -n "$to_delete" | xargs -0 rm -rf
67
+ print_info "Rotated backups: removed $to_delete old backup(s)"
68
+ fi
69
+
70
+ return 0
71
+ }
72
+
73
+ # Clean up old in-place backup files from previous versions
74
+ # Uses find -delete to safely remove only files (not directories)
75
+ cleanup_old_backups() {
76
+ local cleaned=0
77
+ local count
78
+
79
+ # Clean ~/AGENTS.md.backup.* files
80
+ count=$(find "$HOME" -maxdepth 1 -name "AGENTS.md.backup.*" -type f 2>/dev/null | wc -l)
81
+ if (( count > 0 )); then
82
+ find "$HOME" -maxdepth 1 -name "AGENTS.md.backup.*" -type f -delete 2>/dev/null
83
+ (( cleaned += count ))
84
+ fi
85
+
86
+ # Clean ~/git/AGENTS.md.backup.* or ~/Git/AGENTS.md.backup.* files
87
+ for git_dir in "$HOME/git" "$HOME/Git"; do
88
+ if [[ -d "$git_dir" ]]; then
89
+ count=$(find "$git_dir" -maxdepth 1 -name "AGENTS.md.backup.*" -type f 2>/dev/null | wc -l)
90
+ if (( count > 0 )); then
91
+ find "$git_dir" -maxdepth 1 -name "AGENTS.md.backup.*" -type f -delete 2>/dev/null
92
+ (( cleaned += count ))
93
+ fi
94
+ fi
95
+ done
96
+
97
+ # Clean ~/.aidevops/.agent-workspace/README.md.backup.* files
98
+ local workspace="$HOME/.aidevops/.agent-workspace"
99
+ if [[ -d "$workspace" ]]; then
100
+ count=$(find "$workspace" -maxdepth 1 -name "README.md.backup.*" -type f 2>/dev/null | wc -l)
101
+ if (( count > 0 )); then
102
+ find "$workspace" -maxdepth 1 -name "README.md.backup.*" -type f -delete 2>/dev/null
103
+ (( cleaned += count ))
104
+ fi
105
+ fi
106
+
107
+ if (( cleaned > 0 )); then
108
+ print_success "Cleaned up $cleaned old backup file(s)"
109
+ fi
110
+
111
+ return 0
112
+ }
113
+
31
114
  deploy_home_agents() {
32
115
  local target_file="$HOME/AGENTS.md"
33
116
 
34
117
  print_info "Deploying minimal AGENTS.md to home directory..."
35
118
 
36
- # Backup existing file if it exists
119
+ # Backup existing file if it exists (with rotation)
37
120
  if [[ -f "$target_file" ]]; then
38
- print_warning "Existing AGENTS.md found, creating backup..."
39
- cp "$target_file" "$target_file.backup.$(date +%Y%m%d_%H%M%S)"
121
+ create_backup_with_rotation "$target_file" "home-agents"
40
122
  fi
41
123
 
42
124
  # Deploy template
@@ -57,10 +139,9 @@ deploy_git_agents() {
57
139
  print_info "Created git directory: $git_dir"
58
140
  fi
59
141
 
60
- # Backup existing file if it exists
142
+ # Backup existing file if it exists (with rotation)
61
143
  if [[ -f "$target_file" ]]; then
62
- print_warning "Existing git/AGENTS.md found, creating backup..."
63
- cp "$target_file" "$target_file.backup.$(date +%Y%m%d_%H%M%S)"
144
+ create_backup_with_rotation "$target_file" "git-agents"
64
145
  fi
65
146
 
66
147
  # Deploy template
@@ -81,10 +162,9 @@ deploy_agent_directory() {
81
162
  print_info "Created workspace directory: $agent_workspace"
82
163
  fi
83
164
 
84
- # Backup existing README if it exists
165
+ # Backup existing README if it exists (with rotation)
85
166
  if [[ -f "$target_file" ]]; then
86
- print_warning "Existing .agent-workspace/README.md found, creating backup..."
87
- cp "$target_file" "$target_file.backup.$(date +%Y%m%d_%H%M%S)"
167
+ create_backup_with_rotation "$target_file" "workspace-readme"
88
168
  fi
89
169
 
90
170
  # Deploy template
@@ -128,6 +208,9 @@ main() {
128
208
  print_info "Deploying minimal, secure AGENTS.md templates..."
129
209
  print_warning "These templates contain minimal instructions to prevent prompt injection attacks"
130
210
 
211
+ # Clean up old in-place backups from previous versions
212
+ cleanup_old_backups
213
+
131
214
  deploy_home_agents
132
215
  deploy_git_agents
133
216
  deploy_agent_directory