@orchestrator-claude/cli 3.10.2 → 3.12.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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/base/CLAUDE.md.hbs +35 -332
- package/dist/templates/base/claude/hooks/dangling-workflow-guard.sh +57 -0
- package/dist/templates/base/claude/hooks/gate-guardian.sh +79 -0
- package/dist/templates/base/claude/hooks/orch-helpers.sh +133 -0
- package/dist/templates/base/claude/hooks/ping-pong-enforcer.sh +58 -0
- package/dist/templates/base/claude/hooks/prompt-orchestrator.sh +41 -0
- package/dist/templates/base/claude/hooks/session-orchestrator.sh +54 -0
- package/dist/templates/base/claude/hooks/workflow-guard.sh +53 -0
- package/dist/templates/base/claude/settings.json +63 -7
- package/dist/templates/base/claude/skills/workflow-status/SKILL.md +59 -291
- package/dist/templates/base/docker-compose.yml.hbs +2 -1
- package/package.json +1 -1
- package/templates/base/CLAUDE.md.hbs +35 -332
- package/templates/base/claude/hooks/dangling-workflow-guard.sh +57 -0
- package/templates/base/claude/hooks/gate-guardian.sh +79 -0
- package/templates/base/claude/hooks/orch-helpers.sh +133 -0
- package/templates/base/claude/hooks/ping-pong-enforcer.sh +58 -0
- package/templates/base/claude/hooks/prompt-orchestrator.sh +41 -0
- package/templates/base/claude/hooks/session-orchestrator.sh +54 -0
- package/templates/base/claude/hooks/workflow-guard.sh +53 -0
- package/templates/base/claude/settings.json +63 -7
- package/templates/base/claude/skills/workflow-status/SKILL.md +59 -291
- package/templates/base/docker-compose.yml.hbs +2 -1
- package/dist/templates/base/claude/hooks/post-artifact-generate.sh +0 -39
- package/dist/templates/base/claude/hooks/post-implement-validate.sh +0 -139
- package/dist/templates/base/claude/hooks/pre-agent-invoke.sh +0 -34
- package/dist/templates/base/claude/hooks/pre-phase-advance.sh +0 -40
- package/templates/base/claude/hooks/post-artifact-generate.sh +0 -39
- package/templates/base/claude/hooks/post-implement-validate.sh +0 -139
- package/templates/base/claude/hooks/pre-agent-invoke.sh +0 -34
- package/templates/base/claude/hooks/pre-phase-advance.sh +0 -40
|
@@ -1,322 +1,90 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: workflow-status
|
|
3
3
|
description: Consulta status detalhado do workflow atual incluindo fase, artefatos, gates e proximos passos. Use para verificar progresso ou diagnosticar problemas.
|
|
4
|
-
allowed-tools: Read, Grep, Glob
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
# Workflow Status Skill
|
|
8
7
|
|
|
9
|
-
##
|
|
8
|
+
## Data Source
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
All workflow state is in **PostgreSQL** via MCP tools. NEVER read `.orchestrator/orchestrator-index.json`.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
### MCP Tools for Status Queries
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Invocacao
|
|
24
|
-
|
|
25
|
-
Exemplos de como invocar esta skill:
|
|
14
|
+
| Tool | What it returns |
|
|
15
|
+
|------|----------------|
|
|
16
|
+
| `getStatus` | Current workflow: phase, status, pending action |
|
|
17
|
+
| `getWorkflows` | All workflows with phase configs |
|
|
18
|
+
| `getNextAction` | Next pending action (agent + status) |
|
|
19
|
+
| `getInvocations` | Agent invocation history |
|
|
20
|
+
| `getMetrics` | Workflow metrics (duration, counts) |
|
|
21
|
+
| `listCheckpoints` | Checkpoint history |
|
|
26
22
|
|
|
23
|
+
Load tools via ToolSearch before first use:
|
|
27
24
|
```
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"Mostre o progresso da implementacao"
|
|
31
|
-
|
|
32
|
-
"Quais artefatos ja foram gerados?"
|
|
33
|
-
|
|
34
|
-
"Em qual fase estamos?"
|
|
35
|
-
|
|
36
|
-
"Quais sao os proximos passos?"
|
|
37
|
-
|
|
38
|
-
"Liste os checkpoints disponiveis"
|
|
25
|
+
ToolSearch("select:mcp__orchestrator-tools__getStatus")
|
|
39
26
|
```
|
|
40
27
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
| Parametro | Tipo | Obrigatorio | Descricao |
|
|
44
|
-
|-----------|------|-------------|-----------|
|
|
45
|
-
| `workflowId` | string | Nao | ID do workflow (usa atual se omitido) |
|
|
46
|
-
| `detail_level` | enum | Nao | summary, standard, detailed |
|
|
47
|
-
| `include_artifacts` | boolean | Nao | Incluir lista de artefatos |
|
|
48
|
-
| `include_checkpoints` | boolean | Nao | Incluir lista de checkpoints |
|
|
49
|
-
| `include_gates` | boolean | Nao | Incluir status dos gates |
|
|
50
|
-
|
|
51
|
-
### Valores de detail_level
|
|
52
|
-
|
|
53
|
-
- **summary**: Apenas fase atual e status geral
|
|
54
|
-
- **standard** (default): Fase, status, ultimos artefatos, proximo passo
|
|
55
|
-
- **detailed**: Tudo incluindo historico completo
|
|
56
|
-
|
|
57
|
-
## Output
|
|
58
|
-
|
|
59
|
-
A skill retorna informacoes estruturadas:
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"success": true,
|
|
64
|
-
"workflow": {
|
|
65
|
-
"id": "wf-123",
|
|
66
|
-
"type": "feature_development",
|
|
67
|
-
"feature": "OAuth2 Authentication",
|
|
68
|
-
"status": "in_progress",
|
|
69
|
-
"startedAt": "2025-12-09T10:00:00Z",
|
|
70
|
-
"updatedAt": "2025-12-09T14:30:00Z"
|
|
71
|
-
},
|
|
28
|
+
## When to Use
|
|
72
29
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"totalTasks": 10,
|
|
79
|
-
"completedTasks": 6,
|
|
80
|
-
"percentage": 60
|
|
81
|
-
}
|
|
82
|
-
},
|
|
30
|
+
- Check current workflow phase and progress
|
|
31
|
+
- Verify which artifacts have been generated
|
|
32
|
+
- Diagnose why a workflow is stuck
|
|
33
|
+
- List available checkpoints
|
|
34
|
+
- Review agent invocation history
|
|
83
35
|
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
"name": "research",
|
|
87
|
-
"status": "completed",
|
|
88
|
-
"duration": "45m",
|
|
89
|
-
"artifacts": ["research-context.md"]
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "specify",
|
|
93
|
-
"status": "completed",
|
|
94
|
-
"duration": "1h",
|
|
95
|
-
"artifacts": ["spec.md"]
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"name": "plan",
|
|
99
|
-
"status": "completed",
|
|
100
|
-
"duration": "1h 30m",
|
|
101
|
-
"artifacts": ["plan.md"]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "tasks",
|
|
105
|
-
"status": "completed",
|
|
106
|
-
"duration": "45m",
|
|
107
|
-
"artifacts": ["tasks.md"]
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"name": "implement",
|
|
111
|
-
"status": "in_progress",
|
|
112
|
-
"duration": "2h (ongoing)",
|
|
113
|
-
"artifacts": ["impl-001.md", "impl-002.md"]
|
|
114
|
-
}
|
|
115
|
-
],
|
|
36
|
+
## How to Report Status
|
|
116
37
|
|
|
117
|
-
|
|
118
|
-
{
|
|
119
|
-
"id": "art-001",
|
|
120
|
-
"type": "research",
|
|
121
|
-
"path": ".orchestrator/artifacts/research/research-context.md",
|
|
122
|
-
"status": "validated",
|
|
123
|
-
"createdAt": "2025-12-09T10:45:00Z"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"id": "art-002",
|
|
127
|
-
"type": "specification",
|
|
128
|
-
"path": ".orchestrator/artifacts/specify/spec.md",
|
|
129
|
-
"status": "validated",
|
|
130
|
-
"createdAt": "2025-12-09T11:45:00Z"
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
|
|
134
|
-
"gates": {
|
|
135
|
-
"research": { "passed": true, "evaluatedAt": "2025-12-09T10:50:00Z" },
|
|
136
|
-
"specify": { "passed": true, "evaluatedAt": "2025-12-09T11:50:00Z" },
|
|
137
|
-
"plan": { "passed": true, "evaluatedAt": "2025-12-09T13:20:00Z" },
|
|
138
|
-
"tasks": { "passed": true, "evaluatedAt": "2025-12-09T14:00:00Z" },
|
|
139
|
-
"implement": { "passed": false, "pending": true }
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
"checkpoints": [
|
|
143
|
-
{
|
|
144
|
-
"id": "chk-001",
|
|
145
|
-
"phase": "specify",
|
|
146
|
-
"message": "[orchestrator] specify: specification validated",
|
|
147
|
-
"gitRef": "abc123",
|
|
148
|
-
"createdAt": "2025-12-09T11:50:00Z"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"id": "chk-002",
|
|
152
|
-
"phase": "plan",
|
|
153
|
-
"message": "[orchestrator] plan: technical plan approved",
|
|
154
|
-
"gitRef": "def456",
|
|
155
|
-
"createdAt": "2025-12-09T13:20:00Z"
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
|
|
159
|
-
"nextSteps": [
|
|
160
|
-
"Completar TASK-007: Implementar middleware de autenticacao",
|
|
161
|
-
"Executar testes de integracao",
|
|
162
|
-
"Avaliar gate de implement para concluir workflow"
|
|
163
|
-
],
|
|
164
|
-
|
|
165
|
-
"metrics": {
|
|
166
|
-
"totalDuration": "4h 30m",
|
|
167
|
-
"estimatedRemaining": "2h",
|
|
168
|
-
"artifactsGenerated": 6,
|
|
169
|
-
"gatesPassed": 4,
|
|
170
|
-
"checkpointsCreated": 4
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Formato de Output para Usuario
|
|
176
|
-
|
|
177
|
-
Quando invocada, a skill formata output amigavel:
|
|
38
|
+
### Quick Status (default)
|
|
178
39
|
|
|
179
40
|
```markdown
|
|
180
|
-
## Status
|
|
181
|
-
|
|
182
|
-
**ID**: wf-123
|
|
183
|
-
**Tipo**: feature_development
|
|
184
|
-
**Feature**: OAuth2 Authentication
|
|
185
|
-
**Status**: 🟡 Em Progresso
|
|
186
|
-
|
|
187
|
-
### Fase Atual: IMPLEMENT
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
[████████░░░░░░░░░░░░] 60% (6/10 tasks)
|
|
191
|
-
```
|
|
41
|
+
## Workflow Status
|
|
192
42
|
|
|
193
|
-
|
|
43
|
+
**ID**: wf-123 | **Type**: feature_development | **Status**: in_progress
|
|
44
|
+
**Phase**: IMPLEMENT (6/10 tasks)
|
|
194
45
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
| specify |
|
|
199
|
-
| plan |
|
|
200
|
-
| tasks |
|
|
201
|
-
| implement |
|
|
46
|
+
### Phase Progress
|
|
47
|
+
| Phase | Status | Gate |
|
|
48
|
+
|-------|--------|------|
|
|
49
|
+
| specify | completed | passed |
|
|
50
|
+
| plan | completed | passed |
|
|
51
|
+
| tasks | completed | passed |
|
|
52
|
+
| implement | in_progress | pending |
|
|
202
53
|
|
|
203
|
-
###
|
|
204
|
-
|
|
205
|
-
- [x] research-complete
|
|
206
|
-
- [x] specification-complete
|
|
207
|
-
- [x] plan-complete
|
|
208
|
-
- [x] tasks-complete
|
|
209
|
-
- [ ] implementation-complete (pendente)
|
|
210
|
-
|
|
211
|
-
### Proximos Passos
|
|
212
|
-
|
|
213
|
-
1. Completar TASK-007: Implementar middleware de autenticacao
|
|
214
|
-
2. Executar testes de integracao
|
|
215
|
-
3. Avaliar gate de implement para concluir workflow
|
|
216
|
-
|
|
217
|
-
### Metricas
|
|
218
|
-
|
|
219
|
-
- **Tempo Total**: 4h 30m
|
|
220
|
-
- **Estimativa Restante**: 2h
|
|
221
|
-
- **Artefatos**: 6
|
|
222
|
-
- **Checkpoints**: 4
|
|
54
|
+
### Next Action
|
|
55
|
+
Agent: implementer | Status: awaiting_agent
|
|
223
56
|
```
|
|
224
57
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
Esta skill invoca o handler TypeScript:
|
|
58
|
+
### Detailed Status (when user asks for details)
|
|
228
59
|
|
|
229
|
-
|
|
230
|
-
|
|
60
|
+
Add to quick status:
|
|
61
|
+
- **Artifacts**: List with type, status (draft/validated), storage location
|
|
62
|
+
- **Checkpoints**: List with phase, git ref, timestamp
|
|
63
|
+
- **Invocations**: Agent history with duration and result
|
|
64
|
+
- **Metrics**: Total duration, artifacts generated, gates passed
|
|
231
65
|
|
|
232
|
-
|
|
233
|
-
name = 'workflow-status';
|
|
234
|
-
description = 'Consulta status detalhado do workflow';
|
|
66
|
+
## Diagnosing Common Problems
|
|
235
67
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// 5. Lista artefatos e checkpoints
|
|
242
|
-
// 6. Calcula metricas
|
|
243
|
-
// 7. Formata output
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
```
|
|
68
|
+
### Workflow stuck — no pending action
|
|
69
|
+
1. Call `getStatus` to check current phase
|
|
70
|
+
2. Call `getNextAction` — if `hasAction: false`:
|
|
71
|
+
- In implement phase → call `completeWorkflow`
|
|
72
|
+
- In other phases → orchestrator needs to set next pendingAction
|
|
247
73
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
Skill: workflow-status com detail_level=summary
|
|
254
|
-
Output: Fase atual, status, progresso percentual
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Relatorio Detalhado
|
|
258
|
-
```
|
|
259
|
-
User: "Me de um relatorio completo do progresso"
|
|
260
|
-
Skill: workflow-status com detail_level=detailed, todos includes=true
|
|
261
|
-
Output: Relatorio completo com historico
|
|
262
|
-
```
|
|
74
|
+
### Gate not passing
|
|
75
|
+
1. Call `getStatus` to see which phase is current
|
|
76
|
+
2. Check artifact exists for that phase via `artifactRetrieve`
|
|
77
|
+
3. Check artifact status (draft vs validated)
|
|
78
|
+
4. If draft → artifact-validator hook may not have fired
|
|
263
79
|
|
|
264
|
-
###
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
Output: Lista de artefatos com status e paths
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Diagnostico de Problema
|
|
272
|
-
```
|
|
273
|
-
User: "Por que o workflow esta travado?"
|
|
274
|
-
Skill: workflow-status com include_gates=true
|
|
275
|
-
Output: Status detalhado mostrando gate pendente
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
## Comportamento em Casos Especiais
|
|
279
|
-
|
|
280
|
-
### Nenhum Workflow Ativo
|
|
281
|
-
```json
|
|
282
|
-
{
|
|
283
|
-
"success": false,
|
|
284
|
-
"error": {
|
|
285
|
-
"code": "NO_ACTIVE_WORKFLOW",
|
|
286
|
-
"message": "Nenhum workflow ativo encontrado",
|
|
287
|
-
"suggestion": "Use 'orchestrate start' para iniciar um novo workflow"
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Workflow Nao Encontrado
|
|
293
|
-
```json
|
|
294
|
-
{
|
|
295
|
-
"success": false,
|
|
296
|
-
"error": {
|
|
297
|
-
"code": "WORKFLOW_NOT_FOUND",
|
|
298
|
-
"message": "Workflow 'wf-xyz' nao encontrado",
|
|
299
|
-
"suggestion": "Verifique o ID ou use sem parametro para workflow atual"
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Index Corrompido
|
|
305
|
-
```json
|
|
306
|
-
{
|
|
307
|
-
"success": false,
|
|
308
|
-
"error": {
|
|
309
|
-
"code": "INDEX_CORRUPTED",
|
|
310
|
-
"message": "orchestrator-index.json esta corrompido ou invalido",
|
|
311
|
-
"suggestion": "Execute 'orchestrator config validate' para diagnosticar"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
```
|
|
80
|
+
### Phase stuck in in_progress
|
|
81
|
+
1. Check if agent invocation completed (`getInvocations`)
|
|
82
|
+
2. Check if `completeAgentInvocation` was called
|
|
83
|
+
3. If not → pending action may be stale
|
|
315
84
|
|
|
316
|
-
##
|
|
85
|
+
## Important Notes
|
|
317
86
|
|
|
318
|
-
1.
|
|
319
|
-
2.
|
|
320
|
-
3.
|
|
321
|
-
4.
|
|
322
|
-
5. Cache de 30 segundos para evitar leituras repetidas
|
|
87
|
+
1. This skill is **read-only** — it queries state, never modifies it
|
|
88
|
+
2. All data comes from PostgreSQL via MCP tools
|
|
89
|
+
3. Artifacts content is in MinIO — use `artifactRetrieve` to read
|
|
90
|
+
4. The `ping-pong-enforcer` hook auto-injects getNextAction after Agent calls
|
|
@@ -154,7 +154,8 @@ services:
|
|
|
154
154
|
POSTGRES_PORT: "5432"
|
|
155
155
|
DATABASE_URL: postgresql://${POSTGRES_USER:-orchestrator}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-orchestrator}
|
|
156
156
|
# MinIO object storage (requires --profile object-storage or --profile full)
|
|
157
|
-
|
|
157
|
+
# ADR-013 Phase 4 (F-07): Default false — set true in .env when using object-storage profile
|
|
158
|
+
ENABLE_OBJECT_STORAGE: "${ENABLE_OBJECT_STORAGE:-false}"
|
|
158
159
|
OBJECT_STORAGE_PROVIDER: minio
|
|
159
160
|
OBJECT_STORAGE_ENDPOINT: "http://minio:9000"
|
|
160
161
|
OBJECT_STORAGE_REGION: us-east-1
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Post-Artifact Generate Hook
|
|
3
|
-
# Executado apos geracao de um artefato
|
|
4
|
-
# Valida artefato, atualiza indice, cria checkpoint
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
-
|
|
11
|
-
# Recebe evento via stdin ou argumento
|
|
12
|
-
if [ -n "$1" ]; then
|
|
13
|
-
EVENT="$1"
|
|
14
|
-
else
|
|
15
|
-
EVENT=$(cat)
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Verifica se temos o handler compilado
|
|
19
|
-
HANDLER="$PROJECT_ROOT/dist/hook.js"
|
|
20
|
-
|
|
21
|
-
if [ ! -f "$HANDLER" ]; then
|
|
22
|
-
echo '{"success": false, "error": "Hook handler not compiled. Run npm run build first."}' >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Executa o handler TypeScript
|
|
27
|
-
echo "$EVENT" | node "$HANDLER" post-artifact
|
|
28
|
-
|
|
29
|
-
EXIT_CODE=$?
|
|
30
|
-
|
|
31
|
-
# Log do resultado
|
|
32
|
-
if [ $EXIT_CODE -eq 0 ]; then
|
|
33
|
-
echo "[post-artifact-generate] Artifact processed successfully" >&2
|
|
34
|
-
else
|
|
35
|
-
echo "[post-artifact-generate] Warning: Artifact processing had issues" >&2
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Este hook nao bloqueia, apenas avisa
|
|
39
|
-
exit 0
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Post-Implement Validation Hook
|
|
3
|
-
# Validates orchestrator-index.json consistency after IMPLEMENT phase
|
|
4
|
-
# Detects possible delegation bypass where code was written directly
|
|
5
|
-
# instead of through the implementer subagent
|
|
6
|
-
#
|
|
7
|
-
# Exit codes:
|
|
8
|
-
# 0 = Validation passed or skipped (jq not available)
|
|
9
|
-
# 1 = Warning detected (possible delegation bypass)
|
|
10
|
-
#
|
|
11
|
-
# Author: Orchestrator System
|
|
12
|
-
# Version: 1.0.0
|
|
13
|
-
|
|
14
|
-
set -e
|
|
15
|
-
|
|
16
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
18
|
-
INDEX_FILE="$PROJECT_ROOT/.orchestrator/orchestrator-index.json"
|
|
19
|
-
|
|
20
|
-
# Colors for output
|
|
21
|
-
RED='\033[0;31m'
|
|
22
|
-
YELLOW='\033[1;33m'
|
|
23
|
-
GREEN='\033[0;32m'
|
|
24
|
-
CYAN='\033[0;36m'
|
|
25
|
-
NC='\033[0m' # No Color
|
|
26
|
-
|
|
27
|
-
log_info() {
|
|
28
|
-
echo -e "${GREEN}[post-implement-validate]${NC} $1" >&2
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
log_warn() {
|
|
32
|
-
echo -e "${YELLOW}[post-implement-validate] WARNING:${NC} $1" >&2
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
log_error() {
|
|
36
|
-
echo -e "${RED}[post-implement-validate] ERROR:${NC} $1" >&2
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
log_debug() {
|
|
40
|
-
if [ "${DEBUG:-false}" = "true" ]; then
|
|
41
|
-
echo -e "${CYAN}[post-implement-validate] DEBUG:${NC} $1" >&2
|
|
42
|
-
fi
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# Check if jq is available
|
|
46
|
-
if ! command -v jq &> /dev/null; then
|
|
47
|
-
log_warn "jq not found, skipping validation (install jq for full validation)"
|
|
48
|
-
exit 0
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# Check if orchestrator-index.json exists
|
|
52
|
-
if [ ! -f "$INDEX_FILE" ]; then
|
|
53
|
-
log_debug "orchestrator-index.json not found at $INDEX_FILE, skipping validation"
|
|
54
|
-
exit 0
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
# Read statistics from orchestrator-index.json
|
|
58
|
-
TASKS_COMPLETED=$(jq -r '.statistics.tasksCompleted // 0' "$INDEX_FILE" 2>/dev/null || echo "0")
|
|
59
|
-
TASKS_PENDING=$(jq -r '.statistics.tasksPending // 0' "$INDEX_FILE" 2>/dev/null || echo "0")
|
|
60
|
-
CURRENT_PHASE=$(jq -r '.activeWorkflow.currentPhase // "unknown"' "$INDEX_FILE" 2>/dev/null || echo "unknown")
|
|
61
|
-
STATUS=$(jq -r '.activeWorkflow.status // "unknown"' "$INDEX_FILE" 2>/dev/null || echo "unknown")
|
|
62
|
-
|
|
63
|
-
# Count TypeScript files in src/ (if directory exists)
|
|
64
|
-
TS_FILES_COUNT=0
|
|
65
|
-
if [ -d "$PROJECT_ROOT/src" ]; then
|
|
66
|
-
TS_FILES_COUNT=$(find "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | wc -l | tr -d ' ' || echo "0")
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
# Count test files
|
|
70
|
-
TEST_FILES_COUNT=0
|
|
71
|
-
if [ -d "$PROJECT_ROOT/tests" ]; then
|
|
72
|
-
TEST_FILES_COUNT=$(find "$PROJECT_ROOT/tests" -name "*.spec.ts" -o -name "*.test.ts" 2>/dev/null | wc -l | tr -d ' ' || echo "0")
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
log_info "Validating IMPLEMENT phase consistency..."
|
|
76
|
-
log_info " Current Phase: $CURRENT_PHASE"
|
|
77
|
-
log_info " Status: $STATUS"
|
|
78
|
-
log_info " Tasks Completed: $TASKS_COMPLETED"
|
|
79
|
-
log_info " Tasks Pending: $TASKS_PENDING"
|
|
80
|
-
log_info " TypeScript Files: $TS_FILES_COUNT"
|
|
81
|
-
log_info " Test Files: $TEST_FILES_COUNT"
|
|
82
|
-
|
|
83
|
-
# Detection logic
|
|
84
|
-
WARNINGS=0
|
|
85
|
-
MESSAGES=()
|
|
86
|
-
|
|
87
|
-
# Check 1: Few tasks completed but many pending (primary indicator)
|
|
88
|
-
if [ "$TASKS_COMPLETED" -le 1 ] && [ "$TASKS_PENDING" -gt 5 ]; then
|
|
89
|
-
MESSAGES+=("Only $TASKS_COMPLETED task(s) completed but $TASKS_PENDING pending.")
|
|
90
|
-
MESSAGES+=("This suggests the implementer agent may not have been properly invoked.")
|
|
91
|
-
WARNINGS=$((WARNINGS + 1))
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
# Check 2: Many source files but few tasks completed
|
|
95
|
-
if [ "$TS_FILES_COUNT" -gt 10 ] && [ "$TASKS_COMPLETED" -lt 5 ]; then
|
|
96
|
-
MESSAGES+=("Found $TS_FILES_COUNT TypeScript files but only $TASKS_COMPLETED tasks completed.")
|
|
97
|
-
MESSAGES+=("Code may have been generated without proper task tracking.")
|
|
98
|
-
WARNINGS=$((WARNINGS + 1))
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
# Check 3: Status still "ready_for_implementation" after code exists
|
|
102
|
-
if [ "$STATUS" = "ready_for_implementation" ] && [ "$TS_FILES_COUNT" -gt 5 ]; then
|
|
103
|
-
MESSAGES+=("Status is still 'ready_for_implementation' but $TS_FILES_COUNT code files exist.")
|
|
104
|
-
MESSAGES+=("Workflow state may not have been updated correctly.")
|
|
105
|
-
WARNINGS=$((WARNINGS + 1))
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Check 4: Source files exist but no test files (TDD violation)
|
|
109
|
-
if [ "$TS_FILES_COUNT" -gt 5 ] && [ "$TEST_FILES_COUNT" -eq 0 ]; then
|
|
110
|
-
MESSAGES+=("Found $TS_FILES_COUNT source files but no test files.")
|
|
111
|
-
MESSAGES+=("TDD methodology may not have been followed.")
|
|
112
|
-
WARNINGS=$((WARNINGS + 1))
|
|
113
|
-
fi
|
|
114
|
-
|
|
115
|
-
# Summary
|
|
116
|
-
if [ "$WARNINGS" -gt 0 ]; then
|
|
117
|
-
echo "" >&2
|
|
118
|
-
log_warn "============================================"
|
|
119
|
-
log_warn "Detected $WARNINGS potential issue(s):"
|
|
120
|
-
log_warn "============================================"
|
|
121
|
-
for msg in "${MESSAGES[@]}"; do
|
|
122
|
-
log_warn " - $msg"
|
|
123
|
-
done
|
|
124
|
-
echo "" >&2
|
|
125
|
-
log_warn "Possible causes:"
|
|
126
|
-
log_warn " 1. Implementer agent was not invoked via Task tool"
|
|
127
|
-
log_warn " 2. Code was written directly instead of through delegation"
|
|
128
|
-
log_warn " 3. orchestrator-index.json was not updated during implementation"
|
|
129
|
-
echo "" >&2
|
|
130
|
-
log_warn "Recommended actions:"
|
|
131
|
-
log_warn " 1. Review CLAUDE.md section: MANDATORY: IMPLEMENT Phase Delegation"
|
|
132
|
-
log_warn " 2. Ensure Task tool is used with subagent_type='implementer'"
|
|
133
|
-
log_warn " 3. Update orchestrator-index.json with correct task progress"
|
|
134
|
-
echo "" >&2
|
|
135
|
-
exit 1
|
|
136
|
-
else
|
|
137
|
-
log_info "Validation passed. No issues detected."
|
|
138
|
-
exit 0
|
|
139
|
-
fi
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Pre-Agent Invoke Hook
|
|
3
|
-
# Executado antes de invocar um subagent
|
|
4
|
-
# Valida contexto e injeta informacoes da KB
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
-
|
|
11
|
-
# Recebe evento via stdin ou argumento
|
|
12
|
-
if [ -n "$1" ]; then
|
|
13
|
-
EVENT="$1"
|
|
14
|
-
else
|
|
15
|
-
EVENT=$(cat)
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Verifica se temos o handler compilado
|
|
19
|
-
HANDLER="$PROJECT_ROOT/dist/hook.js"
|
|
20
|
-
|
|
21
|
-
if [ ! -f "$HANDLER" ]; then
|
|
22
|
-
echo '{"success": false, "error": "Hook handler not compiled. Run npm run build first."}' >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Executa o handler TypeScript
|
|
27
|
-
echo "$EVENT" | node "$HANDLER" pre-agent-invoke
|
|
28
|
-
|
|
29
|
-
EXIT_CODE=$?
|
|
30
|
-
|
|
31
|
-
# Exit code determina se agente pode prosseguir
|
|
32
|
-
# 0 = permitido
|
|
33
|
-
# 1 = bloqueado
|
|
34
|
-
exit $EXIT_CODE
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Pre-Phase Advance Hook
|
|
3
|
-
# Executado antes de avancar para proxima fase
|
|
4
|
-
# Avalia gate e cria checkpoint
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
-
|
|
11
|
-
# Recebe evento via stdin ou argumento
|
|
12
|
-
if [ -n "$1" ]; then
|
|
13
|
-
EVENT="$1"
|
|
14
|
-
else
|
|
15
|
-
EVENT=$(cat)
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Verifica se temos o handler compilado
|
|
19
|
-
HANDLER="$PROJECT_ROOT/dist/hook.js"
|
|
20
|
-
|
|
21
|
-
if [ ! -f "$HANDLER" ]; then
|
|
22
|
-
echo '{"success": false, "error": "Hook handler not compiled. Run npm run build first."}' >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Executa o handler TypeScript
|
|
27
|
-
echo "$EVENT" | node "$HANDLER" pre-phase-advance
|
|
28
|
-
|
|
29
|
-
EXIT_CODE=$?
|
|
30
|
-
|
|
31
|
-
# Exit code determina se fase pode avancar
|
|
32
|
-
# 0 = gate passou, pode avancar
|
|
33
|
-
# 1 = gate falhou, bloqueado
|
|
34
|
-
if [ $EXIT_CODE -eq 0 ]; then
|
|
35
|
-
echo "[pre-phase-advance] Gate passed, advancing phase" >&2
|
|
36
|
-
else
|
|
37
|
-
echo "[pre-phase-advance] Gate failed, phase advance blocked" >&2
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
exit $EXIT_CODE
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Post-Artifact Generate Hook
|
|
3
|
-
# Executado apos geracao de um artefato
|
|
4
|
-
# Valida artefato, atualiza indice, cria checkpoint
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
-
|
|
11
|
-
# Recebe evento via stdin ou argumento
|
|
12
|
-
if [ -n "$1" ]; then
|
|
13
|
-
EVENT="$1"
|
|
14
|
-
else
|
|
15
|
-
EVENT=$(cat)
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Verifica se temos o handler compilado
|
|
19
|
-
HANDLER="$PROJECT_ROOT/dist/hook.js"
|
|
20
|
-
|
|
21
|
-
if [ ! -f "$HANDLER" ]; then
|
|
22
|
-
echo '{"success": false, "error": "Hook handler not compiled. Run npm run build first."}' >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Executa o handler TypeScript
|
|
27
|
-
echo "$EVENT" | node "$HANDLER" post-artifact
|
|
28
|
-
|
|
29
|
-
EXIT_CODE=$?
|
|
30
|
-
|
|
31
|
-
# Log do resultado
|
|
32
|
-
if [ $EXIT_CODE -eq 0 ]; then
|
|
33
|
-
echo "[post-artifact-generate] Artifact processed successfully" >&2
|
|
34
|
-
else
|
|
35
|
-
echo "[post-artifact-generate] Warning: Artifact processing had issues" >&2
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Este hook nao bloqueia, apenas avisa
|
|
39
|
-
exit 0
|