Skip to content

refactor(scripts): use match and functional pipelines in Nushell scripts - #1485

Merged
ryoppippi merged 6 commits into
mainfrom
cursor/nushell-functional-style-0b7e
Jul 24, 2026
Merged

ryoppippi merged 6 commits into
mainfrom
cursor/nushell-functional-style-0b7e

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Rewrites the repo Nushell scripts in a more functional style: match expressions (including guards, record patterns, and list patterns) replace if/else chains and defensive describe checks, and pipelines (where/each/all) replace loops and nested conditionals. No behavior changes intended.

  • .github/scripts/upsert-pr-comment.nu: the update-status dispatch (ok/missing/auth/error) is now a match; comment author/body extraction uses record patterns and guard patterns instead of describe =~ '^record' checks; status classification in try_update_comment uses match with guards.
  • apps/ccusage/scripts/ensure-native-binary.nu: nested if/else in is_portable_binary, native_package_includes_binary, and has_expected_version split into small functions dispatched via match (including a list pattern on [$target_platform, $binary]); the package-root scan is a where/each pipeline.
  • apps/ccusage/scripts/stage-native-package.nu: package-dir resolution, binary naming, and per-platform finalization dispatch via match; the darwin dylib rewrite for loop is now a pipeline that collects failed rewrites as values and raises once.
  • apps/ccusage/scripts/verify-native-package.nu: readiness checks return an issue string or null and are dispatched with match instead of try/catch around imperative checks. Uses path type, so a directory at the binary path now correctly reports "is not a file" instead of an incidental ls error.

generate-e2e-fixture.nu was already pipeline-based and is unchanged.

CI follow-up

security & lint preflight initially failed on treefmt-check / nufmt layout. Follow-up commits apply the expected wrapping and rewrite the upsert where filter with intermediate lets so nufmt does not strip parentheses into invalid syntax. Verified locally with the flake-pinned nufmt --dry-run (all five .nu scripts already formatted). CI is green.

Open in Web Open in Cursor 

View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.


Summary by cubic

Refactors Nushell scripts to use match and pipeline combinators for a clearer, more functional style. Applies nufmt layout to satisfy treefmt-check; no behavior changes.

  • Refactors
    • .github/scripts/upsert-pr-comment.nu: extract find_existing_comment, comment_login, and comment_body; dispatch upsert via match; centralize update_or_recreate_comment; classify update status via match; make filter, long signature, and print arms nufmt-friendly.
    • apps/ccusage/scripts/ensure-native-binary.nu: add binary_name, manifest_lists_binary, linux_binary_is_static, darwin_binary_links_only_system_dylibs, and reported_version; use match (including list patterns) and pipelines for portability, manifest, and version checks.
    • apps/ccusage/scripts/stage-native-package.nu: select package dir and binary name with match; finalize per-platform via finalize_target; rewrite darwin dylibs with a pipeline that reports the first failed rewrite.
    • apps/ccusage/scripts/verify-native-package.nu: return readiness issues as values and dispatch with match; use path type so directories report “is not a file”; skip executability checks for .exe.

Written for commit 07a6cc2. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved native package validation on Linux and macOS, covering binary presence, executability, portability, manifest/bin listing, and --version parsing.
    • Enhanced macOS dylib rewriting to surface a single consolidated error when multiple rewrites fail.
    • Increased reliability of automated pull request bot comments by improving how existing comments are detected and updated/recreated, with clearer handling of missing or limited write access.
  • Chores
    • Streamlined native packaging and release verification logic for clearer, more consistent diagnostics and decision outcomes.

cursoragent and others added 4 commits July 24, 2026 11:03
Replace the if/else status chain and defensive describe checks with
match arms, guard patterns, and record destructuring for comment
author and body extraction.

Co-authored-by: ryoppippi <[email protected]>
Split portability, manifest, and version probes into small functions
that dispatch via match list patterns and pipeline combinators instead
of nested if/else blocks.

Co-authored-by: ryoppippi <[email protected]>
Resolve the package dir and binary name through match, dispatch
platform finalization with match, and turn the darwin dylib rewrite
loop into a where/each pipeline that reports the first failed rewrite.

Co-authored-by: ryoppippi <[email protected]>
Model binary readiness checks as functions returning an issue string
or null, dispatched with match, instead of try/catch around imperative
checks. Use path type so directories report 'is not a file' instead of
an incidental ls error.

Co-authored-by: ryoppippi <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Four Nushell scripts are refactored into helper-based and match-based control flows for PR comment upserts, native binary validation, package staging, and package verification.

Changes

PR comment upsert

Layer / File(s) Summary
Comment lookup and upsert flow
.github/scripts/upsert-pr-comment.nu
Comment discovery, creation, update status handling, environment validation, and API error handling are extracted into dedicated functions.

Native package workflows

Layer / File(s) Summary
Native binary selection and validation
apps/ccusage/scripts/ensure-native-binary.nu
Platform naming, package matching, manifest inspection, Linux/Darwin portability checks, and version parsing are moved into helpers.
Native package staging and finalization
apps/ccusage/scripts/stage-native-package.nu
Staging uses centralized binary naming and delegates permissions and Darwin library rewriting to platform finalization helpers.
Native package verification
apps/ccusage/scripts/verify-native-package.nu
Binary path extraction, file validation, and executable checks are separated from the main verification flow.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • ccusage/ccusage#1306: Modifies the same PR-comment and native-package Nushell scripts with related refactoring of comment upsert and platform verification flows.

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: refactoring Nushell scripts to use match expressions and functional pipelines.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/nushell-functional-style-0b7e

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ryoppippi
ryoppippi marked this pull request as ready for review July 24, 2026 11:06
@pullfrog

pullfrog Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

CI failure diagnosis

The security & lint preflight job failed because treefmt-check detected that the four .nu scripts were not formatted with nufmt. This is a formatting-only failure introduced by this PR — the scripts were written without running nufmt (as noted by the author).

Fix applied

Ran treefmt --fail-on-change through nix develop to apply nufmt formatting to all three changed .nu scripts:

  • .github/scripts/upsert-pr-comment.nu
  • apps/ccusage/scripts/ensure-native-binary.nu
  • apps/ccusage/scripts/stage-native-package.nu

treefmt --fail-on-change passes cleanly after formatting. All three scripts also pass Nushell AST validation (nu -c 'ast <file> | null').

Push blocked

Commit c21d20a (style(nu): apply nufmt formatting) is ready locally but push fails with:

remote: Permission to ccusage/ccusage.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/ccusage/ccusage.git/': The requested URL returned error: 403

The pullfrog push tool authenticates as github-actions[bot] which lacks write access to this repository. A PAT with write scope or a workflow token override is needed to push the formatting fix.

Task list (6/6 completed)
  • Checkout the PR branch
  • Fetch and analyze check suite logs
  • Verify failure was introduced by this PR
  • Format .nu files with treefmt/nufmt
  • Verify fix locally, commit and push
  • Report progress

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 07a6cc2 Commit Preview URL

Branch Preview URL
Jul 24 2026, 11:20 AM

Match the formatting treefmt expects for ensure/stage helpers, and
rewrite the upsert comment filter with intermediate lets so nufmt does
not strip parentheses into invalid syntax.

Co-authored-by: ryoppippi <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — consistent refactor of four Nushell scripts from imperative if/else chains and for loops to functional match expressions, record/list patterns, and pipeline combinators (where/each/all). No user-facing behavior changes intended.

  • Dispatch comment flows with match — upsert-pr-comment.nu uses match with guards for update status classification, record patterns for comment_login/comment_body extraction, and match for the main dispatch.
  • Extract helpers and use list-pattern match — ensure-native-binary.nu splits portability, manifest, and version checks into small named functions; is_portable_binary dispatches via match [$platform, $binary] list pattern instead of nested if/else.
  • Pipeline-based darwin dylib rewrite — stage-native-package.nu resolves package dir and finalization with match; the libiconv rewrite loop is now a where/each pipeline that collects results and reports the first failure.
  • Return issues as values, drop try/catch — verify-native-package.nu returns issue strings (or null) and dispatches with match; uses path type instead of ls, and get --optional 0 instead of first.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — one new commit (238334f) applies nufmt formatting to satisfy treefmt-check. Pure layout changes, no semantics affected.

  • upsert-pr-comment.nu — where filter split into intermediate let bindings (let login = comment_login $comment; let body = comment_body $comment) to avoid a nufmt bug that strips parentheses into invalid Nushell syntax.
  • ensure-native-binary.nu — manifest_lists_binary and reported_version expressions wrapped across lines.
  • stage-native-package.nu — let target array and error make in the failure arm wrapped across lines.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/ccusage/scripts/ensure-native-binary.nu">

<violation number="1" location="apps/ccusage/scripts/ensure-native-binary.nu:44">
P3: The `binary_name` function is defined identically in both `ensure-native-binary.nu` and `stage-native-package.nu`. Since these are standalone scripts, this won't cause runtime errors, but it creates a maintenance risk: any future change to the binary naming convention (e.g., a different extension, a renamed binary) requires updating both files in lockstep. Consider extracting `binary_name` to a shared Nushell module or source-able file that both scripts can import.</violation>
</file>

<file name="apps/ccusage/scripts/stage-native-package.nu">

<violation number="1" location="apps/ccusage/scripts/stage-native-package.nu:57">
P3: The new pipeline in `rewrite_darwin_system_libraries` runs all `install_name_tool` commands for matching libraries *before* checking for failures, then reports the first failed result. The original code used a `for` loop that failed fast on the first error. This means if multiple libiconv references exist and the first rewrite fails, subsequent (potentially also-failing) `install_name_tool` calls are still needlessly executed. While most binaries will only have a single libiconv reference (making this difference purely theoretical in practice), the PR states "no behavioral changes" and this is a minor behavioral divergence. Consider restoring fail-fast semantics by checking each rewrite result inline within the `each` block.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

$other => $other
}
}
def binary_name [platform: string] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The binary_name function is defined identically in both ensure-native-binary.nu and stage-native-package.nu. Since these are standalone scripts, this won't cause runtime errors, but it creates a maintenance risk: any future change to the binary naming convention (e.g., a different extension, a renamed binary) requires updating both files in lockstep. Consider extracting binary_name to a shared Nushell module or source-able file that both scripts can import.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/ccusage/scripts/ensure-native-binary.nu, line 44:

<comment>The `binary_name` function is defined identically in both `ensure-native-binary.nu` and `stage-native-package.nu`. Since these are standalone scripts, this won't cause runtime errors, but it creates a maintenance risk: any future change to the binary naming convention (e.g., a different extension, a renamed binary) requires updating both files in lockstep. Consider extracting `binary_name` to a shared Nushell module or source-able file that both scripts can import.</comment>

<file context>
@@ -42,85 +41,72 @@ def node_arch [] {
         $other => $other
     }
 }
+def binary_name [platform: string] {
+    match $platform {
+        'win32' => 'ccusage.exe'
</file context>

| skip 1
| each {|line| $line | str trim | split row --regex '\s+' | first }
| where {|library| $library =~ '^/nix/store/[^/]+-libiconv-[^/]+/lib/libiconv\.2\.dylib$' }
| each {|library|

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The new pipeline in rewrite_darwin_system_libraries runs all install_name_tool commands for matching libraries before checking for failures, then reports the first failed result. The original code used a for loop that failed fast on the first error. This means if multiple libiconv references exist and the first rewrite fails, subsequent (potentially also-failing) install_name_tool calls are still needlessly executed. While most binaries will only have a single libiconv reference (making this difference purely theoretical in practice), the PR states "no behavioral changes" and this is a minor behavioral divergence. Consider restoring fail-fast semantics by checking each rewrite result inline within the each block.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/ccusage/scripts/stage-native-package.nu, line 54:

<comment>The new pipeline in `rewrite_darwin_system_libraries` runs all `install_name_tool` commands for matching libraries *before* checking for failures, then reports the first failed result. The original code used a `for` loop that failed fast on the first error. This means if multiple libiconv references exist and the first rewrite fails, subsequent (potentially also-failing) `install_name_tool` calls are still needlessly executed. While most binaries will only have a single libiconv reference (making this difference purely theoretical in practice), the PR states "no behavioral changes" and this is a minor behavioral divergence. Consider restoring fail-fast semantics by checking each rewrite result inline within the `each` block.</comment>

<file context>
@@ -10,43 +10,55 @@ const package_dirs = {
+        | skip 1
+        | each {|line| $line | str trim | split row --regex '\s+' | first }
+        | where {|library| $library =~ '^/nix/store/[^/]+-libiconv-[^/]+/lib/libiconv\.2\.dylib$' }
+        | each {|library|
+            {library: $library, rewrite: (run-external install_name_tool '-change' $library /usr/lib/libiconv.2.dylib $binary_path | complete)}
         }
</file context>

Wrap the four-arg update_or_recreate_comment signature and long
auth-skip print match arms the way nufmt expects.

Co-authored-by: ryoppippi <[email protected]>
Copilot AI review requested due to automatic review settings July 24, 2026 11:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1485

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1485

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1485

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1485

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1485

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1485

commit: 07a6cc2

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 07a6cc2d35d4
Base SHA: 31e084afbca3

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 348.0ms 2.89 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 329.6ms 3.05 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 106.9ms 9.42 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 84.0ms 11.99 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 27.7ms 4.3ms 6.37x 55.25 MiB 12.46 MiB 0.23x 0.06 MiB/s 0.36 MiB/s
claude session --offline --json 0.00 MiB 23.0ms 3.0ms 7.76x 55.00 MiB 12.45 MiB 0.23x 0.07 MiB/s 0.52 MiB/s
codex daily --offline --json 0.00 MiB 24.3ms 3.5ms 6.95x 55.50 MiB 10.47 MiB 0.19x 0.04 MiB/s 0.25 MiB/s
codex session --offline --json 0.00 MiB 24.2ms 2.4ms 10.22x 55.25 MiB 10.47 MiB 0.19x 0.04 MiB/s 0.36 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 393.7ms 325.9ms 1.21x 966.60 MiB 954.60 MiB 0.99x 2.56 GiB/s 3.09 GiB/s
codex --offline --json 1.01 GiB 116.4ms 102.9ms 1.13x 411.30 MiB 439.30 MiB 1.07x 8.65 GiB/s 9.78 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.71 KiB 18.70 KiB -0.00 KiB 1.00x
installed native package binary 4106.75 KiB 4106.75 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 07a6cc2d35d4
Base SHA: 31e084afbca3

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 342.6ms 2.94 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 307.0ms 3.28 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 107.2ms 9.39 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 84.8ms 11.88 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 26.6ms 26.4ms 1.01x 55.25 MiB 55.25 MiB 1.00x 0.06 MiB/s 0.06 MiB/s
claude session --offline --json 0.00 MiB 26.3ms 25.4ms 1.03x 55.25 MiB 55.25 MiB 1.00x 0.06 MiB/s 0.06 MiB/s
codex daily --offline --json 0.00 MiB 23.3ms 23.5ms 0.99x 55.25 MiB 55.25 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex session --offline --json 0.00 MiB 25.0ms 23.5ms 1.06x 55.25 MiB 55.50 MiB 1.00x 0.03 MiB/s 0.04 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 377.3ms 349.8ms 1.08x 930.59 MiB 958.60 MiB 1.03x 2.67 GiB/s 2.88 GiB/s
codex --offline --json 1.01 GiB 107.0ms 109.0ms 0.98x 417.29 MiB 429.30 MiB 1.03x 9.41 GiB/s 9.24 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.71 KiB 18.70 KiB -0.00 KiB 1.00x
installed native package binary 4106.75 KiB 4106.75 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@ryoppippi
ryoppippi merged commit 739e88f into main Jul 24, 2026
37 checks passed
@ryoppippi
ryoppippi deleted the cursor/nushell-functional-style-0b7e branch July 24, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants