aidevops 3.8.69 → 3.8.71

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.8.69
1
+ 3.8.71
package/aidevops.sh CHANGED
@@ -5,7 +5,7 @@
5
5
  # AI DevOps Framework CLI
6
6
  # Usage: aidevops <command> [options]
7
7
  #
8
- # Version: 3.8.69
8
+ # Version: 3.8.71
9
9
 
10
10
  set -euo pipefail
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidevops",
3
- "version": "3.8.69",
3
+ "version": "3.8.71",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,30 @@
9
9
  # Keep pulse workers alive long enough for opus-tier dispatches.
10
10
  PULSE_STALE_THRESHOLD_SECONDS=1800
11
11
 
12
+ # Resolve the modern bash binary path for use in launchd ProgramArguments.
13
+ # Launchd bypasses the shebang when ProgramArguments specifies an explicit
14
+ # interpreter, so we must resolve the path at plist generation time.
15
+ # Falls back to /bin/bash if no modern bash is available (the re-exec guard
16
+ # in shared-constants.sh provides defense-in-depth). (GH#19632 / t2176)
17
+ _resolve_modern_bash() {
18
+ local candidate
19
+ for candidate in /opt/homebrew/bin/bash /usr/local/bin/bash /home/linuxbrew/.linuxbrew/bin/bash; do
20
+ if [[ -x "$candidate" ]]; then
21
+ # Verify it's actually bash 4+
22
+ local ver
23
+ ver=$("$candidate" -c 'echo "${BASH_VERSINFO[0]}"' 2>/dev/null) || continue
24
+ if [[ "${ver:-0}" -ge 4 ]]; then
25
+ printf '%s' "$candidate"
26
+ return 0
27
+ fi
28
+ fi
29
+ done
30
+ # No modern bash found — fall back to /bin/bash. The re-exec guard in
31
+ # shared-constants.sh handles this case at runtime.
32
+ printf '%s' "/bin/bash"
33
+ return 0
34
+ }
35
+
12
36
  # Shell safety baseline
13
37
  set -Eeuo pipefail
14
38
  IFS=$'\n\t'
