@artifactshare/cli 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -19,8 +19,11 @@ On the first run in an interactive terminal, the CLI prints a sign-in link — o
19
19
  ```sh
20
20
  npx --yes @artifactshare/cli publish ./dist --project "Weekly Reports"
21
21
  npx --yes @artifactshare/cli projects create "Client reports" --json
22
- npx --yes @artifactshare/cli move <artifact-id-or-url> --project-id <id> --json
22
+ npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
23
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
24
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility private --grant-email viewer@example.com --json
23
25
  npx --yes @artifactshare/cli update <artifact-id-or-url> ./dist
26
+ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
24
27
  ```
25
28
 
26
29
  ## Authentication
@@ -31,22 +34,24 @@ npx --yes @artifactshare/cli update <artifact-id-or-url> ./dist
31
34
 
32
35
  ## Commands
33
36
 
34
- | Command | What it does |
35
- | ----------------------------------------- | ---------------------------------------------------------------------------------------------- |
36
- | `publish <path>` | Publish a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
37
- | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
38
- | `resolve <value>` | Find files by URL, ID, title, or project name |
39
- | `artifacts get <target>` | Read a file's content and metadata back |
40
- | `download <target>` | Save a file or a whole static site locally |
41
- | `comments list / post <target>` | Read and write comments, including inline quotes and replies |
42
- | `projects list / create` | List projects you can publish to, or create a new project |
43
- | `move <target>` | Move an existing file into a project or back home |
44
- | `request-access` | Join the waitlist when publishing is not enabled yet |
45
- | `login` / `whoami` | Sign in and check who you are |
46
- | `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
47
- | `profiles list / use / import-token` | Switch between local account profiles and import an issued token from stdin |
48
- | `init` | Save a default project for the current directory |
49
- | `skills install / list / update / remove` | Install the bundled usage guide into your AI agent's skills |
37
+ | Command | What it does |
38
+ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
39
+ | `publish <path>` | Publish a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
40
+ | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
41
+ | `edit <target>` | Change title, sharing, explicit viewers, or project placement |
42
+ | `delete <target>` | Permanently delete a file you published |
43
+ | `resolve <value>` | Find files by URL, ID, title, or project name |
44
+ | `artifacts get <target>` | Read a file's content and metadata back |
45
+ | `download <target>` | Save a file or a whole static site locally |
46
+ | `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
47
+ | `projects list / create / edit` | List, create, and edit project destinations and audience |
48
+ | `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
49
+ | `request-access` | Join the waitlist when publishing is not enabled yet |
50
+ | `login` / `whoami` | Sign in and check who you are |
51
+ | `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
52
+ | `profiles list / use / import-token` | Switch between local account profiles and import an issued token from stdin |
53
+ | `init` | Save a default project for the current directory |
54
+ | `skills install / list / update / remove` | Install the bundled usage guide into your AI agent's skills |
50
55
 
51
56
  ## For AI agents
52
57
 
@@ -56,7 +61,9 @@ Teach your agent how to use Artifact Share once:
56
61
  npx --yes @artifactshare/cli skills install
