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)

This commit is contained in:
Hermes Agent 2026-08-07 08:17:26 +00:00
parent 76876ef895
commit d469688408

View File

@ -66,10 +66,7 @@ func runMain(logger *log.Logger, args []string) int {
return 1 return 1
} }
case "intent": case "intent":
if err := intentCommand(logger, args[2:]); err != nil { return runIntentCommand(logger, args[2:])
logger.Printf("intent failed: %v", err)
return 1
}
case "help", "-h", "--help": case "help", "-h", "--help":
usage() usage()
default: default:
@ -80,6 +77,14 @@ func runMain(logger *log.Logger, args []string) int {
return 0 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. // usage runs one orchestration or CLI step.
// Signature: usage(). // Signature: usage().
// Why: keeps behavior explicit so startup/shutdown workflows remain maintainable as services evolve. // Why: keeps behavior explicit so startup/shutdown workflows remain maintainable as services evolve.