@damenor/agent-docs 0.1.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/README.md +115 -0
- package/dist/index.js +568 -0
- package/package.json +53 -0
- package/templates/base/AGENTS.md +177 -0
- package/templates/base/CHANGELOG.md +86 -0
- package/templates/base/README.md +110 -0
- package/templates/base/docs/CONTEXT.md +111 -0
- package/templates/base/docs/README.md +131 -0
- package/templates/base/docs/adr/TEMPLATE.md +83 -0
- package/templates/modules/agents/.agents/agents/doc-designer.md +56 -0
- package/templates/modules/agents/.agents/agents/doc-maintainer.md +54 -0
- package/templates/modules/agents/.agents/agents/doc-reviewer.md +80 -0
- package/templates/modules/agents/.agents/agents/doc-writer.md +66 -0
- package/templates/modules/agents/.agents/agents/reviewer.md +138 -0
- package/templates/modules/agents/.agents/skills/doc-design/SKILL.md +359 -0
- package/templates/modules/agents/.agents/skills/doc-design/references/design-system-format.md +550 -0
- package/templates/modules/agents/.agents/skills/doc-maintain/SKILL.md +345 -0
- package/templates/modules/agents/.agents/skills/doc-maintain/references/triggers.md +311 -0
- package/templates/modules/agents/.agents/skills/doc-review/SKILL.md +324 -0
- package/templates/modules/agents/.agents/skills/doc-review/references/health-checklist.md +290 -0
- package/templates/modules/agents/.agents/skills/doc-scaffold/SKILL.md +277 -0
- package/templates/modules/agents/.agents/skills/doc-scaffold/references/diataxis-quick-ref.md +149 -0
- package/templates/modules/agents/.agents/skills/doc-write/SKILL.md +414 -0
- package/templates/modules/agents/.agents/skills/doc-write/references/adr-format.md +194 -0
- package/templates/modules/agents/.agents/skills/doc-write/references/diataxis-patterns.md +351 -0
- package/templates/modules/ci/.github/workflows/docs-check.yml +94 -0
- package/templates/modules/design/docs/DESIGN.md +253 -0
- package/templates/modules/explanation/docs/explanation/agent-flow.md +15 -0
- package/templates/modules/explanation/docs/explanation/architecture.md +138 -0
- package/templates/modules/guides/docs/guides/deployment.md +189 -0
- package/templates/modules/guides/docs/guides/runbooks/TEMPLATE.md +86 -0
- package/templates/modules/guides/docs/guides/troubleshooting.md +65 -0
- package/templates/modules/operations/docs/operations/README.md +115 -0
- package/templates/modules/product/docs/product/overview.md +90 -0
- package/templates/modules/product/docs/roadmap.md +80 -0
- package/templates/modules/reference/docs/reference/api.md +131 -0
- package/templates/modules/reference/docs/reference/code-style.md +275 -0
- package/templates/modules/reference/docs/reference/configuration.md +117 -0
- package/templates/modules/reference/docs/reference/infrastructure.md +191 -0
- package/templates/modules/tutorials/docs/tutorials/environment-setup.md +212 -0
- package/templates/modules/tutorials/docs/tutorials/first-task.md +246 -0
- package/templates/modules/tutorials/docs/tutorials/quick-start.md +146 -0
- package/templates/shared/.editorconfig +20 -0
- package/templates/shared/.markdownlint.json +14 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
created: "2025-01-01"
|
|
3
|
+
status: active
|
|
4
|
+
type: reference
|
|
5
|
+
tags: [referencia, infraestructura, entornos, CI/CD, URLs, acceso]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Referencia de Infraestructura
|
|
9
|
+
|
|
10
|
+
Información técnica sobre los entornos, acceso y pipelines del proyecto.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Entornos
|
|
15
|
+
|
|
16
|
+
| Entorno | Propósito | URL | Branch trigger | Region |
|
|
17
|
+
|---------|-----------|-----|---------------|--------|
|
|
18
|
+
| **Development** | Desarrollo local | `http://localhost:3000` | N/A | Local |
|
|
19
|
+
| **Staging** | QA y validación | `https://staging.[dominio]` | Push a `[develop / main]` | [Región cloud] |
|
|
20
|
+
| **Production** | Usuarios finales | `https://[dominio]` | Tag `v*` o manual | [Región cloud] |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Arquitectura de infraestructura
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌──────────────┐
|
|
28
|
+
│ CDN / DNS │
|
|
29
|
+
│ [Proveedor] │
|
|
30
|
+
└──────┬───────┘
|
|
31
|
+
│
|
|
32
|
+
┌──────▼───────┐
|
|
33
|
+
│ Load Balancer│
|
|
34
|
+
│ [Proveedor] │
|
|
35
|
+
└──────┬───────┘
|
|
36
|
+
│
|
|
37
|
+
┌────────────┼────────────┐
|
|
38
|
+
│ │ │
|
|
39
|
+
┌──────▼──────┐ ┌──▼─────┐ ┌───▼──────┐
|
|
40
|
+
│ App Server │ │ App │ │ App │
|
|
41
|
+
│ (Primary) │ │ Server │ │ Server │
|
|
42
|
+
└──────┬──────┘ └──┬─────┘ └───┬──────┘
|
|
43
|
+
│ │ │
|
|
44
|
+
└───────────┼───────────┘
|
|
45
|
+
│
|
|
46
|
+
┌───────▼───────┐
|
|
47
|
+
│ Base de datos │
|
|
48
|
+
│ [Tipo + Host] │
|
|
49
|
+
└───────────────┘
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Servicios gestionados
|
|
53
|
+
|
|
54
|
+
| Servicio | Proveedor | Propósito | Plan / Tamaño |
|
|
55
|
+
|----------|-----------|-----------|---------------|
|
|
56
|
+
| **[App Hosting]** | [Proveedor — ej. Vercel / AWS ECS / Railway] | Hosting de la aplicación | [Plan] |
|
|
57
|
+
| **[Database]** | [Proveedor — ej. AWS RDS / Supabase / Neon] | Base de datos gestionada | [Plan y specs] |
|
|
58
|
+
| **[Cache]** | [Proveedor — ej. Redis Cloud / ElastiCache] | Caché y sesiones (si aplica) | [Plan] |
|
|
59
|
+
| **[Storage]** | [Proveedor — ej. S3 / Cloudflare R2] | Archivos estáticos y uploads | [Plan] |
|
|
60
|
+
| **[CDN]** | [Proveedor — ej. CloudFront / Cloudflare] | Distribución de contenido | [Plan] |
|
|
61
|
+
| **[Email]** | [Proveedor — ej. SendGrid / AWS SES] | Envío de emails transaccionales | [Plan] |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Acceso
|
|
66
|
+
|
|
67
|
+
### Hosting / Dashboard
|
|
68
|
+
|
|
69
|
+
| Servicio | URL de acceso | Quién tiene acceso |
|
|
70
|
+
|----------|--------------|-------------------|
|
|
71
|
+
| [App Hosting Dashboard] | `https://[dashboard-url]` | [Lista de personas / roles] |
|
|
72
|
+
| [Database Dashboard] | `https://[dashboard-url]` | [Lista de personas / roles] |
|
|
73
|
+
| [CI/CD Dashboard] | `https://[dashboard-url]` | Todos los developers |
|
|
74
|
+
|
|
75
|
+
### Base de datos
|
|
76
|
+
|
|
77
|
+
| Entorno | Host | Puerto | Database | Usuario de acceso |
|
|
78
|
+
|---------|------|--------|----------|-------------------|
|
|
79
|
+
| Staging | `[host]` | `[puerto]` | `[nombre]` | `[usuario de solo lectura para debugging]` |
|
|
80
|
+
| Production | `[host]` | `[puerto]` | `[nombre]` | Solo acceso vía aplicación. Acceso directo requiere aprobación. |
|
|
81
|
+
|
|
82
|
+
**Conexión directa para debugging** (solo staging):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
[comando de conexión — ej. psql "postgresql://user:pass@host:port/dbname"]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### SSH / Console *(si aplica)*
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Conectarse al servidor de staging
|
|
92
|
+
[comando — ej. ssh user@staging-host]
|
|
93
|
+
|
|
94
|
+
# Ver logs en tiempo real
|
|
95
|
+
[comando — ej. kubectl logs -f deployment/app -n staging]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## CI/CD Pipeline
|
|
101
|
+
|
|
102
|
+
### Overview
|
|
103
|
+
|
|
104
|
+
| Plataforma | Configuración | Ubicación |
|
|
105
|
+
|-----------|--------------|-----------|
|
|
106
|
+
| **[{{TECH_STACK}} / GitLab CI / etc.]** | YAML | `[.github/workflows/ o .gitlab-ci.yml]` |
|
|
107
|
+
|
|
108
|
+
### Stages
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
[Push / PR] → Lint → Test → Build → Deploy (solo en merge/tag)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Stage | Qué hace | Duración aprox. |
|
|
115
|
+
|-------|---------|-----------------|
|
|
116
|
+
| **Lint** | Ejecuta linter y formateador | ~30s |
|
|
117
|
+
| **Test** | Tests unitarios y de integración | ~2min |
|
|
118
|
+
| **Build** | Build de producción | ~1min |
|
|
119
|
+
| **Deploy Staging** | Deploy automático a staging (solo en push a main) | ~3min |
|
|
120
|
+
| **Deploy Production** | Deploy manual o via tag (solo desde main) | ~3min |
|
|
121
|
+
|
|
122
|
+
### Secrets del CI/CD
|
|
123
|
+
|
|
124
|
+
Los secrets se configuran en [Settings > Secrets / Variables] del repositorio:
|
|
125
|
+
|
|
126
|
+
| Secret | Propósito | Rotación |
|
|
127
|
+
|--------|-----------|----------|
|
|
128
|
+
| `[DEPLOY_KEY]` | Autenticación con el hosting | Cada 90 días |
|
|
129
|
+
| `[PRODUCTION_DATABASE_URL]` | Connection string de producción | Cuando se rota |
|
|
130
|
+
| `[API_KEY_SERVICIO]` | API key para servicios externos | Según política del servicio |
|
|
131
|
+
|
|
132
|
+
**Regla**: Nunca imprimir secrets en logs. Usar masked secrets en CI/CD.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Monitoreo y alertas
|
|
137
|
+
|
|
138
|
+
| Herramienta | URL | Qué monitorea |
|
|
139
|
+
|------------|-----|---------------|
|
|
140
|
+
| **[Uptime monitoring]** | `https://[dashboard]` | Disponibilidad de la aplicación |
|
|
141
|
+
| **[Error tracking]** | `https://[dashboard]` | Errores en producción (Sentry, etc.) |
|
|
142
|
+
| **[Logs]** | `https://[dashboard]` | Logs centralizados (DataDog, CloudWatch, etc.) |
|
|
143
|
+
| **[Performance]** | `https://[dashboard]` | Core Web Vitals y performance |
|
|
144
|
+
|
|
145
|
+
### Alertas activas
|
|
146
|
+
|
|
147
|
+
| Alerta | Condición | Canal de notificación |
|
|
148
|
+
|--------|-----------|----------------------|
|
|
149
|
+
| App down | Health check falla 3 veces seguidas | [Slack #incidentes + PagerDuty] |
|
|
150
|
+
| Error rate alto | > 5% de requests con error 5xx en 5 min | [Slack #incidentes] |
|
|
151
|
+
| Latencia alta | P95 > 3s por 5 minutos | [Slack #incidentes] |
|
|
152
|
+
| CPU alto | > 80% por 10 minutos | [Slack #infra] |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Backup y recuperación
|
|
157
|
+
|
|
158
|
+
| Qué | Frecuencia | Retención | Método |
|
|
159
|
+
|-----|-----------|-----------|--------|
|
|
160
|
+
| **Base de datos** | [Diaria / Continua] | [30 días] | [Automated backups del proveedor] |
|
|
161
|
+
| **Uploads / Files** | [Continua] | [Indefinida] | [Replicación del storage] |
|
|
162
|
+
| **Configuración** | En git | Indefinida | Versionado en el repositorio |
|
|
163
|
+
|
|
164
|
+
### Restaurar un backup
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# 1. Identificar el backup a restaurar
|
|
168
|
+
[comando para listar backups]
|
|
169
|
+
|
|
170
|
+
# 2. Restaurar (ejemplo con PostgreSQL)
|
|
171
|
+
pg_restore --clean --dbname=[DATABASE_URL] [archivo_de_backup]
|
|
172
|
+
|
|
173
|
+
# 3. Verificar integridad
|
|
174
|
+
[comando de verificación]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Escalamiento
|
|
180
|
+
|
|
181
|
+
| Recurso | Límite actual | Cuándo escalar | Cómo |
|
|
182
|
+
|---------|--------------|---------------|------|
|
|
183
|
+
| **App servers** | [N instancias] | CPU > 70% sostenido | [Auto-scaling / manual] |
|
|
184
|
+
| **Database** | [Specs] | Conexiones agotadas o queries lentas | [Upgrade de plan] |
|
|
185
|
+
| **Storage** | [GB] | Al 80% de capacidad | [Auto-expande / manual] |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Cambios a esta referencia
|
|
190
|
+
|
|
191
|
+
Cualquier cambio de infraestructura (nuevo servicio, cambio de plan, nueva URL) debe actualizarse en este archivo en el mismo PR o tarea que realiza el cambio.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
created: "2025-01-01"
|
|
3
|
+
status: active
|
|
4
|
+
type: tutorial
|
|
5
|
+
tags: [tutorial, setup, entorno, configuración, onboarding]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Configuración del Entorno de Desarrollo
|
|
9
|
+
|
|
10
|
+
Este tutorial te guía paso a paso para configurar tu entorno de desarrollo completo. Al terminar, tendrás todas las herramientas necesarias para trabajar en el proyecto de forma eficiente.
|
|
11
|
+
|
|
12
|
+
**Tiempo estimado**: 30 minutos.
|
|
13
|
+
**Audiencia**: Developers que se incorporan al proyecto.
|
|
14
|
+
**Prerrequisito**: Haber completado [`quick-start.md`](quick-start.md).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Prerrequisitos
|
|
19
|
+
|
|
20
|
+
Verificar que tienes las herramientas base instaladas (ver tabla en [`quick-start.md`](quick-start.md)).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Paso 1: Configurar el editor
|
|
25
|
+
|
|
26
|
+
### VS Code *(recomendado)*
|
|
27
|
+
|
|
28
|
+
Instalar las siguientes extensiones:
|
|
29
|
+
|
|
30
|
+
| Extensión | Para qué | ID |
|
|
31
|
+
|-----------|----------|----|
|
|
32
|
+
| **[ESLint / Linter]** | Mostrar errores de lint en el editor | `[dbaeumer.vscode-eslint]` |
|
|
33
|
+
| **[Prettier / Formatter]** | Formatear código al guardar | `[esbenp.prettier-vscode]` |
|
|
34
|
+
| **[Tailwind CSS IntelliSense]** | Autocompletado de clases | `[bradlc.vscode-tailwindcss]` |
|
|
35
|
+
| **[GitLens]** | Ver historial de cambios inline | `[eamodio.gitlens]` |
|
|
36
|
+
|
|
37
|
+
Configurar format-on-save. Añadir a `.vscode/settings.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"editor.formatOnSave": true,
|
|
42
|
+
"editor.defaultFormatter": "[esbenp.prettier-vscode]",
|
|
43
|
+
"editor.codeActionsOnSave": {
|
|
44
|
+
"source.fixAll.[eslint]": true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Otros editores
|
|
50
|
+
|
|
51
|
+
Si usas otro editor, asegúrate de configurar:
|
|
52
|
+
- Linter integrado
|
|
53
|
+
- Formateo automático al guardar
|
|
54
|
+
- Integración con git
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Paso 2: Configurar herramientas de línea de comandos
|
|
59
|
+
|
|
60
|
+
### Git hooks
|
|
61
|
+
|
|
62
|
+
Los hooks de git se instalan automáticamente al ejecutar `[npm install]`. Verificar:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
ls .git/hooks/
|
|
66
|
+
# Debería mostrar: pre-commit, commit-msg, etc.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### CLI tools recomendadas
|
|
70
|
+
|
|
71
|
+
| Herramienta | Para qué | Instalación |
|
|
72
|
+
|------------|----------|-------------|
|
|
73
|
+
| **[gh]** | GitHub CLI (PRs, issues desde terminal) | `brew install gh` / `winget install GitHub.cli` |
|
|
74
|
+
| **[ herramienta 2 ]** | [Descripción] | `[comando de instalación]` |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Paso 3: Configurar variables de entorno completas
|
|
79
|
+
|
|
80
|
+
Copiar y configurar el archivo de entorno:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
cp .env.example .env
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Variables obligatorias
|
|
87
|
+
|
|
88
|
+
| Variable | Descripción | Ejemplo | Cómo obtener el valor |
|
|
89
|
+
|----------|-------------|---------|----------------------|
|
|
90
|
+
| `APP_ENV` | Entorno de ejecución | `development` | Fijo |
|
|
91
|
+
| `[DATABASE_URL]` | Conexión a la base de datos local | `postgresql://user:pass@localhost:5432/dbname` | Ver Paso 4 |
|
|
92
|
+
| `[API_KEY_EXTERNA]` | API key para servicios externos | `[valor]` | Pedir al tech lead |
|
|
93
|
+
|
|
94
|
+
### Variables opcionales
|
|
95
|
+
|
|
96
|
+
| Variable | Default | Descripción |
|
|
97
|
+
|----------|---------|-------------|
|
|
98
|
+
| `LOG_LEVEL` | `info` | Nivel de logging (debug, info, warn, error) |
|
|
99
|
+
| `PORT` | `[3000]` | Puerto del servidor de desarrollo |
|
|
100
|
+
|
|
101
|
+
Ver la referencia completa en [`docs/reference/configuration.md`](../reference/configuration.md).
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Paso 4: Configurar la base de datos local
|
|
106
|
+
|
|
107
|
+
### Instalación *(si no la tienes)*
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# macOS
|
|
111
|
+
brew install [postgresql]
|
|
112
|
+
|
|
113
|
+
# Windows
|
|
114
|
+
winget install PostgreSQL.PostgreSQL
|
|
115
|
+
|
|
116
|
+
# Linux
|
|
117
|
+
sudo apt install postgresql
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Crear la base de datos
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Conectarse a PostgreSQL
|
|
124
|
+
psql -U postgres
|
|
125
|
+
|
|
126
|
+
# Crear base de datos y usuario
|
|
127
|
+
CREATE DATABASE [nombre_db];
|
|
128
|
+
CREATE USER [usuario] WITH PASSWORD '[password]';
|
|
129
|
+
GRANT ALL PRIVILEGES ON DATABASE [nombre_db] TO [usuario];
|
|
130
|
+
\q
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Ejecutar migraciones
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
[comando de migración — ej. npm run db:migrate]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Cargar datos de desarrollo
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
[comando de seed — ej. npm run db:seed]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Esto carga datos de ejemplo para poder trabajar localmente.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Paso 5: Verificar la configuración
|
|
150
|
+
|
|
151
|
+
Ejecuta esta lista de verificación:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# 1. Tests pasan
|
|
155
|
+
[npm run test]
|
|
156
|
+
|
|
157
|
+
# 2. Lint pasa
|
|
158
|
+
[npm run lint]
|
|
159
|
+
|
|
160
|
+
# 3. Build funciona
|
|
161
|
+
[npm run build]
|
|
162
|
+
|
|
163
|
+
# 4. Servidor arranca
|
|
164
|
+
[npm run dev]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Si todo pasa sin errores, tu entorno está listo.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Paso 6: Configuración adicional *(opcional)*
|
|
172
|
+
|
|
173
|
+
### Docker *(si el proyecto lo usa)*
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
docker-compose up -d
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Verifica que los contenedores estén corriendo:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
docker-compose ps
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### HTTPS local *(si es necesario)*
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Generar certificado local
|
|
189
|
+
[comando para generar cert]
|
|
190
|
+
|
|
191
|
+
# Arrancar con HTTPS
|
|
192
|
+
[comando específico]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Problemas comunes
|
|
198
|
+
|
|
199
|
+
| Problema | Solución |
|
|
200
|
+
|----------|----------|
|
|
201
|
+
| `EADDRINUSE` (puerto en uso) | Cambiar el puerto en `.env` o matar el proceso: `lsof -i :3000` |
|
|
202
|
+
| Tests fallan por conexión a DB | Verificar que PostgreSQL esté corriendo: `pg_isready` |
|
|
203
|
+
| `npm install` falla | Borrar `node_modules` y `package-lock.json`, verificar versión de Node |
|
|
204
|
+
| Hook de git falla | Reinstalar hooks: `npm install` |
|
|
205
|
+
|
|
206
|
+
Más soluciones en [`docs/guides/troubleshooting.md`](../guides/troubleshooting.md).
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Siguiente paso
|
|
211
|
+
|
|
212
|
+
Ahora que tu entorno está listo, haz tu primera contribución: [`first-task.md`](first-task.md).
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
created: "2025-01-01"
|
|
3
|
+
status: active
|
|
4
|
+
type: tutorial
|
|
5
|
+
tags: [tutorial, primera-tarea, contribución, PR, git]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Tu Primera Tarea — End to End
|
|
9
|
+
|
|
10
|
+
Este tutorial te guía a través del ciclo completo de desarrollo: desde crear una branch hasta mergear tu PR. Lo harás con una tarea real (o un ejercicio de prueba).
|
|
11
|
+
|
|
12
|
+
**Tiempo estimado**: 30-45 minutos.
|
|
13
|
+
**Audiencia**: Developers que hacen su primera contribución al proyecto.
|
|
14
|
+
**Prerrequisitos**: Haber completado [`quick-start.md`](quick-start.md) y [`environment-setup.md`](environment-setup.md).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Qué vas a construir
|
|
19
|
+
|
|
20
|
+
[Descripción de la tarea de ejemplo. Ejemplo: "Vas a añadir un componente de 'Alerta' al design system que muestre mensajes de éxito, warning y error con estilo consistente."]
|
|
21
|
+
|
|
22
|
+
Al terminar, habrás practicado:
|
|
23
|
+
- Crear una branch
|
|
24
|
+
- Escribir código siguiendo las convenciones del proyecto
|
|
25
|
+
- Escribir tests
|
|
26
|
+
- Crear un Pull Request
|
|
27
|
+
- Responder a code review
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Paso 1: Actualizar main y crear tu branch
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Asegúrate de estar en main
|
|
35
|
+
git checkout main
|
|
36
|
+
|
|
37
|
+
# Actualiza con los últimos cambios
|
|
38
|
+
git pull origin main
|
|
39
|
+
|
|
40
|
+
# Crea tu branch de trabajo
|
|
41
|
+
git checkout -b feature/[nombre-de-tu-feature]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Nombrar la branch siguiendo las convenciones de [`dev-workflow.md`](../dev-workflow.md):
|
|
45
|
+
- `feature/` para features nuevas
|
|
46
|
+
- `fix/` para bug fixes
|
|
47
|
+
- `refactor/` para refactors
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Paso 2: Leer la documentación relevante
|
|
52
|
+
|
|
53
|
+
Antes de escribir código, leer:
|
|
54
|
+
|
|
55
|
+
1. [`docs/CONTEXT.md`](../CONTEXT.md) — Vocabulario del dominio.
|
|
56
|
+
2. [`docs/explanation/architecture.md`](../explanation/architecture.md) — Cómo está estructurado el proyecto.
|
|
57
|
+
3. [`docs/DESIGN.md`](../DESIGN.md) — Si tu tarea involucra UI (colores, tipografía, componentes).
|
|
58
|
+
4. [`docs/adr/`](../adr/) — Verificar si hay ADRs relacionados con tu tarea.
|
|
59
|
+
|
|
60
|
+
Esto te dará el contexto necesario para escribir código que sigue las convenciones del proyecto.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Paso 3: Implementar
|
|
65
|
+
|
|
66
|
+
### 3.1 Identificar dónde va tu cambio
|
|
67
|
+
|
|
68
|
+
Mirar la estructura del proyecto (ver `AGENTS.md`) y encontrar el lugar correcto:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
src/
|
|
72
|
+
├── components/ ← Si es un componente UI
|
|
73
|
+
├── pages/ ← Si es una página nueva
|
|
74
|
+
├── services/ ← Si es lógica de negocio
|
|
75
|
+
├── utils/ ← Si es una utilidad reutilizable
|
|
76
|
+
└── types/ ← Si necesitas definir tipos nuevos
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3.2 Escribir el código
|
|
80
|
+
|
|
81
|
+
Seguir las convenciones:
|
|
82
|
+
|
|
83
|
+
- **Nombres en inglés** (variables, funciones, archivos).
|
|
84
|
+
- **Comentarios en español** cuando sean necesarios.
|
|
85
|
+
- **Tipado** (si el proyecto usa TypeScript): tipar todo lo que se pueda.
|
|
86
|
+
- **Accesibilidad**: si es UI, incluir `aria-labels`, roles semánticos, contraste adecuado.
|
|
87
|
+
|
|
88
|
+
### 3.3 Verificar mientras desarrollas
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# En una terminal, mantener el servidor corriendo
|
|
92
|
+
[npm run dev]
|
|
93
|
+
|
|
94
|
+
# En otra terminal, ejecutar lint después de cambios significativos
|
|
95
|
+
[npm run lint]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Paso 4: Escribir tests
|
|
101
|
+
|
|
102
|
+
Todo código nuevo debe incluir tests. Ver las reglas en [`dev-workflow.md`](../dev-workflow.md).
|
|
103
|
+
|
|
104
|
+
### Qué testear
|
|
105
|
+
|
|
106
|
+
- **Happy path**: el caso principal donde todo funciona correctamente.
|
|
107
|
+
- **Edge cases**: datos vacíos, valores límite, inputs inesperados.
|
|
108
|
+
- **Error cases**: qué pasa cuando algo falla.
|
|
109
|
+
|
|
110
|
+
### Ejemplo
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// [archivo de test — ej. src/components/Alert.test.tsx]
|
|
114
|
+
describe('Alert', () => {
|
|
115
|
+
it('muestra el mensaje correctamente', () => {
|
|
116
|
+
// Test del happy path
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('aplica el estilo según la variante', () => {
|
|
120
|
+
// Test de cada variante (success, warning, error)
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('es accesible', () => {
|
|
124
|
+
// Test de accesibilidad (aria-label, role)
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Ejecutar los tests
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
[npm run test]
|
|
133
|
+
|
|
134
|
+
# Si quieres ejecutar solo los tests de tu cambio:
|
|
135
|
+
[comando específico — ej. npm run test -- --grep "Alert"]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Paso 5: Commit y push
|
|
141
|
+
|
|
142
|
+
### Hacer commit
|
|
143
|
+
|
|
144
|
+
Seguir el formato de Conventional Commits (ver [`dev-workflow.md`](../dev-workflow.md)):
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
git add [archivos modificados]
|
|
148
|
+
git commit -m "feat([alcance]): descripción breve del cambio"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Ejemplos:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git commit -m "feat(ui): se añadió componente Alert con variantes success, warning y error"
|
|
155
|
+
git commit -m "test(ui): se añadieron tests unitarios para componente Alert"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Hacer push
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git push -u origin feature/[nombre-de-tu-feature]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Paso 6: Crear el Pull Request
|
|
167
|
+
|
|
168
|
+
### En GitHub
|
|
169
|
+
|
|
170
|
+
1. Ir al repositorio en GitHub.
|
|
171
|
+
2. Click en "Compare & pull request".
|
|
172
|
+
3. Llenar el template de PR (definido en [`dev-workflow.md`](../dev-workflow.md)):
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
## Qué hace
|
|
176
|
+
[Añadí el componente Alert con 3 variantes: success, warning y error.]
|
|
177
|
+
|
|
178
|
+
## Por qué
|
|
179
|
+
[El design system no tenía un componente estándar para alertas. Cada página implementaba su propio estilo.]
|
|
180
|
+
|
|
181
|
+
## Cómo probar
|
|
182
|
+
1. Arrancar el servidor con `npm run dev`
|
|
183
|
+
2. Ir a la página de demo: `/demo/alerts`
|
|
184
|
+
3. Verificar que las 3 variantes se renderizan correctamente
|
|
185
|
+
4. Verificar que los tests pasan: `npm run test`
|
|
186
|
+
|
|
187
|
+
## Checklist
|
|
188
|
+
- [x] Tests añadidos
|
|
189
|
+
- [x] Lint pasa sin errores
|
|
190
|
+
- [ ] Documentación actualizada (verificar si DESIGN.md necesita update)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Asignar reviewers
|
|
194
|
+
|
|
195
|
+
Asignar al menos un reviewer según el área:
|
|
196
|
+
- **UI/UX**: [Nombre del diseñador/a o frontend lead]
|
|
197
|
+
- **Backend**: [Nombre del backend lead]
|
|
198
|
+
- **General**: [Tech lead]
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Paso 7: Responder al code review
|
|
203
|
+
|
|
204
|
+
Es normal recibir comentarios. No tomarlos personalmente.
|
|
205
|
+
|
|
206
|
+
1. **Leer todos los comentarios** antes de empezar a responder.
|
|
207
|
+
2. **Clasificar**: blocker (🔴), sugerencia (🟡), nit (🟢).
|
|
208
|
+
3. **Corregir** los blockers primero, luego las sugerencias.
|
|
209
|
+
4. **Hacer commit** con los cambios:
|
|
210
|
+
```bash
|
|
211
|
+
git commit -m "refactor([alcance]): se aplicó feedback del code review"
|
|
212
|
+
git push
|
|
213
|
+
```
|
|
214
|
+
5. **Pedir re-review** cuando termines.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Paso 8: Merge
|
|
219
|
+
|
|
220
|
+
Una vez que el PR esté aprobado y CI pase:
|
|
221
|
+
|
|
222
|
+
1. Hacer **squash merge** desde GitHub (o pedir a quien tenga permisos).
|
|
223
|
+
2. Borrar la branch remota.
|
|
224
|
+
3. Actualizar tu local:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
git checkout main
|
|
228
|
+
git pull origin main
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Checklist final
|
|
234
|
+
|
|
235
|
+
Después de mergear, verificar:
|
|
236
|
+
|
|
237
|
+
- [ ] ¿Se actualizó la documentación afectada? (Ver [`AGENTS.md`](../../AGENTS.md) checklist post-tarea.)
|
|
238
|
+
- [ ] ¿Se añadió un término nuevo al dominio? → Actualizar [`CONTEXT.md`](../CONTEXT.md).
|
|
239
|
+
- [ ] ¿Se tomó una decisión técnica? → Crear ADR en [`docs/adr/`](../adr/TEMPLATE.md).
|
|
240
|
+
- [ ] ¿Se cambió algo visual? → Actualizar [`DESIGN.md`](../DESIGN.md).
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Felicidades
|
|
245
|
+
|
|
246
|
+
Acabas de completar tu primera contribución end-to-end. Ya conoces el flujo completo del proyecto. Para siguientes tareas, el proceso es el mismo: branch → código → tests → PR → review → merge.
|