feat(profile): timeline --sort, --offset, default limit, and total count header#48
feat(profile): timeline --sort, --offset, default limit, and total count header#48
Conversation
…mmands Uncapped `profile timeline` can dump 300+ lines for a typical session. Add `--limit 5` to the example and a comment flagging the risk, consistent with how `profile slow` and `profile rerenders` are already shown with limits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a --sort flag to `profile timeline`: - --sort duration: sorts commits by duration descending before applying --limit, so the top N most expensive commits surface immediately - --sort timeline: explicit chronological order (same as the default) Default behavior (no --sort) remains chronological, unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows skipping the first N entries (after sorting), enabling pagination through long sessions and skipping known-good warm-up commits. profile timeline --limit 20 # commits 0-19 profile timeline --limit 20 --offset 20 # commits 20-39 profile timeline --offset 30 --limit 10 # skip warm-up Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…meline
- Default limit changed from unlimited to 20, consistent with profile slow
and profile rerenders (both default to 10; timeline entries are more compact
so 20 is a natural page size)
- Output header now shows total commit count and range:
Commit timeline (showing 1–20 of 87):
When all commits fit: Commit timeline (42 commits):
- Introduces TimelineResult { entries, total, offset } returned by getTimeline()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 441c656 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6669d2e222
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…past end in formatTimeline
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dc3211e34
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Negative offset values passed through to Array.slice() use JS tail-indexing semantics, returning commits from the wrong end of the array and producing nonsensical pagination headers.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 441c656630
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
--sort duration|timelineflag toprofile timeline--offset Nflag for paginationCommit timeline (showing 1–20 of 87):when paginatedMotivation
Agents were treating
profile timelineas a cheap command and calling it without--limit, flooding their context with hundreds of commit entries.Test plan
profile timelinereturns at most 20 entries by defaultprofile timeline --limit 5returns 5 entriesprofile timeline --sort duration --limit 5returns 5 most expensive commitsprofile timeline --offset 10 --limit 10returns entries 11–20(showing X–Y of N)when paginated,(N commits)when not🤖 Generated with Claude Code