diff options
| -rwxr-xr-x | skills/subagent-driven-development/scripts/sdd-workspace | 9 | ||||
| -rwxr-xr-x | tests/claude-code/test-executing-plans-scripts.sh | 5 | ||||
| -rwxr-xr-x | tests/claude-code/test-sdd-workspace.sh | 40 |
3 files changed, 42 insertions, 12 deletions
diff --git a/skills/subagent-driven-development/scripts/sdd-workspace b/skills/subagent-driven-development/scripts/sdd-workspace index b4661eb..77ef8a2 100755 --- a/skills/subagent-driven-development/scripts/sdd-workspace +++ b/skills/subagent-driven-development/scripts/sdd-workspace @@ -84,4 +84,11 @@ fi # Create-only: a repo may commit its own .gitignore here (e.g. to version # progress.md ledgers); overwriting it would revert that on every run. [ -e "$base/.gitignore" ] || printf '*\n' > "$base/.gitignore" -CDPATH='' cd -- "$dir" && pwd + +# On Windows (Git Bash, MSYS2, Cygwin) print C:/Users/... rather than +# /c/Users/... or /tmp/...: the caller may be PowerShell or another native +# tool, which can't resolve MSYS paths, and bash accepts this form too. +# Only the printed path changes; the plan-path markers above keep pwd -P's +# spelling, so existing workspaces still match their plans. +CDPATH='' cd -- "$dir" +if command -v cygpath >/dev/null 2>&1; then cygpath -m "$PWD"; else pwd; fi diff --git a/tests/claude-code/test-executing-plans-scripts.sh b/tests/claude-code/test-executing-plans-scripts.sh index e4e3904..277c947 100755 --- a/tests/claude-code/test-executing-plans-scripts.sh +++ b/tests/claude-code/test-executing-plans-scripts.sh @@ -33,8 +33,9 @@ main() { git init -q -b main "$TEST_ROOT/repo" local repo repo="$(cd "$TEST_ROOT/repo" && git rev-parse --show-toplevel)" - # Same spelling as the scripts print (pwd), not rev-parse's C:/... on Git Bash. - repo="$(cd "$repo" && pwd)" + # Same spelling as the scripts print: C:/... from cygpath -m on Windows, + # plain pwd elsewhere. + repo="$(cd "$repo" && if command -v cygpath >/dev/null 2>&1; then cygpath -m "$PWD"; else pwd; fi)" local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false) cat > "$repo/plan.md" <<'PLAN' diff --git a/tests/claude-code/test-sdd-workspace.sh b/tests/claude-code/test-sdd-workspace.sh index 16cf50d..369cac2 100755 --- a/tests/claude-code/test-sdd-workspace.sh +++ b/tests/claude-code/test-sdd-workspace.sh @@ -17,15 +17,24 @@ fail() { FAILURES=$((FAILURES + 1)) } -# Push a path through the same `cd ... && pwd` normalization that -# sdd-workspace's own printed output goes through, so both sides of a -# string comparison are guaranteed to be spelled identically. On Windows -# Git Bash/MSYS, `git rev-parse --show-toplevel` (Windows-style, -# C:/Users/...) and `cd ... && pwd` (MSYS-style, /c/Users/...) can print -# different spellings of the identical physical directory; on Linux/macOS -# this is a no-op since the two already agree (module the resolved-symlink -# /var -> /private/var case handled by the mktemp comment above). -physical_path() { (cd "$1" && pwd); } +# Push a path through the same normalization that sdd-workspace's own +# printed output goes through, so both sides of a string comparison are +# guaranteed to be spelled identically. On Windows (Git Bash/MSYS, Cygwin) +# that is the drive-letter form `cygpath -m` prints (C:/Users/...), not the +# MSYS form `pwd` prints (/c/Users/...); on Linux/macOS it is plain `pwd` +# (modulo the resolved-symlink /var -> /private/var case handled by the +# mktemp comment below). +physical_path() { + (cd "$1" && if command -v cygpath >/dev/null 2>&1; then cygpath -m "$PWD"; else pwd; fi) +} + +# On Windows, check that PowerShell (the shell an agent's PowerShell tool +# runs) can open a path the helpers printed. Elsewhere there is nothing to +# check: the printed path is the shell's own. +native_readable() { + command -v cygpath >/dev/null 2>&1 && command -v powershell.exe >/dev/null 2>&1 || return 0 + [[ "$(powershell.exe -NoProfile -Command "Test-Path -LiteralPath '$1'" | tr -d '\r')" == "True" ]] +} cleanup() { if [[ -n "$TEST_ROOT" && -d "$TEST_ROOT" ]]; then @@ -93,6 +102,13 @@ PLAN echo " got: $dir_a" fi + if native_readable "$dir_a"; then + pass "the printed workspace path opens from PowerShell on Windows" + else + fail "the printed workspace path opens from PowerShell on Windows" + echo " got: $dir_a" + fi + if [[ "$dir_a" != "$dir_b" && -d "$dir_a" && -d "$dir_b" ]]; then pass "two plans resolve to two distinct directories" else @@ -139,6 +155,12 @@ PLAN fail "task-brief writes its brief under the plan's workspace" echo " got: $brief_path" fi + if native_readable "$brief_path"; then + pass "the printed brief path opens from PowerShell on Windows" + else + fail "the printed brief path opens from PowerShell on Windows" + echo " got: $brief_path" + fi # --- review-package takes the plan first and lands in its directory --- local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false) |
