@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/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ For user-facing announcements, see https://artifactshare.com/updates?product=cli
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.15.0 - 2026-10-08
9
+
10
+ - Add owner-only `edit --retain-versions N` (or `all`) to prune old versions, release storage, and preserve version numbers.
11
+
12
+ - Preserve local-preview highlights and anchor updates after back/forward restoration.
13
+
14
+ - Internal: harden shared preview-reporter generation guards and preserve text verification when page code replaces array methods.
15
+
16
+ - Internal: build the preview reporter from typed modules and test the shared anchor engine directly, preserving annotation and handshake behavior.
17
+
18
+ - Preserve legacy preview annotations, including long quotes and trimmed context, and skip malformed saved records individually with a warning.
19
+ - Resolve quoted comments in the viewer using exact context; expose optional `anchor.position_state` (`attached`, `needs-check`, `unchecked`) while retaining `anchor.state`. Local preview uses the same selectors and paints highlights without changing document text nodes.
20
+
21
+ ## 0.14.0 - 2026-09-30
22
+
23
+ - Include the Viewer version number in update JSON at `data.version.number`, with or without a label; retain compatibility with older servers.
24
+
25
+ - Return the normalized, stored label in update success JSON at `data.version.label`, or `null` when omitted.
26
+
27
+ - Add optional `update --label` notes to version history, with shared Unicode validation and API support.
28
+
29
+ - Return recoverable `expected_version_required` for agent updates missing
30
+ `--expected-version`, and document using the previous successful share or update
31
+ output’s `data.version.id` in CLI help, guides, and bundled instructions.
32
+
33
+ - Accept `artifacts delete` as an alias of `delete`, with the same options and output.
34
+
8
35
  ## 0.13.3 - 2026-09-02
9
36
 
10
37
  - Allow workspace members to update, rename, and move artifacts they can view,
package/README.md CHANGED
@@ -43,6 +43,10 @@ runs add versions to the same file.
43
43
  Pass `--expected-version <version-id>` to reject an update when another version
44
44
  became current first. Project-scoped agent profiles must pass it to `update`
45
45
  and to repeat `share --key` updates; initial key creation does not require it.
46
+ 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`.
47
+ A signed-in external human whose verified email is explicitly granted on an
48
+ artifact can also update it when the artifact workspace allows external
49
+ posting. Link access alone does not grant update access.
46
50
 
47
51
  ## Authentication
48
52
 
@@ -65,10 +69,11 @@ project's Slack channel must be reauthorized.
65
69
  | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
70
  | `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
67
71
  | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
68
- | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
72
+ | `update <target> <path>` | Add a new version to an existing file (ID or share URL); optional `--label` adds a version note |
69
73
  | `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 |
70
74
  | `edit <target>` | Change title, sharing, link expiry, explicit viewers, or project placement |
71
75
  | `delete <target>` | Permanently delete a file you shared |
76
+ | `artifacts delete <target>` | Alias of delete; permanently delete a file you shared |
72
77
  | `resolve <value>` | Find files by URL, ID, title, or project name |
73
78
  | `artifacts get <target>` | Read a file's content and metadata back |
74
79
  | `download <target>` | Save a file or a whole static site locally |
@@ -86,7 +91,9 @@ project's Slack channel must be reauthorized.
86
91
 
87
92
  Public command paths covered by this reference:
88
93
 
89
- `append`, `artifacts`, `artifacts get`, `artifacts list`, `changelog`, `comments`, `comments delete`, `comments edit`, `comments list`, `comments post`, `comments reopen`, `comments resolve`, `config`, `config get`, `config set`, `config unset`, `delete`, `doctor`, `download`, `edit`, `init`, `login`, `logout`, `move`, `open`, `preview`, `preview done`, `preview next`, `preview reply`, `preview start`, `preview stop`, `profiles`, `profiles delete`, `profiles import-token`, `profiles list`, `profiles use`, `projects`, `projects create`, `projects edit`, `projects list`, `resolve`, `share`, `skills`, `skills ensure`, `skills install`, `skills list`, `skills remove`, `skills update`, `update`, `whoami`.
94
+ `append`, `artifacts`, `artifacts delete`, `artifacts get`, `artifacts list`, `changelog`, `comments`, `comments delete`, `comments edit`, `comments list`, `comments post`, `comments reopen`, `comments resolve`, `config`, `config get`, `config set`, `config unset`, `delete`, `doctor`, `download`, `edit`, `init`, `login`, `logout`, `move`, `open`, `preview`, `preview done`, `preview next`, `preview reply`, `preview start`, `preview stop`, `profiles`, `profiles delete`, `profiles import-token`, `profiles list`, `profiles use`, `projects`, `projects create`, `projects edit`, `projects list`, `resolve`, `share`, `skills`, `skills ensure`, `skills install`, `skills list`, `skills remove`, `skills update`, `update`, `whoami`.
95
+
96
+ `artifacts delete <artifact-id-or-url>` is an alias of top-level `delete`, with the same options and output. Both paths use JSON `command: "delete"` and schema version `2`.
90
97
 
91
98
  Saved credentials use macOS Keychain, Linux Secret Service, or Windows
92
99
  Credential Manager. If no native store is available, the explicit
@@ -172,7 +179,9 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare config get home_aud
172
179
 
173
180
  Use `--scope repository` only for a policy agreed by all repository participants, and pass `--visibility private|workspace|link` for a one-time home override. For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit both to use the workspace default. For project creation, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`. Pass `--no-slack-notify` to suppress the project Slack notification for one post.
