@artifactshare/cli 0.19.2 → 0.20.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.
@@ -4,7 +4,7 @@ description: Share, publish, upload, host, update, open, or read back existing f
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 46
7
+ version: 49
8
8
  managed: true
9
9
  -->
10
10
 
@@ -42,63 +42,31 @@ When passing paths or free-form text through a shell, quote them. Paths may
42
42
  contain `$`, spaces, `*`, or `?`; use single quotes such as
43
43
  `'apps/web/app/routes/a.$id/index.tsx'` so the shell does not expand them.
44
44
 
45
- The browser share page opens HTML, Markdown, and static sites with its URL fragment (`#…`) and follows fragment changes inside the frame. Copy link includes the current fragment, so filtered views and Markdown headings can be shared. For static sites, only the entrypoint updates the share fragment; subpages leave it unchanged. This does not change CLI local preview.
45
+ ## Output contract
46
46
 
47
- Targets accept artifact IDs, app share URLs, per-ID `artifactshare.link` viewer URLs, and `a-<id>--v-<hex-version>.artifactshareusercontent.com` or `l-<id>--v-<hex-version>.artifactshareusercontent.com` execution URLs. Legacy sandbox and link-content URLs still resolve to IDs through the API; they no longer serve file content. Public share URLs are unchanged.
47
+ - Always pass `--json`. Success prints
48
+ `{"schema_version":2,"ok":true,"command":...,"data":...}` to stdout; failure
49
+ prints `{"schema_version":2,"ok":false,"error":...}` to stderr with exit
50
+ code 1.
51
+ - On failure, read `error.code`, `error.hint`, and `error.recovery`.
52
+ `recovery.kind` is one of `change_input`, `run_command`, `retry_later`,
53
+ `ask_human`, `report_issue`. When `error.requires_human` is true, report to
54
+ the user instead of retrying.
48
55
 
49
- ## Quick reference
56
+ ## First-time setup
50
57
 
51
- | Task | Command |
52
- | ------------------------ | ----------------------------------------------------------------------------------- |
53
- | Share a file or folder | `share <path> --json` |
54
- | Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
55
- | Replace with same URL | `update <target> <path> --json` |
56
- | Append to same URL | `append <target> <path> --json` |
57
- | Read back source | `artifacts get <target> --json` |
58
- | Download a site bundle | `download <target> --output ./out --json` |
59
- | Download a whole project | `download --project-id <id> --output ./out --json` |
60
- | List your artifacts | `artifacts list --json` |
61
- | Post a comment | `comments post <target> --body '<text>' --json` |
62
- | Read comments | `comments list <target> --json` |
63
- | Read older replies | `comments list <target> --thread-id <id> --before <older_cursor> --limit 50 --json` |
64
- | Change title or sharing | `edit <target> --title 'New' --json` |
65
- | Move to a project | `edit <target> --project-id <id> --json` |
66
- | Create a project | `projects create 'Name' --json` |
67
- | Find an ID from a title | `resolve <value> --json` |
68
- | Open a share URL | `open <url> --json` |
69
- | Preview a local file | `preview <file> --json` (local, no sign-in) |
70
- | Log out | `logout --profile <name> --json` |
58
+ `npm exec --yes --package=@artifactshare/cli -- artifactshare init --json` detects the agent, installs or updates
59
+ this skill, and reports the next steps (sign in, then share). When you receive
60
+ a share URL instead, start with `open <artifact-id-or-url> --json`. It ensures
61
+ this skill is installed or updated, then reads single-file artifacts or returns
62
+ a `download` next command for static sites and multi-file artifacts.
63
+
64
+ For attended setup, use `login --profile <name> --preset agent --json` and approve
65
+ the browser request. Omit `--preset` for unrestricted personal login. Check
66
+ `whoami --json` or `doctor --json`; follow `auth_required` recovery.
71
67
 
72
- ## Authentication
73
-
74
- - `login --profile <name> --preset agent --json` is for an attended coding
75
- agent on the user's own machine. It creates a project-scoped profile and may
76
- open the OS browser. Add `--project <exact-name-or-id>` to confirm one fixed
77
- eligible project; omit it to select a project in the browser. Omit `--preset`
78
- for unrestricted personal login. The pending event on stderr includes
79
- `browser_open`. Do not pass tokens to `login`. Device-login profiles renew
80
- expired CLI sessions automatically.
81
- - In unattended CI or scripts without browser approval, ask the user to issue
82
- an API token at `https://artifactshare.com/settings/tokens`, then inject it
83
- with `ARTIFACTSHARE_TOKEN` or `--token`. A shared agent platform uses a
84
- workspace-managed bot credential in a trusted host service outside the model
85
- sandbox; never expose it to model shell commands.
86
- - `logout --profile <name> --json` revokes a device-login refresh credential
87
- before removing it locally and leaves profile metadata in `config.json`.
88
- If remote revoke fails, the local credential is kept and logout fails.
89
- API-token profiles are removed locally only and are not revoked on the server.
90
- - To keep using an issued token as a named profile without TTY or browser
91
- login, pipe it on standard input:
92
- `printf '%s' "$TOKEN" | npm exec --yes --package=@artifactshare/cli -- artifactshare profiles import-token --profile <name> --json`.
93
- Bot tokens (`asb_` prefix, issued by a workspace admin) use the same command; the first
94
- refresh consumes the displayed token, overwriting an existing profile credential requires
95
- `--force`, and a revoked or superseded bot token fails with `bot_token_invalid` (ask the
96
- admin to reissue).
97
- Imported API-token profiles are not renewed by the CLI.
98
- Use `--allow-plaintext-token-store` only on a trusted machine without a native token store.
99
- That fallback is mode `0600` on POSIX and unavailable on Windows, where saved profiles require Credential Manager.
100
- - Check the current state with `whoami --json`, or `doctor --json` for token
101
- storage, authentication, destination, network, upload access, and skill update status.
68
+ Read [authentication, profiles and skills](references/authentication-profiles-skills.md)
69
+ when choosing credentials, importing tokens, changing profiles, or managing installations.
102
70
 
103
71
  ## Share
104
72
 
@@ -146,38 +114,8 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare share ./site-dir --
146
114
  runs add versions to the same artifact.
147
115
  - Run `share --help` for all flags.
148
116
 
149
- ## Audience and visibility settings
150
-
151
- Destination lists include only active projects you can post into. A private project permits its creator, a current workspace owner/admin on the team plan, or a verified contributor/manager. On free and plus, admin status alone does not permit placement in another member’s private project. Viewer access and individual artifact grants do not authorize placement. Agents and bots still require their fixed project and a verified contributor/manager grant for private projects; publisher credentials cannot select projects.
152
-
153
- Posting to a project delivers to the audience defined by that project. Without
154
- a destination, `share` posts to home. Choose the home audience by purpose:
155
-
156
- ```bash
157
- npm exec --yes --package=@artifactshare/cli -- artifactshare config set home_audience private --scope user --json
158
- npm exec --yes --package=@artifactshare/cli -- artifactshare config set home_audience workspace --scope repository --json
159
- npm exec --yes --package=@artifactshare/cli -- artifactshare share ./report.html --visibility private --json
160
- npm exec --yes --package=@artifactshare/cli -- artifactshare config get home_audience --scope effective --json
161
- ```
162
-
163
- Use the user scope for a personal safe default in this CLI environment, the
164
- repository scope only for a policy agreed by all participants, and
165
- `--visibility` for a one-time audience.
166
-
167
- Use `--visibility private|workspace|project|link` as a per-post override. For new
168
- projects, pass `projects create --visibility private|workspace`; persistent
169
- project defaults are documented in `projects create --help`.
170
-
171
- The complete `config --help` reference covers user and repository scopes,
172
- effective resolution, and the canonical `home_audience` key. The old
173
- `default_artifact_visibility` remains a compatibility alias, while
174
- `default_project_visibility` is the advanced `projects create` default. Home
175
- resolution checks repository then user settings (including the alias at each
176
- scope), then product default `workspace`; project defaults use repository,
177
- user, then `workspace`. Keyless `config get --json` returns only
178
- `home_audience`; pass an explicit key for either other setting. These settings
179
- only affect new home posts and project creation; update, edit, Web, and MCP
180
- defaults are unchanged.
117
+ Read [upload path safety](references/upload-path-safety.md) when selecting linked paths or recovering from upload filesystem errors.
118
+ Read [static-site scripts and data](references/static-sites.md) when a folder uses workers, WebAssembly, fonts, or data files.
181
119
 
182
120
  ## Update
183
121
 
@@ -214,6 +152,8 @@ it reports the current version and uses `recovery.kind: ask_human` with
214
152
  for those.
215
153
  - Run `update --help` for all flags.
216
154
 
155
+ Use `--label <label>` for an immutable version note. Read [version labels](references/version-labels.md) when adding labels or interpreting version history.
156
+
217
157
  ## Read back and download
218
158
 
219
159
  Use `artifacts get` for single-file sources. Use `download` for static sites.
@@ -252,545 +192,81 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare download --project-
252
192
  `resolve <value> --json` first and use the returned ID.
253
193
  - Run `artifacts get --help` or `download --help` for all flags.
254
194
 
