2026-05-02 10:37:38 -05:00
package app
import (
"context"
2026-11-20 04:13:05 +00:00
"gitea.maximumdirect.net/eric/narratio/internal/buildinfo"
"go.maximumdirect.net/commandkit"
)
2026-08-29 18:19:54 +00:00
2026-11-20 04:13:05 +00:00
// NewApplication constructs the native command boundary without acquiring configuration
// or initializing external services.
func NewApplication ( ) ( * commandkit . App , error ) {
return newApplication ( commandDependencies { } , executePlan )
2026-09-04 01:21:37 +00:00
}
2026-11-20 04:13:05 +00:00
func newApplication ( deps commandDependencies , executor pipelineExecutor ) ( * commandkit . App , error ) {
return commandkit . New (
commandkit . Identity { Name : "narratio" , Version : buildinfo . Version } ,
2026-11-20 05:02:46 +00:00
configurationCommand ( deps ) ,
2026-11-20 05:10:04 +00:00
executionCommand ( "run" , "Execute a session pipeline." , false , deps , executor ) ,
2026-11-20 05:15:43 +00:00
commandkit . Group ( "artifacts" , "Inspect and regenerate configured artifacts." , artifactCatalogCommand ( deps ) , executionCommand ( "regenerate" , "Rebuild extraction and analysis artifacts." , true , deps , executor ) ) ,
2026-11-20 05:23:32 +00:00
commandkit . Group ( "session" , "Manage and inspect sessions." , sessionPlanCommand ( deps ) , sessionValidationCommand ( deps ) , sessionStateCommand ( "status" , true , deps ) , sessionStateCommand ( "artifacts" , false , deps ) ) ,
2026-11-20 04:13:05 +00:00
)
2026-09-05 17:53:56 +00:00
}
2026-11-20 04:13:05 +00:00
// 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 ( )
2026-05-02 10:37:38 -05:00
if err != nil {
2026-11-20 04:13:05 +00:00
return operationOutcome ( err )
2026-05-02 10:37:38 -05:00
}
2026-11-20 04:13:05 +00:00
return application . Execute ( ctx , args , streams )
2026-05-02 10:37:38 -05:00
}