Skip to content

Return Composer dependency trees as JSON and detect CLI versions - #44

Draft
andrew wants to merge 1 commit into
mainfrom
composer-json-resolve
Draft

andrew wants to merge 1 commit into
mainfrom
composer-json-resolve

Conversation

@andrew

@andrew andrew commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Composer resolution currently returns text. Use composer show --tree --format=json and add CLI version detection that preserves prerelease and development suffixes, so callers can choose a parser based on the installed version.

Draft pending a Composer release containing composer/composer#13049. That change adds installed versions to child nodes in the JSON tree. Older releases still report only constraints on those nodes, so consumers will need to retain their fallback until the installed Composer version includes the change.

@andrew

andrew commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up needed in git-pkgs/resolve after this ships: updating the managers dependency alone will not switch Composer to JSON output, because ResolveDeps currently routes Composer through ParseDir before running the manager's resolve command.

  • Update the managers dependency once a release includes this change.
  • Confirm the first Composer release containing Add installed version to sub-dependencies in show --tree JSON output composer/composer#13049, then use version detection to select the JSON command for supported releases.
  • Add a tree parser using root version values and child installed values, skipping platform requirements and retaining resolved versions at every depth.
  • Keep the lockfile parser for older or unrecognized Composer versions.
  • Cover both selection paths and parser behavior with tests, then verify against real Composer output on both sides of the version boundary.

The Composer version threshold should be confirmed from the published release rather than inferred from the milestone.

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