aidevops 3.1.55 → 3.1.57
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 +1 -1
- package/aidevops.sh +1 -1
- package/package.json +1 -1
- package/setup.sh +152 -35
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.1.
|
|
1
|
+
3.1.57
|
package/aidevops.sh
CHANGED
package/package.json
CHANGED
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.
|
|
13
|
+
# Version: 3.1.57
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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"
|
|
@@ -1489,6 +1514,100 @@ ST_PLIST
|
|
|
1489
1514
|
fi
|
|
1490
1515
|
fi
|
|
1491
1516
|
|
|
1517
|
+
# Contribution watch — monitors external issues/PRs for new activity (t1554).
|
|
1518
|
+
# Auto-seeds on first run (discovers authored/commented issues/PRs), then installs
|
|
1519
|
+
# a launchd/cron job to scan periodically. Requires gh CLI authenticated.
|
|
1520
|
+
# No consent needed — this is passive monitoring (read-only notifications API),
|
|
1521
|
+
# not autonomous action. Comment bodies are never processed by LLM in automated context.
|
|
1522
|
+
# Respects config: aidevops config set orchestration.contribution_watch false
|
|
1523
|
+
local cw_script="$HOME/.aidevops/agents/scripts/contribution-watch-helper.sh"
|
|
1524
|
+
local cw_label="sh.aidevops.contribution-watch"
|
|
1525
|
+
local cw_state="$HOME/.aidevops/cache/contribution-watch.json"
|
|
1526
|
+
if [[ -x "$cw_script" ]] && is_feature_enabled contribution_watch 2>/dev/null && command -v gh &>/dev/null && gh auth status &>/dev/null 2>&1; then
|
|
1527
|
+
mkdir -p "$HOME/.aidevops/cache" "$HOME/.aidevops/logs"
|
|
1528
|
+
|
|
1529
|
+
# Auto-seed on first run (populates state file with existing contributions)
|
|
1530
|
+
if [[ ! -f "$cw_state" ]]; then
|
|
1531
|
+
print_info "Discovering external contributions for contribution watch..."
|
|
1532
|
+
if bash "$cw_script" seed >/dev/null 2>&1; then
|
|
1533
|
+
print_info "Contribution watch seeded (external issues/PRs discovered)"
|
|
1534
|
+
else
|
|
1535
|
+
print_warning "Contribution watch seed failed (non-fatal, will retry on next run)"
|
|
1536
|
+
fi
|
|
1537
|
+
fi
|
|
1538
|
+
|
|
1539
|
+
# Install/update scheduled scanner
|
|
1540
|
+
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
1541
|
+
local cw_plist="$HOME/Library/LaunchAgents/${cw_label}.plist"
|
|
1542
|
+
|
|
1543
|
+
local _xml_cw_script _xml_cw_home
|
|
1544
|
+
_xml_cw_script=$(_xml_escape "$cw_script")
|
|
1545
|
+
_xml_cw_home=$(_xml_escape "$HOME")
|
|
1546
|
+
|
|
1547
|
+
local cw_plist_content
|
|
1548
|
+
cw_plist_content=$(
|
|
1549
|
+
cat <<CW_PLIST
|
|
1550
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
1551
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
1552
|
+
<plist version="1.0">
|
|
1553
|
+
<dict>
|
|
1554
|
+
<key>Label</key>
|
|
1555
|
+
<string>${cw_label}</string>
|
|
1556
|
+
<key>ProgramArguments</key>
|
|
1557
|
+
<array>
|
|
1558
|
+
<string>/bin/bash</string>
|
|
1559
|
+
<string>${_xml_cw_script}</string>
|
|
1560
|
+
<string>scan</string>
|
|
1561
|
+
</array>
|
|
1562
|
+
<key>StartInterval</key>
|
|
1563
|
+
<integer>3600</integer>
|
|
1564
|
+
<key>StandardOutPath</key>
|
|
1565
|
+
<string>${_xml_cw_home}/.aidevops/logs/contribution-watch.log</string>
|
|
1566
|
+
<key>StandardErrorPath</key>
|
|
1567
|
+
<string>${_xml_cw_home}/.aidevops/logs/contribution-watch.log</string>
|
|
1568
|
+
<key>EnvironmentVariables</key>
|
|
1569
|
+
<dict>
|
|
1570
|
+
<key>PATH</key>
|
|
1571
|
+
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
|
1572
|
+
<key>HOME</key>
|
|
1573
|
+
<string>${_xml_cw_home}</string>
|
|
1574
|
+
</dict>
|
|
1575
|
+
<key>RunAtLoad</key>
|
|
1576
|
+
<false/>
|
|
1577
|
+
<key>KeepAlive</key>
|
|
1578
|
+
<false/>
|
|
1579
|
+
<key>ProcessType</key>
|
|
1580
|
+
<string>Background</string>
|
|
1581
|
+
<key>LowPriorityBackgroundIO</key>
|
|
1582
|
+
<true/>
|
|
1583
|
+
<key>Nice</key>
|
|
1584
|
+
<integer>10</integer>
|
|
1585
|
+
</dict>
|
|
1586
|
+
</plist>
|
|
1587
|
+
CW_PLIST
|
|
1588
|
+
)
|
|
1589
|
+
|
|
1590
|
+
if _launchd_install_if_changed "$cw_label" "$cw_plist" "$cw_plist_content"; then
|
|
1591
|
+
print_info "Contribution watch enabled (launchd, hourly scan)"
|
|
1592
|
+
else
|
|
1593
|
+
print_warning "Failed to load contribution watch LaunchAgent"
|
|
1594
|
+
fi
|
|
1595
|
+
else
|
|
1596
|
+
# Linux: cron entry (hourly)
|
|
1597
|
+
local _cron_cw_script
|
|
1598
|
+
_cron_cw_script=$(_cron_escape "$cw_script")
|
|
1599
|
+
(
|
|
1600
|
+
crontab -l 2>/dev/null | grep -v 'aidevops: contribution-watch'
|
|
1601
|
+
echo "0 * * * * /bin/bash ${_cron_cw_script} scan >> \"\$HOME/.aidevops/logs/contribution-watch.log\" 2>&1 # aidevops: contribution-watch"
|
|
1602
|
+
) | crontab - 2>/dev/null || true
|
|
1603
|
+
if crontab -l 2>/dev/null | grep -qF "aidevops: contribution-watch" 2>/dev/null; then
|
|
1604
|
+
print_info "Contribution watch enabled (cron, hourly scan)"
|
|
1605
|
+
else
|
|
1606
|
+
print_warning "Failed to install contribution watch cron entry"
|
|
1607
|
+
fi
|
|
1608
|
+
fi
|
|
1609
|
+
fi
|
|
1610
|
+
|
|
1492
1611
|
# Profile README — auto-create repo and seed README if not already set up.
|
|
1493
1612
|
# Requires gh CLI authenticated. Creates username/username repo, seeds README
|
|
1494
1613
|
# with stat markers, registers in repos.json with priority: "profile".
|
|
@@ -1544,17 +1663,14 @@ ST_PLIST
|
|
|
1544
1663
|
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
1545
1664
|
local pr_plist="$HOME/Library/LaunchAgents/${pr_label}.plist"
|
|
1546
1665
|
|
|
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
1666
|
# XML-escape paths for safe plist embedding
|
|
1553
1667
|
local _xml_pr_script _xml_pr_home
|
|
1554
1668
|
_xml_pr_script=$(_xml_escape "$pr_script")
|
|
1555
1669
|
_xml_pr_home=$(_xml_escape "$HOME")
|
|
1556
1670
|
|
|
1557
|
-
|
|
1671
|
+
local pr_plist_content
|
|
1672
|
+
pr_plist_content=$(
|
|
1673
|
+
cat <<PR_PLIST
|
|
1558
1674
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
1559
1675
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
1560
1676
|
<plist version="1.0">
|
|
@@ -1593,8 +1709,9 @@ ST_PLIST
|
|
|
1593
1709
|
</dict>
|
|
1594
1710
|
</plist>
|
|
1595
1711
|
PR_PLIST
|
|
1712
|
+
)
|
|
1596
1713
|
|
|
1597
|
-
if
|
|
1714
|
+
if _launchd_install_if_changed "$pr_label" "$pr_plist" "$pr_plist_content"; then
|
|
1598
1715
|
print_info "Profile README update enabled (launchd, hourly)"
|
|
1599
1716
|
else
|
|
1600
1717
|
print_warning "Failed to load profile README update LaunchAgent"
|