@mediamonks/canopy-cli 0.7.48 → 0.7.50
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-CWPQiUft.mjs → ai-BjnuSjmw.mjs} +1 -1
- package/dist/{audience-B68YZBGy.mjs → audience-BSvOEbco.mjs} +1 -1
- package/dist/{calls-DhkVJ32C.mjs → calls-COIxX32d.mjs} +1 -1
- package/dist/{db-DpCMc0uz.mjs → db-D5SXZrp5.mjs} +4 -4
- package/dist/{deploy-BnRQusjJ.mjs → deploy-D8OZyhH8.mjs} +5 -5
- package/dist/{dev-BE48xClT.mjs → dev-BQ77vmCk.mjs} +6 -5
- package/dist/dev-Z3bI5hgh.mjs +2 -0
- package/dist/docs/calling-projects.md +8 -4
- package/dist/docs/cli-calls.md +42 -0
- package/dist/docs/cli.md +6 -0
- package/dist/docs/index.json +17 -2
- package/dist/docs/platform-members-and-access.md +3 -1
- package/dist/docs/roles.md +4 -0
- package/dist/docs/sdk-members.md +79 -0
- package/dist/docs/sdk-projects.md +76 -0
- package/dist/docs/sdk.md +4 -3
- package/dist/{docs-BZquSJej.mjs → docs-Cd6VzYts.mjs} +2 -2
- package/dist/{egress-BM4EpLBh.mjs → egress-BoGWBHRa.mjs} +1 -1
- package/dist/{feedback-CAM-DJH9.mjs → feedback-BkrdL92o.mjs} +2 -2
- package/dist/index.mjs +35 -35
- package/dist/{local-DRcoiNcy.mjs → local-C6ggy2PQ.mjs} +1 -1
- package/dist/{login-2MW9sGJO.mjs → login-DrMr99-A.mjs} +3 -3
- package/dist/{logs-dZMPTJLu.mjs → logs-DJWrL6ja.mjs} +1 -1
- package/dist/{mcp-q9wWZ2yk.mjs → mcp-Bt9Z9kdf.mjs} +1 -1
- package/dist/{open-DcQSdfx5.mjs → open-6ev_6m0p.mjs} +1 -1
- package/dist/{package-Df9caKjj.mjs → package-Sir3152_.mjs} +1 -1
- package/dist/project-template-ChFb7A_H.mjs +2 -0
- package/dist/{project-template-BPW_Dgxj.mjs → project-template-DHWdVc6E.mjs} +1 -1
- package/dist/{projects-CnU3194_.mjs → projects-Z8ufQIBc.mjs} +5 -5
- package/dist/{rename-BWvERJgA.mjs → rename-PIJmdzHk.mjs} +1 -1
- package/dist/repo-CGTFmIWM.mjs +2 -0
- package/dist/{repo-6a7gRQaf.mjs → repo-Dry87b9d.mjs} +1 -1
- package/dist/{roles-S2D9Id0W.mjs → roles-CUFRTp_R.mjs} +1 -1
- package/dist/{roles-CrYf_8wk.mjs → roles-CXY226VM.mjs} +1 -1
- package/dist/{schedule-DvHSSzfR.mjs → schedule-DJsclUxC.mjs} +1 -1
- package/dist/{secrets-BIn2RPoe.mjs → secrets-CV2IwVwU.mjs} +1 -1
- package/dist/{skill-BtL5ANQO.mjs → skill-Bxc5E-wu.mjs} +2 -2
- package/dist/{staging-Dn8kH9cK.mjs → staging-B9sjqvfh.mjs} +3 -3
- package/dist/{token-DMCj88A-.mjs → token-BT2_ELX6.mjs} +1 -1
- package/dist/{ui-26ETk1n8.mjs → ui-Ddw4d2Nn.mjs} +21 -2
- package/dist/{upgrade-DrEk3nqk.mjs → upgrade-DOpeMSWD.mjs} +2 -2
- package/dist/{usage-Bpz5B1N1.mjs → usage-VMT75MZ4.mjs} +1 -1
- package/package.json +3 -3
- package/dist/dev-z2KvqkF9.mjs +0 -2
- package/dist/project-template-Dw11151p.mjs +0 -2
- package/dist/repo-C7AXDtFZ.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors } from "./ui-
|
|
3
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/audience.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
3
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/calls.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext, r as apiDataRequest } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as spinner$1, i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-BReMlGWP.mjs";
|
|
5
5
|
import { defineCommand } from "citty";
|
|
6
6
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
@@ -46,7 +46,7 @@ const pullCommand = defineCommand({
|
|
|
46
46
|
run: reportErrors("db pull", async ({ args }) => {
|
|
47
47
|
const { slug } = resolveProject(args);
|
|
48
48
|
const out = args.out ?? `${slug}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replaceAll(/[:T]/g, "-")}.sql`;
|
|
49
|
-
const spin =
|
|
49
|
+
const spin = spinner$1();
|
|
50
50
|
spin.start(`Exporting ${slug}${channelNote(args)}…`);
|
|
51
51
|
try {
|
|
52
52
|
const { url } = await apiDataRequest("POST", "/db/export", slug, void 0, void 0, channelOf(args));
|
|
@@ -72,7 +72,7 @@ const snapshotCommand = defineCommand({
|
|
|
72
72
|
},
|
|
73
73
|
run: reportErrors("db snapshot", async ({ args }) => {
|
|
74
74
|
const { slug } = resolveProject(args);
|
|
75
|
-
const spin =
|
|
75
|
+
const spin = spinner$1();
|
|
76
76
|
spin.start(`Snapshotting ${slug}${channelNote(args)}…`);
|
|
77
77
|
let created;
|
|
78
78
|
try {
|
|
@@ -327,7 +327,7 @@ const migrateCommand = defineCommand({
|
|
|
327
327
|
for (const line of describeMigrateResult(result)) console.log(line);
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
const spin =
|
|
330
|
+
const spin = spinner$1();
|
|
331
331
|
spin.start(`Migrating ${slug}${channelNote(args)}…`);
|
|
332
332
|
let result;
|
|
333
333
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, l as projectFlagArgs, m as tryReadCanopyJson, p as stagingUrl, r as siteConfig, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
2
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-DmJrIsE7.mjs";
|
|
3
|
-
import { a as unwrap, r as reportErrors, t as formatDateTime } from "./ui-
|
|
3
|
+
import { a as spinner$1, o as unwrap, r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-BReMlGWP.mjs";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
@@ -274,7 +274,7 @@ const deployCommand = defineCommand({
|
|
|
274
274
|
let workerBytes = null;
|
|
275
275
|
if (config.worker && !args.worker) p.log.warn(`Skipping the backend (${config.worker}) — deploying the frontend only.`);
|
|
276
276
|
if (config.worker && args.worker) {
|
|
277
|
-
const spinWorker =
|
|
277
|
+
const spinWorker = spinner$1();
|
|
278
278
|
spinWorker.start(`Bundling worker ${config.worker}`);
|
|
279
279
|
try {
|
|
280
280
|
workerBytes = await bundleWorker(dir, config.worker);
|
|
@@ -286,7 +286,7 @@ const deployCommand = defineCommand({
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
const source = process.env["GITHUB_ACTIONS"] ? { "x-canopy-source": "github-action" } : {};
|
|
289
|
-
const spin =
|
|
289
|
+
const spin = spinner$1();
|
|
290
290
|
const workerNote = workerBytes ? " + worker" : "";
|
|
291
291
|
const channelNote = channel === "staging" ? " [staging]" : "";
|
|
292
292
|
spin.start(`Deploying ${files.length} files${workerNote} (${(total / 1024).toFixed(0)} kB) → ${slug}${channelNote}`);
|
|
@@ -374,7 +374,7 @@ const promoteCommand = defineCommand({
|
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
const spin =
|
|
377
|
+
const spin = spinner$1();
|
|
378
378
|
spin.start(`Promoting ${slug} v${target} → live`);
|
|
379
379
|
let result;
|
|
380
380
|
try {
|
|
@@ -548,7 +548,7 @@ const downloadCommand = defineCommand({
|
|
|
548
548
|
else throw new Error("No live version to download — pass a version, e.g. v1.");
|
|
549
549
|
}
|
|
550
550
|
const out = args.out ?? `${slug}-v${target}.zip`;
|
|
551
|
-
const spin =
|
|
551
|
+
const spin = spinner$1();
|
|
552
552
|
spin.start(`Downloading ${slug} v${target}…`);
|
|
553
553
|
try {
|
|
554
554
|
const zip = await apiDownload(`/projects/${slug}/deploys/${target}/download`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, m as tryReadCanopyJson, r as siteConfig, s as projectDialect } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext, t as ApiError } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
3
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { r as readMigrationFiles } from "./migrations-BReMlGWP.mjs";
|
|
5
5
|
import { i as stampWorkerHeaders, n as WORKER_ATTEST_HEADER } from "./src-DzU89gZN.mjs";
|
|
6
|
-
import { a as parseAppRoleFlag } from "./roles-
|
|
6
|
+
import { a as parseAppRoleFlag } from "./roles-CUFRTp_R.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";
|
|
@@ -325,7 +325,7 @@ async function devRemote(flags, slug) {
|
|
|
325
325
|
async function devLocal(flags, slug) {
|
|
326
326
|
let dump;
|
|
327
327
|
if (flags.pull) {
|
|
328
|
-
const { fetchProjectDump } = await import("./local-
|
|
328
|
+
const { fetchProjectDump } = await import("./local-C6ggy2PQ.mjs");
|
|
329
329
|
console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
|
|
330
330
|
dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
|
|
331
331
|
}
|
|
@@ -342,7 +342,7 @@ async function devLocal(flags, slug) {
|
|
|
342
342
|
}
|
|
343
343
|
const workerAttest = randomBytes(24).toString("base64url");
|
|
344
344
|
const devRoles = await resolveDevRoles(slug, flags.asRoles);
|
|
345
|
-
const { createSandbox } = await import("./local-
|
|
345
|
+
const { createSandbox } = await import("./local-C6ggy2PQ.mjs");
|
|
346
346
|
const sandbox = await createSandbox({
|
|
347
347
|
slug,
|
|
348
348
|
persistDir: join(flags.dir, ".canopy", "local"),
|
|
@@ -386,7 +386,8 @@ async function devLocal(flags, slug) {
|
|
|
386
386
|
"/_api/data/v1/ai": remoteEntry,
|
|
387
387
|
"/_api/data/v1/services": remoteEntry,
|
|
388
388
|
"/_api/data/v1/google": remoteEntry,
|
|
389
|
-
"/_api/data/v1/calls": remoteEntry
|
|
389
|
+
"/_api/data/v1/calls": remoteEntry,
|
|
390
|
+
"/_api/data/v1/members": remoteEntry
|
|
390
391
|
},
|
|
391
392
|
"/_api": {
|
|
392
393
|
target: `http://127.0.0.1:${apiAddress.port}`,
|
|
@@ -21,7 +21,8 @@ canopy calls allow campaign-site
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Or use **Incoming calls** on the project's Backend tab. Only the owner can
|
|
24
|
-
change this list; managers and editors can see it.
|
|
24
|
+
change this list; managers and editors can see it. All the options are in
|
|
25
|
+
[`canopy calls`](https://docs.canopy.website/cli/calls).
|
|
25
26
|
|
|
26
27
|
One allow covers both channels of each project and every path under `/api`.
|
|
27
28
|
It also covers every visitor of the calling project and its scheduled runs,
|
|
@@ -43,8 +44,8 @@ if (!res.ok) throw new Error(`asset-library said ${res.status}`);
|
|
|
43
44
|
const assets = await res.json();
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
`projects.fetch` works like `fetch`: pass a method, headers
|
|
47
|
-
usual. It calls the live channel unless you pass `{ channel: "staging" }`.
|
|
47
|
+
[`projects.fetch`](https://docs.canopy.website/sdk/projects) works like `fetch`: pass a method, headers
|
|
48
|
+
and a body as usual. It calls the live channel unless you pass `{ channel: "staging" }`.
|
|
48
49
|
The other project needs no entry on your [outbound hosts](https://docs.canopy.website/platform/egress).
|
|
49
50
|
|
|
50
51
|
You get the other project's response back as it is. When Canopy refuses the
|
|
@@ -84,7 +85,8 @@ app.get("/api/assets", (c) => {
|
|
|
84
85
|
[app roles](https://docs.canopy.website/guides/roles) on _your_ project. They don't need to be a member
|
|
85
86
|
of it. It is `null` when nobody was behind the call, such as a scheduled run.
|
|
86
87
|
- `env.USER` is `null` on these calls, and your backend's own `canopy.db` and
|
|
87
|
-
other calls act as your project.
|
|
88
|
+
other calls act as your project. Every field is listed in
|
|
89
|
+
[Projects](https://docs.canopy.website/sdk/projects#on-the-other-side).
|
|
88
90
|
|
|
89
91
|
If your project calls another one while handling a call, that next project
|
|
90
92
|
sees your project, acting for nobody.
|
|
@@ -95,5 +97,7 @@ sees your project, acting for nobody.
|
|
|
95
97
|
canopy calls remove campaign-site
|
|
96
98
|
```
|
|
97
99
|
|
|
100
|
+
Or remove it on the Backend tab. See [`canopy calls`](https://docs.canopy.website/cli/calls).
|
|
101
|
+
|
|
98
102
|
New calls are refused within a few seconds. A call that had already started
|
|
99
103
|
may still finish within five minutes.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: canopy calls
|
|
3
|
+
description: Manage which other projects may call this project's backend.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`canopy calls` manages which other projects may call this project's `/api`
|
|
7
|
+
from their backend with [`canopy.projects.fetch`](https://docs.canopy.website/sdk/projects). See
|
|
8
|
+
[Calling another project](https://docs.canopy.website/guides/calling-projects) for the whole flow.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
canopy calls list
|
|
14
|
+
canopy calls allow campaign-site
|
|
15
|
+
canopy calls remove campaign-site
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Arguments & flags
|
|
19
|
+
|
|
20
|
+
All subcommands resolve the project the usual way — `canopy.json` in the
|
|
21
|
+
target directory, or `--project <slug>` to override — and honor the global
|
|
22
|
+
`--profile <site>` / `CANOPY_PROFILE`.
|
|
23
|
+
|
|
24
|
+
- `list` — the projects allowed to call this one, with their owner and who
|
|
25
|
+
allowed them when.
|
|
26
|
+
- `allow <project>` — let that project's backend call this one, by its slug.
|
|
27
|
+
Only the project owner (or a platform admin) can do this.
|
|
28
|
+
- `remove <project>` — stop it. New calls are refused within a few seconds; a
|
|
29
|
+
call already under way may finish within five minutes. Owner only, like
|
|
30
|
+
`allow`.
|
|
31
|
+
|
|
32
|
+
Owners, managers and editors can run `list`.
|
|
33
|
+
|
|
34
|
+
## How it works
|
|
35
|
+
|
|
36
|
+
One allow covers both channels of each project and every path under `/api`.
|
|
37
|
+
It also covers every visitor of the calling project and its scheduled runs,
|
|
38
|
+
so this project's backend decides what each caller may do: it sees them as
|
|
39
|
+
`env.CALLER.kind === "project"`, with the visitor behind the call in
|
|
40
|
+
`actingFor`. A project can always call itself without being allowed.
|
|
41
|
+
|
|
42
|
+
The same list is on the project's Backend tab, under **Incoming calls**.
|
package/dist/docs/cli.md
CHANGED
|
@@ -82,6 +82,12 @@ See `canopy docs ci` for wiring push-to-main deploys.
|
|
|
82
82
|
- `canopy egress allow <host>` — allow a hostname (or `"*.sub.wildcard"`).
|
|
83
83
|
- `canopy egress remove <host>` — remove an entry.
|
|
84
84
|
|
|
85
|
+
## Calls from other projects
|
|
86
|
+
|
|
87
|
+
- `canopy calls list` — projects allowed to call this project's backend.
|
|
88
|
+
- `canopy calls allow <project>` — let a project call it (owner only).
|
|
89
|
+
- `canopy calls remove <project>` — stop it (owner only).
|
|
90
|
+
|
|
85
91
|
## Maintenance
|
|
86
92
|
|
|
87
93
|
- `canopy upgrade` — update the CLI to the latest version. `--version <v>` pins a
|
package/dist/docs/index.json
CHANGED
|
@@ -306,6 +306,11 @@
|
|
|
306
306
|
"title": "canopy egress",
|
|
307
307
|
"summary": "Manage which outbound hosts the project's backend worker may fetch."
|
|
308
308
|
},
|
|
309
|
+
{
|
|
310
|
+
"slug": "cli-calls",
|
|
311
|
+
"title": "canopy calls",
|
|
312
|
+
"summary": "Manage which other projects may call this project's backend."
|
|
313
|
+
},
|
|
309
314
|
{
|
|
310
315
|
"slug": "cli-secrets",
|
|
311
316
|
"title": "canopy secrets",
|
|
@@ -386,12 +391,12 @@
|
|
|
386
391
|
{
|
|
387
392
|
"key": "sdk",
|
|
388
393
|
"title": "SDK reference",
|
|
389
|
-
"description": "The typed client your project code uses — auth, data, files, AI, email, notify, realtime, services.",
|
|
394
|
+
"description": "The typed client your project code uses — auth, data, files, AI, email, notify, realtime, project calls, members, services.",
|
|
390
395
|
"topics": [
|
|
391
396
|
{
|
|
392
397
|
"slug": "sdk",
|
|
393
398
|
"title": "Using the SDK",
|
|
394
|
-
"summary": "One typed client for auth, data, files, AI, email, notify, realtime, and services — no keys, no connection strings, the platform authenticates for you."
|
|
399
|
+
"summary": "One typed client for auth, data, files, AI, email, notify, realtime, project calls, members, and services — no keys, no connection strings, the platform authenticates for you."
|
|
395
400
|
},
|
|
396
401
|
{
|
|
397
402
|
"slug": "sdk-auth",
|
|
@@ -428,6 +433,16 @@
|
|
|
428
433
|
"title": "Realtime",
|
|
429
434
|
"summary": "Live updates between the people using your app — subscribe to a topic, publish to it, no backend needed."
|
|
430
435
|
},
|
|
436
|
+
{
|
|
437
|
+
"slug": "sdk-projects",
|
|
438
|
+
"title": "Projects",
|
|
439
|
+
"summary": "Call another project's backend API from your backend, with no keys to manage."
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"slug": "sdk-members",
|
|
443
|
+
"title": "Members",
|
|
444
|
+
"summary": "List who is on your project, with their app roles, from your backend — including people who haven't opened the app yet."
|
|
445
|
+
},
|
|
431
446
|
{
|
|
432
447
|
"slug": "sdk-mcp",
|
|
433
448
|
"title": "Agent tools (MCP)",
|
|
@@ -81,7 +81,9 @@ App roles cover that without a table of emails in your code.
|
|
|
81
81
|
Under **Settings → Access → App roles**, create the roles your app needs. Each
|
|
82
82
|
has a name and a slug, like `approver`. Then give members their roles from the
|
|
83
83
|
Members card. Your app reads them as `roles` on the signed-in user, from
|
|
84
|
-
[`auth.user()`](https://docs.canopy.website/sdk/auth) or `env.CALLER` in a backend worker.
|
|
84
|
+
[`auth.user()`](https://docs.canopy.website/sdk/auth) or `env.CALLER` in a backend worker. To list
|
|
85
|
+
everyone on the project with their roles, your backend calls
|
|
86
|
+
[`members.list()`](https://docs.canopy.website/sdk/members).
|
|
85
87
|
|
|
86
88
|
One role is always the **default**. Everyone who can open the app has it,
|
|
87
89
|
client-password visitors included, so you don't have to hand it out. The first
|
package/dist/docs/roles.md
CHANGED
|
@@ -58,6 +58,10 @@ user.roles; // ["user", "approver"]
|
|
|
58
58
|
In a backend worker, `env.CALLER.roles` holds the same list without a round
|
|
59
59
|
trip, and so does `env.USER.roles` for a signed-in Monk.
|
|
60
60
|
|
|
61
|
+
To list everyone who has a role, including people who haven't opened the app
|
|
62
|
+
yet, call [`canopy.members.list({ appRole })`](https://docs.canopy.website/sdk/members) from your
|
|
63
|
+
backend.
|
|
64
|
+
|
|
61
65
|
## Check roles where it counts
|
|
62
66
|
|
|
63
67
|
A check that only runs in the browser hides buttons. It doesn't protect
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Members
|
|
3
|
+
description: List who is on your project, with their app roles, from your backend — including people who haven't opened the app yet.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`canopy.members` gives your backend the project's roster: the owner, every
|
|
7
|
+
member, and everyone invited who hasn't signed in yet, each with their
|
|
8
|
+
[app roles](https://docs.canopy.website/guides/roles). Use it for a "People" page, a picker of
|
|
9
|
+
approvers, or a weekly email to everyone with the `qa` role.
|
|
10
|
+
|
|
11
|
+
Backend code only. A page that calls it straight from the browser is
|
|
12
|
+
refused, even for the owner. Your backend route decides what of the list to
|
|
13
|
+
send to whoever is asking.
|
|
14
|
+
|
|
15
|
+
## members.list(options?)
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createCanopy } from "@mediamonks/canopy";
|
|
19
|
+
|
|
20
|
+
const canopy = createCanopy({ fetch: env.CANOPY.fetch.bind(env.CANOPY) });
|
|
21
|
+
|
|
22
|
+
// Everyone on the project.
|
|
23
|
+
const people = await canopy.members.list();
|
|
24
|
+
|
|
25
|
+
// Only the people with the `qa` role, invites included.
|
|
26
|
+
const qa = await canopy.members.list({ appRole: "qa" });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Options:**
|
|
30
|
+
|
|
31
|
+
- `appRole` — optional. Only people whose roles include this slug. A slug
|
|
32
|
+
your project doesn't have gives an empty list.
|
|
33
|
+
|
|
34
|
+
**Returns** an array of `ProjectMember`, the owner first, then members by
|
|
35
|
+
name, then invites:
|
|
36
|
+
|
|
37
|
+
| Field | Meaning |
|
|
38
|
+
| ---------- | --------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `id` | Their Canopy user id, the same as `env.CALLER.id` on their requests. `null` for someone still invited. |
|
|
40
|
+
| `email` | The email they sign in with. |
|
|
41
|
+
| `name` | Their name. Empty for someone still invited. |
|
|
42
|
+
| `appRoles` | Their app roles: the project's default role first, then the ones given to them. The same as `env.CALLER.roles`. |
|
|
43
|
+
| `pending` | `true` for someone invited who hasn't signed in to Canopy yet. |
|
|
44
|
+
|
|
45
|
+
The list has no Canopy roles (owner, manager, editor, viewer). Those decide
|
|
46
|
+
who manages the project in Canopy; app roles are the ones your app uses.
|
|
47
|
+
|
|
48
|
+
## Link your own data to people
|
|
49
|
+
|
|
50
|
+
Store the `id`, not the email, next to your own data (a region, a team, a
|
|
51
|
+
desk). It's what `env.CALLER.id` gives you when that person makes a
|
|
52
|
+
request, so you can find their row without a lookup.
|
|
53
|
+
|
|
54
|
+
Someone still invited has no id yet. Key their row by email until they sign
|
|
55
|
+
in; from then on their entry has an id, and you can switch that one row
|
|
56
|
+
over.
|
|
57
|
+
|
|
58
|
+
## A list to show, not a permission check
|
|
59
|
+
|
|
60
|
+
The list can be a few seconds behind: a role change, a new invite or a
|
|
61
|
+
removed member shows up within a few seconds. To decide what the person
|
|
62
|
+
making a request may do, check `env.CALLER.roles`, as in
|
|
63
|
+
[Check roles where it counts](https://docs.canopy.website/guides/roles#check-roles-where-it-counts).
|
|
64
|
+
|
|
65
|
+
## Errors
|
|
66
|
+
|
|
67
|
+
| Status | Error | What happened |
|
|
68
|
+
| ------ | -------------- | ---------------------------------------------------------------------------------------- |
|
|
69
|
+
| 403 | `backend_only` | The call came from a browser page, or from a credential that isn't your backend. |
|
|
70
|
+
| 403 | `members_only` | Your backend forwarded a request from someone who isn't on a collaborators-only project. |
|
|
71
|
+
|
|
72
|
+
## Good to know
|
|
73
|
+
|
|
74
|
+
- The live and staging channels list the same people: the roster belongs to
|
|
75
|
+
the project, not to a channel.
|
|
76
|
+
- In [`canopy dev`](https://docs.canopy.website/cli/dev) the list is your deployed project's real
|
|
77
|
+
roster. Nothing you do locally changes it.
|
|
78
|
+
- To change the roster, use the dashboard or
|
|
79
|
+
[`canopy members`](https://docs.canopy.website/cli/members).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Projects
|
|
3
|
+
description: Call another project's backend API from your backend, with no keys to manage.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`canopy.projects` lets your project's backend call another project's `/api`.
|
|
7
|
+
The other project's owner allows yours first; after that, Canopy proves who
|
|
8
|
+
is calling on every call, so your code holds no key or token. The walkthrough
|
|
9
|
+
is in [Calling another project](https://docs.canopy.website/guides/calling-projects).
|
|
10
|
+
|
|
11
|
+
Backend code only: a call is made as your project, so it doesn't work from a
|
|
12
|
+
browser.
|
|
13
|
+
|
|
14
|
+
## projects.fetch(project, path, init?)
|
|
15
|
+
|
|
16
|
+
Works like `fetch`, aimed at another project:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createCanopy } from "@mediamonks/canopy";
|
|
20
|
+
|
|
21
|
+
const canopy = createCanopy({ fetch: env.CANOPY.fetch.bind(env.CANOPY) });
|
|
22
|
+
|
|
23
|
+
const res = await canopy.projects.fetch("asset-library", "/api/assets?tag=summer");
|
|
24
|
+
if (!res.ok) throw new Error(`asset-library said ${res.status}`);
|
|
25
|
+
const assets = await res.json();
|
|
26
|
+
|
|
27
|
+
// Any method, headers and body; the staging channel when you need it.
|
|
28
|
+
await canopy.projects.fetch("asset-library", "/api/assets", {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: { "content-type": "application/json" },
|
|
31
|
+
body: JSON.stringify({ name: "hero.jpg" }),
|
|
32
|
+
channel: "staging",
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Arguments:**
|
|
37
|
+
|
|
38
|
+
- `project` — the other project's slug.
|
|
39
|
+
- `path` — a path under its `/api`, with a query string if you need one.
|
|
40
|
+
Anything else is refused before it is sent.
|
|
41
|
+
- `init` — optional. The usual fetch options (`method`, `headers`, `body`, …)
|
|
42
|
+
plus `channel`: `"live"` (the default) or `"staging"`.
|
|
43
|
+
|
|
44
|
+
**Returns** a `Response`: the other project's answer as it is. It doesn't
|
|
45
|
+
throw on an error status, so check `res.ok` like any fetch.
|
|
46
|
+
|
|
47
|
+
When Canopy refuses the call, the response is a JSON error instead:
|
|
48
|
+
|
|
49
|
+
| Status | Error | What happened |
|
|
50
|
+
| ------ | --------------------- | --------------------------------------------------------------- |
|
|
51
|
+
| 400 | `invalid_call_path` | The path isn't under `/api`. |
|
|
52
|
+
| 403 | `call_not_granted` | That project hasn't allowed yours, or there is no such project. |
|
|
53
|
+
| 404 | `no_backend` | That project has no backend on that channel. |
|
|
54
|
+
| 508 | `call_depth_exceeded` | Projects called each other more than four times in a row. |
|
|
55
|
+
| 503 | `calls_unavailable` | This site can't make project calls. |
|
|
56
|
+
|
|
57
|
+
Calls don't go through your [outbound hosts](https://docs.canopy.website/platform/egress), so the other
|
|
58
|
+
project needs no entry there. In [`canopy dev`](https://docs.canopy.website/cli/dev) they go to the
|
|
59
|
+
deployed project, as your project.
|
|
60
|
+
|
|
61
|
+
## On the other side
|
|
62
|
+
|
|
63
|
+
The project you call sees the call in its backend as `env.CALLER`, typed
|
|
64
|
+
`CanopyProjectCaller`:
|
|
65
|
+
|
|
66
|
+
| Field | Meaning |
|
|
67
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| `kind` | `"project"`. |
|
|
69
|
+
| `id` | The calling project's id. It stays the same if the project is renamed. |
|
|
70
|
+
| `project` | The calling project's current slug. |
|
|
71
|
+
| `channel` | Which of its channels called: `"live"` or `"staging"`. |
|
|
72
|
+
| `name` | The calling project's name. |
|
|
73
|
+
| `actingFor` | The visitor whose request caused the call, with their [app roles](https://docs.canopy.website/guides/roles) on the called project; `null` for a scheduled run. |
|
|
74
|
+
|
|
75
|
+
`env.USER` is `null` on these calls. See [Auth](https://docs.canopy.website/sdk/auth) for the other
|
|
76
|
+
kinds of caller.
|
package/dist/docs/sdk.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Using the SDK
|
|
3
|
-
description: One typed client for auth, data, files, AI, email, notify, realtime, and services — no keys, no connection strings, the platform authenticates for you.
|
|
3
|
+
description: One typed client for auth, data, files, AI, email, notify, realtime, project calls, members, and services — no keys, no connection strings, the platform authenticates for you.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
`@mediamonks/canopy` is a thin, typed client over the platform's project API.
|
|
7
7
|
One `createCanopy()` call gives you its modules — `auth`, `db`, `blob`, `ai`,
|
|
8
|
-
`email`, `notify`, `realtime`, `google`, `slack`, and `services` — and that is the entire surface. There are no API keys,
|
|
8
|
+
`email`, `notify`, `realtime`, `projects`, `members`, `google`, `slack`, and `services` — and that is the entire surface. There are no API keys,
|
|
9
9
|
connection strings, or environment variables to manage: every call rides the
|
|
10
10
|
session the platform already established before your code ran.
|
|
11
11
|
|
|
@@ -36,7 +36,8 @@ import { createCanopy } from "@mediamonks/canopy";
|
|
|
36
36
|
|
|
37
37
|
const canopy = createCanopy();
|
|
38
38
|
// canopy.auth, canopy.db, canopy.blob, canopy.ai, canopy.email, canopy.notify,
|
|
39
|
-
// canopy.realtime, canopy.
|
|
39
|
+
// canopy.realtime, canopy.projects, canopy.members, canopy.google, canopy.slack,
|
|
40
|
+
// canopy.services
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
| Option | Type | Default | What it does |
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-Sir3152_.mjs";
|
|
2
2
|
import { r as siteConfig } from "./site-BL5Ik-yj.mjs";
|
|
3
3
|
import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
|
|
4
4
|
import { n as agentHeaders } from "./api-DmJrIsE7.mjs";
|
|
5
|
-
import { r as reportErrors } from "./ui-
|
|
5
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.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 { c as projectDirArgs, d as resolveProject } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as requireTty, o as unwrap, r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.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-
|
|
1
|
+
import { t as version } from "./package-Sir3152_.mjs";
|
|
2
2
|
import { c as projectDirArgs, d as resolveProject, h as tryResolveProject, m as tryReadCanopyJson, r as siteConfig } from "./site-BL5Ik-yj.mjs";
|
|
3
3
|
import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-DmJrIsE7.mjs";
|
|
4
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
4
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.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";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-Sir3152_.mjs";
|
|
3
3
|
import { i as siteHeaderLine, n as setInvocationProfile } from "./site-BL5Ik-yj.mjs";
|
|
4
4
|
import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
|
|
5
5
|
import { defineCommand, runMain } from "citty";
|
|
@@ -63,41 +63,41 @@ const main = defineCommand({
|
|
|
63
63
|
description: "canopy — create and deploy vibecoded projects"
|
|
64
64
|
},
|
|
65
65
|
subCommands: {
|
|
66
|
-
login: () => import("./login-
|
|
67
|
-
whoami: () => import("./login-
|
|
68
|
-
logout: () => import("./login-
|
|
69
|
-
create: () => import("./projects-
|
|
70
|
-
init: () => import("./projects-
|
|
71
|
-
projects: () => import("./projects-
|
|
72
|
-
delete: () => import("./projects-
|
|
73
|
-
rename: () => import("./rename-
|
|
74
|
-
dev: () => import("./dev-
|
|
75
|
-
deploy: () => import("./deploy-
|
|
76
|
-
promote: () => import("./deploy-
|
|
77
|
-
staging: () => import("./staging-
|
|
78
|
-
rollback: () => import("./deploy-
|
|
79
|
-
download: () => import("./deploy-
|
|
80
|
-
token: () => import("./token-
|
|
81
|
-
egress: () => import("./egress-
|
|
82
|
-
calls: () => import("./calls-
|
|
83
|
-
secrets: () => import("./secrets-
|
|
84
|
-
roles: () => import("./roles-
|
|
85
|
-
members: () => import("./roles-
|
|
86
|
-
schedule: () => import("./schedule-
|
|
87
|
-
feedback: () => import("./feedback-
|
|
88
|
-
db: () => import("./db-
|
|
89
|
-
usage: () => import("./usage-
|
|
90
|
-
ai: () => import("./ai-
|
|
91
|
-
open: () => import("./open-
|
|
66
|
+
login: () => import("./login-DrMr99-A.mjs").then((m) => m.loginCommand),
|
|
67
|
+
whoami: () => import("./login-DrMr99-A.mjs").then((m) => m.whoamiCommand),
|
|
68
|
+
logout: () => import("./login-DrMr99-A.mjs").then((m) => m.logoutCommand),
|
|
69
|
+
create: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.createCommand),
|
|
70
|
+
init: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.initCommand),
|
|
71
|
+
projects: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.projectsCommand),
|
|
72
|
+
delete: () => import("./projects-Z8ufQIBc.mjs").then((m) => m.deleteCommand),
|
|
73
|
+
rename: () => import("./rename-PIJmdzHk.mjs").then((m) => m.renameCommand),
|
|
74
|
+
dev: () => import("./dev-Z3bI5hgh.mjs").then((m) => m.devCommand),
|
|
75
|
+
deploy: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.deployCommand),
|
|
76
|
+
promote: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.promoteCommand),
|
|
77
|
+
staging: () => import("./staging-B9sjqvfh.mjs").then((m) => m.stagingCommand),
|
|
78
|
+
rollback: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.rollbackCommand),
|
|
79
|
+
download: () => import("./deploy-D8OZyhH8.mjs").then((m) => m.downloadCommand),
|
|
80
|
+
token: () => import("./token-BT2_ELX6.mjs").then((m) => m.tokenCommand),
|
|
81
|
+
egress: () => import("./egress-BoGWBHRa.mjs").then((m) => m.egressCommand),
|
|
82
|
+
calls: () => import("./calls-COIxX32d.mjs").then((m) => m.callsCommand),
|
|
83
|
+
secrets: () => import("./secrets-CV2IwVwU.mjs").then((m) => m.secretsCommand),
|
|
84
|
+
roles: () => import("./roles-CXY226VM.mjs").then((m) => m.rolesCommand),
|
|
85
|
+
members: () => import("./roles-CXY226VM.mjs").then((m) => m.membersCommand),
|
|
86
|
+
schedule: () => import("./schedule-DJsclUxC.mjs").then((m) => m.scheduleCommand),
|
|
87
|
+
feedback: () => import("./feedback-BkrdL92o.mjs").then((m) => m.feedbackCommand),
|
|
88
|
+
db: () => import("./db-D5SXZrp5.mjs").then((m) => m.dbCommand),
|
|
89
|
+
usage: () => import("./usage-VMT75MZ4.mjs").then((m) => m.usageCommand),
|
|
90
|
+
ai: () => import("./ai-BjnuSjmw.mjs").then((m) => m.aiCommand),
|
|
91
|
+
open: () => import("./open-6ev_6m0p.mjs").then((m) => m.openCommand),
|
|
92
92
|
browse: () => import("./browse-BPLWhoFI.mjs").then((m) => m.browseCommand),
|
|
93
|
-
docs: () => import("./docs-
|
|
94
|
-
skill: () => import("./skill-
|
|
95
|
-
upgrade: () => import("./upgrade-
|
|
96
|
-
logs: () => import("./logs-
|
|
97
|
-
mcp: () => import("./mcp-
|
|
98
|
-
repo: () => import("./repo-
|
|
99
|
-
template: () => import("./project-template-
|
|
100
|
-
audience: () => import("./audience-
|
|
93
|
+
docs: () => import("./docs-Cd6VzYts.mjs").then((m) => m.docsCommand),
|
|
94
|
+
skill: () => import("./skill-Bxc5E-wu.mjs").then((m) => m.skillCommand),
|
|
95
|
+
upgrade: () => import("./upgrade-DOpeMSWD.mjs").then((m) => m.upgradeCommand),
|
|
96
|
+
logs: () => import("./logs-DJWrL6ja.mjs").then((m) => m.logsCommand),
|
|
97
|
+
mcp: () => import("./mcp-Bt9Z9kdf.mjs").then((m) => m.mcpCommand),
|
|
98
|
+
repo: () => import("./repo-CGTFmIWM.mjs").then((m) => m.repoCommand),
|
|
99
|
+
template: () => import("./project-template-ChFb7A_H.mjs").then((m) => m.templateCommand),
|
|
100
|
+
audience: () => import("./audience-BSvOEbco.mjs").then((m) => m.audienceCommand)
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
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 { r as apiDataRequest } from "./api-DmJrIsE7.mjs";
|
|
2
2
|
import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-DzU89gZN.mjs";
|
|
3
|
-
import { a as rewriteApiPath } from "./dev-
|
|
3
|
+
import { a as rewriteApiPath } from "./dev-BQ77vmCk.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { 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 isProfileId, S as getBakedProfile, _ as listBakedProfiles, b as upsertProfileAuth, g as clearAllProfileTokens, r as siteConfig, v as readConfigFile, x as writeConfigFile, y as setActiveProfile } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { n as agentHeaders } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { n as openBrowser, r as reportErrors } from "./ui-
|
|
3
|
+
import { a as spinner$1, n as openBrowser, r as reportErrors } from "./ui-Ddw4d2Nn.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";
|
|
@@ -251,7 +251,7 @@ async function login(json, profileFlag) {
|
|
|
251
251
|
}).toString();
|
|
252
252
|
const authorizeHref = authorizeUrl.toString();
|
|
253
253
|
openBrowser(authorizeHref);
|
|
254
|
-
const spin = json ? void 0 :
|
|
254
|
+
const spin = json ? void 0 : spinner$1();
|
|
255
255
|
if (json) console.log(JSON.stringify({
|
|
256
256
|
status: "waiting",
|
|
257
257
|
url: authorizeHref
|
|
@@ -284,7 +284,7 @@ async function login(json, profileFlag) {
|
|
|
284
284
|
if (!tokenRes.ok) throw new Error(`Token exchange failed: ${tokenRes.status} ${await tokenRes.text()}`);
|
|
285
285
|
const { id_token: idToken } = await tokenRes.json();
|
|
286
286
|
if (!idToken) throw new Error("OneLogin returned no id_token.");
|
|
287
|
-
const mintSpin = json ? void 0 :
|
|
287
|
+
const mintSpin = json ? void 0 : spinner$1();
|
|
288
288
|
mintSpin?.start("Minting CLI tokens for each site…");
|
|
289
289
|
const results = [];
|
|
290
290
|
for (const prof of listBakedProfiles()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors } from "./ui-
|
|
3
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/logs.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-Sir3152_.mjs";
|
|
2
2
|
import { h as tryResolveProject, p as stagingUrl, r as siteConfig, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
3
3
|
import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-DmJrIsE7.mjs";
|
|
4
4
|
import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, p as stagingUrl, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
2
|
-
import { n as openBrowser, r as reportErrors } from "./ui-
|
|
2
|
+
import { n as openBrowser, r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
//#region src/open.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.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
1
|
import { m as tryReadCanopyJson, r as siteConfig, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
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-
|
|
3
|
+
import { a as spinner$1, i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
4
|
+
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-DHWdVc6E.mjs";
|
|
5
|
+
import { a as offerRepoOnCreate, i as githubOrigin, n as cloneProjectRepo } from "./repo-Dry87b9d.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";
|
|
@@ -170,7 +170,7 @@ const createCommand = defineCommand({
|
|
|
170
170
|
}
|
|
171
171
|
const targetDir = resolve(slug);
|
|
172
172
|
if (scaffold && existsSync(targetDir)) throw new Error(`Directory ./${slug} already exists — remove it, or use --no-scaffold to only register.`);
|
|
173
|
-
const spin =
|
|
173
|
+
const spin = spinner$1();
|
|
174
174
|
spin.start(`Registering ${slug}…`);
|
|
175
175
|
let project;
|
|
176
176
|
try {
|
|
@@ -228,7 +228,7 @@ async function createFromTemplate(name, slug, from) {
|
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
const spin =
|
|
231
|
+
const spin = spinner$1();
|
|
232
232
|
spin.start(`Creating ${slug} from ${from}…`);
|
|
233
233
|
let project;
|
|
234
234
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, f as rewriteCanopyJsonSlug, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.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, c as projectDirArgs, d as resolveProject, l as projectFlagArgs, m as tryReadCanopyJson, o as parseRepositoryArg, r as siteConfig } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, f as noticeRenamesOnly, m as withContext, n as agentHeaders, u as followRename } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as requireTty, o as unwrap, r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as requireTty, o as unwrap, r as reportErrors } from "./ui-Ddw4d2Nn.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 { i as membersCommand, o as rolesCommand } from "./roles-
|
|
1
|
+
import { i as membersCommand, o as rolesCommand } from "./roles-CUFRTp_R.mjs";
|
|
2
2
|
export { membersCommand, rolesCommand };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
3
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/schedule.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { o as unwrap, r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/secrets.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
2
|
-
import { r as reportErrors } from "./ui-
|
|
1
|
+
import { t as version } from "./package-Sir3152_.mjs";
|
|
2
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.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 resolveProject, l as projectFlagArgs, p as stagingUrl, u as projectUrl } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as spinner$1, i as requireTty, o as unwrap, r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/staging.ts
|
|
@@ -100,7 +100,7 @@ const stagingCommand = defineCommand({
|
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
const spin =
|
|
103
|
+
const spin = spinner$1();
|
|
104
104
|
spin.start(`Cloning live → staging for ${slug}…`);
|
|
105
105
|
try {
|
|
106
106
|
await withContext(apiRequest("POST", `/projects/${slug}/staging/sync`), {
|
|
@@ -136,7 +136,7 @@ const stagingCommand = defineCommand({
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const spin =
|
|
139
|
+
const spin = spinner$1();
|
|
140
140
|
spin.start(`Destroying staging for ${slug}…`);
|
|
141
141
|
try {
|
|
142
142
|
await withContext(apiRequest("DELETE", `/projects/${slug}/staging`), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as projectDirArgs, d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
3
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
const tokenCommand = defineCommand({
|
|
6
6
|
meta: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ApiError } from "./api-DmJrIsE7.mjs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { cancel, isCancel } from "@clack/prompts";
|
|
3
|
+
import { cancel, isCancel, spinner } from "@clack/prompts";
|
|
4
4
|
//#region src/ui.ts
|
|
5
5
|
/**
|
|
6
6
|
* Shared terminal UX plumbing: clack prompt unwrapping and uniform
|
|
@@ -14,6 +14,25 @@ function unwrap(result) {
|
|
|
14
14
|
}
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A progress spinner that degrades to plain lines off a TTY. clack's spinner
|
|
19
|
+
* animates regardless: every frame repaints one line with cursor escapes and
|
|
20
|
+
* the final message lands on that same line, so an agent shell or a log file
|
|
21
|
+
* shows a bare "│" and never the result (dashboard-32: deploys that went live
|
|
22
|
+
* looked silent and got re-run).
|
|
23
|
+
*/
|
|
24
|
+
function spinner$1(output = process.stdout) {
|
|
25
|
+
if (output.isTTY) return spinner({ output });
|
|
26
|
+
const line = (msg) => {
|
|
27
|
+
if (msg) output.write(`${msg}\n`);
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
start: line,
|
|
31
|
+
message: line,
|
|
32
|
+
stop: line,
|
|
33
|
+
error: line
|
|
34
|
+
};
|
|
35
|
+
}
|
|
17
36
|
/** Terminal width to wrap error copy to, bounded so it stays readable. */
|
|
18
37
|
const TEXT_WIDTH = Math.min(process.stdout.columns || 80, 88);
|
|
19
38
|
/** Render ` Label text…`, wrapping and aligning continuation lines under the text. */
|
|
@@ -120,4 +139,4 @@ function openBrowser(url) {
|
|
|
120
139
|
}).on("error", () => {}).unref();
|
|
121
140
|
}
|
|
122
141
|
//#endregion
|
|
123
|
-
export {
|
|
142
|
+
export { spinner$1 as a, requireTty as i, openBrowser as n, unwrap as o, reportErrors as r, formatDateTime as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as PACKAGE_NAME } from "./version-check-CcsA1QjI.mjs";
|
|
2
|
-
import { r as reportErrors } from "./ui-
|
|
2
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.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-
|
|
115
|
+
const { skillInstalled } = await import("./skill-Bxc5E-wu.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 { d as resolveProject, l as projectFlagArgs } from "./site-BL5Ik-yj.mjs";
|
|
2
2
|
import { a as apiRequest, m as withContext } from "./api-DmJrIsE7.mjs";
|
|
3
|
-
import { r as reportErrors } from "./ui-
|
|
3
|
+
import { r as reportErrors } from "./ui-Ddw4d2Nn.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/usage.ts
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediamonks/canopy-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.50",
|
|
4
4
|
"description": "Canopy CLI — create, develop and deploy Canopy projects.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"canopy": "./dist/index.mjs"
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"esbuild": "^0.28.1",
|
|
23
23
|
"hono": "^4.8.0",
|
|
24
24
|
"vite-server": "npm:vite@^7",
|
|
25
|
-
"@mediamonks/canopy
|
|
26
|
-
"@mediamonks/canopy": "0.0.
|
|
25
|
+
"@mediamonks/canopy": "0.0.15",
|
|
26
|
+
"@mediamonks/canopy-data-plane": "0.0.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^26.1.1",
|
package/dist/dev-z2KvqkF9.mjs
DELETED
package/dist/repo-C7AXDtFZ.mjs
DELETED