Skip to content

Commit f6d1477

Browse files
authored
Merge pull request #215 from buildermethods/base-update-improvement
improved base update process
2 parents 31440e0 + 298e172 commit f6d1477

File tree

3 files changed

+149
-22
lines changed

3 files changed

+149
-22
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to Agent OS will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.5] - 2025-10-16
9+
10+
- Updated base installation update options to include a "Full update" option, which is the easiest way to pull and update the latest Agent OS stuff (default profile, scripts) without losing your base installation's custom profiles.
11+
- The "Full update" option also dynamically updates your base install config.yml version number without changing your configurations.
12+
813
## [2.0.4] - 2025-10-14
914

1015
- Fixed multi-agent-mode not installing the roles/ files in the project agent-os folder.

config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 2.0.4
1+
version: 2.0.5
22
base_install: true
33

44
# ================================================

scripts/base-install.sh

Lines changed: 143 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -328,39 +328,85 @@ prompt_overwrite_choice() {
328328
echo ""
329329
print_status "What would you like to do?"
330330
echo ""
331-
echo "1) Overwrite everything"
332-
echo "2) Overwrite only the default profile, including this profile's standards"
333-
echo "3) Overwrite only the scripts"
334-
echo "4) Overwrite only the base config.yml"
335-
echo "5) Cancel installation"
331+
332+
echo -e "${YELLOW}1) Full update${NC}"
333+
echo ""
334+
echo " Updates & overwrites:"
335+
echo " - ~/agent-os/profiles/default/*"
336+
echo " - ~/agent-os/scripts/*"
337+
echo " - ~/agent-os/CHANGELOG.md"
338+
echo ""
339+
echo " Updates your version number in ~/agent-os/config.yml but doesn't change anything else in this file."
336340
echo ""
337-
echo "If you choose to update and overwrite, your previous base installation will be saved in ~/agent-os.backup."
341+
echo " Everything else in your ~/agent-os folder will remain intact."
338342
echo ""
339343

340-
read -p "Enter your choice (1-5): " choice < /dev/tty
344+
echo -e "${YELLOW}2) Update default profile only${NC}"
345+
echo ""
346+
echo " Updates & overwrites:"
347+
echo " - ~/agent-os/profiles/default/*"
348+
echo ""
349+
echo " Everything else in your ~/agent-os folder will remain intact."
350+
echo ""
351+
352+
echo -e "${YELLOW}3) Update scripts only${NC}"
353+
echo ""
354+
echo " Updates & overwrites:"
355+
echo " - ~/agent-os/scripts/*"
356+
echo ""
357+
echo " Everything else in your ~/agent-os folder will remain intact."
358+
echo ""
359+
360+
echo -e "${YELLOW}4) Update config.yml only${NC}"
361+
echo ""
362+
echo " Updates & overwrites:"
363+
echo " - ~/agent-os/config.yml"
364+
echo ""
365+
echo " Everything else in your ~/agent-os folder will remain intact."
366+
echo ""
367+
368+
echo -e "${YELLOW}5) Delete & reinstall fresh${NC}"
369+
echo ""
370+
echo " - Makes a backup of your current ~/agent-os folder at ~/agent-os.backup"
371+
echo " - Deletes your current ~/agent-os folder and all of its contents."
372+
echo " - Installs a fresh ~/agent-os base installation"
373+
echo ""
374+
375+
echo -e "${YELLOW}6) Cancel and abort${NC}"
376+
echo ""
377+
378+
read -p "Enter your choice (1-6): " choice < /dev/tty
341379

342380
case $choice in
343381
1)
344382
echo ""
345-
print_status "Overwriting entire installation..."
346-
overwrite_all
383+
print_status "Performing full update..."
384+
full_update "$latest_version"
347385
;;
348386
2)
349387
echo ""
350-
print_status "Overwriting default profile..."
388+
print_status "Updating default profile..."
389+
create_backup
351390
overwrite_profile
352391
;;
353392
3)
354393
echo ""
355-
print_status "Overwriting scripts..."
394+
print_status "Updating scripts..."
395+
create_backup
356396
overwrite_scripts
357397
;;
358398
4)
359399
echo ""
360-
print_status "Overwriting config.yml..."
400+
print_status "Updating config.yml..."
401+
create_backup
361402
overwrite_config
362403
;;
363404
5)
405+
echo ""
406+
print_status "Deleting & reinstalling fresh..."
407+
overwrite_all
408+
;;
409+
6)
364410
echo ""
365411
print_warning "Installation cancelled"
366412
exit 0
@@ -372,6 +418,87 @@ prompt_overwrite_choice() {
372418
esac
373419
}
374420

