VS extension: batch all CLI calls into a single all --json invocation#530
Merged
VS extension: batch all CLI calls into a single all --json invocation#530
all --json invocation#530Conversation
…flows Agent-Logs-Url: https://github.com/rajbos/github-copilot-token-usage/sessions/9de39781-72b7-4905-b26d-e7b0d4b841da Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize CLI calls by implementing batched data loading
VS extension: batch all CLI calls into a single Mar 30, 2026
all --json invocation
rajbos
approved these changes
Mar 30, 2026
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.
Multiple sequential CLI spawns on extension load caused multiple loader spinners and unnecessary latency. This replaces them with a single batched call that populates all view caches upfront.
CLI — new
allcommandcli/src/commands/all.ts: runscalculateDetailedStats,calculateDailyStats, andcalculateUsageAnalysisStatsin parallel, then returns a single JSON envelope:{ "details": {...}, "chart": {...}, "usage": {...}, "fluency": {...} }VS extension —
CliBridgebatched fetchGetAllDataAsync(): runsall --jsononce, deserializes each top-level key, and populates all in-memory caches (_cachedStats,_cachedChartJson,_cachedUsageAnalysisJson,_cachedMaturity). Concurrent callers share the same in-flightTask— no duplicate processes.Get*Async()methods now serve from cache when fresh; fall back to a per-command CLI call otherwise (backwards-compatible).VS extension — single-spinner preload
PrewarmAllViewsAsync()(called once during WebView init): shows one loading indicator, callsGetAllDataAsync(), then builds and caches rendered HTML for all five views (details, chart, usage, environmental, maturity). Tab switches after this point are instant with no additional spinners.CI
all --jsonvalidation step to bothcli-build.ymlandvisualstudio-build.ymlto catch regressions in the batched command.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
teststorage.blob.core.windows.net/opt/hostedtoolcache/node/20.20.1/x64/bin/node /opt/hostedtoolcache/node/20.20.1/x64/bin/node --require ./out/test/unit/vscode-shim-register.js --test-force-exit /home/REDACTED/work/github-copilot-token-usage/github-copilot-token-usage/vscode-extension/out/test/unit/backend-blobUploadService.test.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created from Copilot chat.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.