Refactor matr to use a dedicated cli package#7
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the command runtime implementation into a dedicated github.com/euforic/matr/cli package while keeping the root github.com/euforic/matr package as the CLI launcher and a compatibility layer via type aliases.
Changes:
- Moved the runtime implementation (Matr, Task, Flag, Invocation) into the new
clipackage and re-exported types/constructors from the root package for compatibility. - Updated the generated runner template to instantiate and register tasks via
cli.New()/cli.Task/cli.Flag. - Updated and added tests to validate compatibility and ensure code generation uses the
clipackage; updated docs to describe the new package split.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| usage_test.go | Updates tests to use the new SetOutputs API instead of accessing unexported runtime fields. |
| template_test.go | Adds a regression test to ensure generated code imports/uses github.com/euforic/matr/cli. |
| template.go | Updates the runner template and flag type mapping to use the new cli runtime. |
| task.go | Converts root runtime types into compatibility aliases pointing at cli. |
| matr.go | Converts root Matr to a compatibility alias and forwards New() to cli.New(). |
| compatibility_test.go | Adds an API-compatibility test ensuring root aliases remain assignable to cli types and Run behavior works. |
| cli/task.go | Introduces cli definitions for tasks/flags/invocations/handler types. |
| cli/matr.go | Introduces the cli runtime implementation (ported from the former root runtime). |
| README.md | Documents the new cli package and compatibility behavior in the root package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
github.com/euforic/matr/cliTesting