@artifactshare/cli 0.13.3 → 0.14.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.14.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: 40
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.
@@ -281,15 +285,28 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare delete <artifact-id
281
285
  expiry or `--no-link-expiry` for unlimited expiry. The expiry options are
282
286
  mutually exclusive; omit both to preserve an existing link expiry.
283
287
  - 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).
288
+ If a link operation fails, use
289
+ `link_sharing_plan_required` as a legacy code (Free can use link sharing now),
290
+ `link_sharing_disabled` to ask the workspace owner or a Team admin to resume link sharing,
291
+ `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
292
+ (or use `--no-link-expiry` when the policy allows it), or
293
+ `link_publish_rate_limited` when, under the default thresholds, the service
294
+ observes 20 counted files before a publication in a Free workspace less than
295
+ 14 days old during its rolling 24-hour window. A file counts once for its
296
+ most recent change to link visibility, or for creation with link visibility.
297
+ Making an artifact private, hiding it, or
298
+ deleting it does not erase its publication history during the 24-hour window,
299
+ so those actions do not restore a slot. A concurrent publication may be
300
+ refused even if an earlier preflight saw room. Share with specific people.
301
+ `error.recovery` indicates `retry_later`; use `error.message` and
302
+ `error.hint` for when to retry, and honor the returned retry duration. Retry
303
+ the link publication later instead of retrying immediately with unchanged
304
+ input.
289
305
  - Moving a `project` visibility artifact home makes it `private`, because home
290
306
  has no project audience.
291
307
  - The older `move` command remains available for placement-only automation, but
292
308
  prefer `edit` for new flows.
309
+ - `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
310
  - `delete` permanently removes an artifact and its version history. Use only
294
311
  when the user explicitly asks.
295
312
 
@@ -508,3 +525,34 @@ this skill, and reports the next steps (sign in, then share). When you receive
508
525
  a share URL instead, start with `open <artifact-id-or-url> --json`. It ensures
509
526
  this skill is installed or updated, then reads single-file artifacts or returns
510
527
  a `download` next command for static sites and multi-file artifacts.
528
+
529
+ ### Version labels
530
+
531
+ Successful update API responses include `number`, a positive integer matching the
532
+ Viewer’s `v{number}` for the created version. CLI JSON exposes it as
533
+ `data.version.number`, with or without a label. Older server responses may omit
534
+ `number`; the CLI accepts them and omits `data.version.number`.
535
+
536
+ The optional `--label <label>` option on `artifactshare update <target> <path>`
537
+ attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
538
+ bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
539
+ space separators (Zs) are trimmed. Internal spacing and case are preserved.
540
+ The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
541
+ Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
542
+ (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
543
+ controls, and unpaired surrogates are rejected; labels are never truncated.
544
+ CLI validation happens before authentication or upload. For a value beginning
545
+ with a known flag, use `--label=--text` to pass it explicitly.
546
+
547
+ The update API accepts one optional `label` query parameter on
548
+ `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
549
+ Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
550
+ Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
551
+ `data.version.label`: the normalized, stored label or `null` when omitted.
552
+ Existing unlabeled rows are unchanged. Authorized history at
553
+ `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
554
+ `artifacts get <target> --include versions --json` preserves it. The viewer's
555
+ version menu and full history show the label as plain text.
556
+ `GET /api/shareables/:id/versions` remains a current-version lookup.
557
+ Labels are update-only: initial uploads, `share --key`, `append`, preview,
558
+ 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: 40
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,6 +63,7 @@ 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.
@@ -70,11 +72,19 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
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.
71
73
  - 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
74
  - 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
75
+ - For link errors, `link_sharing_plan_required` is a legacy code (Free can use link sharing now),
76
+ `link_sharing_disabled` means the workspace owner (or a Team admin) must resume the workspace
75
77
  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.
78
+ within policy (or the workspace must allow `--no-link-expiry`);
79
+ `link_publish_rate_limited` means that, under the default thresholds, the
80
+ service observed 20 counted files before a publication in a Free workspace
81
+ less than 14 days old during its rolling 24-hour window. A file counts once
82
+ for its most recent change to link visibility, or for creation with link
83
+ visibility while it remains link-shared. Share with specific people.
84
+ `error.recovery` indicates `retry_later`; use `error.message` and
85
+ `error.hint` for when to retry. Retry the link publication later instead of
86
+ retrying immediately with unchanged input.
87
+ - `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
88
  - Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
79
89
  - 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
90
  - Save a default project with `init --project-id <id> --json`. Preview setup with `init --dry-run --json`.
@@ -82,3 +92,34 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
82
92
  - 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
93
  - Check the current state with `whoami --json` or `doctor --json` for token storage, authentication, destination, network, upload access, and skill update status.
84
94
  - 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.
95
+
96
+ ### Version labels
97
+
98
+ Successful update API responses include `number`, a positive integer matching the
99
+ Viewer’s `v{number}` for the created version. CLI JSON exposes it as
100
+ `data.version.number`, with or without a label. Older server responses may omit
101
+ `number`; the CLI accepts them and omits `data.version.number`.
102
+
103
+ The optional `--label <label>` option on `artifactshare update <target> <path>`
104
+ attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
105
+ bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
106
+ space separators (Zs) are trimmed. Internal spacing and case are preserved.
107
+ The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
108
+ Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
109
+ (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
110
+ controls, and unpaired surrogates are rejected; labels are never truncated.
111
+ CLI validation happens before authentication or upload. For a value beginning
112
+ with a known flag, use `--label=--text` to pass it explicitly.
113
+
114
+ The update API accepts one optional `label` query parameter on
115
+ `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
116
+ Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
117
+ Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
118
+ `data.version.label`: the normalized, stored label or `null` when omitted.
119
+ Existing unlabeled rows are unchanged. Authorized history at
120
+ `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
121
+ `artifacts get <target> --include versions --json` preserves it. The viewer's
122
+ version menu and full history show the label as plain text.
123
+ `GET /api/shareables/:id/versions` remains a current-version lookup.
124
+ Labels are update-only: initial uploads, `share --key`, `append`, preview,
125
+ bridge publishing, and MCP update inputs do not accept them.