59 lines
2.0 KiB
Markdown
59 lines
2.0 KiB
Markdown
|
|
# Task ID: 54
|
||
|
|
|
||
|
|
**Title:** Create mcpctl-system project with system prompts
|
||
|
|
|
||
|
|
**Status:** done
|
||
|
|
|
||
|
|
**Dependencies:** 40 ✓, 39 ✓
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Implement bootstrap logic to create the mcpctl-system project and its required system prompts on first startup, with protection against deletion.
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
1. Create seed migration or startup hook:
|
||
|
|
```typescript
|
||
|
|
async function bootstrapSystemProject() {
|
||
|
|
const systemProject = await projectRepo.findByName('mcpctl-system');
|
||
|
|
if (systemProject) return; // Already exists
|
||
|
|
|
||
|
|
// Create mcpctl-system project
|
||
|
|
const project = await projectRepo.create({
|
||
|
|
name: 'mcpctl-system',
|
||
|
|
description: 'System prompts for mcpctl gating and encouragement',
|
||
|
|
gated: false, // System project is not gated
|
||
|
|
ownerId: SYSTEM_USER_ID,
|
||
|
|
});
|
||
|
|
|
||
|
|
// Create required system prompts
|
||
|
|
const systemPrompts = [
|
||
|
|
{ name: 'gate-instructions', priority: 10, content: GATE_INSTRUCTIONS },
|
||
|
|
{ name: 'gate-encouragement', priority: 10, content: GATE_ENCOURAGEMENT },
|
||
|
|
{ name: 'read-prompts-reminder', priority: 10, content: READ_PROMPTS_REMINDER },
|
||
|
|
{ name: 'gate-intercept-preamble', priority: 10, content: GATE_INTERCEPT_PREAMBLE },
|
||
|
|
{ name: 'session-greeting', priority: 10, content: SESSION_GREETING },
|
||
|
|
];
|
||
|
|
|
||
|
|
for (const p of systemPrompts) {
|
||
|
|
await promptRepo.create({ ...p, projectId: project.id });
|
||
|
|
}
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
2. Add delete protection in prompt delete endpoint:
|
||
|
|
- Check if prompt belongs to mcpctl-system
|
||
|
|
- Return 403 error if attempting to delete system prompt
|
||
|
|
|
||
|
|
3. Define default content for each system prompt per PRD
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
- Unit test: System project created on first startup
|
||
|
|
- Unit test: All 5 system prompts created
|
||
|
|
- Unit test: Subsequent startups don't duplicate
|
||
|
|
- Unit test: Delete system prompt returns 403
|
||
|
|
- Unit test: System prompts have priority 10
|
||
|
|
- Unit test: mcpctl-system project has gated=false
|
||
|
|
- Integration test: End-to-end bootstrap flow
|