255
- ## Comment
256
-
257
- Use `comments list` to read, `comments post` to write. IDs from `list` feed
258
- into `edit`, `resolve`, `reopen`, and `delete`.
259
-
260
- ```bash
261
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments list <artifact-id-or-url> --json
262
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <artifact-id-or-url> --body '<text>' --json
263
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <artifact-id-or-url> --body '<text>' --reply-to <thread-id> --json
264
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <artifact-id-or-url> --body '<text>' --quote 'exact text' --json
265
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <artifact-id-or-url> --body '<text>' --agent 'Claude' --json
266
- ```
267
-
268
- Quoted comments are resolved in the viewer using the exact quote and surrounding context, never the nearest repeated words. `--quote-before` and `--quote-after` accept up to 400 characters per side; preserve spaces next to the quote. Creation does not search the artifact. Optional `anchor.position_state` is `unchecked` until that version is viewed, then `attached` or `needs-check`. Only `attached` maps to `anchor.state: attached`; both other states map to `orphaned`. Older responses may omit `position_state`. Local preview uses the same strict resolution on every reload and preserves the original quote when its position needs checking.
269
-
270
- - `--reply-to <thread-id>` replies to an existing thread from `comments list`.
271
- - `--quote <text>` anchors a new thread to the quoted text. Copy the text from
272
- `artifacts get` so it matches exactly. When the same text appears more than
273
- once, add `--quote-before` and/or `--quote-after` to pick the right one.
274
- Do not combine `--quote` with `--reply-to`.
275
- - `--agent <name>` declares the posting agent (e.g. `Claude`, `Cursor`).
276
- The comment shows an agent badge in the viewer. Omit to post without a badge.
277
- `comments list` returns an `agent` field on messages posted with this flag.
278
-
279
- ```bash
280
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments edit <artifact-id-or-url> --message-id <id> --body '<text>' --json
281
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments resolve <artifact-id-or-url> --thread-id <id> --json
282
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments reopen <artifact-id-or-url> --thread-id <id> --json
283
- npm exec --yes --package=@artifactshare/cli -- artifactshare comments delete <artifact-id-or-url> --thread-id <id> --message-id <id> --json
284
- ```
285
-
286
- - Comment deletion cannot be undone. Omit `--message-id` only when the user
287
- wants the whole thread deleted.
288
- - Run `comments post --help` for all flags.
289
-
290
- ## Organize and settings
291
-
292
- Use `edit` for post-share changes. Use `projects list/create/edit` for
293
- project management.
294
-
295
- ```bash
296
- npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-or-url> --title 'New title' --json
297
- npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-or-url> --visibility private --grant-email viewer@example.com --json
298
- npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-or-url> --project-id <id> --json
299
- npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-or-url> --visibility project --json
300
- npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-or-url> --home --json
301
- npm exec --yes --package=@artifactshare/cli -- artifactshare delete <artifact-id-or-url> --json
302
- ```
303
-
304
- - Owners with unrestricted credentials can set `edit <target> --retain-versions N`
305
- to keep the latest N eligible published versions, or `--retain-versions all` to keep all
306
- future versions. For files created by or assigned to a publisher client, this counts only published publisher versions (including earlier clients) and keeps every version people added, even when an unrestricted owner changes the setting. Other files keep counting all published versions. The current version is always kept. Setting or lowering retention immediately deletes older eligible
307
- versions; the response reports `retain_versions` and `deleted_versions`.
308
- Owners can also use the file history panel, which confirms existing removals.
309
- Authorized viewers of versions removed by retention see an explanation and
310
- a latest-version link (HTTP 410). Unknown IDs still return 404 for signed-in
311
- viewers. Clearing the limit never restores deleted content. Comments and
312
- surviving version numbers remain. Agent-preset credentials cannot change retention.
313
- - `edit` changes title, visibility, explicit viewers, or project placement
314
- without adding a new version.
315
- - Set `--visibility link` with `--link-expires-at <RFC3339 UTC>` for a finite
316
- expiry or `--no-link-expiry` for unlimited expiry. The expiry options are
317
- mutually exclusive; omit both to preserve an existing link expiry.
318
- - If `edit` changes visibility away from `link`, the link expiry is cleared.
319
- If a link operation fails, use
320
- `link_sharing_plan_required` as a legacy code (Free can use link sharing now),
321
- `link_sharing_disabled` to ask the workspace owner or a Team admin to resume link sharing,
322
- `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
323
- (or use `--no-link-expiry` when the policy allows it), or
324
- `link_publish_rate_limited` when, under the default thresholds, the service
325
- observes 20 counted files before a publication in a Free workspace less than
326
- 14 days old during its rolling 24-hour window. A file counts once for its
327
- most recent change to link visibility, or for creation with link visibility.
328
- Making an artifact private, hiding it, or
329
- deleting it does not erase its publication history during the 24-hour window,
330
- so those actions do not restore a slot. A concurrent publication may be
331
- refused even if an earlier preflight saw room. Share with specific people.
332
- `error.recovery` indicates `retry_later`; use `error.message` and
333
- `error.hint` for when to retry, and honor the returned retry duration. Retry
334
- the link publication later instead of retrying immediately with unchanged
335
- input.
336
- - edit accepts --visibility private|workspace|project|link. Project visibility requires the artifact to be in a project after the edit; use --project-id <id> in the same request if needed. An explicit --visibility project at home (including --home) is refused without changes. Moving a project-visible artifact home makes it private only when project visibility is not explicitly requested.
337
- - The older `move` command remains available for placement-only automation, but
338
- prefer `edit` for new flows.
339
- - `artifacts delete <artifact-id-or-url>` is an alias of `delete`; both return JSON `command: "delete"`. Keep using top-level `delete` in deletion workflows.
340
- - `delete` permanently removes an artifact and its version history. Use only
341
- when the user explicitly asks.
342
-
343
- ```bash
344
- npm exec --yes --package=@artifactshare/cli -- artifactshare projects list --json
345
- npm exec --yes --package=@artifactshare/cli -- artifactshare projects create 'Client reports' --json
346
- npm exec --yes --package=@artifactshare/cli -- artifactshare projects create 'Internal' --visibility private --json
347
- npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id> --add-email viewer@example.com --json
348
- npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id> --archive --json
349
- ```
350
-
351
- - `projects create` uses `default_project_visibility` when saved, otherwise
352
- `workspace`. Pass `--visibility private` for a confidential project.
353
- - `projects edit` changes name, description, visibility, audience
354
- (`--add-email` / `--remove-email`), and archive state (`--archive` /
355
- `--unarchive`).
356
- - `init --project-id <id> --json` saves a default project for the working
357
- directory. `init --dry-run --json` previews the setup without side effects.
358
- - Run `edit --help`, `projects create --help`, or `projects edit --help` for
359
- all flags.
360
-
361
- ## Profiles
195
+ The browser share page opens HTML, Markdown, and static sites with its URL fragment (`#…`) and follows fragment changes inside the frame. Copy link includes the current fragment, so filtered views and Markdown headings can be shared. For static sites, only the entrypoint updates the share fragment; subpages leave it unchanged. This does not change CLI local preview.
362
196
 
363
- ```bash
364
- npm exec --yes --package=@artifactshare/cli -- artifactshare profiles list --json
365
- npm exec --yes --package=@artifactshare/cli -- artifactshare profiles use <name> --json
366
- npm exec --yes --package=@artifactshare/cli -- artifactshare profiles delete <name> --json
367
- ```
197
+ Targets accept artifact IDs, app share URLs, per-ID `artifactshare.link` viewer URLs, and `a-<id>--v-<hex-version>.artifactshareusercontent.com` or `l-<id>--v-<hex-version>.artifactshareusercontent.com` execution URLs. Legacy sandbox and link-content URLs also resolve to IDs through the API.
368
198
 
369
- - `profiles list` shows saved profiles and the default.
370
- - `profiles use` switches the default profile.
371
- - `profiles delete` removes the profile entry and its saved credential. Use
372
- `logout --profile <name>` when you only want to remove the credential.
373
- - To create a profile, use `login --profile <name>` (interactive) or
374
- `profiles import-token` (non-interactive, see Authentication).
199
+ Read [local write recovery](references/local-write-recovery.md) before overwriting downloads or recovering from filesystem or config-write failures.
375
200
 
376
- ## Skills
201
+ ## Comments
377
202
 
