mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-28 23:27:04 +08:00
060712a287
`main()` called `cli()` without any error handling, so a failure to reach the
AdGuardHome API surfaced as a chained urllib3/requests/click traceback. In
`--json` mode nothing at all was written to stdout, leaving an agent with no
parsable result.
The Docker hint inside that error message also mapped the host port to itself
(`-p 3001:3001`), which cannot reach a fresh container: the image serves its web
interface on container port 3000, as the harness's own E2E fixture and README
already assume.
- catch RuntimeError and requests exceptions in `main()`: emit
`{"error": ...}` on stdout with `--json`, the plain message on stderr
otherwise, exit 1 in both cases
- map the Docker hint to container port 3000 and mention that the wizard must
keep the web interface there
- cover both paths with tests: JSON shape and exit status on an unreachable
host, plain-message path on stderr, and the port mapping in the hint
Fixes #437
Claude-Session: https://claude.ai/code/session_01ChPxA9ksnNqr83nLbfMhwu
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>