feat: add Qwen install target

This commit is contained in:
Affaan Mustafa
2026-05-11 11:15:45 -04:00
committed by Affaan Mustafa
parent c7c1e36625
commit e70ef4a2ff
16 changed files with 284 additions and 21 deletions

View File

@@ -246,6 +246,31 @@ function runTests() {
assert.ok(plan.operations.length > 0, 'Should include install operations');
})) passed++; else failed++;
if (test('resolves Qwen minimal profile while leaving hooks out', () => {
const homeDir = '/Users/example';
const plan = resolveInstallPlan({
profileId: 'minimal',
target: 'qwen',
homeDir,
});
assert.deepStrictEqual(
plan.selectedModuleIds,
['rules-core', 'agents-core', 'commands-core', 'platform-configs', 'workflow-quality']
);
assert.deepStrictEqual(plan.skippedModuleIds, []);
assert.strictEqual(plan.targetAdapterId, 'qwen-home');
assert.strictEqual(plan.targetRoot, path.join(homeDir, '.qwen'));
assert.ok(
plan.operations.some(operation => operation.sourceRelativePath === '.qwen'),
'Should install Qwen native config'
);
assert.ok(
!plan.operations.some(operation => operation.destinationPath.includes(`${path.sep}hooks`)),
'Qwen minimal profile should not install hook runtime files'
);
})) passed++; else failed++;
if (test('resolves explicit modules with dependency expansion', () => {
const plan = resolveInstallPlan({ moduleIds: ['security'] });
assert.ok(plan.selectedModuleIds.includes('security'), 'Should include requested module');

View File

@@ -44,6 +44,7 @@ function runTests() {
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');
assert.ok(targets.includes('qwen'), 'Should include qwen target');
})) passed++; else failed++;
if (test('resolves cursor adapter root and install-state path from project root', () => {
@@ -525,6 +526,29 @@ function runTests() {
assert.ok(byTarget.supports('joycode-project'));
})) passed++; else failed++;
if (test('resolves qwen adapter root and install-state path from home dir', () => {
const adapter = getInstallTargetAdapter('qwen');
const homeDir = '/Users/example';
const root = adapter.resolveRoot({ homeDir });
const statePath = adapter.getInstallStatePath({ homeDir });
assert.strictEqual(adapter.id, 'qwen-home');
assert.strictEqual(adapter.target, 'qwen');
assert.strictEqual(adapter.kind, 'home');
assert.strictEqual(root, path.join(homeDir, '.qwen'));
assert.strictEqual(statePath, path.join(homeDir, '.qwen', 'ecc-install-state.json'));
})) passed++; else failed++;
if (test('qwen adapter supports lookup by target and adapter id', () => {
const byTarget = getInstallTargetAdapter('qwen');
const byId = getInstallTargetAdapter('qwen-home');
assert.strictEqual(byTarget.id, 'qwen-home');
assert.strictEqual(byId.id, 'qwen-home');
assert.ok(byTarget.supports('qwen'));
assert.ok(byTarget.supports('qwen-home'));
})) passed++; else failed++;
if (test('plans codebuddy rules with flat namespaced filenames', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';
@@ -622,6 +646,69 @@ function runTests() {
);
})) passed++; else failed++;
if (test('plans qwen commands, agents, skills, and native config under home root', () => {
const repoRoot = path.join(__dirname, '..', '..');
const homeDir = '/Users/example';
const plan = planInstallTargetScaffold({
target: 'qwen',
repoRoot,
homeDir,
modules: [
{
id: 'rules-core',
paths: ['rules'],
},
{
id: 'agents-core',
paths: ['agents'],
},
{
id: 'commands-core',
paths: ['commands'],
},
{
id: 'platform-configs',
paths: ['.qwen', '.gemini', 'mcp-configs'],
},
{
id: 'workflow-quality',
paths: ['skills/tdd-workflow'],
},
],
});
assert.strictEqual(plan.adapter.id, 'qwen-home');
assert.strictEqual(plan.targetRoot, path.join(homeDir, '.qwen'));
assert.strictEqual(plan.installStatePath, path.join(homeDir, '.qwen', 'ecc-install-state.json'));
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'rules'
&& operation.destinationPath === path.join(homeDir, '.qwen', 'rules')
)),
'Should preserve rules under ~/.qwen/rules'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === '.qwen'
&& operation.destinationPath === path.join(homeDir, '.qwen')
&& operation.strategy === 'sync-root-children'
)),
'Should sync Qwen native config into ~/.qwen'
);
assert.ok(
!plan.operations.some(operation => normalizedRelativePath(operation.sourceRelativePath) === '.gemini'),
'Should skip foreign platform config paths'
);
assert.ok(
plan.operations.some(operation => (
normalizedRelativePath(operation.sourceRelativePath) === 'skills/tdd-workflow'
&& operation.destinationPath === path.join(homeDir, '.qwen', 'skills', 'tdd-workflow')
)),
'Should install skills under ~/.qwen/skills'
);
})) passed++; else failed++;
if (test('exposes validate and planOperations on codebuddy adapter', () => {
const codebuddyAdapter = getInstallTargetAdapter('codebuddy');

View File

@@ -267,6 +267,40 @@ function runTests() {
}
})) passed++; else failed++;
if (test('installs Qwen profile through managed home install-state', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');
try {
const result = run(['--target', 'qwen', '--profile', 'minimal'], { cwd: projectDir, homeDir });
assert.strictEqual(result.code, 0, result.stderr);
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'QWEN.md')));
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'rules', 'common', 'coding-style.md')));
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'agents', 'architect.md')));
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'commands', 'plan.md')));
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'skills', 'tdd-workflow', 'SKILL.md')));
assert.ok(fs.existsSync(path.join(homeDir, '.qwen', 'mcp-configs', 'mcp-servers.json')));
assert.ok(!fs.existsSync(path.join(homeDir, '.qwen', 'hooks')));
const statePath = path.join(homeDir, '.qwen', 'ecc-install-state.json');
const state = readJson(statePath);
assert.strictEqual(state.target.id, 'qwen-home');
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('.qwen', 'skills', 'tdd-workflow', 'SKILL.md'))
)),
'Should record Qwen 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-');

View File

@@ -111,6 +111,7 @@ function main() {
"scripts/catalog.js",
"scripts/consult.js",
".gemini/GEMINI.md",
".qwen/QWEN.md",
".claude-plugin/plugin.json",
".codex-plugin/plugin.json",
"schemas/install-state.schema.json",