feat: add claude plugins for sandbox config and troubleshooting - #134
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Claude Code plugin packaging to devsandbox by introducing a configuration skill plugin and a PostToolUse triage hook plugin, along with repository docs/metadata and a test task to keep the bundled plugins from drifting from devsandbox behavior and documentation.
Changes:
- Add Claude plugin marketplace metadata plus two plugins:
devsandbox-config(docs-grounded config skill) anddevsandbox-triage(signature-based failure explainer hook). - Add plugin checks to
task test(triage behavioral tests + validate docs URL → source file mapping). - Document the plugins in README and record the change in the changelog.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yaml | Runs plugin checks as part of the main test task. |
| README.md | Documents how to install and what the plugins do. |
| CHANGELOG.md | Records the new plugin marketplace capability under Unreleased. |
| .claude-plugin/marketplace.json | Declares the repo as a Claude Code plugin marketplace and lists the plugins. |
| .claude-plugin/devsandbox-triage/scripts/triage.sh | Implements the PostToolUse hook that matches known devsandbox restriction signatures. |
| .claude-plugin/devsandbox-triage/scripts/triage_test.sh | Adds behavioral tests to prevent signature drift. |
| .claude-plugin/devsandbox-triage/README.md | Documents the triage plugin behavior and requirements. |
| .claude-plugin/devsandbox-triage/hooks/hooks.json | Registers the PostToolUse hook command and timeout. |
| .claude-plugin/devsandbox-triage/.claude-plugin/plugin.json | Plugin metadata for devsandbox-triage. |
| .claude-plugin/devsandbox-config/skills/devsandbox-config/SKILL.md | Adds the docs-grounded configuration skill definition and usage guidance. |
| .claude-plugin/devsandbox-config/.claude-plugin/plugin.json | Plugin metadata for devsandbox-config. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if ! command -v jq >/dev/null 2>&1; then | ||
| # A hook that cannot parse its input must say so once rather than fail | ||
| # silently, but it runs on every Bash call, so the notice is stamped. | ||
| marker="${CLAUDE_PLUGIN_DATA:-}/jq-missing-reported" | ||
| if [ -z "${CLAUDE_PLUGIN_DATA:-}" ] || [ ! -e "$marker" ]; then | ||
| [ -n "${CLAUDE_PLUGIN_DATA:-}" ] && mkdir -p "${CLAUDE_PLUGIN_DATA}" 2>/dev/null && : >"$marker" | ||
| printf '%s\n' '{"systemMessage":"devsandbox-triage: jq is not on PATH, so sandbox error triage is disabled. Install jq to enable it."}' | ||
| fi | ||
| exit 0 | ||
| fi |
| tool=$(jq -r '.tool_name // ""' <<<"$payload") | ||
| [ "$tool" = "Bash" ] || exit 0 | ||
|
|
||
| cmd=$(jq -r '.tool_input.command // ""' <<<"$payload") | ||
| out=$(jq -r '.tool_output | if type == "object" then (.text // tostring) else (. // "" | tostring) end' <<<"$payload") |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (2)
.claude-plugin/devsandbox-triage/scripts/triage.sh:30
- When
jqis missing, the marker is created under${TMPDIR:-/tmp}by default. In a shared, world-writable temp directory this creates a TOCTOU window between the-echeck and: >"$marker", allowing another local user to race in a symlink and potentially redirect the write (as the current user). Prefer a per-user, non-world-writable state directory fallback instead of/tmpwhenCLAUDE_PLUGIN_DATAis unset.
dir="${CLAUDE_PLUGIN_DATA:-${TMPDIR:-/tmp}}"
marker="$dir/devsandbox-triage-jq-missing.${UID:-0}"
if [ ! -e "$marker" ]; then
mkdir -p "$dir" 2>/dev/null
: >"$marker" 2>/dev/null
printf '%s\n' '{"systemMessage":"devsandbox-triage: jq is not on PATH, so sandbox error triage is disabled. Install jq to enable it."}'
Taskfile.yaml:103
- The docs-URL mapping check can pass even if the SKILL.md file is missing/unreadable:
grep ... "$skill"failing results in an emptyforlist andmissingstays 0, so the task exits successfully while the plugin is broken.
- |
skill=.claude-plugin/devsandbox-config/skills/devsandbox-config/SKILL.md
missing=0
for path in $(grep -oE 'docs/[a-z0-9][a-z0-9/-]*/' "$skill" | sed -E 's,^docs/,,; s,/$,,' | sort -u); do
if [ -f "docs/$path.md" ]; then
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.claude-plugin/devsandbox-triage/scripts/triage.sh:31
- The jq-missing marker write has a TOCTOU window and can follow a pre-created symlink (e.g., in /tmp) because it checks
-eand then truncates the path. This is avoidable by using an atomic create withnoclobber(and dropping the separate existence check), which also keeps the “print once” behavior.
dir="${CLAUDE_PLUGIN_DATA:-${TMPDIR:-/tmp}}"
marker="$dir/devsandbox-triage-jq-missing.${UID:-0}"
if [ ! -e "$marker" ]; then
mkdir -p "$dir" 2>/dev/null
: >"$marker" 2>/dev/null
printf '%s\n' '{"systemMessage":"devsandbox-triage: jq is not on PATH, so sandbox error triage is disabled. Install jq to enable it."}'
fi
exit 0
No description provided.