Skip to content

Add consistent machine-readable output format support across CLI commands #2070

Description

@ScottGuymer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).status/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).type/featureNew capability, new flag, new primitive.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions