@clipkit/cli 1.0.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.
Files changed (75) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +182 -0
  3. package/dist/commands/docs.d.ts +3 -0
  4. package/dist/commands/docs.d.ts.map +1 -0
  5. package/dist/commands/docs.js +31 -0
  6. package/dist/commands/docs.js.map +1 -0
  7. package/dist/commands/explain.d.ts +3 -0
  8. package/dist/commands/explain.d.ts.map +1 -0
  9. package/dist/commands/explain.js +25 -0
  10. package/dist/commands/explain.js.map +1 -0
  11. package/dist/commands/init.d.ts +3 -0
  12. package/dist/commands/init.d.ts.map +1 -0
  13. package/dist/commands/init.js +176 -0
  14. package/dist/commands/init.js.map +1 -0
  15. package/dist/commands/login.d.ts +3 -0
  16. package/dist/commands/login.d.ts.map +1 -0
  17. package/dist/commands/login.js +88 -0
  18. package/dist/commands/login.js.map +1 -0
  19. package/dist/commands/mcp.d.ts +3 -0
  20. package/dist/commands/mcp.d.ts.map +1 -0
  21. package/dist/commands/mcp.js +26 -0
  22. package/dist/commands/mcp.js.map +1 -0
  23. package/dist/commands/new.d.ts +3 -0
  24. package/dist/commands/new.d.ts.map +1 -0
  25. package/dist/commands/new.js +77 -0
  26. package/dist/commands/new.js.map +1 -0
  27. package/dist/commands/preview.d.ts +3 -0
  28. package/dist/commands/preview.d.ts.map +1 -0
  29. package/dist/commands/preview.js +69 -0
  30. package/dist/commands/preview.js.map +1 -0
  31. package/dist/commands/render.d.ts +3 -0
  32. package/dist/commands/render.d.ts.map +1 -0
  33. package/dist/commands/render.js +213 -0
  34. package/dist/commands/render.js.map +1 -0
  35. package/dist/commands/schema.d.ts +3 -0
  36. package/dist/commands/schema.d.ts.map +1 -0
  37. package/dist/commands/schema.js +20 -0
  38. package/dist/commands/schema.js.map +1 -0
  39. package/dist/commands/still.d.ts +3 -0
  40. package/dist/commands/still.d.ts.map +1 -0
  41. package/dist/commands/still.js +58 -0
  42. package/dist/commands/still.js.map +1 -0
  43. package/dist/commands/transcribe.d.ts +3 -0
  44. package/dist/commands/transcribe.d.ts.map +1 -0
  45. package/dist/commands/transcribe.js +52 -0
  46. package/dist/commands/transcribe.js.map +1 -0
  47. package/dist/commands/validate.d.ts +3 -0
  48. package/dist/commands/validate.d.ts.map +1 -0
  49. package/dist/commands/validate.js +46 -0
  50. package/dist/commands/validate.js.map +1 -0
  51. package/dist/config.d.ts +14 -0
  52. package/dist/config.d.ts.map +1 -0
  53. package/dist/config.js +58 -0
  54. package/dist/config.js.map +1 -0
  55. package/dist/index.d.ts +3 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +53 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lint.d.ts +8 -0
  60. package/dist/lint.d.ts.map +1 -0
  61. package/dist/lint.js +75 -0
  62. package/dist/lint.js.map +1 -0
  63. package/dist/load-source.d.ts +5 -0
  64. package/dist/load-source.d.ts.map +1 -0
  65. package/dist/load-source.js +63 -0
  66. package/dist/load-source.js.map +1 -0
  67. package/dist/templates/agents-content.d.ts +3 -0
  68. package/dist/templates/agents-content.d.ts.map +1 -0
  69. package/dist/templates/agents-content.js +3282 -0
  70. package/dist/templates/agents-content.js.map +1 -0
  71. package/dist/util.d.ts +17 -0
  72. package/dist/util.d.ts.map +1 -0
  73. package/dist/util.js +40 -0
  74. package/dist/util.js.map +1 -0
  75. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Clipkit Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # @clipkit/cli
