Skip to content

fix(output): inline YAML of embedded structs, clone -o json, colors only on a terminal, chart rows - #169

Merged
omattsson merged 1 commit into
mainfrom
fix/output-yaml-inline-clone-json-color
Oct 19, 2026
Merged

omattsson merged 1 commit into
mainfrom
fix/output-yaml-inline-clone-json-color

Conversation

@omattsson

Copy link
Copy Markdown
Owner

Summary

Four output bugs, found in a live test of the new commands against a local k8s-stack-manager:

  1. -o yaml nested the base fields under base:. yaml.v3 does not inline an embedded struct without a tag. The embedded Base, StackTemplate and TemplateVersion fields in pkg/types now carry yaml:",inline", so YAML has the same top-level keys as JSON (id, created_at, updated_at, deleted_at, version). This affects stacks, definitions, templates, the template publish response, charts, users, cluster quotas, shared values, template versions and cleanup policies. JSON does not change.
  2. stack clone -o json|yaml printed text. The command now prints the instance in every format except table, as stack create does. The quota warning stays on stderr.
  3. Status colors went to pipes and files. stackctl now prints colors only when stdout is a terminal, and not with --no-color or a non-empty NO_COLOR (no-color.org). A non-empty NO_COLOR also gives plugins STACKCTL_NO_COLOR=1. EXTENDING.md says that a plugin checks its own stdout for a terminal.
  4. The chart output showed empty Name and Release Name rows. The server sends no such fields. add-chart and update-chart now show ID, chart, repository, chart path, version, deploy order and, for a required chart, Required.

Breaking change: YAML output

A script that reads .base.id (or another .base.* key) from -o yaml must now read .id. I found no such consumer in this repository or in k8s-stack-manager-extensions.

Notes

  • --no-color=false cannot force colors into a pipe (for example | less -R). A --color=always|auto|never flag can follow if needed.
  • Git Bash and mintty on Windows give a pipe, not a console, so colors are off there.

Tests

  • go test ./... passes, also go test -shuffle=on ./cmd. staticcheck (latest) has no findings.
  • New tests: TestYAML_EmbeddedStructsAreInline (all 10 types, YAML and JSON), cli/cmd/output_fixes_test.go (clone in table, quiet, JSON and YAML; the chart rows; the color rule) and TestPluginEnv_NoColorFromEnv.

🤖 Generated with Claude Code

…nly on a terminal, chart rows

Found in a live test of the new commands.

- -o yaml put id, created_at, updated_at, deleted_at and version under
  "base:" (yaml.v3 does not inline an embedded struct without a tag).
  Embedded Base, StackTemplate and TemplateVersion now carry
  yaml:",inline", so YAML has the same top-level keys as JSON.
  Note: a script that reads .base.id from YAML must read .id now.
- stack clone ignored -o json and -o yaml (it printed text). It now
  prints the instance in every format except table, as stack create does.
- Status colors went to pipes and files. stackctl now prints colors only
  when stdout is a terminal and NO_COLOR is not set. A non-empty NO_COLOR
  also sets STACKCTL_NO_COLOR=1 for plugins.
- The chart output (add-chart, update-chart) showed empty Name and
  Release Name rows: the server sends no such fields. It now shows the
  chart path, the deploy order and Required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omattsson omattsson added the bug Something isn't working label Oct 19, 2026
@omattsson
omattsson merged commit 8162129 into main Oct 19, 2026
7 checks passed
@omattsson
omattsson deleted the fix/output-yaml-inline-clone-json-color branch October 19, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant