claude-artifact-cli 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/PKG-INFO +216 -10
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/README.md +215 -9
- claude_artifact_cli-0.3.0/src/claude_artifact_cli/__init__.py +1 -0
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/src/claude_artifact_cli/api.py +272 -14
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/src/claude_artifact_cli/cli.py +317 -1
- claude_artifact_cli-0.3.0/src/claude_artifact_cli/commands.py +881 -0
- claude_artifact_cli-0.3.0/src/claude_artifact_cli/update.py +243 -0
- claude_artifact_cli-0.2.0/src/claude_artifact_cli/__init__.py +0 -1
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/.gitignore +0 -0
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/LICENSE +0 -0
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/pyproject.toml +0 -0
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/src/claude_artifact_cli/__main__.py +0 -0
- {claude_artifact_cli-0.2.0 → claude_artifact_cli-0.3.0}/src/claude_artifact_cli/auth.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: claude-artifact-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Publish, update, list and inspect Claude Artifacts from the terminal, using the Claude Code login already on your machine.
|
|
5
5
|
Project-URL: Homepage, https://github.com/nikships/claude-artifact-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/nikships/claude-artifact-cli
|
|
@@ -34,7 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
|
|
35
35
|
# claude-artifact-cli
|
|
36
36
|
|
|
37
|
-
Publish, update, pull
|
|
37
|
+
Publish, update, pull and inspect Claude Artifacts from the terminal, and work with their comments, database, assets, types and sharing, using the Claude Code login already on your machine.
|
|
38
38
|
|
|
39
39
|
[](https://pypi.org/project/claude-artifact-cli/)
|
|
40
40
|
[](https://pypi.org/project/claude-artifact-cli/)
|
|
@@ -46,7 +46,7 @@ Publish, update, pull, list and inspect Claude Artifacts from the terminal, usin
|
|
|
46
46
|
|
|
47
47
|
## What is this?
|
|
48
48
|
|
|
49
|
-
`claude-artifact` publishes an HTML page (plus any CSS, JS and images it uses) as a [Claude Artifact](https://claude.ai/code/artifacts) and prints the link, and pulls an artifact's files back down to edit and republish. It talks to the same API the Claude Code `Artifact` tool uses and reuses the claude.ai login from `claude /login`. No API key, no config file, no dependencies beyond Python 3.10+.
|
|
49
|
+
`claude-artifact` publishes an HTML page (plus any CSS, JS and images it uses) as a [Claude Artifact](https://claude.ai/code/artifacts) and prints the link, and pulls an artifact's files back down to edit and republish. It also reads and answers comment threads, reads and writes an artifact's database, manages its uploaded assets, starts artifacts from types (Slides, Docs, Dashboard, …), declares runtime capabilities, and handles sharing, renaming, pinning, history and deletion. It talks to the same API the Claude Code `Artifact` tool uses and reuses the claude.ai login from `claude /login`. No API key, no config file, no dependencies beyond Python 3.10+.
|
|
50
50
|
|
|
51
51
|
Use it where the built-in tool can't reach: other coding agents (Droid, Codex, Cursor, OpenCode), subagents, shell scripts, Makefiles, git hooks and CI jobs.
|
|
52
52
|
|
|
@@ -80,10 +80,31 @@ claude-artifact list [--scope mine|shared|all] [--limit N]
|
|
|
80
80
|
claude-artifact read SLUG_OR_URL [-o FILE] metadata + published file manifest
|
|
81
81
|
claude-artifact read SLUG_OR_URL --path P [--path P ... --out-dir DIR]
|
|
82
82
|
a published file's exact bytes
|
|
83
|
+
claude-artifact versions SLUG_OR_URL version history (* marks live)
|
|
84
|
+
claude-artifact rename SLUG_OR_URL TITLE
|
|
85
|
+
claude-artifact pin|unpin SLUG_OR_URL
|
|
86
|
+
claude-artifact delete SLUG_OR_URL --yes delete for everyone; no undo
|
|
87
|
+
claude-artifact share SLUG_OR_URL [--private | --org | --add UUID ... [--access view|comment] | --remove UUID ...]
|
|
88
|
+
|
|
89
|
+
claude-artifact comments list SLUG_OR_URL [--all | --awaiting] [--full]
|
|
90
|
+
claude-artifact comments reply SLUG_OR_URL THREAD TEXT|- [--id UUID]
|
|
91
|
+
claude-artifact comments resolve SLUG_OR_URL THREAD ...
|
|
92
|
+
claude-artifact watch SLUG_OR_URL [--interval S] [--count N] [--no-comments]
|
|
93
|
+
|
|
94
|
+
claude-artifact db whoami|get|list|query|set|update|delete|edit|batch SLUG_OR_URL ...
|
|
95
|
+
claude-artifact assets list|upload|get|delete|copy SLUG_OR_URL ...
|
|
96
|
+
|
|
97
|
+
claude-artifact types list | show TYPE | read TYPE PATH | instances TYPE
|
|
98
|
+
claude-artifact create TYPE [--title T] new artifact from a type (slides, docs, ...)
|
|
99
|
+
claude-artifact contract [VERSION] [--prompt]
|
|
100
|
+
runtime capabilities and the page-author guide
|
|
101
|
+
|
|
83
102
|
claude-artifact whoami check that auth works
|
|
103
|
+
claude-artifact update upgrade to the latest release now
|
|
104
|
+
claude-artifact --version
|
|
84
105
|
```
|
|
85
106
|
|
|
86
|
-
The URL goes to stdout and progress goes to stderr, so `URL=$(claude-artifact publish page.html -q)` captures only the link. Add `--json` to
|
|
107
|
+
The URL goes to stdout and progress goes to stderr, so `URL=$(claude-artifact publish page.html -q)` captures only the link. Add `--json` to any command that prints data for raw output. Exit codes: `0` success, `1` API error, `2` auth error, `3` version conflict (HTTP 409: a newer artifact version, or a database document that changed since `--if-version`), `130` interrupted.
|
|
87
108
|
|
|
88
109
|
Wherever a command takes a slug or URL (`SLUG_OR_URL`, `--slug`, `--url`), it accepts any of:
|
|
89
110
|
|
|
@@ -128,6 +149,12 @@ claude-artifact publish index.html --slug <slug> \
|
|
|
128
149
|
| `--mode patch\|replace` | `patch` overlays the manifest onto the base version, so published files you don't pass are kept. Default when updating a page. `replace` makes the manifest the whole artifact, so any published file you leave out is removed. Default for a new artifact and for the first publish of a directory. A directory with `.artifact.json` patches (see below). |
|
|
129
150
|
| `--base-version` | The version this publish was made against. If a newer version is live, the publish is refused with exit code `3`. Defaults to the version in a directory's `.artifact.json` (when publishing to the slug saved there). Without one, patch uses the live version and replace is not checked, so a concurrent publish goes undetected. |
|
|
130
151
|
| `--force` | Publish even if a newer version is live, discarding it. |
|
|
152
|
+
| `--capability NAME[=JSON]` | Declare a runtime capability the page uses: `db`, `user`, `assets`, `comments`, `artifact`, `downloads`, … with its config (default `{}`), e.g. `--capability 'db={"rules":[…]}'`. Repeatable. The set you pass replaces the stored declaration; a publish without `--capability` keeps it. Names are checked against the contract. `claude-artifact contract --prompt` documents each one. |
|
|
153
|
+
| `--clear-capabilities` | Drop every declared capability. |
|
|
154
|
+
| `--contract VERSION` | Pin the runtime contract, or `latest` to upgrade. Default: the artifact's stored contract; a declaration on an artifact without one uses the latest. |
|
|
155
|
+
| `--copy SOURCE PUB[=SRC]` | Have the server copy published file `SRC` (default `PUB`) from artifact `SOURCE` into this one at `PUB`. Nothing is downloaded or re-uploaded. Repeatable. The server copies scripts, styles, data, fonts and images, not HTML or XML. |
|
|
156
|
+
| `--note TEXT` | A note recorded with this version; `versions` shows it. |
|
|
157
|
+
| `--thumbnail IMAGE`, `--thumbnail-dark IMAGE` | Gallery thumbnails. |
|
|
131
158
|
| `-q`, `--quiet` | Print only the URL. |
|
|
132
159
|
|
|
133
160
|
`--json` prints the deploy response with the artifact `url` added: `{"url", "slug", "version", …}`.
|
|
@@ -224,8 +251,126 @@ claude-artifact read <slug> --path index.html --path app.css --out-dir ./out #
|
|
|
224
251
|
|
|
225
252
|
`read --path P` prints the published file's exact bytes to stdout instead, checked against the manifest's sha256. Repeat `--path` with `--out-dir DIR` to save several files under `DIR` at their published paths; it prints each saved path. `--path` doesn't combine with `--json` or `-o`, more than one `--path` needs `--out-dir`, and `--out-dir` needs `--path`.
|
|
226
253
|
|
|
254
|
+
`read` also shows the artifact's runtime contract and declared capabilities. `list --pinned` shows only pinned artifacts.
|
|
255
|
+
|
|
227
256
|
Never WebFetch or curl a `claude.ai` artifact URL: it is a login-walled app shell and returns no page content.
|
|
228
257
|
|
|
258
|
+
### Comments
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
claude-artifact comments list <slug> # open threads, with authors and anchors
|
|
262
|
+
claude-artifact comments list <slug> --awaiting # threads a person sent to Claude that have no answer yet
|
|
263
|
+
claude-artifact comments reply <slug> <thread> "Fixed in the latest version."
|
|
264
|
+
echo "Long answer" | claude-artifact comments reply <slug> <thread> -
|
|
265
|
+
claude-artifact comments resolve <slug> <thread>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
`list` shows open threads; `--all` adds resolved ones and `--full` keeps long comments whole. Each thread prints its id, its state (`resolved`, `sent to Claude`, `awaiting Claude`), what it is anchored to, and every comment.
|
|
269
|
+
|
|
270
|
+
`reply` posts **as Claude**, and only on a thread a person sent to Claude ("Send to Claude" on the artifact's page); anything else is refused, as it is for Claude Code's Artifact tool. When the thread is waiting on Claude, the reply marks that request answered. Each reply carries a client id (`--id`, default a fresh UUID); resending the same id posts nothing new, so a retry after a network error is safe. `resolve` works on the same threads. Starting a thread, and replying or resolving as yourself, need a claude.ai browser session: do those on the artifact's page.
|
|
271
|
+
|
|
272
|
+
### Watch
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
claude-artifact watch <slug> # prints events until Ctrl-C
|
|
276
|
+
claude-artifact watch <slug> --json --count 1 # wait for the next event, print it as JSON, exit
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Polls every `--interval` seconds (default 30) and prints one line per new version, new comment (`[to Claude]` when a person sent it to Claude) and resolved thread. `--json` prints one JSON object per line: `{"event": "version", "version", "previous"}`, `{"event": "comment", "thread", "comment", "author", "text", "to_claude", "awaiting_claude"}` or `{"event": "resolved", "thread", "at"}`. `--no-comments` watches versions only. Publishing identical content creates no new version, so it prints nothing.
|
|
280
|
+
|
|
281
|
+
### Database
|
|
282
|
+
|
|
283
|
+
An artifact's database holds shared and per-person JSON documents its page reads with `claude.use("db")`. The page's published version must declare the capability: `publish … --capability db --capability user`.
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
claude-artifact db set <slug> tasks t1 --data '{"title": "Ship it", "done": false}'
|
|
287
|
+
claude-artifact db update <slug> tasks t1 --data '{"done": true}' --if-version 1
|
|
288
|
+
claude-artifact db get <slug> tasks t1
|
|
289
|
+
claude-artifact db list <slug> tasks --all
|
|
290
|
+
claude-artifact db query <slug> tasks --where done == false --where n '>=' 2 --order-by n:desc
|
|
291
|
+
claude-artifact db edit <slug> notes n1 --field body --old "teh" --new "the" --replace-all
|
|
292
|
+
claude-artifact db delete <slug> tasks t1
|
|
293
|
+
claude-artifact db batch <slug> @writes.json # [{"op":"set","collection":"tasks","doc_id":"t2","data":{…}}, …]
|
|
294
|
+
claude-artifact db whoami <slug> # your id, as in data/users/<id>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
| Rule | |
|
|
298
|
+
|------|--|
|
|
299
|
+
| Paths | A collection is 1-15 `/`-separated segments with an odd count (`tasks`, `boards/b1/columns`); a document is collection + doc id. Segments use letters, digits and `_ - . ~ : @ +`. |
|
|
300
|
+
| Per-person data | `data/users/<id>` is private to that person, even from the owner. `me` stands for you: `db get <slug> data/users/me prefs`. |
|
|
301
|
+
| `set` / `update` | `set` replaces the document; `update` merges fields, and `{"__delete__": true}` removes one. `--data` takes JSON, `-` for stdin, or `@FILE`. |
|
|
302
|
+
| `--if-version N` | The write applies only if the document is still at version `N`. Otherwise nothing is written and the command exits `3`. |
|
|
303
|
+
| `edit` | Replaces text inside one string field without resending the document. |
|
|
304
|
+
| `query` | `--where FIELD OP VALUE` with `==` `!=` `<` `<=` `>` `>=` `in` `not-in` `array-contains`. `VALUE` is parsed as JSON when it can be, else taken as a string. |
|
|
305
|
+
| Paging | `list` and `query` print `--cursor` for the next page; `--all` follows every page. |
|
|
306
|
+
| `batch` | 1-50 `set`/`update`/`delete` writes, `{op, collection, doc_id, data?, if_version?}`, each document at most once, up to 1 MiB, in one request. |
|
|
307
|
+
|
|
308
|
+
`get` prints the document's data (stderr has its version); a missing document exits `1`. List and query print `id`, `v<version>` and the data, tab-separated.
|
|
309
|
+
|
|
310
|
+
### Assets
|
|
311
|
+
|
|
312
|
+
The asset store holds files a page uploads or references by id: images, SVG, video, PDF, fonts, CSS/JS, CSV, Markdown, JSON and text, up to 20 MiB each (SVG 2 MiB, sanitized). Declare `--capability assets` for the page to use them.
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
claude-artifact assets upload <slug> logo.png chart.svg # prints id, url, file
|
|
316
|
+
claude-artifact assets list <slug>
|
|
317
|
+
claude-artifact assets get <slug> <id> -o logo.png # bytes, checked against the sha256
|
|
318
|
+
claude-artifact assets copy <slug> --from <other-slug> <id> ... # 1-10 ids; prints old -> new
|
|
319
|
+
claude-artifact assets delete <slug> <id>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
A page serves an asset at `/_blob/<id>`. `--type` overrides the content type taken from the extension.
|
|
323
|
+
|
|
324
|
+
### Types
|
|
325
|
+
|
|
326
|
+
Artifact types (Slides, Docs, Dashboard, Design, Motion, …) are ready-made pages that take your content as data.
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
claude-artifact types list
|
|
330
|
+
claude-artifact types show slides # release and the files it ships
|
|
331
|
+
claude-artifact types read slides SKILL.md # how to fill one
|
|
332
|
+
claude-artifact create slides --title "Q3 review" # prints the new artifact's URL
|
|
333
|
+
claude-artifact pull <new-slug> ./deck # then add your files, publish ./deck
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`TYPE` is a title (case-insensitive), slug or URL. `create` sends an idempotency key (`--idempotency-key` to reuse one), so a retried create doesn't make a second artifact. `types instances TYPE` lists artifacts made from a type.
|
|
337
|
+
|
|
338
|
+
### Contract and capabilities
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
claude-artifact contract # latest runtime contract and its capability names
|
|
342
|
+
claude-artifact contract --prompt # the guide for page authors: claude.use(...), each capability's config
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Sharing and housekeeping
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
claude-artifact share <slug> # audience, people, viewers, commenters
|
|
349
|
+
claude-artifact share <slug> --org # everyone in your organization
|
|
350
|
+
claude-artifact share <slug> --private # only you
|
|
351
|
+
claude-artifact share <slug> --add <account-uuid> --access view
|
|
352
|
+
claude-artifact share <slug> --remove <account-uuid>
|
|
353
|
+
claude-artifact versions <slug>
|
|
354
|
+
claude-artifact rename <slug> "New title" # recorded as a new version
|
|
355
|
+
claude-artifact pin <slug>
|
|
356
|
+
claude-artifact delete <slug> --yes
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Sharing is read-modify-write: a change made by someone else in between is refused rather than overwritten. People are named by claude.ai account UUID (`owner_account` in `list --json`, `author.account` in comments for org members); there is no lookup by email. `delete` refuses without `--yes`.
|
|
360
|
+
|
|
361
|
+
## Updates
|
|
362
|
+
|
|
363
|
+
A uv tool or pipx install keeps itself current. At most once a day, a command checks PyPI in the background (2-second timeout, never in CI). When a newer release is out, it starts `uv tool upgrade claude-artifact-cli` (or `pipx upgrade claude-artifact-cli`) in a detached process after the command finishes and says so on stderr; `-q` keeps that quiet. The upgrade's output goes to `~/.config/claude-artifact-cli/update.log`. A plain pip install isn't changed behind your back: it prints a notice instead. A failed check or upgrade never changes the command's output or exit code.
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
claude-artifact update # upgrade now, in the foreground
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
| Variable | Effect |
|
|
370
|
+
|----------|--------|
|
|
371
|
+
| `CLAUDE_ARTIFACT_NO_AUTO_UPDATE=1` | Check and print a notice, but never upgrade. |
|
|
372
|
+
| `CLAUDE_ARTIFACT_NO_UPDATE_CHECK=1` | No check at all. `CI` set does the same. |
|
|
373
|
+
|
|
229
374
|
## Auth
|
|
230
375
|
|
|
231
376
|
The token is looked up in this order:
|
|
@@ -274,6 +419,12 @@ curl -fsSL https://raw.githubusercontent.com/nikships/claude-artifact-cli/main/s
|
|
|
274
419
|
| `an artifact made from a type can only be patched` | `--mode replace` on a typed directory. Leave `--mode` off. |
|
|
275
420
|
| `…/index.html belongs to the artifact's type and can't be published; remove it` | A typed directory holds an `index.html`. Delete it. |
|
|
276
421
|
| `429 … daily publish cap` | Plan limit. Resets at UTC midnight. |
|
|
422
|
+
| `Claude can only reply on a thread a person sent to Claude` | `comments reply`/`resolve` on a thread without "Send to Claude". Ask the person to send it to Claude, or answer on the page. |
|
|
423
|
+
| `this artifact's published version doesn't declare the db capability` | Republish with `--capability db --capability user`. |
|
|
424
|
+
| `the document changed since --if-version`, exit code `3` | Someone wrote the document since you read it. `db get` it again and redo the write. |
|
|
425
|
+
| `… names a document, not a collection` | A collection path needs an odd number of segments. Split off the last segment as the doc id. |
|
|
426
|
+
| `contract … has no capability …` | A misspelled `--capability`. The error lists the valid names. |
|
|
427
|
+
| `deleting … can't be undone; pass --yes` | `delete` needs `--yes`. |
|
|
277
428
|
|
|
278
429
|
## The protocol
|
|
279
430
|
|
|
@@ -284,15 +435,34 @@ POST /api/frame/deploy/direct publish
|
|
|
284
435
|
POST /api/frame/deploy/prepare content-hash preflight (bodies over ~15 MB)
|
|
285
436
|
POST /api/frame/upload stage blobs the preflight asked for
|
|
286
437
|
GET /api/frame/{slug}?via=model_read boot: metadata, file manifest, assetToken
|
|
287
|
-
GET /api/frame/read/{slug} ownership
|
|
438
|
+
GET /api/frame/read/{slug} ownership, stored contract and capabilities
|
|
288
439
|
GET /api/frame/frames?limit=N list
|
|
440
|
+
GET /api/frame/versions/{slug} version history
|
|
441
|
+
POST /api/frame/retitle/{slug} rename {"title"}
|
|
442
|
+
POST|DELETE /api/frame/favorite/{slug} pin / unpin
|
|
443
|
+
DELETE /api/frame/{slug} delete
|
|
444
|
+
GET|PATCH /api/frame/perm/{slug} sharing (PATCH needs If-Match: <version from GET>)
|
|
445
|
+
|
|
446
|
+
GET /api/frame/comments/{slug}?names=1 threads
|
|
447
|
+
POST /api/frame/comments/{slug}/{thread} reply as Claude
|
|
448
|
+
POST /api/frame/comments/{slug}/{thread}/session-resolve resolve
|
|
449
|
+
POST /api/frame/db/agent database
|
|
450
|
+
POST /api/frame/blob/{slug}/agent-upload|agent-list|agent-copy, /{id}/agent-delete assets
|
|
451
|
+
|
|
452
|
+
GET /api/frame/types[/{slug}[/files/{path}|/instances]] types
|
|
453
|
+
POST /api/frame/types/{slug}/create?idempotency_key=K new artifact from a type
|
|
454
|
+
GET /api/frame/contract/{latest|version}[/prompt] runtime contract
|
|
289
455
|
|
|
290
456
|
GET https://{slug}.frame.claudeusercontent.com/_f/{ver}/_src/{path}?__frame_t=<assetToken>
|
|
291
457
|
published source bytes (see Reading files)
|
|
292
458
|
GET https://{slug}.frame.claudeusercontent.com/_f/{ver}/{path}?__frame_t=<assetToken>
|
|
293
459
|
served copy
|
|
460
|
+
GET https://{slug}.frame.claudeusercontent.com/_f/{ver}/_blob/{id}?__frame_t=<assetToken>
|
|
461
|
+
an uploaded asset
|
|
294
462
|
```
|
|
295
463
|
|
|
464
|
+
Every route above answers the OAuth bearer directly. Claude Code routes some of them through a relay in cloud sessions; on a local machine it calls them directly too.
|
|
465
|
+
|
|
296
466
|
Headers on `api.anthropic.com` calls:
|
|
297
467
|
|
|
298
468
|
```
|
|
@@ -330,7 +500,9 @@ A manifest value with `content` inlines the file; one with `sha256` references a
|
|
|
330
500
|
|
|
331
501
|
**Wire encoding.** These content types go as raw UTF-8 strings; everything else is base64: `text/html`, `text/css`, `text/plain`, `text/markdown`, `text/csv`, `text/javascript`, `application/javascript`, `application/json`, `application/manifest+json`, `application/xml`, `text/xml`, `image/svg+xml`.
|
|
332
502
|
|
|
333
|
-
|
|
503
|
+
Optional deploy fields: `description`, `icon`, `label`, `note`, `thumbnail` and `thumbnail_dark` (base64 images), and `contract` with `capabilities` (`{"db": {}, "user": {}}`). `capabilities` requires `contract` (`HTTP 400: capabilities requires contract`); a deploy without `capabilities` keeps the stored declaration, and `{}` clears it. A patch needs a non-empty manifest.
|
|
504
|
+
|
|
505
|
+
Response: `{"slug", "version", "manifest", "history", "contract", "capabilities", …}`. The page lives at `https://claude.ai/code/artifact/<slug>`.
|
|
334
506
|
|
|
335
507
|
**Modes and conflicts.** `replace` makes the manifest the whole artifact; `patch` overlays it onto `baseVersion`, keeping paths it doesn't name. Both modes honor `baseVersion`: if the live version is newer, the deploy is refused with
|
|
336
508
|
|
|
@@ -345,6 +517,37 @@ HTTP 409
|
|
|
345
517
|
|
|
346
518
|
Over ~15 MB inline, the client switches to `prepare` → `upload` → `deploy`. `prepare` takes `{slug?, shas:[…]}` and answers `{slug, missing:[…]}`. The missing blobs go to `/upload` in batches of at most 15 MB, and the final deploy references them by `sha256`: the hex sha256 of the raw file bytes.
|
|
347
519
|
|
|
520
|
+
### Copying files from another artifact
|
|
521
|
+
|
|
522
|
+
A manifest entry can reference a file another artifact already published. First `POST /api/frame/upload` with `{"slug", "files": [{"path": "<dest>", "from": {"slug", "path", "ver"}}]}` (a new artifact reserves its slug with `/deploy/prepare` first), then deploy with `"<dest>": {"sha256": "<source sha256>", "contentType": "…"}`.
|
|
523
|
+
|
|
524
|
+
### Comments
|
|
525
|
+
|
|
526
|
+
`GET /comments/{slug}?names=1` answers `{"threads": [...], "names": {account: name}, "viewer"}`. A thread is `{id, created_at, anchor: {path, label, file, file_sha, …}, comments: [...], resolved_at?, resolved_by?, claude_activated_at?}`; a comment is `{id, author: {account, role?}, text, created_at, to_claude_at?}`. `author.role` is set (`"assistant"`) on Claude's comments. `to_claude_at` marks a comment a person sent to Claude.
|
|
527
|
+
|
|
528
|
+
The OAuth token can reply and resolve only on threads with `claude_activated_at` (a person used "Send to Claude"); elsewhere the server answers `403 Claude is not activated on this thread`. A reply is `POST /comments/{slug}/{thread}` with `{"id": "<client uuid>", "text", "answers_summon"?: true}`; it answers `201 {"thread_id", "comment_id", "replayed"?}` and the same `id` again answers `replayed: true` without posting. Resolve is `POST …/session-resolve` with `{"resolved": true}`. Starting a thread (`POST /comments/{slug}`) and `/resolve` answer `403 this comment action requires a claude.ai session`.
|
|
529
|
+
|
|
530
|
+
### Database
|
|
531
|
+
|
|
532
|
+
`POST /api/frame/db/agent` with `{"slug", "verb", "args"}`:
|
|
533
|
+
|
|
534
|
+
| verb | args |
|
|
535
|
+
|------|------|
|
|
536
|
+
| `whoami` | `{}` → `{"id"}` |
|
|
537
|
+
| `get` | `{"path": "coll/doc"}` → `{exists, data, version, updatedAt}` |
|
|
538
|
+
| `list`, `query` | `{"collection", "limit"?, "cursor"?, "where"?: [{field, op, value}], "orderBy"?: {field, direction}}` → `{docs: [{id, data, version, updatedAt}], nextCursor}` |
|
|
539
|
+
| `set` | `{"path", "data", "replace": true, "ifVersion"?}` |
|
|
540
|
+
| `update` | `{"path", "data", "ifVersion"?}` |
|
|
541
|
+
| `delete` | `{"path", "ifVersion"?}` |
|
|
542
|
+
| `str_replace` | `{"path", "field", "old_str", "new_str", "replace_all"?, "idem": <16 random bytes, base64url>, "ifVersion"?}` |
|
|
543
|
+
| `batch` | `{"ops": [{"op", …the args above}]}` → `{results: [{version?}]}` |
|
|
544
|
+
|
|
545
|
+
`op` is `eq ne lt lte gt gte in not-in array-contains`. Writes answer `{version, usage}`. Errors are `{"error": {"code", "message", …}}`: `404 not_declared` when the published version doesn't declare `db`, `409 version_mismatch` (with the current `version`) when `ifVersion` is stale.
|
|
546
|
+
|
|
547
|
+
### Assets
|
|
548
|
+
|
|
549
|
+
`agent-upload` takes the raw file bytes with the asset's `Content-Type` and answers `{opaque_id, url: "/_blob/<id>", size_bytes, content_type, sha256}`. `agent-list` takes `{"limit", "after"?}` and answers `{assets, usage, next?}`; `agent-copy` takes `{"from": <slug>, "ids": [...]}`; `/{id}/agent-delete` takes `{}` and answers `{"deleted"}`.
|
|
550
|
+
|
|
348
551
|
### Reading files
|
|
349
552
|
|
|
350
553
|
The boot, `GET /api/frame/{slug}?via=model_read`, returns `ver`, the `files` manifest (`path`, `size`, `contentType`, `sha256`) and a short-lived `assetToken`. Bytes come from the content host `https://{slug}.frame.claudeusercontent.com`:
|
|
@@ -365,9 +568,10 @@ The `assetToken` is redacted from every output and never written to disk.
|
|
|
365
568
|
|
|
366
569
|
### Not supported
|
|
367
570
|
|
|
368
|
-
- **
|
|
369
|
-
- **
|
|
370
|
-
- **
|
|
571
|
+
- **Starting comment threads, or commenting as yourself.** Those routes need a claude.ai browser session.
|
|
572
|
+
- **Artifacts shared from other organizations in `list`.** `GET /frames/external` needs a browser session.
|
|
573
|
+
- **Push notifications.** Claude Code's watch subscribes a webhook (`/subscribe/{slug}`) minted by its own session; `watch` polls instead.
|
|
574
|
+
- **Sharing by email.** The route takes account UUIDs; Claude Code resolves names on an approval card the CLI has no equivalent of.
|
|
371
575
|
|
|
372
576
|
## Project Structure
|
|
373
577
|
|
|
@@ -386,7 +590,9 @@ src/
|
|
|
386
590
|
├── __main__.py python -m claude_artifact_cli
|
|
387
591
|
├── api.py frame API client
|
|
388
592
|
├── auth.py token lookup
|
|
389
|
-
|
|
593
|
+
├── cli.py argparse entry point; publish, read, pull, status
|
|
594
|
+
├── commands.py comments, db, assets, types, sharing, history, watch
|
|
595
|
+
└── update.py daily update check, background upgrade, `update`
|
|
390
596
|
tests/ unit tests (offline; transport mocked)
|
|
391
597
|
AGENTS.md
|
|
392
598
|
LICENSE
|