project-standalo-note-to-app/.claude/commands/guardrail/implement.md

75 lines
1.6 KiB
Markdown

---
description: Implement an approved entity from the manifest
allowed-tools: Read, Write, Bash
---
# Implement Entity
Implement the entity: "$ARGUMENTS"
## CRITICAL RULES
⚠️ **GUARDRAIL ENFORCEMENT ACTIVE**
You can ONLY write to files that:
1. Are defined in `project_manifest.json`
2. Have status = `APPROVED`
3. Match the `file_path` in the manifest EXACTLY
## Steps
1. **Verify Phase**: Must be in `IMPLEMENTATION_PHASE`
2. **Find Entity** in manifest:
- If "$ARGUMENTS" is `--all`: implement all APPROVED entities
- Otherwise: find the specific entity by ID
3. **For Each Entity**:
a. **Load Definition** from manifest
b. **Verify Status** is `APPROVED`
c. **Generate Code** matching the specification:
- Props must match manifest exactly
- Types must match manifest exactly
- File path must match `file_path` in manifest
d. **Write File** to the exact path in manifest
e. **Run Validations**:
```bash
npm run lint --if-present
npm run type-check --if-present
```
4. **Status Updates** (handled by post-hook):
- Entity status changes to `IMPLEMENTED`
- Timestamp recorded
## Code Templates
### Component (Frontend)
```tsx
import React from 'react';
interface [Name]Props {
// From manifest.props
}
export const [Name]: React.FC<[Name]Props> = (props) => {
return (
// Implementation
);
};
```
### API Endpoint (Backend)
```typescript
import { Request, Response } from 'express';
export async function handler(req: Request, res: Response) {
// From manifest.request/response schemas
}
```