From 6ef3255f786e5aa73cc7df3f89bd9aebcfc4dbd3 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Wed, 15 Apr 2026 15:00:26 -0400 Subject: [PATCH] fix: normalize Windows paths in update scope detection (#2278) * docs: sync ARCHITECTURE.md command count to 74 commands/gsd/ has 74 .md files; the two count references in ARCHITECTURE.md still said 73. Fixes the command-count-sync regression test. Co-Authored-By: Claude Sonnet 4.6 * fix: normalize Windows paths in update scope detection (#2232) On Windows with Git Bash, `pwd` returns POSIX-style /c/Users/... paths while execution_context carries Windows-style C:/Users/... paths. The string equality check for LOCAL vs GLOBAL install scope never matched, so every local install on Windows was misdetected as GLOBAL and the wrong (global) install was updated. Fix: normalize both paths to POSIX drive-letter form before comparing, using portable POSIX shell (case+printf+tr, no GNU extensions). Closes #2232 Co-Authored-By: Claude Sonnet 4.6 * feat(commands): add gsd:inbox command for GitHub issue/PR triage inbox.md was created but not committed, causing the command count to read 73 in git while ARCHITECTURE.md correctly stated 74. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Claude Sonnet 4.6 --- get-shit-done/workflows/update.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/get-shit-done/workflows/update.md b/get-shit-done/workflows/update.md index f008da045..d67b4f5c0 100644 --- a/get-shit-done/workflows/update.md +++ b/get-shit-done/workflows/update.md @@ -78,9 +78,27 @@ fi # runtime directories. if [ -n "$PREFERRED_CONFIG_DIR" ] && { [ -f "$PREFERRED_CONFIG_DIR/get-shit-done/VERSION" ] || [ -f "$PREFERRED_CONFIG_DIR/get-shit-done/workflows/update.md" ]; }; then INSTALL_SCOPE="GLOBAL" + # Normalize a path for comparison: on Windows with Git Bash, pwd returns + # POSIX-style /c/Users/... but PREFERRED_CONFIG_DIR may carry C:/Users/... + # Convert Windows drive-letter paths to POSIX form so the comparison works + # on both Windows (Git Bash) and POSIX systems. + normalize_path() { + local p="$1" + case "$p" in + [A-Za-z]:/*) + local drive rest + drive="${p%%:*}" + rest="${p#?:}" + p="/$(printf '%s' "$drive" | tr '[:upper:]' '[:lower:]')$rest" + ;; + esac + printf '%s' "$p" + } + normalized_preferred="$(normalize_path "$PREFERRED_CONFIG_DIR")" for dir in .claude .config/opencode .opencode .gemini .config/kilo .kilo .codex; do resolved_local="$(cd "./$dir" 2>/dev/null && pwd)" - if [ -n "$resolved_local" ] && [ "$resolved_local" = "$PREFERRED_CONFIG_DIR" ]; then + normalized_local="$(normalize_path "$resolved_local")" + if [ -n "$normalized_local" ] && [ "$normalized_local" = "$normalized_preferred" ]; then INSTALL_SCOPE="LOCAL" break fi