@mediamonks/canopy-cli 0.7.50 → 0.7.52

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 (41) hide show
  1. package/dist/{dev-BQ77vmCk.mjs → dev-BnzJ8a1u.mjs} +5 -4
  2. package/dist/dev-DSI3e4qP.mjs +2 -0
  3. package/dist/{dev-worker-BP-HGHYb.mjs → dev-worker-DBBN0F6X.mjs} +15 -33
  4. package/dist/docs/access-tokens.md +145 -0
  5. package/dist/docs/calling-projects.md +9 -0
  6. package/dist/docs/ci.md +8 -0
  7. package/dist/docs/cli-dev.md +1 -1
  8. package/dist/docs/cli-files.md +57 -0
  9. package/dist/docs/cli.md +2 -0
  10. package/dist/docs/developers-architecture.md +20 -4
  11. package/dist/docs/index.json +20 -0
  12. package/dist/docs/outside-sign-in.md +79 -0
  13. package/dist/docs/overview-faq.md +4 -3
  14. package/dist/docs/platform-client-access.md +6 -0
  15. package/dist/docs/platform-credentials.md +76 -0
  16. package/dist/docs/platform-members-and-access.md +31 -6
  17. package/dist/docs/platform-project-data.md +11 -1
  18. package/dist/docs/sdk-auth.md +71 -21
  19. package/dist/docs/sdk-files.md +148 -3
  20. package/dist/docs/sdk-projects.md +2 -1
  21. package/dist/docs/sdk.md +17 -10
  22. package/dist/docs/staging.md +8 -0
  23. package/dist/docs/troubleshooting.md +20 -0
  24. package/dist/{docs-Cd6VzYts.mjs → docs-Od4duFhd.mjs} +1 -1
  25. package/dist/{feedback-BkrdL92o.mjs → feedback-XEIHbeor.mjs} +1 -1
  26. package/dist/files-B7toJRlj.mjs +69 -0
  27. package/dist/index.mjs +14 -12
  28. package/dist/{local-C6ggy2PQ.mjs → local-R-INkPbU.mjs} +17 -6
  29. package/dist/{mcp-Bt9Z9kdf.mjs → mcp-misDO7O8.mjs} +1 -1
  30. package/dist/{package-Sir3152_.mjs → package-DBdEKZ6u.mjs} +1 -1
  31. package/dist/{project-template-DHWdVc6E.mjs → project-template-Bas1UN2O.mjs} +1 -0
  32. package/dist/project-template-Dti_Mmnb.mjs +2 -0
  33. package/dist/{projects-Z8ufQIBc.mjs → projects-BEBYhy6k.mjs} +1 -1
  34. package/dist/skill/canopy/SKILL.md +9 -1
  35. package/dist/{skill-Bxc5E-wu.mjs → skill-3RZw4vSI.mjs} +1 -1
  36. package/dist/{src-DzU89gZN.mjs → src-UBUAqzqH.mjs} +442 -43
  37. package/dist/templates/worker/worker/index.ts +4 -0
  38. package/dist/{upgrade-DOpeMSWD.mjs → upgrade-Dy4XV7iP.mjs} +1 -1
  39. package/package.json +2 -2
  40. package/dist/dev-Z3bI5hgh.mjs +0 -2
  41. package/dist/project-template-ChFb7A_H.mjs +0 -2
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-Sir3152_.mjs";
2
+ import { t as version } from "./package-DBdEKZ6u.mjs";
3
3
  import { i as siteHeaderLine, n as setInvocationProfile } from "./site-BL5Ik-yj.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -15,6 +15,7 @@ import { defineCommand, runMain } from "citty";
15
15
  * deploy build & deploy assets (+ worker) [phase 1/2]
16
16
  * token create|list|revoke deploy tokens for CI [phase 2]
17
17
  * db pull|snapshot|restore [phase 2]
18
+ * files access what the app's pages may do with its files
18
19
  * logs [--follow] read the project's worker logs [phase 2]
19
20
  * usage AI spend + storage for a project [phase 1]
20
21
  * ai models the site's AI models and auto/* aliases
@@ -66,12 +67,12 @@ const main = defineCommand({
66
67
  login: () => import("./login-DrMr99-A.mjs").then((m) => m.loginCommand),
67
68
  whoami: () => import("./login-DrMr99-A.mjs").then((m) => m.whoamiCommand),
68
69
  logout: () => import("./login-DrMr99-A.mjs").then((m) => m.logoutCommand),
69
- create: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.createCommand),
70
- init: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.initCommand),
71
- projects: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.projectsCommand),
72
- delete: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.deleteCommand),
70
+ create: () => import("./projects-BEBYhy6k.mjs").then((m) => m.createCommand),
71
+ init: () => import("./projects-BEBYhy6k.mjs").then((m) => m.initCommand),
72
+ projects: () => import("./projects-BEBYhy6k.mjs").then((m) => m.projectsCommand),
73
+ delete: () => import("./projects-BEBYhy6k.mjs").then((m) => m.deleteCommand),
73
74
  rename: () => import("./rename-PIJmdzHk.mjs").then((m) => m.renameCommand),
