@artifactshare/cli 0.13.2 → 0.13.3

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,15 @@ For user-facing announcements, see https://artifactshare.com/updates?product=cli
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 0.13.3 - 2026-09-02
9
+
10
+ - Allow workspace members to update, rename, and move artifacts they can view,
11
+ while preserving owner-only sharing controls and private artifacts.
12
+ - Add `--expected-version <version-id>` to `update` and repeat `share --key`
13
+ operations, returning a recoverable `version_conflict` when another update
14
+ commits first.
15
+ - Include human or agent creator attribution in `versions --json` output.
16
+
8
17
  ## 0.13.2 - 2026-08-30
9
18
 
10
19
  - Define preview startup in the bundled agent skill as one owned long-lived
package/README.md CHANGED
@@ -40,6 +40,9 @@ To keep an existing share URL, update it with
40
40
  sharing again. For CI, scheduled reports, or other repeat jobs, use
41
41
  `share <path> --key <key>`: the first run creates the shared file, and later
42
42
  runs add versions to the same file.
43
+ Pass `--expected-version <version-id>` to reject an update when another version
44
+ became current first. Project-scoped agent profiles must pass it to `update`
45
+ and to repeat `share --key` updates; initial key creation does not require it.
43
46
 
44
47
  ## Authentication
45
48
 
package/dist/index.js CHANGED
@@ -156,6 +156,7 @@ const SUBCOMMANDS = {
156
156
  const UPDATE_OPTION_KEYS = /* @__PURE__ */ new Set([
157
157
  "allowPlaintextTokenStore",
158
158
  "baseUrl",
159
+ "expectedVersion",
159
160
  "help",
160
161
  "insecureLocalhost",
161
162
  "json",
@@ -382,17 +383,21 @@ function mapApiError(status, body, options = {}) {
382
383
  recovery: { kind: "change_input" }
383
384
  });
384
385
  }
385
- if (options.artifactTarget && options.operation === "append" && apiCode === "version_conflict") {
386
+ if (options.artifactTarget && [
387
+ "append",
388
+ "update",
389
+ "share"
390
+ ].includes(options.operation ?? "") && apiCode === "version_conflict") {
386
391
  const current = typeof body?.error === "object" ? body.error.details : void 0;
387
392
  const currentVersionId = isRecord$1(current) && typeof current.current_version_id === "string" ? current.current_version_id : null;
388
393
  return cliError({
389
394
  code: "version_conflict",
390
- message: apiMessage ?? "The artifact changed before append.",
395
+ message: apiMessage ?? "The artifact changed before the update.",
391
396
  why: currentVersionId ? `The current version is ${currentVersionId}.` : "Another update was committed first.",
392
- hint: "Run the same append command again to append to the latest content.",
397
+ hint: options.operation === "append" ? "Run the same append command again to append to the latest content." : "Read the current version, reapply your changes, and retry with its version id.",
393
398
  agentRecoverable: true,
394
399
  requiresHuman: false,
395
- recovery: { kind: "retry_later" },
400
+ recovery: { kind: options.operation === "append" ? "retry_later" : "change_input" },
396
401
  ...currentVersionId ? { details: { current_version_id: currentVersionId } } : {}
397
402
  });
398
403
  }
@@ -13690,6 +13695,7 @@ async function runShare(parsed, mode, isRetry = false) {
13690
13695
  if (parsed.options.noSlackNotify === true) initialForm.set("slack_notify", "false");
13691
13696
  const uploadUrl = apiUrl("/api/shareables/uploads", baseUrl);
13692
13697
  if (shareKey !== null) uploadUrl.searchParams.set("publish_key", shareKey);
13698
+ if (parsed.options.expectedVersion) uploadUrl.searchParams.set("expected_version", parsed.options.expectedVersion);
13693
13699
  const upload = await prepareUploadPayload(targetPath, fileStat, initialForm);
13694
13700
  if (upload.error) return writeFailure(command, upload.error, mode, 1);
13695
13701
  if (upload.payload.kind === "static_site") {
@@ -13703,6 +13709,10 @@ async function runShare(parsed, mode, isRetry = false) {
13703
13709
  requestInit: request.init,
13704
13710
  errorOptions: {
13705
13711
  authenticated: true,
13712
+ ...shareKey !== null ? {
13713
+ artifactTarget: true,
13714
+ operation: "share"
13715
+ } : {},
13706
13716
  baseUrl,
13707
13717
  credentialSource: credential.source,
13708
13718
  profile: credential.profile,
@@ -13808,6 +13818,7 @@ async function runUpdate(parsed, mode, isRetry = false) {
13808
13818
  if (upload.error) return writeFailure(command, upload.error, mode, 1);
13809
13819
  const updateUrl = apiUrl(`/api/shareables/${encodeURIComponent(artifactId)}/versions`, baseUrl);
13810
13820
  if (upload.payload.kind === "static_site") updateUrl.searchParams.set("artifact_kind", "static_site");
13821
+ if (parsed.options.expectedVersion) updateUrl.searchParams.set("expected_version", parsed.options.expectedVersion);
13811
13822
  const response = await cliFetch(updateUrl, {
13812
13823
  method: "POST",
13813
13824
  headers: { Authorization: `Bearer ${credential.token}` },
@@ -13819,6 +13830,7 @@ async function runUpdate(parsed, mode, isRetry = false) {
13819
13830
  if (!response.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(response.status, body, {
13820
13831
  authenticated: true,
13821
13832
  artifactTarget: true,
13833
+ operation: "update",
13822
13834
  baseUrl,
13823
13835
  credentialSource: credential.source,
13824
13836
  profile: credential.profile,
@@ -14613,6 +14625,11 @@ const shareDefinition = define({
14613
14625
  type: "string",
14614
14626
  toKebab: true,
14615
14627
  description: "Stable key for create-or-update: the first share creates the artifact, repeats add versions. Not a secret; it appears in logs and JSON"
14628
+ },
14629
+ expectedVersion: {
14630
+ type: "string",
14631
+ toKebab: true,
14632
+ description: "Require this current version when --key updates an existing artifact"
14616
14633
  }
14617
14634
  },
14618
14635
  examples: `npm exec --yes --package=@artifactshare/cli -- artifactshare share report.html --project-id <id> --json
@@ -14658,6 +14675,11 @@ const updateDefinition = define({
14658
14675
  path: {
14659
14676
  type: "positional",
14660
14677
  description: "File or directory to add as the new version"
14678
+ },
14679
+ expectedVersion: {
14680
+ type: "string",
14681
+ toKebab: true,
14682
+ description: "Only update when this is still the current version id"
14661
14683
  }
14662
14684
  },
14663
14685
  examples: `Target:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
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": {
@@ -180,6 +180,11 @@ Use `update` to add a new version to an existing artifact while keeping its URL.
180
180
  npm exec --yes --package=@artifactshare/cli -- artifactshare update <artifact-id-or-url> ./report.html --json
181
181
  ```
182
182
 
183
+ - Pass `--expected-version <version-id>` to reject an update when another
184
+ version became current first. Project-scoped agent profiles must pass it.
185
+ Repeat `share --key` updates accept the same option; initial creation does
186
+ not require it.
187
+
183
188
  - To keep an existing share URL, do not run `share --artifact-id`; use `update`.
184
189
  - Pass the same kind of input (single file vs directory) it was created with.
185
190
  - `update` does not change title, visibility, viewers, or placement. Use `edit`