fix(install): устранены конфликты stow в WSL и opencode
- Зачем: - нужно было убрать падение install.sh на абсолютных WSL-симлинках и существующей runtime-директории opencode. - Что: - убран `--restow` из вызова stow, чтобы install не падал на ссылках `~/.aws` и `~/.azure`. - настройка `~/.config/opencode` переведена на ручную установку с backup существующего `opencode.json` и сохранением runtime-файлов. - в tests/test_install.sh добавлены сценарии для WSL-симлинков и существующей директории opencode. - Проверка: - bash -n install.sh - bash -n tests/test_install.sh - ./tests/test_install.sh
This commit is contained in:
1 parent
edeb8da3c2
commit
22d38f80e5
2 files changed
+111
-3
No files matched your search
@@ -162,6 +162,29 @@ test_preserves_nonempty_skills_directory() {
|
||||
[ -f "$home_dir/.claude/skills/local.txt" ] || fail "Expected local skill data to be preserved"
|
||||
}
|
||||
|
||||
test_opencode_runtime_dir_is_preserved_and_config_is_managed() {
|
||||
local fixture repo_root home_dir backup_path
|
||||
fixture="$(setup_fixture)"
|
||||
repo_root="$fixture/repo"
|
||||
home_dir="$fixture/home"
|
||||
mkdir -p "$home_dir/.config/opencode"
|
||||
echo runtime > "$home_dir/.config/opencode/package.json"
|
||||
cat > "$home_dir/.config/opencode/opencode.json" <<'EOF'
|
||||
{"source":"local"}
|
||||
EOF
|
||||
|
||||
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >/tmp/test-install.out
|
||||
|
||||
[ -f "$home_dir/.config/opencode/package.json" ] || fail "Expected opencode runtime files to be preserved"
|
||||
[ -L "$home_dir/.config/opencode/agents" ] || fail "Expected ~/.config/opencode/agents symlink"
|
||||
[ -L "$home_dir/.config/opencode/skills" ] || fail "Expected ~/.config/opencode/skills symlink"
|
||||
assert_file_contains "$home_dir/.config/opencode/opencode.json" '"$schema": "https://opencode.ai/config.json"'
|
||||
|
||||
backup_path="$(find "$home_dir/.config/opencode" -maxdepth 1 -name 'opencode.json.bak.*' -print -quit)"
|
||||
[ -n "$backup_path" ] || fail "Expected backup for existing opencode.json"
|
||||
assert_file_contains "$backup_path" '"source":"local"'
|
||||
}
|
||||
|
||||
test_broken_claude_symlink_does_not_fail() {
|
||||
local fixture repo_root home_dir
|
||||
fixture="$(setup_fixture)"
|
||||
@@ -176,6 +199,22 @@ test_broken_claude_symlink_does_not_fail() {
|
||||
[ ! -L "$home_dir/.claude" ] || fail "Expected ~/.claude to stop being a symlink"
|
||||
}
|
||||
|
||||
test_absolute_symlinks_in_home_do_not_break_install() {
|
||||
local fixture repo_root home_dir
|
||||
fixture="$(setup_fixture)"
|
||||
repo_root="$fixture/repo"
|
||||
home_dir="$fixture/home"
|
||||
mkdir -p "$home_dir" "$fixture/windows/.aws" "$fixture/windows/.azure"
|
||||
ln -s "$fixture/windows/.aws" "$home_dir/.aws"
|
||||
ln -s "$fixture/windows/.azure" "$home_dir/.azure"
|
||||
|
||||
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >/tmp/test-install.out
|
||||
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >/tmp/test-install.out
|
||||
|
||||
[ -L "$home_dir/.aws" ] || fail "Expected ~/.aws symlink to survive install"
|
||||
[ -L "$home_dir/.azure" ] || fail "Expected ~/.azure symlink to survive install"
|
||||
}
|
||||
|
||||
test_wsl_noninteractive_skips_file_changes() {
|
||||
local fixture repo_root home_dir wsl_conf output
|
||||
fixture="$(setup_fixture)"
|
||||
@@ -246,7 +285,9 @@ main() {
|
||||
test_rerun_does_not_duplicate_bashrc_line
|
||||
test_repairs_nested_skills_directory_bug
|
||||
test_preserves_nonempty_skills_directory
|
||||
test_opencode_runtime_dir_is_preserved_and_config_is_managed
|
||||
test_broken_claude_symlink_does_not_fail
|
||||
test_absolute_symlinks_in_home_do_not_break_install
|
||||
test_wsl_noninteractive_skips_file_changes
|
||||
test_wsl_interactive_adds_boot_command
|
||||
test_wsl_existing_boot_command_is_preserved
|
||||
|
||||
Reference in new issue
Block a user