Skip to content

Commit 3cdf8d8

Browse files
authored
Add warp plugin to plugin marketplace (#137)
1 parent 9b56281 commit 3cdf8d8

17 files changed

Lines changed: 726 additions & 0 deletions

.augment-plugin/marketplace.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
"source": "./plugin_marketplace/code-review",
1616
"category": "code-quality",
1717
"tags": ["code-review", "git", "commands", "agents"]
18+
},
19+
{
20+
"name": "warp",
21+
"description": "Native Warp notifications when Auggie completes tasks or needs input",
22+
"version": "2.0.0",
23+
"source": "./plugin_marketplace/warp",
24+
"category": "productivity",
25+
"tags": ["notifications", "terminal", "warp"]
1826
}
1927
]
2028
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "warp",
3+
"description": "Warp terminal integration for Auggie - native notifications, and more to come",
4+
"version": "2.0.0",
5+
"author": {
6+
"name": "Augment Code",
7+
"url": "https://www.augmentcode.com"
8+
},
9+
"homepage": "https://github.com/augmentcode/auggie/tree/main/plugin_marketplace/warp"
10+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"description": "Warp terminal notifications",
3+
"hooks": {
4+
"SessionStart": [
5+
{
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-session-start.sh"
10+
}
11+
]
12+
}
13+
],
14+
"Stop": [
15+
{
16+
"metadata": {
17+
"includeConversationData": true
18+
},
19+
"hooks": [
20+
{
21+
"type": "command",
22+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-stop.sh"
23+
}
24+
]
25+
}
26+
],
27+
"Notification": [
28+
{
29+
"hooks": [
30+
{
31+
"type": "command",
32+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-notification.sh"
33+
}
34+
]
35+
}
36+
],
37+
"PostToolUse": [
38+
{
39+
"matcher": ".*",
40+
"hooks": [
41+
{
42+
"type": "command",
43+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-post-tool-use.sh"
44+
}
45+
]
46+
}
47+
],
48+
"PreToolUse": [
49+
{
50+
"matcher": ".*",
51+
"hooks": [
52+
{
53+
"type": "command",
54+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-pre-tool-use.sh"
55+
}
56+
]
57+
}
58+
],
59+
"PromptSubmit": [
60+
{
61+
"hooks": [
62+
{
63+
"type": "command",
64+
"command": "${AUGMENT_PLUGIN_ROOT}/scripts/on-prompt-submit.sh"
65+
}
66+
]
67+
}
68+
]
69+
}
70+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
# Builds a structured JSON notification payload for warp://cli-agent.
3+
#
4+
# Usage: source this file, then call build_payload with event-specific fields.
5+
#
6+
# Example:
7+
# source "$(dirname "${BASH_SOURCE[0]}")/build-payload.sh"
8+
# BODY=$(build_payload "$INPUT" "stop" \
9+
# --arg query "$QUERY" \
10+
# --arg response "$RESPONSE")
11+
#
12+
# The function extracts common fields (session_id, cwd, project) from the
13+
# hook's stdin JSON (passed as $1), then merges any extra jq args you pass.
14+
15+
# The current protocol version this plugin knows how to produce.
16+
PLUGIN_CURRENT_PROTOCOL_VERSION=1
17+
18+
# Negotiate the protocol version with Warp.
19+
# Uses min(plugin_current, warp_declared), falling back to 1 if Warp doesn't advertise a version.
20+
negotiate_protocol_version() {
21+
local warp_version="${WARP_CLI_AGENT_PROTOCOL_VERSION:-1}"
22+
if [ "$warp_version" -lt "$PLUGIN_CURRENT_PROTOCOL_VERSION" ] 2>/dev/null; then
23+
echo "$warp_version"
24+
else
25+
echo "$PLUGIN_CURRENT_PROTOCOL_VERSION"
26+
fi
27+
}
28+
29+
build_payload() {
30+
local input="$1"
31+
local event="$2"
32+
local agent="auggie"
33+
shift 2
34+
35+
local protocol_version
36+
protocol_version=$(negotiate_protocol_version)
37+
38+
# Extract common fields from the hook input
39+
local session_id cwd project
40+
session_id=$(echo "$input" | jq -r '.conversation_id // empty' 2>/dev/null)
41+
cwd=$(echo "$input" | jq -r '.workspace_roots[0] // empty' 2>/dev/null)
42+
project=""
43+
if [ -n "$cwd" ]; then
44+
project=$(basename "$cwd")
45+
fi
46+
47+
# Build the payload: common fields + any extra args passed by the caller.
48+
# Extra args should be jq flag pairs like: --arg key "value" or --argjson key '{"a":1}'
49+
jq -nc \
50+
--argjson v "$protocol_version" \
51+
--arg agent "$agent" \
52+
--arg event "$event" \
53+
--arg session_id "$session_id" \
54+
--arg cwd "$cwd" \
55+
--arg project "$project" \
56+
"$@" \
57+
'{v:$v, agent:$agent, event:$event, session_id:$session_id, cwd:$cwd, project:$project} + $ARGS.named'
58+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Hook script for Auggie Notification event
3+
# Sends a Warp notification when Auggie needs user input
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
# Opt-in debug logging (set AUGGIE_WARP_DEBUG=1)
8+
if [ -n "${AUGGIE_WARP_DEBUG:-}" ]; then
9+
_LOG="${AUGGIE_WARP_DEBUG_LOG:-/tmp/auggie-warp-debug.log}"
10+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $(basename "$0") pid=$$ TERM_PROGRAM=${TERM_PROGRAM:-} WARP_PROTO=${WARP_CLI_AGENT_PROTOCOL_VERSION:-} WARP_VER=${WARP_CLIENT_VERSION:-}" >> "$_LOG"
11+
fi
12+
13+
# Read hook input from stdin
14+
INPUT=$(cat)
15+
[ -n "${AUGGIE_WARP_DEBUG:-}" ] && echo "[stdin] $INPUT" >> "${AUGGIE_WARP_DEBUG_LOG:-/tmp/auggie-warp-debug.log}"
16+
17+
# Extract the notification message
18+
MSG=$(echo "$INPUT" | jq -r '.message // "Input needed"' 2>/dev/null)
19+
[ -z "$MSG" ] && MSG="Input needed"
20+
21+
"$SCRIPT_DIR/warp-notify.sh" "Auggie" "$MSG"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Hook script for Auggie SessionStart event
3+
# Shows welcome message and Warp detection status
4+
5+
# Opt-in debug logging (set AUGGIE_WARP_DEBUG=1)
6+
if [ -n "${AUGGIE_WARP_DEBUG:-}" ]; then
7+
_LOG="${AUGGIE_WARP_DEBUG_LOG:-/tmp/auggie-warp-debug.log}"
8+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $(basename "$0") pid=$$ TERM_PROGRAM=${TERM_PROGRAM:-} WARP_PROTO=${WARP_CLI_AGENT_PROTOCOL_VERSION:-} WARP_VER=${WARP_CLIENT_VERSION:-}" >> "$_LOG"
9+
fi
10+
11+
# Check if running in Warp terminal
12+
if [ "$TERM_PROGRAM" = "WarpTerminal" ]; then
13+
# Running in Warp - notifications will work
14+
cat << 'EOF'
15+
{
16+
"systemMessage": "🔔 Warp plugin active. You'll receive native Warp notifications when tasks complete or input is needed."
17+
}
18+
EOF
19+
else
20+
exit 0
21+
fi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# Hook script for Auggie Stop event
3+
# Sends a Warp notification when Auggie completes a task
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
# Opt-in debug logging (set AUGGIE_WARP_DEBUG=1)
8+
if [ -n "${AUGGIE_WARP_DEBUG:-}" ]; then
9+
_LOG="${AUGGIE_WARP_DEBUG_LOG:-/tmp/auggie-warp-debug.log}"
10+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $(basename "$0") pid=$$ TERM_PROGRAM=${TERM_PROGRAM:-} WARP_PROTO=${WARP_CLI_AGENT_PROTOCOL_VERSION:-} WARP_VER=${WARP_CLIENT_VERSION:-}" >> "$_LOG"
11+
fi
12+
13+
# Read hook input from stdin
14+
INPUT=$(cat)
15+
[ -n "${AUGGIE_WARP_DEBUG:-}" ] && echo "[stdin] $INPUT" >> "${AUGGIE_WARP_DEBUG_LOG:-/tmp/auggie-warp-debug.log}"
16+
17+
# Extract transcript path from the hook input
18+
TRANSCRIPT_PATH=$(echo "$INPUT" | jq -r '.transcript_path // empty' 2>/dev/null)
19+
20+
# Default message
21+
MSG="Task completed"
22+
23+
# Try to extract prompt and response from the transcript (JSONL format)
24+
if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
25+
# Get the first user prompt
26+
PROMPT=$(jq -rs '
27+
[.[] | select(.type == "user")] | first | .message.content // empty
28+
' "$TRANSCRIPT_PATH" 2>/dev/null)
29+
30+
# Get the last assistant response
31+
RESPONSE=$(jq -rs '
32+
[.[] | select(.type == "assistant" and .message.content)] | last |
33+
[.message.content[] | select(.type == "text") | .text] | join(" ")
34+
' "$TRANSCRIPT_PATH" 2>/dev/null)
35+
36+
if [ -n "$PROMPT" ] && [ -n "$RESPONSE" ]; then
37+
# Truncate prompt to 50 chars
38+
if [ ${#PROMPT} -gt 50 ]; then
39+
PROMPT="${PROMPT:0:47}..."
40+
fi
41+
# Truncate response to 120 chars
42+
if [ ${#RESPONSE} -gt 120 ]; then
43+
RESPONSE="${RESPONSE:0:117}..."
44+
fi
45+
MSG="\"${PROMPT}\"${RESPONSE}"
46+
elif [ -n "$RESPONSE" ]; then
47+
# Fallback to just response if no prompt found
48+
if [ ${#RESPONSE} -gt 175 ]; then
49+
RESPONSE="${RESPONSE:0:172}..."
50+
fi
51+
MSG="$RESPONSE"
52+
fi
53+
fi
54+
55+
"$SCRIPT_DIR/warp-notify.sh" "Auggie" "$MSG"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Warp notification utility using OSC escape sequences
3+
# Usage: warp-notify.sh <title> <body>
4+
5+
TITLE="${1:-Notification}"
6+
BODY="${2:-}"
7+
8+
# OSC 777 format: \033]777;notify;<title>;<body>\007
9+
# Write directly to /dev/tty to ensure it reaches the terminal
10+
printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY" > /dev/tty 2>/dev/null || true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Hook script for Auggie Notification event (idle_prompt only)
3+
# Sends a structured Warp notification when Auggie has been idle
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
source "$SCRIPT_DIR/should-use-structured.sh"
8+
9+
# Legacy fallback for old Warp versions
10+
if ! should_use_structured; then
11+
[ "$TERM_PROGRAM" = "WarpTerminal" ] && exec "$SCRIPT_DIR/legacy/on-notification.sh"
12+
exit 0
13+
fi
14+
15+
source "$SCRIPT_DIR/build-payload.sh"
16+
17+
# Read hook input from stdin
18+
INPUT=$(cat)
19+
20+
# Extract notification-specific fields
21+
NOTIF_TYPE=$(echo "$INPUT" | jq -r '.notification_type // "unknown"' 2>/dev/null)
22+
MSG=$(echo "$INPUT" | jq -r '.notification_message // "Input needed"' 2>/dev/null)
23+
[ -z "$MSG" ] && MSG="Input needed"
24+
25+
BODY=$(build_payload "$INPUT" "$NOTIF_TYPE" \
26+
--arg summary "$MSG")
27+
"$SCRIPT_DIR/warp-notify.sh" "warp://cli-agent" "$BODY"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Hook script for Auggie PostToolUse event
3+
# Sends a structured Warp notification after a tool call completes,
4+
# transitioning the session status from Blocked back to Running.
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
8+
source "$SCRIPT_DIR/should-use-structured.sh"
9+
10+
# No legacy equivalent for this hook
11+
if ! should_use_structured; then
12+
exit 0
13+
fi
14+
15+
source "$SCRIPT_DIR/build-payload.sh"
16+
17+
# Read hook input from stdin
18+
INPUT=$(cat)
19+
20+
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
21+
22+
BODY=$(build_payload "$INPUT" "tool_complete" \
23+
--arg tool_name "$TOOL_NAME")
24+
25+
"$SCRIPT_DIR/warp-notify.sh" "warp://cli-agent" "$BODY"

0 commit comments

Comments
 (0)