@artifactshare/cli 0.22.0 → 0.24.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.
@@ -1,4 +1,4 @@
1
- import { d as previewsDir, p as processAlive, t as CURSOR_ACP_ACK_TIMEOUT_MS } from "./cursor-notification-Hz6fuACK.js";
1
+ import { f as previewsDir, m as processAlive, t as CURSOR_ACP_ACK_TIMEOUT_MS } from "./cursor-notification-BIq-4zCX.js";
2
2
  import { closeSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { spawn } from "node:child_process";
@@ -6,7 +6,7 @@ import { join, resolve } from "node:path";
6
6
  import { createHash, randomBytes } from "node:crypto";
7
7
  import { createServer } from "node:http";
8
8
  import { createInterface } from "node:readline";
9
- //#region src/preview/cursor-permission.ts
9
+ // src/preview/cursor-permission.ts
10
10
  const MAX_PERMISSION_DISPLAY_LENGTH = 12e3;
11
11
  function formatCursorPermissionRequest(toolCall) {
12
12
  let serialized;
@@ -28,8 +28,7 @@ function formatCursorPermissionRequest(toolCall) {
28
28
  if (sanitized.length <= MAX_PERMISSION_DISPLAY_LENGTH) return sanitized;
29
29
  return `${sanitized.slice(0, MAX_PERMISSION_DISPLAY_LENGTH)}\n… (truncated)`;
30
30
  }
31
- //#endregion
32
- //#region src/cursor-acp.ts
31
+ // src/cursor-acp.ts
33
32
  async function runCursorAcp() {
34
33
  const input = process.argv[2];
35
34
  if (!input || input === "--help" || input === "-h") {
@@ -410,5 +409,4 @@ async function runCursorAcp() {
410
409
  releaseWorkspaceLock();
411
410
  process.exitCode = interrupted ? 130 : fatalAgentFailure ? 1 : previewExit.code ?? 1;
412
411
  }
413
- //#endregion
414
412
  export { runCursorAcp };
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as checkRuntime } from "./runtime-CgvHR_2f.js";
3
- //#region src/cursor-acp-entry.ts
4
- if (checkRuntime(process.argv.slice(2))) await (await import("./cursor-acp-C19O-3Za.js")).runCursorAcp();
5
- //#endregion
2
+ import { t as checkRuntime } from "./runtime-D944T46q.js";
3
+ // src/cursor-acp-entry.ts
4
+ if (checkRuntime(process.argv.slice(2))) await (await import("./cursor-acp-DJ-rkyY3.js")).runCursorAcp();
6
5
  export {};
@@ -2,7 +2,17 @@ import { chmodSync, closeSync, mkdirSync, openSync, readFileSync, realpathSync,
2
2
  import { homedir } from "node:os";
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
- //#region src/preview/contract.ts
5
+ function isPreviewRewrite(value) {
6
+ if (typeof value !== "object" || value === null) return false;
7
+ const record = value;
8
+ return Object.keys(record).length === 2 && typeof record.original === "string" && typeof record.proposed === "string" && record.original.length > 0 && record.original.length <= 16e3 && record.proposed.length <= 16e3 && record.proposed !== record.original;
9
+ }
10
+ /** The anchored text a rewrite replaces, or null when the anchor has none. */
11
+ function rewritableText(anchor) {
12
+ if (anchor.kind === "text") return anchor.quotedText || null;
13
+ if (anchor.kind === "element") return anchor.ownText || null;
14
+ return null;
15
+ }
6
16
  /** Custom header required on every mutating request. Its presence forces a
7
17
  * CORS preflight from any cross-origin caller, and the server sends no CORS
8
18
  * headers, so cross-origin writes fail in the browser. */
@@ -37,6 +47,7 @@ function isThreadMessage(value) {
37
47
  function isPreviewAnnotation(value) {
38
48
  if (typeof value !== "object" || value === null) return false;
39
49
  const record = value;
50
+ if (record.rewrite !== void 0 && !isPreviewRewrite(record.rewrite)) return false;
40
51
  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
52
  }
42
53
  function isPreviewAnchor(value, options = {}) {
@@ -44,8 +55,9 @@ function isPreviewAnchor(value, options = {}) {
44
55
  const record = value;
45
56
  if (record.kind === "artifact") return true;
46
57
  if (record.state !== "attached" && record.state !== "orphaned") return false;
58
+ if (record.screen !== void 0 && (typeof record.screen !== "string" || record.screen.length === 0 || record.screen.length > 1e3)) return false;
47
59
  const optionalString = (name) => record[name] === void 0 || typeof record[name] === "string";
48
- if (record.kind === "element") return optionalString("ownText") && optionalString("tagName") && typeof record.selector === "string" && typeof record.label === "string" && typeof record.contextText === "string";
60
+ if (record.kind === "element") return (Object.hasOwn(record, "ownTextHash") || Object.hasOwn(record, "ownTextExcerpt") ? !Object.hasOwn(record, "ownText") && typeof record.ownTextHash === "string" && /^[a-f0-9]{64}$/.test(record.ownTextHash) && typeof record.ownTextExcerpt === "string" && record.ownTextExcerpt.length <= 16e3 : optionalString("ownText")) && optionalString("tagName") && typeof record.selector === "string" && typeof record.label === "string" && typeof record.contextText === "string";
49
61
  if (record.kind === "text") {
50
62
  if (record.position_state !== void 0 && ![
51
63
  "attached",
@@ -57,8 +69,7 @@ function isPreviewAnchor(value, options = {}) {
57
69
  }
58
70
  return false;
59
71
  }
60
- //#endregion
61
- //#region src/preview/notification.ts
72
+ // src/preview/notification.ts
62
73
  const FAILURE_CODES = /* @__PURE__ */ new Set([
63
74
  "target_unavailable",
64
75
  "rejected",
@@ -204,8 +215,7 @@ function createPreviewNotificationCoordinator(options) {
204
215
  }
205
216
  };
206
217
  }
207
- //#endregion
208
- //#region src/preview/session.ts
218
+ // src/preview/session.ts
209
219
  function previewsDir(env = process.env) {
210
220
  const override = env.ARTIFACTSHARE_CONFIG_HOME;
211
221
  const base = override !== void 0 && override !== "" ? override : join(homedir(), ".artifactshare");
@@ -240,6 +250,11 @@ function annotationsFilePath(sessionId, env = process.env) {
240
250
  if (!isSessionId(sessionId)) throw new Error("invalid preview session id");
241
251
  return join(previewsDir(env), `annotations-${sessionId}.json`);
242
252
  }
253
+ /** Per-session review history: one JSON file per submitted batch. */
254
+ function historyDirPath(sessionId, env = process.env) {
255
+ if (!isSessionId(sessionId)) throw new Error("invalid preview session id");
256
+ return join(previewsDir(env), `history-${sessionId}`);
257
+ }
243
258
  function previewRealpath(input) {
244
259
  try {
245
260
  return {
@@ -421,8 +436,7 @@ function releaseStaleClaim(sessionId, env = process.env) {
421
436
  rmSync(lockPath, { force: true });
422
437
  return true;
423
438
  }
424
- //#endregion
425
- //#region src/preview/cursor-notification.ts
439
+ // src/preview/cursor-notification.ts
426
440
  const PREVIEW_SESSION_PATTERN = /^[0-9a-f]{16}$/;
427
441
  const BATCH_ID_PATTERN = /^[a-z0-9_-]{1,128}$/i;
428
442
  const TOKEN_PATTERN = /^[0-9a-f]{64}$/;
@@ -524,5 +538,4 @@ function createCursorAcpAdapter(encoded, fetchImpl = globalThis.fetch) {
524
538
  }
525
539
  };
526
540
  }
527
- //#endregion
528
- export { defaultPreviewNotificationRegistration as C, isPreviewAnchor as D, PREVIEW_SESSION_ENDPOINT as E, isPreviewAnnotation as O, createPreviewNotificationCoordinator as S, PREVIEW_MUTATION_HEADER as T, resolveLiveSession as _, annotationsFilePath as a, updateSessionNotificationRegistration as b, isSessionId as c, previewsDir as d, probeSession as f, removeSessionFile as g, releaseStaleClaim as h, cursorNotificationRegistration as i, isPreviewDoneItemInput as k, previewIdentityPath as l, readSessionFile as m, CURSOR_ACP_NOTIFICATION_TIMEOUT_MS as n, claimSessionStart as o, processAlive as p, createCursorAcpAdapter as r, isConnectionRefused as s, CURSOR_ACP_ACK_TIMEOUT_MS as t, previewRealpath as u, sessionIdForPath as v, samePreviewNotificationRegistration as w, writeSessionFile as x, tokenFingerprint as y };
541
+ export { isPreviewDoneItemInput as A, createPreviewNotificationCoordinator as C, PREVIEW_SESSION_ENDPOINT as D, PREVIEW_MUTATION_HEADER as E, rewritableText as M, isPreviewAnchor as O, writeSessionFile as S, samePreviewNotificationRegistration as T, removeSessionFile as _, annotationsFilePath as a, tokenFingerprint as b, isConnectionRefused as c, previewRealpath as d, previewsDir as f, releaseStaleClaim as g, readSessionFile as h, cursorNotificationRegistration as i, isPreviewRewrite as j, isPreviewAnnotation as k, isSessionId as l, processAlive as m, CURSOR_ACP_NOTIFICATION_TIMEOUT_MS as n, claimSessionStart as o, probeSession as p, createCursorAcpAdapter as r, historyDirPath as s, CURSOR_ACP_ACK_TIMEOUT_MS as t, previewIdentityPath as u, resolveLiveSession as v, defaultPreviewNotificationRegistration as w, updateSessionNotificationRegistration as x, sessionIdForPath as y };
package/dist/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- //#region src/index.d.ts
2
- export declare function generateCliHelp(path: string[]): Promise<string>;
3
- //#endregion
1
+ export declare function generateCliHelp(path: string[]): Promise<string>;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { t as checkRuntime } from "./runtime-CgvHR_2f.js";
2
+ import { t as checkRuntime } from "./runtime-D944T46q.js";
3
3
  import { realpathSync } from "node:fs";
4
4
  import { pathToFileURL } from "node:url";
5
- //#region src/index.ts
5
+ // src/index.ts
6
6
  async function generateCliHelp(path) {
7
7
  return (await import("./cli.js")).generateCliHelp(path);
8
8
  }
@@ -14,5 +14,4 @@ if (process.argv[1]) try {
14
14
  isDirectExecution = import.meta.url === pathToFileURL(process.argv[1]).href;
15
15
  }
16
16
  if (isDirectExecution && checkRuntime(cliArgv)) await (await import("./cli.js")).runCli(cliArgv);
17
- //#endregion
18
17
  export { generateCliHelp };
@@ -1,4 +1,4 @@
1
- //#region src/runtime.ts
1
+ // src/runtime.ts
2
2
  const MINIMUM_NODE_VERSION = "22.19.0";
3
3
  function isSupportedNode(version) {
4
4
  const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
@@ -33,5 +33,4 @@ function checkRuntime(argv, version = process.versions.node) {
33
33
  process.exitCode = 1;
34
34
  return false;
35
35
  }
36
- //#endregion
37
36
  export { checkRuntime as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.22.0",
4
- "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
3
+ "version": "0.24.0",
4
+ "description": "Upload and share HTML, Markdown, PDF, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,6 +15,7 @@
15
15
  "upload",
16
16
  "share",
17
17
  "static-site",
18
+ "pdf",
18
19
  "automation",
19
20
  "ai-agents"
20
21
  ],
@@ -39,17 +40,17 @@
39
40
  "access": "public"
40
41
  },
41
42
  "dependencies": {
42
- "gunshi": "0.37.2",
43
- "undici": "8.10.2",
44
- "zod": "4.6.2"
43
+ "gunshi": "0.37.3",
44
+ "undici": "8.12.4",
45
+ "zod": "4.6.7"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@artifactshare/contract": "0.1.0",
48
49
  "@artifactshare/viewer-kit": "0.0.1",
49
- "@types/node": "22.20.2",
50
- "tsdown": "0.23.0",
50
+ "@types/node": "22.20.5",
51
+ "tsdown": "0.23.7",
51
52
  "typescript": "7.0.2",
52
- "vitest": "4.1.12"
53
+ "vitest": "5.1.0"
53
54
  },
54
55
  "scripts": {
55
56
  "build": "pnpm --filter @artifactshare/contract build && node scripts/generate-preview-messages.mjs && tsdown",
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  name: artifactshare
3
- description: Share, publish, upload, host, update, open, or read back existing files and Artifact Share URLs; or show a local file in the browser for review before sharing. Use when the user wants a browser link for an HTML/Markdown report, folder, static site, or generated file; wants to update the same URL; wants to look at, check, preview, or comment on a file you just generated before it is shared; says Artifact Share, artifactshare, or contextual "as"; or asks to read comments from a shared URL.
3
+ description: Share, publish, upload, host, update, open, or read back existing files and Artifact Share URLs; or show a local file in the browser for review before sharing. Use when the user wants a browser link for an HTML/Markdown report, PDF, MP4 video, folder, static site, or generated file; wants to update the same URL; wants to look at, check, preview, or comment on a file you just generated before it is shared; says Artifact Share, artifactshare, or contextual "as"; or asks to read comments from a shared URL.
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 53
7
+ version: 70
8
8
  managed: true
9
9
  -->
10
10
 
11
11
  # Artifact Share CLI
12
12
 
13
13
  Artifact Share is for the last step after a file already exists: share,
14
- publish, upload, or host HTML pages, Markdown documents, folders, and static
15
- sites; return a browser link; update the same URL; open or read back an
14
+ publish, upload, or host HTML pages, Markdown documents, PDFs, MP4 videos,
15
+ folders, and static sites; return a browser link; update the same URL; open or read back an
16
16
  Artifact Share URL; and read or post comments. The CLI is designed for agents:
17
17
  every command supports `--json` with a stable contract.
18
18
 
@@ -53,13 +53,16 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
53
53
  `ask_human`, `report_issue`. When `error.requires_human` is true, report to
54
54
  the user instead of retrying.
55
55
 
56
+ Workspace administrators can approve multiple destination projects for an ordinary bot in Settings → Bots. Keep the existing primary for old clients, and select another approved destination with `--project-id`. Existing imported credentials and sessions use the live approved set; no reimport is needed. `projects list` lists publishable approvals and `doctor` adds `approved_project_ids` and live `publishable_project_ids` while keeping `project_id` as primary. An approved default that is archived or has lost its private contributor grant reports `agent_destination_unavailable` with destination and upload readiness false; authentication remains valid. Older servers may omit the live array, in which case doctor retains approval-based diagnostics; without either array it uses the singular primary. `whoami` keeps its existing response and does not expose bot approvals. Human agent approvals remain limited to one project. For reports intended only for a private project audience, explicitly pass `--visibility project`: the destination alone does not prevent workspace-visible posts. Removing an approval revokes posting but retains project audience grants and their quota usage until an administrator removes them through project membership management.
57
+
56
58
  ## First-time setup
57
59
 
58
60
  `npm exec --yes --package=@artifactshare/cli -- artifactshare init --json` detects the agent, installs or updates
59
61
  this skill, and reports the next steps (sign in, then share). When you receive
60
62
  a share URL instead, start with `open <artifact-id-or-url> --json`. It ensures
61
63
  this skill is installed or updated, then reads single-file artifacts or returns
62
- a `download` next command for static sites and multi-file artifacts.
64
+ a `download` next command for static sites, multi-file artifacts, PDFs, and
65
+ videos.
63
66
 
64
67
  For attended setup, use `login --profile <name> --preset agent --json` and approve
65
68
  the browser request. Omit `--preset` for unrestricted personal login. Check
@@ -74,14 +77,21 @@ Use `share` for new files. Use `update` to replace an existing artifact. Use
74
77
  `append` to add a non-empty UTF-8 file exactly as-is to a single-file artifact;
75
78
  Markdown is appended at source end, while HTML is inserted before an ASCII
76
79
  case-insensitive `</body>` when present, or at source end otherwise. It adds no
77
- newline or separator and does not support sites.
80
+ newline or separator and does not support sites, PDFs, or videos.
78
81
 
79
82
  ```bash
80
83
  npm exec --yes --package=@artifactshare/cli -- artifactshare share ./report.html --json
81
84
  npm exec --yes --package=@artifactshare/cli -- artifactshare share ./site-dir --project-id <id> --json
82
85
  ```
83
86
 
84
- - `share` accepts a single `.html` / `.md` file or a static-site directory.
87
+ - `share` accepts a single `.html` / `.md` / `.pdf` / `.mp4` file or a static-site directory.
88
+ A `.pdf` (any case) must start with `%PDF-`; it is stored as the original
89
+ file, up to 25 MiB. `update` and `share --key` accept PDFs the same way.
90
+ `append`, local `preview`, and static-site folders do not accept PDFs.
91
+ A `.mp4` (any case) must have an ISO base media `ftyp` box at byte 4; it is
92
+ stored as the original video, up to 25 MiB, and plays in the viewer. Other
93
+ video formats are not accepted. `append` and local `preview` refuse MP4s;
94
+ an `.mp4` inside a static-site folder stays a site asset.
85
95
  If a successful result contains `data.warnings`, tell the user each warning
86
96
  explicitly. `slack_reauthorization_required` means project Slack
87
97
  notifications are not being delivered until the channel is reauthorized.
@@ -94,7 +104,7 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare share ./site-dir --
94
104
  Posting to a project delivers to the audience defined by that project.
95
105
  Without any destination it posts to home.
96
106
  - Choose `home_audience` by purpose: use `config set home_audience private
97
- --scope user --json` for a personal safe default in this CLI environment,
107
+ --scope user --json` for a personal safe default in this CLI environment,
98
108
  use `--scope repository` only for a policy agreed by all participants, and
99
109
  use `--visibility private|workspace|link` for one home post.
100
110
  - Inspect the home audience policy before posting with
@@ -159,7 +169,10 @@ Use `--label <label>` for an immutable version note. Read [version labels](refer
159
169
 
160
170
  ## Read back and download
161
171
 
162
- Use `artifacts get` for single-file sources. Use `download` for static sites.
172
+ Use `artifacts get` for HTML and Markdown sources. Use `download` for static
173
+ sites, PDFs and videos: a PDF or video has no text source (`artifacts get`
174
+ returns `unsupported_kind`), and `download` saves its original `.pdf` or
175
+ `.mp4` bytes.
163
176
 
164
177
  ```bash
165
178
  npm exec --yes --package=@artifactshare/cli -- artifactshare artifacts get <artifact-id-or-url> --json
@@ -222,7 +235,34 @@ Do not launch duplicates while startup is indeterminate.
222
235
  When the user submits feedback, read the whole batch with `preview next --json`,
223
236
  fix it in one editing pass, save once, and report the batch with
224
237
  `preview done --stdin --json`. Skip orphaned anchors with an explanatory note.
225
- Saving reloads the preview. Sharing happens only when the user opens its share dialog.
238
+ Saving reloads the preview after an open comment is added or cancelled. Failed
239
+ operations keep the draft available for retry; if the session ends, copy any
240
+ unconfirmed comment before closing the page, then use its restart command.
241
+ Oversized element hashes with lone-surrogate or U+FFFD candidates stay
242
+ orphaned/needs-check, including ambiguous legacy hashes; never infer a target
243
+ from their selector alone. The local Document background choice can recover
244
+ transparent HTML readability without changing authored styles, browser media
245
+ queries, or the shared viewer. Sharing happens only when the user opens its
246
+ share dialog.
247
+
248
+ ## Changing and checking visibility
249
+
250
+ `update` and `share --key` resends do not change visibility. A keyed resend
251
+ with an explicit, different `--visibility` fails with `key_visibility_mismatch`
252
+ before creating a version. The error provides an `edit` recovery command;
253
+ with an agent credential, ask a person with a human credential to run the edit.
254
+ The same value, or no flag, adds a version with the existing audience.
255
+ Home treats `project` as `private` for this comparison, just as on creation.
256
+
257
+ Change the audience intentionally, then check it:
258
+
259
+ ```sh
260
+ npm exec --yes --package=@artifactshare/cli -- artifactshare edit <id> --visibility private --json
261
+ npm exec --yes --package=@artifactshare/cli -- artifactshare artifacts get <id> --json
262
+ ```
263
+
264
+ For HTML/Markdown artifacts, `data.visibility` is the current stored audience
265
+ and `data.title` is the display title, including historical and continuation reads.
226
266
 
227
267
  ## Audience and visibility settings
228
268
 
@@ -249,29 +289,55 @@ removal and unattended token imports.
249
289
 
250
290
  Read [REST API only](references/rest-api-only.md) when working directly with
251
291
  static-site inheritance or publisher device credentials. These have no supported
252
- CLI workflows; do not invent flags for them.
292
+ CLI workflows; do not invent flags for them. Publisher version append responses
293
+ use a stable app viewer URL regardless of visibility; opening it still checks access.
253
294
 
254
295
  ## Quick reference
255
296
 
256
- | Task | Command |
257
- | ------------------------ | ----------------------------------------------------------------------------------- |
258
- | Share a file or folder | `share <path> --json` |
259
- | Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
260
- | Replace with same URL | `update <target> <path> --json` |
261
- | Append to same URL | `append <target> <path> --json` |
262
- | Read back source | `artifacts get <target> --json` |
263
- | Download a site bundle | `download <target> --output ./out --json` |
264
- | Download a whole project | `download --project-id <id> --output ./out --json` |
265
- | List your artifacts | `artifacts list --json` |
266
- | Post a comment | `comments post <target> --body '<text>' --json` |
267
- | Read comments | `comments list <target> --json` |
268
- | Read older replies | `comments list <target> --thread-id <id> --before <older_cursor> --limit 50 --json` |
269
- | Change title or sharing | `edit <target> --title 'New' --json` |
270
- | Move to a project | `edit <target> --project-id <id> --json` |
271
- | Create a project | `projects create 'Name' --json` |
272
- | Find an ID from a title | `resolve <value> --json` |
273
- | Open a share URL | `open <url> --json` |
274
- | Preview a local file | `preview <file> --json` (local, no sign-in) |
275
- | Log out | `logout --profile <name> --json` |
297
+ | Task | Command |
298
+ | -------------------------------------- | ----------------------------------------------------------------------------------- |
299
+ | Share a file or folder | `share <path> --json` |
300
+ | Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
301
+ | Replace with same URL | `update <target> <path> --json` |
302
+ | Append to same URL | `append <target> <path> --json` |
303
+ | Read back source, title and visibility | `artifacts get <target> --json` |
304
+ | Download a site bundle | `download <target> --output ./out --json` |
305
+ | Download a whole project | `download --project-id <id> --output ./out --json` |
306
+ | Inspect retained versions and bytes | `artifacts versions <target> --json` |
307
+ | List your artifacts | `artifacts list --json` |
308
+ | Post a comment | `comments post <target> --body '<text>' --json` |
309
+ | Read comments | `comments list <target> --json` |
310
+ | Read older replies | `comments list <target> --thread-id <id> --before <older_cursor> --limit 50 --json` |
311
+ | Change title or sharing | `edit <target> --title 'New' --json` |
312
+ | Move to a project | `edit <target> --project-id <id> --json` |
313
+ | Create a project | `projects create 'Name' --json` |
314
+ | Find an ID from a title | `resolve <value> --json` |
315
+ | Open a share URL | `open <url> --json` |
316
+ | Preview a local file | `preview <file> --json` (local, no sign-in) |
317
+ | List approved bot destinations | `projects list --json` |
318
+ | Log out | `logout --profile <name> --json` |
276
319
 
277
320
  For an orphaned comment, read its original source with `artifacts get <target> --version <anchor.version_id> --json` or MCP `get_artifact` `version_id`. See [comments](references/comments.md) for null anchors, removed versions and continuation. Historical ids are not the current id required for safe updates.
321
+
322
+ ## Retained versions and logical storage
323
+
324
+ Run `artifacts versions <target> --json` for HTML, Markdown, or static sites. Each entry includes `version_id`, `created_at`, `size_bytes`, and `is_current`, plus available labels and creator metadata. Pages contain up to 50 entries, newest first. While `has_more` is true, pass `next_cursor` as `--cursor`; an invalid or wrong-artifact cursor requires restarting without it. Publication or pruning between pages is not a snapshot.
325
+
326
+ For human and agent credentials, updated servers return `retain_versions` (null means unlimited), `version_count`, and `total_size_bytes` in `artifacts get`, legacy `artifacts list` rows (without search filters), and history pages. Human search rows also include these fields; restricted agent and bot search rows omit all three. Counts and byte totals cover versions the caller can list, independently of the history page or source `--version`. Static-site history and totals include only published versions with a publication timestamp for every caller, including owners. Publisher credentials do not receive `version_count` or `total_size_bytes` and cannot list artifacts or read history. Publisher-created static-site versions may have a null `creator`. Static-site bytes sum all files in each version, including inherited files. Reused files count in each version. These are logical bytes, not physical storage, billing, or proof of object cleanup. Publisher-managed histories may exceed the policy because human-created and current versions are protected. Combine list pages and compare `total_size_bytes` client-side to find the largest artifacts.
327
+
328
+ Static-site `artifacts get` now succeeds with metadata only, without `content` or `format`; `--include`, `--version`, and `--offset` remain unsupported for sites. Updated CLI get explicitly requests metadata. Released source-only clients retain unsupported-kind, so open still suggests download. Publisher credentials can read their scoped current metadata and, for sites, retain_versions, without version counts or total sizes but cannot list history or use `get --include versions`. Existing human/agent access rules apply; unreadable artifacts return `target_not_found` (API 404), with failure JSON on stderr, empty stdout, and exit 1. Shared viewers retain history access with creator email redaction. All shared flags and supported target URL forms work with `artifacts versions`.
329
+
330
+ ## Full-text search
331
+
332
+ Use `artifacts list --q <text>` (MCP: `list_artifacts` with `q`) to search body text and titles. `query` / `--query` matches titles only; combining it with full-text, owner, or period filters returns `validation_failed`. API `q: ""` browses discoverable files; the CLI requires nonblank `--q`, or omit it for owner/period browsing.
333
+
334
+ Filter by repeatable `--owner-user-ids` (MCP array `owner_user_ids`, user IDs, not email addresses), `--project-id` / `project_id`, or `--home` / empty `project_id`. Periods require `--date-field updated|viewed` (`date_field`) and either `--days 7|30|90` or ISO `--from` / `--to`. Date-only upper bounds include that UTC day; timestamp upper bounds are exclusive.
335
+
336
+ Search returns up to 50 grouped representatives per page, excerpts, `group_size` and `group_size_relation`, and `total` matching groups capped at 1000. `eq` means exact; `gte` means a lower bound. Group sizes count allowed matching documents with the same normalized title across the search, not just this page. Repeat normalized filters with `next_cursor`; restart without cursor after changing filters or credentials. Relative periods stay anchored to the first page.
337
+
338
+ Human CLI and MCP OAuth use person discovery. Restricted agents and bots search only its intersection with their readable project range; search omits their version/retention summaries. Publisher, bridge and bootstrap credentials cannot list/search. MCP OAuth does not accept bots.
339
+
340
+ Rephrase the query and search again before concluding that nothing exists.
341
+ A completed zero-result search succeeds with this `search_hint`; errors and capacity failures are not empty results. Retry with fewer or different words before concluding absence. For a query with two or more normalized terms and no matches for all terms, search automatically retries for any of the terms. No additional flag or OR syntax is needed. Results from this fallback carry the hint: "No documents matched all query terms. These results match any of the terms. Rephrase the query and search again." If search fails because search capacity was exceeded (the CLI reports `service_error` with `details.api_code` `search_capacity_exceeded`; the API answers HTTP 503), narrow the query or filters and search again; this error is not a zero-result search.
342
+
343
+ Full-text search shares 1,000 requests per authenticated actor per UTC day across all plans and clients. HTTP 429 and CLI JSON use `search_daily_limit_exceeded`; CLI `error.details.retry_at` is the exact UTC ISO reset, and `retry_after_seconds` mirrors HTTP `Retry-After`. Wait until reset before searching again. Title-only listing is unaffected.
@@ -23,6 +23,7 @@
23
23
  refresh consumes the displayed token, overwriting an existing profile credential requires
24
24
  `--force`, and a revoked or superseded bot token fails with `bot_token_invalid` (ask the
25
25
  admin to reissue).
26
+ Administrators can edit an ordinary bot’s approved destinations in Settings → Bots without reimport. `doctor` checks `approved_project_ids` when available, falling back to the singular primary from older servers. Human agent approvals remain single-project.
26
27
  Imported API-token profiles are not renewed by the CLI.
27
28
  Use `--allow-plaintext-token-store` only on a trusted machine without a native token store.
28
29
  That fallback is mode `0600` on POSIX and unavailable on Windows, where saved profiles require Credential Manager.
@@ -62,6 +62,21 @@ carry `ambiguous_at_creation` (including false), describing ambiguity at creatio
62
62
  not attachment today. Agent and legacy anchors omit that key. Older servers may
63
63
  omit all these additional fields. Artifact-level anchors are unchanged.
64
64
 
65
+ Text anchors also return `target_path`, the page the text is on. Single-file
66
+ artifacts return their entry page. On a multi-file site it is the file path
67
+ (for example `/docs/setup.html`), or for a single-page app the route path
68
+ (`/settings`) plus a hash route that starts with `#/` or `#!/`
69
+ (`/index.html#/billing`). Other fragments, such as `#intro`, are in-page anchors
70
+ and are not part of the path. Agents cannot post quoted-text comments on
71
+ multi-file sites; post whole-artifact comments there.
72
+
73
+ PDF comments that readers post from the comment panel carry the page that was
74
+ open. Their anchor keeps `kind: "artifact"` (with `quoted_text` and `state`
75
+ null) and adds `page_number`, plus `version_id` and `version_number` for the
76
+ version it was posted on. Both are null once that version is deleted, and
77
+ `version_number` is null for a version without a number. Other whole-artifact
78
+ anchors omit all three. Agents cannot post page comments.
79
+
65
80
  `comments list <target> --json` returns at most 50 threads, open first. Each
66
81
  thread contains its current first message and latest three replies, plus
67
82
  `message_count`, `reply_count` and `older_cursor`. These are partial histories.
@@ -7,7 +7,7 @@
7
7
 
8
8
  ## Audience and visibility settings
9
9
 
10
- 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.
10
+ 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. Human agents remain limited to their fixed approved project. Ordinary workspace bots may select any destination in their administrator-approved set. Both require a verified contributor/manager grant for private projects; publisher credentials cannot select projects.
11
11
 
12
12
  Posting to a project delivers to the audience defined by that project. Without
13
13
  a destination, `share` posts to home. Choose the home audience by purpose:
@@ -98,6 +98,7 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id>
98
98
  npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id> --archive --json
99
99
  ```
100
100
 
101
+ - `projects list` shows all currently publishable bot approvals, primary first. Administrators edit these in Settings → Bots; imported credentials stay valid. Explicitly use `--visibility project` for private-project reports. Removing an approval revokes posting but retains project audience grants and their quota usage.
101
102
  - `projects create` uses `default_project_visibility` when saved, otherwise
102
103
  `workspace`. Pass `--visibility private` for a confidential project.
103
104
  - `projects edit` changes name, description, visibility, audience
@@ -109,3 +110,5 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id>
109
110
  all flags.
110
111
 
111
112
  Home without an explicit or configured audience defaults to workspace when the account supports it, otherwise private. Explicit or configured workspace still fails when unavailable; sharing never automatically switches to link. Choose --visibility link deliberately. Config inspection is offline: value workspace with source product_default is an unresolved policy placeholder. Share and preview resolve it against the account. Older servers without workspace.visibility_available retain workspace and its existing rejection.
113
+
114
+ After a retention edit, check `retain_versions`, `version_count`, and `total_size_bytes` with `artifacts get <target> --json`. Null retention means unlimited. Combine `artifacts list --json` pages and compare `total_size_bytes` locally to find the largest histories. Totals cover versions the caller can list. Static-site history and totals include only published versions with a publication timestamp for every caller, including owners. Publisher credentials do not receive `version_count` or `total_size_bytes` and cannot list artifacts or read history. On managed artifacts, protected human/current versions can exceed the configured policy. See [retained versions and logical storage](../SKILL.md#retained-versions-and-logical-storage) for units, pagination, and access limits.
@@ -15,6 +15,8 @@
15
15
  elements or text selections in the browser and submits them as an explicit
16
16
  batch, and the agent fixes the file. Nothing is uploaded by previewing;
17
17
  an upload happens only if the user opens the share dialog from the page.
18
+ PDF and MP4 video files cannot be previewed; share them and open the share URL
19
+ instead.
18
20
 
19
21
  ### Start and own one preview
20
22
 
@@ -53,6 +55,12 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare preview start ./lp.
53
55
  invocation's task or process handle as the server owner.
54
56
  - Editing and saving the file reloads the page automatically; annotations
55
57
  stay anchored where possible.
58
+ - Interactive documents (slides, tabs, SPAs): in comment mode the user
59
+ Alt/Option+clicks to operate the page and plainly clicks to comment. Element
60
+ and text anchors may carry `screen`, the URL state (a `#/` or `#!/` route
61
+ hash, or a History API path) they were made on; the default screen omits
62
+ it. Plain fragments such as `#section` and non-URL state such as an open
63
+ modal are not recorded. Use `screen` to find which slide or route a comment refers to.
56
64
  - `preview next` returns every batch the user has submitted; it is
57
65
  non-claiming (calling it again returns the same open items) and with
58
66
  `--wait <sec>` it long-polls. `timed_out: true` and `session_ended: true`
@@ -69,6 +77,11 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare preview start ./lp.
69
77
  - Report outcomes with `preview done --stdin`; reply into a thread with
70
78
  `preview reply --thread <id> --body <text>` (state unchanged); end the
71
79
  session with `preview stop` (annotations stay saved on disk).
80
+ - `preview history <file>` lists earlier batches with before/after document
81
+ snapshots, and `--batch <id>` returns one batch's comments, reports and
82
+ snapshots. Use it to look up past corrections before reviewing a similar
83
+ document. It reads local files only; `fixed`/`skipped` are agent reports,
84
+ not human approval.
72
85
 
73
86
  ### Waking up when the user submits a batch
74
87
 
@@ -133,6 +146,14 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare preview next --sess
133
146
  `fixed` (you changed the file) or `skipped` (`note` explaining why is
134
147
  required). The `note` is shown to the user as the thread summary, so
135
148
  write it for them.
149
+ - An item with `rewrite: {original, proposed}` is the user's own wording:
150
+ replace `original` (the text at the anchor as displayed) with `proposed`
151
+ in the source file, keeping the surrounding markup. `comment` is their
152
+ optional reason and may be empty; an empty `proposed` means remove that
153
+ text. For an element, `original` is its displayed text with inline markup
154
+ flattened, so keep links and formatting in the source while applying the
155
+ new wording. Apply it as written rather than rephrasing it, and report
156
+ `skipped` with a note when the text cannot be found or applied.
136
157
  - An item whose `anchor.state` is `orphaned` lost its place in the document;
137
158
  do not try to re-fix it — report it as `skipped` with a note.
138
159
  - `done` is idempotent per generation: each item comes back as `accepted`,
@@ -148,6 +169,35 @@ Sharing is user-driven: the page's share button opens a separate-origin
148
169
  dialog that publishes the snapshot bytes; local annotations are never
149
170
  carried into the shared copy.
150
171
 
172
+ Element anchors keep raw `ownText` for normalized text of at most 16,000 UTF-16
173
+ code units, including empty text. Larger captures omit `ownText` and return
174
+ `ownTextHash` (the full normalized text's SHA-256, 64 lowercase hex characters)
175
+ and `ownTextExcerpt` (at most its first 16,000 code units, shortened to 15,999
176
+ when necessary to avoid splitting a valid surrogate pair). `preview next` preserves these
177
+ fields. The excerpt is reader context only and is never used for matching.
178
+ UTF-8 SHA-256 bytes stay compatible for well-formed text. Oversized hash
179
+ candidates containing a lone surrogate or U+FFFD after whitespace normalization
180
+ are ineligible for attachment, including legacy hashes from literal U+FFFD.
181
+ Their comments stay stored and visible as orphaned/needs-check; neither the
182
+ selector nor the excerpt can override that verdict. Short raw-text anchors
183
+ (including U+FFFD), unambiguous legacy anchors and selection anchors remain
184
+ supported; existing stored raw text is not migrated. Failed annotation saves retain the draft and show a retry message.
185
+ Repeated Share focuses the existing dialog: editable snapshots refresh in place,
186
+ while sign-in, uploads and completed results keep their state.
187
+
188
+ The editor keeps its text and target during resizing and failed saves. Finish or
189
+ cancel the current entry before choosing another target or loading a queued
190
+ update. A failed operation can be retried; a lost acknowledgement does not prove
191
+ that nothing was saved. If Preview ends, copy any unconfirmed comment from the
192
+ surviving page before closing it, then use the displayed restart command.
193
+ Never-saved text is not restored from disk after restarting.
194
+
195
+ For HTML with unreadable colors on a transparent canvas, the local **Document
196
+ background** control offers light (the default) and dark backgrounds. It changes
197
+ only the iframe background behind transparent content; authored backgrounds and
198
+ colors, browser theme/media detection, Markdown and the shared Web Viewer are
199
+ unchanged. It is a manual readability recovery, not automatic theme correction.
200
+
151
201
  ### Local preview isolation
152
202
 
153
203
  Local HTML and Markdown previews run scripts inside a frame with `sandbox="allow-scripts"`. Preview isolation cannot be disabled. `localStorage`, IndexedDB, and other same-origin features are unavailable; the review shell always shows this restriction. Reporter observations are bounded, document-scoped display data. Saving or submitting feedback requires an explicit action in the review shell.
@@ -32,6 +32,8 @@ flags, MCP inputs, or bridge inputs for inheritance.
32
32
 
33
33
  ### Publisher device credentials (API only)
34
34
 
35
+ Publisher version appends return a stable app /a/:id shareUrl for HTML, Markdown and static sites, independent of current visibility. Opening it uses normal viewer authorization and host routing; human update URLs retain their existing visibility behavior.
36
+
35
37
  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.
36
38
 
37
39
  The device API accepts `preset: "publisher"` with a required `device_name`.
@@ -74,3 +76,7 @@ move, projects, append and upsert remain denied. Existing presets' download and
74
76
  readback responses are unchanged. CLI publisher login/resume and publishing/download
75
77
  workflows remain unsupported; use the API. Credentials retain their client across
76
78
  rotation and can be revoked from Settings → CLI sessions.
79
+
80
+ For retained history, request `GET /api/cli/artifacts/:id/versions`. Each page returns up to 50 entries; send `next_cursor` as the `cursor` query while `has_more` is true. Entries include `version_id`, `created_at`, `size_bytes`, and `is_current`. For human and agent credentials, history, current readback, and collection rows include `retain_versions` (null means unlimited), `version_count`, and `total_size_bytes` for versions the caller can list. Static-site history and totals include only published versions with a publication timestamp for every caller, including owners. Publisher-created static-site versions may have a null `creator`. Static-site bytes include inherited files per version, not deduplicated physical storage. Protected human/current versions can make managed histories exceed the retention policy. Publisher credentials do not receive `version_count` or `total_size_bytes` and cannot list artifacts or read history.
81
+
82
+ Human and agent `GET /api/cli/artifacts/:id` requests must send `X-ArtifactShare-Static-Metadata: 1` to receive metadata-only static sites. Without it, static sites return the existing `unsupported-kind` response for source-only clients. Publisher readback keeps its existing metadata behavior. Static-site version selection, include, and offset remain unsupported.
@@ -1,9 +1,9 @@
1
1
  ## Static-site scripts and data
2
2
 
3
3
  Folder shares load external HTTPS images, stylesheets from jsDelivr, cdnjs,
4
- unpkg, and Google Fonts (`fonts.googleapis.com`), and font files from jsDelivr
5
- and Google Fonts (`fonts.gstatic.com`). Load icon/font packages from jsDelivr
6
- or bundle the font files because cdnjs and unpkg font files are blocked.
4
+ unpkg, and Google Fonts (`fonts.googleapis.com`), and font files from the same
5
+ jsDelivr, cdnjs, and unpkg CDNs and Google Fonts (`fonts.gstatic.com`), so
6
+ icon/font packages from those CDNs work as-is.
7
7
  JavaScript `eval` and `new Function` remain blocked.
8
8
 
9
9
  Folder shares support WebAssembly, same-origin worker files, and `blob:` workers.
@@ -37,3 +37,7 @@ Static-site binary assets support HTTP byte ranges. To refresh data while keepin
37
37
  the same share URL, replace the data locally and update the folder as a new
38
38
  version; each version retains its own isolated origin. Single-file HTML and
39
39
  Markdown have different script policies; these permissions apply to folder shares.
40
+
41
+ Use `artifacts versions <target> --json` (files and static sites) to inspect retained versions and labels; continue with `--cursor <next_cursor>` while `has_more`. For human and agent credentials, `artifacts get` and `artifacts list` include `retain_versions` (null: unlimited), `version_count` and `total_size_bytes` for versions the caller can list. Static-site history and totals include only published versions with a publication timestamp for every caller, including owners. Publisher-created versions may have a null `creator`. Site bytes include inherited files in each version, not deduplicated physical storage. Managed histories may exceed policy due to protected human/current versions. Publisher credentials do not receive `version_count` or `total_size_bytes` and cannot list artifacts or inspect history. Compare list totals client-side across pages.
42
+
43
+ `artifacts get <target> --json` returns current static-site metadata without `content` or `format`; `--include`, `--version` and `--offset` are unsupported for sites. Updated get opts into this response; released clients keep unsupported-kind and open download guidance. Use `download` for site files.
@@ -28,3 +28,5 @@ version menu and full history show the label as plain text.
28
28
  `GET /api/shareables/:id/versions` remains a current-version lookup.
29
29
  Labels are update-only: initial uploads, `share --key`, `append`, preview,
30
30
  bridge publishing, and MCP update inputs do not accept them.
31
+
32
+ For labels on both files and static sites, use `artifacts versions <target> --json`, or `GET /api/cli/artifacts/:id/versions`. Continue with the returned cursor to inspect more than 50 versions. Labels remain optional and creator emails remain redacted for external shared viewers. See [retained versions and logical storage](../SKILL.md#retained-versions-and-logical-storage) for summary fields and publisher history restrictions.