Skip to content

detectDevCommand

detectDevCommand(worktreePath, fs?): Promise<string | null>

Defined in: src/preview.ts:104

Resolve the dev-server command for a worktree, using injectable fs accessors.

Resolution order:

  1. Root package.json with scripts.dev → <pm> run dev
  2. Exactly one curated/workspace subdir with scripts.dev → cd <dir> && <pm> run dev
  3. Zero or multiple subdirs → null

NEVER uses sync fs operations (hard rule for Shepherd’s single Bun event loop).

string

FsAccessors = realFs

Promise<string | null>