@artifactshare/cli 0.13.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.13.3",
3
+ "version": "0.15.0",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "repository": {
@@ -39,21 +39,23 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "gunshi": "^0.37.0",
43
- "undici": "^8.10.0",
44
- "zod": "4.4.3"
42
+ "gunshi": "0.37.2",
43
+ "undici": "8.10.2",
44
+ "zod": "4.6.2"
45
45
  },
46
46
  "devDependencies": {
47
+ "@artifactshare/contract": "0.1.0",
47
48
  "@artifactshare/viewer-kit": "0.0.1",
48
- "@types/node": "22.20.1",
49
- "tsdown": "0.22.14",
49
+ "@types/node": "22.20.2",
50
+ "tsdown": "0.23.0",
50
51
  "typescript": "7.0.2",
51
- "vitest": "4.1.10"
52
+ "vitest": "4.1.11"
52
53
  },
53
54
  "scripts": {
54
- "build": "node scripts/generate-preview-messages.mjs && tsdown",
55
+ "build": "pnpm --filter @artifactshare/contract build && node scripts/generate-preview-messages.mjs && tsdown",
55
56
  "test": "pnpm run build && vitest run",
56
- "typecheck": "tsc --noEmit",
57
- "generate:preview-messages": "node scripts/generate-preview-messages.mjs"
57
+ "typecheck": "pnpm --filter @artifactshare/contract build && tsc --noEmit",
58
+ "generate:preview-messages": "node scripts/generate-preview-messages.mjs",
59
+ "test:package": "node scripts/smoke-package.mjs"
58
60
  }
59
61
  }
@@ -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: 37
7
+ version: 41
8
8
  managed: true
9
9
  -->
10
10
 
@@ -134,7 +134,7 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare share ./site-dir --
134
134
  - Pass `--no-slack-notify` only when the user explicitly does not want the
135
135
  project Slack notification for this post.
136
136
  - A workspace policy may allow a finite expiry from 1 to 365 days or unlimited
137
- expiry. The initial default is 30 days and the initial maximum is 90 days.
137
+ expiry. The initial default is 30 days and the initial maximum is unlimited.
138
138
  `link_expires_at` in the result is the confirmed UTC timestamp or `null`.
139
139
  - For repeat jobs with a stable caller-owned name, use
140
140
  `share <path> --key <key> --json`: the first run creates the artifact, later
@@ -184,6 +184,10 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare update <artifact-id
184
184
  version became current first. Project-scoped agent profiles must pass it.
185
185
  Repeat `share --key` updates accept the same option; initial creation does
186
186
  not require it.
187
+ - After `login --preset agent`, updates require `--expected-version <version-id>` using `data.version.id` from the previous successful `share` or `update` output. If omitted, `expected_version_required` reports `recovery.kind: change_input`; retry with that value. `artifacts get` instead returns the current version as `data.version_id`.
188
+ - A signed-in external human whose verified email is explicitly granted on an
189
+ artifact can update it when the artifact workspace allows external posting.
190
+ Link access alone does not grant update access.
187
191
 
188
192
  - To keep an existing share URL, do not run `share --artifact-id`; use `update`.
189
193
  - Pass the same kind of input (single file vs directory) it was created with.
@@ -242,6 +246,8 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <arti
242
246
  npm exec --yes --package=@artifactshare/cli -- artifactshare comments post <artifact-id-or-url> --body '<text>' --agent 'Claude' --json
243
247
  ```
244
248
 
249
+ 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.
250
+
245
251
  - `--reply-to <thread-id>` replies to an existing thread from `comments list`.
246
252
  - `--quote <text>` anchors a new thread to the quoted text. Copy the text from
247
253
  `artifacts get` so it matches exactly. When the same text appears more than
@@ -275,21 +281,40 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare edit <artifact-id-o
275
281
  npm exec --yes --package=@artifactshare/cli -- artifactshare delete <artifact-id-or-url> --json
276
282
  ```
277
283
 
