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), executionCommand("run", "Execute a session pipeline.", false, deps, executor), commandkit.Group("artifacts", "Inspect and regenerate configured artifacts.", artifactCatalogCommand(deps), executionCommand("regenerate", "Rebuild extraction and analysis artifacts.", true, deps, executor)), commandkit.Group("session", "Manage and inspect sessions.", sessionPlanCommand(deps), sessionValidationCommand(deps), sessionStateCommand("status", true, deps), sessionStateCommand("artifacts", false, deps)), ) } // 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) }