mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-03-17 10:33:08 +00:00
Compare commits
7 Commits
kenshiro/e
...
add-plugin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a6b21dabc | ||
|
|
205b6e0b30 | ||
|
|
b7c995dd3c | ||
|
|
028eccf544 | ||
|
|
8644df9ad5 | ||
|
|
adfc379663 | ||
|
|
55b58ec6e5 |
@@ -684,6 +684,17 @@
|
|||||||
"url": "https://github.com/semgrep/mcp-marketplace.git"
|
"url": "https://github.com/semgrep/mcp-marketplace.git"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/semgrep/mcp-marketplace.git"
|
"homepage": "https://github.com/semgrep/mcp-marketplace.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sourcegraph",
|
||||||
|
"description": "Code search and understanding across codebases. Search, read, and trace references across repositories; analyze refactor impact; investigate incidents via commit and diff search; run targeted security sweeps.",
|
||||||
|
"category": "development",
|
||||||
|
"source": {
|
||||||
|
"source": "url",
|
||||||
|
"url": "https://github.com/sourcegraph-community/sourcegraph-claudecode-plugin.git",
|
||||||
|
"sha": "cfe3d44476957b16d1575261bef6b2dc7cb1e0b7"
|
||||||
|
},
|
||||||
|
"homepage": "https://sourcegraph.com"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
.github/workflows/close-external-prs.yml
vendored
2
.github/workflows/close-external-prs.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: context.payload.pull_request.number,
|
issue_number: context.payload.pull_request.number,
|
||||||
body: `Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin [here](https://docs.google.com/forms/d/e/1FAIpQLSdeFthxvjOXUjxg1i3KrOOkEPDJtn71XC-KjmQlxNP63xYydg/viewform).`
|
body: `Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin [here](https://clau.de/plugin-directory-submission).`
|
||||||
});
|
});
|
||||||
|
|
||||||
await github.rest.pulls.update({
|
await github.rest.pulls.update({
|
||||||
|
|||||||
@@ -24,6 +24,16 @@ MAX_ITERATIONS=$(echo "$FRONTMATTER" | grep '^max_iterations:' | sed 's/max_iter
|
|||||||
# Extract completion_promise and strip surrounding quotes if present
|
# Extract completion_promise and strip surrounding quotes if present
|
||||||
COMPLETION_PROMISE=$(echo "$FRONTMATTER" | grep '^completion_promise:' | sed 's/completion_promise: *//' | sed 's/^"\(.*\)"$/\1/')
|
COMPLETION_PROMISE=$(echo "$FRONTMATTER" | grep '^completion_promise:' | sed 's/completion_promise: *//' | sed 's/^"\(.*\)"$/\1/')
|
||||||
|
|
||||||
|
# Session isolation: the state file is project-scoped, but the Stop hook
|
||||||
|
# fires in every Claude Code session in that project. If another session
|
||||||
|
# started the loop, this session must not block (or touch the state file).
|
||||||
|
# Legacy state files without session_id fall through (preserves old behavior).
|
||||||
|
STATE_SESSION=$(echo "$FRONTMATTER" | grep '^session_id:' | sed 's/session_id: *//' || true)
|
||||||
|
HOOK_SESSION=$(echo "$HOOK_INPUT" | jq -r '.session_id // ""')
|
||||||
|
if [[ -n "$STATE_SESSION" ]] && [[ "$STATE_SESSION" != "$HOOK_SESSION" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Validate numeric fields before arithmetic operations
|
# Validate numeric fields before arithmetic operations
|
||||||
if [[ ! "$ITERATION" =~ ^[0-9]+$ ]]; then
|
if [[ ! "$ITERATION" =~ ^[0-9]+$ ]]; then
|
||||||
echo "⚠️ Ralph loop: State file corrupted" >&2
|
echo "⚠️ Ralph loop: State file corrupted" >&2
|
||||||
@@ -77,35 +87,39 @@ if ! grep -q '"role":"assistant"' "$TRANSCRIPT_PATH"; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract last assistant message with explicit error handling
|
# Extract the most recent assistant text block.
|
||||||
LAST_LINE=$(grep '"role":"assistant"' "$TRANSCRIPT_PATH" | tail -1)
|
#
|
||||||
if [[ -z "$LAST_LINE" ]]; then
|
# Claude Code writes each content block (text/tool_use/thinking) as its own
|
||||||
echo "⚠️ Ralph loop: Failed to extract last assistant message" >&2
|
# JSONL line, all with role=assistant. So slurp the last N assistant lines,
|
||||||
|
# flatten to text blocks only, and take the last one.
|
||||||
|
#
|
||||||
|
# Capped at the last 100 assistant lines to keep jq's slurp input bounded
|
||||||
|
# for long-running sessions.
|
||||||
|
LAST_LINES=$(grep '"role":"assistant"' "$TRANSCRIPT_PATH" | tail -n 100)
|
||||||
|
if [[ -z "$LAST_LINES" ]]; then
|
||||||
|
echo "⚠️ Ralph loop: Failed to extract assistant messages" >&2
|
||||||
echo " Ralph loop is stopping." >&2
|
echo " Ralph loop is stopping." >&2
|
||||||
rm "$RALPH_STATE_FILE"
|
rm "$RALPH_STATE_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse JSON with error handling
|
# Parse the recent lines and pull out the final text block.
|
||||||
LAST_OUTPUT=$(echo "$LAST_LINE" | jq -r '
|
# `last // ""` yields empty string when no text blocks exist (e.g. a turn
|
||||||
.message.content |
|
# that is all tool calls). That's fine: empty text means no <promise> tag,
|
||||||
map(select(.type == "text")) |
|
# so the loop simply continues.
|
||||||
map(.text) |
|
# (Briefly disable errexit so a jq failure can be caught by the $? check.)
|
||||||
join("\n")
|
set +e
|
||||||
|
LAST_OUTPUT=$(echo "$LAST_LINES" | jq -rs '
|
||||||
|
map(.message.content[]? | select(.type == "text") | .text) | last // ""
|
||||||
' 2>&1)
|
' 2>&1)
|
||||||
|
JQ_EXIT=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
# Check if jq succeeded
|
# Check if jq succeeded
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $JQ_EXIT -ne 0 ]]; then
|
||||||
echo "⚠️ Ralph loop: Failed to parse assistant message JSON" >&2
|
echo "⚠️ Ralph loop: Failed to parse assistant message JSON" >&2
|
||||||
echo " Error: $LAST_OUTPUT" >&2
|
echo " Error: $LAST_OUTPUT" >&2
|
||||||
echo " This may indicate a transcript format issue" >&2
|
echo " This may indicate a transcript format issue." >&2
|
||||||
echo " Ralph loop is stopping." >&2
|
|
||||||
rm "$RALPH_STATE_FILE"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$LAST_OUTPUT" ]]; then
|
|
||||||
echo "⚠️ Ralph loop: Assistant message contained no text content" >&2
|
|
||||||
echo " Ralph loop is stopping." >&2
|
echo " Ralph loop is stopping." >&2
|
||||||
rm "$RALPH_STATE_FILE"
|
rm "$RALPH_STATE_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ cat > .claude/ralph-loop.local.md <<EOF
|
|||||||
---
|
---
|
||||||
active: true
|
active: true
|
||||||
iteration: 1
|
iteration: 1
|
||||||
|
session_id: ${CLAUDE_CODE_SESSION_ID:-}
|
||||||
max_iterations: $MAX_ITERATIONS
|
max_iterations: $MAX_ITERATIONS
|
||||||
completion_promise: $COMPLETION_PROMISE_YAML
|
completion_promise: $COMPLETION_PROMISE_YAML
|
||||||
started_at: "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
started_at: "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
|||||||
Reference in New Issue
Block a user