fix: harden install target filtering and MCP health probes

This commit is contained in:
Affaan Mustafa
2026-04-05 13:59:42 -07:00
parent 9d718ec66a
commit 8baffb4ad3
7 changed files with 138 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ const path = require('path');
const {
createFlatRuleOperations,
createInstallTargetAdapter,
isForeignPlatformPath,
} = require('./helpers');
module.exports = createInstallTargetAdapter({
@@ -30,18 +31,20 @@ module.exports = createInstallTargetAdapter({
return modules.flatMap(module => {
const paths = Array.isArray(module.paths) ? module.paths : [];
return paths.flatMap(sourceRelativePath => {
if (sourceRelativePath === 'rules') {
return createFlatRuleOperations({
moduleId: module.id,
repoRoot,
sourceRelativePath,
destinationDir: path.join(targetRoot, 'rules'),
});
}
return paths
.filter(p => !isForeignPlatformPath(p, adapter.target))
.flatMap(sourceRelativePath => {
if (sourceRelativePath === 'rules') {
return createFlatRuleOperations({
moduleId: module.id,
repoRoot,
sourceRelativePath,
destinationDir: path.join(targetRoot, 'rules'),
});
}
return [adapter.createScaffoldOperation(module.id, sourceRelativePath, planningInput)];
});
return [adapter.createScaffoldOperation(module.id, sourceRelativePath, planningInput)];
});
});
},
});