@@ -490,6 +514,11 @@ _generate_pulse_plist_content() {
490
514
  local _headless_xml_env
491
515
  _headless_xml_env=$(_build_pulse_headless_env_xml)
492
516
 
517
+ # Resolve modern bash for ProgramArguments — launchd bypasses shebangs
518
+ # when an explicit interpreter is specified. (GH#19632 / t2176)
519
+ local _xml_bash_bin
520
+ _xml_bash_bin=$(_xml_escape "$(_resolve_modern_bash)")
521
+
493
522
  cat <<PLIST
494
523
  <?xml version="1.0" encoding="UTF-8"?>
495
524
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -499,7 +528,7 @@ _generate_pulse_plist_content() {
499
528
  <string>${pulse_label}</string>
500
529
  <key>ProgramArguments</key>
501
530
  <array>
502
- <string>/bin/bash</string>
531
+ <string>${_xml_bash_bin}</string>
503
532
  <string>${_xml_wrapper_script}</string>
504
533
  </array>
505
534
  <key>StartInterval</key>
@@ -941,7 +970,7 @@ setup_stats_wrapper() {
941
970
  <string>${stats_label}</string>
942
971
  <key>ProgramArguments</key>
943
972
  <array>
944
- <string>/bin/bash</string>
973
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
945
974
  <string>${_xml_stats_script}</string>
946
975
  </array>
947
976
  <key>StartInterval</key>
@@ -1040,7 +1069,7 @@ setup_failure_miner() {
1040
1069
  <string>${miner_label}</string>
1041
1070
  <key>ProgramArguments</key>
1042
1071
  <array>
1043
- <string>/bin/bash</string>
1072
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1044
1073
  <string>${_xml_miner_script}</string>
1045
1074
  <string>create-issues</string>
1046
1075
  <string>--since-hours</string>
@@ -1137,7 +1166,7 @@ setup_process_guard() {
1137
1166
  <string>${guard_label}</string>
1138
1167
  <key>ProgramArguments</key>
1139
1168
  <array>
1140
- <string>/bin/bash</string>
1169
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1141
1170
  <string>${_xml_guard_script}</string>
1142
1171
  <string>kill-runaways</string>
1143
1172
  </array>
@@ -1232,7 +1261,7 @@ setup_memory_pressure_monitor() {
1232
1261
  <string>${monitor_label}</string>
1233
1262
  <key>ProgramArguments</key>
1234
1263
  <array>
1235
- <string>/bin/bash</string>
1264
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1236
1265
  <string>${_xml_monitor_script}</string>
1237
1266
  </array>
1238
1267
  <key>StartInterval</key>
@@ -1320,7 +1349,7 @@ setup_screen_time_snapshot() {
1320
1349
  <string>${st_label}</string>
1321
1350
  <key>ProgramArguments</key>
1322
1351
  <array>
1323
- <string>/bin/bash</string>
1352
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1324
1353
  <string>${_xml_st_script}</string>
1325
1354
  <string>snapshot</string>
1326
1355
  </array>
@@ -1425,7 +1454,7 @@ _install_cw_launchd() {
1425
1454
  <string>${cw_label}</string>
1426
1455
  <key>ProgramArguments</key>
1427
1456
  <array>
1428
- <string>/bin/bash</string>
1457
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1429
1458
  <string>${_xml_cw_script}</string>
1430
1459
  <string>scan</string>
1431
1460
  </array>
@@ -1587,7 +1616,7 @@ _install_profile_readme_launchd() {
1587
1616
  <string>${pr_label}</string>
1588
1617
  <key>ProgramArguments</key>
1589
1618
  <array>
1590
- <string>/bin/bash</string>
1619
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1591
1620
  <string>${_xml_pr_script}</string>
1592
1621
  <string>update</string>
1593
1622
  </array>
@@ -1793,7 +1822,7 @@ _install_token_refresh_launchd() {
1793
1822
  <string>${tr_label}</string>
1794
1823
  <key>ProgramArguments</key>
1795
1824
  <array>
1796
- <string>/bin/bash</string>
1825
+ <string>$(_xml_escape "$(_resolve_modern_bash)")</string>
1797
1826
  <string>-c</string>
1798
1827
  <string>&quot;${_xml_tr_script}&quot; refresh anthropic; &quot;${_xml_tr_script}&quot; refresh openai</string>
1799
1828
  </array>
@@ -1866,6 +1895,62 @@ setup_oauth_token_refresh() {
1866
1895
  return 0
1867
1896
  }
1868
1897
 
1898
+ # Setup opencode DB maintenance scheduler (r913, t2183).
1899
+ # Runs weekly (Sun 04:00 local) to checkpoint/optimize/vacuum opencode.db.
1900
+ # The helper self-noops on missing DB, so installing unconditionally is safe —
1901
+ # a non-opencode machine wakes up weekly, sees no DB, exits 0 silently.
1902
+ #
1903
+ # Platform split (mirrors the pattern for token-refresh):
1904
+ # macOS — helper owns its plist generation via cmd_install (Approach B).
1905
+ # Linux — _install_scheduler_linux with cron `0 4 * * 0` + systemd
1906
+ # OnCalendar `Sun *-*-* 04:00:00` for accurate wall-clock firing.
1907
+ # Windows — TODO(t2183-followup): opencode on Windows is rare and the
1908
+ # helper self-noops on missing DB, so leaving unscheduled is
1909
+ # low-risk for this iteration.
1910
+ setup_opencode_db_maintenance() {
1911
+ local ocdbm_script="$HOME/.aidevops/agents/scripts/opencode-db-maintenance-helper.sh"
1912
+ if ! [[ -x "$ocdbm_script" ]]; then
1913
+ return 0
1914
+ fi
1915
+
1916
+ local ocdbm_log_dir="$HOME/.aidevops/.agent-workspace/logs"
1917
+ mkdir -p "$ocdbm_log_dir"
1918
+
1919
+ if [[ "$(uname -s)" == "Darwin" ]]; then
1920
+ # Helper owns its own plist generation (Approach B, like repo-sync).
1921
+ # Quiet the helper's multi-line output and emit one consolidated line
1922
+ # to match the style of setup_profile_readme / setup_oauth_token_refresh.
1923
+ if bash "$ocdbm_script" install >/dev/null 2>&1; then
1924
+ print_info "OpenCode DB maintenance enabled (launchd, weekly Sun 04:00)"
1925
+ else
1926
+ print_warning "Failed to install opencode DB maintenance LaunchAgent"
1927
+ fi
1928
+ elif _is_windows; then
1929
+ # Windows scheduling deferred — helper self-noops on missing DB so
1930
+ # the cost of leaving unscheduled is ~0 until opencode lands on
1931
+ # Windows in quantity.
1932
+ return 0
1933
+ else
1934
+ # Linux / WSL: prefer systemd user timer, fall back to cron.
1935
+ # Weekly Sunday 04:00 local — cron: `0 4 * * 0`; systemd OnCalendar
1936
+ # ensures wall-clock firing even across suspends/reboots.
1937
+ _install_scheduler_linux \
1938
+ "aidevops-opencode-db-maintenance" \
1939
+ "aidevops: opencode-db-maintenance" \
1940
+ "0 4 * * 0" \
1941
+ "\"${ocdbm_script}\" auto" \
1942
+ "604800" \
1943
+ "${ocdbm_log_dir}/opencode-db-maintenance.log" \
1944
+ "" \
1945
+ "OpenCode DB maintenance enabled (weekly Sun 04:00)" \
1946
+ "Failed to install opencode DB maintenance scheduler" \
1947
+ "false" \
1948
+ "true" \
1949
+ "Sun *-*-* 04:00:00"
1950
+ fi
1951
+ return 0
1952
+ }
1953
+
1869
1954
  # Setup repo-sync scheduler if not already installed.
1870
1955
  # Keeps local git repos up to date with daily ff-only pulls.
1871
1956
  # Respects config: aidevops config set orchestration.repo_sync false
package/setup.sh CHANGED
@@ -12,7 +12,7 @@ shopt -s inherit_errexit 2>/dev/null || true
12
12
  # AI Assistant Server Access Framework Setup Script
13
13
  # Helps developers set up the framework for their infrastructure
14
14
  #
15
- # Version: 3.8.69
15
+ # Version: 3.8.71
16
16
  #
17
17
  # Quick Install:
18
18
  # npm install -g aidevops && aidevops update (recommended)
@@ -90,15 +90,17 @@ if [[ -d "$SETUP_MODULES_DIR" ]]; then
90
90
  # shellcheck disable=SC1091
91
91
  source "$SETUP_MODULES_DIR/_privacy_guard.sh"
92
92
  # shellcheck disable=SC1091
93
+ source "$SETUP_MODULES_DIR/_complexity_guard.sh"
94
+ # shellcheck disable=SC1091
93
95
  source "$SETUP_MODULES_DIR/_task_id_guard.sh"
94
96
  # shellcheck disable=SC1091
95
97
  source "$SETUP_MODULES_DIR/_canonical_guard.sh"
96
98
  fi
97
99
 
98
- print_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
99
- print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
100
- print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
101
- print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
100
+ print_info() { local _m="$1"; echo -e "${BLUE}[INFO]${NC} $_m"; return 0; }
101
+ print_success() { local _m="$1"; echo -e "${GREEN}[SUCCESS]${NC} $_m"; return 0; }
102
+ print_warning() { local _m="$1"; echo -e "${YELLOW}[WARNING]${NC} $_m"; return 0; }
103
+ print_error() { local _m="$1"; echo -e "${RED}[ERROR]${NC} $_m"; return 0; }
102
104
 
103
105
  # Source shared-constants for config support (is_feature_enabled / config_enabled)
104
106
  # Try repo-local first, then deployed location
@@ -245,9 +247,9 @@ _launchd_install_if_changed() {
245
247
 
246
248
  # Detect whether a scheduler is already installed via launchd, cron, or systemd.
247
249
  # Optionally migrates legacy launchd labels / cron entries to launchd on macOS.
248
- # Args: $1=scheduler_name, $2=launchd_label, $3=legacy_launchd_label,
249
- # $4=cron_marker, $5=migrate_script, $6=migrate_arg, $7=migrate_hint
250
- # $8=systemd_unit (optional — base name without .timer suffix, e.g. "aidevops-supervisor-pulse")
250
+ # Args: arg1=scheduler_name, arg2=launchd_label, arg3=legacy_launchd_label,
251
+ # arg4=cron_marker, arg5=migrate_script, arg6=migrate_arg, arg7=migrate_hint
252
+ # arg8=systemd_unit (optional — base name without .timer suffix, e.g. "aidevops-supervisor-pulse")
251
253
  _scheduler_detect_installed() {
252
254
  local scheduler_name="$1"
253
255
  local launchd_label="$2"
@@ -317,7 +319,7 @@ _should_setup_noninteractive_supervisor_pulse() {
317
319
  # Generic non-interactive scheduler detection (GH#17695 Finding B).
318
320
  # Returns 0 if the named scheduler is already installed on any backend,
319
321
  # meaning it should be regenerated during non-interactive setup.
320
- # Args: $1=name $2=launchd_label $3=cron_marker $4=systemd_unit
322
+ # Args: arg1=name arg2=launchd_label arg3=cron_marker arg4=systemd_unit
321
323
  _should_setup_noninteractive_scheduler() {
322
324
  local name="$1"
323
325
  local launchd_label="$2"
@@ -739,7 +741,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/setup-modules/post-setup.sh"
739
741
 
740
742
  parse_args() {
741
743
  while [[ $# -gt 0 ]]; do
742
- case "$1" in
744
+ local _opt="$1"
745
+ case "$_opt" in
743
746
  --clean)
744
747
  CLEAN_MODE=true
745
748
  shift
@@ -774,7 +777,7 @@ parse_args() {
774
777
  exit 0
775
778
  ;;
776
779
  *)
777
- print_error "Unknown option: $1"
780
+ print_error "Unknown option: $_opt"
778
781
  echo "Use --help for usage information"
779
782
  exit 1
780
783
  ;;
@@ -957,6 +960,10 @@ _setup_run_non_interactive() {
957
960
  # repo so TODO/todo/README/ISSUE_TEMPLATE pushes to public GitHub repos
958
961
  # are scanned for private slug leaks (t1968).
959
962
  setup_privacy_guard
963
+ # Install/refresh the complexity-regression pre-push hook in every
964
+ # initialized repo so pushes that introduce new function-complexity,
965
+ # nesting-depth, or file-size violations are caught before CI (t2198).
966
+ setup_complexity_guard
960
967
  # Install/refresh the canonical-on-main post-checkout hook in every
961
968
  # initialized repo so branch switches away from main in the canonical
962
969
  # directory are warned against (t1995). Complements pre-edit-check.sh's
@@ -1131,6 +1138,9 @@ _setup_post_setup_steps() {
1131
1138
  if _should_setup_noninteractive_scheduler "OAuth token refresh" "sh.aidevops.token-refresh" "aidevops: token-refresh" "aidevops-token-refresh"; then
1132
1139
  setup_oauth_token_refresh
1133
1140
  fi
1141
+ # opencode DB maintenance (r913, t2183). Helper self-noops on missing
1142
+ # DB — safe to install unconditionally in non-interactive mode too.
1143
+ setup_opencode_db_maintenance
1134
1144
  # Migrate cron entries to systemd after schedulers are installed (GH#17695 Finding D)
1135
1145
  migrate_cron_to_systemd
1136
1146
  setup_tabby
@@ -1150,6 +1160,7 @@ _setup_post_setup_steps() {
1150
1160
  setup_draft_responses
1151
1161
  setup_profile_readme
1152
1162
  setup_oauth_token_refresh
1163
+ setup_opencode_db_maintenance
1153
1164
  # Migrate cron entries to systemd after schedulers are installed (GH#17695 Finding D)
1154
1165
  migrate_cron_to_systemd
1155
1166
  setup_tabby