@clipit-ai/cli 0.2.1

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 (4) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +249 -0
  3. package/bin/clipit.mjs +2183 -0
  4. package/package.json +39 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Video Clipper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # ClipIt CLI
2
+
3
+ Command-line access for ClipIt and shell-capable agents.
4
+
5
+ The CLI works with any agent framework, including Claude Code, Codex, Hermes, and others. It lets users connect a terminal or agent to ClipIt with a one-time browser approval link, discover Clippy tools, run approved actions, navigate videos and clips, and install local agent skill instructions without storing API keys in those skill files.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npx @clipit-ai/cli --help
11
+ npm install -g @clipit-ai/cli
12
+ ```
13
+
14
+ Node.js 18 or newer is required.
15
+
16
+ ## Login
17
+
18
+ ```bash
19
+ clipit login
20
+ ```
21
+
22
+ The CLI opens ClipIt in your browser and prints a one-time code. Approve the request in the web app, then the CLI stores a scoped credential in:
23
+
24
+ - macOS/Linux/WSL: `~/.config/clipit/config.json`
25
+ - Windows: `%APPDATA%\ClipIt\config.json`
26
+
27
+ Generated agent skills never contain the credential. They call the `clipit` command already installed on the user's machine.
28
+
29
+ For terminals without a browser:
30
+
31
+ ```bash
32
+ clipit login --no-browser
33
+ ```
34
+
35
+ For CI or manually created API keys:
36
+
37
+ ```bash
38
+ printf '%s' "$CLIPPER_API_KEY" | clipit auth set-key --stdin
39
+ ```
40
+
41
+ ## Core Commands
42
+
43
+ ```bash
44
+ clipit setup [--agent codex|claude|hermes|openclaw|<any-framework>]
45
+ clipit logout
46
+ clipit doctor --json
47
+ clipit auth status --json
48
+ clipit auth open-settings
49
+ clipit auth profiles --json
50
+ clipit skills list --json
51
+ clipit tools list --json
52
+ clipit tools describe <functionName> --json
53
+ clipit run <functionName> --params @params.json --max-credits 25 --json
54
+ ```
55
+
56
+ Video and clip helpers:
57
+
58
+ ```bash
59
+ clipit videos list --json
60
+ clipit videos get <videoId> --json
61
+ clipit videos upload ./source.mp4 --json
62
+ clipit videos import-url "https://example.com/video" --json
63
+ clipit videos transcribe <videoId> --json
64
+ clipit videos transcript <videoId> --json
65
+ clipit videos suggest-clips <videoId> --count 5 --json
66
+ clipit videos delete <videoId> --confirm --json
67
+
68
+ clipit clips list --video-id <videoId> --json
69
+ clipit clips get <clipId> --json
70
+ clipit clips create --video-id <videoId> --start 12 --end 42 --title "Strong hook" --json
71
+ clipit clips update <clipId> --title "Better title" --json
72
+ clipit clips render <clipId> --aspect 9:16 --quality high --json
73
+ clipit clips download <clipId> --json
74
+ clipit jobs wait <jobId> --stream
75
+ ```
76
+
77
+ Platform helpers:
78
+
79
+ ```bash
80
+ clipit credits balance --json
81
+ clipit credits usage --json
82
+ clipit credits estimate --operation-type transcription --provider deepgram --metrics @metrics.json --json
83
+
84
+ clipit analytics overview --days 30 --json
85
+ clipit analytics top-clips --limit 10 --json
86
+ clipit analytics post <socialPostId> --json
87
+
88
+ clipit exports start --clip-id <clipId> --params @export.json --confirm --json
89
+ clipit exports list --json
90
+ clipit exports get <jobId> --json
91
+ clipit exports wait <jobId> --stream
92
+ clipit exports download <jobId> --open
93
+ clipit exports cancel <jobId> --json
94
+
95
+ clipit assets list --json
96
+ clipit assets upload ./brand-logo.png --kind image --json
97
+ clipit assets delete <assetId> --confirm --json
98
+
99
+ clipit thumbnails generate --clip-id <clipId> --prompt "High contrast thumbnail" --confirm --json
100
+ clipit thumbnails get <thumbnailId> --json
101
+ clipit thumbnails list --clip-id <clipId> --json
102
+
103
+ clipit broll plan <clipId> --count 3 --confirm --json
104
+ clipit broll generate <clipId> --concept-index 0 --confirm --json
105
+ clipit broll list --clip-id <clipId> --json
106
+ clipit broll get <brollId> --json
107
+
108
+ clipit social accounts --json
109
+ clipit social post --clip-id <clipId> --platforms x,tiktok --caption "New clip" --confirm --json
110
+ clipit social schedule --clip-id <clipId> --platforms youtube --title "Launch clip" --caption "New clip" --at 2026-07-01T15:00:00.000Z --confirm --json
111
+ clipit social posts --status scheduled --json
112
+ clipit social get <postId> --json
113
+ clipit social cancel <postId> --confirm --json
114
+ ```
115
+
116
+ ## Reliability And Spend Guards
117
+
118
+ The CLI retries only idempotent `GET` requests, with at most two retries for network failures, `429`, `502`, `503`, and `504`. `Retry-After` is honored up to 10 seconds. `POST`, `PATCH`, and `DELETE` requests are never retried. Pass `--no-retry` to disable GET retries.
119
+
120
+ Non-OK API errors include the server `X-Request-Id` when present. In `--json` mode the error payload includes `requestId`, which is safe to share with ClipIt support.
121
+
122
+ Use `--max-credits <n>` on paid commands to preflight a cost estimate before the command runs:
123
+
124
+ ```bash
125
+ clipit exports start --clip-id <clipId> --confirm --max-credits 10 --json
126
+ clipit thumbnails generate --clip-id <clipId> --prompt "High contrast thumbnail" --confirm --max-credits 20 --json
127
+ clipit broll generate <clipId> --concept-index 0 --confirm --max-credits 150 --json
128
+ clipit social post --clip-id <clipId> --platforms x,tiktok --caption "New clip" --confirm --max-credits 2 --json
129
+ ```
130
+
131
+ For confirmation-gated commands, `--yes` is an alias for `--confirm`.
132
+
133
+ If the estimate is greater than the limit, the CLI exits with code `12` and prints the estimate. Explicitly mapped commands are `exports start`, `thumbnails generate`, `broll plan`, `broll generate`, `clips render`, `videos import-url`, `social post`, and `social schedule`. Confirmation-gated `clipit run <functionName>` calls do not have a command-specific estimate mapping; with `--max-credits` they print `estimate unavailable` and require `--confirm`.
134
+
135
+ When the server returns HTTP 402, the CLI exits with code `13`. For spend-limit errors, raise the API key spend limit in ClipIt Settings or use a different key; otherwise top up credits at https://clipit.dev/settings (Billing).
136
+
137
+ Large `videos upload` and `assets upload` commands print upload progress to stderr about every two seconds when stderr is a TTY and `--json` is not set.
138
+
139
+ ## Exit codes
140
+
141
+ | Code | Meaning |
142
+ | --- | --- |
143
+ | 0 | OK |
144
+ | 2 | Usage or validation error |
145
+ | 10 | Auth required |
146
+ | 11 | Permission denied |
147
+ | 12 | Confirmation required, `--max-credits` exceeded, or workflow awaiting approval |
148
+ | 13 | Insufficient credits or spend limit |
149
+ | 20 | Network error |
150
+ | 21 | Server error |
151
+
152
+ ## Agentic Workflows
153
+
154
+ Use `clipit ask` for natural-language Clippy workflows that may run across multiple tools and pause for approval:
155
+
156
+ ```bash
157
+ clipit context use --video-id <videoId>
158
+ clipit ask "Find the strongest clip in this video and prepare a social edit"
159
+ ```
160
+
161
+ If the workflow needs approval, the CLI exits with code 12 and prints the pending tasks, estimated cost, and the exact approval command:
162
+
163
+ ```bash
164
+ clipit workflow approve <jobId> --approval-id <approvalId> --decision approved
165
+ ```
166
+
167
+ Workflow helpers:
168
+
169
+ ```bash
170
+ clipit ask "Create three clip candidates" --video-id <videoId> --quick --stream
171
+ clipit ask "Prepare a review cut" --clip-id <clipId> --conversation-id <sessionId> --no-wait --json
172
+ clipit workflow status <jobId> --json
173
+ clipit workflow wait <jobId> --stream
174
+ clipit workflow approve <jobId> --approval-id <approvalId> --decision cheaper
175
+ ```
176
+
177
+ Navigation:
178
+
179
+ ```bash
180
+ clipit open settings
181
+ clipit open clip <clipId>
182
+ clipit links clip <clipId> --download --json
183
+ ```
184
+
185
+ ## Agent Skills
186
+
187
+ Install credential-free instructions for a shell-capable agent. The CLI fetches server-rendered instructions from `/api/v1/agent/instructions?target=<agent>&format=json` when authenticated. If the fetch fails or the CLI is offline, it installs a generic fallback skill and records the source in `SKILL.meta.json` next to `SKILL.md`.
188
+
189
+ ```bash
190
+ clipit agent install codex
191
+ clipit agent install claude
192
+ clipit agent install hermes
193
+ clipit agent install generic
194
+ ```
195
+
196
+ Inspect or remove generated skills:
197
+
198
+ ```bash
199
+ clipit agent doctor codex --json
200
+ clipit agent list --json
201
+ clipit agent update codex
202
+ clipit agent uninstall codex
203
+ clipit agent print-skill generic
204
+ ```
205
+
206
+ ## Profiles And Environment
207
+
208
+ The default profile is `default`.
209
+
210
+ ```bash
211
+ clipit login --profile work
212
+ clipit auth status --profile work --json
213
+ CLIPIT_PROFILE=work clipit clips list --json
214
+ ```
215
+
216
+ Supported environment variables:
217
+
218
+ - `CLIPPER_API_KEY`: overrides stored credentials.
219
+ - `CLIPPER_BASE_URL`: overrides the API base URL.
220
+ - `CLIPIT_PROFILE`: selects a config profile.
221
+ - `CLIPIT_CONFIG_DIR`: overrides the config directory.
222
+ - `CLIPIT_ALLOW_CUSTOM_HOST=true`: allows non-ClipIt hosts.
223
+ - `CLIPIT_TRUSTED_HOSTS=staging.example.com`: comma-separated extra trusted hosts.
224
+
225
+ ## Host Safety
226
+
227
+ By default the CLI only contacts ClipIt-owned hosts and local development hosts. To use staging or a self-hosted environment, pass:
228
+
229
+ ```bash
230
+ clipit login --base-url https://staging.example.com --allow-custom-host
231
+ ```
232
+
233
+ Only use `--allow-custom-host` for hosts you control or trust. It permits the CLI to send API requests and credentials to that host.
234
+
235
+ ## Public V1 Surface
236
+
237
+ | Area | Commands | Notes |
238
+ | --- | --- | --- |
239
+ | Auth and setup | `login`, `setup`, `logout`, `doctor`, `auth status`, `auth set-key`, `auth open-settings`, `auth profiles` | Browser-link login plus manual key fallback. |
240
+ | Agent tools | `skills list`, `tools list`, `tools describe`, `run`, `ask`, `workflow status/wait/approve` | Direct tool execution and natural-language Clippy workflows. |
241
+ | Context and navigation | `context use/show/clear/build`, `open`, `links`, `examples` | Persist active IDs and open ClipIt review surfaces. |
242
+ | Videos and clips | `videos list/get/upload/import-url/transcribe/transcript/suggest-clips/delete`, `clips list/get/create/update/render/download/delete`, `jobs get/wait` | Core media and render job helpers. |
243
+ | Credits | `credits balance`, `credits usage`, `credits estimate` | Estimate accepts `--metrics @file.json`. |
244
+ | Analytics | `analytics overview`, `analytics top-clips`, `analytics post` | `overview` returns aggregate and by-platform metrics. |
245
+ | Exports | `exports start/list/get/wait/download/cancel` | Export jobs poll through `/api/v1/exports/:jobId`; paid start requires `--confirm`. |
246
+ | Assets | `assets list/upload/delete` | Upload signs, PUTs the file to object storage, then finalizes the library asset. Delete requires `--confirm`. |
247
+ | Thumbnails and B-Roll | `thumbnails generate/get/list`, `broll plan/generate/list/get` | Paid generation commands require `--confirm`. |
248
+ | Social | `social accounts/post/schedule/posts/get/cancel` | Publish/schedule/cancel require `--confirm`; `x` maps to the server `twitter` platform. |
249
+ | Agent skills | `agent install/update/uninstall/doctor/print-skill/list` | `doctor` reports whether the installed skill came from the server or fallback. |