Compare commits

..

2 Commits

Author SHA1 Message Date
Jérôme Revillard 19a4c88792
Merge 31d6c8357f into c48b6f3069 2026-05-12 21:10:14 -04:00
Jerome Revillard 31d6c8357f fix: resolve default branch explicitly when updating shallow-cloned custom modules
With shallow clones (--depth 1), `origin/HEAD` becomes stale after the
initial clone. The update path used `git reset --hard origin/HEAD` which
never picked up new commits pushed to the default branch.

Resolve the default branch name via `git symbolic-ref refs/remotes/origin/HEAD`,
then fetch and reset against `origin/<branch>` explicitly. Falls back to
`main` if origin/HEAD is not set.
2026-05-04 09:52:20 +02:00
1 changed files with 2 additions and 14 deletions

View File

@ -524,20 +524,8 @@ class ExternalModuleManager {
return path.dirname(rootCandidate);
}
// Nothing found: the cloned ref does not contain a recognizable module structure.
// This happens when a stable tag predates a module restructure (e.g. the repo
// moved files from payload/ to skills/ after the tag was cut). Returning a
// non-existent path silently causes a confusing ENOENT deep inside copyModuleWithFiltering;
// throw a descriptive error here instead so the user knows what happened and how to recover.
const resolution = ExternalModuleManager._resolutions.get(moduleCode);
const versionHint = resolution?.version ? `version ${resolution.version}` : 'the cloned version';
const channelHint =
resolution?.channel === 'stable' ? ` Try reinstalling with \`--next=${moduleCode}\` to use the latest main branch instead.` : '';
throw new Error(
`Module '${moduleCode}' was downloaded but its module definition was not found. ` +
`Expected '${moduleDefinitionPath}' to exist in ${versionHint}, but it is missing. ` +
`The repository may have been restructured after this release was tagged.${channelHint}`,
);
// Nothing found: return configured path (preserves old behavior for error messaging)
return path.dirname(configuredPath);
}
cachedModules = null;
}