378
- ```bash
379
- npm exec --yes --package=@artifactshare/cli -- artifactshare skills ensure --tool auto --json
380
- npm exec --yes --package=@artifactshare/cli -- artifactshare skills update --json
381
- npm exec --yes --package=@artifactshare/cli -- artifactshare skills list --json
382
- ```
383
-
384
- - `open`, flag-less `init`, and `skills ensure --tool auto` detect Claude Code,
385
- Codex, or Cursor in the working directory (also Claude at its resolved user
386
- root when CLAUDE_CONFIG_DIR is nonblank) and install or update this skill in user scope
387
- (`$CLAUDE_CONFIG_DIR/skills/` or `~/.claude/skills/` when unset, `~/.agents/skills/`, or
388
- `~/.cursor/skills/artifactshare/SKILL.md`). With no agent detected,
389
- user-scope Codex, Claude Code, and Cursor skills are prepared.
390
- Claude Code user-scope skills go to `$CLAUDE_CONFIG_DIR/skills` when set, otherwise `~/.claude/skills`. A blank value skips automatic writes; `doctor` explains why. Mutations explicitly selecting `--tool claude --scope user` fail with `validation_failed`. With `--tool claude` and no `--scope`, `skills update` and `skills remove` process the project target and report the user target as skipped.
391
-
392
- - Cursor project scope is not auto-installed. Install the Cursor rule explicitly
393
- with `skills install --tool cursor --scope project`.
394
- - Use `skills install --tool cursor --scope user` to install or manage the
395
- Cursor user-scope skill explicitly.
396
- - `skills ensure --tool auto` accepts omitted `--scope` or `--scope user`;
397
- `--scope project` fails with `validation_failed`. Project-scope skills are
398
- opt-in via `skills install --tool <tool> --scope project`.
399
- - `skills update` updates installed managed skills to the bundled version.
400
- - `--force` overwrites an unmanaged file on install.
401
- - Run `skills --help` for all subcommands.
203
+ Use `comments list <target> --json` to pick up feedback and
204
+ `comments post <target> --body '<text>' --json` to respond. List results contain
205
+ partial thread histories. Read [comments](references/comments.md) when reading
206
+ older replies, anchoring feedback, editing or resolving threads, or handling posting limits.
402
207
 
403
208
  ## Preview (local annotate-and-fix loop)
404
209
 
405
- `preview` is a local, unauthenticated feature: it serves one local `.md` or
406
- `.html` file with the same rendering as the product viewer, the user annotates
407
- elements or text selections in the browser and submits them as an explicit
408
- batch, and the agent fixes the file. Nothing is uploaded by previewing;
409
- an upload happens only if the user opens the share dialog from the page.
210
+ Preview serves one local HTML or Markdown file without sign-in or uploading.
211
+ Read [preview](references/preview.md) before starting: it explains process ownership,
212
+ agent-specific notifications, manual pickup, recovery, and local isolation.
410
213
 
411
- ### Start and own one preview
214
+ Start `preview <file> --json` once using the environment's long-running task
215
+ mechanism. Keep the process handle. Wait for the ready JSON line with `url` and
216
+ `session` before telling the user it opened; a running task alone is not readiness.
217
+ Do not launch duplicates while startup is indeterminate.
412
218
 
413
- `preview` starts a long-lived local service; process exit is not its success
414
- condition. Start it once for the file using the environment's supported
415
- long-running or background process mechanism. Keep that process or task handle
416
- for the lifetime of the preview.
219
+ When the user submits feedback, read the whole batch with `preview next --json`,
220
+ fix it in one editing pass, save once, and report the batch with
221
+ `preview done --stdin --json`. Skip orphaned anchors with an explanatory note.
222
+ Saving reloads the preview. Sharing happens only when the user opens its share dialog.
417
223
 
