feat(init): scaffold app flavor manifests#54
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51aaf5d4cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return nil | ||
| } | ||
|
|
||
| var flavorKeyPattern = regexp.MustCompile(`^[a-z][a-z0-9-]{1,31}$`) |
There was a problem hiding this comment.
Align flavor validation with push input contract
init now rejects flavor keys that push accepts, because this regex requires at least two characters and only [a-z0-9-] after the first letter. For example, --flavor=v is rejected during grounds init even though grounds push trims and forwards arbitrary non-empty flavor strings, so valid existing flavor naming conventions can no longer be scaffolded by the CLI.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR extends grounds init to optionally scaffold a flavor-scoped manifest (grounds init --flavor=<key>) that aligns with the existing grounds push --flavor workflow, while keeping legacy top-level runtime fields valid. It also updates the README to document the flavor workflow and the behavior when jar is omitted (Gradle artifact auto-detection).
Changes:
- Add
--flavortogrounds init, rendering runtime fields underflavors.<key>when provided. - Make
--jaroptional and reject glob patterns, relying on Gradle artifact auto-detection when omitted. - Update README and add/extend unit tests for the new init scaffolding behavior and validations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents init/push flavor workflow and jar auto-detection when omitted. |
| cmd/grounds/commands/init.go | Adds --flavor, makes --jar optional, validates inputs, and renders flavor-scoped YAML when requested. |
| cmd/grounds/commands/init_test.go | Adds coverage for flavor YAML rendering, explicit jar handling, and new validation errors. |
Comments suppressed due to low confidence (1)
cmd/grounds/commands/init_test.go:142
- This test also doesn't set
cmd.SetOut/cmd.SetErr, so it will print the init status output to the test runner. Route output to a buffer to avoid pollutinggo testoutput.
cmd := NewInitCommand()
cmd.SetArgs([]string{
"--app-name=plugin-config",
"--type=plugin-paper",
"--base-image=paper",
"--flavor=paper",
"--jar=paper/build/libs/plugin-config-paper.jar",
})
if err := cmd.Execute(); err != nil {
t.Fatalf("execute: %v", err)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Non-interactive when all flags supplied | ||
| if f.appName != "" && f.type_ != "" && f.baseImage != "" { | ||
| if err := validateBaseImageChoice(catalog, f.type_, f.baseImage); err != nil { | ||
| return err | ||
| } | ||
| if err := validateJarPath(f.jar); err != nil { | ||
| return err | ||
| } | ||
| if err := validateFlavorKey(f.flavor); err != nil { | ||
| return err | ||
| } |
| cmd := NewInitCommand() | ||
| cmd.SetArgs([]string{ | ||
| "--app-name=my-plugin", | ||
| "--type=plugin-paper", | ||
| "--base-image=paper", | ||
| "--jar=paper/build/libs/my-plugin.jar", | ||
| }) | ||
| if err := cmd.Execute(); err != nil { | ||
| t.Fatalf("execute: %v", err) | ||
| } |
Pull Request
Description
Adds
grounds init --flavor=<key>so init can scaffold app-flavor manifests that match the existinggrounds push --flavorcontract. Legacy top-level runtime manifests remain valid, and explicit JAR paths are nested under the selected flavor when provided.The README now documents the init and push flavor workflow, including the artifact-detection behavior when
jaris omitted.Type of Change
Related Issues
Testing
/home/lukas/.local/bin/pkgx go test ./...Checklist