Skip to content

revamp the cscli hub list output to make it human friendly#4564

Open
buixor wants to merge 5 commits into
masterfrom
cscli-hub-list-imp
Open

revamp the cscli hub list output to make it human friendly#4564
buixor wants to merge 5 commits into
masterfrom
cscli-hub-list-imp

Conversation

@buixor

@buixor buixor commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
image

Copilot AI review requested due to automatic review settings July 16, 2026 13:23
@github-actions

Copy link
Copy Markdown

@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@github-actions

Copy link
Copy Markdown

@buixor: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR revamps cscli hub list to be more human-friendly by defaulting to a collection-centric overview (with nesting), while keeping script-oriented outputs intact and adding status filtering and a new hub search command.

Changes:

  • Reworks cscli hub list human output into an overview tree (installed root collections + standalone installed items) and a compact flat table for -a.
  • Introduces single-word item status computation and a --status filter shared by hub list and the new hub search command.
  • Updates BATS tests to assert the new output structure and behaviors (nesting, taint display, status filtering, search output).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/bats/20_hub.bats Updates/expands BATS coverage for the new list/search UX, nesting, and status filtering behavior.
pkg/cwhub/state.go Adds single-word status constants and ItemState.Status() used by the new CLI views/filters.
pkg/cwhub/item.go Adds InstalledParents() helper to distinguish installed ancestry from index ancestry.
cmd/crowdsec-cli/clisupport/support.go Changes hub dump in support bundle to list all installed items (not overview-only).
cmd/crowdsec-cli/cliitem/cmdremove.go Switches to InstalledParents() for clearer parent collection reporting.
cmd/crowdsec-cli/clihub/utils_table.go Implements new compact and overview table rendering (tree indentation, details column).
cmd/crowdsec-cli/clihub/search.go Adds cscli hub search (term-based local index search with optional status filtering).
cmd/crowdsec-cli/clihub/items.go Adds status filter helpers and installed-root/standalone selection helpers.
cmd/crowdsec-cli/clihub/hub.go Wires in the new list modes, --status support, and registers the new search subcommand.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cwhub/state.go
Comment on lines +58 to +74
// Status returns the item's state as a single mutually-exclusive word (see the Status* constants).
// Taint is only reported for installed items: it propagates to ancestor collections even when they
// are not installed themselves.
func (s *ItemState) Status() string {
switch {
case !s.IsInstalled():
return StatusNotInstalled
case s.Tainted:
return StatusTainted
case s.IsLocal():
return StatusLocal
case !s.UpToDate:
return StatusOutdated
default:
return StatusUpToDate
}
}
Comment thread cmd/crowdsec-cli/clisupport/support.go
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.92642% with 66 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.82%. Comparing base (0a79ef8) to head (a93b57a).

Files with missing lines Patch % Lines
cmd/crowdsec-cli/clihub/utils_table.go 63.90% 42 Missing and 6 partials ⚠️
cmd/crowdsec-cli/clihub/search.go 85.71% 4 Missing and 3 partials ⚠️
cmd/crowdsec-cli/clihub/hub.go 83.33% 4 Missing and 2 partials ⚠️
cmd/crowdsec-cli/clisupport/support.go 57.14% 1 Missing and 2 partials ⚠️
pkg/cwhub/state.go 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4564      +/-   ##
==========================================
+ Coverage   63.75%   63.82%   +0.07%     
==========================================
  Files         507      508       +1     
  Lines       38652    38929     +277     
==========================================
+ Hits        24644    24848     +204     
- Misses      11650    11714      +64     
- Partials     2358     2367       +9     
Flag Coverage Δ
bats 41.90% <77.92%> (+0.25%) ⬆️
unit-linux 39.80% <2.34%> (-0.26%) ⬇️
unit-windows 28.37% <2.34%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@buixor

buixor commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

/area cscli
/kind enhancement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cscli kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants