feat: add JoyCode install target

This commit is contained in:
Affaan Mustafa
2026-05-11 10:58:24 -04:00
committed by Affaan Mustafa
parent fb9a8f2973
commit c7c1e36625
12 changed files with 275 additions and 21 deletions

View File

@@ -43,6 +43,7 @@ function runTests() {
assert.ok(targets.includes('gemini'), 'Should include gemini target');
assert.ok(targets.includes('opencode'), 'Should include opencode target');
assert.ok(targets.includes('codebuddy'), 'Should include codebuddy target');
assert.ok(targets.includes('joycode'), 'Should include joycode target');
})) passed++; else failed++;
if (test('resolves cursor adapter root and install-state path from project root', () => {
@@ -501,6 +502,29 @@ function runTests() {
assert.ok(byTarget.supports('codebuddy-project'));
})) passed++; else failed++;
if (test('resolves joycode adapter root and install-state path from project root', () => {
const adapter = getInstallTargetAdapter('joycode');
const projectRoot = '/workspace/app';
const root = adapter.resolveRoot({ projectRoot });
const statePath = adapter.getInstallStatePath({ projectRoot });
assert.strictEqual(adapter.id, 'joycode-project');
assert.strictEqual(adapter.target, 'joycode');
assert.strictEqual(adapter.kind, 'project');
assert.strictEqual(root, path.join(projectRoot, '.joycode'));
assert.strictEqual(statePath, path.join(projectRoot, '.joycode', 'ecc-install-state.json'));
})) passed++; else failed++;
if (test('joycode adapter supports lookup by target and adapter id', () => {
const byTarget = getInstallTargetAdapter('joycode');
const byId = getInstallTargetAdapter('joycode-project');
assert.strictEqual(byTarget.id, 'joycode-project');
assert.strictEqual(byId.id, 'joycode-project');
assert.ok(byTarget.supports('joycode'));
assert.ok(byTarget.supports('joycode-project'));
})) passed++; else failed++;
if (test('plans codebuddy rules with flat namespaced filenames', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';
@@ -536,6 +560,68 @@ function runTests() {
);
})) passed++; else failed++;
if (test('plans joycode commands, agents, skills, and flattened rules', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';
const plan = planInstallTargetScaffold({
target: 'joycode',
repoRoot,
projectRoot,
modules: [
{
id: 'rules-core',
paths: ['rules'],
},
{
id: 'agents-core',
paths: ['agents'],
},
{
id: 'commands-core',
paths: ['commands'],
},
{
id: 'workflow-quality',
paths: ['skills/tdd-workflow'],
},
],
});
assert.strictEqual(plan.adapter.id, 'joycode-project');
assert.strictEqual(plan.targetRoot, path.join(projectRoot, '.joycode'));
assert.strictEqual(plan.installStatePath, path.join(projectRoot, '.joycode', 'ecc-install-state.json'));
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'rules/common/coding-style.md'
&& operation.destinationPath === path.join(projectRoot, '.joycode', 'rules', 'common-coding-style.md')
)),
'Should flatten common rules into namespaced files for joycode'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'agents'
&& operation.destinationPath === path.join(projectRoot, '.joycode', 'agents')
)),
'Should install agents under .joycode/agents'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'commands'
&& operation.destinationPath === path.join(projectRoot, '.joycode', 'commands')
)),
'Should install commands under .joycode/commands'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'skills/tdd-workflow'
&& operation.destinationPath === path.join(projectRoot, '.joycode', 'skills', 'tdd-workflow')
)),
'Should install skills under .joycode/skills'
);
})) passed++; else failed++;
if (test('exposes validate and planOperations on codebuddy adapter', () => {
const codebuddyAdapter = getInstallTargetAdapter('codebuddy');

View File

@@ -233,6 +233,40 @@ function runTests() {
}
})) passed++; else failed++;
if (test('installs JoyCode profile through managed install-state', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');
try {
const result = run(['--target', 'joycode', '--profile', 'minimal'], { cwd: projectDir, homeDir });
assert.strictEqual(result.code, 0, result.stderr);
assert.ok(fs.existsSync(path.join(projectDir, '.joycode', 'rules', 'common-coding-style.md')));
assert.ok(!fs.existsSync(path.join(projectDir, '.joycode', 'rules', 'common', 'coding-style.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.joycode', 'agents', 'architect.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.joycode', 'commands', 'plan.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.joycode', 'skills', 'tdd-workflow', 'SKILL.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.joycode', 'mcp-configs', 'mcp-servers.json')));
assert.ok(!fs.existsSync(path.join(projectDir, '.joycode', 'hooks')));
const statePath = path.join(projectDir, '.joycode', 'ecc-install-state.json');
const state = readJson(statePath);
assert.strictEqual(state.target.id, 'joycode-project');
assert.deepStrictEqual(state.request.modules, []);
assert.strictEqual(state.request.profile, 'minimal');
assert.ok(state.resolution.selectedModules.includes('workflow-quality'));
assert.ok(
state.operations.some(operation => (
operation.destinationPath.endsWith(path.join('.joycode', 'skills', 'tdd-workflow', 'SKILL.md'))
)),
'Should record JoyCode skill file operation'
);
} finally {
cleanup(homeDir);
cleanup(projectDir);
}
})) passed++; else failed++;
if (test('supports dry-run without mutating the target project', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');