@zenuml/core 3.32.6 → 3.33.0
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/.claude/commands/README.md +162 -0
- package/.claude/commands/code-review.md +322 -0
- package/.claude/commands/create-docs.md +309 -0
- package/.claude/commands/full-context.md +121 -0
- package/.claude/commands/gemini-consult.md +164 -0
- package/.claude/commands/handoff.md +146 -0
- package/.claude/commands/refactor.md +188 -0
- package/.claude/commands/update-docs.md +314 -0
- package/.claude/hooks/README.md +270 -0
- package/.claude/hooks/config/sensitive-patterns.json +86 -0
- package/.claude/hooks/gemini-context-injector.sh +129 -0
- package/.claude/hooks/mcp-security-scan.sh +147 -0
- package/.claude/hooks/notify.sh +103 -0
- package/.claude/hooks/setup/hook-setup.md +96 -0
- package/.claude/hooks/setup/settings.json.template +63 -0
- package/.claude/hooks/sounds/complete.wav +0 -0
- package/.claude/hooks/sounds/input-needed.wav +0 -0
- package/.claude/hooks/subagent-context-injector.sh +65 -0
- package/.storybook/main.ts +25 -0
- package/.storybook/preview.ts +29 -0
- package/MCP-ASSISTANT-RULES.md +85 -0
- package/README.md +1 -1
- package/TUTORIAL.md +116 -0
- package/dist/zenuml.esm.mjs +4649 -4598
- package/dist/zenuml.js +52 -52
- package/docs/CONTEXT-tier2-component.md +96 -0
- package/docs/CONTEXT-tier3-feature.md +162 -0
- package/docs/README.md +207 -0
- package/docs/ai-context/deployment-infrastructure.md +21 -0
- package/docs/ai-context/docs-overview.md +89 -0
- package/docs/ai-context/handoff.md +174 -0
- package/docs/ai-context/project-structure.md +160 -0
- package/docs/ai-context/system-integration.md +21 -0
- package/docs/open-issues/example-api-performance-issue.md +79 -0
- package/eslint.config.mjs +26 -26
- package/package.json +9 -2
- package/tailwind.config.js +0 -4
- package/docs/asciidoc/integration-guide.adoc +0 -121
|
@@ -0,0 +1,103 @@
|
|
|
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
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
@@ -0,0 +1,65 @@
|
|
|
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"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
"stories": [
|
|
5
|
+
"../src/**/*.mdx",
|
|
6
|
+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
7
|
+
],
|
|
8
|
+
"addons": [
|
|
9
|
+
"@storybook/addon-docs",
|
|
10
|
+
"@storybook/addon-onboarding"
|
|
11
|
+
],
|
|
12
|
+
"framework": {
|
|
13
|
+
"name": "@storybook/react-vite",
|
|
14
|
+
"options": {}
|
|
15
|
+
},
|
|
16
|
+
"typescript": {
|
|
17
|
+
"check": false,
|
|
18
|
+
"reactDocgen": "react-docgen-typescript",
|
|
19
|
+
"reactDocgenTypescriptOptions": {
|
|
20
|
+
"shouldExtractLiteralValuesFromEnum": true,
|
|
21
|
+
"propFilter": (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default config;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Preview } from '@storybook/react-vite'
|
|
2
|
+
import '../src/index.css'
|
|
3
|
+
|
|
4
|
+
const preview: Preview = {
|
|
5
|
+
parameters: {
|
|
6
|
+
controls: {
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/i,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
backgrounds: {
|
|
13
|
+
default: 'light',
|
|
14
|
+
values: [
|
|
15
|
+
{
|
|
16
|
+
name: 'light',
|
|
17
|
+
value: '#ffffff',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'dark',
|
|
21
|
+
value: '#333333',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default preview;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# MCP Assistant Rules - [Project Name]
|
|
2
|
+
|
|
3
|
+
## Project Context
|
|
4
|
+
[Brief description of what your project does and its main purpose. Keep it concise - 2-3 sentences max.]
|
|
5
|
+
|
|
6
|
+
### Core Vision & Architecture
|
|
7
|
+
- **Product Goal**: [Primary goal of your product]
|
|
8
|
+
- **Target Platform**: [Primary platform(s) - web, mobile, desktop, etc.]
|
|
9
|
+
- **Architecture**: [High-level architecture overview]
|
|
10
|
+
- **Key Technologies**: [Main technologies/frameworks used]
|
|
11
|
+
|
|
12
|
+
### Key Technical Principles
|
|
13
|
+
[List 4-6 core technical principles that guide your project]
|
|
14
|
+
- **Example**: Session-based architecture with clear boundaries
|
|
15
|
+
- **Example**: API-first design with versioning from day one
|
|
16
|
+
- **Example**: Security by default - validate all inputs at boundaries
|
|
17
|
+
- **Example**: Observable systems with structured logging
|
|
18
|
+
|
|
19
|
+
**Note:** The complete project structure and technology stack are provided in the attached `project-structure.md` file.
|
|
20
|
+
|
|
21
|
+
## Key Project Standards
|
|
22
|
+
|
|
23
|
+
### Core Principles
|
|
24
|
+
[List your fundamental development principles]
|
|
25
|
+
- Follow KISS, YAGNI, and DRY - prefer proven solutions over custom implementations
|
|
26
|
+
- Never mock, use placeholders, or omit code - always implement fully
|
|
27
|
+
- Be brutally honest about whether an idea is good or bad
|
|
28
|
+
- [Add project-specific principles]
|
|
29
|
+
|
|
30
|
+
### Code Organization
|
|
31
|
+
[Define your code organization standards]
|
|
32
|
+
- Keep files under [X] lines - split by extracting utilities, constants, types
|
|
33
|
+
- Single responsibility per file with clear purpose
|
|
34
|
+
- Prefer composition over inheritance
|
|
35
|
+
- [Add language/framework specific organization rules]
|
|
36
|
+
|
|
37
|
+
### [Language] Standards
|
|
38
|
+
[Replace with your primary language and its standards]
|
|
39
|
+
- Type safety requirements
|
|
40
|
+
- Naming conventions (classes, functions, constants)
|
|
41
|
+
- Documentation requirements (docstring style, required elements)
|
|
42
|
+
- Error handling patterns
|
|
43
|
+
|
|
44
|
+
### Error Handling & Logging
|
|
45
|
+
- Use specific exceptions with helpful messages
|
|
46
|
+
- Structured logging only - define your logging approach
|
|
47
|
+
- [Specify logging categories or patterns]
|
|
48
|
+
- Every request needs correlation ID for tracing
|
|
49
|
+
|
|
50
|
+
### API Design
|
|
51
|
+
[If applicable - define API standards]
|
|
52
|
+
- RESTful with consistent URL patterns
|
|
53
|
+
- Version from day one (/v1/, /v2/)
|
|
54
|
+
- Consistent response format
|
|
55
|
+
- Proper HTTP status codes
|
|
56
|
+
|
|
57
|
+
### Security & State
|
|
58
|
+
- Never trust external inputs - validate at boundaries
|
|
59
|
+
- [Define session/state management approach]
|
|
60
|
+
- [Specify data retention policies]
|
|
61
|
+
- Keep secrets in environment variables only
|
|
62
|
+
|
|
63
|
+
## Project-Specific Guidelines
|
|
64
|
+
[Add any project-specific guidelines that AI assistants should know]
|
|
65
|
+
|
|
66
|
+
### Domain-Specific Rules
|
|
67
|
+
[Add rules specific to your problem domain]
|
|
68
|
+
|
|
69
|
+
### Integration Points
|
|
70
|
+
[List key integration points or external services]
|
|
71
|
+
|
|
72
|
+
### Performance Considerations
|
|
73
|
+
[Add any performance-critical aspects]
|
|
74
|
+
|
|
75
|
+
## Important Constraints
|
|
76
|
+
- You cannot create, modify, or execute code
|
|
77
|
+
- You operate in a read-only support capacity
|
|
78
|
+
- Your suggestions are for the primary AI (Claude Code) to implement
|
|
79
|
+
- Focus on analysis, understanding, and advisory support
|
|
80
|
+
|
|
81
|
+
## Quick Reference
|
|
82
|
+
[Add frequently needed information]
|
|
83
|
+
- Key commands: [List common commands]
|
|
84
|
+
- Important paths: [List critical file paths]
|
|
85
|
+
- Documentation links: [Add links to detailed docs]
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ You can use it ZenUML on your favorite platforms and applications:
|
|
|
19
19
|
# Integrations
|
|
20
20
|
|
|
21
21
|
ZenUML can be integrated with your favorite tools and platforms as a library or an embeddable widget.
|
|
22
|
-
Please follow the [integration
|
|
22
|
+
Please follow the [integration tutorial](./TUTORIAL.md) for detailed steps.
|
|
23
23
|
|
|
24
24
|
# Development
|
|
25
25
|
|
package/TUTORIAL.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
# ZenUML Integration Tutorial
|
|
3
|
+
|
|
4
|
+
This tutorial provides a comprehensive guide on how to integrate ZenUML into your applications. There are two primary methods for integration: as a library or as an embedded iframe.
|
|
5
|
+
|
|
6
|
+
## 1. As a Library
|
|
7
|
+
|
|
8
|
+
This is the most flexible method, allowing for deep integration with your application.
|
|
9
|
+
|
|
10
|
+
### Installation
|
|
11
|
+
|
|
12
|
+
First, add the `@zenuml/core` package to your project:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @zenuml/core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @zenuml/core
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
The main entry point of the library is the `ZenUml` class. Here's a basic example of how to use it:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import ZenUml from '@zenuml/core';
|
|
30
|
+
|
|
31
|
+
// 1. Get the container element
|
|
32
|
+
const el = document.getElementById('zenuml-container');
|
|
33
|
+
|
|
34
|
+
// 2. Create a new instance of ZenUml
|
|
35
|
+
const zenUml = new ZenUml(el);
|
|
36
|
+
|
|
37
|
+
// 3. Render a diagram
|
|
38
|
+
const code = 'A->B: message';
|
|
39
|
+
const config = {
|
|
40
|
+
theme: 'default',
|
|
41
|
+
};
|
|
42
|
+
zenUml.render(code, config);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Configuration
|
|
46
|
+
|
|
47
|
+
The `render` method accepts a configuration object with the following properties:
|
|
48
|
+
|
|
49
|
+
- `theme`: The name of the theme to use. A list of available themes can be found in the documentation.
|
|
50
|
+
- `enableScopedTheming`: A boolean that indicates whether to scope the theme to the container element. This is useful when you have multiple diagrams on the same page with different themes.
|
|
51
|
+
- `onThemeChange`: A callback function that is called when the theme is changed.
|
|
52
|
+
- `enableMultiTheme`: A boolean that indicates whether to enable multi-theme support.
|
|
53
|
+
- `stickyOffset`: A number that indicates the offset for the sticky header.
|
|
54
|
+
- `onContentChange`: A callback function that is called when the content of the diagram is changed.
|
|
55
|
+
- `onEventEmit`: A callback function that is called when an event is emitted from the diagram.
|
|
56
|
+
- `mode`: The rendering mode. Can be `RenderMode.Dynamic` or `RenderMode.Static`.
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
Here's a more advanced example that uses some of the configuration options:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
import ZenUml from '@zenuml/core';
|
|
64
|
+
|
|
65
|
+
const el = document.getElementById('zenuml-container');
|
|
66
|
+
const zenUml = new ZenUml(el);
|
|
67
|
+
|
|
68
|
+
const code = `
|
|
69
|
+
// This is a comment
|
|
70
|
+
A->B: synchronous message
|
|
71
|
+
B-->A: asynchronous message
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const config = {
|
|
75
|
+
theme: 'blue',
|
|
76
|
+
enableScopedTheming: true,
|
|
77
|
+
onContentChange: (newCode) => {
|
|
78
|
+
console.log('Diagram code changed:', newCode);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
zenUml.render(code, config);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Exporting Diagrams
|
|
86
|
+
|
|
87
|
+
You can export diagrams to PNG and SVG formats. The `ZenUml` class provides the following methods for exporting:
|
|
88
|
+
|
|
89
|
+
- `getPng()`: Returns a promise that resolves to a PNG data URL.
|
|
90
|
+
- `getSvg()`: Returns a promise that resolves to an SVG data URL.
|
|
91
|
+
|
|
92
|
+
Here's an example of how to use these methods:
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
import ZenUml from '@zenuml/core';
|
|
96
|
+
|
|
97
|
+
const el = document.getElementById('zenuml-container');
|
|
98
|
+
const zenUml = new ZenUml(el);
|
|
99
|
+
|
|
100
|
+
const code = 'A->B: message';
|
|
101
|
+
|
|
102
|
+
async function exportDiagram() {
|
|
103
|
+
await zenUml.render(code, { theme: 'default' });
|
|
104
|
+
const png = await zenUml.getPng();
|
|
105
|
+
// Do something with the PNG data URL
|
|
106
|
+
console.log(png);
|
|
107
|
+
|
|
108
|
+
const svg = await zenUml.getSvg();
|
|
109
|
+
// Do something with the SVG data URL
|
|
110
|
+
console.log(svg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exportDiagram();
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This tutorial should provide you with a solid foundation for integrating ZenUML into your applications. For more detailed information, please refer to the official documentation.
|