Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cmd/picoclaw/internal/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,30 @@ func NewAgentCommand() *cobra.Command {
sessionKey string
model string
debug bool
remoteURL string
token string
)

cmd := &cobra.Command{
Use: "agent",
Short: "Interact with the agent directly",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
if remoteURL != "" {
remoteSessionKey := sessionKey
if !cmd.Flags().Changed("session") {
remoteSessionKey = ""
}
return remoteAgentCmd(
cmd.Context(),
remoteURL,
token,
message,
remoteSessionKey,
cmd.InOrStdin(),
cmd.OutOrStdout(),
)
}
return agentCmd(message, sessionKey, model, debug)
},
}
Expand All @@ -25,6 +42,13 @@ func NewAgentCommand() *cobra.Command {
cmd.Flags().StringVarP(&message, "message", "m", "", "Send a single message (non-interactive mode)")
cmd.Flags().StringVarP(&sessionKey, "session", "s", "cli:default", "Session key")
cmd.Flags().StringVarP(&model, "model", "", "", "Model to use")
cmd.Flags().StringVar(
&remoteURL,
"remote",
"",
"Connect to a remote Pico WebSocket URL, e.g. ws://host:18790/pico/ws",
)
cmd.Flags().StringVar(&token, "token", "", "Bearer token for remote Pico auth")

return cmd
}
2 changes: 2 additions & 0 deletions cmd/picoclaw/internal/agent/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ func TestNewAgentCommand(t *testing.T) {
assert.NotNil(t, cmd.Flags().Lookup("message"))
assert.NotNil(t, cmd.Flags().Lookup("session"))
assert.NotNil(t, cmd.Flags().Lookup("model"))
assert.NotNil(t, cmd.Flags().Lookup("remote"))
assert.NotNil(t, cmd.Flags().Lookup("token"))
}
Loading