fix: inline --json-schema file paths so structured output works on CLI 2.1.160 (closes #3)
The docs recommend the file-path form (`--json-schema /path/to/schema.json`) as primary, but the default-pinned Claude CLI 2.1.160 only accepts an inline JSON string. Passing a path makes the CLI exit 0 with empty output, so the action's fail-loud branch trips on every run. Resolve the value before spawning the CLI: a file-path schema is read in-process and passed inline (validated + compacted), while an already-inline schema is left untouched. Because the value is handed to spawn() as an argv element (never through a shell), a schema with `$ref`/`$defs` round-trips intact. Unreadable files and invalid JSON now fail with a clear error instead of the CLI's silent empty output. Docs (README, example workflow, action.yml) are corrected to explain that the file-path form is auto-inlined and works on the default CLI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ inputs:
|
||||
required: false
|
||||
default: ""
|
||||
claude_args:
|
||||
description: "Additional arguments to pass directly to the Claude CLI, forwarded verbatim (e.g. '--json-schema /path/to/schema.json' to get schema-validated output via the structured_output output). Requires a Claude CLI new enough to support the flags used (see README)."
|
||||
description: "Additional arguments to pass directly to the Claude CLI, forwarded verbatim (e.g. '--json-schema /path/to/schema.json' to get schema-validated output via the structured_output output; a file path given to --json-schema is read and inlined automatically, so it works on the default-installed CLI). Requires a Claude CLI new enough to support the flags used (see README)."
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user