74
- dev: () => import("./dev-Z3bI5hgh.mjs").then((m) => m.devCommand),
75
+ dev: () => import("./dev-DSI3e4qP.mjs").then((m) => m.devCommand),
75
76
  deploy: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.deployCommand),
76
77
  promote: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.promoteCommand),
77
78
  staging: () => import("./staging-B9sjqvfh.mjs").then((m) => m.stagingCommand),
@@ -84,19 +85,20 @@ const main = defineCommand({
84
85
  roles: () => import("./roles-CXY226VM.mjs").then((m) => m.rolesCommand),
85
86
  members: () => import("./roles-CXY226VM.mjs").then((m) => m.membersCommand),
86
87
  schedule: () => import("./schedule-DJsclUxC.mjs").then((m) => m.scheduleCommand),
87
- feedback: () => import("./feedback-BkrdL92o.mjs").then((m) => m.feedbackCommand),
88
+ feedback: () => import("./feedback-XEIHbeor.mjs").then((m) => m.feedbackCommand),
88
89
  db: () => import("./db-D5SXZrp5.mjs").then((m) => m.dbCommand),
90
+ files: () => import("./files-B7toJRlj.mjs").then((m) => m.filesCommand),
89
91
  usage: () => import("./usage-VMT75MZ4.mjs").then((m) => m.usageCommand),
90
92
  ai: () => import("./ai-BjnuSjmw.mjs").then((m) => m.aiCommand),
91
93
  open: () => import("./open-6ev_6m0p.mjs").then((m) => m.openCommand),
92
94
  browse: () => import("./browse-BPLWhoFI.mjs").then((m) => m.browseCommand),
93
- docs: () => import("./docs-Cd6VzYts.mjs").then((m) => m.docsCommand),
94
- skill: () => import("./skill-Bxc5E-wu.mjs").then((m) => m.skillCommand),
95
- upgrade: () => import("./upgrade-DOpeMSWD.mjs").then((m) => m.upgradeCommand),
95
+ docs: () => import("./docs-Od4duFhd.mjs").then((m) => m.docsCommand),
96
+ skill: () => import("./skill-3RZw4vSI.mjs").then((m) => m.skillCommand),
97
+ upgrade: () => import("./upgrade-Dy4XV7iP.mjs").then((m) => m.upgradeCommand),
96
98
  logs: () => import("./logs-DJWrL6ja.mjs").then((m) => m.logsCommand),
97
- mcp: () => import("./mcp-Bt9Z9kdf.mjs").then((m) => m.mcpCommand),
99
+ mcp: () => import("./mcp-misDO7O8.mjs").then((m) => m.mcpCommand),
98
100
  repo: () => import("./repo-CGTFmIWM.mjs").then((m) => m.repoCommand),
99
- template: () => import("./project-template-ChFb7A_H.mjs").then((m) => m.templateCommand),
101
+ template: () => import("./project-template-Dti_Mmnb.mjs").then((m) => m.templateCommand),
100
102
  audience: () => import("./audience-BSvOEbco.mjs").then((m) => m.audienceCommand)
101
103
  }
102
104
  });
@@ -1,10 +1,12 @@
1
1
  import { r as apiDataRequest } from "./api-DmJrIsE7.mjs";
2
- import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-DzU89gZN.mjs";
3
- import { a as rewriteApiPath } from "./dev-BQ77vmCk.mjs";
2
+ import { c as dbRouter, d as STREAMED_BLOB_BYTES, f as blobRouter, l as hasPrivateNames, p as isCreateOnly, s as realtimeRouter, t as WORKER_ATTEST_HEADER, u as META_COLUMNS } from "./src-UBUAqzqH.mjs";
3
+ import { a as rewriteApiPath } from "./dev-BnzJ8a1u.mjs";
4
4
  import { createRequire } from "node:module";
5
- import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
5
+ import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, relative, sep } from "node:path";
7
7
  import { Hono } from "hono";
8
+ import { Readable } from "node:stream";
9
+ import { pipeline } from "node:stream/promises";
8
10
  //#region ../data-plane/src/db-access.ts
9
11
  /** The worker-only marker: `private_` at the start of a collection or table name. */
10
12
  const PRIVATE_PREFIX = "private_";
