mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-20 19:29:58 +08:00
feat(install-targets): add claude-project (per-project Claude Code) adapter
Completes the install-target matrix for Claude Code. Until now, ECC's Claude support was home-scope only (~/.claude/) via the `claude` target. This adds a project-scope counterpart (./.claude/) via a new `claude-project` target so teams can install ECC per-repo without contaminating ~/.claude/ — matching the existing project-scope adapters for Cursor, Antigravity, Gemini, CodeBuddy, Joycode, and Zed. Symmetric with `claude`: - Same namespace under rules/ecc and skills/ecc - Same docs/<locale> handling for --locale - Same hooks placeholder substitution for hooks.json - Reuses claude-home's destination-mapping logic 1:1 Use cases: - Monorepos with multiple Flow-managed projects - Teams that want ECC scoped per-project without touching ~/.claude/ - Per-project skill/rule isolation when global install isn't desirable No breaking change: existing --target claude continues to route to claude-home (user-scope) unchanged. New target is opt-in. Tests ----- - 4 new tests in tests/lib/install-targets.test.js (root resolution, lookup-by-id, plan parity with claude, foreign-path filtering) - All install-target regression guards (schema enum / SUPPORTED_INSTALL_TARGETS) still pass - End-to-end smoke: `--target claude-project --profile minimal --dry-run` emits 359 ops with destinations rooted at <projectRoot>/.claude/ (parity with --target claude which emits 359 ops rooted at ~/.claude/)
This commit is contained in:
committed by
Affaan Mustafa
parent
27e4036075
commit
7004a66243
@@ -37,6 +37,7 @@ function runTests() {
|
||||
const adapters = listInstallTargetAdapters();
|
||||
const targets = adapters.map(adapter => adapter.target);
|
||||
assert.ok(targets.includes('claude'), 'Should include claude target');
|
||||
assert.ok(targets.includes('claude-project'), 'Should include claude-project target');
|
||||
assert.ok(targets.includes('cursor'), 'Should include cursor target');
|
||||
assert.ok(targets.includes('antigravity'), 'Should include antigravity target');
|
||||
assert.ok(targets.includes('codex'), 'Should include codex target');
|
||||
@@ -865,6 +866,99 @@ function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('resolves claude-project adapter root and install-state path from project root', () => {
|
||||
const adapter = getInstallTargetAdapter('claude-project');
|
||||
const projectRoot = '/workspace/app';
|
||||
const root = adapter.resolveRoot({ projectRoot });
|
||||
const statePath = adapter.getInstallStatePath({ projectRoot });
|
||||
|
||||
assert.strictEqual(adapter.id, 'claude-project');
|
||||
assert.strictEqual(adapter.target, 'claude-project');
|
||||
assert.strictEqual(adapter.kind, 'project');
|
||||
assert.strictEqual(root, path.join(projectRoot, '.claude'));
|
||||
assert.strictEqual(statePath, path.join(projectRoot, '.claude', 'ecc', 'install-state.json'));
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('claude-project adapter supports lookup by target and adapter id', () => {
|
||||
const byTarget = getInstallTargetAdapter('claude-project');
|
||||
const byId = getInstallTargetAdapter('claude-project');
|
||||
|
||||
assert.strictEqual(byTarget.id, 'claude-project');
|
||||
assert.strictEqual(byId.id, 'claude-project');
|
||||
assert.ok(byTarget.supports('claude-project'));
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('plans claude-project rules and skills under project-scope ECC-managed subdirectories', () => {
|
||||
const repoRoot = path.join(__dirname, '..', '..');
|
||||
const projectRoot = '/workspace/app';
|
||||
|
||||
const plan = planInstallTargetScaffold({
|
||||
target: 'claude-project',
|
||||
repoRoot,
|
||||
projectRoot,
|
||||
modules: [
|
||||
{
|
||||
id: 'rules-core',
|
||||
paths: ['rules'],
|
||||
},
|
||||
{
|
||||
id: 'workflow-quality',
|
||||
paths: ['skills/tdd-workflow'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.strictEqual(plan.adapter.id, 'claude-project');
|
||||
assert.strictEqual(plan.targetRoot, path.join(projectRoot, '.claude'));
|
||||
assert.strictEqual(plan.installStatePath, path.join(projectRoot, '.claude', 'ecc', 'install-state.json'));
|
||||
assert.ok(
|
||||
plan.operations.some(operation => (
|
||||
normalizedRelativePath(operation.sourceRelativePath) === 'rules'
|
||||
&& operation.destinationPath === path.join(projectRoot, '.claude', 'rules', 'ecc')
|
||||
)),
|
||||
'Should install bundled rules under project-scope rules/ecc'
|
||||
);
|
||||
assert.ok(
|
||||
plan.operations.some(operation => (
|
||||
normalizedRelativePath(operation.sourceRelativePath) === 'skills/tdd-workflow'
|
||||
&& operation.destinationPath === path.join(projectRoot, '.claude', 'skills', 'ecc', 'tdd-workflow')
|
||||
)),
|
||||
'Should install bundled skills under project-scope skills/ecc'
|
||||
);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('claude-project skips foreign platform source paths', () => {
|
||||
const repoRoot = path.join(__dirname, '..', '..');
|
||||
const projectRoot = '/workspace/app';
|
||||
|
||||
const plan = planInstallTargetScaffold({
|
||||
target: 'claude-project',
|
||||
repoRoot,
|
||||
projectRoot,
|
||||
modules: [
|
||||
{
|
||||
id: 'platform-configs',
|
||||
paths: ['.cursor', '.zed', 'rules'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
!plan.operations.some(operation => (
|
||||
normalizedRelativePath(operation.sourceRelativePath) === '.cursor'
|
||||
|| normalizedRelativePath(operation.sourceRelativePath).startsWith('.cursor/')
|
||||
)),
|
||||
'Should skip foreign Cursor platform paths'
|
||||
);
|
||||
assert.ok(
|
||||
!plan.operations.some(operation => (
|
||||
normalizedRelativePath(operation.sourceRelativePath) === '.zed'
|
||||
|| normalizedRelativePath(operation.sourceRelativePath).startsWith('.zed/')
|
||||
)),
|
||||
'Should skip foreign Zed platform paths'
|
||||
);
|
||||
})) passed++; else failed++;
|
||||
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user