Compare commits

...

9 Commits

Author SHA1 Message Date
Affaan Mustafa
8b6140dedc Merge pull request #956 from tae1344/fix/ajv-runtime-dependency
fix(install): move ajv to dependencies and add .yarnrc.yml for node-modules linker
2026-03-27 06:25:02 -04:00
Affaan Mustafa
7633386e04 Merge pull request #878 from affaan-m/feat/install-catalog-project-config
feat: add install catalog and project config autodetection
2026-03-27 06:00:05 -04:00
Affaan Mustafa
b4296c7095 feat: add install catalog and project config autodetection 2026-03-27 05:56:39 -04:00
Affaan Mustafa
cc60bf6b65 Merge pull request #947 from chris-yyau/fix/shell-script-permissions
fix: add execute permissions to codex sync shell scripts
2026-03-27 02:47:13 -04:00
Affaan Mustafa
160624d0ed Merge branch 'main' into fix/shell-script-permissions 2026-03-27 02:46:42 -04:00
Affaan Mustafa
73c10122fe Merge pull request #938 from affaan-m/dependabot/npm_and_yarn/npm_and_yarn-3f9ee708be
chore(deps-dev): bump picomatch from 4.0.3 to 4.0.4 in the npm_and_yarn group across 1 directory
2026-03-27 02:46:29 -04:00
tae1344
fe6a6fc106 fix: move ajv to dependencies and add .yarnrc.yml for node-modules linker
ajv was in devDependencies but required at runtime by scripts/lib/install/config.js,
causing 'Cannot find module ajv' when running ./install.sh. Also adds .yarnrc.yml
with nodeLinker: node-modules so plain `node` can resolve packages without PnP.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 12:18:44 +09:00
Chris Yau
2243f15581 fix: add execute permissions to codex sync shell scripts
Three .sh files were committed without the execute bit, causing
`install-global-git-hooks.sh` to fail with "Permission denied"
when invoked by `sync-ecc-to-codex.sh`.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-26 22:14:51 +08:00
dependabot[bot]
6408511611 chore(deps-dev): bump picomatch
Bumps the npm_and_yarn group with 1 update in the / directory: [picomatch](https://github.com/micromatch/picomatch).


Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/4.0.3...4.0.4)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-26 12:04:05 +00:00
18 changed files with 2456 additions and 11 deletions

1
.yarnrc.yml Normal file
View File

@@ -0,0 +1 @@
nodeLinker: node-modules

6
package-lock.json generated
View File

@@ -2457,9 +2457,9 @@
}
},
"node_modules/picomatch": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
"engines": {

View File

@@ -110,11 +110,11 @@
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"ajv": "^8.18.0",
"sql.js": "^1.14.1"
},
"devDependencies": {
"@eslint/js": "^9.39.2",
"ajv": "^8.18.0",
"c8": "^10.1.2",
"eslint": "^9.39.2",
"globals": "^17.1.0",
@@ -122,5 +122,6 @@
},
"engines": {
"node": ">=18"
}
},
"packageManager": "yarn@4.9.2+sha512.1fc009bc09d13cfd0e19efa44cbfc2b9cf6ca61482725eb35bbc5e257e093ebf4130db6dfe15d604ff4b79efd8e1e8e99b25fa7d0a6197c9f9826358d4d65c3c"
}

186
scripts/catalog.js Normal file
View File

