@artifactshare/cli 0.15.3 → 0.17.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/CHANGELOG.md CHANGED
@@ -5,6 +5,48 @@ For user-facing announcements, see https://artifactshare.com/updates?product=cli
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.17.0 - 2026-10-23
9
+
10
+ - Record invalid, duplicate or conflicting manifest file paths and malformed or mismatched project manifest identities as per-artifact failures and continue project downloads. Malformed single-download responses report service errors; failure hints name only verified, nonempty retained workspaces.
11
+
12
+ - Recheck each write operation’s recorded ancestry to detect nested directory redirects while avoiding unrelated trees.
13
+
14
+ - Check download manifest path conflicts without pairwise scans, preserve case-distinct paths on Linux, and return `output_exists` before inspecting an existing single-download tree without `--force`. New local files respect the umask; replaced init config and Git excludes preserve their permissions.
15
+
16
+ - Download validates ten-character lowercase alphanumeric artifact IDs before writes. Output parents may be links; their resolved directory identities are rechecked. Linked output roots, indexes, and listed artifact trees are rejected even with `--force`. Preflight includes unchanged artifacts but does not walk unrelated content. Ordinary network/content failures remain per-artifact; every boundary violation stops further publication. Successful replacements retain originals and previous indexes at reported recovery paths for manual cleanup. Artifact IDs with surrounding whitespace are rejected, not trimmed, including single-download targets; remove the whitespace before retrying. Share URLs use normal URL-to-ID resolution.
17
+ - Init atomically saves local defaults while preserving unknown keys. Linked config paths are refused; Git worktrees and unsafe exclude paths save config with actionable manual-exclude warnings.
18
+ - Upload aliases use the stored filename for kind and content type. Disappearing listed entries report `changed`; relative paths through files report `not_found`. Share and append help include all upload recovery reasons.
19
+
20
+ - Verify local upload boundaries for share, append, and update before authentication. Reject links and parent traversal, detect observed path replacements, and reuse verified content on authentication retries.
21
+
22
+ - Accept version-scoped execution URLs on artifactshareusercontent.com while preserving public share URLs and legacy URL-to-ID resolution. Artifact execution is isolated from app and link-viewer cookies.
23
+
24
+ - Show only authorized project destinations and enforce live placement permissions when uploads, moves, edits, and agent updates commit. Preserve existing contents and clean up uploads if destination access is revoked.
25
+
26
+ - Declare the optional `deleted_message_id` in the MCP `delete_comment` output schema to match existing deletion responses.
27
+
28
+ ## 0.16.0 - 2026-10-20
29
+
30
+ - Paginate comments with first/latest-three windows, counts, older cursors and targeted reads. Enforce 500 stored messages per thread and 20 combined create/reply admissions per user/artifact per fixed UTC minute, with structured retry guidance.
31
+
32
+ - Bound artifact live connections to eight tabs per viewer and 128 per room, coalesce presence updates, and stagger reconnect retries while preserving HTTP viewing and comments.
33
+
34
+ - Revoke API tokens and AI tool OAuth credentials when a workspace member is removed.
35
+
36
+ - Preserve every version people added when applying retention to publisher-managed artifacts; update bundled retention guidance and CLI help.
37
+
38
+ - Treat publisher versions as scheduled updates: preserve activity order and human update signals while displaying scheduled freshness on project pinned cards and marking scheduled versions in history. Remove the data freshness label from the artifact viewer.
39
+
40
+ - Extend server publisher permissions to static sites, manifest and metadata readback, retention and deletion of client-owned or owner-assigned artifacts. Add audited API-only adoption and update bundled documentation; publisher CLI workflows remain unsupported.
41
+
42
+ - Update bundled documentation for owner version settings in file history and authorized explanations for versions removed by retention. Clearing a limit does not restore deleted content.
43
+
44
+ - Preserve the server-verified publisher preset when importing a token, including when replacing an existing profile; reject malformed authority responses before saving credentials.
45
+
46
+ - Preserve publisher device credentials in saved profiles and rotation, report their client scope in doctor, and reject unsupported publisher login/resume without downgrading. The device API can approve a named publisher client to create private home files and update only its own files; its exact download endpoint returns source bytes.
47
+
48
+ - Deny unknown CLI authority kinds and persisted credential presets by default.
49
+
8
50
  ## 0.15.3 - 2026-10-10
