Commit Graph
3 Commits
Author SHA1 Message Date
clawbot 9ce902fb05 Take the chat client's port from Run's caller (closes #4)
check / check (push) Successful in 1m8s
The test that runs the whole bot started its stand-in chat client on
5225, the port a real simplex-chat uses, so on a machine where one
listens there the test would have sent it the bot's set-up commands.
Run now takes the chat client's port: the run command passes
bot.ChatPort (5225), and the test a port it found free.

Model: opus-5-5
2026-09-29 02:08:56 +00:00
clawbot 17d6be9fe1 HTTP API: server, credential and the list of chats (closes #4)
check / check (push) Successful in 1m1s
The bot now serves an HTTP API on PORT (default 8080) beside the chat
client. Every request needs the credential read at startup from the
file named by API_TOKEN_FILE, sent as a bearer token; without one,
every request is refused. Responses carry the security headers, bodies
are capped at 64 KiB and each request's work at 10 seconds.

GET /api/v1/chats lists the bot's contacts from the chat client's
/_contacts command, ordered by id, and marks the contacts who deleted
their chat with the bot, which the chat client keeps listing. bot.Run
starts the API after set-up and stops it within 5 seconds; a listener
failure ends the bot as a chat client failure does.

Model: opus-5-5
2026-09-29 00:37:57 +00:00
clawbot 09a5caa8ab Move the command tree into internal/cli (closes #8)
check / check (push) Successful in 1m40s
`cmd/simplexcalc/` now holds only `main.go`, whose body is one call, `os.Exit(cli.Main(version))`, as the Go style guide requires. The command tree and the `run` and `version` commands moved unchanged into `internal/cli`, with tests for `version` and for an unknown command. Output streams, exit statuses and the `-X main.version` build flag are as before.

Disclosure: the comment in `execute` saying cobra has already printed the error is false, since the root command silences cobra's errors; it moved unchanged and is left for a follow-up.

Model: opus-5-5
2026-09-29 01:51:34 +02:00