fix: shorten plugin slug to ecc

This commit is contained in:
Affaan Mustafa
2026-04-05 14:31:30 -07:00
parent 908116d736
commit 1346f83b08
27 changed files with 233 additions and 144 deletions

View File

@@ -188,12 +188,22 @@ function detectTargetMode(rootDir) {
function findPluginInstall(rootDir) {
const homeDir = process.env.HOME || '';
const candidates = [
path.join(rootDir, '.claude', 'plugins', 'everything-claude-code', '.claude-plugin', 'plugin.json'),
path.join(rootDir, '.claude', 'plugins', 'everything-claude-code', 'plugin.json'),
homeDir && path.join(homeDir, '.claude', 'plugins', 'everything-claude-code', '.claude-plugin', 'plugin.json'),
homeDir && path.join(homeDir, '.claude', 'plugins', 'everything-claude-code', 'plugin.json'),
const pluginDirs = [
'ecc',
'ecc@ecc',
'everything-claude-code',
'everything-claude-code@everything-claude-code',
];
const candidateRoots = [
path.join(rootDir, '.claude', 'plugins'),
homeDir && path.join(homeDir, '.claude', 'plugins'),
].filter(Boolean);
const candidates = candidateRoots.flatMap((pluginsDir) =>
pluginDirs.flatMap((pluginDir) => [
path.join(pluginsDir, pluginDir, '.claude-plugin', 'plugin.json'),
path.join(pluginsDir, pluginDir, 'plugin.json'),
])
);
return candidates.find(candidate => fs.existsSync(candidate)) || null;
}
@@ -480,7 +490,7 @@ function getConsumerChecks(rootDir) {
category: 'Tool Coverage',
points: 4,
scopes: ['repo'],
path: '~/.claude/plugins/everything-claude-code/',
path: '~/.claude/plugins/ecc/ (legacy everything-claude-code paths also supported)',
description: 'Everything Claude Code is installed for the active user or project',
pass: Boolean(pluginInstall),
fix: 'Install the ECC plugin for this user or project before auditing project-specific harness quality.',

View File

@@ -30,6 +30,18 @@ const fs = require('fs');
const path = require('path');
const { spawnSync } = require('child_process');
const CURRENT_PLUGIN_SLUG = 'ecc';
const LEGACY_PLUGIN_SLUG = 'everything-claude-code';
const KNOWN_PLUGIN_PATHS = [
[CURRENT_PLUGIN_SLUG],
[`${CURRENT_PLUGIN_SLUG}@${CURRENT_PLUGIN_SLUG}`],
['marketplace', CURRENT_PLUGIN_SLUG],
[LEGACY_PLUGIN_SLUG],
[`${LEGACY_PLUGIN_SLUG}@${LEGACY_PLUGIN_SLUG}`],
['marketplace', LEGACY_PLUGIN_SLUG],
];
const CACHE_PLUGIN_SLUGS = [CURRENT_PLUGIN_SLUG, LEGACY_PLUGIN_SLUG];
// Read the raw JSON event from stdin
const raw = fs.readFileSync(0, 'utf8');
@@ -52,8 +64,8 @@ function hasRunnerRoot(candidate) {
* Resolves the ECC plugin root using the following priority order:
* 1. CLAUDE_PLUGIN_ROOT environment variable
* 2. ~/.claude (direct install)
* 3. Several well-known plugin sub-paths under ~/.claude/plugins/
* 4. Versioned cache directories under ~/.claude/plugins/cache/everything-claude-code/
* 3. Several well-known plugin sub-paths under ~/.claude/plugins/ (current + legacy)
* 4. Versioned cache directories under ~/.claude/plugins/cache/{ecc,everything-claude-code}/
* 5. Falls back to ~/.claude if nothing else matches
*
* @returns {string}
@@ -71,11 +83,9 @@ function resolvePluginRoot() {
return claudeDir;
}
const knownPaths = [
path.join(claudeDir, 'plugins', 'everything-claude-code'),
path.join(claudeDir, 'plugins', 'everything-claude-code@everything-claude-code'),
path.join(claudeDir, 'plugins', 'marketplace', 'everything-claude-code'),
];
const knownPaths = KNOWN_PLUGIN_PATHS.map((segments) =>
path.join(claudeDir, 'plugins', ...segments)
);
for (const candidate of knownPaths) {
if (hasRunnerRoot(candidate)) {
@@ -83,16 +93,18 @@ function resolvePluginRoot() {
}
}
// Walk versioned cache: ~/.claude/plugins/cache/everything-claude-code/<org>/<version>/
// Walk versioned cache: ~/.claude/plugins/cache/{ecc,everything-claude-code}/<org>/<version>/
try {
const cacheBase = path.join(claudeDir, 'plugins', 'cache', 'everything-claude-code');
for (const org of fs.readdirSync(cacheBase, { withFileTypes: true })) {
if (!org.isDirectory()) continue;
for (const version of fs.readdirSync(path.join(cacheBase, org.name), { withFileTypes: true })) {
if (!version.isDirectory()) continue;
const candidate = path.join(cacheBase, org.name, version.name);
if (hasRunnerRoot(candidate)) {
return candidate;
for (const slug of CACHE_PLUGIN_SLUGS) {
const cacheBase = path.join(claudeDir, 'plugins', 'cache', slug);
for (const org of fs.readdirSync(cacheBase, { withFileTypes: true })) {
if (!org.isDirectory()) continue;
for (const version of fs.readdirSync(path.join(cacheBase, org.name), { withFileTypes: true })) {
if (!version.isDirectory()) continue;
const candidate = path.join(cacheBase, org.name, version.name);
if (hasRunnerRoot(candidate)) {
return candidate;
}
}
}
}

View File

@@ -4,14 +4,28 @@ const fs = require('fs');
const path = require('path');
const os = require('os');
const CURRENT_PLUGIN_SLUG = 'ecc';
const LEGACY_PLUGIN_SLUG = 'everything-claude-code';
const CURRENT_PLUGIN_HANDLE = `${CURRENT_PLUGIN_SLUG}@${CURRENT_PLUGIN_SLUG}`;
const LEGACY_PLUGIN_HANDLE = `${LEGACY_PLUGIN_SLUG}@${LEGACY_PLUGIN_SLUG}`;
const PLUGIN_CACHE_SLUGS = [CURRENT_PLUGIN_SLUG, LEGACY_PLUGIN_SLUG];
const PLUGIN_ROOT_SEGMENTS = [
[CURRENT_PLUGIN_SLUG],
[CURRENT_PLUGIN_HANDLE],
['marketplace', CURRENT_PLUGIN_SLUG],
[LEGACY_PLUGIN_SLUG],
[LEGACY_PLUGIN_HANDLE],
['marketplace', LEGACY_PLUGIN_SLUG],
];
/**
* Resolve the ECC source root directory.
*
* Tries, in order:
* 1. CLAUDE_PLUGIN_ROOT env var (set by Claude Code for hooks, or by user)
* 2. Standard install location (~/.claude/) — when scripts exist there
* 3. Exact legacy plugin roots under ~/.claude/plugins/
* 4. Plugin cache auto-detection — scans ~/.claude/plugins/cache/everything-claude-code/
* 3. Known plugin roots under ~/.claude/plugins/ (current + legacy slugs)
* 4. Plugin cache auto-detection — scans ~/.claude/plugins/cache/{ecc,everything-claude-code}/
* 5. Fallback to ~/.claude/ (original behaviour)
*
* @param {object} [options]
@@ -41,11 +55,9 @@ function resolveEccRoot(options = {}) {
// Exact legacy plugin install locations. These preserve backwards
// compatibility without scanning arbitrary plugin trees.
const legacyPluginRoots = [
path.join(claudeDir, 'plugins', 'everything-claude-code'),
path.join(claudeDir, 'plugins', 'everything-claude-code@everything-claude-code'),
path.join(claudeDir, 'plugins', 'marketplace', 'everything-claude-code')
];
const legacyPluginRoots = PLUGIN_ROOT_SEGMENTS.map((segments) =>
path.join(claudeDir, 'plugins', ...segments)
);
for (const candidate of legacyPluginRoots) {
if (fs.existsSync(path.join(candidate, probe))) {
@@ -56,25 +68,27 @@ function resolveEccRoot(options = {}) {
// Plugin cache — Claude Code stores marketplace plugins under
// ~/.claude/plugins/cache/<plugin-name>/<org>/<version>/
try {
const cacheBase = path.join(claudeDir, 'plugins', 'cache', 'everything-claude-code');
const orgDirs = fs.readdirSync(cacheBase, { withFileTypes: true });
for (const slug of PLUGIN_CACHE_SLUGS) {
const cacheBase = path.join(claudeDir, 'plugins', 'cache', slug);
const orgDirs = fs.readdirSync(cacheBase, { withFileTypes: true });
for (const orgEntry of orgDirs) {
if (!orgEntry.isDirectory()) continue;
const orgPath = path.join(cacheBase, orgEntry.name);
for (const orgEntry of orgDirs) {
if (!orgEntry.isDirectory()) continue;
const orgPath = path.join(cacheBase, orgEntry.name);
let versionDirs;
try {
versionDirs = fs.readdirSync(orgPath, { withFileTypes: true });
} catch {
continue;
}
let versionDirs;
try {
versionDirs = fs.readdirSync(orgPath, { withFileTypes: true });
} catch {
continue;
}
for (const verEntry of versionDirs) {
if (!verEntry.isDirectory()) continue;
const candidate = path.join(orgPath, verEntry.name);
if (fs.existsSync(path.join(candidate, probe))) {
return candidate;
for (const verEntry of versionDirs) {
if (!verEntry.isDirectory()) continue;
const candidate = path.join(orgPath, verEntry.name);
if (fs.existsSync(path.join(candidate, probe))) {
return candidate;
}
}
}
}
@@ -96,7 +110,7 @@ function resolveEccRoot(options = {}) {
* const _r = <paste INLINE_RESOLVE>;
* const sm = require(_r + '/scripts/lib/session-manager');
*/
const INLINE_RESOLVE = `(()=>{var e=process.env.CLAUDE_PLUGIN_ROOT;if(e&&e.trim())return e.trim();var p=require('path'),f=require('fs'),h=require('os').homedir(),d=p.join(h,'.claude'),q=p.join('scripts','lib','utils.js');if(f.existsSync(p.join(d,q)))return d;for(var l of [p.join(d,'plugins','everything-claude-code'),p.join(d,'plugins','everything-claude-code@everything-claude-code'),p.join(d,'plugins','marketplace','everything-claude-code')])if(f.existsSync(p.join(l,q)))return l;try{var b=p.join(d,'plugins','cache','everything-claude-code');for(var o of f.readdirSync(b,{withFileTypes:true})){if(!o.isDirectory())continue;for(var v of f.readdirSync(p.join(b,o.name),{withFileTypes:true})){if(!v.isDirectory())continue;var c=p.join(b,o.name,v.name);if(f.existsSync(p.join(c,q)))return c}}}catch(x){}return d})()`;
const INLINE_RESOLVE = `(()=>{var e=process.env.CLAUDE_PLUGIN_ROOT;if(e&&e.trim())return e.trim();var p=require('path'),f=require('fs'),h=require('os').homedir(),d=p.join(h,'.claude'),q=p.join('scripts','lib','utils.js');if(f.existsSync(p.join(d,q)))return d;for(var s of ${JSON.stringify(PLUGIN_ROOT_SEGMENTS)}){var l=p.join(d,'plugins',...s);if(f.existsSync(p.join(l,q)))return l}try{for(var g of ${JSON.stringify(PLUGIN_CACHE_SLUGS)}){var b=p.join(d,'plugins','cache',g);for(var o of f.readdirSync(b,{withFileTypes:true})){if(!o.isDirectory())continue;for(var v of f.readdirSync(p.join(b,o.name),{withFileTypes:true})){if(!v.isDirectory())continue;var c=p.join(b,o.name,v.name);if(f.existsSync(p.join(c,q)))return c}}}}catch(x){}return d})()`;
module.exports = {
resolveEccRoot,