mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-11 21:39:01 +00:00
e2b19d393f
Replaces cobra's built-in `help` with a custom subcommand implementing the cmdhelp v0.1 mandatory surface (https://getpad.dev/cmdhelp; IDEA-927): pad help [subcommand…] [--format <fmt>] [--depth <n>] [--all] Routing: - --format text (default): delegates to cobra's text renderer so the existing --help UX is byte-for-byte unchanged. - --format json|md|llm: routes to cmdhelp emitters. JSON and markdown emitters are stubs that return clear "not yet implemented" errors pointing to TASK-934 / TASK-935; this lets the routing layer ship and be tested independently of the emitter work. - --depth <n> and --all are accepted at this layer; their effect lives in the JSON/MD emitters. - llm is a renderer-level alias for md per spec §3. Scope levels (spec §4): - pad help → root tree summary (text mode delegates to cobra) - pad help <group> → subtree (e.g. `pad help item`) - pad help <group> <leaf> → single command, deep Tests (cmd/pad/help_cmdhelp_test.go): - 11 cases covering all routing branches: default text, group scope, leaf scope, --format text == default, --format json stub references TASK-934, --format md/llm stubs reference TASK-935, llm aliases md, unknown --format rejected, unknown topic rejected, --depth/--all accepted, CmdhelpVersion is MAJOR.MINOR. Verification: - All 11 new tests pass. - `make check` clean (lint + go test + web build). - Manual smoke-test on built binary: 13 paths exercised — group/leaf routing, format aliases, error paths, existing `pad <cmd> --help` unchanged. The JSON/MD emitters land in TASK-934/935. --capabilities discovery is a separate concern (TASK-937). Parent: PLAN-930.