9
51
 
10
52
  - `edit` now accepts `--visibility project`, including when moving into a project in the same request. Edits requesting project visibility at home are refused without changes and explain how to select a project.
package/README.md CHANGED
@@ -6,6 +6,8 @@ The official CLI to open, share, and update files, folders, and static sites on
6
6
 
7
7
  Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI shares a single file or a whole folder (HTML, Markdown, exported SPAs, images included), updates versions, opens shared URLs for agents, reads content and comments back, and works the same for humans, terminal agents (Claude Code, Codex, Cursor Agent), and automation.
8
8
 
9
+ 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.
10
+
9
11
  ## WebAssembly dashboards
10
12
 
11
13
  Static sites can run WebAssembly and workers, such as DuckDB-WASM loaded from jsDelivr, and folder uploads accept `.wasm` and `.parquet`; extensions such as `parquet` load from `extensions.duckdb.org`, and the bundled skill describes the setup.
@@ -71,7 +73,7 @@ project's Slack channel must be reauthorized.
71
73
 
72
74
  | Command | What it does |
73
75
  | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
74
- | `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
76
+ | `open <target>` | First command for agents opening a share or artifactshareusercontent.com execution URL; ensures skills, then reads or suggests download |
75
77
  | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
76
78
  | `update <target> <path>` | Add a new version to an existing file (ID or share URL); optional `--label` adds a version note |
77
79
  | `append <target> <path>` | Append a non-empty UTF-8 file without a separator: at Markdown source end or before `</body>` in HTML, falling back to source end |
@@ -82,7 +84,7 @@ project's Slack channel must be reauthorized.
82
84
  | `artifacts get <target>` | Read a file's content and metadata back |
83
85
  | `download <target>` | Save a file or a whole static site locally |
84
86
  | `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
85
- | `projects list / create / edit` | List, create, and edit project destinations and audience |
87
+ | `projects list / create / edit` | List eligible project destinations; create and edit projects and audience |
86
88
  | `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
87
89
  | `preview <file>` (alias of `preview start`) | Serve a local Markdown or HTML file with the product viewer look for browser annotation; local only, no sign-in, nothing uploaded |
88
90
  | `preview next` / `preview done` / `preview reply` / `preview stop` | Agent loop for a live preview: poll submitted annotation batches, report fixed/skipped outcomes from stdin, reply into a thread, and stop the session |
@@ -172,6 +174,8 @@ dialog, and local annotations are not included in what is shared.
172
174
 
173
175
  ## Where shared files are delivered
174
176
 
177
+ 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.
178
+
175
179
  Posting to a project delivers to the audience defined by that project. With no destination, `share` posts to home. Choose the home audience by purpose:
176
180
 
177
181
  ```sh
@@ -185,7 +189,7 @@ Use `--scope repository` only for a policy agreed by all repository participants
185
189
 
186
190
  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.
187
191
 
188
- Owners can run `edit <target> --retain-versions 24 --json` to keep the latest 24 published versions, or `--retain-versions all` to clear the limit. Setting or lowering the limit immediately deletes older versions and releases their storage. The response includes `retain_versions` and `deleted_versions`. Deleted version URLs return 404; comments and surviving version numbers remain. This requires unrestricted owner credentials; agent-preset credentials cannot change retention. The edit API accepts the same setting as `retain_versions` (a positive integer or `null`) at `POST /api/cli/shareables/:id/edit`.
192
+ Owners can run `edit <target> --retain-versions 24 --json` to keep the latest 24 eligible published versions, or `--retain-versions all` to clear the limit. 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 the limit immediately deletes older eligible versions and releases their storage. The response includes `retain_versions` and `deleted_versions`. Owners can also change this setting in the file history panel, with confirmation before removing existing versions. Authorized viewers opening a version removed by retention see an explanation and a latest-version link (HTTP 410); unknown version IDs still return 404 for signed-in viewers. Clearing the limit never restores deleted content. Comments and surviving version numbers remain. Unrestricted owner credentials can edit retention; publisher credentials can edit only retention on artifacts their client created or was assigned through the API. Agent credentials cannot change retention. The edit API accepts the same setting as `retain_versions` (a positive integer or `null`) at `POST /api/cli/shareables/:id/edit`.
189
193
 
