@mediamonks/canopy-cli 0.7.10 → 0.7.12

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 (108) hide show
  1. package/dist/{deploy-BKFICJT1.mjs → deploy-B1WrPq5W.mjs} +12 -2
  2. package/dist/{dev-DtoZrexp.mjs → dev-BnUYGQQm.mjs} +5 -4
  3. package/dist/dev-CySBxW7I.mjs +2 -0
  4. package/dist/{dev-worker-BZgtEM9V.mjs → dev-worker-IWnHvQ1f.mjs} +42 -7
  5. package/dist/{docs-Ck9xogEV.mjs → docs-DxB7NhZs.mjs} +1 -1
  6. package/dist/{feedback-BpiCvItH.mjs → feedback-B-GXUBPs.mjs} +1 -1
  7. package/dist/index.mjs +10 -10
  8. package/dist/{local-C5AhA4GM.mjs → local-BGRd_FMZ.mjs} +6 -469
  9. package/dist/{package-DRp7sI6i.mjs → package-CDLufecy.mjs} +1 -1
  10. package/dist/{skill-B2sDMAmv.mjs → skill-BOWfqwr2.mjs} +1 -1
  11. package/dist/src-Bu4Ze32I.mjs +470 -0
  12. package/dist/{upgrade-tOfSmAcc.mjs → upgrade-fhfrid_O.mjs} +1 -1
  13. package/package.json +3 -3
  14. package/dist/dev-BYxSHUH6.mjs +0 -2
  15. package/dist/docs/ci.md +0 -50
  16. package/dist/docs/cli-create.md +0 -46
  17. package/dist/docs/cli-db.md +0 -86
  18. package/dist/docs/cli-delete.md +0 -44
  19. package/dist/docs/cli-deploy.md +0 -58
  20. package/dist/docs/cli-dev.md +0 -82
  21. package/dist/docs/cli-docs.md +0 -47
  22. package/dist/docs/cli-download.md +0 -42
  23. package/dist/docs/cli-egress.md +0 -37
  24. package/dist/docs/cli-feedback.md +0 -75
  25. package/dist/docs/cli-index.md +0 -61
  26. package/dist/docs/cli-init.md +0 -46
  27. package/dist/docs/cli-login.md +0 -43
  28. package/dist/docs/cli-logout.md +0 -32
  29. package/dist/docs/cli-logs.md +0 -57
  30. package/dist/docs/cli-open.md +0 -41
  31. package/dist/docs/cli-projects.md +0 -43
  32. package/dist/docs/cli-promote.md +0 -44
  33. package/dist/docs/cli-rollback.md +0 -45
  34. package/dist/docs/cli-skill.md +0 -39
  35. package/dist/docs/cli-staging.md +0 -54
  36. package/dist/docs/cli-token.md +0 -47
  37. package/dist/docs/cli-upgrade.md +0 -43
  38. package/dist/docs/cli-usage.md +0 -43
  39. package/dist/docs/cli-whoami.md +0 -46
  40. package/dist/docs/cli.md +0 -86
  41. package/dist/docs/data.md +0 -85
  42. package/dist/docs/deploy.md +0 -81
  43. package/dist/docs/dev.md +0 -72
  44. package/dist/docs/developers-agents-and-ai.md +0 -95
  45. package/dist/docs/developers-architecture.md +0 -106
  46. package/dist/docs/getting-started.md +0 -108
  47. package/dist/docs/index.json +0 -331
  48. package/dist/docs/infrastructure.md +0 -406
  49. package/dist/docs/migrations.md +0 -183
  50. package/dist/docs/overview-faq.md +0 -105
  51. package/dist/docs/overview-how-it-works.md +0 -82
  52. package/dist/docs/overview-use-cases.md +0 -76
  53. package/dist/docs/overview-what-is-canopy.md +0 -75
  54. package/dist/docs/platform-ai-usage.md +0 -65
  55. package/dist/docs/platform-client-access.md +0 -54
  56. package/dist/docs/platform-deploys-and-rollbacks.md +0 -93
  57. package/dist/docs/platform-egress.md +0 -75
  58. package/dist/docs/platform-feedback.md +0 -114
  59. package/dist/docs/platform-members-and-access.md +0 -71
  60. package/dist/docs/platform-project-data.md +0 -76
  61. package/dist/docs/platform-schedules.md +0 -90
  62. package/dist/docs/platform-sites-and-profiles.md +0 -61
  63. package/dist/docs/porting-nextjs.md +0 -233
  64. package/dist/docs/sdk-ai.md +0 -103
  65. package/dist/docs/sdk-auth.md +0 -57
  66. package/dist/docs/sdk-database.md +0 -126
  67. package/dist/docs/sdk-files.md +0 -82
  68. package/dist/docs/sdk-services.md +0 -58
  69. package/dist/docs/sdk.md +0 -126
  70. package/dist/docs/staging.md +0 -106
  71. package/dist/docs/static-serving.md +0 -318
  72. package/dist/docs/troubleshooting.md +0 -102
  73. package/dist/skill/canopy/SKILL.md +0 -160
  74. package/dist/templates/spa/.github/workflows/canopy-deploy.yml +0 -34
  75. package/dist/templates/spa/AGENTS.md +0 -47
  76. package/dist/templates/spa/README.md +0 -14
  77. package/dist/templates/spa/_gitignore +0 -4
  78. package/dist/templates/spa/canopy.json +0 -5
  79. package/dist/templates/spa/index.html +0 -12
  80. package/dist/templates/spa/package.json +0 -21
  81. package/dist/templates/spa/src/app.tsx +0 -25
  82. package/dist/templates/spa/src/canopy.ts +0 -5
  83. package/dist/templates/spa/src/main.tsx +0 -10
  84. package/dist/templates/spa/src/style.css +0 -29
  85. package/dist/templates/spa/tsconfig.json +0 -16
  86. package/dist/templates/spa/vite.config.ts +0 -7
  87. package/dist/templates/static/AGENTS.md +0 -45
  88. package/dist/templates/static/README.md +0 -9
  89. package/dist/templates/static/_gitignore +0 -2
  90. package/dist/templates/static/canopy.json +0 -4
  91. package/dist/templates/static/index.html +0 -21
  92. package/dist/templates/static/main.js +0 -9
  93. package/dist/templates/static/style.css +0 -29
  94. package/dist/templates/worker/.dev.vars.example +0 -9
  95. package/dist/templates/worker/.github/workflows/canopy-deploy.yml +0 -34
  96. package/dist/templates/worker/AGENTS.md +0 -63
  97. package/dist/templates/worker/README.md +0 -17
  98. package/dist/templates/worker/_gitignore +0 -5
  99. package/dist/templates/worker/canopy.json +0 -6
  100. package/dist/templates/worker/index.html +0 -12
  101. package/dist/templates/worker/package.json +0 -22
  102. package/dist/templates/worker/src/app.tsx +0 -25
  103. package/dist/templates/worker/src/canopy.ts +0 -5
  104. package/dist/templates/worker/src/main.tsx +0 -10
  105. package/dist/templates/worker/src/style.css +0 -29
  106. package/dist/templates/worker/tsconfig.json +0 -16
  107. package/dist/templates/worker/vite.config.ts +0 -7
  108. package/dist/templates/worker/worker/index.ts +0 -52
