@mediamonks/canopy-cli 0.7.59 → 0.7.61

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.
@@ -0,0 +1,129 @@
1
+ import { f as resolveProject, l as projectDirArgs } from "./site-Bz-fEyKS.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-CpG-9WSe.mjs";
3
+ import { i as reportErrors } from "./ui-BUeiY_zZ.mjs";
4
+ import { defineCommand } from "citty";
5
+ //#region src/cors.ts
6
+ /**
7
+ * canopy cors — the project's allowed browser origins on `/api` (OpenSpec
8
+ * project-api-cors): the web apps on other addresses whose pages may call the
9
+ * project's `/api` with an access token. The gateway answers their CORS
10
+ * preflights from this list; everything else gets `cors_origin_not_allowed`.
11
+ * The same list is Settings → Access in the dashboard. Reading it is open to
12
+ * anyone who can open the project's settings; changing it is the owner's.
13
+ */
14
+ /** What `canopy cors list` prints. */
15
+ function renderOrigins(view, slug) {
16
+ const origins = view.origins ?? [];
17
+ const lines = origins.length === 0 ? [`No browser origins may call ${slug}'s /api.`] : [`Browser origins that may call ${slug}'s /api with a token:`, ...origins.map((o) => ` ${o}`)];
18
+ if (!view.enabled) lines.push("", `Access tokens are off for ${slug}, so this list has no effect until the owner turns them on in Settings → Access.`);
19
+ return lines.join("\n");
20
+ }
21
+ /** The list after adding `origin` (the platform normalises and dedupes it). */
22
+ function addOrigin(origins, origin) {
23
+ return [...origins, origin.trim()];
24
+ }
25
+ /**
26
+ * The list after removing `origin`, matched the way the platform stores it
27
+ * (lowercase, no trailing slash, no default port), or null when it isn't listed.
28
+ */
29
+ function removeOrigin(origins, origin) {
30
+ const wanted = comparable(origin);
31
+ const kept = origins.filter((o) => comparable(o) !== wanted);
32
+ return kept.length === origins.length ? null : kept;
33
+ }
34
+ function comparable(origin) {
35
+ return origin.trim().toLowerCase().replace(/\/$/, "").replace(/^(https:\/\/[^/]+):443$/, "$1").replace(/^(http:\/\/[^/]+):80$/, "$1");
36
+ }
37
+ const CORS_FIXES = {
38
+ owner_only: "Only the project owner can change the allowed origins — ask them to run this command, or to add it under Settings → Access.",
39
+ person_required: "Run this with your own sign-in (`canopy login`), not a project-scoped token such as an agent or deploy token.",
40
+ invalid_origin: "Use the app's origin: https:// plus its host, like https://app.example.com, or https://*.example.com for every site under one domain.",
41
+ not_found: "Check the project slug, or this site doesn't support allowed origins yet (update Canopy or try another --profile)."
42
+ };
43
+ async function load(slug) {
44
+ return withContext(apiRequest("GET", `/projects/${slug}/access-tokens`), {
45
+ action: `read the allowed origins of ${slug}`,
46
+ fixes: CORS_FIXES
47
+ });
48
+ }
49
+ async function save(slug, origins, context) {
50
+ return (await withContext(apiRequest("PUT", `/projects/${slug}/access-tokens/origins`, { origins }), {
51
+ ...context,
52
+ fixes: CORS_FIXES
53
+ })).origins;
54
+ }
55
+ const corsCommand = defineCommand({
56
+ meta: {
57
+ name: "cors",
58
+ description: "Manage which web apps on other addresses may call the project's /api with a token"
59
+ },
60
+ subCommands: {
61
+ list: defineCommand({
62
+ meta: {
63
+ name: "list",
64
+ description: "List the browser origins allowed on the project's /api"
65
+ },
66
+ args: { ...projectDirArgs },
67
+ run: reportErrors("cors list", async ({ args }) => {
68
+ const { slug } = resolveProject(args);
69
+ console.log(renderOrigins(await load(slug), slug));
70
+ })
71
+ }),
72
+ allow: defineCommand({
73
+ meta: {
74
+ name: "allow",
75
+ description: "Let a web app's pages call the project's /api with a token (e.g. https://app.example.com or https://*.figma.site)"
76
+ },
77
+ args: {
78
+ origin: {
79
+ type: "positional",
80
+ description: "The app's origin",
81
+ required: true
82
+ },
83
+ ...projectDirArgs
84
+ },
85
+ run: reportErrors("cors allow", async ({ args }) => {
86
+ const { slug } = resolveProject(args);
87
+ const current = await load(slug);
88
+ const origins = await save(slug, addOrigin(current.origins ?? [], args.origin), { action: `allow ${args.origin} on ${slug}` });
89
+ console.log(`Allowed ${args.origin} on ${slug}'s /api — it takes effect within seconds.\n`);
90
+ console.log(renderOrigins({
91
+ ...current,
92
+ origins
93
+ }, slug));
94
+ })
95
+ }),
96
+ remove: defineCommand({
97
+ meta: {
98
+ name: "remove",
99
+ description: "Stop a web app's pages calling the project's /api"
100
+ },
101
+ args: {
102
+ origin: {
103
+ type: "positional",
104
+ description: "The origin to remove",
105
+ required: true
106
+ },
107
+ ...projectDirArgs
108
+ },
109
+ run: reportErrors("cors remove", async ({ args }) => {
110
+ const { slug } = resolveProject(args);
111
+ const current = await load(slug);
112
+ const kept = removeOrigin(current.origins ?? [], args.origin);
113
+ if (kept === null) {
114
+ console.log(`${args.origin} is not allowed on ${slug}; nothing to remove.\n`);
115
+ console.log(renderOrigins(current, slug));
116
+ return;
117
+ }
118
+ const origins = await save(slug, kept, { action: `remove ${args.origin} from ${slug}` });
119
+ console.log(`Removed ${args.origin} from ${slug}'s /api — it takes effect within seconds.\n`);
120
+ console.log(renderOrigins({
121
+ ...current,
122
+ origins
123
+ }, slug));
124
+ })
125
+ })
126
+ }
127
+ });
128
+ //#endregion
129
+ export { corsCommand };
@@ -165,6 +165,8 @@ const MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
165
165
  "json",
