@artifactshare/cli 0.8.0 → 0.8.2

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
@@ -3,6 +3,14 @@
3
3
  All notable changes to `@artifactshare/cli` are documented here.
4
4
  For user-facing announcements, see https://artifactshare.com/updates?product=cli.
5
5
 
6
+ ## 0.8.2 - 2026-07-26
7
+
8
+ - Add `append` for appending UTF-8 content to single-file Markdown and HTML artifacts.
9
+
10
+ ## 0.8.1 - 2026-07-26
11
+
12
+ - Document the `artifacts get --json` readback contract in help, bundled skills, and MCP tool descriptions, including `content`, `version_id`, and continuation fields.
13
+
6
14
  ## 0.8.0 - 2026-07-15
7
15
 
8
16
  - Remove the `request-access` command. Sharing is open to everyone at sign-up, so there is no waitlist to join.
package/README.md CHANGED
@@ -23,7 +23,10 @@ npx --yes @artifactshare/cli projects create 'Client reports' --json
23
23
  npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
24
24
  npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
25
25
  npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility private --grant-email viewer@example.com --json
26
+ npx --yes @artifactshare/cli share ./report.html --visibility link --link-expires-at '2026-08-01T00:00:00Z' --json
27
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility link --no-link-expiry --json
26
28
  npx --yes @artifactshare/cli update <artifact-id-or-url> ./dist
29
+ npx --yes @artifactshare/cli append <artifact-id-or-url> ./new-section.md
27
30
  npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
28
31
  npx --yes @artifactshare/cli logout --profile default --json
29
32
  npx --yes @artifactshare/cli config set home_audience private --scope user --json
@@ -47,9 +50,10 @@ runs add versions to the same file.
47
50
  | Command | What it does |
48
51
  | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
52
  | `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
50
- | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
53
+ | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
51
54
  | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
52
- | `edit <target>` | Change title, sharing, explicit viewers, or project placement |
55
+ | `append <target> <path>` | Append a non-empty UTF-8 file exactly as-is to a single-file Markdown or HTML artifact |
56
+ | `edit <target>` | Change title, sharing, link expiry, explicit viewers, or project placement |
53
57
  | `delete <target>` | Permanently delete a file you shared |
54
58
  | `resolve <value>` | Find files by URL, ID, title, or project name |
55
59
  | `artifacts get <target>` | Read a file's content and metadata back |
@@ -66,7 +70,7 @@ runs add versions to the same file.
66
70
 
67
71
  Public command paths covered by this reference:
68
72
 
69
- `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`, `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`.
73
+ `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`, `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`.
70
74
 
71
75
  ## Where shared files are delivered
72
76
 
@@ -79,7 +83,9 @@ npx --yes @artifactshare/cli share ./report.html --visibility private --json
79
83
  npx --yes @artifactshare/cli config get home_audience --scope effective --json
80
84
  ```
81
85
 
82
- Use `--scope repository` only for a policy agreed by all repository participants, and pass `--visibility private|workspace` for a one-time home override. For project creation, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`.
86
+ 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`.
87
+
88
+ 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.
83
89
 
84
90
  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.
85
91
 
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ const BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
35
35
  "help",
36
36
  "home",
37
37
  "insecure-localhost",
38
+ "no-link-expiry",
38
39
  "unarchive"
39
40
  ]);
