@artifactshare/cli 0.17.0 → 0.19.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.
@@ -0,0 +1,37 @@
1
+ //#region src/runtime.ts
2
+ const MINIMUM_NODE_VERSION = "22.19.0";
3
+ function isSupportedNode(version) {
4
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
5
+ if (!match) return false;
6
+ const [, major, minor] = match.map(Number);
7
+ return major > 22 || major === 22 && minor >= 19;
8
+ }
9
+ function checkRuntime(argv, version = process.versions.node) {
10
+ if (isSupportedNode(version)) return true;
11
+ const message = `Node.js ${MINIMUM_NODE_VERSION} or newer is required; current version is ${version}.`;
12
+ const hint = `Upgrade Node.js to ${MINIMUM_NODE_VERSION} or newer, then retry.`;
13
+ const error = {
14
+ code: "unsupported_node_version",
15
+ message,
16
+ why: "The current Node.js runtime is unsupported.",
17
+ hint,
18
+ agent_recoverable: false,
19
+ requires_human: true,
20
+ recovery: { kind: "ask_human" },
21
+ details: {
22
+ required_version: MINIMUM_NODE_VERSION,
23
+ current_version: version
24
+ }
25
+ };
26
+ const json = argv.includes("--json") || process.env.CI === "true" || !process.stdout.isTTY;
27
+ process.stderr.write(json ? `${JSON.stringify({
28
+ schema_version: 2,
29
+ ok: false,
30
+ command: "unknown",
31
+ error
32
+ }, null, 2)}\n` : `Error: ${message} ${hint}\n`);
33
+ process.exitCode = 1;
34
+ return false;
35
+ }
36
+ //#endregion
37
+ export { checkRuntime as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "repository": {
@@ -49,7 +49,7 @@
49
49
  "@types/node": "22.20.2",
50
50
  "tsdown": "0.23.0",
51
51
  "typescript": "7.0.2",
52
- "vitest": "4.1.11"
52
+ "vitest": "4.1.12"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "pnpm --filter @artifactshare/contract build && node scripts/generate-preview-messages.mjs && tsdown",
@@ -4,7 +4,7 @@ description: Share, publish, upload, host, update, open, or read back existing f
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 43
7
+ version: 45
8
8
  managed: true
9
9
  -->
10
10
 
@@ -192,6 +192,18 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare update <artifact-id
192
192
  Repeat `share --key` updates accept the same option; initial creation does
193
193
  not require it.
194
194
  - 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`.
195
+
196
+ Unknown options fail locally with `unknown_option` before authentication, requests,
197
+ or writes. Correct `details.option`; the hint suggests a nearby option when one
198
+ exists. Use the selected command’s `--help` to see accepted options.
199
+ A digits-only `--expected-version` fails with `invalid_expected_version`: pass a
200
+ version id from `data.version.id` in the previous share or update output, or
201
+ `data.version_id` from `artifacts get <target> --json` for a single-file artifact.
202
+ Both errors have `recovery.kind: change_input` and are agent-recoverable.
203
+ `unsupported_node_version` requires upgrading Node.js to 22.19.0 or newer;
204
+ it reports the current version and uses `recovery.kind: ask_human` with
205
+ `agent_recoverable: false` and `requires_human: true`.
206
+
195
207
  - A signed-in external human whose verified email is explicitly granted on an
196
208
  artifact can update it when the artifact workspace allows external posting.
197
209
  Link access alone does not grant update access.
@@ -577,6 +589,12 @@ bridge publishing, and MCP update inputs do not accept them.
577
589
 
578
590
  ## Static-site scripts and data
579
591
 
592
+ Folder shares load external HTTPS images, stylesheets from jsDelivr, cdnjs,
593
+ unpkg, and Google Fonts (`fonts.googleapis.com`), and font files from jsDelivr
594
+ and Google Fonts (`fonts.gstatic.com`). Load icon/font packages from jsDelivr
595
+ or bundle the font files because cdnjs and unpkg font files are blocked.
596
+ JavaScript `eval` and `new Function` remain blocked.
597
+
580
598
  Folder shares support WebAssembly, same-origin worker files, and `blob:` workers.
581
599
  DuckDB-WASM can load from jsDelivr: its `getJsDelivrBundles()` setup uses a blob
582
600
  worker to `importScripts()` the CDN worker and fetch its `.wasm` file. The existing
@@ -767,3 +785,9 @@ relative path passes through a regular file. Both `share --help` and
767
785
  `append --help` list `upload_read_failed` and all `validation_failed` reasons:
768
786
  `link`, `outside_cwd`, `parent_traversal`, `changed`, `not_found`, `invalid_type`,
769
787
  and `unsupported_guarantee`.
788
+
789
+ ### Local preview isolation
790
+
791
+ 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.
792
+
793
+ Local preview and share-dialog HTTP routes still lack per-session authentication. Loopback binding, Host checks and fixed mutation headers do not authenticate other local clients. Do not treat knowledge of the local port as an access-control boundary. Session authentication and private browser launchers are deferred; the existing ready `url` and `--no-open` behavior are unchanged.
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 43
7
+ version: 45
8
8
  managed: true
9
9
  -->
10
10
 
@@ -65,6 +65,17 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
65
65
  - For repeat jobs with a stable caller-owned name, use `share <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
66
66
  - To keep an existing share URL, do not use `share --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`. `update` does not change title, visibility, viewers, or placement.
67
67
  - 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`.
68
+
69
+ Unknown options fail locally with `unknown_option` before authentication, requests,
70
+ or writes. Correct `details.option`; the hint suggests a nearby option when one
71
+ exists. Use the selected command’s `--help` to see accepted options.
72
+ A digits-only `--expected-version` fails with `invalid_expected_version`: pass a
73
+ version id from `data.version.id` in the previous share or update output, or
74
+ `data.version_id` from `artifacts get <target> --json` for a single-file artifact.
75
+ Both errors have `recovery.kind: change_input` and are agent-recoverable.
76
+ `unsupported_node_version` requires upgrading Node.js to 22.19.0 or newer;
77
+ it reports the current version and uses `recovery.kind: ask_human` with
78
+ `agent_recoverable: false` and `requires_human: true`.
68
79
  - Read back with `artifacts get <target> --json`. Pass `--include versions` or `--include comments` to fetch history or comments in one call. If truncated, call again with `--offset` set to `next_offset`.
69
80
  - In the successful JSON response, read the source from `data.content` and the current version from `data.version_id`. See `artifacts get --help` for the complete contract and continuation example.
70
81
  - Download static-site bundles with `download <target> --output ./out --json`. Pass `--force` to overwrite an existing output directory.
@@ -135,6 +146,12 @@ Targets accept artifact IDs, app share URLs, per-ID `artifactshare.link` viewer
135
146
 
136
147
  ## Static-site scripts and data
137
148
 
149
+ Folder shares load external HTTPS images, stylesheets from jsDelivr, cdnjs,
150
+ unpkg, and Google Fonts (`fonts.googleapis.com`), and font files from jsDelivr
151
+ and Google Fonts (`fonts.gstatic.com`). Load icon/font packages from jsDelivr
152
+ or bundle the font files because cdnjs and unpkg font files are blocked.
153
+ JavaScript `eval` and `new Function` remain blocked.
154
+
138
155
  Folder shares support WebAssembly, same-origin worker files, and `blob:` workers.
139
156
  DuckDB-WASM can load from jsDelivr: its `getJsDelivrBundles()` setup uses a blob
140
157
  worker to `importScripts()` the CDN worker and fetch its `.wasm` file. The existing
@@ -326,3 +343,9 @@ relative path passes through a regular file. Both `share --help` and
326
343
  `append --help` list `upload_read_failed` and all `validation_failed` reasons:
327
344
  `link`, `outside_cwd`, `parent_traversal`, `changed`, `not_found`, `invalid_type`,
328
345
  and `unsupported_guarantee`.
346
+
347
+ ### Local preview isolation
348
+
349
+ 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.
350
+
351
+ Local preview and share-dialog HTTP routes still lack per-session authentication. Loopback binding, Host checks and fixed mutation headers do not authenticate other local clients. Do not treat knowledge of the local port as an access-control boundary. Session authentication and private browser launchers are deferred; the existing ready `url` and `--no-open` behavior are unchanged.