Merges feat/agent-project-membership (task 166/152). An agent can finally join many projects: membership routes, per-membership role and optional brain override, chat resolving context from the membership, and CLI attach-agent / detach-agent / get memberships. The legacy Agent.projectId fallback is kept for this release as the schema comment promises. Conflict resolved in main.ts: that branch added its RBAC case to mapUrlToPermission inline, while this branch had extracted the function to middleware/url-permission.ts so it could be tested. Kept the extraction and ported the case into it — joining a team is `edit:agents:<name>`, not `create:agents`, which is the authority to mint a whole agent. Also fixes something the extraction makes possible. security.test.ts contained a hand-copied reproduction of mapUrlToPermission, because main.ts self-invokes main() and nothing in it was importable. A security test asserting against a copy stops testing the system the moment the real one changes, and this copy had already drifted. It now imports the real function; all 18 assertions still pass, against the code that actually runs. Local: build clean, workspace 2550 passed, lint unchanged at 794 errors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4wNHWf7xSwnZCWpJcyv9p
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
|