Support claude_args + structured_output (merge upstream v1 --json-schema capability) #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Bring the upstream
claude_argspassthrough input andstructured_outputoutput into this Gitea fork, so downstream workflows can run the agent with arbitrary Claude CLI flags — specifically--output-format json --json-schema '<schema>'— and read the schema-validated verdict back as an action output (no agent-written file), while keeping the Gitea API + Gitea MCP adaptations this fork exists for.Downstream driver:
ryan/ourwhmcsPR-review workflow wants the review verdict to be the model's own schema-enforced output instead of a file the agent writes (ourwhmcs #1164/#1165).Current state (why it doesn't work today)
claude-code-actionarchitecture. ItsRun Claude Codestep delegates the actualclaudeinvocation toanthropics/claude-code-base-action@v0.0.63.v0.0.63,src/run-claude.tsbuilds a fixed arg list:BASE_ARGS = ["-p","--verbose","--output-format","stream-json"]plus only--allowedTools/--disallowedTools/--max-turns/--mcp-config/--system-prompt/--append-system-prompt/--fallback-model/--model.There is no input for arbitrary args and no
structured_output.v0.0.63is also the newest released tag ofclaude-code-base-action.Upstream state (where the capability lives)
anthropics/claude-code-actionv1.x (released; v1.0 on 2025-08-26, latestv1.0.133) replaced the many individual inputs with a singleclaude_argsinput ("Additional arguments to pass directly to Claude CLI") and added astructured_outputoutput ("JSON string containing all structured output fields when--json-schemais provided inclaude_args").anthropics/claude-code-base-actionalso hasclaude_args+structured_output— but only on untaggedmain(no release tag carries it yet).Options to merge
Option A — Re-base the fork onto
claude-code-actionv1 (e.g.v1.0.133)Adopt the v1 architecture (single
prompt+claude_args+structured_output, no separate pre-v1 base-action delegation) and re-apply the Gitea adaptations on top:api.github.com→ Gitea API ($GITHUB_API_URL= Gitea instance)Cleanest long-term (tracks upstream, real release tags,
structured_outputnative). Largest effort — v1 is a substantial rewrite vs the pre-v1 base this fork derives from.Option B — Minimal passthrough patch (keep current architecture)
anthropics/claude-code-base-action@v0.0.63→ amaincommit SHA that hasclaude_args+structured_output.claude_argsinput to this fork'saction.yml, forward it to base-actionwith: claude_args:.structured_outputoutput to this fork, mapped from the base-action step'sstructured_output.Smaller change. Risks: pins an untagged base-action
maincommit (moving target unless SHA-pinned); base-actionmainmay have diverged from thev0.0.63behavior this fork relies on (prompt-file delivery,mcp_config, stream-json execution log) — must retest those.Cross-cutting caveats (apply to either option)
claude-runnerimage bakes the action SHA, the base-action tag, and aclaudeCLI version (currently 1.0.117).--json-schemaneeds a CLI new enough to support it (1.0.117 predates it). So merging this requires rebuilding/pushing the runner image with a newerclaudeand the matchingACTION_SHA/BASE_ACTION_TAG, then restarting the runner (see ourwhmcs.gitea/runner/README.md).@claude). Verify each still works: prompt-file delivery, Gitea MCP tools, and theexecution_file/ stream-json parsing.Acceptance criteria
claude_argsinput and astructured_outputoutput.claude_args: --output-format json --json-schema "$(cat schema.json)"and read the schema-validated object fromsteps.<id>.outputs.structured_output.claudeCLI that supports--json-schema.References
anthropics/claude-code-action@v1.0.133action.yml(claude_args,structured_output).main:anthropics/claude-code-base-actionaction.yml+src/run-claude.ts.ryan/ourwhmcs#1164 / #1165 (PR-review prompt extraction; verdict-as-LLM-output goal).