mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-23 16:25:30 +00:00
GREEN: hook policy 4/4, MCP policy 8/8, native Antigravity 1.2.9 import, tier suite 24/24, lifecycle 5/5 plus 73 existing checks. Use shared enable/profile/dry-run decisions and managed setup; stop importing source MCP definitions and filter mcp_config.json. Derive sibling workflow roots for doctor/repair/uninstall and refuse escapes. Restore upstream Claude setup behavior after four migration regressions. Update module targets, carrier schema, unchanged trigger binding, and native validation limits.
65 lines
2.9 KiB
JavaScript
65 lines
2.9 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const os = require('os');
|
|
const path = require('path');
|
|
const { spawnSync } = require('child_process');
|
|
const { createManifestInstallPlan } = require('../../scripts/lib/install/plan');
|
|
const { applyInstallPlan } = require('../../scripts/lib/install/apply');
|
|
const { withHookConsent } = require('../../scripts/lib/install/hook-consent');
|
|
|
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-agy-native-'));
|
|
const loaderHome = path.join(root, 'loader-home');
|
|
fs.mkdirSync(loaderHome);
|
|
// Only pass filesystem locations owned by this test; never inherit authentication.
|
|
const env = {
|
|
PATH: process.env.PATH,
|
|
HOME: loaderHome,
|
|
USERPROFILE: loaderHome,
|
|
XDG_CONFIG_HOME: path.join(loaderHome, '.config'),
|
|
XDG_DATA_HOME: path.join(loaderHome, '.local', 'share'),
|
|
XDG_CACHE_HOME: path.join(loaderHome, '.cache'),
|
|
...(process.platform === 'win32' ? { SystemRoot: process.env.SystemRoot, APPDATA: loaderHome, LOCALAPPDATA: loaderHome } : {}),
|
|
};
|
|
|
|
function agy(args) {
|
|
return spawnSync('agy', args, { env, cwd: root, encoding: 'utf8', timeout: 15000 });
|
|
}
|
|
|
|
function checked(args) {
|
|
const result = agy(args);
|
|
assert.strictEqual(result.status, 0, result.error?.message || result.stderr || result.stdout);
|
|
return result.stdout;
|
|
}
|
|
|
|
try {
|
|
const version = agy(['--version']);
|
|
if (version.error?.code === 'ENOENT' || (version.status === 0 && version.stdout.trim() !== '1.2.9')) {
|
|
console.log(`SKIP: native plugin validation requires installed agy 1.2.9 (found ${version.stdout?.trim() || 'none'}); no download attempted.`);
|
|
} else {
|
|
assert.strictEqual(version.status, 0, version.error?.message || version.stderr);
|
|
const plan = withHookConsent(createManifestInstallPlan({
|
|
sourceRoot: path.resolve(__dirname, '../..'),
|
|
profileId: 'core',
|
|
target: 'antigravity-home',
|
|
projectRoot: path.join(root, 'workspace'),
|
|
homeDir: path.join(root, 'install-home'),
|
|
}), 'enabled');
|
|
applyInstallPlan(plan);
|
|
assert.ok(fs.existsSync(path.join(plan.targetRoot, 'plugin.json')));
|
|
const validation = checked(['plugin', 'validate', plan.targetRoot]);
|
|
assert.match(validation, /\[ok\]/);
|
|
checked(['plugin', 'install', plan.targetRoot]);
|
|
const listed = JSON.parse(checked(['plugin', 'list', '--json']));
|
|
const plugin = listed.imports.find(entry => entry.name === 'ecc');
|
|
assert.ok(plugin, 'Native CLI must discover ECC after explicit local import');
|
|
assert.ok(plugin.components.includes('hooks'), 'Native importer must register lifecycle hooks');
|
|
assert.ok(plugin.components.includes('mcpServers'), 'Native importer must register ECC memory');
|
|
console.log('PASS: agy 1.2.9 validates and imports the generated ECC plugin in a disposable HOME.');
|
|
console.log('NOT CHECKED: authenticated tool execution, Stop execution, and automatic IDE discovery.');
|
|
}
|
|
} finally {
|
|
fs.rmSync(root, { recursive: true, force: true });
|
|
}
|