@mediamonks/canopy-cli 0.7.56 → 0.7.57

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 (51) hide show
  1. package/dist/{ai-DDVTX_nO.mjs → ai-00f2Mgqh.mjs} +2 -2
  2. package/dist/{api-MIRoGsB6.mjs → api-fmc8CEMT.mjs} +4 -0
  3. package/dist/{audience-8U1dwxcU.mjs → audience-ByM1jUH3.mjs} +2 -2
  4. package/dist/{browse-CVBq2IB4.mjs → browse-CxwKuka0.mjs} +1 -1
  5. package/dist/{calls-Cnt16FiF.mjs → calls-DsbRjCcy.mjs} +2 -2
  6. package/dist/{db-CXeAa-Qy.mjs → db-BU-ni9fj.mjs} +3 -3
  7. package/dist/{deploy-C1mwXvJY.mjs → deploy-7tgGJZUK.mjs} +16 -5
  8. package/dist/dev-BtacZ4HE.mjs +2 -0
  9. package/dist/{dev--vOKyg1k.mjs → dev-qp1VRNM_.mjs} +6 -6
  10. package/dist/docs/cli-download.md +1 -1
  11. package/dist/docs/cli-promote.md +2 -0
  12. package/dist/docs/cli-rollback.md +3 -1
  13. package/dist/docs/cli-staging.md +2 -0
  14. package/dist/docs/cli-versions.md +79 -0
  15. package/dist/docs/cli.md +2 -0
  16. package/dist/docs/index.json +6 -1
  17. package/dist/docs/platform-deploys-and-rollbacks.md +37 -5
  18. package/dist/{docs-DgMINV-7.mjs → docs-hcHwEc6n.mjs} +3 -3
  19. package/dist/{egress-Cy3UBgEM.mjs → egress-Bzn2VKDe.mjs} +2 -2
  20. package/dist/{feedback-DymVKtj0.mjs → feedback-COujxFBV.mjs} +3 -3
  21. package/dist/{files-CYTMMRC0.mjs → files-CBbAtHIK.mjs} +2 -2
  22. package/dist/index.mjs +38 -37
  23. package/dist/{local-DCo1A00D.mjs → local-C1i2uhAf.mjs} +2 -2
  24. package/dist/{login-BpmefYHv.mjs → login-Baso-JE0.mjs} +2 -2
  25. package/dist/{logs-CWr7tRhN.mjs → logs-c76jVOhb.mjs} +2 -2
  26. package/dist/{mcp-D0TZcRce.mjs → mcp-aWskwkXw.mjs} +2 -2
  27. package/dist/{migrations-CkGa1pmn.mjs → migrations-ChafLorm.mjs} +1 -1
  28. package/dist/{open-D2WqNBiq.mjs → open-Doat726T.mjs} +1 -1
  29. package/dist/{package-BpSdSdZI.mjs → package-BpOFa8Qi.mjs} +1 -1
  30. package/dist/project-template--mESzwea.mjs +2 -0
  31. package/dist/{project-template-DjbT9RRU.mjs → project-template-BnX47DpF.mjs} +2 -2
  32. package/dist/{projects-Dcq37hny.mjs → projects-DOqpkUVT.mjs} +4 -4
  33. package/dist/{rename-DTg_3_BJ.mjs → rename-RA_oYbRT.mjs} +2 -2
  34. package/dist/{repo-ZjkxQKwh.mjs → repo-DD3eK1P_.mjs} +2 -2
  35. package/dist/repo-DayXVvyj.mjs +2 -0
  36. package/dist/{roles-2dF7LkZB.mjs → roles-BS8-Gvv-.mjs} +2 -2
  37. package/dist/{roles-B5E2tfbN.mjs → roles-tqf4sYDM.mjs} +1 -1
  38. package/dist/{schedule-_u2Ab1WH.mjs → schedule-D8AQ8MVF.mjs} +2 -2
  39. package/dist/{secrets-H1bQRNBr.mjs → secrets-Bi7BYCla.mjs} +2 -2
  40. package/dist/skill/canopy/SKILL.md +5 -0
  41. package/dist/{skill-BHDQdPTC.mjs → skill-984KseKb.mjs} +2 -2
  42. package/dist/{staging-BZJwA_iG.mjs → staging-BxG3Cffd.mjs} +2 -2
  43. package/dist/{token-BEV5lbld.mjs → token-bHdy_IoX.mjs} +2 -2
  44. package/dist/{ui-7cyGNbu5.mjs → ui-9f_lF2Ak.mjs} +1 -1
  45. package/dist/{upgrade-BYTMPnOF.mjs → upgrade-DhK_PlAN.mjs} +2 -2
  46. package/dist/{usage-iYp64st3.mjs → usage-DFs2TERV.mjs} +2 -2
  47. package/dist/versions-Cgw7sB3h.mjs +106 -0
  48. package/package.json +1 -1
  49. package/dist/dev-CCMeTwvP.mjs +0 -2
  50. package/dist/project-template-D-e33lix.mjs +0 -2
  51. package/dist/repo-C_gmPkLX.mjs +0 -2
