@mediamonks/canopy-cli 0.3.0 → 0.3.1

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.
@@ -60,9 +60,14 @@ This prompts for a name and a starter template, scaffolds a runnable project
60
60
  directory, and registers the project on the platform. To skip the prompts:
61
61
 
62
62
  ```bash
63
- canopy create "My App" --scaffold --template static
63
+ canopy create "My App" --scaffold --template spa
64
64
  ```
65
65
 
66
+ Templates: **`static`** (no-build html/css/js; SDK served untyped from the
67
+ platform) is the default and fine for a trivial page or two. Reach for
68
+ **`spa`** (Vite + React + TypeScript; typed SDK from npm) once you lean on the
69
+ SDK or expect the app to grow — most projects want this.
70
+
66
71
  ## 4. Run it locally
67
72
 
68
73
  ```bash
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-DyEUYkEq.mjs";
2
+ import { t as version } from "./package-B34Xg7L3.mjs";
3
3
  import { i as runRefresh, r as notifyOfUpdate } from "./version-check-CoWgQs2h.mjs";
4
4
  import { defineCommand, runMain } from "citty";
5
5
  //#region src/index.ts
@@ -44,9 +44,9 @@ const main = defineCommand({
44
44
  login: () => import("./login-Dif9Y32q.mjs").then((m) => m.loginCommand),
45
45
  whoami: () => import("./login-Dif9Y32q.mjs").then((m) => m.whoamiCommand),
46
46
  logout: () => import("./login-Dif9Y32q.mjs").then((m) => m.logoutCommand),
47
- create: () => import("./projects-DJT_mJDR.mjs").then((m) => m.createCommand),
48
- projects: () => import("./projects-DJT_mJDR.mjs").then((m) => m.projectsCommand),
49
- delete: () => import("./projects-DJT_mJDR.mjs").then((m) => m.deleteCommand),
47
+ create: () => import("./projects-DOYKtMZC.mjs").then((m) => m.createCommand),
48
+ projects: () => import("./projects-DOYKtMZC.mjs").then((m) => m.projectsCommand),
49
+ delete: () => import("./projects-DOYKtMZC.mjs").then((m) => m.deleteCommand),
50
50
  dev: () => import("./dev-D_GlUULk.mjs").then((m) => m.devCommand),
51
51
  deploy: () => import("./deploy-N88l4Kt3.mjs").then((m) => m.deployCommand),
52
52
  rollback: () => import("./deploy-N88l4Kt3.mjs").then((m) => m.rollbackCommand),
@@ -54,8 +54,8 @@ const main = defineCommand({
54
54
  db: () => import("./db-CtUG4vfG.mjs").then((m) => m.dbCommand),
55
55
  open: () => import("./open-xLiGUz_W.mjs").then((m) => m.openCommand),
56
56
  docs: () => import("./docs-C3aOAx_A.mjs").then((m) => m.docsCommand),
57
- skill: () => import("./skill-nN0e59rO.mjs").then((m) => m.skillCommand),
58
- upgrade: () => import("./upgrade-C5IoUEZg.mjs").then((m) => m.upgradeCommand),
57
+ skill: () => import("./skill-BlRch5eA.mjs").then((m) => m.skillCommand),
58
+ upgrade: () => import("./upgrade-DblPIwpX.mjs").then((m) => m.upgradeCommand),
59
59
  logs: planned("logs", "Tail worker logs", "2")
60
60
  }
61
61
  });
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.3.0";
2
+ var version = "0.3.1";
3
3
  //#endregion
4
4
  export { version as t };
@@ -21,12 +21,12 @@ const TEMPLATES = [
21
21
  {
22
22
  id: "static",
23
23
  label: "Static site",
24
- hint: "plain html/css/js, no build step (default)"
24
+ hint: "plain html/css/js, no build; untyped SDK from the platform — simplest apps only"
25
25
  },
26
26
  {
27
27
  id: "spa",
28
28
  label: "React SPA",
29
- hint: "Vite + React + TypeScript, SDK from npm",
29
+ hint: "Vite + React + TypeScript, typed SDK from npm — best for real SDK use or growth",
30
30
  needsInstall: true
31
31
  },
32
32
  {
@@ -70,6 +70,29 @@ truth and never go stale.
70
70
  - Manage data: `canopy db pull | snapshot | snapshots | restore`
71
71
  - CI credentials: `canopy token create | list | revoke`
72
72
 
73
+ ## Choosing a starter template (`canopy create`)
74
+
75
+ `canopy create` offers three scaffolds. **`static` is the default, but reach
76
+ for it only when the app is genuinely trivial** — a page or two with light SDK
77
+ use. Its SDK is served untyped from the platform (`/_api/v1/sdk.js`): no
78
+ autocomplete, no type-checking, mistakes only show up in the browser.
79
+
80
+ Prefer **`spa`** the moment either is true — which covers most real projects:
81
+
82
+ - **You lean on the SDK** (`db` queries, `blob`, `ai` — anything past a stray
83
+ `auth.user()`). `spa` installs the SDK from npm (`@mediamonks/canopy`), fully
84
+ typed, so the compiler catches mistakes as you write them.
85
+ - **The app will grow.** `spa` is Vite + React + TypeScript, giving components,
86
+ routing, and state a real home; `static` has no build step to organise into.
87
+
88
+ Use **`worker`** (`--template worker`; hidden from the picker) only when you
89
+ need server-side backend code — e.g. calling an external API with a secret the
90
+ browser can't hold. Per-project Workers are a Phase 2 preview (frontend deploys
91
+ now; `worker/` is picked up once the platform supports it).
92
+
93
+ Non-interactive: `canopy create "My App" --template spa`. **When unsure between
94
+ `static` and `spa`, pick `spa`.**
95
+
73
96
  ## Safety rules
74
97
 
75
98
  - **Destructive commands** — `canopy db restore` and `canopy delete` wipe data.
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-DyEUYkEq.mjs";
1
+ import { t as version } from "./package-B34Xg7L3.mjs";
2
2
  import { n as reportErrors } from "./ui-C8VuPzGp.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
@@ -115,7 +115,7 @@ const upgradeCommand = defineCommand({
115
115
  console.log(`Upgrading via ${command}: ${command} ${cmd.join(" ")}`);
116
116
  await run(command, cmd);
117
117
  console.log(`\nDone. Run \`canopy --version\` to confirm.`);
118
- const { skillInstalled } = await import("./skill-nN0e59rO.mjs");
118
+ const { skillInstalled } = await import("./skill-BlRch5eA.mjs");
119
119
  if (skillInstalled(process.cwd())) {
120
120
  console.log("Refreshing the Canopy agent skill in this repo…");
121
121
  await run("canopy", ["skill", "install"]).catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"
@@ -19,8 +19,8 @@
19
19
  "hono": "^4.8.0",
20
20
  "miniflare": "^4.20260714.0",
21
21
  "vite": "npm:@voidzero-dev/vite-plus-core@0.2.5",
22
- "@mediamonks/canopy": "0.0.1",
23
- "@mediamonks/canopy-data-plane": "0.0.1"
22
+ "@mediamonks/canopy-data-plane": "0.0.1",
23
+ "@mediamonks/canopy": "0.0.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^26.1.1",