@mediamonks/canopy-cli 0.7.5 → 0.7.7

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 (55) hide show
  1. package/dist/docs/cli-create.md +46 -0
  2. package/dist/docs/cli-db.md +86 -0
  3. package/dist/docs/cli-delete.md +44 -0
  4. package/dist/docs/cli-deploy.md +58 -0
  5. package/dist/docs/cli-dev.md +63 -0
  6. package/dist/docs/cli-docs.md +47 -0
  7. package/dist/docs/cli-download.md +42 -0
  8. package/dist/docs/cli-egress.md +37 -0
  9. package/dist/docs/cli-feedback.md +51 -0
  10. package/dist/docs/cli-index.md +61 -0
  11. package/dist/docs/cli-init.md +46 -0
  12. package/dist/docs/cli-login.md +43 -0
  13. package/dist/docs/cli-logout.md +32 -0
  14. package/dist/docs/cli-logs.md +57 -0
  15. package/dist/docs/cli-open.md +41 -0
  16. package/dist/docs/cli-projects.md +43 -0
  17. package/dist/docs/cli-promote.md +44 -0
  18. package/dist/docs/cli-rollback.md +45 -0
  19. package/dist/docs/cli-skill.md +39 -0
  20. package/dist/docs/cli-staging.md +54 -0
  21. package/dist/docs/cli-token.md +47 -0
  22. package/dist/docs/cli-upgrade.md +43 -0
  23. package/dist/docs/cli-usage.md +43 -0
  24. package/dist/docs/cli-whoami.md +46 -0
  25. package/dist/docs/developers-agents-and-ai.md +95 -0
  26. package/dist/docs/developers-architecture.md +106 -0
  27. package/dist/docs/index.json +331 -0
  28. package/dist/docs/infrastructure.md +5 -8
  29. package/dist/docs/overview-faq.md +105 -0
  30. package/dist/docs/overview-how-it-works.md +81 -0
  31. package/dist/docs/overview-use-cases.md +76 -0
  32. package/dist/docs/overview-what-is-canopy.md +75 -0
  33. package/dist/docs/platform-ai-usage.md +65 -0
  34. package/dist/docs/platform-client-access.md +53 -0
  35. package/dist/docs/platform-deploys-and-rollbacks.md +93 -0
  36. package/dist/docs/platform-egress.md +75 -0
  37. package/dist/docs/platform-feedback.md +79 -0
  38. package/dist/docs/platform-members-and-access.md +71 -0
  39. package/dist/docs/platform-project-data.md +66 -0
  40. package/dist/docs/platform-schedules.md +90 -0
  41. package/dist/docs/platform-sites-and-profiles.md +61 -0
  42. package/dist/docs/static-serving.md +5 -8
  43. package/dist/docs/troubleshooting.md +6 -8
  44. package/dist/{docs-DQmUReJR.mjs → docs-DOiL2Sw-.mjs} +42 -20
  45. package/dist/feedback-BZG8E8zG.mjs +258 -0
  46. package/dist/index.mjs +10 -9
  47. package/dist/{logs-DBLDS3aQ.mjs → logs-DuzM-_Rn.mjs} +1 -1
  48. package/dist/{package-yVoO2pq4.mjs → package-BNiOibhj.mjs} +1 -1
  49. package/dist/{projects-D2fDeWNU.mjs → projects-C9TBoiW7.mjs} +5 -8
  50. package/dist/skill/canopy/SKILL.md +17 -8
  51. package/dist/{skill-12Ga-2UT.mjs → skill-DRTg-mJR.mjs} +1 -1
  52. package/dist/templates/worker/AGENTS.md +0 -3
  53. package/dist/templates/worker/README.md +1 -5
  54. package/dist/{upgrade-Du6U0xjp.mjs → upgrade-BDaM4M6Y.mjs} +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: canopy logout
3
+ description: Sign out of Canopy by removing all locally stored CLI tokens.
4
+ ---
5
+
6
+ `canopy logout` signs you out on this machine by forgetting every stored CLI token. Use it on a shared machine, or when you want a clean slate before logging in as someone else.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy logout
12
+ ```
13
+
14
+ ## Arguments & flags
15
+
16
+ None. Logout is deliberately all-or-nothing: it clears the tokens for **every** site (`main`, `staging`, `gcp-pilot`) at once — there is no per-profile logout, so the global `--profile` flag has no effect here.
17
+
18
+ ## Details
19
+
20
+ The command is local-only: it removes every stored token from `~/.canopy/config.json` and prints a confirmation. Nothing is called on the server, so the tokens themselves aren't revoked — they simply age out at their normal expiry. Your active-site choice stays in the file, so the next `canopy login` picks up where you left off.
21
+
22
+ If no token was stored to begin with, it prints `Not logged in.` and exits successfully.
23
+
24
+ ## Examples
25
+
26
+ ```bash
27
+ canopy logout
28
+ ```
29
+
30
+ Removes all site tokens from `~/.canopy/config.json`; subsequent commands that need the API will ask you to run `canopy login`.
31
+
32
+ See also [canopy login](https://docs.canopy.website/cli/login) and [canopy whoami](https://docs.canopy.website/cli/whoami).
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: canopy logs
3
+ description: Read your project worker's logs (console output) from the terminal — no cloud console access needed.
4
+ ---
5
+
6
+ `canopy logs` prints what your project's worker wrote to `console.log` / `console.error`. Reach for it when the worker misbehaves — a 500, an unexpected 403, a schedule that "did nothing" — instead of adding diagnostic endpoints and redeploying. The same output lives in the dashboard under the project's **Logs** tab.
7
+
8
+ Logs are available on every site that runs workers. On a site where the platform can't read worker output, the command says so honestly instead of guessing. One caveat on Cloudflare-hosted sites: log capture starts with a project's next deploy after 2026-08-19 — a worker that hasn't been redeployed since then has nothing to show yet.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ canopy logs [--project <slug>] [--staging] [--since 1h] [--limit 100] [--follow] [--json]
14
+ ```
15
+
16
+ ## Arguments & flags
17
+
18
+ - `--project <slug>` — project slug. Defaults to the `canopy.json` in the current directory.
19
+ - `--staging` — read the staging channel's worker instead of live. Default `false`.
20
+ - `--since <when>` — how far back to read: a duration like `30s`, `15m`, `2h`, `1d`, or a timestamp. Default `1h`.
21
+ - `--limit <n>` — max entries to print, 1–1000. Default `100`.
22
+ - `--follow` / `-f` — keep polling for new entries every few seconds until you Ctrl-C.
23
+ - `--json` — print entries as JSON lines (`{ ts, severity, text }`) instead of formatted text.
24
+
25
+ ## How it works
26
+
27
+ Every request your worker handles captures its stdout/stderr; `canopy logs` reads that capture through the platform (project members only — there's no direct cloud access to grant or leak). Entries print oldest-first as:
28
+
29
+ ```
30
+ SEVERITY timestamp text
31
+ ```
32
+
33
+ `console.error` output is tagged `ERROR` and `console.warn` is `WARNING`; `console.log` stays `DEFAULT`. Text is verbatim — whatever the worker logged, including multi-line JSON. Thrown errors show up too: an uncaught exception in a request handler becomes one `ERROR` entry with the full stack trace (and the request answers a 500), so a crashing endpoint is diagnosable from the log alone.
34
+
35
+ It's read-only and stdout-clean: entries go to stdout for piping, everything else to stderr.
36
+
37
+ ## Examples
38
+
39
+ ```bash
40
+ canopy logs --since 15m
41
+ ```
42
+
43
+ The last quarter hour of worker output for the project in the current directory.
44
+
45
+ ```bash
46
+ canopy logs -f
47
+ ```
48
+
49
+ Watch logs live while you exercise the app — the closest thing to a terminal attached to your deployed worker.
50
+
51
+ ```bash
52
+ canopy logs --staging --since 1d --json | jq -r 'select(.severity == "ERROR") | .text'
53
+ ```
54
+
55
+ Just yesterday's errors from the staging worker, for a script or an agent.
56
+
57
+ See also [Troubleshooting](https://docs.canopy.website/guides/troubleshooting) for what to do with what you find, and [canopy staging](https://docs.canopy.website/cli/staging) for the staging channel.
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: canopy open
3
+ description: Open the deployed project in your browser.
4
+ ---
5
+
6
+ `canopy open` opens the project's live URL in your default browser — the quickest way to look at what's actually deployed, typically right after a `canopy deploy`.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy open [dir] [--project <slug>]
12
+ ```
13
+
14
+ ## Arguments & flags
15
+
16
+ - `--staging` — open the [staging channel](https://docs.canopy.website/guides/staging) (`staging-dot-<slug>`) instead of the live site.
17
+
18
+ - `[dir]` — project directory to read `canopy.json` from. Defaults to the current directory.
19
+ - `--project <slug>` — project slug, overriding `canopy.json`.
20
+
21
+ ## How it works
22
+
23
+ The command resolves the project slug, builds the live URL from the active site's project domain (projects are served at `https://<slug>.<site domain>`), prints the URL, and opens it in your default browser. Which domain that is depends on the active profile — `--profile staging` opens the project on the staging site, not production.
24
+
25
+ It does not deploy, check, or wait for anything: if the project has never been deployed, the browser simply lands on whatever the platform serves for an empty project. To open the dashboard instead, use the URL printed by [canopy projects](https://docs.canopy.website/cli/projects).
26
+
27
+ ## Examples
28
+
29
+ ```bash
30
+ canopy deploy && canopy open
31
+ ```
32
+
33
+ Ship and eyeball: deploys the current directory's project, then opens the freshly-live site.
34
+
35
+ ```bash
36
+ canopy open --project my-app --profile staging
37
+ ```
38
+
39
+ Opens `my-app` as served by the staging site, regardless of what the current directory pins.
40
+
41
+ See also [canopy deploy](https://docs.canopy.website/cli/deploy) and [Sites & profiles](https://docs.canopy.website/platform/sites-and-profiles).
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: canopy projects
3
+ description: List your Canopy projects with their status, role, and live URLs.
4
+ ---
5
+
6
+ `canopy projects` lists the projects you can work on for the current site — one line each with slug, status, your role, live URL, and name. It's the quickest way to recall a slug, check what you have access to, or confirm you're on the site you think you are.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy projects
12
+ canopy projects --all
13
+ canopy --profile staging projects
14
+ ```
15
+
16
+ ## Arguments & flags
17
+
18
+ - `--all` — include projects you can't edit. By default the list shows only projects where you're an owner or editor (admins always see everything, since they can edit everything).
19
+ - `--profile <site>` — global flag (or `CANOPY_PROFILE`): each site has its own project registry, so listing on `staging` shows a completely different set than `main`.
20
+
21
+ ## Details
22
+
23
+ The command fetches your project list from the platform and prints one aligned row per project: slug, status, your role (`owner` / `editor`; for `--all` rows you can't edit it shows the owner's email instead, and admins see `admin`), the live URL, and the display name.
24
+
25
+ With nothing to show, the message distinguishes the two cases: no projects exist at all (`run canopy create`), or none are yours — in which case it mentions how many `--all` would reveal.
26
+
27
+ The CLI version and active site are printed on stderr, keeping stdout clean for piping — handy since the output is stable, column-aligned text.
28
+
29
+ ## Examples
30
+
31
+ ```bash
32
+ canopy projects
33
+ ```
34
+
35
+ Shows your own projects on your default site, e.g. to grab a slug for `canopy init` or `canopy delete`.
36
+
37
+ ```bash
38
+ canopy projects --all
39
+ ```
40
+
41
+ Shows every project on the site, with owner emails for the ones you can't edit — useful for finding who to ask for access.
42
+
43
+ See also [canopy create](https://docs.canopy.website/cli/create), [canopy init](https://docs.canopy.website/cli/init), and [Members & access](https://docs.canopy.website/platform/members-and-access).
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: canopy promote
3
+ description: Make the staged version live — migrations replay against the live database first, then the exact staged artifacts go live.
4
+ ---
5
+
6
+ `canopy promote` takes what you verified on the [staging channel](https://docs.canopy.website/guides/staging)
7
+ and makes it live. It is not a redeploy: the platform re-uses the exact files
8
+ and backend bundle of the staged version, so what you tested is what ships.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ canopy promote # promote the currently staged version
14
+ canopy promote v8 # promote a specific version
15
+ canopy promote --yes # skip the confirmation (CI)
16
+ ```
17
+
18
+ ## Arguments & flags
19
+
20
+ - `[version]` — the version to make live, as `8` or `v8`. Defaults to whatever
21
+ is currently staged; errors when nothing is staged and no version is given.
22
+ - `--project <slug>` — project slug, overriding `canopy.json`.
23
+ - `--dir <path>` — project directory (defaults to the current directory).
24
+ - `--yes` — skip the confirmation prompt.
25
+ - `--profile <site>` / `CANOPY_PROFILE` — which site to promote on.
26
+
27
+ ## What happens, in order
28
+
29
+ 1. **Migrations replay against live.** Any schema migrations you rehearsed on
30
+ staging are still pending in the live database's journal — they apply now,
31
+ with an automatic pre-promote snapshot taken first. A migration failure
32
+ aborts the promote: the live version never flips, old code keeps running,
33
+ and the output names the snapshot and the restore command.
34
+ 2. **The staged backend goes live.** If the version shipped a worker, the
35
+ platform redeploys that exact bundle with live bindings.
36
+ 3. **The pointer flips.** The staged version becomes the live version.
37
+
38
+ The output confirms the live URL, the promoted version, any migrations that
39
+ applied, and the snapshot key.
40
+
41
+ Promotion is also a button on the dashboard's Overview tab.
42
+
43
+ See also [canopy deploy](https://docs.canopy.website/cli/deploy) (`--staging`), [canopy staging](https://docs.canopy.website/cli/staging),
44
+ and [Staging & promoting](https://docs.canopy.website/guides/staging).
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: canopy rollback
3
+ description: Make an earlier deploy live again by moving the live pointer to a previous version.
4
+ ---
5
+
6
+ `canopy rollback` switches the project's live version back to an earlier deploy. Reach for it when a deploy went wrong and you want the last good version serving again in seconds — no rebuild, no re-upload.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy rollback # pick a version from the deploy history
12
+ canopy rollback v3 # make v3 live directly
13
+ canopy rollback --project my-app 3
14
+ ```
15
+
16
+ ## Arguments & flags
17
+
18
+ - `[version]` — the deploy version to make live, as `3` or `v3`. Optional: when omitted on an interactive terminal you get a picker showing the full deploy history (version, timestamp, source, and which one is currently live), preselecting the version just before the live one. On a non-TTY run with no version, the CLI rolls back to `live - 1` automatically.
19
+ - `--project <slug>` — project slug, overriding `canopy.json` in the target directory.
20
+ - `--dir <path>` — project directory (defaults to the current directory).
21
+ - `--profile <site>` / `CANOPY_PROFILE` — which site's deployment to roll back.
22
+
23
+ ## How it works
24
+
25
+ Every deploy is stored immutably as a numbered version; "live" is just a pointer to one of them. Rolling back moves that pointer — no files are rebuilt, uploaded, or deleted. Projects with a custom backend also get their backend rolled to the bundle matching the target version, so frontend and backend stay in step. The command prints the target, asks the platform to repoint, and confirms with the live URL, the now-live version, and the version that was live before.
26
+
27
+ Because versions are never destroyed, rolling back is symmetric: "roll forward" is simply `canopy rollback <newer-version>` — pass the number of the newer deploy you want live again. Picking the version that's already live is an error, and a project with fewer than two deploys has nothing to roll back to.
28
+
29
+ Deploy history is also visible in the dashboard, where the same rollback is a button.
30
+
31
+ ## Examples
32
+
33
+ ```bash
34
+ canopy rollback
35
+ ```
36
+
37
+ Shows the deploy history for the project in the current directory and lets you pick — the entry before the live one is preselected.
38
+
39
+ ```bash
40
+ canopy rollback v7 --project client-site --profile main
41
+ ```
42
+
43
+ Directly repoints `client-site` on the main site to version 7 — works the same whether v7 is older or newer than what's live.
44
+
45
+ See also [canopy deploy](https://docs.canopy.website/cli/deploy), [canopy download](https://docs.canopy.website/cli/download), and [Deploys & rollbacks](https://docs.canopy.website/platform/deploys-and-rollbacks).
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: canopy skill
3
+ description: Install the Canopy agent skill into a repo so coding agents know how to drive the platform.
4
+ ---
5
+
6
+ `canopy skill install` writes the Canopy agent skill into the current repository, teaching AI coding agents (Claude Code and others) how to use the platform: checking install and login state, creating vs. initializing projects, choosing templates, reading `canopy docs` before guessing, and treating `db restore`, `delete`, and deploys with appropriate care.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy skill install
12
+ ```
13
+
14
+ `install` is currently the only subcommand.
15
+
16
+ ## Arguments & flags
17
+
18
+ None — it always installs into the repository at the current working directory.
19
+
20
+ ## How it works
21
+
22
+ The skill files ship inside the CLI package, so installing needs no network. Two paths are written:
23
+
24
+ - `.agents/skills/canopy/` — the source of truth, in the tool-neutral `.agents/` tree so any agent tooling can read it (no vendor lock-in).
25
+ - `.claude/skills/canopy` — a **symlink** to the `.agents/` copy, so Claude Code picks the skill up. Where symlinks aren't available (e.g. Windows without developer mode), the CLI falls back to a real copy and says so.
26
+
27
+ Installation is a clean replace: any existing skill directory is removed first, and the installed copy is stamped with the CLI version that wrote it. That stamp is how the skill stays fresh — [`canopy upgrade`](https://docs.canopy.website/cli/upgrade) detects an installed skill in the repo and re-runs `canopy skill install` with the new CLI, so the skill always matches the CLI version in use. If that auto-refresh ever fails, re-run `canopy skill install` yourself.
28
+
29
+ Commit the `.agents/` directory (and the `.claude/` link) so teammates and CI agents get the skill with the repo.
30
+
31
+ ## Examples
32
+
33
+ ```bash
34
+ canopy skill install
35
+ ```
36
+
37
+ From a repo root: installs the skill, prints where the files went and whether `.claude/skills/canopy` is a symlink or a copy, and suggests trying `canopy docs`.
38
+
39
+ See also [canopy docs](https://docs.canopy.website/cli/docs) — the always-current documentation the skill points agents at — and [canopy upgrade](https://docs.canopy.website/cli/upgrade).
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: canopy staging
3
+ description: Inspect, refresh, or tear down the project's staging channel.
4
+ ---
5
+
6
+ `canopy staging` manages the project's [staging channel](https://docs.canopy.website/guides/staging) — the
7
+ safe copy created by the first `canopy deploy --staging`.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ canopy staging status # what's staged, what's live, the staging URL
13
+ canopy staging use v3 # serve an existing version on staging
14
+ canopy staging sync # replace staging data with a fresh copy of live
15
+ canopy staging destroy # remove the staging channel entirely
16
+ ```
17
+
18
+ ## Subcommands
19
+
20
+ ### `status`
21
+
22
+ Shows whether the channel exists, which version is staged (and whether it has
23
+ a backend), which version is live, and the staging URL. When the staged version
24
+ differs from live it reminds you that `canopy promote` makes it live.
25
+
26
+ ### `use`
27
+
28
+ Points the staging channel at any version in the deploy history — the reverse
29
+ of [canopy promote](https://docs.canopy.website/cli/promote), and the staging twin of
30
+ [canopy rollback](https://docs.canopy.website/cli/rollback). A pointer move: nothing is uploaded or
31
+ rebuilt, and the version's backend (if any) is redeployed to the staging
32
+ worker. Omit the version on a terminal to pick from the history. Requires the
33
+ staging channel to exist; it applies no migrations, so an old version runs
34
+ against staging's current schema (the same caveat version previews have).
35
+
36
+ ### `sync`
37
+
38
+ Re-clones the live database over the staging one. Staging data is replaced —
39
+ live is only read. Use it to re-rehearse a migration on fresh data, or when
40
+ test writes have made staging drift too far. Asks for confirmation on a
41
+ terminal; `--yes` skips it.
42
+
43
+ ### `destroy`
44
+
45
+ Deletes the staging database, staged files, and the staging backend. Live is
46
+ untouched. The deploy history keeps its records, and the next
47
+ `canopy deploy --staging` recreates the channel from a fresh copy of live.
48
+ Requires typing the slug to confirm; `--yes` skips it.
49
+
50
+ All three take `--project <slug>` to target a project outside the current
51
+ directory, and `--profile <site>` / `CANOPY_PROFILE` for the site.
52
+
53
+ See also [canopy deploy](https://docs.canopy.website/cli/deploy), [canopy promote](https://docs.canopy.website/cli/promote), and
54
+ [Staging & promoting](https://docs.canopy.website/guides/staging).
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: canopy token
3
+ description: Create, list, and revoke project-scoped deploy tokens for CI and push-to-main deploys.
4
+ ---
5
+
6
+ `canopy token` manages deploy tokens: standing `cnpy_` bearer credentials that can do exactly one thing — deploy one specific project. You reach for it when setting up CI (typically GitHub Actions deploying on every push to main) so the runner never needs a personal login.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy token create --name "GitHub Actions"
12
+ canopy token list
13
+ canopy token revoke <id>
14
+ ```
15
+
16
+ ## Arguments & flags
17
+
18
+ All subcommands resolve the project the usual way — `canopy.json` in the target directory, or `--project <slug>` to override — and honor the global `--profile <site>` / `CANOPY_PROFILE` for which site the token belongs to.
19
+
20
+ - `create` — mint a new deploy token for the project.
21
+ - `--name <label>` — a label shown in the dashboard, e.g. `"GitHub Actions"`. Optional but recommended so you can tell tokens apart later.
22
+ - `list` — show the project's deploy tokens: id, name, creation time, and who created them. Token values are never shown here.
23
+ - `revoke <id>` — delete a token by its id (from `canopy token list`). Deploys using it stop working immediately.
24
+
25
+ ## How it works
26
+
27
+ `create` prints the token plaintext **exactly once** — the platform stores only a hash, so copy it right away. The token is scoped to a single project on a single site: it can deploy that project and nothing else, which makes it safe to hand to a CI system.
28
+
29
+ To use it in CI, put the value in the `CANOPY_DEPLOY_TOKEN` environment variable — the CLI checks it before the login token, so `canopy deploy` works on a runner with no `canopy login`. For GitHub Actions, add it as the repo secret `CANOPY_DEPLOY_TOKEN` (`gh secret set CANOPY_DEPLOY_TOKEN`, or Settings → Secrets); pushes to main then deploy via the project's `canopy-deploy.yml` workflow.
30
+
31
+ If a deploy fails with a rejected token, it was likely revoked — create a fresh one here or in the dashboard (Settings → Deploy tokens) and update the secret. Losing a token is never a problem: revoke the old id and mint a new one.
32
+
33
+ ## Examples
34
+
35
+ ```bash
36
+ canopy token create --name "GitHub Actions"
37
+ ```
38
+
39
+ Prints a new `cnpy_` token once, with instructions for storing it as the `CANOPY_DEPLOY_TOKEN` repo secret.
40
+
41
+ ```bash
42
+ canopy token list --project my-app
43
+ ```
44
+
45
+ Shows every deploy token for `my-app` so you can spot stale ones and revoke them by id.
46
+
47
+ See also [canopy deploy](https://docs.canopy.website/cli/deploy) and the [CI guide](https://docs.canopy.website/guides/ci).
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: canopy upgrade
3
+ description: Update the Canopy CLI to the latest published version, using the installer that put it there.
4
+ ---
5
+
6
+ `canopy upgrade` reinstalls the CLI globally at the latest published version. You'll usually run it because the CLI told you to: when a newer release exists, commands print a one-line `Update available: … Run 'canopy upgrade' to update.` hint on stderr.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy upgrade
12
+ canopy upgrade --version 0.5.0
13
+ canopy upgrade --pm npm
14
+ ```
15
+
16
+ ## Arguments & flags
17
+
18
+ - `--version <x.y.z>` — install this exact version instead of `latest` (also how you downgrade).
19
+ - `--pm <installer>` — which installer to use: `vp`, `npm`, `pnpm`, `yarn`, or `bun`. Auto-detected by default.
20
+
21
+ ## How it works
22
+
23
+ The CLI shells out to a package manager rather than replacing files itself, so global prefixes, permissions, and lockfiles stay the installer's concern. It detects which installer owns the running binary from the binary's own path (Vite+, pnpm, bun, and yarn each keep globals in a recognizable place) and defaults to npm otherwise. The detection matters: a Vite+-installed `canopy` upgraded via plain `npm install -g` would land in npm's separate prefix and leave the active binary untouched — `--pm` overrides the guess when it's wrong.
24
+
25
+ The command prints the exact install command it runs, streams the installer's output, and suggests `canopy --version` to confirm. If the repo you're in has the [Canopy agent skill](https://docs.canopy.website/cli/skill) installed, the upgrade finishes by running the **new** CLI's `canopy skill install` to keep the skill in sync (with a warning, not a failure, if that step can't run).
26
+
27
+ The passive hint that leads you here is a once-a-day background check of the npm registry, cached in `~/.canopy/version-check.json`. It never blocks or slows a command, stays silent in CI and piped output, and can be disabled with `CANOPY_NO_UPDATE_CHECK=1`. The hint itself is suppressed while you're running `upgrade`.
28
+
29
+ ## Examples
30
+
31
+ ```bash
32
+ canopy upgrade
33
+ ```
34
+
35
+ Detects that the CLI was installed with, say, Vite+ and runs `vp install -g @mediamonks/canopy-cli@latest`, then refreshes the repo's agent skill if one is installed.
36
+
37
+ ```bash
38
+ canopy upgrade --version 0.5.0 --pm npm
39
+ ```
40
+
41
+ Pins a specific release through npm — useful to roll back a release or to correct a wrong auto-detection.
42
+
43
+ See also [canopy skill](https://docs.canopy.website/cli/skill) and [Installing the CLI](https://docs.canopy.website/cli).
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: canopy usage
3
+ description: Show a project's AI spend, storage footprint, and deploy count from the terminal.
4
+ ---
5
+
6
+ `canopy usage` prints what a project is consuming — the same data as the dashboard's Usage tab, without leaving the terminal. Reach for it when you want to know what the AI features are costing, how big the database and blob store have grown, or which version is live.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ canopy usage [--project <slug>] [--json]
12
+ ```
13
+
14
+ ## Arguments & flags
15
+
16
+ - `--project <slug>` — project slug. Defaults to the `canopy.json` in the current directory.
17
+ - `--json` — print the raw JSON (same shape as the dashboard Usage API) instead of the formatted report. Default `false`.
18
+
19
+ ## How it works
20
+
21
+ The command resolves the project, fetches its usage from the platform, and prints a report covering (by default) the last 30 days:
22
+
23
+ - **AI** — total spend in USD, request count, and tokens in/out, with a per-model breakdown (top 8 models). If AI usage data isn't available for the project, the report says so with the reason. A note appears when the window held more requests than were summarized.
24
+ - **Storage** — database size and table count, and blob storage total bytes and object count (each shown as `—` when the project has none).
25
+ - **Deploys** — how many deploys the project has had, and which version is currently live.
26
+
27
+ It's read-only: nothing is changed, and no confirmation is needed. With `--json`, the report goes to stdout as `{ slug, usage }` for scripts and agents; the human view is plain text either way.
28
+
29
+ ## Examples
30
+
31
+ ```bash
32
+ canopy usage
33
+ ```
34
+
35
+ From inside a project directory: prints the AI spend, storage, and deploy summary for the project pinned in `canopy.json`.
36
+
37
+ ```bash
38
+ canopy usage --project my-app --json | jq .usage.ai.costUsd
39
+ ```
40
+
41
+ Pulls one number — the project's AI spend over the window — for a script or a quick answer.
42
+
43
+ See also [AI usage](https://docs.canopy.website/platform/ai-usage) for how spend is measured, and [canopy projects](https://docs.canopy.website/cli/projects) to find a slug.
@@ -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,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.