feat(query): add query command with structured JSON output#1612
Open
samuraisatoshi wants to merge 1 commit intoyonaskolb:masterfrom
Open
feat(query): add query command with structured JSON output#1612samuraisatoshi wants to merge 1 commit intoyonaskolb:masterfrom
samuraisatoshi wants to merge 1 commit intoyonaskolb:masterfrom
Conversation
Adds a new `xcodegen query` command for introspecting the resolved project spec without generating a project. Query types (--type): targets List all targets with name, type, platform target Full detail for a single target (--name required) sources Source paths for a target (--name required) settings Build settings for a target (--name, optional --config) dependencies Dependencies for a target (--name required) All output is pretty-printed JSON. Errors (target not found, missing --name) are also reported as JSON with an 'error' key. Exit code is 1 on error, 0 on success. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
We already have a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
xcodegen querycommand for introspecting the resolved project spec without generating a project. All output is pretty-printed JSON.jq, CI scripts, or editor integrations--namereturns{"error":"..."}with exit code 1Query types (
--type)targetstarget--namesources--namesettings--name(optional--config)dependencies--nameOutput examples
xcodegen query --type targets[ { "name": "MyApp", "platform": "iOS", "type": "application" }, { "name": "MyTests", "platform": "iOS", "type": "bundle.unit-test" } ]xcodegen query --type target --name MyApp{ "dependencies": [{ "reference": "MyLib", "type": "target" }], "deploymentTarget": "16.0", "name": "MyApp", "platform": "iOS", "sources": ["Sources/App.swift"], "type": "application" }xcodegen query --type settings --name MyApp --config Debug{ "PRODUCT_BUNDLE_IDENTIFIER": "com.example.myapp", "SWIFT_VERSION": "5.9" }Use cases
generate.xcodeprojxcodegen query --type sources --name MyApp | jq '.[]'Test plan
xcodegen query→ JSON array of all targetsxcodegen query --type target --name MyApp→ full target detailxcodegen query --type target --name Missing→{"error":"..."}, exit 1xcodegen query --type sources(missing --name) →{"error":"..."}, exit 1xcodegen query --type settings --name MyApp --config Debug→ config-specific settingsswift testpasses🤖 Generated with Claude Code