Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix(install): keep home targets target-safe

Dante1b9d599aabe2
diff --git a/scripts/lib/install-manifests.js b/scripts/lib/install-manifests.js
index bb16cc93c..e3da77f7f 100644
--- a/scripts/lib/install-manifests.js
+++ b/scripts/lib/install-manifests.js
@@ -631,7 +631,7 @@ function resolveInstallPlan(options = {}) {
const visitingIds = new Set();
const resolvedIds = new Set();
- function resolveModule(moduleId, dependencyOf, rootRequesterId) {
+ function resolveModule(moduleId, dependencyOf) {
const module = manifests.modulesById.get(moduleId);
if (!module) {
throw new Error(`Unknown install module: ${moduleId}`);
@@ -655,8 +655,12 @@ function resolveInstallPlan(options = {}) {
if (!supportsTarget) {
if (dependencyOf) {
- skippedTargetIds.add(rootRequesterId || dependencyOf);
- return false;
+ // A module that explicitly supports the selected target remains useful
+ // when one of its cross-harness dependencies does not. Treat that
+ // dependency as inapplicable for this target instead of dropping the
+ // target-capable root module with it.
+ skippedTargetIds.add(moduleId);
+ return true;
}
skippedTargetIds.add(moduleId);
return false;
@@ -674,8 +678,7 @@ function resolveInstallPlan(options = {}) {
for (const dependencyId of module.dependencies) {
const dependencyResolved = resolveModule(
dependencyId,
- moduleId,
- rootRequesterId || moduleId
+ moduleId
);
if (!dependencyResolved) {
visitingIds.delete(moduleId);
@@ -692,7 +695,7 @@ function resolveInstallPlan(options = {}) {
}
for (const moduleId of effectiveRequestedIds) {
- resolveModule(moduleId, null, moduleId);
+ resolveModule(moduleId, null);
}
const selectedModules = manifests.modules.filter(module => selectedIds.has(module.id));
diff --git a/scripts/lib/install-targets/claude-home.js b/scripts/lib/install-targets/claude-home.js
index 5cc426ac9..a07de2835 100644
--- a/scripts/lib/install-targets/claude-home.js
+++ b/scripts/lib/install-targets/claude-home.js
@@ -3,7 +3,6 @@ const path = require('path');
const {
createInstallTargetAdapter,
createRemappedOperation,
- isForeignPlatformPath,
normalizeRelativePath,
planClaudeHooksOperations,
} = require('./helpers');
@@ -53,6 +52,7 @@ module.exports = createInstallTargetAdapter({
rootSegments: ['.claude'],
installStatePathSegments: ['ecc', 'install-state.json'],
nativeRootRelativePath: '.claude-plugin',
+ excludedSourcePaths: ['.agents'],
planOperations(input, adapter) {
const modules = Array.isArray(input.modules)
? input.modules
@@ -66,7 +66,7 @@ module.exports = createInstallTargetAdapter({
return modules.flatMap(module => {
const paths = Array.isArray(module.paths) ? module.paths : [];
return paths
- .filter(p => !isForeignPlatformPath(p, adapter.target))
+ .filter(adapter.supportsSourcePath)
.flatMap(sourceRelativePath => {
if (
module.id === 'hooks-runtime'
diff --git a/scripts/lib/install-targets/codex-home.js b/scripts/lib/install-targets/codex-home.js
index ae29b41a1..f2423ef68 100644
--- a/scripts/lib/install-targets/codex-home.js
+++ b/scripts/lib/install-targets/codex-home.js
@@ -7,4 +7,5 @@ module.exports = createInstallTargetAdapter({
rootSegments: ['.codex'],
installStatePathSegments: ['ecc-install-state.json'],
nativeRootRelativePath: '.codex',
+ excludedSourcePaths: ['.agents'],
});
diff --git a/scripts/lib/install-targets/helpers.js b/scripts/lib/install-targets/helpers.js
index f69d75e86..4a37b5fec 100644
--- a/scripts/lib/install-targets/helpers.js
+++ b/scripts/lib/install-targets/helpers.js
@@ -298,6 +298,19 @@ function createFlatRuleOperations(options) {
}
function createInstallTargetAdapter(config) {
+ function supportsSourcePath(sourceRelativePath) {
+ const normalizedSourcePath = normalizeRelativePath(sourceRelativePath);
+ const excludedSourcePaths = Array.isArray(config.excludedSourcePaths)
+ ? config.excludedSourcePaths.map(normalizeRelativePath)
+ : [];
+
+ return !isForeignPlatformPath(normalizedSourcePath, config.target)
+ && !excludedSourcePaths.some(excludedPath => (
+ normalizedSourcePath === excludedPath
+ || normalizedSourcePath.startsWith(`${excludedPath}/`)
+ ));
+ }
+
const adapter = {
id: config.id,
target: config.target,
@@ -351,6 +364,7 @@ function createInstallTargetAdapter(config) {
strategy: adapter.determineStrategy(normalizedSourcePath),
});
},
+ supportsSourcePath,
planOperations(input = {}) {
if (typeof config.planOperations === 'function') {
return config.planOperations(input, adapter);
@@ -360,7 +374,7 @@ function createInstallTargetAdapter(config) {
return input.modules.flatMap(module => {
const paths = Array.isArray(module.paths) ? module.paths : [];
return paths
- .filter(p => !isForeignPlatformPath(p, config.target))
+ .filter(supportsSourcePath)
.map(sourceRelativePath => adapter.createScaffoldOperation(
module.id,
sourceRelativePath,
@@ -372,7 +386,7 @@ function createInstallTargetAdapter(config) {
const module = input.module || {};
const paths = Array.isArray(module.paths) ? module.paths : [];
return paths
- .filter(p => !isForeignPlatformPath(p, config.target))
+ .filter(supportsSourcePath)
.map(sourceRelativePath => adapter.createScaffoldOperation(
module.id,
sourceRelativePath,
diff --git a/scripts/sync-ecc-to-codex.sh b/scripts/sync-ecc-to-codex.sh
index 1e157bad1..cecc397cf 100755
--- a/scripts/sync-ecc-to-codex.sh
+++ b/scripts/sync-ecc-to-codex.sh
@@ -339,7 +339,7 @@ for agent_file in "$CODEX_AGENTS_SRC"/*.toml; do
done
# Skills are NOT synced here — Codex CLI reads directly from
-# ~/.agents/skills/ (installed by ECC installer / npx skills).
+# ~/.agents/skills/ (Codex's user-level skill discovery path).
# Copying into ~/.codex/skills/ was unnecessary.
log "Generating prompt files from ECC commands"
diff --git a/tests/lib/install-manifests.test.js b/tests/lib/install-manifests.test.js
index cd91e6e3a..438c44952 100644
--- a/tests/lib/install-manifests.test.js
+++ b/tests/lib/install-manifests.test.js
@@ -698,7 +698,7 @@ function runTests() {
);
})) passed++; else failed++;
- if (test('skips a requested module when its dependency chain does not support the target', () => {
+ if (test('keeps a requested target-capable module when a dependency does not support the target', () => {
const repoRoot = createTestRepo();
try {
writeJson(path.join(repoRoot, 'manifests', 'install-modules.json'), {
@@ -736,8 +736,8 @@ function runTests() {
});
const plan = resolveInstallPlan({ repoRoot, profileId: 'core', target: 'claude' });
- assert.deepStrictEqual(plan.selectedModuleIds, []);
- assert.deepStrictEqual(plan.skippedModuleIds, ['parent']);
+ assert.deepStrictEqual(plan.selectedModuleIds, ['parent']);
+ assert.deepStrictEqual(plan.skippedModuleIds, ['child']);
} finally {
cleanupTestRepo(repoRoot);
}