feat: add project groups and --group filter - #56
Open
temp wants to merge 1 commit into
Open
Conversation
Groups are named sets of projects defined in the config file and can be
targeted with --group instead of spelling out directories every time:
groups:
backend: [api, libs/shared]
gogo exec --group backend "npm test"
Multiple groups are combined as a union; --group intersects with the
existing filters. Predefined commands can name their groups via the new
"groups" key, which a --group flag on the command line overrides.
Group and command cross-references are resolved lazily rather than while
reading a config, so a group that references a project living in an
overlay that is not loaded does not break unrelated commands. Using such
a group reports the problem, and gogo validate checks all references
against the merged config.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Groups are named sets of projects defined in the config file. They can be targeted with
--groupinstead of spelling out directories every time.JSON works the same way. Like the other filters,
--groupis also available as a persistent root flag, and it combines with--include-only/--exclude-only/ the patterns via AND. A--groupflag on the command line replaces thegroupsfrom a command definition.Implementation
internal/config:MetaConfig.Groups,CommandConfig.Groups,ResolveGroups(union, deduplicated, sorted),GetGroupNames/GetGroup; merge rule for overlays (the overlay wins per group name);RemoveProjectkeeps groups consistent.internal/filter: new first filter stageOptions.GroupOnly— exact path match, no basename match, since group members are config keys.internal/cli:--groupflag inaddFilterFlagsand in the root persistent flags;resolveFilterOptionsWithConfigresolves group names against the merged config and only reads the config when--groupis used.Design decision: references are resolved lazily
Group and command cross-references are not validated while reading a config. Otherwise a group referencing a project that lives in an overlay which is not loaded would break every unrelated command — that runs against the whole point of overlays. Instead:
Validateonly checks a single file structurally (name not empty, at least one member).ResolveGroupsreports bad references when a group is actually used:unknown group "nope". Available groups: backend, frontend.gogo validatechecks all references against the merged config (config.ValidateReferences), which also surfaces errors that used to be swallowed silently.Tests
go test -race ./...passes,go vetis clean. New tests ininternal/config/config_test.go,internal/filter/filter_test.go,internal/cli/group_test.goandinternal/cli/validate_test.go: resolving single and multiple groups, dedupe, unknown group, intersection withinclude-only/exclude-only, groups from JSON and YAML, overlay merge, write/read round-trip, command groups,RemoveProjectcleanup, lazy reference resolution, and thegogo validatereport.Also verified end-to-end with the built binary against a real project, including a group defined in an overlay and a broken reference.
make lintdid not run locally —golangci-lintis not installed here; CI covers it.🤖 Generated with Claude Code