Skip to content

feat(get): add default-org to fetch user default organization#979

Merged
mbevc1 merged 2 commits into
mainfrom
20260629_get_default-org
Jun 29, 2026
Merged

feat(get): add default-org to fetch user default organization#979
mbevc1 merged 2 commits into
mainfrom
20260629_get_default-org

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Adds kosli get default-org which calls GET /api/v2/user/default-org to retrieve the default organization for the currently authenticated user. Supports table (default) and json output.

Adds `kosli get default-org` which calls `GET /api/v2/user/default-org` to
retrieve the default organization for the currently authenticated user.
Supports table (default) and json output.
@mbevc1 mbevc1 added enhancement New feature or request go Pull requests that update go code labels Jun 29, 2026
@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Claude finished @mbevc1's task in 1m 53s —— View job


Review: feat(get): add default-org

  • Gather context (read changed files)
  • Static analysis (go build, go vet, go mod tidy)
  • Code review (quality, edge cases, bugs, tests, security)
  • Post review feedback

Static analysis

Check Result
go build ./... ✅ passes
go vet ./cmd/kosli/ ✅ clean
go mod tidy (diff check) ✅ no changes

Summary

This is a clean, well-scoped slice that follows the repo's established conventions closely. 👍

Strengths

  • newGetDefaultOrgCmd mirrors the existing new<Command>Cmd() factory pattern, uses RequireGlobalFlags in PreRunE, and wires output.FormattedPrint with table/json formatters exactly like sibling get commands.
  • The empty-org (none set) fallback (the suggestion from my earlier review) was incorporated, and it's backed by a dedicated unit test (TestPrintDefaultOrgAsTableNoneSet) — nice closure on that thread.
  • Good test coverage for a slice this size: pure unit tests for the table renderer plus an httpfake-driven suite test covering table output, --output json, and the NoArgs error path.
  • The updateDefaultOrgLongDesc wording fix improves consistency with the new get command's description.

Minor / optional observations (none blocking)

  • Args: cobra.NoArgs is correct here, and the test asserting the error on extra-arg is a nice touch.
  • The defaultOrg struct + json.Unmarshal error is propagated correctly; if the API ever returns a non-200 with an error body, kosliClient.Do already surfaces that, so no extra handling is needed.
  • No dry-run flag on this get command — correct, since it's a read-only GET (consistent with other get subcommands).

Nothing required from my side — looks ready to merge. ✅
· 20260629_get_default-org

Comment thread cmd/kosli/getDefaultOrg.go
@mbevc1 mbevc1 enabled auto-merge (squash) June 29, 2026 11:51
@mbevc1 mbevc1 merged commit 29f83c7 into main Jun 29, 2026
18 checks passed
@mbevc1 mbevc1 deleted the 20260629_get_default-org branch June 29, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants