cloudtifact 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6467,7 +6467,7 @@ const mergeSpaceOutput = object({
6467
6467
  object({
6468
6468
  workspace: workspaceSlugSchema,
6469
6469
  name: string().min(1).max(100),
6470
- visibility: visibilitySchema.default("public"),
6470
+ visibility: visibilitySchema.default("members"),
6471
6471
  /** List it in this folder of the workspace (folderSchema.id); omitted: the top level. */
6472
6472
  folderId: string().max(64).optional()
6473
6473
  });
@@ -13043,7 +13043,7 @@ function tokenSpace(token) {
13043
13043
  //#endregion
13044
13044
  //#region src/version.ts
13045
13045
  /** This CLI's version, from package.json at build time (tsdown.config.ts). Unbuilt (tests, tsx): "0.0.0-dev". */
13046
- const VERSION = "0.3.0";
13046
+ const VERSION = "0.3.1";
13047
13047
  /**
13048
13048
  * Sent on every API request, so the API can tell which CLI version is calling (and one day tell an old one to
13049
13049
  * upgrade). Without it Node sends just "node", which is what 0.2.2 and older send. The sign-in page shows it too.
@@ -14380,6 +14380,8 @@ The folder named by \`dir\` in \`.cloudtifact.json\` (at the repo root) is publi
14380
14380
 
14381
14381
  The command is \`cloudy\` (\`cloudtifact\` is the same command under its old name). If neither is found, install it: \`${installCommand()}\` (needs Node.js 20 or later). \`cloudy upgrade\` updates it, and the skill file with it. To run it once without installing, use \`${NPX_COMMAND}\` in place of \`cloudy\`: \`npx cloudy\` is someone else's package.
14382
14382
 
14383
+ At most once a day a command ends with a line on stderr like \`Cloudy <new version> is out (you have <yours>). Run: cloudy upgrade\`. Finish the task first. If the line says \`cloudy upgrade\`, run it: it replaces only Cloudy's own file and refreshes this skill. If it names an \`npm\` command, don't run it: tell the user a newer Cloudy is out and give them the command. Never install or update anything else.
14384
+
14383
14385
  ## What a page can do
14384
14386
 
14385
14387
  People describe what they want, not these names: pick the capability for them. Before building anything interactive, run \`cloudy capabilities --toon\` (add \`--space <id>\` to see which are on in that space), then fetch the docs page of each one you use: it has a copy-paste example, the limits and the errors to handle.
@@ -14549,7 +14551,7 @@ async function skillCopies(home, version = VERSION) {
14549
14551
  * somebody edited by hand survives until the CLI changes. `check` reports and writes nothing.
14550
14552
  */
14551
14553
  async function installSkill(home, opts = {}) {
14552
- const version = opts.version ?? "0.3.0";
14554
+ const version = opts.version ?? "0.3.1";
14553
14555
  const markdown = skillMarkdown(version);
14554
14556
  const copies = await skillCopies(home, version);
14555
14557
  const written = [];
@@ -14861,11 +14863,12 @@ async function runUpdateCheck(source, deps = {}) {
14861
14863
  const latest = await fetchLatest(source);
14862
14864
  const before = await readUpdateCache(env);
14863
14865
  await writeUpdateCache({
14866
+ ...before,
14864
14867
  checkedAt: deps.now ?? Date.now(),
14865
14868
  source,
14866
14869
  ...latest ? { latest } : before?.latest ? { latest: before.latest } : {}
14867
14870
  }, env);
14868
- await refreshSkillCopies(homeDir(env), deps.version ?? "0.3.0");
14871
+ await refreshSkillCopies(homeDir(env), deps.version ?? "0.3.1");
14869
14872
  }
14870
14873
  /** Starts the check in a detached process that outlives this one and is never waited for. */
14871
14874
  function spawnUpdateCheck(entry, source) {
@@ -14882,10 +14885,13 @@ function spawnUpdateCheck(entry, source) {
14882
14885
  child.unref();
14883
14886
  }
14884
14887
  const truthy = (v) => !!v && v !== "0" && v.toLowerCase() !== "false";
14885
- /** Why there's no notice: --json/--toon, piped output, CI, the opt-out, or a build without a version. */
14888
+ /**
14889
+ * Why there's no notice: CI, the opt-outs, `upgrade` (it just did), the agent hook (nobody reads its stderr, and it
14890
+ * would use up the agent's daily line), or a build without a version.
14891
+ */
14886
14892
  function updateNoticeOff(opts) {
14887
14893
  const { env } = opts;
14888
- return truthy(env.CLOUDTIFACT_NO_UPDATE_NOTIFIER) || truthy(env.NO_UPDATE_NOTIFIER) || truthy(env.CI) || !opts.tty || opts.format !== "text" || opts.command === "upgrade" || opts.current.startsWith("0.0.0");
14894
+ return truthy(env.CLOUDTIFACT_NO_UPDATE_NOTIFIER) || truthy(env.NO_UPDATE_NOTIFIER) || truthy(env.CI) || opts.command === "upgrade" || opts.command === "hook" || opts.current.startsWith("0.0.0");
14889
14895
  }
14890
14896
  function updateNoticeLine(latest, current, source) {
14891
14897
  return `Cloudy ${latest} is out (you have ${current}). Run: ${source === "curl" ? "cloudy upgrade" : npmUpgradeCommand()}`;
@@ -14899,15 +14905,17 @@ async function updateNotice(deps) {
14899
14905
  const now = deps.now ?? Date.now();
14900
14906
  const cache = await readUpdateCache(env);
14901
14907
  const mine = cache?.source === deps.source ? cache : null;
14902
- if (!mine || now - mine.checkedAt >= DAY || now < mine.checkedAt) {
14903
- await writeUpdateCache({
14904
- checkedAt: now,
14905
- source: deps.source,
14906
- ...mine?.latest ? { latest: mine.latest } : {}
14907
- }, env);
14908
- deps.check();
14909
- }
14910
- return mine?.latest && isNewer(mine.latest, deps.current) ? updateNoticeLine(mine.latest, deps.current, deps.source) : null;
14908
+ const stale = (at) => at === void 0 || now - at >= DAY || now < at;
14909
+ const due = !mine || stale(mine.checkedAt);
14910
+ const tell = !!mine?.latest && isNewer(mine.latest, deps.current) && (!deps.daily || stale(mine?.toldAt));
14911
+ if (due || tell && deps.daily) await writeUpdateCache({
14912
+ ...mine,
14913
+ checkedAt: due ? now : mine?.checkedAt ?? now,
14914
+ source: deps.source,
14915
+ ...tell && deps.daily ? { toldAt: now } : {}
14916
+ }, env);
14917
+ if (due) deps.check();
14918
+ return tell && mine?.latest ? updateNoticeLine(mine.latest, deps.current, deps.source) : null;
14911
14919
  }
14912
14920
  //#endregion
14913
14921
  //#region src/uploads.ts
@@ -15064,16 +15072,15 @@ const program = new Command().name("cloudy").description("Publish pages and docs
15064
15072
  const tty = !!process.stdout.isTTY && !!process.stderr.isTTY;
15065
15073
  if (updateNoticeOff({
15066
15074
  env: process.env,
15067
- current: "0.3.0",
15068
- format,
15069
- command: cmd.name(),
15070
- tty
15075
+ current: "0.3.1",
15076
+ command: cmd.name()
15071
15077
  })) return;
15072
15078
  const entry = fileURLToPath(import.meta.url);
15073
15079
  const source = isCurlInstall(entry, homeDir()) ? "curl" : "npm";
15074
15080
  const line = await updateNotice({
15075
15081
  current: VERSION,
15076
15082
  source,
15083
+ daily: !tty || format !== "text",
15077
15084
  check: () => spawnUpdateCheck(entry, source)
15078
15085
  });
15079
15086
  if (line) console.error(line);
@@ -15326,7 +15333,7 @@ program.command("init").description("Link this repo to a space (creating one in
15326
15333
  const cur = await workspaceForNewSpace(client, opts.workspace, config.workspace);
15327
15334
  console.log(workspaceLine(cur));
15328
15335
  let visibility = opts.visibility;
15329
- if (!visibility && prompt) visibility = await choose("Who can view it?", ["anyone with the link", `members of ${cur.workspace.slug} only`]) ? "members" : "public";
15336
+ if (!visibility && prompt) visibility = await choose("Who can view it?", [`members of ${cur.workspace.slug} only`, "anyone with the link"]) ? "public" : "members";
15330
15337
  const defaultName = path.basename(root);
15331
15338
  const name = opts.name ?? (prompt ? await ask("Space name:", defaultName) : defaultName);
15332
15339
  space = await client.createSpace({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudtifact",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Publish pages and docs to Cloudy as links people comment on, with every version kept and the comments handed back to your agent.",
5
5
  "license": "MIT",
6
6
  "author": "The Cloudy authors",