Skip to content

feat(generate): add --dry-run flag to diff project without writing#1610

Open
samuraisatoshi wants to merge 1 commit intoyonaskolb:masterfrom
samuraisatoshi:feat/generate-dry-run
Open

feat(generate): add --dry-run flag to diff project without writing#1610
samuraisatoshi wants to merge 1 commit intoyonaskolb:masterfrom
samuraisatoshi:feat/generate-dry-run

Conversation

@samuraisatoshi
Copy link
Copy Markdown

Summary

Adds a --dry-run flag to the generate command that generates the Xcode project entirely in memory and prints a JSON diff of what would change — without writing any files to disk.

This is useful for:

  • CI checks that want to verify the spec is clean without modifying the repo
  • Reviewing what XcodeGen would change before committing a spec change
  • Debugging spec changes in a safe, read-only mode

Changes

  • GenerateCommand.swift: new --dry-run flag; when set, calls ProjectDiff and prints JSON then returns early
  • ProjectDiff.swift (new): lightweight struct that compares an in-memory XcodeProj against an existing .xcodeproj on disk and captures added/removed/modified PBX object keys

JSON output example

{
  "added": ["ABC123", "DEF456"],
  "modified": ["GHI789"],
  "removed": []
}

Test plan

  • Run xcodegen generate --dry-run on an existing project — verify JSON output, no files written
  • Run on a project with no existing .xcodeproj — all keys should appear in added
  • Existing tests pass: swift test

🤖 Generated with Claude Code

Adds a new --dry-run flag to the generate command that generates the
Xcode project in memory and prints a JSON diff of what would change
compared to the existing project on disk, without writing any files.

New type ProjectDiff captures added/removed/modified file keys in the
pbxproj and serialises them as JSON.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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