feat: add zed install target

This commit is contained in:
Affaan Mustafa
2026-05-17 07:06:49 -04:00
parent fb6d4a7104
commit 2371a3cf05
17 changed files with 361 additions and 37 deletions

View File

@@ -43,7 +43,7 @@ test('adapter compliance matrix covers the required harness surfaces', () => {
'OpenCode',
'Cursor',
'Gemini',
'Zed-adjacent',
'Zed',
'dmux',
'Orca',
'Superset',
@@ -57,6 +57,14 @@ test('adapter compliance matrix covers the required harness surfaces', () => {
test('adapter compliance source data validates required evidence fields', () => {
assert.deepStrictEqual(validateAdapterRecords(), []);
const zedRecord = ADAPTER_RECORDS.find(record => record.id === 'zed');
assert.ok(zedRecord, 'Expected Zed adapter record');
assert.strictEqual(zedRecord.state, 'Adapter-backed');
assert.ok(
zedRecord.install_or_onramp.includes('`./install.sh --profile minimal --target zed`'),
'Expected Zed installer onramp'
);
for (const record of ADAPTER_RECORDS) {
assert.ok(record.install_or_onramp.length > 0, `${record.id} needs an install or onramp`);
assert.ok(record.verification_commands.length > 0, `${record.id} needs verification commands`);

View File

@@ -280,6 +280,32 @@ function runTests() {
);
})) passed++; else failed++;
if (test('resolves Zed minimal profile with project settings and without hooks', () => {
const projectRoot = '/workspace/zed-app';
const plan = resolveInstallPlan({
profileId: 'minimal',
target: 'zed',
projectRoot,
});
assert.deepStrictEqual(
plan.selectedModuleIds,
['rules-core', 'agents-core', 'commands-core', 'platform-configs', 'workflow-quality']
);
assert.deepStrictEqual(plan.skippedModuleIds, []);
assert.strictEqual(plan.targetAdapterId, 'zed-project');
assert.strictEqual(plan.targetRoot, path.join(projectRoot, '.zed'));
assert.ok(
plan.operations.some(operation => operation.sourceRelativePath === '.zed'),
'Should install Zed native project settings'
);
assert.ok(
!plan.selectedModuleIds.includes('hooks-runtime')
&& !plan.operations.some(operation => operation.moduleId === 'hooks-runtime'),
'Zed minimal profile should not install hook runtime files'
);
})) passed++; else failed++;
if (test('resolves machine-learning component with workflow dependencies', () => {
const plan = resolveInstallPlan({
includeComponentIds: ['capability:machine-learning'],

View File

@@ -45,6 +45,7 @@ function runTests() {
assert.ok(targets.includes('codebuddy'), 'Should include codebuddy target');
assert.ok(targets.includes('joycode'), 'Should include joycode target');
assert.ok(targets.includes('qwen'), 'Should include qwen target');
assert.ok(targets.includes('zed'), 'Should include zed target');
})) passed++; else failed++;
if (test('resolves cursor adapter root and install-state path from project root', () => {
@@ -549,6 +550,29 @@ function runTests() {
assert.ok(byTarget.supports('qwen-home'));
})) passed++; else failed++;
if (test('resolves zed adapter root and install-state path from project root', () => {
const adapter = getInstallTargetAdapter('zed');
const projectRoot = '/workspace/app';
const root = adapter.resolveRoot({ projectRoot });
const statePath = adapter.getInstallStatePath({ projectRoot });
assert.strictEqual(adapter.id, 'zed-project');
assert.strictEqual(adapter.target, 'zed');
assert.strictEqual(adapter.kind, 'project');
assert.strictEqual(root, path.join(projectRoot, '.zed'));
assert.strictEqual(statePath, path.join(projectRoot, '.zed', 'ecc-install-state.json'));
})) passed++; else failed++;
if (test('zed adapter supports lookup by target and adapter id', () => {
const byTarget = getInstallTargetAdapter('zed');
const byId = getInstallTargetAdapter('zed-project');
assert.strictEqual(byTarget.id, 'zed-project');
assert.strictEqual(byId.id, 'zed-project');
assert.ok(byTarget.supports('zed'));
assert.ok(byTarget.supports('zed-project'));
})) passed++; else failed++;
if (test('plans codebuddy rules with flat namespaced filenames', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';
@@ -709,6 +733,83 @@ function runTests() {
);
})) passed++; else failed++;
if (test('plans zed project settings, commands, agents, skills, and flattened rules', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';
const plan = planInstallTargetScaffold({
target: 'zed',
repoRoot,
projectRoot,
modules: [
{
id: 'rules-core',
paths: ['rules'],
},
{
id: 'agents-core',
paths: ['agents'],
},
{
id: 'commands-core',
paths: ['commands'],
},
{
id: 'platform-configs',
paths: ['.zed', '.cursor', 'mcp-configs'],
},
{
id: 'workflow-quality',
paths: ['skills/tdd-workflow'],
},
],
});
assert.strictEqual(plan.adapter.id, 'zed-project');
assert.strictEqual(plan.targetRoot, path.join(projectRoot, '.zed'));
assert.strictEqual(plan.installStatePath, path.join(projectRoot, '.zed', 'ecc-install-state.json'));
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === '.zed'
&& operation.destinationPath === path.join(projectRoot, '.zed')
&& operation.strategy === 'sync-root-children'
)),
'Should sync Zed native project settings into .zed'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'rules/common/coding-style.md'
&& operation.destinationPath === path.join(projectRoot, '.zed', 'rules', 'common-coding-style.md')
)),
'Should flatten common rules into namespaced files for zed'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'agents'
&& operation.destinationPath === path.join(projectRoot, '.zed', 'agents')
)),
'Should install agents under .zed/agents'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'commands'
&& operation.destinationPath === path.join(projectRoot, '.zed', 'commands')
)),
'Should install commands under .zed/commands'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'skills/tdd-workflow'
&& operation.destinationPath === path.join(projectRoot, '.zed', 'skills', 'tdd-workflow')
)),
'Should install skills under .zed/skills'
);
assert.ok(
!plan.operations.some(operation => normalizedRelativePath(operation.sourceRelativePath) === '.cursor'),
'Should skip foreign Cursor platform config paths'
);
})) passed++; else failed++;
if (test('exposes validate and planOperations on codebuddy adapter', () => {
const codebuddyAdapter = getInstallTargetAdapter('codebuddy');

View File

@@ -480,6 +480,7 @@ function runTests() {
assert.ok(result.includes('--with'), 'Help should mention --with');
assert.ok(result.includes('--without'), 'Help should mention --without');
assert.ok(result.includes('component'), 'Help should describe components');
assert.ok(result.includes('zed - Install project settings'), 'Help should describe Zed target');
})) passed++; else failed++;
// ─── End-to-End Dry-Run ───
@@ -515,6 +516,45 @@ function runTests() {
}
})) passed++; else failed++;
if (test('end-to-end: --profile minimal --target zed --dry-run --json plans project adapter', () => {
const { execFileSync } = require('child_process');
const scriptPath = path.join(__dirname, '..', '..', 'scripts', 'install-apply.js');
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'selective-e2e-'));
const projectDir = fs.mkdtempSync(path.join(os.tmpdir(), 'selective-e2e-zed-project-'));
try {
const result = execFileSync('node', [
scriptPath,
'--profile', 'minimal',
'--target', 'zed',
'--dry-run',
'--json',
], {
cwd: projectDir,
env: { ...process.env, HOME: homeDir },
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'pipe'],
});
const parsed = JSON.parse(result);
assert.strictEqual(parsed.dryRun, true);
assert.strictEqual(parsed.plan.target, 'zed');
assert.strictEqual(parsed.plan.adapter.id, 'zed-project');
assert.strictEqual(parsed.plan.installRoot, path.join(fs.realpathSync(projectDir), '.zed'));
assert.ok(
parsed.plan.operations.some(operation => operation.sourceRelativePath === '.zed/settings.json'),
'Should include Zed native settings operation'
);
assert.ok(
!parsed.plan.operations.some(operation => operation.moduleId === 'hooks-runtime'),
'Zed minimal dry-run should not install hook runtime files'
);
} finally {
fs.rmSync(homeDir, { recursive: true, force: true });
fs.rmSync(projectDir, { recursive: true, force: true });
}
})) passed++; else failed++;
if (test('end-to-end: --with lang:python --with agent:security-reviewer --dry-run', () => {
const { execFileSync } = require('child_process');
const scriptPath = path.join(__dirname, '..', '..', 'scripts', 'install-apply.js');