@codexa/cli 8.6.13 → 8.6.14

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.
@@ -3,6 +3,7 @@ import { initSchema } from "../db/schema";
3
3
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
4
4
  import { join } from "path";
5
5
  import { spawnSync } from "child_process";
6
+ import pkg from "../package.json";
6
7
  import {
7
8
  detectUniversal,
8
9
  detectStackLegacy,
@@ -182,9 +183,9 @@ export function discoverConfirm(): void {
182
183
  // Mover de pending para default
183
184
  db.run("DELETE FROM project WHERE id = 'pending'");
184
185
  db.run(
185
- `INSERT INTO project (id, name, stack, discovered_at, updated_at)
186
- VALUES ('default', ?, ?, ?, ?)`,
187
- ["Projeto", JSON.stringify(data.stack), now, now]
186
+ `INSERT INTO project (id, name, stack, discovered_at, updated_at, cli_version)
187
+ VALUES ('default', ?, ?, ?, ?, ?)`,
188
+ ["Projeto", JSON.stringify(data.stack), now, now, pkg.version]
188
189
  );
189
190
 
190
191
  // Criar standards baseados na estrutura detectada
@@ -997,9 +998,9 @@ export function discoverExportPatterns(): void {
997
998
  export function ensureDeepExploreAgent(): void {
998
999
  const agentPath = join(process.cwd(), ".claude", "agents", "deep-explore.md");
999
1000
 
1000
- // Check grepai availability
1001
- const grepaiCheck = spawnSync("grepai", ["--version"], { encoding: "utf-8" });
1002
- if (grepaiCheck.error || grepaiCheck.status !== 0) {
1001
+ // Check grepai availability (grepai uses "help" not "--version")
1002
+ const grepaiCheck = spawnSync("grepai", ["help"], { encoding: "utf-8", timeout: 5000 });
1003
+ if (grepaiCheck.error) {
1003
1004
  console.warn("\n⚠ grepai nao encontrado no PATH.");
1004
1005
  console.warn(" O agente deep-explore depende de grepai para busca semantica.");
1005
1006
  console.warn(" Instale com: go install github.com/your-org/grepai@latest");
@@ -1044,6 +1045,8 @@ You are a semantic code exploration agent. Your primary tool is \\\`grepai\\\`
1044
1045
 
1045
1046
  ### Step 1: ALWAYS run grepai search FIRST
1046
1047
 
1048
+ **IMPORTANT: Execute ONE grepai search per Bash call. Do NOT run multiple grepai commands in parallel — this causes "Sibling tool call errored". Run them SEQUENTIALLY, one at a time.**
1049
+
1047
1050
  \\\`\\\`\\\`bash
1048
1051
  grepai search "your query here" --json --compact
1049
1052
  \\\`\\\`\\\`
@@ -1051,14 +1054,20 @@ grepai search "your query here" --json --compact
1051
1054
  - Queries MUST be in English
1052
1055
  - Use \\\`--compact\\\` to save tokens
1053
1056
  - Use natural language: "authentication flow", "error handling middleware", "how payments are processed"
1057
+ - Run ONE command, wait for result, then run the next
1054
1058
 
1055
- Examples:
1059
+ Examples (run each one SEPARATELY):
1056
1060
 
1057
1061
  \\\`\\\`\\\`bash
1058
1062
  grepai search "authentication flow" --json --compact
1063
+ \\\`\\\`\\\`
1064
+
1065
+ \\\`\\\`\\\`bash
1059
1066
  grepai search "error handling middleware" --json --compact
1067
+ \\\`\\\`\\\`
1068
+
1069
+ \\\`\\\`\\\`bash
1060
1070
  grepai search "database connection management" --json --compact
1061
- grepai search "state management pattern" --json --compact
1062
1071
  \\\`\\\`\\\`
1063
1072
 
1064
1073
  ### Step 2: Use grepai trace for relationships
@@ -76,8 +76,8 @@ const PATTERN_QUERIES: PatternQuery[] = [
76
76
 
77
77
  function isGrepaiAvailable(): boolean {
78
78
  try {
79
- const result = spawnSync("grepai", ["--version"], { encoding: "utf-8" });
80
- return result.status === 0;
79
+ const result = spawnSync("grepai", ["help"], { encoding: "utf-8", timeout: 5000 });
80
+ return !result.error;
81
81
  } catch {
82
82
  return false;
83
83
  }
package/db/schema.ts CHANGED
@@ -383,6 +383,13 @@ export function initSchema(): void {
383
383
  } catch {
384
384
  // Coluna ja existe - ignorar
385
385
  }
386
+
387
+ // v8.7: Migracao - adicionar cli_version na tabela project
388
+ try {
389
+ db.exec(`ALTER TABLE project ADD COLUMN cli_version TEXT`);
390
+ } catch {
391
+ // Coluna ja existe - ignorar
392
+ }
386
393
  }
387
394
 
388
395
  export function getPatternsByScope(scope: string): any[] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexa/cli",
3
- "version": "8.6.13",
3
+ "version": "8.6.14",
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
@@ -38,23 +38,60 @@ import {
38
38
  architectCancel,
39
39
  } from "./commands/architect";
40
40
  import { initSchema } from "./db/schema";
41
+ import { getDb } from "./db/connection";
41
42
  import { execSync } from "child_process";
42
43
  import { existsSync, readFileSync } from "fs";
43
44
  import { join } from "path";
44
45
  import pkg from "./package.json";
45
46
 
46
47
  function checkVersionSync(): void {
48
+ // 1. Check CLI vs Plugin (dev repo only)
47
49
  try {
48
50
  const gitRoot = execSync("git rev-parse --show-toplevel", { encoding: "utf-8" }).trim();
49
51
  const pluginJson = join(gitRoot, "plugins", "codexa-workflow", ".claude-plugin", "plugin.json");
50
- if (!existsSync(pluginJson)) return;
51
- const plugin = JSON.parse(readFileSync(pluginJson, "utf-8"));
52
- if (plugin.version && plugin.version !== pkg.version) {
53
- console.warn(`\nVersao desatualizada: CLI=${pkg.version} Plugin=${plugin.version}`);
54
- console.warn(` Atualize o CLI: bun add -g @codexa/cli\n`);
52
+ if (existsSync(pluginJson)) {
53
+ const plugin = JSON.parse(readFileSync(pluginJson, "utf-8"));
54
+ if (plugin.version && plugin.version !== pkg.version) {
55
+ console.error(`\nVersao incompativel: CLI=${pkg.version} Plugin=${plugin.version}`);
56
+ console.error(` O CLI e o plugin DEVEM ter a mesma versao.`);
57
+ console.error(` Atualize o CLI: bun add -g @codexa/cli@${plugin.version}\n`);
58
+ process.exit(1);
59
+ }
55
60
  }
56
61
  } catch {
57
- // Not in a git repo or plugin not found — skip silently
62
+ // Not in dev repo — skip
63
+ }
64
+
65
+ // 2. Check CLI vs project's stored version (client projects)
66
+ try {
67
+ const dbPath = join(process.cwd(), ".codexa", "db", "workflow.db");
68
+ if (!existsSync(dbPath)) return;
69
+
70
+ initSchema();
71
+ const db = getDb();
72
+ const project = db.query("SELECT cli_version FROM project WHERE id = 'default'").get() as any;
73
+ if (!project) return;
74
+
75
+ if (!project.cli_version) {
76
+ // Projeto existente sem versao gravada (pre-v8.7) — registrar versao atual
77
+ db.run(
78
+ `UPDATE project SET cli_version = ? WHERE id = 'default'`,
79
+ [pkg.version]
80
+ );
81
+ console.log(`✓ Versao do CLI (${pkg.version}) registrada no projeto.`);
82
+ return;
83
+ }
84
+
85
+ if (project.cli_version !== pkg.version) {
86
+ console.error(`\n✘ Versao incompativel: CLI=${pkg.version} Projeto=${project.cli_version}`);
87
+ console.error(` O projeto foi configurado com CLI v${project.cli_version} mas voce esta usando v${pkg.version}.`);
88
+ console.error(` Opcoes:`);
89
+ console.error(` 1. Atualize o CLI: bun add -g @codexa/cli@${project.cli_version}`);
90
+ console.error(` 2. Reconfigure o projeto: codexa discover reset && codexa discover start\n`);
91
+ process.exit(1);
92
+ }
93
+ } catch {
94
+ // DB not available or column doesn't exist yet — skip
58
95
  }
59
96
  }
60
97