@jaguilar87/gaia-ops 1.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/CHANGELOG.md +315 -0
- package/CLAUDE.md +154 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/agents/aws-troubleshooter.md +50 -0
- package/agents/claude-architect.md +821 -0
- package/agents/devops-developer.md +92 -0
- package/agents/gcp-troubleshooter.md +50 -0
- package/agents/gitops-operator.md +360 -0
- package/agents/terraform-architect.md +289 -0
- package/bin/gaia-init.js +620 -0
- package/commands/architect.md +97 -0
- package/commands/restore-session.md +87 -0
- package/commands/save-session.md +88 -0
- package/commands/session-status.md +61 -0
- package/commands/speckit.add-task.md +144 -0
- package/commands/speckit.analyze-task.md +65 -0
- package/commands/speckit.implement.md +96 -0
- package/commands/speckit.init.md +237 -0
- package/commands/speckit.plan.md +88 -0
- package/commands/speckit.specify.md +161 -0
- package/commands/speckit.tasks.md +188 -0
- package/config/AGENTS.md +162 -0
- package/config/agent-catalog.md +604 -0
- package/config/context-contracts.md +682 -0
- package/config/git-standards.md +674 -0
- package/config/git_standards.json +69 -0
- package/config/orchestration-workflow.md +735 -0
- package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
- package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
- package/hooks/post_tool_use.py +463 -0
- package/hooks/pre_kubectl_security.py +205 -0
- package/hooks/pre_tool_use.py +530 -0
- package/hooks/session_start.py +315 -0
- package/hooks/subagent_stop.py +549 -0
- package/index.js +92 -0
- package/package.json +59 -0
- package/speckit/README.en.md +648 -0
- package/speckit/README.md +353 -0
- package/speckit/governance.md +169 -0
- package/speckit/scripts/check-prerequisites.sh +194 -0
- package/speckit/scripts/common.sh +126 -0
- package/speckit/scripts/create-new-feature.sh +131 -0
- package/speckit/scripts/init.sh +42 -0
- package/speckit/scripts/setup-plan.sh +95 -0
- package/speckit/scripts/update-agent-context.sh +718 -0
- package/speckit/templates/adr-template.md +118 -0
- package/speckit/templates/agent-file-template.md +23 -0
- package/speckit/templates/plan-template.md +233 -0
- package/speckit/templates/spec-template.md +116 -0
- package/speckit/templates/tasks-template-bkp.md +136 -0
- package/speckit/templates/tasks-template.md +345 -0
- package/templates/CLAUDE.template.md +170 -0
- package/templates/code-examples/approval_gate_workflow.py +141 -0
- package/templates/code-examples/clarification_workflow.py +94 -0
- package/templates/code-examples/commit_validation.py +86 -0
- package/templates/project-context.template.json +126 -0
- package/templates/settings.template.json +307 -0
- package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
- package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
- package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
- package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
- package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
- package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
- package/tools/agent_capabilities.json +231 -0
- package/tools/agent_invoker_helper.py +239 -0
- package/tools/agent_router.py +730 -0
- package/tools/approval_gate.py +318 -0
- package/tools/clarify_engine.py +511 -0
- package/tools/clarify_patterns.py +356 -0
- package/tools/commit_validator.py +338 -0
- package/tools/context_provider.py +181 -0
- package/tools/context_section_reader.py +301 -0
- package/tools/demo_clarify.py +104 -0
- package/tools/generate_embeddings.py +168 -0
- package/tools/quicktriage_aws_troubleshooter.sh +45 -0
- package/tools/quicktriage_devops_developer.sh +38 -0
- package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
- package/tools/quicktriage_gitops_operator.sh +47 -0
- package/tools/quicktriage_terraform_architect.sh +40 -0
- package/tools/semantic_matcher.py +222 -0
- package/tools/task_manager.py +547 -0
- package/tools/task_manager_README.md +395 -0
- package/tools/task_manager_example.py +215 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Spec-Kit 2.0 - Framework de Desarrollo de Features Estructurado
|
|
2
|
+
|
|
3
|
+
Framework simplificado para desarrollo dirigido por especificaciones con orchestración inteligente de agentes.
|
|
4
|
+
|
|
5
|
+
## 🎯 Visión General
|
|
6
|
+
|
|
7
|
+
Spec-Kit 2.0 es un workflow automatizado que traduce descripciones de features en implementaciones completas:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Idea → Spec → Plan → Tasks → Implementation
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Mejoras en 2.0**:
|
|
14
|
+
- ✅ **Simplificado**: 5 comandos core (antes 10)
|
|
15
|
+
- ✅ **Automático**: Clarificación, validación y enrichment integrados
|
|
16
|
+
- ✅ **Inteligente**: Auto-context desde project-context.json
|
|
17
|
+
- ✅ **Sin pasos manuales**: tasks-richer.py eliminado, todo inline
|
|
18
|
+
- ✅ **Governance simple**: ADRs inmutables vs constitution versionado
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📋 Workflow Simplificado
|
|
23
|
+
|
|
24
|
+
### Paso 0: Bootstrap (Una vez por proyecto)
|
|
25
|
+
```bash
|
|
26
|
+
/speckit.init
|
|
27
|
+
```
|
|
28
|
+
- Valida/crea `project-context.json`
|
|
29
|
+
- Configura paths de GitOps, Terraform, GCP
|
|
30
|
+
- Ready para crear features
|
|
31
|
+
|
|
32
|
+
### Paso 1: Especificar Feature
|
|
33
|
+
```bash
|
|
34
|
+
/speckit.specify spec-kit-tcm-plan Add dark mode toggle to settings
|
|
35
|
+
```
|
|
36
|
+
- Crea `spec.md` con template
|
|
37
|
+
- **AUTO-LLENA** project context (cluster, namespace, paths)
|
|
38
|
+
- Genera functional requirements y user stories
|
|
39
|
+
- Output: `specs/00N-dark-mode-toggle/spec.md`
|
|
40
|
+
|
|
41
|
+
### Paso 2: Planear Implementación
|
|
42
|
+
```bash
|
|
43
|
+
/speckit.plan spec-kit-tcm-plan 00N-dark-mode-toggle
|
|
44
|
+
```
|
|
45
|
+
- **INTEGRA clarify**: Detecta ambigüedades, pregunta inline (max 5 questions)
|
|
46
|
+
- Lee governance.md para standards
|
|
47
|
+
- Genera plan técnico con arquitectura, data model, contracts
|
|
48
|
+
- Output: `plan.md`, `data-model.md`, `contracts/`, `research.md`
|
|
49
|
+
|
|
50
|
+
### Paso 3: Generar Tareas
|
|
51
|
+
```bash
|
|
52
|
+
/speckit.tasks spec-kit-tcm-plan 00N-dark-mode-toggle
|
|
53
|
+
```
|
|
54
|
+
- Genera tasks.md con metadata INLINE (no post-process)
|
|
55
|
+
- **INTEGRA validation**: Auto-detecta coverage gaps, inconsistencias
|
|
56
|
+
- **AUTO-ENRICH**: Cada task con agent, tier, tags, confidence
|
|
57
|
+
- **GATE**: Pausa si issues CRITICAL
|
|
58
|
+
- Output: `tasks.md` (listo para implement)
|
|
59
|
+
|
|
60
|
+
### Paso 4: Implementar
|
|
61
|
+
```bash
|
|
62
|
+
/speckit.implement spec-kit-tcm-plan 00N-dark-mode-toggle
|
|
63
|
+
```
|
|
64
|
+
- Lee tasks.md enriquecido
|
|
65
|
+
- Auto-ejecuta tasks con agentes especializados
|
|
66
|
+
- T2/T3 tasks → Auto-análisis antes de ejecutar
|
|
67
|
+
- TaskManager para files >25K tokens
|
|
68
|
+
- Output: Código implementado, tests, docs
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🚀 Comandos Core (5)
|
|
73
|
+
|
|
74
|
+
| Comando | Propósito | Integra |
|
|
75
|
+
|---------|-----------|---------|
|
|
76
|
+
| `/speckit.init` | Bootstrap project configuration | project-context.json validation |
|
|
77
|
+
| `/speckit.specify` | Create feature spec | Auto-context filling |
|
|
78
|
+
| `/speckit.plan` | Generate implementation plan | Clarification (inline) |
|
|
79
|
+
| `/speckit.tasks` | Generate enriched task list | Validation + Enrichment (inline) |
|
|
80
|
+
| `/speckit.implement` | Execute tasks with agents | High-risk analysis (auto) |
|
|
81
|
+
|
|
82
|
+
## 🛠️ Comandos Auxiliares (3)
|
|
83
|
+
|
|
84
|
+
| Comando | Uso |
|
|
85
|
+
|---------|-----|
|
|
86
|
+
| `/speckit.add-task` | Add single task during implementation (inline enrichment) |
|
|
87
|
+
| `/speckit.analyze-task` | Deep analysis of specific task (auto-triggered for T2/T3) |
|
|
88
|
+
| `/save-session` | Export session bundle with context |
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 📁 Estructura de Proyecto
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
.claude-shared/speckit/
|
|
96
|
+
├── governance.md # Project-wide principles (NO versioning)
|
|
97
|
+
├── decisions/ # ADRs (immutable records)
|
|
98
|
+
│ └── ADR-001-example.md
|
|
99
|
+
├── templates/
|
|
100
|
+
│ ├── spec-template.md
|
|
101
|
+
│ ├── plan-template.md
|
|
102
|
+
│ ├── tasks-template.md
|
|
103
|
+
│ └── adr-template.md
|
|
104
|
+
├── scripts/ # Bash automation
|
|
105
|
+
└── README.md # This file
|
|
106
|
+
|
|
107
|
+
<speckit-root>/ # e.g., spec-kit-tcm-plan/
|
|
108
|
+
└── specs/
|
|
109
|
+
├── 001-feature-name/
|
|
110
|
+
│ ├── spec.md # Auto-filled with project context
|
|
111
|
+
│ ├── plan.md # With clarifications integrated
|
|
112
|
+
│ ├── tasks.md # With inline metadata
|
|
113
|
+
│ ├── data-model.md
|
|
114
|
+
│ └── contracts/
|
|
115
|
+
└── 002-another-feature/
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🔑 Características Clave
|
|
121
|
+
|
|
122
|
+
### 1. Auto-Context desde project-context.json
|
|
123
|
+
|
|
124
|
+
`/specify` automáticamente llena:
|
|
125
|
+
- `[PROJECT_ID]` → `aaxis-rnd-general-project`
|
|
126
|
+
- `[CLUSTER]` → `tcm-gke-non-prod`
|
|
127
|
+
- `[GITOPS_PATH]` → `/path/to/gitops`
|
|
128
|
+
- `[TERRAFORM_PATH]` → `/path/to/terraform`
|
|
129
|
+
|
|
130
|
+
**Sin project-context.json**: Pregunta interactivamente y sugiere ejecutar `/init`.
|
|
131
|
+
|
|
132
|
+
### 2. Clarification Integrada en /plan
|
|
133
|
+
|
|
134
|
+
ANTES (Spec-Kit 1.0):
|
|
135
|
+
```bash
|
|
136
|
+
/specify ...
|
|
137
|
+
/clarify ... # Manual step
|
|
138
|
+
/plan ...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
AHORA (Spec-Kit 2.0):
|
|
142
|
+
```bash
|
|
143
|
+
/specify ...
|
|
144
|
+
/plan ... # Clarify happens inline automatically
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 3. Validation Integrada en /tasks
|
|
148
|
+
|
|
149
|
+
ANTES:
|
|
150
|
+
```bash
|
|
151
|
+
/tasks ...
|
|
152
|
+
/analyze-plan ... # Manual validation
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
AHORA:
|
|
156
|
+
```bash
|
|
157
|
+
/tasks ... # Validation happens inline automatically
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 4. Task Enrichment Inline
|
|
161
|
+
|
|
162
|
+
ANTES:
|
|
163
|
+
```bash
|
|
164
|
+
/tasks ...
|
|
165
|
+
python3 tasks-richer.py ... # Manual enrichment
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
AHORA:
|
|
169
|
+
```bash
|
|
170
|
+
/tasks ... # Enrichment happens during generation
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Cada task generada con:
|
|
174
|
+
```markdown
|
|
175
|
+
- [ ] T001 Create GKE cluster configuration
|
|
176
|
+
<!-- 🤖 Agent: terraform-architect | 👁️ T0 | ⚡ 0.85 -->
|
|
177
|
+
<!-- 🏷️ Tags: #terraform #infrastructure #gke -->
|
|
178
|
+
<!-- 🎯 skill: terraform_infrastructure (8.0) -->
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 5. Governance con ADRs (No Versioning)
|
|
182
|
+
|
|
183
|
+
ANTES:
|
|
184
|
+
- `constitution.md` con semantic versioning (MAJOR.MINOR.PATCH)
|
|
185
|
+
- Complex template propagation
|
|
186
|
+
- Per-feature versioning
|
|
187
|
+
|
|
188
|
+
AHORA:
|
|
189
|
+
- `governance.md` simple (project-wide standards)
|
|
190
|
+
- ADRs para decisions (immutable, one per decision)
|
|
191
|
+
- Git history = versioning (no manual version numbers)
|
|
192
|
+
|
|
193
|
+
**Crear ADR**:
|
|
194
|
+
1. Copy `.claude-shared/speckit/templates/adr-template.md`
|
|
195
|
+
2. Fill with decision context, options, rationale
|
|
196
|
+
3. Save to `.claude-shared/speckit/decisions/ADR-XXX-title.md`
|
|
197
|
+
4. Reference in commits: `feat: implement feature (ADR-005)`
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🧠 Agent Routing
|
|
202
|
+
|
|
203
|
+
Spec-Kit integra con agentes especializados:
|
|
204
|
+
|
|
205
|
+
| Agent | Triggers | Tier |
|
|
206
|
+
|-------|----------|------|
|
|
207
|
+
| **terraform-architect** | terraform, terragrunt, .tf, infrastructure, gke, vpc | T0-T3 |
|
|
208
|
+
| **gitops-operator** | kubectl, helm, flux, kubernetes, deployment, service | T0-T3 |
|
|
209
|
+
| **gcp-troubleshooter** | gcloud, GCP, cloud logging, IAM | T0 |
|
|
210
|
+
| **devops-developer** | docker, npm, build, test, CI, Dockerfile | T0-T1 |
|
|
211
|
+
|
|
212
|
+
**Code-First Protocol**: Todos los agentes exploran patterns existentes antes de crear nuevos recursos.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📝 Ejemplos
|
|
217
|
+
|
|
218
|
+
### Bootstrap Nuevo Proyecto
|
|
219
|
+
```bash
|
|
220
|
+
# 1. Initialize (interactive)
|
|
221
|
+
/speckit.init
|
|
222
|
+
|
|
223
|
+
# Questions asked:
|
|
224
|
+
# - GCP Project ID? aaxis-rnd-general-project
|
|
225
|
+
# - Region? us-central1
|
|
226
|
+
# - Cluster? tcm-gke-non-prod
|
|
227
|
+
# - GitOps path? /path/to/gitops
|
|
228
|
+
# - Terraform path? /path/to/terraform
|
|
229
|
+
|
|
230
|
+
# Creates .claude/project-context.json
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Feature Completo
|
|
234
|
+
```bash
|
|
235
|
+
# 1. Specify
|
|
236
|
+
/speckit.specify spec-kit-tcm-plan Add user authentication with OAuth2
|
|
237
|
+
|
|
238
|
+
# Auto-fills: project_id, cluster, gitops_path, terraform_path
|
|
239
|
+
# Output: specs/003-user-authentication/spec.md
|
|
240
|
+
|
|
241
|
+
# 2. Plan (with auto-clarify)
|
|
242
|
+
/speckit.plan spec-kit-tcm-plan 003-user-authentication
|
|
243
|
+
|
|
244
|
+
# Asks max 5 clarification questions inline:
|
|
245
|
+
# Q1: Which OAuth provider? (Google, GitHub, Azure)
|
|
246
|
+
# Q2: Session duration? (1h, 24h, 7d)
|
|
247
|
+
# Updates spec.md with answers
|
|
248
|
+
# Output: plan.md, data-model.md, contracts/
|
|
249
|
+
|
|
250
|
+
# 3. Tasks (with auto-validation)
|
|
251
|
+
/speckit.tasks spec-kit-tcm-plan 003-user-authentication
|
|
252
|
+
|
|
253
|
+
# Generates 25 tasks with inline metadata
|
|
254
|
+
# Validates coverage (100%), no critical issues
|
|
255
|
+
# Output: tasks.md (ready to implement)
|
|
256
|
+
|
|
257
|
+
# 4. Implement
|
|
258
|
+
/speckit.implement spec-kit-tcm-plan 003-user-authentication
|
|
259
|
+
|
|
260
|
+
# Executes tasks with agents:
|
|
261
|
+
# T001 → terraform-architect (T2)
|
|
262
|
+
# T002 → gitops-operator (T3)
|
|
263
|
+
# T003 → devops-developer (T1)
|
|
264
|
+
# Output: Código + commits
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Agregar Task Durante Implementación
|
|
268
|
+
```bash
|
|
269
|
+
/speckit.add-task spec-kit-tcm-plan 003-user-authentication
|
|
270
|
+
|
|
271
|
+
# Interactive:
|
|
272
|
+
# Task description? Configure session timeout middleware
|
|
273
|
+
# Task ID? T026
|
|
274
|
+
# Phase? Integration
|
|
275
|
+
# Parallel? No
|
|
276
|
+
|
|
277
|
+
# Generates with inline metadata:
|
|
278
|
+
# - [ ] T026 Configure session timeout middleware
|
|
279
|
+
# <!-- 🤖 Agent: devops-developer | ✅ T1 | ⚡ 0.75 -->
|
|
280
|
+
# <!-- 🏷️ Tags: #config #security #middleware -->
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 🔧 Troubleshooting
|
|
286
|
+
|
|
287
|
+
### Error: project-context.json not found
|
|
288
|
+
```bash
|
|
289
|
+
/speckit.init
|
|
290
|
+
# Creates .claude/project-context.json interactively
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Error: Task file exceeds token limit (>25K)
|
|
294
|
+
TaskManager handles this automatically during `/implement`. No manual intervention.
|
|
295
|
+
|
|
296
|
+
### Error: CRITICAL issues in validation
|
|
297
|
+
```markdown
|
|
298
|
+
### Validation Report
|
|
299
|
+
Issues: 1 critical, 2 high
|
|
300
|
+
|
|
301
|
+
| ID | Severity | Summary |
|
|
302
|
+
|----|----------|---------|
|
|
303
|
+
| A1 | CRITICAL | "Performance monitoring" has zero tasks |
|
|
304
|
+
|
|
305
|
+
# Fix: Add tasks or mark as out-of-scope in spec.md
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Warning: High-risk task (T2/T3)
|
|
309
|
+
```markdown
|
|
310
|
+
T055 Apply Terraform VPC changes (T3)
|
|
311
|
+
⚠️ HIGH RISK: Analyze before execution
|
|
312
|
+
|
|
313
|
+
# /speckit.analyze-task auto-triggered
|
|
314
|
+
# User approval required before execution
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 📚 Governance
|
|
320
|
+
|
|
321
|
+
- **Standards**: `.claude-shared/speckit/governance.md`
|
|
322
|
+
- **Decisions**: `.claude-shared/speckit/decisions/ADR-XXX-title.md`
|
|
323
|
+
- **Commit Format**: Conventional Commits (enforced by hooks)
|
|
324
|
+
- **Security Tiers**: T0 (read) → T1 (validate) → T2 (plan) → T3 (apply)
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## 🆕 What's New in 2.0
|
|
329
|
+
|
|
330
|
+
| Feature | 1.0 | 2.0 |
|
|
331
|
+
|---------|-----|-----|
|
|
332
|
+
| Commands | 10 | **5 core + 3 aux** |
|
|
333
|
+
| Clarify | Manual `/clarify` | **Integrated in `/plan`** |
|
|
334
|
+
| Validation | Manual `/analyze-plan` | **Integrated in `/tasks`** |
|
|
335
|
+
| Enrichment | External `tasks-richer.py` | **Inline during generation** |
|
|
336
|
+
| Governance | Versioned constitution.md | **governance.md + ADRs** |
|
|
337
|
+
| Init | Deprecated | **Revived with project-context** |
|
|
338
|
+
| Auto-context | None | **project-context.json integration** |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 📖 Ver También
|
|
343
|
+
|
|
344
|
+
- [Agent Prompts](../.claude-shared/agents/) - terraform-architect, gitops-operator, etc.
|
|
345
|
+
- [Governance](governance.md) - Project-wide standards
|
|
346
|
+
- [ADR Template](templates/adr-template.md) - Decision record template
|
|
347
|
+
- [CLAUDE.md](../../CLAUDE.md) - Orchestrator workflow
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
**Versión**: 2.0.0
|
|
352
|
+
**Última actualización**: 2025-11-05
|
|
353
|
+
**Maintainers**: Claude Code Agent System
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Project Governance
|
|
2
|
+
|
|
3
|
+
This document defines the architectural principles and standards that guide all development decisions in this project.
|
|
4
|
+
|
|
5
|
+
## Stack Definition
|
|
6
|
+
|
|
7
|
+
### Infrastructure Layer
|
|
8
|
+
- **Cloud Provider**: Google Cloud Platform (GCP)
|
|
9
|
+
- **Region**: us-central1
|
|
10
|
+
- **Project ID**: aaxis-rnd-general-project
|
|
11
|
+
- **Infrastructure as Code**: Terraform + Terragrunt
|
|
12
|
+
- **Terraform Base Path**: `/home/jaguilar/aaxis/rnd/repositories/terraform`
|
|
13
|
+
|
|
14
|
+
### Kubernetes Layer
|
|
15
|
+
- **Orchestration**: Google Kubernetes Engine (GKE)
|
|
16
|
+
- **Cluster**: tcm-gke-non-prod
|
|
17
|
+
- **GitOps Tool**: Flux CD
|
|
18
|
+
- **GitOps Repository**: `/home/jaguilar/aaxis/rnd/repositories/gitops`
|
|
19
|
+
- **Package Manager**: Helm
|
|
20
|
+
|
|
21
|
+
### Application Layer
|
|
22
|
+
- **Primary Database**: PostgreSQL (Cloud SQL)
|
|
23
|
+
- **Instance**: tcm-postgres-non-prod
|
|
24
|
+
- **Container Registry**: Artifact Registry (us-central1-docker.pkg.dev)
|
|
25
|
+
- **Service Architecture**: Microservices with Helm charts
|
|
26
|
+
|
|
27
|
+
## Core Architectural Principles
|
|
28
|
+
|
|
29
|
+
### 1. Code-First Protocol (Mandatory)
|
|
30
|
+
|
|
31
|
+
**All agents MUST analyze existing patterns before creating new resources.**
|
|
32
|
+
|
|
33
|
+
When creating any new infrastructure or Kubernetes resource:
|
|
34
|
+
1. **Discover**: Search for similar existing resources in the codebase
|
|
35
|
+
2. **Read**: Examine 2-3 examples to identify patterns
|
|
36
|
+
3. **Extract**: Document directory structure, naming conventions, configuration patterns
|
|
37
|
+
4. **Replicate**: Follow discovered patterns, adapt only what's specific to the new resource
|
|
38
|
+
5. **Explain**: Document which pattern was followed and why
|
|
39
|
+
|
|
40
|
+
**Rationale**: Ensures consistency, reduces drift, and leverages proven configurations.
|
|
41
|
+
|
|
42
|
+
### 2. GitOps as Single Source of Truth
|
|
43
|
+
|
|
44
|
+
**All Kubernetes changes MUST go through Git, never direct cluster manipulation.**
|
|
45
|
+
|
|
46
|
+
- Infrastructure state lives in Terraform repository
|
|
47
|
+
- Application state lives in GitOps repository
|
|
48
|
+
- Flux CD synchronizes Git → Cluster
|
|
49
|
+
- Manual `kubectl apply` is forbidden in production workflows
|
|
50
|
+
- All changes require git commit → push → Flux reconciliation
|
|
51
|
+
|
|
52
|
+
**Rationale**: Auditability, rollback capability, and declarative state management.
|
|
53
|
+
|
|
54
|
+
### 3. Security Tier Enforcement
|
|
55
|
+
|
|
56
|
+
**All operations are classified by security tier with explicit approval gates.**
|
|
57
|
+
|
|
58
|
+
| Tier | Operations | Approval |
|
|
59
|
+
|------|-----------|----------|
|
|
60
|
+
| T0 | Read-only (get, describe, logs, plan) | Auto-approved |
|
|
61
|
+
| T1 | Validation (validate, template, lint) | Auto-approved |
|
|
62
|
+
| T2 | Simulation (dry-run, plan) | Auto-approved |
|
|
63
|
+
| T3 | Realization (apply, push, reconcile) | User approval required |
|
|
64
|
+
|
|
65
|
+
**Rationale**: Prevents accidental infrastructure changes and provides approval visibility.
|
|
66
|
+
|
|
67
|
+
### 4. Conventional Commits Standard
|
|
68
|
+
|
|
69
|
+
**All commits MUST follow Conventional Commits specification.**
|
|
70
|
+
|
|
71
|
+
Format: `<type>(<scope>): <description>`
|
|
72
|
+
|
|
73
|
+
Allowed types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `ci`, `perf`, `style`, `build`
|
|
74
|
+
|
|
75
|
+
Examples:
|
|
76
|
+
- `feat(helmrelease): add report-generator worker service`
|
|
77
|
+
- `fix(terraform): correct VPC network peering configuration`
|
|
78
|
+
- `refactor(gitops): consolidate duplicate service account definitions`
|
|
79
|
+
|
|
80
|
+
**Rationale**: Enables automated changelog generation, semantic versioning, and clear change tracking.
|
|
81
|
+
|
|
82
|
+
### 5. Workload Identity for All Services
|
|
83
|
+
|
|
84
|
+
**All GKE services MUST use Workload Identity, not service account keys.**
|
|
85
|
+
|
|
86
|
+
- Create Kubernetes ServiceAccount with GCP IAM binding annotation
|
|
87
|
+
- Bind GCP Service Account with `iam.workloadIdentityUser` role
|
|
88
|
+
- Never use downloaded JSON keys in containers
|
|
89
|
+
|
|
90
|
+
**Rationale**: Eliminates static credentials, follows GCP security best practices, automatic key rotation.
|
|
91
|
+
|
|
92
|
+
### 6. Resource Limits as Default
|
|
93
|
+
|
|
94
|
+
**All Helm releases MUST define resource requests and limits.**
|
|
95
|
+
|
|
96
|
+
Standard tiers:
|
|
97
|
+
- **Small**: 256Mi/512Mi memory, 250m/500m CPU
|
|
98
|
+
- **Medium**: 512Mi/1Gi memory, 500m/1000m CPU
|
|
99
|
+
- **Large**: 1Gi/2Gi memory, 1000m/2000m CPU
|
|
100
|
+
|
|
101
|
+
**Rationale**: Prevents resource contention, enables proper scheduling, cost predictability.
|
|
102
|
+
|
|
103
|
+
## Decision Making Process
|
|
104
|
+
|
|
105
|
+
### When to Create an ADR
|
|
106
|
+
|
|
107
|
+
Create an Architecture Decision Record (ADR) when:
|
|
108
|
+
- Choosing between multiple viable technical approaches
|
|
109
|
+
- Making a decision that affects multiple services or teams
|
|
110
|
+
- Establishing a new pattern or standard
|
|
111
|
+
- Deviating from an existing principle for valid reasons
|
|
112
|
+
|
|
113
|
+
**ADR Template**: `.claude-shared/speckit/templates/adr-template.md`
|
|
114
|
+
|
|
115
|
+
**ADR Location**: `.claude-shared/speckit/decisions/`
|
|
116
|
+
|
|
117
|
+
### ADR Lifecycle
|
|
118
|
+
|
|
119
|
+
1. **Draft**: Create ADR with status "Proposed"
|
|
120
|
+
2. **Review**: Share with team (if applicable)
|
|
121
|
+
3. **Decide**: Update status to "Accepted" or "Rejected"
|
|
122
|
+
4. **Implement**: Reference ADR number in commits
|
|
123
|
+
5. **Archive**: ADRs are immutable; superseding decisions get new ADRs
|
|
124
|
+
|
|
125
|
+
**Rationale**: Decisions are immutable historical records. Context matters more than current state.
|
|
126
|
+
|
|
127
|
+
## Standards Evolution
|
|
128
|
+
|
|
129
|
+
### How to Update This Document
|
|
130
|
+
|
|
131
|
+
1. Identify need for principle change
|
|
132
|
+
2. Create ADR documenting the proposed change and rationale
|
|
133
|
+
3. If ADR is accepted, update this governance.md
|
|
134
|
+
4. Commit both files together with message: `docs(governance): [description] (ADR-XXX)`
|
|
135
|
+
|
|
136
|
+
### Versioning Strategy
|
|
137
|
+
|
|
138
|
+
This document uses **Git history as version control**. No semantic versioning.
|
|
139
|
+
|
|
140
|
+
- To see why a principle exists: `git log -p governance.md`
|
|
141
|
+
- To see decision context: Read corresponding ADR
|
|
142
|
+
- To propose changes: Create ADR first, then update
|
|
143
|
+
|
|
144
|
+
**Rationale**: Git already provides perfect versioning. Additional versioning adds complexity without value.
|
|
145
|
+
|
|
146
|
+
## Compliance
|
|
147
|
+
|
|
148
|
+
### Enforcement
|
|
149
|
+
|
|
150
|
+
These principles are enforced through:
|
|
151
|
+
1. **Agent Protocols**: Specialized agents (terraform-architect, gitops-operator) follow these standards
|
|
152
|
+
2. **Validation Hooks**: Pre-commit and pre-tool-use hooks validate compliance
|
|
153
|
+
3. **Security Tiers**: Permission system blocks non-compliant operations
|
|
154
|
+
4. **Code Review**: Human review of T3 operations before realization
|
|
155
|
+
|
|
156
|
+
### Exceptions
|
|
157
|
+
|
|
158
|
+
Exceptions to these principles require:
|
|
159
|
+
1. ADR documenting the exception and time-bound context
|
|
160
|
+
2. Explicit approval in the ADR review process
|
|
161
|
+
3. Scheduled re-evaluation date in ADR
|
|
162
|
+
|
|
163
|
+
**No permanent exceptions.** All deviations must justify their continued existence or be removed.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
**Last Updated**: 2025-11-05
|
|
168
|
+
**Related ADRs**: None yet (foundation document)
|
|
169
|
+
**Supersedes**: constitution.md (deprecated)
|