trackops 2.0.4 → 2.0.6

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.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +660 -575
  3. package/bin/trackops.js +127 -106
  4. package/lib/cli-format.js +118 -0
  5. package/lib/config.js +352 -326
  6. package/lib/control.js +408 -246
  7. package/lib/env.js +234 -222
  8. package/lib/i18n.js +5 -4
  9. package/lib/init.js +390 -282
  10. package/lib/locale.js +41 -41
  11. package/lib/opera-bootstrap.js +1066 -880
  12. package/lib/opera.js +615 -444
  13. package/lib/preferences.js +74 -74
  14. package/lib/registry.js +214 -214
  15. package/lib/release.js +56 -56
  16. package/lib/runtime-state.js +144 -144
  17. package/lib/skills.js +114 -89
  18. package/lib/workspace.js +259 -248
  19. package/locales/en.json +311 -167
  20. package/locales/es.json +314 -170
  21. package/package.json +61 -58
  22. package/scripts/postinstall-locale.js +21 -21
  23. package/scripts/skills-marketplace-smoke.js +124 -124
  24. package/scripts/smoke-tests.js +563 -517
  25. package/scripts/sync-skill-version.js +21 -21
  26. package/scripts/validate-skill.js +103 -103
  27. package/skills/trackops/SKILL.md +126 -122
  28. package/skills/trackops/agents/openai.yaml +7 -7
  29. package/skills/trackops/locales/en/SKILL.md +126 -122
  30. package/skills/trackops/locales/en/references/activation.md +94 -90
  31. package/skills/trackops/locales/en/references/troubleshooting.md +73 -67
  32. package/skills/trackops/locales/en/references/workflow.md +55 -32
  33. package/skills/trackops/references/activation.md +94 -90
  34. package/skills/trackops/references/troubleshooting.md +73 -67
  35. package/skills/trackops/references/workflow.md +55 -32
  36. package/skills/trackops/skill.json +29 -29
  37. package/templates/hooks/post-checkout +2 -2
  38. package/templates/hooks/post-commit +2 -2
  39. package/templates/hooks/post-merge +2 -2
  40. package/templates/opera/agent.md +28 -27
  41. package/templates/opera/architecture/dependency-graph.md +24 -24
  42. package/templates/opera/architecture/runtime-automation.md +24 -24
  43. package/templates/opera/architecture/runtime-operations.md +34 -34
  44. package/templates/opera/en/agent.md +22 -21
  45. package/templates/opera/en/architecture/dependency-graph.md +24 -24
  46. package/templates/opera/en/architecture/runtime-automation.md +24 -24
  47. package/templates/opera/en/architecture/runtime-operations.md +34 -34
  48. package/templates/opera/en/reviews/delivery-audit.md +18 -18
  49. package/templates/opera/en/reviews/integration-audit.md +18 -18
  50. package/templates/opera/en/router.md +24 -19
  51. package/templates/opera/references/autonomy-and-recovery.md +117 -117
  52. package/templates/opera/references/opera-cycle.md +193 -193
  53. package/templates/opera/registry.md +28 -28
  54. package/templates/opera/reviews/delivery-audit.md +18 -18
  55. package/templates/opera/reviews/integration-audit.md +18 -18
  56. package/templates/opera/router.md +54 -49
  57. package/templates/skills/changelog-updater/SKILL.md +69 -69
  58. package/templates/skills/commiter/SKILL.md +99 -99
  59. package/templates/skills/opera-contract-auditor/SKILL.md +38 -38
  60. package/templates/skills/opera-contract-auditor/locales/en/SKILL.md +38 -38
  61. package/templates/skills/opera-policy-guard/SKILL.md +26 -26
  62. package/templates/skills/opera-policy-guard/locales/en/SKILL.md +26 -26
  63. package/templates/skills/opera-skill/SKILL.md +279 -0
  64. package/templates/skills/opera-skill/locales/en/SKILL.md +279 -0
  65. package/templates/skills/opera-skill/locales/en/references/phase-dod.md +138 -0
  66. package/templates/skills/opera-skill/references/phase-dod.md +138 -0
  67. package/templates/skills/project-starter-skill/SKILL.md +150 -131
  68. package/templates/skills/project-starter-skill/locales/en/SKILL.md +143 -105
  69. package/templates/skills/project-starter-skill/references/opera-cycle.md +195 -193
  70. package/ui/css/base.css +284 -284
  71. package/ui/css/charts.css +425 -425
  72. package/ui/css/components.css +1107 -1107
  73. package/ui/css/onboarding.css +133 -133
  74. package/ui/css/terminal.css +125 -125
  75. package/ui/css/timeline.css +58 -58
  76. package/ui/css/tokens.css +284 -284
  77. package/ui/favicon.svg +5 -5
  78. package/ui/index.html +99 -99
  79. package/ui/js/charts.js +526 -526
  80. package/ui/js/console-logger.js +172 -172
  81. package/ui/js/filters.js +247 -247
  82. package/ui/js/icons.js +129 -129
  83. package/ui/js/keyboard.js +229 -229
  84. package/ui/js/router.js +142 -142
  85. package/ui/js/theme.js +100 -100
  86. package/ui/js/time-tracker.js +248 -248
  87. package/ui/js/views/dashboard.js +870 -870
  88. package/ui/js/views/flash.js +47 -47
  89. package/ui/js/views/projects.js +745 -745
  90. package/ui/js/views/scrum.js +476 -476
  91. package/ui/js/views/settings.js +331 -331
  92. package/ui/js/views/timeline.js +265 -265
