Commit 6edb045
feat(period): support absolute date ranges in --period flag (#674)
## Summary
Overload the existing `--period` flag across all 8 time-scoped commands
to accept absolute date ranges using `gh`-compatible syntax (e.g., `gh
search issues --created ">2023-01-01"`), in addition to existing
relative durations.
## New syntax
| Syntax | Meaning | Example |
|--------|---------|---------|
| `7d`, `24h` | Relative (unchanged) | `--period 7d` |
| `date..date` | Full range | `--period "2024-01-01..2024-02-01"` |
| `date..` / `..date` | Open-ended | `--period "2024-01-01.."` |
| `>=date` | From (inclusive) | `--period ">=2024-01-01"` |
| `>date` | After (exclusive) | `--period ">2024-01-01"` |
| `<=date` | Through (inclusive) | `--period "<=2024-02-01"` |
| `<date` | Before (exclusive) | `--period "<2024-02-01"` |
Date formats: `YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS`, with optional
timezone.
## Key design decisions
- **Single flag** — no new `--start`/`--end` flags, avoids alias
conflicts and `--help` clutter
- **Local timezone** for date-only inputs — `"2024-01-15"` means the
user's local midnight, not UTC
- **Exclusive operators shift dates** — `>2024-01-15` (date-only) starts
from Jan 16; `>2024-01-15T12:00:00Z` (datetime) passes through as-is
- **Follow mode validation** — `log list --follow` rejects end-bounded
ranges
- **Pagination cache** — serialization normalizes to UTC for
deterministic keys; `>=2024-01-01` and `2024-01-01..` share the same
cache entry
## Affected commands (8)
`trace list`, `span list`, `issue events`, `event list`, `issue list`,
`trace logs`, `log list`, `dashboard view`
## Changes
- **New**: `src/lib/time-range.ts` — `parsePeriod()`,
`timeRangeToApiParams()`, `serializeTimeRange()`, `timeRangeToSeconds()`
- **API layer**: Added `start?`/`end?` to all option types in
`api/traces.ts`, `api/events.ts`, `api/issues.ts`, `api/logs.ts`,
`api/dashboards.ts`
- **Commands**: All 8 commands parse period via `parsePeriod()`, spread
API params via `timeRangeToApiParams()`, serialize for pagination via
`serializeTimeRange()`
- **Tests**: 67 new tests (34 unit + 33 property-based with fast-check)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 924d325 commit 6edb045
File tree
30 files changed
+1429
-85
lines changed- docs/src/content/docs/commands
- plugins/sentry-cli/skills/sentry-cli/references
- src
- commands
- dashboard
- event
- issue
- log
- span
- trace
- lib
- api
- test
- commands/issue
- lib
30 files changed
+1429
-85
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
0 commit comments