166
166
  "csv",
167
167
  "txt",
168
+ "vtt",
169
+ "srt",
168
170
  "png",
169
171
  "jpg",
170
172
  "jpeg",
@@ -174,14 +176,23 @@ const MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
174
176
  "ico",
175
177
  "mp4",
176
178
  "webm",
179
+ "m4v",
180
+ "mov",
181
+ "ogv",
177
182
  "mp3",
178
183
  "wav",
179
184
  "ogg",
180
185
  "m4a",
186
+ "aac",
187
+ "flac",
188
+ "opus",
181
189
  "woff",
182
190
  "woff2",
191
+ "ttf",
192
+ "otf",
183
193
  "glb",
184
194
  "gltf",
195
+ "usdz",
185
196
  "bin"
186
197
  ]);
187
198
  function isMediaFile(path) {
@@ -520,7 +531,7 @@ const deployCommand = defineCommand({
520
531
  for (const folder of mediaFolders) if (!media.some((f) => f.path.startsWith(folder))) p.log.warn(`canopy.json "media": ${folder} is not in the build output; nothing to upload from it.`);
521
532
  const notMedia = media.filter((f) => !isMediaFile(f.path)).map((f) => f.path);
522
533
  if (notMedia.length > 0) throw new Error([
523
- "Site media holds data and media files only (JSON, CSV, text, images, video, audio, fonts, 3D models). These can't be media:",
534
+ "Site media holds data and media files only (JSON, CSV, text, captions, images, video, audio, fonts, 3D models). These can't be media:",
524
535
  ...notMedia.slice(0, 20).map((path) => ` ${path}`),
525
536
  ...notMedia.length > 20 ? [` … and ${notMedia.length - 20} more`] : [],
526
537
  "Move them out of the media folders, or take the folder out of canopy.json \"media\"."
@@ -84,6 +84,33 @@ A personal token keeps working as long as its person signs in to Canopy at
84
84
  least once a month, in a browser or with `canopy login`. If someone only ever uses the plugin, the
85
85
  `token_access_lost` answer tells them to sign in again.
86
86
 
87
+ ## Calling from a web app
88
+
89
+ A web app on another address, like an app built in Figma Make, can call the
90
+ project's `/api` with a token too. The owner first allows the app's address,
91
+ with [`canopy cors allow`](https://docs.canopy.website/cli/cors) or under **Settings → Access → Allowed
92
+ browser origins**:
93
+
94
+ ```bash
95
+ canopy cors allow "https://*.figma.site"
96
+ ```
97
+
98
+ Then the app calls the project as usual:
99
+
100
+ ```js
101
+ const res = await fetch("https://my-project.canopy.website/api/records", {
102
+ headers: { Authorization: `Bearer ${CANOPY_KEY}` },
103
+ });
104
+ ```
105
+
106
+ Canopy answers the browser's preflight check itself; your backend needs no
107
+ CORS code. An address that isn't listed gets `cors_origin_not_allowed`, and
108
+ the browser shows "blocked by CORS policy".
109
+
110
+ A token in a web page can be read by anyone who can open that page. Use a
111
+ project key limited to `GET` and to the paths the app needs, and treat
112
+ whatever it can reach as visible to the app's visitors.
113
+
87
114
  ## 4. Check it in your backend
88
115
 
89
116
  Your backend sees who called on [`env.CALLER`](https://docs.canopy.website/sdk/auth#in-a-backend-worker),
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: canopy cors
3
+ description: Choose which web apps on other addresses may call your project's /api with an access token.
4
+ ---
5
+
6
+ `canopy cors` manages the project's **allowed browser origins**: the web apps
7
+ on other addresses whose pages may call the project's `/api` with an
8
+ [access token](https://docs.canopy.website/guides/access-tokens). An app built in Figma Make is the usual
9
+ case. Without an entry here, the browser blocks the call with a "blocked by
10
+ CORS policy" error.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ canopy cors list
16
+ canopy cors allow https://app.example.com
17
+ canopy cors allow "https://*.figma.site"
18
+ canopy cors remove https://app.example.com
19
+ ```
20
+
21
+ ## Arguments & flags
22
+
23
+ All subcommands resolve the project the usual way: `canopy.json` in the
24
+ target directory, or `--project <slug>` to override. They also honor the global
25
+ `--profile <site>` / `CANOPY_PROFILE`.
26
+
27
+ - `list`: print the allowed origins. It also says when access tokens are off,
28
+ because the list does nothing until they're on. Anyone who can open the
29
+ project's settings can run it.
30
+ - `allow <origin>`: add an origin. Owner only.
31
+ - `remove <origin>`: remove an origin. Owner only. Removing one that isn't
32
+ listed changes nothing.
33
+
34
+ An origin is the start of the app's address:
35
+
36
+ - `https://` plus the host, with a port if it uses one, like
37
+ `https://app.example.com`. No path.
38
+ - `https://*.example.com` allows every site one level under `example.com`,
39
+ like `https://abc.example.com`, but not `https://example.com` itself or
40
+ `https://a.b.example.com`. Quote it so your shell leaves the `*` alone.
41
+ - `http://localhost` and `http://127.0.0.1`, with any port, for trying an app
42
+ on your own machine.
43
+
44
+ `*` on its own is refused, and so is any other `http://` address. A project can
45
+ list up to 20 origins.
46
+
47
+ ## How it works
48
+
49
+ The list lives on the platform, per project, and covers the live and staging
50
+ channels. Changes take effect within a few seconds, with no deploy. The same
51
+ list is under **Settings → Access** in the dashboard.
52
+
53
+ Canopy answers the browser's preflight check itself, so your backend never
54
+ needs CORS code. For a listed origin, it adds the CORS headers to every call
55
+ that carries a token, and replaces any your backend sets. If you are
56
+ debugging, send the preflight yourself to see why it was refused:
57
+
58
+ ```bash
59
+ curl -i -X OPTIONS https://my-project.canopy.website/api/health \
60
+ -H "Origin: https://abc.figma.site" \
61
+ -H "Access-Control-Request-Method: GET"
62
+ ```
63
+
64
+ A refusal is `403` with `cors_origin_not_allowed` and a reason.
65
+
66
+ A token used from a web page can be read by anyone who can open that page.
67
+ Use a [project key](https://docs.canopy.website/guides/access-tokens#2-make-a-token) limited to `GET` and
68
+ to the paths the app needs. Treat whatever it can reach as visible to the
69
+ app's visitors.
@@ -46,7 +46,7 @@ A folder of large data or media that rarely changes, such as Storybook mock data
46
46
  }
47
47
  ```
48
48
 
49
- The folders are paths inside the build output. Their files keep their URLs (`/mocks/users.json`), and don't count toward the deploy limit. They may hold data and media only: JSON, CSV, text, images, video, audio, fonts and 3D models. A folder with HTML, JavaScript, CSS or SVG in it is refused before anything uploads. **Media is not versioned:** a rollback or a pinned version serves the current files, and it is shared with the staging channel.
49
+ The folders are paths inside the build output. Their files keep their URLs (`/mocks/users.json`), and don't count toward the deploy limit. They may hold data and media only: JSON, CSV, text, captions, images, video, audio, fonts and 3D models. A folder with HTML, JavaScript, CSS, SVG or PDF in it is refused before anything uploads. **Media is not versioned:** a rollback or a pinned version serves the current files, and it is shared with the staging channel.
50
50
 
51
51
  The CLI suggests folders for you. When the version reaches 30% of the deploy limit, the deploy ends with a hint naming the folders that could move and the exact `"media"` line to add. When it is over the limit, the refusal names the folders that would bring it under. The CLI never edits `canopy.json` itself. See [Site media](https://docs.canopy.website/guides/static-serving#site-media) for limits and details.
52
52
 
package/dist/docs/cli.md CHANGED
@@ -92,6 +92,12 @@ See `canopy docs ci` for wiring push-to-main deploys.
92
92
  - `canopy calls allow <project>` — let a project call it (owner only).
93
93
  - `canopy calls remove <project>` — stop it (owner only).
94
94
 
95
+ ## Web apps calling the API (CORS)
96
+
97
+ - `canopy cors list`: web apps on other addresses allowed to call the project's `/api` with a token.
98
+ - `canopy cors allow <origin>`: allow one, like `https://app.example.com` or `"https://*.figma.site"` (owner only).
99
+ - `canopy cors remove <origin>`: stop it (owner only).
100
+
95
101
  ## Maintenance
96
102
 
97
103
  - `canopy upgrade` — update the CLI to the latest version. `--version <v>` pins a
@@ -331,6 +331,11 @@
331
331
  "title": "canopy calls",
332
332
  "summary": "Manage which other projects may call this project's backend."
333
333
  },
334
+ {
335
+ "slug": "cli-cors",
336
+ "title": "canopy cors",
337
+ "summary": "Choose which web apps on other addresses may call your project's /api with an access token."
338
+ },
334
339
  {
335
340
  "slug": "cli-secrets",
336
341
  "title": "canopy secrets",
@@ -9,17 +9,18 @@ your browser needs a way in.
9
9
 
10
10
  ## Pick by job
11
11
 
12
- | You want to… | Use | Lasts |
13
- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
14
- | work with Canopy from your terminal | [`canopy login`](https://docs.canopy.website/cli/login) | 30 days, or until you sign out |
15
- | run your project locally against its real data | a dev token — [`canopy dev`](https://docs.canopy.website/cli/dev) makes one for you | 12 hours, or until you sign out |
16
- | deploy from GitHub Actions | nothing: [link the repository](https://docs.canopy.website/guides/ci) | — |
17
- | deploy from any other CI | a deploy token — [`canopy token create`](https://docs.canopy.website/cli/token) | until revoked, or 90 days without a deploy |
18
- | let a CI job, script or service call your project's `/api` | a [project key](https://docs.canopy.website/guides/access-tokens) | until revoked or its date, or 90 days without a call |
19
- | let a desktop app or plugin call your project's `/api` as you | a [personal token](https://docs.canopy.website/guides/access-tokens) | up to 90 days, while you keep signing in |
20
- | let an AI agent work on your project | nothing: [`canopy mcp`](https://docs.canopy.website/cli/mcp) and [`canopy browse`](https://docs.canopy.website/cli/browse) do it | while your `canopy login` lasts |
21
- | let another project's backend call yours | nothing: [`canopy calls allow`](https://docs.canopy.website/cli/calls) | — |
22
- | let people outside Monks open your project | an [email invite](https://docs.canopy.website/guides/outside-sign-in) or the [client password](https://docs.canopy.website/platform/client-access) | — |
12
+ | You want to… | Use | Lasts |
13
+ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
14
+ | work with Canopy from your terminal | [`canopy login`](https://docs.canopy.website/cli/login) | 30 days, or until you sign out |
15
+ | run your project locally against its real data | a dev token — [`canopy dev`](https://docs.canopy.website/cli/dev) makes one for you | 12 hours, or until you sign out |
16
+ | deploy from GitHub Actions | nothing: [link the repository](https://docs.canopy.website/guides/ci) | — |
17
+ | deploy from any other CI | a deploy token — [`canopy token create`](https://docs.canopy.website/cli/token) | until revoked, or 90 days without a deploy |
18
+ | let a CI job, script or service call your project's `/api` | a [project key](https://docs.canopy.website/guides/access-tokens) | until revoked or its date, or 90 days without a call |
19
+ | let a desktop app or plugin call your project's `/api` as you | a [personal token](https://docs.canopy.website/guides/access-tokens) | up to 90 days, while you keep signing in |
20
+ | let a web app on another address call your project's `/api` | a [project key](https://docs.canopy.website/guides/access-tokens#calling-from-a-web-app), plus [`canopy cors allow`](https://docs.canopy.website/cli/cors) | until revoked or its date, or 90 days without a call |
21
+ | let an AI agent work on your project | nothing: [`canopy mcp`](https://docs.canopy.website/cli/mcp) and [`canopy browse`](https://docs.canopy.website/cli/browse) do it | while your `canopy login` lasts |
22
+ | let another project's backend call yours | nothing: [`canopy calls allow`](https://docs.canopy.website/cli/calls) | — |
23
+ | let people outside Monks open your project | an [email invite](https://docs.canopy.website/guides/outside-sign-in) or the [client password](https://docs.canopy.website/platform/client-access) | — |
23
24
 
24
25
  Your own backend never needs a credential either: the platform gives it one,
25
26
  and the [SDK](https://docs.canopy.website/sdk) uses it for you.
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-tnyqU_dN.mjs";
1
+ import { t as version } from "./package-CyuzTQmN.mjs";
2
2
  import { r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
4
  import { n as agentHeaders } from "./api-CpG-9WSe.mjs";
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-tnyqU_dN.mjs";
1
+ import { t as version } from "./package-CyuzTQmN.mjs";
2
2
  import { f as resolveProject, g as tryResolveProject, h as tryReadCanopyJson, l as projectDirArgs, r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-CpG-9WSe.mjs";
4
4
  import { i as reportErrors, n as formatDateTime } from "./ui-BUeiY_zZ.mjs";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-tnyqU_dN.mjs";
2
+ import { t as version } from "./package-CyuzTQmN.mjs";
3
3
  import { i as siteHeaderLine, n as setInvocationProfile } from "./site-Bz-fEyKS.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -60,31 +60,32 @@ const main = defineCommand({
60
60
  delete: () => import("./projects-DCFn4zcq.mjs").then((m) => m.deleteCommand),
61
61
  rename: () => import("./rename-OeOI97da.mjs").then((m) => m.renameCommand),
62
62
  dev: () => import("./dev-pj6lLjMR.mjs").then((m) => m.devCommand),
63
- deploy: () => import("./deploy-Bp5DMp_U.mjs").then((m) => m.deployCommand),
64
- promote: () => import("./deploy-Bp5DMp_U.mjs").then((m) => m.promoteCommand),
63
+ deploy: () => import("./deploy-Qe5jRWpi.mjs").then((m) => m.deployCommand),
64
+ promote: () => import("./deploy-Qe5jRWpi.mjs").then((m) => m.promoteCommand),
65
65
  staging: () => import("./staging-D6-Ojy39.mjs").then((m) => m.stagingCommand),
66
- rollback: () => import("./deploy-Bp5DMp_U.mjs").then((m) => m.rollbackCommand),
67
- download: () => import("./deploy-Bp5DMp_U.mjs").then((m) => m.downloadCommand),
66
+ rollback: () => import("./deploy-Qe5jRWpi.mjs").then((m) => m.rollbackCommand),
67
+ download: () => import("./deploy-Qe5jRWpi.mjs").then((m) => m.downloadCommand),
68
68
  versions: () => import("./versions-C204ivt9.mjs").then((m) => m.versionsCommand),
69
69
  token: () => import("./token-yAj7pF78.mjs").then((m) => m.tokenCommand),
70
70
  egress: () => import("./egress-Dwq-d6cB.mjs").then((m) => m.egressCommand),
71
+ cors: () => import("./cors-B90J32_O.mjs").then((m) => m.corsCommand),
71
72
  calls: () => import("./calls-NFUccBaQ.mjs").then((m) => m.callsCommand),
72
73
  secrets: () => import("./secrets-Cgte8mvq.mjs").then((m) => m.secretsCommand),
73
74
  roles: () => import("./roles-2Pkqiwrx.mjs").then((m) => m.rolesCommand),
74
75
  members: () => import("./roles-2Pkqiwrx.mjs").then((m) => m.membersCommand),
75
76
  schedule: () => import("./schedule-Cy-7IFy5.mjs").then((m) => m.scheduleCommand),
76
- feedback: () => import("./feedback-ClCjUP3z.mjs").then((m) => m.feedbackCommand),
77
+ feedback: () => import("./feedback-DqZqxMQr.mjs").then((m) => m.feedbackCommand),
77
78
  db: () => import("./db-DIxujtt1.mjs").then((m) => m.dbCommand),
78
79
  files: () => import("./files-CUPtGcuZ.mjs").then((m) => m.filesCommand),
79
80
  usage: () => import("./usage-BXPm04tk.mjs").then((m) => m.usageCommand),
80
81
  ai: () => import("./ai-4Mr9FbLU.mjs").then((m) => m.aiCommand),
81
82
  open: () => import("./open-5JLHiz_J.mjs").then((m) => m.openCommand),
82
83
  browse: () => import("./browse-BegddW9V.mjs").then((m) => m.browseCommand),
83
- docs: () => import("./docs-F0GxdMrn.mjs").then((m) => m.docsCommand),
84
- skill: () => import("./skill-CoPNcCaM.mjs").then((m) => m.skillCommand),
85
- upgrade: () => import("./upgrade-CLFrKuJS.mjs").then((m) => m.upgradeCommand),
84
+ docs: () => import("./docs-Cvrkba0X.mjs").then((m) => m.docsCommand),
85
+ skill: () => import("./skill-CCz7sQ1t.mjs").then((m) => m.skillCommand),
86
+ upgrade: () => import("./upgrade-vJEkO28k.mjs").then((m) => m.upgradeCommand),
86
87
  logs: () => import("./logs-BwqG7lYU.mjs").then((m) => m.logsCommand),
87
- mcp: () => import("./mcp-CnTfFA0U.mjs").then((m) => m.mcpCommand),
88
+ mcp: () => import("./mcp-CkCiu-1J.mjs").then((m) => m.mcpCommand),
88
89
  repo: () => import("./repo-BW7dDQZL.mjs").then((m) => m.repoCommand),
89
90
  template: () => import("./project-template-xNjGs9ty.mjs").then((m) => m.templateCommand),
90
91
  audience: () => import("./audience-BXXdvGC_.mjs").then((m) => m.audienceCommand)
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-tnyqU_dN.mjs";
1
+ import { t as version } from "./package-CyuzTQmN.mjs";
2
2
  import { d as projectUrl, g as tryResolveProject, m as stagingUrl, r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-CpG-9WSe.mjs";
4
4
  import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.7.59";
2
+ var version = "0.7.61";
3
3
  //#endregion
4
4
  export { version as t };
@@ -128,6 +128,16 @@ create | list | revoke`). Software that **calls the project's `/api`** — a
128
128
  `env.CALLER.token` and checks the project's scopes with `requireScope`; give
129
129
  every `switch (env.CALLER.kind)` a refusing `default`. Never put any token in
130
130
  the repository.
131
+ - **A web app on another address calling `/api`** (Figma Make, a page on
132
+ another host) with an access token, and the browser says "blocked by CORS
133
+ policy": run `canopy cors list`, then `canopy cors allow <the app's origin>`
134
+ (e.g. `https://app.example.com`, or `"https://*.figma.site"`). Reproduce the
135
+ preflight with `curl -X OPTIONS -H "Origin: …" -H "Access-Control-Request-Method: GET"`
136
+ to read the reason (`cors_origin_not_allowed`). Only the owner can change
137
+ the list, and it needs access tokens on. Don't add CORS handling to the
138
+ worker: the platform answers preflights. Tell the user that a token in a
139
+ page can be read by anyone who loads it, so use a GET-only project key with
140
+ a path prefix (`canopy docs cli/cors`).
131
141
  - Git: `canopy repo show --json` (is there a repository, and its remote) ·
132
142
  `canopy repo create` · `canopy repo clone <slug>` · `canopy repo connect`
133
143
  (set up an existing folder). Then plain `git`: the CLI gives git
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-tnyqU_dN.mjs";
1
+ import { t as version } from "./package-CyuzTQmN.mjs";
2
2
  import { i as reportErrors } from "./ui-BUeiY_zZ.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
@@ -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-CoPNcCaM.mjs");
115
+ const { skillInstalled } = await import("./skill-CCz7sQ1t.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());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.7.59",
3
+ "version": "0.7.61",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"