284
+ - Owners with unrestricted credentials can set `edit <target> --retain-versions N`
285
+ to keep the latest N published versions, or `--retain-versions all` to keep all
286
+ future versions. Setting or lowering retention immediately deletes older
287
+ versions; the response reports `retain_versions` and `deleted_versions`.
288
+ Deleted version links return 404, while comments and surviving version numbers
289
+ remain. Agent-preset credentials cannot change retention.
278
290
  - `edit` changes title, visibility, explicit viewers, or project placement
279
291
  without adding a new version.
280
292
  - Set `--visibility link` with `--link-expires-at <RFC3339 UTC>` for a finite
281
293
  expiry or `--no-link-expiry` for unlimited expiry. The expiry options are
282
294
  mutually exclusive; omit both to preserve an existing link expiry.
283
295
  - If `edit` changes visibility away from `link`, the link expiry is cleared.
284
- If a link operation fails, do not retry unchanged input: use
285
- `link_sharing_plan_required` to report that Plus or Team is required,
286
- `link_sharing_disabled` to ask a Team owner or admin to enable link sharing,
287
- or `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
288
- (or use `--no-link-expiry` when the policy allows it).
296
+ If a link operation fails, use
297
+ `link_sharing_plan_required` as a legacy code (Free can use link sharing now),
298
+ `link_sharing_disabled` to ask the workspace owner or a Team admin to resume link sharing,
299
+ `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
300
+ (or use `--no-link-expiry` when the policy allows it), or
301
+ `link_publish_rate_limited` when, under the default thresholds, the service
302
+ observes 20 counted files before a publication in a Free workspace less than
303
+ 14 days old during its rolling 24-hour window. A file counts once for its
304
+ most recent change to link visibility, or for creation with link visibility.
305
+ Making an artifact private, hiding it, or
306
+ deleting it does not erase its publication history during the 24-hour window,
307
+ so those actions do not restore a slot. A concurrent publication may be
308
+ refused even if an earlier preflight saw room. Share with specific people.
309
+ `error.recovery` indicates `retry_later`; use `error.message` and
310
+ `error.hint` for when to retry, and honor the returned retry duration. Retry
311
+ the link publication later instead of retrying immediately with unchanged
312
+ input.
289
313
  - Moving a `project` visibility artifact home makes it `private`, because home
290
314
  has no project audience.
291
315
  - The older `move` command remains available for placement-only automation, but
292
316
  prefer `edit` for new flows.
317
+ - `artifacts delete <artifact-id-or-url>` is an alias of `delete`; both return JSON `command: "delete"`. Keep using top-level `delete` in deletion workflows.
293
318
  - `delete` permanently removes an artifact and its version history. Use only
294
319
  when the user explicitly asks.
295
320
 
@@ -508,3 +533,34 @@ this skill, and reports the next steps (sign in, then share). When you receive
508
533
  a share URL instead, start with `open <artifact-id-or-url> --json`. It ensures
509
534
  this skill is installed or updated, then reads single-file artifacts or returns
510
535
  a `download` next command for static sites and multi-file artifacts.
