fix(loader): use @sf-run scope instead of @gsd for workspace packages

Loader was creating @gsd directories in node_modules but cli.js imports
@sf-run/* packages. This mismatch caused module resolution failures.
Rename gsdScopeDir to sfRunScopeDir and update scope to @sf-run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ace-pm 2026-04-15 15:03:39 +02:00
parent 32df63621f
commit 291cad9f7b

View file

@ -182,13 +182,13 @@ if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy
// On Windows without Developer Mode or admin rights, symlinkSync will throw even for
// 'junction' type — so we fall back to cpSync (a full directory copy) which works
// everywhere without elevated permissions.
const gsdScopeDir = join(gsdNodeModules, '@gsd')
const sfRunScopeDir = join(gsdNodeModules, '@sf-run')
const packagesDir = join(gsdRoot, 'packages')
const wsPackages = ['native', 'pi-agent-core', 'pi-ai', 'pi-coding-agent', 'pi-tui']
try {
if (!existsSync(gsdScopeDir)) mkdirSync(gsdScopeDir, { recursive: true })
if (!existsSync(sfRunScopeDir)) mkdirSync(sfRunScopeDir, { recursive: true })
for (const pkg of wsPackages) {
const target = join(gsdScopeDir, pkg)
const target = join(sfRunScopeDir, pkg)
const source = join(packagesDir, pkg)
if (!existsSync(source) || existsSync(target)) continue
try {
@ -205,7 +205,7 @@ try {
// symlink+copy attempts, emit a clear diagnostic instead of a cryptic
// ERR_MODULE_NOT_FOUND from deep inside cli.js.
const criticalPackages = ['pi-coding-agent']
const missingPackages = criticalPackages.filter(pkg => !existsSync(join(gsdScopeDir, pkg)))
const missingPackages = criticalPackages.filter(pkg => !existsSync(join(sfRunScopeDir, pkg)))
if (missingPackages.length > 0) {
const missing = missingPackages.map(p => `@sf-run/${p}`).join(', ')
process.stderr.write(