40
41
  const VALUE_FLAGS = /* @__PURE__ */ new Set([
@@ -46,6 +47,7 @@ const VALUE_FLAGS = /* @__PURE__ */ new Set([
46
47
  "grant-email",
47
48
  "include",
48
49
  "key",
50
+ "link-expires-at",
49
51
  "message-id",
50
52
  "name",
51
53
  "note",
@@ -74,6 +76,7 @@ const COMMAND_NAMES = /* @__PURE__ */ new Set([
74
76
  "share",
75
77
  "open",
76
78
  "update",
79
+ "append",
77
80
  "edit",
78
81
  "delete",
79
82
  "resolve",
@@ -142,6 +145,16 @@ function isProfileCredentialSource(source) {
142
145
  return source === "profile" || source === "local_config" || source === "project_config" || source === "global_profile";
143
146
  }
144
147
  //#endregion
148
+ //#region src/validators.ts
149
+ function isRecord(value) {
150
+ return typeof value === "object" && value !== null && !Array.isArray(value);
151
+ }
152
+ function nonEmpty(value) {
153
+ if (typeof value !== "string") return void 0;
154
+ const trimmed = value.trim();
155
+ return trimmed ? trimmed : void 0;
156
+ }
157
+ //#endregion
145
158
  //#region src/errors.ts
146
159
  const PROJECTS_LIST_COMMAND = `${CLI_INVOCATION} projects list --json`;
147
160
  function apiError(body) {
@@ -323,15 +336,32 @@ function mapApiError(status, body, options = {}) {
323
336
  requiresHuman: false,
324
337
  recovery: { kind: "retry_later" }
325
338
  });
326
- if (options.artifactTarget && apiCode === "copy-forbidden") return cliError({
327
- code: "artifact_kind_mismatch",
328
- message: apiMessage ?? "The selected artifact cannot be updated with this input.",
329
- why: "Single-file artifacts must be updated with a file, and static-site artifacts must be updated with a directory.",
330
- hint: "Retry with the same kind of input that was used to create the artifact.",
331
- agentRecoverable: true,
332
- requiresHuman: false,
333
- recovery: { kind: "change_input" }
334
- });
339
+ if (options.artifactTarget && apiCode === "copy-forbidden") {
340
+ const append = options.operation === "append";
341
+ return cliError({
342
+ code: "artifact_kind_mismatch",
343
+ message: apiMessage ?? (append ? "Append only supports single-file Markdown or HTML artifacts." : "The selected artifact cannot be updated with this input."),
344
+ why: append ? "Static sites do not have one source file to append to." : "Single-file artifacts must be updated with a file, and static-site artifacts must be updated with a directory.",
345
+ hint: append ? "Use update to replace the full source, or append to a single Markdown or HTML artifact." : "Retry with the same kind of input that was used to create the artifact.",
346
+ agentRecoverable: true,
347
+ requiresHuman: false,
348
+ recovery: { kind: "change_input" }
349
+ });
350
+ }
351
+ if (options.artifactTarget && options.operation === "append" && apiCode === "version_conflict") {
352
+ const current = typeof body?.error === "object" ? body.error.details : void 0;
353
+ const currentVersionId = isRecord(current) && typeof current.current_version_id === "string" ? current.current_version_id : null;
354
+ return cliError({
355
+ code: "version_conflict",
356
+ message: apiMessage ?? "The artifact changed before append.",
357
+ why: currentVersionId ? `The current version is ${currentVersionId}.` : "Another update was committed first.",
358
+ hint: "Run the same append command again to append to the latest content.",
359
+ agentRecoverable: true,
360
+ requiresHuman: false,
361
+ recovery: { kind: "retry_later" },
362
+ ...currentVersionId ? { details: { current_version_id: currentVersionId } } : {}
363
+ });
364
+ }
335
365
  if (apiCode === "project-limit-reached") return cliError({
336
366
  code: "project_limit_reached",
337
367
  message: apiMessage ?? "You've reached your plan's project limit. Upgrade your plan or archive existing projects.",
@@ -398,6 +428,15 @@ function mapApiError(status, body, options = {}) {
398
428
  requiresHuman: false,
399
429
  recovery: { kind: "change_input" }
400
430
  });
431
+ if (apiCode === "link-sharing-plan-required" || apiCode === "link-sharing-disabled" || apiCode === "link-expiry-invalid") return cliError({
432
+ code: apiCode.replaceAll("-", "_"),
433
+ message: apiMessage ?? "The link sharing option is invalid.",
434
+ why: apiCode === "link-sharing-plan-required" ? "Link sharing is available only on Plus and Team plans." : apiCode === "link-sharing-disabled" ? "The Team workspace has disabled link sharing." : "The requested link expiry does not match the link sharing policy.",
435
+ hint: apiCode === "link-expiry-invalid" ? "Pass a future RFC3339 UTC timestamp within the workspace maximum, or use --no-link-expiry when unlimited expiry is allowed." : "Ask a workspace owner or administrator to review the workspace plan or link sharing policy.",
436
+ agentRecoverable: apiCode === "link-expiry-invalid",
437
+ requiresHuman: apiCode !== "link-expiry-invalid",
438
+ recovery: apiCode === "link-expiry-invalid" ? { kind: "change_input" } : { kind: "ask_human" }
439
+ });
401
440
  if ((options.editSettings || options.projectTarget) && apiCode === "too-many-grants") return cliError({
402
441
  code: "too_many_grants",
403
442
  message: apiMessage ?? "Too many people are shared.",
@@ -728,6 +767,20 @@ function networkError(error) {
728
767
  recovery: { kind: "retry_later" }
729
768
  });
730
769
  }
770
+ function appendOutcomeUnknownError(artifactId, error) {
771
+ return cliError({
772
+ code: "append_outcome_unknown",
773
+ message: "The append result is unknown.",
774
+ why: error instanceof Error ? `The connection ended before confirmation: ${error.message}` : "The connection ended before Artifact Share confirmed whether the append was saved.",
775
+ hint: `Run ${CLI_INVOCATION} artifacts get ${artifactId} --json and inspect the end of content before deciding whether to retry append.`,
776
+ agentRecoverable: true,
777
+ requiresHuman: false,
778
+ recovery: {
779
+ kind: "run_command",
780
+ command: `${CLI_INVOCATION} artifacts get ${artifactId} --json`
781
+ }
782
+ });
783
+ }
731
784
  function unexpectedError(error) {
732
785
  return cliError({
733
786
  code: "unexpected_error",
@@ -795,6 +848,7 @@ function resolveArtifactId(input) {
795
848
  return null;
796
849
  }
797
850
  const TARGET_COMMAND_LABELS = {
851
+ append: "Append",
798
852
  update: "Update",
799
853
  open: "Open",
800
854
  "artifacts get": "Artifacts get",
@@ -979,16 +1033,6 @@ function normalizeArgvForGunshi(argv, commandCandidate) {
979
1033
  ] : [head, ...rest];
980
1034
  }
981
1035
  //#endregion
982
- //#region src/validators.ts
983
- function isRecord(value) {
984
- return typeof value === "object" && value !== null && !Array.isArray(value);
985
- }
986
- function nonEmpty(value) {
987
- if (typeof value !== "string") return void 0;
988
- const trimmed = value.trim();
989
- return trimmed ? trimmed : void 0;
990
- }
991
- //#endregion
992
1036
  //#region src/output.ts
993
1037
  function outputModeFromArgv(argv) {
994
1038
  return outputMode({ json: argv.includes("--json") });
@@ -1164,13 +1208,13 @@ function resolveSuccessFields(data) {
1164
1208
  }
1165
1209
  function artifactGetSuccessFields(data) {
1166
1210
  if (!isRecord(data)) return false;
1167
- return typeof data.id === "string" && typeof data.share_url === "string" && typeof data.version_id === "string" && (data.format === "html" || data.format === "markdown") && typeof data.content === "string" && typeof data.size_bytes === "number" && typeof data.truncated === "boolean" && (typeof data.next_offset === "number" || data.next_offset === null);
1211
+ return typeof data.id === "string" && typeof data.share_url === "string" && typeof data.version_id === "string" && (data.format === "html" || data.format === "markdown") && typeof data.content === "string" && typeof data.size_bytes === "number" && typeof data.truncated === "boolean" && (typeof data.next_offset === "number" || data.next_offset === null) && (data.link_expires_at === void 0 || typeof data.link_expires_at === "string" || data.link_expires_at === null);
1168
1212
  }
1169
1213
  function artifactsListSuccessFields(data) {
1170
1214
  if (!isRecord(data)) return false;
1171
1215
  return Array.isArray(data.artifacts) && data.artifacts.every((item) => {
1172
1216
  if (!isRecord(item)) return false;
1173
- return typeof item.id === "string" && typeof item.title === "string" && typeof item.share_url === "string" && typeof item.visibility === "string" && typeof item.updated_at === "string" && (typeof item.project_id === "string" || item.project_id === null);
1217
+ return typeof item.id === "string" && typeof item.title === "string" && typeof item.share_url === "string" && typeof item.visibility === "string" && (item.link_expires_at === void 0 || typeof item.link_expires_at === "string" || item.link_expires_at === null) && typeof item.updated_at === "string" && (typeof item.project_id === "string" || item.project_id === null);
1174
1218
  }) && typeof data.limit === "number" && typeof data.has_more === "boolean" && (typeof data.next_cursor === "string" || data.next_cursor === null);
1175
1219
  }
1176
1220
  function deleteSuccessFields(data) {
@@ -3931,16 +3975,24 @@ async function runEdit(parsed, mode) {
3931
3975
  function buildEditPayload(parsed) {
3932
3976
  const body = {};
3933
3977
  let hasChange = false;
3978
+ if (parsed.options.linkExpiresAt !== void 0 && parsed.options.noLinkExpiry === true) return { error: validationError("Choose only one link expiry option.", "Pass --link-expires-at <RFC3339 UTC> or --no-link-expiry, not both.") };
3934
3979
  if (parsed.options.title !== void 0) {
3935
3980
  body.title = parsed.options.title;
3936
3981
  hasChange = true;
3937
3982
  }
3938
3983
  if (parsed.options.visibility !== void 0) {
3939
3984
  const visibility = parsed.options.visibility.trim();
3940
- if (visibility !== "private" && visibility !== "workspace") return { error: validationError("--visibility must be private or workspace.", "Retry with --visibility private or --visibility workspace.") };
3985
+ if (visibility !== "private" && visibility !== "workspace" && visibility !== "link") return { error: validationError("--visibility must be private, workspace, or link.", "Retry with --visibility private, --visibility workspace, or --visibility link.") };
3941
3986
  body.visibility = visibility;
3942
3987
  hasChange = true;
3943
3988
  }
3989
+ if (parsed.options.linkExpiresAt !== void 0) {
3990
+ body.link_expires_at = parsed.options.linkExpiresAt;
3991
+ hasChange = true;
3992
+ } else if (parsed.options.noLinkExpiry === true) {
3993
+ body.link_expires_at = null;
3994
+ hasChange = true;
3995
+ }
3944
3996
  const addEmails = normalizedEmailOptions$1(parsed.options.grantEmail);
3945
3997
  if (addEmails.error) return { error: addEmails.error };
3946
3998
  if (parsed.options.grantEmail !== void 0) {
@@ -3963,7 +4015,7 @@ function buildEditPayload(parsed) {
3963
4015
  body.destination = { project_id: projectId };
3964
4016
  hasChange = true;
3965
4017
  }
3966
- if (!hasChange) return { error: validationError("At least one edit option is required.", "Pass --title, --visibility, --grant-email, --revoke-email, --project-id, or --home.") };
4018
+ if (!hasChange) return { error: validationError("At least one edit option is required.", "Pass --title, --visibility, --link-expires-at, --no-link-expiry, --grant-email, --revoke-email, --project-id, or --home.") };
3967
4019
  return { body };
3968
4020
  }
3969
4021
  function normalizedEmailOptions$1(value) {
@@ -3984,7 +4036,10 @@ function parseEditData(body) {
3984
4036
  url: typeof artifact.url === "string" ? artifact.url : null
3985
4037
  },
3986
4038
  title: body.title,
3987
- share: { visibility: share.visibility }
4039
+ share: {
4040
+ visibility: share.visibility,
4041
+ link_expires_at: typeof share.link_expires_at === "string" || share.link_expires_at === null ? share.link_expires_at : null
4042
+ }
3988
4043
  };
3989
4044
  if (destination.type === "project") {
3990
4045
  if (typeof destination.project_id !== "string") return null;
@@ -4543,6 +4598,7 @@ async function runShare(parsed, mode, isRetry = false) {
4543
4598
  const command = "share";
4544
4599
  const targetPath = parsed.positionals[0];
4545
4600
  if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to share."), mode, 1);
4601
+ if (parsed.options.linkExpiresAt !== void 0 && parsed.options.noLinkExpiry === true) return writeFailure(command, validationError("Choose only one link expiry option.", "Pass --link-expires-at <RFC3339 UTC> or --no-link-expiry, not both."), mode, 1);
4546
4602
  let shareKey = null;
4547
4603
  if ("key" in parsed.options) {
4548
4604
  shareKey = (typeof parsed.options.key === "string" ? parsed.options.key : "").trim();
@@ -4593,6 +4649,8 @@ async function runShare(parsed, mode, isRetry = false) {
4593
4649
  initialForm.set("visibility", requestedVisibility);
4594
4650
  for (const email of grantEmails) initialForm.append("grant_email", email);
4595
4651
  if (destination.containerId) initialForm.set("container_id", destination.containerId);
4652
+ if (parsed.options.linkExpiresAt !== void 0) initialForm.set("link_expires_at", parsed.options.linkExpiresAt);
4653
+ else if (parsed.options.noLinkExpiry === true) initialForm.set("link_expires_at", "null");
4596
4654
  const uploadUrl = apiUrl("/api/shareables/uploads", baseUrl);
4597
4655
  if (shareKey !== null) uploadUrl.searchParams.set("publish_key", shareKey);
4598
4656
  const upload = await prepareUploadPayload(targetPath, fileStat, initialForm);
@@ -4632,7 +4690,8 @@ async function runShare(parsed, mode, isRetry = false) {
4632
4690
  } : { type: "home" },
4633
4691
  share: {
4634
4692
  visibility: body?.visibility ?? requestedVisibility,
4635
- grant_emails: grantEmails
4693
+ grant_emails: grantEmails,
4694
+ link_expires_at: body?.link_expires_at ?? null
4636
4695
  }
4637
4696
  }, mode);
4638
4697
  }
@@ -4737,6 +4796,61 @@ async function runUpdate(parsed, mode, isRetry = false) {
4737
4796
  return writeSuccess(command, result, mode);
4738
4797
  }
4739
4798
  //#endregion
4799
+ //#region src/command-runners/append.ts
4800
+ async function runAppend(parsed, mode, isRetry = false) {
4801
+ const command = "append";
4802
+ const input = parsed.positionals[0];
4803
+ const path = parsed.positionals[1];
4804
+ if (!input) return writeFailure(command, validationError("Artifact is required.", "Pass an artifact ID or share URL."), mode, 1);
4805
+ if (!path) return writeFailure(command, validationError("Path is required.", "Pass a non-empty UTF-8 file."), mode, 1);
4806
+ const id = resolveArtifactId(input);
4807
+ if (!id) return writeFailure(command, targetResolutionError(input, "append"), mode, 1);
4808
+ const s = await stat(path).catch(() => null);
4809
+ if (!s || !s.isFile() || s.size === 0) return writeFailure(command, validationError("Path must be a non-empty file.", "Append supports one non-empty UTF-8 file for Markdown or HTML artifacts."), mode, 1);
4810
+ const bytes = await readFile(path);
4811
+ let content;
4812
+ try {
4813
+ content = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
4814
+ } catch {
4815
+ return writeFailure(command, validationError("File is not valid UTF-8.", "Use a non-empty UTF-8 file and retry."), mode, 1);
4816
+ }
4817
+ const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
4818
+ if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () => runAppend(parsed, mode, true), isRetry);
4819
+ const request = await requestConfig(parsed.options);
4820
+ if (request.error) return writeFailure(command, request.error, mode, 1);
4821
+ const response = await cliFetch(apiUrl(`/api/cli/artifacts/${encodeURIComponent(id)}/append`, baseUrlOf(parsed.options)), {
4822
+ method: "POST",
4823
+ headers: {
4824
+ Authorization: `Bearer ${credential.token}`,
4825
+ "Content-Type": "application/json"
4826
+ },
4827
+ body: JSON.stringify({ content }),
4828
+ ...request.init
4829
+ });
4830
+ if ("networkError" in response) return writeFailure(command, appendOutcomeUnknownError(id, response.networkError), mode, 1);
4831
+ const body = await readJson(response);
4832
+ if (!response.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(response.status, body, {
4833
+ authenticated: true,
4834
+ artifactTarget: true,
4835
+ operation: "append",
4836
+ baseUrl: baseUrlOf(parsed.options),
4837
+ credentialSource: credential.source,
4838
+ profile: credential.profile,
4839
+ profileCredentialKind: credential.profileCredentialKind
4840
+ }), credential, parsed.options, mode, () => runAppend(parsed, mode, true), isRetry);
4841
+ const success = {
4842
+ artifact: {
4843
+ id: body?.id ?? id,
4844
+ url: body?.shareUrl ?? `${baseUrlOf(parsed.options)}/a/${id}`,
4845
+ kind: body?.artifactKind
4846
+ },
4847
+ version: { id: body?.versionId },
4848
+ result: { appended: true }
4849
+ };
4850
+ if (!updateSuccessFields(success)) return writeFailure(command, validationError("Append succeeded but the response was incomplete.", "Retry the command."), mode, 1);
4851
+ return writeSuccess(command, success, mode);
4852
+ }
4853
+ //#endregion
4740
4854
  //#region src/command-runners/whoami.ts
4741
4855
  async function runWhoami(parsed, mode) {
4742
4856
  const command = "whoami";
@@ -4980,6 +5094,10 @@ async function updateRunner(ctx) {
4980
5094
  const parsed = parsedArgsFromContext("update", ctx);
4981
5095
  return await runWithSkillAutoUpdate(parsed, () => runUpdate(parsed, outputMode(parsed.options)));
4982
5096
  }
5097
+ async function appendRunner(ctx) {
5098
+ const parsed = parsedArgsFromContext("append", ctx);
5099
+ return await runWithSkillAutoUpdate(parsed, () => runAppend(parsed, outputMode(parsed.options)));
5100
+ }
4983
5101
  async function editRunner(ctx) {
4984
5102
  const parsed = parsedArgsFromContext("edit", ctx);
4985
5103
  return await runWithSkillAutoUpdate(parsed, () => runEdit(parsed, outputMode(parsed.options)));
@@ -5193,16 +5311,18 @@ async function main(rawArgv) {
5193
5311
  if (usage) writeText(usage);
5194
5312
  }
5195
5313
  async function runGunshi(argv) {
5314
+ const version = await loadCliVersion();
5196
5315
  return cli(argv, entryCommand, {
5197
5316
  name: "artifactshare",
5198
5317
  description: "Artifact Share CLI",
5199
- version: await loadCliVersion(),
5318
+ version,
5200
5319
  subCommands: {
5201
5320
  login: lazyCommand(loginDefinition, loginRunner),
5202
5321
  logout: lazyCommand(logoutDefinition, logoutRunner),
5203
5322
  share: lazyCommand(shareDefinition, shareRunner),
5204
5323
  open: lazyCommand(openDefinition, openRunner),
5205
5324
  update: lazyCommand(updateDefinition, updateRunner),
5325
+ append: lazyCommand(appendDefinition, appendRunner),
5206
5326
  edit: lazyCommand(editDefinition, editRunner),
5207
5327
  delete: lazyCommand(deleteDefinition, deleteRunner),
5208
5328
  resolve: lazyCommand(resolveDefinition, resolveRunner),
@@ -5363,7 +5483,17 @@ const shareDefinition = define({
5363
5483
  visibility: {
5364
5484
  type: "string",
5365
5485
  toKebab: true,
5366
- description: "private, workspace, or project (default: project for a project destination, otherwise resolved from config)"
5486
+ description: "private, workspace, project, or link (default: project for a project destination, otherwise resolved from config)"
5487
+ },
5488
+ linkExpiresAt: {
5489
+ type: "string",
5490
+ toKebab: true,
5491
+ description: "Set a finite link expiry as an RFC3339 UTC timestamp"
5492
+ },
5493
+ noLinkExpiry: {
5494
+ type: "boolean",
5495
+ toKebab: true,
5496
+ description: "Set link sharing to unlimited expiry"
5367
5497
  },
5368
5498
  grantEmail: {
5369
5499
  type: "string",
@@ -5386,7 +5516,9 @@ With no destination, share posts to home. Choose the setting by purpose:
5386
5516
  npx --yes @artifactshare/cli config set home_audience private --scope user --json
5387
5517
  Shared policy agreed by all repository participants:
5388
5518
  npx --yes @artifactshare/cli config set home_audience workspace --scope repository --json
5389
- One-time audience for a single post: pass --visibility private|workspace.
5519
+ One-time audience for a single post: pass --visibility private|workspace|link.
5520
+ Link sharing accepts --link-expires-at <RFC3339 UTC> or --no-link-expiry;
5521
+ these expiry options are mutually exclusive.
5390
5522
  Check the resolved audience before posting:
5391
5523
  npx --yes @artifactshare/cli config get home_audience --scope effective --json
5392
5524
 
@@ -5431,6 +5563,24 @@ Common failures:
5431
5563
  file_too_large Reduce file or directory size and retry
5432
5564
  validation_failed Check file type (.html / .md for single files) and directory layout`
5433
5565
  });
5566
+ const appendDefinition = define({
5567
+ name: "append",
5568
+ description: "Append a local file to an existing Markdown or HTML artifact.",
5569
+ toKebab: true,
5570
+ args: {
5571
+ ...commonArgs,
5572
+ artifactIdOrUrl: {
5573
+ type: "positional",
5574
+ toKebab: true,
5575
+ description: "Artifact ID or share URL"
5576
+ },
5577
+ path: {
5578
+ type: "positional",
5579
+ description: "Non-empty UTF-8 file to append"
5580
+ }
5581
+ },
5582
+ examples: `Append <path> to the current source of an existing artifact.\n\nStatic sites are not supported. Use update to replace the full source instead.`
5583
+ });
5434
5584
  const editDefinition = define({
5435
5585
  name: "edit",
5436
5586
  description: "Edit artifact title, sharing, or project placement.",
@@ -5450,7 +5600,17 @@ const editDefinition = define({
5450
5600
  visibility: {
5451
5601
  type: "string",
5452
5602
  toKebab: true,
5453
- description: "private or workspace"
5603
+ description: "private, workspace, or link"
5604
+ },
5605
+ linkExpiresAt: {
5606
+ type: "string",
5607
+ toKebab: true,
5608
+ description: "Set a finite link expiry as an RFC3339 UTC timestamp"
5609
+ },
5610
+ noLinkExpiry: {
5611
+ type: "boolean",
5612
+ toKebab: true,
5613
+ description: "Set link sharing to unlimited expiry"
5454
5614
  },
5455
5615
  grantEmail: {
5456
5616
  type: "string",
@@ -5480,6 +5640,8 @@ const editDefinition = define({
5480
5640
  npx --yes @artifactshare/cli edit https://artifactshare.com/a/abc123def4 --project-id prj123 --json
5481
5641
  npx --yes @artifactshare/cli edit abc123def4 --home --json
5482
5642
 
5643
+ Link sharing accepts --visibility link with either --link-expires-at <RFC3339 UTC> or --no-link-expiry. These expiry options are mutually exclusive.
5644
+
5483
5645
  Edit changes artifact settings without adding a new version. Use update to replace content.
5484
5646
  Move remains available for placement-only automation; edit is the main command for post-share settings.
5485
5647
 
@@ -5662,7 +5824,8 @@ const artifactsGetDefinition = define({
5662
5824
  npx --yes @artifactshare/cli artifacts get abc123def4 --offset 200000 --json
5663
5825
 
5664
5826
  Use resolve first when a user gives a title or project name, then pass the id here.
5665
- If truncated is true, call again with --offset set to next_offset before updating.
5827
+ Read the successful JSON from data.content (the source) and data.version_id (the current version).
5828
+ The response also includes data.truncated and data.next_offset. If data.truncated is true, call again with --offset set to data.next_offset and concatenate data.content until data.truncated is false.
5666
5829
 
5667
5830
  Common failures:
5668
5831
  auth_required Set ARTIFACTSHARE_TOKEN before artifacts get
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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
  "license": "Apache-2.0",
@@ -32,14 +32,14 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "gunshi": "^0.35.1",
36
- "undici": "^8.5.0"
35
+ "gunshi": "^0.37.0",
36
+ "undici": "^8.7.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "26.0.0",
40
- "tsdown": "^0.22.3",
39
+ "@types/node": "22.20.1",
40
+ "tsdown": "0.22.8",
41
41
  "typescript": "6.0.3",
42
- "vitest": "4.1.9"
42
+ "vitest": "4.1.10"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "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: 27
7
+ version: 30
8
8
  managed: true
9
9
  -->
10
10
 
@@ -40,21 +40,23 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
40
40
 
41
41
  ## Quick reference
42
42
 
43
- | Task | Command |
44
- | ----------------------- | ----------------------------------------------- |
45
- | Share a file or folder | `share <path> --json` |
46
- | Replace with same URL | `update <target> <path> --json` |
47
- | Read back source | `artifacts get <target> --json` |
48
- | Download a site bundle | `download <target> --output ./out --json` |
49
- | List your artifacts | `artifacts list --json` |
50
- | Post a comment | `comments post <target> --body '<text>' --json` |
51
- | Read comments | `comments list <target> --json` |
52
- | Change title or sharing | `edit <target> --title 'New' --json` |
53
- | Move to a project | `edit <target> --project-id <id> --json` |
54
- | Create a project | `projects create 'Name' --json` |
55
- | Find an ID from a title | `resolve <value> --json` |
56
- | Open a share URL | `open <url> --json` |
57
- | Log out locally | `logout --profile <name> --json` |
43
+ | Task | Command |
44
+ | ------------------------ | ------------------------------------------------------------------------- |
45
+ | Share a file or folder | `share <path> --json` |
46
+ | Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
47
+ | Replace with same URL | `update <target> <path> --json` |
48
+ | Append to same URL | `append <target> <path> --json` |
49
+ | Read back source | `artifacts get <target> --json` |
50
+ | Download a site bundle | `download <target> --output ./out --json` |
51
+ | List your artifacts | `artifacts list --json` |
52
+ | Post a comment | `comments post <target> --body '<text>' --json` |
53
+ | Read comments | `comments list <target> --json` |
54
+ | Change title or sharing | `edit <target> --title 'New' --json` |
55
+ | Move to a project | `edit <target> --project-id <id> --json` |
56
+ | Create a project | `projects create 'Name' --json` |
57
+ | Find an ID from a title | `resolve <value> --json` |
58
+ | Open a share URL | `open <url> --json` |
59
+ | Log out locally | `logout --profile <name> --json` |
58
60
 
59
61
  ## Authentication
60
62
 
@@ -78,7 +80,9 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
78
80
 
79
81
  ## Share
80
82
 
81
- Use `share` for new files. Use `update` to replace an existing artifact.
83
+ Use `share` for new files. Use `update` to replace an existing artifact. Use
84
+ `append` to add a non-empty UTF-8 file exactly as-is to a single-file Markdown
85
+ or HTML artifact; it adds no newline or separator and does not support sites.
82
86
 
83
87
  ```bash
84
88
  npx --yes @artifactshare/cli share ./report.html --json
@@ -97,12 +101,17 @@ npx --yes @artifactshare/cli share ./site-dir --project-id <id> --json
97
101
  - Choose `home_audience` by purpose: use `config set home_audience private
98
102
  --scope user --json` for a personal safe default in this CLI environment,
99
103
  use `--scope repository` only for a policy agreed by all participants, and
100
- use `--visibility private|workspace` for one home post.
104
+ use `--visibility private|workspace|link` for one home post.
101
105
  - Confirm the resolved home audience before posting with
102
106
  `config get home_audience --scope effective --json`.
103
- - Set visibility at share time with `--visibility private|workspace|project`.
107
+ - Set visibility at share time with `--visibility private|workspace|project|link`.
104
108
  This is a per-post override; `--grant-email` does not change the resolved
105
109
  default visibility.
110
+ - For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or
111
+ `--no-link-expiry`. Omit both to use the workspace default.
112
+ - A workspace policy may allow a finite expiry from 1 to 365 days or unlimited
113
+ expiry. The initial default is 30 days and the initial maximum is 90 days.
114
+ `link_expires_at` in the result is the confirmed UTC timestamp or `null`.
106
115
  - For repeat jobs with a stable caller-owned name, use
107
116
  `share <path> --key <key> --json`: the first run creates the artifact, later
108
117
  runs add versions to the same artifact.
@@ -124,7 +133,7 @@ Use the user scope for a personal safe default in this CLI environment, the
124
133
  repository scope only for a policy agreed by all participants, and
125
134
  `--visibility` for a one-time audience.
126
135
 
127
- Use `--visibility private|workspace|project` as a per-post override. For new
136
+ Use `--visibility private|workspace|project|link` as a per-post override. For new
128
137
  projects, pass `projects create --visibility private|workspace`; persistent
129
138
  project defaults are documented in `projects create --help`.
130
139
 
@@ -163,6 +172,7 @@ npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --include versio
163
172
  npx --yes @artifactshare/cli download <artifact-id-or-url> --output ./out --json
164
173
  ```
165
174
 
175
+ - In the successful JSON response, read the source from `data.content` and the current version from `data.version_id`.
166
176
  - If `artifacts get` returns `truncated: true`, call again with `--offset` set
167
177
  to `next_offset`.
168
178
  - `--include versions` and `--include comments` fetch version history or
@@ -223,6 +233,15 @@ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
223
233
 
224
234
  - `edit` changes title, visibility, explicit viewers, or project placement
225
235
  without adding a new version.
236
+ - Set `--visibility link` with `--link-expires-at <RFC3339 UTC>` for a finite
237
+ expiry or `--no-link-expiry` for unlimited expiry. The expiry options are
238
+ mutually exclusive; omit both to preserve an existing link expiry.
239
+ - If `edit` changes visibility away from `link`, the link expiry is cleared.
240
+ If a link operation fails, do not retry unchanged input: use
241
+ `link_sharing_plan_required` to report that Plus or Team is required,
242
+ `link_sharing_disabled` to ask a Team owner or admin to enable link sharing,
243
+ or `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
244
+ (or use `--no-link-expiry` when the policy allows it).
226
245
  - Moving a `project` visibility artifact home makes it `private`, because home
227
246
  has no project audience.
228
247
  - The older `move` command remains available for placement-only automation, but
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 27
7
+ version: 30
8
8
  managed: true
9
9
  -->
10
10
 
@@ -31,28 +31,41 @@ sites, and Artifact Share URLs.
31
31
  Use the CLI for local files and folders. The remote MCP tools accept HTML or
32
32
  Markdown source strings; they cannot read paths like `/Users/.../report.html`
33
33
  from the user's filesystem.
34
+ Use `append <target> <path> --json` to append a non-empty UTF-8 file exactly
35
+ as-is to a single-file Markdown or HTML artifact. It inserts no separator and
36
+ does not support static sites.
34
37
 
35
38
  Quote paths and free-form text before passing them through a shell. Paths may
36
39
  contain `$`, spaces, `*`, or `?`; use single quotes such as
37
40
  `'apps/web/app/routes/a.$id/index.tsx'` so the shell does not expand them.
38
41
 
39
42
  - Always pass `--json`; on failure read `error.code`, `error.hint`, and `error.recovery`.
43
+ - Link sharing is available on Plus and Team only. Use `--visibility link` with
44
+ exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit
45
+ both to use the workspace default on share or preserve the current expiry on
46
+ edit. Results expose `link_expires_at` as a UTC timestamp or `null`.
40
47
  - In agents, CI, or scripts, ask the user to issue an API token at `https://artifactshare.com/settings/tokens`, then run normal commands with `ARTIFACTSHARE_TOKEN` or `--token`; do not pass API tokens to `login`.
41
48
  - To save that token as a named profile without TTY or browser login, pipe it on standard input: `printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --profile <name> --json`. Imported API-token profiles are not renewed by the CLI. Add `--allow-plaintext-token-store` only on a trusted machine without a native token store.
42
49
  - Use `login --profile <name> --json` when a user is present for browser approval. The pending event on stderr includes `browser_open`. Profiles created by `login` renew expired CLI sessions automatically.
43
50
  - Remove a saved local credential with `logout --profile <name> --json`; this keeps profile metadata and does not revoke API tokens on the server.
44
51
  - Switch profiles with `profiles use <name> --json`; list with `profiles list --json`; remove a profile entry and its credential with `profiles delete <name> --json`.
45
52
  - When the user gives an Artifact Share URL, start with `open <artifact-id-or-url> --json`. It ensures this rule is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
46
- - Share with `share <path> --json`. In JSON output, give the user `data.artifact.url`; the artifact ID is `data.artifact.id`. Do not rerun `share` just to inspect the JSON shape: without `--key`, each successful run creates a new artifact. Posting to a project delivers to the audience defined by that project. Pick it with `--project-id <id>` or `--project <name>` (by exact name), or use the saved default. With no destination, share posts to home. Choose `home_audience` by purpose: use `config set home_audience private --scope user --json` for a personal safe default in this CLI environment, use `--scope repository` only for a policy agreed by all participants, and use `--visibility private|workspace` for one home post. Confirm the resolved audience with `config get home_audience --scope effective --json`; `--grant-email` does not change the resolved default.
53
+ - Share with `share <path> --json`. In JSON output, give the user `data.artifact.url`; the artifact ID is `data.artifact.id`. Do not rerun `share` just to inspect the JSON shape: without `--key`, each successful run creates a new artifact. Posting to a project delivers to the audience defined by that project. Pick it with `--project-id <id>` or `--project <name>` (by exact name), or use the saved default. With no destination, share posts to home. Choose `home_audience` by purpose: use `config set home_audience private --scope user --json` for a personal safe default in this CLI environment, use `--scope repository` only for a policy agreed by all participants, and use `--visibility private|workspace|link` for one home post. For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit both to use the workspace default. Confirm the resolved audience with `config get home_audience --scope effective --json`; `--grant-email` does not change the resolved default.
47
54
  - For new projects, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`. The complete `config --help` reference covers the canonical `home_audience`, user/repository/effective scopes, and resolution. `default_artifact_visibility` is a compatibility alias; `default_project_visibility` is the advanced project-creation default. Home resolution checks repository then user settings, including the alias at each scope, then product default `workspace`. Keyless `config get --json` returns only `home_audience`; pass an explicit key for either other setting. These settings do not change update, edit, Web, or MCP defaults.
48
55
  - 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.
49
56
  - 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.
50
57
  - 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`.
58
+ - 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.
51
59
  - Download static-site bundles with `download <target> --output ./out --json`. Pass `--force` to overwrite an existing output directory.
52
60
  - Find artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`. Resolve titles, project names, and URLs to IDs with `resolve <value> --json`.
53
61
  - Comment with `comments post <target> --body '<text>' --json`. Reply with `--reply-to <thread-id>`. Anchor to quoted text with `--quote '<text>'`; add `--quote-before`/`--quote-after` to disambiguate. Declare the posting agent with `--agent '<name>'` (e.g. `Claude`); omit for no badge. `comments list` returns an `agent` field on agent-posted messages.
54
62
  - Edit, resolve, reopen, and delete comments with `comments edit`, `comments resolve`, `comments reopen`, and `comments delete` using IDs from `comments list`. Comment deletion cannot be undone; omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
55
- - Change post-share settings with `edit <target>`: `--title`, `--visibility`, `--grant-email`, `--revoke-email`, `--project-id`, `--home`. Moving a `project` visibility file home makes it `private`. `move` remains for placement-only automation; prefer `edit`.
63
+ - Change post-share settings with `edit <target>`: `--title`, `--visibility private|workspace|link`, `--link-expires-at <RFC3339 UTC>`, `--no-link-expiry`, `--grant-email`, `--revoke-email`, `--project-id`, `--home`. The expiry options are mutually exclusive; omit both to preserve an existing link expiry. Moving a `project` visibility file home makes it `private`. `move` remains for placement-only automation; prefer `edit`.
64
+ - For link errors, `link_sharing_plan_required` means Plus or Team is required,
65
+ `link_sharing_disabled` means a Team owner or admin must enable the workspace
66
+ setting, and `link_expiry_invalid` means the timestamp must be future and
67
+ within policy (or the workspace must allow `--no-link-expiry`). Follow
68
+ `error.recovery`; do not retry unchanged input.
56
69
  - Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
57
70
  - Manage projects: `projects list --json`, `projects create <name> --json` (uses `default_project_visibility` when saved, otherwise `workspace`; pass `--visibility private` for a confidential project), `projects edit <id>` for name, description, visibility, audience (`--add-email`/`--remove-email`), and archive state (`--archive`/`--unarchive`).
58
71
  - Save a default project with `init --project-id <id> --json`. Preview setup with `init --dry-run --json`.