@@ -113,6 +113,12 @@ const deployCommand = defineCommand({
113
113
  type: "boolean",
114
114
  default: false,
115
115
  description: "Deploy to the project's staging channel (created on first use, database cloned from live)"
116
+ },
117
+ worker: {
118
+ type: "boolean",
119
+ default: true,
120
+ description: "Include the backend worker from canopy.json",
121
+ negativeDescription: "Deploy the frontend only — for sites whose target hosts no per-project backends"
116
122
  }
117
123
  },
118
124
  run: reportErrors("deploy", async ({ args }) => {
@@ -145,7 +151,8 @@ const deployCommand = defineCommand({
145
151
  });
146
152
  }
147
153
  let workerBytes = null;
148
- if (config.worker) {
154
+ if (config.worker && !args.worker) p.log.warn(`Skipping the backend (${config.worker}) — deploying the frontend only.`);
155
+ if (config.worker && args.worker) {
149
156
  const spinWorker = p.spinner();
150
157
  spinWorker.start(`Bundling worker ${config.worker}`);
151
158
  try {
@@ -185,7 +192,10 @@ const deployCommand = defineCommand({
185
192
  throw err;
186
193
  }
187
194
  }
188
- ({deploy: result} = await withContext(apiRequest("POST", `/projects/${slug}/deploys/${upload.version}/complete`, { grant: upload.grant }, void 0, source), { action: `deploy "${slug}"` }));
195
+ ({deploy: result} = await withContext(apiRequest("POST", `/projects/${slug}/deploys/${upload.version}/complete`, {
196
+ grant: upload.grant,
197
+ migrations: migrateResult?.appliedNow ?? []
198
+ }, void 0, source), { action: `deploy "${slug}"` }));
189
199
  } catch (err) {
190
200
  spin.error("Deploy failed.");
191
201
  throw err;
@@ -37,7 +37,7 @@ async function workerPlugin(flags, slug) {
37
37
  console.log(`note: canopy.json points "worker" at ${entry}, which does not exist — skipping.`);
38
38
  return;
39
39
  }
40
- const { missingSecretNames, readDevVars, workerDevPlugin } = await import("./dev-worker-BZgtEM9V.mjs");
40
+ const { missingSecretNames, readDevVars, workerDevPlugin } = await import("./dev-worker-IWnHvQ1f.mjs");
41
41
  const secrets = readDevVars(flags.dir);
42
42
  const email = siteConfig().email;
43
43
  const plugin = workerDevPlugin({
@@ -165,7 +165,7 @@ async function devRemote(flags, slug) {
165
165
  async function devLocal(flags, slug) {
166
166
  let dump;
167
167
  if (flags.pull) {
168
- const { fetchProjectDump } = await import("./local-C5AhA4GM.mjs");
168
+ const { fetchProjectDump } = await import("./local-BGRd_FMZ.mjs");
169
169
  console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
170
170
  dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
171
171
  }
@@ -180,7 +180,7 @@ async function devLocal(flags, slug) {
180
180
  const reason = err instanceof ApiError ? err.explain().why : String(err);
181
181
  console.log(`Note: ai/services will be unavailable — could not reach the platform (${reason}).`);
182
182
  }
183
- const { createSandbox } = await import("./local-C5AhA4GM.mjs");
183
+ const { createSandbox } = await import("./local-BGRd_FMZ.mjs");
184
184
  const sandbox = await createSandbox({
185
185
  slug,
186
186
  persistDir: join(flags.dir, ".canopy", "local"),
@@ -233,7 +233,8 @@ async function devLocal(flags, slug) {
233
233
  const server = await startVite(flags, { proxy: {
234
234
  ...remoteEntry && {
235
235
  "/_api/data/v1/ai": remoteEntry,
236
- "/_api/data/v1/services": remoteEntry
236
+ "/_api/data/v1/services": remoteEntry,
237
+ "/_api/data/v1/google": remoteEntry
237
238
  },
238
239
  "/_api": {
239
240
  target: `http://127.0.0.1:${apiAddress.port}`,
@@ -0,0 +1,2 @@
1
+ import { t as devCommand } from "./dev-BnUYGQQm.mjs";
2
+ export { devCommand };
@@ -1,5 +1,43 @@
1
+ import "./src-Bu4Ze32I.mjs";
1
2
  import { readFileSync } from "node:fs";
2
3
  import { relative, resolve, sep } from "node:path";
4
+ //#region ../data-plane/src/worker-request.ts
5
+ /**
6
+ * How a project's backend addresses the platform — the one definition.
7
+ *
8
+ * Three hosts run project workers and each builds this request itself: the
9
+ * Workers-for-Platforms shim (apps/api/src/platform/wfp-shim.ts), the Node
10
+ * runtime (apps/project-runtime/src/canopy-fetch.ts), and `canopy dev`
11
+ * (packages/cli/src/dev-worker.ts). They had three copies of the header
12
+ * shaping, and the two that hold a worker token had two copies of the
13
+ * credential rule — which is exactly how the Google project grant came to
14
+ * work on one target and not the other.
15
+ *
16
+ * The shim cannot import this: it ships as a standalone module uploaded
17
+ * beside the user bundle, so it may only import `./bundle.mjs`. It keeps a
18
+ * transcription, and `wfp-shim.test.ts` runs it against the table in
19
+ * `worker-request.cases.ts` alongside this implementation, so the two cannot
20
+ * drift silently.
21
+ */
22
+ /** Gateway-stamped identity, for the worker's own `env.USER` — never relayed. */
23
+ const IDENTITY_STAMP_HEADERS = [
24
+ "x-canopy-user-sub",
25
+ "x-canopy-user-email",
26
+ "x-canopy-user-name"
27
+ ];
28
+ /**
29
+ * Strip what must never travel upstream and stamp who is calling. Common to
30
+ * every host; says nothing about credentials.
31
+ */
32
+ function stampWorkerHeaders(headers, ctx) {
33
+ headers.delete("host");
34
+ for (const stamp of IDENTITY_STAMP_HEADERS) headers.delete(stamp);
35
+ headers.set("x-canopy-project", ctx.projectSlug);
36
+ if (ctx.channel === "staging") headers.set("x-canopy-channel", "staging");
37
+ else headers.delete("x-canopy-channel");
38
+ return headers;
39
+ }
40
+ //#endregion
3
41
  //#region src/dev-worker.ts
4
42
  /**
5
43
  * Paths that belong to the worker rather than the SPA — the gateway's rule
@@ -79,15 +117,12 @@ function rewriteCanopyUrl(raw, base) {
79
117
  function createCanopyFetch(apiBase, slug, channel, fetchImpl = fetch) {
80
118
  return async (input, init) => {
81
119
  const url = rewriteCanopyUrl(typeof input === "string" ? input : input instanceof URL ? input.href : input.url, apiBase());
82
- const headers = new Headers(input instanceof Request ? input.headers : init?.headers);
83
- headers.delete("host");
84
- headers.delete("x-canopy-user-sub");
85
- headers.delete("x-canopy-user-email");
86
- headers.delete("x-canopy-user-name");
120
+ const headers = stampWorkerHeaders(new Headers(input instanceof Request ? input.headers : init?.headers), {
121
+ projectSlug: slug,
122
+ channel
123
+ });
87
124
  headers.delete("authorization");
88
125
  headers.delete("cookie");
89
- headers.set("x-canopy-project", slug);
90
- if (channel === "staging") headers.set("x-canopy-channel", "staging");
91
126
  const method = (input instanceof Request ? input.method : init?.method) ?? "GET";
92
127
  const body = input instanceof Request ? input.body : init?.body;
93
128
  const outbound = {
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-DRp7sI6i.mjs";
1
+ import { t as version } from "./package-CDLufecy.mjs";
2
2
  import { n as siteConfig } from "./site-BUlQR117.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
4
  import { n as reportErrors } from "./ui-2mrJcjYC.mjs";
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-DRp7sI6i.mjs";
1
+ import { t as version } from "./package-CDLufecy.mjs";
2
2
  import { a as projectDirArgs, c as resolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-BUlQR117.mjs";
3
3
  import { c as apiRequest, l as apiUpload, n as reportErrors, s as apiDownload } from "./ui-2mrJcjYC.mjs";
4
4
  import { defineCommand } from "citty";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-DRp7sI6i.mjs";
2
+ import { t as version } from "./package-CDLufecy.mjs";
3
3
  import { r as siteHeaderLine, t as setInvocationProfile } from "./site-BUlQR117.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -67,21 +67,21 @@ const main = defineCommand({
67
67
  init: () => import("./projects-C6JQjVqg.mjs").then((m) => m.initCommand),
68
68
  projects: () => import("./projects-C6JQjVqg.mjs").then((m) => m.projectsCommand),
69
69
  delete: () => import("./projects-C6JQjVqg.mjs").then((m) => m.deleteCommand),
70
- dev: () => import("./dev-BYxSHUH6.mjs").then((m) => m.devCommand),
71
- deploy: () => import("./deploy-BKFICJT1.mjs").then((m) => m.deployCommand),
72
- promote: () => import("./deploy-BKFICJT1.mjs").then((m) => m.promoteCommand),
70
+ dev: () => import("./dev-CySBxW7I.mjs").then((m) => m.devCommand),
71
+ deploy: () => import("./deploy-B1WrPq5W.mjs").then((m) => m.deployCommand),
72
+ promote: () => import("./deploy-B1WrPq5W.mjs").then((m) => m.promoteCommand),
73
73
  staging: () => import("./staging-Bw1D_J8M.mjs").then((m) => m.stagingCommand),
74
- rollback: () => import("./deploy-BKFICJT1.mjs").then((m) => m.rollbackCommand),
75
- download: () => import("./deploy-BKFICJT1.mjs").then((m) => m.downloadCommand),
74
+ rollback: () => import("./deploy-B1WrPq5W.mjs").then((m) => m.rollbackCommand),
75
+ download: () => import("./deploy-B1WrPq5W.mjs").then((m) => m.downloadCommand),
76
76
  token: () => import("./token-D7zrIF8G.mjs").then((m) => m.tokenCommand),
77
77
  egress: () => import("./egress-CN_axsAN.mjs").then((m) => m.egressCommand),
78
- feedback: () => import("./feedback-BpiCvItH.mjs").then((m) => m.feedbackCommand),
78
+ feedback: () => import("./feedback-B-GXUBPs.mjs").then((m) => m.feedbackCommand),
79
79
  db: () => import("./db-8Etjmzxh.mjs").then((m) => m.dbCommand),
80
80
  usage: () => import("./usage-CX1Izj_l.mjs").then((m) => m.usageCommand),
81
81
  open: () => import("./open-DRPp4QJg.mjs").then((m) => m.openCommand),
82
- docs: () => import("./docs-Ck9xogEV.mjs").then((m) => m.docsCommand),
83
- skill: () => import("./skill-B2sDMAmv.mjs").then((m) => m.skillCommand),
84
- upgrade: () => import("./upgrade-tOfSmAcc.mjs").then((m) => m.upgradeCommand),
82
+ docs: () => import("./docs-DxB7NhZs.mjs").then((m) => m.docsCommand),
83
+ skill: () => import("./skill-BOWfqwr2.mjs").then((m) => m.skillCommand),
84
+ upgrade: () => import("./upgrade-fhfrid_O.mjs").then((m) => m.upgradeCommand),
85
85
  logs: () => import("./logs-DNiZquki.mjs").then((m) => m.logsCommand)
86
86
  }
87
87
  });