feat(install): install semantic-search only with retrieval
Skip the semantic-search skill while semantic retrieval is disabled and remove a setup-owned copy when it is turned off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
14e6588d4e
commit
587c27c1cd
8 files changed
+31
-6
No files matched your search
@@ -41,7 +41,7 @@ $plugins = Select-ConfiguredPlugins -RepositoryRoot $root -HomePath $homePath -C
|
|||||||
|
|
||||||
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Shell $shell -Client $Client)) {
|
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Shell $shell -Client $Client)) {
|
||||||
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
||||||
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -PowerShellCommand $powerShellCommand -ClaudeConcurrency $claudeConcurrency -FlashbangEnabled $options.flashbang -StatusLineEnabled $options.statusline -DryRun:$DryRun -Summary:$Summary
|
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -PowerShellCommand $powerShellCommand -ClaudeConcurrency $claudeConcurrency -FlashbangEnabled $options.flashbang -StatusLineEnabled $options.statusline -SemanticRetrievalEnabled $options.semantic_retrieval -DryRun:$DryRun -Summary:$Summary
|
||||||
}
|
}
|
||||||
|
|
||||||
Sync-ConfiguredPlugins -RepositoryRoot $root -HomePath $homePath -Client $Client -DryRun:$DryRun -Summary:$Summary -Entries $plugins.Selected
|
Sync-ConfiguredPlugins -RepositoryRoot $root -HomePath $homePath -Client $Client -DryRun:$DryRun -Summary:$Summary -Entries $plugins.Selected
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ select_configured_plugins "$root" "$client" Install "$dry_run" selected_plugins
|
|||||||
while IFS='|' read -r source destination; do
|
while IFS='|' read -r source destination; do
|
||||||
ai_config_root=$destination
|
ai_config_root=$destination
|
||||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$powershell_command" "$dry_run" "$summary" "$flashbang" "$claude_concurrency" "$statusline"
|
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$powershell_command" "$dry_run" "$summary" "$flashbang" "$claude_concurrency" "$statusline" "$semantic_retrieval"
|
||||||
done < <(get_install_targets "$generated" "$home_path" "$shell" "$client")
|
done < <(get_install_targets "$generated" "$home_path" "$shell" "$client")
|
||||||
|
|
||||||
sync_configured_plugins "$root" "$client" "$home_path" "$dry_run" false selected_plugins "$summary"
|
sync_configured_plugins "$root" "$client" "$home_path" "$dry_run" false selected_plugins "$summary"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ $plugins = if ($Quick) {
|
|||||||
|
|
||||||
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Shell $shell -Client $Client)) {
|
foreach ($item in (Get-InstallTargets -Generated $generated -HomePath $homePath -Shell $shell -Client $Client)) {
|
||||||
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
Sync-ManagedDestination -Source $item.Source -Destination $item.Destination -Stamp $stamp `
|
||||||
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -PowerShellCommand $powerShellCommand -FlashbangEnabled $options.flashbang -StatusLineEnabled $options.statusline -DryRun:$DryRun -Summary:$Summary
|
-AiConfigRoot $item.Destination.Replace('\','/') -ShellCommand $shellCommand -PowerShellCommand $powerShellCommand -FlashbangEnabled $options.flashbang -StatusLineEnabled $options.statusline -SemanticRetrievalEnabled $options.semantic_retrieval -DryRun:$DryRun -Summary:$Summary
|
||||||
}
|
}
|
||||||
|
|
||||||
$previousPluginNonInteractive = $script:PluginNonInteractive
|
$previousPluginNonInteractive = $script:PluginNonInteractive
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ fi
|
|||||||
while IFS='|' read -r source destination; do
|
while IFS='|' read -r source destination; do
|
||||||
ai_config_root=$destination
|
ai_config_root=$destination
|
||||||
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
command -v cygpath >/dev/null && ai_config_root=$(cygpath -m "$destination")
|
||||||
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$powershell_command" "$dry_run" "$summary" "$flashbang" 5 "$statusline"
|
sync_managed_destination "$source" "$destination" "$stamp" "$ai_config_root" "$shell_command" "$powershell_command" "$dry_run" "$summary" "$flashbang" 5 "$statusline" "$semantic_retrieval"
|
||||||
done < <(get_install_targets "$generated" "$home_path" "$shell" "$client")
|
done < <(get_install_targets "$generated" "$home_path" "$shell" "$client")
|
||||||
|
|
||||||
if [ "$quick" = true ]; then
|
if [ "$quick" = true ]; then
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ function Sync-ManagedDestination {
|
|||||||
[string]$ClaudeConcurrency = '5',
|
[string]$ClaudeConcurrency = '5',
|
||||||
[bool]$FlashbangEnabled = $true,
|
[bool]$FlashbangEnabled = $true,
|
||||||
[bool]$StatusLineEnabled = $true,
|
[bool]$StatusLineEnabled = $true,
|
||||||
|
[bool]$SemanticRetrievalEnabled = $true,
|
||||||
[switch]$DryRun,
|
[switch]$DryRun,
|
||||||
[switch]$Summary
|
[switch]$Summary
|
||||||
)
|
)
|
||||||
@@ -169,6 +170,7 @@ function Invoke-ManagedSync {
|
|||||||
[string]$ClaudeConcurrency = '5',
|
[string]$ClaudeConcurrency = '5',
|
||||||
[bool]$FlashbangEnabled = $true,
|
[bool]$FlashbangEnabled = $true,
|
||||||
[bool]$StatusLineEnabled = $true,
|
[bool]$StatusLineEnabled = $true,
|
||||||
|
[bool]$SemanticRetrievalEnabled = $true,
|
||||||
[switch]$DryRun,
|
[switch]$DryRun,
|
||||||
[switch]$Summary
|
[switch]$Summary
|
||||||
)
|
)
|
||||||
@@ -193,6 +195,7 @@ function Invoke-ManagedSync {
|
|||||||
$relative = $_.FullName.Substring($Source.Length).TrimStart([char[]]@('\','/')).Replace('\','/')
|
$relative = $_.FullName.Substring($Source.Length).TrimStart([char[]]@('\','/')).Replace('\','/')
|
||||||
if ((Split-Path $Destination -Leaf) -eq '.codex' -and $relative.StartsWith('skills/')) { return }
|
if ((Split-Path $Destination -Leaf) -eq '.codex' -and $relative.StartsWith('skills/')) { return }
|
||||||
if ((Split-Path $Destination -Leaf) -eq '.claude' -and -not $StatusLineEnabled -and $relative.StartsWith('statusline/')) { return }
|
if ((Split-Path $Destination -Leaf) -eq '.claude' -and -not $StatusLineEnabled -and $relative.StartsWith('statusline/')) { return }
|
||||||
|
if (-not $SemanticRetrievalEnabled -and $relative -match '(^|/)semantic-search/') { return }
|
||||||
$target = Resolve-ManagedPath -Destination $Destination -Relative $relative
|
$target = Resolve-ManagedPath -Destination $Destination -Relative $relative
|
||||||
$rawContent = Get-Content -LiteralPath $_.FullName -Raw -Encoding UTF8
|
$rawContent = Get-Content -LiteralPath $_.FullName -Raw -Encoding UTF8
|
||||||
$filterOptions = ((-not $FlashbangEnabled) -or (-not $StatusLineEnabled)) -and $relative -in @('settings.json', 'config.toml')
|
$filterOptions = ((-not $FlashbangEnabled) -or (-not $StatusLineEnabled)) -and $relative -in @('settings.json', 'config.toml')
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ sync_managed_destination() {
|
|||||||
return "$status"
|
return "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
# run_managed_sync <source-dir> <destination-dir> <stamp> <ai-config-root> <shell-command> <powershell-command> <dry-run: true|false> [summary: true|false] [flashbang] [claude-concurrency] [statusline]
|
# run_managed_sync <source-dir> <destination-dir> <stamp> <ai-config-root> <shell-command> <powershell-command> <dry-run: true|false> [summary: true|false] [flashbang] [claude-concurrency] [statusline] [semantic-retrieval]
|
||||||
run_managed_sync() {
|
run_managed_sync() {
|
||||||
local source=$1 destination=$2 stamp=$3 ai_config_root=$4 shell_command=$5 powershell_command=$6 dry_run=$7 summary=${8:-false} flashbang_enabled=${9:-true} claude_concurrency=${10:-5} statusline_enabled=${11:-true}
|
local source=$1 destination=$2 stamp=$3 ai_config_root=$4 shell_command=$5 powershell_command=$6 dry_run=$7 summary=${8:-false} flashbang_enabled=${9:-true} claude_concurrency=${10:-5} statusline_enabled=${11:-true} semantic_retrieval_enabled=${12:-true}
|
||||||
[ "$summary" = true ] || printf 'SOURCE %s -> %s\n' "$source" "$destination"
|
[ "$summary" = true ] || printf 'SOURCE %s -> %s\n' "$source" "$destination"
|
||||||
local manifest
|
local manifest
|
||||||
manifest=$(manifest_path "$destination")
|
manifest=$(manifest_path "$destination")
|
||||||
@@ -151,6 +151,7 @@ run_managed_sync() {
|
|||||||
relative=${source_file#"$source/"}
|
relative=${source_file#"$source/"}
|
||||||
if [ "${destination##*/}" = .codex ] && [[ "$relative" = skills/* ]]; then continue; fi
|
if [ "${destination##*/}" = .codex ] && [[ "$relative" = skills/* ]]; then continue; fi
|
||||||
if [ "${destination##*/}" = .claude ] && [ "$statusline_enabled" = false ] && [[ "$relative" = statusline/* ]]; then continue; fi
|
if [ "${destination##*/}" = .claude ] && [ "$statusline_enabled" = false ] && [[ "$relative" = statusline/* ]]; then continue; fi
|
||||||
|
if [ "$semantic_retrieval_enabled" = false ] && [[ "$relative" =~ (^|/)semantic-search/ ]]; then continue; fi
|
||||||
target=$(managed_target "$destination" "$relative") || return 1
|
target=$(managed_target "$destination" "$relative") || return 1
|
||||||
content=$(cat -- "$source_file" && printf '\034') || return
|
content=$(cat -- "$source_file" && printf '\034') || return
|
||||||
content=${content%$'\034'}
|
content=${content%$'\034'}
|
||||||
|
|||||||
@@ -122,6 +122,18 @@ try {
|
|||||||
if (@(Get-ChildItem -LiteralPath $destination -Filter '.ai-config-write-*' -File -Recurse).Count) { throw 'Atomic writes left a temporary file.' }
|
if (@(Get-ChildItem -LiteralPath $destination -Filter '.ai-config-write-*' -File -Recurse).Count) { throw 'Atomic writes left a temporary file.' }
|
||||||
if (Test-Path -LiteralPath (Join-Path $destination '.ai-config.lock')) { throw 'Sync must release its destination lock.' }
|
if (Test-Path -LiteralPath (Join-Path $destination '.ai-config.lock')) { throw 'Sync must release its destination lock.' }
|
||||||
|
|
||||||
|
$searchSkill = Join-Path $source 'skills/semantic-search/SKILL.md'
|
||||||
|
New-Item (Split-Path $searchSkill -Parent) -ItemType Directory -Force | Out-Null
|
||||||
|
Set-Content $searchSkill 'search skill' -NoNewline
|
||||||
|
$installedSearchSkill = Join-Path $destination 'skills/semantic-search/SKILL.md'
|
||||||
|
$null = Sync-ManagedDestination -Source $source -Destination $destination -Stamp 'search-off' -SemanticRetrievalEnabled $false
|
||||||
|
if (Test-Path -LiteralPath $installedSearchSkill) { throw 'The semantic-search skill must not be installed while retrieval is disabled.' }
|
||||||
|
$null = Sync-ManagedDestination -Source $source -Destination $destination -Stamp 'search-on' -SemanticRetrievalEnabled $true
|
||||||
|
if (-not (Test-Path -LiteralPath $installedSearchSkill)) { throw 'The semantic-search skill must be installed while retrieval is enabled.' }
|
||||||
|
$null = Sync-ManagedDestination -Source $source -Destination $destination -Stamp 'search-off-again' -SemanticRetrievalEnabled $false
|
||||||
|
if (Test-Path -LiteralPath $installedSearchSkill) { throw 'Disabling retrieval must remove the setup-owned semantic-search skill.' }
|
||||||
|
Remove-Item -LiteralPath (Split-Path $searchSkill -Parent) -Recurse -Force
|
||||||
|
|
||||||
$lockPath = Join-Path $destination '.ai-config.lock'
|
$lockPath = Join-Path $destination '.ai-config.lock'
|
||||||
[System.IO.File]::WriteAllText($lockPath, "bash other-host 1`n")
|
[System.IO.File]::WriteAllText($lockPath, "bash other-host 1`n")
|
||||||
$manifestBefore = [System.IO.File]::ReadAllText((Get-ManagedManifestPath $destination))
|
$manifestBefore = [System.IO.File]::ReadAllText((Get-ManagedManifestPath $destination))
|
||||||
|
|||||||
@@ -137,6 +137,15 @@ sync_managed_destination "$source_dir" "$destination" concurrency "" "" "" false
|
|||||||
[ "$(cat "$destination/concurrency.txt")" = 7 ] || { printf 'Standalone concurrency placeholder must be resolved.\n' >&2; exit 1; }
|
[ "$(cat "$destination/concurrency.txt")" = 7 ] || { printf 'Standalone concurrency placeholder must be resolved.\n' >&2; exit 1; }
|
||||||
[ -z "$(find "$destination" -name '.ai-config-write.*' -print -quit)" ] || { printf 'Atomic writes left a temporary file.\n' >&2; exit 1; }
|
[ -z "$(find "$destination" -name '.ai-config-write.*' -print -quit)" ] || { printf 'Atomic writes left a temporary file.\n' >&2; exit 1; }
|
||||||
[ ! -e "$destination/.ai-config.lock" ] || { printf 'Sync must release its destination lock.\n' >&2; exit 1; }
|
[ ! -e "$destination/.ai-config.lock" ] || { printf 'Sync must release its destination lock.\n' >&2; exit 1; }
|
||||||
|
mkdir -p "$source_dir/skills/semantic-search"
|
||||||
|
printf 'search skill' > "$source_dir/skills/semantic-search/SKILL.md"
|
||||||
|
sync_managed_destination "$source_dir" "$destination" search-off "" "" "" false false true 5 true false > /dev/null
|
||||||
|
[ ! -e "$destination/skills/semantic-search/SKILL.md" ] || { printf 'The semantic-search skill must not be installed while retrieval is disabled.\n' >&2; exit 1; }
|
||||||
|
sync_managed_destination "$source_dir" "$destination" search-on "" "" "" false false true 5 true true > /dev/null
|
||||||
|
[ -f "$destination/skills/semantic-search/SKILL.md" ] || { printf 'The semantic-search skill must be installed while retrieval is enabled.\n' >&2; exit 1; }
|
||||||
|
sync_managed_destination "$source_dir" "$destination" search-off-again "" "" "" false false true 5 true false > /dev/null
|
||||||
|
[ ! -e "$destination/skills/semantic-search/SKILL.md" ] || { printf 'Disabling retrieval must remove the setup-owned semantic-search skill.\n' >&2; exit 1; }
|
||||||
|
rm -r -- "$source_dir/skills/semantic-search"
|
||||||
printf 'powershell other-host 1\n' > "$destination/.ai-config.lock"
|
printf 'powershell other-host 1\n' > "$destination/.ai-config.lock"
|
||||||
manifest_before=$(cat "$destination/.ai-config-manifest.tsv")
|
manifest_before=$(cat "$destination/.ai-config-manifest.tsv")
|
||||||
if sync_managed_destination "$source_dir" "$destination" locked "" "" "" false > /dev/null 2>&1; then printf 'A held destination lock must block a parallel sync.\n' >&2; exit 1; fi
|
if sync_managed_destination "$source_dir" "$destination" locked "" "" "" false > /dev/null 2>&1; then printf 'A held destination lock must block a parallel sync.\n' >&2; exit 1; fi
|
||||||
|
|||||||
Reference in new issue
Block a user