fix: retire legacy command shims from default surface

This commit is contained in:
Affaan Mustafa
2026-04-29 23:47:19 -04:00
committed by Affaan Mustafa
parent affbd33485
commit 06f9eca8e2
40 changed files with 135 additions and 102 deletions

View File

@@ -10,6 +10,22 @@ const path = require('path');
const REPO_ROOT = path.join(__dirname, '..', '..');
const AGENT_YAML_PATH = path.join(REPO_ROOT, 'agent.yaml');
const COMMANDS_DIR = path.join(REPO_ROOT, 'commands');
const LEGACY_COMMANDS_DIR = path.join(REPO_ROOT, 'legacy-command-shims', 'commands');
const RETIRED_LEGACY_SHIMS = [
'agent-sort',
'claw',
'context-budget',
'devfleet',
'docs',
'e2e',
'eval',
'orchestrate',
'prompt-optimize',
'rules-distill',
'tdd',
'verify',
];
function extractTopLevelList(yamlSource, key) {
const lines = yamlSource.replace(/^\uFEFF/, '').split(/\r?\n/);
@@ -70,6 +86,22 @@ function run() {
assert.deepStrictEqual(declaredCommands, actualCommands);
})) passed++; else failed++;
if (test('retired legacy slash-entry shims are not in the default commands export', () => {
const defaultShimCommands = RETIRED_LEGACY_SHIMS
.filter(command => actualCommands.includes(command));
assert.deepStrictEqual(defaultShimCommands, []);
})) passed++; else failed++;
if (test('retired legacy slash-entry shims remain available from the opt-in archive', () => {
const archivedCommands = fs.readdirSync(LEGACY_COMMANDS_DIR)
.filter(file => file.endsWith('.md'))
.map(file => path.basename(file, '.md'))
.sort();
assert.deepStrictEqual(archivedCommands, RETIRED_LEGACY_SHIMS);
})) passed++; else failed++;
console.log(`\nPassed: ${passed}`);
console.log(`Failed: ${failed}`);

View File

@@ -59,7 +59,7 @@ test('parseWorkerTask extracts objective and seeded overlays', () => {
'',
'## Seeded Local Overlays',
'- `scripts/orchestrate-worktrees.js`',
'- `commands/orchestrate.md`',
'- `commands/multi-workflow.md`',
'',
'## Objective',
'Verify seeded files and summarize status.'
@@ -67,7 +67,7 @@ test('parseWorkerTask extracts objective and seeded overlays', () => {
assert.deepStrictEqual(task.seedPaths, [
'scripts/orchestrate-worktrees.js',
'commands/orchestrate.md'
'commands/multi-workflow.md'
]);
assert.strictEqual(task.objective, 'Verify seeded files and summarize status.');
});

View File

@@ -299,7 +299,7 @@ test('executePlan rolls back partial setup when orchestration fails mid-run', ()
workerName: 'Docs',
workerSlug: 'docs',
worktreePath: '/tmp/ecc-rollback-docs',
seedPaths: ['commands/orchestrate.md'],
seedPaths: ['commands/multi-workflow.md'],
gitArgs: ['worktree', 'add', '-b', 'orchestrator-rollback-test-docs', '/tmp/ecc-rollback-docs', 'HEAD'],
launchCommand: 'echo run'
}

View File

@@ -84,14 +84,14 @@ function runTests() {
const projectRoot = createTempDir('trae-project-');
try {
const preexistingCommandPath = path.join(projectRoot, '.trae', 'commands', 'e2e.md');
const preexistingCommandPath = path.join(projectRoot, '.trae', 'commands', 'quality-gate.md');
fs.mkdirSync(path.dirname(preexistingCommandPath), { recursive: true });
fs.writeFileSync(preexistingCommandPath, 'user owned command\n');
runInstall({ cwd: projectRoot, homeDir });
const manifestLines = readManifestLines(projectRoot);
assert.ok(!manifestLines.includes('commands/e2e.md'), 'Preexisting file should not be recorded in manifest');
assert.ok(!manifestLines.includes('commands/quality-gate.md'), 'Preexisting file should not be recorded in manifest');
runUninstall({ cwd: projectRoot, homeDir });
@@ -131,13 +131,13 @@ function runTests() {
try {
runInstall({ cwd: projectRoot, homeDir });
const managedCommandPath = path.join(projectRoot, '.trae', 'commands', 'e2e.md');
const managedCommandPath = path.join(projectRoot, '.trae', 'commands', 'quality-gate.md');
fs.rmSync(managedCommandPath);
runInstall({ cwd: projectRoot, homeDir });
const manifestLines = readManifestLines(projectRoot);
const entryCount = manifestLines.filter((line) => line === 'commands/e2e.md').length;
const entryCount = manifestLines.filter((line) => line === 'commands/quality-gate.md').length;
assert.strictEqual(entryCount, 1, 'Managed file should appear once in manifest after reinstall');
assert.ok(fs.existsSync(managedCommandPath), 'Managed file should be recreated on reinstall');