57
62
  ```
58
63
 
59
- This installs a skill (for Claude Code, Codex, and Cursor) that covers publishing, updating, and reading comments.
64
+ This installs a skill (for Claude Code, Codex, and Cursor) that covers publishing, updating, and working with comments.
65
+
66
+ Comment deletion is permanent. Use `comments delete <target> --thread-id <id> --message-id <id> --json` for one message, or omit `--message-id` only when deleting the whole thread.
60
67
 
61
68
  All commands emit stable JSON when run non-interactively, piped, or with `--json`: success on stdout as `{ "schema_version": 1, "ok": true, "command": ..., "data": ... }`, failures on stderr as `{ "schema_version": 1, "ok": false, "command": ..., "error": ... }` with exit code 1. The `error` object carries a machine-readable `code`, a `hint`, and a structured `recovery` field (for example `{ "kind": "run_command", ... }`), so agents and scripts can branch and recover without parsing prose.
62
69
 
package/dist/index.js CHANGED
@@ -26,31 +26,41 @@ const EXCLUDED_DIR_NAMES = new Set([
26
26
  ]);
27
27
  const BOOLEAN_FLAGS = new Set([
28
28
  "allow-plaintext-token-store",
29
+ "archive",
29
30
  "dry-run",
30
31
  "force",
31
32
  "json",
32
33
  "help",
33
34
  "home",
34
- "insecure-localhost"
35
+ "insecure-localhost",
36
+ "unarchive"
35
37
  ]);
36
38
  const VALUE_FLAGS = new Set([
39
+ "add-email",
37
40
  "base-url",
38
41
  "body",
39
42
  "description",
40
43
  "grant-email",
41
44
  "include",
42
45
  "key",
46
+ "message-id",
47
+ "name",
43
48
  "note",
44
49
  "offset",
45
50
  "output",
46
51
  "profile",
47
52
  "project",
48
53
  "project-id",
54
+ "query",
49
55
  "quote",
50
56
  "quote-after",
51
57
  "quote-before",
52
58
  "reply-to",
59
+ "remove-email",
60
+ "revoke-email",
53
61
  "scope",
62
+ "thread-id",
63
+ "title",
54
64
  "token",
55
65
  "tool",
56
66
  "visibility"
@@ -59,6 +69,8 @@ const COMMAND_NAMES = new Set([
59
69
  "login",
60
70
  "publish",
61
71
  "update",
72
+ "edit",
73
+ "delete",
62
74
  "resolve",
63
75
  "download",
64
76
  "move",
@@ -73,14 +85,25 @@ const COMMAND_NAMES = new Set([
73
85
  "init"
74
86
  ]);
75
87
  const SUBCOMMANDS = {
76
- artifacts: ["get"],
77
- comments: ["list", "post"],
88
+ artifacts: ["list", "get"],
89
+ comments: [
90
+ "list",
91
+ "post",
92
+ "edit",
93
+ "resolve",
94
+ "reopen",
95
+ "delete"
96
+ ],
78
97
  profiles: [
79
98
  "list",
80
99
  "use",
81
100
  "import-token"
82
101
  ],
83
- projects: ["list", "create"],
102
+ projects: [
103
+ "list",
104
+ "create",
105
+ "edit"
106
+ ],
84
107
  skills: [
85
108
  "install",
86
109
  "list",
@@ -194,6 +217,15 @@ function mapApiError(status, body, options = {}) {
194
217
  requiresHuman: false,
195
218
  recovery: { kind: "change_input" }
196
219
  });
220
+ if (apiCode === "message-not-found") return cliError({
221
+ code: "message_not_found",
222
+ message: apiMessage ?? "Comment message was not found.",
223
+ why: "No comment message with that ID exists in the selected thread.",
224
+ hint: `Run ${CLI_INVOCATION} comments list <artifact-id> --json and retry with a listed message_id.`,
225
+ agentRecoverable: true,
226
+ requiresHuman: false,
227
+ recovery: { kind: "change_input" }
228
+ });
197
229
  if (apiCode === "thread-resolved") return cliError({
198
230
  code: "thread_resolved",
199
231
  message: apiMessage ?? "Comment thread is resolved.",
@@ -203,6 +235,7 @@ function mapApiError(status, body, options = {}) {
203
235
  requiresHuman: false,
204
236
  recovery: { kind: "change_input" }
205
237
  });
238
+ if (apiCode === "invalid-comment") return validationError(apiMessage ?? "Invalid comment payload.", "Check the comment body and IDs, then retry.");
206
239
  if (apiCode === "quote-unsupported") return cliError({
207
240
  code: "quote_unsupported",
208
241
  message: apiMessage ?? "This artifact does not support quoted comments.",
@@ -230,6 +263,18 @@ function mapApiError(status, body, options = {}) {
230
263
  requiresHuman: false,
231
264
  recovery: { kind: "change_input" }
232
265
  });
266
+ if (options.projectTarget && (apiCode === "not-found" || status === 404)) return cliError({
267
+ code: "target_not_found",
268
+ message: apiMessage ?? "Project target was not found.",
269
+ why: "The specified project does not exist or is not available in the current workspace.",
270
+ hint: `Run ${PROJECTS_LIST_COMMAND}, then retry with a listed project id.`,
271
+ agentRecoverable: true,
272
+ requiresHuman: false,
273
+ recovery: {
274
+ kind: "run_command",
275
+ command: PROJECTS_LIST_COMMAND
276
+ }
277
+ });
233
278
  if (options.artifactTarget && apiCode === "unsupported-kind") return cliError({
234
279
  code: "unsupported_kind",
235
280
  message: apiMessage ?? "This artifact cannot be read as a single source file.",
@@ -257,6 +302,15 @@ function mapApiError(status, body, options = {}) {
257
302
  requiresHuman: false,
258
303
  recovery: { kind: "change_input" }
259
304
  });
305
+ if (apiCode === "forbidden" || status === 403) return cliError({
306
+ code: "forbidden",
307
+ message: apiMessage ?? "You do not have permission to do that.",
308
+ why: "The current account is not allowed to change this comment or artifact.",
309
+ hint: "Use an account with permission, or ask the artifact owner or a workspace admin to make the change.",
310
+ agentRecoverable: false,
311
+ requiresHuman: true,
312
+ recovery: { kind: "ask_human" }
313
+ });
260
314
  if (apiCode === "key-target-moved") return cliError({
261
315
  code: "key_target_moved",
262
316
  message: apiMessage ?? "The artifact for this key moved.",
@@ -296,6 +350,33 @@ function mapApiError(status, body, options = {}) {
296
350
  command: PROJECTS_LIST_COMMAND
297
351
  }
298
352
  });
353
+ if (options.editSettings && apiCode === "workspace-unavailable") return cliError({
354
+ code: "workspace_unavailable",
355
+ message: apiMessage ?? "Workspace visibility is unavailable for this account.",
356
+ why: "Personal Google accounts cannot share with a whole workspace.",
357
+ hint: "Retry with --visibility private and explicit --grant-email values.",
358
+ agentRecoverable: true,
359
+ requiresHuman: false,
360
+ recovery: { kind: "change_input" }
361
+ });
362
+ if ((options.editSettings || options.projectTarget) && apiCode === "too-many-grants") return cliError({
363
+ code: "too_many_grants",
364
+ message: apiMessage ?? "Too many people are shared.",
365
+ why: "The target reached the maximum number of explicit viewers.",
366
+ hint: "Remove one or more viewers, or use a narrower set of email values.",
367
+ agentRecoverable: true,
368
+ requiresHuman: false,
369
+ recovery: { kind: "change_input" }
370
+ });
371
+ if (options.projectTarget && apiCode === "project-archived") return cliError({
372
+ code: "project_archived",
373
+ message: apiMessage ?? "Project is archived.",
374
+ why: "Archived projects must be unarchived before changing their settings or audience.",
375
+ hint: "Retry with --unarchive in the same command, or unarchive the project first.",
376
+ agentRecoverable: true,
377
+ requiresHuman: false,
378
+ recovery: { kind: "change_input" }
379
+ });
299
380
  if (apiCode !== null && [
300
381
  "unsupported-type",
301
382
  "invalid-key",
@@ -622,6 +703,9 @@ function parseIncludeOptions(value) {
622
703
  }
623
704
  return { values: [...new Set(values)] };
624
705
  }
706
+ function hasProjectIdHomeConflict(options) {
707
+ return options.projectId !== void 0 && Boolean(options.home);
708
+ }
625
709
  function unsupportedUpdateOption(options) {
626
710
  for (const key of Object.keys(options)) if (!UPDATE_OPTION_KEYS.has(key)) return kebabCase(key);
627
711
  return null;
@@ -647,7 +731,13 @@ const TARGET_COMMAND_LABELS = {
647
731
  download: "Download",
648
732
  "comments list": "Comments list",
649
733
  "comments post": "Comments post",
650
- move: "Move"
734
+ "comments edit": "Comments edit",
735
+ "comments resolve": "Comments resolve",
736
+ "comments reopen": "Comments reopen",
737
+ "comments delete": "Comments delete",
738
+ move: "Move",
739
+ edit: "Edit",
740
+ delete: "Delete"
651
741
  };
652
742
  function targetResolutionError(input, command) {
653
743
  return cliError({
@@ -684,6 +774,14 @@ function parsedArgsFromContext(command, ctx) {
684
774
  const name = camelCase(rawName);
685
775
  if (options[name] === void 0 && !UPDATE_OPTION_KEYS.has(name)) options[name] = true;
686
776
  }
777
+ if (command === "edit") for (const token of ctx.tokens) {
778
+ if (token.kind !== "option") continue;
779
+ if ((token.name ?? token.rawName?.replace(/^--?/, "")) === "title" && options.title === void 0) options.title = "";
780
+ }
781
+ if (command === "projects edit") for (const token of ctx.tokens) {
782
+ if (token.kind !== "option") continue;
783
+ if ((token.name ?? token.rawName?.replace(/^--?/, "")) === "description" && options.description === void 0) options.description = "";
784
+ }
687
785
  return {
688
786
  command,
689
787
  options,
@@ -727,16 +825,20 @@ function validateRawArgs(argv) {
727
825
  const eqIndex = arg.indexOf("=");
728
826
  if (eqIndex === -1) {
729
827
  const rawName = arg.slice(2);
730
- if (VALUE_FLAGS.has(rawName) && (argv[i + 1] === void 0 || argv[i + 1] === "")) return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
828
+ const next = argv[i + 1];
829
+ if (VALUE_FLAGS.has(rawName) && (next === void 0 || isKnownFlagToken(next) || next === "" && !allowsEmptyValue(rawName))) return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
731
830
  continue;
732
831
  }
733
832
  const rawName = arg.slice(2, eqIndex);
734
833
  const value = arg.slice(eqIndex + 1);
735
834
  if (BOOLEAN_FLAGS.has(rawName)) return validationError(`--${rawName} does not accept a value.`, `Use --${rawName} without =value.`);
736
- if (VALUE_FLAGS.has(rawName) && value === "") return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
835
+ if (VALUE_FLAGS.has(rawName) && value === "" && !allowsEmptyValue(rawName)) return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
737
836
  }
738
837
  return null;
739
838
  }
839
+ function allowsEmptyValue(rawName) {
840
+ return rawName === "title" || rawName === "description";
841
+ }
740
842
  function commandNameFromArgv(argv) {
741
843
  const found = findCommandCandidate(argv);
742
844
  const command = found?.command;
@@ -908,6 +1010,17 @@ function artifactGetSuccessFields(data) {
908
1010
  if (!isRecord(data)) return false;
909
1011
  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);
910
1012
  }
1013
+ function artifactsListSuccessFields(data) {
1014
+ if (!isRecord(data)) return false;
1015
+ return Array.isArray(data.artifacts) && data.artifacts.every((item) => {
1016
+ if (!isRecord(item)) return false;
1017
+ 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);
1018
+ }) && typeof data.limit === "number" && typeof data.has_more === "boolean" && (typeof data.next_cursor === "string" || data.next_cursor === null);
1019
+ }
1020
+ function deleteSuccessFields(data) {
1021
+ if (!isRecord(data)) return false;
1022
+ return typeof data.id === "string" && data.deleted === true;
1023
+ }
911
1024
  function downloadManifestFields(data) {
912
1025
  if (!isRecord(data)) return false;
913
1026
  return typeof data.id === "string" && typeof data.share_url === "string" && typeof data.version_id === "string" && typeof data.artifact_kind === "string" && Array.isArray(data.files) && data.files.every(downloadManifestFileFields) && typeof data.total_size_bytes === "number";
@@ -972,6 +1085,13 @@ async function apiPost(path, token, payload, options, init, errorOptions = {}) {
972
1085
  ...init
973
1086
  }, errorOptions);
974
1087
  }
1088
+ async function apiDelete(path, token, options, init, errorOptions = {}) {
1089
+ return await apiRequest(path, options, {
1090
+ method: "DELETE",
1091
+ headers: { Authorization: `Bearer ${token}` },
1092
+ ...init
1093
+ }, errorOptions);
1094
+ }
975
1095
  async function apiRequest(path, options, init, errorOptions) {
976
1096
  const response = await fetch(apiUrl(path, baseUrlOf(options)), init).catch((error) => ({ networkError: error }));
977
1097
  if ("networkError" in response) return { error: networkError(response.networkError) };
@@ -1543,6 +1663,33 @@ async function runArtifactsGet(parsed, mode) {
1543
1663
  if (!artifactGetSuccessFields(body)) return writeFailure(command, serviceError("Artifact read succeeded but the response did not include source metadata."), mode, 1);
1544
1664
  return writeSuccess(command, body, mode);
1545
1665
  }
1666
+ async function runArtifactsList(parsed, mode) {
1667
+ const command = "artifacts list";
1668
+ const hasProjectId = parsed.options.projectId !== void 0;
1669
+ const projectId = parsed.options.projectId?.trim() ?? "";
1670
+ const home = Boolean(parsed.options.home);
1671
+ if (hasProjectId && !projectId) return writeFailure(command, validationError("--project-id must not be empty.", "Pass --project-id <id>, use --home, or omit the destination filter."), mode, 1);
1672
+ if (hasProjectIdHomeConflict(parsed.options)) return writeFailure(command, validationError("Artifact list destination is ambiguous.", "Choose only one destination filter: --project-id <id> or --home.", "destination_conflict"), mode, 1);
1673
+ const query = parsed.options.query?.trim();
1674
+ if (parsed.options.query !== void 0 && !query) return writeFailure(command, validationError("--query must not be empty.", "Pass --query <text> or omit --query."), mode, 1);
1675
+ const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
1676
+ if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
1677
+ const request = await requestConfig(parsed.options);
1678
+ if (request.error) return writeFailure(command, request.error, mode, 1);
1679
+ const url = apiUrl("/api/cli/artifacts", baseUrlOf(parsed.options));
1680
+ if (home) url.searchParams.set("project_id", "");
1681
+ else if (projectId) url.searchParams.set("project_id", projectId);
1682
+ if (query) url.searchParams.set("query", query);
1683
+ const response = await fetch(url, {
1684
+ headers: { Authorization: `Bearer ${credential.token}` },
1685
+ ...request.init
1686
+ }).catch((error) => ({ networkError: error }));
1687
+ if ("networkError" in response) return writeFailure(command, networkError(response.networkError), mode, 1);
1688
+ const body = await readJson(response);
1689
+ if (!response.ok) return writeFailure(command, mapApiError(response.status, body, { authenticated: true }), mode, 1);
1690
+ if (!artifactsListSuccessFields(body)) return writeFailure(command, serviceError("Artifact list succeeded but the response did not include list metadata."), mode, 1);
1691
+ return writeSuccess(command, body, mode);
1692
+ }
1546
1693
  //#endregion
1547
1694
  //#region src/command-runners/comments.ts
1548
1695
  async function runCommentsList(parsed, mode) {
@@ -1598,6 +1745,127 @@ async function runCommentsPost(parsed, mode) {
1598
1745
  thread: result.body?.thread ?? null
1599
1746
  }, mode);
1600
1747
  }
1748
+ async function runCommentsEdit(parsed, mode) {
1749
+ const command = "comments edit";
1750
+ const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL.");
1751
+ if (target.error) return writeFailure(command, target.error, mode, 1);
1752
+ const messageId = requiredOption(parsed.options.messageId, "--message-id is required.", "Run comments list and retry with a listed message_id.");
1753
+ if (messageId.error) return writeFailure(command, messageId.error, mode, 1);
1754
+ const body = requiredOption(parsed.options.body, "--body is required.", "Pass --body <text> with the updated comment.");
1755
+ if (body.error) return writeFailure(command, body.error, mode, 1);
1756
+ const result = await postCommentAction(parsed, command, target.artifactId, {
1757
+ action: "edit",
1758
+ message_id: messageId.value,
1759
+ body: body.value
1760
+ }, mode);
1761
+ if (!result) return;
1762
+ const threadId = configString(result.thread_id);
1763
+ if (!threadId || result.thread === void 0) return writeFailure(command, serviceError("Comment was changed but the response had no thread."), mode, 1);
1764
+ writeSuccess(command, {
1765
+ artifact_id: target.artifactId,
1766
+ share_url: configString(result.share_url),
1767
+ thread_id: threadId,
1768
+ thread: result.thread
1769
+ }, mode);
1770
+ }
1771
+ async function runCommentsResolve(parsed, mode) {
1772
+ return await runCommentsStatus(parsed, mode, "comments resolve", "resolve");
1773
+ }
1774
+ async function runCommentsReopen(parsed, mode) {
1775
+ return await runCommentsStatus(parsed, mode, "comments reopen", "reopen");
1776
+ }
1777
+ async function runCommentsDelete(parsed, mode) {
1778
+ const command = "comments delete";
1779
+ const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL.");
1780
+ if (target.error) return writeFailure(command, target.error, mode, 1);
1781
+ const threadId = requiredOption(parsed.options.threadId, "--thread-id is required.", "Run comments list and retry with a listed thread_id.");
1782
+ if (threadId.error) return writeFailure(command, threadId.error, mode, 1);
1783
+ const payload = {
1784
+ action: "delete",
1785
+ thread_id: threadId.value
1786
+ };
1787
+ if (parsed.options.messageId !== void 0) {
1788
+ if (!parsed.options.messageId.trim()) return writeFailure(command, validationError("--message-id cannot be empty.", "Run comments list and retry with a listed message_id."), mode, 1);
1789
+ payload.message_id = parsed.options.messageId.trim();
1790
+ }
1791
+ const result = await postCommentAction(parsed, command, target.artifactId, payload, mode);
1792
+ if (!result) return;
1793
+ const responseThreadId = configString(result.thread_id);
1794
+ if (!responseThreadId || result.deleted !== true) return writeFailure(command, serviceError("Comment was deleted but the response was incomplete."), mode, 1);
1795
+ writeSuccess(command, {
1796
+ artifact_id: target.artifactId,
1797
+ share_url: configString(result.share_url),
1798
+ thread_id: responseThreadId,
1799
+ deleted: true,
1800
+ thread_deleted: result.thread_deleted === true,
1801
+ ...result.thread !== void 0 ? { thread: result.thread } : {}
1802
+ }, mode);
1803
+ }
1804
+ async function runCommentsStatus(parsed, mode, command, action) {
1805
+ const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL.");
1806
+ if (target.error) return writeFailure(command, target.error, mode, 1);
1807
+ const threadId = requiredOption(parsed.options.threadId, "--thread-id is required.", "Run comments list and retry with a listed thread_id.");
1808
+ if (threadId.error) return writeFailure(command, threadId.error, mode, 1);
1809
+ const result = await postCommentAction(parsed, command, target.artifactId, {
1810
+ action,
1811
+ thread_id: threadId.value
1812
+ }, mode);
1813
+ if (!result) return;
1814
+ const responseThreadId = configString(result.thread_id);
1815
+ if (!responseThreadId || result.thread === void 0) return writeFailure(command, serviceError("Comment was changed but the response had no thread."), mode, 1);
1816
+ writeSuccess(command, {
1817
+ artifact_id: target.artifactId,
1818
+ share_url: configString(result.share_url),
1819
+ thread_id: responseThreadId,
1820
+ thread: result.thread
1821
+ }, mode);
1822
+ }
1823
+ async function postCommentAction(parsed, command, artifactId, payload, mode) {
1824
+ const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
1825
+ if (!credential.ok) {
1826
+ writeFailure(command, credential.error, mode, 1);
1827
+ return null;
1828
+ }
1829
+ const request = await requestConfig(parsed.options);
1830
+ if (request.error) {
1831
+ writeFailure(command, request.error, mode, 1);
1832
+ return null;
1833
+ }
1834
+ const result = await apiPost(`/api/cli/artifacts/${encodeURIComponent(artifactId)}/comments`, credential.token, payload, parsed.options, request.init, { artifactTarget: true });
1835
+ if (result.error) {
1836
+ writeFailure(command, result.error, mode, 1);
1837
+ return null;
1838
+ }
1839
+ if (result.body === null) {
1840
+ writeFailure(command, serviceError("Comment was changed but the response was empty."), mode, 1);
1841
+ return null;
1842
+ }
1843
+ return result.body;
1844
+ }
1845
+ function requiredOption(value, message, hint) {
1846
+ if (!value || !value.trim()) return { error: validationError(message, hint) };
1847
+ return { value: value.trim() };
1848
+ }
1849
+ //#endregion
1850
+ //#region src/command-runners/delete.ts
1851
+ async function runDelete(parsed, mode) {
1852
+ const command = "delete";
1853
+ const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL to delete.");
1854
+ if (target.error) return writeFailure(command, target.error, mode, 1);
1855
+ const artifactId = target.artifactId;
1856
+ const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
1857
+ if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
1858
+ const request = await requestConfig(parsed.options);
1859
+ if (request.error) return writeFailure(command, request.error, mode, 1);
1860
+ const result = await apiDelete(`/api/cli/artifacts/${encodeURIComponent(artifactId)}`, credential.token, parsed.options, request.init, {
1861
+ authenticated: true,
1862
+ artifactTarget: true
1863
+ });
1864
+ if (result.error) return writeFailure(command, result.error, mode, 1);
1865
+ const body = result.body;
1866
+ if (!deleteSuccessFields(body)) return writeFailure(command, serviceError("Delete succeeded but the response did not include deletion metadata."), mode, 1);
1867
+ return writeSuccess(command, body, mode);
1868
+ }
1601
1869
  //#endregion
1602
1870
  //#region src/command-runners/doctor.ts
1603
1871
  const LOGIN_COMMAND = `${CLI_INVOCATION} login`;
@@ -2294,6 +2562,104 @@ async function runDownload(parsed, mode, isRetry = false) {
2294
2562
  }, mode);
2295
2563
  }
2296
2564
  //#endregion
2565
+ //#region src/command-runners/edit.ts
2566
+ async function runEdit(parsed, mode) {
2567
+ const command = "edit";
2568
+ const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL to edit.");
2569
+ if (target.error) return writeFailure(command, target.error, mode, 1);
2570
+ const payload = buildEditPayload(parsed);
2571
+ if (payload.error) return writeFailure(command, payload.error, mode, 1);
2572
+ const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
2573
+ if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
2574
+ const request = await requestConfig(parsed.options);
2575
+ if (request.error) return writeFailure(command, request.error, mode, 1);
2576
+ const result = await apiPost(`/api/cli/shareables/${encodeURIComponent(target.artifactId)}/edit`, credential.token, payload.body, parsed.options, request.init, {
2577
+ artifactTarget: true,
2578
+ editSettings: true
2579
+ });
2580
+ if (result.error) return writeFailure(command, result.error, mode, 1);
2581
+ const data = parseEditData(result.body);
2582
+ if (!data) return writeFailure(command, serviceError("Edit succeeded but the response did not include edit data."), mode, 1);
2583
+ writeSuccess(command, data, mode);
2584
+ }
2585
+ function buildEditPayload(parsed) {
2586
+ const body = {};
2587
+ let hasChange = false;
2588
+ if (parsed.options.title !== void 0) {
2589
+ body.title = parsed.options.title;
2590
+ hasChange = true;
2591
+ }
2592
+ if (parsed.options.visibility !== void 0) {
2593
+ const visibility = parsed.options.visibility.trim();
2594
+ if (visibility !== "private" && visibility !== "workspace") return { error: validationError("--visibility must be private or workspace.", "Retry with --visibility private or --visibility workspace.") };
2595
+ body.visibility = visibility;
2596
+ hasChange = true;
2597
+ }
2598
+ const addEmails = normalizedEmailOptions$1(parsed.options.grantEmail);
2599
+ if (addEmails.error) return { error: addEmails.error };
2600
+ if (parsed.options.grantEmail !== void 0) {
2601
+ body.add_emails = addEmails.values;
2602
+ hasChange = true;
2603
+ }
2604
+ const removeEmails = normalizedEmailOptions$1(parsed.options.revokeEmail);
2605
+ if (removeEmails.error) return { error: removeEmails.error };
2606
+ if (parsed.options.revokeEmail !== void 0) {
2607
+ body.remove_emails = removeEmails.values;
2608
+ hasChange = true;
2609
+ }
2610
+ if (hasProjectIdHomeConflict(parsed.options)) return { error: validationError("Edit destination is conflicting.", "Choose either --project-id <id> or --home.", "destination_conflict") };
2611
+ if (parsed.options.home) {
2612
+ body.destination = "home";
2613
+ hasChange = true;
2614
+ } else if (parsed.options.projectId !== void 0) {
2615
+ const projectId = parsed.options.projectId.trim();
2616
+ if (!projectId) return { error: validationError("--project-id must not be blank.", "Retry with an active project id from projects list, or use --home.", "invalid_destination") };
2617
+ body.destination = { project_id: projectId };
2618
+ hasChange = true;
2619
+ }
2620
+ if (!hasChange) return { error: validationError("At least one edit option is required.", "Pass --title, --visibility, --grant-email, --revoke-email, --project-id, or --home.") };
2621
+ return { body };
2622
+ }
2623
+ function normalizedEmailOptions$1(value) {
2624
+ const values = arrayOption(value).map((email) => email.trim()).filter(Boolean);
2625
+ if (value !== void 0 && values.length === 0) return { error: validationError("Email option must not be blank.", "Pass a non-empty email address.") };
2626
+ return { values };
2627
+ }
2628
+ function parseEditData(body) {
2629
+ if (!isRecord(body)) return null;
2630
+ const artifact = body.artifact;
2631
+ const destination = body.destination;
2632
+ const share = body.share;
2633
+ if (!isRecord(artifact) || !isRecord(destination) || !isRecord(share)) return null;
2634
+ if (typeof artifact.id !== "string" || typeof body.title !== "string" || typeof destination.type !== "string" || typeof share.visibility !== "string") return null;
2635
+ const base = {
2636
+ artifact: {
2637
+ id: artifact.id,
2638
+ url: typeof artifact.url === "string" ? artifact.url : null
2639
+ },
2640
+ title: body.title,
2641
+ share: { visibility: share.visibility }
2642
+ };
2643
+ if (destination.type === "project") {
2644
+ if (typeof destination.project_id !== "string") return null;
2645
+ return {
2646
+ ...base,
2647
+ destination: {
2648
+ type: "project",
2649
+ project_id: destination.project_id
2650
+ }
2651
+ };
2652
+ }
2653
+ if (destination.type === "home" && destination.project_id === null) return {
2654
+ ...base,
2655
+ destination: {
2656
+ type: "home",
2657
+ project_id: null
2658
+ }
2659
+ };
2660
+ return null;
2661
+ }
2662
+ //#endregion
2297
2663
  //#region src/git-exclude.ts
2298
2664
  async function ensureGitExclude(cwd) {
2299
2665
  const git = await findGitDir(cwd);
@@ -2399,10 +2765,11 @@ async function runMove(parsed, mode) {
2399
2765
  const command = "move";
2400
2766
  const target = parseArtifactTarget(parsed.positionals[0], command, "Pass an artifact ID or share URL to move.");
2401
2767
  if (target.error) return writeFailure(command, target.error, mode, 1);
2402
- const hasProjectId = parsed.options.projectId !== void 0;
2768
+ parsed.options.projectId;
2403
2769
  const projectId = parsed.options.projectId?.trim() ?? "";
2404
2770
  const home = Boolean(parsed.options.home);
2405
- if (hasProjectId && home || !projectId && !home) return writeFailure(command, validationError("Move destination is required.", "Choose exactly one destination: --project-id <id> or --home.", hasProjectId && home ? "destination_conflict" : "invalid_destination"), mode, 1);
2771
+ const destinationConflict = hasProjectIdHomeConflict(parsed.options);
2772
+ if (destinationConflict || !projectId && !home) return writeFailure(command, validationError("Move destination is required.", "Choose exactly one destination: --project-id <id> or --home.", destinationConflict ? "destination_conflict" : "invalid_destination"), mode, 1);
2406
2773
  const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
2407
2774
  if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
2408
2775
  const request = await requestConfig(parsed.options);
@@ -2600,6 +2967,87 @@ async function runProjectsCreate(parsed, mode) {
2600
2967
  next_command: `npx --yes @artifactshare/cli publish <path> --project-id ${id} --json`
2601
2968
  }, mode);
2602
2969
  }
2970
+ async function runProjectsEdit(parsed, mode) {
2971
+ const command = "projects edit";
2972
+ const projectId = parsed.positionals[0]?.trim();
2973
+ if (!projectId) return writeFailure(command, validationError("Project id is required.", "Pass a project id: projects edit <id>."), mode, 1);
2974
+ const payload = buildProjectsEditPayload(parsed);
2975
+ if (payload.error) return writeFailure(command, payload.error, mode, 1);
2976
+ const projectConfig = await resolveProjectConfig();
2977
+ const credential = await resolveCredential(parsed.options, projectConfig);
2978
+ if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
2979
+ const request = await requestConfig(parsed.options);
2980
+ if (request.error) return writeFailure(command, request.error, mode, 1);
2981
+ const result = await apiPost(`/api/cli/projects/${encodeURIComponent(projectId)}`, credential.token, payload.body, parsed.options, request.init, { projectTarget: true });
2982
+ if (result.error) return writeFailure(command, result.error, mode, 1);
2983
+ const data = parseProjectsEditData(result.body);
2984
+ if (!data) return writeFailure(command, serviceError("Project edit succeeded but the response did not include project data."), mode, 1);
2985
+ writeSuccess(command, data, mode);
2986
+ }
2987
+ function buildProjectsEditPayload(parsed) {
2988
+ const body = {};
2989
+ let hasChange = false;
2990
+ if (parsed.options.name !== void 0) {
2991
+ const name = parsed.options.name.trim();
2992
+ if (!name) return { error: validationError("--name must not be blank.", "Retry with a non-empty project name.") };
2993
+ body.name = name;
2994
+ hasChange = true;
2995
+ }
2996
+ if (parsed.options.description !== void 0) {
2997
+ body.description = parsed.options.description;
2998
+ hasChange = true;
2999
+ }
3000
+ if (parsed.options.visibility !== void 0) {
3001
+ const visibility = parsed.options.visibility.trim();
3002
+ if (visibility !== "workspace" && visibility !== "private") return { error: validationError("--visibility must be workspace or private.", "Retry with --visibility workspace or --visibility private.") };
3003
+ body.base_visibility = visibility;
3004
+ hasChange = true;
3005
+ }
3006
+ const addEmails = normalizedEmailOptions(parsed.options.addEmail);
3007
+ if (addEmails.error) return { error: addEmails.error };
3008
+ if (parsed.options.addEmail !== void 0) {
3009
+ body.add_emails = addEmails.values;
3010
+ hasChange = true;
3011
+ }
3012
+ const removeEmails = normalizedEmailOptions(parsed.options.removeEmail);
3013
+ if (removeEmails.error) return { error: removeEmails.error };
3014
+ if (parsed.options.removeEmail !== void 0) {
3015
+ body.remove_emails = removeEmails.values;
3016
+ hasChange = true;
3017
+ }
3018
+ if (parsed.options.archive && parsed.options.unarchive) return { error: validationError("Archive state is conflicting.", "Choose either --archive or --unarchive.") };
3019
+ if (parsed.options.archive) {
3020
+ body.archived = true;
3021
+ hasChange = true;
3022
+ }
3023
+ if (parsed.options.unarchive) {
3024
+ body.archived = false;
3025
+ hasChange = true;
3026
+ }
3027
+ if (!hasChange) return { error: validationError("At least one project edit option is required.", "Pass --name, --description, --visibility, --add-email, --remove-email, --archive, or --unarchive.") };
3028
+ return { body };
3029
+ }
3030
+ function normalizedEmailOptions(value) {
3031
+ const values = arrayOption(value).map((email) => email.trim()).filter(Boolean);
3032
+ if (value !== void 0 && values.length === 0) return { error: validationError("Email option must not be blank.", "Pass a non-empty email address.") };
3033
+ return { values };
3034
+ }
3035
+ function parseProjectsEditData(body) {
3036
+ if (!isRecord(body) || !isRecord(body.project)) return null;
3037
+ const { project } = body;
3038
+ if (typeof project.id !== "string" || typeof project.archived !== "boolean" || !Array.isArray(body.audience) || body.audience.some((email) => typeof email !== "string")) return null;
3039
+ return {
3040
+ project: {
3041
+ id: project.id,
3042
+ name: configString(project.name),
3043
+ description: configString(project.description),
3044
+ base_visibility: configString(project.base_visibility),
3045
+ file_count: typeof project.file_count === "number" ? project.file_count : null,
3046
+ archived: project.archived
3047
+ },
3048
+ audience: body.audience
3049
+ };
3050
+ }
2603
3051
  //#endregion
2604
3052
  //#region src/command-runners/publish.ts
2605
3053
  const MAX_PUBLISH_KEY_LENGTH = 128;
@@ -3086,6 +3534,14 @@ async function updateRunner(ctx) {
3086
3534
  const parsed = parsedArgsFromContext("update", ctx);
3087
3535
  return await runUpdate(parsed, outputMode(parsed.options));
3088
3536
  }
3537
+ async function editRunner(ctx) {
3538
+ const parsed = parsedArgsFromContext("edit", ctx);
3539
+ return await runEdit(parsed, outputMode(parsed.options));
3540
+ }
3541
+ async function deleteRunner(ctx) {
3542
+ const parsed = parsedArgsFromContext("delete", ctx);
3543
+ return await runDelete(parsed, outputMode(parsed.options));
3544
+ }
3089
3545
  async function resolveRunner(ctx) {
3090
3546
  const parsed = parsedArgsFromContext("resolve", ctx);
3091
3547
  return await runResolve(parsed, outputMode(parsed.options));
@@ -3102,6 +3558,10 @@ async function artifactsGetRunner(ctx) {
3102
3558
  const parsed = parsedArgsFromContext("artifacts get", ctx);
3103
3559
  return await runArtifactsGet(parsed, outputMode(parsed.options));
3104
3560
  }
3561
+ async function artifactsListRunner(ctx) {
3562
+ const parsed = parsedArgsFromContext("artifacts list", ctx);
3563
+ return await runArtifactsList(parsed, outputMode(parsed.options));
3564
+ }
3105
3565
  async function commentsListRunner(ctx) {
3106
3566
  const parsed = parsedArgsFromContext("comments list", ctx);
3107
3567
  return await runCommentsList(parsed, outputMode(parsed.options));
@@ -3110,6 +3570,22 @@ async function commentsPostRunner(ctx) {
3110
3570
  const parsed = parsedArgsFromContext("comments post", ctx);
3111
3571
  return await runCommentsPost(parsed, outputMode(parsed.options));
3112
3572
  }
3573
+ async function commentsEditRunner(ctx) {
3574
+ const parsed = parsedArgsFromContext("comments edit", ctx);
3575
+ return await runCommentsEdit(parsed, outputMode(parsed.options));
3576
+ }
3577
+ async function commentsResolveRunner(ctx) {
3578
+ const parsed = parsedArgsFromContext("comments resolve", ctx);
3579
+ return await runCommentsResolve(parsed, outputMode(parsed.options));
3580
+ }
3581
+ async function commentsReopenRunner(ctx) {
3582
+ const parsed = parsedArgsFromContext("comments reopen", ctx);
3583
+ return await runCommentsReopen(parsed, outputMode(parsed.options));
3584
+ }
3585
+ async function commentsDeleteRunner(ctx) {
3586
+ const parsed = parsedArgsFromContext("comments delete", ctx);
3587
+ return await runCommentsDelete(parsed, outputMode(parsed.options));
3588
+ }
3113
3589
  async function requestAccessRunner(ctx) {
3114
3590
  const parsed = parsedArgsFromContext("request-access", ctx);
3115
3591
  return await runRequestAccess(parsed, outputMode(parsed.options));
@@ -3139,6 +3615,10 @@ async function projectsCreateRunner(ctx) {
3139
3615
  const parsed = parsedArgsFromContext("projects create", ctx);
3140
3616
  return await runProjectsCreate(parsed, outputMode(parsed.options));
3141
3617
  }
3618
+ async function projectsEditRunner(ctx) {
3619
+ const parsed = parsedArgsFromContext("projects edit", ctx);
3620
+ return await runProjectsEdit(parsed, outputMode(parsed.options));
3621
+ }
3142
3622
  async function initRunner(ctx) {
3143
3623
  const parsed = parsedArgsFromContext("init", ctx);
3144
3624
  return await runInit(parsed, outputMode(parsed.options));
@@ -3212,6 +3692,8 @@ async function runGunshi(argv) {
3212
3692
  login: lazyCommand(loginDefinition, loginRunner),
3213
3693
  publish: lazyCommand(publishDefinition, publishRunner),
3214
3694
  update: lazyCommand(updateDefinition, updateRunner),
3695
+ edit: lazyCommand(editDefinition, editRunner),
3696
+ delete: lazyCommand(deleteDefinition, deleteRunner),
3215
3697
  resolve: lazyCommand(resolveDefinition, resolveRunner),
3216
3698
  download: lazyCommand(downloadDefinition, downloadRunner),
3217
3699
  move: lazyCommand(moveDefinition, moveRunner),
@@ -3272,9 +3754,13 @@ const entryCommand = define({
3272
3754
  args: commonArgs,
3273
3755
  examples: `npx --yes @artifactshare/cli publish <path> --project-id <id> --json
