@agent-canvas/cli 0.1.0 → 0.1.2
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 +88 -0
- package/dist/commands/start.js +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/ws-client.js +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +9 -2
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @agent-canvas/cli
|
|
2
|
+
|
|
3
|
+
A CLI tool that provides an Excalidraw canvas interface for AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @agent-canvas/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Browser mode** (default): Opens Excalidraw in your browser
|
|
14
|
+
- **Electron mode** (optional): Desktop app with `--app` flag
|
|
15
|
+
- Full drawing capabilities: shapes, text, lines, arrows, polygons
|
|
16
|
+
- Element manipulation: move, rotate, group, delete
|
|
17
|
+
- File I/O: load and save .excalidraw files
|
|
18
|
+
- PNG export with scale, dark mode, and embed scene options
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Start Canvas
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Browser mode (default)
|
|
26
|
+
agent-canvas start
|
|
27
|
+
agent-canvas start -f diagram.excalidraw
|
|
28
|
+
|
|
29
|
+
# Electron mode (requires @agent-canvas/electron-app)
|
|
30
|
+
agent-canvas start --app
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Drawing
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Add shapes
|
|
37
|
+
agent-canvas add-shape -t rectangle -x 100 -y 100 -w 200 -h 100 --background-color "#FFA07A" -l "My Box"
|
|
38
|
+
agent-canvas add-shape -t ellipse -x 300 -y 100 -w 100 -h 100
|
|
39
|
+
agent-canvas add-shape -t diamond -x 500 -y 100 -w 100 -h 100
|
|
40
|
+
|
|
41
|
+
# Add text
|
|
42
|
+
agent-canvas add-text -t "Hello World" -x 100 -y 300 --font-size 24
|
|
43
|
+
|
|
44
|
+
# Add lines and arrows
|
|
45
|
+
agent-canvas add-line -x 100 -y 400 --end-x 300 --end-y 400
|
|
46
|
+
agent-canvas add-arrow -x 100 -y 500 --end-x 300 --end-y 500
|
|
47
|
+
|
|
48
|
+
# Add polygon
|
|
49
|
+
agent-canvas add-polygon -p '[{"x":0,"y":0},{"x":100,"y":0},{"x":50,"y":100}]'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Element Manipulation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Delete elements (supports batch)
|
|
56
|
+
agent-canvas delete-elements -i <id1>,<id2>,<id3>
|
|
57
|
+
|
|
58
|
+
# Rotate elements (degrees, positive = clockwise)
|
|
59
|
+
agent-canvas rotate-elements -i <id1>,<id2> -a 45
|
|
60
|
+
|
|
61
|
+
# Move elements
|
|
62
|
+
agent-canvas move-elements -i <id1>,<id2> --delta-x 50 --delta-y 100
|
|
63
|
+
|
|
64
|
+
# Group/ungroup
|
|
65
|
+
agent-canvas group-elements -i <id1>,<id2>,<id3>
|
|
66
|
+
agent-canvas ungroup-element -i <element-id>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Read & Export
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Read scene (TOON format - token efficient)
|
|
73
|
+
agent-canvas read
|
|
74
|
+
|
|
75
|
+
# Read scene (JSON format)
|
|
76
|
+
agent-canvas read --json
|
|
77
|
+
|
|
78
|
+
# Save to file
|
|
79
|
+
agent-canvas save diagram.excalidraw
|
|
80
|
+
|
|
81
|
+
# Export to PNG
|
|
82
|
+
agent-canvas export -o output.png
|
|
83
|
+
agent-canvas export -o output.png --scale 2 --dark --no-background
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
package/dist/commands/start.js
CHANGED
|
@@ -3,8 +3,8 @@ import { resolve, dirname } from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { readFileSync, existsSync } from 'fs';
|
|
5
5
|
import { promisify } from 'util';
|
|
6
|
-
import { connectToCanvas, isCanvasRunning, generateId } from '../lib/ws-client';
|
|
7
|
-
import { startServer, isBrowserServerRunning } from '../server';
|
|
6
|
+
import { connectToCanvas, isCanvasRunning, generateId } from '../lib/ws-client.js';
|
|
7
|
+
import { startServer, isBrowserServerRunning } from '../server/index.js';
|
|
8
8
|
const execAsync = promisify(exec);
|
|
9
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
function getDevElectronAppPath() {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { writeFileSync } from 'node:fs';
|
|
3
3
|
import { encode as toToon } from '@toon-format/toon';
|
|
4
|
-
import { startBrowser, startApp } from './commands/start';
|
|
5
|
-
import { connectToCanvas, generateId } from './lib/ws-client';
|
|
4
|
+
import { startBrowser, startApp } from './commands/start.js';
|
|
5
|
+
import { connectToCanvas, generateId } from './lib/ws-client.js';
|
|
6
6
|
const program = new Command();
|
|
7
7
|
program
|
|
8
8
|
.name('agent-canvas')
|
package/dist/lib/ws-client.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
4
4
|
import { join, extname } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { dirname } from 'path';
|
|
7
|
-
import { WS_PORT } from '../lib/protocol';
|
|
7
|
+
import { WS_PORT } from '../lib/protocol.js';
|
|
8
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
const HTTP_PORT = 7891;
|
|
10
10
|
const MIME_TYPES = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-canvas/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI tool for Agent Canvas - Excalidraw interface for AI agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
"url": "https://github.com/WHQ25/agent-canvas.git",
|
|
9
9
|
"directory": "packages/cli"
|
|
10
10
|
},
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"excalidraw",
|
|
13
|
+
"canvas",
|
|
14
|
+
"ai",
|
|
15
|
+
"agent",
|
|
16
|
+
"cli",
|
|
17
|
+
"drawing"
|
|
18
|
+
],
|
|
12
19
|
"bin": {
|
|
13
20
|
"agent-canvas": "./bin/agent-canvas.js"
|
|
14
21
|
},
|