536
+
537
+ ### Version labels
538
+
539
+ Successful update API responses include `number`, a positive integer matching the
540
+ Viewer’s `v{number}` for the created version. CLI JSON exposes it as
541
+ `data.version.number`, with or without a label. Older server responses may omit
542
+ `number`; the CLI accepts them and omits `data.version.number`.
543
+
544
+ The optional `--label <label>` option on `artifactshare update <target> <path>`
545
+ attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
546
+ bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
547
+ space separators (Zs) are trimmed. Internal spacing and case are preserved.
548
+ The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
549
+ Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
550
+ (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
551
+ controls, and unpaired surrogates are rejected; labels are never truncated.
552
+ CLI validation happens before authentication or upload. For a value beginning
553
+ with a known flag, use `--label=--text` to pass it explicitly.
554
+
555
+ The update API accepts one optional `label` query parameter on
556
+ `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
557
+ Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
558
+ Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
559
+ `data.version.label`: the normalized, stored label or `null` when omitted.
560
+ Existing unlabeled rows are unchanged. Authorized history at
561
+ `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
562
+ `artifacts get <target> --include versions --json` preserves it. The viewer's
563
+ version menu and full history show the label as plain text.
564
+ `GET /api/shareables/:id/versions` remains a current-version lookup.
565
+ Labels are update-only: initial uploads, `share --key`, `append`, preview,
566
+ bridge publishing, and MCP update inputs do not accept them.
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 37
7
+ version: 41
8
8
  managed: true
9
9
  -->
10
10
 
@@ -45,10 +45,11 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
45
45
  `'apps/web/app/routes/a.$id/index.tsx'` so the shell does not expand them.
46
46
 
47
47
  - Always pass `--json`; on failure read `error.code`, `error.hint`, and `error.recovery`.
48
- - Link sharing is available on Plus and Team only. Use `--visibility link` with
48
+ - Link sharing is available on every plan (Team workspaces can turn it off). Use `--visibility link` with
49
49
  exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit
50
50
  both to use the workspace default on share or preserve the current expiry on
51
- edit. Results expose `link_expires_at` as a UTC timestamp or `null`.
51
+ edit. Results expose `link_expires_at` as a UTC timestamp or `null`. The
52
+ initial default is 30 days and the initial maximum is unlimited.
52
53
  - For an attended coding agent on the user's own machine, use `login --preset agent --profile <name> --json`; add `--project <exact-name-or-id>` to confirm a fixed project or omit it to use the browser picker. In CI, issue an API token at `https://artifactshare.com/settings/tokens` and inject it with `ARTIFACTSHARE_TOKEN` or `--token`. A shared agent platform uses a workspace-managed bot credential in a trusted host outside the model sandbox; never expose it to model shell commands. Do not pass tokens to `login`.
53
54
  - To save that token as a named profile without TTY or browser login, pipe it on standard input: `printf '%s' "$TOKEN" | npm exec --yes --package=@artifactshare/cli -- artifactshare profiles import-token --profile <name> --json`. Imported API-token profiles are not renewed by the CLI. Bot tokens (`asb_` prefix) import through the same command as rotating refresh credentials; overwriting an existing profile credential needs `--force`, and a rejected bot token reports `bot_token_invalid` (recovery is an admin reissue). Add `--allow-plaintext-token-store` only on a trusted machine without a native token store. That fallback is mode `0600` on POSIX and unavailable on Windows, where saved profiles require Credential Manager.
54
55
  - Use `login --profile <name> --json` when a user is present for browser approval. The pending event on stderr includes `browser_open`. Profiles created by `login` renew expired CLI sessions automatically.
@@ -62,19 +63,30 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
62
63
  - For new projects, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`. The complete `config --help` reference covers the canonical `home_audience`, user/repository/effective scopes, and resolution. `default_artifact_visibility` is a compatibility alias; `default_project_visibility` is the advanced project-creation default. Home resolution checks repository then user settings, including the alias at each scope, then product default `workspace`. Keyless `config get --json` returns only `home_audience`; pass an explicit key for either other setting. These settings do not change update, edit, Web, or MCP defaults.
63
64
  - For repeat jobs with a stable caller-owned name, use `share <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
64
65
  - To keep an existing share URL, do not use `share --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`. `update` does not change title, visibility, viewers, or placement.
66
+ - After `login --preset agent`, updates require `--expected-version <version-id>` using `data.version.id` from the previous successful `share` or `update` output. If omitted, `expected_version_required` reports `recovery.kind: change_input`; retry with that value. `artifacts get` instead returns the current version as `data.version_id`.
65
67
  - Read back with `artifacts get <target> --json`. Pass `--include versions` or `--include comments` to fetch history or comments in one call. If truncated, call again with `--offset` set to `next_offset`.
66
68
  - In the successful JSON response, read the source from `data.content` and the current version from `data.version_id`. See `artifacts get --help` for the complete contract and continuation example.
67
69
  - Download static-site bundles with `download <target> --output ./out --json`. Pass `--force` to overwrite an existing output directory.
68
70
  - Fetch every document in a project with `download --project-id <id> --output <dir> --json`. Each artifact lands in `<dir>/<artifactId>/` and `<dir>/index.json` maps ids to titles, owners, and statuses. The listing includes other members' artifacts you can view; `spa` and `workspace_app` artifacts are skipped. Pass `--force` to replace previously downloaded artifact directories. A partial failure prints `ok: true` with the failure list on stdout and exits 1 — check both `index.json` and the exit code. Re-running against the same `<dir>` is an incremental sync: artifacts whose version is unchanged are reported as `unchanged` and not fetched again.
69
71
  - Find artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`. With `--project-id`, the list includes other members' artifacts you can view (with `owner_email`); when `has_more` is true, continue with `--cursor <next_cursor>`. Resolve titles, project names, and URLs to IDs with `resolve <value> --json`.
70
72
  - Comment with `comments post <target> --body '<text>' --json`. Reply with `--reply-to <thread-id>`. Anchor to quoted text with `--quote '<text>'`; add `--quote-before`/`--quote-after` to disambiguate. Declare the posting agent with `--agent '<name>'` (e.g. `Claude`); omit for no badge. `comments list` returns an `agent` field on agent-posted messages.
73
+ 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.
74
+
71
75
  - Edit, resolve, reopen, and delete comments with `comments edit`, `comments resolve`, `comments reopen`, and `comments delete` using IDs from `comments list`. Comment deletion cannot be undone; omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
72
76
  - Change post-share settings with `edit <target>`: `--title`, `--visibility private|workspace|link`, `--link-expires-at <RFC3339 UTC>`, `--no-link-expiry`, `--grant-email`, `--revoke-email`, `--project-id`, `--home`. The expiry options are mutually exclusive; omit both to preserve an existing link expiry. Moving a `project` visibility file home makes it `private`. `move` remains for placement-only automation; prefer `edit`.
73
- - For link errors, `link_sharing_plan_required` means Plus or Team is required,
74
- `link_sharing_disabled` means a Team owner or admin must enable the workspace
77
+ - For link errors, `link_sharing_plan_required` is a legacy code (Free can use link sharing now),
78
+ `link_sharing_disabled` means the workspace owner (or a Team admin) must resume the workspace
75
79
  setting, and `link_expiry_invalid` means the timestamp must be future and
76
- within policy (or the workspace must allow `--no-link-expiry`). Follow
77
- `error.recovery`; do not retry unchanged input.
80
+ within policy (or the workspace must allow `--no-link-expiry`);
81
+ `link_publish_rate_limited` means that, under the default thresholds, the
82
+ service observed 20 counted files before a publication in a Free workspace
83
+ less than 14 days old during its rolling 24-hour window. A file counts once
84
+ for its most recent change to link visibility, or for creation with link
85
+ visibility while it remains link-shared. Share with specific people.
86
+ `error.recovery` indicates `retry_later`; use `error.message` and
87
+ `error.hint` for when to retry. Retry the link publication later instead of
88
+ retrying immediately with unchanged input.
89
+ - `artifacts delete <artifact-id-or-url>` is an alias of `delete`; both return JSON `command: "delete"`. Keep using top-level `delete` in deletion workflows.
78
90
  - Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
79
91
  - Manage projects: `projects list --json`, `projects create <name> --json` (uses `default_project_visibility` when saved, otherwise `workspace`; pass `--visibility private` for a confidential project), `projects edit <id>` for name, description, visibility, audience (`--add-email`/`--remove-email`), and archive state (`--archive`/`--unarchive`).
80
92
  - Save a default project with `init --project-id <id> --json`. Preview setup with `init --dry-run --json`.
@@ -82,3 +94,36 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
82
94
  - Preview a local `.md` / `.html` file with `preview <file> --json` (add `--no-open` to keep the browser closed). Preview start is a long-lived service, so run the CLI invocation itself once with the environment's long-running/background process mechanism and retain that task or process as its owner; add no shell pipeline, redirection, command substitution, or wrapper that waits for process exit (tool-managed background output capture is fine). The single ready JSON line (`url` / generated `session` / `share_origin` / `reused` / sanitized `agent`) is the startup handshake: a task id or PID alone is not readiness, and `--session` is only for later `next` / `done` / `reply` / `stop`, never start. While one launch is still running without readable ready output, do not launch a second or infer a URL from listening ports; report that startup is unverified and ask the user how to proceed. A `reused: true` handshake is valid, but that invocation exits because the original process remains the server owner; do not treat the reused invocation's handle as ownership. Saving the file reloads the page. A preview started inside Codex registers the trusted thread UUID and uses `codex queue` for a fixed batch-ready notice; `queued` means accepted, while `preview next` is the first proof of processing. If it remains queued, reopen the session with `codex resume`. In Claude Code, only when background tasks are enabled (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` is neither `1` nor `true`) and Bash exposes `run_in_background`, run preview start as one Bash background task, read it through Claude Code's task-output mechanism until the ready JSON arrives, and keep a non-reused task alive; then arm `preview next --wait 3600` as a separate background task. Re-arm after `preview done`, but not after `timed_out: true`. If background waiting is disabled or rejected after start, use manual pickup. If background Bash tasks are unavailable before start, ask the user to run and keep preview open in their own terminal; that user-owned process owns the server and pickup is manual. In Cursor, keep `preview next --wait 90` in the foreground. The user annotates in the browser and submits batches. Fetch them with `preview next [--wait <sec>] [--session <id>]` — non-claiming long poll where `timed_out` / `session_ended` are normal empty results and `preview_session_not_found` means no live session, `preview_request_failed` means the session is alive and rejected the request, and `preview_session_unverified` means the recorded session went silent — retry, then stop the process before `preview stop <file> --force`. Fix the whole batch in one edit, then pipe `{"items":[{"thread","generation","outcome":"fixed|skipped","note"}]}` to `preview done --stdin` (idempotent per generation; results `accepted|stale|already_reported|unknown_thread`; `skipped` needs a note; items with `anchor.state: "orphaned"` are skipped, not re-fixed; the note becomes the thread summary). `preview reply --thread <id> --body <text>` answers without changing state; `preview stop` ends the session and keeps annotations. Never copy comment content into a provider notification; `preview next` is the source of truth. If `preview next` immediately returns the same items again, stop polling and tell the user. Nothing is uploaded unless the user shares from the page.
