{"record":{"id":"5fc30a1232b4514a","repo":"JuliusBrussee/caveman","slug":"usage-npm-create-caveman-ai-agent-latest-projec","errorCode":null,"errorMessage":"usage: npm create @caveman-ai/agent@latest <project> [--provider anthropic|openai|google] [--no-install]","messagePattern":"usage: npm create @caveman-ai/agent@latest <project> \\[--provider anthropic\\|openai\\|google\\] \\[--no-install\\]","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-caveman-agent/src/index.ts","lineNumber":79,"sourceCode":"  let install = true;\n  const positional: string[] = [];\n  for (let index = 0; index < args.length; index++) {\n    const value = args[index]!;\n    if (value === \"--provider\") {\n      const candidate = args[++index];\n      if (!candidate || candidate.startsWith(\"--\")) throw new Error(\"--provider requires a value\");\n      provider = candidate;\n      continue;\n    }\n    if (value === \"--no-install\") {\n      install = false;\n      continue;\n    }\n    if (value.startsWith(\"--\")) throw new Error(`unknown option ${value}`);\n    positional.push(value);\n  }\n  if (positional.length !== 1) {\n    throw new Error(\n      USAGE,\n    );\n  }\n  return {\n    target: positional[0]!,\n    ...(provider === undefined ? {} : { provider }),\n    install,\n  };\n}\n\nasync function installDependencies(directory: string): Promise<void> {\n  const npmExecPath = process.env.npm_execpath;\n  const windowsShell = !npmExecPath && process.platform === \"win32\";\n  const command = npmExecPath\n    ? process.execPath\n    : windowsShell\n      ? process.env.ComSpec ?? \"cmd.exe\"\n      : \"npm\";","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/create-caveman-agent/src/index.ts#L61-L97","documentation":"After flag parsing, exactly one positional argument (the target project name/directory) is required. Zero positionals or more than one cause parseArgs to throw the full usage string so the developer sees the correct command shape.","triggerScenarios":"Running the create command with no project name (`npm create @caveman-ai/agent@latest -- --provider openai`), or with two or more positional names, or a quoted path that the shell splits into multiple tokens.","commonSituations":"Forgetting the project argument entirely; paths with unquoted spaces (`my app` becomes two positionals — quote it); passing a description sentence as extra words.","solutions":["Supply exactly one project name: `npm create @caveman-ai/agent@latest my-app`","Quote paths containing spaces: `\"my app\"`","Remove extra positional words; flags like --provider already carry their own values"],"exampleFix":"// before\nnpm create @caveman-ai/agent@latest\n// after\nnpm create @caveman-ai/agent@latest my-app -- --provider anthropic","handlingStrategy":"validation","validationCode":"const positional = argv.filter(a => !a.startsWith(\"--\"));\nif (positional.length !== 1) throw new Error(USAGE);","typeGuard":"function hasSinglePositional(argv: string[]): boolean {\n  return argv.filter(a => !a.startsWith(\"--\")).length === 1;\n}","tryCatchPattern":"try {\n  const opts = parseArgs(argv);\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith(\"usage:\")) {\n    console.error(error.message);\n    process.exitCode = 1;\n  } else throw error;\n}","preventionTips":["Always pass exactly one project name positional","Quote project paths containing spaces","Remember flags consume their own values and don't count as positionals"],"tags":["cli","argument-parsing"],"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"}