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): treat .pi as a foreign platform path (#3560)

Gaurav Dubey30b68924ae97
diff --git a/scripts/lib/install-targets/helpers.js b/scripts/lib/install-targets/helpers.js
index 5df5ae1c4..3ff268a46 100644
--- a/scripts/lib/install-targets/helpers.js
+++ b/scripts/lib/install-targets/helpers.js
@@ -18,6 +18,9 @@ const PLATFORM_SOURCE_PATH_OWNERS = Object.freeze({
'.joycode': 'joycode',
'.opencode': 'opencode',
'.openclaw': 'openclaw',
+ // Pi loads ECC through `pi install`, not install-apply, so `.pi` is
+ // foreign to every install target.
+ '.pi': 'pi',
'.codebuddy': 'codebuddy',
'.qwen': 'qwen',
'.zed': 'zed',
diff --git a/tests/lib/install-targets.test.js b/tests/lib/install-targets.test.js
index fc1435bca..68cedc557 100644
--- a/tests/lib/install-targets.test.js
+++ b/tests/lib/install-targets.test.js
@@ -13,6 +13,7 @@ const {
listInstallTargetAdapters,
planInstallTargetScaffold,
} = require('../../scripts/lib/install-targets/registry');
+const { isForeignPlatformPath } = require('../../scripts/lib/install-targets/helpers');
const { resolveInvocationEnvironment } = require('../../scripts/lib/invocation-environment');
function normalizedRelativePath(value) {
@@ -1252,6 +1253,50 @@ function runTests() {
);
})) passed++; else failed++;
+ if (test('opencode adapter skips the foreign Pi harness directory', () => {
+ const repoRoot = path.join(__dirname, '..', '..');
+ const homeDir = path.join(os.tmpdir(), 'ecc-opencode-pi-home');
+
+ const plan = planInstallTargetScaffold({
+ target: 'opencode',
+ repoRoot,
+ homeDir,
+ exemptValidationCodes: ['opencode-plugin-not-built'],
+ modules: [
+ {
+ id: 'platform-configs',
+ paths: ['.opencode', '.pi', 'mcp-configs'],
+ },
+ ],
+ });
+
+ assert.ok(
+ plan.operations.some(operation => (
+ normalizedRelativePath(operation.sourceRelativePath) === 'mcp-configs'
+ )),
+ 'Should still include non-foreign mcp-configs path (guards against empty-plan regression)'
+ );
+ assert.ok(
+ !plan.operations.some(operation => (
+ normalizedRelativePath(operation.sourceRelativePath) === '.pi'
+ || normalizedRelativePath(operation.sourceRelativePath).startsWith('.pi/')
+ )),
+ 'Should skip the Pi harness directory, which Pi consumes via `pi install`'
+ );
+ })) passed++; else failed++;
+
+ if (test('every install target treats .pi as a foreign platform path', () => {
+ for (const adapter of listInstallTargetAdapters()) {
+ for (const sourcePath of ['.pi', '.pi/extensions/index.ts', '.pi/README.md']) {
+ assert.strictEqual(
+ isForeignPlatformPath(sourcePath, adapter.target),
+ true,
+ `${adapter.target} should treat ${sourcePath} as foreign`
+ );
+ }
+ }
+ })) passed++; else failed++;
+
if (test('resolves opencode adapter root and install-state path from home dir', () => {
const adapter = getInstallTargetAdapter('opencode');
const homeDir = '/Users/example';