diff --git a/src/loader.ts b/src/loader.ts index 02570d62b..3b7640af2 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -145,9 +145,12 @@ process.env.SF_BIN_PATH = process.env.SF_BIN_PATH || process.argv[1] // SF_WORKFLOW_PATH — absolute path to bundled SF-WORKFLOW.md, used by patched sf extension // when dispatching workflow prompts. Prefers dist/resources/ (stable, set at build time) // over src/resources/ (live working tree) — see resource-loader.ts for rationale. +// Guard: the build sometimes copies dist/resources/extensions/ without the root-level +// markdown files, leaving existsSync(distRes)=true but SF-WORKFLOW.md missing. Fall +// back to src/resources/ when the file itself isn't present in dist. const distRes = join(sfRootDir, 'dist', 'resources') const srcRes = join(sfRootDir, 'src', 'resources') -const resourcesDir = existsSync(distRes) ? distRes : srcRes +const resourcesDir = existsSync(join(distRes, 'SF-WORKFLOW.md')) ? distRes : srcRes process.env.SF_WORKFLOW_PATH = join(resourcesDir, 'SF-WORKFLOW.md') // SF_BUNDLED_EXTENSION_PATHS — dynamically discovered bundled extension entry points.