2
+
3
+ The Clipkit command-line interface — author and render Clipkit Protocol
4
+ videos locally.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install -g @clipkit/cli
10
+ # or, no install:
11
+ npx @clipkit/cli <command>
12
+ ```
13
+
14
+ ## Commands
15
+
16
+ ### `clipkit init [name]`
17
+
18
+ Scaffold a new Clipkit project in a fresh directory.
19
+
20
+ ```bash
21
+ clipkit init my-video
22
+ cd my-video
23
+ npm install
24
+ ```
25
+
26
+ Generates `package.json`, `tsconfig.json`, a starter `video.ts`,
27
+ `AGENTS.md` (so AI agents working in this directory auto-load the
28
+ authoring context), and `README.md`.
29
+
30
+ ### `clipkit new <template>`
31
+
32
+ Scaffold a known-good, render-tested Source from the `@clipkit/patterns`
33
+ library — an idiomatic starting point (fewer schema errors, better-looking
34
+ output) instead of a blank file. Templates: `promo`, `hero`, `kinetic`,
35
+ `title`, `cta`. Prints JSON to stdout, or `-o` to a file.
36
+
37
+ ```bash
38
+ clipkit new promo -o video.json
39
+ clipkit new hero --theme minimal > hero.json
40
+ ```
41
+
42
+ ### `clipkit validate <file>`
43
+
44
+ Schema-check a Source against the Clipkit Protocol. Accepts `.json`,
45
+ `.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.mjs`, or `.cjs`. TypeScript
46
+ files are loaded via [`jiti`](https://github.com/unjs/jiti) — no
47
+ separate build step.
48
+
49
+ ```bash
50
+ clipkit validate video.ts
51
+ # ✓ /…/video.ts is a valid Clipkit Protocol v1.0 document.
52
+
53
+ clipkit validate broken.json
54
+ # ✗ /…/broken.json failed validation (2 errors):
55
+ # - elements.0.type: Invalid discriminator value
56
+ # - width: Expected positive integer
57
+ ```
58
+
59
+ Add `--explain` to surface protocol-aware *warnings* on success (things
60
+ that validate but the runtime will silently drop or clip — e.g. non-ASCII
61
+ text the font atlas can't render, or an element that runs past the
62
+ composition's end) and extra guidance on failure.
63
+
64
+ The file must export the Source as `default`, or as a named export
65
+ called `source`, `video`, `project`, or `composition`. If only one
66
+ named export exists, that's used.
67
+
68
+ ### `clipkit explain <file>`
69
+
70
+ A plain-language read-back of a Source — dimensions, fps, duration, a
71
+ per-track timeline, an element breakdown, and the same protocol-aware
72
+ warnings as `validate --explain`. Verify what was authored without
73
+ rendering (the fast inner loop of an author → check → fix cycle).
74
+
75
+ ```bash
76
+ clipkit explain video.json
77
+ # 1280×720 · 30fps · 6s · mp4
78
+ # 4 elements (2 shape, 1 text, 1 caption)
79
+ # Timeline (by track, paint order low→high): …
80
+ ```
81
+
82
+ ### `clipkit preview <file>`
83
+
84
+ Open a Source in the Clipkit web editor — a live, editable preview with
85
+ zero local setup (no Chrome, no render, no credits; the editor renders it
86
+ in your browser). It uploads the Source and opens the returned link:
87
+
88
+ ```bash
89
+ clipkit preview video.ts
90
+ # ✓ Preview ready (anonymous, expires in 7 days):
91
+ #
92
+ # https://clipkit.dev/editor?id=…
93
+ ```
94
+
95
+ The link is shareable — copy it, send it, embed it. Without an API key the
96
+ preview is anonymous and expires in 7 days; logged in (see `clipkit login`)
97
+ it's owned by your team and permanent on paid plans. Pass `--no-open` to
98
+ print the link without launching a browser.
99
+
100
+ ### `clipkit render <file> -o output.mp4`
101
+
102
+ Render the Source to a video file. Two engines:
103
+
104
+ ```bash
105
+ # Local (default): headless Chrome on your machine — free, needs Google Chrome.
106
+ clipkit render video.ts -o out.mp4
107
+
108
+ # Cloud: Clipkit's GPU servers — needs `clipkit login`, consumes credits.
109
+ clipkit render video.ts -o out.mp4 --cloud
110
+
111
+ # Resolution / format / bitrate
112
+ clipkit render video.ts -o out.mp4 --resolution 1080p
113
+ ```
114
+
115
+ Local rendering uses the optional `@clipkit/render-service` engine plus your
116
+ installed Google Chrome. If it isn't present, the command tells you how to
117
+ install it (or to use `--cloud`). Cloud rendering submits the job, shows live
118
+ progress, and downloads the finished file.
119
+
120
+ ### `clipkit still <file> -o poster.png`
121
+
122
+ Render a single frame to a PNG — a fast visual sanity-check or thumbnail
123
+ without a full encode. Uses the same local engine as `render --local`
124
+ (needs Google Chrome). `-t/--time` picks the composition time.
125
+
126
+ ```bash
127
+ clipkit still video.json -o poster.png --time 1.5
128
+ ```
129
+
130
+ ### `clipkit login` / `clipkit logout`
131
+
132
+ Store an API key for the cloud commands (`render --cloud`, team-owned
133
+ previews). `login` opens the dashboard's API-keys page, takes a pasted
134
+ `ck_live_…` key, and saves it to `~/.config/clipkit/config.json` (chmod
135
+ 600). `logout` removes it.
136
+
137
+ ```bash
138
+ clipkit login # interactive: opens /keys, prompts for the key
139
+ clipkit login --api-key ck_live_… # non-interactive (CI)
140
+ ```
141
+
142
+ Every cloud command resolves its key as: `--api-key` flag → `CLIPKIT_API_KEY`
143
+ env var → the stored config file. The API host follows the same order via
144
+ `--api-url` / `CLIPKIT_API_URL`, defaulting to `https://clipkit.dev`.
145
+
146
+ ## For AI agents
147
+
148
+ Three commands make Clipkit easy to author against from an LLM:
149
+
150
+ ### `clipkit docs [topic]`
151
+
152
+ Print the canonical authoring docs to stdout, so an agent can pull the spec
153
+ into context in one command. Topics: `agents` (the authoring guide, default)
154
+ and `protocol` (formal field semantics).
155
+
156
+ ```bash
157
+ clipkit docs protocol > .context.md
158
+ ```
159
+
160
+ ### `clipkit schema`
161
+
162
+ Print the protocol as a JSON Schema (generated from the Zod source of
163
+ truth) — for constrained/structured generation, editor autocomplete, or
164
+ external validators.
165
+
166
+ ```bash
167
+ clipkit schema > clipkit.schema.json
168
+ ```
169
+
170
+ ### `clipkit mcp`
171
+
172
+ Run the Clipkit [MCP](https://modelcontextprotocol.io) server over stdio, so
173
+ an agent gets the full toolset (compose, preview, render) from one command.
174
+ Wire it into your agent's MCP config:
175
+
176
+ ```json
177
+ { "command": "npx", "args": ["-y", "@clipkit/cli", "mcp"] }
178
+ ```
179
+
180
+ ## License
181
+
182
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function docsCommand(program: Command): void;
3
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuBlD"}
@@ -0,0 +1,31 @@
1
+ // `clipkit docs [topic]` — print the canonical authoring docs to stdout, so an
2
+ // agent can pull the spec into context in one command:
3
+ // clipkit docs protocol > .context.md
4
+ // Docs are embedded at build time (see scripts/embed-agents.mjs) — no network,
5
+ // no dependence on the repo layout.
6
+ import { AGENTS_MD_CONTENT, PROTOCOL_MD_CONTENT } from '../templates/agents-content.js';
7
+ const TOPICS = {
8
+ agents: AGENTS_MD_CONTENT,
9
+ protocol: PROTOCOL_MD_CONTENT,
10
+ };
11
+ export function docsCommand(program) {
12
+ program
13
+ .command('docs [topic]')
14
+ .description('Print authoring docs (topics: agents, protocol; default: agents)')
15
+ .action((topic) => {
16
+ const key = (topic ?? 'agents').toLowerCase();
17
+ if (key === 'list') {
18
+ process.stdout.write('Available docs:\n' +
19
+ ' agents — the authoring guide (how to compose Sources)\n' +
20
+ ' protocol — formal field semantics (PROTOCOL.md)\n');
21
+ return;
22
+ }
23
+ const doc = TOPICS[key];
24
+ if (!doc) {
25
+ process.stderr.write(`✗ unknown topic "${topic}". Try: ${Object.keys(TOPICS).join(', ')} (or "list").\n`);
26
+ process.exit(1);
27
+ }
28
+ process.stdout.write(doc.endsWith('\n') ? doc : `${doc}\n`);
29
+ });
30
+ }
31
+ //# sourceMappingURL=docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,uDAAuD;AACvD,wCAAwC;AACxC,+EAA+E;AAC/E,oCAAoC;AAGpC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAExF,MAAM,MAAM,GAA2B;IACrC,MAAM,EAAE,iBAAiB;IACzB,QAAQ,EAAE,mBAAmB;CAC9B,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO;SACJ,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,kEAAkE,CAAC;SAC/E,MAAM,CAAC,CAAC,KAAc,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9C,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,mBAAmB;gBACjB,8DAA8D;gBAC9D,sDAAsD,CACzD,CAAC;YACF,OAAO;QACT,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,oBAAoB,KAAK,WAAW,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CACpF,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function explainCommand(program: Command): void;
3
+ //# sourceMappingURL=explain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../src/commands/explain.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAcrD"}
@@ -0,0 +1,25 @@
1
+ // `clipkit explain <file>` — a plain-language read-back of a Source so you (or
2
+ // an agent) can sanity-check what was authored WITHOUT rendering: dimensions,
3
+ // fps, duration, a per-track timeline, an element breakdown, plus protocol-aware
4
+ // warnings. The fast inner loop of an author→verify→fix cycle. The summary logic
5
+ // lives in @clipkit/lint so the MCP server can reuse it.
6
+ import { validate } from '@clipkit/protocol';
7
+ import { describe } from '@clipkit/lint';
8
+ import { loadSource } from '../load-source.js';
9
+ import { printValidationErrors } from '../util.js';
10
+ export function explainCommand(program) {
11
+ program
12
+ .command('explain <file>')
13
+ .description('Summarize a Source in plain language (timeline, elements, warnings)')
14
+ .action(async (file) => {
15
+ const { path, source } = await loadSource(file);
16
+ const result = validate(source);
17
+ if (!result.valid) {
18
+ printValidationErrors(path, result.errors);
19
+ process.stderr.write('\n(`explain` describes valid Sources — fix the errors above first.)\n');
20
+ process.exit(1);
21
+ }
22
+ process.stdout.write(describe(result.data));
23
+ });
24
+ }
25
+ //# sourceMappingURL=explain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.js","sourceRoot":"","sources":["../../src/commands/explain.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,yDAAyD;AAGzD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC7B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function initCommand(program: Command): void;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmClD"}
@@ -0,0 +1,176 @@
1
+ // `clipkit init [name]` — scaffold a new Clipkit project.
2
+ //
3
+ // Creates a directory with package.json + tsconfig.json + video.ts +
4
+ // README.md + AGENTS.md (copied so AI agents working in this project
5
+ // auto-load it as context). The video.ts starts as a minimal but
6
+ // brand-correct dark composition the user can immediately render.
7
+ import { mkdir, writeFile, access } from 'node:fs/promises';
8
+ import { join, resolve as resolvePath } from 'node:path';
9
+ import { CLIPKIT_PROTOCOL_VERSION } from '@clipkit/protocol';
10
+ import { AGENTS_MD_CONTENT } from '../templates/agents-content.js';
11
+ export function initCommand(program) {
12
+ program
13
+ .command('init [name]')
14
+ .description('Scaffold a new Clipkit project in a fresh directory')
15
+ .option('-f, --force', 'overwrite the directory if it already exists', false)
16
+ .action(async (name, opts) => {
17
+ const projectName = name ?? 'my-video';
18
+ const projectDir = resolvePath(process.cwd(), projectName);
19
+ // Refuse to clobber unless --force.
20
+ const exists = await pathExists(projectDir);
21
+ if (exists && !opts.force) {
22
+ throw new Error(`${projectDir} already exists. Re-run with --force to overwrite, or pick a different name.`);
23
+ }
24
+ await mkdir(projectDir, { recursive: true });
25
+ await writeFile(join(projectDir, 'package.json'), packageJson(projectName));
26
+ await writeFile(join(projectDir, 'tsconfig.json'), tsconfigJson());
27
+ await writeFile(join(projectDir, 'video.ts'), videoTs());
28
+ await writeFile(join(projectDir, 'README.md'), readmeMd(projectName));
29
+ await writeFile(join(projectDir, 'AGENTS.md'), AGENTS_MD_CONTENT);
30
+ await writeFile(join(projectDir, '.gitignore'), gitignore());
31
+ process.stdout.write(`Created ${projectName}/\n\n` +
32
+ ` cd ${projectName}\n` +
33
+ ` npm install\n` +
34
+ ` npx clipkit preview video.ts # browser preview\n` +
35
+ ` npx clipkit render video.ts # render to MP4\n\n` +
36
+ `Conforms to Clipkit Protocol v${CLIPKIT_PROTOCOL_VERSION}.\n`);
37
+ });
38
+ }
39
+ async function pathExists(p) {
40
+ try {
41
+ await access(p);
42
+ return true;
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ function packageJson(name) {
49
+ return (JSON.stringify({
50
+ name,
51
+ version: '0.0.0',
52
+ private: true,
53
+ type: 'module',
54
+ scripts: {
55
+ validate: 'clipkit validate video.ts',
56
+ preview: 'clipkit preview video.ts',
57
+ render: 'clipkit render video.ts -o output.mp4',
58
+ },
59
+ dependencies: {
60
+ '@clipkit/protocol': '*',
61
+ '@clipkit/patterns': '*',
62
+ },
63
+ devDependencies: {
64
+ '@clipkit/cli': '*',
65
+ typescript: '^5.7.0',
66
+ },
67
+ }, null, 2) + '\n');
68
+ }
69
+ function tsconfigJson() {
70
+ return (JSON.stringify({
71
+ compilerOptions: {
72
+ target: 'ES2022',
73
+ module: 'ESNext',
74
+ moduleResolution: 'Bundler',
75
+ esModuleInterop: true,
76
+ allowSyntheticDefaultImports: true,
77
+ strict: true,
78
+ skipLibCheck: true,
79
+ resolveJsonModule: true,
80
+ noEmit: true,
81
+ },
82
+ include: ['*.ts'],
83
+ }, null, 2) + '\n');
84
+ }
85
+ function videoTs() {
86
+ return `import type { Source } from '@clipkit/protocol';
87
+ import { CLIPKIT_PROTOCOL_VERSION } from '@clipkit/protocol';
88
+
89
+ // A minimal Clipkit Source. Edit freely — the schema is JSON-shaped at
90
+ // runtime; the TypeScript types are just authoring assistance.
91
+ //
92
+ // See AGENTS.md for the schema cheat sheet, pattern catalog, and recipes.
93
+
94
+ const source: Source = {
95
+ clipkit_version: CLIPKIT_PROTOCOL_VERSION,
96
+ width: 1920,
97
+ height: 1080,
98
+ duration: 6,
99
+ frame_rate: 30,
100
+ elements: [
101
+ // Dark background.
102
+ {
103
+ id: 'bg',
104
+ type: 'shape',
105
+ layer: 2,
106
+ time: 0,
107
+ duration: 6,
108
+ shape: 'rectangle',
109
+ x: 0,
110
+ y: 0,
111
+ width: 1920,
112
+ height: 1080,
113
+ fill_color: '#0A0A0A',
114
+ },
115
+
116
+ // Hero text — Geist 600, spring scale-in.
117
+ {
118
+ id: 'title',
119
+ type: 'text',
120
+ layer: 1,
121
+ time: 0.4,
122
+ duration: 5.6,
123
+ text: 'Hello, Clipkit',
124
+ x: 960,
125
+ y: 540,
126
+ x_anchor: 0.5,
127
+ y_anchor: 0.5,
128
+ font_family: 'Geist, Helvetica Neue, Arial, sans-serif',
129
+ font_size: 160,
130
+ font_weight: '600',
131
+ letter_spacing: -5,
132
+ fill_color: '#FAFAFA',
133
+ animations: [
134
+ { type: 'fade-in', duration: 0.5 },
135
+ { type: 'scale-in', duration: 1.0, easing: 'spring' },
136
+ ],
137
+ },
138
+ ],
139
+ };
140
+
141
+ export default source;
142
+ `;
143
+ }
144
+ function readmeMd(name) {
145
+ return `# ${name}
146
+
147
+ A Clipkit video project.
148
+
149
+ ## Scripts
150
+
151
+ \`\`\`bash
152
+ npm run validate # schema-check video.ts
153
+ npm run preview # open the browser preview
154
+ npm run render # render to output.mp4
155
+ \`\`\`
156
+
157
+ ## Authoring
158
+
159
+ \`video.ts\` exports a Clipkit \`Source\` — a JSON-shaped object describing
160
+ the composition. The TypeScript types come from \`@clipkit/protocol\`; the
161
+ [Clipkit Protocol](https://clipkit.dev/spec) defines the format.
162
+
163
+ See [\`AGENTS.md\`](./AGENTS.md) for the authoring reference. It's also
164
+ auto-loaded by AI agents (Claude Code, Cursor, etc.) when they work in
165
+ this directory.
166
+ `;
167
+ }
168
+ function gitignore() {
169
+ return `node_modules
170
+ dist
171
+ output.mp4
172
+ *.tsbuildinfo
173
+ .DS_Store
174
+ `;
175
+ }
176
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,iEAAiE;AACjE,kEAAkE;AAElE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,aAAa,EAAE,8CAA8C,EAAE,KAAK,CAAC;SAC5E,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE,IAAyB,EAAE,EAAE;QACpE,MAAM,WAAW,GAAG,IAAI,IAAI,UAAU,CAAC;QACvC,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;QAE3D,oCAAoC;QACpC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,GAAG,UAAU,8EAA8E,CAC5F,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7C,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;QAC5E,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;QACnE,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACzD,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;QACtE,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAClE,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAE7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,WAAW,OAAO;YAC3B,QAAQ,WAAW,IAAI;YACvB,iBAAiB;YACjB,wDAAwD;YACxD,wDAAwD;YACxD,iCAAiC,wBAAwB,KAAK,CACjE,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,CAAS;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,CACL,IAAI,CAAC,SAAS,CACZ;QACE,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,QAAQ,EAAE,2BAA2B;YACrC,OAAO,EAAE,0BAA0B;YACnC,MAAM,EAAE,uCAAuC;SAChD;QACD,YAAY,EAAE;YACZ,mBAAmB,EAAE,GAAG;YACxB,mBAAmB,EAAE,GAAG;SACzB;QACD,eAAe,EAAE;YACf,cAAc,EAAE,GAAG;YACnB,UAAU,EAAE,QAAQ;SACrB;KACF,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CACT,CAAC;AACJ,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,CACL,IAAI,CAAC,SAAS,CACZ;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,SAAS;YAC3B,eAAe,EAAE,IAAI;YACrB,4BAA4B,EAAE,IAAI;YAClC,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI;YAClB,iBAAiB,EAAE,IAAI;YACvB,MAAM,EAAE,IAAI;SACb;QACD,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CACT,CAAC;AACJ,CAAC;AAED,SAAS,OAAO;IACd,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDR,CAAC;AACF,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;CAqBjB,CAAC;AACF,CAAC;AAED,SAAS,SAAS;IAChB,OAAO;;;;;CAKR,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function loginCommand(program: Command): void;
3
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqEnD"}