@deckflow/deckuse 1.0.2 → 1.2.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/LICENSE +662 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/bin.js +938 -225
- package/dist/bin.js.map +1 -1
- package/dist/cli-text.d.ts +12 -0
- package/dist/cli-text.d.ts.map +1 -0
- package/dist/cli-text.js +49 -0
- package/dist/cli-text.js.map +1 -0
- package/dist/edition.d.ts +4 -0
- package/dist/edition.d.ts.map +1 -0
- package/dist/edition.js +2 -0
- package/dist/edition.js.map +1 -0
- package/dist/help.d.ts +6 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +689 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/monitor-daemon.d.ts +38 -0
- package/dist/monitor-daemon.d.ts.map +1 -0
- package/dist/monitor-daemon.js +182 -0
- package/dist/monitor-daemon.js.map +1 -0
- package/dist/monitor.d.ts +24 -0
- package/dist/monitor.d.ts.map +1 -0
- package/dist/monitor.js +894 -0
- package/dist/monitor.js.map +1 -0
- package/dist/office2html-exec.d.ts +3 -0
- package/dist/office2html-exec.d.ts.map +1 -0
- package/dist/office2html-exec.js +22 -0
- package/dist/office2html-exec.js.map +1 -0
- package/dist/render.d.ts +28 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +124 -0
- package/dist/render.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +19 -8
package/dist/help.js
ADDED
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
import { PROTOCOL_VERSION } from '@deckflow/deckuse-core';
|
|
2
|
+
const GLOBAL_OPTIONS = `Global options:
|
|
3
|
+
--workspace <path> Explicit workspace (default: nearest .deckuse)
|
|
4
|
+
--revision <rev> Read a historical revision (writes reject it)
|
|
5
|
+
--json Machine-readable envelope
|
|
6
|
+
--quiet Suppress human-oriented summaries
|
|
7
|
+
--dry-run Plan a write without committing
|
|
8
|
+
--expect-revision <rev> Optimistic-concurrency guard for writes
|
|
9
|
+
--reason <text> Stored with write history`;
|
|
10
|
+
const WRITE_GLOBALS = `Write globals: --workspace, --json, --dry-run, --expect-revision, --reason`;
|
|
11
|
+
export const HELP_MAIN = `usage: deckuse [global-options] <command> [subcommand] [target] [options]
|
|
12
|
+
|
|
13
|
+
DeckUse Phase 1a CLI (protocol ${PROTOCOL_VERSION}).
|
|
14
|
+
|
|
15
|
+
${GLOBAL_OPTIONS}
|
|
16
|
+
|
|
17
|
+
Commands:
|
|
18
|
+
init Create a workspace from a .pptx
|
|
19
|
+
status Show workspace revision / branch summary
|
|
20
|
+
list List slides, shapes, layouts, masters, or theme
|
|
21
|
+
get Read a target's properties (with provenance)
|
|
22
|
+
inspect Deck/slide structural diagnostic
|
|
23
|
+
search Search text or shapes
|
|
24
|
+
add Add a slide or shape
|
|
25
|
+
remove Remove a slide or shape target
|
|
26
|
+
set Set text or dotted properties on a target
|
|
27
|
+
replace-text Find/replace text across the deck
|
|
28
|
+
xfrm Set geometry (x/y/width/height/rotation)
|
|
29
|
+
align Align or distribute shapes on a slide
|
|
30
|
+
z Change z-order
|
|
31
|
+
apply Apply one or many JSON / JSONL write commands
|
|
32
|
+
schema Print command JSON Schema (self-describing CLI)
|
|
33
|
+
measure Heuristic text size estimate (for layout)
|
|
34
|
+
validate Validate package / relationships
|
|
35
|
+
history Show write history
|
|
36
|
+
undo Undo recent write revisions
|
|
37
|
+
export Pack source/ to .pptx (default; --from-package copies snapshot)
|
|
38
|
+
monitor Live HTML preview server (foreground or start/status/stop)
|
|
39
|
+
render Screenshot one slide to PNG (for visual review)
|
|
40
|
+
query Back-compat selector query (prefer search / list)
|
|
41
|
+
|
|
42
|
+
Run 'deckuse <command> --help' for details.
|
|
43
|
+
`;
|
|
44
|
+
const entries = {
|
|
45
|
+
init: {
|
|
46
|
+
usage: 'deckuse init <input.pptx> <workspace/>',
|
|
47
|
+
summary: 'Unpack a PPTX into a versioned DeckUse workspace (revision starts at 1).',
|
|
48
|
+
example: 'deckuse init input.pptx ./workspace --json',
|
|
49
|
+
details: `Arguments:
|
|
50
|
+
<input.pptx> Source presentation to unpack
|
|
51
|
+
<workspace/> Destination directory for the workspace
|
|
52
|
+
|
|
53
|
+
Options:
|
|
54
|
+
--json Machine-readable envelope
|
|
55
|
+
|
|
56
|
+
Notes:
|
|
57
|
+
Creates source/, package.pptx, .deckuse/, and a Git baseline.
|
|
58
|
+
Does not normalize or rewrite slide content.`,
|
|
59
|
+
},
|
|
60
|
+
status: {
|
|
61
|
+
usage: 'deckuse status [--workspace <path>]',
|
|
62
|
+
summary: 'Show workspace revision, branch, and package summary.',
|
|
63
|
+
example: 'deckuse status --workspace ./workspace --json',
|
|
64
|
+
details: `Options:
|
|
65
|
+
--workspace <path> Workspace root (default: nearest .deckuse)
|
|
66
|
+
--revision <rev> Read a historical revision
|
|
67
|
+
--json Machine-readable envelope`,
|
|
68
|
+
},
|
|
69
|
+
list: {
|
|
70
|
+
usage: 'deckuse list <slides|shapes|layouts|masters|theme> [options]',
|
|
71
|
+
summary: 'List inventory resources from the workspace index / live package.',
|
|
72
|
+
example: 'deckuse list shapes --slide 1 --workspace ./workspace --json',
|
|
73
|
+
details: `Arguments:
|
|
74
|
+
slides | shapes | layouts | masters | theme
|
|
75
|
+
|
|
76
|
+
Options:
|
|
77
|
+
--slide <n> Required for shapes; one-based slide index
|
|
78
|
+
--workspace <path> Workspace root
|
|
79
|
+
--revision <rev> Read a historical revision
|
|
80
|
+
--json Machine-readable envelope
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
deckuse list slides --json
|
|
84
|
+
deckuse list shapes --slide 12 --json
|
|
85
|
+
deckuse list layouts --json`,
|
|
86
|
+
},
|
|
87
|
+
'list slides': {
|
|
88
|
+
usage: 'deckuse list slides [options]',
|
|
89
|
+
summary: 'List slides with index, uid, title preview, layout, and notes flags.',
|
|
90
|
+
example: 'deckuse list slides --workspace ./workspace --json',
|
|
91
|
+
details: `Options:
|
|
92
|
+
--workspace <path> Workspace root
|
|
93
|
+
--revision <rev> Read a historical revision
|
|
94
|
+
--json Machine-readable envelope`,
|
|
95
|
+
},
|
|
96
|
+
'list shapes': {
|
|
97
|
+
usage: 'deckuse list shapes --slide <n> [options]',
|
|
98
|
+
summary: 'List shapes on a slide (id, name, role, type, bbox, text preview).',
|
|
99
|
+
example: 'deckuse list shapes --slide 1 --workspace ./workspace --json',
|
|
100
|
+
details: `Required:
|
|
101
|
+
--slide <n> One-based slide index
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
--workspace <path> Workspace root
|
|
105
|
+
--revision <rev> Read a historical revision
|
|
106
|
+
--json Machine-readable envelope`,
|
|
107
|
+
},
|
|
108
|
+
'list layouts': {
|
|
109
|
+
usage: 'deckuse list layouts [options]',
|
|
110
|
+
summary: 'List slide layouts available in the package.',
|
|
111
|
+
example: 'deckuse list layouts --json',
|
|
112
|
+
details: `Options:
|
|
113
|
+
--workspace <path> Workspace root
|
|
114
|
+
--revision <rev> Read a historical revision
|
|
115
|
+
--json Machine-readable envelope`,
|
|
116
|
+
},
|
|
117
|
+
'list masters': {
|
|
118
|
+
usage: 'deckuse list masters [options]',
|
|
119
|
+
summary: 'List slide masters available in the package.',
|
|
120
|
+
example: 'deckuse list masters --json',
|
|
121
|
+
details: `Options:
|
|
122
|
+
--workspace <path> Workspace root
|
|
123
|
+
--revision <rev> Read a historical revision
|
|
124
|
+
--json Machine-readable envelope`,
|
|
125
|
+
},
|
|
126
|
+
'list theme': {
|
|
127
|
+
usage: 'deckuse list theme [options]',
|
|
128
|
+
summary: 'List theme tokens / theme inventory.',
|
|
129
|
+
example: 'deckuse list theme --json',
|
|
130
|
+
details: `Options:
|
|
131
|
+
--workspace <path> Workspace root
|
|
132
|
+
--revision <rev> Read a historical revision
|
|
133
|
+
--json Machine-readable envelope`,
|
|
134
|
+
},
|
|
135
|
+
get: {
|
|
136
|
+
usage: 'deckuse get <target> [options]',
|
|
137
|
+
summary: 'Read a semantic target with direct/effective values and provenance.',
|
|
138
|
+
example: 'deckuse get slide:1/shape:2 --resolve both --json',
|
|
139
|
+
details: `Arguments:
|
|
140
|
+
<target> e.g. slide:1, slide:1/shape:2, slide:1/shape:2/text
|
|
141
|
+
|
|
142
|
+
Options:
|
|
143
|
+
--resolve <mode> effective | direct | both (default: both)
|
|
144
|
+
--props <a,b,c> Comma-separated property filter
|
|
145
|
+
--no-provenance Omit inheritance source paths
|
|
146
|
+
--workspace <path> Workspace root
|
|
147
|
+
--revision <rev> Read a historical revision
|
|
148
|
+
--json Machine-readable envelope`,
|
|
149
|
+
},
|
|
150
|
+
inspect: {
|
|
151
|
+
usage: 'deckuse inspect [<target>] [options]',
|
|
152
|
+
summary: 'Structural diagnostic for the deck or a slide/target.',
|
|
153
|
+
example: 'deckuse inspect slide:1 --visual-tree --depth 2 --json',
|
|
154
|
+
details: `Arguments:
|
|
155
|
+
<target> Optional; omit for presentation-level inspect
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
--visual-tree Include object tree projection
|
|
159
|
+
--depth <n> Tree depth (default: 2)
|
|
160
|
+
--workspace <path> Workspace root
|
|
161
|
+
--revision <rev> Read a historical revision
|
|
162
|
+
--json Machine-readable envelope`,
|
|
163
|
+
},
|
|
164
|
+
search: {
|
|
165
|
+
usage: 'deckuse search <text|shape> ...',
|
|
166
|
+
summary: 'Search indexed text or shapes; never mutates the workspace.',
|
|
167
|
+
example: 'deckuse search text "Q2 Revenue" --limit 50 --json',
|
|
168
|
+
details: `Subcommands:
|
|
169
|
+
text <query> Literal text search
|
|
170
|
+
shape Shape search via --name / --query
|
|
171
|
+
|
|
172
|
+
Options:
|
|
173
|
+
--name <name> Match shape name
|
|
174
|
+
--query <text> Query string (shape mode)
|
|
175
|
+
--limit <n> Max results (default: 100)
|
|
176
|
+
--workspace <path> Workspace root
|
|
177
|
+
--revision <rev> Read a historical revision
|
|
178
|
+
--json Machine-readable envelope
|
|
179
|
+
|
|
180
|
+
Run 'deckuse search <text|shape> --help' for details.`,
|
|
181
|
+
},
|
|
182
|
+
'search text': {
|
|
183
|
+
usage: 'deckuse search text <query> [options]',
|
|
184
|
+
summary: 'Search slide text for a literal query string.',
|
|
185
|
+
example: 'deckuse search text "FY2025" --limit 100 --json',
|
|
186
|
+
details: `Arguments:
|
|
187
|
+
<query> Literal text to find
|
|
188
|
+
|
|
189
|
+
Options:
|
|
190
|
+
--limit <n> Max results (default: 100)
|
|
191
|
+
--workspace <path> Workspace root
|
|
192
|
+
--revision <rev> Read a historical revision
|
|
193
|
+
--json Machine-readable envelope`,
|
|
194
|
+
},
|
|
195
|
+
'search shape': {
|
|
196
|
+
usage: 'deckuse search shape [options]',
|
|
197
|
+
summary: 'Search shapes by name and/or query string.',
|
|
198
|
+
example: 'deckuse search shape --name "Title" --limit 50 --json',
|
|
199
|
+
details: `Options:
|
|
200
|
+
--name <name> Match shape name
|
|
201
|
+
--query <text> Additional query string
|
|
202
|
+
--limit <n> Max results (default: 100)
|
|
203
|
+
--workspace <path> Workspace root
|
|
204
|
+
--revision <rev> Read a historical revision
|
|
205
|
+
--json Machine-readable envelope`,
|
|
206
|
+
},
|
|
207
|
+
add: {
|
|
208
|
+
usage: 'deckuse add <slide|shape> [options]',
|
|
209
|
+
summary: 'Add a slide or shape. One successful write commits one revision.',
|
|
210
|
+
example: 'deckuse add shape --slide 1 --type text --name Title --x 0 --y 0 --width 914400 --height 457200',
|
|
211
|
+
details: `Subcommands:
|
|
212
|
+
slide Insert a new slide
|
|
213
|
+
shape Insert a shape on an existing slide
|
|
214
|
+
|
|
215
|
+
${WRITE_GLOBALS}
|
|
216
|
+
|
|
217
|
+
Run 'deckuse add <slide|shape> --help' for details.`,
|
|
218
|
+
},
|
|
219
|
+
'add slide': {
|
|
220
|
+
usage: 'deckuse add slide [options]',
|
|
221
|
+
summary: 'Insert one slide (and package/relationship updates) in a single revision.',
|
|
222
|
+
example: 'deckuse add slide --after 5 --layout title-and-content --name feature-page --json',
|
|
223
|
+
details: `Options:
|
|
224
|
+
--after <n> Insert after one-based slide index (append if omitted)
|
|
225
|
+
--layout <name-or-id> Layout to use (blank / title-and-content / ...)
|
|
226
|
+
--name <name> Slide name stored in inventory
|
|
227
|
+
${WRITE_GLOBALS}`,
|
|
228
|
+
},
|
|
229
|
+
'add shape': {
|
|
230
|
+
usage: 'deckuse add shape --slide <n> --type <kind> [options]',
|
|
231
|
+
summary: 'Insert a shape on a slide. Geometry accepts EMU numbers or unit strings (px|pt|cm|mm|in|%).',
|
|
232
|
+
example: 'deckuse add shape --slide 1 --type text --text "Hello\\nWorld" --name Title --x 5% --y 120px --width 90% --height 150px --json',
|
|
233
|
+
details: `Required:
|
|
234
|
+
--slide <n> One-based slide index
|
|
235
|
+
--type <kind> text | rect | rounded-rect | ellipse | line | connector |
|
|
236
|
+
elbow | curved-connector | arrow | left-arrow | up-arrow | down-arrow |
|
|
237
|
+
chevron | pentagon | trapezoid | triangle | rt-triangle |
|
|
238
|
+
circular-arrow | curved-right-arrow | curved-left-arrow |
|
|
239
|
+
image | group | table | chart | video | audio
|
|
240
|
+
(line/connector = straight cxnSp; elbow/curved = bent/curved connectors)
|
|
241
|
+
|
|
242
|
+
Common options:
|
|
243
|
+
--name <name> Shape name (should be unique on the slide)
|
|
244
|
+
--role <role> OOXML p:ph type (title, body, subTitle, ctrTitle, …).
|
|
245
|
+
Aliases: subtitle→subTitle, centertitle→ctrTitle.
|
|
246
|
+
Unknown roles are rejected (INVALID_COMMAND).
|
|
247
|
+
--x/--y/--width/--height EMU number, or unit string: 120px, 12pt, 1.5in, 5%, …
|
|
248
|
+
Bare numbers are EMU. % is relative to slide size.
|
|
249
|
+
px uses 96 DPI (1px = 9525 EMU).
|
|
250
|
+
|
|
251
|
+
Type-specific:
|
|
252
|
+
--text <text> Initial text (--type text). Supports \\n / \\t escapes.
|
|
253
|
+
--text-file <path> Read initial text from a UTF-8 file
|
|
254
|
+
--text-raw Disable escape processing for --text
|
|
255
|
+
--file <path> Media path (required for image | video | audio)
|
|
256
|
+
--rows <json> string[][] JSON (required for table)
|
|
257
|
+
--height auto Table only: heuristic height from cell wrap + padding (may still clip; check TABLE_HEIGHT_MAY_CLIP / render)
|
|
258
|
+
--theme <name> Table theme: minimal | zebra
|
|
259
|
+
--align-columns <list> Table column aligns (JSON array or comma list: l,ctr,r)
|
|
260
|
+
--chart-type <kind> bar | column | line | pie | combo (required for chart; prefer bar/column/line/pie for community render)
|
|
261
|
+
--data <json> Chart data JSON (required for chart):
|
|
262
|
+
{"title?":"...","categories":["Q1"],"series":[{"name":"S1","values":[1],"color?":"#5B8DEF","chart?":"column","axis?":"primary"}]}
|
|
263
|
+
--show-data-labels Enable chart data labels on create
|
|
264
|
+
|
|
265
|
+
Chart styling (via set / apply setProperties on a chart target):
|
|
266
|
+
title, series[{name,values,color}], textColor / font.color,
|
|
267
|
+
gapWidth, showMajorGridlines, showDataLabels, valueFormatCode / axisFormatCode
|
|
268
|
+
|
|
269
|
+
Examples:
|
|
270
|
+
deckuse add shape --slide 1 --type text --text 'Hello\\nWorld' --json
|
|
271
|
+
deckuse add shape --slide 1 --type image --file ./photo.png --json
|
|
272
|
+
deckuse add shape --slide 1 --type table --rows '[["A","B"],["1","2"]]' --height auto --theme zebra --json
|
|
273
|
+
deckuse add shape --slide 1 --type chart --chart-type column --data '{"categories":["Q1","Q2"],"series":[{"name":"2024","values":[10,20]}]}' --show-data-labels --json
|
|
274
|
+
deckuse add shape --slide 1 --type chart --chart-type combo --data '{"categories":["Q1","Q2"],"series":[{"name":"Rev","values":[10,20],"chart":"column"},{"name":"Margin","values":[0.1,0.2],"chart":"line","axis":"secondary"}]}' --json
|
|
275
|
+
deckuse add shape --slide 1 --type video --file ./clip.mp4 --json
|
|
276
|
+
deckuse add shape --slide 1 --type audio --file ./track.mp3 --json
|
|
277
|
+
|
|
278
|
+
${WRITE_GLOBALS}`,
|
|
279
|
+
},
|
|
280
|
+
remove: {
|
|
281
|
+
usage: 'deckuse remove <target> [options]',
|
|
282
|
+
summary: 'Remove a slide or shape target in one revision.',
|
|
283
|
+
example: 'deckuse remove slide:1/shape:2 --reason "obsolete bullet" --json',
|
|
284
|
+
details: `Arguments:
|
|
285
|
+
<target> e.g. slide:9 or slide:6/shape:17
|
|
286
|
+
|
|
287
|
+
Options:
|
|
288
|
+
${WRITE_GLOBALS}`,
|
|
289
|
+
},
|
|
290
|
+
set: {
|
|
291
|
+
usage: 'deckuse set text <target> --value <text> | deckuse set <target> --prop value ...',
|
|
292
|
+
summary: 'Write text or dotted semantic properties on exactly one target.',
|
|
293
|
+
example: "deckuse set slide:1/shape:2 --font.size 42 --fill.color '#0A2930' --json",
|
|
294
|
+
details: `Forms:
|
|
295
|
+
set text <target> --value <text>
|
|
296
|
+
set <target> --font.size 42 --fill.color '#RRGGBB' ...
|
|
297
|
+
|
|
298
|
+
Common properties:
|
|
299
|
+
font.family, font.size, font.weight, font.color, font.italic
|
|
300
|
+
fill.kind, fill.color, fill.transparency
|
|
301
|
+
line.kind, line.color, line.width, line.dash
|
|
302
|
+
paragraph.align, paragraph.level, bullet, hyperlink, name, visible
|
|
303
|
+
x, y, width, height, rotation
|
|
304
|
+
|
|
305
|
+
Table targets also accept:
|
|
306
|
+
insertRow / deleteRow / insertColumn / deleteColumn (object with index)
|
|
307
|
+
Cell targets accept fill
|
|
308
|
+
|
|
309
|
+
Chart targets also accept:
|
|
310
|
+
title, series (JSON array with name/values/color),
|
|
311
|
+
textColor | font.color, gapWidth, showMajorGridlines,
|
|
312
|
+
showDataLabels, valueFormatCode | axisFormatCode,
|
|
313
|
+
fill | background, gridlineColor
|
|
314
|
+
|
|
315
|
+
Options:
|
|
316
|
+
--scope <scope> local only in Phase 1a (default); other scopes reject
|
|
317
|
+
--value <text> Required for set text
|
|
318
|
+
${WRITE_GLOBALS}
|
|
319
|
+
|
|
320
|
+
Run 'deckuse set text --help' for the text form.`,
|
|
321
|
+
},
|
|
322
|
+
'set text': {
|
|
323
|
+
usage: 'deckuse set text <target> (--value <text> | --text-file <path> | --blocks <json>) [options]',
|
|
324
|
+
summary: 'Replace the full text body of a target. CLI \\n/\\t escapes become real characters unless --text-raw.',
|
|
325
|
+
example: "deckuse set text slide:1/shape:2 --value 'Line1\\nLine2' --json",
|
|
326
|
+
details: `Arguments:
|
|
327
|
+
<target> e.g. slide:1/shape:2 or slide:1/shape:2/text
|
|
328
|
+
|
|
329
|
+
Text source (choose one):
|
|
330
|
+
--value <text> Replacement text (\\n \\t \\\\ unescaped unless --text-raw)
|
|
331
|
+
--text-file <path> Read UTF-8 text from file
|
|
332
|
+
--blocks <json> Rich paragraphs: [{"text":"…","fontSize":12,"textColor":"6B7280","bold":true}, …]
|
|
333
|
+
|
|
334
|
+
Options:
|
|
335
|
+
--text-raw Keep escape sequences in --value literal
|
|
336
|
+
${WRITE_GLOBALS}
|
|
337
|
+
|
|
338
|
+
Notes:
|
|
339
|
+
Prefer protocol JSON setText (real newlines or blocks) for agents.
|
|
340
|
+
Each blocks[] entry becomes one styled paragraph.`,
|
|
341
|
+
},
|
|
342
|
+
'replace-text': {
|
|
343
|
+
usage: 'deckuse replace-text --source <text> --target <text> [--regex] [--limit <n>] [--selector <sel>]',
|
|
344
|
+
summary: 'Find and replace text across matching indexed text nodes.',
|
|
345
|
+
example: 'deckuse replace-text --source FY2025 --target FY2026 --json',
|
|
346
|
+
details: `Required:
|
|
347
|
+
--source <text> Find string (non-empty); maps to protocol find
|
|
348
|
+
--target <text> Replacement string; maps to protocol replace
|
|
349
|
+
|
|
350
|
+
Options:
|
|
351
|
+
--regex Treat --source as a Unicode regular expression
|
|
352
|
+
--limit <n> Max replacements
|
|
353
|
+
--selector <sel> Narrow matches (e.g. slide=1)
|
|
354
|
+
${WRITE_GLOBALS}`,
|
|
355
|
+
},
|
|
356
|
+
xfrm: {
|
|
357
|
+
usage: 'deckuse xfrm set (--target <t> | --slide <n> --shape <id>) [geometry]',
|
|
358
|
+
summary: 'Low-level geometry write. All supplied fields apply atomically.',
|
|
359
|
+
example: 'deckuse xfrm set --slide 1 --shape 2 --x 0 --y 0 --width 914400 --height 457200 --json',
|
|
360
|
+
details: `Subcommands:
|
|
361
|
+
set Set transform fields on one shape
|
|
362
|
+
|
|
363
|
+
Options (via set):
|
|
364
|
+
--target <target> e.g. slide:1/shape:2
|
|
365
|
+
--slide <n> --shape <id> Alternative addressing
|
|
366
|
+
--x <emu> --y <emu>
|
|
367
|
+
--width|--cx <emu>
|
|
368
|
+
--height|--cy <emu>
|
|
369
|
+
--rotation <deg> Clockwise degrees
|
|
370
|
+
${WRITE_GLOBALS}
|
|
371
|
+
|
|
372
|
+
Run 'deckuse xfrm set --help' for details.`,
|
|
373
|
+
},
|
|
374
|
+
'xfrm set': {
|
|
375
|
+
usage: 'deckuse xfrm set (--target <t> | --slide <n> --shape <id>) [geometry]',
|
|
376
|
+
summary: 'Set x/y/width/height/rotation. Lengths may be EMU numbers or unit strings (px|pt|cm|mm|in|%).',
|
|
377
|
+
example: 'deckuse xfrm set --target slide:1/shape:2 --x 5% --y 120px --width 90% --height 150px',
|
|
378
|
+
details: `Addressing (one required):
|
|
379
|
+
--target <target> e.g. slide:1/shape:2
|
|
380
|
+
--slide <n> --shape <id> Combined into slide:<n>/shape:<id>
|
|
381
|
+
|
|
382
|
+
Geometry (all optional; supplied fields applied together):
|
|
383
|
+
--x/--y/--width/--height EMU or unit string (px, pt, cm, mm, in, %). Bare number = EMU.
|
|
384
|
+
--cx/--cy Aliases for width/height
|
|
385
|
+
--rotation <deg> Clockwise rotation
|
|
386
|
+
|
|
387
|
+
Options:
|
|
388
|
+
${WRITE_GLOBALS}`,
|
|
389
|
+
},
|
|
390
|
+
align: {
|
|
391
|
+
usage: 'deckuse align --slide <n> --targets <t1,t2,...> --mode <mode> [--gap <length>]',
|
|
392
|
+
summary: 'Align or distribute shapes. Compiles to absolute EMU xfrm writes (not a layout engine).',
|
|
393
|
+
example: 'deckuse align --slide 2 --targets "slide:2/shape:3,slide:2/shape:4,slide:2/shape:5" --mode distribute-h --gap 20px --json',
|
|
394
|
+
details: `Required:
|
|
395
|
+
--slide <n> One-based slide index
|
|
396
|
+
--targets <list> Comma-separated targets
|
|
397
|
+
--mode <mode> left | right | top | bottom | center-h | center-v |
|
|
398
|
+
distribute-h | distribute-v
|
|
399
|
+
|
|
400
|
+
Options:
|
|
401
|
+
--gap <length> Optional gap for distribute-* (px|pt|cm|in|%|EMU)
|
|
402
|
+
${WRITE_GLOBALS}`,
|
|
403
|
+
},
|
|
404
|
+
z: {
|
|
405
|
+
usage: 'deckuse z move <target> (--above <t> | --below <t> | --to-front | --to-back)',
|
|
406
|
+
summary: 'Change relative z-order of a shape.',
|
|
407
|
+
example: 'deckuse z move slide:1/shape:6 --above slide:1/shape:2 --json',
|
|
408
|
+
details: `Subcommands:
|
|
409
|
+
move Reorder one target relative to another
|
|
410
|
+
|
|
411
|
+
Options (via move):
|
|
412
|
+
--above <target> Place above another target
|
|
413
|
+
--below <target> Place below another target
|
|
414
|
+
--to-front Bring to front
|
|
415
|
+
--to-back Send to back
|
|
416
|
+
${WRITE_GLOBALS}
|
|
417
|
+
|
|
418
|
+
Run 'deckuse z move --help' for details.`,
|
|
419
|
+
},
|
|
420
|
+
'z move': {
|
|
421
|
+
usage: 'deckuse z move <target> (--above <t> | --below <t> | --to-front | --to-back)',
|
|
422
|
+
summary: 'Move a shape above/below another target, or to front/back.',
|
|
423
|
+
example: 'deckuse z move slide:1/shape:7 --to-front --json',
|
|
424
|
+
details: `Arguments:
|
|
425
|
+
<target> Shape to move, e.g. slide:1/shape:6
|
|
426
|
+
|
|
427
|
+
Position (choose one):
|
|
428
|
+
--above <target> Place immediately above
|
|
429
|
+
--below <target> Place immediately below
|
|
430
|
+
--to-front Bring to front of the slide
|
|
431
|
+
--to-back Send to back of the slide
|
|
432
|
+
|
|
433
|
+
Options:
|
|
434
|
+
${WRITE_GLOBALS}`,
|
|
435
|
+
},
|
|
436
|
+
apply: {
|
|
437
|
+
usage: 'deckuse apply [<workspace>] [--input <file|->]',
|
|
438
|
+
summary: 'Apply one or many write commands from JSON / JSONL. High-level arrays (and { "operations": [...] } of high-level types) run as one atomic batch; items with op run as applyTransaction.',
|
|
439
|
+
example: 'deckuse apply --workspace ./workspace --input ops.json --json',
|
|
440
|
+
details: `Arguments:
|
|
441
|
+
<workspace> Optional workspace path (or use --workspace)
|
|
442
|
+
|
|
443
|
+
Options:
|
|
444
|
+
--input <file|-> Input path; "-" (default) reads stdin
|
|
445
|
+
${WRITE_GLOBALS}
|
|
446
|
+
|
|
447
|
+
Accepted input shapes:
|
|
448
|
+
[ { "type": "setText", ... }, ... ] High-level batch (preferred)
|
|
449
|
+
{ "operations": [ { "type": ... } ] } High-level batch (same as array)
|
|
450
|
+
{ "type": "setText", ... } Single command
|
|
451
|
+
JSONL One command object per line
|
|
452
|
+
[ { "op": ... }, ... ] Low-level applyTransaction
|
|
453
|
+
{ "operations": [ { "op": ... } ] } Low-level applyTransaction
|
|
454
|
+
|
|
455
|
+
Notes:
|
|
456
|
+
Prefer apply for agent workflows: one revision, one audit entry, atomic rollback.
|
|
457
|
+
Only write command types are accepted (setText, setProperties, addShape,
|
|
458
|
+
setTransform / xfrmSet, alignElements, …).
|
|
459
|
+
setProperties accepts camelCase/nested keys and dotted keys (font.size, fill.color).
|
|
460
|
+
Same-batch forward refs by shape name work after addShape.
|
|
461
|
+
|
|
462
|
+
Template (ops.json) — KPI card with inline style:
|
|
463
|
+
|
|
464
|
+
[
|
|
465
|
+
{
|
|
466
|
+
"type": "addShape",
|
|
467
|
+
"slide": 2,
|
|
468
|
+
"shapeType": "rect",
|
|
469
|
+
"name": "kpi-1",
|
|
470
|
+
"x": "5%",
|
|
471
|
+
"y": "120px",
|
|
472
|
+
"width": "28%",
|
|
473
|
+
"height": "100px",
|
|
474
|
+
"fill": { "color": "F0FDF4" },
|
|
475
|
+
"stroke": { "color": "BBF7D0", "width": 1 },
|
|
476
|
+
"blocks": [
|
|
477
|
+
{ "text": "全年总收入", "fontSize": 12, "textColor": "6B7280" },
|
|
478
|
+
{ "text": "598 百万元", "fontSize": 20, "textColor": "059669", "bold": true }
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"type": "alignElements",
|
|
483
|
+
"slide": 2,
|
|
484
|
+
"targets": ["slide:2/shape:kpi-1", "slide:2/shape:kpi-2", "slide:2/shape:kpi-3"],
|
|
485
|
+
"mode": "distribute-h",
|
|
486
|
+
"gap": "20px"
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
|
|
490
|
+
Examples:
|
|
491
|
+
deckuse apply --input ops.json --json
|
|
492
|
+
deckuse apply --input ops.jsonl --json
|
|
493
|
+
printf '%s\\n' '{"type":"setText",...}' '{"type":"setProperties",...}' | deckuse apply --json`,
|
|
494
|
+
},
|
|
495
|
+
schema: {
|
|
496
|
+
usage: 'deckuse schema [--type <commandType>] [--json]',
|
|
497
|
+
summary: 'Print the command JSON Schema (Draft 2020-12) with CLI/protocol version.',
|
|
498
|
+
example: 'deckuse schema --type addShape --json',
|
|
499
|
+
details: `Options:
|
|
500
|
+
--type <commandType> Slice to one command (e.g. addShape, setProperties, batch)
|
|
501
|
+
--json Compact JSON (default pretty-print)
|
|
502
|
+
|
|
503
|
+
Notes:
|
|
504
|
+
Prefer this over guessing fields from docs. Includes cliVersion, protocolVersion, edition.`,
|
|
505
|
+
},
|
|
506
|
+
measure: {
|
|
507
|
+
usage: 'deckuse measure --text <string> --font-size <pt> [--max-width <len>] [--bold]',
|
|
508
|
+
summary: 'Heuristic text width/height estimate for layout (not a font rasterizer).',
|
|
509
|
+
example: 'deckuse measure --text "总营收" --font-size 24 --max-width 28% --json',
|
|
510
|
+
details: `Required:
|
|
511
|
+
--text <string> Text to measure
|
|
512
|
+
--font-size <pt> Font size in points
|
|
513
|
+
|
|
514
|
+
Options:
|
|
515
|
+
--max-width <len> Wrap width (EMU number or unit string / %)
|
|
516
|
+
--bold Assume bold glyphs
|
|
517
|
+
--font-family <name> Recorded in output only (heuristic ignores metrics)
|
|
518
|
+
--json Machine-readable envelope
|
|
519
|
+
|
|
520
|
+
Notes:
|
|
521
|
+
Returns EMU/px and line count. Expect ~10–20% error vs PowerPoint; verify with render.`,
|
|
522
|
+
},
|
|
523
|
+
validate: {
|
|
524
|
+
usage: 'deckuse validate [<workspace>] [options]',
|
|
525
|
+
summary: 'Validate package integrity and optional relationship checks.',
|
|
526
|
+
example: 'deckuse validate --workspace ./workspace --package --relationships --json',
|
|
527
|
+
details: `Arguments:
|
|
528
|
+
<workspace> Optional workspace path (or use --workspace)
|
|
529
|
+
|
|
530
|
+
Options:
|
|
531
|
+
--level <level> Validation level (default: full)
|
|
532
|
+
--package Include package checks
|
|
533
|
+
--relationships Include relationship graph checks
|
|
534
|
+
--slide <n> Limit to one slide when supported
|
|
535
|
+
--workspace <path> Workspace root
|
|
536
|
+
--revision <rev> Validate a historical revision
|
|
537
|
+
--json Machine-readable envelope`,
|
|
538
|
+
},
|
|
539
|
+
history: {
|
|
540
|
+
usage: 'deckuse history [<workspace>] [options]',
|
|
541
|
+
summary: 'List committed write operations from the workspace journal.',
|
|
542
|
+
example: 'deckuse history --workspace ./workspace --limit 20 --json',
|
|
543
|
+
details: `Arguments:
|
|
544
|
+
<workspace> Optional workspace path (or use --workspace)
|
|
545
|
+
|
|
546
|
+
Options:
|
|
547
|
+
--limit <n> Max entries (default: 100)
|
|
548
|
+
--offset <n> Skip entries (default: 0)
|
|
549
|
+
--slide <n> Filter to operations affecting a slide
|
|
550
|
+
--workspace <path> Workspace root
|
|
551
|
+
--json Machine-readable envelope`,
|
|
552
|
+
},
|
|
553
|
+
undo: {
|
|
554
|
+
usage: 'deckuse undo [<workspace>] [--steps <n>]',
|
|
555
|
+
summary: 'Undo one or more recent write revisions.',
|
|
556
|
+
example: 'deckuse undo --workspace ./workspace --steps 1 --json',
|
|
557
|
+
details: `Arguments:
|
|
558
|
+
<workspace> Optional workspace path (or use --workspace)
|
|
559
|
+
|
|
560
|
+
Options:
|
|
561
|
+
--steps <n> Number of revisions to undo (default: 1)
|
|
562
|
+
${WRITE_GLOBALS}`,
|
|
563
|
+
},
|
|
564
|
+
export: {
|
|
565
|
+
usage: 'deckuse export <output.pptx> [options]',
|
|
566
|
+
summary: 'Pack workspace source/ to .pptx (default) or copy package.pptx.',
|
|
567
|
+
example: 'deckuse export ./out.pptx --workspace ./workspace --json',
|
|
568
|
+
details: `Arguments:
|
|
569
|
+
<output.pptx> Destination path
|
|
570
|
+
|
|
571
|
+
Options:
|
|
572
|
+
--workspace <path> Workspace root
|
|
573
|
+
--from-package Copy existing package.pptx without rebuilding from source/
|
|
574
|
+
--revision <rev> Export a historical revision (not available in Phase 1a)
|
|
575
|
+
--json Machine-readable envelope
|
|
576
|
+
|
|
577
|
+
Notes:
|
|
578
|
+
Default export rebuilds package.pptx from source/ so hand-edits are included.`,
|
|
579
|
+
},
|
|
580
|
+
monitor: {
|
|
581
|
+
usage: 'deckuse monitor [start|status|stop] [<workspace>] [--host <addr>] [--port <n>]',
|
|
582
|
+
summary: 'Live HTML preview. Bare `monitor` is foreground; start/status/stop manage a background daemon.',
|
|
583
|
+
example: 'deckuse monitor start --workspace ./workspace --port 4173',
|
|
584
|
+
details: `Subcommands:
|
|
585
|
+
(none) Foreground server until SIGINT/SIGTERM
|
|
586
|
+
start Detach a background daemon (writes .deckuse/monitor/daemon.json)
|
|
587
|
+
status Show daemon pid / url / reachability
|
|
588
|
+
stop SIGTERM the daemon and clear daemon.json
|
|
589
|
+
|
|
590
|
+
Arguments:
|
|
591
|
+
<workspace> Optional workspace path (or use --workspace)
|
|
592
|
+
|
|
593
|
+
Options:
|
|
594
|
+
--host <addr> Bind address (default: 0.0.0.0)
|
|
595
|
+
--port <n> Port 0–65535 (default: 4173). Use 0 for an ephemeral free port.
|
|
596
|
+
--workspace <path> Workspace root
|
|
597
|
+
|
|
598
|
+
Notes:
|
|
599
|
+
Port conflicts (EADDRINUSE) return a clear error; daemon start fails if unreachable.
|
|
600
|
+
|
|
601
|
+
Examples:
|
|
602
|
+
deckuse monitor --port 4173
|
|
603
|
+
deckuse monitor start --port 0
|
|
604
|
+
deckuse monitor status --json
|
|
605
|
+
deckuse monitor stop`,
|
|
606
|
+
},
|
|
607
|
+
render: {
|
|
608
|
+
usage: 'deckuse render --page <n> [--output <file.png>] [--scale <n>]',
|
|
609
|
+
summary: 'Convert one slide to HTML (office2html), screenshot it with Playwright, then delete the HTML staging output.',
|
|
610
|
+
example: 'deckuse render --page 3 --workspace ./workspace --scale 2 --json',
|
|
611
|
+
details: `Required:
|
|
612
|
+
--page <n> One-based slide index (exactly one page per call)
|
|
613
|
+
|
|
614
|
+
Options:
|
|
615
|
+
--output <file.png> PNG path (default: .deckuse/render/page-<n>.png)
|
|
616
|
+
--scale <n> Device scale factor (default: 1)
|
|
617
|
+
--workspace <path> Workspace root (default: nearest .deckuse)
|
|
618
|
+
--json Machine-readable envelope
|
|
619
|
+
|
|
620
|
+
Notes:
|
|
621
|
+
Intended for AI agents to visually review whether an edit looks correct.
|
|
622
|
+
Community render may not show custom chart series colors faithfully — check ppt/charts/*.xml or PowerPoint.
|
|
623
|
+
Requires a system Chrome / Chromium / Edge, or PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH.
|
|
624
|
+
Temporary office2html output is always removed after the screenshot.`,
|
|
625
|
+
},
|
|
626
|
+
query: {
|
|
627
|
+
usage: 'deckuse query [<workspace>] <selector> [--limit <n>]',
|
|
628
|
+
summary: 'Back-compat selector query (prefer search / list for Phase 1a).',
|
|
629
|
+
example: "deckuse query ./workspace 'text=FY2025' --limit 100 --json",
|
|
630
|
+
details: `Arguments:
|
|
631
|
+
<workspace> Optional workspace path when not using --workspace
|
|
632
|
+
<selector> Selector string (default: *)
|
|
633
|
+
|
|
634
|
+
Options:
|
|
635
|
+
--limit <n> Max results (default: 100)
|
|
636
|
+
--workspace <path> Workspace root
|
|
637
|
+
--json Machine-readable envelope
|
|
638
|
+
|
|
639
|
+
Selector examples:
|
|
640
|
+
* | all
|
|
641
|
+
kind=textbox
|
|
642
|
+
text=Quarter
|
|
643
|
+
text~=pattern
|
|
644
|
+
hasText=true
|
|
645
|
+
slide=1 name=Title`,
|
|
646
|
+
},
|
|
647
|
+
};
|
|
648
|
+
const formatEntry = (entry) => {
|
|
649
|
+
const parts = [`usage: ${entry.usage}`, '', entry.summary, '', `Example:`, ` ${entry.example}`];
|
|
650
|
+
if (entry.details) {
|
|
651
|
+
parts.push('', entry.details);
|
|
652
|
+
}
|
|
653
|
+
parts.push('');
|
|
654
|
+
return parts.join('\n');
|
|
655
|
+
};
|
|
656
|
+
/** Resolve progressive help for a command path such as ['add','shape']. */
|
|
657
|
+
export const resolveHelp = (topic) => {
|
|
658
|
+
if (topic.length === 0)
|
|
659
|
+
return HELP_MAIN;
|
|
660
|
+
const key = topic.map((part) => part.toLowerCase()).join(' ');
|
|
661
|
+
const entry = entries[key];
|
|
662
|
+
if (entry)
|
|
663
|
+
return formatEntry(entry);
|
|
664
|
+
if (topic.length > 1) {
|
|
665
|
+
const parentKey = topic[0].toLowerCase();
|
|
666
|
+
const parent = entries[parentKey];
|
|
667
|
+
if (parent) {
|
|
668
|
+
return (`Unknown subcommand: ${topic.slice(1).join(' ')}\n\n` +
|
|
669
|
+
formatEntry(parent) +
|
|
670
|
+
`Run 'deckuse ${parentKey} --help' for available forms.\n`);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return (`Unknown command: ${topic[0]}\n\n` +
|
|
674
|
+
HELP_MAIN +
|
|
675
|
+
`Run 'deckuse --help' for the command list.\n`);
|
|
676
|
+
};
|
|
677
|
+
/** Tokens that form a help topic (command path), ignoring options and help flags. */
|
|
678
|
+
export const helpTopicFromArgs = (clean) => {
|
|
679
|
+
if (clean.length === 0)
|
|
680
|
+
return null;
|
|
681
|
+
if (clean[0] === 'help') {
|
|
682
|
+
return clean.slice(1).filter((token) => token !== '--help' && token !== '-h' && !token.startsWith('--'));
|
|
683
|
+
}
|
|
684
|
+
const helpIndex = clean.findIndex((token) => token === '--help' || token === '-h');
|
|
685
|
+
if (helpIndex < 0)
|
|
686
|
+
return null;
|
|
687
|
+
return clean.slice(0, helpIndex).filter((token) => !token.startsWith('--'));
|
|
688
|
+
};
|
|
689
|
+
//# sourceMappingURL=help.js.map
|