@mediamonks/canopy-cli 0.7.51 → 0.7.53
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.
- package/dist/{ai-BjnuSjmw.mjs → ai-BlqO9NhM.mjs} +2 -2
- package/dist/{api-DmJrIsE7.mjs → api-D4KUT6Ly.mjs} +9 -8
- package/dist/{audience-BSvOEbco.mjs → audience-Dlrsdthb.mjs} +3 -3
- package/dist/{browse-BPLWhoFI.mjs → browse-CW3CnhK_.mjs} +2 -2
- package/dist/{calls-COIxX32d.mjs → calls-DFtWVJfv.mjs} +3 -3
- package/dist/{db-D5SXZrp5.mjs → db-Dy1csI71.mjs} +15 -18
- package/dist/{deploy-D8OZyhH8.mjs → deploy-DHjZj2Pq.mjs} +13 -19
- package/dist/dev-CVC7elOr.mjs +2 -0
- package/dist/{dev-DjK3Y8jb.mjs → dev-L5slb6ke.mjs} +10 -9
- package/dist/{dev-worker-CDxgu7c1.mjs → dev-worker-DBBN0F6X.mjs} +15 -33
- package/dist/docs/access-tokens.md +145 -0
- package/dist/docs/ci.md +8 -0
- package/dist/docs/cli-dev.md +1 -1
- package/dist/docs/cli-schedule.md +1 -1
- package/dist/docs/cli-token.md +1 -1
- package/dist/docs/developers-architecture.md +16 -5
- package/dist/docs/index.json +10 -0
- package/dist/docs/outside-sign-in.md +1 -1
- package/dist/docs/overview-faq.md +4 -3
- package/dist/docs/platform-client-access.md +1 -1
- package/dist/docs/platform-credentials.md +76 -0
- package/dist/docs/platform-egress.md +4 -4
- package/dist/docs/platform-members-and-access.md +31 -6
- package/dist/docs/platform-project-data.md +4 -0
- package/dist/docs/platform-schedules.md +4 -4
- package/dist/docs/porting-nextjs.md +23 -23
- package/dist/docs/sdk-auth.md +61 -14
- package/dist/docs/sdk-files.md +117 -4
- package/dist/docs/sdk.md +17 -10
- package/dist/docs/staging.md +1 -1
- package/dist/docs/static-serving.md +6 -3
- package/dist/docs/troubleshooting.md +21 -1
- package/dist/{docs-CLgKBi8H.mjs → docs-bnQLqEOn.mjs} +4 -4
- package/dist/{egress-BoGWBHRa.mjs → egress-hKpsJF84.mjs} +4 -10
- package/dist/{feedback-B6tqJ3cd.mjs → feedback-vHJwLyWF.mjs} +4 -4
- package/dist/{files-B7toJRlj.mjs → files-DKtyMjY0.mjs} +3 -3
- package/dist/index.mjs +39 -52
- package/dist/{local-BmUmiOUN.mjs → local-B15wYk6z.mjs} +19 -8
- package/dist/{login-DrMr99-A.mjs → login-cbwynFoT.mjs} +3 -3
- package/dist/{logs-DJWrL6ja.mjs → logs-ByDPHO28.mjs} +3 -3
- package/dist/{mcp-CWtqUFE3.mjs → mcp-BmT4Es_B.mjs} +3 -3
- package/dist/{migrations-BReMlGWP.mjs → migrations-k5pyUUR0.mjs} +3 -3
- package/dist/{open-6ev_6m0p.mjs → open-CYfkeTaw.mjs} +2 -2
- package/dist/{package-4SGn0Cy3.mjs → package-DtU4jB_Z.mjs} +1 -1
- package/dist/{project-template-Bas1UN2O.mjs → project-template-B297eCQ0.mjs} +3 -3
- package/dist/project-template-B6YpesjZ.mjs +2 -0
- package/dist/{projects-BEBYhy6k.mjs → projects-ztlDQi0P.mjs} +28 -28
- package/dist/{rename-PIJmdzHk.mjs → rename-BZ8hvUUt.mjs} +3 -3
- package/dist/{repo-Dry87b9d.mjs → repo-BUIM4d_1.mjs} +4 -10
- package/dist/repo-fDD4TcJ4.mjs +2 -0
- package/dist/{roles-CXY226VM.mjs → roles-DvywfJ8x.mjs} +1 -1
- package/dist/{roles-CUFRTp_R.mjs → roles-Yn8U3cr-.mjs} +3 -3
- package/dist/{schedule-DJsclUxC.mjs → schedule-Cv26MIfS.mjs} +3 -3
- package/dist/{secrets-CV2IwVwU.mjs → secrets-C6tF7BI9.mjs} +3 -3
- package/dist/{site-BL5Ik-yj.mjs → site-C0nf9RXY.mjs} +8 -3
- package/dist/skill/canopy/SKILL.md +9 -1
- package/dist/{skill-CY_4eqOD.mjs → skill-CRTV3ZQ1.mjs} +2 -2
- package/dist/{src-DbqT3K2l.mjs → src-UBUAqzqH.mjs} +419 -41
- package/dist/{staging-B9sjqvfh.mjs → staging-C9mn0EBS.mjs} +6 -14
- package/dist/templates/spa/AGENTS.md +3 -3
- package/dist/templates/spa/README.md +2 -2
- package/dist/templates/spa/package.json +1 -1
- package/dist/templates/static/AGENTS.md +3 -3
- package/dist/templates/static/README.md +2 -2
- package/dist/templates/worker/AGENTS.md +3 -3
- package/dist/templates/worker/README.md +2 -2
- package/dist/templates/worker/package.json +1 -1
- package/dist/{token-BT2_ELX6.mjs → token-DIJtUPrE.mjs} +3 -3
- package/dist/{ui-Ddw4d2Nn.mjs → ui-BPq6-hKS.mjs} +16 -3
- package/dist/{upgrade-Dxzb3e3r.mjs → upgrade-LTEfQn4L.mjs} +2 -2
- package/dist/{usage-VMT75MZ4.mjs → usage-DBhL6SUo.mjs} +3 -3
- package/package.json +3 -3
- package/dist/dev-DkaQjBTp.mjs +0 -2
- package/dist/project-template-Dti_Mmnb.mjs +0 -2
- package/dist/repo-CGTFmIWM.mjs +0 -2
package/dist/docs/sdk.md
CHANGED
|
@@ -40,11 +40,11 @@ const canopy = createCanopy();
|
|
|
40
40
|
// canopy.services
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
| Option | Type | Default | What it does
|
|
44
|
-
| --------- | -------------- | -------------- |
|
|
45
|
-
| `baseUrl` | `string` | `"/_api"` | Base URL of the platform data API. The default is same-origin, so it works untouched in the browser.
|
|
46
|
-
| `token` | `string` | none | A
|
|
47
|
-
| `fetch` | `typeof fetch` | global `fetch` | Override how requests are sent — a backend worker passes its platform service binding here.
|
|
43
|
+
| Option | Type | Default | What it does |
|
|
44
|
+
| --------- | -------------- | -------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `baseUrl` | `string` | `"/_api"` | Base URL of the platform data API. The default is same-origin, so it works untouched in the browser. |
|
|
46
|
+
| `token` | `string` | none | A dev token sent as a bearer on every request — for a local script that reads the project's data while you work. |
|
|
47
|
+
| `fetch` | `typeof fetch` | global `fetch` | Override how requests are sent — a backend worker passes its platform service binding here. |
|
|
48
48
|
|
|
49
49
|
In the browser no config is needed. In a backend worker (the `worker`
|
|
50
50
|
template), the platform is reachable through the `CANOPY` service binding, so
|
|
@@ -58,18 +58,25 @@ app.get("/api/hello", async (c) => {
|
|
|
58
58
|
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`
|
|
64
|
-
API
|
|
61
|
+
A local Node script has no session and no service binding. While you work,
|
|
62
|
+
it can use a dev token: `canopy dev` mints one for you (it lasts 12 hours and
|
|
63
|
+
needs your `canopy login`), or an editor can mint one with
|
|
64
|
+
`POST /control/v1/projects/:slug/dev-token`. Pass it with the platform's API
|
|
65
|
+
host:
|
|
65
66
|
|
|
66
67
|
```ts
|
|
67
68
|
const canopy = createCanopy({
|
|
68
69
|
baseUrl: "https://api.canopy.website",
|
|
69
|
-
token: process.env.
|
|
70
|
+
token: process.env.CANOPY_DEV_TOKEN, // a dev token, valid for 12 hours
|
|
70
71
|
});
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
A dev token isn't for CI or anything that runs unattended. To let a CI job,
|
|
75
|
+
script or app reach your project, give it a
|
|
76
|
+
[project key or personal token](https://docs.canopy.website/guides/access-tokens) and have it call your
|
|
77
|
+
project's own `/api` routes. Access tokens only work there, so don't pass one
|
|
78
|
+
to `createCanopy`.
|
|
79
|
+
|
|
73
80
|
## One instance, shared
|
|
74
81
|
|
|
75
82
|
In the browser, create the client once and import it everywhere. The scaffolds
|
package/dist/docs/staging.md
CHANGED
|
@@ -102,7 +102,7 @@ canopy staging destroy # removes the staging database, files and backend
|
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
Live is untouched, and the next `canopy deploy --staging` recreates the channel
|
|
105
|
-
from a fresh copy. The dashboard's
|
|
105
|
+
from a fresh copy. The dashboard's Deploys tab has the same controls, the
|
|
106
106
|
Overview tab shows what's staged with a Promote button, and a Live/Staging
|
|
107
107
|
toggle above the Data and Files tabs browses either channel's data.
|
|
108
108
|
|
|
@@ -39,13 +39,16 @@ a wrong path, not a broken server.
|
|
|
39
39
|
|
|
40
40
|
## Caching, and why a new deploy shows up immediately
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Three rules, picked automatically:
|
|
43
43
|
|
|
44
44
|
- **HTML always revalidates.** Browsers re-check it on every visit, so the
|
|
45
45
|
moment you deploy, people get the new build — no cache-busting dance, no
|
|
46
46
|
waiting.
|
|
47
|
-
- **
|
|
48
|
-
|
|
47
|
+
- **Hashed assets cache for a year.** A file with a content hash in its name
|
|
48
|
+
(like `index-a1b2c3d4.js`) never changes under that name, so the visitor's
|
|
49
|
+
browser keeps it and doesn't ask again. That is what keeps repeat visits fast.
|
|
50
|
+
- **Other files cache for an hour.** Anything without a hash in its name (a
|
|
51
|
+
favicon, files you copy in from `public/`) is re-checked after an hour.
|
|
49
52
|
|
|
50
53
|
This is the right shape for a normal build tool that puts a content hash in
|
|
51
54
|
asset filenames (Vite does this by default) — the HTML that names them is
|
|
@@ -45,6 +45,26 @@ Run it on your own laptop.
|
|
|
45
45
|
The `CANOPY_DEPLOY_TOKEN` was revoked or is wrong. Create a new one with
|
|
46
46
|
`canopy token create` (or in the dashboard) and update your CI secret.
|
|
47
47
|
|
|
48
|
+
## `token_invalid`, `token_expired`, `token_access_lost` (401)
|
|
49
|
+
|
|
50
|
+
An access token was refused on a project's `/api`. `token_invalid` means it's
|
|
51
|
+
unknown, revoked, or made for another project or channel; `token_expired`
|
|
52
|
+
means it's past its date, or a project key went 90 days without a call;
|
|
53
|
+
`token_access_lost` means its person lost access to the project or hasn't
|
|
54
|
+
signed in to Canopy for 30 days (signing in again fixes it). The full list is
|
|
55
|
+
in [Calling from apps and scripts](https://docs.canopy.website/guides/access-tokens#3-call-the-project).
|
|
56
|
+
|
|
57
|
+
## `token_disabled` (401)
|
|
58
|
+
|
|
59
|
+
The project's owner turned access tokens off under **Settings → Access**.
|
|
60
|
+
Turning them back on revives every token that hasn't expired.
|
|
61
|
+
|
|
62
|
+
## `credential_out_of_scope` (403)
|
|
63
|
+
|
|
64
|
+
A credential reached past what it may do: a deploy token outside its own
|
|
65
|
+
project's deploys, or a dev token on another project. See
|
|
66
|
+
[Which credential do I need?](https://docs.canopy.website/platform/credentials).
|
|
67
|
+
|
|
48
68
|
## `not_supported_on_target` (501)
|
|
49
69
|
|
|
50
70
|
Some features are platform-target-specific: a site whose platform target
|
|
@@ -71,7 +91,7 @@ pick the change up without a deploy):
|
|
|
71
91
|
canopy egress allow api.example.com
|
|
72
92
|
```
|
|
73
93
|
|
|
74
|
-
or use dashboard
|
|
94
|
+
or use dashboard Backend → Outbound hosts. Details and entry rules:
|
|
75
95
|
[Outbound requests](https://docs.canopy.website/platform/egress). Calls made through the SDK /
|
|
76
96
|
`env.CANOPY.fetch` don't count as egress and are unaffected.
|
|
77
97
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
2
|
-
import { r as siteConfig } from "./site-
|
|
1
|
+
import { t as version } from "./package-DtU4jB_Z.mjs";
|
|
2
|
+
import { r as siteConfig } from "./site-C0nf9RXY.mjs";
|
|
3
3
|
import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
|
|
4
|
-
import { n as agentHeaders } from "./api-
|
|
5
|
-
import {
|
|
4
|
+
import { n as agentHeaders } from "./api-D4KUT6Ly.mjs";
|
|
5
|
+
import { i as reportErrors } from "./ui-BPq6-hKS.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
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { i as
|
|
1
|
+
import { f as resolveProject, l as projectDirArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-BPq6-hKS.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/egress.ts
|
|
@@ -136,13 +136,7 @@ const modeCommand = defineCommand({
|
|
|
136
136
|
const access = await apiRequest("GET", `/projects/${slug}/client-password`).catch(() => ({ enabled: false }));
|
|
137
137
|
console.log(openModeRiskSummary(slug, access.enabled));
|
|
138
138
|
console.log("");
|
|
139
|
-
if (!args["accept-risk"])
|
|
140
|
-
requireTty("pass --accept-risk to enable open mode without confirmation.");
|
|
141
|
-
if (unwrap(await p.text({ message: `Type the project slug ("${slug}") to enable open mode.` })).trim() !== slug) {
|
|
142
|
-
p.cancel("Aborted — egress mode unchanged.");
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
139
|
+
if (!args["accept-risk"] && !await confirmTypedSlug(slug, `Type the project slug ("${slug}") to enable open mode.`, "pass --accept-risk to enable open mode without confirmation.", "Aborted — egress mode unchanged.")) return;
|
|
146
140
|
}
|
|
147
141
|
const updated = await withContext(apiRequest("PUT", `/projects/${slug}/egress`, { mode: wanted }), {
|
|
148
142
|
action: `switch ${slug} to ${wanted} egress mode`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
2
|
-
import {
|
|
3
|
-
import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-
|
|
4
|
-
import {
|
|
1
|
+
import { t as version } from "./package-DtU4jB_Z.mjs";
|
|
2
|
+
import { f as resolveProject, g as tryResolveProject, h as tryReadCanopyJson, l as projectDirArgs, r as siteConfig } from "./site-C0nf9RXY.mjs";
|
|
3
|
+
import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-D4KUT6Ly.mjs";
|
|
4
|
+
import { i as reportErrors, n as formatDateTime } from "./ui-BPq6-hKS.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
|
-
import {
|
|
2
|
-
import { a as apiRequest } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { f as resolveProject, u as projectFlagArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { i as reportErrors } from "./ui-BPq6-hKS.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/files.ts
|
|
6
6
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
3
|
-
import { i as siteHeaderLine, n as setInvocationProfile } from "./site-
|
|
2
|
+
import { t as version } from "./package-DtU4jB_Z.mjs";
|
|
3
|
+
import { i as siteHeaderLine, n as setInvocationProfile } from "./site-C0nf9RXY.mjs";
|
|
4
4
|
import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
|
|
5
5
|
import { defineCommand, runMain } from "citty";
|
|
6
6
|
//#region src/index.ts
|
|
@@ -8,20 +8,7 @@ import { defineCommand, runMain } from "citty";
|
|
|
8
8
|
* canopy — the Canopy CLI.
|
|
9
9
|
*
|
|
10
10
|
* Commands are citty subcommands, lazily imported so startup stays snappy.
|
|
11
|
-
*
|
|
12
|
-
* login OneLogin sign-in (browser, PKCE) [phase 1]
|
|
13
|
-
* create scaffold + register a project [phase 1]
|
|
14
|
-
* dev [--local [--pull]] local dev: remote-first, or offline sandbox [phase 1/2]
|
|
15
|
-
* deploy build & deploy assets (+ worker) [phase 1/2]
|
|
16
|
-
* token create|list|revoke deploy tokens for CI [phase 2]
|
|
17
|
-
* db pull|snapshot|restore [phase 2]
|
|
18
|
-
* files access what the app's pages may do with its files
|
|
19
|
-
* logs [--follow] read the project's worker logs [phase 2]
|
|
20
|
-
* usage AI spend + storage for a project [phase 1]
|
|
21
|
-
* ai models the site's AI models and auto/* aliases
|
|
22
|
-
* mcp add|serve a project's tools for AI agents (docs/49)
|
|
23
|
-
* open open the deployed project / dashboard [phase 1]
|
|
24
|
-
* browse one-time sign-in link for an agent's browser
|
|
11
|
+
* The full command list is the `subCommands` map below.
|
|
25
12
|
*/
|
|
26
13
|
if (process.env["CANOPY_UPDATE_REFRESH"] === "1") {
|
|
27
14
|
await runRefresh();
|
|
@@ -64,42 +51,42 @@ const main = defineCommand({
|
|
|
64
51
|
description: "canopy — create and deploy vibecoded projects"
|
|
65
52
|
},
|
|
66
53
|
subCommands: {
|
|
67
|
-
login: () => import("./login-
|
|
68
|
-
whoami: () => import("./login-
|
|
69
|
-
logout: () => import("./login-
|
|
70
|
-
create: () => import("./projects-
|
|
71
|
-
init: () => import("./projects-
|
|
72
|
-
projects: () => import("./projects-
|
|
73
|
-
delete: () => import("./projects-
|
|
74
|
-
rename: () => import("./rename-
|
|
75
|
-
dev: () => import("./dev-
|
|
76
|
-
deploy: () => import("./deploy-
|
|
77
|
-
promote: () => import("./deploy-
|
|
78
|
-
staging: () => import("./staging-
|
|
79
|
-
rollback: () => import("./deploy-
|
|
80
|
-
download: () => import("./deploy-
|
|
81
|
-
token: () => import("./token-
|
|
82
|
-
egress: () => import("./egress-
|
|
83
|
-
calls: () => import("./calls-
|
|
84
|
-
secrets: () => import("./secrets-
|
|
85
|
-
roles: () => import("./roles-
|
|
86
|
-
members: () => import("./roles-
|
|
87
|
-
schedule: () => import("./schedule-
|
|
88
|
-
feedback: () => import("./feedback-
|
|
89
|
-
db: () => import("./db-
|
|
90
|
-
files: () => import("./files-
|
|
91
|
-
usage: () => import("./usage-
|
|
92
|
-
ai: () => import("./ai-
|
|
93
|
-
open: () => import("./open-
|
|
94
|
-
browse: () => import("./browse-
|
|
95
|
-
docs: () => import("./docs-
|
|
96
|
-
skill: () => import("./skill-
|
|
97
|
-
upgrade: () => import("./upgrade-
|
|
98
|
-
logs: () => import("./logs-
|
|
99
|
-
mcp: () => import("./mcp-
|
|
100
|
-
repo: () => import("./repo-
|
|
101
|
-
template: () => import("./project-template-
|
|
102
|
-
audience: () => import("./audience-
|
|
54
|
+
login: () => import("./login-cbwynFoT.mjs").then((m) => m.loginCommand),
|
|
55
|
+
whoami: () => import("./login-cbwynFoT.mjs").then((m) => m.whoamiCommand),
|
|
56
|
+
logout: () => import("./login-cbwynFoT.mjs").then((m) => m.logoutCommand),
|
|
57
|
+
create: () => import("./projects-ztlDQi0P.mjs").then((m) => m.createCommand),
|
|
58
|
+
init: () => import("./projects-ztlDQi0P.mjs").then((m) => m.initCommand),
|
|
59
|
+
projects: () => import("./projects-ztlDQi0P.mjs").then((m) => m.projectsCommand),
|
|
60
|
+
delete: () => import("./projects-ztlDQi0P.mjs").then((m) => m.deleteCommand),
|
|
61
|
+
rename: () => import("./rename-BZ8hvUUt.mjs").then((m) => m.renameCommand),
|
|
62
|
+
dev: () => import("./dev-CVC7elOr.mjs").then((m) => m.devCommand),
|
|
63
|
+
deploy: () => import("./deploy-DHjZj2Pq.mjs").then((m) => m.deployCommand),
|
|
64
|
+
promote: () => import("./deploy-DHjZj2Pq.mjs").then((m) => m.promoteCommand),
|
|
65
|
+
staging: () => import("./staging-C9mn0EBS.mjs").then((m) => m.stagingCommand),
|
|
66
|
+
rollback: () => import("./deploy-DHjZj2Pq.mjs").then((m) => m.rollbackCommand),
|
|
67
|
+
download: () => import("./deploy-DHjZj2Pq.mjs").then((m) => m.downloadCommand),
|
|
68
|
+
token: () => import("./token-DIJtUPrE.mjs").then((m) => m.tokenCommand),
|
|
69
|
+
egress: () => import("./egress-hKpsJF84.mjs").then((m) => m.egressCommand),
|
|
70
|
+
calls: () => import("./calls-DFtWVJfv.mjs").then((m) => m.callsCommand),
|
|
71
|
+
secrets: () => import("./secrets-C6tF7BI9.mjs").then((m) => m.secretsCommand),
|
|
72
|
+
roles: () => import("./roles-DvywfJ8x.mjs").then((m) => m.rolesCommand),
|
|
73
|
+
members: () => import("./roles-DvywfJ8x.mjs").then((m) => m.membersCommand),
|
|
74
|
+
schedule: () => import("./schedule-Cv26MIfS.mjs").then((m) => m.scheduleCommand),
|
|
75
|
+
feedback: () => import("./feedback-vHJwLyWF.mjs").then((m) => m.feedbackCommand),
|
|
76
|
+
db: () => import("./db-Dy1csI71.mjs").then((m) => m.dbCommand),
|
|
77
|
+
files: () => import("./files-DKtyMjY0.mjs").then((m) => m.filesCommand),
|
|
78
|
+
usage: () => import("./usage-DBhL6SUo.mjs").then((m) => m.usageCommand),
|
|
79
|
+
ai: () => import("./ai-BlqO9NhM.mjs").then((m) => m.aiCommand),
|
|
80
|
+
open: () => import("./open-CYfkeTaw.mjs").then((m) => m.openCommand),
|
|
81
|
+
browse: () => import("./browse-CW3CnhK_.mjs").then((m) => m.browseCommand),
|
|
82
|
+
docs: () => import("./docs-bnQLqEOn.mjs").then((m) => m.docsCommand),
|
|
83
|
+
skill: () => import("./skill-CRTV3ZQ1.mjs").then((m) => m.skillCommand),
|
|
84
|
+
upgrade: () => import("./upgrade-LTEfQn4L.mjs").then((m) => m.upgradeCommand),
|
|
85
|
+
logs: () => import("./logs-ByDPHO28.mjs").then((m) => m.logsCommand),
|
|
86
|
+
mcp: () => import("./mcp-BmT4Es_B.mjs").then((m) => m.mcpCommand),
|
|
87
|
+
repo: () => import("./repo-fDD4TcJ4.mjs").then((m) => m.repoCommand),
|
|
88
|
+
template: () => import("./project-template-B6YpesjZ.mjs").then((m) => m.templateCommand),
|
|
89
|
+
audience: () => import("./audience-Dlrsdthb.mjs").then((m) => m.audienceCommand)
|
|
103
90
|
}
|
|
104
91
|
});
|
|
105
92
|
const quiet = process.argv[2] === "mcp" && process.argv[3] === "serve" || process.argv[2] === "repo" && process.argv[3] === "credential";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { r as apiDataRequest } from "./api-
|
|
2
|
-
import {
|
|
3
|
-
import { a as rewriteApiPath } from "./dev-
|
|
1
|
+
import { r as apiDataRequest } from "./api-D4KUT6Ly.mjs";
|
|
2
|
+
import { c as dbRouter, d as STREAMED_BLOB_BYTES, f as blobRouter, l as hasPrivateNames, p as isCreateOnly, s as realtimeRouter, t as WORKER_ATTEST_HEADER, u as META_COLUMNS } from "./src-UBUAqzqH.mjs";
|
|
3
|
+
import { a as rewriteApiPath } from "./dev-L5slb6ke.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join, relative, sep } from "node:path";
|
|
7
7
|
import { Hono } from "hono";
|
|
8
|
+
import { Readable } from "node:stream";
|
|
9
|
+
import { pipeline } from "node:stream/promises";
|
|
8
10
|
//#region ../data-plane/src/db-access.ts
|
|
9
11
|
/** The worker-only marker: `private_` at the start of a collection or table name. */
|
|
10
12
|
const PRIVATE_PREFIX = "private_";
|
|
@@ -653,8 +655,9 @@ function createMemoryBlobBucket() {
|
|
|
653
655
|
const objects = /* @__PURE__ */ new Map();
|
|
654
656
|
return {
|
|
655
657
|
async put(key, body, options) {
|
|
658
|
+
if (isCreateOnly(options?.onlyIf) && objects.has(key)) return null;
|
|
656
659
|
objects.set(key, {
|
|
657
|
-
body,
|
|
660
|
+
body: body instanceof ArrayBuffer ? body : await new Response(body).arrayBuffer(),
|
|
658
661
|
meta: {
|
|
659
662
|
contentType: options?.httpMetadata?.contentType,
|
|
660
663
|
uploaded: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -715,7 +718,14 @@ function createFsBlobBucket(root) {
|
|
|
715
718
|
async put(key, body, options) {
|
|
716
719
|
const path = dataPath(root, key);
|
|
717
720
|
mkdirSync(dirname(path), { recursive: true });
|
|
718
|
-
|
|
721
|
+
const flag = isCreateOnly(options?.onlyIf) ? "wx" : "w";
|
|
722
|
+
try {
|
|
723
|
+
if (body instanceof ArrayBuffer) writeFileSync(path, Buffer.from(body), { flag });
|
|
724
|
+
else await pipeline(Readable.fromWeb(body), createWriteStream(path, { flags: flag }));
|
|
725
|
+
} catch (err) {
|
|
726
|
+
if (err.code === "EEXIST") return null;
|
|
727
|
+
throw err;
|
|
728
|
+
}
|
|
719
729
|
writeFileSync(metaPath(root, key), `${JSON.stringify({
|
|
720
730
|
contentType: options?.httpMetadata?.contentType,
|
|
721
731
|
uploaded: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -796,7 +806,7 @@ function resolveSdkBundle() {
|
|
|
796
806
|
}
|
|
797
807
|
/** Downloads a fresh SQL dump of the project's production database (pull-only sync). */
|
|
798
808
|
async function fetchProjectDump(slug, channel = "live") {
|
|
799
|
-
const { url } = await apiDataRequest("POST", "/db/export", slug, void 0,
|
|
809
|
+
const { url } = await apiDataRequest("POST", "/db/export", slug, void 0, { channel });
|
|
800
810
|
const download = await fetch(url);
|
|
801
811
|
if (!download.ok) throw new Error(`Dump download failed (HTTP ${download.status}).`);
|
|
802
812
|
return download.text();
|
|
@@ -907,7 +917,8 @@ async function createSandbox(options) {
|
|
|
907
917
|
prefix: ""
|
|
908
918
|
}
|
|
909
919
|
},
|
|
910
|
-
signDownload: async () => "local"
|
|
920
|
+
signDownload: async () => "local",
|
|
921
|
+
maxBytes: () => STREAMED_BLOB_BYTES
|
|
911
922
|
}));
|
|
912
923
|
const realtimeHub = memoryRealtimeBroker();
|
|
913
924
|
app.route("/data/v1", realtimeRouter({ context: async (c) => ownProject(c) ?? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { n as agentHeaders } from "./api-
|
|
3
|
-
import {
|
|
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-C0nf9RXY.mjs";
|
|
2
|
+
import { n as agentHeaders } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { i as reportErrors, o as spinner$1, r as openBrowser } from "./ui-BPq6-hKS.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
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { f as resolveProject, u as projectFlagArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { i as reportErrors } from "./ui-BPq6-hKS.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-
|
|
2
|
-
import {
|
|
3
|
-
import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-
|
|
1
|
+
import { t as version } from "./package-DtU4jB_Z.mjs";
|
|
2
|
+
import { d as projectUrl, g as tryResolveProject, m as stagingUrl, r as siteConfig } from "./site-C0nf9RXY.mjs";
|
|
3
|
+
import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-D4KUT6Ly.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
|
-
import {
|
|
2
|
-
import { r as apiDataRequest } from "./api-
|
|
1
|
+
import { h as tryReadCanopyJson } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { r as apiDataRequest } from "./api-D4KUT6Ly.mjs";
|
|
3
3
|
import { readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
//#region src/migrations.ts
|
|
@@ -35,7 +35,7 @@ function migrateProject(slug, migrations, plan = false, channel = "live") {
|
|
|
35
35
|
return apiDataRequest("POST", "/db/migrate", slug, {
|
|
36
36
|
migrations,
|
|
37
37
|
plan
|
|
38
|
-
},
|
|
38
|
+
}, { channel });
|
|
39
39
|
}
|
|
40
40
|
/** One-line-per-fact summary shared by `db migrate` and the deploy step. */
|
|
41
41
|
function describeMigrateResult(result) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { d as projectUrl, f as resolveProject, l as projectDirArgs, m as stagingUrl } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { i as reportErrors, r as openBrowser } from "./ui-BPq6-hKS.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
//#region src/open.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { f as resolveProject, l as projectDirArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-BPq6-hKS.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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as
|
|
4
|
-
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-
|
|
5
|
-
import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-
|
|
1
|
+
import { d as projectUrl, h as tryReadCanopyJson, r as siteConfig } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-BPq6-hKS.mjs";
|
|
4
|
+
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-B297eCQ0.mjs";
|
|
5
|
+
import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-BUIM4d_1.mjs";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { join, relative, resolve, sep } from "node:path";
|
|
@@ -15,10 +15,19 @@ import { fileURLToPath } from "node:url";
|
|
|
15
15
|
* any code — copied into the CLI's dist/templates at build time
|
|
16
16
|
* (scripts/sync-templates.mjs) so the published tarball is self-contained.
|
|
17
17
|
*
|
|
18
|
-
* Scaffolding copies a template recursively, substitutes {{name}}/{{slug}}
|
|
19
|
-
* and renames _gitignore → .gitignore (npm strips .gitignore files from
|
|
18
|
+
* Scaffolding copies a template recursively, substitutes {{name}}/{{slug}}
|
|
19
|
+
* and the site's {{url}}/{{dashboardUrl}}, and renames _gitignore → .gitignore (npm strips .gitignore files from
|
|
20
20
|
* published tarballs, so templates can't ship one under its real name).
|
|
21
21
|
*/
|
|
22
|
+
/** Template vars for a project on the resolved profile's site. */
|
|
23
|
+
function siteTemplateVars(name, slug) {
|
|
24
|
+
return {
|
|
25
|
+
name,
|
|
26
|
+
slug,
|
|
27
|
+
url: projectUrl(slug),
|
|
28
|
+
dashboardUrl: projectUrl("dashboard")
|
|
29
|
+
};
|
|
30
|
+
}
|
|
22
31
|
const TEMPLATES = [
|
|
23
32
|
{
|
|
24
33
|
id: "static",
|
|
@@ -55,7 +64,7 @@ function scaffoldTemplate(templateId, targetDir, vars) {
|
|
|
55
64
|
mkdirSync(dest, { recursive: true });
|
|
56
65
|
continue;
|
|
57
66
|
}
|
|
58
|
-
writeFileSync(dest, readFileSync(join(entry.parentPath, entry.name), "utf8").replaceAll("{{name}}", vars.name).replaceAll("{{slug}}", vars.slug));
|
|
67
|
+
writeFileSync(dest, readFileSync(join(entry.parentPath, entry.name), "utf8").replaceAll("{{name}}", vars.name).replaceAll("{{slug}}", vars.slug).replaceAll("{{url}}", vars.url).replaceAll("{{dashboardUrl}}", vars.dashboardUrl));
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
//#endregion
|
|
@@ -76,6 +85,13 @@ function writeCanopyJson(dir, fields) {
|
|
|
76
85
|
};
|
|
77
86
|
writeFileSync(join(dir, "canopy.json"), `${JSON.stringify(next, null, 2)}\n`);
|
|
78
87
|
}
|
|
88
|
+
/** The `canopy projects` table, one line per project, each column padded to its widest cell. */
|
|
89
|
+
function projectRows(projects, isAdmin) {
|
|
90
|
+
const width = Math.max(...projects.map((project) => project.slug.length));
|
|
91
|
+
const roles = projects.map((project) => project.role ?? (isAdmin ? "admin" : `owner: ${project.owner_email}`));
|
|
92
|
+
const roleWidth = Math.max(...roles.map((role) => role.length));
|
|
93
|
+
return projects.map((project, i) => `${project.slug.padEnd(width)} ${project.status.padEnd(7)} ${roles[i].padEnd(roleWidth)} ${projectUrl(project.slug)} ${project.name}`);
|
|
94
|
+
}
|
|
79
95
|
function slugify(input) {
|
|
80
96
|
let slug = input.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-").replaceAll(/(^-+|-+$)/g, "").slice(0, 40);
|
|
81
97
|
while (slug.includes("-dot-")) slug = slug.replaceAll("-dot-", "-");
|
|
@@ -184,10 +200,7 @@ const createCommand = defineCommand({
|
|
|
184
200
|
}
|
|
185
201
|
spin.stop(`Created ${project.name} — ${projectUrl(project.slug)}`);
|
|
186
202
|
if (scaffold) {
|
|
187
|
-
scaffoldTemplate(template.id, targetDir,
|
|
188
|
-
name,
|
|
189
|
-
slug
|
|
190
|
-
});
|
|
203
|
+
scaffoldTemplate(template.id, targetDir, siteTemplateVars(name, slug));
|
|
191
204
|
writeCanopyJson(targetDir, {
|
|
192
205
|
...tryReadCanopyJson(targetDir),
|
|
193
206
|
slug
|
|
@@ -321,10 +334,7 @@ const initCommand = defineCommand({
|
|
|
321
334
|
}));
|
|
322
335
|
template = TEMPLATES.find((t) => t.id === id) ?? template;
|
|
323
336
|
}
|
|
324
|
-
scaffoldTemplate(template.id, targetDir,
|
|
325
|
-
name: project.name,
|
|
326
|
-
slug
|
|
327
|
-
});
|
|
337
|
+
scaffoldTemplate(template.id, targetDir, siteTemplateVars(project.name, slug));
|
|
328
338
|
writeCanopyJson(targetDir, {
|
|
329
339
|
...tryReadCanopyJson(targetDir),
|
|
330
340
|
slug
|
|
@@ -390,11 +400,7 @@ const projectsCommand = defineCommand({
|
|
|
390
400
|
console.log(projects.length === 0 ? "No projects yet — run `canopy create`." : `No projects of your own yet — run \`canopy create\`, or --all to list all ${projects.length}.`);
|
|
391
401
|
return;
|
|
392
402
|
}
|
|
393
|
-
const
|
|
394
|
-
for (const project of mine) {
|
|
395
|
-
const role = project.role ?? (isAdmin ? "admin" : `owner: ${project.owner_email}`);
|
|
396
|
-
console.log(`${project.slug.padEnd(width)} ${project.status.padEnd(7)} ${role.padEnd(6)} ${projectUrl(project.slug)} ${project.name}`);
|
|
397
|
-
}
|
|
403
|
+
for (const row of projectRows(mine, isAdmin)) console.log(row);
|
|
398
404
|
})
|
|
399
405
|
});
|
|
400
406
|
const deleteCommand = defineCommand({
|
|
@@ -430,13 +436,7 @@ const deleteCommand = defineCommand({
|
|
|
430
436
|
}))
|
|
431
437
|
}));
|
|
432
438
|
}
|
|
433
|
-
if (!args.yes)
|
|
434
|
-
requireTty("pass --yes to delete without confirmation.");
|
|
435
|
-
if (unwrap(await p.text({ message: `Delete "${slug}" permanently? This tears down its database and files. Type the slug to confirm.` })).trim() !== slug) {
|
|
436
|
-
p.cancel("Aborted.");
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
439
|
+
if (!args.yes && !await confirmTypedSlug(slug, `Delete "${slug}" permanently? This tears down its database and files. Type the slug to confirm.`, "pass --yes to delete without confirmation.")) return;
|
|
440
440
|
await apiRequest("DELETE", `/projects/${slug}`);
|
|
441
441
|
p.log.success(`Deleted ${slug}.`);
|
|
442
442
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { d as projectUrl, f as resolveProject, l as projectDirArgs, p as rewriteCanopyJsonSlug } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-BPq6-hKS.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
|
-
import { a as parseGithubRemote,
|
|
2
|
-
import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-
|
|
3
|
-
import { i as
|
|
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-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime, s as unwrap, t as confirmTypedSlug } from "./ui-BPq6-hKS.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";
|
|
@@ -317,13 +317,7 @@ const deleteCommand = defineCommand({
|
|
|
317
317
|
},
|
|
318
318
|
run: reportErrors("repo delete", async ({ args }) => {
|
|
319
319
|
const { slug } = resolveProject(args);
|
|
320
|
-
if (!args.yes)
|
|
321
|
-
requireTty("pass --yes to delete without confirmation.");
|
|
322
|
-
if (unwrap(await p.text({ message: `Delete ${slug}'s git repository and all its history? Type the slug to confirm.` })).trim() !== slug) {
|
|
323
|
-
p.cancel("Aborted.");
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
320
|
+
if (!args.yes && !await confirmTypedSlug(slug, `Delete ${slug}'s git repository and all its history? Type the slug to confirm.`, "pass --yes to delete without confirmation.")) return;
|
|
327
321
|
await withContext(apiRequest("DELETE", `/projects/${slug}/repo`), {
|
|
328
322
|
action: `delete ${slug}'s git repository`,
|
|
329
323
|
fixes: REPO_FIXES
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as membersCommand, o as rolesCommand } from "./roles-
|
|
1
|
+
import { i as membersCommand, o as rolesCommand } from "./roles-Yn8U3cr-.mjs";
|
|
2
2
|
export { membersCommand, rolesCommand };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import {
|
|
1
|
+
import { f as resolveProject, l as projectDirArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-BPq6-hKS.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/roles.ts
|