feat(install,update): thread --summary/-Summary through sync and plugin steps
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
77dab28c9a
commit
0a76bd5e54
4 files changed
+137
-73
No files matched your search
+16
-27
@@ -3,51 +3,40 @@ param(
|
||||
[switch]$DryRun,
|
||||
[ValidateSet('Codex','Claude','Both')][string]$Client,
|
||||
[ValidateSet('Windows','Linux')][string]$Platform,
|
||||
[switch]$UpdatePlugins
|
||||
[switch]$Summary
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
. (Join-Path $PSScriptRoot 'lib/plugins.ps1')
|
||||
. (Join-Path $PSScriptRoot 'lib/manifest.ps1')
|
||||
. (Join-Path $PSScriptRoot 'lib/install-targets.ps1')
|
||||
|
||||
$Platform = Read-InstallPlatform -Platform $Platform
|
||||
$platform = $Platform.ToLowerInvariant()
|
||||
$Client = Read-InstallClient -Client $Client
|
||||
|
||||
$homePath = [Environment]::GetFolderPath('UserProfile')
|
||||
if (-not $DryRun -and (Test-AnyManifestPresent (Get-InstallDestinations -HomePath $homePath -Client $Client))) {
|
||||
throw 'Already installed, use the update script.'
|
||||
}
|
||||
|
||||
$buildScript = Join-Path $PSScriptRoot 'build.ps1'
|
||||
& $buildScript
|
||||
if (-not $?) { throw 'Build failed. Installation was not started.' }
|
||||
$generated = Join-Path $root 'generated'
|
||||
if (-not (Test-Path $generated)) { throw 'Generated output is missing after a successful build.' }
|
||||
|
||||
if (-not $Platform) {
|
||||
Write-Output 'Select target platform:'
|
||||
Write-Output '1) Windows'
|
||||
Write-Output '2) Linux'
|
||||
do { $platformSelection = Read-Host 'Selection [1-2]' } while ($platformSelection -notin @('1','2'))
|
||||
$Platform = @{'1'='Windows'; '2'='Linux'}[$platformSelection]
|
||||
}
|
||||
$platform = $Platform.ToLowerInvariant()
|
||||
|
||||
if (-not $Client) {
|
||||
Write-Output 'Select installation target:'
|
||||
Write-Output '1) Codex'
|
||||
Write-Output '2) Claude'
|
||||
Write-Output '3) Both'
|
||||
do { $selection = Read-Host 'Selection [1-3]' } while ($selection -notin @('1','2','3'))
|
||||
$Client = @{'1'='Codex'; '2'='Claude'; '3'='Both'}[$selection]
|
||||
}
|
||||
|
||||
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
||||
$homePath = [Environment]::GetFolderPath('UserProfile')
|
||||
$shellCommand = 'pwsh -NoProfile -ExecutionPolicy Bypass -File'
|
||||
$windowsShellCommand = 'powershell -NoProfile -ExecutionPolicy Bypass -File'
|
||||
if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $shellCommand = $windowsShellCommand }
|
||||
$targets = @()
|
||||
if ($Client -in @('Codex','Both')) { $targets += @{ Source=(Join-Path $generated "codex-$platform"); Destination=(Join-Path $homePath '.codex') } }
|
||||
if ($Client -in @('Codex','Both')) { $targets += @{ Source=(Join-Path $generated "codex-$platform/skills"); Destination=(Join-Path $homePath '.agents/skills') } }
|
||||
if ($Client -in @('Claude','Both')) { $targets += @{ Source=(Join-Path $generated "claude-$platform"); Destination=(Join-Path $homePath '.claude') } }
|
||||
|
||||
foreach ($item in $targets) {
|
||||
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Platform $platform -Client $Client)) {
|
||||
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
||||
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -WindowsShellCommand $windowsShellCommand -DryRun:$DryRun
|
||||
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -WindowsShellCommand $windowsShellCommand -DryRun:$DryRun -Summary:$Summary
|
||||
}
|
||||
|
||||
Install-ConfiguredPlugins -RepositoryRoot $root -Client $Client -DryRun:$DryRun -Update:$UpdatePlugins
|
||||
$plugins = Select-ConfiguredPlugins -RepositoryRoot $root -Client $Client -Mode 'Install' -DryRun:$DryRun
|
||||
Install-ConfiguredPlugins -RepositoryRoot $root -Client $Client -DryRun:$DryRun -Summary:$Summary -Entries $plugins.Selected
|
||||
Write-Output ($(if ($DryRun) { 'PASS install dry-run' } else { 'PASS install' }))
|
||||
exit 0
|
||||
+23
-46
@@ -4,11 +4,11 @@ set -euo pipefail
|
||||
dry_run=false
|
||||
client=""
|
||||
platform=""
|
||||
update_plugins=false
|
||||
summary=false
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dry-run) dry_run=true; shift ;;
|
||||
--update-plugins) update_plugins=true; shift ;;
|
||||
--summary) summary=true; shift ;;
|
||||
--client) client=${2:?--client requires a value}; shift 2 ;;
|
||||
--platform) platform=${2:?--platform requires a value}; shift 2 ;;
|
||||
*) printf 'Unknown argument: %s\n' "$1" >&2; exit 1 ;;
|
||||
@@ -18,60 +18,37 @@ done
|
||||
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
. "$root/scripts/lib/plugins.sh"
|
||||
. "$root/scripts/lib/manifest.sh"
|
||||
. "$root/scripts/lib/install-targets.sh"
|
||||
|
||||
platform=$(read_install_platform "$platform")
|
||||
client=$(read_install_client "$client")
|
||||
|
||||
home_path=${HOME:?HOME is required}
|
||||
if [ "$dry_run" = false ]; then
|
||||
mapfile -t destinations < <(get_install_destinations "$home_path" "$client")
|
||||
if any_manifest_present "${destinations[@]}"; then
|
||||
printf 'Already installed, use the update script.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
bash "$root/scripts/build.sh"
|
||||
generated="$root/generated"
|
||||
[ -d "$generated" ] || { printf 'Generated output is missing after a successful build.\n' >&2; exit 1; }
|
||||
|
||||
if [ -z "$platform" ]; then
|
||||
printf 'Select target platform:\n1) Windows\n2) Linux\n'
|
||||
while :; do
|
||||
read -r -p 'Selection [1-2] ' platform_selection
|
||||
case "$platform_selection" in 1) platform=windows; break;; 2) platform=linux; break;; esac
|
||||
done
|
||||
else
|
||||
case "$platform" in
|
||||
windows|Windows) platform=windows ;;
|
||||
linux|Linux) platform=linux ;;
|
||||
*) printf 'Unknown --platform value: %s (expected windows or linux)\n' "$platform" >&2; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z "$client" ]; then
|
||||
printf 'Select installation target:\n1) Codex\n2) Claude\n3) Both\n'
|
||||
while :; do
|
||||
read -r -p 'Selection [1-3] ' selection
|
||||
case "$selection" in 1) client=codex; break;; 2) client=claude; break;; 3) client=both; break;; esac
|
||||
done
|
||||
else
|
||||
case "$client" in
|
||||
codex|Codex) client=codex ;;
|
||||
claude|Claude) client=claude ;;
|
||||
both|Both) client=both ;;
|
||||
*) printf 'Unknown --client value: %s (expected codex, claude, or both)\n' "$client" >&2; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
stamp=$(date +%Y%m%d-%H%M%S)
|
||||
home_path=${HOME:?HOME is required}
|
||||
shell_command=bash
|
||||
windows_shell_command='powershell -NoProfile -ExecutionPolicy Bypass -File'
|
||||
|
||||
targets=()
|
||||
case "$client" in
|
||||
codex|both) targets+=("$generated/codex-$platform|$home_path/.codex" "$generated/codex-$platform/skills|$home_path/.agents/skills");;
|
||||
esac
|
||||
case "$client" in
|
||||
claude|both) targets+=("$generated/claude-$platform|$home_path/.claude");;
|
||||
esac
|
||||
|
||||
for target_pair in "${targets[@]}"; do
|
||||
source=${target_pair%%|*}
|
||||
destination=${target_pair#*|}
|
||||
while IFS='|' read -r source destination; do
|
||||
ai_config_root=$destination
|
||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$windows_shell_command" "$dry_run"
|
||||
done
|
||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$windows_shell_command" "$dry_run" "$summary"
|
||||
done < <(get_install_targets "$generated" "$home_path" "$platform" "$client")
|
||||
|
||||
install_configured_plugins "$root" "$client" "$dry_run" "$update_plugins"
|
||||
selected_plugins=()
|
||||
deselected_plugins=()
|
||||
select_configured_plugins "$root" "$client" Install "$dry_run" selected_plugins deselected_plugins
|
||||
install_configured_plugins "$root" "$client" "$dry_run" false selected_plugins "$summary"
|
||||
|
||||
if "$dry_run"; then printf 'PASS install dry-run\n'; else printf 'PASS install\n'; fi
|
||||
@@ -0,0 +1,43 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$DryRun,
|
||||
[ValidateSet('Codex','Claude','Both')][string]$Client,
|
||||
[ValidateSet('Windows','Linux')][string]$Platform,
|
||||
[switch]$Summary
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
. (Join-Path $PSScriptRoot 'lib/plugins.ps1')
|
||||
. (Join-Path $PSScriptRoot 'lib/manifest.ps1')
|
||||
. (Join-Path $PSScriptRoot 'lib/install-targets.ps1')
|
||||
|
||||
$Platform = Read-InstallPlatform -Platform $Platform
|
||||
$platform = $Platform.ToLowerInvariant()
|
||||
$Client = Read-InstallClient -Client $Client
|
||||
|
||||
$homePath = [Environment]::GetFolderPath('UserProfile')
|
||||
if (-not $DryRun -and -not (Test-AllManifestsPresent (Get-InstallDestinations -HomePath $homePath -Client $Client))) {
|
||||
throw 'Not installed, use the install script.'
|
||||
}
|
||||
|
||||
$buildScript = Join-Path $PSScriptRoot 'build.ps1'
|
||||
& $buildScript
|
||||
if (-not $?) { throw 'Build failed. Update was not started.' }
|
||||
$generated = Join-Path $root 'generated'
|
||||
if (-not (Test-Path $generated)) { throw 'Generated output is missing after a successful build.' }
|
||||
|
||||
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
||||
$shellCommand = 'pwsh -NoProfile -ExecutionPolicy Bypass -File'
|
||||
$windowsShellCommand = 'powershell -NoProfile -ExecutionPolicy Bypass -File'
|
||||
if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $shellCommand = $windowsShellCommand }
|
||||
|
||||
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Platform $platform -Client $Client)) {
|
||||
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
||||
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -WindowsShellCommand $windowsShellCommand -DryRun:$DryRun -Summary:$Summary
|
||||
}
|
||||
|
||||
$plugins = Select-ConfiguredPlugins -RepositoryRoot $root -Client $Client -Mode 'Update' -DryRun:$DryRun
|
||||
Install-ConfiguredPlugins -RepositoryRoot $root -Client $Client -DryRun:$DryRun -Update -Summary:$Summary -Entries $plugins.Selected
|
||||
Uninstall-DeselectedPlugins -Entries $plugins.Deselected -Client $Client -DryRun:$DryRun -Summary:$Summary
|
||||
Write-Output ($(if ($DryRun) { 'PASS update dry-run' } else { 'PASS update' }))
|
||||
exit 0
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
dry_run=false
|
||||
client=""
|
||||
platform=""
|
||||
summary=false
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dry-run) dry_run=true; shift ;;
|
||||
--summary) summary=true; shift ;;
|
||||
--client) client=${2:?--client requires a value}; shift 2 ;;
|
||||
--platform) platform=${2:?--platform requires a value}; shift 2 ;;
|
||||
*) printf 'Unknown argument: %s\n' "$1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
. "$root/scripts/lib/plugins.sh"
|
||||
. "$root/scripts/lib/manifest.sh"
|
||||
. "$root/scripts/lib/install-targets.sh"
|
||||
|
||||
platform=$(read_install_platform "$platform")
|
||||
client=$(read_install_client "$client")
|
||||
|
||||
home_path=${HOME:?HOME is required}
|
||||
if [ "$dry_run" = false ]; then
|
||||
mapfile -t destinations < <(get_install_destinations "$home_path" "$client")
|
||||
if ! all_manifests_present "${destinations[@]}"; then
|
||||
printf 'Not installed, use the install script.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
bash "$root/scripts/build.sh"
|
||||
generated="$root/generated"
|
||||
[ -d "$generated" ] || { printf 'Generated output is missing after a successful build.\n' >&2; exit 1; }
|
||||
|
||||
stamp=$(date +%Y%m%d-%H%M%S)
|
||||
shell_command=bash
|
||||
windows_shell_command='powershell -NoProfile -ExecutionPolicy Bypass -File'
|
||||
|
||||
while IFS='|' read -r source destination; do
|
||||
ai_config_root=$destination
|
||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$windows_shell_command" "$dry_run" "$summary"
|
||||
done < <(get_install_targets "$generated" "$home_path" "$platform" "$client")
|
||||
|
||||
selected_plugins=()
|
||||
deselected_plugins=()
|
||||
select_configured_plugins "$root" "$client" Update "$dry_run" selected_plugins deselected_plugins
|
||||
install_configured_plugins "$root" "$client" "$dry_run" true selected_plugins "$summary"
|
||||
uninstall_deselected_plugins "$root" "$client" "$dry_run" deselected_plugins "$summary"
|
||||
|
||||
if "$dry_run"; then printf 'PASS update dry-run\n'; else printf 'PASS update\n'; fi
|
||||
Reference in new issue
Block a user