Skip to content

Add bundle debug list-targets command#5005

Merged
pavloKozlov merged 2 commits intomainfrom
pavlo.kozlov/bundle-debug-list-targets
Apr 20, 2026
Merged

Add bundle debug list-targets command#5005
pavloKozlov merged 2 commits intomainfrom
pavlo.kozlov/bundle-debug-list-targets

Conversation

@pavloKozlov
Copy link
Copy Markdown
Contributor

Why

Provide a lightweight way to retrieve bundle target names along with their default, mode, and workspace.host fields. This is a prerequisite for running other bundle CLI commands (deploy, validate, run, etc.), which all require --target.

Changes

Adds a new hidden bundle debug list-targets subcommand that loads only the local YAML configuration (bundle.MustLoad + phases.Load) and returns each target's name, default, mode, and workspace.host. No target selection, no variable resolution, no authentication, no API calls.

Text output:
dev (default) development https://dev.example.com
prod production https://prod.example.com
staging https://staging.example.com

JSON output:

  {
    "targets": [
      {"name": "dev", "default": true, "mode": "development", "host": "https://dev.example.com"},
      {"name": "prod", "mode": "production", "host": "https://prod.example.com"},
      {"name": "staging", "host": "https://staging.example.com"}
    ]
  }

Test plan

  • Unit tests for collectTargets (sorting, all fields, nil workspace, empty map)
  • Acceptance test covering text and JSON output
  • Command is hidden from bundle debug --help

@pavloKozlov pavloKozlov force-pushed the pavlo.kozlov/bundle-debug-list-targets branch from fc88797 to 2453fea Compare April 17, 2026 09:00
targets:
dev:
default: true
mode: development
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.

for fields that have variable in default and mode, should we record behaviour as well in the test? (even if it does not work, it's good to know what happens and that it degrades gracefully).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Comment thread cmd/bundle/debug/list_targets_test.go Outdated
assert.Equal(t, "https://prod.example.com", result[1].Host)
}

func TestCollectTargetsHandlesNilWorkspace(t *testing.T) {
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.

these tests seem redundant given that we have acceptance test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed these tests in favour of acceptance tests.

@pavloKozlov pavloKozlov force-pushed the pavlo.kozlov/bundle-debug-list-targets branch from 74b9278 to afb9ec4 Compare April 20, 2026 12:56
@pavloKozlov pavloKozlov marked this pull request as ready for review April 20, 2026 12:58
@pavloKozlov pavloKozlov added this pull request to the merge queue Apr 20, 2026
Merged via the queue into main with commit 64a5907 Apr 20, 2026
27 of 28 checks passed
@pavloKozlov pavloKozlov deleted the pavlo.kozlov/bundle-debug-list-targets branch April 20, 2026 13:41
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.

3 participants