fix: isolate Claude project hooks from ESM hosts (#3184)

* fix: isolate Claude project hooks from ESM hosts

* fix: handle user-owned Claude scripts package
This commit is contained in:
Eastern
2026-09-20 14:26:49 -04:00
committed by GitHub
parent 111387afe4
commit 95448ad81d
4 changed files with 141 additions and 1 deletions
+17 -1
View File
@@ -9,6 +9,7 @@ const {
} = require('./helpers');
const CLAUDE_ECC_NAMESPACE = 'ecc';
const CLAUDE_PROJECT_COMMONJS_PACKAGE = 'manifests/install-assets/claude-project-scripts-package.json';
function getClaudeManagedDestinationPath(adapter, sourceRelativePath, input) {
const normalizedSourcePath = normalizeRelativePath(sourceRelativePath);
@@ -65,7 +66,7 @@ module.exports = createInstallTargetAdapter({
return modules.flatMap(module => {
const paths = Array.isArray(module.paths) ? module.paths : [];
return paths
const operations = paths
.filter(p => !isForeignPlatformPath(p, 'claude'))
.flatMap(sourceRelativePath => {
if (
@@ -93,6 +94,21 @@ module.exports = createInstallTargetAdapter({
return [adapter.createScaffoldOperation(module.id, sourceRelativePath, planningInput)];
});
if (module.id !== 'hooks-runtime') {
return operations;
}
return [
...['hooks', 'lib'].map(directory => createRemappedOperation(
adapter,
module.id,
CLAUDE_PROJECT_COMMONJS_PACKAGE,
path.join(adapter.resolveRoot(planningInput), 'scripts', directory, 'package.json'),
{ strategy: 'preserve-relative-path' }
)),
...operations,
];
});
},
});