@nhtio/adk/batteries/llm/claude_code_cli/validation
Runtime validation schema and wrapper for Claude Code CLI adapter options.
Remarks
Schema and call-site wrapper for validating ClaudeCodeCliAdapterOptions. Used at construction time and at the start of every iteration against the merged options shape (stash > executor > constructor). Throws E_INVALID_CLAUDE_CODE_CLI_OPTIONS on failure — same hard-fail policy as every other ADK contract.
Three invariants enforced here that have no equivalent in the other LLM batteries:
apiKey/authTokenare mutually exclusive AND at least one is required (.xor).extraArgsentries are validated against a strict six-flag allowlist, with per-flag value arity, and every value string is rejected if it starts with-— the fix for the--betasvariadic-value injection hazard (a value string spelling another flag would otherwise reach the CLI's own argv parser as a distinct token).process.platformis checked at validation time: this battery is POSIX-only in v1 (reliable process-group control requires POSIX process groups), mirroringsrc/batteries/sandbox/node/srt_enforcer.ts's own platform-boundary precedent.
Variables
| Variable | Description |
|---|---|
| claudeCodeCliOptionsSchema | Validator schema for ClaudeCodeCliAdapterOptions. Used by validateOptions at construction time and again at the start of every iteration after options have been merged (stash > executor > constructor). Rejects unknown top-level keys so typos fail loud. |
Functions
| Function | Description |
|---|---|
| validateOptions | Validates an arbitrary input against claudeCodeCliOptionsSchema and returns the resolved options shape. Throws E_INVALID_CLAUDE_CODE_CLI_OPTIONS (carrying the validator's error report on cause) on failure. |