65 lines
1.8 KiB
Markdown
65 lines
1.8 KiB
Markdown
|
|
# Task ID: 59
|
||
|
|
|
||
|
|
**Title:** Update CLI create prompt command for priority and link
|
||
|
|
|
||
|
|
**Status:** done
|
||
|
|
|
||
|
|
**Dependencies:** 40 ✓
|
||
|
|
|
||
|
|
**Priority:** medium
|
||
|
|
|
||
|
|
**Description:** Extend the mcpctl create prompt command to accept --priority (1-10) and --link (project/server:uri) flags.
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
1. Update `/src/cli/src/commands/create.ts` for prompt:
|
||
|
|
```typescript
|
||
|
|
.command('prompt <name>')
|
||
|
|
.description('Create a new prompt')
|
||
|
|
.option('-p, --project <name>', 'Project to create prompt in')
|
||
|
|
.option('--priority <number>', 'Priority level (1-10, default: 5)', '5')
|
||
|
|
.option('--link <target>', 'Link to MCP resource (project/server:uri)')
|
||
|
|
.option('-f, --file <path>', 'Read content from file')
|
||
|
|
.action(async (name, options) => {
|
||
|
|
const priority = parseInt(options.priority, 10);
|
||
|
|
if (priority < 1 || priority > 10) {
|
||
|
|
console.error('Priority must be between 1 and 10');
|
||
|
|
process.exit(1);
|
||
|
|
}
|
||
|
|
|
||
|
|
let content = '';
|
||
|
|
if (options.link) {
|
||
|
|
// Linked prompts don't need content (fetched from source)
|
||
|
|
content = `[Link: ${options.link}]`;
|
||
|
|
} else if (options.file) {
|
||
|
|
content = await fs.readFile(options.file, 'utf-8');
|
||
|
|
} else {
|
||
|
|
content = await promptForContent();
|
||
|
|
}
|
||
|
|
|
||
|
|
const body = {
|
||
|
|
name,
|
||
|
|
content,
|
||
|
|
projectId: options.project,
|
||
|
|
priority,
|
||
|
|
linkTarget: options.link,
|
||
|
|
};
|
||
|
|
|
||
|
|
await api.post('/api/v1/prompts', body);
|
||
|
|
});
|
||
|
|
```
|
||
|
|
|
||
|
|
2. Validate link format: `project/server:resource-uri`
|
||
|
|
|
||
|
|
3. Add shell completions for new flags
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
- Unit test: --priority flag sets prompt priority
|
||
|
|
- Unit test: --priority validation (1-10 range)
|
||
|
|
- Unit test: --link flag sets linkTarget
|
||
|
|
- Unit test: --link validation (format check)
|
||
|
|
- Unit test: Linked prompt skips content prompt
|
||
|
|
- Unit test: Default priority is 5
|
||
|
|
- Integration test: End-to-end create with flags
|