aidevops 3.1.28 → 3.1.30

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/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.28
1
+ 3.1.30
package/aidevops.sh CHANGED
@@ -3,7 +3,7 @@
3
3
  # AI DevOps Framework CLI
4
4
  # Usage: aidevops <command> [options]
5
5
  #
6
- # Version: 3.1.28
6
+ # Version: 3.1.30
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": "3.1.28",
3
+ "version": "3.1.30",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -435,11 +435,10 @@ setup_opencode_plugins() {
435
435
  # Prerequisites met — proceed with setup
436
436
  print_info "Setting up OpenCode plugins..."
437
437
 
438
- # Setup aidevops plugin via local plugin directory (not opencode.json plugin array).
439
- # OpenCode's plugin array is npm-only. Local plugins must be symlinked to:
440
- # ~/.config/opencode/plugins/ (global)
441
- # .opencode/plugins/ (project-level)
442
- # See: https://opencode.ai/docs/plugins/
438
+ # Register aidevops plugin using two complementary mechanisms:
439
+ # 1. file:// URL in opencode.json "plugin" array (works on all tested versions)
440
+ # 2. Symlink in ~/.config/opencode/plugins/ (newer OpenCode convention)
441
+ # Both are idempotent — the plugin's registerPoolProvider() checks before adding.
443
442
  local plugins_dir="$HOME/.config/opencode/plugins"
444
443
  local aidevops_plugin_src="$HOME/.aidevops/agents/plugins/opencode-aidevops"
445
444
  local aidevops_plugin_dst="$plugins_dir/opencode-aidevops"
@@ -452,22 +451,52 @@ setup_opencode_plugins() {
452
451
  return 0
453
452
  fi
454
453
 
455
- # Create plugins directory if needed
456
- mkdir -p "$plugins_dir"
454
+ # --- Mechanism 1: file:// URL in opencode.json plugin array ---
455
+ # This is the primary mechanism — proven to work on OpenCode 1.2.x.
456
+ local opencode_config
457
+ local plugin_url="file://${aidevops_plugin_entrypoint}"
458
+ if opencode_config=$(find_opencode_config) && command -v jq &>/dev/null; then
459
+ # Check if the plugin URL is already in the array
460
+ local already_registered
461
+ already_registered=$(jq --arg url "$plugin_url" \
462
+ '(.plugin // []) | map(select(. == $url)) | length' \
463
+ "$opencode_config" 2>/dev/null || echo "0")
464
+
465
+ if [[ "$already_registered" -eq 0 ]]; then
466
+ # Add the plugin URL to the array (create array if absent)
467
+ local tmp_config="${opencode_config}.tmp.$$"
468
+ if jq --arg url "$plugin_url" \
469
+ '.plugin = ((.plugin // []) + [$url] | unique)' \
470
+ "$opencode_config" >"$tmp_config" 2>/dev/null; then
471
+ mv "$tmp_config" "$opencode_config"
472
+ print_success "aidevops plugin registered in opencode.json"
473
+ else
474
+ rm -f "$tmp_config"
475
+ print_warning "Failed to update opencode.json plugin array"
476
+ fi
477
+ else
478
+ print_success "aidevops plugin already registered in opencode.json"
479
+ fi
480
+ pool_plugin_registered="true"
481
+ else
482
+ if [[ -z "${opencode_config:-}" ]]; then
483
+ print_info "opencode.json not found — run 'opencode' once to create it, then re-run setup"
484
+ else
485
+ print_info "jq not installed — cannot update opencode.json plugin array"
486
+ fi
487
+ fi
457
488
 
458
- # Register plugin if needed; treat broken symlinks as unregistered.
489
+ # --- Mechanism 2: symlink in plugins directory (belt-and-suspenders) ---
490
+ mkdir -p "$plugins_dir"
459
491
  if [[ -L "$aidevops_plugin_dst" ]]; then
460
492
  if [[ ! -e "$aidevops_plugin_dst" ]]; then
461
- print_warning "Broken aidevops plugin symlink detected; recreating ~/.config/opencode/plugins/opencode-aidevops"
493
+ print_warning "Broken aidevops plugin symlink detected; recreating"
462
494
  ln -sfn "$aidevops_plugin_src" "$aidevops_plugin_dst"
463
495
  fi
464
- print_success "aidevops plugin already registered at ~/.config/opencode/plugins/"
465
- elif [[ -d "$aidevops_plugin_dst" && -f "$aidevops_plugin_dst/index.mjs" ]]; then
466
- print_success "aidevops plugin already registered at ~/.config/opencode/plugins/"
467
- else
496
+ elif [[ ! -d "$aidevops_plugin_dst" ]]; then
468
497
  ln -sfn "$aidevops_plugin_src" "$aidevops_plugin_dst"
469
- print_success "aidevops plugin registered at ~/.config/opencode/plugins/"
470
498
  fi
499
+
471
500
  setup_track_configured "OpenCode plugins"
472
501
  pool_plugin_registered="true"
473
502
 
package/setup.sh CHANGED
@@ -10,7 +10,7 @@ shopt -s inherit_errexit 2>/dev/null || true
10
10
  # AI Assistant Server Access Framework Setup Script
11
11
  # Helps developers set up the framework for their infrastructure
12
12
  #
13
- # Version: 3.1.28
13
+ # Version: 3.1.30
14
14
  #
15
15
  # Quick Install:
16
16
  # npm install -g aidevops && aidevops update (recommended)
@@ -1496,13 +1496,28 @@ ST_PLIST
1496
1496
  local repos_json="$HOME/.config/aidevops/repos.json"
1497
1497
  local has_profile_repo="false"
1498
1498
  if [[ -x "$pr_script" ]] && command -v gh &>/dev/null && gh auth status &>/dev/null; then
1499
- # Initialize profile repo if not already set up
1499
+ # Initialize profile repo if not already set up.
1500
+ # Verify the entry is valid: local dir exists AND README has stat markers.
1501
+ # If the repo was deleted or local clone removed, re-run init to recreate.
1502
+ local profile_needs_init="true"
1500
1503
  if [[ -f "$repos_json" ]] && command -v jq &>/dev/null; then
1501
- if jq -e '.initialized_repos[]? | select(.priority == "profile")' "$repos_json" >/dev/null 2>&1; then
1504
+ local profile_path
1505
+ profile_path=$(jq -r '
1506
+ if .initialized_repos then
1507
+ .initialized_repos[] | select(.priority == "profile") | .path
1508
+ else
1509
+ to_entries[] | select(.value.priority == "profile") | .value.path
1510
+ end
1511
+ ' "$repos_json" 2>/dev/null | head -1)
1512
+ if [[ -n "$profile_path" && "$profile_path" != "null" ]] &&
1513
+ [[ -d "$profile_path" ]] &&
1514
+ [[ -f "${profile_path}/README.md" ]] &&
1515
+ grep -q '<!-- STATS-START -->' "${profile_path}/README.md" 2>/dev/null; then
1516
+ profile_needs_init="false"
1502
1517
  has_profile_repo="true"
1503
1518
  fi
1504
1519
  fi
1505
- if [[ "$has_profile_repo" == "false" ]]; then
1520
+ if [[ "$profile_needs_init" == "true" ]]; then
1506
1521
  print_info "Setting up GitHub profile README..."
1507
1522
  if bash "$pr_script" init; then
1508
1523
  has_profile_repo="true"
@@ -1510,8 +1525,6 @@ ST_PLIST
1510
1525
  else
1511
1526
  print_warning "Profile README setup failed (non-fatal, skipping)"
1512
1527
  fi
1513
- else
1514
- has_profile_repo="true"
1515
1528
  fi
1516
1529
  elif [[ -f "$repos_json" ]] && command -v jq &>/dev/null; then
1517
1530
  # No gh CLI but check if profile repo already registered