Skip to content

feat(init): scaffold app flavor manifests#54

Merged
lusu007 merged 1 commit into
mainfrom
feat/init-app-flavors
May 21, 2026
Merged

feat(init): scaffold app flavor manifests#54
lusu007 merged 1 commit into
mainfrom
feat/init-app-flavors

Conversation

@lusu007
Copy link
Copy Markdown
Contributor

@lusu007 lusu007 commented May 21, 2026

Pull Request

Description

Adds grounds init --flavor=<key> so init can scaffold app-flavor manifests that match the existing grounds push --flavor contract. 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 jar is omitted.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • ♻️ Refactoring
  • 📚 Documentation
  • 🔧 Chore

Related Issues

  • None

Testing

  • Unit tests pass: /home/lukas/.local/bin/pkgx go test ./...
  • Manual testing completed
  • New tests added for new functionality

Checklist

  • I have performed a self-review of my own code
  • Tests have been added/updated and pass (if needed)
  • Documentation has been updated (if needed)

@lusu007 lusu007 marked this pull request as ready for review May 21, 2026 14:42
Copilot AI review requested due to automatic review settings May 21, 2026 14:42
@lusu007 lusu007 merged commit 4a657e2 into main May 21, 2026
7 checks passed
@lusu007 lusu007 deleted the feat/init-app-flavors branch May 21, 2026 14:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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}$`)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

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 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 --flavor to grounds init, rendering runtime fields under flavors.<key> when provided.
  • Make --jar optional 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 polluting go test output.
	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.

Comment on lines 45 to +55
// 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
}
Comment on lines +55 to +64
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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants