aidevops 3.8.45 → 3.8.47
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-modules/agent-deploy.sh +64 -45
- package/setup.sh +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.8.
|
|
1
|
+
3.8.47
|
package/aidevops.sh
CHANGED
package/package.json
CHANGED
|
@@ -334,6 +334,67 @@ _install_opencode_plugin_deps() {
|
|
|
334
334
|
return 0
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
# _atomic_stage_and_deploy_agents source_dir target_dir [plugin_namespaces...]
|
|
338
|
+
# Stages a copy in target_dir.staging, carries over preserved dirs (custom/,
|
|
339
|
+
# draft/, and any plugin namespaces), then atomically swaps staging into place.
|
|
340
|
+
# Returns 0 on success, 1 on failure.
|
|
341
|
+
_atomic_stage_and_deploy_agents() {
|
|
342
|
+
local source_dir="$1"
|
|
343
|
+
local target_dir="$2"
|
|
344
|
+
shift 2
|
|
345
|
+
local -a plugin_namespaces=("$@")
|
|
346
|
+
|
|
347
|
+
# Atomic deploy: build a staging directory, then swap it into place.
|
|
348
|
+
# Previously, clean + copy happened in-place, creating a window where
|
|
349
|
+
# scripts were missing. The pulse could dispatch workers mid-deploy,
|
|
350
|
+
# hitting "No such file or directory" errors. Now we:
|
|
351
|
+
# 1. rsync into a staging dir (target_dir.staging)
|
|
352
|
+
# 2. Move preserved dirs (custom/, draft/, plugins) from live to staging
|
|
353
|
+
# 3. mv live → .old, mv staging → live (atomic on same filesystem)
|
|
354
|
+
# 4. rm .old
|
|
355
|
+
local staging_dir="${target_dir}.staging"
|
|
356
|
+
local old_dir="${target_dir}.old"
|
|
357
|
+
rm -rf "$staging_dir" "$old_dir"
|
|
358
|
+
mkdir -p "$staging_dir"
|
|
359
|
+
|
|
360
|
+
# Copy source into staging
|
|
361
|
+
local copy_rc
|
|
362
|
+
if [[ ${#plugin_namespaces[@]} -gt 0 ]]; then
|
|
363
|
+
_deploy_agents_copy "$source_dir" "$staging_dir" "${plugin_namespaces[@]}"
|
|
364
|
+
copy_rc=$?
|
|
365
|
+
else
|
|
366
|
+
_deploy_agents_copy "$source_dir" "$staging_dir"
|
|
367
|
+
copy_rc=$?
|
|
368
|
+
fi
|
|
369
|
+
if [[ "$copy_rc" -ne 0 ]]; then
|
|
370
|
+
print_error "Failed to deploy agents to staging directory"
|
|
371
|
+
rm -rf "$staging_dir"
|
|
372
|
+
return 1
|
|
373
|
+
fi
|
|
374
|
+
|
|
375
|
+
# Carry over preserved directories from live target to staging
|
|
376
|
+
local -a preserved_dirs=("custom" "draft")
|
|
377
|
+
if [[ ${#plugin_namespaces[@]} -gt 0 ]]; then
|
|
378
|
+
for pns in "${plugin_namespaces[@]}"; do
|
|
379
|
+
preserved_dirs+=("$pns")
|
|
380
|
+
done
|
|
381
|
+
fi
|
|
382
|
+
for pdir in "${preserved_dirs[@]}"; do
|
|
383
|
+
if [[ -d "$target_dir/$pdir" ]]; then
|
|
384
|
+
# Copy user dirs into staging so they survive the swap
|
|
385
|
+
cp -a "$target_dir/$pdir" "$staging_dir/$pdir" 2>/dev/null || true
|
|
386
|
+
fi
|
|
387
|
+
done
|
|
388
|
+
|
|
389
|
+
# Atomic swap: mv is atomic on the same filesystem (POSIX rename())
|
|
390
|
+
if [[ -d "$target_dir" ]]; then
|
|
391
|
+
mv "$target_dir" "$old_dir"
|
|
392
|
+
fi
|
|
393
|
+
mv "$staging_dir" "$target_dir"
|
|
394
|
+
rm -rf "$old_dir"
|
|
395
|
+
return 0
|
|
396
|
+
}
|
|
397
|
+
|
|
337
398
|
# _deploy_version_file target_dir repo_dir
|
|
338
399
|
# Copies VERSION file from repo root to the deployed agents directory.
|
|
339
400
|
_deploy_version_file() {
|
|
@@ -518,54 +579,12 @@ deploy_aidevops_agents() {
|
|
|
518
579
|
|
|
519
580
|
mkdir -p "$target_dir"
|
|
520
581
|
|
|
521
|
-
#
|
|
522
|
-
# Previously, clean + copy happened in-place, creating a window where
|
|
523
|
-
# scripts were missing. The pulse could dispatch workers mid-deploy,
|
|
524
|
-
# hitting "No such file or directory" errors. Now we:
|
|
525
|
-
# 1. rsync into a staging dir (target_dir.staging)
|
|
526
|
-
# 2. Move preserved dirs (custom/, draft/, plugins) from live to staging
|
|
527
|
-
# 3. mv live → .old, mv staging → live (atomic on same filesystem)
|
|
528
|
-
# 4. rm .old
|
|
529
|
-
local staging_dir="${target_dir}.staging"
|
|
530
|
-
local old_dir="${target_dir}.old"
|
|
531
|
-
rm -rf "$staging_dir" "$old_dir"
|
|
532
|
-
mkdir -p "$staging_dir"
|
|
533
|
-
|
|
534
|
-
# Copy source into staging
|
|
535
|
-
local copy_rc
|
|
582
|
+
# Atomically copy source to staging, carry over user dirs, then swap.
|
|
536
583
|
if [[ ${#plugin_namespaces[@]} -gt 0 ]]; then
|
|
537
|
-
|
|
538
|
-
copy_rc=$?
|
|
584
|
+
_atomic_stage_and_deploy_agents "$source_dir" "$target_dir" "${plugin_namespaces[@]}" || return 1
|
|
539
585
|
else
|
|
540
|
-
|
|
541
|
-
copy_rc=$?
|
|
586
|
+
_atomic_stage_and_deploy_agents "$source_dir" "$target_dir" || return 1
|
|
542
587
|
fi
|
|
543
|
-
if [[ "$copy_rc" -ne 0 ]]; then
|
|
544
|
-
print_error "Failed to deploy agents to staging directory"
|
|
545
|
-
rm -rf "$staging_dir"
|
|
546
|
-
return 1
|
|
547
|
-
fi
|
|
548
|
-
|
|
549
|
-
# Carry over preserved directories from live target to staging
|
|
550
|
-
local -a preserved_dirs=("custom" "draft")
|
|
551
|
-
if [[ ${#plugin_namespaces[@]} -gt 0 ]]; then
|
|
552
|
-
for pns in "${plugin_namespaces[@]}"; do
|
|
553
|
-
preserved_dirs+=("$pns")
|
|
554
|
-
done
|
|
555
|
-
fi
|
|
556
|
-
for pdir in "${preserved_dirs[@]}"; do
|
|
557
|
-
if [[ -d "$target_dir/$pdir" ]]; then
|
|
558
|
-
# Move user dirs into staging so they survive the swap
|
|
559
|
-
cp -a "$target_dir/$pdir" "$staging_dir/$pdir" 2>/dev/null || true
|
|
560
|
-
fi
|
|
561
|
-
done
|
|
562
|
-
|
|
563
|
-
# Atomic swap: mv is atomic on the same filesystem (POSIX rename())
|
|
564
|
-
if [[ -d "$target_dir" ]]; then
|
|
565
|
-
mv "$target_dir" "$old_dir"
|
|
566
|
-
fi
|
|
567
|
-
mv "$staging_dir" "$target_dir"
|
|
568
|
-
rm -rf "$old_dir"
|
|
569
588
|
|
|
570
589
|
print_success "Deployed agents to $target_dir"
|
|
571
590
|
_deploy_agents_post_copy "$target_dir" "$repo_dir" "$source_dir" "$plugins_file"
|
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.
|
|
15
|
+
# Version: 3.8.47
|
|
16
16
|
#
|
|
17
17
|
# Quick Install:
|
|
18
18
|
# npm install -g aidevops && aidevops update (recommended)
|