From 82f4e2da2799276756ea0028c154a173e10256ce Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:36:22 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++++++ README.md | 3 +++ hooks/entrypoints/stop.sh | 20 ++++++++++++++++ hooks/hooks.json | 15 ++++++++++++ plugin.lock.json | 49 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100755 hooks/entrypoints/stop.sh create mode 100644 hooks/hooks.json create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..6cb9a9b --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "test-plugin", + "description": "Minimal test plugin to reproduce hook output capture bug", + "version": "1.0.0", + "author": { + "name": "Test" + }, + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..824d18e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# test-plugin + +Minimal test plugin to reproduce hook output capture bug diff --git a/hooks/entrypoints/stop.sh b/hooks/entrypoints/stop.sh new file mode 100755 index 0000000..a6ea721 --- /dev/null +++ b/hooks/entrypoints/stop.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Simple Stop hook that blocks (forces continuation) - PLUGIN VERSION + +# Read input from STDIN (Claude Code passes hook data as JSON) +read -r input + +# Check if stop hook is already active (prevents infinite loop) +stop_hook_active=$(echo "$input" | jq -r '.stop_hook_active // false') + +if [ "$stop_hook_active" = "true" ]; then + # Already triggered once, allow normal stop + echo '{"continue":true,"stopReason":"","suppressOutput":true}' >&1 + exit 0 +fi + +# Output valid JSON response to STDERR (required when exit code is 2) +echo '{"continue":true,"stopReason":"","suppressOutput":true,"decision":"block","reason":"I notice I just used a reflexive agreement phrase. Let me provide a more substantive response:\n\nInstead of simply agreeing, let me analyze your point with specific technical reasoning, consider potential edge cases or alternative approaches, and offer constructive insights that build collaboratively on your observation."}' >&2 + +# Exit with code 2 to force continuation +exit 2 diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..4a5d6f4 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,15 @@ +{ + "description": "Minimal test hook configuration to reproduce output capture bug", + "hooks": { + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "${CLAUDE_PLUGIN_ROOT}/hooks/entrypoints/stop.sh" + } + ] + } + ] + } +} diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..425516a --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,49 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:kylesnowschwartz/plugin-hook-debug:plugins/test-plugin", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "5c72c29791246372a286f32eba9391d63bf634a5", + "treeHash": "db6ac4a14eddbb6a5fc4e7e3dd3d71be95a91bfe1f47dcdbe57201f663e08a54", + "generatedAt": "2025-11-28T10:20:02.408966Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "test-plugin", + "description": "Minimal test plugin to reproduce hook output capture bug", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "3c5a529b7cbfc5b9c3ec4a663f2e2afdc6d1c39f91bf75176351320a95cb812d" + }, + { + "path": "hooks/hooks.json", + "sha256": "de8e63ae139943ad092bd3994d627e23ef0de4c5462703d6b9a82fdf2b3e065f" + }, + { + "path": "hooks/entrypoints/stop.sh", + "sha256": "5b61b38c86addf3aea582b61b91d757f21673b68abc963cc93730e77a2f76946" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "369f896c55c9676c85778fb60151c0fd4be78ebed9e77fa206bd9aca04640e9a" + } + ], + "dirSha256": "db6ac4a14eddbb6a5fc4e7e3dd3d71be95a91bfe1f47dcdbe57201f663e08a54" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file