cloudtifact 0.1.0 → 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.
- package/dist/index.js +51 -15
- 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
|
|
6729
|
-
const installCommand = (
|
|
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, "");
|
|
@@ -11455,10 +11495,12 @@ function findThread(threads, commentId) {
|
|
|
11455
11495
|
}
|
|
11456
11496
|
//#endregion
|
|
11457
11497
|
//#region src/hooks.ts
|
|
11498
|
+
const SCRIPT_INSTALL_BIN = "\"$HOME/.cloudtifact/bin/cloudtifact\"";
|
|
11458
11499
|
/** The command every harness runs after a file edit. Reads the hook payload on stdin, always exits 0. */
|
|
11459
|
-
const HOOK_COMMAND =
|
|
11500
|
+
const HOOK_COMMAND = `if [ -x ${SCRIPT_INSTALL_BIN} ]; then ${SCRIPT_INSTALL_BIN} hook; elif command -v cloudtifact >/dev/null 2>&1; then cloudtifact hook; fi`;
|
|
11460
11501
|
const OUR_COMMANDS = /* @__PURE__ */ new Set([
|
|
11461
11502
|
HOOK_COMMAND,
|
|
11503
|
+
`${SCRIPT_INSTALL_BIN} hook`,
|
|
11462
11504
|
"npx -y cloudtifact hook",
|
|
11463
11505
|
"cloudtifact hook"
|
|
11464
11506
|
]);
|
|
@@ -11769,7 +11811,7 @@ description: Use when you make an HTML page for the user (publish it and share t
|
|
|
11769
11811
|
|
|
11770
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.
|
|
11771
11813
|
|
|
11772
|
-
If the \`cloudtifact\` command isn't found, install it: \`${installCommand()}\` (
|
|
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.
|
|
11773
11815
|
|
|
11774
11816
|
## Before editing docs in that folder
|
|
11775
11817
|
|
|
@@ -11792,7 +11834,7 @@ Published file types: Markdown, HTML, and the files pages load (CSS, JS, JSON, i
|
|
|
11792
11834
|
|
|
11793
11835
|
## Publishing HTML pages
|
|
11794
11836
|
|
|
11795
|
-
When you make an HTML page for the user, run \`cloudtifact publish <file.html>\` and give them the
|
|
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).
|
|
11796
11838
|
|
|
11797
11839
|
- To update it, edit the same file and publish it again: new version, same link.
|
|
11798
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.
|
|
@@ -12074,7 +12116,7 @@ function workspaceTextLines(workspaces, currentSlug) {
|
|
|
12074
12116
|
}
|
|
12075
12117
|
//#endregion
|
|
12076
12118
|
//#region src/program.ts
|
|
12077
|
-
const VERSION = "0.1.
|
|
12119
|
+
const VERSION = "0.1.2";
|
|
12078
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);
|
|
12079
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) => {
|
|
12080
12122
|
const config = await readGlobalConfig();
|
|
@@ -12458,13 +12500,6 @@ for (const [name, verb] of [["resolve", "Resolved"], ["unresolve", "Reopened"]])
|
|
|
12458
12500
|
const c = await (name === "resolve" ? client.resolveComment(commentId) : client.unresolveComment(commentId));
|
|
12459
12501
|
console.log(`${verb} ${c.id} on ${c.path}.`);
|
|
12460
12502
|
}));
|
|
12461
|
-
function printLink(space) {
|
|
12462
|
-
if (space.shareUrl) console.log(space.shareUrl);
|
|
12463
|
-
else {
|
|
12464
|
-
console.log(space.url);
|
|
12465
|
-
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.`);
|
|
12466
|
-
}
|
|
12467
|
-
}
|
|
12468
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) => {
|
|
12469
12504
|
const abs = path.resolve(target);
|
|
12470
12505
|
if (!existsSync(abs)) throw new CliError(`${target} does not exist.`);
|
|
@@ -12510,7 +12545,7 @@ program.command("publish").description("Publish an HTML page (with the files it
|
|
|
12510
12545
|
const n = bundle.files.length;
|
|
12511
12546
|
if (r.status === "pushed") console.log(`Published "${space.name}" v${r.version} (${n} file${n === 1 ? "" : "s"}; ${summarize(r.diff)})`);
|
|
12512
12547
|
else console.log(`No changes since v${space.latestVersion}: "${space.name}"`);
|
|
12513
|
-
|
|
12548
|
+
for (const line of linkLines(space)) console.log(line);
|
|
12514
12549
|
}));
|
|
12515
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) => {
|
|
12516
12551
|
const map = await readArtifacts();
|
|
@@ -12526,7 +12561,8 @@ program.command("artifacts").description("List pages published with `cloudtifact
|
|
|
12526
12561
|
workspace: space?.workspace.slug ?? null,
|
|
12527
12562
|
visibility: space?.visibility ?? null,
|
|
12528
12563
|
latestVersion: space?.latestVersion ?? null,
|
|
12529
|
-
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
|
|
12530
12566
|
});
|
|
12531
12567
|
}
|
|
12532
12568
|
const format = resolveFormat(opts);
|
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudtifact",
|
|
3
|
-
"version": "0.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://
|
|
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
|
+
}
|