Consolidates everything since v0.4.2 (v0.4.3 skipped; xyz-rust used 0.4.3 for
a crates.io build fix).
1. TTY-aware output format (spec §10.7)
- --format gains `auto` (the new default): interactive stdout → text
(aligned tables/KV), piped/redirected → jsonl. Config.FormatInteractive /
FormatPiped configure the pair; CliHints.Format sets it per command.
- Four-tier precedence: bare --format/--json > --xyz.format > CliHints.Format
> Config.Format > auto. --xyz.format=auto accepted.
- termx leaf package owns the TTY probe (character-device check), shared by
the format axis and the reserved style axis; cli.Options.Interactive forces
it for tests/embedding; ExecContext.Interactive exposes it.
2. Four modes + namespacing + help (spec §13.1/§13.2/§10.4)
- New `http` mode: standalone HTTP REST (+ /openapi.json), no /mcp; `serve`
stays REST + /mcp. ModeWords.HTTP added; four pairwise-distinct words.
- Every mode word W is also reachable as the always-available, help-hidden
`xyz.W`. A user command whose top segment equals W shadows the bare word
(bare → user command; built-in via xyz.W). Registering such a command is no
longer an error (checkReserved → shadowedModes). Overview lists a bare mode
word only when unshadowed.
- `help <command-path>` (dotted or spaced) prints that command's detailed
help (= <path> -h); `help <mode>` prints mode help; bare `help` → overview.
- `serve -h`/`http -h`/`mcp -h` print mode help and exit 0 without starting
a server (fixes serve -h previously starting the server). Bilingual
mode-help text.
3. Runtime environment context (spec §14 item 7)
- termx.Interactive/StdoutInteractive/NoColor; root xyz.Language() /
Interactive() / NoColor() / Env() EnvContext / LanguageFromCtx(ctx).
4. Accept-Language per-request language (spec §11.7)
- langx gains ctx-aware WithLang/FromCtx/Tctx/Tfctx + ParseAcceptLanguage
(highest-q supported tag, zh*/en*, fallback to process default). The HTTP
frontend resolves it per request, carries it in the request context,
localizes framework messages (invalid JSON body, not found), and exposes it
to handlers via xyz.LanguageFromCtx.
(Builds on v0.4.2: rich errors Code/Detail/Status + shared error body,
--format text/json/jsonl/markdown, application-identity X-App-*/X-XYZ-* headers,
MCP _meta.xyz, per-channel output functions.)
Tests: cli/format (auto TTY, precedence), main_modes (resolveModes/matchMode/
hasHelpFlag/shadowing), env, langx/accept, httpapi/i18n + meta. Full suite
green; nocli/nohttp/nomcp + all-trim variants build; vet clean. End-to-end
smoked: http vs serve /mcp, help <path>/<mode>, mode -h, piped jsonl vs pty
text, Accept-Language zh/en/fallback, xyz.help.