54 lines
1.4 KiB
Markdown
54 lines
1.4 KiB
Markdown
|
|
# Task ID: 96
|
||
|
|
|
||
|
|
**Title:** Implement mcpctl delete stage Command
|
||
|
|
|
||
|
|
**Status:** cancelled
|
||
|
|
|
||
|
|
**Dependencies:** 79 ✓
|
||
|
|
|
||
|
|
**Priority:** low
|
||
|
|
|
||
|
|
**Description:** Add CLI command to delete a custom stage file (cannot delete built-ins).
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
Create `src/cli/src/commands/delete-stage.ts`:
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
import { Command } from 'commander';
|
||
|
|
import { unlink, access } from 'fs/promises';
|
||
|
|
import { join } from 'path';
|
||
|
|
import { listStages } from 'mcplocal/proxymodel/stage-registry';
|
||
|
|
|
||
|
|
const STAGES_DIR = join(process.env.HOME ?? '', '.mcpctl', 'stages');
|
||
|
|
|
||
|
|
export function registerDeleteStage(program: Command): void {
|
||
|
|
program
|
||
|
|
.command('delete stage <name>')
|
||
|
|
.description('Delete a custom stage')
|
||
|
|
.action(async (name: string) => {
|
||
|
|
const stages = listStages();
|
||
|
|
const stageInfo = stages.find(s => s.name === name);
|
||
|
|
|
||
|
|
if (!stageInfo) {
|
||
|
|
console.error(`Stage '${name}' not found`);
|
||
|
|
process.exit(1);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (stageInfo.source === 'built-in') {
|
||
|
|
console.error(`Cannot delete built-in stage '${name}'`);
|
||
|
|
process.exit(1);
|
||
|
|
}
|
||
|
|
|
||
|
|
const filePath = join(STAGES_DIR, `${name}.ts`);
|
||
|
|
await unlink(filePath);
|
||
|
|
|
||
|
|
console.log(`Deleted ${filePath}`);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
CLI test: can delete custom stage, cannot delete built-in stage (error message), deleting non-existent stage shows error.
|