Support claude_args + structured_output (merge upstream v1 --json-schema capability) #1

Closed
opened 2026-06-02 12:49:10 +02:00 by ryan · 0 comments
Owner

Goal

Bring the upstream claude_args passthrough input and structured_output output 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/ourwhmcs PR-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)

  • This fork is a port of the pre-v1 claude-code-action architecture. Its Run Claude Code step delegates the actual claude invocation to anthropics/claude-code-base-action@v0.0.63.
  • In v0.0.63, src/run-claude.ts builds 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.63 is also the newest released tag of claude-code-base-action.

Upstream state (where the capability lives)

  • anthropics/claude-code-action v1.x (released; v1.0 on 2025-08-26, latest v1.0.133) replaced the many individual inputs with a single claude_args input ("Additional arguments to pass directly to Claude CLI") and added a structured_output output ("JSON string containing all structured output fields when --json-schema is provided in claude_args").
  • anthropics/claude-code-base-action also has claude_args + structured_output — but only on untagged main (no release tag carries it yet).

Options to merge

Option A — Re-base the fork onto claude-code-action v1 (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:

  • octokit / api.github.com → Gitea API ($GITHUB_API_URL = Gitea instance)
  • GitHub MCP → Gitea MCP server config
  • GitHub event payload shapes → Gitea equivalents
    Cleanest long-term (tracks upstream, real release tags, structured_output native). Largest effort — v1 is a substantial rewrite vs the pre-v1 base this fork derives from.

Option B — Minimal passthrough patch (keep current architecture)

  • Bump the inner pin anthropics/claude-code-base-action@v0.0.63 → a main commit SHA that has claude_args + structured_output.
  • Add a claude_args input to this fork's action.yml, forward it to base-action with: claude_args:.
  • Add a structured_output output to this fork, mapped from the base-action step's structured_output.
    Smaller change. Risks: pins an untagged base-action main commit (moving target unless SHA-pinned); base-action main may have diverged from the v0.0.63 behavior this fork relies on (prompt-file delivery, mcp_config, stream-json execution log) — must retest those.

Cross-cutting caveats (apply to either option)

  1. Runner image rebuild required. The downstream claude-runner image bakes the action SHA, the base-action tag, and a claude CLI version (currently 1.0.117). --json-schema needs a CLI new enough to support it (1.0.117 predates it). So merging this requires rebuilding/pushing the runner image with a newer claude and the matching ACTION_SHA/BASE_ACTION_TAG, then restarting the runner (see ourwhmcs .gitea/runner/README.md).
  2. Blast radius. Bumping the base action affects every downstream step using this fork (PR review, docs-update, conflict-resolver, issue-triage, @claude). Verify each still works: prompt-file delivery, Gitea MCP tools, and the execution_file / stream-json parsing.

Acceptance criteria

  • This fork exposes a claude_args input and a structured_output output.
  • A downstream workflow can set claude_args: --output-format json --json-schema "$(cat schema.json)" and read the schema-validated object from steps.<id>.outputs.structured_output.
  • Existing fork-based steps (review/docs/conflict/triage/@claude) behave unchanged.
  • Pin targets documented (action SHA + base-action ref) and runner image rebuilt to a claude CLI that supports --json-schema.

References

  • Upstream input/output: anthropics/claude-code-action@v1.0.133 action.yml (claude_args, structured_output).
  • Base action feature on main: anthropics/claude-code-base-action action.yml + src/run-claude.ts.
  • Downstream consumer: ryan/ourwhmcs #1164 / #1165 (PR-review prompt extraction; verdict-as-LLM-output goal).
## Goal Bring the upstream **`claude_args`** passthrough input and **`structured_output`** output 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/ourwhmcs` PR-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) - This fork is a port of the **pre-v1** `claude-code-action` architecture. Its `Run Claude Code` step delegates the actual `claude` invocation to **`anthropics/claude-code-base-action@v0.0.63`**. - In `v0.0.63`, `src/run-claude.ts` builds 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.63` is also the **newest released tag** of `claude-code-base-action`. ## Upstream state (where the capability lives) - **`anthropics/claude-code-action` v1.x** (released; v1.0 on 2025-08-26, latest `v1.0.133`) replaced the many individual inputs with a single **`claude_args`** input ("Additional arguments to pass directly to Claude CLI") and added a **`structured_output`** output ("JSON string containing all structured output fields when `--json-schema` is provided in `claude_args`"). - **`anthropics/claude-code-base-action`** also has `claude_args` + `structured_output` — but **only on untagged `main`** (no release tag carries it yet). ## Options to merge ### Option A — Re-base the fork onto `claude-code-action` v1 (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: - octokit / `api.github.com` → Gitea API (`$GITHUB_API_URL` = Gitea instance) - GitHub MCP → Gitea MCP server config - GitHub event payload shapes → Gitea equivalents Cleanest long-term (tracks upstream, real release tags, `structured_output` native). Largest effort — v1 is a substantial rewrite vs the pre-v1 base this fork derives from. ### Option B — Minimal passthrough patch (keep current architecture) - Bump the inner pin `anthropics/claude-code-base-action@v0.0.63` → a **`main` commit SHA** that has `claude_args` + `structured_output`. - Add a **`claude_args`** input to this fork's `action.yml`, forward it to base-action `with: claude_args:`. - Add a **`structured_output`** output to this fork, mapped from the base-action step's `structured_output`. Smaller change. Risks: pins an **untagged** base-action `main` commit (moving target unless SHA-pinned); base-action `main` may have diverged from the `v0.0.63` behavior this fork relies on (prompt-file delivery, `mcp_config`, stream-json execution log) — must retest those. ## Cross-cutting caveats (apply to either option) 1. **Runner image rebuild required.** The downstream `claude-runner` image bakes the action SHA, the base-action tag, and a **`claude` CLI version (currently 1.0.117)**. `--json-schema` needs a CLI new enough to support it (1.0.117 predates it). So merging this requires rebuilding/pushing the runner image with a newer `claude` and the matching `ACTION_SHA`/`BASE_ACTION_TAG`, then restarting the runner (see ourwhmcs `.gitea/runner/README.md`). 2. **Blast radius.** Bumping the base action affects **every** downstream step using this fork (PR review, docs-update, conflict-resolver, issue-triage, `@claude`). Verify each still works: prompt-file delivery, Gitea MCP tools, and the `execution_file` / stream-json parsing. ## Acceptance criteria - This fork exposes a `claude_args` **input** and a `structured_output` **output**. - A downstream workflow can set `claude_args: --output-format json --json-schema "$(cat schema.json)"` and read the schema-validated object from `steps.<id>.outputs.structured_output`. - Existing fork-based steps (review/docs/conflict/triage/@claude) behave unchanged. - Pin targets documented (action SHA + base-action ref) and runner image rebuilt to a `claude` CLI that supports `--json-schema`. ## References - Upstream input/output: `anthropics/claude-code-action@v1.0.133` `action.yml` (`claude_args`, `structured_output`). - Base action feature on `main`: `anthropics/claude-code-base-action` `action.yml` + `src/run-claude.ts`. - Downstream consumer: `ryan/ourwhmcs` #1164 / #1165 (PR-review prompt extraction; verdict-as-LLM-output goal).
ryan closed this issue 2026-06-02 14:33:57 +02:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/claude-code-gitea-action#1