3274
3756
  npx --yes @artifactshare/cli update <artifact-id-or-url> <path> --json
3757
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --title "New title" --json
3758
+ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
3275
3759
  npx --yes @artifactshare/cli resolve <url-id-or-title> --json
3276
3760
  npx --yes @artifactshare/cli projects create "Launch review" --json
3761
+ npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
3277
3762
  npx --yes @artifactshare/cli move <artifact-id-or-url> --project-id <id> --json
3763
+ npx --yes @artifactshare/cli artifacts list --json
3278
3764
  npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --json
3279
3765
  npx --yes @artifactshare/cli comments list <artifact-id-or-url> --json
3280
3766
  npx --yes @artifactshare/cli comments post <artifact-id-or-url> --body "<text>" --json
@@ -3400,6 +3886,89 @@ Common failures:
3400
3886
  file_too_large Reduce file or directory size and retry
3401
3887
  validation_failed Check file type (.html / .md for single files) and directory layout`
3402
3888
  });
3889
+ const editDefinition = define({
3890
+ name: "edit",
3891
+ description: "Edit artifact title, sharing, or project placement.",
3892
+ toKebab: true,
3893
+ args: {
3894
+ ...commonArgs,
3895
+ artifactIdOrUrl: {
3896
+ type: "positional",
3897
+ toKebab: true,
3898
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
3899
+ },
3900
+ title: {
3901
+ type: "string",
3902
+ toKebab: true,
3903
+ description: "Set display title; pass an empty value to clear it"
3904
+ },
3905
+ visibility: {
3906
+ type: "string",
3907
+ toKebab: true,
3908
+ description: "private or workspace"
3909
+ },
3910
+ grantEmail: {
3911
+ type: "string",
3912
+ multiple: true,
3913
+ toKebab: true,
3914
+ description: "Add an explicit viewer; repeat for multiple viewers"
3915
+ },
3916
+ revokeEmail: {
3917
+ type: "string",
3918
+ multiple: true,
3919
+ toKebab: true,
3920
+ description: "Remove an explicit viewer; repeat for multiple viewers"
3921
+ },
3922
+ projectId: {
3923
+ type: "string",
3924
+ toKebab: true,
3925
+ description: "Move into this project"
3926
+ },
3927
+ home: {
3928
+ type: "boolean",
3929
+ toKebab: true,
3930
+ description: "Move back to the owner home area"
3931
+ }
3932
+ },
3933
+ examples: `npx --yes @artifactshare/cli edit abc123def4 --title "Launch plan" --json
3934
+ npx --yes @artifactshare/cli edit abc123def4 --visibility private --grant-email viewer@example.com --json
3935
+ npx --yes @artifactshare/cli edit https://artifactshare.com/a/abc123def4 --project-id prj123 --json
3936
+ npx --yes @artifactshare/cli edit abc123def4 --home --json
3937
+
3938
+ Edit changes artifact settings without adding a new version. Use update to replace content.
3939
+ Move remains available for placement-only automation; edit is the main command for post-publish settings.
3940
+
3941
+ Common failures:
3942
+ auth_required Set ARTIFACTSHARE_TOKEN before edit
3943
+ target_not_found Retry with an artifact ID, share URL, or sandbox URL
3944
+ destination_conflict Choose either --project-id or --home
3945
+ invalid_destination Use an active project id from projects list, or --home
3946
+ workspace_unavailable Use --visibility private for personal Google accounts
3947
+ too_many_grants Remove viewers or grant fewer email addresses`
3948
+ });
3949
+ const deleteDefinition = define({
3950
+ name: "delete",
3951
+ description: "Permanently delete an artifact you published.",
3952
+ toKebab: true,
3953
+ args: {
3954
+ ...commonArgs,
3955
+ artifactIdOrUrl: {
3956
+ type: "positional",
3957
+ toKebab: true,
3958
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
3959
+ }
3960
+ },
3961
+ examples: `npx --yes @artifactshare/cli delete abc123def4 --json
3962
+ npx --yes @artifactshare/cli delete https://artifactshare.com/a/abc123def4 --json
3963
+
3964
+ Delete permanently removes the artifact and its version history. This cannot be undone.
3965
+ Use resolve first when a user gives a title or project name, then pass the id here.
3966
+
3967
+ Common failures:
3968
+ auth_required Set ARTIFACTSHARE_TOKEN before delete
3969
+ target_not_found Retry with an artifact ID, share URL, or sandbox URL
3970
+ service_error Retry later if deletion could not complete`
3971
+ });
3403
3972
  const resolveDefinition = define({
3404
3973
  name: "resolve",
3405
3974
  description: "Find artifact, version, and project candidates before writing.",
@@ -3491,35 +4060,30 @@ Common failures:
3491
4060
  destination_conflict Choose either --project-id or --home
3492
4061
  invalid_destination Use an active project id from projects list, or --home`
3493
4062
  });
3494
- const artifactsDefinition = define({
3495
- name: "artifacts",
3496
- description: "Read Artifact Share artifacts.",
4063
+ const artifactsGetDefinition = define({
4064
+ name: "get",
4065
+ description: "Read a single-file artifact source and metadata.",
3497
4066
  toKebab: true,
3498
- args: commonArgs,
3499
- subCommands: { get: lazyCommand(define({
3500
- name: "get",
3501
- description: "Read a single-file artifact source and metadata.",
3502
- toKebab: true,
3503
- args: {
3504
- ...commonArgs,
3505
- artifactIdOrUrl: {
3506
- type: "positional",
3507
- toKebab: true,
3508
- description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
3509
- },
3510
- offset: {
3511
- type: "string",
3512
- toKebab: true,
3513
- description: "Character offset for continuing a truncated read"
3514
- },
3515
- include: {
3516
- type: "string",
3517
- multiple: true,
3518
- toKebab: true,
3519
- description: "Extra data to include: versions or comments"
3520
- }
4067
+ args: {
4068
+ ...commonArgs,
4069
+ artifactIdOrUrl: {
4070
+ type: "positional",
4071
+ toKebab: true,
4072
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
4073
+ },
4074
+ offset: {
4075
+ type: "string",
4076
+ toKebab: true,
4077
+ description: "Character offset for continuing a truncated read"
3521
4078
  },
3522
- examples: `npx --yes @artifactshare/cli artifacts get abc123def4 --json
4079
+ include: {
4080
+ type: "string",
4081
+ multiple: true,
4082
+ toKebab: true,
4083
+ description: "Extra data to include: versions or comments"
4084
+ }
4085
+ },
4086
+ examples: `npx --yes @artifactshare/cli artifacts get abc123def4 --json
3523
4087
  npx --yes @artifactshare/cli artifacts get https://artifactshare.com/a/abc123def4 --include versions --include comments --json
3524
4088
  npx --yes @artifactshare/cli artifacts get abc123def4 --offset 200000 --json
3525
4089
 
@@ -3531,9 +4095,52 @@ Common failures:
3531
4095
  target_not_found Retry with an artifact ID, share URL, or sandbox URL
3532
4096
  unsupported_kind Use download for static sites or other multi-file artifacts
3533
4097
  validation_failed Check --offset and --include values`
3534
- }), artifactsGetRunner) },
3535
- examples: `npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --json
4098
+ });
4099
+ const artifactsDefinition = define({
4100
+ name: "artifacts",
4101
+ description: "Read Artifact Share artifacts.",
4102
+ toKebab: true,
4103
+ args: commonArgs,
4104
+ subCommands: {
4105
+ list: lazyCommand(define({
4106
+ name: "list",
4107
+ description: "List artifacts you published, newest first.",
4108
+ toKebab: true,
4109
+ args: {
4110
+ ...commonArgs,
4111
+ projectId: {
4112
+ type: "string",
4113
+ toKebab: true,
4114
+ description: "Only artifacts in this project"
4115
+ },
4116
+ home: {
4117
+ type: "boolean",
4118
+ toKebab: true,
4119
+ description: "Only artifacts in the unfiled home area"
4120
+ },
4121
+ query: {
4122
+ type: "string",
4123
+ toKebab: true,
4124
+ description: "Only artifacts whose title contains this text"
4125
+ }
4126
+ },
4127
+ examples: `npx --yes @artifactshare/cli artifacts list --json
4128
+ npx --yes @artifactshare/cli artifacts list --project-id <id> --json
4129
+ npx --yes @artifactshare/cli artifacts list --home --query report --json
3536
4130
 
4131
+ Use an id from this list with update, edit, move, delete, artifacts get, or comments list.
4132
+
4133
+ Common failures:
4134
+ auth_required Set ARTIFACTSHARE_TOKEN before artifacts list
4135
+ invalid_destination Run projects list, then retry with --project-id <id> or --home
4136
+ validation_failed Choose only one of --project-id or --home`
4137
+ }), artifactsListRunner),
4138
+ get: lazyCommand(artifactsGetDefinition, artifactsGetRunner)
4139
+ },
4140
+ examples: `npx --yes @artifactshare/cli artifacts list --json
4141
+ npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --json
4142
+
4143
+ Use artifacts list to find IDs for update, edit, move, delete, artifacts get, and comments list.
3537
4144
  Use artifacts get to read back Markdown or HTML before update.`,
3538
4145
  run: parentCommandRunner("artifacts")
3539
4146
  });
@@ -3609,17 +4216,115 @@ Common failures:
3609
4216
  quote_not_found Copy the exact text from artifacts get
3610
4217
  validation_failed Pass --body, and do not combine --quote with --reply-to`
3611
4218
  });
4219
+ const commentThreadActionArgs = {
4220
+ ...commonArgs,
4221
+ artifactIdOrUrl: {
4222
+ type: "positional",
4223
+ toKebab: true,
4224
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
4225
+ },
4226
+ threadId: {
4227
+ type: "string",
4228
+ toKebab: true,
4229
+ description: "Thread id from comments list"
4230
+ }
4231
+ };
4232
+ const commentsEditDefinition = define({
4233
+ name: "edit",
4234
+ description: "Edit a comment message you wrote.",
4235
+ toKebab: true,
4236
+ args: {
4237
+ ...commonArgs,
4238
+ artifactIdOrUrl: {
4239
+ type: "positional",
4240
+ toKebab: true,
4241
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
4242
+ },
4243
+ messageId: {
4244
+ type: "string",
4245
+ toKebab: true,
4246
+ description: "Message id from comments list"
4247
+ },
4248
+ body: {
4249
+ type: "string",
4250
+ toKebab: true,
4251
+ description: "Updated comment text (required)"
4252
+ }
4253
+ },
4254
+ examples: `npx --yes @artifactshare/cli comments edit abc123def4 --message-id <message-id> --body "Updated text" --json
4255
+
4256
+ Common failures:
4257
+ message_not_found Run comments list and retry with a listed message_id
4258
+ forbidden You can edit only your own comments
4259
+ validation_failed Pass --message-id and --body`
4260
+ });
4261
+ const commentsResolveDefinition = define({
4262
+ name: "resolve",
4263
+ description: "Mark a comment thread as resolved.",
4264
+ toKebab: true,
4265
+ args: commentThreadActionArgs,
4266
+ examples: `npx --yes @artifactshare/cli comments resolve abc123def4 --thread-id <thread-id> --json
4267
+
4268
+ Common failures:
4269
+ thread_not_found Run comments list and retry with a listed thread_id
4270
+ forbidden Resolving needs the thread author, artifact owner, or workspace admin
4271
+ validation_failed Pass --thread-id`
4272
+ });
4273
+ const commentsReopenDefinition = define({
4274
+ name: "reopen",
4275
+ description: "Reopen a resolved comment thread.",
4276
+ toKebab: true,
4277
+ args: commentThreadActionArgs,
4278
+ examples: `npx --yes @artifactshare/cli comments reopen abc123def4 --thread-id <thread-id> --json
4279
+
4280
+ Common failures:
4281
+ thread_not_found Run comments list and retry with a listed thread_id
4282
+ forbidden Reopening needs the thread author, artifact owner, or workspace admin
4283
+ validation_failed Pass --thread-id`
4284
+ });
4285
+ const commentsDeleteDefinition = define({
4286
+ name: "delete",
4287
+ description: "Permanently delete a comment message or a whole thread.",
4288
+ toKebab: true,
4289
+ args: {
4290
+ ...commentThreadActionArgs,
4291
+ messageId: {
4292
+ type: "string",
4293
+ toKebab: true,
4294
+ description: "Message id from comments list; omit to delete the thread"
4295
+ }
4296
+ },
4297
+ examples: `npx --yes @artifactshare/cli comments delete abc123def4 --thread-id <thread-id> --message-id <message-id> --json
4298
+ npx --yes @artifactshare/cli comments delete abc123def4 --thread-id <thread-id> --json
4299
+
4300
+ Deleting comments cannot be undone. Omit --message-id only when deleting the whole thread.
4301
+
4302
+ Common failures:
4303
+ thread_not_found Run comments list and retry with a listed thread_id
4304
+ message_not_found Retry with a message_id from that thread
4305
+ forbidden You can delete your own comments; owners/admins can delete any thread
4306
+ validation_failed Pass --thread-id`
4307
+ });
3612
4308
  const commentsDefinition = define({
3613
4309
  name: "comments",
3614
- description: "Read and write artifact comments.",
4310
+ description: "Read, write, edit, resolve, reopen, and delete artifact comments.",
3615
4311
  toKebab: true,
3616
4312
  args: commonArgs,
3617
4313
  subCommands: {
3618
4314
  list: lazyCommand(commentsListDefinition, commentsListRunner),
3619
- post: lazyCommand(commentsPostDefinition, commentsPostRunner)
4315
+ post: lazyCommand(commentsPostDefinition, commentsPostRunner),
4316
+ edit: lazyCommand(commentsEditDefinition, commentsEditRunner),
4317
+ resolve: lazyCommand(commentsResolveDefinition, commentsResolveRunner),
4318
+ reopen: lazyCommand(commentsReopenDefinition, commentsReopenRunner),
4319
+ delete: lazyCommand(commentsDeleteDefinition, commentsDeleteRunner)
3620
4320
  },
3621
4321
  examples: `npx --yes @artifactshare/cli comments list <artifact-id-or-url> --json
3622
- npx --yes @artifactshare/cli comments post <artifact-id-or-url> --body "<text>" --json`,
4322
+ npx --yes @artifactshare/cli comments post <artifact-id-or-url> --body "<text>" --json
4323
+ npx --yes @artifactshare/cli comments edit <artifact-id-or-url> --message-id <message-id> --body "<text>" --json
4324
+ npx --yes @artifactshare/cli comments resolve <artifact-id-or-url> --thread-id <thread-id> --json
4325
+ npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <thread-id> --json
4326
+
4327
+ Deleting comments cannot be undone.`,
3623
4328
  run: parentCommandRunner("comments")
3624
4329
  });
3625
4330
  const profilesListDefinition = define({
@@ -3724,17 +4429,79 @@ Common failures:
3724
4429
  upload_not_allowed Your account cannot publish yet; request access from an operator
3725
4430
  validation_failed Pass a non-empty name and valid --visibility`
3726
4431
  });
4432
+ const projectsEditDefinition = define({
4433
+ name: "edit",
4434
+ description: "Edit project settings and audience.",
4435
+ toKebab: true,
4436
+ args: {
4437
+ ...commonArgs,
4438
+ id: {
4439
+ type: "positional",
4440
+ description: "Project id"
4441
+ },
4442
+ name: {
4443
+ type: "string",
4444
+ toKebab: true,
4445
+ description: "New project name"
4446
+ },
4447
+ description: {
4448
+ type: "string",
4449
+ toKebab: true,
4450
+ description: "New project description; pass an empty value to clear it"
4451
+ },
4452
+ visibility: {
4453
+ type: "string",
4454
+ toKebab: true,
4455
+ description: "workspace or private"
4456
+ },
4457
+ addEmail: {
4458
+ type: "string",
4459
+ multiple: true,
4460
+ toKebab: true,
4461
+ description: "Add an audience email address; repeat for multiple"
4462
+ },
4463
+ removeEmail: {
4464
+ type: "string",
4465
+ multiple: true,
4466
+ toKebab: true,
4467
+ description: "Remove an audience email address; repeat for multiple"
4468
+ },
4469
+ archive: {
4470
+ type: "boolean",
4471
+ toKebab: true,
4472
+ description: "Archive the project after other edits"
4473
+ },
4474
+ unarchive: {
4475
+ type: "boolean",
4476
+ toKebab: true,
4477
+ description: "Unarchive the project before other edits"
4478
+ }
4479
+ },
4480
+ examples: `npx --yes @artifactshare/cli projects edit <id> --name "Launch review" --json
4481
+ npx --yes @artifactshare/cli projects edit <id> --visibility private --add-email viewer@example.com --json
4482
+ npx --yes @artifactshare/cli projects edit <id> --archive --json
4483
+ npx --yes @artifactshare/cli projects edit <id> --unarchive --description "" --json
4484
+
4485
+ Common failures:
4486
+ target_not_found Use a project id from projects list
4487
+ forbidden Only the creator or workspace admin can edit project settings
4488
+ project_archived Retry with --unarchive, or unarchive first
4489
+ too_many_grants Remove project audience entries before adding more
4490
+ validation_failed Pass a project id and at least one valid edit option`
4491
+ });
3727
4492
  const projectsDefinition = define({
3728
4493
  name: "projects",
3729
- description: "Create and find publish destinations.",
4494
+ description: "Create, find, and edit publish destinations.",
3730
4495
  toKebab: true,
3731
4496
  args: commonArgs,
3732
4497
  subCommands: {
3733
4498
  list: lazyCommand(projectsListDefinition, projectsListRunner),
3734
- create: lazyCommand(projectsCreateDefinition, projectsCreateRunner)
4499
+ create: lazyCommand(projectsCreateDefinition, projectsCreateRunner),
4500
+ edit: lazyCommand(projectsEditDefinition, projectsEditRunner)
3735
4501
  },
3736
4502
  examples: `npx --yes @artifactshare/cli projects list --json
3737
- npx --yes @artifactshare/cli projects create "Launch review" --json`,
4503
+ npx --yes @artifactshare/cli projects create "Launch review" --json
4504
+ npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json`,
3738
4505
  run: parentCommandRunner("projects")
3739
4506
  });
3740
4507
  const skillsToolArgs = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "gunshi": "^0.33.0",
36
- "undici": "^7.24.8"
36
+ "undici": "^7.28.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "24.12.4",
@@ -4,7 +4,7 @@ description: Publish, update, and read back shared files with the Artifact Share
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 7
7
+ version: 12
8
8
  managed: true
9
9
  -->
10
10
 
@@ -44,14 +44,16 @@ paths like `/Users/.../report.html` from the user's filesystem.
44
44
 
45
45
  1. `projects list --json` shows the projects this account can publish into; `is_default` marks the working-directory default.
46
46
  2. `projects create <name> --json` creates a project and returns `project.id` plus a `next_command` using `publish --project-id <id>`.
47
- 3. `init --project-id <id> --json` saves a default project for the working directory.
48
- 4. `publish` resolves the destination from `--project-id`, then the saved default, then `--home` (the home destination for files not placed in a project). Without any of these it fails with `destination_required`.
49
- 5. `move <artifact-id-or-url> --project-id <id> --json` moves an existing file into a project; `move <artifact-id-or-url> --home --json` moves it back home.
47
+ 3. `projects edit <id> --name "New name" --json`, `projects edit <id> --visibility private --json`, `projects edit <id> --add-email person@example.com --json`, `projects edit <id> --remove-email person@example.com --json`, `projects edit <id> --archive --json`, and `projects edit <id> --unarchive --json` change the project settings and audience.
48
+ 4. `init --project-id <id> --json` saves a default project for the working directory.
49
+ 5. `publish` resolves the destination from `--project-id`, then the saved default, then `--home` (the home destination for files not placed in a project). Without any of these it fails with `destination_required`.
50
+ 6. `edit <artifact-id-or-url> --project-id <id> --json` moves an existing file into a project; `edit <artifact-id-or-url> --home --json` moves it back home.
51
+ 7. `edit <artifact-id-or-url> --title "New title" --json`, `edit <artifact-id-or-url> --visibility private --json`, `edit <artifact-id-or-url> --grant-email person@example.com --json`, and `edit <artifact-id-or-url> --revoke-email person@example.com --json` change post-publish settings.
50
52
 
51
- `move` does not add grants. For `project` visibility artifacts, moving between
52
- projects may change the live project audience; the response reports
53
- `share.project_audience_may_change`. Moving a `project` visibility artifact
54
- home makes it `private`, because home has no project audience.
53
+ `edit` changes settings without adding a new version. Moving a `project`
54
+ visibility artifact home makes it `private`, because home has no project
55
+ audience. The older `move` command remains available for placement-only
56
+ automation, but prefer `edit` for new flows.
55
57
 
56
58
  ## Core commands
57
59
 
@@ -59,16 +61,29 @@ home makes it `private`, because home has no project audience.
59
61
  npx --yes @artifactshare/cli publish ./report.html --json
60
62
  npx --yes @artifactshare/cli publish ./site-dir --project-id <id> --json
61
63
  npx --yes @artifactshare/cli projects create "Client reports" --json
62
- npx --yes @artifactshare/cli move <artifact-id-or-url> --project-id <id> --json
64
+ npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
65
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
66
+ npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility private --grant-email viewer@example.com --json
63
67
  npx --yes @artifactshare/cli update <artifact-id-or-url> ./report.html --json
68
+ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
69
+ npx --yes @artifactshare/cli artifacts list --json
64
70
  npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --json
65
71
  npx --yes @artifactshare/cli download <artifact-id-or-url> --output ./out --json
66
72
  npx --yes @artifactshare/cli comments list <artifact-id-or-url> --json
67
73
  npx --yes @artifactshare/cli comments post <artifact-id-or-url> --body "<text>" --json
74
+ npx --yes @artifactshare/cli comments edit <artifact-id-or-url> --message-id <message-id> --body "<text>" --json
75
+ npx --yes @artifactshare/cli comments resolve <artifact-id-or-url> --thread-id <thread-id> --json
76
+ npx --yes @artifactshare/cli comments reopen <artifact-id-or-url> --thread-id <thread-id> --json
77
+ npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <thread-id> --message-id <message-id> --json
68
78
  ```
69
79
 
70
80
  - `publish` accepts a single `.html` / `.md` file or a static-site directory. The returned `share_url` is the link to give the user.
71
81
  - `update` adds a new version to an existing file; pass the same kind of input (single file vs directory) it was created with.
82
+ - `edit` changes the display title, visibility, explicit viewers, or project placement after publishing.
83
+ - `projects edit` changes a project name, description, sharing scope, audience, or archive state. Use IDs from `projects list --json`.
84
+ - `delete` permanently removes an artifact you published, including its version history. Use it only when the user explicitly asks to delete.
85
+ - Use `artifacts list --json` to find recent artifact IDs for `update`, `edit`, `move`, `delete`, `artifacts get`, or `comments list`. Filter with `--project-id <id>`, `--home`, or `--query <text>`.
86
+ - Use IDs from `comments list --json` for `comments edit`, `comments resolve`, `comments reopen`, and `comments delete`. Comment deletion cannot be undone; omit `--message-id` only when the user wants the whole thread deleted.
72
87
  - When the user gives a title, project name, or URL instead of an ID, run `resolve <value> --json` first and use the returned ID.
73
88
  - `artifacts get` reads back single-file sources (use `--offset` to continue truncated reads); `download` saves static-site bundles.
74
89
 
@@ -4,7 +4,7 @@ alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 7
7
+ version: 12
8
8
  managed: true
9
9
  -->
10
10
 
@@ -24,8 +24,12 @@ from the user's filesystem.
24
24
  - 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`. Add `--allow-plaintext-token-store` only on a trusted machine without a native token store.
25
25
  - Use `login --profile <name>` only in an interactive terminal where the user can approve the browser device flow.
26
26
  - Pick the destination with `projects list --json`, `projects create <name> --json`, `init --project-id <id>`, or `--project-id`.
27
- - Move existing files with `move <artifact-id-or-url> --project-id <id> --json` or `move <artifact-id-or-url> --home --json`. `move` does not add grants; for `project` visibility files, moving between projects may change the project audience, and moving home makes the file `private`.
28
- - Publish with `publish <path> --json`; add a version with `update <artifact-id-or-url> <path> --json`.
27
+ - Change project settings with `projects edit <id> --name "New name" --json`, `projects edit <id> --visibility private --json`, `projects edit <id> --add-email person@example.com --json`, `projects edit <id> --remove-email person@example.com --json`, `projects edit <id> --archive --json`, or `projects edit <id> --unarchive --json`.
28
+ - Change post-publish settings with `edit <artifact-id-or-url> --title "New title" --json`, `edit <artifact-id-or-url> --visibility private --json`, `edit <artifact-id-or-url> --grant-email person@example.com --json`, `edit <artifact-id-or-url> --revoke-email person@example.com --json`, `edit <artifact-id-or-url> --project-id <id> --json`, or `edit <artifact-id-or-url> --home --json`. Moving a `project` visibility file home makes it `private`.
29
+ - `move <artifact-id-or-url> --project-id <id> --json` and `move <artifact-id-or-url> --home --json` remain available for placement-only automation, but prefer `edit` for new flows.
30
+ - Publish with `publish <path> --json`; add a version with `update <artifact-id-or-url> <path> --json`; permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
31
+ - Find recent artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`.
29
32
  - Resolve titles, project names, and URLs to IDs with `resolve <value> --json` before writing.
30
- - Read back with `artifacts get` / `download`; comment with `comments list` / `comments post`.
33
+ - Read back with `artifacts get` / `download`; comment with `comments list` / `comments post`; use `comments edit`, `comments resolve`, `comments reopen`, and `comments delete` with IDs from `comments list`.
34
+ - Comment deletion cannot be undone. Omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
31
35
  - On `upload_not_allowed`, run `request-access --note "<why>" --json` and tell the user an operator opens publishing; do not retry in a loop.