@clarity-tools/cli 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 (3) hide show
  1. package/README.md +158 -0
  2. package/dist/index.js +2610 -0
  3. package/package.json +47 -0
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # @clarity-tools/cli
2
+
3
+ Generate beautiful, hand-drawn style architecture diagrams from your Infrastructure-as-Code files.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@clarity-tools/cli.svg)](https://www.npmjs.com/package/@clarity-tools/cli)
6
+
7
+ ## Features
8
+
9
+ - **Auto-detection**: Finds docker-compose.yml, compose.yml, and Helm charts
10
+ - **Smart layout**: Semantic grouping with ELK.js layout engine
11
+ - **LLM enhancement**: Optional AI-powered service descriptions (via OpenRouter)
12
+ - **Excalidraw output**: Hand-drawn style diagrams you can edit
13
+ - **PNG export**: High-quality rendered images
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install -g @clarity-tools/cli
19
+ ```
20
+
21
+ **Requirements:**
22
+ - Node.js 18+
23
+ - Chromium (auto-downloaded by Puppeteer on first run)
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Run in a directory with docker-compose.yml or Helm chart
29
+ cd my-project
30
+ iac-diagrams
31
+
32
+ # Or specify a file/directory
33
+ iac-diagrams ./docker-compose.yml
34
+ iac-diagrams ./charts/my-app/
35
+
36
+ # Output goes to ./docs/diagrams/ by default
37
+ open docs/diagrams/docker-compose.png
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```bash
43
+ iac-diagrams [path] [options]
44
+ ```
45
+
46
+ **Arguments:**
47
+ - `path` - File or directory to process (default: current directory)
48
+
49
+ **Options:**
50
+ - `-o, --output <dir>` - Output directory (default: `./docs/diagrams`)
51
+ - `--no-llm` - Disable LLM enhancement
52
+ - `--no-png` - Skip PNG rendering (output .excalidraw only)
53
+ - `-v, --verbose` - Show detailed output
54
+
55
+ **Examples:**
56
+ ```bash
57
+ # Process current directory
58
+ iac-diagrams
59
+
60
+ # Process specific file
61
+ iac-diagrams docker-compose.yml
62
+
63
+ # Process Helm chart directory
64
+ iac-diagrams ./charts/my-app/
65
+
66
+ # Custom output directory
67
+ iac-diagrams -o ./architecture/
68
+
69
+ # Skip LLM and PNG (fast mode)
70
+ iac-diagrams --no-llm --no-png
71
+
72
+ # Verbose output
73
+ iac-diagrams -v
74
+ ```
75
+
76
+ ## Configuration
77
+
78
+ ### LLM Enhancement
79
+
80
+ The tool can use OpenRouter's LLM API to:
81
+ - Generate service descriptions
82
+ - Suggest logical groupings
83
+ - Add category metadata
84
+
85
+ To enable, set your OpenRouter API key:
86
+
87
+ ```bash
88
+ # Set via CLI
89
+ iac-diagrams config set-key sk-or-...
90
+
91
+ # Or via environment variable
92
+ export OPENROUTER_API_KEY=sk-or-...
93
+
94
+ # View current config
95
+ iac-diagrams config show
96
+
97
+ # Clear API key
98
+ iac-diagrams config clear-key
99
+ ```
100
+
101
+ ## Output
102
+
103
+ Files are saved to the output directory (default `./docs/diagrams/`):
104
+
105
+ ```
106
+ docs/diagrams/
107
+ ├── docker-compose.excalidraw # Excalidraw JSON (open at excalidraw.com)
108
+ └── docker-compose.png # Rendered PNG image
109
+ ```
110
+
111
+ The `.excalidraw` file can be opened at [excalidraw.com](https://excalidraw.com) for editing.
112
+
113
+ ## Supported Formats
114
+
115
+ | Format | Status | Notes |
116
+ |--------|--------|-------|
117
+ | Docker Compose | ✅ | docker-compose.yml, compose.yml |
118
+ | Helm Charts | ✅ | Detects Chart.yaml in directories |
119
+ | Kubernetes YAML | 🔜 | Coming soon |
120
+ | Terraform | 🔜 | Coming soon |
121
+
122
+ ## Troubleshooting
123
+
124
+ ### Browser not available
125
+
126
+ If you see "Browser not available for PNG rendering", Puppeteer couldn't launch Chromium.
127
+
128
+ **Fix:**
129
+ ```bash
130
+ # Install Chrome for Puppeteer
131
+ npx puppeteer browsers install chrome
132
+
133
+ # Or use your system Chrome
134
+ export PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
135
+
136
+ # Or skip PNG generation
137
+ iac-diagrams --no-png
138
+ ```
139
+
140
+ ### No IaC files found
141
+
142
+ The tool looks for:
143
+ - `docker-compose.yml`, `docker-compose.yaml`
144
+ - `compose.yml`, `compose.yaml`
145
+ - Directories containing `Chart.yaml` (Helm charts)
146
+
147
+ ### API key not working
148
+
149
+ Ensure your OpenRouter API key is valid:
150
+ ```bash
151
+ iac-diagrams config show
152
+ ```
153
+
154
+ The key should start with `sk-or-`.
155
+
156
+ ## License
157
+
158
+ MIT