@a-company/atelier 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.
- package/README.md +241 -0
- package/dist/chunk-LL2EJ6YE.js +1465 -0
- package/dist/chunk-LL2EJ6YE.js.map +1 -0
- package/dist/cli.cjs +1469 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +1502 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +118 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.cjs +1817 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.js +1784 -0
- package/dist/mcp.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "@atelier/cli"
|
|
3
|
+
scope: CLI tool — validate, info, still commands for .atelier files
|
|
4
|
+
packages: ["@atelier/cli"]
|
|
5
|
+
related: ["docs/getting-started.md", "packages/schema/README.md", "packages/core/README.md"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# @atelier/cli
|
|
9
|
+
|
|
10
|
+
CLI tool for working with `.atelier` animation files. Validates documents, displays summaries, and resolves individual frames for inspection.
|
|
11
|
+
|
|
12
|
+
| | |
|
|
13
|
+
|---|---|
|
|
14
|
+
| **Version** | 0.1.0 |
|
|
15
|
+
| **Binary** | `atelier` (maps to `./dist/cli.js`) |
|
|
16
|
+
| **Build** | tsup (ESM + CJS + DTS) |
|
|
17
|
+
| **Source** | `packages/cli/src/` |
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
| Package | Source |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `@atelier/types` | workspace |
|
|
24
|
+
| `@atelier/schema` | workspace |
|
|
25
|
+
| `@atelier/core` | workspace |
|
|
26
|
+
| `@atelier/canvas` | workspace |
|
|
27
|
+
| `commander` | ^13.0.0 |
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# From monorepo root
|
|
33
|
+
pnpm build
|
|
34
|
+
|
|
35
|
+
# Then use directly
|
|
36
|
+
npx atelier validate my-animation.atelier
|
|
37
|
+
|
|
38
|
+
# Or link globally
|
|
39
|
+
cd packages/cli && pnpm link --global
|
|
40
|
+
atelier validate my-animation.atelier
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Commands
|
|
44
|
+
|
|
45
|
+
### `atelier validate <file>`
|
|
46
|
+
|
|
47
|
+
Validates an `.atelier` YAML file through three checks:
|
|
48
|
+
|
|
49
|
+
1. **YAML syntax** -- the file must be parseable YAML.
|
|
50
|
+
2. **Zod schema validation** -- all types and structure must conform to the `@atelier/schema` definitions.
|
|
51
|
+
3. **Delta overlap detection** -- detects when two deltas target the same layer and property with overlapping frame ranges.
|
|
52
|
+
|
|
53
|
+
On success, prints `Valid` and exits with code 0. On failure, prints `Validation errors:` followed by a bulleted list and exits with code 1.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
$ atelier validate animation.atelier
|
|
57
|
+
Valid
|
|
58
|
+
|
|
59
|
+
$ atelier validate broken.atelier
|
|
60
|
+
Validation errors:
|
|
61
|
+
- State "intro": Overlapping deltas on layer "title", property "opacity" ...
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Source: `packages/cli/src/commands/validate.ts`
|
|
65
|
+
|
|
66
|
+
### `atelier info <file>`
|
|
67
|
+
|
|
68
|
+
Parses an `.atelier` file and displays a human-readable summary of its contents: document metadata, canvas settings, layers, states, and preset counts.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ atelier info animation.atelier
|
|
72
|
+
Name: My Animation
|
|
73
|
+
Description: A cool animation
|
|
74
|
+
Canvas: 800x600 @ 60fps, background: #1a1a2e
|
|
75
|
+
Layers: 4
|
|
76
|
+
- bg (shape)
|
|
77
|
+
- title (text)
|
|
78
|
+
- circle (shape)
|
|
79
|
+
- box (shape)
|
|
80
|
+
States: 1
|
|
81
|
+
- intro: 180 frames, 7 deltas
|
|
82
|
+
Presets: 2
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Source: `packages/cli/src/commands/info.ts`
|
|
86
|
+
|
|
87
|
+
### `atelier still <file> [options]`
|
|
88
|
+
|
|
89
|
+
Resolves a single frame of a document and outputs the computed layer states as JSON. This lets you inspect the exact property values at any point in an animation without rendering it.
|
|
90
|
+
|
|
91
|
+
**Options:**
|
|
92
|
+
|
|
93
|
+
| Flag | Description | Default |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `-s, --state <name>` | State name to resolve | First state in the document |
|
|
96
|
+
| `-f, --frame <number>` | Frame number to resolve | `0` |
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
$ atelier still animation.atelier --state intro --frame 30
|
|
100
|
+
{
|
|
101
|
+
"frame": 30,
|
|
102
|
+
"stateName": "intro",
|
|
103
|
+
"layers": [
|
|
104
|
+
{
|
|
105
|
+
"id": "bg",
|
|
106
|
+
"layer": { ... },
|
|
107
|
+
"computedProperties": {}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "title",
|
|
111
|
+
"layer": { ... },
|
|
112
|
+
"computedProperties": {
|
|
113
|
+
"opacity": 1,
|
|
114
|
+
"scale.x": 0.95
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Source: `packages/cli/src/commands/still.ts`
|
|
122
|
+
|
|
123
|
+
## Programmatic API
|
|
124
|
+
|
|
125
|
+
All three commands export functions that can be imported directly, independent of the CLI entry point.
|
|
126
|
+
|
|
127
|
+
### `validateFile(filePath: string)`
|
|
128
|
+
|
|
129
|
+
Reads and validates an `.atelier` file. Returns a result object without printing to stdout or calling `process.exit`.
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { validateFile } from "@atelier/cli";
|
|
133
|
+
|
|
134
|
+
const { valid, errors } = validateFile("animation.atelier");
|
|
135
|
+
if (!valid) {
|
|
136
|
+
console.error(errors);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Returns:** `{ valid: boolean; errors: string[] }`
|
|
141
|
+
|
|
142
|
+
### `getInfo(doc: AtelierDocument)`
|
|
143
|
+
|
|
144
|
+
Extracts a structured summary from a parsed `AtelierDocument`.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { getInfo } from "@atelier/cli";
|
|
148
|
+
import type { DocumentInfo } from "@atelier/cli";
|
|
149
|
+
|
|
150
|
+
const info: DocumentInfo = getInfo(doc);
|
|
151
|
+
console.log(`${info.layers.count} layers, ${info.states.count} states`);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `resolveStill(doc, stateName?, frame?)`
|
|
155
|
+
|
|
156
|
+
Resolves a single frame, returning all layers with their computed property values.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
import { resolveStill } from "@atelier/cli";
|
|
160
|
+
|
|
161
|
+
const resolved = resolveStill(doc, "intro", 30);
|
|
162
|
+
for (const layer of resolved.layers) {
|
|
163
|
+
console.log(layer.id, layer.computedProperties);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Parameters:**
|
|
168
|
+
|
|
169
|
+
| Parameter | Type | Default |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| `doc` | `AtelierDocument` | (required) |
|
|
172
|
+
| `stateName` | `string` | First state in the document |
|
|
173
|
+
| `frame` | `number` | `0` |
|
|
174
|
+
|
|
175
|
+
**Returns:** `ResolvedFrame` (from `@atelier/core`)
|
|
176
|
+
|
|
177
|
+
**Throws** if the document has no states or the specified state name does not exist.
|
|
178
|
+
|
|
179
|
+
## Types
|
|
180
|
+
|
|
181
|
+
### `DocumentInfo`
|
|
182
|
+
|
|
183
|
+
Returned by `getInfo`. Contains the structured summary of a document.
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
interface DocumentInfo {
|
|
187
|
+
name: string;
|
|
188
|
+
description?: string;
|
|
189
|
+
canvas: {
|
|
190
|
+
width: number;
|
|
191
|
+
height: number;
|
|
192
|
+
fps: number;
|
|
193
|
+
background?: string;
|
|
194
|
+
};
|
|
195
|
+
layers: {
|
|
196
|
+
count: number;
|
|
197
|
+
items: { id: string; type: string }[];
|
|
198
|
+
};
|
|
199
|
+
states: {
|
|
200
|
+
count: number;
|
|
201
|
+
items: { name: string; duration: number; deltaCount: number }[];
|
|
202
|
+
};
|
|
203
|
+
presets: {
|
|
204
|
+
count: number;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### `ResolvedFrame` / `ResolvedLayer`
|
|
210
|
+
|
|
211
|
+
Returned by `resolveStill`. Re-exported from `@atelier/core`.
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
interface ResolvedFrame {
|
|
215
|
+
frame: number;
|
|
216
|
+
stateName: string;
|
|
217
|
+
layers: ResolvedLayer[];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
interface ResolvedLayer {
|
|
221
|
+
id: string;
|
|
222
|
+
layer: Layer;
|
|
223
|
+
computedProperties: Partial<Record<AnimatableProperty, unknown>>;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Development
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Build
|
|
231
|
+
pnpm --filter @atelier/cli build
|
|
232
|
+
|
|
233
|
+
# Type-check
|
|
234
|
+
pnpm --filter @atelier/cli typecheck
|
|
235
|
+
|
|
236
|
+
# Run tests
|
|
237
|
+
pnpm --filter @atelier/cli test
|
|
238
|
+
|
|
239
|
+
# Clean build artifacts
|
|
240
|
+
pnpm --filter @atelier/cli clean
|
|
241
|
+
```
|