@animaapp/cli 0.2.1 → 0.3.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 +236 -67
- package/dist/index.js +649 -483
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,132 +1,301 @@
|
|
|
1
1
|
# @animaapp/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generate production-ready apps from prompts, URLs, or Figma designs — from the
|
|
4
|
+
command line.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Built for **agents**: any AI tool that can run a shell command can use it. No MCP
|
|
7
|
+
server to configure, no plugins — just `npx`. (Under the hood every command talks
|
|
8
|
+
to Anima over MCP; you don't have to set any of that up.)
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npx @animaapp/cli login
|
|
12
|
+
npx @animaapp/cli create -t p2c -p "SaaS dashboard with sidebar and analytics"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> Examples use `npx @animaapp/cli <command>`. If you install the package globally
|
|
16
|
+
> (`npm i -g @animaapp/cli`), the same commands are available as `anima <command>` —
|
|
17
|
+
> the shorthand used in prose below.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Connecting an agent
|
|
22
|
+
|
|
23
|
+
Every command runs as a **scoped agent identity**: it acts only within the
|
|
24
|
+
workspaces and capabilities a human approved, your team can see and **revoke** it
|
|
25
|
+
at any time, and it expires after ~7 days. You get that identity one of two ways.
|
|
26
|
+
|
|
27
|
+
### 1. Device login — `anima login`
|
|
28
|
+
|
|
29
|
+
The machine running the CLI needs **no browser and no human sitting at it**. The
|
|
30
|
+
command prints a short code and a verification URL; a human opens that URL on
|
|
31
|
+
_any_ device, picks the workspaces/capabilities, names the agent, and approves.
|
|
32
|
+
The CLI polls until approval lands, then stores the token at
|
|
33
|
+
`~/.config/anima/credentials.json`.
|
|
34
|
+
|
|
35
|
+
Re-running `anima login` with the **same agent name** reconnects to the same
|
|
36
|
+
identity (renewal is just logging in again).
|
|
37
|
+
|
|
38
|
+
**Interactive agent (Claude Code, Cursor, a dev at a terminal):**
|
|
8
39
|
|
|
9
40
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
npx @animaapp/cli auth --figma-token <figma-token>
|
|
41
|
+
npx @animaapp/cli login
|
|
42
|
+
```
|
|
13
43
|
|
|
14
|
-
|
|
15
|
-
|
|
44
|
+
In a terminal it also tries to open the verification page for you (disable with
|
|
45
|
+
`--no-open`).
|
|
16
46
|
|
|
17
|
-
|
|
18
|
-
|
|
47
|
+
**Headless agent with a human it can reach (chat, PR, logs):** run in JSON mode
|
|
48
|
+
and relay the verification step. The CLI emits a `verification_required` event to
|
|
49
|
+
**stderr** so your agent can surface it to its human while stdout stays clean:
|
|
19
50
|
|
|
20
|
-
|
|
21
|
-
npx @animaapp/cli
|
|
51
|
+
```bash
|
|
52
|
+
npx @animaapp/cli login --json
|
|
53
|
+
# stderr:
|
|
54
|
+
# {"event":"verification_required","verificationUri":"https://.../device",
|
|
55
|
+
# "verificationUriComplete":"https://.../device?user_code=ABCD-1234",
|
|
56
|
+
# "userCode":"ABCD-1234","expiresIn":900}
|
|
57
|
+
```
|
|
22
58
|
|
|
23
|
-
|
|
24
|
-
|
|
59
|
+
The agent shows the human the URL + code, the human approves, and the same
|
|
60
|
+
process resolves with the final `{ "success": true, "tokenType": "agent", ... }`
|
|
61
|
+
on stdout.
|
|
62
|
+
|
|
63
|
+
### 2. Pre-issued token — `ANIMA_API_TOKEN`
|
|
64
|
+
|
|
65
|
+
For CI or a fully headless agent with **no human in the loop**, skip login and
|
|
66
|
+
provide a token directly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
export ANIMA_API_TOKEN=<agent-or-personal-token>
|
|
70
|
+
export ANIMA_TEAM_ID=<team-id> # optional
|
|
71
|
+
export FIGMA_TOKEN=<token> # only for codegen / f2c
|
|
25
72
|
```
|
|
26
73
|
|
|
27
|
-
|
|
74
|
+
Resolution priority: `ANIMA_API_TOKEN` env var → stored credentials file → error.
|
|
75
|
+
|
|
76
|
+
### Which do I use?
|
|
77
|
+
|
|
78
|
+
| Situation | How to connect |
|
|
79
|
+
|-----------|----------------|
|
|
80
|
+
| Human at a dev machine | `anima login` (browser opens) |
|
|
81
|
+
| Interactive agent, human nearby | `anima login` — show the URL + code, human approves on any device |
|
|
82
|
+
| Headless agent, human reachable | `anima login --json` — relay the `verification_required` event, polling finishes automatically |
|
|
83
|
+
| Fully headless / CI, no human | set `ANIMA_API_TOKEN` — no login step |
|
|
28
84
|
|
|
29
|
-
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quick start
|
|
30
88
|
|
|
31
89
|
```bash
|
|
32
|
-
#
|
|
33
|
-
npx @animaapp/cli
|
|
34
|
-
npx @animaapp/cli auth --figma-token <figma-token>
|
|
90
|
+
# 1. Connect (once)
|
|
91
|
+
npx @animaapp/cli login
|
|
35
92
|
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
|
|
93
|
+
# 2. Create from a prompt / URL / Figma
|
|
94
|
+
npx @animaapp/cli create -t p2c -p "E-commerce product page with cart"
|
|
95
|
+
npx @animaapp/cli create -t l2c -u https://linear.app
|
|
96
|
+
npx @animaapp/cli create -t f2c --file-key <key> --nodes 42:15
|
|
97
|
+
|
|
98
|
+
# 3. Publish, edit over git, or generate raw files
|
|
99
|
+
npx @animaapp/cli publish <sessionId>
|
|
100
|
+
npx @animaapp/cli get-git-token https://dev.animaapp.com/chat/<sessionId> # then: git clone <url>
|
|
101
|
+
npx @animaapp/cli codegen --file-key <key> --nodes 42:15 -o ./components
|
|
39
102
|
```
|
|
40
103
|
|
|
41
|
-
|
|
104
|
+
---
|
|
42
105
|
|
|
43
106
|
## Commands
|
|
44
107
|
|
|
45
|
-
### `
|
|
108
|
+
### `login` — connect this machine
|
|
46
109
|
|
|
47
110
|
```bash
|
|
48
|
-
|
|
49
|
-
npx @animaapp/cli
|
|
111
|
+
npx @animaapp/cli login
|
|
112
|
+
npx @animaapp/cli login --client-name "My CI Agent" # label on the consent screen
|
|
113
|
+
npx @animaapp/cli login --no-open # don't auto-open the browser
|
|
114
|
+
npx @animaapp/cli login --print-mcp-config # also emit an MCP server config
|
|
115
|
+
```
|
|
50
116
|
|
|
51
|
-
|
|
52
|
-
|
|
117
|
+
| Option | Description | Default |
|
|
118
|
+
|--------|-------------|---------|
|
|
119
|
+
| `--client-name <name>` | How the CLI appears on the consent screen | `Anima CLI` |
|
|
120
|
+
| `--no-open` | Don't try to open the verification page in a browser | — |
|
|
121
|
+
| `--print-mcp-config` | One-shot: after this fresh login, also print the MCP server config. If you are already logged in, use `mcp-config` instead — this flag always starts a new login | off |
|
|
122
|
+
|
|
123
|
+
### `mcp-config` — print your MCP server config (no new login)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx @animaapp/cli mcp-config
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Prints a ready-to-paste remote MCP server entry (points at `/v1/mcp` with a
|
|
130
|
+
bearer header) **from your stored credentials** — no network call, no device
|
|
131
|
+
flow. Errors with "run `anima login`" if you are not logged in or the token
|
|
132
|
+
expired. `--json` wraps it as `{ success, mcpConfig, expiresAt }`.
|
|
133
|
+
|
|
134
|
+
**MCP-capable agents:** `login` once, then `mcp-config`. Configure the printed
|
|
135
|
+
entry and use native MCP tools directly — no CLI in the loop. The token is
|
|
136
|
+
scoped and expires in ~7 days; on auth errors run `login` again, then
|
|
137
|
+
`mcp-config` again. The token is never printed by plain `login --json` — only
|
|
138
|
+
by `mcp-config` and `--print-mcp-config`.
|
|
53
139
|
|
|
54
|
-
|
|
140
|
+
### `create` — generate a playground (3–7 min)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx @animaapp/cli create -t p2c -p "Analytics dashboard with a sidebar"
|
|
144
|
+
npx @animaapp/cli create -t l2c -u https://stripe.com
|
|
55
145
|
npx @animaapp/cli create -t f2c --file-key <key> --nodes 42:15
|
|
56
146
|
```
|
|
57
147
|
|
|
58
|
-
|
|
148
|
+
| Option | Values | Default |
|
|
149
|
+
|--------|--------|---------|
|
|
150
|
+
| `-t, --type` | `p2c` (prompt), `l2c` (URL), `f2c` (Figma) | _required_ |
|
|
151
|
+
| `-p, --prompt` | free text | _(p2c)_ |
|
|
152
|
+
| `-u, --url` | website URL | _(l2c)_ |
|
|
153
|
+
| `--file-key` | Figma file key or URL | _(f2c)_ |
|
|
154
|
+
| `--nodes` | Figma node IDs, comma-separated | _(f2c)_ |
|
|
155
|
+
| `--figma-token` | Figma PAT (or `FIGMA_TOKEN` env) | _(f2c)_ |
|
|
156
|
+
| `--framework` | `react`, `html` | `react` |
|
|
157
|
+
| `--styling` | `tailwind`, `css`, `plain_css`, `css_modules`, `inline_styles`¹ | `tailwind` |
|
|
158
|
+
| `--language` | `typescript`, `javascript` | `typescript` (react) |
|
|
159
|
+
| `--ui-library` | `shadcn`, `mui`, `antd`, `clean_react` | _(none)_ |
|
|
160
|
+
| `--guidelines` | free text | _(p2c only)_ |
|
|
161
|
+
|
|
162
|
+
¹ The valid styling / UI-library set depends on `--type`; the server validates and
|
|
163
|
+
returns a clear error for unsupported combinations.
|
|
164
|
+
|
|
165
|
+
### `codegen` — Figma to local files (no playground)
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npx @animaapp/cli codegen --file-key <key-or-url> --nodes 42:15 -o ./components
|
|
169
|
+
```
|
|
59
170
|
|
|
60
171
|
| Option | Values | Default |
|
|
61
172
|
|--------|--------|---------|
|
|
62
|
-
| `--
|
|
63
|
-
| `--
|
|
64
|
-
| `--
|
|
65
|
-
|
|
|
66
|
-
| `--
|
|
173
|
+
| `--file-key` | Figma file key or URL | _required_ |
|
|
174
|
+
| `--nodes` | Figma node IDs, comma-separated | _(or node id in the URL)_ |
|
|
175
|
+
| `--figma-token` | Figma PAT (or `FIGMA_TOKEN` env) | _required_ |
|
|
176
|
+
| `-o, --output` | output directory | `./generated` |
|
|
177
|
+
| `--framework` | `react`, `html` | `react` |
|
|
178
|
+
| `--styling` | `tailwind`, `plain_css` | `tailwind` |
|
|
179
|
+
| `--language` | `typescript`, `javascript` | `typescript` (react) |
|
|
180
|
+
| `--ui-library` | `shadcn`, `mui`, `antd`, `clean_react` | _(none)_ |
|
|
67
181
|
|
|
68
|
-
### `publish` —
|
|
182
|
+
### `publish` — deploy a session (1–3 min)
|
|
69
183
|
|
|
70
184
|
```bash
|
|
71
185
|
npx @animaapp/cli publish <sessionId>
|
|
72
186
|
npx @animaapp/cli publish <sessionId> --mode designSystem --package-name my-ds
|
|
73
187
|
```
|
|
74
188
|
|
|
75
|
-
|
|
189
|
+
| Option | Values | Default |
|
|
190
|
+
|--------|--------|---------|
|
|
191
|
+
| `--mode` | `webapp`, `designSystem` | `webapp` |
|
|
192
|
+
| `--package-name` | npm package name | _(designSystem)_ |
|
|
193
|
+
| `--package-version` | npm package version | _(designSystem)_ |
|
|
194
|
+
|
|
195
|
+
### `get-git-token` — read/edit a playground's code over git
|
|
76
196
|
|
|
77
197
|
```bash
|
|
78
|
-
npx @animaapp/cli
|
|
198
|
+
npx @animaapp/cli get-git-token https://dev.animaapp.com/chat/<sessionId>
|
|
79
199
|
```
|
|
80
200
|
|
|
81
|
-
|
|
201
|
+
A playground **is** a git repository, and git is the only way to read or edit
|
|
202
|
+
its code. This command mints a short-lived access token scoped to that one
|
|
203
|
+
playground and prints a ready-to-use remote URL — you run git yourself:
|
|
82
204
|
|
|
83
|
-
|
|
205
|
+
```bash
|
|
206
|
+
git clone <gitRemoteUrl> # read (and edit locally)
|
|
207
|
+
git push # read-write access: updates the live playground
|
|
208
|
+
git remote set-url origin <new url> # after expiry: re-run get-git-token, re-point the clone
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
In `--json` mode the output is `{ gitRemoteUrl, access: "ro"|"rw", expiresAt }`.
|
|
212
|
+
The token expires within an hour and cannot be renewed — treat the URL as a
|
|
213
|
+
secret, and re-mint rather than store it.
|
|
214
|
+
|
|
215
|
+
### `logout` — disconnect this machine
|
|
84
216
|
|
|
85
217
|
```bash
|
|
86
|
-
npx @animaapp/cli
|
|
218
|
+
npx @animaapp/cli logout
|
|
87
219
|
```
|
|
88
220
|
|
|
89
|
-
|
|
221
|
+
Clears **all** stored credentials (Anima token, Figma token, agent metadata) and
|
|
222
|
+
removes the config directory. This only forgets the token locally — to actually
|
|
223
|
+
disable an agent, revoke it from your team settings.
|
|
224
|
+
|
|
225
|
+
### `config` — store CLI preferences
|
|
226
|
+
|
|
227
|
+
Persist non-secret settings to `~/.config/anima/config.json` so you don't have to
|
|
228
|
+
pass flags every time — handy for pointing at a local API during development.
|
|
229
|
+
Kept separate from credentials, so `logout` never touches it.
|
|
90
230
|
|
|
91
231
|
```bash
|
|
92
|
-
npx @animaapp/cli
|
|
93
|
-
npx @animaapp/cli
|
|
94
|
-
npx @animaapp/cli
|
|
95
|
-
npx @animaapp/cli
|
|
232
|
+
npx @animaapp/cli config set api-url http://localhost:3789
|
|
233
|
+
npx @animaapp/cli config get api-url
|
|
234
|
+
npx @animaapp/cli config list
|
|
235
|
+
npx @animaapp/cli config unset api-url
|
|
96
236
|
```
|
|
97
237
|
|
|
98
|
-
|
|
238
|
+
The API URL resolves in this order: **`--api-url` flag → `ANIMA_API_URL` env →
|
|
239
|
+
`config.json` → default (`https://public-api.animaapp.com`).**
|
|
99
240
|
|
|
100
|
-
|
|
101
|
-
|
|
241
|
+
### `auth` — inspect or manage credentials
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npx @animaapp/cli auth --status # token type + expiry
|
|
245
|
+
npx @animaapp/cli auth --figma-token <T> # save a Figma token for codegen / f2c
|
|
246
|
+
npx @animaapp/cli auth --logout # alias for `anima logout`
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Global flags
|
|
252
|
+
|
|
253
|
+
Available on the network commands (`login`, `create`, `codegen`, `publish`,
|
|
254
|
+
`get-git-token`):
|
|
255
|
+
|
|
256
|
+
| Flag | Description | Default |
|
|
257
|
+
|------|-------------|---------|
|
|
258
|
+
| `--json` | Emit a single JSON object to stdout (for agents) | off (pretty in a TTY) |
|
|
259
|
+
| `--verbose` | Stream progress to stderr in JSON mode¹ | off |
|
|
260
|
+
| `--api-url <url>` | API base URL (point at local/staging)³ | `https://public-api.animaapp.com` |
|
|
261
|
+
| `--log-file <path>` | Append a JSON debug log of each step to a file | off |
|
|
262
|
+
| `--timeout <ms>` | Request timeout² | `600000` (10 min) |
|
|
263
|
+
|
|
264
|
+
¹ `--verbose` applies to `create` / `codegen` / `publish` / `get-git-token`.
|
|
265
|
+
² `--timeout` applies to `create` / `codegen`. Don't lower it — generation takes
|
|
266
|
+
minutes.
|
|
267
|
+
³ Falls back to `ANIMA_API_URL`, then `anima config set api-url`, then the
|
|
268
|
+
default. Set it once with `config` instead of passing `--api-url` every time.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Output modes
|
|
273
|
+
|
|
274
|
+
- **Terminal (TTY):** colored text, spinner, elapsed time.
|
|
275
|
+
- **Piped / `--json`:** a single JSON object on **stdout**; progress and the
|
|
276
|
+
device-flow `verification_required` event go to **stderr**, so stdout is always
|
|
277
|
+
a clean, parseable result.
|
|
102
278
|
|
|
103
279
|
```bash
|
|
104
|
-
# AI tool usage — parse JSON output
|
|
105
280
|
npx @animaapp/cli create -t p2c -p "dashboard" --json 2>/dev/null | jq .playgroundUrl
|
|
106
281
|
```
|
|
107
282
|
|
|
108
|
-
|
|
283
|
+
---
|
|
109
284
|
|
|
110
|
-
##
|
|
285
|
+
## Debugging
|
|
111
286
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
| `publish` | 1-3 minutes |
|
|
116
|
-
| `codegen` | 2-5 minutes |
|
|
117
|
-
| `download` | seconds |
|
|
287
|
+
**`--log-file`** (or the `ANIMA_LOG_FILE` env var) writes one JSON line per step —
|
|
288
|
+
HTTP requests/responses, MCP connect and tool calls, and errors — to a file you
|
|
289
|
+
can inspect or share. Tokens and auth headers are redacted.
|
|
118
290
|
|
|
119
|
-
|
|
291
|
+
```bash
|
|
292
|
+
npx @animaapp/cli login --log-file ./anima-debug.log
|
|
293
|
+
```
|
|
120
294
|
|
|
121
|
-
|
|
295
|
+
**`HTTP 404` on `login`** means the API at `--api-url` doesn't have the device
|
|
296
|
+
grant deployed. Point at an API that does (`--api-url`) or use `ANIMA_API_TOKEN`.
|
|
122
297
|
|
|
123
|
-
|
|
124
|
-
|------|---------|
|
|
125
|
-
| 0 | Success |
|
|
126
|
-
| 1 | API error |
|
|
127
|
-
| 2 | Auth error |
|
|
128
|
-
| 3 | Validation error |
|
|
129
|
-
| 4 | Timeout |
|
|
298
|
+
---
|
|
130
299
|
|
|
131
300
|
## License
|
|
132
301
|
|