@mediamonks/canopy-cli 0.7.12 → 0.7.13

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 (119) hide show
  1. package/dist/{db-8Etjmzxh.mjs → db-DKnJQPm5.mjs} +2 -2
  2. package/dist/{deploy-B1WrPq5W.mjs → deploy-CnxJ4TE6.mjs} +2 -2
  3. package/dist/dev-BqLvttKc.mjs +2 -0
  4. package/dist/{dev-BnUYGQQm.mjs → dev-CyJT6EfQ.mjs} +4 -4
  5. package/dist/docs/ci.md +50 -0
  6. package/dist/docs/cli-create.md +46 -0
  7. package/dist/docs/cli-db.md +86 -0
  8. package/dist/docs/cli-delete.md +44 -0
  9. package/dist/docs/cli-deploy.md +58 -0
  10. package/dist/docs/cli-dev.md +82 -0
  11. package/dist/docs/cli-docs.md +47 -0
  12. package/dist/docs/cli-download.md +42 -0
  13. package/dist/docs/cli-egress.md +37 -0
  14. package/dist/docs/cli-feedback.md +75 -0
  15. package/dist/docs/cli-index.md +61 -0
  16. package/dist/docs/cli-init.md +46 -0
  17. package/dist/docs/cli-login.md +43 -0
  18. package/dist/docs/cli-logout.md +32 -0
  19. package/dist/docs/cli-logs.md +57 -0
  20. package/dist/docs/cli-open.md +41 -0
  21. package/dist/docs/cli-projects.md +43 -0
  22. package/dist/docs/cli-promote.md +44 -0
  23. package/dist/docs/cli-rollback.md +45 -0
  24. package/dist/docs/cli-skill.md +39 -0
  25. package/dist/docs/cli-staging.md +54 -0
  26. package/dist/docs/cli-token.md +47 -0
  27. package/dist/docs/cli-upgrade.md +43 -0
  28. package/dist/docs/cli-usage.md +43 -0
  29. package/dist/docs/cli-whoami.md +46 -0
  30. package/dist/docs/cli.md +86 -0
  31. package/dist/docs/data.md +85 -0
  32. package/dist/docs/deploy.md +81 -0
  33. package/dist/docs/dev.md +72 -0
  34. package/dist/docs/developers-agents-and-ai.md +95 -0
  35. package/dist/docs/developers-architecture.md +106 -0
  36. package/dist/docs/getting-started.md +108 -0
  37. package/dist/docs/index.json +336 -0
  38. package/dist/docs/infrastructure.md +406 -0
  39. package/dist/docs/migrations.md +183 -0
  40. package/dist/docs/overview-faq.md +105 -0
  41. package/dist/docs/overview-how-it-works.md +82 -0
  42. package/dist/docs/overview-use-cases.md +76 -0
  43. package/dist/docs/overview-what-is-canopy.md +75 -0
  44. package/dist/docs/platform-ai-usage.md +65 -0
  45. package/dist/docs/platform-client-access.md +54 -0
  46. package/dist/docs/platform-deploys-and-rollbacks.md +93 -0
  47. package/dist/docs/platform-egress.md +75 -0
  48. package/dist/docs/platform-feedback.md +114 -0
  49. package/dist/docs/platform-google.md +213 -0
  50. package/dist/docs/platform-members-and-access.md +71 -0
  51. package/dist/docs/platform-project-data.md +76 -0
  52. package/dist/docs/platform-schedules.md +90 -0
  53. package/dist/docs/platform-sites-and-profiles.md +61 -0
  54. package/dist/docs/porting-nextjs.md +233 -0
  55. package/dist/docs/sdk-ai.md +103 -0
  56. package/dist/docs/sdk-auth.md +57 -0
  57. package/dist/docs/sdk-database.md +126 -0
  58. package/dist/docs/sdk-files.md +82 -0
  59. package/dist/docs/sdk-services.md +58 -0
  60. package/dist/docs/sdk.md +126 -0
  61. package/dist/docs/staging.md +106 -0
  62. package/dist/docs/static-serving.md +323 -0
  63. package/dist/docs/troubleshooting.md +102 -0
  64. package/dist/{docs-DxB7NhZs.mjs → docs-BBMVxVta.mjs} +2 -2
  65. package/dist/{egress-CN_axsAN.mjs → egress-BFSwa8Uu.mjs} +1 -1
  66. package/dist/{feedback-B-GXUBPs.mjs → feedback-BMX_d4KZ.mjs} +2 -2
  67. package/dist/index.mjs +25 -24
  68. package/dist/{local-BGRd_FMZ.mjs → local-BQxsp-ZQ.mjs} +2 -2
  69. package/dist/{login-D7dI8D9N.mjs → login-BDTO3nVw.mjs} +1 -1
  70. package/dist/{logs-DNiZquki.mjs → logs-C53y2eAS.mjs} +1 -1
  71. package/dist/{migrations-C-5x6SYf.mjs → migrations-C6EcKD6a.mjs} +1 -1
  72. package/dist/{open-DRPp4QJg.mjs → open-C5x3tX6I.mjs} +1 -1
  73. package/dist/{package-CDLufecy.mjs → package-vJXq4RNN.mjs} +1 -1
  74. package/dist/{projects-C6JQjVqg.mjs → projects-MMbv7MmK.mjs} +1 -1
  75. package/dist/schedule-Cq9K0rnE.mjs +106 -0
  76. package/dist/skill/canopy/SKILL.md +160 -0
  77. package/dist/{skill-BOWfqwr2.mjs → skill-Zq9aIPKf.mjs} +2 -2
  78. package/dist/{staging-Bw1D_J8M.mjs → staging-D8G4amjO.mjs} +1 -1
  79. package/dist/templates/spa/.github/workflows/canopy-deploy.yml +34 -0
  80. package/dist/templates/spa/AGENTS.md +47 -0
  81. package/dist/templates/spa/README.md +14 -0
  82. package/dist/templates/spa/_gitignore +4 -0
  83. package/dist/templates/spa/canopy.json +5 -0
  84. package/dist/templates/spa/index.html +12 -0
  85. package/dist/templates/spa/package.json +21 -0
  86. package/dist/templates/spa/src/app.tsx +25 -0
  87. package/dist/templates/spa/src/canopy.ts +5 -0
  88. package/dist/templates/spa/src/main.tsx +10 -0
  89. package/dist/templates/spa/src/style.css +29 -0
  90. package/dist/templates/spa/tsconfig.json +16 -0
  91. package/dist/templates/spa/vite.config.ts +7 -0
  92. package/dist/templates/static/AGENTS.md +45 -0
  93. package/dist/templates/static/README.md +9 -0
  94. package/dist/templates/static/_gitignore +2 -0
  95. package/dist/templates/static/canopy.json +4 -0
  96. package/dist/templates/static/index.html +21 -0
  97. package/dist/templates/static/main.js +9 -0
  98. package/dist/templates/static/style.css +29 -0
  99. package/dist/templates/worker/.dev.vars.example +9 -0
  100. package/dist/templates/worker/.github/workflows/canopy-deploy.yml +34 -0
  101. package/dist/templates/worker/AGENTS.md +63 -0
  102. package/dist/templates/worker/README.md +17 -0
  103. package/dist/templates/worker/_gitignore +5 -0
  104. package/dist/templates/worker/canopy.json +6 -0
  105. package/dist/templates/worker/index.html +12 -0
  106. package/dist/templates/worker/package.json +22 -0
  107. package/dist/templates/worker/src/app.tsx +25 -0
  108. package/dist/templates/worker/src/canopy.ts +5 -0
  109. package/dist/templates/worker/src/main.tsx +10 -0
  110. package/dist/templates/worker/src/style.css +29 -0
  111. package/dist/templates/worker/tsconfig.json +16 -0
  112. package/dist/templates/worker/vite.config.ts +7 -0
  113. package/dist/templates/worker/worker/index.ts +52 -0
  114. package/dist/{token-D7zrIF8G.mjs → token-BUxgRJVA.mjs} +1 -1
  115. package/dist/{ui-2mrJcjYC.mjs → ui-B1Px5y7q.mjs} +17 -0
  116. package/dist/{upgrade-fhfrid_O.mjs → upgrade-ES8u8_Pn.mjs} +2 -2
  117. package/dist/{usage-CX1Izj_l.mjs → usage-DjNngyvy.mjs} +1 -1
  118. package/package.json +1 -1
  119. package/dist/dev-CySBxW7I.mjs +0 -2
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: canopy whoami
3
+ description: Show which account and site the CLI is currently talking to, and whether your token is still valid.
4
+ ---
5
+
6
+ `canopy whoami` prints the login the CLI would use right now: your email, the API it points at, and your token's expiry. Reach for it when a command fails with an auth error, or to double-check which site you're about to act on.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy whoami
12
+ canopy --profile staging whoami # check a specific site's token
13
+ ```
14
+
15
+ ## Arguments & flags
16
+
17
+ - `--profile <site>` — global flag (or `CANOPY_PROFILE`): check the token for a specific site instead of your resolved default. Each site has its own token, so being logged in on `main` says nothing about `staging`.
18
+
19
+ ## Details
20
+
21
+ The command is fully offline — it only reads `~/.canopy/config.json`, no network calls. For the resolved profile it prints:
22
+
23
+ - your email (as recorded at login),
24
+ - the cloud the site runs on, when known,
25
+ - the API URL the CLI targets,
26
+ - the token expiry — either `Token expires <date>` or a loud `Token EXPIRED` line telling you to run `canopy login` again.
27
+
28
+ The active site and CLI version are printed on stderr as a header line by every command, `whoami` included. If no token is stored for the resolved profile, the command exits with an error suggesting `canopy login`.
29
+
30
+ Note that expiry is checked against the stored timestamp only; a token can also be revoked server-side, in which case `whoami` looks fine but API commands fail.
31
+
32
+ ## Examples
33
+
34
+ ```bash
35
+ canopy whoami
36
+ ```
37
+
38
+ Prints your email, API URL, and token expiry for your default site — a quick sanity check before a deploy.
39
+
40
+ ```bash
41
+ canopy --profile gcp-pilot whoami
42
+ ```
43
+
44
+ Verifies you also hold a (non-expired) token for the GCP pilot site before targeting it.
45
+
46
+ See also [canopy login](https://docs.canopy.website/cli/login) and [Sites & profiles](https://docs.canopy.website/platform/sites-and-profiles).
@@ -0,0 +1,86 @@
1
+ ---
2
+ title: CLI command reference
3
+ description: Every canopy command, its flags, and what it does.
4
+ ---
5
+
6
+ Run `canopy <command> --help` for the authoritative flags of any command. This
7
+ is the one-page overview; the docs site's [CLI reference](https://docs.canopy.website/cli) section
8
+ has a full page per command.
9
+
10
+ ## Auth
11
+
12
+ - `canopy login` — sign in via OneLogin (opens the browser; finish there).
13
+ Add `--json` for machine-readable status output (for agents/CI).
14
+ - `canopy whoami` — show the current login and token expiry.
15
+ - `canopy logout` — forget the local CLI token.
16
+
17
+ ## Projects
18
+
19
+ - `canopy create [name]` — register a **new** project (and scaffold it).
20
+ - `--slug <slug>` — URL slug (defaults to a slugified name).
21
+ - `--template <id>` — `static` | `spa` | `worker` (picker when omitted).
22
+ - `--scaffold` — write `./<slug>/` from the starter template (on by default;
23
+ `--no-scaffold` to only register).
24
+ - `canopy init [slug] [dir]` — set up a local folder for an **existing** project
25
+ (e.g. one created in the dashboard) — does **not** register a new project.
26
+ - `dir` — `.` for the current directory, a path, or `./<slug>/` when omitted.
27
+ - `--template <id>` — template to scaffold (picker when omitted).
28
+ - `--no-scaffold` — link an app you already have: just write a `canopy.json`.
29
+ - `canopy projects` — list your projects. `--all` includes ones you can't edit.
30
+ - `canopy delete [slug]` — full teardown of a project. `--yes` skips the
31
+ type-the-slug confirmation.
32
+
33
+ ## Develop
34
+
35
+ - `canopy dev` — run the project locally against live platform data.
36
+ - `--port <port>` — dev server port.
37
+ - `--local` — offline sandbox (PGlite + filesystem blobs under `.canopy/local/`).
38
+ - `--pull` — hydrate the sandbox from a fresh prod export first (with `--local`).
39
+
40
+ ## Deploy
41
+
42
+ - `canopy deploy` — build and deploy the project (the `canopy.json` build
43
+ command runs first by default).
44
+ - `--no-build` — skip the build, deploy the output directory as-is.
45
+ - `--project <slug>` — deploy any directory, overriding (or without) a
46
+ `canopy.json`.
47
+ - `canopy rollback [version]` — make an earlier deploy live again, e.g. `v3`
48
+ (picked from history when omitted). `--dir <path>` to target another directory.
49
+ - `canopy download [version]` — download a deploy's assets as a zip, e.g. `v3`
50
+ (the live version when omitted, or picked from history interactively).
51
+ `--out <file>` to name it.
52
+ - `canopy open` — open the deployed project in your browser.
53
+
54
+ ## Data
55
+
56
+ - `canopy db pull` — download a fresh SQL dump. `--out <file>` to name it.
57
+ - `canopy db snapshot` — store a dump server-side (restorable anytime).
58
+ - `canopy db snapshots` — list stored snapshots.
59
+ - `canopy db restore [file]` — replace ALL project data from a `.sql` file or
60
+ `--snapshot <key>`. `--yes` skips the confirmation. **Destructive.**
61
+ - `canopy usage` — AI spend and storage for the project (same data as the
62
+ dashboard Usage tab). `--project <slug>` / `--json` for agents.
63
+
64
+ ## CI / deploy tokens
65
+
66
+ - `canopy token create` — create a project-scoped deploy token for CI.
67
+ `--name "<label>"` to label it.
68
+ - `canopy token list` — list the project's deploy tokens.
69
+ - `canopy token revoke <id>` — revoke a token.
70
+
71
+ See `canopy docs ci` for wiring push-to-main deploys.
72
+
73
+ ## Outbound hosts (egress)
74
+
75
+ - `canopy egress list` — hosts the project's worker may `fetch` directly.
76
+ - `canopy egress allow <host>` — allow a hostname (or `"*.sub.wildcard"`).
77
+ - `canopy egress remove <host>` — remove an entry.
78
+
79
+ ## Maintenance
80
+
81
+ - `canopy upgrade` — update the CLI to the latest version. `--version <v>` pins a
82
+ release; `--pm <npm|pnpm|yarn|bun>` overrides the package-manager guess.
83
+ Upgrading also refreshes the installed Canopy agent skill.
84
+ - `canopy docs [topic]` — list docs, or print one. `--refresh` re-fetches from
85
+ the platform.
86
+ - `canopy skill install` — (re)install the Canopy agent skill into this repo.
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: Working with project data
3
+ description: Pulling, snapshotting, and restoring your project database.
4
+ ---
5
+
6
+ Each Canopy project gets its own database and blob storage (D1 and R2 on the
7
+ Cloudflare target; Postgres and GCS on GCP). Your app reads and writes them
8
+ through the Canopy SDK at runtime; the CLI gives you tools to manage the data
9
+ around it.
10
+
11
+ ## Collections in your app (SDK)
12
+
13
+ The paved road is document-style collections:
14
+
15
+ ```ts
16
+ await canopy.db.collection("blog_posts").insert({ title: "Hello" });
17
+ ```
18
+
19
+ **Collection names must be lowercase** — start with a letter, then letters,
20
+ digits, and underscores only (`^[a-z][a-z0-9_]*$`). `blog_posts` is fine;
21
+ `blogPosts` or `BlogPosts` are **not** and throw at runtime:
22
+
23
+ > `Invalid collection name "BlogPosts" — use lowercase letters, digits and underscores.`
24
+
25
+ Use `snake_case` for multi-word names. This mirrors the collection name straight
26
+ into the underlying database, so keeping it lowercase avoids case-sensitivity
27
+ surprises.
28
+
29
+ ## Dialects and raw SQL
30
+
31
+ The document API above is portable — it behaves the same on every platform
32
+ target. Raw SQL is not: `canopy.db.sql()` passes your statement through
33
+ untranslated, so it speaks whatever the target's database speaks. Ask the
34
+ platform which that is:
35
+
36
+ ```ts
37
+ await canopy.db.dialect(); // "sqlite" | "postgres"
38
+ ```
39
+
40
+ Parameterize with `?` on sqlite and `$1` on postgres. One more per-target
41
+ difference: `collection().search()` is real full-text search (FTS5) on sqlite
42
+ targets, and a plain substring match on postgres targets — different matches,
43
+ no ranking.
44
+
45
+ ## Download a dump
46
+
47
+ ```bash
48
+ canopy db pull # writes <slug>-<timestamp>.sql
49
+ canopy db pull --out data.sql # choose the filename
50
+ ```
51
+
52
+ A plain SQL dump you can inspect, diff, or keep as a backup.
53
+
54
+ ## Snapshots (server-side backups)
55
+
56
+ ```bash
57
+ canopy db snapshot # store a dump on the platform
58
+ canopy db snapshots # list stored snapshots
59
+ ```
60
+
61
+ Snapshots live on the platform and can be restored at any time — handy before a
62
+ risky change.
63
+
64
+ ## Restore — destructive
65
+
66
+ > **Warning:** Restoring **replaces ALL project data**. Take a snapshot first — a snapshot taken seconds earlier
67
+ > is your undo button.
68
+
69
+ Restore from either source:
70
+
71
+ ```bash
72
+ canopy db restore backup.sql # from a local dump
73
+ canopy db restore --snapshot <key> # from a server-side snapshot
74
+ ```
75
+
76
+ You'll be asked to type the project slug to confirm. `--yes` skips that prompt —
77
+ use it only in scripts you trust.
78
+
79
+ ## Safe workflow for agents
80
+
81
+ Before any destructive data change:
82
+
83
+ 1. `canopy db snapshot` — take a restore point.
84
+ 2. Make the change (or test it first with `canopy dev --local --pull`).
85
+ 3. If something goes wrong, `canopy db restore --snapshot <key>`.
@@ -0,0 +1,81 @@
1
+ ---
2
+ title: Deploying a project
3
+ description: How canopy deploy builds, uploads, and makes a version live.
4
+ ---
5
+
6
+ From inside a project directory:
7
+
8
+ ```bash
9
+ canopy deploy
10
+ ```
11
+
12
+ This uploads your built assets to the platform, creates a new immutable deploy
13
+ version, and makes it live. Each deploy is versioned (`v1`, `v2`, …).
14
+
15
+ Under the hood a deploy is three steps: the platform authorizes it and issues a
16
+ short-lived signed upload grant, the CLI uploads each file directly against
17
+ that grant, and a completion call checks the bundle and makes the new version
18
+ live. You only ever run `canopy deploy` — but it means a half-uploaded deploy
19
+ is never served.
20
+
21
+ ## Building first
22
+
23
+ If your project needs a build step (React SPA, anything with a bundler), declare
24
+ the build command in `canopy.json` — `canopy deploy` runs it automatically
25
+ before uploading. To skip the build and upload whatever is already in the
26
+ output directory (or the static files as-is for a `static` project):
27
+
28
+ ```bash
29
+ canopy deploy --no-build
30
+ ```
31
+
32
+ ## Trying it on staging first
33
+
34
+ Nervous about a change — especially one with schema migrations or backend
35
+ code? Deploy it to the project's staging channel first, then promote the exact
36
+ same version once it checks out:
37
+
38
+ ```bash
39
+ canopy deploy --staging # own URL, own database (a copy of live)
40
+ canopy promote # make that version live
41
+ ```
42
+
43
+ See [Staging & promoting](https://docs.canopy.website/guides/staging).
44
+
45
+ ## Rolling back
46
+
47
+ Every deploy is kept, so you can instantly revert:
48
+
49
+ ```bash
50
+ canopy rollback # pick a version from history
51
+ canopy rollback v3 # make v3 live again
52
+ ```
53
+
54
+ Rollback re-points the live version at an existing deploy — it does not
55
+ rebuild, and the project's backend rolls back with it.
56
+
57
+ ## Downloading a version
58
+
59
+ Every version's assets can be pulled back down as a zip — the exact files that
60
+ were deployed, for any version in the history:
61
+
62
+ ```bash
63
+ canopy download # the live version (pick from history in a terminal)
64
+ canopy download v3 # a specific version
65
+ canopy download v3 --out release.zip
66
+ ```
67
+
68
+ The same download is available per version from the dashboard (project overview
69
+ → Deploys). Handy for archiving a release or moving a matured project off the
70
+ platform.
71
+
72
+ ## Seeing the live site
73
+
74
+ ```bash
75
+ canopy open
76
+ ```
77
+
78
+ ## Deploying from CI
79
+
80
+ For automated push-to-main deploys, use a deploy token instead of an interactive
81
+ login — see `canopy docs ci`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Local development
3
+ description: Running a project locally against live or sandboxed data.
4
+ ---
5
+
6
+ From inside a project directory:
7
+
8
+ ```bash
9
+ canopy dev
10
+ ```
11
+
12
+ By default `canopy dev` runs your project locally but talks to **live platform
13
+ data** (your project's real database, blobs, and AI). This is the fastest way to
14
+ develop against realistic state.
15
+
16
+ - `--port <port>` — choose the dev-server port.
17
+
18
+ ## Offline sandbox
19
+
20
+ To develop without touching live data — for example on a plane, or before you
21
+ trust a destructive change — use a local sandbox backed by an embedded database
22
+ and a filesystem blob store:
23
+
24
+ ```bash
25
+ canopy dev --local
26
+ ```
27
+
28
+ This creates a local database and blobs under `.canopy/local/` in your
29
+ project. The sandbox starts empty.
30
+
31
+ To seed the sandbox from a fresh copy of production data first:
32
+
33
+ ```bash
34
+ canopy dev --local --pull
35
+ ```
36
+
37
+ `.canopy/local/` is disposable — delete it to reset the sandbox.
38
+
39
+ By default the sandbox runs PGlite (embedded Postgres), so raw
40
+ `canopy.db.sql()` speaks the postgres dialect there, while your deployed
41
+ project speaks whatever its platform target speaks (`canopy.db.dialect()`
42
+ tells you — sqlite on Cloudflare). Collections (`canopy.db.collection(...)`)
43
+ behave the same in both, so this only matters for hand-written SQL — see
44
+ `canopy docs data`. If your project's raw SQL targets a sqlite site, lock the
45
+ dialect in `canopy.json` (`"dialect": "sqlite"`) and the sandbox runs an
46
+ embedded SQLite engine instead, so the same SQL works locally and deployed —
47
+ see [canopy dev](https://docs.canopy.website/cli/dev).
48
+
49
+ ## Backend worker
50
+
51
+ Projects with a `worker` entry in `canopy.json` get their backend locally too:
52
+ `/api/*` is served by your worker in both modes, with the same `env` it has in
53
+ production (`env.CANOPY`, `env.DB`, `env.BLOB`, `env.USER`). Edit and refresh —
54
+ there's no build step.
55
+
56
+ Secrets are the one thing that doesn't come from the dashboard. Stored values
57
+ are never downloadable, so put local ones in a `.dev.vars` file next to
58
+ `canopy.json`:
59
+
60
+ ```
61
+ STRIPE_KEY=sk_test_local
62
+ ```
63
+
64
+ Your worker reads them the same way it reads dashboard secrets
65
+ (`c.env.STRIPE_KEY`). `canopy dev` prints which dashboard secret names your
66
+ `.dev.vars` is missing. Keep the file out of git — the scaffolds ignore it.
67
+
68
+ ## Which mode should an agent use?
69
+
70
+ - Iterating on UI or read-only features → `canopy dev` (live data, realistic).
71
+ - Testing writes, migrations, or anything destructive → `canopy dev --local`
72
+ (optionally `--pull` to start from real data).
@@ -0,0 +1,95 @@
1
+ ---
2
+ title: Building with agents
3
+ description: Teach your coding agent Canopy — the agent skill, offline docs, template guardrails, and prompts that work.
4
+ ---
5
+
6
+ Canopy is built to be driven by coding agents. Three pieces make that work:
7
+ an installable agent skill, docs the CLI carries offline, and guardrail files
8
+ every new project ships with. Set them up once and your agent knows how to
9
+ scaffold, run, deploy, and manage data without guessing.
10
+
11
+ ## Install the skill
12
+
13
+ From your project (or any repo the agent works in):
14
+
15
+ ```bash
16
+ canopy skill install
17
+ ```
18
+
19
+ This writes the skill to the tool-neutral `.agents/skills/canopy/` tree and
20
+ symlinks `.claude/skills/canopy` to it, so Claude Code picks it up while other
21
+ agents read `.agents/`. `canopy upgrade` refreshes it alongside the CLI.
22
+
23
+ The skill teaches an agent to:
24
+
25
+ - **Check install and login first** — `canopy --version`, `canopy whoami`,
26
+ and how to run `canopy login` correctly (hand the browser sign-in to the
27
+ human; never touch credentials).
28
+ - **Read docs before acting** — prefer `canopy docs <topic>` and
29
+ `canopy <command> --help` over guessing flags.
30
+ - **Choose the right starter** — `spa` for anything real (typed SDK),
31
+ `static` only for trivial pages, `worker` when server-side code is needed —
32
+ and use `canopy init <slug>` (never `canopy create`) for a project that
33
+ already exists.
34
+ - **Respect safety rules** — confirm before deploys, snapshot before
35
+ `canopy db restore`, treat `canopy delete` as destructive.
36
+
37
+ ## Offline docs for agents
38
+
39
+ The CLI ships the full platform documentation and keeps it fresh from the
40
+ platform, so an agent can read it without a browser — even before signing in:
41
+
42
+ ```bash
43
+ canopy docs # list all topics
44
+ canopy docs deploy # print one topic
45
+ canopy docs cli --refresh # force a re-fetch from the platform
46
+ ```
47
+
48
+ Topics mirror the [guides](https://docs.canopy.website/guides/getting-started) on this site:
49
+ `getting-started`, `cli`, `dev`, `deploy`, `data`, `ci`, `troubleshooting`,
50
+ and more.
51
+
52
+ ## Template guardrails
53
+
54
+ Every scaffolded project includes an `AGENTS.md` (the agent-facing README)
55
+ that encodes the platform's boundaries, so an agent starting cold in the repo
56
+ already knows the rules:
57
+
58
+ - **Don't add auth** — the platform authenticates every request first.
59
+ - **Don't store secrets** in the repo or browser code; set them in the
60
+ dashboard, and only a backend worker reads them.
61
+ - **No SSR, no custom servers, no external databases** — data goes through
62
+ `canopy.db` and `canopy.blob`.
63
+ - `canopy dev` uses **live** project data: snapshot before risky writes, or
64
+ use `canopy dev --local` for an offline sandbox where writes never reach
65
+ the platform.
66
+
67
+ ## Prompts that work
68
+
69
+ With the skill installed, these are safe, copy-pasteable asks — each maps to
70
+ commands the skill and docs actually cover:
71
+
72
+ ```text
73
+ Set up Canopy in this repo: check the CLI is installed and I'm logged in,
74
+ then install the Canopy skill and skim `canopy docs getting-started`.
75
+ ```
76
+
77
+ ```text
78
+ Create a new Canopy project for a team lunch-voting app (spa template),
79
+ run it locally with `canopy dev`, and build the first version of the UI.
80
+ ```
81
+
82
+ ```text
83
+ Deploy this project to Canopy, then open the live site so I can check it.
84
+ If anything looks wrong, roll back to the previous version.
85
+ ```
86
+
87
+ ```text
88
+ Take a database snapshot, then pull the production data with
89
+ `canopy db pull` and use the dump to reproduce the bug locally with
90
+ `canopy dev --local --pull`.
91
+ ```
92
+
93
+ > **Note:** Deploys go live behind company sign-in and restores replace all project data — a well-behaved
94
+ > agent will confirm both with you first. That caution comes from the skill; keep it installed and
95
+ > current.
@@ -0,0 +1,106 @@
1
+ ---
2
+ title: How the platform serves your project
3
+ description: What happens between a browser and your deployed code — auth wall, static assets, the optional backend worker, and where data lives.
4
+ ---
5
+
6
+ You never manage servers on Canopy, but it helps to know what the platform
7
+ does with a request. This page covers the pieces a project developer actually
8
+ touches; platform internals stay out of it.
9
+
10
+ ## The request path
11
+
12
+ Every project lives at `https://<slug>.canopy.<domain>`. Requests hit the
13
+ **gateway** first, which enforces authentication before any of your project's
14
+ bytes are served — then either serves your deployed static files or, if the
15
+ project has one, dispatches `/api/*` to your backend worker.
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ B[Browser] --> G["Gateway<br/>auth wall: OneLogin session<br/>or client password"]
20
+ G -->|"most paths"| A["Static assets<br/>deployed build, SPA fallback"]
21
+ G -->|"/api/*"| W["Backend worker<br/>(optional, canopy.json 'worker')"]
22
+ G -->|"/_api/data/v1/*"| P["Platform data plane<br/>auth · db · blob · ai"]
23
+ W --> P
24
+ P --> D[("Project database<br/>+ blob prefix")]
25
+ ```
26
+
27
+ ## The auth wall
28
+
29
+ Authentication is a platform property — your app cannot opt out, and must not
30
+ build its own. A visitor without a valid session is redirected into the
31
+ OneLogin sign-in flow; on projects with client access enabled, outsiders get a
32
+ password page and receive a scope-limited `external` session instead. Only
33
+ after that does any project code or asset get served. Your app just asks
34
+ `canopy.auth.user()` who came through the door
35
+ (see the [SDK reference](https://docs.canopy.website/sdk)).
36
+
37
+ ## Static assets and the SPA fallback
38
+
39
+ A deploy uploads your built files as an immutable, numbered version; serving
40
+ reads whichever version is live. Requests for paths that don't match a file
41
+ fall back to `index.html`, so client-side routes like `/settings` work on a
42
+ hard refresh without any configuration. Rollback just repoints "live" at an
43
+ earlier version — instant, nothing rebuilt.
44
+
45
+ The full path — including caching, version-pinned `v12-dot-<slug>` preview
46
+ hosts, and the security review — is in
47
+ [How static files are served](https://docs.canopy.website/guides/static-serving).
48
+
49
+ ## The optional backend worker
50
+
51
+ Most projects are frontend-only: the SDK talks straight to the platform, and
52
+ no server code exists. When you need server-side code — say, calling an
53
+ external API with a secret the browser can't hold — the `worker` template adds
54
+ a backend, declared in `canopy.json`:
55
+
56
+ ```json
57
+ {
58
+ "slug": "my-app",
59
+ "build": "npm run build",
60
+ "dist": "dist",
61
+ "worker": "worker/index.ts"
62
+ }
63
+ ```
64
+
65
+ Requests under `/api/*` reach the worker (Hono-style handlers); everything
66
+ else is still static serving. Three things to know:
67
+
68
+ - **Requests arrive authenticated.** The worker sits behind the same gateway
69
+ wall as the frontend.
70
+ - **Platform access goes through the same SDK**, via the `CANOPY` service
71
+ binding — same budgets, same data isolation as the browser:
72
+
73
+ ```ts
74
+ app.get("/api/hello", async (c) => {
75
+ const canopy = createCanopy({ fetch: c.env.CANOPY.fetch.bind(c.env.CANOPY) });
76
+ const user = await canopy.auth.user();
77
+ return c.json({ message: `Hello, ${user.name}!` });
78
+ });
79
+ ```
80
+
81
+ - **Secrets and schedules come from the dashboard.** Secrets (Settings →
82
+ Secrets) land as Workers-shaped bindings (`c.env.MY_API_KEY`, not
83
+ `process.env`); dashboard Schedules invoke an exported
84
+ `scheduled(event, env)` — switch on `event.name`.
85
+
86
+ > **Warning:** Backend workers are capability-gated per target: today the GCP target runs them, while on
87
+ > Cloudflare sites a worker deploy answers a clear "not supported yet". Frontend-only projects
88
+ > deploy everywhere.
89
+
90
+ ## Where your data lives
91
+
92
+ Every project gets its own database and its own blob-storage prefix. No other
93
+ project can read them, and deleting the project tears everything down. The
94
+ document API is portable across targets; raw SQL speaks the target's dialect
95
+ (`sqlite` or `postgres` — ask `canopy.db.dialect()`). Dumps, snapshots, and
96
+ restores are CLI commands — see the [project data guide](https://docs.canopy.website/guides/data).
97
+
98
+ ## Sites
99
+
100
+ A _site_ is one installation of the whole platform. The CLI ships three
101
+ profiles — `main` (canopy.website, Cloudflare), `staging` (thanarie.dev,
102
+ Cloudflare), and `gcp-pilot` (canopy.monks.zone, GCP) — and always shows which
103
+ one you're on. Projects pin theirs in `canopy.json`; `--profile` or
104
+ `CANOPY_PROFILE` overrides per command. Most projects only ever use `main`.
105
+ Target differences (dialect, full-text search, worker support) surface as
106
+ capabilities, not separate APIs.
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: Getting started
3
+ description: Install the CLI, sign in with OneLogin, and ship your first project.
4
+ ---
5
+
6
+ Canopy is Monks' managed platform for vibecoded projects. You build a small web
7
+ app, and Canopy hosts it, gives it a database, blob storage, and AI — no
8
+ infrastructure to manage.
9
+
10
+ This guide is written so an AI coding agent (Claude, Cursor, etc.) can follow it
11
+ on your behalf. Everything runs through one command-line tool: `canopy`.
12
+
13
+ ## 1. Install the CLI
14
+
15
+ The CLI is published on npm. Install it globally:
16
+
17
+ ```bash
18
+ npm install -g @mediamonks/canopy-cli
19
+ ```
20
+
21
+ Confirm it's on your PATH:
22
+
23
+ ```bash
24
+ canopy --version
25
+ ```
26
+
27
+ If `npm` isn't available, install Node.js 20+ first (https://nodejs.org), then
28
+ re-run the install.
29
+
30
+ ## 2. Sign in
31
+
32
+ Canopy authenticates through Monks' OneLogin. Run:
33
+
34
+ ```bash
35
+ canopy login
36
+ ```
37
+
38
+ This opens your browser. **Finish the sign-in there** — the CLI waits for the
39
+ browser to redirect back, then stores a token in `~/.canopy/config.json`.
40
+
41
+ > If you are an agent: run `canopy login`, then stop and tell the human to
42
+ > complete the sign-in in the browser window that just opened. Never ask for or
43
+ > type the user's password or any codes yourself.
44
+
45
+ Check who you are at any time:
46
+
47
+ ```bash
48
+ canopy whoami
49
+ ```
50
+
51
+ ## 3. Create your first project
52
+
53
+ ```bash
54
+ canopy create
55
+ ```
56
+
57
+ This prompts for a name and a starter template, scaffolds a runnable project
58
+ directory, and registers the project on the platform. To skip the prompts:
59
+
60
+ ```bash
61
+ canopy create "My App" --scaffold --template spa
62
+ ```
63
+
64
+ > If you are an agent: don't stop at printing this command. Ask the person what
65
+ > they'd like to build and what it's about, then pick a name and template for
66
+ > them and run `canopy create` non-interactively — then keep going and build
67
+ > it. Aim for a working first project, not a list of commands.
68
+
69
+ Templates: **`static`** (no-build html/css/js; SDK served untyped from the
70
+ platform) is the default and fine for a trivial page or two. Reach for
71
+ **`spa`** (Vite + React + TypeScript; typed SDK from npm) once you lean on the
72
+ SDK or expect the app to grow — most projects want this.
73
+
74
+ ## 4. Run it locally
75
+
76
+ ```bash
77
+ cd my-app
78
+ canopy dev
79
+ ```
80
+
81
+ Your project runs against live platform data by default. For an offline sandbox
82
+ with local data, use `canopy dev --local`.
83
+
84
+ ## 5. Deploy
85
+
86
+ ```bash
87
+ canopy deploy
88
+ ```
89
+
90
+ Then open the live site:
91
+
92
+ ```bash
93
+ canopy open
94
+ ```
95
+
96
+ ## Where to go next
97
+
98
+ Everything the CLI can do is documented and available offline. List the topics:
99
+
100
+ ```bash
101
+ canopy docs
102
+ ```
103
+
104
+ Read one, e.g.:
105
+
106
+ ```bash
107
+ canopy docs deploy
108
+ ```