Skip to content

docs(repos): add usage examples to list repos and add pagination#1006

Merged
mbevc1 merged 7 commits into
mainfrom
20260708_repo_examples
Jul 9, 2026
Merged

docs(repos): add usage examples to list repos and add pagination#1006
mbevc1 merged 7 commits into
mainfrom
20260708_repo_examples

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Other kosli list * reference pages render an "Examples Use Cases" section from the command's Example field; list repos had none. Add examples covering the default listing, --name and --provider filters, and pagination, matching the style of list flows / list environments.

Also adds pagination and table headers to match backend defaults and behaviour.

Other `kosli list *` reference pages render an "Examples Use Cases"
section from the command's Example field; list repos had none. Add
examples covering the default listing, `--name` and `--provider` filters,
and pagination, matching the style of `list flows` / `list environments`.
@mbevc1 mbevc1 added the documentation Improvements or additions to documentation label Jul 8, 2026
@mbevc1 mbevc1 enabled auto-merge (squash) July 8, 2026 16:55
@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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


Review — PR #1006 · docs(repos): add usage examples & pagination

  • Gather context (read diff & changed files)
  • Phase 1: Static analysis (build, vet, mod tidy)
  • Phase 2: Code review
  • Phase 3: Acknowledge good work

Phase 1 — Static analysis ✅

Check Result
go build ./... ✅ passes
go vet ./cmd/kosli/ ✅ clean
go mod tidy + git diff go.mod go.sum ✅ no changes

Phase 2 — Code review

This is a clean, well-scoped PR and the iterative review rounds already resolved the substantive points. Confirming the current state:

  • Non-default page size — the example (--page-limit 25) and the pagination test now use 25, so the flag's effect is visible rather than mirroring the default 15. ✅
  • Accurate long descriptionlistReposLongDesc now states results are always paginated (first page, 15/page by default), matching the actual runtime behavior where run unconditionally sends page/per_page (listRepos.go:87-88). This correctly diverges from the list flows wording. ✅
  • Footer + headersprintReposListAsTable now renders the NAME/URL/PROVIDER/TAGS header and a Showing page X of Y, total Z repos footer, backed by the new listReposResponse envelope. ✅
  • Consistent page source — both the empty-list message and the footer read response.Page (documented in the inline comment at listRepos.go:134-136), so the two paths can't disagree. ✅

Minor / non-blocking observations:

  1. printReposListAsTable(raw string, out io.Writer, page int) — the page parameter is now unused (the body reads response.Page throughout). It's required to satisfy the shared output.FormatOutputFunc signature, so this is fine and not a regression; just noting it in case a linter ever flags it.
  2. Footer is appended unconditionally (no if pagination != nil guard like printFlowsListAsTable). Already discussed in-thread — acceptable given the endpoint always paginates and always returns these fields.

Testing — good coverage: the pagination case, --name/--provider/--repo-id filters, empty-result messaging, blank-TAGS rendering, and a standalone unit test (TestPrintReposListAsTableRendersBlankTagsCell) asserting header + footer without a live server. Test page size matches the documented example.

Phase 3 — Good work 👍

  • Introducing listReposResponse as a named type cleans up the previous anonymous-struct unmarshal and makes the pagination fields explicit.
  • The examples closely mirror the list flows / list environments style, giving the reference docs a consistent "Example Use Cases" section.
  • The standalone table-rendering unit test is a nice touch — it exercises the formatting logic deterministically without depending on the local Kosli server.

Verdict: LGTM. All prior review concerns are addressed; no blocking issues.
· 20260708_repo_examples

@mbevc1 mbevc1 disabled auto-merge July 8, 2026 17:00
@mbevc1 mbevc1 enabled auto-merge (squash) July 8, 2026 17:05
Comment thread cmd/kosli/listRepos.go Outdated
Comment thread cmd/kosli/listRepos.go Outdated
@mbevc1 mbevc1 disabled auto-merge July 8, 2026 17:19
The list repos endpoint always paginates (page 1, 15 per page by
default, max 50) with no unpaginated "return all" mode, so correct the
long description and example accordingly. Surface the page context in
table output with a "Showing page X of Y, total Z repos" footer from
the response envelope, mirroring list controls/environments/flows, and
make the no-repos message page-aware. Covered by a server-free unit
test plus an integration assertion.
@mbevc1 mbevc1 force-pushed the 20260708_repo_examples branch from 17bbc08 to 78959c9 Compare July 8, 2026 21:14
Comment thread cmd/kosli/listRepos.go
`--page-limit 15` equalled the default, making the flag look like a no-op;
use 25 (matching the sibling commands' examples) so the flag's effect is
clear, and update the comment to match.
@mbevc1 mbevc1 force-pushed the 20260708_repo_examples branch from 1772e75 to e126a06 Compare July 8, 2026 21:21
@mbevc1 mbevc1 changed the title docs(repos): add usage examples to list repos docs(repos): add usage examples to list repos and add pagination Jul 8, 2026
`--page-limit 15` equalled the default, so the value demonstrated nothing
distinct from an unparameterised call; use 25 to match the example.
@mbevc1 mbevc1 force-pushed the 20260708_repo_examples branch from 27162c7 to a0a50c0 Compare July 8, 2026 21:26
Comment thread cmd/kosli/listRepos.go
The empty-list message read the requested page argument while the
footer read response.Page. They agree in practice, but sourcing both
from the response envelope removes the divergence and keeps the page
number consistent with the total_pages/total_count shown beside it.
@mbevc1 mbevc1 force-pushed the 20260708_repo_examples branch from ebe22df to 615c8e5 Compare July 8, 2026 21:42
@mbevc1 mbevc1 enabled auto-merge (squash) July 8, 2026 21:45
@mbevc1 mbevc1 merged commit 3f754b0 into main Jul 9, 2026
20 checks passed
@mbevc1 mbevc1 deleted the 20260708_repo_examples branch July 9, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants