@caddis/cli 0.0.0 → 0.1.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.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -1
  3. package/bundles/antigravity-plugin/agents/code-reviewer.md +47 -0
  4. package/bundles/antigravity-plugin/agents/preflight.md +53 -0
  5. package/bundles/antigravity-plugin/guard_agy.py +338 -0
  6. package/bundles/antigravity-plugin/hooks.json +36 -0
  7. package/bundles/antigravity-plugin/mcp_config.json +8 -0
  8. package/bundles/antigravity-plugin/mcp_ping_server.py +55 -0
  9. package/bundles/antigravity-plugin/plugin.json +5 -0
  10. package/bundles/antigravity-plugin/session_end_agy.py +57 -0
  11. package/bundles/antigravity-plugin/skills/_registry.md +115 -0
  12. package/bundles/antigravity-plugin/skills/add-rules/SKILL.md +45 -0
  13. package/bundles/antigravity-plugin/skills/api-design/SKILL.md +249 -0
  14. package/bundles/antigravity-plugin/skills/backend-development/SKILL.md +305 -0
  15. package/bundles/antigravity-plugin/skills/best-practices/SKILL.md +500 -0
  16. package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +263 -0
  17. package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +326 -0
  18. package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +245 -0
  19. package/bundles/antigravity-plugin/skills/best-practices/references/anti-patterns.md +571 -0
  20. package/bundles/antigravity-plugin/skills/best-practices/references/before-after-examples.md +1114 -0
  21. package/bundles/antigravity-plugin/skills/best-practices/references/best-practices-guide.md +513 -0
  22. package/bundles/antigravity-plugin/skills/best-practices/references/common-workflows.md +692 -0
  23. package/bundles/antigravity-plugin/skills/best-practices/references/prompt-patterns.md +547 -0
  24. package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +57 -0
  25. package/bundles/antigravity-plugin/skills/ci-cd-pipeline/SKILL.md +315 -0
  26. package/bundles/antigravity-plugin/skills/code-documentation/SKILL.md +271 -0
  27. package/bundles/antigravity-plugin/skills/code-review/SKILL.md +122 -0
  28. package/bundles/antigravity-plugin/skills/codebase-audit/SKILL.md +204 -0
  29. package/bundles/antigravity-plugin/skills/context-curator/SKILL.md +157 -0
  30. package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +40 -0
  31. package/bundles/antigravity-plugin/skills/css-architecture/SKILL.md +305 -0
  32. package/bundles/antigravity-plugin/skills/css-architecture/references/RESPONSIVE-DESIGN.md +604 -0
  33. package/bundles/antigravity-plugin/skills/database-design/SKILL.md +177 -0
  34. package/bundles/antigravity-plugin/skills/db-diagram/SKILL.md +148 -0
  35. package/bundles/antigravity-plugin/skills/db-diagram/scripts/sql_to_graph.py +1212 -0
  36. package/bundles/antigravity-plugin/skills/digress/SKILL.md +61 -0
  37. package/bundles/antigravity-plugin/skills/draw-io/SKILL.md +162 -0
  38. package/bundles/antigravity-plugin/skills/draw-io/references/aws-icons.md +677 -0
  39. package/bundles/antigravity-plugin/skills/draw-io/references/layout-guidelines.md +142 -0
  40. package/bundles/antigravity-plugin/skills/draw-io/references/troubleshooting.md +118 -0
  41. package/bundles/antigravity-plugin/skills/draw-io/references/workflows.md +103 -0
  42. package/bundles/antigravity-plugin/skills/draw-io/scripts/convert-drawio-to-png.sh +25 -0
  43. package/bundles/antigravity-plugin/skills/draw-io/scripts/find_aws_icon.py +79 -0
  44. package/bundles/antigravity-plugin/skills/error-handling/SKILL.md +260 -0
  45. package/bundles/antigravity-plugin/skills/excalidraw-db/SKILL.md +38 -0
  46. package/bundles/antigravity-plugin/skills/fastapi-dev/SKILL.md +300 -0
  47. package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +198 -0
  48. package/bundles/antigravity-plugin/skills/frontend-design/SKILL.md +193 -0
  49. package/bundles/antigravity-plugin/skills/frontend-design/references/my-tech-stack.md +127 -0
  50. package/bundles/antigravity-plugin/skills/gh-cli/SKILL.md +195 -0
  51. package/bundles/antigravity-plugin/skills/git-commit/SKILL.md +285 -0
  52. package/bundles/antigravity-plugin/skills/golden-plan/SKILL.md +577 -0
  53. package/bundles/antigravity-plugin/skills/handoff/SKILL.md +100 -0
  54. package/bundles/antigravity-plugin/skills/implement/SKILL.md +114 -0
  55. package/bundles/antigravity-plugin/skills/javascript-typescript/SKILL.md +142 -0
  56. package/bundles/antigravity-plugin/skills/kb/SKILL.md +60 -0
  57. package/bundles/antigravity-plugin/skills/mermaid-db/SKILL.md +33 -0
  58. package/bundles/antigravity-plugin/skills/mermaid-diagrams/SKILL.md +236 -0
  59. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/ENHANCEMENTS.md +264 -0
  60. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/MERMAID-SUMMARY.md +137 -0
  61. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/advanced-features.md +556 -0
  62. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/architecture-diagrams.md +192 -0
  63. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/c4-diagrams.md +410 -0
  64. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/class-diagrams.md +361 -0
  65. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/erd-diagrams.md +510 -0
  66. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/flowcharts.md +450 -0
  67. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/sequence-diagrams.md +394 -0
  68. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/troubleshooting.md +335 -0
  69. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/workflows.md +418 -0
  70. package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +68 -0
  71. package/bundles/antigravity-plugin/skills/mockup/SKILL.md +242 -0
  72. package/bundles/antigravity-plugin/skills/particle-art/SKILL.md +243 -0
  73. package/bundles/antigravity-plugin/skills/particle-art/references/canvas-utils.ts +171 -0
  74. package/bundles/antigravity-plugin/skills/particle-art/references/dot-field.template.tsx +203 -0
  75. package/bundles/antigravity-plugin/skills/particle-art/references/flow-field.template.tsx +263 -0
  76. package/bundles/antigravity-plugin/skills/particle-art/references/node-shape.template.tsx +261 -0
  77. package/bundles/antigravity-plugin/skills/particle-art/references/shape-sampler.ts +281 -0
  78. package/bundles/antigravity-plugin/skills/particle-art/references/stipple-morph.template.tsx +167 -0
  79. package/bundles/antigravity-plugin/skills/particle-art/references/stipple.template.tsx +175 -0
  80. package/bundles/antigravity-plugin/skills/particle-art/references/trail-ghost.template.tsx +266 -0
  81. package/bundles/antigravity-plugin/skills/particle-art/references/usage-examples.md +320 -0
  82. package/bundles/antigravity-plugin/skills/playwright/API_REFERENCE.md +653 -0
  83. package/bundles/antigravity-plugin/skills/playwright/SKILL.md +454 -0
  84. package/bundles/antigravity-plugin/skills/playwright/lib/helpers.js +441 -0
  85. package/bundles/antigravity-plugin/skills/playwright/package.json +26 -0
  86. package/bundles/antigravity-plugin/skills/playwright/run.js +228 -0
  87. package/bundles/antigravity-plugin/skills/prd/SKILL.md +107 -0
  88. package/bundles/antigravity-plugin/skills/preflight/SKILL.md +435 -0
  89. package/bundles/antigravity-plugin/skills/python/SKILL.md +388 -0
  90. package/bundles/antigravity-plugin/skills/react-best-practices/SKILL.md +269 -0
  91. package/bundles/antigravity-plugin/skills/react-dev/README.md +404 -0
  92. package/bundles/antigravity-plugin/skills/react-dev/SKILL.md +459 -0
  93. package/bundles/antigravity-plugin/skills/react-dev/examples/generic-components.md +579 -0
  94. package/bundles/antigravity-plugin/skills/react-dev/examples/server-components.md +579 -0
  95. package/bundles/antigravity-plugin/skills/react-dev/references/event-handlers.md +574 -0
  96. package/bundles/antigravity-plugin/skills/react-dev/references/hooks.md +456 -0
  97. package/bundles/antigravity-plugin/skills/react-dev/references/react-19-patterns.md +638 -0
  98. package/bundles/antigravity-plugin/skills/react-dev/references/react-router.md +1002 -0
  99. package/bundles/antigravity-plugin/skills/react-dev/references/tanstack-router.md +587 -0
  100. package/bundles/antigravity-plugin/skills/refactoring/SKILL.md +486 -0
  101. package/bundles/antigravity-plugin/skills/resume/SKILL.md +36 -0
  102. package/bundles/antigravity-plugin/skills/security-review/SKILL.md +196 -0
  103. package/bundles/antigravity-plugin/skills/setup-project-ai/SKILL.md +61 -0
  104. package/bundles/antigravity-plugin/skills/ship/SKILL.md +107 -0
  105. package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +103 -0
  106. package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +102 -0
  107. package/bundles/antigravity-plugin/skills/skill-creator/LICENSE.txt +202 -0
  108. package/bundles/antigravity-plugin/skills/skill-creator/SKILL.md +491 -0
  109. package/bundles/antigravity-plugin/skills/skill-creator/agents/analyzer.md +274 -0
  110. package/bundles/antigravity-plugin/skills/skill-creator/agents/comparator.md +202 -0
  111. package/bundles/antigravity-plugin/skills/skill-creator/agents/grader.md +223 -0
  112. package/bundles/antigravity-plugin/skills/skill-creator/assets/eval_review.html +146 -0
  113. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  114. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  115. package/bundles/antigravity-plugin/skills/skill-creator/references/schemas.md +430 -0
  116. package/bundles/antigravity-plugin/skills/skill-creator/scripts/__init__.py +0 -0
  117. package/bundles/antigravity-plugin/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  118. package/bundles/antigravity-plugin/skills/skill-creator/scripts/generate_report.py +326 -0
  119. package/bundles/antigravity-plugin/skills/skill-creator/scripts/improve_description.py +247 -0
  120. package/bundles/antigravity-plugin/skills/skill-creator/scripts/package_skill.py +136 -0
  121. package/bundles/antigravity-plugin/skills/skill-creator/scripts/quick_validate.py +103 -0
  122. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_eval.py +310 -0
  123. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_loop.py +328 -0
  124. package/bundles/antigravity-plugin/skills/skill-creator/scripts/utils.py +47 -0
  125. package/bundles/antigravity-plugin/skills/sql/SKILL.md +321 -0
  126. package/bundles/antigravity-plugin/skills/tdd/SKILL.md +37 -0
  127. package/bundles/antigravity-plugin/skills/tdd-workflow/SKILL.md +188 -0
  128. package/bundles/antigravity-plugin/skills/technical-writing/SKILL.md +286 -0
  129. package/bundles/antigravity-plugin/skills/test-strategy/SKILL.md +155 -0
  130. package/bundles/antigravity-plugin/skills/ui-brief/SKILL.md +84 -0
  131. package/bundles/antigravity-plugin/skills/ui-review/SKILL.md +176 -0
  132. package/bundles/antigravity-plugin/skills/ui-review/references/framework-fixes.md +471 -0
  133. package/bundles/antigravity-plugin/skills/ui-review/references/visual-checklist.md +236 -0
  134. package/bundles/antigravity-plugin/skills/usage-review/SKILL.md +77 -0
  135. package/bundles/antigravity-plugin/skills/use-model/SKILL.md +64 -0
  136. package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +217 -0
  137. package/bundles/antigravity-plugin/skills/version/SKILL.md +18 -0
  138. package/bundles/antigravity-plugin/skills/warm-editorial-ui/DESIGN_TOKENS.md +487 -0
  139. package/bundles/antigravity-plugin/skills/warm-editorial-ui/IMPLEMENTATION_GUIDE.md +177 -0
  140. package/bundles/antigravity-plugin/skills/warm-editorial-ui/SKILL.md +732 -0
  141. package/bundles/antigravity-plugin/skills/webapp-testing/LICENSE.txt +202 -0
  142. package/bundles/antigravity-plugin/skills/webapp-testing/SKILL.md +97 -0
  143. package/bundles/antigravity-plugin/skills/webapp-testing/examples/console_logging.py +35 -0
  144. package/bundles/antigravity-plugin/skills/webapp-testing/examples/element_discovery.py +40 -0
  145. package/bundles/antigravity-plugin/skills/webapp-testing/examples/static_html_automation.py +33 -0
  146. package/bundles/antigravity-plugin/skills/webapp-testing/scripts/with_server.py +106 -0
  147. package/bundles/antigravity-plugin/skills/windows-deployment/SKILL.md +880 -0
  148. package/bundles/antigravity-plugin/skills/writing-plans/SKILL.md +384 -0
  149. package/bundles/antigravity-plugin/statusline-command-agy.sh +91 -0
  150. package/bundles/antigravity-plugin/warm_start_agy.py +149 -0
  151. package/bundles/manifest.json +6 -0
  152. package/dist/cli.js +5363 -0
  153. package/package.json +61 -4
@@ -0,0 +1,142 @@
1
+ # Layout Guidelines
2
+
3
+ ## Grouping Principles
4
+
5
+ ### Hierarchy Structure
6
+ ```text
7
+ Cloud Provider (outermost)
8
+ ├── VPC / Virtual Network
9
+ │ ├── Public Subnet
10
+ │ │ └── Load Balancer, NAT Gateway
11
+ │ └── Private Subnet
12
+ │ └── Application Servers, Databases
13
+ ├── Object Storage (S3, Blob, GCS)
14
+ ├── Monitoring (CloudWatch, Monitor)
15
+ └── Other Services
16
+ ```
17
+
18
+ ### Grouping Rules
19
+ - Security boundaries (DMZ, private, management)
20
+ - Service tiers (frontend, backend, data)
21
+ - Team ownership (team A, team B)
22
+
23
+ ## Flow Directions
24
+
25
+ ### Left-to-Right (Preferred)
26
+ ```text
27
+ [Data Source] → [Processing] → [Storage] → [Analysis]
28
+ ```
29
+ **Use for:** ETL pipelines, request-response, sequential processing
30
+
31
+ ### Top-to-Bottom (Alternative)
32
+ ```text
33
+ [User/Client]
34
+
35
+ [Load Balancer]
36
+
37
+ [Application]
38
+
39
+ [Database]
40
+ ```
41
+ **Use for:** User-facing architectures, hierarchical systems
42
+
43
+ ### Hub-and-Spoke
44
+ ```text
45
+ [Service A]
46
+
47
+ [Central Hub] ← [Service C]
48
+
49
+ [Service B]
50
+ ```
51
+ **Use for:** API gateway, message bus, service mesh
52
+
53
+ ## Line Types
54
+
55
+ | Flow Type | Line Style | Use Case |
56
+ |-----------|------------|----------|
57
+ | Data Flow | Solid line | Read/write operations |
58
+ | Data Ingestion | Dashed line | Data import |
59
+ | Control Flow | Dotted line | Management/config |
60
+ | Event Flow | Wavy line | Event-driven |
61
+
62
+ ## Common Patterns
63
+
64
+ ### Three-Tier
65
+ ```text
66
+ [Presentation] → [Business Logic] → [Data Access] → [Database]
67
+ ```
68
+
69
+ ### Microservices
70
+ ```text
71
+ [API Gateway] → [Service A] → [DB A]
72
+ → [Service B] → [DB B]
73
+ → [Service C] → [Cache]
74
+ ```
75
+
76
+ ### Event-Driven
77
+ ```text
78
+ [Producer] → [Event Bus] → [Consumer A]
79
+ → [Consumer B]
80
+ ```
81
+
82
+ ### Serverless
83
+ ```text
84
+ [API Gateway] → [Lambda] → [DynamoDB]
85
+ ```
86
+
87
+ ## Visual Clarity Rules
88
+
89
+ ### Spacing
90
+ - **Standard gap**: 100px between elements
91
+ - **Frame margins**: 30px minimum from boundaries
92
+ - **Arrow clearance**: 20px from labels
93
+
94
+ ### Alignment
95
+ - Align elements horizontally or vertically
96
+ - Match center coordinates for alignment
97
+ - Use consistent icon sizes (78x78px standard)
98
+
99
+ ### Labels
100
+ - Position near elements
101
+ - Avoid overlaps
102
+ - Use consistent font (18px+ for presentations)
103
+ - Include units where applicable
104
+
105
+ ## Color Usage
106
+
107
+ Don't rely on color alone - use with patterns/labels:
108
+ - **Blue**: Standard services
109
+ - **Green**: Success/healthy
110
+ - **Red**: Errors/critical
111
+ - **Yellow**: Warnings
112
+ - **Gray**: Disabled/infrastructure
113
+
114
+ Ensure WCAG AA contrast (4.5:1 minimum)
115
+
116
+ ## Diagram Types
117
+
118
+ | Type | Purpose | Include | Audience |
119
+ |------|---------|---------|----------|
120
+ | Context | System boundaries | External actors, system boundary | Executive |
121
+ | System | Main components | Services, databases, flows | Architects |
122
+ | Component | Technical details | APIs, integrations, tech choices | Developers |
123
+ | Deployment | Infrastructure | VPCs, regions, networks | DevOps |
124
+ | Sequence | Time-based interactions | Request/response pairs | Developers |
125
+
126
+ ## Anti-Patterns
127
+
128
+ ### ❌ DON'T:
129
+ - Cross arrows unnecessarily
130
+ - Use tiny fonts (< 14px)
131
+ - Overcrowd diagrams
132
+ - Mix abstraction levels
133
+ - Use vague labels
134
+ - Forget to label arrows
135
+
136
+ ### ✓ DO:
137
+ - Keep diagrams focused
138
+ - Use consistent spacing
139
+ - Label everything clearly
140
+ - Align elements
141
+ - Include legends
142
+ - Version your diagrams
@@ -0,0 +1,118 @@
1
+ # Troubleshooting Guide
2
+
3
+ ## PNG Not Generated
4
+
5
+ **Symptoms:** Script runs but no .png file created
6
+
7
+ **Solutions:**
8
+ 1. Check if drawio CLI is installed:
9
+ ```bash
10
+ drawio --version
11
+ ```
12
+
13
+ 2. Install if missing:
14
+ - macOS: `brew install drawio`
15
+ - Linux: Download from https://github.com/jgraph/drawio-desktop/releases
16
+ - Windows: Download from https://www.drawio.com/
17
+
18
+ 3. Check file permissions:
19
+ ```bash
20
+ ls -l your-diagram.drawio
21
+ chmod 644 your-diagram.drawio # If needed
22
+ ```
23
+
24
+ 4. Verify .drawio file is valid XML:
25
+ ```bash
26
+ xmllint --noout your-diagram.drawio
27
+ ```
28
+
29
+ ## Elements Overlapping in PNG
30
+
31
+ **Symptoms:** Diagram looks good in draw.io app but elements overlap in PNG
32
+
33
+ **Solutions:**
34
+ 1. Open .drawio in text editor
35
+ 2. Check arrow placement - arrows must be after title, before other elements:
36
+ ```xml
37
+ <mxCell id="title" .../> <!-- First -->
38
+ <mxCell id="arrow1" .../> <!-- Arrows next -->
39
+ <mxCell id="box1" .../> <!-- Elements last -->
40
+ ```
41
+ 3. Verify element z-order (elements later in file appear on top)
42
+ 4. Adjust coordinates to create spacing
43
+ 5. Re-export and verify
44
+
45
+ ## Text Cut Off or Wrapped
46
+
47
+ **Symptoms:** Labels truncated or broken into multiple lines unexpectedly
48
+
49
+ **Solutions:**
50
+ 1. Calculate required width:
51
+ - English: chars × 10px + 20px padding
52
+ - Example: "Application Server" (18 chars) = 180px + 20px = 200px
53
+
54
+ 2. Update width in mxGeometry:
55
+ ```xml
56
+ <mxGeometry x="140" y="60" width="200" height="40" />
57
+ ```
58
+
59
+ 3. For multi-line text, increase height proportionally
60
+
61
+ ## Script Permission Denied
62
+
63
+ **Symptoms:** `bash: permission denied: convert-drawio-to-png.sh`
64
+
65
+ **Solutions:**
66
+ ```bash
67
+ # Make script executable
68
+ chmod +x scripts/convert-drawio-to-png.sh
69
+
70
+ # Or run with bash explicitly
71
+ bash scripts/convert-drawio-to-png.sh diagram.drawio
72
+ ```
73
+
74
+ ## AWS Icon Not Found
75
+
76
+ **Symptoms:** Search script returns no results
77
+
78
+ **Solutions:**
79
+ 1. Check spelling:
80
+ ```bash
81
+ python scripts/find_aws_icon.py lambda
82
+ ```
83
+
84
+ 2. Try partial match:
85
+ ```bash
86
+ python scripts/find_aws_icon.py compute
87
+ ```
88
+
89
+ 3. List all available icons:
90
+ ```bash
91
+ python scripts/find_aws_icon.py --list-all
92
+ ```
93
+
94
+ 4. Some newer services may not be in aws4 icon set
95
+
96
+ ## Transparent Background Not Working
97
+
98
+ **Symptoms:** PNG has white background despite `-t` flag
99
+
100
+ **Solutions:**
101
+ 1. Remove background attribute from mxGraphModel:
102
+ ```xml
103
+ <!-- Remove this line -->
104
+ <mxGraphModel background="#ffffff" ...>
105
+
106
+ <!-- Keep page="0" -->
107
+ <mxGraphModel page="0" ...>
108
+ ```
109
+
110
+ 2. Ensure `-t` flag is used in conversion:
111
+ ```bash
112
+ drawio -x -f png -s 2 -t -o output.png input.drawio
113
+ ```
114
+
115
+ 3. Check drawio CLI version (should be v20+):
116
+ ```bash
117
+ drawio --version
118
+ ```
@@ -0,0 +1,103 @@
1
+ # Workflow Examples
2
+
3
+ ## Example 1: Create AWS Architecture Diagram
4
+
5
+ ```bash
6
+ # 1. Create diagram file
7
+ touch aws-architecture.drawio
8
+
9
+ # 2. Find required AWS icons
10
+ python scripts/find_aws_icon.py ec2
11
+ python scripts/find_aws_icon.py rds
12
+ python scripts/find_aws_icon.py lambda
13
+
14
+ # 3. Edit diagram in draw.io app or as XML
15
+ # Add: VPC boundary, subnets, services with icons
16
+
17
+ # 4. Convert to PNG
18
+ bash scripts/convert-drawio-to-png.sh aws-architecture.drawio
19
+
20
+ # 5. Verify output
21
+ open aws-architecture.drawio.png # macOS
22
+ ```
23
+
24
+ ## Example 2: Fix Overlapping Elements
25
+
26
+ ```bash
27
+ # 1. Identify issue
28
+ open diagram.drawio.png
29
+
30
+ # 2. Edit XML
31
+ vim diagram.drawio
32
+
33
+ # 3. Calculate and align element centers
34
+ # Box 1: y=100, height=80 → center = 140
35
+ # Box 2: Adjust to y=120, height=40 → center = 140
36
+
37
+ # 4. Move arrows to back layer (after title in XML)
38
+
39
+ # 5. Regenerate PNG
40
+ bash scripts/convert-drawio-to-png.sh diagram.drawio
41
+
42
+ # 6. Verify fix
43
+ open diagram.drawio.png
44
+ ```
45
+
46
+ ## Example 3: Batch Convert Multiple Diagrams
47
+
48
+ ```bash
49
+ # Convert all diagrams in directory
50
+ bash scripts/convert-drawio-to-png.sh diagrams/*.drawio
51
+
52
+ # Or use find
53
+ find . -name "*.drawio" -type f -exec \
54
+ bash scripts/convert-drawio-to-png.sh {} \;
55
+ ```
56
+
57
+ ## Example 4: Progressive Disclosure Architecture Set
58
+
59
+ ```bash
60
+ # Create staged diagrams for complex system
61
+ touch 01-context.drawio # External view (users, external systems)
62
+ touch 02-system.drawio # Main components (services, databases)
63
+ touch 03-component.drawio # Technical details (APIs, integrations)
64
+ touch 04-deployment.drawio # Infrastructure (VPCs, regions, AZs)
65
+
66
+ # Edit each diagram appropriately for its audience
67
+
68
+ # Convert all
69
+ bash scripts/convert-drawio-to-png.sh 0*.drawio
70
+ ```
71
+
72
+ ## Example 5: CI/CD Integration
73
+
74
+ Add to `.github/workflows/diagrams.yml`:
75
+
76
+ ```yaml
77
+ name: Generate Diagrams
78
+
79
+ on: [push]
80
+
81
+ jobs:
82
+ convert:
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/checkout@v3
86
+
87
+ - name: Install drawio
88
+ run: |
89
+ wget https://github.com/jgraph/drawio-desktop/releases/download/v21.6.5/drawio-amd64-21.6.5.deb
90
+ sudo apt install ./drawio-amd64-21.6.5.deb
91
+
92
+ - name: Convert diagrams
93
+ run: |
94
+ find . -name "*.drawio" -exec drawio -x -f png -s 2 -t -o {}.png {} \;
95
+
96
+ - name: Commit PNGs
97
+ run: |
98
+ git config user.name github-actions
99
+ git config user.email github-actions@github.com
100
+ git add "*.png"
101
+ git commit -m "Auto-generate diagram PNGs" || echo "No changes"
102
+ git push
103
+ ```
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Convert .drawio files to .drawio.png
5
+ generated_files=()
6
+
7
+ for drawio in "$@"; do
8
+ png="${drawio%.drawio}.drawio.png"
9
+ echo "Converting $drawio to $png..."
10
+
11
+ # drawio CLI export to PNG with 2x scale for high quality
12
+ if ! drawio -x -f png -s 2 -t -o "$png" "$drawio" 2>/dev/null; then
13
+ echo "✗ drawio PNG export failed for $drawio" >&2
14
+ continue
15
+ fi
16
+
17
+ generated_files+=("$png")
18
+ echo "✓ Generated $png"
19
+ done
20
+
21
+ # Stage all generated files at once to avoid index.lock conflicts
22
+ if [ ${#generated_files[@]} -gt 0 ]; then
23
+ git add "${generated_files[@]}"
24
+ echo "Staged ${#generated_files[@]} file(s)"
25
+ fi
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env python3
2
+ """AWS アイコン検索スクリプト
3
+
4
+ references/aws-icons.md からサービス名でアイコン情報を検索する。
5
+ トークン効率を向上させるため、必要な情報のみを抽出する。
6
+
7
+ Usage:
8
+ python find_aws_icon.py <service_name>
9
+ python find_aws_icon.py ec2
10
+ python find_aws_icon.py lambda
11
+ python find_aws_icon.py s3
12
+ """
13
+
14
+ import re
15
+ import sys
16
+ from pathlib import Path
17
+
18
+
19
+ def load_icon_data() -> dict[str, str]:
20
+ """aws-icons.md からアイコンデータを読み込む"""
21
+ icons = {}
22
+ script_dir = Path(__file__).parent
23
+ aws_icons_path = script_dir.parent / "references" / "aws-icons.md"
24
+
25
+ if not aws_icons_path.exists():
26
+ return icons
27
+
28
+ content = aws_icons_path.read_text(encoding="utf-8")
29
+
30
+ # テーブル行からサービス名と resIcon を抽出
31
+ # | Amazon EC2 | mxgraph.aws4.ec2 |
32
+ pattern = r"\|\s*([^|]+?)\s*\|\s*(mxgraph\.aws4\.[a-z0-9_]+)\s*\|"
33
+ for match in re.finditer(pattern, content):
34
+ service_name = match.group(1).strip()
35
+ res_icon = match.group(2).strip()
36
+ icons[service_name.lower()] = {
37
+ "name": service_name,
38
+ "resIcon": res_icon,
39
+ }
40
+
41
+ return icons
42
+
43
+
44
+ def search_icon(query: str) -> list[dict]:
45
+ """クエリに一致するアイコンを検索"""
46
+ icons = load_icon_data()
47
+ query_lower = query.lower()
48
+ results = []
49
+
50
+ for key, data in icons.items():
51
+ if query_lower in key or query_lower in data["resIcon"]:
52
+ results.append(data)
53
+
54
+ return results
55
+
56
+
57
+ def main():
58
+ if len(sys.argv) < 2:
59
+ print("Usage: python find_aws_icon.py <service_name>")
60
+ print("Example: python find_aws_icon.py ec2")
61
+ sys.exit(1)
62
+
63
+ query = sys.argv[1]
64
+ results = search_icon(query)
65
+
66
+ if not results:
67
+ print(f"No icons found for: {query}")
68
+ sys.exit(1)
69
+
70
+ print(f"Found {len(results)} icon(s) for '{query}':\n")
71
+ for result in results:
72
+ print(f"Service: {result['name']}")
73
+ print(f"resIcon: {result['resIcon']}")
74
+ print(f"Style: shape=mxgraph.aws4.resourceIcon;resIcon={result['resIcon']};")
75
+ print()
76
+
77
+
78
+ if __name__ == "__main__":
79
+ main()