feat: add --format json to all porcelain commands for agent-first output
Every porcelain command that produces meaningful structured output now accepts --format json (or --format text, the default). Agents can pass this flag to receive machine-readable JSON instead of human-readable text, enabling clean pipelines without text parsing.
Commands updated: - commit → {commit_id, branch, snapshot_id, message, parent_commit_id, committed_at, sem_ver_bump} - checkout → {action, branch, commit_id} - status → {branch, clean, added, modified, deleted} - diff → {summary, added, deleted, modified, total_changes} - merge → {status, commit_id, branch, current_branch, conflicts} - reset → {branch, old_commit_id, new_commit_id, mode} - revert → {commit_id, branch, reverted_commit_id, message} - cherry-pick → {commit_id, branch, source_commit_id, conflicts} - rebase → {status, branch, new_head, onto, squash, replayed, conflicts} - log → JSON array of commit objects - branch → JSON array for list; action object for create/delete - tag add/list/remove → structured tag objects - stash push/pop/list/drop → structured stash objects - reflog → JSON array of ref entries - worktree add/list/remove → structured worktree objects - gc → {collected_count, collected_bytes, reachable_count, elapsed_seconds, dry_run, collected_ids} - whoami → --format json aliases existing --json flag
show already had --json; no change needed. All format validation follows the same pattern: unknown values echo an error and exit USER_ERROR. Tests updated throughout.
mypy: 0 errors | typing_audit: 0 violations | pytest: 3198 passed
No comments yet. Be the first to start the discussion.