feat(3310): wire remaining ERROR_REASON typed codes into gsd-tools (#3311)

Closes #3310

Wires `ERROR_REASON.SDK_UNKNOWN_COMMAND` and `ERROR_REASON.USAGE` into the remaining untyped error paths in `gsd-tools.cjs` (template, frontmatter, requirements, milestone, uat, todo, workstream, graphify, learnings subcommand routers and `--cwd`/missing-required-arg paths). Tests assert via `JSON.parse(stderr).reason` rather than substring matching on prose. Closure regression guard locks the canonical `{ok, reason, message}` shape for every newly-typed path.

Also moves `--json-errors` activation up to the top of `main()` so `--cwd` validation paths emit JSON rather than plain text when `GSD_JSON_ERRORS=1` is set.
This commit is contained in:
Tom Boucher
2026-05-09 13:54:06 -04:00
committed by GitHub
parent eaf20d2cd3
commit 2e87c60afc
3 changed files with 271 additions and 37 deletions

View File

@@ -0,0 +1,5 @@
---
type: Changed
pr: 3311
---
**`gsd-tools --json-errors` covers every error path** — every "Unknown <subsystem> subcommand" and missing-required-arg error now emits a typed `ERROR_REASON` code (`sdk_unknown_command` or `usage`) instead of the fallback `unknown`. Tests can now lock these paths via `JSON.parse(stderr).reason` without grepping the human message (#3310, builds on #3255).