Merged
Conversation
The test assumed unsetting SENTRY_API_TOKEN would cause an error, but LoadConfig falls back to ~/.config/sentire/config.json. Override HOME to a temp directory so no config file is found.
Introduce CLIError type with machine-readable error codes (auth_missing, api_error, invalid_input, invalid_format) and distinct exit codes (0=success, 1=general, 2=auth, 3=API, 4=invalid input). Errors are output as JSON to stderr when format is json. Add typed error wrappers in config (AuthError), client (APIError), and formatter (FormatError) that are automatically mapped to CLIError at the CLI layer.
Validate org/project slugs (lowercase alphanumeric + hyphens, max 50 chars), issue IDs (numeric), event IDs (32 hex chars or latest/oldest/recommended), and inspect URLs (must contain sentry.io) before making API calls. Returns CLIError with invalid_input code and exit code 4.
Add global --fields flag that accepts comma-separated field names (e.g. --fields id,title,status). When specified, JSON output only includes the requested fields, reducing payload size for agents that only need specific data from large Sentry responses.
Add NDJSON formatter that outputs one JSON object per line with no array wrapper or indentation. Supports --fields filtering. Useful for agents processing results incrementally or piping through jq.
Add 'sentire describe' command that outputs machine-readable JSON describing all commands, their args, flags, and output fields. Supports 'sentire describe events list-issues' for a specific command. Uses reflect to extract JSON tag names from model structs.
Add CONTEXT.md with agent-specific guidance (command reference, output control, error codes, tips). Add 'sentire context' command that prints it using go:embed.
ab64ff6 to
7246f9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLIErrorwith machine-readable codes (auth_missing,api_error,invalid_input,invalid_format) and distinct exit codes (0=success, 1=general, 2=auth, 3=API, 4=invalid input). Errors output as JSON to stderr when format is json/ndjson.--fieldsflag: Filters JSON output to only requested fields (e.g.--fields id,title,status). Reduces token usage for large Sentry payloads.--format ndjson: Newline-delimited JSON output — one object per line, no array brackets. Useful for streaming and piping through jq.describecommand: Machine-readable JSON introspection of all commands, args, flags, and output fields. Supportssentire describe(all) andsentire describe events list-issues(specific).contextcommand + CONTEXT.md: Agent-specific usage guide with command reference, error codes, and tips.TestNewClienttest failure when a config file exists at~/.config/sentire/config.json.Test plan
make testpasses (51 tests, 0 failures)make buildsucceeds