@reverso-agent/cli 0.2.6 → 0.3.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/README.md CHANGED
@@ -4,6 +4,8 @@ CLI do agente investigativo Reverso — OSINT com LLM. Processa documentos, gera
4
4
 
5
5
  ## Instalação
6
6
 
7
+ **Recomendado — instalação global** (evita conflitos com dependências do projeto):
8
+
7
9
  ```bash
8
10
  # npm
9
11
  npm install -g @reverso-agent/cli
@@ -12,6 +14,14 @@ npm install -g @reverso-agent/cli
12
14
  pnpm add -g @reverso-agent/cli
13
15
  ```
14
16
 
17
+ Para usar como dependência local do projeto, use `--ignore-scripts` (a dependência `yargs` pode falhar em scripts de build em alguns ambientes):
18
+
19
+ ```bash
20
+ npm i @reverso-agent/cli --ignore-scripts
21
+ # ou
22
+ pnpm add @reverso-agent/cli --ignore-scripts
23
+ ```
24
+
15
25
  Requisitos: Node.js >= 18.
16
26
 
17
27
  Verificar:
package/bin/reverso.js CHANGED
File without changes
package/dist/index.js CHANGED
@@ -4315,7 +4315,7 @@ async function detectFilesystemRoot(cwd) {
4315
4315
  }
4316
4316
  await ensureFilesystemDirs(cwd);
4317
4317
  console.log(
4318
- `Nenhuma estrutura de investiga\xE7\xE3o encontrada em ${cwd}. Estrutura inicial criada. Adicione PDFs em ${path.join(cwd, "source")}.`
4318
+ `No investigation structure found in ${cwd}. Initial structure created. Add PDFs to ${path.join(cwd, "source")}.`
4319
4319
  );
4320
4320
  return {
4321
4321
  filesystemRoot: cwd,
@@ -4472,7 +4472,7 @@ async function resolveRuntimeConfig(opts) {
4472
4472
  const apiKey = process.env.OPENROUTER_API_KEY;
4473
4473
  if (!apiKey) {
4474
4474
  throw new Error(
4475
- "OPENROUTER_API_KEY nao encontrado. Configure no shell, ~/.reverso/.env, ./.env ou ./.env.local."
4475
+ "OPENROUTER_API_KEY not found. Set it in your shell, ~/.reverso/.env, ./.env or ./.env.local."
4476
4476
  );
4477
4477
  }
4478
4478
  const model = opts?.model ?? process.env.AGENT_LAB_MODEL ?? "google/gemini-2.5-flash";
@@ -4972,7 +4972,7 @@ var OpenRouterClient = class {
4972
4972
  const rawBody = await response.text();
4973
4973
  const json = rawBody ? JSON.parse(rawBody) : {};
4974
4974
  const message = json?.error?.message ?? `HTTP ${response.status}`;
4975
- throw new Error(`Falha OpenRouter: ${message}`);
4975
+ throw new Error(`OpenRouter request failed: ${message}`);
4976
4976
  }
4977
4977
  const reader = response.body?.getReader();
4978
4978
  if (!reader) throw new Error("Response body is not readable");
@@ -5017,7 +5017,7 @@ var OpenRouterClient = class {
5017
5017
  clearTimeout(timeout);
5018
5018
  return stripCodeFence(fullContent.trim());
5019
5019
  } catch (error2) {
5020
- lastError = error2 instanceof Error ? error2.name === "AbortError" ? new Error("Timeout ao chamar OpenRouter.") : error2 : new Error(String(error2));
5020
+ lastError = error2 instanceof Error ? error2.name === "AbortError" ? new Error("OpenRouter request timed out.") : error2 : new Error(String(error2));
5021
5021
  if (attempt < 3) {
5022
5022
  await sleep(700 * attempt);
5023
5023
  }
@@ -5025,7 +5025,7 @@ var OpenRouterClient = class {
5025
5025
  clearTimeout(timeout);
5026
5026
  }
5027
5027
  }
5028
- throw lastError ?? new Error("Falha desconhecida no OpenRouter.");
5028
+ throw lastError ?? new Error("Unknown OpenRouter failure.");
5029
5029
  }
5030
5030
  async chatJson(request, fallback) {
5031
5031
  const content = await this.chatText(request);
@@ -5161,26 +5161,26 @@ var CliUiFeedback = class {
5161
5161
  ...errorCode ? { errorCode } : {}
5162
5162
  });
5163
5163
  }
