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
This commit was merged in pull request #9.
This commit is contained in:
2026-09-29 01:51:34 +02:00
parent 16649e0f2f
commit 09a5caa8ab
8 changed files with 116 additions and 21 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
---
title: Agent Guidance
last_modified: 2026-09-26
last_modified: 2026-09-28
---
This file is the single source of guidance for any automated agent
@@ -118,9 +118,10 @@ Do not weaken them.
## Layout
```
cmd/simplexcalc/ cobra command tree; main(), run and version
cmd/simplexcalc/ main(), a single call into internal/cli
internal/bot/ startup, address setup, and the reply to a message
internal/calc/ the arithmetic: go/parser and go/constant
internal/cli/ cobra command tree: run and version
internal/config/ viper-backed configuration; the abort-on-garbage rule
internal/logger/ log/slog, JSON always
internal/simplex/ the simplex-chat child process and its WebSocket API