-
Notifications
You must be signed in to change notification settings - Fork 46
feat(hooks): v2.0.1 — expand claude code hook coverage #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yigitkonur
wants to merge
5
commits into
warpdotdev:main
Choose a base branch
from
yigitkonur:feat/comprehensive-hook-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ecd546c
fix(stop-hook): drop 0.3s transcript race, read last_assistant_messag…
yigitkonur c737e76
feat(hooks): complete claude code lifecycle coverage with rich sideba…
yigitkonur 3eb86ad
test(hooks): cover all new event payloads and temp-file prompt handoff
yigitkonur a270c3c
chore(plugin): bump to v3.0.0 and document complete lifecycle coverage
yigitkonur 256b057
chore(plugin): retag as v2.0.1 instead of v3.0.0
yigitkonur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| # Hook script for Claude Code CwdChanged event | ||
| # Emits cwd_changed so the sidebar project label reflects cd commands executed | ||
| # by Claude. The envelope's `project` field is derived from basename(cwd) at | ||
| # notification time — this event pushes the update without waiting for the | ||
| # next tool call. | ||
| # | ||
| # https://docs.anthropic.com/en/docs/claude-code/hooks#cwdchanged | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| source "$SCRIPT_DIR/should-use-structured.sh" | ||
|
|
||
| if ! should_use_structured; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| source "$SCRIPT_DIR/build-payload.sh" | ||
|
|
||
| INPUT=$(cat) | ||
|
|
||
| # No extra fields — the envelope already carries the new cwd and derived project. | ||
| BODY=$(build_payload "$INPUT" "cwd_changed") | ||
|
|
||
| "$SCRIPT_DIR/warp-notify.sh" "warp://cli-agent" "$BODY" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
| # Hook script for Claude Code Elicitation event | ||
| # MCP servers can request user input mid-tool-execution via elicitation. | ||
| # This maps directly to OpenCode's `question_asked` event — Warp already has | ||
| # UI wired for it, so re-using that event gets MCP elicitation into the | ||
| # sidebar with zero new event registration on Warp's side. | ||
| # | ||
| # https://docs.anthropic.com/en/docs/claude-code/hooks#elicitation-input | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| source "$SCRIPT_DIR/should-use-structured.sh" | ||
|
|
||
| if ! should_use_structured; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| source "$SCRIPT_DIR/build-payload.sh" | ||
|
|
||
| INPUT=$(cat) | ||
|
|
||
| # Elicitation's matcher is the MCP server name; it also appears in tool_name. | ||
| SERVER_NAME=$(echo "$INPUT" | jq -r '.server_name // .tool_name // "unknown"' 2>/dev/null) | ||
| MESSAGE=$(echo "$INPUT" | jq -r '.message // .requestedSchema.description // empty' 2>/dev/null) | ||
|
|
||
| if [ -n "$MESSAGE" ] && [ ${#MESSAGE} -gt 200 ]; then | ||
| MESSAGE="${MESSAGE:0:197}..." | ||
| fi | ||
|
|
||
| BODY=$(build_payload "$INPUT" "question_asked" \ | ||
| --arg tool_name "$SERVER_NAME" \ | ||
| --arg summary "$MESSAGE") | ||
|
|
||
| "$SCRIPT_DIR/warp-notify.sh" "warp://cli-agent" "$BODY" |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README lists the new Warp events added in v3.0.0 but omits
question_asked, even though the hook inventory/table above documentsElicitationmapping toquestion_asked. For consistency and to avoid confusion for Warp-side routing work, consider includingquestion_askedin that v3.0.0 new-events list (or clarifying that it reuses an existing event name).