Skip to content

feat: add --json output mode for structured AI context#56

Open
vratprem-art wants to merge 5 commits into
promptpolish-ai:mainfrom
vratprem-art:main
Open

feat: add --json output mode for structured AI context#56
vratprem-art wants to merge 5 commits into
promptpolish-ai:mainfrom
vratprem-art:main

Conversation

@vratprem-art

Copy link
Copy Markdown

Hi there! 👋 I've implemented the $2 bounty to add a --json output flag.

🚀 What this PR does:

  • Added a --json argument to both __init__.py and the standalone git-context script.
  • When --json is used, the context is output as a structured JSON dictionary containing repo_name, git_info, recent_commits, project_structure, and file_contents.
  • Bug Fix: Added sys.stdout.reconfigure(encoding='utf-8', errors='replace') at the start of main(). This fixes a UnicodeEncodeError that occurs on Windows consoles when the script tries to print folder/file emoji icons.
  • Updated the README.md to document the new --json flag.

🧪 Testing:

Tested locally on Windows and the JSON output is perfectly formatted and valid. Let me know if you need any changes!

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