feat(cli): add internal/{text,compat} packages and acceptance scaffold (PR-6)

text/      gh-style display-width string helpers (Truncate / FuzzyAgo / Pluralize)
compat/    server-CLI version skew probe (kubectl) + 24h TTL cache (gh internal/update)
acceptance/contract/  helpers_test.go for in-process cobra exec + golden assert
                      (uses iostreams.SetForTest singleton replacement; no t.Parallel)
cmdutil/errors.go: AllCodes() + ClassifyHTTPErrorOutputs() bridge for the
                   contract test suite (no behavior change in error handling)

go-runewidth promoted from indirect to direct (used by text.Truncate for
display-width-aware CJK truncation).

acceptance/contract/helpers_test.go forward-references cmd.NewRootCmd which
is exported in PR-7 — that file does not compile until then by design.
This commit is contained in:
nullkey
2026-05-08 15:44:32 +08:00
committed by lyingbug
parent b7388f10e1
commit 92d78dea72
17 changed files with 733 additions and 1 deletions
+1 -1
View File
@@ -8,6 +8,7 @@ require (
github.com/Tencent/WeKnora/client v0.0.0-00010101000000-000000000000
github.com/charmbracelet/huh v1.0.0
github.com/mattn/go-isatty v0.0.20
github.com/mattn/go-runewidth v0.0.16
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.11.1
github.com/zalando/go-keyring v0.2.8
@@ -34,7 +35,6 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect