@zenuml/core 3.47.9 → 3.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/zenuml.mjs +13529 -0
- package/dist/cli/zenuml.mjs.map +1 -0
- package/dist/cloud-icons-eHuugVSv.js.map +1 -0
- package/dist/zenuml.esm.mjs +2153 -2156
- package/dist/zenuml.esm.mjs.map +1 -0
- package/dist/zenuml.js +82 -82
- package/dist/zenuml.js.map +1 -0
- package/package.json +18 -5
- package/.agents/skills/babysit-pr/SKILL.md +0 -223
- package/.agents/skills/babysit-pr/agents/openai.yaml +0 -7
- package/.agents/skills/dia-scoring/SKILL.md +0 -139
- package/.agents/skills/dia-scoring/agents/openai.yaml +0 -7
- package/.agents/skills/dia-scoring/references/selectors-and-keys.md +0 -253
- package/.agents/skills/land-pr/SKILL.md +0 -120
- package/.agents/skills/propagate-core-release/SKILL.md +0 -205
- package/.agents/skills/propagate-core-release/agents/openai.yaml +0 -7
- package/.agents/skills/propagate-core-release/references/downstreams.md +0 -42
- package/.agents/skills/ship-branch/SKILL.md +0 -105
- package/.agents/skills/submit-branch/SKILL.md +0 -76
- package/.agents/skills/validate-branch/SKILL.md +0 -72
- package/.claude/commands/README.md +0 -162
- package/.claude/commands/analyze.md +0 -101
- package/.claude/commands/clarify.md +0 -158
- package/.claude/commands/code-review.md +0 -322
- package/.claude/commands/constitution.md +0 -73
- package/.claude/commands/create-docs.md +0 -309
- package/.claude/commands/full-context.md +0 -121
- package/.claude/commands/gemini-consult.md +0 -164
- package/.claude/commands/handoff.md +0 -146
- package/.claude/commands/implement.md +0 -56
- package/.claude/commands/plan.md +0 -43
- package/.claude/commands/refactor.md +0 -188
- package/.claude/commands/specify.md +0 -21
- package/.claude/commands/tasks.md +0 -62
- package/.claude/commands/update-docs.md +0 -314
- package/.claude/hooks/README.md +0 -270
- package/.claude/hooks/config/sensitive-patterns.json +0 -86
- package/.claude/hooks/gemini-context-injector.sh +0 -129
- package/.claude/hooks/mcp-security-scan.sh +0 -147
- package/.claude/hooks/notify.sh +0 -103
- package/.claude/hooks/setup/hook-setup.md +0 -96
- package/.claude/hooks/setup/settings.json.template +0 -63
- package/.claude/hooks/sounds/complete.wav +0 -0
- package/.claude/hooks/sounds/input-needed.wav +0 -0
- package/.claude/hooks/subagent-context-injector.sh +0 -65
- package/.claude/skills/babysit-pr/SKILL.md +0 -223
- package/.claude/skills/babysit-pr/agents/openai.yaml +0 -7
- package/.claude/skills/dia-scoring/SKILL.md +0 -139
- package/.claude/skills/dia-scoring/agents/openai.yaml +0 -7
- package/.claude/skills/dia-scoring/references/selectors-and-keys.md +0 -253
- package/.claude/skills/emoji-eval/SKILL.md +0 -187
- package/.claude/skills/land-pr/SKILL.md +0 -120
- package/.claude/skills/propagate-core-release/SKILL.md +0 -205
- package/.claude/skills/propagate-core-release/agents/openai.yaml +0 -7
- package/.claude/skills/propagate-core-release/references/downstreams.md +0 -42
- package/.claude/skills/ship-branch/SKILL.md +0 -105
- package/.claude/skills/submit-branch/SKILL.md +0 -76
- package/.claude/skills/validate-branch/SKILL.md +0 -72
- package/.claude/skills/zenuml-ux-research/SKILL.md +0 -183
- package/.claude/skills/zenuml-ux-research/references/assertion-catalog.md +0 -261
- package/.claude/skills/zenuml-ux-research/references/best-practices-overview.md +0 -56
- package/.claude/skills/zenuml-ux-research/references/report-template.md +0 -89
- package/.claude/skills/zenuml-ux-research/references/scenarios/edit-message-label.md +0 -37
- package/.claude/skills/zenuml-ux-research/references/scenarios/insert-message.md +0 -36
- package/.claude/skills/zenuml-ux-research/references/scenarios/insert-participant.md +0 -31
- package/.claude/skills/zenuml-ux-research/references/scenarios/rename-participant.md +0 -33
- package/.claude/skills/zenuml-ux-research/references/scenarios/undo-insert.md +0 -35
- package/.devcontainer/devcontainer.json +0 -21
- package/.dockerignore +0 -19
- package/.eslintrc.js +0 -39
- package/.git-blame-ignore-revs +0 -6
- package/.kiro/hooks/README.md +0 -38
- package/.kiro/hooks/session-sound-notification.js +0 -44
- package/.kiro/hooks/session-sound-notification.json +0 -23
- package/.mcp.json.example +0 -17
- package/.nvmrc +0 -1
- package/.prettierignore +0 -4
- package/.prettierrc +0 -1
- package/.specify/memory/constitution.md +0 -33
- package/.specify/scripts/bash/check-prerequisites.sh +0 -166
- package/.specify/scripts/bash/common.sh +0 -113
- package/.specify/scripts/bash/create-new-feature.sh +0 -97
- package/.specify/scripts/bash/setup-plan.sh +0 -60
- package/.specify/scripts/bash/update-agent-context.sh +0 -728
- package/.specify/templates/agent-file-template.md +0 -23
- package/.specify/templates/plan-template.md +0 -219
- package/.specify/templates/spec-template.md +0 -116
- package/.specify/templates/tasks-template.md +0 -127
- package/.storybook/main.ts +0 -25
- package/.storybook/preview.ts +0 -29
- package/.watchmanconfig +0 -3
- package/AGENTS.md +0 -26
- package/CLAUDE.md +0 -124
- package/DEPLOYMENT.md +0 -62
- package/Dockerfile +0 -36
- package/IMPLEMENTATION_PLAN.md +0 -163
- package/Integration/vanilla-js/index.html +0 -42
- package/MCP-ASSISTANT-RULES.md +0 -85
- package/README_CN.md +0 -15
- package/TUTORIAL.md +0 -116
- package/antlr/antlr-4.11.1-complete.jar +0 -0
- package/bun.lock +0 -1544
- package/bunfig.toml +0 -52
- package/docs/UNICODE_SUPPORT.md +0 -179
- package/docs/ai-context/deployment-infrastructure.md +0 -21
- package/docs/ai-context/docs-overview.md +0 -89
- package/docs/ai-context/handoff.md +0 -174
- package/docs/ai-context/project-structure.md +0 -160
- package/docs/ai-context/system-integration.md +0 -21
- package/docs/asciidoc/contributor.adoc +0 -54
- package/docs/asciidoc/create-my-own-theme.adoc +0 -149
- package/docs/asciidoc/images/creation-component.png +0 -0
- package/docs/asciidoc/images/creation-rtl.png +0 -0
- package/docs/asciidoc/images/message-arrow-rtl.png +0 -0
- package/docs/asciidoc/images/occurrence.png +0 -0
- package/docs/asciidoc/images/return-message-conflict.png +0 -0
- package/docs/asciidoc/images/shift-up-half-the-height.png +0 -0
- package/docs/asciidoc/images/three-layer-info-arch.png +0 -0
- package/docs/asciidoc/images/vertical-alignment.svg +0 -1
- package/docs/asciidoc/images/vertically-aligning.png +0 -0
- package/docs/asciidoc/index.adoc +0 -277
- package/docs/asciidoc/theme-debug-web-app.png +0 -0
- package/docs/asciidoc/tutorial.adoc +0 -22
- package/docs/asciidoc/user-css.png +0 -0
- package/docs/async-vs-sync-parser-rules.md +0 -81
- package/docs/divider-parser-allow-spaces.md +0 -38
- package/docs/highlighting-messages.md +0 -52
- package/docs/images/editor-sample.png +0 -0
- package/docs/inherited-vs-provided-from.md +0 -64
- package/docs/parser/Assignment.md +0 -8
- package/docs/parser/PARSER_IMPROVEMENTS_CC.md +0 -425
- package/docs/parser/grammar_review_gemini.md +0 -116
- package/docs/participants-function.md +0 -25
- package/docs/responsive-participant-margin.md +0 -52
- package/docs/starter.md +0 -9
- package/docs/superpowers/plans/2026-03-27-e2e-test-reorg.md +0 -698
- package/docs/superpowers/plans/2026-03-30-emoji-support.md +0 -1220
- package/docs/superpowers/plans/2026-03-30-self-correcting-scoring.md +0 -206
- package/docs/superpowers/plans/2026-04-15-keyboard-editing-on-diagram.md +0 -1992
- package/docs/superpowers/plans/2026-04-15-zenuml-ux-research-skill.md +0 -1452
- package/docs/ux-research/.gitkeep +0 -0
- package/docs/ux-research/2026-04-15-rename-participant.md +0 -156
- package/docs/ux-research/2026-04-18-insert-participant.md +0 -151
- package/docs/width-translate-and-offsets.md +0 -62
- package/docs/xss.md +0 -59
- package/e2e/data/compare-cases.js +0 -1090
- package/e2e/data/diff-algorithm.js +0 -199
- package/e2e/fixtures/create-message.html +0 -26
- package/e2e/fixtures/editable-label.html +0 -35
- package/e2e/fixtures/editable-span.html +0 -122
- package/e2e/fixtures/empty-diagram.html +0 -23
- package/e2e/fixtures/fixture.html +0 -31
- package/e2e/fixtures/insert-participant.html +0 -23
- package/e2e/fixtures/reorder-cross-fragment.html +0 -31
- package/e2e/fixtures/reorder-fragment.html +0 -29
- package/e2e/fixtures/reorder-message.html +0 -27
- package/e2e/fixtures/svg-test.html +0 -21
- package/e2e/fixtures/type-switch.html +0 -29
- package/e2e/tools/canonical-history.html +0 -908
- package/e2e/tools/compare-case.html +0 -371
- package/e2e/tools/compare.html +0 -35
- package/e2e/tools/native-diff-ext/background.js +0 -60
- package/e2e/tools/native-diff-ext/bridge.js +0 -26
- package/e2e/tools/native-diff-ext/content.js +0 -194
- package/e2e/tools/svg-preview.html +0 -56
- package/embed.html +0 -193
- package/eslint.config.mjs +0 -35
- package/firebase-debug.log +0 -108
- package/iframe-container-demo/diagram.html +0 -124
- package/iframe-container-demo/host.html +0 -817
- package/index.html +0 -771
- package/mermaid-zenuml-async-spa-auth.png +0 -0
- package/mermaid-zenuml-async-spa-auth.snapshot.md +0 -96
- package/newsletter/unicode-support-announcement.md +0 -134
- package/playground/creation.html +0 -53
- package/playground/message.html +0 -63
- package/playwright.config.ts +0 -40
- package/renderer.html +0 -366
- package/scripts/analyze-compare-case/collect-data.mjs +0 -1134
- package/scripts/analyze-compare-case/config.mjs +0 -102
- package/scripts/analyze-compare-case/geometry.mjs +0 -101
- package/scripts/analyze-compare-case/native-diff.mjs +0 -224
- package/scripts/analyze-compare-case/output.mjs +0 -74
- package/scripts/analyze-compare-case/panel-diff.mjs +0 -114
- package/scripts/analyze-compare-case/report.mjs +0 -162
- package/scripts/analyze-compare-case/residual-scopes.mjs +0 -347
- package/scripts/analyze-compare-case/scoring.mjs +0 -829
- package/scripts/analyze-compare-case.mjs +0 -149
- package/scripts/bump-version.js +0 -117
- package/scripts/snapshot-dual.js +0 -173
- package/scripts/update-snapshots.js +0 -70
- package/skills/dia-scoring/SKILL.md +0 -129
- package/skills/dia-scoring/agents/openai.yaml +0 -7
- package/skills/dia-scoring/references/selectors-and-keys.md +0 -253
- package/tailwind.config.js +0 -126
- package/test-compression.html +0 -274
- package/test-mermaid-zenuml.html +0 -57
- package/test-setup.ts +0 -124
- package/test-url-params.html +0 -192
- package/tsconfig.app.json +0 -31
- package/tsconfig.node.json +0 -24
- package/tsconfig.test.json +0 -9
- package/vite.config.lib.ts +0 -93
- package/vite.config.ts +0 -84
- package/wrangler.toml +0 -18
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Gemini Context Injector Hook
|
|
3
|
-
# Automatically adds project context files to new Gemini consultation sessions:
|
|
4
|
-
# - docs/ai-context/project-structure.md
|
|
5
|
-
# - MCP-ASSISTANT-RULES.md
|
|
6
|
-
#
|
|
7
|
-
# This hook enhances Gemini consultations by automatically including your project's
|
|
8
|
-
# structure documentation and assistant rules, ensuring the AI has complete context.
|
|
9
|
-
|
|
10
|
-
set -euo pipefail
|
|
11
|
-
|
|
12
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
14
|
-
PROJECT_STRUCTURE_FILE="$PROJECT_ROOT/docs/ai-context/project-structure.md"
|
|
15
|
-
MCP_RULES_FILE="$PROJECT_ROOT/MCP-ASSISTANT-RULES.md"
|
|
16
|
-
LOG_FILE="$SCRIPT_DIR/../logs/context-injection.log"
|
|
17
|
-
|
|
18
|
-
# Ensure log directory exists
|
|
19
|
-
mkdir -p "$(dirname "$LOG_FILE")"
|
|
20
|
-
|
|
21
|
-
# Read input from stdin
|
|
22
|
-
INPUT_JSON=$(cat)
|
|
23
|
-
|
|
24
|
-
# Function to log injection events
|
|
25
|
-
log_injection_event() {
|
|
26
|
-
local event_type="$1"
|
|
27
|
-
local details="$2"
|
|
28
|
-
local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
29
|
-
echo "{\"timestamp\": \"$timestamp\", \"event\": \"$event_type\", \"details\": \"$details\"}" >> "$LOG_FILE"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
# Main logic
|
|
33
|
-
main() {
|
|
34
|
-
# Extract tool information from stdin
|
|
35
|
-
local tool_name=$(echo "$INPUT_JSON" | jq -r '.tool_name // ""')
|
|
36
|
-
|
|
37
|
-
# Only process Gemini consultation requests
|
|
38
|
-
if [[ "$tool_name" != "mcp__gemini__consult_gemini" ]]; then
|
|
39
|
-
echo '{"continue": true}'
|
|
40
|
-
exit 0
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Extract tool arguments
|
|
44
|
-
local tool_args=$(echo "$INPUT_JSON" | jq -r '.tool_input // "{}"')
|
|
45
|
-
|
|
46
|
-
# Check if this is a new session (no session_id provided)
|
|
47
|
-
local session_id=$(echo "$tool_args" | jq -r '.session_id // ""' 2>/dev/null || echo "")
|
|
48
|
-
|
|
49
|
-
if [[ -z "$session_id" || "$session_id" == "null" ]]; then
|
|
50
|
-
log_injection_event "new_session_detected" "preparing_context_injection"
|
|
51
|
-
|
|
52
|
-
# Check if required files exist
|
|
53
|
-
local missing_files=""
|
|
54
|
-
if [[ ! -f "$PROJECT_STRUCTURE_FILE" ]]; then
|
|
55
|
-
missing_files="$missing_files project_structure.md"
|
|
56
|
-
fi
|
|
57
|
-
if [[ ! -f "$MCP_RULES_FILE" ]]; then
|
|
58
|
-
missing_files="$missing_files MCP-ASSISTANT-RULES.md"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# If either file is missing, log warning but continue
|
|
62
|
-
if [[ -n "$missing_files" ]]; then
|
|
63
|
-
log_injection_event "warning" "missing_files:$missing_files"
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
# If both files are missing, exit early
|
|
67
|
-
if [[ ! -f "$PROJECT_STRUCTURE_FILE" ]] && [[ ! -f "$MCP_RULES_FILE" ]]; then
|
|
68
|
-
echo '{"continue": true}'
|
|
69
|
-
exit 0
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# Extract current attached_files if any
|
|
73
|
-
local current_files=$(echo "$tool_args" | jq -c '.attached_files // []' 2>/dev/null || echo "[]")
|
|
74
|
-
|
|
75
|
-
# Check if files are already included
|
|
76
|
-
local has_project_structure=$(echo "$current_files" | jq -e ".[] | select(. == \"$PROJECT_STRUCTURE_FILE\")" > /dev/null 2>&1 && echo "true" || echo "false")
|
|
77
|
-
local has_mcp_rules=$(echo "$current_files" | jq -e ".[] | select(. == \"$MCP_RULES_FILE\")" > /dev/null 2>&1 && echo "true" || echo "false")
|
|
78
|
-
|
|
79
|
-
# If both files exist and are already included, skip
|
|
80
|
-
if [[ -f "$PROJECT_STRUCTURE_FILE" ]] && [[ "$has_project_structure" == "true" ]] && \
|
|
81
|
-
[[ -f "$MCP_RULES_FILE" ]] && [[ "$has_mcp_rules" == "true" ]]; then
|
|
82
|
-
log_injection_event "skipped" "all_required_files_already_included"
|
|
83
|
-
echo '{"continue": true}'
|
|
84
|
-
exit 0
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Add missing files to attached_files
|
|
88
|
-
local modified_args="$tool_args"
|
|
89
|
-
local files_added=""
|
|
90
|
-
|
|
91
|
-
if [[ -f "$PROJECT_STRUCTURE_FILE" ]] && [[ "$has_project_structure" == "false" ]]; then
|
|
92
|
-
modified_args=$(echo "$modified_args" | jq --arg file "$PROJECT_STRUCTURE_FILE" '
|
|
93
|
-
.attached_files = ((.attached_files // []) + [$file])
|
|
94
|
-
' 2>/dev/null)
|
|
95
|
-
files_added="$files_added project_structure.md"
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
if [[ -f "$MCP_RULES_FILE" ]] && [[ "$has_mcp_rules" == "false" ]]; then
|
|
99
|
-
modified_args=$(echo "$modified_args" | jq --arg file "$MCP_RULES_FILE" '
|
|
100
|
-
.attached_files = ((.attached_files // []) + [$file])
|
|
101
|
-
' 2>/dev/null)
|
|
102
|
-
files_added="$files_added MCP-ASSISTANT-RULES.md"
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
if [[ -n "$modified_args" ]] && [[ "$modified_args" != "$tool_args" ]]; then
|
|
106
|
-
log_injection_event "context_injected" "added_files:$files_added"
|
|
107
|
-
|
|
108
|
-
# Update the input JSON with modified tool_input
|
|
109
|
-
local output_json=$(echo "$INPUT_JSON" | jq --argjson new_args "$modified_args" '.tool_input = $new_args')
|
|
110
|
-
|
|
111
|
-
# Return the modified input to stdout
|
|
112
|
-
echo "$output_json"
|
|
113
|
-
exit 0
|
|
114
|
-
else
|
|
115
|
-
log_injection_event "error" "failed_to_modify_arguments"
|
|
116
|
-
# Continue without modification on error
|
|
117
|
-
echo '{"continue": true}'
|
|
118
|
-
exit 0
|
|
119
|
-
fi
|
|
120
|
-
else
|
|
121
|
-
log_injection_event "existing_session" "session_id:$session_id"
|
|
122
|
-
# For existing sessions, continue without modification
|
|
123
|
-
echo '{"continue": true}'
|
|
124
|
-
exit 0
|
|
125
|
-
fi
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
# Run main function
|
|
129
|
-
main
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# MCP Security Scanner Hook
|
|
3
|
-
# Scans MCP requests for sensitive data before sending to external services
|
|
4
|
-
#
|
|
5
|
-
# This hook protects against accidental exposure of secrets, API keys, and other
|
|
6
|
-
# sensitive information when using MCP servers like Gemini or Context7.
|
|
7
|
-
|
|
8
|
-
set -euo pipefail
|
|
9
|
-
|
|
10
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
-
PATTERNS_FILE="$SCRIPT_DIR/config/sensitive-patterns.json"
|
|
12
|
-
LOG_FILE="$SCRIPT_DIR/../logs/security-scan.log"
|
|
13
|
-
|
|
14
|
-
# Ensure log directory exists
|
|
15
|
-
mkdir -p "$(dirname "$LOG_FILE")"
|
|
16
|
-
|
|
17
|
-
# Read input from stdin
|
|
18
|
-
INPUT_JSON=$(cat)
|
|
19
|
-
|
|
20
|
-
# Function to log security events
|
|
21
|
-
log_security_event() {
|
|
22
|
-
local event_type="$1"
|
|
23
|
-
local details="$2"
|
|
24
|
-
local tool_name="${3:-unknown}"
|
|
25
|
-
local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
26
|
-
echo "{\"timestamp\": \"$timestamp\", \"tool\": \"$tool_name\", \"event\": \"$event_type\", \"details\": \"$details\"}" >> "$LOG_FILE"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
# Function to check if content matches sensitive patterns
|
|
30
|
-
check_sensitive_content() {
|
|
31
|
-
local content="$1"
|
|
32
|
-
local pattern_type="$2"
|
|
33
|
-
|
|
34
|
-
# Get patterns from JSON config
|
|
35
|
-
local patterns=$(jq -r ".patterns.$pattern_type[]" "$PATTERNS_FILE" 2>/dev/null || echo "")
|
|
36
|
-
|
|
37
|
-
for pattern in $patterns; do
|
|
38
|
-
if echo "$content" | grep -qiE "$pattern"; then
|
|
39
|
-
# Check whitelist
|
|
40
|
-
local whitelisted=false
|
|
41
|
-
local whitelist_patterns=$(jq -r '.whitelist.allowed_mentions[]' "$PATTERNS_FILE" 2>/dev/null || echo "")
|
|
42
|
-
|
|
43
|
-
for whitelist in $whitelist_patterns; do
|
|
44
|
-
if echo "$content" | grep -qF "$whitelist"; then
|
|
45
|
-
whitelisted=true
|
|
46
|
-
break
|
|
47
|
-
fi
|
|
48
|
-
done
|
|
49
|
-
|
|
50
|
-
if [[ "$whitelisted" == "false" ]]; then
|
|
51
|
-
return 0 # Found sensitive data
|
|
52
|
-
fi
|
|
53
|
-
fi
|
|
54
|
-
done
|
|
55
|
-
|
|
56
|
-
return 1 # No sensitive data found
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# Function to scan file content
|
|
60
|
-
scan_file_content() {
|
|
61
|
-
local file_path="$1"
|
|
62
|
-
|
|
63
|
-
# Check if file name itself is sensitive
|
|
64
|
-
local filename=$(basename "$file_path")
|
|
65
|
-
if check_sensitive_content "$filename" "sensitive_files"; then
|
|
66
|
-
return 0 # Sensitive file
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
# Don't scan files that don't exist or are too large
|
|
70
|
-
if [[ ! -f "$file_path" ]] || [[ $(stat -f%z "$file_path" 2>/dev/null || stat -c%s "$file_path" 2>/dev/null || echo "999999999") -gt 1048576 ]]; then
|
|
71
|
-
return 1
|
|
72
|
-
fi
|
|
73
|
-
|
|
74
|
-
# Read and scan file content
|
|
75
|
-
local content=$(cat "$file_path" 2>/dev/null || echo "")
|
|
76
|
-
|
|
77
|
-
# Check all pattern types
|
|
78
|
-
for pattern_type in api_keys credentials regex_patterns; do
|
|
79
|
-
if check_sensitive_content "$content" "$pattern_type"; then
|
|
80
|
-
return 0 # Found sensitive data
|
|
81
|
-
fi
|
|
82
|
-
done
|
|
83
|
-
|
|
84
|
-
return 1
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
# Main scanning logic
|
|
88
|
-
main() {
|
|
89
|
-
# Extract tool information from stdin
|
|
90
|
-
local tool_name=$(echo "$INPUT_JSON" | jq -r '.tool_name // ""')
|
|
91
|
-
local tool_args=$(echo "$INPUT_JSON" | jq -r '.tool_input // "{}"')
|
|
92
|
-
|
|
93
|
-
log_security_event "scan_started" "$tool_name" "$tool_name"
|
|
94
|
-
|
|
95
|
-
# Check code_context for sensitive data
|
|
96
|
-
local code_context=$(echo "$tool_args" | jq -r '.code_context // ""' 2>/dev/null || echo "")
|
|
97
|
-
if [[ -n "$code_context" ]]; then
|
|
98
|
-
for pattern_type in api_keys credentials regex_patterns; do
|
|
99
|
-
if check_sensitive_content "$code_context" "$pattern_type"; then
|
|
100
|
-
log_security_event "blocked" "sensitive_data_in_code_context" "$tool_name"
|
|
101
|
-
echo '{"decision": "block", "reason": "Security Alert: Detected sensitive data in code_context. Found patterns matching actual credentials (API keys, passwords, or secrets with values). For discussions about security topics, use placeholders like YOUR_API_KEY, <password>, or example values instead of real credentials."}'
|
|
102
|
-
exit 2
|
|
103
|
-
fi
|
|
104
|
-
done
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
# Check problem_description for sensitive data
|
|
108
|
-
local problem_desc=$(echo "$tool_args" | jq -r '.problem_description // ""' 2>/dev/null || echo "")
|
|
109
|
-
if [[ -n "$problem_desc" ]]; then
|
|
110
|
-
for pattern_type in api_keys credentials regex_patterns; do
|
|
111
|
-
if check_sensitive_content "$problem_desc" "$pattern_type"; then
|
|
112
|
-
log_security_event "blocked" "sensitive_data_in_problem_description" "$tool_name"
|
|
113
|
-
echo '{"decision": "block", "reason": "Security Alert: Detected sensitive data in problem description. Found patterns matching actual credentials (API keys, passwords, connection strings, or tokens with values). For security discussions, use placeholders: YOUR_API_KEY, <password>, postgres://user:password@localhost, or example-token-here."}'
|
|
114
|
-
exit 2
|
|
115
|
-
fi
|
|
116
|
-
done
|
|
117
|
-
fi
|
|
118
|
-
|
|
119
|
-
# Check attached files
|
|
120
|
-
local attached_files=$(echo "$tool_args" | jq -r '.attached_files[]?' 2>/dev/null || echo "")
|
|
121
|
-
for file in $attached_files; do
|
|
122
|
-
if scan_file_content "$file"; then
|
|
123
|
-
log_security_event "blocked" "sensitive_file_attached:$file" "$tool_name"
|
|
124
|
-
echo "{\"decision\": \"block\", \"reason\": \"Security Alert: Detected sensitive content in attached file $file. Found credentials, private keys, or environment files. Remove actual secrets and use placeholders like YOUR_SECRET_HERE or example values for demonstrations.\"}"
|
|
125
|
-
exit 2
|
|
126
|
-
fi
|
|
127
|
-
done
|
|
128
|
-
|
|
129
|
-
# Check specific question for Context7
|
|
130
|
-
if [[ "$tool_name" == "mcp__context7__get-library-docs" ]]; then
|
|
131
|
-
local library_id=$(echo "$tool_args" | jq -r '.context7CompatibleLibraryID // ""' 2>/dev/null || echo "")
|
|
132
|
-
# Basic check to prevent injection attacks
|
|
133
|
-
if echo "$library_id" | grep -qE '(\$|`|;|&&|\|\||>|<)'; then
|
|
134
|
-
log_security_event "blocked" "suspicious_library_id" "$tool_name"
|
|
135
|
-
echo '{"decision": "block", "reason": "Security Alert: Detected suspicious characters in library ID that could indicate command injection. Please use only alphanumeric characters, hyphens, underscores, and forward slashes."}'
|
|
136
|
-
exit 2
|
|
137
|
-
fi
|
|
138
|
-
fi
|
|
139
|
-
|
|
140
|
-
log_security_event "scan_completed" "no_sensitive_data_found" "$tool_name"
|
|
141
|
-
|
|
142
|
-
# All checks passed, allow the tool to continue
|
|
143
|
-
# No output needed when allowing - just exit 0
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
# Run main function
|
|
147
|
-
main
|
package/.claude/hooks/notify.sh
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Claude Code notification hook script
|
|
3
|
-
# Plays pleasant sounds when Claude needs input or completes tasks
|
|
4
|
-
|
|
5
|
-
# Get the directory where this script is located
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
SOUNDS_DIR="$SCRIPT_DIR/sounds"
|
|
8
|
-
|
|
9
|
-
# Function to play a sound file with cross-platform support
|
|
10
|
-
play_sound_file() {
|
|
11
|
-
local sound_file="$1"
|
|
12
|
-
|
|
13
|
-
# Check if file exists
|
|
14
|
-
if [[ ! -f "$sound_file" ]]; then
|
|
15
|
-
echo "Warning: Sound file not found: $sound_file" >&2
|
|
16
|
-
return 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# Detect OS and use appropriate command-line audio player
|
|
20
|
-
local os_type="$(uname -s)"
|
|
21
|
-
|
|
22
|
-
case "$os_type" in
|
|
23
|
-
Darwin*) # macOS
|
|
24
|
-
if command -v afplay &> /dev/null; then
|
|
25
|
-
afplay "$sound_file" 2>/dev/null &
|
|
26
|
-
return 0 # Exit immediately after starting playback
|
|
27
|
-
fi
|
|
28
|
-
;;
|
|
29
|
-
|
|
30
|
-
Linux*) # Linux
|
|
31
|
-
# Try PulseAudio first (most common on modern desktop Linux)
|
|
32
|
-
if command -v paplay &> /dev/null; then
|
|
33
|
-
paplay "$sound_file" 2>/dev/null &
|
|
34
|
-
return 0 # Exit immediately after starting playback
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
# Try ALSA
|
|
38
|
-
if command -v aplay &> /dev/null; then
|
|
39
|
-
aplay -q "$sound_file" 2>/dev/null &
|
|
40
|
-
return 0 # Exit immediately after starting playback
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Try PipeWire (newer systems)
|
|
44
|
-
if command -v pw-play &> /dev/null; then
|
|
45
|
-
pw-play "$sound_file" 2>/dev/null &
|
|
46
|
-
return 0 # Exit immediately after starting playback
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# Try sox play command
|
|
50
|
-
if command -v play &> /dev/null; then
|
|
51
|
-
play -q "$sound_file" 2>/dev/null &
|
|
52
|
-
return 0 # Exit immediately after starting playback
|
|
53
|
-
fi
|
|
54
|
-
;;
|
|
55
|
-
|
|
56
|
-
MINGW*|CYGWIN*|MSYS*) # Windows (Git Bash, WSL, etc.)
|
|
57
|
-
# Try PowerShell
|
|
58
|
-
if command -v powershell.exe &> /dev/null; then
|
|
59
|
-
# Use Windows Media Player COM object for better compatibility
|
|
60
|
-
# Run in background and exit immediately
|
|
61
|
-
powershell.exe -NoProfile -Command "
|
|
62
|
-
Start-Job -ScriptBlock {
|
|
63
|
-
\$player = New-Object -ComObject WMPlayer.OCX
|
|
64
|
-
\$player.URL = '$sound_file'
|
|
65
|
-
\$player.controls.play()
|
|
66
|
-
Start-Sleep -Milliseconds 1000
|
|
67
|
-
\$player.close()
|
|
68
|
-
}
|
|
69
|
-
" 2>/dev/null
|
|
70
|
-
return 0 # Exit immediately after starting playback
|
|
71
|
-
fi
|
|
72
|
-
;;
|
|
73
|
-
esac
|
|
74
|
-
|
|
75
|
-
# If we have ffplay (cross-platform)
|
|
76
|
-
if command -v ffplay &> /dev/null; then
|
|
77
|
-
ffplay -nodisp -autoexit -loglevel quiet "$sound_file" 2>/dev/null &
|
|
78
|
-
return 0 # Exit immediately after starting playback
|
|
79
|
-
fi
|
|
80
|
-
|
|
81
|
-
# No audio player found - fail silently
|
|
82
|
-
return 1
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
# Main script logic
|
|
86
|
-
case "$1" in
|
|
87
|
-
"input")
|
|
88
|
-
play_sound_file "$SOUNDS_DIR/input-needed.wav"
|
|
89
|
-
;;
|
|
90
|
-
|
|
91
|
-
"complete")
|
|
92
|
-
play_sound_file "$SOUNDS_DIR/complete.wav"
|
|
93
|
-
;;
|
|
94
|
-
|
|
95
|
-
*)
|
|
96
|
-
echo "Usage: $0 {input|complete}" >&2
|
|
97
|
-
echo " input - Play sound when Claude needs user input" >&2
|
|
98
|
-
echo " complete - Play sound when Claude completes tasks" >&2
|
|
99
|
-
exit 1
|
|
100
|
-
;;
|
|
101
|
-
esac
|
|
102
|
-
|
|
103
|
-
exit 0
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
## Description
|
|
2
|
-
|
|
3
|
-
This command uses specialized agents to verify, configure, and test your Claude Code hooks installation. It ensures everything is properly set up and working correctly.
|
|
4
|
-
|
|
5
|
-
## Process
|
|
6
|
-
|
|
7
|
-
### Phase 1: Multi-Agent Setup Verification
|
|
8
|
-
|
|
9
|
-
The command spawns specialized agents to handle different aspects:
|
|
10
|
-
|
|
11
|
-
1. **Installation Agent**
|
|
12
|
-
- Verifies `.claude/hooks/` directory exists
|
|
13
|
-
- Checks all hook scripts are present
|
|
14
|
-
- Ensures executable permissions (`chmod +x`)
|
|
15
|
-
- Validates sound files and configuration files
|
|
16
|
-
|
|
17
|
-
2. **Configuration Agent**
|
|
18
|
-
- Locates Claude Code settings.json for your OS
|
|
19
|
-
- Verifies hook configurations in settings
|
|
20
|
-
- Checks WORKSPACE environment variable
|
|
21
|
-
- Validates MCP server configurations
|
|
22
|
-
|
|
23
|
-
3. **Documentation Agent**
|
|
24
|
-
- Ensures project structure documentation exists
|
|
25
|
-
- Verifies paths used by context injector
|
|
26
|
-
- Checks log directory setup
|
|
27
|
-
|
|
28
|
-
### Phase 2: Comprehensive Testing
|
|
29
|
-
|
|
30
|
-
After setup verification, the main agent runs comprehensive tests:
|
|
31
|
-
|
|
32
|
-
1. **Security Scanner Tests**
|
|
33
|
-
- API key detection patterns
|
|
34
|
-
- Password and secret detection
|
|
35
|
-
- Whitelist functionality
|
|
36
|
-
- Command injection protection
|
|
37
|
-
- File scanning capabilities
|
|
38
|
-
|
|
39
|
-
2. **Context Injector Tests**
|
|
40
|
-
- New session detection
|
|
41
|
-
- File attachment logic
|
|
42
|
-
- Path resolution
|
|
43
|
-
- Error handling scenarios
|
|
44
|
-
|
|
45
|
-
3. **Notification Tests**
|
|
46
|
-
- Audio playback on current platform
|
|
47
|
-
- Fallback mechanism verification
|
|
48
|
-
- Both input and complete sounds
|
|
49
|
-
|
|
50
|
-
## Expected Output
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
Starting multi-agent hook setup verification...
|
|
54
|
-
|
|
55
|
-
[Installation Agent]
|
|
56
|
-
✓ Hooks directory found: .claude/hooks/
|
|
57
|
-
✓ All hook scripts present and executable
|
|
58
|
-
✓ Configuration files valid
|
|
59
|
-
✓ Sound files present
|
|
60
|
-
|
|
61
|
-
[Configuration Agent]
|
|
62
|
-
✓ Project settings found: .claude/settings.json
|
|
63
|
-
✓ Hook configurations verified
|
|
64
|
-
✓ WORKSPACE environment variable set correctly
|
|
65
|
-
|
|
66
|
-
[Documentation Agent]
|
|
67
|
-
✓ Project structure documentation found
|
|
68
|
-
✓ Log directories configured
|
|
69
|
-
|
|
70
|
-
Running comprehensive tests...
|
|
71
|
-
|
|
72
|
-
[Security Scanner]
|
|
73
|
-
✓ Detected: sk-1234567890abcdef (API key)
|
|
74
|
-
✓ Detected: password=mysecret123
|
|
75
|
-
✓ Allowed: YOUR_API_KEY (whitelisted)
|
|
76
|
-
✓ Blocked: $(malicious) (injection attempt)
|
|
77
|
-
|
|
78
|
-
[Context Injector]
|
|
79
|
-
✓ New session handling correct
|
|
80
|
-
✓ File attachment working
|
|
81
|
-
✓ Error handling graceful
|
|
82
|
-
|
|
83
|
-
[Notifications]
|
|
84
|
-
✓ Audio playback successful
|
|
85
|
-
✓ Platform: darwin (macOS)
|
|
86
|
-
|
|
87
|
-
All hooks configured and tested successfully!
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Troubleshooting
|
|
91
|
-
|
|
92
|
-
The command provides specific guidance for any issues found:
|
|
93
|
-
- Missing files or permissions
|
|
94
|
-
- Configuration problems
|
|
95
|
-
- Test failures with debugging steps
|
|
96
|
-
- Platform-specific audio issues
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"PreToolUse": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "mcp__gemini__consult_gemini",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "${WORKSPACE}/.claude/hooks/gemini-context-injector.sh",
|
|
10
|
-
"description": "Automatically adds project structure to new Gemini sessions"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"matcher": "mcp__.*",
|
|
16
|
-
"hooks": [
|
|
17
|
-
{
|
|
18
|
-
"type": "command",
|
|
19
|
-
"command": "${WORKSPACE}/.claude/hooks/mcp-security-scan.sh",
|
|
20
|
-
"description": "Scans for sensitive data before sending to external services"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"matcher": "Task",
|
|
26
|
-
"hooks": [
|
|
27
|
-
{
|
|
28
|
-
"type": "command",
|
|
29
|
-
"command": "${WORKSPACE}/.claude/hooks/subagent-context-injector.sh",
|
|
30
|
-
"description": "Automatically adds project context to sub-agent prompts"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"Notification": [
|
|
36
|
-
{
|
|
37
|
-
"matcher": ".*",
|
|
38
|
-
"hooks": [
|
|
39
|
-
{
|
|
40
|
-
"type": "command",
|
|
41
|
-
"command": "${WORKSPACE}/.claude/hooks/notify.sh input",
|
|
42
|
-
"description": "Plays sound when Claude needs user input"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"Stop": [
|
|
48
|
-
{
|
|
49
|
-
"matcher": ".*",
|
|
50
|
-
"hooks": [
|
|
51
|
-
{
|
|
52
|
-
"type": "command",
|
|
53
|
-
"command": "${WORKSPACE}/.claude/hooks/notify.sh complete",
|
|
54
|
-
"description": "Plays sound when Claude completes tasks"
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
"environment": {
|
|
61
|
-
"WORKSPACE": "/path/to/your/project"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Sub-Agent Context Auto-Loader
|
|
3
|
-
# Automatically enhances Task tool prompts with essential project context
|
|
4
|
-
#
|
|
5
|
-
# This hook ensures every sub-agent spawned via the Task tool automatically
|
|
6
|
-
# receives core project documentation, eliminating the need to manually
|
|
7
|
-
# include context in each Task prompt.
|
|
8
|
-
#
|
|
9
|
-
# IMPLEMENTATION OVERVIEW:
|
|
10
|
-
# - Registered as a PreToolUse hook in .claude/settings.json
|
|
11
|
-
# - Intercepts all Task tool calls before execution
|
|
12
|
-
# - Injects references to CLAUDE.md, project-structure.md, and docs-overview.md
|
|
13
|
-
# - Preserves original prompt by prepending context, not replacing
|
|
14
|
-
# - Passes through non-Task tools unchanged with {"continue": true}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
set -euo pipefail
|
|
18
|
-
|
|
19
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
21
|
-
|
|
22
|
-
# Read input from stdin
|
|
23
|
-
INPUT_JSON=$(cat)
|
|
24
|
-
|
|
25
|
-
# Extract tool information
|
|
26
|
-
tool_name=$(echo "$INPUT_JSON" | jq -r '.tool_name // ""')
|
|
27
|
-
|
|
28
|
-
# Only process Task tool calls - pass through all other tools unchanged
|
|
29
|
-
if [[ "$tool_name" != "Task" ]]; then
|
|
30
|
-
echo '{"continue": true}'
|
|
31
|
-
exit 0
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
# Extract current prompt from the Task tool input
|
|
35
|
-
current_prompt=$(echo "$INPUT_JSON" | jq -r '.tool_input.prompt // ""')
|
|
36
|
-
|
|
37
|
-
# Build context injection header with project documentation references
|
|
38
|
-
# These files are automatically available to all sub-agents via @ references
|
|
39
|
-
context_injection="## Auto-Loaded Project Context
|
|
40
|
-
|
|
41
|
-
This sub-agent has automatic access to the following project documentation:
|
|
42
|
-
- @$PROJECT_ROOT/docs/CLAUDE.md (Project overview, coding standards, and AI instructions)
|
|
43
|
-
- @$PROJECT_ROOT/docs/ai-context/project-structure.md (Complete file tree and tech stack)
|
|
44
|
-
- @$PROJECT_ROOT/docs/ai-context/docs-overview.md (Documentation architecture)
|
|
45
|
-
|
|
46
|
-
These files provide essential context about the project structure,
|
|
47
|
-
conventions, and development patterns. Reference them as needed for your task.
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Your Task
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
# Combine context injection with original prompt
|
|
56
|
-
# The context is prepended to preserve the original task instructions
|
|
57
|
-
modified_prompt="${context_injection}${current_prompt}"
|
|
58
|
-
|
|
59
|
-
# Update the input JSON with the modified prompt
|
|
60
|
-
# This maintains all other tool input fields unchanged
|
|
61
|
-
output_json=$(echo "$INPUT_JSON" | jq --arg new_prompt "$modified_prompt" '.tool_input.prompt = $new_prompt')
|
|
62
|
-
|
|
63
|
-
# Output the modified JSON for Claude Code to process
|
|
64
|
-
# The Task tool will receive the enhanced prompt with context
|
|
65
|
-
echo "$output_json"
|