fix(tee): render absolute log path in format_hint#1657
Open
truffle-dev wants to merge 1 commit intortk-ai:developfrom
Open
fix(tee): render absolute log path in format_hint#1657truffle-dev wants to merge 1 commit intortk-ai:developfrom
truffle-dev wants to merge 1 commit intortk-ai:developfrom
Conversation
The tee hint shows where rtk wrote a command's full output so downstream consumers (LLMs, scripts) can read it back. Until now paths under $HOME were rendered with the `~` shorthand, which is not safe to copy verbatim: - `cat "~/Library/Application Support/rtk/tee/..."` does not expand `~` inside double quotes - `cat ~/Library/Application Support/rtk/tee/...` splits on the space and fails Rendering the absolute path keeps the existing `[full output: ...]` enclosure stable and removes the trap. Two regression tests cover the home-prefixed and space-containing paths. Closes rtk-ai#1644
Collaborator
📊 Automated PR Analysis
SummaryRemoves the Review Checklist
Linked issues: #1644 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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
Tee writes the captured output to a file under
dirs::data_local_dir()and prints a hint line so a downstream consumer can read it back. When the file landed under$HOME, the hint was rendered with the~shorthand:That string is not safe to copy verbatim into a shell:
cat "~/Library/Application Support/rtk/tee/..."does not expand~inside double quotescat ~/Library/Application Support/rtk/tee/...splits on the space and failsBoth paths the hint advertises are paths the consumer is expected to use as-is, so the shorthand is a trap on macOS (default data dir is
~/Library/Application Support) and on any Linux user that puts spaces in their home path.Fix
Drop the
~strip-prefix logic and render the absolute path. The path passed in is already absolute (built fromdata_local_dir()), so this is a one-line change toformat_hint. The[full output: ...]enclosure stays.canonicalizewould also work but requires the file to exist at hint time, and the hint is built before the writer flushes, so absolute-only is the simpler fit.Tests
Two regression tests cover the home-prefixed and space-containing shapes.
cargo test --all1689 passed.Closes #1644