feat(cli): load quickstart catalogs using in-memory repository clone#6365
feat(cli): load quickstart catalogs using in-memory repository clone#6365sachin9058 wants to merge 2 commits intomindersec:mainfrom
Conversation
|
Is this building on #6364? Without referencing related PRs, it's a little hard to track whether some PRs should be reviewed before others. |
|
@evankanderson Yes this builds on #6364. #6364 introduces the Happy to rebase or adjust the ordering if you'd prefer these to be reviewed/merged in a specific sequence. |
I'm just trying to figure out what the long-term code shape looks like -- if we were to merge these two PRs and then you were to go off and do something entirely different, would it be clear to a future contributor what the next steps were? I think the plan is:
Is that about right? |
@evankanderson Yes, that’s very close to what I had in mind. The idea is to build the quickstart flow around dynamically discovering profiles and rules from a repository, rather than relying on embedded catalogs. Your outlined steps match the intended direction:
One thing I’m thinking about is keeping the catalog discovery and selection logic separate from the CLI interaction, so it can be reused or extended later (e.g., for non-interactive flows). Happy to adjust the implementation to better align with this structure if you’d prefer a different breakdown. |
We haven't been perfect about this, but in general I'd like to see complex logic isolated from |
@evankanderson That makes sense — I agree with keeping the more complex catalog loading and discovery logic out of Right now some of that logic is still living in the command, but I can refactor it so that:
This should make the flow easier to follow and also reusable for non-interactive use cases later. Happy to restructure this in this PR if you’d prefer, or follow up with a separate refactor. |
|
I think we're iterating in #6364 and will get back to this after that review has settled the underlying file loading (at which point, this might have space to adopt higher-level features). |
Summary
Depends on #6364
Update the
quickstartcommand to dynamically load rule and profile catalogs from a remote repository using an in-memory git clone.Previously, the quickstart flow relied on embedded/static catalog data and installed a limited set of rules. This change enables loading catalogs directly from a repository at runtime, improving flexibility and aligning with the direction discussed in #6339.
The clone operation is performed inline using go-git with in-memory storage, avoiding filesystem side effects and keeping the CLI lightweight. If cloning or parsing fails, the existing embedded catalog flow is used as a fallback to preserve backward compatibility.
This addresses part of #6339 by enabling dynamic catalog loading from a repository.
Testing
make lint-fix go test ./...go run ./cmd/cli quickstart