83
95
  - Check the current state with `whoami --json` or `doctor --json` for token storage, authentication, destination, network, upload access, and skill update status.
84
96
  - First-time setup: `npm exec --yes --package=@artifactshare/cli -- artifactshare init --json` detects Claude Code, Codex, or Cursor, installs or updates user-scope skills, and reports the next steps (sign in, then share). For Cursor project scope, run `skills install --tool cursor --scope project --json` explicitly.
97
+
98
+ ### Version labels
99
+
100
+ Successful update API responses include `number`, a positive integer matching the
101
+ Viewer’s `v{number}` for the created version. CLI JSON exposes it as
102
+ `data.version.number`, with or without a label. Older server responses may omit
103
+ `number`; the CLI accepts them and omits `data.version.number`.
104
+
105
+ The optional `--label <label>` option on `artifactshare update <target> <path>`
106
+ attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
107
+ bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
108
+ space separators (Zs) are trimmed. Internal spacing and case are preserved.
109
+ The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
110
+ Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
111
+ (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
112
+ controls, and unpaired surrogates are rejected; labels are never truncated.
113
+ CLI validation happens before authentication or upload. For a value beginning
114
+ with a known flag, use `--label=--text` to pass it explicitly.
115
+
116
+ The update API accepts one optional `label` query parameter on
117
+ `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
118
+ Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
119
+ Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
120
+ `data.version.label`: the normalized, stored label or `null` when omitted.
121
+ Existing unlabeled rows are unchanged. Authorized history at
122
+ `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
123
+ `artifacts get <target> --include versions --json` preserves it. The viewer's
124
+ version menu and full history show the label as plain text.
125
+ `GET /api/shareables/:id/versions` remains a current-version lookup.
126
+ Labels are update-only: initial uploads, `share --key`, `append`, preview,
127
+ bridge publishing, and MCP update inputs do not accept them.
128
+
129
+ Owners with unrestricted credentials can use `edit <target> --retain-versions N` to keep the latest N versions, or `--retain-versions all` to clear the limit. Setting or lowering retention prunes older published versions immediately; the response includes `retain_versions` and `deleted_versions`. Comments and surviving version numbers remain. Agent-preset credentials cannot change retention.