refactor(time-range): parse --period at flag level via parsePeriod#760
Merged
refactor(time-range): parse --period at flag level via parsePeriod#760
Conversation
Move parsePeriod into the Stricli flag parse function on all --period definitions. flags.period is now TimeRange instead of string — commands no longer call parsePeriod() manually. Invalid periods are rejected at parse time, before func() runs. - LIST_PERIOD_FLAG: parse: String → parse: parsePeriod - 6 commands: remove parsePeriod() call, use flags.period directly - 2 optional-flag commands (log list, dashboard view): use pre-parsed TimeRange constants for runtime defaults - Add formatTimeRangeFlag() for hint builders that need the string form - Add TIME_RANGE_14D/24H/30D constants for common defaults - release list excluded (raw statsPeriod passthrough)
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 82.76%. Project has 1632 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 95.48% 95.46% -0.02%
==========================================
Files 236 236 —
Lines 35898 35924 +26
Branches 0 0 —
==========================================
+ Hits 34273 34292 +19
- Misses 1625 1632 +7
- Partials 0 0 —Generated by Codecov Action |
BYK
commented
Apr 15, 2026
Replace the repeated formatTimeRangeFlag + comparison + push pattern in 4 hint builders with a shared appendPeriodHint() helper. Fix the hardcoded '90d' literal in issue/list.ts to use DEFAULT_PERIOD.
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
parsePeriodinto the Stricli flagparsefunction on all--perioddefinitionsflags.periodis nowTimeRangeinstead ofstring— commands get a pre-parsed, validated value automaticallyfunc()runssanitizeQueryfor--query(fix(search): rewrite OR queries to in-list syntax across all --query commands (CLI-16J) #758)Changes
Foundation (
src/lib/time-range.ts):formatTimeRangeFlag(range)— convertsTimeRangeback to CLI-friendly string for hintsTIME_RANGE_14D,TIME_RANGE_24H,TIME_RANGE_30D— pre-parsed constants for runtime defaultsShared flag (
src/lib/list-command.ts):LIST_PERIOD_FLAG.parse:String→parsePeriod8 commands updated (removed manual
parsePeriod()calls):trace list,span listLIST_PERIOD_FLAG(already updated), removeparsePeriodimportevent list,issue eventsshared-events.ts)issue listparse: parsePeriod, remove redundant?? DEFAULT_PERIODtrace logsparse: parsePeriodlog listoptional: true, runtime default viaTIME_RANGE_14D/TIME_RANGE_30Ddashboard viewoptional: true, runtime default viaparsePeriod(dashboard.period)+TIME_RANGE_24HExcluded:
release list— passesflags.periodas rawstatsPeriodstring to the API.