Skip to content

feat: add --json flag to heroku buildpacks and subcommands (W-23597909, #1637) - #3842

Open
heroku-johnny wants to merge 3 commits into
mainfrom
W-23597909
Open

feat: add --json flag to heroku buildpacks and subcommands (W-23597909, #1637)#3842
heroku-johnny wants to merge 3 commits into
mainfrom
W-23597909

Conversation

@heroku-johnny

Copy link
Copy Markdown
Contributor

Summary

  • Adds -j/--json flag to all six buildpacks subcommands: index (list), info, add, set, remove, and clear
  • List-oriented commands (index, add, set, remove) output the raw BuildpackResponse[] array as JSON
  • info outputs the full buildpack registry object as JSON
  • clear and single-buildpack remove output an empty array [] as JSON (representing the cleared state)
  • BuildpackCommand.clear() in src/lib/buildpacks/buildpacks.ts gains an optional json parameter; when set, it skips the config-vars API call and outputs [] immediately

Test plan

  • All 61 pre-existing buildpack unit tests continue to pass
  • 8 new JSON-coverage tests added (one or two per subcommand) — 69 total passing
  • TypeScript compiles cleanly (npx tsc --noEmit)
  • ESLint passes on all changed source and test files

Closes #1637
GUS: W-23597909

🤖 Generated with Claude Code

Adds a -j/--json flag to all buildpacks subcommands (index, info, add,
set, remove, clear). Commands that return a buildpack list output the raw
BuildpackResponse array; info outputs the registry object; clear and
single-removal output an empty array. Updates all unit tests with JSON
coverage.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@heroku-johnny
heroku-johnny requested a review from a team as a code owner July 27, 2026 20:08

@michaelmalave michaelmalave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev Tools Standards Review Results (machine-generated)

🟡 1 advisory.

@@ -1,17 +1,19 @@
import {Command, flags as Flags} from '@heroku-cli/command'
import {hux} from '@heroku/heroku-cli-util'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete-unused-code (Code style · minor · 60% confidence): The diff adds import {hux} from '@heroku/heroku-cli-util' but hux is never referenced anywhere in this file — run() only delegates to buildpackCommand.clear(...). An unused import is dead code that should be removed rather than left in place.

@michaelmalave michaelmalave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code passes - just a note on an import. LGTM!

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.

Add --json support to 'heroku buildpacks'

2 participants