@@ -0,0 +1,186 @@
#!/usr/bin/env node
const {
getInstallComponent,
listInstallComponents,
listInstallProfiles,
} = require('./lib/install-manifests');
const FAMILY_ALIASES = Object.freeze({
baseline: 'baseline',
baselines: 'baseline',
language: 'language',
languages: 'language',
lang: 'language',
framework: 'framework',
frameworks: 'framework',
capability: 'capability',
capabilities: 'capability',
agent: 'agent',
agents: 'agent',
skill: 'skill',
skills: 'skill',
});
function showHelp(exitCode = 0) {
console.log(`
Discover ECC install components and profiles
Usage:
node scripts/catalog.js profiles [--json]
node scripts/catalog.js components [--family <family>] [--target <target>] [--json]
node scripts/catalog.js show <component-id> [--json]
Examples:
node scripts/catalog.js profiles
node scripts/catalog.js components --family language
node scripts/catalog.js show framework:nextjs
`);
process.exit(exitCode);
}
function normalizeFamily(value) {
if (!value) {
return null;
}
const normalized = String(value).trim().toLowerCase();
return FAMILY_ALIASES[normalized] || normalized;
}
function parseArgs(argv) {
const args = argv.slice(2);
const parsed = {
command: null,
componentId: null,
family: null,
target: null,
json: false,
help: false,
};
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
parsed.help = true;
return parsed;
}
parsed.command = args[0];
for (let index = 1; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--help' || arg === '-h') {
parsed.help = true;
} else if (arg === '--json') {
parsed.json = true;
} else if (arg === '--family') {
if (!args[index + 1]) {
throw new Error('Missing value for --family');
}
parsed.family = normalizeFamily(args[index + 1]);
index += 1;
} else if (arg === '--target') {
if (!args[index + 1]) {
throw new Error('Missing value for --target');
}
parsed.target = args[index + 1];
index += 1;
} else if (parsed.command === 'show' && !parsed.componentId) {
parsed.componentId = arg;
} else {
throw new Error(`Unknown argument: ${arg}`);
}
}
return parsed;
}
function printProfiles(profiles) {
console.log('Install profiles:\n');
for (const profile of profiles) {
console.log(`- ${profile.id} (${profile.moduleCount} modules)`);
console.log(` ${profile.description}`);
}
}
function printComponents(components) {
console.log('Install components:\n');
for (const component of components) {
console.log(`- ${component.id} [${component.family}]`);
console.log(` targets=${component.targets.join(', ')} modules=${component.moduleIds.join(', ')}`);
console.log(` ${component.description}`);
}
}
function printComponent(component) {
console.log(`Install component: ${component.id}\n`);
console.log(`Family: ${component.family}`);
console.log(`Targets: ${component.targets.join(', ')}`);
console.log(`Modules: ${component.moduleIds.join(', ')}`);
console.log(`Description: ${component.description}`);
if (component.modules.length > 0) {
console.log('\nResolved modules:');
for (const module of component.modules) {
console.log(`- ${module.id} [${module.kind}]`);
console.log(
` targets=${module.targets.join(', ')} default=${module.defaultInstall} cost=${module.cost} stability=${module.stability}`
);
console.log(` ${module.description}`);
}
}
}
function main() {
try {
const options = parseArgs(process.argv);
if (options.help) {
showHelp(0);
}
if (options.command === 'profiles') {
const profiles = listInstallProfiles();
if (options.json) {
console.log(JSON.stringify({ profiles }, null, 2));
} else {
printProfiles(profiles);
}
return;
}
if (options.command === 'components') {
const components = listInstallComponents({
family: options.family,
target: options.target,
});
if (options.json) {
console.log(JSON.stringify({ components }, null, 2));
} else {
printComponents(components);
}
return;
}
if (options.command === 'show') {
if (!options.componentId) {
throw new Error('Catalog show requires an install component ID');
}
const component = getInstallComponent(options.componentId);
if (options.json) {
console.log(JSON.stringify(component, null, 2));
} else {
printComponent(component);
}
return;
}
throw new Error(`Unknown catalog command: ${options.command}`);
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
}
}
main();

0
scripts/codex/check-codex-global-state.sh Normal file → Executable file
View File

0
scripts/codex/install-global-git-hooks.sh Normal file → Executable file
View File

View File

@@ -13,6 +13,10 @@ const COMMANDS = {
script: 'install-plan.js',
description: 'Inspect selective-install manifests and resolved plans',
},
catalog: {
script: 'catalog.js',
description: 'Discover install profiles and component IDs',
},
'install-plan': {
script: 'install-plan.js',
description: 'Alias for plan',
@@ -50,6 +54,7 @@ const COMMANDS = {
const PRIMARY_COMMANDS = [
'install',
'plan',
'catalog',
'list-installed',
'doctor',
'repair',
@@ -79,6 +84,9 @@ Examples:
ecc typescript
ecc install --profile developer --target claude
ecc plan --profile core --target cursor
ecc catalog profiles
ecc catalog components --family language
ecc catalog show framework:nextjs
ecc list-installed --json
ecc doctor --target cursor
ecc repair --dry-run

View File

@@ -100,12 +100,18 @@ function main() {
showHelp(0);
}
const { loadInstallConfig } = require('./lib/install/config');
const {
findDefaultInstallConfigPath,
loadInstallConfig,
} = require('./lib/install/config');
const { applyInstallPlan } = require('./lib/install-executor');
const { createInstallPlanFromRequest } = require('./lib/install/runtime');
const defaultConfigPath = options.configPath || options.languages.length > 0
? null
: findDefaultInstallConfigPath({ cwd: process.cwd() });
const config = options.configPath
? loadInstallConfig(options.configPath, { cwd: process.cwd() })
: null;
: (defaultConfigPath ? loadInstallConfig(defaultConfigPath, { cwd: process.cwd() }) : null);
const request = normalizeInstallRequest({
...options,
config,

View File

@@ -9,7 +9,10 @@ const {
listInstallProfiles,
resolveInstallPlan,
} = require('./lib/install-manifests');
const { loadInstallConfig } = require('./lib/install/config');
const {
findDefaultInstallConfigPath,
loadInstallConfig,
} = require('./lib/install/config');
const { normalizeInstallRequest } = require('./lib/install/request');
function showHelp() {
@@ -186,7 +189,7 @@ function main() {
try {
const options = parseArgs(process.argv);
if (options.help || process.argv.length <= 2) {
if (options.help) {
showHelp();
process.exit(0);
}
@@ -224,9 +227,18 @@ function main() {
return;
}
const defaultConfigPath = options.configPath
? null
: findDefaultInstallConfigPath({ cwd: process.cwd() });
const config = options.configPath
? loadInstallConfig(options.configPath, { cwd: process.cwd() })
: null;
: (defaultConfigPath ? loadInstallConfig(defaultConfigPath, { cwd: process.cwd() }) : null);
if (process.argv.length <= 2 && !config) {
showHelp();
process.exit(0);
}
const request = normalizeInstallRequest({
...options,
languages: [],

View File

@@ -216,6 +216,45 @@ function listInstallComponents(options = {}) {
.filter(component => !target || component.targets.includes(target));
}
function getInstallComponent(componentId, options = {}) {
const manifests = loadInstallManifests(options);
const normalizedComponentId = String(componentId || '').trim();
if (!normalizedComponentId) {
throw new Error('An install component ID is required');
}
const component = manifests.componentsById.get(normalizedComponentId);
if (!component) {
throw new Error(`Unknown install component: ${normalizedComponentId}`);
}
const moduleIds = dedupeStrings(component.modules);
const modules = moduleIds
.map(moduleId => manifests.modulesById.get(moduleId))
.filter(Boolean)
.map(module => ({
id: module.id,
kind: module.kind,
description: module.description,
targets: module.targets,
defaultInstall: module.defaultInstall,
cost: module.cost,
stability: module.stability,
dependencies: dedupeStrings(module.dependencies),
}));
return {
id: component.id,
family: component.family,
description: component.description,
moduleIds,
moduleCount: moduleIds.length,
targets: intersectTargets(modules),
modules,
};
}
function expandComponentIdsToModuleIds(componentIds, manifests) {
const expandedModuleIds = [];
@@ -438,6 +477,7 @@ module.exports = {
SUPPORTED_INSTALL_TARGETS,
getManifestPaths,
loadInstallManifests,
getInstallComponent,
listInstallComponents,
listLegacyCompatibilityLanguages,
listInstallModules,

View File

@@ -47,6 +47,12 @@ function resolveInstallConfigPath(configPath, options = {}) {
: path.normalize(path.join(cwd, configPath));
}
function findDefaultInstallConfigPath(options = {}) {
const cwd = options.cwd || process.cwd();
const candidatePath = path.join(cwd, DEFAULT_INSTALL_CONFIG);
return fs.existsSync(candidatePath) ? candidatePath : null;
}
function loadInstallConfig(configPath, options = {}) {
const resolvedPath = resolveInstallConfigPath(configPath, options);
@@ -77,6 +83,7 @@ function loadInstallConfig(configPath, options = {}) {
module.exports = {
DEFAULT_INSTALL_CONFIG,
findDefaultInstallConfigPath,
loadInstallConfig,
resolveInstallConfigPath,
};

0
scripts/sync-ecc-to-codex.sh Normal file → Executable file
View File

View File

@@ -8,6 +8,7 @@ const os = require('os');
const path = require('path');
const {
findDefaultInstallConfigPath,
loadInstallConfig,
resolveInstallConfigPath,
} = require('../../scripts/lib/install/config');
@@ -49,6 +50,32 @@ function runTests() {
assert.strictEqual(resolved, path.join(cwd, 'configs', 'ecc-install.json'));
})) passed++; else failed++;
if (test('finds the default project install config in the provided cwd', () => {
const cwd = createTempDir('install-config-');
try {
const configPath = path.join(cwd, 'ecc-install.json');
writeJson(configPath, {
version: 1,
profile: 'core',
});
assert.strictEqual(findDefaultInstallConfigPath({ cwd }), configPath);
} finally {
cleanup(cwd);
}
})) passed++; else failed++;
if (test('returns null when no default project install config exists', () => {
const cwd = createTempDir('install-config-');
try {
assert.strictEqual(findDefaultInstallConfigPath({ cwd }), null);
} finally {
cleanup(cwd);
}
})) passed++; else failed++;
if (test('loads and normalizes a valid install config', () => {
const cwd = createTempDir('install-config-');

View File

@@ -0,0 +1,104 @@
/**
* Tests for scripts/catalog.js
*/
const assert = require('assert');
const path = require('path');
const { execFileSync } = require('child_process');
const SCRIPT = path.join(__dirname, '..', '..', 'scripts', 'catalog.js');
function run(args = []) {
try {
const stdout = execFileSync('node', [SCRIPT, ...args], {
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe'],
timeout: 10000,
});
return { code: 0, stdout, stderr: '' };
} catch (error) {
return {
code: error.status || 1,
stdout: error.stdout || '',
stderr: error.stderr || '',
};
}
}
function test(name, fn) {
try {
fn();
console.log(` \u2713 ${name}`);
return true;
} catch (error) {
console.log(` \u2717 ${name}`);
console.log(` Error: ${error.message}`);
return false;
}
}
function runTests() {
console.log('\n=== Testing catalog.js ===\n');
let passed = 0;
let failed = 0;
if (test('shows help with no arguments', () => {
const result = run();
assert.strictEqual(result.code, 0);
assert.ok(result.stdout.includes('Discover ECC install components and profiles'));
})) passed++; else failed++;
if (test('shows help with an explicit help flag', () => {
const result = run(['--help']);
assert.strictEqual(result.code, 0);
assert.ok(result.stdout.includes('Usage:'));
assert.ok(result.stdout.includes('node scripts/catalog.js show <component-id>'));
})) passed++; else failed++;
if (test('lists install profiles', () => {
const result = run(['profiles']);
assert.strictEqual(result.code, 0);
assert.ok(result.stdout.includes('Install profiles'));
assert.ok(result.stdout.includes('core'));
})) passed++; else failed++;
if (test('filters components by family and emits JSON', () => {
const result = run(['components', '--family', 'language', '--json']);
assert.strictEqual(result.code, 0, result.stderr);
const parsed = JSON.parse(result.stdout);
assert.ok(Array.isArray(parsed.components));
assert.ok(parsed.components.length > 0);
assert.ok(parsed.components.every(component => component.family === 'language'));
assert.ok(parsed.components.some(component => component.id === 'lang:typescript'));
assert.ok(parsed.components.every(component => component.id !== 'framework:nextjs'));
})) passed++; else failed++;
if (test('shows a resolved component payload', () => {
const result = run(['show', 'framework:nextjs', '--json']);
assert.strictEqual(result.code, 0, result.stderr);
const parsed = JSON.parse(result.stdout);
assert.strictEqual(parsed.id, 'framework:nextjs');
assert.strictEqual(parsed.family, 'framework');
assert.deepStrictEqual(parsed.moduleIds, ['framework-language']);
assert.ok(Array.isArray(parsed.modules));
assert.strictEqual(parsed.modules[0].id, 'framework-language');
})) passed++; else failed++;
if (test('fails on unknown subcommands', () => {
const result = run(['bogus']);
assert.strictEqual(result.code, 1);
assert.ok(result.stderr.includes('Unknown catalog command'));
})) passed++; else failed++;
if (test('fails on unknown component ids', () => {
const result = run(['show', 'framework:not-real']);
assert.strictEqual(result.code, 1);
assert.ok(result.stderr.includes('Unknown install component'));
})) passed++; else failed++;
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);
}
runTests();

View File

@@ -65,6 +65,7 @@ function main() {
const result = runCli(['--help']);
assert.strictEqual(result.status, 0);
assert.match(result.stdout, /ECC selective-install CLI/);
assert.match(result.stdout, /catalog/);
assert.match(result.stdout, /list-installed/);
assert.match(result.stdout, /doctor/);
}],
@@ -93,6 +94,13 @@ function main() {
assert.ok(Array.isArray(payload.profiles));
assert.ok(payload.profiles.length > 0);
}],
['delegates catalog command', () => {
const result = runCli(['catalog', 'show', 'framework:nextjs', '--json']);
assert.strictEqual(result.status, 0, result.stderr);
const payload = parseJson(result.stdout);
assert.strictEqual(payload.id, 'framework:nextjs');
assert.deepStrictEqual(payload.moduleIds, ['framework-language']);
}],
['delegates lifecycle commands', () => {
const homeDir = createTempDir('ecc-cli-home-');
const projectRoot = createTempDir('ecc-cli-project-');
@@ -127,6 +135,11 @@ function main() {
assert.strictEqual(result.status, 0, result.stderr);
assert.match(result.stdout, /Usage: node scripts\/repair\.js/);
}],
['supports help for the catalog subcommand', () => {
const result = runCli(['help', 'catalog']);
assert.strictEqual(result.status, 0, result.stderr);
assert.match(result.stdout, /node scripts\/catalog\.js show <component-id>/);
}],
['fails on unknown commands instead of treating them as installs', () => {
const result = runCli(['bogus']);
assert.strictEqual(result.status, 1);

View File

@@ -358,6 +358,67 @@ function runTests() {
}
})) passed++; else failed++;
if (test('auto-detects ecc-install.json from the project root', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');
const configPath = path.join(projectDir, 'ecc-install.json');
try {
fs.writeFileSync(configPath, JSON.stringify({
version: 1,
target: 'claude',
profile: 'developer',
include: ['capability:security'],
exclude: ['capability:orchestration'],
}, null, 2));
const result = run([], { cwd: projectDir, homeDir });
assert.strictEqual(result.code, 0, result.stderr);
assert.ok(fs.existsSync(path.join(homeDir, '.claude', 'skills', 'security-review', 'SKILL.md')));
assert.ok(!fs.existsSync(path.join(homeDir, '.claude', 'skills', 'dmux-workflows', 'SKILL.md')));
const state = readJson(path.join(homeDir, '.claude', 'ecc', 'install-state.json'));
assert.strictEqual(state.request.profile, 'developer');
assert.deepStrictEqual(state.request.includeComponents, ['capability:security']);
assert.deepStrictEqual(state.request.excludeComponents, ['capability:orchestration']);
assert.ok(state.resolution.selectedModules.includes('security'));
assert.ok(!state.resolution.selectedModules.includes('orchestration'));
} finally {
cleanup(homeDir);
cleanup(projectDir);
}
})) passed++; else failed++;
if (test('preserves legacy language installs when a project config is present', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');
const configPath = path.join(projectDir, 'ecc-install.json');
try {
fs.writeFileSync(configPath, JSON.stringify({
version: 1,
target: 'claude',
profile: 'developer',
include: ['capability:security'],
}, null, 2));
const result = run(['typescript'], { cwd: projectDir, homeDir });
assert.strictEqual(result.code, 0, result.stderr);
const state = readJson(path.join(homeDir, '.claude', 'ecc', 'install-state.json'));
assert.strictEqual(state.request.legacyMode, true);
assert.deepStrictEqual(state.request.legacyLanguages, ['typescript']);
assert.strictEqual(state.request.profile, null);
assert.deepStrictEqual(state.request.includeComponents, []);
assert.ok(state.resolution.selectedModules.includes('framework-language'));
assert.ok(!state.resolution.selectedModules.includes('security'));
} finally {
cleanup(homeDir);
cleanup(projectDir);
}
})) passed++; else failed++;
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);
}

View File

@@ -8,11 +8,12 @@ const { execFileSync } = require('child_process');
const SCRIPT = path.join(__dirname, '..', '..', 'scripts', 'install-plan.js');
function run(args = []) {
function run(args = [], options = {}) {
try {
const stdout = execFileSync('node', [SCRIPT, ...args], {
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe'],
cwd: options.cwd,
timeout: 10000,
});
return { code: 0, stdout, stderr: '' };
@@ -135,6 +136,31 @@ function runTests() {
}
})) passed++; else failed++;
if (test('auto-detects planning intent from project ecc-install.json', () => {
const configDir = path.join(__dirname, '..', 'fixtures', 'tmp-install-plan-autodetect');
const configPath = path.join(configDir, 'ecc-install.json');
try {
require('fs').mkdirSync(configDir, { recursive: true });
require('fs').writeFileSync(configPath, JSON.stringify({
version: 1,
target: 'cursor',
profile: 'core',
include: ['capability:security'],
}, null, 2));
const result = run(['--json'], { cwd: configDir });
assert.strictEqual(result.code, 0, result.stderr);
const parsed = JSON.parse(result.stdout);
assert.strictEqual(parsed.target, 'cursor');
assert.strictEqual(parsed.profileId, 'core');
assert.deepStrictEqual(parsed.includedComponentIds, ['capability:security']);
assert.ok(parsed.selectedModuleIds.includes('security'));
} finally {
require('fs').rmSync(configDir, { recursive: true, force: true });
}
})) passed++; else failed++;
if (test('fails on unknown arguments', () => {
const result = run(['--unknown-flag']);
assert.strictEqual(result.code, 1);

1953
yarn.lock Normal file

File diff suppressed because it is too large Load Diff