Skip to content

Refactor matr to use a dedicated cli package#7

Merged
euforic merged 1 commit into
mainfrom
feat/extract-cli-pkg
Mar 20, 2026
Merged

Refactor matr to use a dedicated cli package#7
euforic merged 1 commit into
mainfrom
feat/extract-cli-pkg

Conversation

@euforic

@euforic euforic commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • extract the generated command runtime into github.com/euforic/matr/cli
  • keep the root package as the launcher plus compatibility aliases for existing Matrfiles
  • update generated runners and docs to point at the new cli runtime

Testing

  • go test ./...
  • go vet ./...
  • golangci-lint run ./...

Copilot AI review requested due to automatic review settings March 20, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown

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 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 cli package 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 cli package; 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.

@euforic euforic merged commit e936394 into main Mar 20, 2026
5 checks passed
@euforic euforic deleted the feat/extract-cli-pkg branch March 20, 2026 22:18
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