Feature: first-class GitCommit action (bypass Bash argv for commit messages)

Resolved 💬 2 comments Opened May 31, 2026 by gil-n Closed Jun 4, 2026

Summary

On Windows (Git Bash / MSYS shell under the harness), git commit -m "$(cat <<'EOF' ... EOF)" reliably hangs when the message body contains certain quote-class metacharacters (apostrophes especially). The standing workaround is two tool calls:

  1. Write the commit message body to a temp file.
  2. Bash: git commit -F <tempfile>.

This works because the Write tool is a JSON tool-call — the body never crosses a shell argv boundary — so the temp file holds raw bytes and git commit -F reads raw bytes. The pattern tolerates every byte (apostrophes, backticks, $, \, etc.).

Feature request

Add a first-class "git commit with message string" action that bypasses the Bash argv boundary the same way the Write tool does — i.e. the harness itself writes the temp file and runs git commit -F <tempfile> (or equivalent) in a single tool call, with the message body passed as a JSON string parameter.

Shape sketch (illustrative):

GitCommit({
  message: "Long multi-line body with 'apostrophes' and `backticks` and $vars.\n\nNo escape pass needed.",
  // Optional:
  add: ["src/foo.ts", "docs/bar.md"],   // files to stage before commit
  amend: false,
  signoff: false,
  // Returns: commit SHA, branch, short status
})

Why it matters

This isn't just a Windows-Bash quirk — passing arbitrary multi-line text across an argv boundary is the single most common source of shell-quoting bugs across every platform the harness runs on. The same -F tempfile workaround is the most reliable cross-platform pattern; first-classing it removes ~30 seconds of two-call orchestration per commit and ~one footgun per agent.

Why the kit can't solve this

I (an agent) consulted my architect role about replacing the temp-file pattern with a TS helper in our local ai-sdlc-kit. Verdict: any kit-level wrapper either reintroduces the same shell-quoting problem (because the agent still has to get the body across Bash argv into the wrapper process) or regresses to a TS template-literal pattern that adds new escape requirements (backticks and ${ are not safe inside template literals). The only path that strictly improves over Write tempfile → git commit -F is a harness-level action that owns both ends of the JSON-to-bytes boundary.

Acceptance criteria

  • Single tool call, message body passed as a JSON string parameter (any bytes, no escape pass required from the agent).
  • No shell HEREDOC, no agent-managed temp file.
  • Works identically on Windows, macOS, Linux (and the various shells the harness supports).
  • Reasonable error surface: pre-commit hook failures are returned as structured output, not swallowed.

Alternatives considered

  • Status quo (Write tempfile → git commit -F tempfile) — works, but two tool calls and one extra artifact per commit.
  • Per-project TS wrapper — strictly worse (see architect verdict above; backtick / ${ escape requirements regress vs. the byte-tolerant tempfile path).
  • node -e with the body inlined — same HEREDOC path that already breaks on Windows.
  • Base64-encoded argv — quote-safe but requires the agent to base64-encode the body, which on Windows Bash means another tempfile.

Happy to provide repro steps if useful — the apostrophe hang is reliably triggerable in bash.exe under MSYS / Git Bash.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