421+
# Create backup of existing installation
422+
create_backup() {
423+
# Backup existing installation
424+
if [[ -d "$BASE_DIR.backup" ]]; then
425+
rm -rf "$BASE_DIR.backup"
426+
fi
427+
cp -R "$BASE_DIR" "$BASE_DIR.backup"
428+
echo "✓ Backed up existing installation to ~/agent-os.backup"
429+
echo ""
430+
}
431+
432+
# Full update - updates profile, scripts, CHANGELOG.md, and version number in config.yml
433+
full_update() {
434+
local latest_version=$1
435+
436+
# Create backup first
437+
create_backup
438+
439+
# Update default profile
440+
print_status "Updating default profile..."
441+
rm -rf "$BASE_DIR/profiles/default"
442+
local file_count=0
443+
local all_files=$(get_all_repo_files | grep "^profiles/default/")
444+
if [[ -n "$all_files" ]]; then
445+
while IFS= read -r file_path; do
446+
if [[ -n "$file_path" ]]; then
447+
local dest_file="${BASE_DIR}/${file_path}"
448+
local dir_path=$(dirname "$dest_file")
449+
[[ -d "$dir_path" ]] || mkdir -p "$dir_path"
450+
if download_file "$file_path" "$dest_file"; then
451+
((file_count++))
452+
print_verbose " Downloaded: ${file_path}"
453+
fi
454+
fi
455+
done <<< "$all_files"
456+
fi
457+
echo "✓ Updated default profile ($file_count files)"
458+
echo ""
459+
460+
# Update scripts
461+
print_status "Updating scripts..."
462+
rm -rf "$BASE_DIR/scripts"
463+
file_count=0
464+
all_files=$(get_all_repo_files | grep "^scripts/")
465+
if [[ -n "$all_files" ]]; then
466+
while IFS= read -r file_path; do
467+
if [[ -n "$file_path" ]]; then
468+
local dest_file="${BASE_DIR}/${file_path}"
469+
local dir_path=$(dirname "$dest_file")
470+
[[ -d "$dir_path" ]] || mkdir -p "$dir_path"
471+
if download_file "$file_path" "$dest_file"; then
472+
((file_count++))
473+
print_verbose " Downloaded: ${file_path}"
474+
fi
475+
fi
476+
done <<< "$all_files"
477+
chmod +x "$BASE_DIR/scripts/"*.sh 2>/dev/null || true
478+
fi
479+
echo "✓ Updated scripts ($file_count files)"
480+
echo ""
481+
482+
# Update CHANGELOG.md
483+
print_status "Updating CHANGELOG.md..."
484+
if download_file "CHANGELOG.md" "$BASE_DIR/CHANGELOG.md"; then
485+
echo "✓ Updated CHANGELOG.md"
486+
fi
487+
echo ""
488+
489+
# Update version number in config.yml (without overwriting the entire file)
490+
print_status "Updating version number in config.yml..."
491+
if [[ -f "$BASE_DIR/config.yml" ]] && [[ -n "$latest_version" ]]; then
492+
# Use sed to update only the version line
493+
sed -i.bak "s/^version:.*/version: $latest_version/" "$BASE_DIR/config.yml"
494+
rm -f "$BASE_DIR/config.yml.bak"
495+
echo "✓ Updated version to $latest_version in config.yml"
496+
fi
497+
echo ""
498+
499+
print_success "Full update completed!"
500+
}
501+
375502
# Overwrite everything
376503
overwrite_all() {
377504
# Backup existing installation
@@ -380,6 +507,7 @@ overwrite_all() {
380507
fi
381508
mv "$BASE_DIR" "$BASE_DIR.backup"
382509
echo "✓ Backed up existing installation to ~/agent-os.backup"
510+
echo ""
383511

384512
# Perform fresh installation
385513
perform_fresh_installation
@@ -392,7 +520,6 @@ overwrite_profile() {
392520

393521
# Download only profile files
394522
local file_count=0
395-
print_status "Updating default profile..."
396523

397524
# Get all files and filter for profiles/default
398525
local all_files=$(get_all_repo_files | grep "^profiles/default/")
@@ -412,6 +539,7 @@ overwrite_profile() {
412539
done <<< "$all_files"
413540
fi
414541

542+
echo "✓ Updated default profile ($file_count files)"
415543
echo ""
416544
print_success "Default profile has been updated!"
417545
}
@@ -423,7 +551,6 @@ overwrite_scripts() {
423551

424552
# Download only script files
425553
local file_count=0
426-
print_status "Updating scripts..."
427554

428555
# Get all files and filter for scripts/
429556
local all_files=$(get_all_repo_files | grep "^scripts/")
@@ -446,24 +573,19 @@ overwrite_scripts() {
446573
chmod +x "$BASE_DIR/scripts/"*.sh 2>/dev/null || true
447574
fi
448575

576+
echo "✓ Updated scripts ($file_count files)"
449577
echo ""
450578
print_success "Scripts have been updated!"
451579
}
452580

453581
# Overwrite only config
454582
overwrite_config() {
455-
# Backup existing config
456-
if [[ -f "$BASE_DIR/config.yml" ]]; then
457-
cp "$BASE_DIR/config.yml" "$BASE_DIR/config.yml.backup"
458-
echo "✓ Backed up existing config to config.yml.backup"
459-
fi
460-
461583
# Download new config.yml
462-
print_status "Updating config.yml..."
463584
if download_file "config.yml" "$BASE_DIR/config.yml"; then
464585
print_verbose " Downloaded: config.yml"
465586
fi
466587

588+
echo "✓ Updated config.yml"
467589
echo ""
468590
print_success "Config has been updated!"
469591
}

0 commit comments

Comments
 (0)