@@ -1,105 +1,143 @@
1
- ---
2
- name: "project-starter-skill"
3
- description: "Skill for discovery and early project structuring with TrackOps and OPERA. Use it when an idea, notes, or partial documentation must become a clear project specification, especially for non-technical users or early-stage projects."
4
- metadata:
5
- version: "4.0"
6
- type: "global"
7
- ---
8
-
9
- # Project Starter Skill
10
-
11
- Your job is to turn an idea or partial documentation into a structured, explainable project.
12
-
13
- ## Core rule
14
-
15
- Start from the person, not from the architecture.
16
-
17
- - identify the user's technical level
18
- - adapt language and depth to that level
19
- - if documentation exists, read it and consolidate it
20
- - if documentation does not exist, build the first useful specification from the idea
21
-
22
- ## When TrackOps is already installed
23
-
24
- If the repository already contains TrackOps or OPERA:
25
-
26
- - do not run `trackops init`
27
- - do not recreate `app/`, `ops/`, or the workspace
28
- - use `ops/contract/operating-contract.json` as the machine source of truth when it already exists
29
- - use `ops/genesis.md` as the compiled human view
30
- - use `ops/project_control.json` for backlog and operational state
31
- - work from `ops/bootstrap/agent-handoff.md`
32
- - write:
33
- - `ops/bootstrap/intake.json`
34
- - `ops/bootstrap/spec-dossier.md`
35
- - `ops/bootstrap/open-questions.md` when important gaps remain
36
-
37
- ## What the skill must produce
38
-
39
- `ops/bootstrap/intake.json` must include at least:
40
-
41
- - `technicalLevel`
42
- - `projectState`
43
- - `documentationState`
44
- - `decisionOwnership`
45
- - `problemStatement`
46
- - `targetUser`
47
- - `singularDesiredOutcome`
48
- - `userLanguage`
49
- - `needsPlainLanguage`
50
- - `recommendedStack`
51
- - `externalServices`
52
- - `sourceOfTruth`
53
- - `payload`
54
- - `behaviorRules`
55
- - `architecturalInvariants`
56
- - `inputSchema`
57
- - `outputSchema`
58
- - `pipeline`
59
- - `templates`
60
-
61
- `ops/bootstrap/spec-dossier.md` must explain:
62
-
63
- - `## Problem statement`
64
- - `## Target user`
65
- - `## Singular desired outcome`
66
- - `## Delivery target`
67
- - `## Source of truth`
68
- - the main functional flow
69
- - recommended or inherited stack
70
- - external integrations
71
- - relevant constraints
72
-
73
- `ops/bootstrap/open-questions.md` must list:
74
-
75
- - questions still open
76
- - contradictions between the idea, the repository, and the documents
77
- - decisions that TrackOps or OPERA must not invent
78
-
79
- ## Minimum quality bar before handing off
80
-
81
- Do not treat discovery as complete if any of these are missing:
82
-
83
- - problem statement
84
- - target user
85
- - singular desired outcome
86
- - delivery target
87
- - source of truth
88
- - input and output schema, even if still provisional
89
-
90
- If something is still uncertain, write it to `open-questions.md` instead of inventing it.
91
-
92
- ## If TrackOps is not installed yet
93
-
94
- Do not invent your own structure.
95
-
96
- Explain the correct flow:
97
-
98
- ```bash
99
- npx skills add Baxahaun/trackops
100
- npm install -g trackops
101
- trackops init
102
- trackops opera install
103
- ```
104
-
105
- If the user only has an idea, make it explicit that TrackOps can route bootstrap into an agent-led discovery conversation.
1
+ ---
2
+ name: "project-starter-skill"
3
+ description: "Skill for discovery and early project structuring with TrackOps and OPERA. Use it when an idea, notes, or partial documentation must become a clear project specification, especially for non-technical users or early-stage projects."
4
+ metadata:
5
+ version: "5.0"
6
+ type: "global"
7
+ ---
8
+
9
+ # Project Starter Skill
10
+
11
+ Your job is to turn an idea or partial documentation into a structured, explainable project.
12
+
13
+ > **IMPORTANT**: The framework is called **OPERA** (Orchestrate, Prove, Establish, Refine, Automate). NEVER use "ETAPA", "E.T.A.P.A.", or any other alternative name. The correct and only name is **OPERA**.
14
+
15
+ ## Core rule
16
+
17
+ Start from the person, not from the architecture.
18
+
19
+ - identify the user's technical level
20
+ - adapt language and depth to that level
21
+ - if documentation exists, read it and consolidate it
22
+ - if documentation does not exist, build the first useful specification from the idea
23
+
24
+ ## Do not assume ask
25
+
26
+ Before making decisions about infrastructure, repositories, licenses, or stack, **ask the user**. Do not take anything for granted.
27
+
28
+ ### Repository and version control questions
29
+
30
+ These questions are mandatory during discovery:
31
+
32
+ 1. **Remote repository**: Do you want a remote repository? (yes/no)
33
+ 2. **Platform**: If yes, which? (GitHub / GitLab / Bitbucket / other — specify)
34
+ 3. **Existing repository**: Does the repository already exist, or should it be created?
35
+ 4. **Visibility**: Public or private?
36
+ 5. **License**: What software license? (MIT / Apache 2.0 / GPL / proprietary / other — or "I don't know, recommend one")
37
+ 6. **Organization**: Under which user or organization?
38
+
39
+ ### Environment and deployment questions
40
+
41
+ Complementary to the repository:
42
+
43
+ 7. **Runtime environment**: Where will it run? (local / server / cloud / edge / not sure yet)
44
+ 8. **CI/CD**: Do you need continuous integration or automatic deployment? (yes/no/not sure)
45
+ 9. **Domain/URL**: Do you have a domain or target URL?
46
+
47
+ If the user doesn't know or has no preference, you may recommend, but **mark the recommendation as such** and ask for confirmation before proceeding. Never create repositories, licenses, or structure without explicit approval.
48
+
49
+ ## When TrackOps is already installed
50
+
51
+ If the repository already contains TrackOps or OPERA:
52
+
53
+ - do not run `trackops init`
54
+ - do not recreate `app/`, `ops/`, or the workspace
55
+ - use `ops/contract/operating-contract.json` as the machine source of truth when it already exists
56
+ - use `ops/genesis.md` as the compiled human view
57
+ - use `ops/project_control.json` for backlog and operational state
58
+ - work from `ops/bootstrap/agent-handoff.md`
59
+ - write:
60
+ - `ops/bootstrap/intake.json`
61
+ - `ops/bootstrap/spec-dossier.md`
62
+ - `ops/bootstrap/open-questions.md` when important gaps remain
63
+
64
+ ## What the skill must produce
65
+
66
+ `ops/bootstrap/intake.json` must include at least:
67
+
68
+ - `technicalLevel`
69
+ - `projectState`
70
+ - `documentationState`
71
+ - `decisionOwnership`
72
+ - `problemStatement`
73
+ - `targetUser`
74
+ - `singularDesiredOutcome`
75
+ - `userLanguage`
76
+ - `needsPlainLanguage`
77
+ - `recommendedStack`
78
+ - `externalServices`
79
+ - `sourceOfTruth`
80
+ - `payload`
81
+ - `behaviorRules`
82
+ - `architecturalInvariants`
83
+ - `inputSchema`
84
+ - `outputSchema`
85
+ - `pipeline`
86
+ - `templates`
87
+ - `versionControl` object with repository decisions:
88
+ - `remote` (boolean)
89
+ - `platform` (github/gitlab/bitbucket/other/none)
90
+ - `repoExists` (boolean)
91
+ - `visibility` (public/private)
92
+ - `license` (MIT/Apache-2.0/GPL-3.0/proprietary/other)
93
+ - `org` (user or organization)
94
+ - `deployment` object with environment decisions:
95
+ - `target` (local/server/cloud/edge/undecided)
96
+ - `cicd` (boolean or null if undecided)
97
+ - `domain` (string or null)
98
+
99
+ `ops/bootstrap/spec-dossier.md` must explain:
100
+
101
+ - `## Problem statement`
102
+ - `## Target user`
103
+ - `## Singular desired outcome`
104
+ - `## Delivery target`
105
+ - `## Source of truth`
106
+ - the main functional flow
107
+ - recommended or inherited stack
108
+ - external integrations
109
+ - relevant constraints
110
+
111
+ `ops/bootstrap/open-questions.md` must list:
112
+
113
+ - questions still open
114
+ - contradictions between the idea, the repository, and the documents
115
+ - decisions that TrackOps or OPERA must not invent
116
+
117
+ ## Minimum quality bar before handing off
118
+
119
+ Do not treat discovery as complete if any of these are missing:
120
+
121
+ - problem statement
122
+ - target user
123
+ - singular desired outcome
124
+ - delivery target
125
+ - source of truth
126
+ - input and output schema, even if still provisional
127
+ - repository and version control preferences
128
+
129
+ If something is still uncertain, write it to `open-questions.md` instead of inventing it.
130
+
131
+ ## If TrackOps is not installed yet
132
+
133
+ Do not invent your own structure.
134
+
135
+ Explain the correct flow:
136
+
137
+ ```bash
138
+ npx skills add Baxahaun/trackops
139
+ trackops init
140
+ trackops opera install
141
+ ```
142
+
143
+ If the user only has an idea, make it explicit that TrackOps can route bootstrap into an agent-led discovery conversation.
@@ -1,193 +1,195 @@
1
- # El Ciclo O.P.E.R.A. — Referencia Completa
2
-
3
- Este documento detalla cada fase del ciclo con sus reglas, procedimientos y Definitions of Done.
4
-
5
- ---
6
-
7
- ## 1️⃣ O — Orquestar (Visión y Lógica)
8
-
9
- ### Descubrimiento
10
-
11
- Haz al usuario las 5 preguntas clave:
12
-
13
- 1. **Directriz Principal**: ¿Cuál es el resultado singular deseado?
14
- 2. **Integraciones**: ¿Qué servicios externos necesitamos? ¿Están listas las claves?
15
- 3. **Fuente de la Verdad**: ¿Dónde viven los datos primarios?
16
- 4. **Carga Útil (Payload)**: ¿Cómo y dónde debe entregarse el resultado final?
17
- 5. **Reglas de Comportamiento**: Restricciones o tono específico.
18
-
19
- ### Regla "Datos-Primero"
20
-
21
- Antes de pasar a la siguiente fase, DEBES definir el **Esquema de Datos JSON** (Input/Output) en `genesis.md`.
22
-
23
- Ejemplo de schema en genesis.md:
24
-
25
- ```json
26
- {
27
- "input": {
28
- "source": "API externa",
29
- "schema": {
30
- "id": "string (UUID)",
31
- "timestamp": "ISO 8601",
32
- "data": "object"
33
- }
34
- },
35
- "output": {
36
- "destination": "webhook POST",
37
- "schema": {
38
- "processed_id": "string (UUID)",
39
- "result": "object",
40
- "status": "enum: success|error"
41
- }
42
- }
43
- }
44
- ```
45
-
46
- ### Definition of Done — Fase O
47
-
48
- - [ ] Las 5 preguntas de descubrimiento están respondidas.
49
- - [ ] Esquema JSON de Input/Output definido en `genesis.md`.
50
- - [ ] Reglas de comportamiento documentadas en `genesis.md`.
51
- - [ ] `task_plan.md` tiene plano aprobado por el usuario.
52
-
53
- ---
54
-
55
- ## 2️⃣ P — Probar (Conectividad)
56
-
57
- Verifica las tuberías antes de pasar el agua. El objetivo es confirmar que todos los servicios externos responden y devuelven datos con la forma esperada.
58
-
59
- ### Procedimiento
60
-
61
- 1. **Verificación de credenciales**: Lee `.env` y confirma que todas las claves necesarias existen y no están vacías.
62
- 2. **Handshake**: Construye scripts mínimos en `tools/` (ej: `test_api.py`) para verificar cada servicio.
63
- 3. **Validación de Shape**: No basta con un HTTP 200. Verifica que la respuesta coincide con el schema definido en `genesis.md`. Compara campos, tipos de datos y estructura.
64
- 4. **Bloqueo**: Si algún test falla, NO procedas a la fase de Estructurar. Documenta el fallo en `findings.md`.
65
-
66
- ### Ejemplo de test mínimo
67
-
68
- ```python
69
- # tools/test_api.py
70
- import os
71
- import requests
72
-
73
- API_KEY = os.getenv("API_KEY")
74
- BASE_URL = os.getenv("API_BASE_URL")
75
-
76
- def test_connection():
77
- """Verifica conexión y shape de respuesta."""
78
- response = requests.get(f"{BASE_URL}/health", headers={"Authorization": f"Bearer {API_KEY}"})
79
- assert response.status_code == 200, f"Expected 200, got {response.status_code}"
80
- data = response.json()
81
- assert "id" in data, "Missing 'id' field in response"
82
- assert "status" in data, "Missing 'status' field in response"
83
- print(" API connection and shape validated")
84
-
85
- if __name__ == "__main__":
86
- test_connection()
87
- ```
88
-
89
- ### Definition of Done — Fase P
90
-
91
- - [ ] Todas las credenciales `.env` verificadas (existen y no están vacías).
92
- - [ ] Scripts `test_*.py` ejecutados y pasando.
93
- - [ ] Respuestas de APIs validadas contra el schema de `genesis.md`.
94
- - [ ] Resultados documentados en `findings.md`.
95
-
96
- ---
97
-
98
- ## 3️⃣ E — Estructurar (La Construcción de 3 Capas)
99
-
100
- ### Capa 1: Arquitectura (`architecture/`)
101
-
102
- SOPs (Standard Operating Procedures) técnicos en Markdown. Cada SOP define:
103
-
104
- - Propósito del script.
105
- - Entradas esperadas (con referencia al schema en `genesis.md`).
106
- - Salidas producidas.
107
- - Casos extremos y cómo manejarlos.
108
- - Dependencias con otras herramientas.
109
-
110
- **Regla**: Si la lógica cambia, actualiza el SOP **antes** que el código.
111
-
112
- ### Capa 2: Navegación (El Agente)
113
-
114
- Capa de razonamiento. Enruta datos entre SOPs y herramientas. No ejecuta lógica de negocio directamente; delega a los scripts.
115
-
116
- ### Capa 3: Herramientas (`tools/`)
117
-
118
- - Scripts atómicos y deterministas.
119
- - Las variables de entorno van en `.env`.
120
- - Usa `.tmp/` para todas las operaciones intermedias.
121
- - Cada script hace UNA cosa bien.
122
-
123
- ### Regla de Idempotencia
124
-
125
- Toda herramienta DEBE ser idempotente. Herramientas con side-effects irreversibles se marcan:
126
-
127
- ```python
128
- # META: side-effect: true
129
- # META: idempotent: false
130
- # META: requires-confirmation: true
131
- ```
132
-
133
- ### Grafo de Dependencias
134
-
135
- Si una herramienta produce output que consume otra, documéntalo en `genesis.md` bajo `## Pipeline`:
136
-
137
- ```markdown
138
- ## Pipeline
139
- ### tool_fetch.py → tool_transform.py
140
- - Output: `.tmp/raw_data.json`
141
- - Formato: JSON array según schema X
142
- ```
143
-
144
- ### Definition of Done — Fase E
145
-
146
- - [ ] SOPs escritos en `architecture/` para cada herramienta.
147
- - [ ] Scripts implementados en `tools/`.
148
- - [ ] Grafo de dependencias documentado en `genesis.md`.
149
- - [ ] Tests de integración entre herramientas pasando.
150
- - [ ] Herramientas con side-effects marcadas con META tags.
151
-
152
- ---
153
-
154
- ## 4️⃣ R — Refinar (Refinamiento)
155
-
156
- ### Templates de Output
157
-
158
- Toda salida del sistema se valida contra una plantilla definida en `templates/`. Las plantillas se referencian desde `genesis.md` bajo `## Templates`.
159
-
160
- El refinamiento no es subjetivo; es verificable contra una plantilla. Si el output no coincide con el template, no pasa.
161
-
162
- ### Refinamiento de Carga Útil
163
-
164
- Formatea todas las salidas (Markdown, HTML, JSON limpio) para entrega profesional según lo definido en `genesis.md`.
165
-
166
- ### UX/UI
167
-
168
- Si el proyecto tiene interfaz, aplica diseños limpios e intuitivos según las especificaciones.
169
-
170
- ### Definition of Done Fase R
171
-
172
- - [ ] Todas las salidas validadas contra sus templates en `templates/`.
173
- - [ ] Formatos de entrega (Markdown, HTML, JSON) verificados.
174
- - [ ] Si hay interfaz: revisión visual completada.
175
-
176
- ---
177
-
178
- ## 5️⃣ A — Automatizar (Despliegue)
179
-
180
- ### Procedimiento
181
-
182
- 1. **Limpieza**: Elimina residuos de `.tmp/`.
183
- 2. **Transferencia**: Mueve la lógica finalizada a producción/nube.
184
- 3. **Configuración**: Establece los disparadores (Cron, Webhooks).
185
- 4. **Smoke Test**: Verificación mínima en el entorno de producción.
186
-
187
- ### Definition of Done Fase A
188
-
189
- - [ ] `.tmp/` limpio (sin archivos residuales).
190
- - [ ] Código desplegado en destino final.
191
- - [ ] Triggers configurados y verificados.
192
- - [ ] Smoke test en producción pasando.
193
- - [ ] `progress.md` actualizado con estado final.
1
+ # El Ciclo O.P.E.R.A. — Referencia Completa
2
+
3
+ > **IMPORTANTE**: El framework se llama **OPERA** (Orquestar, Probar, Estructurar, Refinar, Automatizar). NO uses "ETAPA", "E.T.A.P.A." ni ningún otro nombre alternativo. El nombre correcto y único es **OPERA**.
4
+
5
+ Este documento detalla cada fase del ciclo con sus reglas, procedimientos y Definitions of Done.
6
+
7
+ ---
8
+
9
+ ## 1️⃣ O — Orquestar (Visión y Lógica)
10
+
11
+ ### Descubrimiento
12
+
13
+ Haz al usuario las 5 preguntas clave:
14
+
15
+ 1. **Directriz Principal**: ¿Cuál es el resultado singular deseado?
16
+ 2. **Integraciones**: ¿Qué servicios externos necesitamos? ¿Están listas las claves?
17
+ 3. **Fuente de la Verdad**: ¿Dónde viven los datos primarios?
18
+ 4. **Carga Útil (Payload)**: ¿Cómo y dónde debe entregarse el resultado final?
19
+ 5. **Reglas de Comportamiento**: Restricciones o tono específico.
20
+
21
+ ### Regla "Datos-Primero"
22
+
23
+ Antes de pasar a la siguiente fase, DEBES definir el **Esquema de Datos JSON** (Input/Output) en `genesis.md`.
24
+
25
+ Ejemplo de schema en genesis.md:
26
+
27
+ ```json
28
+ {
29
+ "input": {
30
+ "source": "API externa",
31
+ "schema": {
32
+ "id": "string (UUID)",
33
+ "timestamp": "ISO 8601",
34
+ "data": "object"
35
+ }
36
+ },
37
+ "output": {
38
+ "destination": "webhook POST",
39
+ "schema": {
40
+ "processed_id": "string (UUID)",
41
+ "result": "object",
42
+ "status": "enum: success|error"
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Definition of Done Fase O
49
+
50
+ - [ ] Las 5 preguntas de descubrimiento están respondidas.
51
+ - [ ] Esquema JSON de Input/Output definido en `genesis.md`.
52
+ - [ ] Reglas de comportamiento documentadas en `genesis.md`.
53
+ - [ ] `task_plan.md` tiene plano aprobado por el usuario.
54
+
55
+ ---
56
+
57
+ ## 2️⃣ P Probar (Conectividad)
58
+
59
+ Verifica las tuberías antes de pasar el agua. El objetivo es confirmar que todos los servicios externos responden y devuelven datos con la forma esperada.
60
+
61
+ ### Procedimiento
62
+
63
+ 1. **Verificación de credenciales**: Lee `.env` y confirma que todas las claves necesarias existen y no están vacías.
64
+ 2. **Handshake**: Construye scripts mínimos en `tools/` (ej: `test_api.py`) para verificar cada servicio.
65
+ 3. **Validación de Shape**: No basta con un HTTP 200. Verifica que la respuesta coincide con el schema definido en `genesis.md`. Compara campos, tipos de datos y estructura.
66
+ 4. **Bloqueo**: Si algún test falla, NO procedas a la fase de Estructurar. Documenta el fallo en `findings.md`.
67
+
68
+ ### Ejemplo de test mínimo
69
+
70
+ ```python
71
+ # tools/test_api.py
72
+ import os
73
+ import requests
74
+
75
+ API_KEY = os.getenv("API_KEY")
76
+ BASE_URL = os.getenv("API_BASE_URL")
77
+
78
+ def test_connection():
79
+ """Verifica conexión y shape de respuesta."""
80
+ response = requests.get(f"{BASE_URL}/health", headers={"Authorization": f"Bearer {API_KEY}"})
81
+ assert response.status_code == 200, f"Expected 200, got {response.status_code}"
82
+ data = response.json()
83
+ assert "id" in data, "Missing 'id' field in response"
84
+ assert "status" in data, "Missing 'status' field in response"
85
+ print("✅ API connection and shape validated")
86
+
87
+ if __name__ == "__main__":
88
+ test_connection()
89
+ ```
90
+
91
+ ### Definition of Done Fase P
92
+
93
+ - [ ] Todas las credenciales `.env` verificadas (existen y no están vacías).
94
+ - [ ] Scripts `test_*.py` ejecutados y pasando.
95
+ - [ ] Respuestas de APIs validadas contra el schema de `genesis.md`.
96
+ - [ ] Resultados documentados en `findings.md`.
97
+
98
+ ---
99
+
100
+ ## 3️⃣ E Estructurar (La Construcción de 3 Capas)
101
+
102
+ ### Capa 1: Arquitectura (`architecture/`)
103
+
104
+ SOPs (Standard Operating Procedures) técnicos en Markdown. Cada SOP define:
105
+
106
+ - Propósito del script.
107
+ - Entradas esperadas (con referencia al schema en `genesis.md`).
108
+ - Salidas producidas.
109
+ - Casos extremos y cómo manejarlos.
110
+ - Dependencias con otras herramientas.
111
+
112
+ **Regla**: Si la lógica cambia, actualiza el SOP **antes** que el código.
113
+
114
+ ### Capa 2: Navegación (El Agente)
115
+
116
+ Capa de razonamiento. Enruta datos entre SOPs y herramientas. No ejecuta lógica de negocio directamente; delega a los scripts.
117
+
118
+ ### Capa 3: Herramientas (`tools/`)
119
+
120
+ - Scripts atómicos y deterministas.
121
+ - Las variables de entorno van en `.env`.
122
+ - Usa `.tmp/` para todas las operaciones intermedias.
123
+ - Cada script hace UNA cosa bien.
124
+
125
+ ### Regla de Idempotencia
126
+
127
+ Toda herramienta DEBE ser idempotente. Herramientas con side-effects irreversibles se marcan:
128
+
129
+ ```python
130
+ # META: side-effect: true
131
+ # META: idempotent: false
132
+ # META: requires-confirmation: true
133
+ ```
134
+
135
+ ### Grafo de Dependencias
136
+
137
+ Si una herramienta produce output que consume otra, documéntalo en `genesis.md` bajo `## Pipeline`:
138
+
139
+ ```markdown
140
+ ## Pipeline
141
+ ### tool_fetch.py tool_transform.py
142
+ - Output: `.tmp/raw_data.json`
143
+ - Formato: JSON array según schema X
144
+ ```
145
+
146
+ ### Definition of Done Fase E
147
+
148
+ - [ ] SOPs escritos en `architecture/` para cada herramienta.
149
+ - [ ] Scripts implementados en `tools/`.
150
+ - [ ] Grafo de dependencias documentado en `genesis.md`.
151
+ - [ ] Tests de integración entre herramientas pasando.
152
+ - [ ] Herramientas con side-effects marcadas con META tags.
153
+
154
+ ---
155
+
156
+ ## 4️⃣ R — Refinar (Refinamiento)
157
+
158
+ ### Templates de Output
159
+
160
+ Toda salida del sistema se valida contra una plantilla definida en `templates/`. Las plantillas se referencian desde `genesis.md` bajo `## Templates`.
161
+
162
+ El refinamiento no es subjetivo; es verificable contra una plantilla. Si el output no coincide con el template, no pasa.
163
+
164
+ ### Refinamiento de Carga Útil
165
+
166
+ Formatea todas las salidas (Markdown, HTML, JSON limpio) para entrega profesional según lo definido en `genesis.md`.
167
+
168
+ ### UX/UI
169
+
170
+ Si el proyecto tiene interfaz, aplica diseños limpios e intuitivos según las especificaciones.
171
+
172
+ ### Definition of Done Fase R
173
+
174
+ - [ ] Todas las salidas validadas contra sus templates en `templates/`.
175
+ - [ ] Formatos de entrega (Markdown, HTML, JSON) verificados.
176
+ - [ ] Si hay interfaz: revisión visual completada.
177
+
178
+ ---
179
+
180
+ ## 5️⃣ A — Automatizar (Despliegue)
181
+
182
+ ### Procedimiento
183
+
184
+ 1. **Limpieza**: Elimina residuos de `.tmp/`.
185
+ 2. **Transferencia**: Mueve la lógica finalizada a producción/nube.
186
+ 3. **Configuración**: Establece los disparadores (Cron, Webhooks).
187
+ 4. **Smoke Test**: Verificación mínima en el entorno de producción.
188
+
189
+ ### Definition of Done Fase A
190
+
191
+ - [ ] `.tmp/` limpio (sin archivos residuales).
192
+ - [ ] Código desplegado en destino final.
193
+ - [ ] Triggers configurados y verificados.
194
+ - [ ] Smoke test en producción pasando.
195
+ - [ ] `progress.md` actualizado con estado final.