5164
- fileCreated(path37, addedLines, preview) {
5164
+ fileCreated(path39, addedLines, preview) {
5165
5165
  this.bus.emit({
5166
5166
  type: "file_change",
5167
- path: path37,
5167
+ path: path39,
5168
5168
  changeType: "new",
5169
5169
  ...addedLines !== void 0 ? { addedLines } : {},
5170
5170
  ...preview ? { preview } : {}
5171
5171
  });
5172
5172
  }
5173
- fileEdited(path37, addedLines, removedLines) {
5173
+ fileEdited(path39, addedLines, removedLines) {
5174
5174
  this.bus.emit({
5175
5175
  type: "file_change",
5176
- path: path37,
5176
+ path: path39,
5177
5177
  changeType: "edited",
5178
5178
  ...addedLines !== void 0 ? { addedLines } : {},
5179
5179
  ...removedLines !== void 0 ? { removedLines } : {}
5180
5180
  });
5181
5181
  }
5182
- fileDeleted(path37) {
5183
- this.bus.emit({ type: "file_change", path: path37, changeType: "deleted" });
5182
+ fileDeleted(path39) {
5183
+ this.bus.emit({ type: "file_change", path: path39, changeType: "deleted" });
5184
5184
  }
5185
5185
  requestApproval(_requestId, title, description) {
5186
5186
  this.bus.emit({
@@ -5567,19 +5567,19 @@ ${p.content}`
5567
5567
  // src/commands/init.ts
5568
5568
  var initCommand = {
5569
5569
  command: "init",
5570
- describe: "Gera entendimento inicial da investigacao",
5570
+ describe: "Generate initial understanding of the investigation",
5571
5571
  builder: (yargs2) => yargs2.option("max-tokens", {
5572
5572
  type: "number",
5573
- describe: "Limite de tokens a consumir"
5573
+ describe: "Token consumption limit"
5574
5574
  }).option("model", {
5575
5575
  type: "string",
5576
- describe: "Modelo LLM"
5576
+ describe: "LLM model"
5577
5577
  }).option("response-language", {
5578
5578
  type: "string",
5579
- describe: "Idioma de resposta (auto|en|pt|es|fr|de|it)"
5579
+ describe: "Response language (auto|en|pt|es|fr|de|it)"
5580
5580
  }).option("artifact-language", {
5581
5581
  type: "string",
5582
- describe: "Idioma dos artefatos (source|en|pt|es|fr|de|it)"
5582
+ describe: "Artifact language (source|en|pt|es|fr|de|it)"
5583
5583
  }),
5584
5584
  handler: async (argv) => {
5585
5585
  await runInit({
@@ -7200,19 +7200,19 @@ async function requestStrictDigPayload(input) {
7200
7200
  var digCommand = {
7201
7201
  command: "dig",
7202
7202
  aliases: ["deep-dive"],
7203
- describe: "Executa deep-dive nas fontes",
7204
- builder: (yargs2) => yargs2.option("model", { type: "string", describe: "Modelo LLM" }).option("response-language", {
7203
+ describe: "Run deep-dive on sources",
7204
+ builder: (yargs2) => yargs2.option("model", { type: "string", describe: "LLM model" }).option("response-language", {
7205
7205
  type: "string",
7206
- describe: "Idioma de resposta (auto|en|pt|es|fr|de|it)"
7206
+ describe: "Response language (auto|en|pt|es|fr|de|it)"
7207
7207
  }).option("pev", {
7208
7208
  type: "boolean",
7209
- describe: "Ativa fluxo plan -> execute -> verify"
7209
+ describe: "Enable plan -> execute -> verify flow"
7210
7210
  }).option("self-repair", {
7211
7211
  type: "boolean",
7212
- describe: "Ativa auto-reparo de contratos JSON"
7212
+ describe: "Enable JSON contract auto-repair"
7213
7213
  }).option("self-repair-max-rounds", {
7214
7214
  type: "number",
7215
- describe: "Maximo de rodadas de auto-reparo"
7215
+ describe: "Maximum auto-repair rounds"
7216
7216
  }),
7217
7217
  handler: async (argv) => {
7218
7218
  await runDig({
@@ -7579,19 +7579,19 @@ ${lines.join("\n")}${suffix}`;
7579
7579
  // src/commands/create-lead.ts
7580
7580
  var createLeadCommand = {
7581
7581
  command: "create-lead",
7582
- describe: "Cria lead de investigacao com inquiry plan",
7583
- builder: (yargs2) => yargs2.option("idea", { type: "string", describe: "Ideia inicial para o lead" }).option("model", { type: "string", describe: "Modelo LLM" }).option("response-language", {
7582
+ describe: "Create investigation lead with inquiry plan",
7583
+ builder: (yargs2) => yargs2.option("idea", { type: "string", describe: "Initial idea for the lead" }).option("model", { type: "string", describe: "LLM model" }).option("response-language", {
7584
7584
  type: "string",
7585
- describe: "Idioma de resposta (auto|en|pt|es|fr|de|it)"
7585
+ describe: "Response language (auto|en|pt|es|fr|de|it)"
7586
7586
  }).option("pev", {
7587
7587
  type: "boolean",
7588
- describe: "Ativa fluxo plan -> execute -> verify"
7588
+ describe: "Enable plan -> execute -> verify flow"
7589
7589
  }).option("self-repair", {
7590
7590
  type: "boolean",
7591
- describe: "Ativa auto-reparo de contratos JSON"
7591
+ describe: "Enable JSON contract auto-repair"
7592
7592
  }).option("self-repair-max-rounds", {
7593
7593
  type: "number",
7594
- describe: "Maximo de rodadas de auto-reparo"
7594
+ describe: "Maximum auto-repair rounds"
7595
7595
  }),
7596
7596
  handler: async (argv) => {
7597
7597
  await runCreateLead({
@@ -19456,14 +19456,14 @@ var parameters = /* @__PURE__ */ new Map([
19456
19456
  ["Z", 0],
19457
19457
  ["z", 0]
19458
19458
  ]);
19459
- var parse = function(path37) {
19459
+ var parse = function(path39) {
19460
19460
  var cmd;
19461
19461
  var ret = [];
19462
19462
  var args = [];
19463
19463
  var curArg = "";
19464
19464
  var foundDecimal = false;
19465
19465
  var params = 0;
19466
- for (var _i = 0, path_1 = path37; _i < path_1.length; _i++) {
19466
+ for (var _i = 0, path_1 = path39; _i < path_1.length; _i++) {
19467
19467
  var c = path_1[_i];
19468
19468
  if (parameters.has(c)) {
19469
19469
  params = parameters.get(c);
@@ -19777,8 +19777,8 @@ var segmentToBezier = function(cx1, cy1, th0, th1, rx, ry, sinTh, cosTh) {
19777
19777
  ];
19778
19778
  return result;
19779
19779
  };
19780
- var svgPathToOperators = function(path37) {
19781
- return apply(parse(path37));
19780
+ var svgPathToOperators = function(path39) {
19781
+ return apply(parse(path39));
19782
19782
  };
19783
19783
 
19784
19784
  // ../../node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/es/api/operations.js
@@ -19935,7 +19935,7 @@ var drawEllipse = function(options) {
19935
19935
  popGraphicsState()
19936
19936
  ]).filter(Boolean);
19937
19937
  };
19938
- var drawSvgPath = function(path37, options) {
19938
+ var drawSvgPath = function(path39, options) {
19939
19939
  var _a, _b, _c;
19940
19940
  return __spreadArrays([
19941
19941
  pushGraphicsState(),
@@ -19949,7 +19949,7 @@ var drawSvgPath = function(path37, options) {
19949
19949
  options.borderWidth && setLineWidth(options.borderWidth),
19950
19950
  options.borderLineCap && setLineCap(options.borderLineCap),
19951
19951
  setDashPattern((_b = options.borderDashArray) !== null && _b !== void 0 ? _b : [], (_c = options.borderDashPhase) !== null && _c !== void 0 ? _c : 0)
19952
- ], svgPathToOperators(path37), [
19952
+ ], svgPathToOperators(path39), [
19953
19953
  // prettier-ignore
19954
19954
  options.color && options.borderWidth ? fillAndStroke() : options.color ? fill() : options.borderColor ? stroke() : closePath(),
19955
19955
  popGraphicsState()
@@ -23931,12 +23931,12 @@ var PDFPage = (
23931
23931
  graphicsState: graphicsStateKey
23932
23932
  }));
23933
23933
  };
23934
- PDFPage2.prototype.drawSvgPath = function(path37, options) {
23934
+ PDFPage2.prototype.drawSvgPath = function(path39, options) {
23935
23935
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
23936
23936
  if (options === void 0) {
23937
23937
  options = {};
23938
23938
  }
23939
- assertIs(path37, "path", ["string"]);
23939
+ assertIs(path39, "path", ["string"]);
23940
23940
  assertOrUndefined(options.x, "options.x", ["number"]);
23941
23941
  assertOrUndefined(options.y, "options.y", ["number"]);
23942
23942
  assertOrUndefined(options.scale, "options.scale", ["number"]);
@@ -23965,7 +23965,7 @@ var PDFPage = (
23965
23965
  options.borderColor = rgb(0, 0, 0);
23966
23966
  }
23967
23967
  var contentStream = this.getContentStream();
23968
- contentStream.push.apply(contentStream, drawSvgPath(path37, {
23968
+ contentStream.push.apply(contentStream, drawSvgPath(path39, {
23969
23969
  x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
23970
23970
  y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
23971
23971
  scale: options.scale,
@@ -24478,9 +24478,9 @@ ${chunk}
24478
24478
 
24479
24479
  // src/tools/document-processing/checkpoint.ts
24480
24480
  import { readFile as readFile11, writeFile as writeFile6 } from "fs/promises";
24481
- async function loadCheckpoint(path37) {
24481
+ async function loadCheckpoint(path39) {
24482
24482
  try {
24483
- const raw = await readFile11(path37, "utf8");
24483
+ const raw = await readFile11(path39, "utf8");
24484
24484
  const data = JSON.parse(raw);
24485
24485
  if (!data.pdfPath || !Array.isArray(data.chunks)) return null;
24486
24486
  return data;
@@ -24488,9 +24488,9 @@ async function loadCheckpoint(path37) {
24488
24488
  return null;
24489
24489
  }
24490
24490
  }
24491
- async function saveCheckpoint(path37, data) {
24491
+ async function saveCheckpoint(path39, data) {
24492
24492
  const next = { ...data, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
24493
- await writeFile6(path37, JSON.stringify(next, null, 2), "utf8");
24493
+ await writeFile6(path39, JSON.stringify(next, null, 2), "utf8");
24494
24494
  }
24495
24495
  function createInitialCheckpoint(pdfPath, totalPages, totalChunks, chunkPages, chunkRanges) {
24496
24496
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -26315,9 +26315,9 @@ function getSourceCheckpointPath(sourceDir) {
26315
26315
  return `${sourceDir.replace(/\/$/, "")}/${SOURCE_CHECKPOINT_FILENAME}`;
26316
26316
  }
26317
26317
  async function loadSourceCheckpoint(sourceDir) {
26318
- const path37 = getSourceCheckpointPath(sourceDir);
26318
+ const path39 = getSourceCheckpointPath(sourceDir);
26319
26319
  try {
26320
- const raw = await readFile20(path37, "utf8");
26320
+ const raw = await readFile20(path39, "utf8");
26321
26321
  const data = JSON.parse(raw);
26322
26322
  if (data.version == null || !Array.isArray(data.files)) return null;
26323
26323
  return data;
@@ -26326,12 +26326,12 @@ async function loadSourceCheckpoint(sourceDir) {
26326
26326
  }
26327
26327
  }
26328
26328
  async function saveSourceCheckpoint(sourceDir, data) {
26329
- const path37 = getSourceCheckpointPath(sourceDir);
26329
+ const path39 = getSourceCheckpointPath(sourceDir);
26330
26330
  const next = {
26331
26331
  ...data,
26332
26332
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
26333
26333
  };
26334
- await writeJsonAtomic(path37, next);
26334
+ await writeJsonAtomic(path39, next);
26335
26335
  }
26336
26336
  function createEmptySourceCheckpoint(sourceDir) {
26337
26337
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -27160,7 +27160,7 @@ function resolveApiKey(cwd) {
27160
27160
  const apiKey = process.env.OPENROUTER_API_KEY;
27161
27161
  if (!apiKey) {
27162
27162
  throw new Error(
27163
- "OPENROUTER_API_KEY n\xE3o encontrado. Configure no shell, ~/.reverso/.env, ./.env ou ./.env.local."
27163
+ "OPENROUTER_API_KEY not found. Set it in your shell, ~/.reverso/.env, ./.env or ./.env.local."
27164
27164
  );
27165
27165
  }
27166
27166
  return apiKey;
@@ -27207,7 +27207,7 @@ async function runCli(argv) {
27207
27207
  if (sub === "process-all" || sub === "process-queue") {
27208
27208
  printNextCommand({
27209
27209
  command: "reverso init",
27210
- description: "Atualizar contexto de investiga\xE7\xE3o ap\xF3s processar fontes."
27210
+ description: "Update investigation context after processing sources."
27211
27211
  });
27212
27212
  }
27213
27213
  return true;
@@ -27238,7 +27238,7 @@ async function runCli(argv) {
27238
27238
  });
27239
27239
  printNextCommand({
27240
27240
  command: "reverso init",
27241
- description: "Atualizar contexto de investiga\xE7\xE3o ap\xF3s o rerun dos documentos."
27241
+ description: "Update investigation context after document rerun."
27242
27242
  });
27243
27243
  return true;
27244
27244
  }
@@ -27250,10 +27250,10 @@ async function runCli(argv) {
27250
27250
  checkpoint = await upsertSourceFileEntries(sourceDir, entries);
27251
27251
  const pending = checkpoint.files.filter((f) => f.queuedAt != null && f.status !== "done");
27252
27252
  if (pending.length === 0) {
27253
- console.log("Nenhum documento na fila (queued e n\xE3o conclu\xEDdo).");
27253
+ console.log("No documents in queue (queued and not completed).");
27254
27254
  return true;
27255
27255
  }
27256
- console.log(`Fila: ${pending.length} documento(s) pendente(s)
27256
+ console.log(`Queue: ${pending.length} pending document(s)
27257
27257
  `);
27258
27258
  for (const f of pending) {
27259
27259
  const err = f.lastError ? ` \u2014 ${f.lastError}` : "";
@@ -27276,11 +27276,11 @@ async function runCli(argv) {
27276
27276
  docIdsToClear = checkpoint.files.filter((f) => f.queuedAt != null).map((f) => f.docId);
27277
27277
  }
27278
27278
  if (docIdsToClear.length === 0) {
27279
- console.log("Nenhum documento para remover da fila.");
27279
+ console.log("No documents to remove from queue.");
27280
27280
  return true;
27281
27281
  }
27282
27282
  await setSourceQueued(sourceDir, docIdsToClear, null);
27283
- console.log(`${docIdsToClear.length} documento(s) removido(s) da fila.`);
27283
+ console.log(`${docIdsToClear.length} document(s) removed from queue.`);
27284
27284
  return true;
27285
27285
  }
27286
27286
  if (sub === "watch") {
@@ -27290,7 +27290,7 @@ async function runCli(argv) {
27290
27290
  sourceDir,
27291
27291
  autoProcess,
27292
27292
  onCheckpointUpdated: () => {
27293
- console.log("Checkpoint atualizado.");
27293
+ console.log("Checkpoint updated.");
27294
27294
  }
27295
27295
  });
27296
27296
  let queueInterval = null;
@@ -27322,9 +27322,9 @@ async function runCli(argv) {
27322
27322
  });
27323
27323
  };
27324
27324
  queueInterval = setInterval(runProcessQueue, processQueueEverySec * 1e3);
27325
- console.log(`process-queue a cada ${processQueueEverySec}s`);
27325
+ console.log(`process-queue every ${processQueueEverySec}s`);
27326
27326
  }
27327
- console.log(`Monitorando ${sourceDir}. Ctrl+C para encerrar.`);
27327
+ console.log(`Watching ${sourceDir}. Press Ctrl+C to stop.`);
27328
27328
  process.on("SIGINT", () => {
27329
27329
  if (queueInterval) clearInterval(queueInterval);
27330
27330
  stop();
@@ -27349,11 +27349,11 @@ async function runCli(argv) {
27349
27349
  const existingDocIds = checkpoint.files.map((f) => f.docId);
27350
27350
  const toSet = docIds.filter((id) => existingDocIds.includes(id));
27351
27351
  if (toSet.length === 0) {
27352
- console.log("Nenhum arquivo do checkpoint corresponde \xE0 lista informada.");
27352
+ console.log("No checkpoint files match the provided list.");
27353
27353
  return true;
27354
27354
  }
27355
27355
  await setSourceSelected(sourceDir, toSet, value);
27356
- console.log(`Sele\xE7\xE3o atualizada: ${toSet.length} arquivo(s) -> ${value}`);
27356
+ console.log(`Selection updated: ${toSet.length} file(s) -> ${value}`);
27357
27357
  return true;
27358
27358
  }
27359
27359
  return false;
@@ -29863,111 +29863,111 @@ function addAdvancedOption(yargs2, showAdvanced, key, config) {
29863
29863
  describe: config.describe,
29864
29864
  ...config.choices ? { choices: config.choices } : {},
29865
29865
  hidden: !showAdvanced,
29866
- group: showAdvanced ? "Op\xE7\xF5es avan\xE7adas:" : void 0
29866
+ group: showAdvanced ? "Advanced options:" : void 0
29867
29867
  });
29868
29868
  }
29869
29869
  var inquiryCommand = {
29870
29870
  command: "inquiry",
29871
- describe: "Executa inquiry para um lead especifico",
29871
+ describe: "Run inquiry for a specific lead",
29872
29872
  builder: (yargs2) => {
29873
29873
  const showAdvanced = process.argv.includes("--advanced") || process.argv.includes("--expert");
29874
29874
  let configured = yargs2.option("lead", {
29875
29875
  type: "string",
29876
29876
  demandOption: true,
29877
- describe: "Slug do lead"
29878
- }).option("model", { type: "string", describe: "Modelo LLM" }).option("response-language", {
29877
+ describe: "Lead slug"
29878
+ }).option("model", { type: "string", describe: "LLM model" }).option("response-language", {
29879
29879
  type: "string",
29880
- describe: "Idioma de resposta (auto|en|pt|es|fr|de|it)"
29880
+ describe: "Response language (auto|en|pt|es|fr|de|it)"
29881
29881
  }).option("pev", {
29882
29882
  type: "boolean",
29883
- describe: "Ativa fluxo plan -> execute -> verify"
29884
- }).option("max-steps", { type: "number", describe: "Limite de passos do loop" }).option("max-tool-calls", { type: "number", describe: "Limite de tool calls do loop" }).option("max-elapsed-ms", { type: "number", describe: "Timeout total em ms" }).option("confidence-threshold", {
29883
+ describe: "Enable plan -> execute -> verify flow"
29884
+ }).option("max-steps", { type: "number", describe: "Loop step limit" }).option("max-tool-calls", { type: "number", describe: "Loop tool call limit" }).option("max-elapsed-ms", { type: "number", describe: "Total timeout in ms" }).option("confidence-threshold", {
29885
29885
  type: "number",
29886
- describe: "Threshold de confian\xE7a (0-1)"
29886
+ describe: "Confidence threshold (0-1)"
29887
29887
  }).option("self-repair", {
29888
29888
  type: "boolean",
29889
- describe: "Ativa auto-reparo de contratos JSON"
29889
+ describe: "Enable JSON contract auto-repair"
29890
29890
  }).option("self-repair-max-rounds", {
29891
29891
  type: "number",
29892
- describe: "Maximo de rodadas de auto-reparo"
29892
+ describe: "Maximum auto-repair rounds"
29893
29893
  });
29894
29894
  configured = addAdvancedOption(configured, showAdvanced, "evidence-gate", {
29895
29895
  type: "boolean",
29896
- describe: "Ativa gate de evid\xEAncia"
29896
+ describe: "Enable evidence gate"
29897
29897
  });
29898
29898
  configured = addAdvancedOption(configured, showAdvanced, "evidence-min-confidence", {
29899
29899
  type: "number",
29900
- describe: "Confian\xE7a m\xEDnima do gate de evid\xEAncia (0-1)"
29900
+ describe: "Minimum confidence for evidence gate (0-1)"
29901
29901
  });
29902
29902
  configured = addAdvancedOption(configured, showAdvanced, "enriched-tool-manifest", {
29903
29903
  type: "boolean",
29904
- describe: "Exp\xF5e manifesto de tools enriquecido no planning"
29904
+ describe: "Expose enriched tool manifest in planning"
29905
29905
  });
29906
29906
  configured = addAdvancedOption(configured, showAdvanced, "strict-planning-validation", {
29907
29907
  type: "boolean",
29908
- describe: "Falha se o plano n\xE3o atender valida\xE7\xE3o estrita"
29908
+ describe: "Fail if plan does not meet strict validation"
29909
29909
  });
29910
29910
  configured = addAdvancedOption(configured, showAdvanced, "prewrite-validation", {
29911
29911
  type: "boolean",
29912
- describe: "Executa valida\xE7\xE3o pr\xE9-persist\xEAncia"
29912
+ describe: "Run pre-persistence validation"
29913
29913
  });
29914
29914
  configured = addAdvancedOption(configured, showAdvanced, "prewrite-validation-strict", {
29915
29915
  type: "boolean",
29916
- describe: "Falha a execu\xE7\xE3o se a valida\xE7\xE3o pr\xE9-write reprovar"
29916
+ describe: "Fail execution if pre-write validation fails"
29917
29917
  });
29918
29918
  configured = addAdvancedOption(configured, showAdvanced, "critical-write-gate", {
29919
29919
  type: "boolean",
29920
- describe: "Ativa gate cr\xEDtico de escrita"
29920
+ describe: "Enable critical write gate"
29921
29921
  });
29922
29922
  configured = addAdvancedOption(configured, showAdvanced, "require-explicit-write-approval", {
29923
29923
  type: "boolean",
29924
- describe: "Exige aprova\xE7\xE3o expl\xEDcita para persist\xEAncia cr\xEDtica"
29924
+ describe: "Require explicit approval for critical writes"
29925
29925
  });
29926
29926
  configured = addAdvancedOption(configured, showAdvanced, "p1-compliance-hooks", {
29927
29927
  type: "boolean",
29928
- describe: "Ativa hooks de compliance P1"
29928
+ describe: "Enable P1 compliance hooks"
29929
29929
  });
29930
29930
  configured = addAdvancedOption(configured, showAdvanced, "p1-domain-subagents", {
29931
29931
  type: "boolean",
29932
- describe: "Ativa subagentes de dom\xEDnio P1"
29932
+ describe: "Enable P1 domain subagents"
29933
29933
  });
29934
29934
  configured = addAdvancedOption(configured, showAdvanced, "p1-checkpoint", {
29935
29935
  type: "boolean",
29936
- describe: "Ativa checkpoints de investiga\xE7\xE3o P1"
29936
+ describe: "Enable P1 investigation checkpoints"
29937
29937
  });
29938
29938
  configured = addAdvancedOption(configured, showAdvanced, "p1-checkpoint-restore", {
29939
29939
  type: "boolean",
29940
- describe: "Restaura checkpoint no in\xEDcio da inquiry"
29940
+ describe: "Restore checkpoint at inquiry start"
29941
29941
  });
29942
29942
  configured = addAdvancedOption(configured, showAdvanced, "editorial-governance", {
29943
29943
  type: "boolean",
29944
- describe: "Ativa governan\xE7a editorial de artefatos"
29944
+ describe: "Enable artifact editorial governance"
29945
29945
  });
29946
29946
  configured = addAdvancedOption(configured, showAdvanced, "editorial-governance-strict", {
29947
29947
  type: "boolean",
29948
- describe: "Falha em viola\xE7\xF5es de governan\xE7a editorial"
29948
+ describe: "Fail on editorial governance violations"
29949
29949
  });
29950
29950
  configured = addAdvancedOption(configured, showAdvanced, "p2-batch-concurrency", {
29951
29951
  type: "number",
29952
- describe: "Concorr\xEAncia de lotes da inquiry"
29952
+ describe: "Inquiry batch concurrency"
29953
29953
  });
29954
29954
  configured = addAdvancedOption(configured, showAdvanced, "p2-evidence-mode", {
29955
29955
  type: "string",
29956
29956
  choices: ["lexical", "semantic", "hybrid"],
29957
- describe: "Modo de verifica\xE7\xE3o de evid\xEAncia"
29957
+ describe: "Evidence verification mode"
29958
29958
  });
29959
29959
  configured = addAdvancedOption(configured, showAdvanced, "p2-observability", {
29960
29960
  type: "boolean",
29961
- describe: "Ativa observabilidade operacional P2"
29961
+ describe: "Enable P2 operational observability"
29962
29962
  });
29963
29963
  configured = addAdvancedOption(configured, showAdvanced, "p2-sensitive-data-policy", {
29964
29964
  type: "string",
29965
29965
  choices: ["off", "warn", "strict"],
29966
- describe: "Pol\xEDtica de dados sens\xEDveis"
29966
+ describe: "Sensitive data policy"
29967
29967
  });
29968
29968
  configured = addAdvancedOption(configured, showAdvanced, "p2-sensitive-data-strict", {
29969
29969
  type: "boolean",
29970
- describe: "Alias para p2-sensitive-data-policy=strict"
29970
+ describe: "Alias for p2-sensitive-data-policy=strict"
29971
29971
  });
29972
29972
  return configured;
29973
29973
  },
@@ -30091,11 +30091,11 @@ ${SECTION_ACTIVE}
30091
30091
  // src/commands/agent-setup.ts
30092
30092
  var agentSetupCommand = {
30093
30093
  command: "agent-setup",
30094
- describe: "Atualiza instrucoes do agent.md",
30094
+ describe: "Update agent.md instructions",
30095
30095
  builder: (yargs2) => yargs2.option("text", {
30096
30096
  type: "string",
30097
30097
  demandOption: true,
30098
- describe: "Texto da instrucao"
30098
+ describe: "Instruction text"
30099
30099
  }),
30100
30100
  handler: async (argv) => {
30101
30101
  await runAgentSetup({
@@ -30113,10 +30113,10 @@ async function runDocumentProcessing(argv) {
30113
30113
  // src/commands/doc-process.ts
30114
30114
  var docProcessCommand = {
30115
30115
  command: "doc-process [args..]",
30116
- describe: "Executa processamento de documentos (subcomandos)",
30117
- builder: (yargs2) => yargs2.usage("reverso doc-process <subcomando> [flags]").example("reverso doc-process process-all", "Processa todos os PDFs pendentes").example("reverso doc-process queue-status", "Mostra a fila atual").option("artifact-language", {
30116
+ describe: "Run document processing (subcommands)",
30117
+ builder: (yargs2) => yargs2.usage("reverso doc-process <subcommand> [flags]").example("reverso doc-process process-all", "Process all pending PDFs").example("reverso doc-process queue-status", "Show the current queue").option("artifact-language", {
30118
30118
  type: "string",
30119
- describe: "Idioma dos artefatos (source|en|pt|es|fr|de|it)"
30119
+ describe: "Artifact language (source|en|pt|es|fr|de|it)"
30120
30120
  }),
30121
30121
  handler: async (argv) => {
30122
30122
  const positional = Array.isArray(argv.args) ? argv.args : [];
@@ -30132,40 +30132,135 @@ var docProcessCommand = {
30132
30132
  }
30133
30133
  };
30134
30134
 
30135
+ // src/commands/setup.ts
30136
+ import readline from "readline";
30137
+ import fs2 from "fs";
30138
+ import path37 from "path";
30139
+ function prompt(question) {
30140
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
30141
+ return new Promise((resolve) => {
30142
+ rl.question(question, (answer) => {
30143
+ rl.close();
30144
+ resolve(answer.trim());
30145
+ });
30146
+ });
30147
+ }
30148
+ var setupCommand = {
30149
+ command: "setup",
30150
+ describe: "Configure OpenRouter API key",
30151
+ builder: (yargs2) => yargs2,
30152
+ handler: async () => {
30153
+ console.log("=== Reverso Setup ===\n");
30154
+ console.log("To get your OpenRouter API key, visit:");
30155
+ console.log(" https://openrouter.ai/settings/keys\n");
30156
+ const key = await prompt("Enter your OpenRouter API key: ");
30157
+ if (!key.startsWith("sk-or-")) {
30158
+ console.error('\nError: API key must start with "sk-or-". Please check your key and try again.');
30159
+ process.exitCode = 1;
30160
+ return;
30161
+ }
30162
+ const envPath = getGlobalEnvPath();
30163
+ const envDir = path37.dirname(envPath);
30164
+ fs2.mkdirSync(envDir, { recursive: true });
30165
+ let existing = "";
30166
+ if (fs2.existsSync(envPath)) {
30167
+ existing = fs2.readFileSync(envPath, "utf8");
30168
+ }
30169
+ const lines = existing.split("\n").filter((l) => !l.startsWith("OPENROUTER_API_KEY="));
30170
+ lines.push(`OPENROUTER_API_KEY=${key}`);
30171
+ const content = lines.filter(Boolean).join("\n") + "\n";
30172
+ fs2.writeFileSync(envPath, content, "utf8");
30173
+ console.log(`
30174
+ API key saved to ${envPath}`);
30175
+ }
30176
+ };
30177
+
30178
+ // src/commands/process.ts
30179
+ import fs3 from "fs";
30180
+ import path38 from "path";
30181
+ function hasPdfs(dir) {
30182
+ try {
30183
+ return fs3.readdirSync(dir).some((f) => f.toLowerCase().endsWith(".pdf"));
30184
+ } catch {
30185
+ return false;
30186
+ }
30187
+ }
30188
+ function detectSourceDir(cwd) {
30189
+ const filesystemSources = path38.join(cwd, "filesystem", "sources");
30190
+ if (fs3.existsSync(filesystemSources) && hasPdfs(filesystemSources)) {
30191
+ return filesystemSources;
30192
+ }
30193
+ if (hasPdfs(cwd)) {
30194
+ return cwd;
30195
+ }
30196
+ return void 0;
30197
+ }
30198
+ var processCommand = {
30199
+ command: "process",
30200
+ describe: "Process all PDFs (auto-detects source directory)",
30201
+ builder: (yargs2) => yargs2.option("mode", {
30202
+ type: "string",
30203
+ choices: ["standard", "deep"],
30204
+ default: "standard",
30205
+ describe: "Processing mode"
30206
+ }).option("artifact-language", {
30207
+ type: "string",
30208
+ describe: "Artifact language (source|en|pt|es|fr|de|it)"
30209
+ }).example("reverso process", "Auto-detect PDFs and process all").example("reverso process --mode deep", "Deep processing mode").example("reverso process --artifact-language pt", "Output artifacts in Portuguese"),
30210
+ handler: async (argv) => {
30211
+ const cwd = process.cwd();
30212
+ const detectedSource = detectSourceDir(cwd);
30213
+ const docProcessArgv = ["process-all"];
30214
+ if (detectedSource) {
30215
+ docProcessArgv.push("--source", detectedSource);
30216
+ }
30217
+ if (typeof argv.mode === "string" && argv.mode !== "standard") {
30218
+ docProcessArgv.push("--mode", argv.mode);
30219
+ }
30220
+ if (typeof argv["artifact-language"] === "string") {
30221
+ docProcessArgv.push("--artifact-language", argv["artifact-language"]);
30222
+ }
30223
+ if (typeof argv.feedback === "string") {
30224
+ docProcessArgv.push("--feedback", argv.feedback);
30225
+ }
30226
+ await runDocumentProcessing(docProcessArgv);
30227
+ }
30228
+ };
30229
+
30135
30230
  // src/index.ts
30136
30231
  async function main2() {
30137
- await yargs(hideBin(process.argv)).scriptName("reverso").usage("$0 <comando> [flags]").parserConfiguration({
30232
+ await yargs(hideBin(process.argv)).scriptName("reverso").usage("$0 <command> [flags]").parserConfiguration({
30138
30233
  "camel-case-expansion": false
30139
30234
  }).option("filesystem", {
30140
30235
  type: "string",
30141
- describe: "For\xE7ar caminho do filesystem root",
30236
+ describe: "Override filesystem root path",
30142
30237
  global: true
30143
30238
  }).option("feedback", {
30144
30239
  type: "string",
30145
30240
  choices: ["plain", "compact", "visual"],
30146
30241
  default: DEFAULT_FEEDBACK_MODE,
30147
- describe: "Modo de feedback no terminal",
30242
+ describe: "Terminal feedback mode",
30148
30243
  global: true
30149
30244
  }).option("advanced", {
30150
30245
  type: "boolean",
30151
30246
  default: false,
30152
- describe: "Mostra flags avan\xE7adas no help",
30247
+ describe: "Show advanced flags in help",
30153
30248
  global: true
30154
30249
  }).option("expert", {
30155
30250
  type: "boolean",
30156
30251
  default: false,
30157
30252
  hidden: true,
30158
- describe: "Alias interno para flags avan\xE7adas",
30253
+ describe: "Internal alias for advanced flags",
30159
30254
  global: true
30160
30255
  }).middleware((argv) => {
30161
30256
  if (typeof argv.filesystem === "string" && argv.filesystem.length > 0) {
30162
30257
  process.env.REVERSO_FILESYSTEM = argv.filesystem;
30163
30258
  }
30164
- }).command(initCommand).command(agentSetupCommand).command(digCommand).command(createLeadCommand).command(inquiryCommand).command(docProcessCommand).demandCommand(1, "Especifique um comando. Use --help para ver os dispon\xEDveis.").strictCommands().recommendCommands().help().alias("h", "help").parseAsync();
30259
+ }).command(setupCommand).command(processCommand).command(initCommand).command(agentSetupCommand).command(digCommand).command(createLeadCommand).command(inquiryCommand).command(docProcessCommand).demandCommand(1, "Specify a command. Use --help to see available commands.").strictCommands().recommendCommands().help().alias("h", "help").parseAsync();
30165
30260
  }
30166
30261
  main2().catch((error2) => {
30167
30262
  const message = error2 instanceof Error ? error2.message : String(error2);
30168
- console.error(`Erro no Agent CLI: ${message}`);
30263
+ console.error(`Agent CLI error: ${message}`);
30169
30264
  process.exitCode = 1;
30170
30265
  });
30171
30266
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reverso-agent/cli",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "CLI do agente investigativo Reverso — OSINT com LLM",
5
5
  "type": "module",
6
6
  "bin": {