Files
skillshare/scripts/git/preview-pull-conflicts.sh
T
Willie 73c4a8d27e feat(ui): resolve Git pull conflicts across computers
Guide diverged repositories through pull-and-merge or commit-and-pull before pushing. Compare conflicting file versions in the dashboard and require explicit choices tied to the reviewed revisions, while preserving both histories and automatic metadata merging.

Cover previews, modify/delete conflicts, stale and invalid choices, binary and large files, and dry-run behavior. Add an isolated preview fixture, verification runbook, translations, and documentation.

Validated with devcontainer make check, targeted Git API and UI tests, UI lint/build, website build, React Doctor, and a real isolated UI pull-resolution-push flow across all four themes.
2026-10-01 23:08:43 +08:00

46 lines
2.2 KiB
Bash

#!/usr/bin/env bash
# Run inside the devcontainer image. Uses temporary Git repos and isolated XDG paths.
set -euo pipefail
cd "$(dirname "$0")/../.."
task_root=$(mktemp -d "${TMPDIR:-/tmp}/skillshare-pull-ui.XXXXXX")
export XDG_CONFIG_HOME="$task_root/config"
export XDG_DATA_HOME="$task_root/data"
export XDG_STATE_HOME="$task_root/state"
export XDG_CACHE_HOME="$task_root/cache"
mkdir -p "$task_root/source/shared" "$XDG_CONFIG_HOME/skillshare" "$XDG_CACHE_HOME/skillshare/ui"
git init -q -b main "$task_root/source"
git -C "$task_root/source" config user.name 'UI Test'
git -C "$task_root/source" config user.email 'ui-test@example.invalid'
cat > "$task_root/source/shared/SKILL.md" <<'EOF'
---
name: shared
description: A skill edited on two computers
---
# Shared skill
Original instructions.
EOF
printf 'Original notes.\n' > "$task_root/source/shared/notes.md"
git -C "$task_root/source" add -A
git -C "$task_root/source" commit -qm 'Initial skills'
git init -q --bare -b main "$task_root/remote.git"
git -C "$task_root/source" remote add origin "$task_root/remote.git"
git -C "$task_root/source" push -qu origin main
git clone -q "$task_root/remote.git" "$task_root/other"
git -C "$task_root/other" config user.name 'Other Computer'
git -C "$task_root/other" config user.email 'other-test@example.invalid'
sed -i 's/Original instructions./Instructions updated on the other computer./' "$task_root/other/shared/SKILL.md"
printf 'Notes from the other computer.\n' > "$task_root/other/shared/notes.md"
git -C "$task_root/other" commit -qam 'Other computer updates'
git -C "$task_root/other" push -q
sed -i 's/Original instructions./Instructions updated on this computer./' "$task_root/source/shared/SKILL.md"
printf 'Notes from this computer.\n' > "$task_root/source/shared/notes.md"
git -C "$task_root/source" commit -qam 'Local updates'
printf 'source: %s/source\nmode: merge\ntargets: {}\n' "$task_root" > "$XDG_CONFIG_HOME/skillshare/config.yaml"
ln -s "$PWD/ui/dist" "$XDG_CACHE_HOME/skillshare/ui/dev"
go build -o "$task_root/skillshare" ./cmd/skillshare
printf 'Isolated fixture: %s\n' "$task_root"
exec "$task_root/skillshare" ui -g --host 0.0.0.0 --port "${SKILLSHARE_PREVIEW_PORT:-49421}" --no-open