@artifactshare/cli 0.1.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,24 @@
1
1
  # Artifact Share CLI
2
2
 
3
- The official CLI to upload and share files, folders, and static sites on [Artifact Share](https://artifactshare.com) from terminals, AI agents, and automation. Publish HTML, Markdown, and exported sites to stable share URLs, update existing files, and emit `--json` for scripts and agents.
3
+ The official CLI to open, share, and update files, folders, and static sites on [Artifact Share](https://artifactshare.com) from terminals, AI agents, and automation. Share HTML, Markdown, and exported sites to stable URLs, update existing files, and emit `--json` for scripts and agents.
4
4
 
5
- Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI publishes a single file or a whole folder (HTML, Markdown, exported SPAs, images included), updates versions, reads content and comments back, and works the same for humans, terminal agents (Claude Code, Codex, Cursor Agent), and automation.
5
+ Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI shares a single file or a whole folder (HTML, Markdown, exported SPAs, images included), updates versions, opens shared URLs for agents, reads content and comments back, and works the same for humans, terminal agents (Claude Code, Codex, Cursor Agent), and automation.
6
6
 
7
7
  ## Quick start
8
8
 
9
9
  Requires Node.js 22 or later.
10
10
 
11
11
  ```sh
12
- npx --yes @artifactshare/cli publish ./report.html
12
+ npx --yes @artifactshare/cli share ./report.html
13
13
  ```
14
14
 
15
15
  `--yes` lets agents and CI fetch the package without stopping for an npx install prompt.
16
16
 
17
- On the first run in an interactive terminal, the CLI prints a sign-in link — open it in your browser, and the publish completes and prints the share URL. Folders work too:
17
+ On the first run in an interactive terminal, the CLI prints a sign-in link — open it in your browser, and the share completes and prints the share URL. Folders work too:
18
18
 
19
19
  ```sh
20
- npx --yes @artifactshare/cli publish ./dist --project 'Weekly Reports'
20
+ npx --yes @artifactshare/cli open <artifact-id-or-url> --json
21
+ npx --yes @artifactshare/cli share ./dist --project 'Weekly Reports'
21
22
  npx --yes @artifactshare/cli projects create 'Client reports' --json
22
23
  npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
23
24
  npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
@@ -28,62 +29,64 @@ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
28
29
 
29
30
  To keep an existing share URL, update it with
30
31
  `npx --yes @artifactshare/cli update <artifact-id-or-url> <path>` instead of
31
- publishing again. For CI, scheduled reports, or other repeat jobs, use
32
- `publish <path> --key <key>`: the first run creates the shared file, and later
32
+ sharing again. For CI, scheduled reports, or other repeat jobs, use
33
+ `share <path> --key <key>`: the first run creates the shared file, and later
33
34
  runs add versions to the same file.
34
35
 
35
36
  ## Authentication
36
37
 
37
- - **Interactive**: run `npx --yes @artifactshare/cli login`, or run `publish`, `update`, or `download` directly — those commands start sign-in for you when unauthenticated (the CLI prints a link and code to open in your browser).
38
+ - **Interactive**: run `npx --yes @artifactshare/cli login`, or run `share`, `update`, or `download` directly — those commands start sign-in for you when unauthenticated (the CLI prints a link and code to open in your browser).
38
39
  - **CI / non-interactive**: issue a token at `https://artifactshare.com/settings/tokens`, then set `ARTIFACTSHARE_TOKEN` (or pass `--token`). Without a token, non-interactive runs fail with `error.code: "auth_required"` instead of hanging.
39
40
  - Multiple accounts: keep one local profile per account (`profiles list` / `profiles use <name>`). In non-interactive agents, pipe an issued token into `profiles import-token --profile <name> --json` to create a saved profile without browser login.
40
41
 
41
42
  ## Commands
42
43
 
43
- | Command | What it does |
44
- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
45
- | `publish <path>` | Publish a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
46
- | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
47
- | `edit <target>` | Change title, sharing, explicit viewers, or project placement |
48
- | `delete <target>` | Permanently delete a file you published |
49
- | `resolve <value>` | Find files by URL, ID, title, or project name |
50
- | `agent open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
51
- | `artifacts get <target>` | Read a file's content and metadata back |
52
- | `download <target>` | Save a file or a whole static site locally |
53
- | `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
54
- | `projects list / create / edit` | List, create, and edit project destinations and audience |
55
- | `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
56
- | `request-access` | Join the waitlist when publishing is not enabled yet |
57
- | `login` / `whoami` | Sign in and check who you are |
58
- | `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
59
- | `profiles list / use / import-token` | Switch between local account profiles and import an issued token from stdin |
60
- | `init` | Save a default project for the current directory |
61
- | `skills ensure / install / list / update / remove` | Install or update the bundled usage guide in your AI agent's skills |
44
+ | Command | What it does |
45
+ | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
46
+ | `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
47
+ | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
48
+ | `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
49
+ | `edit <target>` | Change title, sharing, explicit viewers, or project placement |
50
+ | `delete <target>` | Permanently delete a file you shared |
51
+ | `resolve <value>` | Find files by URL, ID, title, or project name |
52
+ | `artifacts get <target>` | Read a file's content and metadata back |
53
+ | `download <target>` | Save a file or a whole static site locally |
54
+ | `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
55
+ | `projects list / create / edit` | List, create, and edit project destinations and audience |
56
+ | `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
57
+ | `request-access` | Join the waitlist when sharing is not enabled yet |
58
+ | `login` / `whoami` | Sign in and check who you are |
59
+ | `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
60
+ | `profiles list / use / import-token` | Switch between local account profiles and import an issued token from stdin |
61
+ | `init` | Set up this directory: detect the agent and install the skill, then show next steps; or save defaults with `--profile` / `--project-id` |
62
+ | `skills ensure / install / list / update / remove` | Install or update the bundled usage guide in your AI agent's skills |
62
63
 
63
64
  ## For AI agents
64
65
 
65
- When an agent receives an Artifact Share URL, start here:
66
+ For first-time setup in a project, start here:
66
67
 
67
68
  ```sh
68
- npx --yes @artifactshare/cli agent open <artifact-id-or-url> --json
69
+ npx --yes @artifactshare/cli init --json
69
70
  ```
70
71
 
71
- This installs or updates the local skill first, then reads single-file artifacts. Static sites and multi-file artifacts return a `download` next command.
72
+ `init` detects the agent (Claude Code, Codex, Cursor) in the working directory, installs or updates the bundled skill, and reports the next steps (sign in, then share). With no agent detected, it installs the Codex and Claude Code project skills. Add `--dry-run` to preview without writing.
72
73
 
73
- To prepare the local skills without opening a URL:
74
+ When an agent receives an Artifact Share URL instead, start with `open`:
74
75
 
75
76
  ```sh
76
- npx --yes @artifactshare/cli skills ensure --tool auto --scope project --json
77
+ npx --yes @artifactshare/cli open <artifact-id-or-url> --json
77
78
  ```
78
79
 
79
- `skills ensure --tool auto` detects Claude Code, Codex, and Cursor project markers. Use `skills install --tool <codex|claude|cursor>` only when you want to target a specific tool manually.
80
+ This installs or updates the local skill first, then reads single-file artifacts. Static sites and multi-file artifacts return a `download` next command.
81
+
82
+ To target a specific tool manually, use `skills install --tool <codex|claude|cursor>`; `skills ensure --tool auto` is the same detection `init` uses.
80
83
 
81
84
  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.
82
85
 
83
- 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.
86
+ All commands emit stable JSON when run non-interactively, piped, or with `--json`: success on stdout as `{ "schema_version": 2, "ok": true, "command": ..., "data": ... }`, failures on stderr as `{ "schema_version": 2, "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.
84
87
 
85
88
  ```sh
86
- npx --yes @artifactshare/cli publish ./dist --json
89
+ npx --yes @artifactshare/cli share ./dist --json
87
90
  ```
88
91
 
89
92
  Quote paths and free-form text before passing them through a shell. Artifact Share route files and user files can contain `$`, spaces, or glob characters, so prefer single quotes such as `'apps/web/app/routes/a.$id/index.tsx'` and `--body 'Looks good'`.
package/dist/index.js CHANGED
@@ -68,13 +68,13 @@ const VALUE_FLAGS = new Set([
68
68
  ]);
69
69
  const COMMAND_NAMES = new Set([
70
70
  "login",
71
- "publish",
71
+ "share",
72
+ "open",
72
73
  "update",
73
74
  "edit",
74
75
  "delete",
75
76
  "resolve",
76
77
  "download",
77
- "agent",
78
78
  "move",
79
79
  "artifacts",
80
80
  "comments",
@@ -87,7 +87,6 @@ const COMMAND_NAMES = new Set([
87
87
  "init"
88
88
  ]);
89
89
  const SUBCOMMANDS = {
90
- agent: ["open"],
91
90
  artifacts: ["list", "get"],
92
91
  comments: [
93
92
  "list",
@@ -158,9 +157,9 @@ function mapApiError(status, body, options = {}) {
158
157
  }
159
158
  if (apiCode === "upload-not-allowed") return cliError({
160
159
  code: "upload_not_allowed",
161
- message: "This account cannot publish yet.",
162
- why: "Artifact Share is currently limiting who can publish.",
163
- hint: `Run ${REQUEST_ACCESS_COMMAND$1} to join the early-access waitlist; an operator opens publishing afterwards.`,
160
+ message: "This account cannot share yet.",
161
+ why: "Artifact Share is currently limiting who can share.",
162
+ hint: `Run ${REQUEST_ACCESS_COMMAND$1} to join the early-access waitlist; an operator opens sharing afterwards.`,
164
163
  agentRecoverable: false,
165
164
  requiresHuman: true,
166
165
  recovery: {
@@ -176,7 +175,7 @@ function mapApiError(status, body, options = {}) {
176
175
  code: "upload_suspended",
177
176
  message: apiMessage ?? "Your upload permission is suspended.",
178
177
  why: "Artifact Share suspended upload access for this account.",
179
- hint: "Ask an operator to restore upload access, then retry publish.",
178
+ hint: "Ask an operator to restore upload access, then retry share.",
180
179
  agentRecoverable: false,
181
180
  requiresHuman: true,
182
181
  recovery: { kind: "ask_human" }
@@ -219,7 +218,7 @@ function mapApiError(status, body, options = {}) {
219
218
  });
220
219
  if (apiCode !== null && ["invalid-container"].includes(apiCode)) return cliError({
221
220
  code: "project_not_found",
222
- message: apiMessage ?? "The publish destination is invalid.",
221
+ message: apiMessage ?? "The share destination is invalid.",
223
222
  why: "The project ID does not exist or is not available in this workspace.",
224
223
  hint: "Retry with a valid --project-id or use --home.",
225
224
  agentRecoverable: true,
@@ -333,7 +332,7 @@ function mapApiError(status, body, options = {}) {
333
332
  code: "key_target_moved",
334
333
  message: apiMessage ?? "The artifact for this key moved.",
335
334
  why: "The artifact this key points to now lives in a different destination, so the key no longer updates it.",
336
- hint: "Find the artifact with resolve --json, then update it by ID or publish with a new key.",
335
+ hint: "Find the artifact with resolve --json, then update it by ID or share with a new key.",
337
336
  agentRecoverable: true,
338
337
  requiresHuman: false,
339
338
  recovery: { kind: "change_input" }
@@ -342,16 +341,16 @@ function mapApiError(status, body, options = {}) {
342
341
  code: "key_kind_mismatch",
343
342
  message: apiMessage ?? "The artifact for this key is a different kind.",
344
343
  why: "The key points to an artifact whose kind (single file or static site) does not match this input.",
345
- hint: "Check the existing artifact by ID, or publish with a new key.",
344
+ hint: "Check the existing artifact by ID, or share with a new key.",
346
345
  agentRecoverable: true,
347
346
  requiresHuman: false,
348
347
  recovery: { kind: "change_input" }
349
348
  });
350
349
  if (apiCode === "key-conflict") return cliError({
351
350
  code: "key_conflict",
352
- message: apiMessage ?? "Another publish created this key first.",
353
- why: "Two publishes raced to create the same key, and the other one won.",
354
- hint: "Retry the same command; it will update the artifact the other publish created.",
351
+ message: apiMessage ?? "Another share created this key first.",
352
+ why: "Two share commands raced to create the same key, and the other one won.",
353
+ hint: "Retry the same command; it will update the artifact the other share created.",
355
354
  agentRecoverable: true,
356
355
  requiresHuman: false,
357
356
  recovery: { kind: "retry_later" }
@@ -411,7 +410,7 @@ function mapApiError(status, body, options = {}) {
411
410
  ].includes(apiCode)) return cliError({
412
411
  code: "validation_failed",
413
412
  message: apiMessage ?? "The upload input is invalid.",
414
- why: "The file, directory, or publish options failed server-side validation.",
413
+ why: "The file, directory, or share options failed server-side validation.",
415
414
  hint: "Check the path, file types, and visibility options, then retry.",
416
415
  agentRecoverable: true,
417
416
  requiresHuman: false,
@@ -644,14 +643,14 @@ function normalizeApiCode(value) {
644
643
  return typeof value === "string" ? value : null;
645
644
  }
646
645
  function uploadBlockedHint(code) {
647
- if (code === "upload-not-allowed") return `Run ${REQUEST_ACCESS_COMMAND$1} to join the waitlist, then retry publish once an operator opens publishing.`;
646
+ if (code === "upload-not-allowed") return `Run ${REQUEST_ACCESS_COMMAND$1} to join the waitlist, then retry share once an operator opens sharing.`;
648
647
  if (code === "upload-policy-unavailable") return "Retry doctor later; upload permission could not be checked.";
649
- return "Resolve the upload issue, then retry publish.";
648
+ return "Resolve the upload issue, then retry share.";
650
649
  }
651
650
  function projectNotFoundByNameError() {
652
651
  return cliError({
653
652
  code: "project_not_found",
654
- message: "The publish destination project was not found.",
653
+ message: "The share destination project was not found.",
655
654
  why: "No project in the current workspace matches the given project name exactly.",
656
655
  hint: `Run ${PROJECTS_LIST_COMMAND}, then retry with --project-id <id>.`,
657
656
  agentRecoverable: true,
@@ -665,7 +664,7 @@ function projectNotFoundByNameError() {
665
664
  function projectAmbiguousError(candidates) {
666
665
  return cliError({
667
666
  code: "project_ambiguous",
668
- message: "The publish destination project is ambiguous.",
667
+ message: "The share destination project is ambiguous.",
669
668
  why: "Multiple projects in the current workspace match the given project name exactly.",
670
669
  hint: "Retry with --project-id <id> from the candidates.",
671
670
  agentRecoverable: true,
@@ -764,9 +763,9 @@ function resolveArtifactId(input) {
764
763
  }
765
764
  const TARGET_COMMAND_LABELS = {
766
765
  update: "Update",
766
+ open: "Open",
767
767
  "artifacts get": "Artifacts get",
768
768
  download: "Download",
769
- "agent open": "Agent open",
770
769
  "comments list": "Comments list",
771
770
  "comments post": "Comments post",
772
771
  "comments edit": "Comments edit",
@@ -863,14 +862,14 @@ function validateRawArgs(argv, command) {
863
862
  const eqIndex = arg.indexOf("=");
864
863
  if (eqIndex === -1) {
865
864
  const rawName = arg.slice(2);
866
- const artifactIdError = unsupportedPublishArtifactId(rawName, command);
865
+ const artifactIdError = unsupportedShareArtifactId(rawName, command);
867
866
  if (artifactIdError) return artifactIdError;
868
867
  const next = argv[i + 1];
869
868
  if (VALUE_FLAGS.has(rawName) && (next === void 0 || isKnownFlagToken(next) || next === "" && !allowsEmptyValue(rawName))) return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
870
869
  continue;
871
870
  }
872
871
  const rawName = arg.slice(2, eqIndex);
873
- const artifactIdError = unsupportedPublishArtifactId(rawName, command);
872
+ const artifactIdError = unsupportedShareArtifactId(rawName, command);
874
873
  if (artifactIdError) return artifactIdError;
875
874
  const value = arg.slice(eqIndex + 1);
876
875
  if (BOOLEAN_FLAGS.has(rawName)) return validationError(`--${rawName} does not accept a value.`, `Use --${rawName} without =value.`);
@@ -878,9 +877,9 @@ function validateRawArgs(argv, command) {
878
877
  }
879
878
  return null;
880
879
  }
881
- function unsupportedPublishArtifactId(rawName, command) {
882
- if (command !== "publish" || rawName !== "artifact-id" && rawName !== "artifactId") return null;
883
- return validationError("Publish does not accept --artifact-id.", `To keep an existing share URL, run ${CLI_INVOCATION} update <artifact-id-or-url> <path> --json. For repeat jobs, use publish --key <key>.`);
880
+ function unsupportedShareArtifactId(rawName, command) {
881
+ if (command !== "share" || rawName !== "artifact-id" && rawName !== "artifactId") return null;
882
+ return validationError("Share does not accept --artifact-id.", `To keep an existing share URL, run ${CLI_INVOCATION} update <artifact-id-or-url> <path> --json. For repeat jobs, use share --key <key>.`);
884
883
  }
885
884
  function allowsEmptyValue(rawName) {
886
885
  return rawName === "title" || rawName === "description";
@@ -965,9 +964,9 @@ function outputMode(options) {
965
964
  return { json: Boolean(options.json) || process.env.CI === "true" || !process.stdout.isTTY };
966
965
  }
967
966
  function writeSuccess(command, data, mode) {
968
- if (!mode.json && command === "publish" && !publishSuccessFields(data)) return writeFailure(command, serviceError("Publish succeeded but the response did not include an artifact id and URL."), mode, 1);
967
+ if (!mode.json && command === "share" && !shareSuccessFields(data)) return writeFailure(command, serviceError("Share succeeded but the response did not include an artifact id and URL."), mode, 1);
969
968
  const payload = {
970
- schema_version: 1,
969
+ schema_version: 2,
971
970
  ok: true,
972
971
  command,
973
972
  data
@@ -980,7 +979,7 @@ function writeSuccess(command, data, mode) {
980
979
  }
981
980
  function writeFailure(command, error, mode, exitCode) {
982
981
  const payload = {
983
- schema_version: 1,
982
+ schema_version: 2,
984
983
  ok: false,
985
984
  command,
986
985
  error
@@ -996,11 +995,11 @@ function writeEvent(data) {
996
995
  process.stderr.write(`${JSON.stringify(data)}\n`);
997
996
  }
998
997
  function humanSuccess(command, data) {
999
- if (command === "publish") {
1000
- const fields = publishSuccessFields(data);
998
+ if (command === "share") {
999
+ const fields = shareSuccessFields(data);
1001
1000
  if (!fields) return `${JSON.stringify(data, null, 2)}\n`;
1002
1001
  return [
1003
- "Published",
1002
+ "Shared",
1004
1003
  `Artifact ID: ${fields.artifactId}`,
1005
1004
  `URL: ${fields.url}`,
1006
1005
  `Destination: ${fields.destinationType}${fields.projectId ? ` (${fields.projectId})` : ""}`,
@@ -1009,20 +1008,34 @@ function humanSuccess(command, data) {
1009
1008
  ].join("\n");
1010
1009
  }
1011
1010
  if (command === "doctor") return doctorHumanOutput(data);
1012
- if (command === "agent open") return agentOpenHumanOutput(data);
1011
+ if (command === "open") return openHumanOutput(data);
1012
+ if (command === "init") return initHumanOutput(data);
1013
1013
  return `${JSON.stringify(data, null, 2)}\n`;
1014
1014
  }
1015
- function agentOpenHumanOutput(data) {
1015
+ function initHumanOutput(data) {
1016
1016
  const body = `${JSON.stringify(data, null, 2)}`;
1017
- const nextCommand = agentOpenNextCommand(data);
1017
+ const nextCommand = initNextCommand(data);
1018
1018
  if (!nextCommand) return `${body}\n`;
1019
1019
  return `${body}\nNext command: ${nextCommand}\n`;
1020
1020
  }
1021
- function agentOpenNextCommand(data) {
1022
- if (!isAgentOpenData(data)) return null;
1021
+ function initNextCommand(data) {
1022
+ if (!isRecord(data) || data.mode !== "onboarding") return null;
1023
+ const steps = data.next_steps;
1024
+ if (!Array.isArray(steps)) return null;
1025
+ const pending = steps.find((step) => isRecord(step) && step.done !== true && typeof step.command === "string");
1026
+ return isRecord(pending) && typeof pending.command === "string" ? pending.command : null;
1027
+ }
1028
+ function openHumanOutput(data) {
1029
+ const body = `${JSON.stringify(data, null, 2)}`;
1030
+ const nextCommand = openNextCommand(data);
1031
+ if (!nextCommand) return `${body}\n`;
1032
+ return `${body}\nNext command: ${nextCommand}\n`;
1033
+ }
1034
+ function openNextCommand(data) {
1035
+ if (!isOpenData(data)) return null;
1023
1036
  return data.open.kind === "download_required" ? data.open.next_command : null;
1024
1037
  }
1025
- function isAgentOpenData(data) {
1038
+ function isOpenData(data) {
1026
1039
  if (!isRecord(data)) return false;
1027
1040
  const open = data.open;
1028
1041
  if (!isRecord(open)) return false;
@@ -1039,7 +1052,7 @@ function doctorNextCommand(data) {
1039
1052
  if (!isRecord(data) || !("next_command" in data)) return null;
1040
1053
  return typeof data.next_command === "string" ? data.next_command : null;
1041
1054
  }
1042
- function publishSuccessFields(data) {
1055
+ function shareSuccessFields(data) {
1043
1056
  if (!isRecord(data)) return null;
1044
1057
  const artifact = data.artifact;
1045
1058
  const destination = data.destination;
@@ -1220,8 +1233,8 @@ function resolveDestination(options, config) {
1220
1233
  if (containerId) return { containerId };
1221
1234
  return { error: cliError({
1222
1235
  code: "destination_required",
1223
- message: "A publish destination is required.",
1224
- why: "Non-interactive publish never guesses a project or home destination.",
1236
+ message: "A share destination is required.",
1237
+ why: "Non-interactive share never guesses a project or home destination.",
1225
1238
  hint: "Retry with --project-id <id>, configure .artifactshare/config.local.json, or pass --home.",
1226
1239
  agentRecoverable: true,
1227
1240
  requiresHuman: false,
@@ -1933,7 +1946,7 @@ function whoamiProfile(body) {
1933
1946
  //#endregion
1934
1947
  //#region src/command-runners/auto-login.ts
1935
1948
  const JSON_PENDING_AUTH_COMMANDS = new Set([
1936
- "publish",
1949
+ "share",
1937
1950
  "update",
1938
1951
  "download",
1939
1952
  "artifacts get"
@@ -2437,9 +2450,9 @@ async function runSkillsRemove(parsed, mode) {
2437
2450
  await runActions(command, planned, parsed.options.dryRun === true, mode);
2438
2451
  }
2439
2452
  //#endregion
2440
- //#region src/command-runners/agent.ts
2441
- async function runAgentOpen(parsed, mode) {
2442
- const command = "agent open";
2453
+ //#region src/command-runners/open.ts
2454
+ async function runOpen(parsed, mode) {
2455
+ const command = "open";
2443
2456
  const skills = await ensureSkills({
2444
2457
  ...parsed,
2445
2458
  options: {
@@ -2833,7 +2846,7 @@ async function prepareUploadPayload(targetPath, fileStat, initialForm = new Form
2833
2846
  if (error instanceof CollectDirectoryFilesError) return { error: validationError(error.message, error.hint) };
2834
2847
  throw error;
2835
2848
  }
2836
- if (files.length === 0) return { error: validationError("Directory has no publishable files.", "Add index.html or index.md and retry.") };
2849
+ if (files.length === 0) return { error: validationError("Directory has no shareable files.", "Add index.html or index.md and retry.") };
2837
2850
  for (const file of files) initialForm.append("file", await blobFor(file.path), file.relativePath);
2838
2851
  return { payload: {
2839
2852
  form: initialForm,
@@ -2942,7 +2955,7 @@ async function collectDirectoryFiles(root) {
2942
2955
  for (const entry of await readdir(dir, { withFileTypes: true })) {
2943
2956
  if (entry.name === "__MACOSX") continue;
2944
2957
  const fullPath = join(dir, entry.name);
2945
- if (entry.isSymbolicLink()) throw new CollectDirectoryFilesError("Directory contains a symbolic link.", "Remove or replace symlinked files and directories before publishing.");
2958
+ if (entry.isSymbolicLink()) throw new CollectDirectoryFilesError("Directory contains a symbolic link.", "Remove or replace symlinked files and directories before sharing.");
2946
2959
  if (entry.isDirectory()) {
2947
2960
  if (EXCLUDED_DIR_NAMES.has(entry.name) || entry.name.startsWith(".")) continue;
2948
2961
  await visit(fullPath);
@@ -3235,12 +3248,48 @@ function gitPattern(path) {
3235
3248
  }
3236
3249
  //#endregion
3237
3250
  //#region src/command-runners/init.ts
3238
- async function runInit(parsed, mode) {
3239
- const command = "init";
3251
+ function runInit(parsed, mode) {
3240
3252
  const profile = nonEmpty(parsed.options.profile);
3241
3253
  const projectId = nonEmpty(parsed.options.projectId);
3254
+ if (!profile && !projectId) return runInitOnboarding(parsed, mode);
3255
+ return runInitConfig(parsed, mode, profile, projectId);
3256
+ }
3257
+ async function runInitOnboarding(parsed, mode) {
3258
+ const command = "init";
3259
+ const skills = await ensureSkills({
3260
+ ...parsed,
3261
+ options: {
3262
+ ...parsed.options,
3263
+ tool: "auto",
3264
+ scope: "project"
3265
+ }
3266
+ }, mode, { command });
3267
+ if (!skills) return;
3268
+ const project = await resolveProjectConfig();
3269
+ const signedIn = (await resolveCredential(parsed.options, project)).ok;
3270
+ return writeSuccess(command, {
3271
+ mode: "onboarding",
3272
+ skills,
3273
+ signed_in: signedIn,
3274
+ next_steps: onboardingNextSteps(signedIn)
3275
+ }, mode);
3276
+ }
3277
+ function onboardingNextSteps(signedIn) {
3278
+ return [{
3279
+ id: "login",
3280
+ title: signedIn ? "Already signed in." : "Sign in so you can share files.",
3281
+ command: `${CLI_INVOCATION} login`,
3282
+ done: signedIn
3283
+ }, {
3284
+ id: "share",
3285
+ title: "Share a file or folder to get a link.",
3286
+ command: `${CLI_INVOCATION} share <path> --json`
3287
+ }];
3288
+ }
3289
+ async function runInitConfig(parsed, mode, profile, projectId) {
3290
+ const command = "init";
3291
+ if (parsed.options.dryRun === true) return writeFailure(command, validationError("--dry-run is only supported without --profile or --project-id.", "Run init --dry-run by itself to preview the skill install, or drop --dry-run to save the defaults."), mode, 1);
3242
3292
  const resolved = await resolveProjectConfig();
3243
- if (!profile && !projectId) return writeSuccess(command, initData(false, resolved.raw ?? {}, resolved), mode);
3244
3293
  if (profile) {
3245
3294
  if (!configHome()) return writeFailure(command, tokenStoreUnavailableError(profile), mode, 1);
3246
3295
  const globalConfig = await readGlobalConfig();
@@ -3255,16 +3304,17 @@ async function runInit(parsed, mode) {
3255
3304
  await mkdir(dirname(path), { recursive: true });
3256
3305
  await writeFile(path, `${JSON.stringify(next, null, 2)}\n`);
3257
3306
  const gitExclude = await ensureGitExclude(process.cwd());
3258
- const data = initData(true, next, resolved);
3307
+ const data = configData(next, resolved);
3259
3308
  delete data.read_path;
3260
3309
  if (gitExclude.warning) data.git_exclude_warning = gitExclude.warning;
3261
3310
  if (gitExclude.applied) data.git_exclude_applied = true;
3262
3311
  return writeSuccess(command, data, mode);
3263
3312
  }
3264
- function initData(written, config, resolved) {
3313
+ function configData(config, resolved) {
3265
3314
  return {
3315
+ mode: "config",
3266
3316
  path: PROJECT_CONFIG_LOCAL_PATH,
3267
- written,
3317
+ written: true,
3268
3318
  config: {
3269
3319
  default_profile: configString(config.default_profile),
3270
3320
  default_project_id: configString(config.default_project_id)
@@ -3455,7 +3505,7 @@ async function runProjectsList(parsed, mode) {
3455
3505
  default_project_id: defaultProjectId,
3456
3506
  projects
3457
3507
  }, mode);
3458
- if (!mode.json && projects.length === 0) writeText("No projects yet. Create one on the web, then publish with --project-id.\n");
3508
+ if (!mode.json && projects.length === 0) writeText("No projects yet. Create one on the web, then share with --project-id.\n");
3459
3509
  }
3460
3510
  async function runProjectsCreate(parsed, mode) {
3461
3511
  const command = "projects create";
@@ -3487,7 +3537,7 @@ async function runProjectsCreate(parsed, mode) {
3487
3537
  description: configString(project?.description),
3488
3538
  base_visibility: configString(project?.base_visibility)
3489
3539
  },
3490
- next_command: `npx --yes @artifactshare/cli publish <path> --project-id ${id} --json`
3540
+ next_command: `npx --yes @artifactshare/cli share <path> --project-id ${id} --json`
3491
3541
  }, mode);
3492
3542
  }
3493
3543
  async function runProjectsEdit(parsed, mode) {
@@ -3576,20 +3626,20 @@ function parseProjectsEditData(body) {
3576
3626
  };
3577
3627
  }
3578
3628
  //#endregion
3579
- //#region src/command-runners/publish.ts
3580
- const MAX_PUBLISH_KEY_LENGTH = 128;
3581
- async function runPublish(parsed, mode, isRetry = false) {
3582
- const command = "publish";
3629
+ //#region src/command-runners/share.ts
3630
+ const MAX_SHARE_KEY_LENGTH = 128;
3631
+ async function runShare(parsed, mode, isRetry = false) {
3632
+ const command = "share";
3583
3633
  const targetPath = parsed.positionals[0];
3584
- if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to publish."), mode, 1);
3585
- let publishKey = null;
3634
+ if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to share."), mode, 1);
3635
+ let shareKey = null;
3586
3636
  if ("key" in parsed.options) {
3587
- publishKey = (typeof parsed.options.key === "string" ? parsed.options.key : "").trim();
3588
- if (publishKey.length === 0 || publishKey.length > MAX_PUBLISH_KEY_LENGTH) return writeFailure(command, validationError(`--key must be 1-${MAX_PUBLISH_KEY_LENGTH} characters after trimming.`, "Pass a short stable identifier, like a job name or PR number."), mode, 1);
3637
+ shareKey = (typeof parsed.options.key === "string" ? parsed.options.key : "").trim();
3638
+ if (shareKey.length === 0 || shareKey.length > MAX_SHARE_KEY_LENGTH) return writeFailure(command, validationError(`--key must be 1-${MAX_SHARE_KEY_LENGTH} characters after trimming.`, "Pass a short stable identifier, like a job name or PR number."), mode, 1);
3589
3639
  }
3590
3640
  const project = await resolveProjectConfig();
3591
3641
  const credential = await resolveCredential(parsed.options, project);
3592
- if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () => runPublish(parsed, mode, true), isRetry);
3642
+ if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
3593
3643
  const baseUrl = baseUrlOf(parsed.options);
3594
3644
  const hasProjectFlag = "project" in parsed.options;
3595
3645
  let destinationOptions = parsed.options;
@@ -3614,7 +3664,7 @@ async function runPublish(parsed, mode, isRetry = false) {
3614
3664
  credentialSource: credential.source,
3615
3665
  profile: credential.profile
3616
3666
  });
3617
- if (resolved.error) return handleAuthenticatedCredentialFailure(command, resolved.error, credential, parsed.options, mode, () => runPublish(parsed, mode, true), isRetry);
3667
+ if (resolved.error) return handleAuthenticatedCredentialFailure(command, resolved.error, credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
3618
3668
  const { project: _project, ...rest } = parsed.options;
3619
3669
  destinationOptions = {
3620
3670
  ...rest,
@@ -3630,7 +3680,7 @@ async function runPublish(parsed, mode, isRetry = false) {
3630
3680
  for (const email of grantEmails) initialForm.append("grant_email", email);
3631
3681
  if (destination.containerId) initialForm.set("container_id", destination.containerId);
3632
3682
  const uploadUrl = apiUrl("/api/shareables/uploads", baseUrl);
3633
- if (publishKey !== null) uploadUrl.searchParams.set("publish_key", publishKey);
3683
+ if (shareKey !== null) uploadUrl.searchParams.set("publish_key", shareKey);
3634
3684
  const upload = await prepareUploadPayload(targetPath, fileStat, initialForm);
3635
3685
  if (upload.error) return writeFailure(command, upload.error, mode, 1);
3636
3686
  if (upload.payload.kind === "static_site") {
@@ -3650,7 +3700,7 @@ async function runPublish(parsed, mode, isRetry = false) {
3650
3700
  baseUrl,
3651
3701
  credentialSource: credential.source,
3652
3702
  profile: credential.profile
3653
- }), credential, parsed.options, mode, () => runPublish(parsed, mode, true), isRetry);
3703
+ }), credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
3654
3704
  const id = body?.id ?? null;
3655
3705
  return writeSuccess(command, {
3656
3706
  artifact: {
@@ -3660,7 +3710,7 @@ async function runPublish(parsed, mode, isRetry = false) {
3660
3710
  },
3661
3711
  version: { id: body?.versionId ?? null },
3662
3712
  result: { created: body?.created ?? true },
3663
- ...publishKey !== null ? { key: publishKey } : {},
3713
+ ...shareKey !== null ? { key: shareKey } : {},
3664
3714
  destination: destination.containerId ? {
3665
3715
  type: "project",
3666
3716
  project_id: destination.containerId
@@ -3812,9 +3862,9 @@ async function runWhoami(parsed, mode) {
3812
3862
  }
3813
3863
  //#endregion
3814
3864
  //#region src/commands.ts
3815
- async function publishRunner(ctx) {
3816
- const parsed = parsedArgsFromContext("publish", ctx);
3817
- return await runPublish(parsed, outputMode(parsed.options));
3865
+ async function shareRunner(ctx) {
3866
+ const parsed = parsedArgsFromContext("share", ctx);
3867
+ return await runShare(parsed, outputMode(parsed.options));
3818
3868
  }
3819
3869
  async function loginRunner(ctx) {
3820
3870
  const parsed = parsedArgsFromContext("login", ctx);
@@ -3840,9 +3890,9 @@ async function downloadRunner(ctx) {
3840
3890
  const parsed = parsedArgsFromContext("download", ctx);
3841
3891
  return await runDownload(parsed, outputMode(parsed.options));
3842
3892
  }
3843
- async function agentOpenRunner(ctx) {
3844
- const parsed = parsedArgsFromContext("agent open", ctx);
3845
- return await runAgentOpen(parsed, outputMode(parsed.options));
3893
+ async function openRunner(ctx) {
3894
+ const parsed = parsedArgsFromContext("open", ctx);
3895
+ return await runOpen(parsed, outputMode(parsed.options));
3846
3896
  }
3847
3897
  async function moveRunner(ctx) {
3848
3898
  const parsed = parsedArgsFromContext("move", ctx);
@@ -3988,13 +4038,13 @@ async function runGunshi(argv) {
3988
4038
  version: await loadCliVersion(),
3989
4039
  subCommands: {
3990
4040
  login: lazyCommand(loginDefinition, loginRunner),
3991
- publish: lazyCommand(publishDefinition, publishRunner),
4041
+ share: lazyCommand(shareDefinition, shareRunner),
4042
+ open: lazyCommand(openDefinition, openRunner),
3992
4043
  update: lazyCommand(updateDefinition, updateRunner),
3993
4044
  edit: lazyCommand(editDefinition, editRunner),
3994
4045
  delete: lazyCommand(deleteDefinition, deleteRunner),
3995
4046
  resolve: lazyCommand(resolveDefinition, resolveRunner),
3996
4047
  download: lazyCommand(downloadDefinition, downloadRunner),
3997
- agent: agentDefinition,
3998
4048
  move: lazyCommand(moveDefinition, moveRunner),
3999
4049
  artifacts: artifactsDefinition,
4000
4050
  comments: commentsDefinition,
@@ -4051,7 +4101,9 @@ const entryCommand = define({
4051
4101
  description: "Artifact Share CLI",
4052
4102
  toKebab: true,
4053
4103
  args: commonArgs,
4054
- examples: `npx --yes @artifactshare/cli publish <path> --project-id <id> --json
4104
+ examples: `npx --yes @artifactshare/cli init --json
4105
+ npx --yes @artifactshare/cli open <artifact-id-or-url> --json
4106
+ npx --yes @artifactshare/cli share <path> --json
4055
4107
  npx --yes @artifactshare/cli update <artifact-id-or-url> <path> --json
4056
4108
  npx --yes @artifactshare/cli edit <artifact-id-or-url> --title "New title" --json
4057
4109
  npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
@@ -4071,7 +4123,7 @@ npx --yes @artifactshare/cli projects list --json
4071
4123
  npx --yes @artifactshare/cli skills install --tool codex --json
4072
4124
  npx --yes @artifactshare/cli skills list --json
4073
4125
  npx --yes @artifactshare/cli init --profile <name> --project-id <id> --json
4074
- npx --yes @artifactshare/cli publish <path> --home --json
4126
+ npx --yes @artifactshare/cli share <path> --home --json
4075
4127
  npx --yes @artifactshare/cli request-access --json
4076
4128
  npx --yes @artifactshare/cli whoami --json
4077
4129
  npx --yes @artifactshare/cli doctor --json
@@ -4104,30 +4156,30 @@ Common failures:
4104
4156
  auth_expired The device code expired before approval
4105
4157
  token_store_unavailable Configure an OS credential store or use the explicit plaintext fallback`
4106
4158
  });
4107
- const publishDefinition = define({
4108
- name: "publish",
4109
- description: "Publish a file or directory.",
4159
+ const shareDefinition = define({
4160
+ name: "share",
4161
+ description: "Share a file or directory.",
4110
4162
  toKebab: true,
4111
4163
  args: {
4112
4164
  ...commonArgs,
4113
4165
  path: {
4114
4166
  type: "positional",
4115
- description: "File or directory to publish"
4167
+ description: "File or directory to share"
4116
4168
  },
4117
4169
  projectId: {
4118
4170
  type: "string",
4119
4171
  toKebab: true,
4120
- description: "Publish into a project"
4172
+ description: "Share into a project"
4121
4173
  },
4122
4174
  project: {
4123
4175
  type: "string",
4124
4176
  toKebab: true,
4125
- description: "Publish into a project by exact name"
4177
+ description: "Share into a project by exact name"
4126
4178
  },
4127
4179
  home: {
4128
4180
  type: "boolean",
4129
4181
  toKebab: true,
4130
- description: "Publish to home instead of a project"
4182
+ description: "Share to home instead of a project"
4131
4183
  },
4132
4184
  visibility: {
4133
4185
  type: "string",
@@ -4143,21 +4195,21 @@ const publishDefinition = define({
4143
4195
  key: {
4144
4196
  type: "string",
4145
4197
  toKebab: true,
4146
- description: "Stable key for create-or-update: the first publish creates the artifact, repeats add versions. Not a secret; it appears in logs and JSON"
4198
+ description: "Stable key for create-or-update: the first share creates the artifact, repeats add versions. Not a secret; it appears in logs and JSON"
4147
4199
  }
4148
4200
  },
4149
- examples: `npx --yes @artifactshare/cli publish report.html --project-id <id> --json
4150
- npx --yes @artifactshare/cli publish report.html --project-id <id> --key nightly-report --json
4201
+ examples: `npx --yes @artifactshare/cli share report.html --project-id <id> --json
4202
+ npx --yes @artifactshare/cli share report.html --project-id <id> --key nightly-report --json
4151
4203
 
4152
4204
  To keep an existing share URL, use update:
4153
4205
  npx --yes @artifactshare/cli update <artifact-id-or-url> <path> --json
4154
4206
 
4155
- For repeat jobs, use --key: first publish creates the artifact, later runs add versions.
4207
+ For repeat jobs, use --key: first share creates the artifact, later runs add versions.
4156
4208
 
4157
4209
  Common failures:
4158
- auth_required Set ARTIFACTSHARE_TOKEN before publish
4159
- destination_required Non-interactive publish needs --project-id, config default, or --home
4160
- upload_not_allowed Your account cannot publish yet; request access from an operator
4210
+ auth_required Set ARTIFACTSHARE_TOKEN before share
4211
+ destination_required Non-interactive share needs --project-id, config default, or --home
4212
+ upload_not_allowed Your account cannot share yet; request access from an operator
4161
4213
  file_too_large Reduce file or directory size and retry
4162
4214
  validation_failed Check file type (.html / .md for single files) and directory layout
4163
4215
  key_target_moved The artifact for --key moved; update it by ID or use a new key
@@ -4187,7 +4239,7 @@ Common failures:
4187
4239
  auth_required Set ARTIFACTSHARE_TOKEN before update
4188
4240
  target_not_found Retry with an artifact ID, share URL, or sandbox URL
4189
4241
  artifact_kind_mismatch Use a file for single-file artifacts or a directory for static sites
4190
- upload_not_allowed Your account cannot publish yet; request access from an operator
4242
+ upload_not_allowed Your account cannot share yet; request access from an operator
4191
4243
  file_too_large Reduce file or directory size and retry
4192
4244
  validation_failed Check file type (.html / .md for single files) and directory layout`
4193
4245
  });
@@ -4241,7 +4293,7 @@ const editDefinition = define({
4241
4293
  npx --yes @artifactshare/cli edit abc123def4 --home --json
4242
4294
 
4243
4295
  Edit changes artifact settings without adding a new version. Use update to replace content.
4244
- Move remains available for placement-only automation; edit is the main command for post-publish settings.
4296
+ Move remains available for placement-only automation; edit is the main command for post-share settings.
4245
4297
 
4246
4298
  Common failures:
4247
4299
  auth_required Set ARTIFACTSHARE_TOKEN before edit
@@ -4253,7 +4305,7 @@ Common failures:
4253
4305
  });
4254
4306
  const deleteDefinition = define({
4255
4307
  name: "delete",
4256
- description: "Permanently delete an artifact you published.",
4308
+ description: "Permanently delete an artifact you shared.",
4257
4309
  toKebab: true,
4258
4310
  args: {
4259
4311
  ...commonArgs,
@@ -4330,38 +4382,30 @@ Common failures:
4330
4382
  output_exists Choose another --output path or pass --force
4331
4383
  validation_failed Check --output and downloaded file paths`
4332
4384
  });
4333
- const agentDefinition = define({
4334
- name: "agent",
4335
- description: "Agent-first helpers for Artifact Share URLs.",
4385
+ const openDefinition = define({
4386
+ name: "open",
4387
+ description: "Prepare agent skills and read an Artifact Share URL.",
4336
4388
  toKebab: true,
4337
- args: commonArgs,
4338
- subCommands: { open: lazyCommand(define({
4339
- name: "open",
4340
- description: "Prepare agent skills and read an Artifact Share URL.",
4341
- toKebab: true,
4342
- args: {
4343
- ...commonArgs,
4344
- artifactIdOrUrl: {
4345
- type: "positional",
4346
- toKebab: true,
4347
- description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
4348
- }
4349
- },
4350
- examples: `npx --yes @artifactshare/cli agent open https://artifactshare.com/a/abc123def4 --json
4351
- npx --yes @artifactshare/cli agent open abc123def4 --json
4389
+ args: {
4390
+ ...commonArgs,
4391
+ artifactIdOrUrl: {
4392
+ type: "positional",
4393
+ toKebab: true,
4394
+ description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
4395
+ }
4396
+ },
4397
+ examples: `npx --yes @artifactshare/cli open https://artifactshare.com/a/abc123def4 --json
4398
+ npx --yes @artifactshare/cli open abc123def4 --json
4352
4399
 
4353
4400
  Use this as the first command when an agent receives an Artifact Share URL.
4354
4401
  It installs or updates the local Artifact Share skill, then reads single-file artifacts.
4355
4402
  For static sites or multi-file artifacts, the JSON includes a download next_command.
4356
4403
 
4357
4404
  Common failures:
4358
- auth_required Set ARTIFACTSHARE_TOKEN before agent open
4405
+ auth_required Set ARTIFACTSHARE_TOKEN before open
4359
4406
  skill_update_conflict Inspect the file or run skills install --tool <tool> --force
4360
4407
  target_not_found Retry with an artifact ID, share URL, or sandbox URL
4361
4408
  validation_failed Pass a non-empty artifact ID or URL`
4362
- }), agentOpenRunner) },
4363
- examples: `npx --yes @artifactshare/cli agent open https://artifactshare.com/a/abc123def4 --json`,
4364
- run: parentCommandRunner("agent")
4365
4409
  });
4366
4410
  const moveDefinition = define({
4367
4411
  name: "move",
@@ -4442,7 +4486,7 @@ const artifactsDefinition = define({
4442
4486
  subCommands: {
4443
4487
  list: lazyCommand(define({
4444
4488
  name: "list",
4445
- description: "List artifacts you published, newest first.",
4489
+ description: "List artifacts you shared, newest first.",
4446
4490
  toKebab: true,
4447
4491
  args: {
4448
4492
  ...commonArgs,
@@ -4728,17 +4772,17 @@ printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --prof
4728
4772
  });
4729
4773
  const projectsListDefinition = define({
4730
4774
  name: "list",
4731
- description: "List projects you can publish into.",
4775
+ description: "List projects you can share into.",
4732
4776
  toKebab: true,
4733
4777
  args: commonArgs,
4734
4778
  examples: `npx --yes @artifactshare/cli projects list --json
4735
4779
 
4736
4780
  is_default marks the working-directory default project from .artifactshare/config.json.
4737
- Use a project id with publish --project-id or init --project-id.`
4781
+ Use a project id with share --project-id or init --project-id.`
4738
4782
  });
4739
4783
  const projectsCreateDefinition = define({
4740
4784
  name: "create",
4741
- description: "Create a project you can publish into.",
4785
+ description: "Create a project you can share into.",
4742
4786
  toKebab: true,
4743
4787
  args: {
4744
4788
  ...commonArgs,
@@ -4760,11 +4804,11 @@ const projectsCreateDefinition = define({
4760
4804
  examples: `npx --yes @artifactshare/cli projects create "Launch review" --json
4761
4805
  npx --yes @artifactshare/cli projects create "Client" --description "Weekly reports" --visibility private --json
4762
4806
 
4763
- The response includes project.id and next_command for publish --project-id.
4807
+ The response includes project.id and next_command for share --project-id.
4764
4808
 
4765
4809
  Common failures:
4766
4810
  auth_required Set ARTIFACTSHARE_TOKEN before projects create
4767
- upload_not_allowed Your account cannot publish yet; request access from an operator
4811
+ upload_not_allowed Your account cannot share yet; request access from an operator
4768
4812
  validation_failed Pass a non-empty name and valid --visibility`
4769
4813
  });
4770
4814
  const projectsEditDefinition = define({
@@ -4829,7 +4873,7 @@ Common failures:
4829
4873
  });
4830
4874
  const projectsDefinition = define({
4831
4875
  name: "projects",
4832
- description: "Create, find, and edit publish destinations.",
4876
+ description: "Create, find, and edit share destinations.",
4833
4877
  toKebab: true,
4834
4878
  args: commonArgs,
4835
4879
  subCommands: {
@@ -4970,28 +5014,37 @@ npx --yes @artifactshare/cli skills list --json`,
4970
5014
  });
4971
5015
  const initDefinition = define({
4972
5016
  name: "init",
4973
- description: "Save working-directory defaults to .artifactshare/config.json.",
5017
+ description: "Set up Artifact Share for this directory, or save its defaults.",
4974
5018
  toKebab: true,
4975
5019
  args: {
4976
5020
  ...commonArgs,
4977
5021
  projectId: {
4978
5022
  type: "string",
4979
5023
  toKebab: true,
4980
- description: "Default project for publish in this directory"
5024
+ description: "Default project for sharing in this directory"
5025
+ },
5026
+ dryRun: {
5027
+ type: "boolean",
5028
+ toKebab: true,
5029
+ description: "Show the planned skill changes without writing (onboarding)"
4981
5030
  }
4982
5031
  },
4983
- examples: `npx --yes @artifactshare/cli init --profile client-a --project-id <id> --json
4984
- npx --yes @artifactshare/cli init --json
5032
+ examples: `npx --yes @artifactshare/cli init --json
5033
+ npx --yes @artifactshare/cli init --dry-run --json
5034
+ npx --yes @artifactshare/cli init --profile client-a --project-id <id> --json
4985
5035
 
4986
- Without flags, init reports the current config and writes nothing.
4987
- Secrets are never written to .artifactshare/config.json.
5036
+ Without flags, init detects your agent (Claude Code, Codex, Cursor), installs the
5037
+ bundled skill, and shows the next steps (sign in, then share). data.mode is "onboarding".
5038
+ With --profile or --project-id, init saves working-directory defaults to
5039
+ .artifactshare/config.local.json instead (data.mode is "config"); secrets are never written there.
4988
5040
 
4989
5041
  Common failures:
4990
- profile_not_found Run profiles list to see saved profiles, or login --profile <name>`
5042
+ skill_update_conflict An unmanaged or broken skill file exists; inspect it before overwriting
5043
+ profile_not_found Run profiles list to see saved profiles, or login --profile <name>`
4991
5044
  });
4992
5045
  const requestAccessDefinition = define({
4993
5046
  name: "request-access",
4994
- description: "Join the early-access waitlist for publishing.",
5047
+ description: "Join the early-access waitlist for sharing.",
4995
5048
  toKebab: true,
4996
5049
  args: {
4997
5050
  ...commonArgs,
@@ -5002,9 +5055,9 @@ const requestAccessDefinition = define({
5002
5055
  }
5003
5056
  },
5004
5057
  examples: `npx --yes @artifactshare/cli request-access --json
5005
- npx --yes @artifactshare/cli request-access --note "Publishing weekly reports for my team" --json
5058
+ npx --yes @artifactshare/cli request-access --note "Sharing weekly reports for my team" --json
5006
5059
 
5007
- Joining the waitlist does not enable publishing immediately; an operator opens it.
5060
+ Joining the waitlist does not enable sharing immediately; an operator opens it.
5008
5061
  Re-running updates your note without creating a duplicate entry.
5009
5062
 
5010
5063
  Common failures:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.1.8",
3
+ "version": "0.3.0",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "license": "Apache-2.0",
@@ -11,7 +11,6 @@
11
11
  "share",
12
12
  "static-site",
13
13
  "automation",
14
- "publish",
15
14
  "ai-agents"
16
15
  ],
17
16
  "type": "module",
@@ -1,22 +1,28 @@
1
1
  ---
2
2
  name: artifactshare
3
- description: Publish, update, and read back shared files with the Artifact Share CLI. Use when the user asks to share an HTML/Markdown report, a static site, or other generated file, or to read back or comment on a shared file.
3
+ description: Open, share, update, and read back shared files with the Artifact Share CLI. Use when the user asks to open an Artifact Share URL, share an HTML/Markdown report, a static site, or other generated file, or to read back or comment on a shared file.
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 14
7
+ version: 16
8
8
  managed: true
9
9
  -->
10
10
 
11
11
  # Artifact Share CLI
12
12
 
13
13
  Artifact Share hosts shared files (HTML pages, Markdown documents, static
14
- sites) with versions and comments. The CLI publishes from the terminal and is
15
- designed for agents: every command supports `--json` with a stable contract.
14
+ sites) with versions and comments. The CLI opens shared URLs, shares local
15
+ files and folders, and is designed for agents: every command supports `--json`
16
+ with a stable contract.
16
17
 
17
18
  Run commands with `npx --yes @artifactshare/cli`. When unsure about a
18
19
  command or flag, read `npx --yes @artifactshare/cli --help` first.
19
20
 
21
+ First-time setup in a project: `npx --yes @artifactshare/cli init` detects the
22
+ agent (Claude Code, Codex, Cursor), installs or updates this skill, and reports
23
+ the next steps (sign in, then share). When you receive a share URL instead,
24
+ start with `open <artifact-id-or-url> --json`.
25
+
20
26
  Use the CLI whenever the file already exists locally as a file or folder.
21
27
  The remote MCP tools accept HTML or Markdown source strings; they cannot read
22
28
  paths like `/Users/.../report.html` from the user's filesystem.
@@ -27,7 +33,7 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
27
33
 
28
34
  ## Output contract
29
35
 
30
- - Always pass `--json`. Success prints `{"schema_version":1,"ok":true,"command":...,"data":...}` to stdout; failure prints `{"ok":false,"error":...}` to stderr with exit code 1.
36
+ - Always pass `--json`. Success prints `{"schema_version":2,"ok":true,"command":...,"data":...}` to stdout; failure prints `{"schema_version":2,"ok":false,"error":...}` to stderr with exit code 1.
31
37
  - On failure, read `error.code`, `error.hint`, and `error.recovery`. `recovery.kind` is one of `change_input`, `run_command`, `retry_later`, `ask_human`, `report_issue`. When `error.requires_human` is true, report to the user instead of retrying.
32
38
 
33
39
  ## Authentication
@@ -46,13 +52,13 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
46
52
 
47
53
  ## Choosing the destination
48
54
 
49
- 1. `projects list --json` shows the projects this account can publish into; `is_default` marks the working-directory default.
50
- 2. `projects create <name> --json` creates a project and returns `project.id` plus a `next_command` using `publish --project-id <id>`.
55
+ 1. `projects list --json` shows the projects this account can share into; `is_default` marks the working-directory default.
56
+ 2. `projects create <name> --json` creates a project and returns `project.id` plus a `next_command` using `share --project-id <id>`.
51
57
  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.
52
58
  4. `init --project-id <id> --json` saves a default project for the working directory.
53
- 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`.
59
+ 5. `share` 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`.
54
60
  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.
55
- 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.
61
+ 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-share settings.
56
62
 
57
63
  `edit` changes settings without adding a new version. Moving a `project`
58
64
  visibility artifact home makes it `private`, because home has no project
@@ -62,9 +68,9 @@ automation, but prefer `edit` for new flows.
62
68
  ## Core commands
63
69
 
64
70
  ```bash
65
- npx --yes @artifactshare/cli agent open <artifact-id-or-url> --json
66
- npx --yes @artifactshare/cli publish ./report.html --json
67
- npx --yes @artifactshare/cli publish ./site-dir --project-id <id> --json
71
+ npx --yes @artifactshare/cli open <artifact-id-or-url> --json
72
+ npx --yes @artifactshare/cli share ./report.html --json
73
+ npx --yes @artifactshare/cli share ./site-dir --project-id <id> --json
68
74
  npx --yes @artifactshare/cli projects create 'Client reports' --json
69
75
  npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
70
76
  npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
@@ -82,14 +88,14 @@ npx --yes @artifactshare/cli comments reopen <artifact-id-or-url> --thread-id <t
82
88
  npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <thread-id> --message-id <message-id> --json
83
89
  ```
84
90
 
85
- - When the user gives an Artifact Share URL, start with `agent open <artifact-id-or-url> --json`. It ensures this skill is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
86
- - `publish` accepts a single `.html` / `.md` file or a static-site directory. The returned `share_url` is the link to give the user.
87
- - To keep an existing share URL, do not run `publish --artifact-id`; run `update <artifact-id-or-url> <path> --json` instead.
88
- - For repeat jobs where the caller can choose a stable name, use `publish <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
91
+ - When the user gives an Artifact Share URL, start with `open <artifact-id-or-url> --json`. It ensures this skill is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
92
+ - `share` accepts a single `.html` / `.md` file or a static-site directory. The returned `share_url` is the link to give the user.
93
+ - To keep an existing share URL, do not run `share --artifact-id`; run `update <artifact-id-or-url> <path> --json` instead.
94
+ - For repeat jobs where the caller can choose a stable name, use `share <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
89
95
  - `update` adds a new version to an existing file; pass the same kind of input (single file vs directory) it was created with. It does not change title, visibility, explicit viewers, or project placement.
90
- - `edit` changes the display title, visibility, explicit viewers, or project placement after publishing.
96
+ - `edit` changes the display title, visibility, explicit viewers, or project placement after sharing.
91
97
  - `projects edit` changes a project name, description, sharing scope, audience, or archive state. Use IDs from `projects list --json`.
92
- - `delete` permanently removes an artifact you published, including its version history. Use it only when the user explicitly asks to delete.
98
+ - `delete` permanently removes an artifact you shared, including its version history. Use it only when the user explicitly asks to delete.
93
99
  - 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>`.
94
100
  - 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.
95
101
  - When the user gives a title, project name, or URL instead of an ID, run `resolve <value> --json` first and use the returned ID.
@@ -97,7 +103,7 @@ npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <t
97
103
 
98
104
  ## Upload access
99
105
 
100
- If `publish` or `update` fails with `upload_not_allowed`, run
106
+ If `share` or `update` fails with `upload_not_allowed`, run
101
107
  `request-access --note '<why>' --json` to join the waitlist, then tell the
102
- user that publishing stays closed until an operator opens it. Do not retry
103
- publish in a loop.
108
+ user that sharing stays closed until an operator opens it. Do not retry
109
+ share in a loop.
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: Use the Artifact Share CLI to publish, update, and read back shared files.
2
+ description: Use the Artifact Share CLI to open, share, update, and read back shared files.
3
3
  alwaysApply: false
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 14
7
+ version: 16
8
8
  managed: true
9
9
  -->
10
10
 
@@ -12,9 +12,13 @@ managed: true
12
12
 
13
13
  Artifact Share hosts shared files (HTML pages, Markdown documents, static
14
14
  sites) with versions and comments. Use `npx --yes @artifactshare/cli` to
15
- publish from the terminal, and read
15
+ open shared URLs and share local files from the terminal, and read
16
16
  `npx --yes @artifactshare/cli --help` before choosing a command.
17
17
 
18
+ First-time setup in a project: `npx --yes @artifactshare/cli init` detects the
19
+ agent (Claude Code, Codex, Cursor), installs or updates this rule, and reports
20
+ the next steps (sign in, then share).
21
+
18
22
  Use the CLI for local files and folders. The remote MCP tools accept HTML or
19
23
  Markdown source strings; they cannot read paths like `/Users/.../report.html`
20
24
  from the user's filesystem.
@@ -27,16 +31,16 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
27
31
  - 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`.
28
32
  - 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.
29
33
  - Use `login --profile <name>` only in an interactive terminal where the user can approve the browser device flow.
30
- - When the user gives an Artifact Share URL, start with `agent 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.
34
+ - 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.
31
35
  - Pick the destination with `projects list --json`, `projects create <name> --json`, `init --project-id <id>`, or `--project-id`.
32
36
  - 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`.
33
- - 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`.
37
+ - Change post-share 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`.
34
38
  - `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.
35
- - Publish with `publish <path> --json`. To keep an existing share URL, do not use `publish --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`.
36
- - For repeat jobs with a stable caller-owned name, use `publish <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
39
+ - Share with `share <path> --json`. To keep an existing share URL, do not use `share --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`.
40
+ - 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.
37
41
  - Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
38
42
  - Find recent artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`.
39
43
  - Resolve titles, project names, and URLs to IDs with `resolve <value> --json` before writing.
40
44
  - 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`.
41
45
  - Comment deletion cannot be undone. Omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
42
- - On `upload_not_allowed`, run `request-access --note '<why>' --json` and tell the user an operator opens publishing; do not retry in a loop.
46
+ - On `upload_not_allowed`, run `request-access --note '<why>' --json` and tell the user an operator opens sharing; do not retry in a loop.