Add dry-run subcommand for token-usage measurement#750
Open
jehna wants to merge 2 commits into
Open
Conversation
Walks every identifier the real pipeline would walk, builds the same (system, user, schema) triple the LLM renamer would send, tokenises with cl100k_base or o200k_base via tiktoken-rs, and reports calls plus per-call and aggregate token totals. No LLM, no API key. Extracts build_rename_prompt() from LlmRenamer so the dry-run path tokenises the exact bytes the real path would have sent. https://claude.ai/code/session_01EYuAm8hmd8HR8CR8xngogJ
Draft markdown body for the comparison issue referenced in #724. Kept in the tree so it's reviewable; will be posted as a GitHub issue separately once approved. https://claude.ai/code/session_01EYuAm8hmd8HR8CR8xngogJ
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
humanify dry-run <file> [--context-size N] [--tokenizer cl100k_base|o200k_base]subcommand. Walks every identifier the real pipeline would walk, builds the exact(system, user, schema)triple the LLM renamer would send, tokenises it viatiktoken-rs, and reportscallsplus per-call and aggregate token totals. No LLM, no API key.build_rename_prompt()out ofLlmRenamerso the dry-run path tokenises the exact bytes the real path would have sent — no chance of drift between the two.Example
Test plan
cargo test --release(186 passing, no regressions)fixtures/example.min.jshumanify dry-runon a real bundle and sanity-check the totalsGenerated by Claude Code