It would be very useful if all apm CLI commands that produce structured information supported a consistent --format flag, including JSON output.
Some commands already support this. For example, apm audit --format json can output machine-readable JSON, which makes it possible to build automation on top of the command without parsing human-readable text output.
Background
I am currently looking at building GitHub Actions automation around APM usage.
One use case is detecting package drift and reporting on it. This works well with apm audit because the JSON output can be parsed reliably.
Another use case is building an update workflow similar in spirit to Dependabot, where automation can detect outdated APM packages and propose pull requests to update them.
This is currently difficult because commands such as apm outdated and apm update do not appear to provide machine-readable output. That means automation would need to parse the human-readable CLI output, which is brittle and likely to break if the formatting changes.
Requested feature
Add a consistent --format option to CLI commands that output structured data.
For example:
apm outdated --format json
apm update --format json
apm list --format json
Potential supported formats could be:
--format text
--format json
Where text remains the default for human CLI usage, and json provides a stable output contract for automation.
Example usage
A GitHub Action could run:
apm outdated --format json
And receive structured information such as:
{
"packages": [
{
"name": "example-package",
"currentVersion": "1.2.0",
"latestVersion": "1.4.0",
"updateAvailable": true
}
]
}
This would allow automation to:
- detect which packages are outdated
- understand the current and target versions
- generate reports
- open pull requests for updates
- avoid relying on fragile text parsing
Why this matters
Machine-readable CLI output makes APM much easier to use in CI/CD, governance, reporting, and automated maintenance workflows.
The existing JSON support in apm audit is a good example of the value this provides. Extending the same pattern consistently across the CLI would make it much easier to build reliable automation around APM.
It would be very useful if all
apmCLI commands that produce structured information supported a consistent--formatflag, including JSON output.Some commands already support this. For example,
apm audit --format jsoncan output machine-readable JSON, which makes it possible to build automation on top of the command without parsing human-readable text output.Background
I am currently looking at building GitHub Actions automation around APM usage.
One use case is detecting package drift and reporting on it. This works well with
apm auditbecause the JSON output can be parsed reliably.Another use case is building an update workflow similar in spirit to Dependabot, where automation can detect outdated APM packages and propose pull requests to update them.
This is currently difficult because commands such as
apm outdatedandapm updatedo not appear to provide machine-readable output. That means automation would need to parse the human-readable CLI output, which is brittle and likely to break if the formatting changes.Requested feature
Add a consistent
--formatoption to CLI commands that output structured data.For example:
Potential supported formats could be:
Where
textremains the default for human CLI usage, andjsonprovides a stable output contract for automation.Example usage
A GitHub Action could run:
And receive structured information such as:
{ "packages": [ { "name": "example-package", "currentVersion": "1.2.0", "latestVersion": "1.4.0", "updateAvailable": true } ] }This would allow automation to:
Why this matters
Machine-readable CLI output makes APM much easier to use in CI/CD, governance, reporting, and automated maintenance workflows.
The existing JSON support in
apm auditis a good example of the value this provides. Extending the same pattern consistently across the CLI would make it much easier to build reliable automation around APM.