@@ -653,8 +655,9 @@ function createMemoryBlobBucket() {
653
655
  const objects = /* @__PURE__ */ new Map();
654
656
  return {
655
657
  async put(key, body, options) {
658
+ if (isCreateOnly(options?.onlyIf) && objects.has(key)) return null;
656
659
  objects.set(key, {
657
- body,
660
+ body: body instanceof ArrayBuffer ? body : await new Response(body).arrayBuffer(),
658
661
  meta: {
659
662
  contentType: options?.httpMetadata?.contentType,
660
663
  uploaded: (/* @__PURE__ */ new Date()).toISOString()
@@ -715,7 +718,14 @@ function createFsBlobBucket(root) {
715
718
  async put(key, body, options) {
716
719
  const path = dataPath(root, key);
717
720
  mkdirSync(dirname(path), { recursive: true });
718
- writeFileSync(path, Buffer.from(body));
721
+ const flag = isCreateOnly(options?.onlyIf) ? "wx" : "w";
722
+ try {
723
+ if (body instanceof ArrayBuffer) writeFileSync(path, Buffer.from(body), { flag });
724
+ else await pipeline(Readable.fromWeb(body), createWriteStream(path, { flags: flag }));
725
+ } catch (err) {
726
+ if (err.code === "EEXIST") return null;
727
+ throw err;
728
+ }
719
729
  writeFileSync(metaPath(root, key), `${JSON.stringify({
720
730
  contentType: options?.httpMetadata?.contentType,
721
731
  uploaded: (/* @__PURE__ */ new Date()).toISOString()
@@ -907,7 +917,8 @@ async function createSandbox(options) {
907
917
  prefix: ""
908
918
  }
909
919
  },
910
- signDownload: async () => "local"
920
+ signDownload: async () => "local",
921
+ maxBytes: () => STREAMED_BLOB_BYTES
911
922
  }));
912
923
  const realtimeHub = memoryRealtimeBroker();
913
924
  app.route("/data/v1", realtimeRouter({ context: async (c) => ownProject(c) ?? {
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Sir3152_.mjs";
1
+ import { t as version } from "./package-DBdEKZ6u.mjs";
2
2
  import { h as tryResolveProject, p as stagingUrl, r as siteConfig, u as projectUrl } from "./site-BL5Ik-yj.mjs";
3
3
  import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-DmJrIsE7.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.50";
2
+ var version = "0.7.52";
3
3
  //#endregion
4
4
  export { version as t };
@@ -22,6 +22,7 @@ function describeCopy(copy) {
22
22
  !copy.csp_enabled && "Content-Security-Policy off",
23
23
  copy.allow_framing && "other sites may frame the app",
24
24
  copy.browser_db_access !== "full" && `browser database access: ${copy.browser_db_access}`,
25
+ copy.browser_blob_access && copy.browser_blob_access !== "full" && `browser file access: ${copy.browser_blob_access}`,
25
26
  !copy.feedback_widget && "feedback widget hidden"
26
27
  ].filter(Boolean);
27
28
  if (loosened.length) lines.push(`Page settings: ${loosened.join("; ")}.`);
@@ -0,0 +1,2 @@
1
+ import { a as templateCommand } from "./project-template-Bas1UN2O.mjs";
2
+ export { templateCommand };
@@ -1,7 +1,7 @@
1
1
  import { m as tryReadCanopyJson, r as siteConfig, u as projectUrl } from "./site-BL5Ik-yj.mjs";
2
2
  import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
3
3
  import { a as spinner$1, i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
4
- import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-DHWdVc6E.mjs";
4
+ import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-Bas1UN2O.mjs";
5
5
  import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-Dry87b9d.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
@@ -118,7 +118,15 @@ and never go stale.
118
118
  only some roles may see in `private_` tables. Try other roles locally with
119
119
  `canopy dev --as-role <slug>`. Adding or removing people is the owner's call
120
120
  (`canopy members add|remove`) — confirm with the user first.
121
- - CI credentials: `canopy token create | list | revoke`
121
+ - Credentials (`canopy docs platform-credentials`): CI **deploys** use a linked
122
+ repository (`canopy repo link`, GitHub) or a deploy token (`canopy token
123
+ create | list | revoke`). Software that **calls the project's `/api`** — a
124
+ CI job, script, plugin or desktop app — uses an access token the owner
125
+ enables and makes in the dashboard (project key, or a person's personal
126
+ token; `canopy docs access-tokens`). The backend reads it on
127
+ `env.CALLER.token` and checks the project's scopes with `requireScope`; give
128
+ every `switch (env.CALLER.kind)` a refusing `default`. Never put any token in
129
+ the repository.
122
130
  - Git: `canopy repo show --json` (is there a repository, and its remote) ·
123
131
  `canopy repo create` · `canopy repo clone <slug>` · `canopy repo connect`
124
132
  (set up an existing folder). Then plain `git`: the CLI gives git
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Sir3152_.mjs";
1
+ import { t as version } from "./package-DBdEKZ6u.mjs";
2
2
  import { r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";