Skip to content

feat(repo-memory): add format-json option to pretty-print JSON files before commit#39540

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-json-formatting-option
Draft

feat(repo-memory): add format-json option to pretty-print JSON files before commit#39540
Copilot wants to merge 2 commits into
mainfrom
copilot/add-json-formatting-option

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

AI agents frequently write JSON memory files as single-line blobs even when instructed otherwise, making them hard to review or manually correct in the repository. A new format-json: true option on repo-memory entries forces all .json files to be pretty-printed (2-space indent, trailing newline) before they are committed to the memory branch.

Changes

  • RepoMemoryEntry struct — new FormatJSON bool field (format-json YAML key)
  • extractRepoMemoryConfig — parses format-json in both object and array config paths
  • buildPushRepoMemoryJob — emits FORMAT_JSON: 'true' env var on the push step only when enabled (omitted otherwise, no-op default)
  • push_repo_memory.cjs — after files are copied but before git add, recursively formats .json files via JSON.stringify(parsed, null, 2); invalid JSON files are skipped with a warning rather than failing the push
  • Schemaformat-json boolean added to both the object and array-item repo-memory schema variants
  • Docsformat-json documented in the advanced config example and option descriptions
  • Tests — object config, array config, default-false, and push-step env-var emission

Example

tools:
  repo-memory:
    branch-name: memory/notes
    format-json: true   # pretty-prints all .json files before commit

Or per-entry in array notation:

tools:
  repo-memory:
    - id: notes
      branch-name: memory/notes
      format-json: true
    - id: logs
      branch-name: memory/logs

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to format JSON repo memory for readability feat(repo-memory): add format-json option to pretty-print JSON files before commit Jun 16, 2026
Copilot finished work on behalf of dsyme June 16, 2026 12:29
Copilot AI requested a review from dsyme June 16, 2026 12:29
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.

2 participants