Repository navigation
Commit a6934cf
authored
CLI rubric parity: output system, typed errors, discovery, distribution (#4)
* Add typed error and envelope output packages
Introduce internal/apierr with machine-readable error codes (usage,
not_found, auth, forbidden, rate_limit, network, api, ambiguous) and
internal/output with envelope JSON writer, format modes (JSON, styled,
quiet, ids-only, count, markdown), TTY auto-detection, and typed exit
codes.
* Migrate client to typed errors with idempotent retry
Replace custom APIError with apierr types so error codes propagate
to the envelope. Add exponential backoff retry for GET/HEAD only;
mutations (POST, PATCH, PUT, DELETE) use single-attempt doOnce to
avoid duplicating side effects. Rate-limit 429 responses respect
Retry-After header.
* Add layered config with HTTPS validation
Load config from global > local (.hey/config.json) > env > flag layers
with source tracking. Enforce HTTPS for non-localhost base URLs at all
layers including --base-url flag. SetFromFlag now returns error so
validation cannot be bypassed. XDG directory compliance for config,
state, and cache paths.
* Defer keyring probe to first credential operation
Replace eager keyring availability check in NewStore with lazy
sync.Once initialization. Commands that never touch credentials
no longer trigger the keyring probe or its fallback warning.
* Migrate CLI to envelope output system
Replace ad-hoc JSON/styled output with envelope writer across all
commands. Add persistent flags: --json, --quiet, --agent, --ids-only,
--count, --markdown, --styled, --html, --base-url. Extract newRootCmd()
constructor shared by Execute() and tests. Normalize only Cobra parse
errors as usage errors; pass through runtime errors unchanged.
New commands: commands (catalog), completion (shell scripts), doctor
(health checks), config show (with source attribution).
Add --help --agent for structured JSON discovery. Remove unused
printJSON/printRawJSON/limitJSONArray from formatting.go and
errNotLoggedIn from errors.go.
* Add surface snapshot test for API stability
Test builds the command tree via newRootCmd() (same wiring as runtime)
and diffs against .surface baseline. Removals fail the test; additions
auto-update the baseline. Captures all commands, subcommands, and
non-inherited flags including persistent root flags.
* Add GoReleaser config and install script
Cross-platform builds (darwin universal, linux amd64/arm64), SHA256
checksums, and curl-pipe install script with checksum verification.
* Add CI workflow for test, lint, and surface compatibility
* Add Claude plugin for agent integration
Plugin manifest with session-start hook, navigator and context-linker
agents. Declares output format capabilities and structured help support.
* Address PR review feedback from Codex and Copilot
- Emit structured JSON errors when writer is nil (initialize JSON writer)
- Fix IPv6 loopback in validateBaseURL (use u.Hostname() directly)
- Use config.ConfigDir() in doctor.go instead of re-deriving path
- Close resp.Body immediately in retry loop instead of defer (prevent leaks)
- Use errors.As in ExitCodeFor and normalizeCobraError for wrapped errors
- Pass opts.Stdout to isTTY instead of hardcoding os.Stdout
- Use bytes.NewReader in NormalizeJSONNumbers to avoid string copy
* Add core infrastructure: table io.Writer, --verbose, --stats, request tracking
- Thread io.Writer through table struct for testable output
- Change readStdin error to typed output.ErrUsage
- Add --verbose/-v flag with HEY_DEBUG env support for request logging
- Add --stats flag for request statistics in JSON meta
- Add Logger, SleepFunc, and atomic request/latency counters to Client
- Add statsOption() helper and agent_notes to printAgentHelp JSON
- Register setup command in root
* Add --all pagination flag, agent notes, and truncation notices to all commands
- Add --all flag to override --limit on: boxes, box, drafts, todo list,
journal list, timetrack list, recordings
- Add --limit to timetrack list (was missing)
- Add truncation notices (styled + JSON WithNotice) to all list commands
- Add agent_notes annotations to all command constructors
- Thread newTable(cmd.OutOrStdout()) and statsOption() through all commands
* Add setup wizard and migrate skill install to writer output
- New hey setup command: first-run wizard with OAuth login
- Skill install now uses dual-path output (styled + JSON envelope)
* Add unit tests for client, auth, and config packages
- Client: retry logic, error mapping, rate limit handling, injectable sleeper
- Auth: store round-trip, keyring bypass, token precedence, refresh
- Config: layered config, env/flag override, URL validation, source tracking
* Harden surface test and add CI lint job
- Surface test now reports additions without auto-updating baseline
- Use -update-surface flag for explicit baseline updates
- Removals still fail the test (breaking change detection)
- Add golangci-lint v2.1.6 job to CI workflow
- Update .surface with new flags and commands
* Add distribution channels, docs, and skill sync script
- Update cosign signing args in goreleaser (output-certificate)
- Add CONTRIBUTING.md with build/test/lint instructions
- Add API-COVERAGE.md mapping endpoints to CLI commands
- Add scripts/sync-skill.sh for deploying skill to ~/.agents
* Fix all golangci-lint issues for clean make check
- Handle fmt.Sscanf return values in client retry logic
- Add nolint annotations for intentional gosec exceptions (fd conversion,
non-crypto rand, resp.Body.Close in retry loop, bounded int shift)
- Check type assertion errors in commands.go table rendering
- Discard enc.Encode error in writer.go Err() and root.go printAgentHelp
- Rename truncate param from max to maxWidth (predeclared shadow)
- Use tagged switch in doctor.go status check
- Mark unused configDir param with blank identifier
* Address PR review feedback: URL validation, JSON number precision
- Reject bare paths in validateBaseURL (require scheme + host)
- Add test cases for bare path rejection and IPv6 loopback
- Use json.Decoder with UseNumber in toSlice/toMap/extractID to
preserve integer precision for large IDs in --ids-only output
* Centralize writeOK for consistent --stats injection and fix recordings output
P1: Replace all writer.OK() calls with writeOK() wrapper that always
injects statsOption(). Removes per-command statsOption() boilerplate
and closes the gap where auth, todo mutations, config, doctor, and
other commands were missing --stats support.
P2: Add combined truncation notice to recordings JSON envelope.
P3: Route recordings styled output through cmd.OutOrStdout() instead
of fmt.Printf. Fix README --from/--to → --starts-on/--ends-on.
Includes regression tests for writeOK stats injection.
* Make bare hey launch TUI, keep README accurate
Root command RunE now launches tui.Run() instead of printing help,
matching the expected UX where hey is the TUI launcher and hey tui
is an explicit alias. README already said "Run hey to launch the
interactive terminal UI" — now code matches.
* Address PR review feedback: output routing and config safety
- Route all styled fmt.Print* through cmd.OutOrStdout() for
testability and Cobra output consistency (all 14 cmd files)
- printAgentHelp encodes to cmd.OutOrStdout() not os.Stdout
- Execute() error path uses FormatAuto not hardcoded FormatJSON
- globalConfigPath() returns "" when ConfigDir() is empty,
preventing accidental relative path reads/writes
* Address PR review feedback from Codex and Copilot
- Bump golangci-lint v2.1.6 → v2.10.1 to match Go 1.26 target
- Route writer output through cmd.OutOrStdout()/cmd.ErrOrStderr()
- Use FormatFromFlags in Execute() fallback writer
- Include inherited flags in printAgentHelp output
- Hide --agent flag from help
- Harden install.sh checksum verification
- Use cmd.OutOrStdout() in completion command
- Save/restore test globals with defer in writeok_test1 parent f9abe8c commit a6934cf
50 files changed
Lines changed: 3678 additions & 600 deletions
File tree
- .claude-plugin
- agents
- hooks
- .github/workflows
- internal
- apierr
- auth
- client
- cmd
- config
- output
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 55 | | |
62 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments