@artifactshare/cli 0.20.3 → 0.21.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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to `@artifactshare/cli` are documented here.
4
4
  For user-facing announcements, see https://artifactshare.com/updates?product=cli.
5
5
 
6
+ ## 0.21.0 - 2026-10-29
7
+
8
+ - Default unspecified Home shares to private for accounts without workspace visibility, using the server-reported capability before a single upload. Preserve explicit and configured audiences, report private fallback provenance, and resolve preview defaults after sign-in.
9
+
6
10
  ## 0.20.3 - 2026-10-28
7
11
 
8
12
  - Preserve newer managed legacy Cursor rules during install, update and ensure unless force explicitly requests a downgrade, and keep doctor from recommending a combined forced update that would downgrade them.
package/README.md CHANGED
@@ -85,7 +85,7 @@ project's Slack channel must be reauthorized.
85
85
  | Command | What it does |
86
86
  | ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87
87
  | `open <target>` | First command for agents opening a share or artifactshareusercontent.com execution URL; ensures skills, then reads or suggests download |
88
- | `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
88
+ | `share <path>` | Share a file or folder; unspecified Home audiences use workspace when available, otherwise private (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
89
89
  | `update <target> <path>` | Add a new version to an existing file (ID or share URL); optional `--label` adds a version note |
90
90
  | `append <target> <path>` | Append a non-empty UTF-8 file without a separator: at Markdown source end or before `</body>` in HTML, falling back to source end |
91
91
  | `edit <target>` | Change title, sharing, link expiry, explicit viewers, or project placement |
@@ -204,7 +204,7 @@ Owners can run `edit <target> --retain-versions 24 --json` to keep the latest 24
204
204
 
205
205
  Link sharing is available on every plan; Team workspaces can turn it off. A workspace policy may allow a finite expiry from 1 to 365 days or no expiration; the initial default is 30 days and the initial maximum is no limit. Share and edit results include the confirmed `link_expires_at` UTC timestamp or `null`. If a link command fails, use `link_sharing_plan_required` as a legacy code (no plan limit applies today), `link_sharing_disabled` to ask the workspace owner or a Team owner or admin to enable the workspace setting, or `link_expiry_invalid` to correct the timestamp or choose `--no-link-expiry` when allowed. Under the default thresholds, `link_publish_rate_limited` means the service observed 20 counted files before a publication in a Free workspace less than 14 days old during its rolling 24-hour window. A file counts once for its most recent change to link visibility, or for creation with link visibility while it remains link-shared. Share with specific people. `error.recovery` indicates `retry_later`; use `error.message` and `error.hint` for when to retry. Retry the link publication later instead of retrying immediately with unchanged input.
206
206
 
207
- For the complete settings reference, `home_audience` is the canonical home key. `default_artifact_visibility` remains a compatibility alias, and `default_project_visibility` is the advanced default for `projects create`. User and repository settings are resolved with repository taking precedence, followed by user and product default `workspace`; home also checks the compatibility alias at each scope. Use `config get home_audience --scope effective --json` to confirm the resolved audience. Keyless `config get --json` returns only `home_audience`; pass an explicit key to read either other setting. These settings only affect new home posts and project creation; update, edit, Web, and MCP defaults are unchanged.
207
+ For the complete settings reference, `home_audience` is the canonical home key. `default_artifact_visibility` remains a compatibility alias, and `default_project_visibility` is the advanced default for `projects create`. User and repository settings are resolved with repository taking precedence, followed by user and the account-aware product default; home also checks the compatibility alias at each scope. Use `config get home_audience --scope effective --json` to inspect the audience policy. Home without an explicit or configured audience defaults to workspace when the account supports it, otherwise private. Explicit or configured workspace still fails when unavailable; sharing never automatically switches to link. Choose --visibility link deliberately. Config inspection is offline: value workspace with source product_default is an unresolved policy placeholder. Share and preview resolve it against the account. Older servers without workspace.visibility_available retain workspace and its existing rejection. When the server confirms the private fallback, share JSON includes `visibility_source: "product_default_private"` and `visibility_hint`. Keyless `config get --json` returns only `home_audience`; pass an explicit key to read either other setting. These settings only affect new home posts and project creation; update, edit, Web, and MCP defaults are unchanged.
208
208
 
209
209
  ## For AI agents
210
210
 
package/dist/cli.js CHANGED
@@ -201,7 +201,8 @@ const CliUserSchema = z.object({
201
201
  });
202
202
  const CliWorkspaceSchema = z.object({
203
203
  id: stringId,
204
- hosted_domain: z.string().nullable()
204
+ hosted_domain: z.string().nullable(),
205
+ visibility_available: z.boolean().optional()
205
206
  });
206
207
  const DoctorAuthoritySchema = z.object({
207
208
  preset: DeviceAuthorizationPresetSchema,
@@ -2132,6 +2133,7 @@ function humanSuccess(command, data) {
2132
2133
  `URL: ${fields.url}`,
2133
2134
  `Destination: ${fields.destinationType}${fields.projectId ? ` (${fields.projectId})` : ""}`,
2134
2135
  `Visibility: ${fields.visibility}`,
2136
+ ...fields.visibilityHint ? [`Note: ${fields.visibilityHint}`] : [],
2135
2137
  ""
2136
2138
  ].join("\n");
2137
2139
  const warnings = shareWarnings(data);
@@ -2248,6 +2250,7 @@ function shareSuccessFields(data) {
2248
2250
  artifactId: artifact.id,
2249
2251
  url: artifact.url,
2250
2252
  destinationType: destination.type,
2253
+ visibilityHint: typeof share.visibility_hint === "string" ? share.visibility_hint : null,
2251
2254
  projectId: typeof destination.project_id === "string" ? destination.project_id : null,
2252
2255
  visibility: share.visibility
2253
2256
  };
@@ -6286,6 +6289,30 @@ function mutationOriginAllowed(origin, host, fetchSite) {
6286
6289
  return origin === void 0 || host !== void 0 && origin === `http://${host}`;
6287
6290
  }
6288
6291
  //#endregion
6292
+ //#region src/home-visibility.ts
6293
+ const PRIVATE_DEFAULT_HINT = "Workspace visibility is unavailable for this account, so Home defaults to private. Choose --visibility link deliberately to share with anyone who has the link.";
6294
+ /**
6295
+ * Only the server knows workspace capability. Credential failures go back to
6296
+ * the caller's sign-in handling; any other failure, or an older server that
6297
+ * omits the field, keeps the product default, which the server still rejects
6298
+ * for personal accounts, so nothing is published more widely.
6299
+ */
6300
+ async function resolveAccountHomeVisibility(resolution, token, options, init, errorOptions) {
6301
+ if (resolution.source !== "product_default") return {
6302
+ ...resolution,
6303
+ privateDefault: false
6304
+ };
6305
+ const result = await apiGet("/api/cli/whoami", token, options, init, errorOptions).catch(() => null);
6306
+ if (result?.error?.code === "auth_required" || result?.error?.code === "token_invalid") return { error: result.error };
6307
+ const workspace = result && !result.error && isRecord$1(result.body) ? result.body.workspace : null;
6308
+ const privateDefault = isRecord$1(workspace) && workspace.visibility_available === false;
6309
+ return {
6310
+ ...resolution,
6311
+ value: privateDefault ? "private" : resolution.value,
6312
+ privateDefault
6313
+ };
6314
+ }
6315
+ //#endregion
6289
6316
  //#region src/command-runners/projects.ts
6290
6317
  async function fetchProjects(token, options, init, errorOptions = {}) {
6291
6318
  const result = await apiGet("/api/cli/projects", token, options, init, errorOptions);
@@ -6573,6 +6600,7 @@ const PREVIEW_MESSAGES = {
6573
6600
  "preview.shareDialog.destination": "Destination",
6574
6601
  "preview.shareDialog.visibility": "Visibility",
6575
6602
  "preview.shareDialog.notCarried": "Local annotations are not carried over. You can comment again after sharing.",
6603
+ "preview.shareDialog.privateDefault": "This account cannot share with everyone in a workspace, so Home defaults to “Specific people”. Choose “Anyone with the link” only when you mean to share with anyone who has the link.",
6576
6604
  "preview.shareDialog.snapshotNote": "Captured at {time}. Later changes are not included.",
6577
6605
  "preview.shareDialog.confirm": "Share",
6578
6606
  "preview.shareDialog.cancel": "Cancel",
@@ -6662,6 +6690,7 @@ const PREVIEW_MESSAGES = {
6662
6690
  "preview.shareDialog.destination": "宛先",
6663
6691
  "preview.shareDialog.visibility": "共有範囲",
6664
6692
  "preview.shareDialog.notCarried": "ローカルのコメントは共有先には引き継がれません。共有後は共有先で新しくコメントできます",
6693
+ "preview.shareDialog.privateDefault": "このアカウントでは「社内全員」に共有できないため、ホームの既定は「個別共有」です。リンクを知っている人全員に共有するときだけ、「リンクを知っている全員」を選んでください",
6665
6694
  "preview.shareDialog.snapshotNote": "{time} 時点の内容です。それ以降の変更は含まれません",
6666
6695
  "preview.shareDialog.confirm": "共有する",
6667
6696
  "preview.shareDialog.cancel": "キャンセル",
@@ -6755,7 +6784,7 @@ function createShareDialogHandler(options) {
6755
6784
  async function handleContext(handlerOptions, response) {
6756
6785
  const cliOptions = handlerOptions.cliOptions;
6757
6786
  const resolved = await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig()).catch(() => null);
6758
- const defaultVisibility = resolved && !("error" in resolved) ? resolved.value : null;
6787
+ let defaultVisibility = resolved && !("error" in resolved) ? resolved.value : null;
6759
6788
  const token = await currentToken(cliOptions);
6760
6789
  const request = requestConfig(cliOptions);
6761
6790
  if (!token.ok || request.error) return sendJson$1(response, 200, {
@@ -6764,10 +6793,20 @@ function createShareDialogHandler(options) {
6764
6793
  default_visibility: request.error ? null : defaultVisibility,
6765
6794
  file_name: handlerOptions.fileName
6766
6795
  });
6796
+ let contextToken = token.token;
6797
+ let privateDefault = false;
6767
6798
  let projectsResult = await fetchProjects(token.token, cliOptions, request.init);
6768
6799
  if (projectsResult.error?.code === "auth_required") {
6769
6800
  const refreshed = await refreshTokenOnce(cliOptions, projectsResult.error);
6770
- if (refreshed !== null) projectsResult = await fetchProjects(refreshed, cliOptions, request.init);
6801
+ if (refreshed !== null) {
6802
+ contextToken = refreshed;
6803
+ projectsResult = await fetchProjects(refreshed, cliOptions, request.init);
6804
+ }
6805
+ }
6806
+ if (resolved && !("error" in resolved)) {
6807
+ const audience = await resolveAccountHomeVisibility(resolved, contextToken, cliOptions, request.init, uploadErrorOptions(baseUrlOf(cliOptions)));
6808
+ defaultVisibility = "error" in audience ? resolved.value : audience.value;
6809
+ privateDefault = !("error" in audience) && audience.privateDefault;
6771
6810
  }
6772
6811
  sendJson$1(response, 200, {
6773
6812
  authenticated: true,
@@ -6776,6 +6815,7 @@ function createShareDialogHandler(options) {
6776
6815
  name: project.name ?? project.id
6777
6816
  })),
6778
6817
  default_visibility: defaultVisibility,
6818
+ private_default: privateDefault,
6779
6819
  file_name: handlerOptions.fileName
6780
6820
  });
6781
6821
  }
@@ -6893,7 +6933,8 @@ function createShareDialogHandler(options) {
6893
6933
  else if (!visibility) {
6894
6934
  const resolved = await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig()).catch(() => ({ error: visibilityUnresolvedError() }));
6895
6935
  if ("error" in resolved) return sendCliError(response, resolved.error);
6896
- visibility = resolved.value;
6936
+ const audience = await resolveAccountHomeVisibility(resolved, token.token, cliOptions, request.init, uploadErrorOptions(baseUrlOf(cliOptions)));
6937
+ visibility = "error" in audience ? resolved.value : audience.value;
6897
6938
  }
6898
6939
  const { FormData } = await import("undici");
6899
6940
  const { Blob } = await import("node:buffer");
@@ -7179,6 +7220,7 @@ function renderPage(options) {
7179
7220
  <option value="link" id="visLink"></option>
7180
7221
  </select>
7181
7222
  </div>
7223
+ <div class="note" id="privateDefaultNote"></div>
7182
7224
  <div class="note" id="notCarried"></div>
7183
7225
  <div class="note" id="snapshotNote"></div>
7184
7226
  <div class="error" id="shareError"></div>
@@ -7222,6 +7264,7 @@ function renderPage(options) {
7222
7264
  el('visPrivate').textContent = t('visibilityPrivate');
7223
7265
  el('visWorkspace').textContent = t('visibilityWorkspace');
7224
7266
  el('visLink').textContent = t('visibilityLink');
7267
+ el('privateDefaultNote').textContent = t('privateDefault');
7225
7268
  el('notCarried').textContent = t('notCarried');
7226
7269
  el('cancelBtn').textContent = t('cancel');
7227
7270
  el('shareBtn').textContent = t('confirm');
@@ -7338,8 +7381,14 @@ function renderPage(options) {
7338
7381
  } else if (visibility.value === 'project') {
7339
7382
  visibility.value = context.default_visibility || 'private';
7340
7383
  }
7384
+ // Explain a private Home default that came from the account, not a choice.
7385
+ el('privateDefaultNote').style.display =
7386
+ !projectSelected && context.private_default && visibility.value === 'private'
7387
+ ? ''
7388
+ : 'none';
7341
7389
  }
7342
7390
  el('destination').addEventListener('change', syncVisibility);
7391
+ el('visibility').addEventListener('change', syncVisibility);
7343
7392
 
7344
7393
  function share() {
7345
7394
  if (!snapshotId || shareInFlight) return;
@@ -12901,6 +12950,8 @@ async function runDoctor(parsed, mode) {
12901
12950
  const rawBody = result.data.body;
12902
12951
  const body = isContract(CLI_DOCTOR_RESPONSE_SCHEMA, rawBody) ? rawBody : isRecord$1(rawBody) ? rawBody : null;
12903
12952
  if (!body) throw new Error("Doctor response was not valid JSON.");
12953
+ const workspace = CliWorkspaceSchema.safeParse(body.workspace);
12954
+ if (workspace.success) data.workspace = workspace.data;
12904
12955
  const auth = isRecord$1(body.auth) ? body.auth : null;
12905
12956
  const user = isRecord$1(body.user) ? body.user : null;
12906
12957
  const upload = isRecord$1(body.upload) ? body.upload : null;
@@ -14768,7 +14819,16 @@ async function runShare(parsed, mode, isRetry = false, prepared) {
14768
14819
  const grantEmails = arrayOption(parsed.options.grantEmail);
14769
14820
  const defaultVisibility = parsed.options.visibility || destination.containerId ? null : await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig());
14770
14821
  if (defaultVisibility && "error" in defaultVisibility) return writeFailure(command, defaultVisibility.error, mode, 1);
14771
- const requestedVisibility = parsed.options.visibility ?? (destination.containerId ? "project" : defaultVisibility.value);
14822
+ const accountVisibility = defaultVisibility ? await resolveAccountHomeVisibility(defaultVisibility, credential.token, parsed.options, request.init, {
14823
+ authenticated: true,
14824
+ baseUrl,
14825
+ credentialSource: credential.source,
14826
+ profile: credential.profile,
14827
+ profileCredentialKind: credential.profileCredentialKind,
14828
+ botProfile: credential.botProfile
14829
+ }) : null;
14830
+ if (accountVisibility && "error" in accountVisibility) return handleAuthenticatedCredentialFailure(command, accountVisibility.error, credential, parsed.options, mode, () => runShare(parsed, mode, true, upload), isRetry);
14831
+ const requestedVisibility = parsed.options.visibility ?? (destination.containerId ? "project" : accountVisibility.value);
14772
14832
  initialForm.set("visibility", requestedVisibility);
14773
14833
  for (const email of grantEmails) initialForm.append("grant_email", email);
14774
14834
  if (destination.containerId) initialForm.set("container_id", destination.containerId);
@@ -14822,6 +14882,10 @@ async function runShare(parsed, mode, isRetry = false, prepared) {
14822
14882
  } : { type: "home" },
14823
14883
  share: {
14824
14884
  visibility: visibility ?? requestedVisibility,
14885
+ ...accountVisibility?.privateDefault && created && visibility === "private" ? {
14886
+ visibility_source: "product_default_private",
14887
+ visibility_hint: PRIVATE_DEFAULT_HINT
14888
+ } : {},
14825
14889
  grant_emails: grantEmails,
14826
14890
  link_expires_at: linkExpiresAt
14827
14891
  },
@@ -15758,6 +15822,7 @@ With no destination, share posts to home. Choose the setting by purpose:
15758
15822
  Shared policy agreed by all repository participants:
15759
15823
  npm exec --yes --package=@artifactshare/cli -- artifactshare config set home_audience workspace --scope repository --json
15760
15824
  One-time audience for a single post: pass --visibility private|workspace|link.
15825
+ With no audience setting, Home uses workspace for organization accounts and private otherwise. Explicit/configured workspace still rejects when unavailable. Link sharing requires --visibility link.
15761
15826
  Link sharing accepts --link-expires-at <RFC3339 UTC> or --no-link-expiry;
15762
15827
  these expiry options are mutually exclusive.
15763
15828
  Pass --no-slack-notify to suppress the project Slack notification for this post.
@@ -16754,7 +16819,7 @@ Keys:
16754
16819
  default_artifact_visibility Compatibility alias for home_audience.
16755
16820
  default_project_visibility Advanced default for projects create.
16756
16821
 
16757
- Scopes: user stores in the global config; repository stores in the shared .artifactshare/config.json; effective reads the resolved value. Home audience resolution is repository home_audience, repository alias, user home_audience, user alias, then product default workspace. Project defaults resolve repository, user, then workspace. Keyless config get --json returns only home_audience; pass an explicit key to read default_project_visibility or the compatibility alias. Explicit --visibility overrides the destination default for one post.`,
16822
+ Scopes: user stores in the global config; repository stores in the shared .artifactshare/config.json; effective reads the resolved value. Home audience resolution is repository home_audience, repository alias, user home_audience, user alias, then the account-aware product default (workspace when available, otherwise private). Config inspection is offline: value workspace with source product_default is unresolved until share or preview reads the account capability. Older servers without the capability retain workspace. Project defaults resolve repository, user, then workspace. Keyless config get --json returns only home_audience; pass an explicit key to read default_project_visibility or the compatibility alias. Explicit --visibility overrides the destination default for one post.`,
16758
16823
  run: parentCommandRunner("config")
16759
16824
  });
16760
16825
  const profilesDefinition = define({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.20.3",
3
+ "version": "0.21.0",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
6
  "repository": {
@@ -4,7 +4,7 @@ description: Share, publish, upload, host, update, open, or read back existing f
4
4
  ---
5
5
 
6
6
  <!-- artifactshare-skill
7
- version: 50
7
+ version: 51
8
8
  managed: true
9
9
  -->
10
10
 
@@ -97,8 +97,11 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare share ./site-dir --
97
97
  --scope user --json` for a personal safe default in this CLI environment,
98
98
  use `--scope repository` only for a policy agreed by all participants, and
99
99
  use `--visibility private|workspace|link` for one home post.
100
- - Confirm the resolved home audience before posting with
100
+ - Inspect the home audience policy before posting with
101
101
  `config get home_audience --scope effective --json`.
102
+ - An unconfigured Home share checks the server: workspace-capable accounts use workspace; personal accounts use private. Keep explicit/configured values, including workspace rejections. Never retry as link without the user choosing --visibility link.
103
+ Offline config output leaves the product_default workspace policy unresolved. The account determines the audience during share or preview; an older server that omits visibility_available keeps the legacy workspace behavior.
104
+ Private fallback results include `data.share.visibility_source: "product_default_private"` and `visibility_hint`.
102
105
  - Set visibility at share time with `--visibility private|workspace|project|link`.
103
106
  This is a per-post override; `--grant-email` does not change the resolved
104
107
  default visibility.
@@ -31,7 +31,7 @@ The complete `config --help` reference covers user and repository scopes,
31
31
  effective resolution, and the canonical `home_audience` key. `default_artifact_visibility` is a compatibility alias, while
32
32
  `default_project_visibility` is the advanced `projects create` default. Home
33
33
  resolution checks repository then user settings (including the alias at each
34
- scope), then product default `workspace`; project defaults use repository,
34
+ scope), then the account-aware product default; project defaults use repository,
35
35
  user, then `workspace`. Keyless `config get --json` returns only
36
36
  `home_audience`; pass an explicit key for either other setting. These settings
37
37
  only affect new home posts and project creation; update, edit, Web, and MCP
@@ -107,3 +107,5 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare projects edit <id>
107
107
  directory. `init --dry-run --json` previews the setup without side effects.
108
108
  - Run `edit --help`, `projects create --help`, or `projects edit --help` for
109
109
  all flags.
110
+
111
+ Home without an explicit or configured audience defaults to workspace when the account supports it, otherwise private. Explicit or configured workspace still fails when unavailable; sharing never automatically switches to link. Choose --visibility link deliberately. Config inspection is offline: value workspace with source product_default is an unresolved policy placeholder. Share and preview resolve it against the account. Older servers without workspace.visibility_available retain workspace and its existing rejection.
@@ -153,3 +153,5 @@ carried into the shared copy.
153
153
  Local HTML and Markdown previews run scripts inside a frame with `sandbox="allow-scripts"`. Preview isolation cannot be disabled. `localStorage`, IndexedDB, and other same-origin features are unavailable; the review shell always shows this restriction. Reporter observations are bounded, document-scoped display data. Saving or submitting feedback requires an explicit action in the review shell.
154
154
 
155
155
  Local preview and share-dialog HTTP routes still lack per-session authentication. Loopback binding, Host checks and fixed mutation headers do not authenticate other local clients. Do not treat knowledge of the local port as an access-control boundary. Session authentication and private browser launchers are deferred; the existing ready `url` and `--no-open` behavior are unchanged.
156
+
157
+ When no audience is configured, the Home share dialog asks the server after sign-in whether the account can use workspace visibility and defaults to private when it cannot. Explicit or configured audiences are preserved.