190
194
  Link sharing is available on every plan; Team workspaces can turn it off. A workspace policy may allow a finite expiry from 1 to 365 days or no expiration; the initial default is 30 days and the initial maximum is no limit. Share and edit results include the confirmed `link_expires_at` UTC timestamp or `null`. If a link command fails, use `link_sharing_plan_required` as a legacy code (no plan limit applies today), `link_sharing_disabled` to ask the workspace owner or a Team owner or admin to enable the workspace setting, or `link_expiry_invalid` to correct the timestamp or choose `--no-link-expiry` when allowed. Under the default thresholds, `link_publish_rate_limited` means the service observed 20 counted files before a publication in a Free workspace less than 14 days old during its rolling 24-hour window. A file counts once for its most recent change to link visibility, or for creation with link visibility while it remains link-shared. Share with specific people. `error.recovery` indicates `retry_later`; use `error.message` and `error.hint` for when to retry. Retry the link publication later instead of retrying immediately with unchanged input.
191
195
 
@@ -295,3 +299,185 @@ physical objects once across retained versions; only sent files add bytes.
295
299
  Pruning keeps objects referenced by remaining versions. Version URLs retain
296
300
  immutable manifests. This is a REST API feature: there are no CLI `update`
297
301
  flags, MCP inputs, or bridge inputs for inheritance.
