{"record":{"id":"2285a31008d68407","repo":"JuliusBrussee/caveman","slug":"usage-invokedcommand-audit-eval-import-evi","errorCode":null,"errorMessage":"usage: ${invokedCommand(\"audit\")} eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]","messagePattern":"usage: (.+?) eval-import <evidence\\.jsonl> \\[--project <uuid>\\] \\[--dry-run\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":17599,"sourceCode":"    \"content-type\": \"application/octet-stream\",\n    \"x-cave-csrf\": \"cli\"\n  };\n  const fieldMap = flagFrom(argv, \"--field-map\", \"\");\n  if (fieldMap) headers[\"x-cave-field-map\"] = fieldMap;\n  const response = await fetch(`${cfg.baseURL}/api/v1/imports?format=${encodeURIComponent(format)}`, {\n    method: \"POST\",\n    headers,\n    body: data\n  });\n  print(await response.json());\n}\n\n// auditEvalImport turns newline-delimited, source-neutral eval records into one\n// bounded batch. Server stamps tenant scope, observed basis, and external-only\n// authority; CI cannot promote its own results into rollout authority.\nasync function auditEvalImport(argv: string[]) {\n  const file = positionalAfterOptions(argv.slice(1), new Set([\"--project\"]));\n  if (!file) throw new Error(`usage: ${invokedCommand(\"audit\")} eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]`);\n  const data = await readFile(file);\n  if (data.byteLength > 4 * 1024 * 1024) throw new Error(\"eval evidence file exceeds 4 MiB batch limit\");\n\n  const items: Record<string, unknown>[] = [];\n  for (const [index, rawLine] of data.toString(\"utf8\").split(/\\r?\\n/).entries()) {\n    const line = rawLine.trim();\n    if (!line) continue;\n    let parsed: unknown;\n    try {\n      parsed = JSON.parse(line);\n    } catch {\n      throw new Error(`eval evidence line ${index + 1} is not valid JSON`);\n    }\n    if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n      throw new Error(`eval evidence line ${index + 1} must be a JSON object`);\n    }\n    items.push(parsed as Record<string, unknown>);\n    if (items.length > 1000) throw new Error(\"eval evidence batch exceeds 1000 records\");","sourceCodeStart":17581,"sourceCodeEnd":17617,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L17581-L17617","documentation":"`auditEvalImport` imports newline-delimited eval evidence and, like audit import, requires the evidence file as a positional argument. When `positionalAfterOptions` finds no file argument, the CLI throws this usage error showing the accepted syntax.","triggerScenarios":"Running `caveman audit eval-import` with only options (e.g. `--project <uuid> --dry-run`) and no evidence file path, or with the file placed before options so the parser misses it.","commonSituations":"Omitting the .jsonl path in CI pipeline configuration; assuming --project is the first argument; typo in the file path causing the parser to treat it as an unknown option.","solutions":["Supply the evidence file as a positional argument: `caveman audit eval-import ./evidence.jsonl --project <uuid>`.","Keep the file path as the first argument, before any --project or --dry-run flags.","Quote paths containing spaces and verify the file exists with `ls`."],"exampleFix":"// before (shell)\ncaveman audit eval-import --project 1234-abcd --dry-run\n// error: usage: caveman audit eval-import <evidence.jsonl> ...\n// after (shell)\ncaveman audit eval-import ./evidence.jsonl --project 1234-abcd --dry-run","handlingStrategy":"validation","validationCode":"// shell\nfile_arg=$(echo \"$args\" | awk '{print $1}')\n[ -f \"$file_arg\" ] || { echo \"usage: caveman audit eval-import <evidence.jsonl> [--project <uuid>] [--dry-run]\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place the evidence file first, before --project/--dry-run flags.","Verify the file exists with `ls`/`test -f` before invoking.","Use --dry-run to validate argument wiring cheaply."],"tags":["cli","usage","audit","eval","missing-argument"],"backgroundTag":"missing-cli-argument","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}