fix(cli): restore --stats flag lost in Cobra migration
The --stats flag was not carried over when the CLI was migrated from manual os.Args parsing to Cobra commands. Add it back to the gateway command and forward enableStats to NewAgentLoop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0a82e1a7ac
commit
8ca3e84a2c
2 changed files with 5 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ func NewGatewayCommand() *cobra.Command {
|
||||||
var (
|
var (
|
||||||
debug bool
|
debug bool
|
||||||
orchestration bool
|
orchestration bool
|
||||||
|
enableStats bool
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
|
@ -16,12 +17,13 @@ func NewGatewayCommand() *cobra.Command {
|
||||||
Short: "Start picoclaw gateway",
|
Short: "Start picoclaw gateway",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(_ *cobra.Command, _ []string) error {
|
RunE: func(_ *cobra.Command, _ []string) error {
|
||||||
return gatewayCmd(debug, orchestration)
|
return gatewayCmd(debug, orchestration, enableStats)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flags().BoolVarP(&debug, "debug", "d", false, "Enable debug logging")
|
cmd.Flags().BoolVarP(&debug, "debug", "d", false, "Enable debug logging")
|
||||||
cmd.Flags().BoolVar(&orchestration, "orchestration", false, "Enable subagent orchestration")
|
cmd.Flags().BoolVar(&orchestration, "orchestration", false, "Enable subagent orchestration")
|
||||||
|
cmd.Flags().BoolVar(&enableStats, "stats", false, "Enable stats tracking")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import (
|
||||||
"github.com/sipeed/picoclaw/pkg/tools"
|
"github.com/sipeed/picoclaw/pkg/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func gatewayCmd(debug bool, orchestration bool) error {
|
func gatewayCmd(debug bool, orchestration bool, enableStats bool) error {
|
||||||
if debug {
|
if debug {
|
||||||
logger.SetLevel(logger.DEBUG)
|
logger.SetLevel(logger.DEBUG)
|
||||||
fmt.Println("🔍 Debug mode enabled")
|
fmt.Println("🔍 Debug mode enabled")
|
||||||
|
|
@ -72,7 +72,7 @@ func gatewayCmd(debug bool, orchestration bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
msgBus := bus.NewMessageBus()
|
msgBus := bus.NewMessageBus()
|
||||||
agentLoop := agent.NewAgentLoop(cfg, msgBus, provider)
|
agentLoop := agent.NewAgentLoop(cfg, msgBus, provider, enableStats)
|
||||||
|
|
||||||
// Print agent startup info
|
// Print agent startup info
|
||||||
fmt.Println("\n📦 Agent Status:")
|
fmt.Println("\n📦 Agent Status:")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue