@chamuka-labs/drawit-cli 0.1.0 → 0.1.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/README.md +150 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @chamuka-labs/drawit-cli
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@chamuka-labs/drawit-cli)
|
|
4
|
+
[](https://www.npmjs.com/package/@chamuka-labs/drawit-cli)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://drawit.chamuka.ai)
|
|
7
|
+
|
|
8
|
+
A command-line tool for validating, inspecting, and exporting `.drawit` diagram files. Part of the [Chamuka DrawIt](https://drawit.chamuka.ai) ecosystem.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @chamuka-labs/drawit-cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Once installed, both `drawit` and `chamuka-drawit` are available as CLI commands.
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
### `drawit validate <file>`
|
|
21
|
+
|
|
22
|
+
Parse and validate a `.drawit` file.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
drawit validate my-diagram.drawit
|
|
26
|
+
drawit validate --strict my-diagram.drawit # Full Zod schema validation
|
|
27
|
+
drawit validate --format json my-diagram.drawit
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `drawit inspect <file>`
|
|
31
|
+
|
|
32
|
+
Show a structured summary of a `.drawit` file.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
drawit inspect my-diagram.drawit
|
|
36
|
+
drawit inspect --elements my-diagram.drawit # Include element ID listing
|
|
37
|
+
drawit inspect --format json my-diagram.drawit
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### `drawit export <file>`
|
|
41
|
+
|
|
42
|
+
Export to a different format.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
drawit export my-diagram.drawit --format svg --output my-diagram.svg
|
|
46
|
+
drawit export my-diagram.drawit --format json --output my-diagram.json
|
|
47
|
+
drawit export my-diagram.drawit --format ndjson --output clean.drawit
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `drawit create <file>`
|
|
51
|
+
|
|
52
|
+
Scaffold a new `.drawit` file.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
drawit create new-diagram.drawit
|
|
56
|
+
drawit create new-diagram.drawit --template flowchart --name "My Flow" --width 1200 --height 800
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `drawit merge <file1> <file2> [...]`
|
|
60
|
+
|
|
61
|
+
Combine multiple `.drawit` files into one.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
drawit merge part1.drawit part2.drawit --output combined.drawit
|
|
65
|
+
drawit merge *.drawit --layout vertical --gap 80 --output combined.drawit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `drawit map`
|
|
69
|
+
|
|
70
|
+
Generate a dependency map diagram from a codebase.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
drawit map --output dependencies.drawit
|
|
74
|
+
drawit map --root ./src --output map.drawit
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `drawit schema`
|
|
78
|
+
|
|
79
|
+
Show or validate against the DrawIt JSON schema.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
drawit schema
|
|
83
|
+
drawit schema --validate my-diagram.drawit
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `drawit deps`
|
|
87
|
+
|
|
88
|
+
Analyze and visualize package dependencies.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
drawit deps --output deps.drawit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `drawit flow`
|
|
95
|
+
|
|
96
|
+
Generate a control-flow diagram from source code.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
drawit flow src/index.ts --output flow.drawit
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `drawit routes`
|
|
103
|
+
|
|
104
|
+
Generate a routes diagram from a Next.js or Express app.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
drawit routes --output routes.drawit
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Global Options
|
|
111
|
+
|
|
112
|
+
- `--format text|json` — Output format for text commands (default: `text`)
|
|
113
|
+
- `--stdin` — Read diagram from stdin instead of a file
|
|
114
|
+
- `--output <path>` / `-o <path>` — Write output to a file
|
|
115
|
+
|
|
116
|
+
## Pipe-Friendly
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
cat diagram.drawit | drawit validate --stdin
|
|
120
|
+
cat diagram.drawit | drawit export --stdin --format svg > output.svg
|
|
121
|
+
drawit validate diagram.drawit && drawit export diagram.drawit --format svg -o out.svg
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Exit Codes
|
|
125
|
+
|
|
126
|
+
| Code | Meaning |
|
|
127
|
+
|------|---------|
|
|
128
|
+
| `0` | Success / valid |
|
|
129
|
+
| `1` | Errors found / invalid file |
|
|
130
|
+
|
|
131
|
+
## Supported File Formats
|
|
132
|
+
|
|
133
|
+
The CLI handles both `.drawit` file formats:
|
|
134
|
+
|
|
135
|
+
- **NDJSON** — one JSON object per line (generated by the CLI and Claude Code skill)
|
|
136
|
+
- **JSON** — pretty-printed multi-line JSON with `elements` array (generated by the web app)
|
|
137
|
+
|
|
138
|
+
## Requirements
|
|
139
|
+
|
|
140
|
+
Node.js 18 or later.
|
|
141
|
+
|
|
142
|
+
## Related
|
|
143
|
+
|
|
144
|
+
- **Web App** — [drawit.chamuka.ai](https://drawit.chamuka.ai) — full AI-powered diagram editor
|
|
145
|
+
- **VS Code Extension** — [ChamukaLabs.vscode-drawit-viewer](https://marketplace.visualstudio.com/items?itemName=ChamukaLabs.vscode-drawit-viewer) — view `.drawit` files in VS Code
|
|
146
|
+
- **npm package** — [@chamuka-labs/drawit-cli](https://www.npmjs.com/package/@chamuka-labs/drawit-cli)
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
Commercial — Part of the [Chamuka DrawIt](https://drawit.chamuka.ai) ecosystem.
|