Documentation
¶
Overview ¶
Package cli implements the devsys command surface: global switches, command dispatch, output rendering and the exit-code taxonomy. Keeping dispatch out of main() makes the exit contract testable.
Since M4.2 every business operation lives in the shared application service (internal/app); this package only parses flags, calls the service and renders. The MCP server (internal/mcp) calls the same service, so no entry point can bypass a constraint the others enforce.
Index ¶
Constants ¶
const ( CodeOK = 0 CodeInternal = 1 CodeUsage = 2 CodePrecondition = 3 // CodeInvalid reports managed state that exists but cannot be trusted: // parse errors, unknown keys, wrong types, unsupported schema_version. // Write commands refuse; read-only diagnostics keep working (方案 §14.1). CodeInvalid = 4 // CodeStale and CodeMissing are the knowledge layer's own codes // (方案 §12.5): a stale page layer, and a page layer that does not exist. CodeStale = 10 CodeMissing = 11 )
Exit codes, pinned by tests so scripts may rely on them:
0 success 1 internal error 2 usage error 3 precondition error 4 invalid managed state
`knowledge status` (and a refresh that found nothing to regenerate) adds a second, reserved convention on top: 10 = the page layer is stale, 11 = the page layer has not been generated (方案 §12.5). Those commands answer with that state through stdout and then exit with the matching code; no other command uses 10 or 11.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.