Create technical documentation for a story or feature
Creates technical documentation for stories or features with in-code docs and architecture references.
/plugin marketplace add eLafo/hefesto/plugin install elafo-hefesto-2@eLafo/hefesto<path> | story <path> | feature <id>dev/Router command that creates technical documentation for stories or features.
Scope: In-code docs, API reference, architecture docs - documentation for developers.
| Input | Strategy |
|---|---|
story <path> | Story Technical Docs |
feature <id> | Feature Technical Docs |
<path> (auto-detect) | Detect from path pattern |
Trigger: dev:document story <path> or auto-detected story path
testedFor each file, add appropriate documentation:
JavaScript/TypeScript (JSDoc):
/**
* Authenticates a user with credentials.
*
* @param email - User's email address
* @param password - User's password
* @returns Authentication result with token
* @throws {AuthError} If credentials invalid
*
* @example
* const result = await authenticate('user@example.com', 'pass');
*/
Python (Docstrings):
def authenticate(email: str, password: str) -> AuthResult:
"""
Authenticate a user with credentials.
Args:
email: User's email address
password: User's password
Returns:
AuthResult with token and user data
Raises:
AuthError: If credentials invalid
Example:
>>> result = authenticate('user@example.com', 'pass')
"""
Go (GoDoc):
// Authenticate verifies user credentials.
//
// Parameters:
// - email: User's email address
// - password: User's password
//
// Returns AuthResult and error if credentials invalid.
func Authenticate(email, password string) (*AuthResult, error) {
Create {story_path}/dev-documentation.md:
# Technical Documentation: {Story Title}
## Overview
{Technical summary of implementation}
## Architecture
### Components
| Component | Purpose | Location |
|-----------|---------|----------|
| AuthService | Authentication logic | src/auth/service.ts |
| LoginForm | UI component | src/components/Login.tsx |
### Data Flow
User Input → LoginForm → AuthService → API → Session Store
## API Reference
### Functions
#### `authenticate(email, password)`
{Full documentation}
**Parameters**:
| Name | Type | Description |
|------|------|-------------|
| email | string | User email |
| password | string | User password |
**Returns**: `Promise<AuthResult>`
**Throws**: `AuthError`
**Example**:
```typescript
const result = await authenticate('user@example.com', 'pass');
AuthResultinterface AuthResult {
success: boolean;
token?: string;
user?: User;
error?: string;
}
{How state is managed}
| Error | Cause | Handling |
|---|---|---|
| AuthError | Invalid credentials | Show message |
| NetworkError | Connection failed | Retry logic |
| Test | Location | Coverage |
|---|---|---|
| Auth flow | auth.test.ts | Login, logout |
npm test -- --grep "auth"
| Package | Purpose |
|---|---|
| bcrypt | Password hashing |
| jsonwebtoken | Token generation |
{Implementation decisions, gotchas}
#### Phase 4: Status Update
- Story status → `dev_documented`
### Output
✅ Story Technical Documentation Complete
Story: {title}
Documentation: ✅ In-code: 3 files documented ✅ Functions: 8 documented ✅ Reference: dev-documentation.md
→ Next (PO): po:validate story {story_path}
---
## Strategy: Feature Technical Docs
**Trigger**: `dev:document feature <id>` or auto-detected feature path
### Prerequisites
- Feature must be `feature_tested`
- All stories must be `dev_documented`
### Process
#### Phase 1: Gather Context
1. Read all story technical docs
2. Understand overall architecture
3. Identify cross-cutting concerns
#### Phase 2: Architecture Documentation
Create `.hefesto/features/{id}/docs/technical.md`:
```markdown
# Technical Documentation: {Feature Title}
## Architecture Overview
{High-level architecture description}
### System Diagram
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ Client │────▶│ Server │────▶│ Database │ └─────────────┘ └─────────────┘ └─────────────┘
### Components
| Component | Responsibility | Stories |
|-----------|---------------|---------|
| AuthModule | Authentication | 001, 002 |
| SessionManager | Session handling | 003 |
## File Structure
src/ ├── auth/ │ ├── service.ts # Core auth logic │ ├── session.ts # Session management │ └── types.ts # Type definitions ├── components/ │ └── Login.tsx # Login UI └── api/ └── auth.ts # API endpoints
## API Reference
### Endpoints
#### POST /api/auth/login
**Request**:
```json
{ "email": "string", "password": "string" }
Response:
{ "token": "string", "user": {...} }
{Cross-story interfaces}
interface User {
id: string;
email: string;
name: string;
createdAt: Date;
}
{Feature-wide state handling}
{Coverage summary}
{What's tested}
{Deployment notes}
{What to monitor}
| Story | Technical Docs |
|---|---|
| 001 | Link |
| 002 | Link |
#### Phase 3: Status Update
Update feature (does not change workflow flags - feature testing already sets those)
### Output
✅ Feature Technical Documentation Complete
Feature: {title}
Documentation: 📄 Architecture: docs/technical.md 📚 Story docs: 5 files linked
→ Next (PO): po:validate feature {id}
---
## Documentation Principles
1. **Document for developers**: Assume technical knowledge
2. **Explain the "why"**: Not just what, but why designed this way
3. **Include examples**: Working code samples
4. **Keep it current**: Update with code changes
5. **Link, don't duplicate**: Reference story docs