The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix(qwen): adapt managed agents before ownership receipts
haelyra07c18210eb56
diff --cc docs/QWEN-GUIDE.mdindex 5a3ee0bd0,5a3ee0bd0..424a8d722--- a/docs/QWEN-GUIDE.md+++ b/docs/QWEN-GUIDE.md@@@ -52,3 -52,3 +52,12 @@@ That removes files recorded in `~/.qwen## ScopeThis target is intentionally narrower than stale PR #1352. It ports the maintainable Qwen install-target intent onto the current selective installer and avoids unverified hook-runtime claims until Qwen's hook/event contract is confirmed.++++## Agent adaptation++++Managed Qwen installs adapt canonical agent tools and colors before recording ownership.++Claude model tiers become `model: inherit`, so the configured Qwen session selects its provider.++Canonical agent files stay unchanged. The standalone `scripts/qwen-adapt-agents.js` utility++can adapt an explicitly selected, user-owned copy; use the managed installer for ECC-owned files++to keep repair and uninstall receipts consistent. Native subagent dispatch still requires++verification in the user's configured Qwen runtime.diff --cc package.jsonindex 38c067438,416c34a7d..5df2a79f2--- a/package.json+++ b/package.json@@@ -126,7 -124,7 +126,8 @@@"scripts/memory.js","scripts/memory-mcp.mjs","scripts/gemini-adapt-agents.js",+ "scripts/github-coordination.js",+ "scripts/qwen-adapt-agents.js","scripts/harness-adapter-compliance.js","scripts/harness-audit.js","scripts/eval-harness.js",diff --cc scripts/lib/install-targets/qwen-home.jsindex 96981d7b0,96981d7b0..a12fa746c--- a/scripts/lib/install-targets/qwen-home.js+++ b/scripts/lib/install-targets/qwen-home.js@@@ -1,6 -1,6 +1,6 @@@const { createInstallTargetAdapter } = require('./helpers');--module.exports = createInstallTargetAdapter({++const adapter = createInstallTargetAdapter({id: 'qwen-home',target: 'qwen',kind: 'home',@@@ -8,3 -8,3 +8,13 @@@installStatePathSegments: ['ecc-install-state.json'],nativeRootRelativePath: '.qwen',});++++module.exports = Object.freeze({++ ...adapter,++ planOperations(input = {}) {++ return adapter.planOperations(input).map(operation =>++ /^agents(?:[\\/]|$)/.test(operation.sourceRelativePath)++ ? { ...operation, contentTransform: 'qwen-agent-frontmatter' }++ : operation);++ },++});diff --cc scripts/lib/install/content-transform.jsindex d27e54c02,000000000..b1a16576dmode 100644,000000..100644--- a/scripts/lib/install/content-transform.js+++ b/scripts/lib/install/content-transform.js@@@ -1,52 -1,0 +1,55 @@@+'use strict';++const { adaptAntigravityAgent } = require('./antigravity-agent');+const { adaptCopilotAgent } = require('./copilot-agent');+const { disableOpenCodeHookPluginRegistration, getDisabledOpenCodePluginContent } = require('./hook-consent');++function rewriteCopilotWorkflowPaths(content, sourceRelativePath) {+ if (!/\.md$/i.test(sourceRelativePath)) return content;+ // Commands run from the installed project root. Rewrite only the supported+ // helper entrypoint, leaving unrelated project scripts and URLs untouched.+ return content.replace(/(^|[\s`"'(])scripts\/setup-package-manager\.js\b/g,+ '$1.github/ecc/scripts/setup-package-manager.js');+}++function transformInstallContent(operation, content) {+ if (!operation.contentTransform) {+ return content;+ }++ if (operation.contentTransform === 'qwen-agent-frontmatter') {++ return require('../../qwen-adapt-agents').adaptFrontmatter(content).text;++ }+ if (operation.contentTransform === 'antigravity-agent-frontmatter') {+ return adaptAntigravityAgent(content, operation.sourceRelativePath);+ }+ if (operation.contentTransform === 'copilot-agent-frontmatter') {+ return rewriteCopilotWorkflowPaths(adaptCopilotAgent(content, operation.sourceRelativePath), operation.sourceRelativePath);+ }+ if (operation.contentTransform === 'copilot-workflow-paths') {+ return rewriteCopilotWorkflowPaths(content, operation.sourceRelativePath);+ }+ if (operation.contentTransform === 'opencode-disable-ecc-hooks') {+ return transformInstallContent({ ...operation, contentTransform: 'opencode-home-skills-path' },+ disableOpenCodeHookPluginRegistration(content, operation.sourceRelativePath));+ }+ if (operation.contentTransform === 'opencode-disable-plugin-entrypoint') {+ return getDisabledOpenCodePluginContent();+ }+ if (operation.contentTransform === 'opencode-home-skills-path') {+ const config = JSON.parse(content);+ if (!Array.isArray(config?.skills?.paths) || !config.skills.paths.includes('../skills')) {+ return content;+ }+ const installedConfig = {+ ...config,+ skills: {+ ...config.skills,+ paths: config.skills.paths.map(skillPath => skillPath === '../skills' ? './skills' : skillPath),+ },+ };+ return `${JSON.stringify(installedConfig, null, 2)}\n`;+ }+ throw new Error(`Unknown install content transform: ${operation.contentTransform}`);+}++module.exports = { transformInstallContent };diff --cc scripts/qwen-adapt-agents.jsindex 000000000,2ba199d6b..9d8be0c37mode 000000,100644..100644--- a/scripts/qwen-adapt-agents.js+++ b/scripts/qwen-adapt-agents.js@@@ -1,0 -1,243 +1,253 @@@+ #!/usr/bin/env node+ 'use strict';++ const fs = require('fs');+ const path = require('path');+ const { normalizeAgentTools } = require('./lib/agent-tools');++ // Qwen Code is a Gemini CLI descendant, so most tool ids match Gemini's. Three+ // entries deliberately differ from gemini-adapt-agents.js:+ //+ // Edit -> edit (Gemini uses `replace`)+ // WebSearch -> web_search (Gemini uses `google_web_search`)+ // mcp__* -> unchanged (Gemini lowercases to mcp_server_tool; Qwen+ // keeps the double-underscore form)+ const TOOL_NAME_MAP = new Map([+ ['Read', 'read_file'],+ ['ReadFile', 'read_file'],+ ['NotebookRead', 'read_file'],+ ['Write', 'write_file'],+ ['Edit', 'edit'],+ ['MultiEdit', 'edit'],+ ['Bash', 'run_shell_command'],+ ['Grep', 'grep_search'],+ ['Glob', 'glob'],+ ['WebFetch', 'web_fetch'],+ // `web_search` is a deferred tool and only resolves for providers that offer a+ // search agent, so it is not universally present. Mapping it is still the+ // better default than dropping it: where the provider supports it the agent+ // gains the capability, and where it does not Qwen Code ignores an unresolvable+ // entry in `tools:` without warning.+ ['WebSearch', 'web_search'],+ ['TodoWrite', 'todo_write'],+ ['Task', 'agent'],+ ]);++ // Qwen Code supports `color:`, but only this palette. An unlisted value is+ // dropped at load time with a SUBAGENT_MANAGER warning, so remap where the+ // intent is clear and drop the rest rather than shipping a field that warns.+ const VALID_COLORS = new Set([+ 'red', 'blue', 'green', 'yellow', 'purple', 'orange', 'pink', 'cyan', 'auto',+ ]);+ const COLOR_MAP = new Map([['teal', 'cyan']]);++ function usage() {+ return [+ 'Adapt ECC agent frontmatter for Qwen Code.',+ '',+ 'Usage:',+ ' node scripts/qwen-adapt-agents.js [agents-dir]',+ '',+ "Defaults to .qwen/agents under the current working directory.",+ 'Rewrites tools: to Qwen Code tool ids and remaps color: values outside the',+ 'Qwen Code palette.',+ ].join('\n');+ }++ function parseArgs(argv) {+ if (argv.includes('--help') || argv.includes('-h')) {+ return { help: true };+ }++ const positional = [];+ for (const arg of argv) {+ if (arg.startsWith('-')) {+ // Reject rather than ignore. This script rewrites files in place, so+ // silently discarding an unrecognized flag would let `--dry-run` — or any+ // mistyped option — modify every installed agent and still exit 0.+ throw new Error(`Unknown option: ${arg}`);+ }+ positional.push(arg);+ }++ if (positional.length > 1) {+ throw new Error('Expected at most one agents directory argument');+ }++ return {+ help: false,+ agentsDir: path.resolve(positional[0] || path.join(process.cwd(), '.qwen', 'agents')),+ };+ }++ function ensureDirectory(dirPath) {+ if (!fs.existsSync(dirPath)) {+ throw new Error(`Agents directory not found: ${dirPath}`);+ }++ if (!fs.statSync(dirPath).isDirectory()) {+ throw new Error(`Expected a directory: ${dirPath}`);+ }+ }++ function parseToolList(line) {+ const match = line.match(/^\s*tools\s*:\s*(.*)$/);+ if (!match) {+ return null;+ }++ return normalizeAgentTools(match[1]);+ }++ function adaptToolName(toolName) {+ const mapped = TOOL_NAME_MAP.get(toolName);+ if (mapped) {+ return mapped;+ }++ // Qwen Code keeps the mcp__server__tool shape, so MCP entries pass through.+ return toolName;+ }++ function formatToolLine(tools) {+ // Comma-separated scalar rather than the JSON flow sequence+ // gemini-adapt-agents.js emits: Qwen Code parses both, and the scalar form is+ // what its own agent examples use.+ return `tools: ${tools.join(', ')}`;+ }++ function adaptColor(line) {+ const match = line.match(/^(\s*)color\s*:\s*(.+?)\s*$/);+ if (!match) {+ return null;+ }++ const value = match[2].replace(/^["']|["']$/g, '');+ if (VALID_COLORS.has(value)) {+ return { line, changed: false };+ }++ const remapped = COLOR_MAP.get(value);+ if (remapped) {+ return { line: `${match[1]}color: ${remapped}`, changed: true };+ }++ return { line: null, changed: true };+ }++ function adaptFrontmatter(text) {+ // Normalize CRLF first. Matching only LF would silently skip a Windows-saved+ // agent and report it as already compatible while `tools: Read` and+ // `color: teal` stayed in place. The original ending style is restored below.+ const usesCrlf = text.includes('\r\n');+ const source = usesCrlf ? text.replace(/\r\n/g, '\n') : text;++ const match = source.match(/^---\n([\s\S]*?)\n---(\n|$)/);+ if (!match) {+ return { text, changed: false };+ }++ let changed = false;+ const updatedLines = [];++ for (const line of match[1].split('\n')) {++ // Claude tiers are not Qwen provider IDs; inherit the configured session.++ if (/^model:\s*["']?(haiku|sonnet|opus)["']?\s*$/.test(line)) {++ updatedLines.push('model: inherit');++ changed = true;++ continue;++ }+ const color = adaptColor(line);+ if (color) {+ if (color.changed) {+ changed = true;+ }+ if (color.line !== null) {+ updatedLines.push(color.line);+ }+ continue;+ }++ const tools = parseToolList(line);+ if (tools) {+ const adaptedTools = [];+ const seen = new Set();++ for (const tool of tools.map(adaptToolName)) {+ if (!tool || seen.has(tool)) {+ continue;+ }+ seen.add(tool);+ adaptedTools.push(tool);+ }++ const updatedLine = formatToolLine(adaptedTools);+ if (updatedLine !== line) {+ changed = true;+ }+ updatedLines.push(updatedLine);+ continue;+ }++ updatedLines.push(line);+ }++ if (!changed) {+ return { text, changed: false };+ }++ const adapted = `---\n${updatedLines.join('\n')}\n---${match[2]}${source.slice(match[0].length)}`;++ return {+ text: usesCrlf ? adapted.replace(/\n/g, '\r\n') : adapted,+ changed: true,+ };+ }++ function adaptAgents(dirPath) {+ ensureDirectory(dirPath);++ let updated = 0;+ let unchanged = 0;++ for (const entry of fs.readdirSync(dirPath, { withFileTypes: true })) {+ if (!entry.isFile() || !entry.name.endsWith('.md')) {+ continue;+ }++ const filePath = path.join(dirPath, entry.name);+ const original = fs.readFileSync(filePath, 'utf8');+ const adapted = adaptFrontmatter(original);++ if (adapted.changed) {+ fs.writeFileSync(filePath, adapted.text);+ updated += 1;+ } else {+ unchanged += 1;+ }+ }++ return { updated, unchanged };+ }++ function main() {+ const options = parseArgs(process.argv.slice(2));+ if (options.help) {+ console.log(usage());+ return;+ }++ const result = adaptAgents(options.agentsDir);+ console.log(`Updated ${result.updated} agent file(s); ${result.unchanged} already compatible`);+ }+-try {- main();-} catch (error) {- console.error(error.message);- process.exit(1);++if (require.main === module) {++ try {++ main();++ } catch (error) {++ console.error(error.message);++ process.exit(1);++ }+ }++++module.exports = { adaptFrontmatter };diff --cc tests/scripts/qwen-adapt-agents.test.jsindex 000000000,1d71b2bed..792954d7bmode 000000,100644..100644--- a/tests/scripts/qwen-adapt-agents.test.js+++ b/tests/scripts/qwen-adapt-agents.test.js@@@ -1,0 -1,371 +1,373 @@@+ /**+ * Tests for scripts/qwen-adapt-agents.js+ */++ const assert = require('assert');+ const fs = require('fs');+ const os = require('os');+ const path = require('path');+ const { execFileSync } = require('child_process');++ const SCRIPT = path.join(__dirname, '..', '..', 'scripts', 'qwen-adapt-agents.js');++ function run(args = [], options = {}) {+ try {+ const stdout = execFileSync('node', [SCRIPT, ...args], {+ encoding: 'utf8',+ stdio: ['pipe', 'pipe', 'pipe'],+ cwd: options.cwd,+ timeout: 10000,+ });+ return { code: 0, stdout, stderr: '' };+ } catch (error) {+ return {+ code: error.status || 1,+ stdout: error.stdout || '',+ stderr: error.stderr || '',+ };+ }+ }++ function test(name, fn) {+ try {+ fn();+ console.log(` ✓ ${name}`);+ return true;+ } catch (error) {+ console.log(` ✗ ${name}`);+ console.log(` Error: ${error.message}`);+ return false;+ }+ }++ function createTempDir() {+ return fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-qwen-adapt-'));+ }++ function cleanupTempDir(dirPath) {+ fs.rmSync(dirPath, { recursive: true, force: true });+ }++ function writeAgent(dirPath, name, body) {+ fs.mkdirSync(dirPath, { recursive: true });+ fs.writeFileSync(path.join(dirPath, name), body);+ }++ function readAgent(dirPath, name) {+ return fs.readFileSync(path.join(dirPath, name), 'utf8');+ }++ function runTests() {+ console.log('\n=== Testing qwen-adapt-agents.js ===\n');++ let passed = 0;+ let failed = 0;++ if (test('shows help with an explicit help flag', () => {+ const result = run(['--help']);+ assert.strictEqual(result.code, 0, result.stderr);+ assert.ok(result.stdout.includes('Adapt ECC agent frontmatter for Qwen Code'));+ assert.ok(result.stdout.includes('Usage:'));+ })) passed++; else failed++;++ if (test('maps Claude Code tool names to Qwen Code ids', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'gan-planner.md',+ [+ '---',+ 'name: gan-planner',+ 'description: Planner agent',+ 'tools: [Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch]',+ 'model: opus',+ '---',+ '',+ 'Body'+ ].join('\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);+ assert.ok(result.stdout.includes('Updated 1 agent file(s)'));++ const updated = readAgent(agentsDir, 'gan-planner.md');+ // Edit maps to `edit`, not Gemini's `replace`. WebSearch maps to+ // `web_search`, not Gemini's `google_web_search`.+ assert.ok(updated.includes('tools: read_file, write_file, edit, run_shell_command, grep_search, glob, web_search, web_fetch'));++ assert.ok(updated.includes('model: inherit'));++ assert.ok(!updated.includes('model: opus'));+ assert.ok(!updated.includes('WebSearch'));+ assert.ok(!updated.includes('WebFetch'));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('preserves the mcp__server__tool shape', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'docs-lookup.md',+ [+ '---',+ 'name: docs-lookup',+ 'description: Documentation lookup agent',+ 'tools: Read, Grep, mcp__context7__resolve-library-id, mcp__context7__query-docs',+ 'model: sonnet',+ '---',+ '',+ 'Body'+ ].join('\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);++ const updated = readAgent(agentsDir, 'docs-lookup.md');+ // Unlike Gemini, which lowercases these to mcp_context7_resolve_library_id,+ // Qwen Code keeps the double-underscore form.+ assert.ok(updated.includes('tools: read_file, grep_search, mcp__context7__resolve-library-id, mcp__context7__query-docs'));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('deduplicates MultiEdit and Edit onto a single edit entry', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'code-simplifier.md',+ [+ '---',+ 'name: code-simplifier',+ 'description: Refactoring agent',+ 'tools: Read, Edit, MultiEdit, Write',+ '---',+ '',+ 'Body'+ ].join('\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);++ const updated = readAgent(agentsDir, 'code-simplifier.md');+ assert.ok(updated.includes('tools: read_file, edit, write_file'));+ assert.strictEqual(updated.split('edit').length - 1, 1);+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('remaps an out-of-palette color instead of dropping it', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'harness-optimizer.md',+ [+ '---',+ 'name: harness-optimizer',+ 'description: Harness tuning agent',+ 'tools: Read, Grep',+ 'color: teal',+ '---',+ '',+ 'Body'+ ].join('\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);++ // Qwen Code supports color:, but only red/blue/green/yellow/purple/orange/+ // pink/cyan/auto. An unlisted value is dropped at load time with a+ // warning, so teal is remapped to its nearest valid equivalent.+ const updated = readAgent(agentsDir, 'harness-optimizer.md');+ assert.ok(updated.includes('color: cyan'));+ assert.ok(!updated.includes('color: teal'));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('leaves an already-compatible agent untouched', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'security-reviewer.md',+ [+ '---',+ 'name: security-reviewer',+ 'description: Security agent',+ 'tools: read_file, grep_search',+ 'color: red',+ '---',+ '',+ 'Body'+ ].join('\n')+ );++ const before = readAgent(agentsDir, 'security-reviewer.md');+ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);+ assert.ok(result.stdout.includes('Updated 0 agent file(s)'));+ assert.ok(result.stdout.includes('1 already compatible'));+ // A color inside the palette and Qwen-native tool ids need no rewrite.+ assert.strictEqual(readAgent(agentsDir, 'security-reviewer.md'), before);+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('leaves the agent body untouched', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');+ const body = ['', 'Read the codebase, then Write a summary.', 'Use Bash only when needed.'].join('\n');++ try {+ writeAgent(+ agentsDir,+ 'code-explorer.md',+ ['---', 'name: code-explorer', 'tools: Read, Bash', '---', body].join('\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);++ const updated = readAgent(agentsDir, 'code-explorer.md');+ // Prose that names Claude tools must survive: only frontmatter is in scope.+ assert.ok(updated.endsWith(body));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('is idempotent on a second run', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'architect.md',+ ['---', 'name: architect', 'tools: Read, Grep, Glob', 'color: teal', '---', '', 'Body'].join('\n')+ );++ const first = run([agentsDir]);+ assert.strictEqual(first.code, 0, first.stderr);+ assert.ok(first.stdout.includes('Updated 1 agent file(s)'));+ const afterFirst = readAgent(agentsDir, 'architect.md');++ const second = run([agentsDir]);+ assert.strictEqual(second.code, 0, second.stderr);+ assert.ok(second.stdout.includes('Updated 0 agent file(s)'));+ assert.ok(second.stdout.includes('1 already compatible'));+ assert.strictEqual(readAgent(agentsDir, 'architect.md'), afterFirst);+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('defaults to the cwd .qwen/agents directory', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'planner.md',+ ['---', 'name: planner', 'tools: ["Read", "Grep", "Glob"]', '---', '', 'Body'].join('\n')+ );++ const result = run([], { cwd: tempDir });+ assert.strictEqual(result.code, 0, result.stderr);+ assert.ok(readAgent(agentsDir, 'planner.md').includes('tools: read_file, grep_search, glob'));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('fails with a clear error when the agents directory is missing', () => {+ const tempDir = createTempDir();++ try {+ const result = run([path.join(tempDir, 'nope')]);+ assert.strictEqual(result.code, 1);+ assert.ok(result.stderr.includes('Agents directory not found'));+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('adapts a CRLF agent and preserves its line endings', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'windows.md',+ ['---', 'name: windows', 'tools: Read, Bash', 'color: teal', '---', '', 'Body line'].join('\r\n')+ );++ const result = run([agentsDir]);+ assert.strictEqual(result.code, 0, result.stderr);+ // A CRLF-only match used to report "already compatible" while leaving+ // Read/Bash/teal in place, so assert the update actually happened.+ assert.ok(result.stdout.includes('Updated 1 agent file(s)'), result.stdout);++ const updated = readAgent(agentsDir, 'windows.md');+ assert.ok(updated.includes('tools: read_file, run_shell_command'));+ assert.ok(updated.includes('color: cyan'));+ assert.ok(!updated.includes('Read,'));+ assert.ok(updated.includes('\r\n'), 'CRLF endings were lost');+ assert.ok(!/[^\r]\n/.test(updated), 'found a bare LF in a CRLF file');+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ if (test('rejects an unknown flag without modifying any file', () => {+ const tempDir = createTempDir();+ const agentsDir = path.join(tempDir, '.qwen', 'agents');++ try {+ writeAgent(+ agentsDir,+ 'architect.md',+ ['---', 'name: architect', 'tools: Read, Bash', '---', '', 'Body'].join('\n')+ );+ const before = readAgent(agentsDir, 'architect.md');++ const result = run(['--dry-run', agentsDir]);+ assert.strictEqual(result.code, 1);+ assert.ok(result.stderr.includes('Unknown option: --dry-run'), result.stderr);+ // The point of rejecting: a flag that looks like a preview must not+ // rewrite installed agents and still exit 0.+ assert.strictEqual(readAgent(agentsDir, 'architect.md'), before);+ } finally {+ cleanupTempDir(tempDir);+ }+ })) passed++; else failed++;++ console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);+ process.exit(failed > 0 ? 1 : 0);+ }++ runTests();