{"record":{"id":"0aa4f939676e95fa","repo":"can1357/oh-my-pi","slug":"usage-omp-auth-broker-import-file-dir-provid","errorCode":null,"errorMessage":"Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]","messagePattern":"Usage: omp auth-broker import <file\\|dir> \\[--provider=<id>\\] \\[--include-disabled\\] \\[--dry-run\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/auth-broker-cli.ts","lineNumber":603,"sourceCode":"\t\t\texpiresAt,\n\t\t\tdisabled: json.disabled === true,\n\t\t\tcredential,\n\t\t});\n\t}\n\treturn { entries, skipped };\n}\n\nfunction describeImportEntry(entry: ImportPlanEntry): string {\n\tconst ident = entry.email ?? entry.accountId ?? \"(no identity)\";\n\tconst stale = entry.expiresAt < Date.now() ? \" [expired]\" : \"\";\n\tconst disabled = entry.disabled ? \" [disabled]\" : \"\";\n\treturn `${entry.provider}: ${ident}${stale}${disabled} from ${entry.sourceFile}`;\n}\n\nasync function runImport(flags: AuthBrokerCommandArgs[\"flags\"]): Promise<void> {\n\tconst target = flags.source;\n\tif (!target) {\n\t\tthrow new Error(\"Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]\");\n\t}\n\tconst resolvedTarget = path.resolve(target.startsWith(\"~\") ? target.replace(/^~/, os.homedir()) : target);\n\tconst { entries, skipped } = await loadImportPlan(resolvedTarget, flags.provider, flags.includeDisabled === true);\n\n\tif (flags.json) {\n\t\tprocess.stdout.write(\n\t\t\t`${JSON.stringify({\n\t\t\t\tdryRun: flags.dryRun === true,\n\t\t\t\timported: flags.dryRun\n\t\t\t\t\t? []\n\t\t\t\t\t: entries.map(e => ({ provider: e.provider, email: e.email, file: e.sourceFile })),\n\t\t\t\tplan: entries.map(e => ({\n\t\t\t\t\tprovider: e.provider,\n\t\t\t\t\temail: e.email,\n\t\t\t\t\taccountId: e.accountId,\n\t\t\t\t\texpiresAt: e.expiresAt,\n\t\t\t\t\tdisabled: e.disabled,\n\t\t\t\t\tfile: e.sourceFile,","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/auth-broker-cli.ts#L585-L621","documentation":"`runImport` requires the import target from `flags.source`; importing is meaningless without a file or directory of credential exports. When the flag is absent it throws a usage string documenting the exact command shape, so the user sees the syntax instead of a null-path crash.","triggerScenarios":"Running `omp auth-broker import` with no `<file|dir>` argument; a shell quoting mistake that drops the argument; calling `runImport` programmatically with default/empty flags.","commonSituations":"Typing the subcommand with no target; unquoted path with spaces being split by the shell; wiring `runImport` from scripts without setting `flags.source`.","solutions":["Pass the target: `omp auth-broker import <file|dir>` (e.g. `omp auth-broker import ./exports/`).","Quote paths containing spaces so argument parsing keeps them intact.","Add optional flags as documented: `--provider=<id>`, `--include-disabled`, `--dry-run`."],"exampleFix":"// before\nomp auth-broker import\n// after\nomp auth-broker import ./auth-exports --provider=anthropic","handlingStrategy":"validation","validationCode":"const flags: AuthBrokerCommandArgs[\"flags\"] = parseFlags(argv);\nif (!flags.source) {\n  console.error(\"Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]\");\n  process.exit(2);\n}\nawait runImport(flags);","typeGuard":null,"tryCatchPattern":"try {\n  await runImport(flags);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Usage: omp auth-broker import\")) {\n    console.error(err.message);\n  } else throw err;\n}","preventionTips":["Always pass the file/directory argument: `omp auth-broker import <file|dir>`.","Quote paths with spaces so argument parsing keeps them intact.","Add `--dry-run` on first use to preview the plan before importing."],"tags":["cli","usage","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}