feat(output): hyperlink URL table cells - #825
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dae4fa6493
ℹ️ 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".
dae4fa6 to
ccc7947
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccc79478d6
ℹ️ 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".
Render standalone HTTP and HTTPS string values as OSC 8 links when table output is sent to an interactive terminal. Keep the original URL as the link target when the displayed cell is truncated, while leaving embedded URLs and non-interactive output unchanged.\n\nHonor the existing styling opt-outs and add PUP_HYPERLINKS=0 for users who want colors without links.
ccc7947 to
d5f8200
Compare
Motivation
Table values are deliberately shortened to keep output readable, but that makes URL cells less useful, as the visible value no longer contains the complete target. This means even if a terminal is set up to allow hyperlink clicks, it'll be the entirely wrong URL.
Terminals already have a way to separate a compact label from its destination: OSC 8 links let us keep the existing table layout while making the original URL available on hover or click.
Changes
When stdout is an interactive terminal, Pup now makes valid HTTP(S) strings that occupy an entire table cell clickable. The displayed value keeps its existing compact preview, while the link target uses the complete original URL. This applies to horizontal, vertical, and scalar tables.
Only whole-cell URL strings are linked. URLs embedded in prose or array previews remain ordinary text, and malformed or non-HTTP(S) targets are rejected.
Links are disabled in agent mode and redirected or piped output.
NO_COLOR,CLICOLOR=0, andTERM=dumbkeep output plain, andPUP_HYPERLINKS=0provides a link-specific opt-out.OSC 8 adds behavior, not decoration, so static output is intentionally unchanged.
Before
After (hover)
Implementation question
This enables
comfy_table'scustom_stylingfeature so OSC 8 control sequences don't count toward table width. That's much simpler and less error-prone than maintaining a custom post-render pass, but the feature applies ANSI-aware width calculation to every native table, including tables without links.comfy_tabledocuments roughly 30–50% slower table formatting, and enabling it adds eight transitive dependencies.Is that an acceptable tradeoff for Pup, or would you prefer a narrower implementation?
QA
--output table, hover or click the shortened label, and confirm it uses the complete original URL.PUP_HYPERLINKS=0,NO_COLOR=1, orCLICOLOR=0and confirm no OSC 8 sequences are emitted.Automated coverage verifies terminal capability detection, full targets behind shortened labels, each table layout, unsafe and embedded URL rejection, opt-outs, and preservation of invisible Unicode separators.
cargo test -- --test-threads=1— 2,004 passedcargo fmt --checkcargo clippy --all-targets -- -D warningsBlast Radius
Interactive human table output, plus the
comfy_tablewidth-calculation path for all native tables. JSON, YAML, CSV, TSV, agent output, and serialized values are unchanged.