cloudtifact 0.1.1 → 0.1.2

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 +48 -14
  2. package/package.json +11 -12
package/dist/index.js CHANGED
@@ -5703,6 +5703,11 @@ const devLoginOutput = object({
5703
5703
  token: string(),
5704
5704
  user: userSchema
5705
5705
  });
5706
+ /** A one-hour token for the comment panel on published pages: reads a space and reads or posts its comments. */
5707
+ const embedTokenOutput = object({
5708
+ token: string(),
5709
+ expiresAt: number$1()
5710
+ });
5706
5711
  object({ label: string().max(60).optional() });
5707
5712
  const cliLoginStartOutput = object({
5708
5713
  deviceCode: string(),
@@ -5749,6 +5754,25 @@ const listTokensOutput = object({ tokens: array(object({
5749
5754
  const preferencesSchema = object({ developerMode: boolean() });
5750
5755
  preferencesSchema.partial();
5751
5756
  object({ handle: handleSchema });
5757
+ const emailCategoryIdSchema = _enum([
5758
+ "invites",
5759
+ "activity",
5760
+ "product"
5761
+ ]);
5762
+ const emailPreferencesSchema = object({
5763
+ email: string().nullable(),
5764
+ categories: array(object({
5765
+ id: emailCategoryIdSchema,
5766
+ label: string(),
5767
+ description: string(),
5768
+ enabled: boolean()
5769
+ }))
5770
+ });
5771
+ object({
5772
+ invites: boolean(),
5773
+ activity: boolean(),
5774
+ product: boolean()
5775
+ }).partial().strict();
5752
5776
  const meOutput = object({
5753
5777
  user: userSchema,
5754
5778
  workspaces: array(myWorkspaceSchema),
@@ -6538,8 +6562,11 @@ function createClient({ baseUrl, token, fetch: fetchImpl = fetch, agent, source,
6538
6562
  const app = (id) => `/v1/apps/${enc$1(id)}`;
6539
6563
  return {
6540
6564
  devLogin: (input) => call("POST", "/v1/auth/dev-login", devLoginOutput, input),
6565
+ createEmbedToken: () => call("POST", "/v1/auth/embed-token", embedTokenOutput),
6541
6566
  me: () => call("GET", "/v1/me", meOutput),
6542
6567
  updatePreferences: (input) => call("PATCH", "/v1/me/preferences", preferencesSchema, input),
6568
+ emailPreferences: () => call("GET", "/v1/me/email-preferences", emailPreferencesSchema),
6569
+ updateEmailPreferences: (input) => call("PATCH", "/v1/me/email-preferences", emailPreferencesSchema, input),
6543
6570
  /** Changes your handle; your personal workspace's slug follows when it matched the old handle. */
6544
6571
  updateHandle: (input) => call("PATCH", "/v1/me/handle", userSchema, input),
6545
6572
  /** Deletes your account for good: tokens stop working, workspaces only you are in are deleted. */
@@ -6725,8 +6752,8 @@ function urlsFor(domain, userContent = USER_CONTENT_DOMAIN) {
6725
6752
  };
6726
6753
  }
6727
6754
  const PUBLIC_URLS = urlsFor(PUBLIC_DOMAIN);
6728
- /** The one-line install for the CLI, against a given API origin. */
6729
- const installCommand = (apiUrl = PUBLIC_URLS.api) => `curl -fsSL ${apiUrl.replace(/\/+$/, "")}/install.sh | sh`;
6755
+ /** The one-line install for the CLI. */
6756
+ const installCommand = () => "npm i -g cloudtifact";
6730
6757
  //#endregion
6731
6758
  //#region ../contract/src/guest-writes.ts
6732
6759
  /**
@@ -11117,6 +11144,19 @@ function errorText(e) {
11117
11144
  //#endregion
11118
11145
  //#region src/publish.ts
11119
11146
  const ENTRY = "index.html";
11147
+ /** A public page's link with the comment panel already open (cloudtifact.app/<id>/?comments). */
11148
+ function commentsUrl(shareUrl) {
11149
+ return `${shareUrl}${shareUrl.includes("?") ? "&" : "?"}comments`;
11150
+ }
11151
+ /**
11152
+ * What `publish` prints after the version line. A public page gets two links to the same page: on its own (a micro
11153
+ * app, with a Comment button in the corner) and with the comment panel already open. A private page has only the
11154
+ * app link, which members open inside the Cloudtifact viewer.
11155
+ */
11156
+ function linkLines(space) {
11157
+ if (space.shareUrl) return [`Page: ${space.shareUrl}`, `With comments: ${commentsUrl(space.shareUrl)}`];
11158
+ return [`Link: ${space.url}`, `Private: only members of the ${space.workspace.slug} workspace can open it. To make it public, change visibility in the space settings on the website.`];
11159
+ }
11120
11160
  /** A local, relative reference, or null for absolute URLs, data:, anchors, etc. Drops ?query and #hash. */
11121
11161
  function localRef(raw) {
11122
11162
  const ref = raw.trim().replace(/^['"]|['"]$/g, "");
@@ -11771,7 +11811,7 @@ description: Use when you make an HTML page for the user (publish it and share t
11771
11811
 
11772
11812
  The folder named by \`dir\` in \`.cloudtifact.json\` (at the repo root) is published to Cloudtifact. Every push makes a new version; readers comment on the published pages.
11773
11813
 
11774
- If the \`cloudtifact\` command isn't found, install it: \`${installCommand()}\` (it lands in \`~/.cloudtifact/bin\`). \`cloudtifact upgrade\` updates it to the latest version.
11814
+ If the \`cloudtifact\` command isn't found, install it: \`${installCommand()}\` (needs Node.js 20 or later). \`cloudtifact upgrade\` updates it to the latest version.
11775
11815
 
11776
11816
  ## Before editing docs in that folder
11777
11817
 
@@ -11794,7 +11834,7 @@ Published file types: Markdown, HTML, and the files pages load (CSS, JS, JSON, i
11794
11834
 
11795
11835
  ## Publishing HTML pages
11796
11836
 
11797
- When you make an HTML page for the user, run \`cloudtifact publish <file.html>\` and give them the link it prints. It uploads the page plus the local files it references (CSS, JS, images).
11837
+ When you make an HTML page for the user, run \`cloudtifact publish <file.html>\` and give them the links it prints. A public page prints two links to the same page: \`Page:\` opens it on its own (with a Comment button in the corner), and \`With comments:\` opens it with the comment panel already open. Give both, or the one the user asked for. A private page prints one \`Link:\`, for members of the workspace. It uploads the page plus the local files it references (CSS, JS, images).
11798
11838
 
11799
11839
  - To update it, edit the same file and publish it again: new version, same link.
11800
11840
  - Keep supporting files next to the HTML (or in subfolders) and reference them with relative paths (\`style.css\`, \`img/logo.png\`). Absolute paths and files outside the page's folder aren't included.
@@ -12076,7 +12116,7 @@ function workspaceTextLines(workspaces, currentSlug) {
12076
12116
  }
12077
12117
  //#endregion
12078
12118
  //#region src/program.ts
12079
- const VERSION = "0.1.1";
12119
+ const VERSION = "0.1.2";
12080
12120
  const program = new Command().name("cloudtifact").description("Publish pages and docs to Cloudtifact as links people comment on, with every version kept and the comments handed back to your agent.").version(VERSION);
12081
12121
  program.command("login").description("Sign in through your browser (GitHub, Google or email) and save a token to the global config").option("--no-browser", "don't open a browser, just print the URL (automatic over SSH)").action(run(async (opts) => {
12082
12122
  const config = await readGlobalConfig();
@@ -12460,13 +12500,6 @@ for (const [name, verb] of [["resolve", "Resolved"], ["unresolve", "Reopened"]])
12460
12500
  const c = await (name === "resolve" ? client.resolveComment(commentId) : client.unresolveComment(commentId));
12461
12501
  console.log(`${verb} ${c.id} on ${c.path}.`);
12462
12502
  }));
12463
- function printLink(space) {
12464
- if (space.shareUrl) console.log(space.shareUrl);
12465
- else {
12466
- console.log(space.url);
12467
- console.log(`Private: only members of the ${space.workspace.slug} workspace can open it. To make it public, change visibility in the space settings on the website.`);
12468
- }
12469
- }
12470
12503
  program.command("publish").description("Publish an HTML page (with the files it references) or a folder; prints its link").argument("<path>", "an .html file or a folder with index.html").option("--public", "anyone with the link can view (only when first published; default: private)").option("--name <name>", "space name (default: the page's <title>, else the file name)").option("--workspace <slug>", "workspace for a new space (default: the current one, see `workspace list`)").option("--entry <file>", "folder only: the page to publish as index.html").option("-m, --message <message>", "version message").option("--no-db", "don't run the db/*.sql files next to the page").action(run(async (target, opts) => {
12471
12504
  const abs = path.resolve(target);
12472
12505
  if (!existsSync(abs)) throw new CliError(`${target} does not exist.`);
@@ -12512,7 +12545,7 @@ program.command("publish").description("Publish an HTML page (with the files it
12512
12545
  const n = bundle.files.length;
12513
12546
  if (r.status === "pushed") console.log(`Published "${space.name}" v${r.version} (${n} file${n === 1 ? "" : "s"}; ${summarize(r.diff)})`);
12514
12547
  else console.log(`No changes since v${space.latestVersion}: "${space.name}"`);
12515
- printLink(space);
12548
+ for (const line of linkLines(space)) console.log(line);
12516
12549
  }));
12517
12550
  program.command("artifacts").description("List pages published with `cloudtifact publish`").option("--toon", "print TOON (compact, for agents)").option("--json", "print JSON").action(run(async (opts) => {
12518
12551
  const map = await readArtifacts();
@@ -12528,7 +12561,8 @@ program.command("artifacts").description("List pages published with `cloudtifact
12528
12561
  workspace: space?.workspace.slug ?? null,
12529
12562
  visibility: space?.visibility ?? null,
12530
12563
  latestVersion: space?.latestVersion ?? null,
12531
- link: space ? space.shareUrl ?? space.url : null
12564
+ link: space ? space.shareUrl ?? space.url : null,
12565
+ commentsLink: space ? space.shareUrl ? commentsUrl(space.shareUrl) : space.url : null
12532
12566
  });
12533
12567
  }
12534
12568
  const format = resolveFormat(opts);
package/package.json CHANGED
@@ -1,17 +1,12 @@
1
1
  {
2
2
  "name": "cloudtifact",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Publish pages and docs to Cloudtifact 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 Cloudtifact authors",
7
7
  "homepage": "https://cloudtifact.com/docs/reference/cli",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/cloudtifact/cloudtifact.git",
11
- "directory": "packages/cli"
12
- },
13
8
  "bugs": {
14
- "url": "https://github.com/cloudtifact/cloudtifact/issues"
9
+ "url": "https://cloudtifact.com/support"
15
10
  },
16
11
  "keywords": [
17
12
  "cloudtifact",
@@ -37,15 +32,15 @@
37
32
  "node": ">=20"
38
33
  },
39
34
  "devDependencies": {
35
+ "@cloudtifact/contract": "0.1.0",
36
+ "@cloudtifact/typescript-config": "0.1.0",
37
+ "@toon-format/toon": "^4.1.1",
40
38
  "@types/node": "^20.19.0",
41
39
  "commander": "^15.0.0",
42
40
  "tsdown": "^0.23.0",
43
41
  "typescript": "^5.9.3",
44
42
  "vitest": "~4.1.11",
45
- "zod": "^4.6.5",
46
- "@toon-format/toon": "^4.1.1",
47
- "@cloudtifact/contract": "0.1.0",
48
- "@cloudtifact/typescript-config": "0.1.0"
43
+ "zod": "^4.6.5"
49
44
  },
50
45
  "publishConfig": {
51
46
  "access": "public"
@@ -55,5 +50,9 @@
55
50
  "dev": "tsdown --watch",
56
51
  "typecheck": "tsc --noEmit",
57
52
  "test": "vitest run"
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/Cloudtifact/cloudtifact-cli.git"
58
57
  }
59
- }
58
+ }