@codexa/cli 9.0.16 → 9.0.18

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.
@@ -644,6 +644,29 @@ export function architectSave(options: { file?: string; json?: boolean }): void
644
644
  const content = readFileSync(filePath, "utf-8");
645
645
  const parsed = parseAnalysisMd(content);
646
646
 
647
+ // v10.0: Validar secoes criticas antes de salvar
648
+ if (!parsed.babySteps || parsed.babySteps.length === 0) {
649
+ const msg = "Secao 'Baby Steps' esta vazia ou nao foi encontrada no .md. "
650
+ + "Verifique se os headers seguem o formato '## Baby Steps' e cada step usa '### N. Nome'.";
651
+ if (options.json) {
652
+ console.log(JSON.stringify({ error: "EMPTY_BABY_STEPS", message: msg }));
653
+ } else {
654
+ console.error(`\n[ERRO] ${msg}\n`);
655
+ }
656
+ throw new CodexaError(msg);
657
+ }
658
+
659
+ if (!parsed.approach) {
660
+ const msg = "Secao 'Solucao Proposta' esta vazia ou nao foi encontrada no .md. "
661
+ + "Verifique se o header segue o formato '## Solucao Proposta'.";
662
+ if (options.json) {
663
+ console.log(JSON.stringify({ error: "EMPTY_APPROACH", message: msg }));
664
+ } else {
665
+ console.error(`\n[ERRO] ${msg}\n`);
666
+ }
667
+ throw new CodexaError(msg);
668
+ }
669
+
647
670
  // Popular DB com dados extraidos do .md
648
671
  const updates: string[] = [];
649
672
  const values: any[] = [];
package/commands/plan.ts CHANGED
@@ -185,8 +185,23 @@ export function planStart(description: string, options: { fromAnalysis?: string;
185
185
  }
186
186
  } else {
187
187
  // v8.4: Auto-deteccao por nome
188
+ // v10.0: Alertar se analise aprovada existe mas --from-analysis nao foi usado
188
189
  const match = getArchitecturalAnalysisForSpec(description);
189
- if (match) {
190
+ if (match && match.status === "approved") {
191
+ const msg = `Analise arquitetural aprovada encontrada: ${match.id} (${match.name}).\n`
192
+ + `Use: plan start "${description}" --from-analysis ${match.id}`;
193
+ if (options.json) {
194
+ console.log(JSON.stringify({
195
+ error: "APPROVED_ANALYSIS_EXISTS",
196
+ analysisId: match.id,
197
+ analysisName: match.name,
198
+ suggestion: `plan start "${description}" --from-analysis ${match.id}`,
199
+ }));
200
+ } else {
201
+ console.error(`\n[ERRO] ${msg}\n`);
202
+ }
203
+ throw new CodexaError(msg);
204
+ } else if (match) {
190
205
  analysis = match;
191
206
  if (!options.json) {
192
207
  console.log(`\n[INFO] Analise arquitetural encontrada: ${match.id} (${match.name})`);
@@ -275,6 +290,21 @@ export function planStart(description: string, options: { fromAnalysis?: string;
275
290
  console.error("[AVISO] Falha ao parsear baby steps da analise. Adicione tasks manualmente.\n");
276
291
  }
277
292
  }
293
+
294
+ // v10.0: Se --from-analysis foi explicito e importou 0 tasks, e um erro
295
+ if (options.fromAnalysis && tasksCreated === 0) {
296
+ const msg = `Analise ${analysis.id} nao contem baby steps validos. `
297
+ + `Verifique o .md com 'architect show --id ${analysis.id}' e corrija a secao Baby Steps.`;
298
+ if (options.json) {
299
+ console.log(JSON.stringify({ error: "ZERO_TASKS_IMPORTED", analysisId: analysis.id, message: msg }));
300
+ } else {
301
+ console.error(`\n[ERRO] ${msg}\n`);
302
+ }
303
+ // Cleanup: remover spec vazio criado
304
+ db.run("DELETE FROM context WHERE spec_id = ?", [specId]);
305
+ db.run("DELETE FROM specs WHERE id = ?", [specId]);
306
+ throw new CodexaError(msg);
307
+ }
278
308
  }
279
309
 
280
310
  // v9.9: Context pressure analysis
package/commands/task.ts CHANGED
@@ -146,7 +146,7 @@ function showStuckWarning(stuck: any[]): void {
146
146
  console.log(` Use: task done <id> --force --force-reason "timeout" para liberar\n`);
147
147
  }
148
148
 
149
- export function taskStart(ids: string, json: boolean = false, fullContext: boolean = false, specId?: string): void {
149
+ export function taskStart(ids: string, json: boolean = false, minimalContext: boolean = false, specId?: string): void {
150
150
  initSchema();
151
151
  enforceGate("task-start");
152
152
 
@@ -209,10 +209,10 @@ export function taskStart(ids: string, json: boolean = false, fullContext: boole
209
209
  if (json) {
210
210
  // NOVO: Incluir contexto COMPLETO para cada task
211
211
  const contexts = startedTasks.map((task) => {
212
- // v9.0: Usar contexto minimo por padrao, expandido via --full-context
213
- const contextText = fullContext
214
- ? getContextForSubagent(task.id)
215
- : getMinimalContextForSubagent(task.id);
212
+ // v10.0: Contexto completo por padrao, reduzido via --minimal-context
213
+ const contextText = minimalContext
214
+ ? getMinimalContextForSubagent(task.id)
215
+ : getContextForSubagent(task.id);
216
216
  const unreadKnowledge = getUnreadKnowledgeForTask(spec.id, task.id);
217
217
 
218
218
  // NOVO v7.4: Buscar implementation patterns relevantes
@@ -276,7 +276,7 @@ export function taskStart(ids: string, json: boolean = false, fullContext: boole
276
276
  _orchestratorWarning: "NAO execute esta task diretamente. Use Task tool com subagent_type='general-purpose' para delegar. O campo 'subagentContext' abaixo e o prompt para o SUBAGENT.",
277
277
  // Contexto para o subagent (NAO para o orquestrador)
278
278
  context: contextText,
279
- contextMode: fullContext ? "full" : "minimal",
279
+ contextMode: minimalContext ? "minimal" : "full",
280
280
  // Knowledge nao lido (broadcast de outras tasks)
281
281
  unreadKnowledge: unreadKnowledge.map((k: any) => ({
282
282
  id: k.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexa/cli",
3
- "version": "9.0.16",
3
+ "version": "9.0.18",
4
4
  "description": "Orchestrated workflow system for Claude Code - manages feature development through parallel subagents with structured phases, gates, and quality enforcement.",
5
5
  "type": "module",
6
6
  "bin": {
package/workflow.ts CHANGED
@@ -253,10 +253,10 @@ taskCmd
253
253
  .command("start <ids>")
254
254
  .description("Inicia task(s) - pode ser multiplas separadas por virgula")
255
255
  .option("--json", "Saida em JSON")
256
- .option("--full-context", "Incluir contexto completo (modo legado)")
256
+ .option("--minimal-context", "Usar contexto reduzido (2KB) em vez do completo (16KB)")
257
257
  .option("--spec <id>", "ID do spec (padrao: mais recente)")
258
258
  .action(wrapAction((ids: string, options) => {
259
- taskStart(ids, options.json, options.fullContext, options.spec);
259
+ taskStart(ids, options.json, options.minimalContext, options.spec);
260
260
  }));
261
261
 
262
262
  taskCmd