302
+
303
+ ### Publisher device credentials (API only)
304
+
305
+ 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.
306
+
307
+ The device API accepts `preset: "publisher"` with a required `device_name`.
308
+ Names are trimmed, NFC-normalized, case-sensitive, and limited to 1–100 Unicode
309
+ letters, marks, numbers, ASCII spaces, or `._-()`. The browser approver explicitly
310
+ creates a new client or continues one of their existing clients in that workspace.
311
+ Names cannot be edited on the approval screen: if a name already exists, continue
312
+ that client or request login again with a different name. Only explicit continuation
313
+ restores access to earlier files; `device_id` never selects a client.
314
+
315
+ A publisher can create private HTML, Markdown, or static-site artifacts in the
316
+ approver's home. Static sites use `POST /api/shareables/uploads?artifact_kind=static_site`.
317
+ It can manage only artifacts created by or assigned to its client, still owned by
318
+ that approver in the same workspace, including after the owner shares or moves them.
319
+ Single-file versions require `expected_version`. Static-site versions accept
320
+ `artifact_kind=static_site` with either `expected_version` for replacement or
321
+ `base_version` for changed-files uploads and repeated `delete_path` removals.
322
+ The base must be current. Version uploads preserve audience, location and retention.
323
+
324
+ 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.
325
+
326
+ The exact `GET /api/cli/artifacts/:id/download` returns raw source bytes for
327
+ single files and a JSON manifest with version id, paths and SHA-256 hashes for
328
+ static sites. Individual `download/*` requests are denied. `GET /api/cli/artifacts/:id`
329
+ includes visibility; static-site readback contains metadata only. No `include`
330
+ expansions are allowed. `DELETE /api/cli/artifacts/:id` deletes the artifact.
331
+ POST or PATCH `/api/cli/shareables/:id/edit` accepts only `retain_versions`, a
332
+ positive integer or null. Setting a limit prunes older versions immediately;
333
+ clearing it never restores deleted content. Other presets remain POST-only.
334
+
335
+ The owner can assign an existing artifact using an unrestricted credential or
336
+ browser session: `POST /api/cli/artifacts/:id/adopt` with
337
+ `{"publisher_client_id":"client1"}`. Obtain the verified client id from whoami or
338
+ doctor. Assignment replaces the previous client's access and is audited even when
339
+ repeated; historical creation attribution stays unchanged. Publisher credentials
340
+ cannot adopt. There is no adoption UI or CLI command.
341
+
342
+ Other clients' artifacts, list, resolve, comments, audience/title/expiry edits,
343
+ move, projects, append and upsert remain denied. Existing presets' download and
344
+ readback responses are unchanged. CLI publisher login/resume and publishing/download
345
+ workflows remain unsupported; use the API. Credentials retain their client across
346
+ rotation and can be revoked from Settings → CLI sessions.
347
+
348
+ ## Comment windows and posting limits
349
+
350
+ `comments list <target> --json` returns at most 50 threads, open first. Each
351
+ thread contains its current first message and latest three replies, plus
352
+ `message_count`, `reply_count` and `older_cursor`. These are partial histories.
353
+ Use `comments list <target> --thread-id <id> --before <older_cursor> --limit 50
354
+ --json` for older replies. Repeat with the returned cursor until it is null;
355
+ merge by message ID and display in `(created_at, message_id)` order. Each page
356
+ also includes the current first message. Cursors remain usable after their
357
+ boundary message is deleted. `--around-message-id <id>` selects a bounded page
358
+ containing a message; do not combine it with `--before`.
359
+
360
+ A thread holds 500 currently stored messages, including its first message.
361
+ `thread_capacity` means start a new thread. Existing excess messages are kept;
362
+ deletions can restore space. Deleting the first message promotes the next
363
+ earliest message; deleting the last removes the thread and anchor. Resolved
364
+ threads still refuse replies.
365
+
366
+ Creation and replies share 20 admissions per authenticated user and artifact
367
+ per fixed UTC minute across browser, CLI, MCP and API tokens. Adjacent minute
368
+ boundaries can admit 40 posts within a sliding 60 seconds. `rate_limited`
369
+ includes `retry_after_seconds` and UTC `retry_at`; HTTP also sends `Retry-After`.
370
+ Keep unsent content and retry after that time. Invalid requests, capacity refusals
371
+ and closed-thread refusals observed before admission consume nothing. Rate
372
+ refusals do not increment the counter; quota storage failures refuse the post.
373
+ Once admitted, commit failures and status/version/capacity races consume the admission without a
374
+ refund. Edits, deletions, resolve/reopen and anchor reports consume nothing.
375
+ Mutation readback contains only the affected thread window and changed message.
376
+ `refresh_required: true` means the write committed but advisory readback failed:
377
+ read that thread by ID; do not replay the write automatically.
378
+
379
+ ## Local upload boundaries
380
+
381
+ `share`, `append`, and `update` validate and read local content before credential
382
+ resolution or refresh, project lookup, or upload. Authentication retries reuse the
383
+ verified bytes; they do not reopen source paths. Append still accepts only a
384
+ nonempty UTF-8 file, and checks emptiness after the verified read.
385
+
386
+ Every literal `..` component is rejected, including absolute paths and Windows
387
+ separator or drive-relative forms. Pass a direct absolute path instead. Relative
388
+ paths stay within the physical current directory: each component is inspected
389
+ with `lstat`, links are rejected, and device/inode identity determines containment.
390
+ Case, Unicode normalization, trailing dot/space aliases, and a current directory
391
+ reached through an alias work when the filesystem resolves them to the same file.
392
+ Absolute paths (including Windows `C:report.html` and `D:report.html`, resolved by
393
+ the platform) trust their parents, but the selection itself must not be a link.
394
+ To select a link target, copy it into the selection or pass its absolute path.
395
+
396
+ Selected trees reject included symlinks, junctions, app execution aliases, dangling
397
+ links, and special files. Names starting with `.`, `__MACOSX`, `node_modules`,
398
+ `.git`, `.artifactshare`, `.turbo`, `.DS_Store`, `Thumbs.db`, and `desktop.ini` are
399
+ excluded before inspection. `build` and `dist` remain included. Remaining entries
400
+ are classified with `lstat`, not directory-entry link flags; cloud placeholders
401
+ serving their own content remain supported when stable identities are available.
402
+ Each included entry's physical parent must have the identity of the directory
403
+ it was reached from, catching redirects that `lstat` reports as ordinary
404
+ directories. Physical paths are resolved once per entry; repeated parent-chain
405
+ checks use `lstat` identities. This comparison uses device/inode identity, not
406
+ canonical path spelling. Absolute selections still trust their parent paths.
407
+
408
+ On POSIX, files are opened once with `O_NOFOLLOW` and `O_NONBLOCK` where available.
409
+ Nonblocking opens prevent a replacement FIFO from stalling before the handle
410
+ is checked to be a regular file. On Windows,
411
+ `lstat` link rejection and the same handle identity checks protect reads without
412
+ requiring POSIX no-follow support. Both compare handle device, inode, mode, and
413
+ size against the recorded file and recheck parent identities before/after entry
414
+ inspection, around opening, and after reading. Missing stable identities or an
415
+ available no-follow guarantee that cannot be provided fail closed. Device zero
416
+ alone is allowed. ctime and mtime are not compared: cloud hydration may change
417
+ ctime. Same-identity, same-size in-place edits are not detected. Node has no
418
+ directory-relative `openat`, so a transient swap-and-restore entirely between
419
+ checks cannot always be detected.
420
+
421
+ Boundary errors use `validation_failed`, name the offending `details.path`
422
+ (descendants are relative to the selection), and provide `details.reason`:
423
+
424
+ | Reason | Recovery |
425
+ | ----------------------- | ------------------------------------------------------------------------- |
426
+ | `parent_traversal` | Pass a direct absolute path without `..`. |
427
+ | `link` | Copy into the selection or pass the target by absolute path. |
428
+ | `outside_cwd` | Pass an absolute path. |
429
+ | `not_found` | Check the path. |
430
+ | `changed` | Retry after the selection stops changing (`retry_later`). |
431
+ | `unsupported_guarantee` | Use a filesystem providing the named stable identity/no-follow guarantee. |
432
+ | `invalid_type` | Select a regular file or directory. |
433
+
434
+ Other filesystem failures, including EACCES, EMFILE, EIO, and EPERM, use
435
+ `upload_read_failed` with `details.errno` and `retry_later`. Check availability and
436
+ permissions, then retry. Raw exceptions remain internal; errors never include
437
+ credentials or file contents. Empty included directories report
438
+ “Directory has no shareable files.”
439
+
440
+ ### Local download and init writes
441
+
442
+ Download artifact IDs must match `^[a-z0-9]{10}$`. Invalid, duplicate, or
443
+ case-colliding IDs in any list page or previous `index.json` are fatal before
444
+ writes. Single-download targets and manifest identities must agree.
445
+
446
+ Output parents may be links; their resolved directory identities are rechecked.
447
+ Linked output roots, indexes, and listed artifact trees are refused,
448
+ even with `--force`. Recorded directory identities are checked again before
449
+ writes and cleanup. Project preflight inspects every listed artifact tree,
450
+ including unchanged versions, and `index.json`; unrelated content is not walked.
451
+ Network failures and invalid manifest paths, bodies, or identities are recorded per artifact. Every boundary
452
+ violation stops further publication, including later artifacts and the final index.
453
+ Artifact IDs with surrounding whitespace are rejected, not trimmed, including
454
+ single-download targets. Remove the whitespace before retrying. Share URLs use
455
+ the usual URL-to-ID resolution; list and index IDs are never normalized.
456
+
457
+ Replacements do not merge stale files. Staging and backups share one private
458
+ directory inside the output root for project downloads, or in its parent for
459
+ single downloads. This keeps project publication on the output filesystem.
460
+ Displaced originals and previous indexes
461
+ remain there after success and are reported in `data.backup_paths` and human
462
+ output. Inspect those paths before manual cleanup. Failed recovery also names
463
+ retained paths in the error. Cleanup removes only CLI-created temporary entries
464
+ and never removes a container holding originals. Files use exclusive creation
465
+ and indexes use temporary-file publication.
466
+ Manifest path conflict checks fold case on macOS and Windows; Linux keeps
467
+ case-distinct names. New downloaded files, config files, and Git excludes use
468
+ the default file mode masked by the umask. Replaced config and exclude files
469
+ preserve their existing permission bits.
470
+ Identity checks detect observed swaps at operation checkpoints; Node path-based
471
+ operations cannot guarantee atomic confinement against arbitrary concurrent changes.
472
+
473
+ `init --profile` / `init --project-id` preserve unknown local config keys and
474
+ refuse linked or changed `.artifactshare` / `config.local.json` paths. Only a
475
+ real repository `.git` directory without redirect metadata or linked `info` /
476
+ `exclude` is eligible for an exclude update. Worktrees and submodules still save
477
+ config and return `git_exclude_warning` with the path and exact line to add
478
+ manually. Running `init` without config arguments still installs user-scope skills.
479
+
480
+ Upload aliases use the stored filename for artifact kind, multipart name, and
481
+ content type. An enumerated entry disappearing is `changed` (retry); a relative
482
+ path through a regular file is `not_found` (correct the path). `share --help`
483
+ and `append --help` list all upload boundary reasons and fixes.