Browse Source

fix(task-management): support git worktrees in router root detection (#301)

find_project_root used [ -d "$dir/.git" ], which fails in a git worktree where .git is a file containing a gitdir: pointer rather than a directory. Switches to -e (a strict superset, so the normal-repo case is unaffected; submodules are fixed for free).

Also changes return 1 to return 0 in the fallback branch: PROJECT_ROOT="$(find_project_root)" takes the command substitution's exit status, so under set -e the script aborted after the fallback value had already been computed, producing silent no-output.

Mainly affects non-Node projects consuming OAC from a worktree; this repo's root package.json masks the bug.
discord9 2 weeks ago
parent
commit
0879d0493b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      .opencode/skills/task-management/router.sh

+ 2 - 2
.opencode/skills/task-management/router.sh

@@ -72,14 +72,14 @@ find_project_root() {
     local dir
     dir="$(pwd)"
     while [ "$dir" != "/" ]; do
-        if [ -d "$dir/.git" ] || [ -f "$dir/package.json" ]; then
+        if [ -e "$dir/.git" ] || [ -f "$dir/package.json" ]; then
             echo "$dir"
             return 0
         fi
         dir="$(dirname "$dir")"
     done
     pwd
-    return 1
+    return 0
 }
 
 # Handle help