@mediamonks/canopy-cli 0.7.54 → 0.7.56
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/{ai-BlqO9NhM.mjs → ai-DDVTX_nO.mjs} +2 -2
- package/dist/{api-D4KUT6Ly.mjs → api-MIRoGsB6.mjs} +1 -1
- package/dist/{audience-Dlrsdthb.mjs → audience-8U1dwxcU.mjs} +3 -3
- package/dist/{browse-CW3CnhK_.mjs → browse-CVBq2IB4.mjs} +2 -2
- package/dist/{calls-DFtWVJfv.mjs → calls-Cnt16FiF.mjs} +3 -3
- package/dist/{db-Dy1csI71.mjs → db-CXeAa-Qy.mjs} +4 -4
- package/dist/{deploy-DHjZj2Pq.mjs → deploy-C1mwXvJY.mjs} +4 -4
- package/dist/{dev-BvzqZU_F.mjs → dev--vOKyg1k.mjs} +9 -9
- package/dist/dev-CCMeTwvP.mjs +2 -0
- package/dist/{dev-worker-BdVcP-SM.mjs → dev-worker-7tqL9UFi.mjs} +1 -1
- package/dist/docs/cli-members.md +7 -0
- package/dist/docs/outside-sign-in.md +16 -5
- package/dist/docs/platform-members-and-access.md +8 -0
- package/dist/{docs-CoH01QrG.mjs → docs-DgMINV-7.mjs} +4 -4
- package/dist/{egress-hKpsJF84.mjs → egress-Cy3UBgEM.mjs} +3 -3
- package/dist/{feedback-CFaqNiiw.mjs → feedback-DymVKtj0.mjs} +4 -4
- package/dist/{files-DKtyMjY0.mjs → files-CYTMMRC0.mjs} +3 -3
- package/dist/index.mjs +38 -38
- package/dist/{local-B1N4TpE9.mjs → local-DCo1A00D.mjs} +3 -3
- package/dist/login-BpmefYHv.mjs +355 -0
- package/dist/{logs-ByDPHO28.mjs → logs-CWr7tRhN.mjs} +3 -3
- package/dist/{mcp-B8VXA-TE.mjs → mcp-D0TZcRce.mjs} +3 -3
- package/dist/{migrations-k5pyUUR0.mjs → migrations-CkGa1pmn.mjs} +2 -2
- package/dist/{open-CYfkeTaw.mjs → open-D2WqNBiq.mjs} +2 -2
- package/dist/{package-BDKvR7By.mjs → package-BpSdSdZI.mjs} +1 -1
- package/dist/project-template-D-e33lix.mjs +2 -0
- package/dist/{project-template-B297eCQ0.mjs → project-template-DjbT9RRU.mjs} +3 -3
- package/dist/{projects-ztlDQi0P.mjs → projects-Dcq37hny.mjs} +75 -16
- package/dist/{rename-BZ8hvUUt.mjs → rename-DTg_3_BJ.mjs} +3 -3
- package/dist/repo-C_gmPkLX.mjs +2 -0
- package/dist/{repo-BUIM4d_1.mjs → repo-ZjkxQKwh.mjs} +3 -3
- package/dist/{roles-Yn8U3cr-.mjs → roles-2dF7LkZB.mjs} +63 -10
- package/dist/roles-B5E2tfbN.mjs +2 -0
- package/dist/{schedule-Cv26MIfS.mjs → schedule-_u2Ab1WH.mjs} +3 -3
- package/dist/{secrets-C6tF7BI9.mjs → secrets-H1bQRNBr.mjs} +3 -3
- package/dist/{site-C0nf9RXY.mjs → site-BcZ0LOvm.mjs} +2 -1
- package/dist/{skill-BXlKClK3.mjs → skill-BHDQdPTC.mjs} +2 -2
- package/dist/{src-B0WdnVz9.mjs → src-DpjA-a59.mjs} +23 -22
- package/dist/{staging-C9mn0EBS.mjs → staging-BZJwA_iG.mjs} +3 -3
- package/dist/{token-DIJtUPrE.mjs → token-BEV5lbld.mjs} +3 -3
- package/dist/{ui-BPq6-hKS.mjs → ui-7cyGNbu5.mjs} +1 -1
- package/dist/{upgrade-CJln-B-I.mjs → upgrade-BYTMPnOF.mjs} +2 -2
- package/dist/{usage-DBhL6SUo.mjs → usage-iYp64st3.mjs} +3 -3
- package/package.json +4 -4
- package/dist/dev-wHv8RrDn.mjs +0 -2
- package/dist/login-cbwynFoT.mjs +0 -355
- package/dist/project-template-B6YpesjZ.mjs +0 -2
- package/dist/repo-fDD4TcJ4.mjs +0 -2
- package/dist/roles-DvywfJ8x.mjs +0 -2
- package/dist/templates/worker/.github/workflows/canopy-deploy.yml +0 -40
- package/dist/templates/worker/index.html +0 -12
- package/dist/templates/worker/src/app.tsx +0 -25
- package/dist/templates/worker/src/canopy.ts +0 -5
- package/dist/templates/worker/src/main.tsx +0 -10
- package/dist/templates/worker/src/style.css +0 -29
- package/dist/templates/worker/vite.config.ts +0 -7
|
@@ -1,13 +1,60 @@
|
|
|
1
|
-
import { d as projectUrl, h as tryReadCanopyJson, r as siteConfig } from "./site-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { i as
|
|
5
|
-
import {
|
|
1
|
+
import { d as projectUrl, h as tryReadCanopyJson, r as siteConfig } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { d as HOST_LABEL_SEPARATOR } from "./src-DpjA-a59.mjs";
|
|
3
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
4
|
+
import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
|
|
5
|
+
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-DjbT9RRU.mjs";
|
|
6
|
+
import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-ZjkxQKwh.mjs";
|
|
6
7
|
import { defineCommand } from "citty";
|
|
7
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
8
9
|
import { join, relative, resolve, sep } from "node:path";
|
|
9
10
|
import * as p from "@clack/prompts";
|
|
10
11
|
import { fileURLToPath } from "node:url";
|
|
12
|
+
const SLUG_RE = new RegExp(`^[a-z](?:[a-z0-9-]{0,38}[a-z0-9])?$`);
|
|
13
|
+
/** Hostnames the gateway owns or that would confuse humans — never project slugs. */
|
|
14
|
+
const RESERVED_SLUGS = /* @__PURE__ */ new Set([
|
|
15
|
+
"admin",
|
|
16
|
+
"api",
|
|
17
|
+
"app",
|
|
18
|
+
"auth",
|
|
19
|
+
"canopy",
|
|
20
|
+
"dashboard",
|
|
21
|
+
"dev",
|
|
22
|
+
"docs",
|
|
23
|
+
"mail",
|
|
24
|
+
"staging",
|
|
25
|
+
"status",
|
|
26
|
+
"www"
|
|
27
|
+
]);
|
|
28
|
+
/** Why the API would refuse `slug`, as a prompt message, or undefined when it is fine. */
|
|
29
|
+
function slugRuleProblem(slug) {
|
|
30
|
+
if (!SLUG_RE.test(slug)) return "Up to 40 characters: lowercase letters, digits and dashes, starting with a letter and not ending in a dash.";
|
|
31
|
+
if (slug.includes("-dot-")) return `"${HOST_LABEL_SEPARATOR}" is reserved for preview hostnames.`;
|
|
32
|
+
if (RESERVED_SLUGS.has(slug)) return `"${slug}" is reserved for the platform.`;
|
|
33
|
+
}
|
|
34
|
+
/** Prefix for a name that starts with a digit: "2026 plan" → "p-2026-plan". */
|
|
35
|
+
const DIGIT_PREFIX = "p-";
|
|
36
|
+
/** Slug for a name with nothing usable in it ("!!!", "Ωμέγα"). */
|
|
37
|
+
const EMPTY_FALLBACK = "project";
|
|
38
|
+
/** Suffix that frees a reserved name: "Admin" → "admin-project". */
|
|
39
|
+
const RESERVED_SUFFIX = "-project";
|
|
40
|
+
/**
|
|
41
|
+
* A project slug from a free-form name that the API always accepts:
|
|
42
|
+
* lowercase, runs of anything but a-z 0-9 become one dash, no "-dot-",
|
|
43
|
+
* at most 40 characters, never ending in a dash. A name starting with a
|
|
44
|
+
* digit gets a `p-` prefix (slugs start with a letter), a reserved name gets
|
|
45
|
+
* a `-project` suffix, and a name with nothing usable becomes `project`.
|
|
46
|
+
* Whether the slug is still free is the API's call.
|
|
47
|
+
*/
|
|
48
|
+
function slugify(input) {
|
|
49
|
+
let slug = input.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/(^-+|-+$)/g, "");
|
|
50
|
+
while (slug.includes(HOST_LABEL_SEPARATOR)) slug = slug.replaceAll(HOST_LABEL_SEPARATOR, "-");
|
|
51
|
+
if (/^\d/.test(slug)) slug = DIGIT_PREFIX + slug;
|
|
52
|
+
slug = slug.slice(0, 40).replace(/-+$/, "");
|
|
53
|
+
if (!slug) return EMPTY_FALLBACK;
|
|
54
|
+
if (RESERVED_SLUGS.has(slug)) return slug + RESERVED_SUFFIX;
|
|
55
|
+
return slug;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
11
58
|
//#region src/template.ts
|
|
12
59
|
/**
|
|
13
60
|
* Template registry + scaffolder for `canopy create`. Templates are real,
|
|
@@ -18,6 +65,10 @@ import { fileURLToPath } from "node:url";
|
|
|
18
65
|
* Scaffolding copies a template recursively, substitutes {{name}}/{{slug}}
|
|
19
66
|
* and the site's {{url}}/{{dashboardUrl}}, and renames _gitignore → .gitignore (npm strips .gitignore files from
|
|
20
67
|
* published tarballs, so templates can't ship one under its real name).
|
|
68
|
+
*
|
|
69
|
+
* A template with a `base` is an overlay: its directory holds only the files
|
|
70
|
+
* that differ, written over a copy of the base template (worker = spa plus
|
|
71
|
+
* its backend, its own package.json, README, …).
|
|
21
72
|
*/
|
|
22
73
|
/** Template vars for a project on the resolved profile's site. */
|
|
23
74
|
function siteTemplateVars(name, slug) {
|
|
@@ -44,7 +95,8 @@ const TEMPLATES = [
|
|
|
44
95
|
id: "worker",
|
|
45
96
|
label: "React SPA + backend worker",
|
|
46
97
|
hint: "spa plus server-side handlers in worker/ — for secrets, schedules, external APIs",
|
|
47
|
-
needsInstall: true
|
|
98
|
+
needsInstall: true,
|
|
99
|
+
base: "spa"
|
|
48
100
|
}
|
|
49
101
|
];
|
|
50
102
|
function templatesRoot() {
|
|
@@ -52,9 +104,24 @@ function templatesRoot() {
|
|
|
52
104
|
for (const candidate of [join(base, "templates"), join(base, "..", "..", "templates")]) if (existsSync(join(candidate, "static"))) return candidate;
|
|
53
105
|
throw new Error("Template files not found — the CLI build is incomplete (missing templates/).");
|
|
54
106
|
}
|
|
107
|
+
/** Template directories to copy, base first, for a template id. */
|
|
108
|
+
function templateLayers(templateId) {
|
|
109
|
+
const layers = [];
|
|
110
|
+
for (let id = templateId; id;) {
|
|
111
|
+
const template = TEMPLATES.find((t) => t.id === id);
|
|
112
|
+
if (!template) throw new Error(`Unknown template "${id}".`);
|
|
113
|
+
if (layers.includes(id)) throw new Error(`Template "${id}" is its own base.`);
|
|
114
|
+
layers.unshift(id);
|
|
115
|
+
id = template.base;
|
|
116
|
+
}
|
|
117
|
+
return layers;
|
|
118
|
+
}
|
|
55
119
|
function scaffoldTemplate(templateId, targetDir, vars) {
|
|
56
|
-
const
|
|
120
|
+
const root = templatesRoot();
|
|
57
121
|
mkdirSync(targetDir, { recursive: true });
|
|
122
|
+
for (const layer of templateLayers(templateId)) copyTemplateDir(join(root, layer), targetDir, vars);
|
|
123
|
+
}
|
|
124
|
+
function copyTemplateDir(source, targetDir, vars) {
|
|
58
125
|
for (const entry of readdirSync(source, {
|
|
59
126
|
recursive: true,
|
|
60
127
|
withFileTypes: true
|
|
@@ -92,11 +159,6 @@ function projectRows(projects, isAdmin) {
|
|
|
92
159
|
const roleWidth = Math.max(...roles.map((role) => role.length));
|
|
93
160
|
return projects.map((project, i) => `${project.slug.padEnd(width)} ${project.status.padEnd(7)} ${roles[i].padEnd(roleWidth)} ${projectUrl(project.slug)} ${project.name}`);
|
|
94
161
|
}
|
|
95
|
-
function slugify(input) {
|
|
96
|
-
let slug = input.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/(^-+|-+$)/g, "").slice(0, 40);
|
|
97
|
-
while (slug.includes("-dot-")) slug = slug.replaceAll("-dot-", "-");
|
|
98
|
-
return slug;
|
|
99
|
-
}
|
|
100
162
|
function shouldScaffoldCreate(requested, cwd = process.cwd()) {
|
|
101
163
|
return requested ?? !existsSync(join(cwd, "canopy.json"));
|
|
102
164
|
}
|
|
@@ -160,10 +222,7 @@ const createCommand = defineCommand({
|
|
|
160
222
|
message: "Slug",
|
|
161
223
|
defaultValue: slugify(name),
|
|
162
224
|
placeholder: slugify(name),
|
|
163
|
-
validate: (value) =>
|
|
164
|
-
if (value && !/^[a-z0-9][a-z0-9-]*$/.test(value)) return "Lowercase letters, digits and dashes only.";
|
|
165
|
-
if (value?.includes("-dot-")) return `"-dot-" is reserved for preview hostnames.`;
|
|
166
|
-
}
|
|
225
|
+
validate: (value) => value ? slugRuleProblem(value) : void 0
|
|
167
226
|
})).trim();
|
|
168
227
|
slug ||= slugify(name);
|
|
169
228
|
if (args.from) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as projectUrl, f as resolveProject, l as projectDirArgs, p as rewriteCanopyJsonSlug } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-
|
|
1
|
+
import { d as projectUrl, f as resolveProject, l as projectDirArgs, p as rewriteCanopyJsonSlug } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/rename.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as parseGithubRemote, f as resolveProject, h as tryReadCanopyJson, l as projectDirArgs, o as parseRepositoryArg, r as siteConfig, u as projectFlagArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-
|
|
3
|
-
import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-
|
|
1
|
+
import { a as parseGithubRemote, f as resolveProject, h as tryReadCanopyJson, l as projectDirArgs, o as parseRepositoryArg, r as siteConfig, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { a as parseCredentialInput, i as helperCommand, o as runCredentialHelper, r as fileTokenCache, t as RepoCredentialError } from "./repo-credential-CNDRM-tG.mjs";
|
|
5
5
|
import { defineCommand } from "citty";
|
|
6
6
|
import { existsSync, realpathSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as resolveProject, l as projectDirArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-
|
|
1
|
+
import { d as projectUrl, f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/roles.ts
|
|
@@ -14,6 +14,47 @@ import * as p from "@clack/prompts";
|
|
|
14
14
|
* and, when it is members-only, who may open it. App roles are the project's
|
|
15
15
|
* own labels, delivered to the app as `roles` and never enforced by Canopy.
|
|
16
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* The access message an inviter passes on to someone outside Monks
|
|
19
|
+
* (outside-invite-opt-in): the dashboard's invite dialog shows the same text.
|
|
20
|
+
* Worded to nobody in particular, so it can be pasted on unchanged.
|
|
21
|
+
*/
|
|
22
|
+
function accessMessage(input) {
|
|
23
|
+
return [
|
|
24
|
+
`${input.projectName} is shared with ${input.email} on Canopy.`,
|
|
25
|
+
"",
|
|
26
|
+
`1. Open ${input.url}`,
|
|
27
|
+
"2. Choose \"Not at Monks? Sign in with email\"",
|
|
28
|
+
`3. Enter ${input.email}`,
|
|
29
|
+
"4. Open the sign-in link from the email that arrives, or type its 6-digit code on the page"
|
|
30
|
+
].join("\n");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What `members add` prints. An outsider gets the access message to pass on
|
|
34
|
+
* and what happened to the invitation email; a Monk the one-line summary.
|
|
35
|
+
*/
|
|
36
|
+
function formatAdded(res, input) {
|
|
37
|
+
const entry = res.member ?? res.invite;
|
|
38
|
+
const role = entry?.role ?? "editor";
|
|
39
|
+
const roles = input.appRoles?.length ? ` with ${input.appRoles.join(", ")}` : "";
|
|
40
|
+
if (entry?.outside) {
|
|
41
|
+
const email = entry.email;
|
|
42
|
+
const head = res.member ? `Added ${email} as ${role}${roles}.` : `Invited ${email} as ${role}${roles}.`;
|
|
43
|
+
const mail = res.invitationSent === true ? "Invitation emailed." : res.invitationSent === false ? "The invitation email didn't go out; send it from the dashboard's Members card." : "No email was sent; share the message above, or pass --send-invitation.";
|
|
44
|
+
return [
|
|
45
|
+
head,
|
|
46
|
+
"",
|
|
47
|
+
accessMessage({
|
|
48
|
+
projectName: input.projectName,
|
|
49
|
+
url: input.url,
|
|
50
|
+
email
|
|
51
|
+
}),
|
|
52
|
+
"",
|
|
53
|
+
mail
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
return res.invite ? `Invited ${input.email} as ${role}${roles} — it takes effect when they first sign in. Canopy sends no email, so let them know.` : `Added ${input.email} as ${role}${roles}.`;
|
|
57
|
+
}
|
|
17
58
|
const ROLE_FIXES = {
|
|
18
59
|
not_found: "The project or role doesn't exist, or you can't manage this project — only its owner and editors can.",
|
|
19
60
|
invalid_role_slug: "Slugs are 1–32 lowercase letters, digits and dashes, starting with a letter. Pass one with --slug.",
|
|
@@ -215,6 +256,8 @@ const MEMBER_FIXES = {
|
|
|
215
256
|
already_member: "They're already on the project — change them with `canopy members set`.",
|
|
216
257
|
already_invited: "They already have a pending invite — change it with `canopy members set`.",
|
|
217
258
|
email_domain_not_allowed: "Only colleagues who can sign in to Canopy can be added.",
|
|
259
|
+
outside_member_viewer_only: "People outside Monks can only be viewers — leave out the role flag, or pass --viewer.",
|
|
260
|
+
outside_member_not_allowed: "People outside Monks can't be added to the dashboard project.",
|
|
218
261
|
cannot_change_owner: "The owner's role is fixed.",
|
|
219
262
|
cannot_remove_owner: "The owner can't be removed — delete the project instead."
|
|
220
263
|
};
|
|
@@ -262,9 +305,13 @@ const membersCommand = defineCommand({
|
|
|
262
305
|
args: {
|
|
263
306
|
email: {
|
|
264
307
|
type: "positional",
|
|
265
|
-
description: "Their
|
|
308
|
+
description: "Their email; someone outside Monks joins as a viewer",
|
|
266
309
|
required: true
|
|
267
310
|
},
|
|
311
|
+
"send-invitation": {
|
|
312
|
+
type: "boolean",
|
|
313
|
+
description: "Someone outside Monks: also email them the invitation (off by default)"
|
|
314
|
+
},
|
|
268
315
|
viewer: {
|
|
269
316
|
type: "boolean",
|
|
270
317
|
description: "May open the app, not manage the project"
|
|
@@ -282,18 +329,24 @@ const membersCommand = defineCommand({
|
|
|
282
329
|
},
|
|
283
330
|
run: reportErrors("members add", async ({ args }) => {
|
|
284
331
|
const { slug } = resolveProject(args);
|
|
285
|
-
const role = canopyRoleFlag(args)
|
|
332
|
+
const role = canopyRoleFlag(args);
|
|
286
333
|
const appRoles = appRolesOf(args);
|
|
287
334
|
const res = await withContext(apiRequest("POST", `/projects/${slug}/members`, {
|
|
288
335
|
email: args.email,
|
|
289
|
-
role,
|
|
290
|
-
...appRoles && { app_roles: appRoles }
|
|
336
|
+
...role && { role },
|
|
337
|
+
...appRoles && { app_roles: appRoles },
|
|
338
|
+
...args["send-invitation"] && { sendInvitation: true }
|
|
291
339
|
}), {
|
|
292
340
|
action: `add ${args.email} to ${slug}`,
|
|
293
341
|
fixes: MEMBER_FIXES
|
|
294
342
|
});
|
|
295
|
-
const
|
|
296
|
-
console.log(res
|
|
343
|
+
const projectName = (res.member ?? res.invite)?.outside === true ? await apiRequest("GET", `/projects/${slug}`).then((r) => r.project.name || slug).catch(() => slug) : slug;
|
|
344
|
+
console.log(formatAdded(res, {
|
|
345
|
+
email: args.email,
|
|
346
|
+
appRoles,
|
|
347
|
+
projectName,
|
|
348
|
+
url: projectUrl(slug)
|
|
349
|
+
}));
|
|
297
350
|
})
|
|
298
351
|
}),
|
|
299
352
|
set: defineCommand({
|
|
@@ -434,4 +487,4 @@ const membersCommand = defineCommand({
|
|
|
434
487
|
}
|
|
435
488
|
});
|
|
436
489
|
//#endregion
|
|
437
|
-
export {
|
|
490
|
+
export { formatRoster as a, rolesCommand as c, formatRoles as i, canopyRoleFlag as n, membersCommand as o, formatAdded as r, parseAppRoleFlag as s, accessMessage as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as resolveProject, u as projectFlagArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { i as reportErrors, n as formatDateTime } from "./ui-
|
|
1
|
+
import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/schedule.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as resolveProject, l as projectDirArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { i as reportErrors, n as formatDateTime, s as unwrap } from "./ui-
|
|
1
|
+
import { f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime, s as unwrap } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/secrets.ts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { f as STAGING_LABEL_PREFIX } from "./src-DpjA-a59.mjs";
|
|
1
2
|
import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
4
|
import { join, resolve } from "node:path";
|
|
@@ -178,7 +179,7 @@ function projectUrl(slug) {
|
|
|
178
179
|
/** The staging channel's URL (docs/14): the first label becomes `staging-dot-<slug>`. */
|
|
179
180
|
function stagingUrl(slug) {
|
|
180
181
|
const url = new URL(projectUrl(slug));
|
|
181
|
-
url.hostname =
|
|
182
|
+
url.hostname = `${STAGING_LABEL_PREFIX}${url.hostname}`;
|
|
182
183
|
return url.origin;
|
|
183
184
|
}
|
|
184
185
|
/** canopy.json parsed if present; undefined when the file is missing. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
2
|
-
import { i as reportErrors } from "./ui-
|
|
1
|
+
import { t as version } from "./package-BpSdSdZI.mjs";
|
|
2
|
+
import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -347,6 +347,12 @@ function blobRouter(config) {
|
|
|
347
347
|
return blob;
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
350
|
+
//#region ../data-plane/src/host-label.ts
|
|
351
|
+
/** Separates the prefix from the slug. Rejected inside real slugs for that reason. */
|
|
352
|
+
const HOST_LABEL_SEPARATOR = "-dot-";
|
|
353
|
+
/** A staging-channel label starts with this (also the channel qualifier on signed blob scopes). */
|
|
354
|
+
const STAGING_LABEL_PREFIX = `staging${HOST_LABEL_SEPARATOR}`;
|
|
355
|
+
//#endregion
|
|
350
356
|
//#region ../data-plane/src/dialect.ts
|
|
351
357
|
/** Platform-managed fields map to real columns instead of JSON extraction. */
|
|
352
358
|
const META_COLUMNS = {
|
|
@@ -1178,12 +1184,11 @@ const monkHeaders = {
|
|
|
1178
1184
|
/**
|
|
1179
1185
|
* How a project's backend addresses the platform — the one definition.
|
|
1180
1186
|
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
* runtime
|
|
1184
|
-
* (packages/cli/src/dev-worker.ts).
|
|
1185
|
-
*
|
|
1186
|
-
* credential rule — which is exactly how the Google project grant came to
|
|
1187
|
+
* Two hosts run project workers and each builds this request itself: the
|
|
1188
|
+
* platform shim (packages/data-plane/src/worker-shim.ts), which both
|
|
1189
|
+
* Cloudflare and the Google Cloud runtime run, and `canopy dev`
|
|
1190
|
+
* (packages/cli/src/dev-worker.ts). Separate copies of the header shaping and
|
|
1191
|
+
* the credential rule are exactly how the Google project grant once came to
|
|
1187
1192
|
* work on one target and not the other.
|
|
1188
1193
|
*
|
|
1189
1194
|
* The shim cannot import this: it ships as a standalone module uploaded
|
|
@@ -1307,8 +1312,8 @@ const IDENTITY_STAMP_HEADERS = [
|
|
|
1307
1312
|
];
|
|
1308
1313
|
|
|
1309
1314
|
// App roles (project-roles) — transcribed from rolesFromHeaders in
|
|
1310
|
-
//
|
|
1311
|
-
//
|
|
1315
|
+
// caller-headers.ts: undefined without the header (an older gateway), so the
|
|
1316
|
+
// property stays absent rather than [].
|
|
1312
1317
|
function rolesFromHeaders(headers) {
|
|
1313
1318
|
const raw = headers.get("x-canopy-identity-roles");
|
|
1314
1319
|
if (raw === null) return undefined;
|
|
@@ -1330,11 +1335,10 @@ function userFromHeaders(headers) {
|
|
|
1330
1335
|
};
|
|
1331
1336
|
}
|
|
1332
1337
|
|
|
1333
|
-
// env.CALLER (worker-caller-identity) — transcribed from
|
|
1334
|
-
//
|
|
1335
|
-
//
|
|
1336
|
-
// A call from another project (project-calls) —
|
|
1337
|
-
// projectCallerFromHeaders in project-runtime/src/user.ts.
|
|
1338
|
+
// env.CALLER (worker-caller-identity) — transcribed from readCaller in
|
|
1339
|
+
// caller-headers.ts: everyone the wall let through, client-password visitors
|
|
1340
|
+
// included, from headers older shims never read.
|
|
1341
|
+
// A call from another project (project-calls) — readProjectCaller there.
|
|
1338
1342
|
function projectCallerFromHeaders(headers, id) {
|
|
1339
1343
|
const project = (headers.get("x-canopy-identity-project") || "").trim();
|
|
1340
1344
|
const channel = (headers.get("x-canopy-identity-channel") || "").trim();
|
|
@@ -1368,8 +1372,8 @@ function projectCallerFromHeaders(headers, id) {
|
|
|
1368
1372
|
};
|
|
1369
1373
|
}
|
|
1370
1374
|
|
|
1371
|
-
// env.CALLER.token (project-access-tokens) — transcribed from
|
|
1372
|
-
//
|
|
1375
|
+
// env.CALLER.token (project-access-tokens) — transcribed from readToken in
|
|
1376
|
+
// caller-headers.ts: the gateway's base64url
|
|
1373
1377
|
// JSON description of the access token a call came with, or null.
|
|
1374
1378
|
function stringList(value) {
|
|
1375
1379
|
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
@@ -1769,15 +1773,13 @@ async function handleBlobChannel(request, bucket) {
|
|
|
1769
1773
|
// on the egress allowlist, and even allowed it would hit the auth wall with
|
|
1770
1774
|
// no session. Identity rides AsyncLocalStorage per inbound request (never a
|
|
1771
1775
|
// closure — the userland patch this replaces bled users across concurrent
|
|
1772
|
-
// requests).
|
|
1773
|
-
//
|
|
1774
|
-
// wfp-shim.test.ts and project-runtime's self-fetch.test.ts run matching
|
|
1775
|
-
// cases so the two can't drift silently.
|
|
1776
|
+
// requests). This is the one implementation, on both targets
|
|
1777
|
+
// (gcp-runtime-boundary); wfp-shim.test.ts holds its cases.
|
|
1776
1778
|
|
|
1777
1779
|
const SELF_FETCH_DEPTH_HEADER = "x-canopy-self-fetch-depth";
|
|
1778
1780
|
const SELF_FETCH_MAX_DEPTH = 8;
|
|
1779
1781
|
// Everything that says who is calling (CALLER_IDENTITY_HEADERS in
|
|
1780
|
-
//
|
|
1782
|
+
// caller-headers.ts): the user and caller stamps plus the agent mark.
|
|
1781
1783
|
const IDENTITY_HEADERS = [...IDENTITY_STAMP_HEADERS, "x-canopy-caller"];
|
|
1782
1784
|
|
|
1783
1785
|
const selfFetchContext = new AsyncLocalStorage();
|
|
@@ -1972,7 +1974,6 @@ export default {
|
|
|
1972
1974
|
|
|
1973
1975
|
// Slack traffic for the project's own app (docs/33 §6), delivered by
|
|
1974
1976
|
// canopy-api through the dispatch binding after signature verification.
|
|
1975
|
-
// Kept in lockstep with the twin branch in project-runtime/src/loader.ts.
|
|
1976
1977
|
// Platform database channel (docs/43 §5.5): canopy-data runs the project's
|
|
1977
1978
|
// SDK statements through THIS script's own D1 binding instead of the REST
|
|
1978
1979
|
// API — a dispatch hop plus a binding call, not an HTTPS round trip to
|
|
@@ -2153,4 +2154,4 @@ export default {
|
|
|
2153
2154
|
};
|
|
2154
2155
|
`;
|
|
2155
2156
|
//#endregion
|
|
2156
|
-
export { readPersonCaller as a, dbRouter as c,
|
|
2157
|
+
export { readPersonCaller as a, dbRouter as c, HOST_LABEL_SEPARATOR as d, STAGING_LABEL_PREFIX as f, isCreateOnly as h, CALLER_HEADER as i, hasPrivateNames as l, blobRouter as m, redactCanopyCredentials as n, readUser as o, STREAMED_BLOB_BYTES as p, stampWorkerHeaders as r, realtimeRouter as s, WORKER_ATTEST_HEADER as t, META_COLUMNS as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as projectUrl, f as resolveProject, m as stagingUrl, s as parseVersionArg, u as projectFlagArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-
|
|
1
|
+
import { d as projectUrl, f as resolveProject, m as stagingUrl, s as parseVersionArg, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/staging.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as resolveProject, l as projectDirArgs, u as projectFlagArgs } from "./site-
|
|
2
|
-
import { a as apiRequest } from "./api-
|
|
3
|
-
import { i as reportErrors, n as formatDateTime } from "./ui-
|
|
1
|
+
import { f as resolveProject, l as projectDirArgs, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
const tokenCommand = defineCommand({
|
|
6
6
|
meta: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as PACKAGE_NAME } from "./version-check-CcsA1QjI.mjs";
|
|
2
|
-
import { i as reportErrors } from "./ui-
|
|
2
|
+
import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -112,7 +112,7 @@ const upgradeCommand = defineCommand({
|
|
|
112
112
|
const spec = `${PACKAGE_NAME}@${args.version ?? "latest"}`;
|
|
113
113
|
const command = pmCommand(pm);
|
|
114
114
|
const cmd = installArgs(pm, spec);
|
|
115
|
-
const { skillInstalled } = await import("./skill-
|
|
115
|
+
const { skillInstalled } = await import("./skill-BHDQdPTC.mjs");
|
|
116
116
|
const { homedir } = await import("node:os");
|
|
117
117
|
const refreshGlobal = skillInstalled(homedir());
|
|
118
118
|
const refreshRepo = process.cwd() !== homedir() && skillInstalled(process.cwd());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as resolveProject, u as projectFlagArgs } from "./site-
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { i as reportErrors } from "./ui-
|
|
1
|
+
import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
|
|
3
|
+
import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/usage.ts
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediamonks/canopy-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.56",
|
|
4
4
|
"description": "Canopy CLI — create, develop and deploy Canopy projects.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"canopy": "./dist/index.mjs"
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"@mediamonks/canopy-data-plane": "0.0.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/node": "^
|
|
30
|
-
"ai": "
|
|
29
|
+
"@types/node": "^24",
|
|
30
|
+
"ai": "7.0.84",
|
|
31
31
|
"typescript": "^7.0.2",
|
|
32
32
|
"vite-plus": "0.2.5",
|
|
33
33
|
"@mediamonks/canopy-pages": "0.0.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "pnpm --filter @mediamonks/canopy-pages run build && vp pack
|
|
36
|
+
"build": "pnpm --filter @mediamonks/canopy-pages run build && vp pack",
|
|
37
37
|
"dev": "vp pack --watch",
|
|
38
38
|
"test": "vp test",
|
|
39
39
|
"check": "vp check"
|
package/dist/dev-wHv8RrDn.mjs
DELETED