@@ -1,5 +1,5 @@
1
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
2
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
1
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
2
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/ai.ts
5
5
  /**
@@ -226,6 +226,10 @@ const ERROR_COPY = {
226
226
  why: "branches are full git refs, and the staging branch must differ from the live one",
227
227
  fix: "Pass e.g. `--ref refs/heads/main --staging-ref refs/heads/develop`."
228
228
  },
229
+ version_expired: {
230
+ why: "version retention expired that version: its files are gone, so it can no longer be made live, staged, pinned or downloaded",
231
+ fix: "Pick a version that is still kept (`canopy versions` shows how many are), or rebuild it from source and deploy."
232
+ },
229
233
  slug_unchanged: {
230
234
  why: "the project already has that slug",
231
235
  fix: "Pass the new slug you want, e.g. `canopy rename my-new-name`."
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/audience.ts
@@ -1,5 +1,5 @@
1
1
  import { g as tryResolveProject, r as siteConfig } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, t as ApiError } from "./api-MIRoGsB6.mjs";
2
+ import { a as apiRequest, t as ApiError } from "./api-fmc8CEMT.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/browse.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/calls.ts
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext, r as apiDataRequest } from "./api-MIRoGsB6.mjs";
3
- import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
4
- import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-CkGa1pmn.mjs";
2
+ import { a as apiRequest, m as withContext, r as apiDataRequest } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
4
+ import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-ChafLorm.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { readFileSync, writeFileSync } from "node:fs";
7
7
  import * as p from "@clack/prompts";
@@ -1,7 +1,7 @@
1
1
  import { d as projectUrl, f as resolveProject, h as tryReadCanopyJson, l as projectDirArgs, m as stagingUrl, r as siteConfig, s as parseVersionArg, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, d as githubActionsCredentials, i as apiDownload, l as currentSlug, m as withContext, p as onGithubActions, r as apiDataRequest, t as ApiError } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap } from "./ui-7cyGNbu5.mjs";
4
- import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-CkGa1pmn.mjs";
2
+ import { a as apiRequest, d as githubActionsCredentials, i as apiDownload, l as currentSlug, m as withContext, p as onGithubActions, r as apiDataRequest, t as ApiError } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
+ import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-ChafLorm.mjs";
5
5
  import { builtinModules } from "node:module";
6
6
  import { defineCommand } from "citty";
7
7
  import { mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -293,12 +293,14 @@ const deployCommand = defineCommand({
293
293
  let result;
294
294
  let migrateResult;
295
295
  let stagingCreated = false;
296
+ let retentionHint = null;
296
297
  try {
297
- const { upload } = await withContext(apiRequest("POST", `/projects/${slug}/deploys`, {
298
+ const { upload, retention } = await withContext(apiRequest("POST", `/projects/${slug}/deploys`, {
298
299
  worker: workerBytes !== null,
299
300
  channel
300
301
  }, { headers: source }), { action: `deploy "${slug}"` });
301
302
  stagingCreated = upload.stagingCreated === true;
303
+ retentionHint = retentionHintLine(retention);
302
304
  const overLimit = bundleLimitError(files, upload);
303
305
  if (overLimit) {
304
306
  spin.error("Deploy refused — nothing was uploaded.");
@@ -333,8 +335,17 @@ const deployCommand = defineCommand({
333
335
  console.log(` happy with it? \`canopy promote\` makes v${result.version} live`);
334
336
  } else spin.stop(`Live: ${projectUrl(currentSlug(slug))} (v${result.version})${backend}`);
335
337
  if (migrateResult !== void 0) for (const line of describeMigrateResult(migrateResult)) console.log(` ${line}`);
338
+ if (retentionHint) console.log(`\n${retentionHint}`);
336
339
  })
337
340
  });
341
+ /**
342
+ * The retention hint a deploy prints when the platform sends one: a project
343
+ * without version retention that has grown large (deploy-retention). One
344
+ * block, worded so an agent reading the output can pass it on.
345
+ */
346
+ function retentionHintLine(retention) {
347
+ return retention?.hint ? ` hint: ${retention.hint}` : null;
348
+ }
338
349
  const promoteCommand = defineCommand({
339
350
  meta: {
340
351
  name: "promote",
@@ -463,7 +474,7 @@ async function uploadFiles(grant, files) {
463
474
  async function pickVersion(deploys, live, message, initial) {
464
475
  return unwrap(await p.select({
465
476
  message,
466
- options: deploys.map((deploy) => ({
477
+ options: deploys.filter((deploy) => !deploy.expired).map((deploy) => ({
467
478
  value: deploy.version,
468
479
  label: `v${deploy.version} ${formatDateTime(deploy.created_at)} (${deploy.source})`,
469
480
  hint: deploy.version === live ? "live" : void 0
@@ -0,0 +1,2 @@
1
+ import { n as devCommand } from "./dev-qp1VRNM_.mjs";
2
+ export { devCommand };
@@ -1,9 +1,9 @@
1
1
  import { c as projectDialect, f as resolveProject, h as tryReadCanopyJson, l as projectDirArgs, r as siteConfig } from "./site-BcZ0LOvm.mjs";
2
2
  import { r as stampWorkerHeaders, t as WORKER_ATTEST_HEADER } from "./src-DpjA-a59.mjs";
3
- import { a as apiRequest, m as withContext, t as ApiError } from "./api-MIRoGsB6.mjs";
4
- import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
5
- import { r as readMigrationFiles } from "./migrations-CkGa1pmn.mjs";
6
- import { s as parseAppRoleFlag } from "./roles-2dF7LkZB.mjs";
3
+ import { a as apiRequest, m as withContext, t as ApiError } from "./api-fmc8CEMT.mjs";
4
+ import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
5
+ import { r as readMigrationFiles } from "./migrations-ChafLorm.mjs";
6
+ import { s as parseAppRoleFlag } from "./roles-BS8-Gvv-.mjs";
7
7
  import { n as writeDevServerRecord } from "./dev-server-file-Dk9pk4AR.mjs";
8
8
  import { createRequire } from "node:module";
9
9
  import { defineCommand } from "citty";
@@ -326,7 +326,7 @@ async function devRemote(flags, slug) {
326
326
  async function devLocal(flags, slug) {
327
327
  let dump;
328
328
  if (flags.pull) {
329
- const { fetchProjectDump } = await import("./local-DCo1A00D.mjs");
329
+ const { fetchProjectDump } = await import("./local-C1i2uhAf.mjs");
330
330
  console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
331
331
  dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
332
332
  }
@@ -343,7 +343,7 @@ async function devLocal(flags, slug) {
343
343
  }
344
344
  const workerAttest = randomBytes(24).toString("base64url");
345
345
  const devRoles = await resolveDevRoles(slug, flags.asRoles);
346
- const { createSandbox } = await import("./local-DCo1A00D.mjs");
346
+ const { createSandbox } = await import("./local-C1i2uhAf.mjs");
347
347
  const sandbox = await createSandbox({
348
348
  slug,
349
349
  persistDir: join(flags.dir, ".canopy", "local"),
@@ -23,7 +23,7 @@ canopy download --project my-app --out backup.zip
23
23
 
24
24
  ## How it works
25
25
 
26
- The CLI resolves the target version (argument, picker, or live), asks the platform for that deploy's assets as a zip, and writes the archive to `--out`. The zip contains the deployed bundle as uploaded — the static files, and for worker projects the bundled `_canopy/worker.mjs`. It does not include files [canopy deploy](https://docs.canopy.website/cli/deploy) skips (like `canopy.json` itself), nor your project's database or blobs — those are handled by the data tooling, not deploy versions. A project with no deploys yet has nothing to download.
26
+ The CLI resolves the target version (argument, picker, or live), asks the platform for that deploy's assets as a zip, and writes the archive to `--out`. The zip contains the deployed bundle as uploaded — the static files, and for worker projects the bundled `_canopy/worker.mjs`. It does not include files [canopy deploy](https://docs.canopy.website/cli/deploy) skips (like `canopy.json` itself), nor your project's database or blobs — those are handled by the data tooling, not deploy versions. A project with no deploys yet has nothing to download. A version that [version retention](https://docs.canopy.website/cli/versions) expired has no files left, and fails with `version_expired`.
27
27
 
28
28
  ## Examples
29
29
 
@@ -19,6 +19,8 @@ canopy promote --yes # skip the confirmation (CI)
19
19
 
20
20
  - `[version]` — the version to make live, as `8` or `v8`. Defaults to whatever
21
21
  is currently staged; errors when nothing is staged and no version is given.
22
+ A version that [version retention](https://docs.canopy.website/cli/versions) expired fails with
23
+ `version_expired`.
22
24
  - `--project <slug>` — project slug, overriding `canopy.json`.
23
25
  - `--dir <path>` — project directory (defaults to the current directory).
24
26
  - `--yes` — skip the confirmation prompt.
@@ -24,7 +24,9 @@ canopy rollback --project my-app 3
24
24
 
25
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
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.
27
+ 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
+ With [version retention](https://docs.canopy.website/cli/versions) on, old versions expire: their files are removed, and they leave the picker. Rolling back to an expired version fails with `version_expired`. The version before live is always kept, so a one-step rollback always works.
28
30
 
29
31
  Deploy history is also visible in the dashboard, where the same rollback is a button.
30
32
 
@@ -32,6 +32,8 @@ rebuilt, and the version's backend (if any) is redeployed to the staging
32
32
  worker. Omit the version on a terminal to pick from the history. Requires the
33
33
  staging channel to exist; it applies no migrations, so an old version runs
34
34
  against staging's current schema (the same caveat version previews have).
35
+ A version that [version retention](https://docs.canopy.website/cli/versions) expired fails with
36
+ `version_expired`.
35
37
 
36
38
  ### `sync`
37
39
 
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: canopy versions
3
+ description: See how many deploy versions a project keeps, and turn version retention on or off.
4
+ ---
5
+
6
+ `canopy versions` shows how many of a project's deploy versions still have
7
+ their files, and whether **version retention** cleans up the old ones.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ canopy versions [--project <slug>]
13
+ canopy versions retention [--project <slug>]
14
+ canopy versions retention on|off [--yes] [--project <slug>]
15
+ ```
16
+
17
+ The project comes from `canopy.json` in the current directory, or from
18
+ `--project <slug>`. The global `--profile <site>` / `CANOPY_PROFILE` picks the
19
+ site.
20
+
21
+ ### canopy versions
22
+
23
+ Prints whether retention is on, how many versions are kept and how much they
24
+ store, and how many have expired. With retention off it also says how many
25
+ versions turning it on would expire.
26
+
27
+ ### canopy versions retention
28
+
29
+ Without an argument, prints the same summary. `on` turns retention on, `off`
30
+ turns it off.
31
+
32
+ With retention on, Canopy keeps:
33
+
34
+ - the 20 most recent versions
35
+ - the live version and the one before it
36
+ - every version newer than live (the ones a rollback stepped back from)
37
+ - the staging version and the one before it
38
+
39
+ Once a day, Canopy removes the files of every other version. A project that
40
+ never passes 20 versions keeps all of them. Expired versions stay in the
41
+ deploy history, but they can no longer be made live, staged, promoted,
42
+ previewed or downloaded.
43
+
44
+ Turning it on first shows how many versions it would expire, and asks before
45
+ going ahead. Pass `--yes` to skip the question, for example in a script. Without
46
+ a terminal and without `--yes`, the command stops instead of guessing.
47
+ Turning it off never asks: from then on every version keeps its files.
48
+
49
+ Only you can change it, signed in as yourself (`canopy login` or the
50
+ dashboard). Deploy tokens and other project tokens can't.
51
+
52
+ New projects start with retention on. Projects created before it existed start
53
+ with it off.
54
+
55
+ ## The hint on deploy
56
+
57
+ When a project without retention passes 100 versions or 500 MB of deploy
58
+ files, every `canopy deploy` ends with a hint saying how many versions it keeps
59
+ and that `canopy versions retention on` would clean them up. The deploy itself
60
+ is unaffected.
61
+
62
+ ## Examples
63
+
64
+ ```bash
65
+ canopy versions
66
+ ```
67
+
68
+ Prints for example `notes: version retention is off — every version keeps its
69
+ files.` and `432 versions kept (1.3 GB)`.
70
+
71
+ ```bash
72
+ canopy versions retention on --project client-site --profile main
73
+ ```
74
+
75
+ Shows how many old versions of `client-site` would expire and asks before
76
+ turning retention on.
77
+
78
+ See also [canopy rollback](https://docs.canopy.website/cli/rollback), [canopy download](https://docs.canopy.website/cli/download), and
79
+ [Deploys & rollbacks](https://docs.canopy.website/platform/deploys-and-rollbacks).
package/dist/docs/cli.md CHANGED
@@ -49,6 +49,8 @@ has a full page per command.
49
49
  - `canopy download [version]` — download a deploy's assets as a zip, e.g. `v3`
50
50
  (the live version when omitted, or picked from history interactively).
51
51
  `--out <file>` to name it.
52
+ - `canopy versions` — how many deploy versions are kept.
53
+ `canopy versions retention on|off` turns version retention on or off.
52
54
  - `canopy open` — open the deployed project in your browser.
53
55
 
54
56
  ## Data
@@ -142,7 +142,7 @@
142
142
  {
143
143
  "slug": "platform-deploys-and-rollbacks",
144
144
  "title": "Deploys & rollbacks",
145
- "summary": "Every deploy is a numbered version you can preview, download, and make live again — rolling back is instant and loses nothing."
145
+ "summary": "Every deploy is a numbered version you can preview, download, and make live again. Rolling back is instant, and version retention clears out the old ones."
146
146
  },
147
147
  {
148
148
  "slug": "platform-project-data",
@@ -301,6 +301,11 @@
301
301
  "title": "canopy download",
302
302
  "summary": "Download the deployed files of any version of a project as a zip archive."
303
303
  },
304
+ {
305
+ "slug": "cli-versions",
306
+ "title": "canopy versions",
307
+ "summary": "See how many deploy versions a project keeps, and turn version retention on or off."
308
+ },
304
309
  {
305
310
  "slug": "cli-token",
306
311
  "title": "canopy token",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Deploys & rollbacks
3
- description: Every deploy is a numbered version you can preview, download, and make live again — rolling back is instant and loses nothing.
3
+ description: Every deploy is a numbered version you can preview, download, and make live again. Rolling back is instant, and version retention clears out the old ones.
4
4
  ---
5
5
 
6
6
  Every time you publish a project, Canopy records it as a numbered version —
@@ -51,7 +51,38 @@ canopy rollback v3 # make v3 live directly
51
51
  ```
52
52
 
53
53
  You can also "roll forward": after reverting to v3, making v5 live again is
54
- the same one-step operation. Any version in the history can be live.
54
+ the same one-step operation. Any version in the history can be live, as long
55
+ as it hasn't expired (see below).
56
+
57
+ ## Version retention
58
+
59
+ Old versions take up storage, and after a while nobody rolls back to them.
60
+ With **version retention** on, Canopy keeps:
61
+
62
+ - the 20 most recent versions
63
+ - the live version and the one before it
64
+ - every version newer than live (the ones a rollback stepped back from)
65
+ - the staging version and the one before it
66
+
67
+ Once a day, Canopy removes the files of every other version. A project that
68
+ never passes 20 versions keeps all of them, and a one-step rollback always
69
+ works.
70
+
71
+ An expired version stays in the deploy history, marked **expired**, but it
72
+ can no longer be made live, staged, promoted, previewed or downloaded. If you
73
+ ever need it back, rebuild it from your source and deploy.
74
+
75
+ New projects have retention on. Projects from before it existed have it off
76
+ until someone turns it on:
77
+
78
+ - **Dashboard** — the **Version retention** card on the project's Deploys tab.
79
+ Turning it on shows how many versions would expire and asks first.
80
+ - **CLI** — `canopy versions retention on` (see
81
+ [canopy versions](https://docs.canopy.website/cli/versions)).
82
+
83
+ Only project editors signed in as themselves can change it. When a project
84
+ without retention passes 100 versions or 500 MB of deploy files, every deploy
85
+ ends with a hint to turn it on.
55
86
 
56
87
  ## The staging channel
57
88
 
@@ -76,12 +107,13 @@ Preview URLs sit behind the same sign-in as the live site — they're for
76
107
  comparing builds and reviewing history, not for sharing something different
77
108
  from what access settings allow. A preview shows an old frontend against the
78
109
  live data; for a full candidate environment (frontend + backend + own
79
- database) use the staging channel above.
110
+ database) use the staging channel above. The preview URL of an expired version
111
+ shows a page saying it has expired, never another version.
80
112
 
81
113
  ## Downloading a version
82
114
 
83
- You can download the exact files behind any past version as a zip — handy for
84
- comparing builds or restoring something by hand:
115
+ You can download the exact files behind any past version that hasn't expired
116
+ as a zip — handy for comparing builds or restoring something by hand:
85
117
 
86
118
  - **Dashboard** — from the version's entry in the deploy history.
87
119
  - **CLI** — `canopy download`, which lets you pick a version.
@@ -1,8 +1,8 @@
1
- import { t as version } from "./package-BpSdSdZI.mjs";
1
+ import { t as version } from "./package-BpOFa8Qi.mjs";
2
2
  import { r as siteConfig } from "./site-BcZ0LOvm.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
- import { n as agentHeaders } from "./api-MIRoGsB6.mjs";
5
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
4
+ import { n as agentHeaders } from "./api-fmc8CEMT.mjs";
5
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
8
8
  import { homedir } from "node:os";
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/egress.ts
@@ -1,7 +1,7 @@
1
- import { t as version } from "./package-BpSdSdZI.mjs";
1
+ import { t as version } from "./package-BpOFa8Qi.mjs";
2
2
  import { f as resolveProject, g as tryResolveProject, h as tryReadCanopyJson, l as projectDirArgs, r as siteConfig } from "./site-BcZ0LOvm.mjs";
3
- import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-MIRoGsB6.mjs";
4
- import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
3
+ import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-fmc8CEMT.mjs";
4
+ import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { basename, extname, join } from "node:path";
7
7
  import { readFile, writeFile } from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/files.ts
6
6
  /**
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-BpSdSdZI.mjs";
2
+ import { t as version } from "./package-BpOFa8Qi.mjs";
3
3
  import { i as siteHeaderLine, n as setInvocationProfile } from "./site-BcZ0LOvm.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -51,42 +51,43 @@ const main = defineCommand({
51
51
  description: "canopy — create and deploy vibecoded projects"
52
52
  },
53
53
  subCommands: {
54
- login: () => import("./login-BpmefYHv.mjs").then((m) => m.loginCommand),
55
- whoami: () => import("./login-BpmefYHv.mjs").then((m) => m.whoamiCommand),
56
- logout: () => import("./login-BpmefYHv.mjs").then((m) => m.logoutCommand),
57
- create: () => import("./projects-Dcq37hny.mjs").then((m) => m.createCommand),
58
- init: () => import("./projects-Dcq37hny.mjs").then((m) => m.initCommand),
59
- projects: () => import("./projects-Dcq37hny.mjs").then((m) => m.projectsCommand),
60
- delete: () => import("./projects-Dcq37hny.mjs").then((m) => m.deleteCommand),
61
- rename: () => import("./rename-DTg_3_BJ.mjs").then((m) => m.renameCommand),
62
- dev: () => import("./dev-CCMeTwvP.mjs").then((m) => m.devCommand),
63
- deploy: () => import("./deploy-C1mwXvJY.mjs").then((m) => m.deployCommand),
64
- promote: () => import("./deploy-C1mwXvJY.mjs").then((m) => m.promoteCommand),
65
- staging: () => import("./staging-BZJwA_iG.mjs").then((m) => m.stagingCommand),
66
- rollback: () => import("./deploy-C1mwXvJY.mjs").then((m) => m.rollbackCommand),
67
- download: () => import("./deploy-C1mwXvJY.mjs").then((m) => m.downloadCommand),
68
- token: () => import("./token-BEV5lbld.mjs").then((m) => m.tokenCommand),
69
- egress: () => import("./egress-Cy3UBgEM.mjs").then((m) => m.egressCommand),
70
- calls: () => import("./calls-Cnt16FiF.mjs").then((m) => m.callsCommand),
71
- secrets: () => import("./secrets-H1bQRNBr.mjs").then((m) => m.secretsCommand),
72
- roles: () => import("./roles-B5E2tfbN.mjs").then((m) => m.rolesCommand),
73
- members: () => import("./roles-B5E2tfbN.mjs").then((m) => m.membersCommand),
74
- schedule: () => import("./schedule-_u2Ab1WH.mjs").then((m) => m.scheduleCommand),
75
- feedback: () => import("./feedback-DymVKtj0.mjs").then((m) => m.feedbackCommand),
76
- db: () => import("./db-CXeAa-Qy.mjs").then((m) => m.dbCommand),
77
- files: () => import("./files-CYTMMRC0.mjs").then((m) => m.filesCommand),
78
- usage: () => import("./usage-iYp64st3.mjs").then((m) => m.usageCommand),
79
- ai: () => import("./ai-DDVTX_nO.mjs").then((m) => m.aiCommand),
80
- open: () => import("./open-D2WqNBiq.mjs").then((m) => m.openCommand),
81
- browse: () => import("./browse-CVBq2IB4.mjs").then((m) => m.browseCommand),
82
- docs: () => import("./docs-DgMINV-7.mjs").then((m) => m.docsCommand),
83
- skill: () => import("./skill-BHDQdPTC.mjs").then((m) => m.skillCommand),
84
- upgrade: () => import("./upgrade-BYTMPnOF.mjs").then((m) => m.upgradeCommand),
85
- logs: () => import("./logs-CWr7tRhN.mjs").then((m) => m.logsCommand),
86
- mcp: () => import("./mcp-D0TZcRce.mjs").then((m) => m.mcpCommand),
87
- repo: () => import("./repo-C_gmPkLX.mjs").then((m) => m.repoCommand),
88
- template: () => import("./project-template-D-e33lix.mjs").then((m) => m.templateCommand),
89
- audience: () => import("./audience-8U1dwxcU.mjs").then((m) => m.audienceCommand)
54
+ login: () => import("./login-Baso-JE0.mjs").then((m) => m.loginCommand),
55
+ whoami: () => import("./login-Baso-JE0.mjs").then((m) => m.whoamiCommand),
56
+ logout: () => import("./login-Baso-JE0.mjs").then((m) => m.logoutCommand),
57
+ create: () => import("./projects-DOqpkUVT.mjs").then((m) => m.createCommand),
58
+ init: () => import("./projects-DOqpkUVT.mjs").then((m) => m.initCommand),
59
+ projects: () => import("./projects-DOqpkUVT.mjs").then((m) => m.projectsCommand),
60
+ delete: () => import("./projects-DOqpkUVT.mjs").then((m) => m.deleteCommand),
61
+ rename: () => import("./rename-RA_oYbRT.mjs").then((m) => m.renameCommand),
62
+ dev: () => import("./dev-BtacZ4HE.mjs").then((m) => m.devCommand),
63
+ deploy: () => import("./deploy-7tgGJZUK.mjs").then((m) => m.deployCommand),
64
+ promote: () => import("./deploy-7tgGJZUK.mjs").then((m) => m.promoteCommand),
65
+ staging: () => import("./staging-BxG3Cffd.mjs").then((m) => m.stagingCommand),
66
+ rollback: () => import("./deploy-7tgGJZUK.mjs").then((m) => m.rollbackCommand),
67
+ download: () => import("./deploy-7tgGJZUK.mjs").then((m) => m.downloadCommand),
68
+ versions: () => import("./versions-Cgw7sB3h.mjs").then((m) => m.versionsCommand),
69
+ token: () => import("./token-bHdy_IoX.mjs").then((m) => m.tokenCommand),
70
+ egress: () => import("./egress-Bzn2VKDe.mjs").then((m) => m.egressCommand),
71
+ calls: () => import("./calls-DsbRjCcy.mjs").then((m) => m.callsCommand),
72
+ secrets: () => import("./secrets-Bi7BYCla.mjs").then((m) => m.secretsCommand),
73
+ roles: () => import("./roles-tqf4sYDM.mjs").then((m) => m.rolesCommand),
74
+ members: () => import("./roles-tqf4sYDM.mjs").then((m) => m.membersCommand),
75
+ schedule: () => import("./schedule-D8AQ8MVF.mjs").then((m) => m.scheduleCommand),
76
+ feedback: () => import("./feedback-COujxFBV.mjs").then((m) => m.feedbackCommand),
77
+ db: () => import("./db-BU-ni9fj.mjs").then((m) => m.dbCommand),
78
+ files: () => import("./files-CBbAtHIK.mjs").then((m) => m.filesCommand),
79
+ usage: () => import("./usage-DFs2TERV.mjs").then((m) => m.usageCommand),
80
+ ai: () => import("./ai-00f2Mgqh.mjs").then((m) => m.aiCommand),
81
+ open: () => import("./open-Doat726T.mjs").then((m) => m.openCommand),
82
+ browse: () => import("./browse-CxwKuka0.mjs").then((m) => m.browseCommand),
83
+ docs: () => import("./docs-hcHwEc6n.mjs").then((m) => m.docsCommand),
84
+ skill: () => import("./skill-984KseKb.mjs").then((m) => m.skillCommand),
85
+ upgrade: () => import("./upgrade-DhK_PlAN.mjs").then((m) => m.upgradeCommand),
86
+ logs: () => import("./logs-c76jVOhb.mjs").then((m) => m.logsCommand),
87
+ mcp: () => import("./mcp-aWskwkXw.mjs").then((m) => m.mcpCommand),
88
+ repo: () => import("./repo-DayXVvyj.mjs").then((m) => m.repoCommand),
89
+ template: () => import("./project-template--mESzwea.mjs").then((m) => m.templateCommand),
90
+ audience: () => import("./audience-ByM1jUH3.mjs").then((m) => m.audienceCommand)
90
91
  }
91
92
  });
92
93
  const quiet = process.argv[2] === "mcp" && process.argv[3] === "serve" || process.argv[2] === "repo" && process.argv[3] === "credential";
@@ -1,6 +1,6 @@
1
1
  import { c as dbRouter, h as isCreateOnly, l as hasPrivateNames, m as blobRouter, p as STREAMED_BLOB_BYTES, s as realtimeRouter, t as WORKER_ATTEST_HEADER, u as META_COLUMNS } from "./src-DpjA-a59.mjs";
2
- import { r as apiDataRequest } from "./api-MIRoGsB6.mjs";
3
- import { a as rewriteApiPath } from "./dev--vOKyg1k.mjs";
2
+ import { r as apiDataRequest } from "./api-fmc8CEMT.mjs";
3
+ import { a as rewriteApiPath } from "./dev-qp1VRNM_.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, relative, sep } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { C as upsertProfileAuth, E as isProfileId, S as setActiveProfile, T as getBakedProfile, b as listBakedProfiles, r as siteConfig, w as writeConfigFile, x as readConfigFile, y as clearAllProfileTokens } from "./site-BcZ0LOvm.mjs";
2
- import { n as agentHeaders } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, o as spinner$1, r as openBrowser } from "./ui-7cyGNbu5.mjs";
2
+ import { n as agentHeaders } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, o as spinner$1, r as openBrowser } from "./ui-9f_lF2Ak.mjs";
4
4
  import { n as clearRepoTokenCache } from "./repo-credential-CNDRM-tG.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { hostname } from "node:os";
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/logs.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { t as version } from "./package-BpSdSdZI.mjs";
1
+ import { t as version } from "./package-BpOFa8Qi.mjs";
2
2
  import { d as projectUrl, g as tryResolveProject, m as stagingUrl, r as siteConfig } from "./site-BcZ0LOvm.mjs";
3
- import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-MIRoGsB6.mjs";
3
+ import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-fmc8CEMT.mjs";
4
4
  import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
@@ -1,5 +1,5 @@
1
1
  import { h as tryReadCanopyJson } from "./site-BcZ0LOvm.mjs";
2
- import { r as apiDataRequest } from "./api-MIRoGsB6.mjs";
2
+ import { r as apiDataRequest } from "./api-fmc8CEMT.mjs";
3
3
  import { readFileSync, readdirSync } from "node:fs";
4
4
  import { join, resolve } from "node:path";
5
5
  //#region src/migrations.ts
@@ -1,5 +1,5 @@
1
1
  import { d as projectUrl, f as resolveProject, l as projectDirArgs, m as stagingUrl } from "./site-BcZ0LOvm.mjs";
2
- import { i as reportErrors, r as openBrowser } from "./ui-7cyGNbu5.mjs";
2
+ import { i as reportErrors, r as openBrowser } from "./ui-9f_lF2Ak.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/open.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.7.56";
2
+ var version = "0.7.57";
3
3
  //#endregion
4
4
  export { version as t };
@@ -0,0 +1,2 @@
1
+ import { a as templateCommand } from "./project-template-BnX47DpF.mjs";
2
+ export { templateCommand };
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  /** Plain words for the API's template errors. */
@@ -1,9 +1,9 @@
1
1
  import { d as projectUrl, h as tryReadCanopyJson, r as siteConfig } from "./site-BcZ0LOvm.mjs";
2
2
  import { d as HOST_LABEL_SEPARATOR } from "./src-DpjA-a59.mjs";
3
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
4
- import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
5
- import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-DjbT9RRU.mjs";
6
- import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-ZjkxQKwh.mjs";
3
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
4
+ import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
5
+ import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-BnX47DpF.mjs";
6
+ import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-DD3eK1P_.mjs";
7
7
  import { defineCommand } from "citty";
8
8
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
9
9
  import { join, relative, resolve, sep } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { d as projectUrl, f as resolveProject, l as projectDirArgs, p as rewriteCanopyJsonSlug } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/rename.ts
@@ -1,6 +1,6 @@
1
1
  import { a as parseGithubRemote, f as resolveProject, h as tryReadCanopyJson, l as projectDirArgs, o as parseRepositoryArg, r as siteConfig, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
4
4
  import { a as parseCredentialInput, i as helperCommand, o as runCredentialHelper, r as fileTokenCache, t as RepoCredentialError } from "./repo-credential-CNDRM-tG.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { existsSync, realpathSync } from "node:fs";
@@ -0,0 +1,2 @@
1
+ import { o as repoCommand } from "./repo-DD3eK1P_.mjs";
2
+ export { repoCommand };
@@ -1,6 +1,6 @@
1
1
  import { d as projectUrl, f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/roles.ts
@@ -1,2 +1,2 @@
1
- import { c as rolesCommand, o as membersCommand } from "./roles-2dF7LkZB.mjs";
1
+ import { c as rolesCommand, o as membersCommand } from "./roles-BS8-Gvv-.mjs";
2
2
  export { membersCommand, rolesCommand };
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/schedule.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime, s as unwrap } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/secrets.ts
@@ -96,6 +96,7 @@ and never go stale.
96
96
  - Test first on staging: `canopy deploy --staging` → verify → `canopy promote`
97
97
  (own database cloned from live; `canopy staging status | sync | destroy`)
98
98
  - Roll back: `canopy rollback`
99
+ - Old versions: `canopy versions` (retention keeps the 20 newest plus live and staging)
99
100
  - Open the live site: `canopy open`
100
101
  - **Look at a deployed project in your own browser** (Playwright, a browser
101
102
  tool, curl): `canopy browse <slug> --json` prints a one-time sign-in link
@@ -220,6 +221,10 @@ Non-interactive: `canopy create "My App" --template spa`. **When unsure between
220
221
  restores.
221
222
  - **Deploys are public.** `canopy deploy` makes a version live. Confirm before
222
223
  deploying unless the user clearly asked you to.
224
+ - **Version retention deletes old versions.** When a deploy prints a retention
225
+ hint, pass it on to the user and ask before running
226
+ `canopy versions retention on`: expired versions can no longer be rolled
227
+ back to, pinned or downloaded.
223
228
  - Keep the CLI current: `canopy upgrade` (this also refreshes this skill).
224
229
  - **A `canopy` command itself failing?** First rule out user error (re-read
225
230
  `canopy docs troubleshooting` and the command's `--help`). If the platform
@@ -1,5 +1,5 @@
1
- import { t as version } from "./package-BpSdSdZI.mjs";
2
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
1
+ import { t as version } from "./package-BpOFa8Qi.mjs";
2
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
@@ -1,6 +1,6 @@
1
1
  import { d as projectUrl, f as resolveProject, m as stagingUrl, s as parseVersionArg, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/staging.ts
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, l as projectDirArgs, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors, n as formatDateTime } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  const tokenCommand = defineCommand({
6
6
  meta: {
@@ -1,4 +1,4 @@
1
- import { t as ApiError } from "./api-MIRoGsB6.mjs";
1
+ import { t as ApiError } from "./api-fmc8CEMT.mjs";
2
2
  import { spawn } from "node:child_process";
3
3
  import { cancel, isCancel, spinner, text } from "@clack/prompts";
4
4
  //#region src/ui.ts
@@ -1,5 +1,5 @@
1
1
  import { t as PACKAGE_NAME } from "./version-check-CcsA1QjI.mjs";
2
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
2
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { spawn } from "node:child_process";
5
5
  import { fileURLToPath } from "node:url";
@@ -112,7 +112,7 @@ const upgradeCommand = defineCommand({
112
112
  const spec = `${PACKAGE_NAME}@${args.version ?? "latest"}`;
113
113
  const command = pmCommand(pm);
114
114
  const cmd = installArgs(pm, spec);
115
- const { skillInstalled } = await import("./skill-BHDQdPTC.mjs");
115
+ const { skillInstalled } = await import("./skill-984KseKb.mjs");
116
116
  const { homedir } = await import("node:os");
117
117
  const refreshGlobal = skillInstalled(homedir());
118
118
  const refreshRepo = process.cwd() !== homedir() && skillInstalled(process.cwd());
@@ -1,6 +1,6 @@
1
1
  import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
- import { a as apiRequest, m as withContext } from "./api-MIRoGsB6.mjs";
3
- import { i as reportErrors } from "./ui-7cyGNbu5.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/usage.ts
6
6
  /**
@@ -0,0 +1,106 @@
1
+ import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
2
+ import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
3
+ import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-9f_lF2Ak.mjs";
4
+ import { defineCommand } from "citty";
5
+ import * as p from "@clack/prompts";
6
+ //#region src/versions.ts
7
+ /**
8
+ * `canopy versions` — the project's deploy versions (OpenSpec deploy-retention).
9
+ *
10
+ * (none) the retention setting and how many versions are kept / expired
11
+ * retention show or turn version retention on or off
12
+ *
13
+ * With retention on the platform keeps the 20 newest versions, the live and
14
+ * staging versions with the one below each, and everything newer than live;
15
+ * its hourly pass expires the rest (files gone, history kept).
16
+ */
17
+ const formatSize = (bytes) => bytes >= 1024 ** 3 ? `${(bytes / 1024 ** 3).toFixed(1)} GB` : bytes >= 1024 ** 2 ? `${(bytes / 1024 ** 2).toFixed(1)} MB` : `${Math.max(0, Math.round(bytes / 1024))} kB`;
18
+ const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
19
+ /** "on" / "off" as a boolean, or null for anything else (case and spaces forgiven). */
20
+ function parseSwitch(raw) {
21
+ const wanted = raw.trim().toLowerCase();
22
+ return wanted === "on" ? true : wanted === "off" ? false : null;
23
+ }
24
+ /** What `canopy versions` and `canopy versions retention` print. */
25
+ function describeRetention(slug, s) {
26
+ const lines = s.enabled ? [`${slug}: version retention is on — keeps the ${s.keepRecent} most recent versions, the live and staging versions with the one below each, and everything newer than live.`] : [`${slug}: version retention is off — every version keeps its files.`];
27
+ lines.push(` ${plural(s.kept, "version")} kept (${formatSize(s.bytes)})` + (s.expired > 0 ? `, ${s.expired} expired` : ""));
28
+ if (s.enabled && s.wouldExpire.versions > 0) lines.push(` ${plural(s.wouldExpire.versions, "version")} expire within the hour.`);
29
+ if (!s.enabled && s.wouldExpire.versions > 0) lines.push(` Turning it on would expire ${plural(s.wouldExpire.versions, "version")} (${formatSize(s.wouldExpire.bytes)}): \`canopy versions retention on\`.`);
30
+ return lines;
31
+ }
32
+ let subcommandRan = false;
33
+ const retentionCommand = defineCommand({
34
+ meta: {
35
+ name: "retention",
36
+ description: "Show or turn version retention on or off (on | off)"
37
+ },
38
+ args: {
39
+ ...projectFlagArgs,
40
+ state: {
41
+ type: "positional",
42
+ description: "on | off (omit to show)",
43
+ required: false
44
+ },
45
+ yes: {
46
+ type: "boolean",
47
+ default: false,
48
+ description: "Don't ask before turning on retention that expires versions"
49
+ }
50
+ },
51
+ run: reportErrors("versions retention", async ({ args }) => {
52
+ subcommandRan = true;
53
+ const { slug } = resolveProject(args);
54
+ const path = `/projects/${slug}/deploy-retention`;
55
+ const print = (s) => {
56
+ for (const line of describeRetention(slug, s)) console.log(line);
57
+ };
58
+ if (!args.state?.trim()) {
59
+ print(await withContext(apiRequest("GET", path), { action: `read the version retention of "${slug}"` }));
60
+ return;
61
+ }
62
+ const enabled = parseSwitch(args.state);
63
+ if (enabled === null) {
64
+ console.error(`unknown state "${args.state.trim()}" — expected on or off.`);
65
+ process.exit(1);
66
+ }
67
+ const context = { action: `change the version retention of "${slug}"` };
68
+ if (enabled && !args.yes) {
69
+ const preview = await withContext(apiRequest("PUT", path, {
70
+ enabled,
71
+ dryRun: true
72
+ }), context);
73
+ if (!preview.enabled || preview.wouldExpire.versions > 0) {
74
+ const n = preview.wouldExpire.versions;
75
+ if (n > 0) {
76
+ requireTty("pass --yes to turn on retention that expires versions.");
77
+ if (!unwrap(await p.confirm({
78
+ message: `This expires ${plural(n, "version")} of "${slug}" (${formatSize(preview.wouldExpire.bytes)}) within the hour. Expired versions can no longer be rolled back to, pinned or downloaded. Continue?`,
79
+ initialValue: false
80
+ }))) {
81
+ p.cancel("Aborted.");
82
+ return;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ print(await withContext(apiRequest("PUT", path, { enabled }), context));
88
+ })
89
+ });
90
+ const summaryRun = reportErrors("versions", async ({ args }) => {
91
+ const { slug } = resolveProject(args);
92
+ const settings = await withContext(apiRequest("GET", `/projects/${slug}/deploy-retention`), { action: `read the versions of "${slug}"` });
93
+ for (const line of describeRetention(slug, settings)) console.log(line);
94
+ console.log(" History: `canopy rollback` lists versions; the dashboard's Deploys tab too.");
95
+ });
96
+ const versionsCommand = defineCommand({
97
+ meta: {
98
+ name: "versions",
99
+ description: "Deploy versions: how many are kept, and version retention"
100
+ },
101
+ args: { ...projectFlagArgs },
102
+ subCommands: { retention: retentionCommand },
103
+ run: (context) => subcommandRan ? void 0 : summaryRun(context)
104
+ });
105
+ //#endregion
106
+ export { versionsCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.7.56",
3
+ "version": "0.7.57",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"
@@ -1,2 +0,0 @@
1
- import { n as devCommand } from "./dev--vOKyg1k.mjs";
2
- export { devCommand };
@@ -1,2 +0,0 @@
1
- import { a as templateCommand } from "./project-template-DjbT9RRU.mjs";
2
- export { templateCommand };
@@ -1,2 +0,0 @@
1
- import { o as repoCommand } from "./repo-ZjkxQKwh.mjs";
2
- export { repoCommand };