Skip to content

[FEAT] - Add --json output flag to list and env commands for CI/scripting #192

Description

@aosmcleod

Description

The list and env commands currently only output human-readable box-drawing tables with ANSI color codes. There's no way to get structured, machine-readable output for use in CI pipelines, scripts, or other tooling.

Current behavior

heroui list

Outputs a colored table using box-drawing characters — great for humans, unusable for scripts.

Proposed behavior

Add a --json flag to list and env that outputs structured JSON:

heroui list --json
{
  "packages": [
    {
      "package": "@heroui/react",
      "version": "3.0.0",
      "latestVersion": "3.0.4",
      "status": "stable",
      "docs": "https://heroui.com"
    },
    {
      "package": "@heroui/styles",
      "version": "3.0.0",
      "latestVersion": "3.0.4",
      "status": "stable",
      "docs": "https://heroui.com"
    }
  ]
}
heroui env --json
{
  "packages": [...],
  "environment": {
    "os": "darwin",
    "arch": "arm64",
    "nodeVersion": "v22.0.0"
  }
}

Why this matters

  • CI/CD pipelines need to parse CLI output programmatically (e.g., check if packages are outdated before deploying)
  • Scripts that wrap the CLI can't reliably parse colored table output
  • Other tools (like MCP servers or IDE extensions) could consume this output
  • It's a common pattern in modern CLIs (npm, yarn, pnpm all support --json)

Implementation notes

The data is already structured internally as PackageComponent[] objects in src/helpers/package.ts. The change is minimal:

  1. Add --json option to list and env command registration
  2. In the action, check for the flag and JSON.stringify the data instead of calling outputComponents()
  3. When --json is set, skip the version-check banner and colored output

Scope

Small — the data structures already exist, this is just an alternative output path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions