Files
narratio/internal/app/commands.go

34 lines
1.1 KiB
Go

package app
import (
"context"
"gitea.maximumdirect.net/eric/narratio/internal/buildinfo"
"go.maximumdirect.net/commandkit"
)
// NewApplication constructs the native command boundary without acquiring configuration
// or initializing external services.
func NewApplication() (*commandkit.App, error) {
return newApplication(commandDependencies{}, executePlan)
}
func newApplication(deps commandDependencies, executor pipelineExecutor) (*commandkit.App, error) {
return commandkit.New(
commandkit.Identity{Name: "narratio", Version: buildinfo.Version},
configurationCommand(deps),
commandkit.Group("artifacts", "Inspect and regenerate configured artifacts."),
commandkit.Group("session", "Manage and inspect sessions."),
)
}
// Execute runs an invocation with caller-owned context and streams and returns
// its finalized native outcome. The process boundary owns exit handling.
func Execute(ctx context.Context, args []string, streams commandkit.Streams) commandkit.Outcome {
application, err := NewApplication()
if err != nil {
return operationOutcome(err)
}
return application.Execute(ctx, args, streams)
}