@artifactshare/cli 0.18.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.18.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: 44
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.
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 44
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.