174
181
 
175
- Link sharing is available on Plus and Team. 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 90 days. Share and edit results include the confirmed `link_expires_at` UTC timestamp or `null`. If a link command fails, use `link_sharing_plan_required` to explain the plan limit, `link_sharing_disabled` to ask 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. Follow `error.recovery` instead of retrying unchanged input.
182
+ 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`.
183
+
184
+ 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.
176
185
 
177
186
  For the complete settings reference, `home_audience` is the canonical home key. `default_artifact_visibility` remains a compatibility alias, and `default_project_visibility` is the advanced default for `projects create`. User and repository settings are resolved with repository taking precedence, followed by user and product default `workspace`; home also checks the compatibility alias at each scope. Use `config get home_audience --scope effective --json` to confirm the resolved audience. Keyless `config get --json` returns only `home_audience`; pass an explicit key to read either other setting. These settings only affect new home posts and project creation; update, edit, Web, and MCP defaults are unchanged.
178
187
 
@@ -215,3 +224,40 @@ Quote paths and free-form text before passing them through a shell. Artifact Sha
215
224
  ## License
216
225
 
217
226
  The npm package through version 0.9.0 is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). From version 0.10.0 onward, `@artifactshare/cli` is covered by the [source-available license](LICENSE). Version 0.10.0 was intentionally not published; version 0.10.1 is the first npm release under the new license.
227
+
228
+ ### Version labels
229
+
230
+ Successful update API responses include `number`, a positive integer matching the
231
+ Viewer’s `v{number}` for the created version. CLI JSON exposes it as
232
+ `data.version.number`, with or without a label. Older server responses may omit
233
+ `number`; the CLI accepts them and omits `data.version.number`.
234
+
235
+ The optional `--label <label>` option on `artifactshare update <target> <path>`
236
+ attaches an immutable note to the new version of an HTML file, Markdown file, or static-site
237
+ bundle. Labels are normalized to Unicode NFC, then leading and trailing Unicode
238
+ space separators (Zs) are trimmed. Internal spacing and case are preserved.
239
+ The result must contain 1–80 Unicode code points (not bytes or UTF-16 units).
240
+ Letters, marks, numbers, punctuation, symbols, space separators, and U+200D
241
+ (joined emoji) are allowed. Empty values, tabs, newlines, controls, bidi formatting
242
+ controls, and unpaired surrogates are rejected; labels are never truncated.
243
+ CLI validation happens before authentication or upload. For a value beginning
244
+ with a known flag, use `--label=--text` to pass it explicitly.
245
+
246
+ The update API accepts one optional `label` query parameter on
247
+ `POST /api/shareables/:id/versions`, including `artifact_kind=static_site` uploads.
248
+ Invalid or repeated labels return HTTP 400 `validation-failed` before upload work.
249
+ Omission stores NULL and never inherits a prior label. Successful update API responses include `label`, and CLI JSON includes
250
+ `data.version.label`: the normalized, stored label or `null` when omitted.
251
+ Existing unlabeled rows are unchanged. Authorized history at
252
+ `GET /api/cli/artifacts/:id?include=versions` includes `label` only when present;
253
+ `artifacts get <target> --include versions --json` preserves it. The viewer's
254
+ version menu and full history show the label as plain text.
255
+ `GET /api/shareables/:id/versions` remains a current-version lookup.
256
+ Labels are update-only: initial uploads, `share --key`, `append`, preview,
257
+ bridge publishing, and MCP update inputs do not accept them.
258
+
259
+ ### Quoted comment positions
260
+
261
+ 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.
262
+
263
+ Older comments may have lost spaces at the edges of their saved context. The viewer tries those boundary spaces only and attaches only at one unique position. It cannot reconstruct missing separators inside old context (for example, `ab` saved across list items now measured as `a b`); those comments need a position check.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { d as previewsDir, p as processAlive, t as CURSOR_ACP_ACK_TIMEOUT_MS } from "./cursor-notification-BBGHJ5v5.js";
2
+ import { d as previewsDir, p as processAlive, t as CURSOR_ACP_ACK_TIMEOUT_MS } from "./cursor-notification-Hz6fuACK.js";
3
3
  import { closeSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { spawn } from "node:child_process";
@@ -37,16 +37,24 @@ function isThreadMessage(value) {
37
37
  function isPreviewAnnotation(value) {
38
38
  if (typeof value !== "object" || value === null) return false;
39
39
  const record = value;
40
- return typeof record.thread === "string" && Number.isInteger(record.generation) && typeof record.status === "string" && ANNOTATION_STATUSES.has(record.status) && isPreviewAnchor(record.anchor) && typeof record.comment === "string" && Array.isArray(record.messages) && record.messages.every(isThreadMessage) && (record.batch_id === null || typeof record.batch_id === "string") && typeof record.created_at === "string" && typeof record.updated_at === "string" && (record.summary === null || typeof record.summary === "string");
40
+ return typeof record.thread === "string" && Number.isInteger(record.generation) && typeof record.status === "string" && ANNOTATION_STATUSES.has(record.status) && isPreviewAnchor(record.anchor, { stored: true }) && typeof record.comment === "string" && Array.isArray(record.messages) && record.messages.every(isThreadMessage) && (record.batch_id === null || typeof record.batch_id === "string") && typeof record.created_at === "string" && typeof record.updated_at === "string" && (record.summary === null || typeof record.summary === "string");
41
41
  }
42
- function isPreviewAnchor(value) {
42
+ function isPreviewAnchor(value, options = {}) {
43
43
  if (typeof value !== "object" || value === null) return false;
44
44
  const record = value;
45
45
  if (record.kind === "artifact") return true;
46
46
  if (record.state !== "attached" && record.state !== "orphaned") return false;
47
47
  const optionalString = (name) => record[name] === void 0 || typeof record[name] === "string";
48
48
  if (record.kind === "element") return optionalString("ownText") && optionalString("tagName") && typeof record.selector === "string" && typeof record.label === "string" && typeof record.contextText === "string";
49
- if (record.kind === "text") return typeof record.quotedText === "string" && typeof record.prefixText === "string" && typeof record.suffixText === "string" && (record.textStart === null || Number.isInteger(record.textStart)) && (record.textEnd === null || Number.isInteger(record.textEnd)) && (record.cssPath === null || typeof record.cssPath === "string");
49
+ if (record.kind === "text") {
50
+ if (record.position_state !== void 0 && ![
51
+ "attached",
52
+ "needs-check",
53
+ "unchecked"
54
+ ].includes(record.position_state)) return false;
55
+ if (record.selectorFormat !== void 0 && (record.selectorFormat !== "normalized-v1" || typeof record.textHash !== "string" || !/^[a-f0-9]{64}$/.test(record.textHash) || typeof record.ambiguousAtCreation !== "boolean" || !Number.isSafeInteger(record.textStart) || !Number.isSafeInteger(record.textEnd) || record.textStart < 0 || typeof record.quotedText !== "string" || record.textEnd - record.textStart !== record.quotedText.length)) return false;
56
+ return typeof record.quotedText === "string" && (options.stored || record.quotedText.length > 0 && record.quotedText.length <= 1e3) && typeof record.prefixText === "string" && (options.stored || record.prefixText.length <= 400) && typeof record.suffixText === "string" && (options.stored || record.suffixText.length <= 400) && (record.textStart === null || Number.isInteger(record.textStart)) && (record.textEnd === null || Number.isInteger(record.textEnd)) && (record.cssPath === null || typeof record.cssPath === "string");
57
+ }
50
58
  return false;
51
59
  }
52
60
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  //#region src/index.d.ts
2
- declare function generateCliHelp(path: string[]): Promise<string>;
3
- //#endregion
4
- export { generateCliHelp };
2
+ export declare function generateCliHelp(path: string[]): Promise<string>;
3
+ //#endregion