Skip to content

feat: add --json output mode for programmatic use#43

Open
numbpilled2133 wants to merge 1 commit into
promptpolish-ai:mainfrom
numbpilled2133:feat/json-output
Open

feat: add --json output mode for programmatic use#43
numbpilled2133 wants to merge 1 commit into
promptpolish-ai:mainfrom
numbpilled2133:feat/json-output

Conversation

@numbpilled2133

@numbpilled2133 numbpilled2133 commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Adds a --json flag that outputs structured JSON instead of markdown/text. Designed for piping into LLM pipelines and programmatic analysis.

Usage

  • git-context --json — basic info, commits, branches, structure
  • git-context --json --files — include file contents
  • git-context --json --depth 1 --log 5 — shallow tree, fewer commits
  • git-context --json -o context.json — write to file

JSON structure

repo            string    repository name
generated       string    timestamp
path            string    absolute path
git_info        object    branch, remote, status (has_unstaged / has_staged / working_tree)
recent_commits  array     hash, short_hash, message, author, relative_time, date
branches        array     branch names
project_structure object  depth + hierarchical tree of files/dirs
file_contents   array     path, language, content (only with --files)

Testing

Tested locally. Valid JSON verified. Text output path is unchanged — purely additive feature.

Bounty wallet: 0x96ae5ac39ac118361c158c045e6c41dc0c08c533

Adds a --json flag that outputs the full repo context as structured JSON
instead of the default markdown/text format.

JSON output includes:
- repo: repository name
- generated: timestamp
- path: absolute path
- git_info: branch, remote, status
- recent_commits: structured list with hash, message, author, date
- branches: list of branch names
- project_structure: hierarchical tree of files/directories
- file_contents: list of {path, language, content} when --files is used

The text output path is unchanged. This is purely additive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant