@artifactshare/cli 0.20.2 → 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,15 @@
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
+
10
+ ## 0.20.3 - 2026-10-28
11
+
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.
13
+ - Restore forced-install recovery commands and collision hints for unowned skill folders blocked by regular files or directories, while keeping user links untouched.
14
+
6
15
  ## 0.20.2 - 2026-10-28
7
16
 
8
17
  - Preserve newer managed skills during install unless force explicitly requests a downgrade.
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
  };
@@ -4301,10 +4304,10 @@ const uuid = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
4301
4304
  const legacyTemp = new RegExp(`^\\.artifactshare-${uuid}\\.tmp$`, "i");
4302
4305
  const stagingName = new RegExp(`^\\.artifactshare-staging-${uuid}$`, "i");
4303
4306
  const stale = (item) => item.mtimeMs < Date.now() - 6e5;
4304
- async function protectedPaths(root, bundle) {
4307
+ async function protectedPaths(root, bundle, observedState) {
4305
4308
  await safe(root, MANIFEST);
4306
4309
  await safe(root, PENDING);
4307
- const state = await stateAt(root);
4310
+ const state = observedState ?? await stateAt(root);
4308
4311
  const pending = await ownership(root, state, PENDING);
4309
4312
  const owned = await ownership(root, state, MANIFEST, pending.manifest);
4310
4313
  const paths = /* @__PURE__ */ new Set([
@@ -4337,6 +4340,13 @@ async function isProtectedLink(root, item, protectedEntries, lookup = info) {
4337
4340
  }
4338
4341
  return false;
4339
4342
  }
4343
+ var SkillPathError = class extends Error {
4344
+ isLink;
4345
+ constructor(message, isLink) {
4346
+ super(message);
4347
+ this.isLink = isLink;
4348
+ }
4349
+ };
4340
4350
  async function inspectTree(root, cleanup = false, folderRoot = root, protectedEntries, userLinks = []) {
4341
4351
  if (!await info(root)) return userLinks;
4342
4352
  for (const name of (await readdir(root)).sort()) {
@@ -4344,7 +4354,7 @@ async function inspectTree(root, cleanup = false, folderRoot = root, protectedEn
4344
4354
  const item = await lstat(path);
4345
4355
  if (item.isSymbolicLink()) {
4346
4356
  const entry = relative(folderRoot, path).split(sep).join("/");
4347
- if (protectedEntries && (protectedEntries.has(entry) || await isProtectedLink(folderRoot, item, protectedEntries) || name === MANIFEST || name === PENDING || stagingName.test(name) || legacyTemp.test(name))) throw new Error(`Unsafe skill path (link): ${entry}. Replace the link with a regular file or directory or remove it, then retry.`);
4357
+ if (protectedEntries && (protectedEntries.has(entry) || await isProtectedLink(folderRoot, item, protectedEntries) || name === MANIFEST || name === PENDING || stagingName.test(name) || legacyTemp.test(name))) throw new SkillPathError(`Unsafe skill path (link): ${entry}. Replace the link with a regular file or directory or remove it, then retry.`, true);
4348
4358
  userLinks.push(entry);
4349
4359
  continue;
4350
4360
  }
@@ -4388,7 +4398,7 @@ async function safe(root, relative, retiredAncestors = /* @__PURE__ */ new Set()
4388
4398
  const item = await info(parts[i]);
4389
4399
  if (i < parts.length - 1 && item?.isFile() && retiredAncestors.has(parts[i])) return;
4390
4400
  if (i === parts.length - 1 && item?.isDirectory() && replacedDirectories.has(parts[i])) continue;
4391
- if (item && (item.isSymbolicLink() || (i === parts.length - 1 ? !item.isFile() : !item.isDirectory()))) throw new Error(`Unsafe skill path (type change or link): ${parts[i]}. Replace the link with a regular file or directory or remove it, then retry.`);
4401
+ if (item && (item.isSymbolicLink() || (i === parts.length - 1 ? !item.isFile() : !item.isDirectory()))) throw new SkillPathError(`Unsafe skill path (type change or link): ${parts[i]}. Replace the link with a regular file or directory or remove it, then retry.`, item.isSymbolicLink());
4392
4402
  }
4393
4403
  }
4394
4404
  async function bytesAt(root, path) {
@@ -4401,39 +4411,50 @@ async function bytesAt(root, path) {
4401
4411
  async function textAt(root, path) {
4402
4412
  return (await bytesAt(root, path))?.toString("utf8") ?? null;
4403
4413
  }
4404
- async function recordsAbsent(root) {
4405
- return !await info(join(root, MANIFEST)) && !await info(join(root, PENDING));
4406
- }
4407
- async function unownedAt(root) {
4408
- if (!await recordsAbsent(root)) return false;
4414
+ async function inspectAt(root, managedLegacy) {
4409
4415
  const entry = await info(join(root, "SKILL.md"));
4410
- if (!entry || entry.isSymbolicLink()) return true;
4411
- return (await stateAt(root)).kind === "unmanaged";
4412
- }
4413
- async function isUnownedFolder(entry, managedLegacy = false) {
4414
- if (managedLegacy) return false;
4416
+ const recordsAbsent = !await info(join(root, MANIFEST)) && !await info(join(root, PENDING));
4417
+ const linkedEntry = entry?.isSymbolicLink() === true;
4418
+ let state;
4415
4419
  try {
4416
- return await unownedAt(await rootFor(entry));
4420
+ state = linkedEntry && recordsAbsent ? { kind: "unmanaged" } : managedState(await textAt(root, "SKILL.md"));
4417
4421
  } catch {
4418
- return false;
4419
- }
4420
- }
4421
- async function stateAt(root) {
4422
- try {
4423
- if ((await info(join(root, "SKILL.md")))?.isSymbolicLink() && await recordsAbsent(root)) return { kind: "unmanaged" };
4424
- return managedState(await textAt(root, "SKILL.md"));
4425
- } catch {
4426
- return { kind: "broken" };
4422
+ state = { kind: "broken" };
4427
4423
  }
4424
+ return {
4425
+ root,
4426
+ state,
4427
+ linkedEntry,
4428
+ unowned: !managedLegacy && recordsAbsent && (!entry || linkedEntry || state.kind === "unmanaged")
4429
+ };
4428
4430
  }
4429
- async function readSkillState(entry) {
4431
+ async function inspectSkillFolder(entry, managedLegacy) {
4432
+ const failed = (root, state, error) => ({
4433
+ root,
4434
+ state,
4435
+ unowned: false,
4436
+ linkedEntry: false,
4437
+ error
4438
+ });
4439
+ let root;
4430
4440
  try {
4431
- return await stateAt(await rootFor(entry));
4441
+ root = await rootFor(entry);
4432
4442
  } catch (error) {
4433
- if (error instanceof SkillFolderResolutionError && error.missingAncestor) return {
4443
+ return failed(null, error instanceof SkillFolderResolutionError && error.missingAncestor ? {
4434
4444
  kind: "missing",
4435
4445
  hint: error.message
4436
- };
4446
+ } : { kind: "broken" }, error);
4447
+ }
4448
+ try {
4449
+ return await inspectAt(root, managedLegacy);
4450
+ } catch (error) {
4451
+ return failed(root, { kind: "broken" }, error);
4452
+ }
4453
+ }
4454
+ async function stateAt(root) {
4455
+ try {
4456
+ return (await inspectAt(root, false)).state;
4457
+ } catch {
4437
4458
  return { kind: "broken" };
4438
4459
  }
4439
4460
  }
@@ -4501,12 +4522,14 @@ async function recoveryOwnership(root, state) {
4501
4522
  recorded
4502
4523
  };
4503
4524
  }
4504
- async function folderDiagnostics(entry, bundle, managedLegacy = false) {
4505
- let root = null;
4525
+ async function folderDiagnostics(entry, bundle, context = false) {
4526
+ const inspection = typeof context === "boolean" ? await inspectSkillFolder(entry, context) : context;
4527
+ let root = inspection.root;
4506
4528
  let user_links = [];
4507
4529
  try {
4508
- root = await rootFor(entry);
4509
- user_links = await inspectTree(root, false, root, !managedLegacy && await unownedAt(root) ? void 0 : await protectedPaths(root, bundle));
4530
+ if (inspection.error) throw inspection.error;
4531
+ root = inspection.root;
4532
+ user_links = await inspectTree(root, false, root, inspection.unowned ? void 0 : await protectedPaths(root, bundle, inspection.state));
4510
4533
  } catch (error) {
4511
4534
  return {
4512
4535
  folder_path: dirname(entry),
@@ -4524,7 +4547,7 @@ async function folderDiagnostics(entry, bundle, managedLegacy = false) {
4524
4547
  hint: error.message
4525
4548
  };
4526
4549
  }
4527
- const state = await stateAt(root);
4550
+ const state = inspection.state;
4528
4551
  const { owned, pending, recorded } = await recoveryOwnership(root, state);
4529
4552
  const newerIntent = pending.manifest && pending.manifest.version > bundle.version;
4530
4553
  const missing_files = [], different_files = [], modified_files = [];
@@ -4809,8 +4832,12 @@ function targetOrder(a, b) {
4809
4832
  }
4810
4833
  async function cleanupTarget(target, bundled) {
4811
4834
  if (target.cleaned) return;
4812
- await cleanupSkillFolder(target.absolutePath, bundled);
4813
- target.cleaned = true;
4835
+ try {
4836
+ await cleanupSkillFolder(target.absolutePath, bundled);
4837
+ target.cleaned = true;
4838
+ } finally {
4839
+ delete target.inspection;
4840
+ }
4814
4841
  }
4815
4842
  async function groupTargets(targets) {
4816
4843
  const groups = /* @__PURE__ */ new Map();
@@ -4823,8 +4850,10 @@ async function groupTargets(targets) {
4823
4850
  const key = await resolveSkillFolder(target.absolutePath).catch(() => null);
4824
4851
  target.resolved_folder_path = key;
4825
4852
  const existing = key === null ? void 0 : groups.get(key);
4826
- if (existing && availableTarget(existing)) existing.aliases = [...aliases(existing), ...aliases(target)];
4827
- else {
4853
+ if (existing && availableTarget(existing)) {
4854
+ existing.aliases = [...aliases(existing), ...aliases(target)];
4855
+ delete existing.inspection;
4856
+ } else {
4828
4857
  target.aliases = aliases(target);
4829
4858
  result.push(target);
4830
4859
  if (key !== null) groups.set(key, target);
@@ -4919,8 +4948,23 @@ function skillTarget(tool, scope) {
4919
4948
  function allTargets() {
4920
4949
  return SKILL_TOOLS.flatMap((tool) => TOOL_CONFIG[tool].scopes.map((scope) => skillTarget(tool, scope)));
4921
4950
  }
4922
- function readTarget(target) {
4923
- return readSkillState(target.absolutePath);
4951
+ async function inspectTarget(target) {
4952
+ const legacy = await legacyRule(target);
4953
+ return {
4954
+ folder: await inspectSkillFolder(target.absolutePath, legacy?.managed === true),
4955
+ legacy
4956
+ };
4957
+ }
4958
+ function targetInspection(target) {
4959
+ return target.inspection ??= inspectTarget(target);
4960
+ }
4961
+ async function readTarget(target) {
4962
+ return (await targetInspection(target)).folder.state;
4963
+ }
4964
+ async function newerInstalledVersion(target, bundle) {
4965
+ const { folder, legacy } = await targetInspection(target);
4966
+ const version = folder.state.kind === "managed" ? folder.state.version : folder.state.kind === "missing" ? legacy?.version : void 0;
4967
+ return version !== void 0 && version > bundle.version ? version : void 0;
4924
4968
  }
4925
4969
  function loadBundledSkills() {
4926
4970
  return loadSkillBundle(fileURLToPath(new URL("../skills/artifactshare/", import.meta.url)));
@@ -4936,23 +4980,23 @@ async function legacyRule(target) {
4936
4980
  const parent = await lstat(dirname(path)).catch(() => null);
4937
4981
  const content = info?.isFile() && !parent?.isSymbolicLink() ? await readFile(path, "utf8").catch(() => null) : null;
4938
4982
  const present = info !== null;
4939
- const managed = managedState(content).kind === "managed";
4983
+ const state = managedState(content);
4984
+ const managed = state.kind === "managed";
4985
+ const coexistence = present && await lstat(resolve(cursor.path)).catch(() => null) !== null;
4940
4986
  return {
4941
4987
  path,
4942
4988
  present,
4943
4989
  managed,
4944
- coexistence: present && await lstat(resolve(cursor.path)).catch(() => null) !== null,
4990
+ ...state.kind === "managed" ? { version: state.version } : {},
4991
+ coexistence,
4945
4992
  hint: present && !managed ? "Inspect the legacy Cursor rule and manually remove it if the skill folder replaces it." : null
4946
4993
  };
4947
4994
  }
4948
- async function legacyManagedVersion(target) {
4949
- const legacy = await legacyRule(target);
4950
- if (!legacy?.managed) return void 0;
4951
- const state = managedState(await readFile(legacy.path, "utf8"));
4952
- return state.kind === "managed" ? state.version : void 0;
4995
+ function legacyRuleOutput({ version: _version, ...rule }) {
4996
+ return rule;
4953
4997
  }
4954
- function isNewer(state, bundle) {
4955
- return state.kind === "managed" && state.version > bundle.version;
4998
+ async function legacyManagedVersion(target) {
4999
+ return (await legacyRule(target))?.version;
4956
5000
  }
4957
5001
  function newerCliHint(installed, bundled) {
4958
5002
  return `A newer CLI installed skill version ${installed}; this CLI bundles version ${bundled}. Keeping the installed version. Use --force only for an intentional downgrade.`;
@@ -4961,18 +5005,18 @@ function downgradeHint(installed, bundled) {
4961
5005
  return `Intentional downgrade from skill version ${installed} to bundled version ${bundled}.`;
4962
5006
  }
4963
5007
  async function diagnostic(target, bundle) {
4964
- const legacy = await legacyRule(target);
4965
- const state = await readTarget(target);
4966
- const details = await folderDiagnostics(target.absolutePath, bundle, legacy?.managed);
5008
+ const { folder, legacy } = await targetInspection(target);
5009
+ const version = await newerInstalledVersion(target, bundle);
5010
+ const details = await folderDiagnostics(target.absolutePath, bundle, folder);
4967
5011
  return {
4968
5012
  ...details,
4969
5013
  folder_path: dirname(target.path),
4970
- ...isNewer(state, bundle) ? { hint: [details.hint, newerCliHint(state.version, bundle.version)].filter(Boolean).join(" ") } : {},
4971
- ...legacy ? { legacy_rule: legacy } : {}
5014
+ ...version !== void 0 ? { hint: [details.hint, newerCliHint(version, bundle.version)].filter(Boolean).join(" ") } : {},
5015
+ ...legacy ? { legacy_rule: legacyRuleOutput(legacy) } : {}
4972
5016
  };
4973
5017
  }
4974
5018
  async function isCurrent(target, bundle) {
4975
- return (await folderDiagnostics(target.absolutePath, bundle)).current;
5019
+ return (await diagnostic(target, bundle)).current;
4976
5020
  }
4977
5021
  function parseTools(value, options = {}) {
4978
5022
  const raws = arrayOption(value);
@@ -5095,30 +5139,35 @@ async function prepareAction(item, dryRun) {
5095
5139
  }
5096
5140
  async function applyAction(item) {
5097
5141
  if (item.preserve || item.action === "failed") return;
5098
- if (item.content) await writeSkillFolder(item.target.absolutePath, item.content, item.force, item.forceRetirement, false);
5099
- if (item.action === "removed") await removeSkillFolder(item.target.absolutePath, aliases(item.target).length > 1, await loadBundledSkills());
5100
- if (item.legacy?.action === "removed") try {
5101
- await unlink(item.legacy.path);
5102
- } catch {
5103
- item.legacy = {
5104
- path: item.legacy.path,
5105
- action: "remove_failed",
5106
- hint: "Retry skills update --tool cursor --scope project --json to remove the legacy rule."
5107
- };
5142
+ try {
5143
+ if (item.content) await writeSkillFolder(item.target.absolutePath, item.content, item.force, item.forceRetirement, false);
5144
+ if (item.action === "removed") await removeSkillFolder(item.target.absolutePath, aliases(item.target).length > 1, await loadBundledSkills());
5145
+ if (item.legacy?.action === "removed") try {
5146
+ await unlink(item.legacy.path);
5147
+ } catch {
5148
+ item.legacy = {
5149
+ path: item.legacy.path,
5150
+ action: "remove_failed",
5151
+ hint: "Retry skills update --tool cursor --scope project --json to remove the legacy rule."
5152
+ };
5153
+ }
5154
+ } finally {
5155
+ delete item.target.inspection;
5108
5156
  }
5109
5157
  }
5110
5158
  function skillUpdateCommand(target) {
5111
5159
  return `${CLI_INVOCATION} skills update --tool ${target.tool} --scope ${target.scope} --json`;
5112
5160
  }
5113
5161
  async function recoveryRecommendation(target, bundled) {
5114
- const state = await readTarget(target);
5115
5162
  const details = await diagnostic(target, bundled);
5116
- if (await isUnownedFolder(target.absolutePath, details.legacy_rule?.managed)) return {};
5117
- if (isNewer(state, bundled)) return { hint: details.hint ?? newerCliHint(state.version, bundled.version) };
5163
+ const { folder } = await targetInspection(target);
5164
+ const version = await newerInstalledVersion(target, bundled);
5165
+ if (version !== void 0) return { hint: details.hint ?? newerCliHint(version, bundled.version) };
5118
5166
  let update_command = skillUpdateCommand(target);
5167
+ let collision;
5119
5168
  try {
5120
5169
  await preflightFolder(target.absolutePath, bundled);
5121
- } catch {
5170
+ } catch (first) {
5122
5171
  try {
5123
5172
  await preflightFolder(target.absolutePath, bundled, false, true);
5124
5173
  update_command = update_command.replace(" --json", " --force --json");
@@ -5126,7 +5175,9 @@ async function recoveryRecommendation(target, bundled) {
5126
5175
  try {
5127
5176
  await preflightFolder(target.absolutePath, bundled, true);
5128
5177
  update_command = `${CLI_INVOCATION} skills install --tool ${target.tool} --scope ${target.scope} --force --json`;
5178
+ if (folder.unowned) collision = first.message;
5129
5179
  } catch (error) {
5180
+ if (folder.unowned && error instanceof SkillPathError && error.isLink) return { suppressHint: true };
5130
5181
  return {
5131
5182
  hint: error.message,
5132
5183
  ...details.modified_files.length ? { modified_files: details.modified_files } : {}
@@ -5136,6 +5187,7 @@ async function recoveryRecommendation(target, bundled) {
5136
5187
  }
5137
5188
  return {
5138
5189
  update_command,
5190
+ ...collision ? { hint: collision } : {},
5139
5191
  ...details.modified_files.length ? {
5140
5192
  modified_files: details.modified_files,
5141
5193
  hint: `Modified skill files: ${details.modified_files.join(", ")}. Preserve your edits before running the recommended command.`
@@ -5182,18 +5234,21 @@ async function finishActions(command, planned, dryRun, mode) {
5182
5234
  }
5183
5235
  return {
5184
5236
  dry_run: dryRun,
5185
- targets: await Promise.all(completed.map(async ({ target, action, legacy, hint }) => ({
5186
- ...hint ? { hint } : {},
5187
- tool: target.tool,
5188
- scope: target.scope,
5189
- path: target.path,
5190
- ...identity(target),
5191
- folder_path: dirname(target.path),
5192
- ...legacy ? { legacy_rule: legacy } : {},
5193
- action,
5194
- ...action === "failed" ? { code: "skill_update_conflict" } : {},
5195
- ...action === "update_recommended" ? await recoveryRecommendation(target, await loadBundledSkills()) : {}
5196
- })))
5237
+ targets: await Promise.all(completed.map(async ({ target, action, legacy, hint }) => {
5238
+ const { suppressHint, ...recommendation } = action === "update_recommended" ? await recoveryRecommendation(target, await loadBundledSkills()) : {};
5239
+ return {
5240
+ ...hint && !suppressHint ? { hint } : {},
5241
+ tool: target.tool,
5242
+ scope: target.scope,
5243
+ path: target.path,
5244
+ ...identity(target),
5245
+ folder_path: dirname(target.path),
5246
+ ...legacy ? { legacy_rule: legacy } : {},
5247
+ action,
5248
+ ...action === "failed" ? { code: "skill_update_conflict" } : {},
5249
+ ...recommendation
5250
+ };
5251
+ }))
5197
5252
  };
5198
5253
  }
5199
5254
  async function runActions(command, planned, dryRun, mode, unavailableTargets = []) {
@@ -5236,12 +5291,13 @@ async function runSkillsInstall(parsed, mode) {
5236
5291
  if (!availableTarget(target)) return writeFailure(command, target.error, mode, 1);
5237
5292
  const state = await readTarget(target);
5238
5293
  if ((state.kind === "unmanaged" || state.kind === "broken") && !force) return writeFailure(command, await conflictFor(target), mode, 1);
5239
- if (isNewer(state, bundled) && !force) {
5294
+ const version = await newerInstalledVersion(target, bundled);
5295
+ if (version !== void 0 && !force) {
5240
5296
  planned.push({
5241
5297
  target,
5242
5298
  action: "unchanged",
5243
5299
  preserve: true,
5244
- hint: newerCliHint(state.version, bundled.version)
5300
+ hint: newerCliHint(version, bundled.version)
5245
5301
  });
5246
5302
  continue;
5247
5303
  }
@@ -5263,7 +5319,7 @@ async function runSkillsInstall(parsed, mode) {
5263
5319
  action: state.kind === "missing" ? "installed" : "updated",
5264
5320
  content: bundled,
5265
5321
  force,
5266
- ...isNewer(state, bundled) ? { hint: downgradeHint(state.version, bundled.version) } : {}
5322
+ ...version !== void 0 ? { hint: downgradeHint(version, bundled.version) } : {}
5267
5323
  });
5268
5324
  }
5269
5325
  await runActions(command, planned, parsed.options.dryRun === true, mode);
@@ -5289,9 +5345,10 @@ async function ensureSkills(parsed, mode, options = {}) {
5289
5345
  const targets = (filters.auto ? await autoTargets(filters.scope) : void 0)?.targets ?? filteredTargets(filters.tools, filters.scope ?? "project");
5290
5346
  const planned = [];
5291
5347
  for (const target of await groupTargets(targets)) {
5292
- const state = await readTarget(target);
5293
- const linkedSkill = state.kind === "unmanaged" && (filters.auto || options.skipBrokenUserSkills) && (await lstat(target.absolutePath).catch(() => null))?.isSymbolicLink();
5294
- if (linkedSkill && await isUnownedFolder(target.absolutePath, (await legacyRule(target))?.managed)) {
5348
+ const { folder } = await targetInspection(target);
5349
+ const state = folder.state;
5350
+ const linkedSkill = state.kind === "unmanaged" && (filters.auto || options.skipBrokenUserSkills) && folder.linkedEntry;
5351
+ if (linkedSkill && folder.unowned) {
5295
5352
  if (filters.auto) planned.push({
5296
5353
  target,
5297
5354
  action: "skipped_unmanaged"
@@ -5326,7 +5383,17 @@ async function ensureSkills(parsed, mode, options = {}) {
5326
5383
  }
5327
5384
  const automaticUpdate = filters.auto || options.command === "init" || options.command === "open";
5328
5385
  if (automaticUpdate && state.kind === "missing" && state.hint) continue;
5329
- if (automaticUpdate && state.kind === "managed" && state.version > bundled.version) continue;
5386
+ const newer = await newerInstalledVersion(target, bundled);
5387
+ if (automaticUpdate && newer !== void 0) continue;
5388
+ if (state.kind === "missing" && newer !== void 0) {
5389
+ planned.push({
5390
+ target,
5391
+ action: "unchanged",
5392
+ preserve: true,
5393
+ hint: newerCliHint(newer, bundled.version)
5394
+ });
5395
+ continue;
5396
+ }
5330
5397
  const details = await diagnostic(target, bundled);
5331
5398
  if (automaticUpdate && state.kind === "managed" && details.modified_files.length) {
5332
5399
  planned.push({
@@ -5354,6 +5421,7 @@ async function ensureSkills(parsed, mode, options = {}) {
5354
5421
  if (plannedPaths.has(await targetPathKey(target))) {
5355
5422
  const existing = planned.find((item) => target.resolved_folder_path !== null ? item.target.resolved_folder_path === target.resolved_folder_path : item.target.absolutePath === target.absolutePath);
5356
5423
  if (existing) {
5424
+ delete existing.target.inspection;
5357
5425
  existing.target.aliases = [...aliases(existing.target), ...aliases(target).filter((alias) => !aliases(existing.target).some((old) => old.tool === alias.tool && old.scope === alias.scope))].sort(targetOrder);
5358
5426
  const primary = existing.target.aliases[0];
5359
5427
  existing.target.tool = primary.tool;
@@ -5469,19 +5537,22 @@ async function autoUpdateUserManagedSkills() {
5469
5537
  ...item.installedVersion !== void 0 ? { installedVersion: item.installedVersion } : {}
5470
5538
  };
5471
5539
  }
5472
- return { targets: await Promise.all(completed.map(async ({ target, action, installedVersion, legacy, hint }) => ({
5473
- ...hint ? { hint } : {},
5474
- tool: target.tool,
5475
- scope: target.scope,
5476
- path: target.path,
5477
- ...identity(target),
5478
- folder_path: dirname(target.path),
5479
- ...legacy ? { legacy_rule: legacy } : {},
5480
- action: action === "update_recommended" ? "update_recommended" : "updated",
5481
- installed_version: action === "update_recommended" ? installedVersion ?? null : installedVersion ?? bundled.version,
5482
- bundled_version: bundled.version,
5483
- ...action === "update_recommended" ? await recoveryRecommendation(target, bundled) : {}
5484
- }))) };
5540
+ return { targets: await Promise.all(completed.map(async ({ target, action, installedVersion, legacy, hint }) => {
5541
+ const { suppressHint, ...recommendation } = action === "update_recommended" ? await recoveryRecommendation(target, bundled) : {};
5542
+ return {
5543
+ ...hint && !suppressHint ? { hint } : {},
5544
+ tool: target.tool,
5545
+ scope: target.scope,
5546
+ path: target.path,
5547
+ ...identity(target),
5548
+ folder_path: dirname(target.path),
5549
+ ...legacy ? { legacy_rule: legacy } : {},
5550
+ action: action === "update_recommended" ? "update_recommended" : "updated",
5551
+ installed_version: action === "update_recommended" ? installedVersion ?? null : installedVersion ?? bundled.version,
5552
+ bundled_version: bundled.version,
5553
+ ...recommendation
5554
+ };
5555
+ })) };
5485
5556
  } catch {
5486
5557
  return;
5487
5558
  }
@@ -5527,6 +5598,7 @@ async function runSkillsList(parsed, mode) {
5527
5598
  async function skillDiagnostics() {
5528
5599
  const bundled = await loadBundledSkills();
5529
5600
  const targets = [];
5601
+ let newerLegacyOnly = false;
5530
5602
  for (const target of await groupTargets(allTargets())) {
5531
5603
  if (!availableTarget(target)) {
5532
5604
  targets.push({
@@ -5540,6 +5612,8 @@ async function skillDiagnostics() {
5540
5612
  const updateAvailable = state.kind === "managed" && state.version < bundled.version;
5541
5613
  const recommendation = await recoveryRecommendation(target, bundled);
5542
5614
  const recoveryCommand = recommendation.update_command ?? null;
5615
+ if (state.kind === "missing" && await newerInstalledVersion(target, bundled) !== void 0) newerLegacyOnly = true;
5616
+ const update_command = details.hint ? null : updateAvailable || details.interrupted_update || state.kind === "managed" && !details.current ? recoveryCommand : null;
5543
5617
  targets.push({
5544
5618
  tool: target.tool,
5545
5619
  scope: target.scope,
@@ -5550,13 +5624,13 @@ async function skillDiagnostics() {
5550
5624
  update_available: updateAvailable,
5551
5625
  ...identity(target),
5552
5626
  ...details,
5553
- ...!recoveryCommand && recommendation.hint ? { hint: recommendation.hint } : {},
5554
- update_command: details.hint ? null : updateAvailable || details.interrupted_update || state.kind === "managed" && !details.current ? recoveryCommand : null
5627
+ ...(!recoveryCommand || !update_command && !details.hint) && recommendation.hint ? { hint: recommendation.hint } : {},
5628
+ update_command
5555
5629
  });
5556
5630
  }
5557
5631
  const updateTargets = targets.filter((target) => target.update_command !== null);
5558
5632
  const commonCommand = updateTargets[0]?.update_command?.replace(/ --tool \S+ --scope \S+/, "");
5559
- const canUpdateTogether = commonCommand?.includes(" skills update ") && updateTargets.every((target) => target.update_command?.replace(/ --tool \S+ --scope \S+/, "") === commonCommand) && !targets.some((target) => target.path !== null && (target.installed || "interrupted_update" in target && target.interrupted_update) && target.hint);
5633
+ const canUpdateTogether = commonCommand?.includes(" skills update ") && updateTargets.every((target) => target.update_command?.replace(/ --tool \S+ --scope \S+/, "") === commonCommand) && !targets.some((target) => target.path !== null && (target.installed || "interrupted_update" in target && target.interrupted_update) && target.hint) && !(newerLegacyOnly && commonCommand.includes(" --force"));
5560
5634
  return {
5561
5635
  bundled_version: bundled.version,
5562
5636
  update_available: targets.some((target) => target.update_available),
@@ -5589,12 +5663,13 @@ async function runSkillsUpdate(parsed, mode) {
5589
5663
  continue;
5590
5664
  }
5591
5665
  if (state.kind === "broken") return writeFailure(command, await conflictFor(target), mode, 1);
5592
- if (isNewer(state, bundled) && !force) {
5666
+ const version = await newerInstalledVersion(target, bundled);
5667
+ if (version !== void 0 && !force) {
5593
5668
  planned.push({
5594
5669
  target,
5595
5670
  action: "unchanged",
5596
5671
  preserve: true,
5597
- hint: newerCliHint(state.version, bundled.version)
5672
+ hint: newerCliHint(version, bundled.version)
5598
5673
  });
5599
5674
  continue;
5600
5675
  }
@@ -5607,10 +5682,11 @@ async function runSkillsUpdate(parsed, mode) {
5607
5682
  });
5608
5683
  continue;
5609
5684
  }
5610
- planned.push((await legacyRule(target))?.managed || (await diagnostic(target, bundled)).interrupted_update ? {
5685
+ planned.push((await targetInspection(target)).legacy?.managed || (await diagnostic(target, bundled)).interrupted_update ? {
5611
5686
  target,
5612
5687
  action: "installed",
5613
- content: bundled
5688
+ content: bundled,
5689
+ ...version !== void 0 ? { hint: downgradeHint(version, bundled.version) } : {}
5614
5690
  } : {
5615
5691
  target,
5616
5692
  action: "not_installed"
@@ -5624,7 +5700,7 @@ async function runSkillsUpdate(parsed, mode) {
5624
5700
  action: "updated",
5625
5701
  content: bundled,
5626
5702
  forceRetirement: force,
5627
- ...isNewer(state, bundled) ? { hint: downgradeHint(state.version, bundled.version) } : {}
5703
+ ...version !== void 0 ? { hint: downgradeHint(version, bundled.version) } : {}
5628
5704
  });
5629
5705
  else planned.push({
5630
5706
  target,
@@ -5664,7 +5740,7 @@ async function runSkillsRemove(parsed, mode) {
5664
5740
  });
5665
5741
  continue;
5666
5742
  }
5667
- const managedLegacy = (await legacyRule(target))?.managed === true;
5743
+ const managedLegacy = (await targetInspection(target)).legacy?.managed === true;
5668
5744
  const action = state.kind === "missing" ? managedLegacy || (await diagnostic(target, await loadBundledSkills())).interrupted_update ? "removed" : "not_installed" : state.kind === "managed" ? "removed" : "skipped_unmanaged";
5669
5745
  planned.push({
5670
5746
  target,
@@ -6213,6 +6289,30 @@ function mutationOriginAllowed(origin, host, fetchSite) {
6213
6289
  return origin === void 0 || host !== void 0 && origin === `http://${host}`;
6214
6290
  }
6215
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
6216
6316
  //#region src/command-runners/projects.ts
6217
6317
  async function fetchProjects(token, options, init, errorOptions = {}) {
6218
6318
  const result = await apiGet("/api/cli/projects", token, options, init, errorOptions);
@@ -6500,6 +6600,7 @@ const PREVIEW_MESSAGES = {
6500
6600
  "preview.shareDialog.destination": "Destination",
6501
6601
  "preview.shareDialog.visibility": "Visibility",
6502
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.",
6503
6604
  "preview.shareDialog.snapshotNote": "Captured at {time}. Later changes are not included.",
6504
6605
  "preview.shareDialog.confirm": "Share",
6505
6606
  "preview.shareDialog.cancel": "Cancel",
@@ -6589,6 +6690,7 @@ const PREVIEW_MESSAGES = {
6589
6690
  "preview.shareDialog.destination": "宛先",
6590
6691
  "preview.shareDialog.visibility": "共有範囲",
6591
6692
  "preview.shareDialog.notCarried": "ローカルのコメントは共有先には引き継がれません。共有後は共有先で新しくコメントできます",
6693
+ "preview.shareDialog.privateDefault": "このアカウントでは「社内全員」に共有できないため、ホームの既定は「個別共有」です。リンクを知っている人全員に共有するときだけ、「リンクを知っている全員」を選んでください",
6592
6694
  "preview.shareDialog.snapshotNote": "{time} 時点の内容です。それ以降の変更は含まれません",
6593
6695
  "preview.shareDialog.confirm": "共有する",
6594
6696
  "preview.shareDialog.cancel": "キャンセル",
@@ -6682,7 +6784,7 @@ function createShareDialogHandler(options) {
6682
6784
  async function handleContext(handlerOptions, response) {
6683
6785
  const cliOptions = handlerOptions.cliOptions;
6684
6786
  const resolved = await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig()).catch(() => null);
6685
- const defaultVisibility = resolved && !("error" in resolved) ? resolved.value : null;
6787
+ let defaultVisibility = resolved && !("error" in resolved) ? resolved.value : null;
6686
6788
  const token = await currentToken(cliOptions);
6687
6789
  const request = requestConfig(cliOptions);
6688
6790
  if (!token.ok || request.error) return sendJson$1(response, 200, {
@@ -6691,10 +6793,20 @@ function createShareDialogHandler(options) {
6691
6793
  default_visibility: request.error ? null : defaultVisibility,
6692
6794
  file_name: handlerOptions.fileName
6693
6795
  });
6796
+ let contextToken = token.token;
6797
+ let privateDefault = false;
6694
6798
  let projectsResult = await fetchProjects(token.token, cliOptions, request.init);
6695
6799
  if (projectsResult.error?.code === "auth_required") {
6696
6800
  const refreshed = await refreshTokenOnce(cliOptions, projectsResult.error);
6697
- 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;
6698
6810
  }
6699
6811
  sendJson$1(response, 200, {
6700
6812
  authenticated: true,
@@ -6703,6 +6815,7 @@ function createShareDialogHandler(options) {
6703
6815
  name: project.name ?? project.id
6704
6816
  })),
6705
6817
  default_visibility: defaultVisibility,
6818
+ private_default: privateDefault,
6706
6819
  file_name: handlerOptions.fileName
6707
6820
  });
6708
6821
  }
@@ -6820,7 +6933,8 @@ function createShareDialogHandler(options) {
6820
6933
  else if (!visibility) {
6821
6934
  const resolved = await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig()).catch(() => ({ error: visibilityUnresolvedError() }));
6822
6935
  if ("error" in resolved) return sendCliError(response, resolved.error);
6823
- 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;
6824
6938
  }
6825
6939
  const { FormData } = await import("undici");
6826
6940
  const { Blob } = await import("node:buffer");
@@ -7106,6 +7220,7 @@ function renderPage(options) {
7106
7220
  <option value="link" id="visLink"></option>
7107
7221
  </select>
7108
7222
  </div>
7223
+ <div class="note" id="privateDefaultNote"></div>
7109
7224
  <div class="note" id="notCarried"></div>
7110
7225
  <div class="note" id="snapshotNote"></div>
7111
7226
  <div class="error" id="shareError"></div>
@@ -7149,6 +7264,7 @@ function renderPage(options) {
7149
7264
  el('visPrivate').textContent = t('visibilityPrivate');
7150
7265
  el('visWorkspace').textContent = t('visibilityWorkspace');
7151
7266
  el('visLink').textContent = t('visibilityLink');
7267
+ el('privateDefaultNote').textContent = t('privateDefault');
7152
7268
  el('notCarried').textContent = t('notCarried');
7153
7269
  el('cancelBtn').textContent = t('cancel');
7154
7270
  el('shareBtn').textContent = t('confirm');
@@ -7265,8 +7381,14 @@ function renderPage(options) {
7265
7381
  } else if (visibility.value === 'project') {
7266
7382
  visibility.value = context.default_visibility || 'private';
7267
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';
7268
7389
  }
7269
7390
  el('destination').addEventListener('change', syncVisibility);
7391
+ el('visibility').addEventListener('change', syncVisibility);
7270
7392
 
7271
7393
  function share() {
7272
7394
  if (!snapshotId || shareInFlight) return;
@@ -12828,6 +12950,8 @@ async function runDoctor(parsed, mode) {
12828
12950
  const rawBody = result.data.body;
12829
12951
  const body = isContract(CLI_DOCTOR_RESPONSE_SCHEMA, rawBody) ? rawBody : isRecord$1(rawBody) ? rawBody : null;
12830
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;
12831
12955
  const auth = isRecord$1(body.auth) ? body.auth : null;
12832
12956
  const user = isRecord$1(body.user) ? body.user : null;
12833
12957
  const upload = isRecord$1(body.upload) ? body.upload : null;
@@ -14695,7 +14819,16 @@ async function runShare(parsed, mode, isRetry = false, prepared) {
14695
14819
  const grantEmails = arrayOption(parsed.options.grantEmail);
14696
14820
  const defaultVisibility = parsed.options.visibility || destination.containerId ? null : await resolveDefaultVisibility("home_audience", await resolveSharedProjectConfig());
14697
14821
  if (defaultVisibility && "error" in defaultVisibility) return writeFailure(command, defaultVisibility.error, mode, 1);
14698
- 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);
14699
14832
  initialForm.set("visibility", requestedVisibility);
14700
14833
  for (const email of grantEmails) initialForm.append("grant_email", email);
14701
14834
  if (destination.containerId) initialForm.set("container_id", destination.containerId);
@@ -14749,6 +14882,10 @@ async function runShare(parsed, mode, isRetry = false, prepared) {
14749
14882
  } : { type: "home" },
14750
14883
  share: {
14751
14884
  visibility: visibility ?? requestedVisibility,
14885
+ ...accountVisibility?.privateDefault && created && visibility === "private" ? {
14886
+ visibility_source: "product_default_private",
14887
+ visibility_hint: PRIVATE_DEFAULT_HINT
14888
+ } : {},
14752
14889
  grant_emails: grantEmails,
14753
14890
  link_expires_at: linkExpiresAt
14754
14891
  },
@@ -15685,6 +15822,7 @@ With no destination, share posts to home. Choose the setting by purpose:
15685
15822
  Shared policy agreed by all repository participants:
15686
15823
  npm exec --yes --package=@artifactshare/cli -- artifactshare config set home_audience workspace --scope repository --json
15687
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.
15688
15826
  Link sharing accepts --link-expires-at <RFC3339 UTC> or --no-link-expiry;
15689
15827
  these expiry options are mutually exclusive.
15690
15828
  Pass --no-slack-notify to suppress the project Slack notification for this post.
@@ -16681,7 +16819,7 @@ Keys:
16681
16819
  default_artifact_visibility Compatibility alias for home_audience.
16682
16820
  default_project_visibility Advanced default for projects create.
16683
16821
 
16684
- 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.`,
16685
16823
  run: parentCommandRunner("config")
16686
16824
  });
16687
16825
  const profilesDefinition = define({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.20.2",
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.