Skip to content

feat(list repos): add --search, --sort-direction and --tag filters#1013

Merged
mbevc1 merged 3 commits into
mainfrom
20260709_list_repos
Jul 10, 2026
Merged

feat(list repos): add --search, --sort-direction and --tag filters#1013
mbevc1 merged 3 commits into
mainfrom
20260709_list_repos

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Expose the query parameters added to GET /api/v2/repos:

  • --search: filter repos by case-insensitive name substring (mutually exclusive with --name)
  • --sort-direction: sort repos by name asc (default) or desc
  • --tag: filter by tag key or key:value, repeatable

Mirrors the existing patterns in kosli list environments.

Expose the query parameters added to `GET /api/v2/repos`:

- `--search`: filter repos by case-insensitive name substring
  (mutually exclusive with --name)
- `--sort-direction`: sort repos by name asc (default) or desc
- `--tag`: filter by tag key or key:value, repeatable

Mirrors the existing patterns in `kosli list environments`.
@mbevc1 mbevc1 added enhancement New feature or request go Pull requests that update go code labels Jul 9, 2026
@claude

claude Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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


Claude PR Review

Static analysis — all clean:

  • go build ./...
  • go vet ./cmd/kosli/
  • go mod tidy (no changes to go.mod/go.sum)

Prior review feedback — both addressed ✅

  • Sort ordering now proven end-to-end. Tests 14g/14h set up three deterministically-named repos (sort-a/-b/-c) and assert the returned order reverses under --sort-direction desc, so the flag is genuinely wired through — this resolves the earlier concern that the test would pass even if the flag were dropped.
  • --tag uses StringArrayVar (listRepos.go:106), so each --tag is one literal entry and a tag value containing a comma won't be silently split. This follows the listControls.go convention and is the more correct choice for key:value inputs.

Code quality

  • Cleanly mirrors the established listEnvironments/listControls patterns: option struct fields, conditional params.Set, params.Add loop for repeatable --tag, and MarkFlagsMutuallyExclusive("name", "search").
  • Help text (long desc + examples) is thorough and accurately describes each new flag, including the --name/--search mutual exclusivity and the asc/desc default.
  • Nice test coverage: substring search (14a/14b), mutual-exclusion error (14c), tag key and key:value (14d/14e), non-matching tag (14f), both sort directions, and the pure-unit TestPrintReposListAsTableRendersBlankTagsCell for table rendering.

Minor / optional (non-blocking)

  • No client-side validation of --sort-direction. An invalid value (e.g. --sort-direction up) is passed straight to the server rather than rejected in validate(). This is consistent with listEnvironments (which also relies on the server), so it's a reasonable choice — just flagging that the error surfaces as a server response rather than a local usage error. No change needed unless you want to tighten it.

Summary

Solid, well-tested PR that faithfully mirrors existing conventions and has fully addressed both earlier review comments. No blocking issues. 👍

Comment thread cmd/kosli/listRepos_test.go Outdated
@mbevc1 mbevc1 enabled auto-merge (squash) July 9, 2026 21:51
Comment thread cmd/kosli/listRepos.go Outdated
@mbevc1 mbevc1 merged commit d809097 into main Jul 10, 2026
20 checks passed
@mbevc1 mbevc1 deleted the 20260709_list_repos branch July 10, 2026 05:32
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