mirror of
https://github.com/affaan-m/ECC.git
synced 2026-08-17 21:15:40 +02:00
* fix(ci): resync lockfiles with package.json (eslint 10) + migrate yarn.lock to Yarn 4 format package.json requires eslint@^10.6.0 but the committed locks pinned 9.39.2, so npm ci aborted and Yarn 4 hardened mode rejected the stale v1-classic yarn.lock (YN0028). Regenerate package-lock.json and rewrite yarn.lock in Yarn 4 (berry) format so npm ci and immutable yarn installs both pass. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(ci): require clean probe exit for Windows shell/bash detection; add pyyaml dev dep Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor: consolidate duplicated hook-root resolver into shared resolveEccRoot() (#2368) The inline node -e resolver blob was duplicated ~60x across hooks.json, command docs, and translations. Each copy inlined the full ~700-char plugin-root search using a spread over nested array literals (p.join(d,'plugins',...s) over [['ecc'],...]), which breaks Windows hook execution due to shell quoting (#2368). Collapse every copy to a 250-char locator that loads the committed resolve-ecc-root module and delegates to resolveEccRoot() — no spread, no nested array literals, no escaped double quotes. The real search logic now lives in one tested module. Also route session-start-bootstrap.js through resolveEccRoot() instead of its own duplicated reimplementation, and fix the auto-update.md 'marketplace' (singular) typo along the way. Guard tests updated: discovery behavior is asserted against resolveEccRoot(); the inline is asserted to delegate and to contain no Windows-fragile constructs. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(resolve-ecc-root): restore full env-unset discovery in inline resolver Address Greptile review on #2410: when CLAUDE_PLUGIN_ROOT is unset the delegating inline could only load the resolver module from ~/.claude, returning ~/.claude without ever reaching the plugin/cache search. Restore the old inline's discovery breadth (exact plugin roots + versioned cache) Windows-safely (no spread, nested arrays, or escaped quotes), then delegate the authoritative decision to resolveEccRoot(). Add regression tests for plugin-subdir and versioned-cache bootstrap with env unset. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: affaan <affaan@itomarkets.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
81 lines
3.5 KiB
JavaScript
81 lines
3.5 KiB
JavaScript
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const os = require('os');
|
|
const assert = require('assert');
|
|
const { INLINE_RESOLVE } = require('../../scripts/lib/resolve-ecc-root');
|
|
|
|
let passed = 0;
|
|
let failed = 0;
|
|
|
|
function test(name, fn) {
|
|
try {
|
|
fn();
|
|
console.log(`PASS ${name}`);
|
|
passed += 1;
|
|
} catch (error) {
|
|
console.error(`FAIL ${name}`);
|
|
console.error(error.stack || error.message || String(error));
|
|
failed += 1;
|
|
}
|
|
}
|
|
|
|
const sessionsDoc = fs.readFileSync(path.join(__dirname, '..', '..', 'commands', 'sessions.md'), 'utf8');
|
|
const skillHealthDoc = fs.readFileSync(path.join(__dirname, '..', '..', 'commands', 'skill-health.md'), 'utf8');
|
|
const instinctStatusDoc = fs.readFileSync(path.join(__dirname, '..', '..', 'commands', 'instinct-status.md'), 'utf8');
|
|
|
|
test('sessions command uses shared inline resolver in all node scripts', () => {
|
|
assert.strictEqual((sessionsDoc.match(/const _r = /g) || []).length, 6);
|
|
assert.strictEqual((sessionsDoc.match(/scripts','lib','resolve-ecc-root/g) || []).length, 6);
|
|
});
|
|
|
|
test('skill-health command uses shared inline resolver in all shell snippets', () => {
|
|
assert.strictEqual((skillHealthDoc.match(/var r=\(function/g) || []).length, 3);
|
|
assert.strictEqual((skillHealthDoc.match(/scripts','lib','resolve-ecc-root/g) || []).length, 3);
|
|
});
|
|
|
|
test('instinct-status command uses shared inline resolver (no stale legacy fallback) (#2037)', () => {
|
|
assert.strictEqual((instinctStatusDoc.match(/var r=\(function/g) || []).length, 1);
|
|
assert.strictEqual((instinctStatusDoc.match(/scripts','lib','resolve-ecc-root/g) || []).length, 1);
|
|
// The pre-fix template hard-coded the legacy path as a fallback when
|
|
// CLAUDE_PLUGIN_ROOT was unset. Asserting its absence prevents regression.
|
|
assert.ok(
|
|
!instinctStatusDoc.includes('python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py'),
|
|
'instinct-status should not hard-code the legacy ~/.claude install path as a fallback'
|
|
);
|
|
});
|
|
|
|
test('resolveEccRoot module covers current and legacy marketplace plugin roots', () => {
|
|
const { resolveEccRoot } = require('../../scripts/lib/resolve-ecc-root');
|
|
assert.ok(typeof resolveEccRoot === 'function');
|
|
|
|
const legacyHomeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-marketplace-legacy-'));
|
|
try {
|
|
const legacyRoot = path.join(legacyHomeDir, '.claude', 'plugins', 'marketplaces', 'ecc');
|
|
fs.mkdirSync(path.join(legacyRoot, 'scripts', 'lib'), { recursive: true });
|
|
fs.writeFileSync(path.join(legacyRoot, 'scripts', 'lib', 'utils.js'), '// stub');
|
|
assert.strictEqual(resolveEccRoot({ envRoot: '', homeDir: legacyHomeDir }), legacyRoot);
|
|
} finally {
|
|
fs.rmSync(legacyHomeDir, { recursive: true, force: true });
|
|
}
|
|
|
|
const cacheHomeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-marketplace-cache-'));
|
|
try {
|
|
const cacheRoot = path.join(cacheHomeDir, '.claude', 'plugins', 'cache', 'ecc', 'affaan-m', '1.0.0');
|
|
fs.mkdirSync(path.join(cacheRoot, 'scripts', 'lib'), { recursive: true });
|
|
fs.writeFileSync(path.join(cacheRoot, 'scripts', 'lib', 'utils.js'), '// stub');
|
|
assert.strictEqual(resolveEccRoot({ envRoot: '', homeDir: cacheHomeDir }), cacheRoot);
|
|
} finally {
|
|
fs.rmSync(cacheHomeDir, { recursive: true, force: true });
|
|
}
|
|
|
|
assert.ok(!INLINE_RESOLVE.includes('\\"'), 'Inline resolver should not require escaped double quotes');
|
|
assert.ok(INLINE_RESOLVE.includes("scripts','lib','resolve-ecc-root"));
|
|
});
|
|
|
|
console.log(`Passed: ${passed}`);
|
|
console.log(`Failed: ${failed}`);
|
|
|
|
process.exit(failed > 0 ? 1 : 0);
|