Add clickable session link to statusline output#219
Conversation
The session cost field (💰) now links to the session detail page at
shelltime.xyz when userLogin, webEndpoint, and session_id are available.
URL format: {webEndpoint}/users/{userLogin}/coding-agent/session/{sessionID}
https://claude.ai/code/session_01WQfLuZR6hgxmy3pwvkukBU
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the statusline output by making the session cost clickable. Users can now directly navigate to their coding agent session details page from the terminal, improving usability and access to session information. The change ensures that the link is only generated when all necessary data is present, maintaining robustness and backward compatibility. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a great feature by making the session cost in the statusline a clickable link to the session details page. The implementation is straightforward and includes comprehensive test coverage for both the new functionality and fallback scenarios. I've made one suggestion to make the URL construction more robust against variations in the webEndpoint configuration.
| if userLogin != "" && webEndpoint != "" && sessionID != "" { | ||
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", webEndpoint, userLogin, sessionID) | ||
| sessionStr = wrapOSC8Link(url, sessionStr) | ||
| } |
There was a problem hiding this comment.
Constructing URLs with fmt.Sprintf can be brittle. If webEndpoint has a trailing slash, it will result in a double slash in the final URL (e.g., https://example.com//users/...). While many servers handle this, it's more robust to prevent it. Using strings.TrimSuffix is a simple way to ensure the URL is always correctly formed.
| if userLogin != "" && webEndpoint != "" && sessionID != "" { | |
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", webEndpoint, userLogin, sessionID) | |
| sessionStr = wrapOSC8Link(url, sessionStr) | |
| } | |
| if userLogin != "" && webEndpoint != "" && sessionID != "" { | |
| url := fmt.Sprintf("%s/users/%s/coding-agent/session/%s", strings.TrimSuffix(webEndpoint, "/"), userLogin, sessionID) | |
| sessionStr = wrapOSC8Link(url, sessionStr) | |
| } |
Summary
This PR adds support for displaying a clickable OSC8 hyperlink to the coding agent session page in the statusline output. The session cost now links directly to the session details page when user login, web endpoint, and session ID are available.
Key Changes
SessionIDfield toCCStatuslineInputstruct to capture session identifier from Claude CodeSessionIDfrom the input data to theformatStatuslineOutputfunctionformatStatuslineOutputto wrap the session cost display with an OSC8 hyperlink when all required parameters (userLogin, webEndpoint, sessionID) are present{webEndpoint}/users/{userLogin}/coding-agent/session/{sessionID}sessionIDparameterImplementation Details
wrapOSC8Linkutility function to create terminal-compatible hyperlinkshttps://claude.ai/code/session_01WQfLuZR6hgxmy3pwvkukBU