418
- ```bash
419
- npm exec --yes --package=@artifactshare/cli -- artifactshare preview ./lp.html
420
- npm exec --yes --package=@artifactshare/cli -- artifactshare preview start ./lp.html --no-open
421
- ```
422
-
423
- - Run the CLI invocation itself as the long-running task. Do not add shell
424
- pipelines, redirections, command substitutions, or wrappers that wait for
425
- output or process exit; output capture managed by the agent's background-task
426
- tool is part of that tool's contract. Extra shell layers change ownership and
427
- the service's output contract.
428
- - Bare `preview <file>` is rewritten to `preview start <file>`. Start prints
429
- exactly one ready JSON line with `url`, `session`, `share_origin`, `reused`,
430
- and a sanitized `agent` notification projection, then keeps serving.
431
- `--no-open` skips opening the browser.
432
- - The ready JSON is the startup handshake. A background task id or running PID
433
- only proves that launch began. Treat the preview as ready, retain its `url`
434
- and `session`, and tell the user it opened only after reading that line.
435
- - `session` is generated by start. Use the returned value only with
436
- `preview next`, `done`, `reply`, or `stop`; do not pass `--session` to start.
437
- - After one launch begins, do not launch another copy until that attempt either
438
- returns a CLI failure or exits without a ready line. If the task is still
439
- running but its ready output cannot be read, the state is indeterminate:
440
- keep the task, report that startup could not be verified, and ask the user
441
- how to proceed. Do not infer a preview URL from ports or unrelated processes.
442
- - A later deliberate start for the same file may return `reused: true`. Its
443
- ready JSON is a valid handshake, but that invocation exits because the
444
- original preview process still owns the service. Do not treat the reused
445
- invocation's task or process handle as the server owner.
446
- - Editing and saving the file reloads the page automatically; annotations
447
- stay anchored where possible.
448
- - `preview next` returns every batch the user has submitted; it is
449
- non-claiming (calling it again returns the same open items) and with
450
- `--wait <sec>` it long-polls. `timed_out: true` and `session_ended: true`
451
- are normal empty results, not errors. The error
452
- `preview_session_not_found` means no live session exists; ask the user to
453
- start one. `preview_wait_conflict` means another long poll owns the session;
454
- use that wait or retry after it returns. `preview_request_failed` means the session is alive but rejected
455
- the request, so fix the payload (thread id, generation, size) and retry.
456
- `preview_session_unverified` on startup means a recorded session did not
457
- answer, or it was started before the current notification contract. Retry a
458
- temporarily unresponsive session; for an older session, ask the user to stop
459
- that preview process and start it again with the current CLI. The `--force`
460
- fallback clears an unresponsive record only once the process is gone.
461
- - Report outcomes with `preview done --stdin`; reply into a thread with
462
- `preview reply --thread <id> --body <text>` (state unchanged); end the
463
- session with `preview stop` (annotations stay saved on disk).
464
-
465
- ### Waking up when the user submits a batch
466
-
467
- Pick the first mode your environment supports:
468
-
469
- 1. In Codex, start preview from the session that owns the work. Current Codex
470
- environments expose the session UUID to the trusted local preview process;
471
- Artifact Share registers it and uses `codex queue` to send a fixed
472
- batch-ready notice. End your turn after preview is ready. When the notice
473
- resumes the session, run `preview next`, fix the whole batch, and report it
474
- with `preview done`. A `queued` state means Codex accepted the notice, not
475
- that it started processing. If it remains queued, the session may have
476
- ended: use `codex resume`, then run `preview next`. Never copy comments into
477
- a queue message; `preview next` is their source of truth.
478
- 2. In Claude Code, if `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor
479
- `true` and Bash exposes `run_in_background`, run the preview start command
480
- itself as one Bash background task and read it through Claude Code's
481
- task-output mechanism until the ready JSON arrives; add no shell pipeline or
482
- redirection. Keep a non-reused task alive as the server owner. After the
483
- handshake,
484
- use the background-wait path only if starting
485
- `preview next --wait 3600` in a separate background task returns a task ID.
486
- End your turn. A submitted batch completes the wait and resumes you; fix the
487
- file, report with `preview done`, then arm one new wait. If the wait returns
488
- `timed_out: true`, do not re-arm it automatically. If background waiting is
489
- unavailable or rejected after start, use manual pickup and do not describe
490
- the session as waiting. If background Bash tasks are unavailable before
491
- start, ask the user to run and keep the preview command open in their own
492
- terminal; that user-owned process is the server owner, and comment pickup is
493
- manual.
494
- 3. For an Artifact Share-managed Cursor ACP session, start with
495
- `npm exec --yes --package=@artifactshare/cli -- artifactshare-preview-cursor <file>`.
496
- Run one managed launcher per workspace. The launcher creates or loads the
497
- workspace's managed conversation and sends a fixed batch-ready prompt only
498
- while that session is idle. Read all comment content with `preview next`;
499
- never place it in the ACP prompt. Keep the launcher attended and approve
500
- Cursor tool permissions only after checking the request shown in its
501
- terminal.
502
- 4. In the interactive Cursor Agent CLI, start preview with
503
- `ARTIFACTSHARE_CURSOR_FOREGROUND_WAIT=1`, then block in the foreground on
504
- `preview next --wait 90` and repeat. Do not use that marker for a normal
505
- Cursor IDE chat: IDE chats are manual pickup and must not be described as
506
- automatically resumable.
507
- 5. Fallback: run `preview next` only when the user tells you a batch is
508
- ready.
509
-
510
- If `preview next` immediately returns the same item set as the previous
511
- call, do not re-arm; report the situation to the user instead.
512
-
513
- ### Working through a batch
514
-
515
- ```bash
516
- npm exec --yes --package=@artifactshare/cli -- artifactshare preview next ./lp.html --wait 90
517
- npm exec --yes --package=@artifactshare/cli -- artifactshare preview next --session 0123456789abcdef
518
- ```
224
+ ## Audience and visibility settings
519
225
 
520
- - Read the whole batch first, then fix everything in one editing pass and
521
- save once, then report the whole batch with a single `preview done` call.
522
- - Successful `preview next` and `preview done` results include the same
523
- sanitized `agent` notification projection as the ready result.
524
- - Each done item is `{thread, generation, outcome, note}` with outcome
525
- `fixed` (you changed the file) or `skipped` (`note` explaining why is
526
- required). The `note` is shown to the user as the thread summary, so
527
- write it for them.
528
- - An item whose `anchor.state` is `orphaned` lost its place in the document;
529
- do not try to re-fix it — report it as `skipped` with a note.
530
- - `done` is idempotent per generation: each item comes back as `accepted`,
531
- `stale` (the thread was reopened with a newer generation), or
532
- `already_reported`, plus `unknown_thread` for ids the session does not
533
- know.
226
+ Project posts use the project's audience; without a destination, share posts to home.
227
+ Use `--visibility private|workspace|project|link` for a per-post override.
228
+ Use `config set home_audience private --scope user --json` for a personal default;
229
+ use repository scope only for an agreed policy. Confirm with
230
+ `config get home_audience --scope effective --json` before posting.
534
231
 
535
- ```bash
536
- printf '%s' '{"items":[{"thread":"t1","generation":1,"outcome":"fixed","note":"Tightened the headline"}]}' | npm exec --yes --package=@artifactshare/cli -- artifactshare preview done ./lp.html --stdin
537
- ```
232
+ Use `edit` to change title, audience, expiry or placement without creating a version.
233
+ Read [organize and settings](references/organize-settings.md) when managing projects,
234
+ access, expiry, retention, deletion, or persistent defaults. Delete only on explicit request.
538
235
 
539
- Sharing is user-driven: the page's share button opens a separate-origin
540
- dialog that publishes the snapshot bytes; local annotations are never
541
- carried into the shared copy.
236
+ ## Skills and profiles
542
237
 
543
- ## Output contract
238
+ `skills ensure --tool auto --json` prepares user-scope skills;
239
+ `skills update --json` updates managed installations. Project installation is opt-in.
240
+ `profiles list --json` shows saved profiles; `profiles use <name> --json` switches
241
+ selection. Use `logout --profile <name> --json` to revoke a device-login credential.
242
+ The authentication, profiles and skills reference above covers tools, scopes, storage,
243
+ removal and unattended token imports.
544
244
 
545
- - Always pass `--json`. Success prints
546
- `{"schema_version":2,"ok":true,"command":...,"data":...}` to stdout; failure
547
- prints `{"schema_version":2,"ok":false,"error":...}` to stderr with exit
548
- code 1.
549
- - On failure, read `error.code`, `error.hint`, and `error.recovery`.
550
- `recovery.kind` is one of `change_input`, `run_command`, `retry_later`,
551
- `ask_human`, `report_issue`. When `error.requires_human` is true, report to
552
- the user instead of retrying.
245
+ ## REST API integrations
553
246
 
554
- ## First-time setup
247
+ Read [REST API only](references/rest-api-only.md) when working directly with
248
+ static-site inheritance or publisher device credentials. These have no supported
249
+ CLI workflows; do not invent flags for them.
555
250
 
556
- `npm exec --yes --package=@artifactshare/cli -- artifactshare init` detects the agent, installs or updates
557
- this skill, and reports the next steps (sign in, then share). When you receive
558
- a share URL instead, start with `open <artifact-id-or-url> --json`. It ensures
559
- this skill is installed or updated, then reads single-file artifacts or returns
560
- a `download` next command for static sites and multi-file artifacts.
251
+ ## Quick reference
561
252
 
562
- ### Version labels
563
-
564
- Successful update API responses include `number`, a positive integer matching the
565
- Viewer’s `v{number}` for the created version. CLI JSON exposes it as
566
- `data.version.number`, with or without a label. Older server responses may omit
567
- `number`; the CLI accepts them and omits `data.version.number`.
568
-
569
- The optional `--label <label>` option on `artifactshare update <target> <path>`
570
- attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
571
- bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
572
- space separators (Zs) are trimmed. Internal spacing and case are preserved.
573
- The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
574
- Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
575
- (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
576
- controls, and unpaired surrogates are rejected; labels are never truncated.
577
- CLI validation happens before authentication or upload. For a value beginning
578
- with a known flag, use `--label=--text` to pass it explicitly.
579
-
580
- The update API accepts one optional `label` query parameter on
581
- `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
582
- Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
583
- Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
584
- `data.version.label`: the normalized, stored label or `null` when omitted.
585
- Existing unlabeled rows are unchanged. Authorized history at
586
- `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
587
- `artifacts get <target> --include versions --json` preserves it. The viewer's
588
- version menu and full history show the label as plain text.
589
- `GET /api/shareables/:id/versions` remains a current-version lookup.
590
- Labels are update-only: initial uploads, `share --key`, `append`, preview,
591
- bridge publishing, and MCP update inputs do not accept them.
592
-
593
- ## Static-site scripts and data
594
-
595
- Folder shares load external HTTPS images, stylesheets from jsDelivr, cdnjs,
596
- unpkg, and Google Fonts (`fonts.googleapis.com`), and font files from jsDelivr
597
- and Google Fonts (`fonts.gstatic.com`). Load icon/font packages from jsDelivr
598
- or bundle the font files because cdnjs and unpkg font files are blocked.
599
- JavaScript `eval` and `new Function` remain blocked.
600
-
601
- Folder shares support WebAssembly, same-origin worker files, and `blob:` workers.
602
- DuckDB-WASM can load from jsDelivr: its `getJsDelivrBundles()` setup uses a blob
603
- worker to `importScripts()` the CDN worker and fetch its `.wasm` file. The existing
604
- script CDNs are allowed inside blob workers; JavaScript `eval` and `new Function`
605
- remain blocked in the page and its blob workers.
606
-
607
- DuckDB-WASM loads runtime extensions such as `parquet` and `json` from
608
- `https://extensions.duckdb.org/<duckdb-version>/<wasm_eh|wasm_mvp>/<name>.duckdb_extension.wasm`.
609
- Static-site `connect-src` permits that origin: blob workers inherit the page's
610
- policy, and same-origin JavaScript workers carry it. This permission covers
611
- extension fetching, not arbitrary network origins.
612
-
613
- To avoid the external extension request, bundle every needed extension matching
614
- the DuckDB engine version and selected WASM platform. Preserve the repository's
615
- version/platform layout, for example
616
- `extensions/v1.4.3/wasm_eh/parquet.duckdb_extension.wasm` for `@duckdb/duckdb-wasm@1.32.0`.
617
- The folder must match the engine version the page loads, which `SELECT version()`
618
- reports, so pin the package version. In the page, compute
619
- `new URL('extensions', location.href).href` (no trailing slash; DuckDB appends `/<version>/...`) and use that absolute same-origin
620
- repository URL in `SET custom_extension_repository = '<absolute same-origin repository URL>'`
621
- before any extension loads or queries. This avoids requests to the extension
622
- host; jsDelivr core bundles still require CDN requests.
623
-
624
- Keep data such as `data/*.parquet` in the shared folder. In the page, build an
625
- absolute same-origin URL with `new URL('data/rows.parquet', location.href).href`
626
- and pass it to DuckDB-WASM's `registerFileURL()` before querying the registered
627
- file with SQL. Relative URLs cannot be resolved inside its blob worker.
628
- Static-site binary assets support HTTP byte ranges. To refresh data while keeping
629
- the same share URL, replace the data locally and update the folder as a new
630
- version; each version retains its own isolated origin. Single-file HTML and
631
- Markdown have different script policies; these permissions apply to folder shares.
632
-
633
- ### API-only static-site inheritance
634
-
635
- `POST /api/shareables/:id/versions?artifact_kind=static_site` accepts one
636
- `base_version` and repeated `delete_path` query parameters. For example,
637
- `?artifact_kind=static_site&base_version=v1&delete_path=data/old.parquet&delete_path=old.js`
638
- with multipart `file` parts for `data/a.parquet` replaces that data file, removes
639
- the two listed paths, and inherits all other files without copying their objects.
640
- The base must be the current published version; a stale base returns HTTP 409
641
- `version_conflict`. It also supplies the expected version for agent credentials.
642
- If `expected_version` is supplied, it must equal the base (otherwise HTTP 400
643
- `validation-failed`). Neither parameter changes write permissions.
644
-
645
- Deletion paths use the same normalization and validation as uploaded paths.
646
- Sending and deleting the same path is invalid. A case-only addition requires
647
- explicitly deleting the old spelling. An absent deletion path is harmless.
648
- A base permits zero sent files, provided the resulting manifest still includes
649
- `index.html` or `index.md`. Entrypoint precedence, file-count, total-size, and
650
- case-collision checks apply to the complete resulting manifest. Without a base,
651
- the existing full replacement behavior applies. Empty or repeated bases,
652
- deletion without a base, and inheritance parameters on other artifact kinds
653
- return HTTP 400 `validation-failed`.
654
-
655
- Version size is the logical sum of that version's files. Workspace quota counts
656
- physical objects once across retained versions; only sent files add bytes.
657
- Pruning keeps objects referenced by remaining versions. Version URLs retain
658
- immutable manifests. This is a REST API feature: there are no CLI `update`
659
- flags, MCP inputs, or bridge inputs for inheritance.
660
-
661
- ### Publisher device credentials (API only)
662
-
663
- Versions added with publisher credentials are scheduled updates: content and live viewers refresh, but list order, feeds, unread indicators, and human update labels do not change. Browser history marks Scheduled update without exposing client names. API `updated_at` remains the actual mutation time; internal `activity_at` controls human activity ordering. Initial creation and versions published through other credentials keep their existing behavior.
664
-
665
- The device API accepts `preset: "publisher"` with a required `device_name`.
666
- Names are trimmed, NFC-normalized, case-sensitive, and limited to 1–100 Unicode
667
- letters, marks, numbers, ASCII spaces, or `._-()`. The browser approver explicitly
668
- creates a new client or continues one of their existing clients in that workspace.
669
- Names cannot be edited on the approval screen: if a name already exists, continue
670
- that client or request login again with a different name. Only explicit continuation
671
- restores access to earlier files; `device_id` never selects a client.
672
-
673
- A publisher can create private HTML, Markdown, or static-site artifacts in the
674
- approver's home. Static sites use `POST /api/shareables/uploads?artifact_kind=static_site`.
675
- It can manage only artifacts created by or assigned to its client, still owned by
676
- that approver in the same workspace, including after the owner shares or moves them.
677
- Single-file versions require `expected_version`. Static-site versions accept
678
- `artifact_kind=static_site` with either `expected_version` for replacement or
679
- `base_version` for changed-files uploads and repeated `delete_path` removals.
680
- The base must be current. Version uploads preserve audience, location and retention.
681
-
682
- On artifacts created by or assigned to a publisher client, retention counts only published versions added with publisher credentials, including earlier clients, and keeps every other version. This also applies to unrestricted owner edits. The newest N publisher versions and every current version are kept; drafts do not count. Unmanaged artifacts continue to count all published versions.
683
-
684
- The exact `GET /api/cli/artifacts/:id/download` returns raw source bytes for
685
- single files and a JSON manifest with version id, paths and SHA-256 hashes for
686
- static sites. Individual `download/*` requests are denied. `GET /api/cli/artifacts/:id`
687
- includes visibility; static-site readback contains metadata only. No `include`
688
- expansions are allowed. `DELETE /api/cli/artifacts/:id` deletes the artifact.
689
- POST or PATCH `/api/cli/shareables/:id/edit` accepts only `retain_versions`, a
690
- positive integer or null. Setting a limit prunes older versions immediately;
691
- clearing it never restores deleted content. Other presets remain POST-only.
692
-
693
- The owner can assign an existing artifact using an unrestricted credential or
694
- browser session: `POST /api/cli/artifacts/:id/adopt` with
695
- `{"publisher_client_id":"client1"}`. Obtain the verified client id from whoami or
696
- doctor. Assignment replaces the previous client's access and is audited even when
697
- repeated; historical creation attribution stays unchanged. Publisher credentials
698
- cannot adopt. There is no adoption UI or CLI command.
699
-
700
- Other clients' artifacts, list, resolve, comments, audience/title/expiry edits,
701
- move, projects, append and upsert remain denied. Existing presets' download and
702
- readback responses are unchanged. CLI publisher login/resume and publishing/download
703
- workflows remain unsupported; use the API. Credentials retain their client across
704
- rotation and can be revoked from Settings → CLI sessions.
705
-
706
- ## Comment windows and posting limits
707
-
708
- `comments list <target> --json` returns at most 50 threads, open first. Each
709
- thread contains its current first message and latest three replies, plus
710
- `message_count`, `reply_count` and `older_cursor`. These are partial histories.
711
- Use `comments list <target> --thread-id <id> --before <older_cursor> --limit 50
712
- --json` for older replies. Repeat with the returned cursor until it is null;
713
- merge by message ID and display in `(created_at, message_id)` order. Each page
714
- also includes the current first message. Cursors remain usable after their
715
- boundary message is deleted. `--around-message-id <id>` selects a bounded page
716
- containing a message; do not combine it with `--before`.
717
-
718
- A thread holds 500 currently stored messages, including its first message.
719
- `thread_capacity` means start a new thread. Existing excess messages are kept;
720
- deletions can restore space. Deleting the first message promotes the next
721
- earliest message; deleting the last removes the thread and anchor. Resolved
722
- threads still refuse replies.
723
-
724
- Creation and replies share 20 admissions per authenticated user and artifact
725
- per fixed UTC minute across browser, CLI, MCP and API tokens. Adjacent minute
726
- boundaries can admit 40 posts within a sliding 60 seconds. `rate_limited`
727
- includes `retry_after_seconds` and UTC `retry_at`; HTTP also sends `Retry-After`.
728
- Keep unsent content and retry after that time. Invalid requests, capacity refusals
729
- and closed-thread refusals observed before admission consume nothing. Rate
730
- refusals do not increment the counter; quota storage failures refuse the post.
731
- Once admitted, commit failures and status/version/capacity races consume the admission without a
732
- refund. Edits, deletions, resolve/reopen and anchor reports consume nothing.
733
- Mutation readback contains only the affected thread window and changed message.
734
- `refresh_required: true` means the write committed but advisory readback failed:
735
- read that thread by ID; do not replay the write automatically.
736
-
737
- ### Upload path safety
738
-
739
- For `share`, `append`, and `update`, use a regular file or directory (`append`
740
- requires one nonempty UTF-8 file). Relative selections stay in physical cwd and
741
- reject linked components. Absolute selections trust parent directories but reject
742
- a linked selection or included descendant. Never normalize `..`: every such
743
- component is rejected; pass a direct absolute path. Copy linked content into the
744
- selection or pass the target by absolute path. Hidden names, `__MACOSX`, excluded
745
- dependency/metadata directories, and ignored OS filenames are skipped before
746
- inspection. Other entries use `lstat`; cloud placeholders work with stable file
747
- identities. Content is verified before authentication or project lookup, and auth
748
- retries reuse it. `validation_failed` includes `details.path` and `details.reason`:
749
- `parent_traversal`, `link`, `outside_cwd`, `not_found`, `changed`,
750
- `unsupported_guarantee`, or `invalid_type`. Follow the specific hint; retry for
751
- `changed` or `upload_read_failed` (filesystem errno in `details.errno`). POSIX uses
752
- available `O_NOFOLLOW`; Windows uses the same handle identity checks and rejects
753
- links reported by `lstat`. Neither detects every transient swap-and-restore or
754
- same-identity, same-size in-place edit. See the CLI README for the full guarantee.
755
-
756
- ## Local write recovery
757
-
758
- Download accepts only unique artifact IDs matching `^[a-z0-9]{10}$`, including
759
- IDs from list pages and the previous index.
760
- Artifact IDs with surrounding whitespace are rejected, not trimmed, including
761
- single-download targets. Remove the whitespace before retrying. URLs use normal
762
- URL-to-ID resolution. Output parents may be links; their resolved directory identities are rechecked.
763
- Linked output roots, indexes, and listed artifact trees are refused even with `--force`. Preflight checks every listed
764
- artifact tree, including unchanged versions, and the index; unrelated content is
765
- not walked. Network failures and invalid manifest paths, bodies, or identities are recorded per artifact;
766
- every boundary violation stops further publication, including the final index.
767
- Successful replacements retain originals and previous indexes in `data.backup_paths`
768
- and report them in human output. Inspect those paths before manual cleanup.
769
- Failed recovery also names retained paths in the error. Cleanup removes only
770
- CLI-created temporary entries, never containers holding originals. Staging and
771
- backups live in one private directory inside the output root for project
772
- downloads, or in its parent for single downloads. Project index temporary files
773
- use that same private directory so publication stays on the output filesystem.
774
- Identity checks detect observed swaps;
775
- Node path-based operations do not provide atomic confinement against arbitrary
776
- concurrent changes.
777
-
778
- Config-mode `init` preserves unknown keys and refuses links at `.artifactshare`
779
- or `config.local.json`. Git worktrees/submodules save config normally but warn
780
- instead of following `.git` files, links, or redirect metadata. Only a real
781
- repository `.git` directory with regular or absent `info/exclude` is updated.
782
- Follow `git_exclude_warning` to add the exact exclude line manually. Onboarding
783
- without config arguments still installs user-scope skills.
784
-
785
- Upload aliases use the stored filename for kind, filename, and content type.
786
- Retry `changed` when an enumerated file disappears; correct `not_found` when a
787
- relative path passes through a regular file. Both `share --help` and
788
- `append --help` list `upload_read_failed` and all `validation_failed` reasons:
789
- `link`, `outside_cwd`, `parent_traversal`, `changed`, `not_found`, `invalid_type`,
790
- and `unsupported_guarantee`.
791
-
792
- ### Local preview isolation
793
-
794
- Local HTML and Markdown previews run scripts inside a frame with `sandbox="allow-scripts"`. Preview isolation cannot be disabled. `localStorage`, IndexedDB, and other same-origin features are unavailable; the review shell always shows this restriction. Reporter observations are bounded, document-scoped display data. Saving or submitting feedback requires an explicit action in the review shell.
795
-
796
- Local preview and share-dialog HTTP routes still lack per-session authentication. Loopback binding, Host checks and fixed mutation headers do not authenticate other local clients. Do not treat knowledge of the local port as an access-control boundary. Session authentication and private browser launchers are deferred; the existing ready `url` and `--no-open` behavior are unchanged.
253
+ | Task | Command |
254
+ | ------------------------ | ----------------------------------------------------------------------------------- |
255
+ | Share a file or folder | `share <path> --json` |
256
+ | Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
257
+ | Replace with same URL | `update <target> <path> --json` |
258
+ | Append to same URL | `append <target> <path> --json` |
259
+ | Read back source | `artifacts get <target> --json` |
260
+ | Download a site bundle | `download <target> --output ./out --json` |
261
+ | Download a whole project | `download --project-id <id> --output ./out --json` |
262
+ | List your artifacts | `artifacts list --json` |
263
+ | Post a comment | `comments post <target> --body '<text>' --json` |
264
+ | Read comments | `comments list <target> --json` |
265
+ | Read older replies | `comments list <target> --thread-id <id> --before <older_cursor> --limit 50 --json` |
266
+ | Change title or sharing | `edit <target> --title 'New' --json` |
267
+ | Move to a project | `edit <target> --project-id <id> --json` |
268
+ | Create a project | `projects create 'Name' --json` |
269
+ | Find an ID from a title | `resolve <value> --json` |
270
+ | Open a share URL | `open <url> --json` |
271
+ | Preview a local file | `preview <file> --json` (local, no sign-in) |
272
+ | Log out | `logout --profile <name> --json` |