summaryrefslogtreecommitdiff
path: root/skills/subagent-driven-development/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'skills/subagent-driven-development/scripts')
-rwxr-xr-xskills/subagent-driven-development/scripts/sdd-workspace13
1 files changed, 9 insertions, 4 deletions
diff --git a/skills/subagent-driven-development/scripts/sdd-workspace b/skills/subagent-driven-development/scripts/sdd-workspace
index ff6b983..b4661eb 100755
--- a/skills/subagent-driven-development/scripts/sdd-workspace
+++ b/skills/subagent-driven-development/scripts/sdd-workspace
@@ -42,13 +42,16 @@ slug=$(basename "$plan" .md)
[ -n "$slug" ] && [ "$slug" != "." ] && [ "$slug" != ".." ] \
|| { echo "cannot derive a workspace name from: $plan" >&2; exit 2; }
-root=$(git rev-parse --show-toplevel)
+# Physical path, spelled the way pwd -P spells the plan path below: on Git
+# Bash, rev-parse prints C:/Users/... while pwd prints /c/Users/..., and the
+# repo-relative marker check needs both in the same form.
+root=$(CDPATH='' cd -- "$(git rev-parse --show-toplevel)" && pwd -P)
base="$root/.superpowers/sdd"
# Normalize the plan path (physical directory, so relative/absolute/../
# spellings of one plan compare equal) and express it as the marker value:
# repo-relative when the plan lives under the repo root, absolute otherwise.
-plan_dir=$(CDPATH= cd -- "$(dirname "$plan")" && pwd -P)
+plan_dir=$(CDPATH='' cd -- "$(dirname "$plan")" && pwd -P)
plan_abs="$plan_dir/$(basename "$plan")"
case "$plan_abs" in
"$root"/*) plan_id=${plan_abs#"$root"/} ;;
@@ -78,5 +81,7 @@ if ! owns "$dir"; then
fi
fi
-printf '*\n' > "$base/.gitignore"
-CDPATH= cd -- "$dir" && pwd
+# 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