Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- List the commands in `clickclack help`, `-h`, and `--help` instead of only the client flags; `clickclack help` no longer fails with `unknown command "help"`. Thanks @KrasimirKralev.

## 0.9.4 - 2026-11-05

**Highlights:** Clearer client configuration and signed-out session errors, with refreshed desktop and database dependencies.
Expand Down
38 changes: 38 additions & 0 deletions apps/api/cmd/clickclack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func client(args []string) error {
opts := defaults.opts
flags := flag.NewFlagSet("clickclack", flag.ExitOnError)
addClientFlags(flags, &opts)
flags.Usage = func() { printUsage(flags) }
if err := flags.Parse(args); err != nil {
return err
}
Expand All @@ -64,6 +65,9 @@ func client(args []string) error {
}
c := apiClient{opts: opts, defaults: defaults, http: &http.Client{Timeout: 10 * time.Second}}
switch rest[0] {
case "help":
printUsage(flags)
return nil
case "login":
return c.login(rest[1:])
case "logout":
Expand Down Expand Up @@ -147,6 +151,40 @@ func sameServer(left, right string) bool {
return strings.TrimRight(left, "/") == strings.TrimRight(right, "/")
}

// Keep in sync with the command block in docs/cli.md.
const usageCommands = `Usage: clickclack <command> [flags]

Commands:
serve run the HTTP/WebSocket server (default if no command given)
migrate apply embedded SQL migrations
admin bootstrap, FakeCo seed, user create, member add, invite create, bot create, events prune, magic-link create, webpush keygen
backup write a SQLite backup file
export write a JSON dump to a file or stdout
version print the binary version
help show this help
login consume a magic-link token and store/print a session token
logout revoke the stored session and remove stored client credentials
whoami print the current server-side user
status print selected server/user/workspace/channel
canary prove a human ClickClack -> OpenClaw -> quoted bot reply round trip
workspaces list
channels list
send
messages send
messages list
threads open
threads reply
reactions add
reactions remove

Client flags (before the command or on the command itself):
`

func printUsage(flags *flag.FlagSet) {
fmt.Fprint(flags.Output(), usageCommands)
flags.PrintDefaults()
}

func addClientFlags(flags *flag.FlagSet, opts *clientOptions) {
flags.StringVar(&opts.Server, "server", opts.Server, "ClickClack server URL")
flags.StringVar(&opts.Token, "token", opts.Token, "session bearer token")
Expand Down
16 changes: 16 additions & 0 deletions apps/api/cmd/clickclack/client_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,19 @@ func TestDefaultClientOptionsIsQuietWithValidConfig(t *testing.T) {
t.Fatalf("defaults = %+v, want the stored server", defaults)
}
}

func TestHelpListsCommandsAndClientFlags(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
var err error
output := captureStderr(t, func() {
err = runArgs([]string{"clickclack", "help"})
})
if err != nil {
t.Fatalf("help returned %v", err)
}
for _, want := range []string{"Commands:", " serve ", " admin ", " login ", " messages list", "-server", "-workspace"} {
if !strings.Contains(output, want) {
t.Fatalf("help output missing %q:\n%s", want, output)
}
}
}
5 changes: 5 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Commands:
admin bootstrap, FakeCo seed, user create, member add, invite create, bot create, events prune, magic-link create, webpush keygen
backup write a SQLite backup file
export write a JSON dump to a file or stdout
version print the binary version
help show this help
login consume a magic-link token and store/print a session token
logout revoke the stored session and remove stored client credentials
whoami print the current server-side user
Expand All @@ -36,6 +38,9 @@ Commands:
reactions remove
```

`clickclack help`, `clickclack -h`, and `clickclack --help` print this command
list followed by the client flags.

Client commands accept these common flags before the command or on the command
itself:

Expand Down
Loading