@@ -18,6 +18,7 @@ import (
1818
1919 boatstack "github.com/operatorstack/boatstack/boatstack"
2020 "github.com/operatorstack/boatstack/boatstack/analysis"
21+ "github.com/operatorstack/boatstack/boatstack/distribution"
2122 "github.com/operatorstack/boatstack/boatstack/internal/kernel/catalog"
2223 "github.com/operatorstack/boatstack/boatstack/internal/kernel/model"
2324 "github.com/operatorstack/boatstack/boatstack/internal/kernel/protocol"
@@ -84,7 +85,7 @@ func run(arguments []string) error {
8485 if err != nil {
8586 return err
8687 }
87- kernel , err := boatstack . NewV2Kernel ( "" )
88+ kernel , err := standardKernel ( context . Background (), request )
8889 if err != nil {
8990 return err
9091 }
@@ -116,7 +117,7 @@ func runRPC() error {
116117 if err := decoder .Decode (& trailing ); err != io .EOF {
117118 return fmt .Errorf ("V2 RPC request contains trailing JSON" )
118119 }
119- kernel , err := boatstack . NewV2Kernel ( "" )
120+ kernel , err := standardKernel ( context . Background (), request )
120121 if err != nil {
121122 return err
122123 }
@@ -220,7 +221,7 @@ func parseOptions(command string, arguments []string, transition catalog.Transit
220221 flags .Var (& options .parameters , "param" , "transition parameter name=value (repeatable)" )
221222 flags .Var (& options .authorityReceipts , "authority-receipt" , "authority receipt JSON path (repeatable)" )
222223 flags .BoolVar (& options .follow , "follow" , false , "follow passive process events (events with jsonl only)" )
223- flags .StringVar (& options .host , "host" , options .host , "cli, cursor, codex, claude, gemini, or mcp" )
224+ flags .StringVar (& options .host , "host" , options .host , "cli, sdk, cursor, codex, claude, gemini, or mcp" )
224225 flags .StringVar (& options .command , "command" , "" , "raw command to classify at the guard boundary" )
225226 if err := flags .Parse (arguments ); err != nil {
226227 return commandOptions {}, err
@@ -245,7 +246,22 @@ func parseOptions(command string, arguments []string, transition catalog.Transit
245246 return options , nil
246247}
247248
248- func followEvents (kernel boatstack.V2Kernel , request surfaces.Request ) error {
249+ func standardKernel (ctx context.Context , request surfaces.Request ) (boatstack.Kernel , error ) {
250+ programRequest := distribution.RepositoryProgramRequest {
251+ Repository : request .Repository , Host : request .Host , CorrelationID : request .CorrelationID ,
252+ }
253+ if request .TransitionID == "installation.initialize" || request .TransitionID == "configuration.initialize" {
254+ programRequest .ConfigurationPath , _ = request .Parameters .Get ("config_path" )
255+ programRequest .ConfigurationFingerprint , _ = request .Parameters .Get ("config_sha256" )
256+ }
257+ program , err := distribution .StandardProgramForRepository (ctx , programRequest )
258+ if err != nil {
259+ return boatstack.Kernel {}, err
260+ }
261+ return boatstack .NewKernel ("" , program )
262+ }
263+
264+ func followEvents (kernel boatstack.Kernel , request surfaces.Request ) error {
249265 ctx , stop := signal .NotifyContext (context .Background (), os .Interrupt )
250266 defer stop ()
251267 encoder := json .NewEncoder (os .Stdout )
@@ -480,6 +496,9 @@ func renderResponse(response surfaces.Response, format string) error {
480496 case "mermaid" :
481497 fmt .Print (surfaces .RenderCatalogMermaid (response .Catalog ))
482498 return nil
499+ case "standard-flow-mermaid" :
500+ fmt .Print (surfaces .RenderStandardFlowMermaid (response .Catalog ))
501+ return nil
483502 case "locus-safety" :
484503 value , err := surfaces .RenderCatalogLocusSafety (response .Catalog )
485504 if err != nil {
@@ -518,7 +537,11 @@ func renderResponse(response surfaces.Response, format string) error {
518537 return nil
519538 }
520539 if response .Doctor != nil {
521- fmt .Printf ("healthy=%t transitions=%d snapshot=%s\n %s\n " , response .Doctor .Healthy , response .Doctor .TransitionCount , response .Doctor .Snapshot , response .Doctor .Detail )
540+ fmt .Printf ("healthy=%t kernel=%s core=%s@%s flow=%s@%s core_transitions=%d flow_transitions=%d extension_transitions=%d transitions=%d program=%s drift=%t snapshot=%s\n %s\n " ,
541+ response .Doctor .Healthy , response .Doctor .KernelVersion , response .Doctor .CoreSystemID , response .Doctor .CoreSystemVersion ,
542+ response .Doctor .PrimaryFlowID , response .Doctor .PrimaryFlowVersion , response .Doctor .CoreTransitionCount ,
543+ response .Doctor .FlowTransitionCount , response .Doctor .ExtensionTransitionCount , response .Doctor .TransitionCount ,
544+ response .Doctor .ProgramFingerprint , response .Doctor .UnresolvedProgramDrift , response .Doctor .Snapshot , response .Doctor .Detail )
522545 return nil
523546 }
524547 if response .Decision != nil {
0 commit comments