From d469688408cfd140d2381a751db2a12d6c666dba Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 7 Aug 2026 08:17:26 +0000 Subject: [PATCH] fix(hermes): This moves one existing conditional out of runMain, reducing its cognitive complexity below the threshold. The helper receives the identical args[2:] slice, calls the same command, logs the same error text, and returns the same status codes. (incident sonar/ananke/go:S3776/AZ-IckhO1fRfbdzqD-5r) --- cmd/ananke/main_dispatch.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/ananke/main_dispatch.go b/cmd/ananke/main_dispatch.go index 851bf12..dd4ddef 100644 --- a/cmd/ananke/main_dispatch.go +++ b/cmd/ananke/main_dispatch.go @@ -66,10 +66,7 @@ func runMain(logger *log.Logger, args []string) int { return 1 } case "intent": - if err := intentCommand(logger, args[2:]); err != nil { - logger.Printf("intent failed: %v", err) - return 1 - } + return runIntentCommand(logger, args[2:]) case "help", "-h", "--help": usage() default: @@ -80,6 +77,14 @@ func runMain(logger *log.Logger, args []string) int { return 0 } +func runIntentCommand(logger *log.Logger, args []string) int { + if err := intentCommand(logger, args); err != nil { + logger.Printf("intent failed: %v", err) + return 1 + } + return 0 +} + // usage runs one orchestration or CLI step. // Signature: usage(). // Why: keeps behavior explicit so startup/shutdown workflows remain maintainable as services evolve.