@maestro-ai/mcp-server 5.6.4 → 5.7.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/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/flows/types.d.ts +25 -0
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/flows/types.js +104 -27
- package/dist/flows/types.js.map +1 -1
- package/dist/gates/code-validator.d.ts +47 -0
- package/dist/gates/code-validator.d.ts.map +1 -0
- package/dist/gates/code-validator.js +225 -0
- package/dist/gates/code-validator.js.map +1 -0
- package/dist/handlers/code-phase-handler.d.ts +36 -0
- package/dist/handlers/code-phase-handler.d.ts.map +1 -0
- package/dist/handlers/code-phase-handler.js +723 -0
- package/dist/handlers/code-phase-handler.js.map +1 -0
- package/dist/handlers/specialist-formatters.d.ts.map +1 -1
- package/dist/handlers/specialist-formatters.js +100 -0
- package/dist/handlers/specialist-formatters.js.map +1 -1
- package/dist/services/deliverable-gate.service.d.ts +40 -0
- package/dist/services/deliverable-gate.service.d.ts.map +1 -0
- package/dist/services/deliverable-gate.service.js +88 -0
- package/dist/services/deliverable-gate.service.js.map +1 -0
- package/dist/services/task-decomposer.service.d.ts +17 -0
- package/dist/services/task-decomposer.service.d.ts.map +1 -1
- package/dist/services/task-decomposer.service.js +344 -0
- package/dist/services/task-decomposer.service.js.map +1 -1
- package/dist/tools/consolidated/avancar.d.ts.map +1 -1
- package/dist/tools/consolidated/avancar.js +21 -3
- package/dist/tools/consolidated/avancar.js.map +1 -1
- package/dist/tools/proximo.d.ts.map +1 -1
- package/dist/tools/proximo.js +56 -121
- package/dist/tools/proximo.js.map +1 -1
- package/dist/types/code-manifest.d.ts +47 -0
- package/dist/types/code-manifest.d.ts.map +1 -0
- package/dist/types/code-manifest.js +12 -0
- package/dist/types/code-manifest.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Phase Handler (v8.0)
|
|
3
|
+
*
|
|
4
|
+
* Handler dedicado para fases de desenvolvimento de código (Frontend, Backend, Integração, Deploy).
|
|
5
|
+
*
|
|
6
|
+
* Responsabilidades:
|
|
7
|
+
* 1. Detectar que é fase de código e interceptar antes do proximo.ts
|
|
8
|
+
* 2. Ler backlog, OpenAPI, arquitetura do disco (via menções)
|
|
9
|
+
* 3. Gerar tasks baseadas no Backlog (não da arquitetura)
|
|
10
|
+
* 4. Apresentar tasks task-by-task com contexto dos docs anteriores
|
|
11
|
+
* 5. Validar existência real de arquivos (não keywords)
|
|
12
|
+
* 6. Gerar manifest ao completar todas tasks
|
|
13
|
+
*
|
|
14
|
+
* State machine: SETUP → WORKING → GATE → COMPLETED
|
|
15
|
+
*
|
|
16
|
+
* @since v8.0
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync } from "fs";
|
|
19
|
+
import { readFile } from "fs/promises";
|
|
20
|
+
import { join } from "path";
|
|
21
|
+
import { serializarEstado } from "../state/storage.js";
|
|
22
|
+
import { saveFile } from "../utils/persistence.js";
|
|
23
|
+
import { getFaseComStitch, isCodePhaseName } from "../flows/types.js";
|
|
24
|
+
import { validateCodePhase, formatCodeValidationResult } from "../gates/code-validator.js";
|
|
25
|
+
import { decomposeBacklogToTasks, getNextTask, getTaskProgress } from "../services/task-decomposer.service.js";
|
|
26
|
+
import { formatMention, detectIDE } from "../utils/ide-paths.js";
|
|
27
|
+
import { getFaseDirName } from "../utils/entregavel-path.js";
|
|
28
|
+
/**
|
|
29
|
+
* Verifica se uma fase é de código.
|
|
30
|
+
* v9.0: Delega para isCodePhaseName de flows/types.ts (fonte única de verdade).
|
|
31
|
+
*/
|
|
32
|
+
export function isCodePhase(faseNome) {
|
|
33
|
+
return isCodePhaseName(faseNome);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Entry point do Code Phase Handler.
|
|
37
|
+
* Detecta o estado atual e delega para o handler correto.
|
|
38
|
+
*/
|
|
39
|
+
export async function handleCodePhase(args) {
|
|
40
|
+
const { estado, diretorio } = args;
|
|
41
|
+
const faseInfo = getFaseComStitch(estado.nivel, estado.fase_atual, estado.usar_stitch);
|
|
42
|
+
if (!faseInfo) {
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: `❌ Fase ${estado.fase_atual} não encontrada no fluxo.` }],
|
|
45
|
+
isError: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Carregar ou inicializar estado da fase de código
|
|
49
|
+
let codeState = loadCodePhaseState(estado, estado.fase_atual, faseInfo.nome);
|
|
50
|
+
// State machine
|
|
51
|
+
switch (codeState.status) {
|
|
52
|
+
case 'setup':
|
|
53
|
+
return handleSetup(args, codeState, faseInfo);
|
|
54
|
+
case 'working':
|
|
55
|
+
return handleWorking(args, codeState, faseInfo);
|
|
56
|
+
case 'gate':
|
|
57
|
+
return handleGate(args, codeState, faseInfo);
|
|
58
|
+
case 'completed':
|
|
59
|
+
// Já completou — delegar para proximo.ts para avançar
|
|
60
|
+
return delegateToProximo(args);
|
|
61
|
+
default:
|
|
62
|
+
return handleSetup(args, codeState, faseInfo);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Handler: SETUP — Primeira vez na fase de código.
|
|
67
|
+
* Lê backlog + OpenAPI + arquitetura, gera tasks, apresenta visão geral.
|
|
68
|
+
*/
|
|
69
|
+
async function handleSetup(args, codeState, faseInfo) {
|
|
70
|
+
const { estado, diretorio } = args;
|
|
71
|
+
const ide = (estado.ide || detectIDE(diretorio) || 'windsurf');
|
|
72
|
+
// Ler entregáveis anteriores do disco
|
|
73
|
+
const backlogContent = await readEntregavel(estado, diretorio, 'backlog');
|
|
74
|
+
const openApiContent = await readEntregavel(estado, diretorio, 'openapi');
|
|
75
|
+
const arquiteturaContent = await readEntregavel(estado, diretorio, 'arquitetura');
|
|
76
|
+
// Gerar tasks a partir do backlog (se disponível)
|
|
77
|
+
if (!codeState.tasksGenerated && backlogContent) {
|
|
78
|
+
try {
|
|
79
|
+
const newTasks = decomposeBacklogToTasks(backlogContent, openApiContent, estado.fase_atual, faseInfo.nome);
|
|
80
|
+
if (newTasks.length > 0) {
|
|
81
|
+
// Limpar tasks antigas da mesma fase
|
|
82
|
+
estado.tasks = [
|
|
83
|
+
...(estado.tasks || []).filter(t => t.phase !== estado.fase_atual),
|
|
84
|
+
...newTasks,
|
|
85
|
+
];
|
|
86
|
+
codeState.tasksGenerated = true;
|
|
87
|
+
console.log(`[code-phase] v8.0: ${newTasks.length} tasks geradas do Backlog para fase ${estado.fase_atual} (${faseInfo.nome})`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.warn('[code-phase] v8.0: Falha ao gerar tasks do backlog:', err);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Calcular progresso
|
|
95
|
+
const progress = getTaskProgress(estado.tasks || [], estado.fase_atual);
|
|
96
|
+
const nextTask = getNextTask((estado.tasks || []).filter(t => t.phase === estado.fase_atual));
|
|
97
|
+
// Extrair stack da arquitetura (parsing simplificado)
|
|
98
|
+
const stackInfo = extractStackInfo(arquiteturaContent, faseInfo.nome);
|
|
99
|
+
// v9.0 Sprint 4: Inicializar manifest com stack da arquitetura
|
|
100
|
+
if (!codeState.manifest) {
|
|
101
|
+
codeState.manifest = createEmptyManifest(estado.fase_atual, faseInfo.nome);
|
|
102
|
+
}
|
|
103
|
+
codeState.manifest.stack = extractStackForManifest(arquiteturaContent, faseInfo.nome);
|
|
104
|
+
// Extrair user stories relevantes do backlog
|
|
105
|
+
const relevantStories = extractRelevantStoriesSummary(backlogContent, faseInfo.nome);
|
|
106
|
+
// Extrair endpoints do OpenAPI
|
|
107
|
+
const endpointsSummary = extractEndpointsSummary(openApiContent, faseInfo.nome);
|
|
108
|
+
// Gerar menções aos documentos relevantes
|
|
109
|
+
const mencoes = buildRelevantMentions(estado, diretorio, faseInfo.nome, ide);
|
|
110
|
+
// Atualizar estado
|
|
111
|
+
codeState.status = nextTask ? 'working' : 'setup';
|
|
112
|
+
saveCodePhaseState(estado, codeState);
|
|
113
|
+
await persistState(estado, diretorio);
|
|
114
|
+
const taskInfo = nextTask
|
|
115
|
+
? `\n## ⚡ Task Atual: 1/${progress.total} — ${nextTask.title}\n${nextTask.description}\n`
|
|
116
|
+
: '\n> ⚠️ Nenhuma task gerada. Verifique se o backlog existe.\n';
|
|
117
|
+
return {
|
|
118
|
+
content: [{
|
|
119
|
+
type: "text",
|
|
120
|
+
text: `# 🚀 Fase ${estado.fase_atual}: ${faseInfo.nome} — Setup
|
|
121
|
+
|
|
122
|
+
## 👤 Especialista: ${faseInfo.especialista}
|
|
123
|
+
|
|
124
|
+
${stackInfo}
|
|
125
|
+
|
|
126
|
+
${relevantStories}
|
|
127
|
+
|
|
128
|
+
${endpointsSummary}
|
|
129
|
+
|
|
130
|
+
## 📎 Leia antes de começar
|
|
131
|
+
${mencoes}
|
|
132
|
+
${taskInfo}
|
|
133
|
+
## 📊 Progresso: ${progress.done}/${progress.total} tasks (${progress.percentage}%)
|
|
134
|
+
|
|
135
|
+
## Gate de Saída
|
|
136
|
+
${faseInfo.gate_checklist.map(item => `- [ ] ${item}`).join('\n')}
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 🤖 Instruções para a IA
|
|
141
|
+
|
|
142
|
+
1. **Leia os documentos mencionados** acima para entender o contexto completo
|
|
143
|
+
2. **Implemente a task atual** seguindo a stack definida na Arquitetura
|
|
144
|
+
3. **Após concluir**, marque como feita chamando:
|
|
145
|
+
|
|
146
|
+
\`\`\`json
|
|
147
|
+
executar({
|
|
148
|
+
"diretorio": "${diretorio}",
|
|
149
|
+
"acao": "avancar",
|
|
150
|
+
"respostas": { "task_done": true }
|
|
151
|
+
})
|
|
152
|
+
\`\`\`
|
|
153
|
+
|
|
154
|
+
> ⚠️ Implemente UMA task por vez. Não tente fazer tudo de uma vez.
|
|
155
|
+
`,
|
|
156
|
+
}],
|
|
157
|
+
estado_atualizado: serializarEstado(estado).content,
|
|
158
|
+
specialist_persona: {
|
|
159
|
+
name: faseInfo.especialista,
|
|
160
|
+
tone: "Técnico e prático",
|
|
161
|
+
expertise: getExpertiseForPhase(faseInfo.nome),
|
|
162
|
+
instructions: `Você é o especialista de ${faseInfo.nome}. Implemente task por task seguindo a stack definida na Arquitetura. Use os docs de referência para contexto.`,
|
|
163
|
+
},
|
|
164
|
+
progress: {
|
|
165
|
+
current_phase: faseInfo.nome,
|
|
166
|
+
total_phases: estado.total_fases,
|
|
167
|
+
completed_phases: estado.gates_validados?.length || 0,
|
|
168
|
+
percentage: Math.round(((estado.gates_validados?.length || 0) / estado.total_fases) * 100),
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Handler: WORKING — Task por task.
|
|
174
|
+
* Recebe indicação de task concluída, marca done, apresenta próxima.
|
|
175
|
+
*/
|
|
176
|
+
async function handleWorking(args, codeState, faseInfo) {
|
|
177
|
+
const { estado, diretorio, respostas } = args;
|
|
178
|
+
const ide = (estado.ide || detectIDE(diretorio) || 'windsurf');
|
|
179
|
+
const phaseTasks = (estado.tasks || []).filter(t => t.phase === estado.fase_atual);
|
|
180
|
+
// Se respostas indica task concluída
|
|
181
|
+
if (respostas?.task_done === true || respostas?.task_done === 'true') {
|
|
182
|
+
// Encontrar task atual (primeira todo ou in_progress)
|
|
183
|
+
const currentTask = phaseTasks.find(t => (t.type === 'task' || t.type === 'subtask') &&
|
|
184
|
+
(t.status === 'in_progress' || t.status === 'todo') &&
|
|
185
|
+
t.dependencies.every(dep => phaseTasks.some(pt => pt.id === dep && pt.status === 'done')));
|
|
186
|
+
if (currentTask) {
|
|
187
|
+
currentTask.status = 'done';
|
|
188
|
+
currentTask.updated_at = new Date().toISOString();
|
|
189
|
+
console.log(`[code-phase] Task marcada como done: ${currentTask.title}`);
|
|
190
|
+
// Verificar se o parent (story) está completo
|
|
191
|
+
if (currentTask.parent_id) {
|
|
192
|
+
const parent = phaseTasks.find(t => t.id === currentTask.parent_id);
|
|
193
|
+
if (parent) {
|
|
194
|
+
const allChildrenDone = parent.children_ids.every(cid => phaseTasks.some(t => t.id === cid && t.status === 'done'));
|
|
195
|
+
if (allChildrenDone) {
|
|
196
|
+
parent.status = 'done';
|
|
197
|
+
parent.updated_at = new Date().toISOString();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Registrar arquivos criados (se informados nas respostas)
|
|
203
|
+
if (respostas?.arquivos_criados && Array.isArray(respostas.arquivos_criados)) {
|
|
204
|
+
if (!codeState.manifest) {
|
|
205
|
+
codeState.manifest = createEmptyManifest(estado.fase_atual, faseInfo.nome);
|
|
206
|
+
}
|
|
207
|
+
codeState.manifest.arquivos_criados.push(...respostas.arquivos_criados);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Calcular progresso atualizado
|
|
211
|
+
const progress = getTaskProgress(phaseTasks, estado.fase_atual);
|
|
212
|
+
const nextTask = getNextTask(phaseTasks);
|
|
213
|
+
// Se todas as tasks estão done → ir para GATE
|
|
214
|
+
if (!nextTask && progress.total > 0 && progress.done === progress.total) {
|
|
215
|
+
codeState.status = 'gate';
|
|
216
|
+
saveCodePhaseState(estado, codeState);
|
|
217
|
+
await persistState(estado, diretorio);
|
|
218
|
+
return handleGate(args, codeState, faseInfo);
|
|
219
|
+
}
|
|
220
|
+
// Marcar próxima task como in_progress
|
|
221
|
+
if (nextTask && nextTask.status === 'todo') {
|
|
222
|
+
nextTask.status = 'in_progress';
|
|
223
|
+
nextTask.updated_at = new Date().toISOString();
|
|
224
|
+
}
|
|
225
|
+
codeState.currentTaskIndex = progress.done;
|
|
226
|
+
codeState.updatedAt = new Date().toISOString();
|
|
227
|
+
saveCodePhaseState(estado, codeState);
|
|
228
|
+
await persistState(estado, diretorio);
|
|
229
|
+
const taskNum = progress.done + 1;
|
|
230
|
+
const mencoes = buildRelevantMentions(estado, diretorio, faseInfo.nome, ide);
|
|
231
|
+
return {
|
|
232
|
+
content: [{
|
|
233
|
+
type: "text",
|
|
234
|
+
text: `# ${progress.done > 0 ? '✅ Task Anterior Concluída!' : ''} Task ${taskNum}/${progress.total}
|
|
235
|
+
|
|
236
|
+
## 📊 Progresso: ${progress.done}/${progress.total} (${progress.percentage}%)
|
|
237
|
+
${'█'.repeat(Math.floor(progress.percentage / 5))}${'░'.repeat(20 - Math.floor(progress.percentage / 5))} ${progress.percentage}%
|
|
238
|
+
|
|
239
|
+
${nextTask ? `## 📌 Task Atual: ${nextTask.title}
|
|
240
|
+
${nextTask.description}
|
|
241
|
+
|
|
242
|
+
${nextTask.metadata?.acceptance_criteria ? `### Critérios de Aceite\n${nextTask.metadata.acceptance_criteria.map(c => `- [ ] ${c}`).join('\n')}` : ''}
|
|
243
|
+
|
|
244
|
+
${nextTask.metadata?.files ? `### Arquivos Esperados\n${nextTask.metadata.files.map(f => `- \`${f}\``).join('\n')}` : ''}
|
|
245
|
+
` : '> Nenhuma task pendente.'}
|
|
246
|
+
|
|
247
|
+
## 📎 Referência
|
|
248
|
+
${mencoes}
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### 🤖 Após implementar esta task:
|
|
253
|
+
|
|
254
|
+
\`\`\`json
|
|
255
|
+
executar({
|
|
256
|
+
"diretorio": "${diretorio}",
|
|
257
|
+
"acao": "avancar",
|
|
258
|
+
"respostas": { "task_done": true }
|
|
259
|
+
})
|
|
260
|
+
\`\`\`
|
|
261
|
+
`,
|
|
262
|
+
}],
|
|
263
|
+
estado_atualizado: serializarEstado(estado).content,
|
|
264
|
+
next_action: {
|
|
265
|
+
tool: "executar",
|
|
266
|
+
description: `Concluir task ${taskNum}/${progress.total}: ${nextTask?.title || 'próxima'}`,
|
|
267
|
+
args_template: { diretorio, acao: "avancar", respostas: { task_done: true } },
|
|
268
|
+
requires_user_input: false,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Handler: GATE — Todas tasks done. Gerar manifest e validar.
|
|
274
|
+
* v9.0: Usa CodeValidator (validação por artefatos) em vez de delegar para proximo.ts textual.
|
|
275
|
+
* Se score >= 70, avança automaticamente via proximo.ts.
|
|
276
|
+
* Se score 50-69, aguarda aprovação manual.
|
|
277
|
+
* Se score < 50, bloqueia com instruções.
|
|
278
|
+
*/
|
|
279
|
+
async function handleGate(args, codeState, faseInfo) {
|
|
280
|
+
const { estado, diretorio } = args;
|
|
281
|
+
const progress = getTaskProgress(estado.tasks || [], estado.fase_atual);
|
|
282
|
+
// Gerar manifest
|
|
283
|
+
const manifest = codeState.manifest || createEmptyManifest(estado.fase_atual, faseInfo.nome);
|
|
284
|
+
manifest.tasks_total = progress.total;
|
|
285
|
+
manifest.tasks_done = progress.done;
|
|
286
|
+
manifest.timestamp = new Date().toISOString();
|
|
287
|
+
// Escanear arquivos criados no diretório do projeto
|
|
288
|
+
const scannedFiles = scanProjectFiles(diretorio, faseInfo.nome);
|
|
289
|
+
manifest.arquivos_criados = [...new Set([...manifest.arquivos_criados, ...scannedFiles])];
|
|
290
|
+
// v9.0 Sprint 4: Popular user_stories a partir das tasks do estado
|
|
291
|
+
populateManifestUserStories(manifest, estado.tasks || [], estado.fase_atual);
|
|
292
|
+
// Salvar manifest
|
|
293
|
+
const faseDirName = getFaseDirName(estado.fase_atual, faseInfo.nome);
|
|
294
|
+
const manifestPath = join(diretorio, 'docs', faseDirName, 'manifest.json');
|
|
295
|
+
const summaryPath = join(diretorio, 'docs', faseDirName, `${faseInfo.nome.toLowerCase()}-summary.md`);
|
|
296
|
+
try {
|
|
297
|
+
await saveFile(manifestPath, JSON.stringify(manifest, null, 2));
|
|
298
|
+
// Gerar resumo markdown
|
|
299
|
+
const summaryContent = generateSummaryMarkdown(manifest, faseInfo, progress);
|
|
300
|
+
await saveFile(summaryPath, summaryContent);
|
|
301
|
+
// Registrar como entregável no estado
|
|
302
|
+
estado.entregaveis[`fase_${estado.fase_atual}`] = summaryPath;
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
console.warn('[code-phase] Falha ao salvar manifest:', err);
|
|
306
|
+
}
|
|
307
|
+
// v9.0: Validação orientada a artefatos (em vez de keywords textuais)
|
|
308
|
+
const validationResult = validateCodePhase(manifest, diretorio, estado.tasks || [], estado.fase_atual);
|
|
309
|
+
console.log(`[code-phase] v9.0: CodeValidator score=${validationResult.score}/100 approved=${validationResult.approved} (arquivos=${validationResult.breakdown.arquivos}, tasks=${validationResult.breakdown.tasks}, manifest=${validationResult.breakdown.manifest})`);
|
|
310
|
+
// Score < 50: BLOQUEAR
|
|
311
|
+
if (validationResult.score < 50) {
|
|
312
|
+
const feedbackMd = formatCodeValidationResult(validationResult, faseInfo.nome);
|
|
313
|
+
return {
|
|
314
|
+
content: [{
|
|
315
|
+
type: "text",
|
|
316
|
+
text: `# ❌ Gate de Código Bloqueado — ${faseInfo.nome}\n\n${feedbackMd}\n\n---\n\n**Não é possível avançar.** Complete as tasks pendentes, gere os arquivos e tente novamente com \`executar({ acao: "avancar" })\`.`,
|
|
317
|
+
}],
|
|
318
|
+
estado_atualizado: serializarEstado(estado).content,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
// Score 50-69: Aguardar aprovação manual
|
|
322
|
+
if (validationResult.score < 70) {
|
|
323
|
+
estado.aguardando_aprovacao = true;
|
|
324
|
+
estado.motivo_bloqueio = `Gate de código: score ${validationResult.score}/100`;
|
|
325
|
+
estado.score_bloqueado = validationResult.score;
|
|
326
|
+
saveCodePhaseState(estado, codeState);
|
|
327
|
+
await persistState(estado, diretorio);
|
|
328
|
+
const feedbackMd = formatCodeValidationResult(validationResult, faseInfo.nome);
|
|
329
|
+
return {
|
|
330
|
+
content: [{
|
|
331
|
+
type: "text",
|
|
332
|
+
text: `# ⚠️ Aprovação Manual Necessária — ${faseInfo.nome}\n\n${feedbackMd}\n\n---\n\n## 🔐 Ação do Usuário\n\n- **Para corrigir** (recomendado): Complete as tasks pendentes e re-submeta\n- **Para aprovar mesmo assim**: Diga "aprovar o gate"\n\n> ⚠️ A IA NÃO pode aprovar automaticamente.`,
|
|
333
|
+
}],
|
|
334
|
+
estado_atualizado: serializarEstado(estado).content,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
// Score >= 70: Aprovado — marcar como completed e delegar para proximo.ts para avançar fase
|
|
338
|
+
codeState.status = 'completed';
|
|
339
|
+
codeState.manifest = manifest;
|
|
340
|
+
saveCodePhaseState(estado, codeState);
|
|
341
|
+
await persistState(estado, diretorio);
|
|
342
|
+
// Delegar para proximo.ts para avançar fase (com summary como entregável textual)
|
|
343
|
+
return delegateToProximo(args);
|
|
344
|
+
}
|
|
345
|
+
// === HELPER FUNCTIONS ===
|
|
346
|
+
/**
|
|
347
|
+
* Carrega ou inicializa o estado da fase de código.
|
|
348
|
+
*/
|
|
349
|
+
function loadCodePhaseState(estado, faseNumero, faseNome) {
|
|
350
|
+
const existing = estado.codePhaseState;
|
|
351
|
+
if (existing && existing.faseNumero === faseNumero) {
|
|
352
|
+
return existing;
|
|
353
|
+
}
|
|
354
|
+
return {
|
|
355
|
+
status: 'setup',
|
|
356
|
+
faseNumero,
|
|
357
|
+
faseNome,
|
|
358
|
+
tasksGenerated: false,
|
|
359
|
+
currentTaskIndex: 0,
|
|
360
|
+
startedAt: new Date().toISOString(),
|
|
361
|
+
updatedAt: new Date().toISOString(),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function saveCodePhaseState(estado, codeState) {
|
|
365
|
+
estado.codePhaseState = codeState;
|
|
366
|
+
}
|
|
367
|
+
async function persistState(estado, diretorio) {
|
|
368
|
+
estado.atualizado_em = new Date().toISOString();
|
|
369
|
+
const estadoFile = serializarEstado(estado);
|
|
370
|
+
try {
|
|
371
|
+
await saveFile(`${diretorio}/${estadoFile.path}`, estadoFile.content);
|
|
372
|
+
}
|
|
373
|
+
catch (err) {
|
|
374
|
+
console.error('[code-phase] Erro ao salvar estado:', err);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Lê um entregável anterior do disco.
|
|
379
|
+
*/
|
|
380
|
+
async function readEntregavel(estado, diretorio, tipo) {
|
|
381
|
+
const entregaveis = estado.entregaveis || {};
|
|
382
|
+
// Buscar no estado por chave parcial
|
|
383
|
+
for (const [key, path] of Object.entries(entregaveis)) {
|
|
384
|
+
const keyLower = key.toLowerCase();
|
|
385
|
+
const pathLower = path.toLowerCase();
|
|
386
|
+
const match = (tipo === 'backlog' && (keyLower.includes('backlog') || pathLower.includes('backlog'))) ||
|
|
387
|
+
(tipo === 'openapi' && (keyLower.includes('api') || pathLower.includes('openapi') || pathLower.includes('.yaml'))) ||
|
|
388
|
+
(tipo === 'arquitetura' && (keyLower.includes('arquitetura') || pathLower.includes('arquitetura')) && !pathLower.includes('avancada')) ||
|
|
389
|
+
(tipo === 'design' && (keyLower.includes('design') || pathLower.includes('design-doc'))) ||
|
|
390
|
+
(tipo === 'banco' && (keyLower.includes('banco') || pathLower.includes('design-banco')));
|
|
391
|
+
if (match) {
|
|
392
|
+
try {
|
|
393
|
+
const content = await readFile(path, 'utf-8');
|
|
394
|
+
if (content && content.trim().length > 50)
|
|
395
|
+
return content;
|
|
396
|
+
}
|
|
397
|
+
catch { /* ignore */ }
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// Fallback: tentar paths convencionais
|
|
401
|
+
const fallbackPaths = {
|
|
402
|
+
backlog: ['docs/12-backlog/backlog.md', 'docs/fase-12-backlog/backlog.md'],
|
|
403
|
+
openapi: ['docs/13-api/openapi.yaml', 'docs/fase-13-contrato-api/openapi.yaml'],
|
|
404
|
+
arquitetura: ['docs/06-arquitetura/arquitetura.md', 'docs/fase-06-arquitetura/arquitetura.md'],
|
|
405
|
+
design: ['docs/03-ux-design/design-doc.md', 'docs/fase-03-ux-design/design-doc.md'],
|
|
406
|
+
banco: ['docs/fase-05-banco/design-banco.md', 'docs/fase-05-banco-de-dados/design-banco.md'],
|
|
407
|
+
};
|
|
408
|
+
for (const relPath of (fallbackPaths[tipo] || [])) {
|
|
409
|
+
const fullPath = join(diretorio, relPath);
|
|
410
|
+
if (existsSync(fullPath)) {
|
|
411
|
+
try {
|
|
412
|
+
return await readFile(fullPath, 'utf-8');
|
|
413
|
+
}
|
|
414
|
+
catch { /* ignore */ }
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Extrai informações de stack da arquitetura.
|
|
421
|
+
*/
|
|
422
|
+
function extractStackInfo(arquiteturaContent, faseNome) {
|
|
423
|
+
if (!arquiteturaContent)
|
|
424
|
+
return '## Stack\n> ⚠️ Documento de Arquitetura não encontrado. Consulte o especialista.';
|
|
425
|
+
const fase = faseNome.toLowerCase();
|
|
426
|
+
const lines = arquiteturaContent.split('\n');
|
|
427
|
+
const stackLines = [];
|
|
428
|
+
let inStackSection = false;
|
|
429
|
+
for (const line of lines) {
|
|
430
|
+
if (line.match(/stack\s+tecnol[oó]gica/i) || line.match(/## \d+\.\s*Stack/i)) {
|
|
431
|
+
inStackSection = true;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (inStackSection) {
|
|
435
|
+
if (line.match(/^##\s/) && !line.match(/stack/i))
|
|
436
|
+
break;
|
|
437
|
+
if (line.trim().startsWith('-') || line.trim().startsWith('*')) {
|
|
438
|
+
const lower = line.toLowerCase();
|
|
439
|
+
if (fase.includes('frontend') && (lower.includes('frontend') || lower.includes('next') || lower.includes('react') || lower.includes('tailwind'))) {
|
|
440
|
+
stackLines.push(line.trim());
|
|
441
|
+
}
|
|
442
|
+
else if (fase.includes('backend') && (lower.includes('backend') || lower.includes('node') || lower.includes('express') || lower.includes('prisma'))) {
|
|
443
|
+
stackLines.push(line.trim());
|
|
444
|
+
}
|
|
445
|
+
else if (!fase.includes('frontend') && !fase.includes('backend')) {
|
|
446
|
+
stackLines.push(line.trim());
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (stackLines.length === 0) {
|
|
452
|
+
// Fallback: buscar menções genéricas de stack
|
|
453
|
+
return `## Stack Definida (Arquitetura)\n> Consulte o documento de Arquitetura para a stack completa.`;
|
|
454
|
+
}
|
|
455
|
+
return `## Stack Definida (Arquitetura)\n${stackLines.join('\n')}`;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Extrai resumo de user stories relevantes do backlog.
|
|
459
|
+
*/
|
|
460
|
+
function extractRelevantStoriesSummary(backlogContent, faseNome) {
|
|
461
|
+
if (!backlogContent)
|
|
462
|
+
return '## 📋 User Stories\n> ⚠️ Backlog não encontrado.';
|
|
463
|
+
const lines = backlogContent.split('\n');
|
|
464
|
+
const stories = [];
|
|
465
|
+
const fase = faseNome.toLowerCase();
|
|
466
|
+
for (const line of lines) {
|
|
467
|
+
const match = line.match(/\|\s*(US-\d+)\s*\|\s*(.+?)\s*\|\s*(\S+)\s*\|\s*\S*\s*\|\s*(\d+)\s*pts?\s*\|/);
|
|
468
|
+
if (match) {
|
|
469
|
+
const [, id, desc, tipo, pts] = match;
|
|
470
|
+
const tipoLower = tipo.toLowerCase();
|
|
471
|
+
const isRelevant = (fase.includes('frontend') && tipoLower.includes('fe')) ||
|
|
472
|
+
(fase.includes('backend') && tipoLower.includes('be')) ||
|
|
473
|
+
(fase.includes('integra') && (tipoLower.includes('integra') || tipoLower.includes('fe+be'))) ||
|
|
474
|
+
(!fase.includes('frontend') && !fase.includes('backend') && !fase.includes('integra'));
|
|
475
|
+
if (isRelevant) {
|
|
476
|
+
stories.push(`| ${id} | ${desc.trim().substring(0, 60)} | ${tipo} | ${pts}pts |`);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (stories.length === 0)
|
|
481
|
+
return '## 📋 User Stories\n> Nenhuma US específica encontrada para esta fase.';
|
|
482
|
+
return `## 📋 User Stories para ${faseNome}\n\n| ID | Descrição | Tipo | Pts |\n|---|---|---|---|\n${stories.join('\n')}`;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Extrai resumo de endpoints do OpenAPI.
|
|
486
|
+
*/
|
|
487
|
+
function extractEndpointsSummary(openApiContent, faseNome) {
|
|
488
|
+
if (!openApiContent)
|
|
489
|
+
return '';
|
|
490
|
+
const fase = faseNome.toLowerCase();
|
|
491
|
+
const lines = openApiContent.split('\n');
|
|
492
|
+
const endpoints = [];
|
|
493
|
+
let currentPath = '';
|
|
494
|
+
for (const line of lines) {
|
|
495
|
+
const pathMatch = line.match(/^ (\/\S+):$/);
|
|
496
|
+
if (pathMatch) {
|
|
497
|
+
currentPath = pathMatch[1];
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
const methodMatch = line.match(/^\s{4}(get|post|put|delete|patch):$/);
|
|
501
|
+
if (methodMatch && currentPath) {
|
|
502
|
+
endpoints.push(`\`${methodMatch[1].toUpperCase()} ${currentPath}\``);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (endpoints.length === 0)
|
|
506
|
+
return '';
|
|
507
|
+
const verb = fase.includes('frontend') ? 'consumir' : fase.includes('backend') ? 'implementar' : 'integrar';
|
|
508
|
+
return `## 🔗 Endpoints para ${verb}\n${endpoints.join(' · ')}`;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Gera menções de arquivo para documentos relevantes à fase.
|
|
512
|
+
*/
|
|
513
|
+
function buildRelevantMentions(estado, diretorio, faseNome, ide) {
|
|
514
|
+
const mencoes = [];
|
|
515
|
+
const entregaveis = estado.entregaveis || {};
|
|
516
|
+
const fase = faseNome.toLowerCase();
|
|
517
|
+
// Documentos sempre relevantes para código
|
|
518
|
+
const relevantKeys = ['backlog', 'api', 'contrato', 'arquitetura'];
|
|
519
|
+
if (fase.includes('frontend'))
|
|
520
|
+
relevantKeys.push('design', 'ux');
|
|
521
|
+
if (fase.includes('backend'))
|
|
522
|
+
relevantKeys.push('banco', 'dominio', 'modelo', 'seguranca');
|
|
523
|
+
if (fase.includes('integra'))
|
|
524
|
+
relevantKeys.push('testes');
|
|
525
|
+
for (const [key, absPath] of Object.entries(entregaveis)) {
|
|
526
|
+
const kl = key.toLowerCase();
|
|
527
|
+
const pl = absPath.toLowerCase();
|
|
528
|
+
if (relevantKeys.some(rk => kl.includes(rk) || pl.includes(rk))) {
|
|
529
|
+
const relPath = absPath
|
|
530
|
+
.replace(diretorio.replace(/\\/g, '/'), '')
|
|
531
|
+
.replace(diretorio, '')
|
|
532
|
+
.replace(/^[\\/]+/, '');
|
|
533
|
+
mencoes.push(`- ${formatMention(relPath.replace(/\\/g, '/'), ide)}`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return mencoes.length > 0 ? mencoes.join('\n') : '> Nenhum documento de referência encontrado.';
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Escaneia arquivos de código criados no projeto.
|
|
540
|
+
*/
|
|
541
|
+
function scanProjectFiles(diretorio, faseNome) {
|
|
542
|
+
const fase = faseNome.toLowerCase();
|
|
543
|
+
const files = [];
|
|
544
|
+
const dirsToScan = [];
|
|
545
|
+
if (fase.includes('frontend'))
|
|
546
|
+
dirsToScan.push('frontend', 'src', 'app', 'pages', 'components');
|
|
547
|
+
if (fase.includes('backend'))
|
|
548
|
+
dirsToScan.push('backend', 'server', 'api', 'src');
|
|
549
|
+
if (fase.includes('integra'))
|
|
550
|
+
dirsToScan.push('tests', 'e2e', '__tests__');
|
|
551
|
+
for (const dir of dirsToScan) {
|
|
552
|
+
const fullPath = join(diretorio, dir);
|
|
553
|
+
if (existsSync(fullPath)) {
|
|
554
|
+
files.push(dir + '/');
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return files;
|
|
558
|
+
}
|
|
559
|
+
function createEmptyManifest(fase, nome) {
|
|
560
|
+
return {
|
|
561
|
+
fase,
|
|
562
|
+
nome,
|
|
563
|
+
stack: { framework: '', language: 'TypeScript' },
|
|
564
|
+
user_stories: [],
|
|
565
|
+
tasks_total: 0,
|
|
566
|
+
tasks_done: 0,
|
|
567
|
+
arquivos_criados: [],
|
|
568
|
+
timestamp: new Date().toISOString(),
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* v9.0 Sprint 4: Extrai stack estruturada da arquitetura para o manifest.
|
|
573
|
+
*/
|
|
574
|
+
function extractStackForManifest(arquiteturaContent, faseNome) {
|
|
575
|
+
if (!arquiteturaContent)
|
|
576
|
+
return { framework: '', language: 'TypeScript' };
|
|
577
|
+
const fase = faseNome.toLowerCase();
|
|
578
|
+
const content = arquiteturaContent.toLowerCase();
|
|
579
|
+
const extras = [];
|
|
580
|
+
let framework = '';
|
|
581
|
+
let language = 'TypeScript';
|
|
582
|
+
if (fase.includes('frontend')) {
|
|
583
|
+
if (content.includes('next.js') || content.includes('nextjs'))
|
|
584
|
+
framework = 'Next.js';
|
|
585
|
+
else if (content.includes('react'))
|
|
586
|
+
framework = 'React';
|
|
587
|
+
else if (content.includes('vue'))
|
|
588
|
+
framework = 'Vue.js';
|
|
589
|
+
else if (content.includes('angular'))
|
|
590
|
+
framework = 'Angular';
|
|
591
|
+
if (content.includes('tailwind'))
|
|
592
|
+
extras.push('Tailwind');
|
|
593
|
+
if (content.includes('shadcn'))
|
|
594
|
+
extras.push('shadcn/ui');
|
|
595
|
+
if (content.includes('zustand'))
|
|
596
|
+
extras.push('Zustand');
|
|
597
|
+
if (content.includes('react query') || content.includes('tanstack'))
|
|
598
|
+
extras.push('React Query');
|
|
599
|
+
}
|
|
600
|
+
else if (fase.includes('backend')) {
|
|
601
|
+
if (content.includes('express'))
|
|
602
|
+
framework = 'Express';
|
|
603
|
+
else if (content.includes('fastify'))
|
|
604
|
+
framework = 'Fastify';
|
|
605
|
+
else if (content.includes('nestjs') || content.includes('nest.js'))
|
|
606
|
+
framework = 'NestJS';
|
|
607
|
+
if (content.includes('prisma'))
|
|
608
|
+
extras.push('Prisma');
|
|
609
|
+
if (content.includes('postgresql') || content.includes('postgres'))
|
|
610
|
+
extras.push('PostgreSQL');
|
|
611
|
+
if (content.includes('redis'))
|
|
612
|
+
extras.push('Redis');
|
|
613
|
+
if (content.includes('jwt'))
|
|
614
|
+
extras.push('JWT');
|
|
615
|
+
}
|
|
616
|
+
else if (fase.includes('integra')) {
|
|
617
|
+
if (content.includes('playwright'))
|
|
618
|
+
framework = 'Playwright';
|
|
619
|
+
else if (content.includes('cypress'))
|
|
620
|
+
framework = 'Cypress';
|
|
621
|
+
if (content.includes('docker'))
|
|
622
|
+
extras.push('Docker');
|
|
623
|
+
}
|
|
624
|
+
else if (fase.includes('deploy')) {
|
|
625
|
+
if (content.includes('docker'))
|
|
626
|
+
framework = 'Docker';
|
|
627
|
+
if (content.includes('github actions'))
|
|
628
|
+
extras.push('GitHub Actions');
|
|
629
|
+
if (content.includes('aws'))
|
|
630
|
+
extras.push('AWS');
|
|
631
|
+
}
|
|
632
|
+
if (content.includes('javascript') && !content.includes('typescript'))
|
|
633
|
+
language = 'JavaScript';
|
|
634
|
+
if (content.includes('python'))
|
|
635
|
+
language = 'Python';
|
|
636
|
+
if (content.includes('java') && !content.includes('javascript'))
|
|
637
|
+
language = 'Java';
|
|
638
|
+
return { framework, language, extras: extras.length > 0 ? extras : undefined };
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* v9.0 Sprint 4: Popula manifest.user_stories a partir das tasks do estado.
|
|
642
|
+
* Mapeia tasks com parent_id (stories) para CodeManifestStory.
|
|
643
|
+
*/
|
|
644
|
+
function populateManifestUserStories(manifest, tasks, faseNumero) {
|
|
645
|
+
const phaseTasks = tasks.filter(t => t.phase === faseNumero);
|
|
646
|
+
const stories = phaseTasks.filter(t => t.type === 'story');
|
|
647
|
+
manifest.user_stories = stories.map(story => {
|
|
648
|
+
// Extrair ID da US do título (ex: "US-020: CRUD Produtos")
|
|
649
|
+
const idMatch = story.title.match(/US-\d+/i);
|
|
650
|
+
const id = idMatch ? idMatch[0] : story.id;
|
|
651
|
+
// Verificar status das sub-tasks
|
|
652
|
+
const childTasks = phaseTasks.filter(t => t.parent_id === story.id);
|
|
653
|
+
const allDone = childTasks.length > 0 && childTasks.every(t => t.status === 'done');
|
|
654
|
+
const anyInProgress = childTasks.some(t => t.status === 'in_progress');
|
|
655
|
+
// Coletar arquivos das sub-tasks
|
|
656
|
+
const arquivos = childTasks
|
|
657
|
+
.flatMap(t => t.metadata?.files || [])
|
|
658
|
+
.filter(Boolean);
|
|
659
|
+
return {
|
|
660
|
+
id,
|
|
661
|
+
titulo: story.title.replace(/^US-\d+:\s*/i, ''),
|
|
662
|
+
status: allDone ? 'done' : anyInProgress ? 'in_progress' : 'todo',
|
|
663
|
+
arquivos,
|
|
664
|
+
};
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
function generateSummaryMarkdown(manifest, faseInfo, progress) {
|
|
668
|
+
// v9.0 Sprint 4: Stack info
|
|
669
|
+
const stackMd = manifest.stack?.framework
|
|
670
|
+
? `## Stack\n- **Framework:** ${manifest.stack.framework}\n- **Language:** ${manifest.stack.language}${manifest.stack.extras ? `\n- **Extras:** ${manifest.stack.extras.join(', ')}` : ''}\n`
|
|
671
|
+
: '';
|
|
672
|
+
// v9.0 Sprint 4: Tabela rastreável US → arquivos → status
|
|
673
|
+
let traceabilityMd = '';
|
|
674
|
+
if (manifest.user_stories.length > 0) {
|
|
675
|
+
traceabilityMd = `## Rastreabilidade US → Código\n\n| US | Título | Status | Arquivos |\n|----|--------|--------|----------|\n`;
|
|
676
|
+
for (const story of manifest.user_stories) {
|
|
677
|
+
const icon = story.status === 'done' ? '✅' : story.status === 'in_progress' ? '🔄' : '⏳';
|
|
678
|
+
const arquivos = story.arquivos.length > 0
|
|
679
|
+
? story.arquivos.slice(0, 3).map(f => `\`${f}\``).join(', ') + (story.arquivos.length > 3 ? ` (+${story.arquivos.length - 3})` : '')
|
|
680
|
+
: '—';
|
|
681
|
+
traceabilityMd += `| ${story.id} | ${story.titulo.substring(0, 50)} | ${icon} ${story.status} | ${arquivos} |\n`;
|
|
682
|
+
}
|
|
683
|
+
const doneCount = manifest.user_stories.filter(s => s.status === 'done').length;
|
|
684
|
+
traceabilityMd += `\n> **US Concluídas:** ${doneCount}/${manifest.user_stories.length}\n`;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
traceabilityMd = `## User Stories\n(geradas via TaskDecomposer)\n`;
|
|
688
|
+
}
|
|
689
|
+
return `# ${faseInfo.nome} — Resumo de Implementação\n\n## Progresso\n- **Tasks:** ${progress.done}/${progress.total} (${progress.percentage}%)\n- **Arquivos criados:** ${manifest.arquivos_criados.length}\n\n${stackMd}\n${traceabilityMd}\n## Arquivos Criados\n${manifest.arquivos_criados.map(f => `- \`${f}\``).join('\n') || '(nenhum registrado)'}\n\n## Timestamp\n${manifest.timestamp}\n`;
|
|
690
|
+
}
|
|
691
|
+
function getExpertiseForPhase(faseNome) {
|
|
692
|
+
const fase = faseNome.toLowerCase();
|
|
693
|
+
if (fase.includes('frontend'))
|
|
694
|
+
return ['React', 'Next.js', 'TypeScript', 'componentes', 'responsividade', 'acessibilidade'];
|
|
695
|
+
if (fase.includes('backend'))
|
|
696
|
+
return ['Node.js', 'Express', 'REST API', 'banco de dados', 'autenticação', 'testes'];
|
|
697
|
+
if (fase.includes('integra'))
|
|
698
|
+
return ['E2E testing', 'CORS', 'CI/CD', 'Docker', 'monitoramento'];
|
|
699
|
+
if (fase.includes('deploy'))
|
|
700
|
+
return ['DevOps', 'CI/CD', 'AWS', 'Docker', 'monitoramento', 'deploy'];
|
|
701
|
+
return ['desenvolvimento', 'arquitetura', 'testes'];
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Delega para proximo.ts para validar gate e avançar fase.
|
|
705
|
+
* Gera um entregável textual resumido a partir do manifest.
|
|
706
|
+
*/
|
|
707
|
+
async function delegateToProximo(args) {
|
|
708
|
+
const { estado, diretorio } = args;
|
|
709
|
+
const codeState = estado.codePhaseState;
|
|
710
|
+
const manifest = codeState?.manifest;
|
|
711
|
+
// Gerar entregável textual a partir do manifest para o proximo.ts validar
|
|
712
|
+
const entregavelTexto = manifest
|
|
713
|
+
? generateSummaryMarkdown(manifest, { nome: codeState?.faseNome || '' }, getTaskProgress(estado.tasks || [], estado.fase_atual))
|
|
714
|
+
: 'Fase de código concluída. Manifest não gerado.';
|
|
715
|
+
// Importar proximo.ts e delegar
|
|
716
|
+
const { proximo } = await import("../tools/proximo.js");
|
|
717
|
+
return proximo({
|
|
718
|
+
diretorio,
|
|
719
|
+
estado_json: serializarEstado(estado).content,
|
|
720
|
+
entregavel: entregavelTexto,
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
//# sourceMappingURL=code-phase-handler.js.map
|