Repository navigation
fix(output): inline YAML of embedded structs, clone -o json, colors only on a terminal, chart rows - #169
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four output bugs, found in a live test of the new commands against a local k8s-stack-manager:
-o yamlnested the base fields underbase:. yaml.v3 does not inline an embedded struct without a tag. The embeddedBase,StackTemplateandTemplateVersionfields inpkg/typesnow carryyaml:",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.stack clone -o json|yamlprinted text. The command now prints the instance in every format except table, asstack createdoes. The quota warning stays on stderr.--no-coloror a non-emptyNO_COLOR(no-color.org). A non-emptyNO_COLORalso gives pluginsSTACKCTL_NO_COLOR=1. EXTENDING.md says that a plugin checks its own stdout for a terminal.NameandRelease Namerows. The server sends no such fields.add-chartandupdate-chartnow 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 yamlmust now read.id. I found no such consumer in this repository or in k8s-stack-manager-extensions.Notes
--no-color=falsecannot force colors into a pipe (for example| less -R). A--color=always|auto|neverflag can follow if needed.Tests
go test ./...passes, alsogo test -shuffle=on ./cmd.staticcheck(latest) has no findings.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) andTestPluginEnv_NoColorFromEnv.🤖 Generated with Claude Code