oden-forge 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/oden/adr.md +241 -0
- package/.claude/commands/oden/architect.md +332 -8
- package/.claude/commands/oden/context.md +573 -0
- package/.claude/commands/oden/test.md +858 -0
- package/.claude/commands/oden/work.md +131 -0
- package/.claude/epics/living-quality-gates-implementation/work-session.md +54 -0
- package/.claude/memory/compliance-rules.yaml +140 -0
- package/.claude/memory/index.md +96 -0
- package/.claude/memory/knowledge/context-preservation-design.md +249 -0
- package/.claude/memory/knowledge/stream-d-completion-report.md +219 -0
- package/.claude/memory/patterns/README.md +159 -0
- package/.claude/memory/patterns/common-functions.md +121 -0
- package/.claude/memory/patterns/duplicate-report.md +14 -0
- package/.claude/memory/sessions/20260327-snapshot.md +64 -0
- package/.claude/scripts/context-preservation.sh +447 -0
- package/README.md +156 -145
- package/package.json +14 -11
- package/MIGRATION.md +0 -410
- package/install.sh +0 -231
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: Bash, Read, Write, LS, Glob, Grep, Task
|
|
3
|
+
description: Living Architecture Decision Records (ADR) system with AI-suggested missing ADRs and compliance validation
|
|
4
|
+
created: 2026-03-27T15:02:15Z
|
|
5
|
+
updated: 2026-03-27T15:02:15Z
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Oden Forge - Architecture Decision Records (ADR)
|
|
9
|
+
|
|
10
|
+
Sistema **Living ADR** con detección inteligente de decisiones faltantes, validación de compliance y mantenimiento automático.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
/oden:adr # Lista ADRs existentes y sugiere faltantes
|
|
16
|
+
/oden:adr create [título] # Crear nuevo ADR interactivo
|
|
17
|
+
/oden:adr suggest # AI-suggested missing ADRs
|
|
18
|
+
/oden:adr validate # Validar compliance con ADRs
|
|
19
|
+
/oden:adr update [número] # Actualizar ADR existente
|
|
20
|
+
/oden:adr review # Revisar ADRs obsoletos
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 🎯 Living ADR Philosophy
|
|
24
|
+
|
|
25
|
+
### Problema Resuelto
|
|
26
|
+
- ❌ **Antes**: Decisiones arquitectónicas perdidas o desactualizadas
|
|
27
|
+
- ❌ **Antes**: No hay sistema para detectar decisiones faltantes
|
|
28
|
+
- ❌ **Antes**: Compliance manual e inconsistente
|
|
29
|
+
- ✅ **Ahora**: ADRs vivientes con AI-assisted management y validación automática
|
|
30
|
+
|
|
31
|
+
### Living ADR Features
|
|
32
|
+
1. **AI-Suggested Missing ADRs** - Detecta automáticamente decisiones no documentadas
|
|
33
|
+
2. **Compliance Validation** - Verifica que el código sigue las decisiones registradas
|
|
34
|
+
3. **Update Workflows** - Mantiene ADRs actualizados con cambios del proyecto
|
|
35
|
+
4. **Cross-Reference Detection** - Encuentra conflictos entre ADRs
|
|
36
|
+
5. **Template-Based Creation** - Templates inteligentes según tipo de decisión
|
|
37
|
+
|
|
38
|
+
## Directory Structure
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
docs/reference/
|
|
42
|
+
├── adrs/
|
|
43
|
+
│ ├── 0001-record-architecture-decisions.md # Meta-ADR
|
|
44
|
+
│ ├── 0002-database-technology-choice.md # Example ADR
|
|
45
|
+
│ ├── 0003-api-authentication-strategy.md # Example ADR
|
|
46
|
+
│ └── template.md # ADR template
|
|
47
|
+
└── adr-index.md # Generated index
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Implementation
|
|
51
|
+
|
|
52
|
+
### 1. List ADRs and Suggest Missing (`/oden:adr`)
|
|
53
|
+
|
|
54
|
+
**Preflight:**
|
|
55
|
+
- Crear `docs/reference/adrs/` si no existe
|
|
56
|
+
- Verificar que existe template
|
|
57
|
+
- Escanear technical-decisions.md para contexto
|
|
58
|
+
|
|
59
|
+
**Main Algorithm:**
|
|
60
|
+
```bash
|
|
61
|
+
echo "📋 Architecture Decision Records Status"
|
|
62
|
+
echo ""
|
|
63
|
+
|
|
64
|
+
# Create directory if needed
|
|
65
|
+
mkdir -p docs/reference/adrs/
|
|
66
|
+
|
|
67
|
+
# List existing ADRs
|
|
68
|
+
echo "## Existing ADRs"
|
|
69
|
+
if ls docs/reference/adrs/*-*.md 2>/dev/null | grep -q .; then
|
|
70
|
+
ls -1 docs/reference/adrs/ | grep -E "^[0-9]{4}-.*\.md$" | while read adr; do
|
|
71
|
+
number=$(echo "$adr" | cut -d'-' -f1)
|
|
72
|
+
title=$(grep "^# " "docs/reference/adrs/$adr" | head -1 | sed 's/^# //' | sed "s/^ADR-[0-9]*: //")
|
|
73
|
+
status=$(grep "^Status:" "docs/reference/adrs/$adr" | head -1 | sed 's/^Status: //')
|
|
74
|
+
echo "- ADR-$number: $title [$status]"
|
|
75
|
+
done
|
|
76
|
+
else
|
|
77
|
+
echo "No ADRs found. Use '/oden:adr create' to start."
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
echo ""
|
|
81
|
+
echo "## 🤖 AI-Suggested Missing ADRs"
|
|
82
|
+
echo ""
|
|
83
|
+
echo "Analyzing codebase for undocumented architectural decisions..."
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Create ADR (`/oden:adr create [título]`)
|
|
87
|
+
|
|
88
|
+
**Interactive Creation Process:**
|
|
89
|
+
- Determine ADR type from title or interactive selection
|
|
90
|
+
- Generate next sequential ADR number
|
|
91
|
+
- Create from appropriate template
|
|
92
|
+
- Auto-populate with project context
|
|
93
|
+
|
|
94
|
+
### 3. Validate Compliance (`/oden:adr validate`)
|
|
95
|
+
|
|
96
|
+
**Compliance Validation Engine:**
|
|
97
|
+
```bash
|
|
98
|
+
echo "🔍 Validating ADR Compliance"
|
|
99
|
+
echo ""
|
|
100
|
+
|
|
101
|
+
VIOLATIONS=0
|
|
102
|
+
|
|
103
|
+
# Read all ADRs and extract compliance rules
|
|
104
|
+
echo "Loading ADR compliance rules..."
|
|
105
|
+
for adr in docs/reference/adrs/[0-9]*.md; do
|
|
106
|
+
if [ -f "$adr" ]; then
|
|
107
|
+
ADR_NUM=$(basename "$adr" | cut -d'-' -f1)
|
|
108
|
+
TITLE=$(grep "^# " "$adr" | head -1)
|
|
109
|
+
STATUS=$(grep "^Status:" "$adr" | head -1 | sed 's/^Status: //')
|
|
110
|
+
|
|
111
|
+
# Only validate accepted ADRs
|
|
112
|
+
if [ "$STATUS" = "Accepted" ]; then
|
|
113
|
+
echo " - Validating ADR-$ADR_NUM"
|
|
114
|
+
|
|
115
|
+
# Extract validation rules from "Compliance" section
|
|
116
|
+
if grep -q "## Compliance" "$adr"; then
|
|
117
|
+
# Perform compliance validation
|
|
118
|
+
validate_adr_compliance "$adr" || VIOLATIONS=$((VIOLATIONS + 1))
|
|
119
|
+
fi
|
|
120
|
+
fi
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
|
|
124
|
+
if [ $VIOLATIONS -eq 0 ]; then
|
|
125
|
+
echo "✅ All ADRs are in compliance"
|
|
126
|
+
echo "Compliance Score: 100%"
|
|
127
|
+
else
|
|
128
|
+
echo "⚠️ Found $VIOLATIONS compliance violations"
|
|
129
|
+
echo "Compliance Score: $((100 - VIOLATIONS * 10))%"
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Integration with Context Preservation System (Stream D)
|
|
133
|
+
if command -v /oden:context >/dev/null 2>&1; then
|
|
134
|
+
echo ""
|
|
135
|
+
echo "📊 Recording compliance metrics in context system..."
|
|
136
|
+
fi
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 4. AI-Suggested Missing ADRs (`/oden:adr suggest`)
|
|
140
|
+
|
|
141
|
+
**Deep Gap Analysis:**
|
|
142
|
+
Uses specialized AI agents to analyze:
|
|
143
|
+
- Technical decisions documentation gaps
|
|
144
|
+
- Code pattern analysis for undocumented decisions
|
|
145
|
+
- Dependency analysis for technology choices
|
|
146
|
+
- API design pattern gaps
|
|
147
|
+
- Database and storage decision gaps
|
|
148
|
+
|
|
149
|
+
### 5. Update and Review ADRs
|
|
150
|
+
|
|
151
|
+
**Maintenance Workflows:**
|
|
152
|
+
- Smart update suggestions based on codebase changes
|
|
153
|
+
- Obsolescence detection for outdated decisions
|
|
154
|
+
- Cross-reference validation
|
|
155
|
+
- Status transition management
|
|
156
|
+
|
|
157
|
+
## ADR Templates
|
|
158
|
+
|
|
159
|
+
### Core Template Structure
|
|
160
|
+
```markdown
|
|
161
|
+
# ADR-{NNNN}: {Title}
|
|
162
|
+
|
|
163
|
+
**Status**: {Proposed|Accepted|Deprecated|Superseded}
|
|
164
|
+
**Date**: {YYYY-MM-DD}
|
|
165
|
+
**Decision**: {Single sentence summary}
|
|
166
|
+
|
|
167
|
+
## Context and Problem Statement
|
|
168
|
+
{Describe the architectural decision and problem}
|
|
169
|
+
|
|
170
|
+
## Decision Drivers
|
|
171
|
+
- {Driver 1}
|
|
172
|
+
- {Driver 2}
|
|
173
|
+
|
|
174
|
+
## Considered Options
|
|
175
|
+
### Option 1: {Name}
|
|
176
|
+
**Pros**: {Benefits}
|
|
177
|
+
**Cons**: {Drawbacks}
|
|
178
|
+
|
|
179
|
+
## Decision Outcome
|
|
180
|
+
**Chosen Option**: Option X
|
|
181
|
+
**Rationale**: {Why selected}
|
|
182
|
+
|
|
183
|
+
## Consequences
|
|
184
|
+
### Positive
|
|
185
|
+
- {Positive consequence 1}
|
|
186
|
+
### Negative
|
|
187
|
+
- {Negative consequence 1}
|
|
188
|
+
|
|
189
|
+
## Compliance
|
|
190
|
+
### Validation Rules
|
|
191
|
+
- {Rule 1: How to verify this decision is followed}
|
|
192
|
+
### Implementation Requirements
|
|
193
|
+
- {Requirement 1}
|
|
194
|
+
|
|
195
|
+
## Related Decisions
|
|
196
|
+
- ADR-{NNNN}: {Related decision}
|
|
197
|
+
|
|
198
|
+
## Implementation Notes
|
|
199
|
+
{Code links, configuration files, etc.}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Integration with Quality Gates
|
|
203
|
+
|
|
204
|
+
### Pre-commit Integration
|
|
205
|
+
```bash
|
|
206
|
+
# ADR Compliance Gate
|
|
207
|
+
echo "📋 Checking ADR compliance..."
|
|
208
|
+
/oden:adr validate --quiet
|
|
209
|
+
if [ $? -ne 0 ]; then
|
|
210
|
+
echo "❌ ADR compliance violations detected"
|
|
211
|
+
echo "Run '/oden:adr validate' for details"
|
|
212
|
+
exit 1
|
|
213
|
+
fi
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Stream Integration
|
|
217
|
+
- **Stream B (Architecture)**: Enhanced architect command uses ADRs
|
|
218
|
+
- **Stream C (Testing)**: Testing requirements defined in ADRs
|
|
219
|
+
- **Stream D (Context)**: Architecture drift monitoring via ADR compliance
|
|
220
|
+
|
|
221
|
+
## Living ADR Benefits
|
|
222
|
+
|
|
223
|
+
### For Development Teams
|
|
224
|
+
1. **Never lose architectural decisions** - Everything documented and maintained
|
|
225
|
+
2. **AI-suggested missing ADRs** - Proactive decision documentation
|
|
226
|
+
3. **Automated compliance checking** - Ensure decisions are followed
|
|
227
|
+
4. **Template-guided creation** - Consistent, high-quality ADRs
|
|
228
|
+
5. **Cross-reference detection** - Avoid conflicting decisions
|
|
229
|
+
|
|
230
|
+
### For Oden Forge Quality Gates
|
|
231
|
+
1. **Measurable architecture compliance** - Foundation for quality gates
|
|
232
|
+
2. **Decision impact tracking** - Understand architectural consequences
|
|
233
|
+
3. **Evolution visibility** - Track how architecture changes over time
|
|
234
|
+
4. **Knowledge preservation** - No lost institutional knowledge
|
|
235
|
+
5. **Automated governance** - Remove manual architecture oversight
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
**Living ADRs transform architecture from invisible to visible, from static to dynamic, from forgotten to enforced.**
|
|
240
|
+
|
|
241
|
+
They solve the real-world problem of "invisible architecture" - architectural decisions that exist in code but are never documented, leading to inconsistent implementations and lost knowledge between team members and across time.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
allowed-tools: Bash, Read, Write, LS, Glob, Grep, Task, TodoWrite, WebSearch, WebFetch
|
|
3
3
|
description: Crear/completar technical-decisions.md con arquitectura completa
|
|
4
|
+
updated: 2026-03-27T07:08:49Z
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Oden Forge - Technical Architect
|
|
@@ -28,7 +29,9 @@ Como Technical Architect, debes:
|
|
|
28
29
|
2. **Diseñar schema de base de datos** completo
|
|
29
30
|
3. **Definir interfaces TypeScript** para todos los modelos
|
|
30
31
|
4. **Documentar patrones de arquitectura**
|
|
31
|
-
5. **
|
|
32
|
+
5. **Especificar estructura de código** y organización interna
|
|
33
|
+
6. **Definir límites y restricciones** de calidad
|
|
34
|
+
7. **Identificar dependencias y riesgos**
|
|
32
35
|
|
|
33
36
|
## Proceso
|
|
34
37
|
|
|
@@ -60,7 +63,239 @@ Basado en el stack, diseña:
|
|
|
60
63
|
└── utils/ # Helper functions
|
|
61
64
|
```
|
|
62
65
|
|
|
63
|
-
### Paso 3:
|
|
66
|
+
### Paso 3: Especificaciones de Código y Estructura
|
|
67
|
+
|
|
68
|
+
**🆕 CRÍTICO:** Define HOW el código debe estar organizado internamente para prevenir god files y inconsistencias.
|
|
69
|
+
|
|
70
|
+
#### 3.1 Límites de Archivos y Módulos
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
## Code Structure Guidelines
|
|
74
|
+
|
|
75
|
+
### File Size Limits (ENFORCE STRICTLY)
|
|
76
|
+
- **Components**: MAX 200 líneas (150 típico)
|
|
77
|
+
- **Hooks**: MAX 100 líneas (50-75 típico)
|
|
78
|
+
- **Services**: MAX 300 líneas (200 típico)
|
|
79
|
+
- **Utils**: MAX 150 líneas (100 típico)
|
|
80
|
+
- **Types**: MAX 200 líneas (split por dominio)
|
|
81
|
+
- **Stores/State**: MAX 250 líneas (split por feature)
|
|
82
|
+
|
|
83
|
+
### Module Organization (HIGH COHESION)
|
|
84
|
+
```
|
|
85
|
+
src/
|
|
86
|
+
├── modules/ # Feature-based modules
|
|
87
|
+
│ ├── auth/
|
|
88
|
+
│ │ ├── components/ # Max 5 files
|
|
89
|
+
│ │ ├── hooks/ # Max 3 files
|
|
90
|
+
│ │ ├── services/ # Max 2 files
|
|
91
|
+
│ │ ├── types.ts # Single types file
|
|
92
|
+
│ │ └── index.ts # Public API only
|
|
93
|
+
│ ├── orders/
|
|
94
|
+
│ │ ├── components/
|
|
95
|
+
│ │ ├── hooks/
|
|
96
|
+
│ │ └── ...
|
|
97
|
+
│ └── shared/ # Cross-module utilities
|
|
98
|
+
│ ├── components/
|
|
99
|
+
│ ├── hooks/
|
|
100
|
+
│ └── utils/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Layer Dependencies (ENFORCE DIRECTION)
|
|
104
|
+
```
|
|
105
|
+
UI Layer (components/)
|
|
106
|
+
↓ can import
|
|
107
|
+
Business Layer (hooks/, services/)
|
|
108
|
+
↓ can import
|
|
109
|
+
Data Layer (types/, utils/)
|
|
110
|
+
|
|
111
|
+
❌ FORBIDDEN: Data layer importing Business/UI
|
|
112
|
+
❌ FORBIDDEN: Circular dependencies
|
|
113
|
+
✅ ALLOWED: Same layer imports
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### 3.2 Internal File Structure Standards
|
|
117
|
+
|
|
118
|
+
**Component Structure (MANDATORY)**
|
|
119
|
+
```typescript
|
|
120
|
+
// TEMPLATE: Component file structure
|
|
121
|
+
import React from 'react';
|
|
122
|
+
// 1. External imports first
|
|
123
|
+
// 2. Internal imports second
|
|
124
|
+
// 3. Types last
|
|
125
|
+
|
|
126
|
+
// Types (if small, <20 lines)
|
|
127
|
+
interface Props {
|
|
128
|
+
// Max 8 props, use config object if more
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Main component (Max 150 lines)
|
|
132
|
+
export function ComponentName({ ...props }: Props) {
|
|
133
|
+
// 1. Hooks first (max 5)
|
|
134
|
+
// 2. Derived state (max 3 computations)
|
|
135
|
+
// 3. Event handlers (max 5)
|
|
136
|
+
// 4. Effects last (max 3)
|
|
137
|
+
|
|
138
|
+
// Early returns for loading/error states
|
|
139
|
+
if (loading) return <Loading />;
|
|
140
|
+
if (error) return <Error />;
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
// JSX (max 50 lines)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Helper components (if needed, max 2)
|
|
148
|
+
function HelperComponent() {
|
|
149
|
+
// Max 25 lines
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Exports last
|
|
153
|
+
export type { Props };
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Service Structure (MANDATORY)**
|
|
157
|
+
```typescript
|
|
158
|
+
// TEMPLATE: Service file structure
|
|
159
|
+
import { ApiClient } from '../shared';
|
|
160
|
+
// External imports
|
|
161
|
+
// Internal imports
|
|
162
|
+
// Types
|
|
163
|
+
|
|
164
|
+
// Types for this service only
|
|
165
|
+
interface ServiceConfig {
|
|
166
|
+
// Service-specific config
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface ServiceResponse<T> {
|
|
170
|
+
// Standardized response format
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Main service class (Max 200 lines)
|
|
174
|
+
class FeatureService {
|
|
175
|
+
private config: ServiceConfig;
|
|
176
|
+
|
|
177
|
+
constructor(config: ServiceConfig) {
|
|
178
|
+
this.config = config;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Public methods (max 8)
|
|
182
|
+
async getAll(): Promise<ServiceResponse<Item[]>> {
|
|
183
|
+
// Max 25 lines per method
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Private methods last
|
|
187
|
+
private helper(): void {
|
|
188
|
+
// Max 15 lines per helper
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Factory function
|
|
193
|
+
export function createFeatureService(config: ServiceConfig): FeatureService {
|
|
194
|
+
return new FeatureService(config);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Export types
|
|
198
|
+
export type { ServiceConfig, ServiceResponse };
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### 3.3 Code Quality Enforcement
|
|
202
|
+
|
|
203
|
+
**Complexity Limits**
|
|
204
|
+
- **Cyclomatic complexity**: Max 10 per function
|
|
205
|
+
- **Nesting depth**: Max 4 levels
|
|
206
|
+
- **Function parameters**: Max 5 (use config object)
|
|
207
|
+
- **Class methods**: Max 12 public methods
|
|
208
|
+
- **Import statements**: Max 15 per file
|
|
209
|
+
|
|
210
|
+
**Naming Conventions**
|
|
211
|
+
```typescript
|
|
212
|
+
// Files: kebab-case
|
|
213
|
+
user-profile.component.ts
|
|
214
|
+
order-management.service.ts
|
|
215
|
+
|
|
216
|
+
// Components: PascalCase
|
|
217
|
+
UserProfile, OrderManagement
|
|
218
|
+
|
|
219
|
+
// Functions/variables: camelCase
|
|
220
|
+
getUserProfile, orderData
|
|
221
|
+
|
|
222
|
+
// Constants: SCREAMING_SNAKE_CASE
|
|
223
|
+
MAX_RETRY_ATTEMPTS, API_ENDPOINTS
|
|
224
|
+
|
|
225
|
+
// Types/Interfaces: PascalCase
|
|
226
|
+
interface UserProfile {}
|
|
227
|
+
type OrderStatus = 'pending' | 'completed';
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Error Handling Patterns**
|
|
231
|
+
```typescript
|
|
232
|
+
// Service layer: Throw typed errors
|
|
233
|
+
class ServiceError extends Error {
|
|
234
|
+
constructor(
|
|
235
|
+
message: string,
|
|
236
|
+
public code: string,
|
|
237
|
+
public status?: number
|
|
238
|
+
) {
|
|
239
|
+
super(message);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Hook layer: Return error states
|
|
244
|
+
function useFeature() {
|
|
245
|
+
const [state, setState] = useState<{
|
|
246
|
+
data: Data | null;
|
|
247
|
+
error: ServiceError | null;
|
|
248
|
+
loading: boolean;
|
|
249
|
+
}>({
|
|
250
|
+
data: null,
|
|
251
|
+
error: null,
|
|
252
|
+
loading: false
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// Error boundary at component level
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### 3.4 Testing Requirements per Layer
|
|
260
|
+
|
|
261
|
+
**Component Testing (MANDATORY)**
|
|
262
|
+
```typescript
|
|
263
|
+
// Every component MUST have:
|
|
264
|
+
describe('ComponentName', () => {
|
|
265
|
+
// 1. Render test
|
|
266
|
+
it('renders without crashing', () => {});
|
|
267
|
+
|
|
268
|
+
// 2. Props test
|
|
269
|
+
it('handles all prop variations', () => {});
|
|
270
|
+
|
|
271
|
+
// 3. Interaction test
|
|
272
|
+
it('handles user interactions', () => {});
|
|
273
|
+
|
|
274
|
+
// 4. Error state test
|
|
275
|
+
it('handles error states', () => {});
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Service Testing (MANDATORY)**
|
|
280
|
+
```typescript
|
|
281
|
+
// Every service MUST have:
|
|
282
|
+
describe('FeatureService', () => {
|
|
283
|
+
// 1. Happy path tests
|
|
284
|
+
it('returns data successfully', () => {});
|
|
285
|
+
|
|
286
|
+
// 2. Error handling tests
|
|
287
|
+
it('handles API errors gracefully', () => {});
|
|
288
|
+
|
|
289
|
+
// 3. Edge case tests
|
|
290
|
+
it('handles empty responses', () => {});
|
|
291
|
+
|
|
292
|
+
// 4. Integration tests
|
|
293
|
+
it('works with real API', () => {});
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Paso 4: Schema de Base de Datos
|
|
64
299
|
|
|
65
300
|
Para cada entidad del sistema:
|
|
66
301
|
|
|
@@ -89,7 +324,7 @@ Para cada entidad del sistema:
|
|
|
89
324
|
- updated_at: Auto-update on modification
|
|
90
325
|
```
|
|
91
326
|
|
|
92
|
-
### Paso
|
|
327
|
+
### Paso 5: Interfaces TypeScript
|
|
93
328
|
|
|
94
329
|
```typescript
|
|
95
330
|
// Types para cada entidad
|
|
@@ -120,7 +355,7 @@ interface ApiError {
|
|
|
120
355
|
}
|
|
121
356
|
```
|
|
122
357
|
|
|
123
|
-
### Paso
|
|
358
|
+
### Paso 6: Patrones de Arquitectura
|
|
124
359
|
|
|
125
360
|
Documenta patrones para:
|
|
126
361
|
|
|
@@ -144,7 +379,7 @@ Documenta patrones para:
|
|
|
144
379
|
- Code splitting
|
|
145
380
|
- Memoization
|
|
146
381
|
|
|
147
|
-
### Paso
|
|
382
|
+
### Paso 7: Seguridad
|
|
148
383
|
|
|
149
384
|
Documenta:
|
|
150
385
|
- Autenticación flow
|
|
@@ -153,7 +388,7 @@ Documenta:
|
|
|
153
388
|
- CORS policy
|
|
154
389
|
- Rate limiting
|
|
155
390
|
|
|
156
|
-
### Paso
|
|
391
|
+
### Paso 8: APIs
|
|
157
392
|
|
|
158
393
|
Define endpoints principales:
|
|
159
394
|
|
|
@@ -178,11 +413,47 @@ Define endpoints principales:
|
|
|
178
413
|
| DELETE | /api/{resource}/:id | Delete | Yes | Admin |
|
|
179
414
|
```
|
|
180
415
|
|
|
416
|
+
### Paso 9: Quality Gates Integration
|
|
417
|
+
|
|
418
|
+
**🆕 Para integración con quality gates:**
|
|
419
|
+
|
|
420
|
+
```markdown
|
|
421
|
+
## Measurable Requirements
|
|
422
|
+
|
|
423
|
+
### Code Structure Metrics (ENFORCE)
|
|
424
|
+
- File count per module: MAX 15 files
|
|
425
|
+
- Lines per file: See limits above
|
|
426
|
+
- Cyclomatic complexity: MAX 10
|
|
427
|
+
- Import depth: MAX 3 levels
|
|
428
|
+
- Duplicate code: MAX 3% similarity
|
|
429
|
+
|
|
430
|
+
### Architecture Compliance (VALIDATE)
|
|
431
|
+
- Layer dependency direction: STRICT
|
|
432
|
+
- Circular dependencies: ZERO tolerance
|
|
433
|
+
- Public API surface: Document all exports
|
|
434
|
+
- Type coverage: MIN 95%
|
|
435
|
+
|
|
436
|
+
### Testing Coverage (MEASURE)
|
|
437
|
+
- Unit tests: MIN 85% coverage
|
|
438
|
+
- Integration tests: All API endpoints
|
|
439
|
+
- Component tests: All user interactions
|
|
440
|
+
- E2E tests: Critical user flows
|
|
441
|
+
|
|
442
|
+
### Performance Benchmarks (TRACK)
|
|
443
|
+
- Bundle size: MAX defined per route
|
|
444
|
+
- Initial load: MAX 2s
|
|
445
|
+
- API response: MAX 500ms p95
|
|
446
|
+
- Memory usage: Monitor growth
|
|
447
|
+
```
|
|
448
|
+
|
|
181
449
|
## Output
|
|
182
450
|
|
|
183
451
|
Al completar, el archivo `docs/reference/technical-decisions.md` debe tener:
|
|
184
452
|
|
|
185
453
|
- [ ] 2000+ líneas de contenido
|
|
454
|
+
- [ ] **🆕 Code structure guidelines** (300-500 líneas)
|
|
455
|
+
- [ ] **🆕 Internal organization patterns** (200-300 líneas)
|
|
456
|
+
- [ ] **🆕 Quality enforcement rules** (150-200 líneas)
|
|
186
457
|
- [ ] Schema de BD completo para todas las entidades
|
|
187
458
|
- [ ] Interfaces TypeScript para todos los modelos
|
|
188
459
|
- [ ] Diagrama de arquitectura (ASCII o mermaid)
|
|
@@ -190,6 +461,7 @@ Al completar, el archivo `docs/reference/technical-decisions.md` debe tener:
|
|
|
190
461
|
- [ ] APIs definidas
|
|
191
462
|
- [ ] Consideraciones de seguridad
|
|
192
463
|
- [ ] Performance targets
|
|
464
|
+
- [ ] **🆕 Testing requirements per layer**
|
|
193
465
|
|
|
194
466
|
---
|
|
195
467
|
|
|
@@ -204,6 +476,9 @@ Crear especificaciones técnicas detalladas (800-1200 líneas) para módulos esp
|
|
|
204
476
|
- **Edge cases** y manejo de errores
|
|
205
477
|
- **APIs** y contratos de datos
|
|
206
478
|
- **Testing scenarios**
|
|
479
|
+
- **🆕 Internal code organization** para el módulo
|
|
480
|
+
- **🆕 File structure and limits** específicos
|
|
481
|
+
- **🆕 Quality requirements** del módulo
|
|
207
482
|
|
|
208
483
|
### Usage:
|
|
209
484
|
```bash
|
|
@@ -212,6 +487,29 @@ Crear especificaciones técnicas detalladas (800-1200 líneas) para módulos esp
|
|
|
212
487
|
/oden:architect spec payments # Procesamiento de pagos
|
|
213
488
|
```
|
|
214
489
|
|
|
490
|
+
### 🆕 Enhanced Spec Output:
|
|
491
|
+
```markdown
|
|
492
|
+
## Module: {nombre}
|
|
493
|
+
|
|
494
|
+
### Code Structure
|
|
495
|
+
- Files organization: {specific to module}
|
|
496
|
+
- Size limits: {adjusted for complexity}
|
|
497
|
+
- Dependencies: {what can this import}
|
|
498
|
+
- Public API: {exported interfaces}
|
|
499
|
+
|
|
500
|
+
### Internal Architecture
|
|
501
|
+
- Layer organization
|
|
502
|
+
- State management pattern
|
|
503
|
+
- Error handling strategy
|
|
504
|
+
- Testing approach
|
|
505
|
+
|
|
506
|
+
### Quality Gates
|
|
507
|
+
- Specific metrics for this module
|
|
508
|
+
- Complexity thresholds
|
|
509
|
+
- Coverage requirements
|
|
510
|
+
- Performance targets
|
|
511
|
+
```
|
|
512
|
+
|
|
215
513
|
---
|
|
216
514
|
|
|
217
515
|
## CHECKLIST MODE: /oden:architect checklist
|
|
@@ -220,28 +518,40 @@ Verificación automática antes de empezar a codificar.
|
|
|
220
518
|
|
|
221
519
|
### Verifica:
|
|
222
520
|
- ✅ technical-decisions.md completo (>2000 líneas)
|
|
521
|
+
- ✅ **🆕 Code structure guidelines** definidas
|
|
522
|
+
- ✅ **🆕 Quality enforcement rules** establecidas
|
|
223
523
|
- ✅ Schema de BD definido
|
|
224
524
|
- ✅ Interfaces TypeScript creadas
|
|
225
525
|
- ✅ Specs de módulos principales (>800 líneas c/u)
|
|
226
526
|
- ✅ Patrones de arquitectura documentados
|
|
527
|
+
- ✅ **🆕 Testing requirements** especificados
|
|
227
528
|
- ✅ Total documentación >8000 líneas
|
|
228
529
|
|
|
229
|
-
###
|
|
530
|
+
### 🆕 Enhanced Validation:
|
|
230
531
|
```
|
|
231
532
|
🎯 CHECKLIST PRE-CÓDIGO
|
|
232
533
|
═══════════════════════════
|
|
233
534
|
|
|
234
535
|
✅ technical-decisions.md: 2,847 líneas
|
|
536
|
+
✅ Code structure: 487 líneas
|
|
537
|
+
✅ Quality rules: 156 líneas
|
|
235
538
|
✅ auth-spec.md: 1,203 líneas
|
|
236
539
|
✅ orders-spec.md: 987 líneas
|
|
237
540
|
❌ payments-spec.md: FALTA
|
|
238
541
|
⚠️ Schema BD: 89% completo
|
|
239
542
|
|
|
240
|
-
TOTAL:
|
|
543
|
+
TOTAL: 8,234 / 8,000 líneas mínimas
|
|
241
544
|
|
|
242
545
|
🚨 BLOQUEADORES:
|
|
243
546
|
- Completar payments-spec.md
|
|
244
547
|
- Finalizar schema de BD
|
|
548
|
+
- Definir testing strategy
|
|
549
|
+
|
|
550
|
+
📊 QUALITY READINESS:
|
|
551
|
+
✅ File size limits defined
|
|
552
|
+
✅ Layer dependencies mapped
|
|
553
|
+
❌ Complexity thresholds missing
|
|
554
|
+
⚠️ Testing requirements 73% complete
|
|
245
555
|
|
|
246
556
|
SIGUIENTE: /oden:architect spec payments
|
|
247
557
|
```
|
|
@@ -257,3 +567,17 @@ Después de completar arquitectura y specs:
|
|
|
257
567
|
2. /oden:epic [feature] → Epic + tasks + work streams
|
|
258
568
|
3. /oden:work [epic] → Desarrollo con Teams
|
|
259
569
|
```
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## 🆕 Integration with Living Quality Gates
|
|
574
|
+
|
|
575
|
+
Este comando ahora produce arquitectura que puede ser validada automáticamente por:
|
|
576
|
+
|
|
577
|
+
- **Code structure compliance checkers**
|
|
578
|
+
- **Dependency direction validators**
|
|
579
|
+
- **File size and complexity monitors**
|
|
580
|
+
- **Testing coverage requirements**
|
|
581
|
+
- **Performance benchmark definitions**
|
|
582
|
+
|
|
583
|
+
La salida es **measurable** y **enforceable** durante el desarrollo.
|