Repository navigation
feat(statusline): link PRs from gh pr create to the session - #10
Merged
Merged
Conversation
A classic.PostToolUse hook watches Bash calls that run `gh pr create`. It takes the PR URLs printed on stdout, including several from one chained command, and runs `shelltime cc pr --session-id <id> <url>...`. The CLI hands them to the ShellTime daemon, which links them to the session on shelltime.xyz. The hook runs after the tool returns and in the background, so it never delays or changes the Bash result. It looks for ~/.shelltime/bin/shelltime first, then `shelltime` on PATH. Each URL is sent once per session; one the CLI could not take is tried again the next time it is printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DVr1QVVUbfrjJSrsj9Nxc1
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Adds a
PostToolUsehook (on('classic.PostToolUse')) toshelltime-statusline.gh pr create, the hook takes the PR URLs printed on stdout, including several from one chained command.shelltime cc pr --session-id <session_id> <url>.... The CLI hands them to the ShellTime daemon, which saves them to the session on the server.ghreports an already existing PR on stderr, and that one wasn't opened here.next(e)and unawaited, so it never delays or changes the Bash result.$.process.run. The daemon's socket speaks raw JSON, and$.http.fetch({ socketPath })only speaks HTTP, so the hook can't write to the socket directly.~/.shelltime/bin/shelltimefirst, thenshelltimeon PATH, because desktop hosts often lack~/.shelltime/bin.hooks/pullRequests.ts.Depends on https://github.com/shelltime/server/pull/514 (the endpoint) and shelltime/cli#318 (
shelltime cc prplus the daemon message). Until a CLI release withcc pris installed, nothing is linked and the statusline is unaffected.Test plan
hooks/pullRequests.test.ts(claude plugin test):gh pr viewand non-Bash tools ignoredshelltimeon PATHclaude plugin validate --strict .andplugins/shelltime-statuslineclaude plugin test plugins/shelltime-statusline: 28 passtscagainst the engine's API types, thenpnpm typecheckandpnpm test(31 pass)🤖 Generated with Claude Code
https://claude.ai/code/session_01DVr1QVVUbfrjJSrsj9Nxc1