Repository navigation
sop-mcp-server: help, version, usage errors, and JSON output - #499
Conversation
… check and demo Thanks, Gerard Recinto
Gemini PR ReviewReviewed commit:
This result blocks merge. Push a fix and comment |
|
/gemini review |
Gemini PR ReviewReviewed commit:
This result blocks merge. Push a fix and comment |
|
/gemini review |
Gemini PR ReviewReviewed commit:
This result blocks merge. Push a fix and comment |
…errors Thanks, Gerard Recinto
|
Both findings fixed. writeJSON now returns the encode error, and check --json and demo --json report it on stderr and exit 1, so a closed pipe is a failed command and not truncated output; a test writes to a broken writer and checks both. The runDemo wrapper that discarded errors is removed, and the demo test calls runDemoArgs with the error stream attached. Thanks, Gerard Recinto /gemini review |
Gemini PR ReviewReviewed commit:
|
|
/gemini review |
Gemini PR ReviewReviewed commit:
|
Running the binary with anything it did not recognize did nothing visible. sop-mcp-server --help, --version, version and a mistyped word all started the stdio server, which exits silently when stdin closes and otherwise just sits waiting. Nothing told the user what the commands were.
help, -h and --help print the commands, the two environment variables and the exit codes. version, -v and --version print one line with the module version the binary was built from, which is the release tag for a published binary or go install, and dev for a build from a working copy. An unknown word is now a usage error that names it and exits 2 instead of starting a server. stdio and serve are accepted as explicit names for starting the server, and no arguments still starts it, so how agents launch it does not change. setup --help is no longer reported as a failure.
check --json and demo --json print one JSON document, for scripts. A runbook that does not load is still reported as JSON with valid false and the error, with exit 1, so a script can read the reason. The flag works before or after the file name. Exit codes are 0 for success, 1 for failure and 2 for a usage error everywhere.
Tests cover each of those. The package vets for Windows on amd64 and arm64 and for Linux and macOS on arm64.
Thanks, Gerard Recinto