aidevops 3.1.54 → 3.1.56

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.54
1
+ 3.1.56
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.54
6
+ # Version: 3.1.56
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.54",
3
+ "version": "3.1.56",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "bin": {
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.54
13
+ # Version: 3.1.56
14
14
  #
15
15
  # Quick Install:
16
16
  # npm install -g aidevops && aidevops update (recommended)
@@ -193,6 +193,38 @@ _launchd_has_agent() {
193
193
  return $?
194
194
  }
195
195
 
196
+ # Install a launchd plist only if its content has changed.
197
+ # Avoids unnecessary unload/reload which resets StartInterval timers.
198
+ # Usage: _launchd_install_if_changed <label> <plist_path> <new_content>
199
+ # Returns: 0 = installed or unchanged, 1 = failed to load
200
+ _launchd_install_if_changed() {
201
+ local label="$1"
202
+ local plist_path="$2"
203
+ local new_content="$3"
204
+
205
+ # Compare with existing plist — skip reload if identical
206
+ if [[ -f "$plist_path" ]]; then
207
+ local existing_content
208
+ existing_content=$(cat "$plist_path")
209
+ if [[ "$existing_content" == "$new_content" ]]; then
210
+ # Ensure it's loaded even if content unchanged
211
+ if ! _launchd_has_agent "$label"; then
212
+ launchctl load "$plist_path" 2>/dev/null || return 1
213
+ fi
214
+ return 0
215
+ fi
216
+ # Content changed — unload before replacing
217
+ if _launchd_has_agent "$label"; then
218
+ launchctl unload "$plist_path" 2>/dev/null || true
219
+ fi
220
+ fi
221
+
222
+ # Write new plist and load
223
+ printf '%s\n' "$new_content" >"$plist_path"
224
+ launchctl load "$plist_path" 2>/dev/null || return 1
225
+ return 0
226
+ }
227
+
196
228
  # Detect whether a scheduler is already installed via launchd or cron.
197
229
  # Optionally migrates legacy launchd labels / cron entries to launchd on macOS.
198
230
  _scheduler_detect_installed() {
@@ -1138,15 +1170,13 @@ PLIST
1138
1170
  if [[ "$(uname -s)" == "Darwin" ]]; then
1139
1171
  local stats_plist="$HOME/Library/LaunchAgents/${stats_label}.plist"
1140
1172
 
1141
- if _launchd_has_agent "$stats_label"; then
1142
- launchctl unload "$stats_plist" 2>/dev/null || true
1143
- fi
1144
-
1145
1173
  local _xml_stats_script _xml_stats_home _xml_stats_path
1146
1174
  _xml_stats_script=$(_xml_escape "$stats_script")
1147
1175
  _xml_stats_home=$(_xml_escape "$HOME")
1148
1176
  _xml_stats_path=$(_xml_escape "$PATH")
1149
- cat >"$stats_plist" <<PLIST
1177
+ local stats_plist_content
1178
+ stats_plist_content=$(
1179
+ cat <<PLIST
1150
1180
  <?xml version="1.0" encoding="UTF-8"?>
1151
1181
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1152
1182
  <plist version="1.0">
@@ -1178,7 +1208,8 @@ PLIST
1178
1208
  </dict>
1179
1209
  </plist>
1180
1210
  PLIST
1181
- if launchctl load "$stats_plist"; then
1211
+ )
1212
+ if _launchd_install_if_changed "$stats_label" "$stats_plist" "$stats_plist_content"; then
1182
1213
  print_info "Stats wrapper enabled (launchd, every 15 min)"
1183
1214
  else
1184
1215
  print_warning "Failed to load stats wrapper LaunchAgent"
@@ -1253,11 +1284,6 @@ PLIST
1253
1284
  if [[ "$(uname -s)" == "Darwin" ]]; then
1254
1285
  local guard_plist="$HOME/Library/LaunchAgents/${guard_label}.plist"
1255
1286
 
1256
- # Unload old plist if upgrading
1257
- if _launchd_has_agent "$guard_label"; then
1258
- launchctl unload "$guard_plist" || true
1259
- fi
1260
-
1261
1287
  # XML-escape paths for safe plist embedding (prevents injection
1262
1288
  # if $HOME or paths contain &, <, > characters)
1263
1289
  local _xml_guard_script _xml_guard_home _xml_guard_path
@@ -1265,7 +1291,9 @@ PLIST
1265
1291
  _xml_guard_home=$(_xml_escape "$HOME")
1266
1292
  _xml_guard_path=$(_xml_escape "$PATH")
1267
1293
 
1268
- cat >"$guard_plist" <<GUARD_PLIST
1294
+ local guard_plist_content
1295
+ guard_plist_content=$(
1296
+ cat <<GUARD_PLIST
1269
1297
  <?xml version="1.0" encoding="UTF-8"?>
1270
1298
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1271
1299
  <plist version="1.0">
@@ -1306,8 +1334,9 @@ PLIST
1306
1334
  </dict>
1307
1335
  </plist>
1308
1336
  GUARD_PLIST
1337
+ )
1309
1338
 
1310
- if launchctl load "$guard_plist"; then
1339
+ if _launchd_install_if_changed "$guard_label" "$guard_plist" "$guard_plist_content"; then
1311
1340
  print_info "Process guard enabled (launchd, every 30s, survives reboot)"
1312
1341
  else
1313
1342
  print_warning "Failed to load process guard LaunchAgent"
@@ -1343,12 +1372,9 @@ GUARD_PLIST
1343
1372
  if [[ "$(uname -s)" == "Darwin" ]]; then
1344
1373
  local monitor_plist="$HOME/Library/LaunchAgents/${monitor_label}.plist"
1345
1374
 
1346
- # Unload old plist if upgrading
1347
- if _launchd_has_agent "$monitor_label"; then
1348
- launchctl unload "$monitor_plist" 2>/dev/null || true
1349
- fi
1350
-
1351
- cat >"$monitor_plist" <<MONITOR_PLIST
1375
+ local monitor_plist_content
1376
+ monitor_plist_content=$(
1377
+ cat <<MONITOR_PLIST
1352
1378
  <?xml version="1.0" encoding="UTF-8"?>
1353
1379
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1354
1380
  <plist version="1.0">
@@ -1386,8 +1412,9 @@ GUARD_PLIST
1386
1412
  </dict>
1387
1413
  </plist>
1388
1414
  MONITOR_PLIST
1415
+ )
1389
1416
 
1390
- if launchctl load "$monitor_plist" 2>/dev/null; then
1417
+ if _launchd_install_if_changed "$monitor_label" "$monitor_plist" "$monitor_plist_content"; then
1391
1418
  print_info "Memory pressure monitor enabled (launchd, every 60s, survives reboot)"
1392
1419
  else
1393
1420
  print_warning "Failed to load memory pressure monitor LaunchAgent"
@@ -1418,17 +1445,14 @@ MONITOR_PLIST
1418
1445
  if [[ "$(uname -s)" == "Darwin" ]]; then
1419
1446
  local st_plist="$HOME/Library/LaunchAgents/${st_label}.plist"
1420
1447
 
1421
- # Unload old plist if upgrading
1422
- if _launchd_has_agent "$st_label"; then
1423
- launchctl unload "$st_plist" 2>/dev/null || true
1424
- fi
1425
-
1426
1448
  # XML-escape paths for safe plist embedding
1427
1449
  local _xml_st_script _xml_st_home
1428
1450
  _xml_st_script=$(_xml_escape "$st_script")
1429
1451
  _xml_st_home=$(_xml_escape "$HOME")
1430
1452
 
1431
- cat >"$st_plist" <<ST_PLIST
1453
+ local st_plist_content
1454
+ st_plist_content=$(
1455
+ cat <<ST_PLIST
1432
1456
  <?xml version="1.0" encoding="UTF-8"?>
1433
1457
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1434
1458
  <plist version="1.0">
@@ -1467,8 +1491,9 @@ MONITOR_PLIST
1467
1491
  </dict>
1468
1492
  </plist>
1469
1493
  ST_PLIST
1494
+ )
1470
1495
 
1471
- if launchctl load "$st_plist" 2>/dev/null; then
1496
+ if _launchd_install_if_changed "$st_label" "$st_plist" "$st_plist_content"; then
1472
1497
  print_info "Screen time snapshot enabled (launchd, every 6h, survives reboot)"
1473
1498
  else
1474
1499
  print_warning "Failed to load screen time snapshot LaunchAgent"
@@ -1544,17 +1569,14 @@ ST_PLIST
1544
1569
  if [[ "$(uname -s)" == "Darwin" ]]; then
1545
1570
  local pr_plist="$HOME/Library/LaunchAgents/${pr_label}.plist"
1546
1571
 
1547
- # Unload old plist if upgrading
1548
- if _launchd_has_agent "$pr_label"; then
1549
- launchctl unload "$pr_plist" 2>/dev/null || true
1550
- fi
1551
-
1552
1572
  # XML-escape paths for safe plist embedding
1553
1573
  local _xml_pr_script _xml_pr_home
1554
1574
  _xml_pr_script=$(_xml_escape "$pr_script")
1555
1575
  _xml_pr_home=$(_xml_escape "$HOME")
1556
1576
 
1557
- cat >"$pr_plist" <<PR_PLIST
1577
+ local pr_plist_content
1578
+ pr_plist_content=$(
1579
+ cat <<PR_PLIST
1558
1580
  <?xml version="1.0" encoding="UTF-8"?>
1559
1581
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1560
1582
  <plist version="1.0">
@@ -1593,8 +1615,9 @@ ST_PLIST
1593
1615
  </dict>
1594
1616
  </plist>
1595
1617
  PR_PLIST
1618
+ )
1596
1619
 
1597
- if launchctl load "$pr_plist" 2>/dev/null; then
1620
+ if _launchd_install_if_changed "$pr_label" "$pr_plist" "$pr_plist_content"; then
1598
1621
  print_info "Profile README update enabled (launchd, hourly)"
1599
1622
  else
1600
1623
  print_warning "Failed to load profile README update LaunchAgent"