@mediamonks/canopy-cli 0.7.52 → 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-BnzJ8a1u.mjs → dev-L5slb6ke.mjs} +7 -7
- package/dist/docs/cli-schedule.md +1 -1
- package/dist/docs/cli-token.md +1 -1
- package/dist/docs/developers-architecture.md +1 -1
- package/dist/docs/outside-sign-in.md +1 -1
- package/dist/docs/platform-client-access.md +1 -1
- package/dist/docs/platform-credentials.md +2 -2
- package/dist/docs/platform-egress.md +4 -4
- package/dist/docs/platform-schedules.md +4 -4
- package/dist/docs/porting-nextjs.md +23 -23
- package/dist/docs/staging.md +1 -1
- package/dist/docs/static-serving.md +6 -3
- package/dist/docs/troubleshooting.md +1 -1
- package/dist/{docs-Od4duFhd.mjs → docs-bnQLqEOn.mjs} +4 -4
- package/dist/{egress-BoGWBHRa.mjs → egress-hKpsJF84.mjs} +4 -10
- package/dist/{feedback-XEIHbeor.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-R-INkPbU.mjs → local-B15wYk6z.mjs} +3 -3
- package/dist/{login-DrMr99-A.mjs → login-cbwynFoT.mjs} +3 -3
- package/dist/{logs-DJWrL6ja.mjs → logs-ByDPHO28.mjs} +3 -3
- package/dist/{mcp-misDO7O8.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-DBdEKZ6u.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-3RZw4vSI.mjs → skill-CRTV3ZQ1.mjs} +2 -2
- 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-Dy4XV7iP.mjs → upgrade-LTEfQn4L.mjs} +2 -2
- package/dist/{usage-VMT75MZ4.mjs → usage-DBhL6SUo.mjs} +3 -3
- package/package.json +3 -3
- package/dist/dev-DSI3e4qP.mjs +0 -2
- package/dist/project-template-Dti_Mmnb.mjs +0 -2
- package/dist/repo-CGTFmIWM.mjs +0 -2
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,6 +1,6 @@
|
|
|
1
|
-
import { r as apiDataRequest } from "./api-
|
|
1
|
+
import { r as apiDataRequest } from "./api-D4KUT6Ly.mjs";
|
|
2
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-
|
|
3
|
+
import { a as rewriteApiPath } from "./dev-L5slb6ke.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join, relative, sep } from "node:path";
|
|
@@ -806,7 +806,7 @@ function resolveSdkBundle() {
|
|
|
806
806
|
}
|
|
807
807
|
/** Downloads a fresh SQL dump of the project's production database (pull-only sync). */
|
|
808
808
|
async function fetchProjectDump(slug, channel = "live") {
|
|
809
|
-
const { url } = await apiDataRequest("POST", "/db/export", slug, void 0,
|
|
809
|
+
const { url } = await apiDataRequest("POST", "/db/export", slug, void 0, { channel });
|
|
810
810
|
const download = await fetch(url);
|
|
811
811
|
if (!download.ok) throw new Error(`Dump download failed (HTTP ${download.status}).`);
|
|
812
812
|
return download.text();
|
|
@@ -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
|
|
@@ -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, n as formatDateTime } from "./ui-BPq6-hKS.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/schedule.ts
|
|
6
6
|
/**
|
|
@@ -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 { i as reportErrors, n as formatDateTime, 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/secrets.ts
|
|
@@ -121,8 +121,8 @@ function resolveConfig(opts = {}) {
|
|
|
121
121
|
projectDomain,
|
|
122
122
|
projectProtocol,
|
|
123
123
|
cloud: baked?.cloud,
|
|
124
|
-
issuer: process.env["CANOPY_OIDC_ISSUER"] ?? file.issuer ??
|
|
125
|
-
cliClientId: process.env["CANOPY_OIDC_CLIENT_ID"] ?? file.cliClientId ??
|
|
124
|
+
issuer: process.env["CANOPY_OIDC_ISSUER"] ?? file.issuer ?? "https://s4capital.onelogin.com/oidc/2",
|
|
125
|
+
cliClientId: process.env["CANOPY_OIDC_CLIENT_ID"] ?? file.cliClientId ?? "b69755d0-6678-013f-b5ce-09fe44a57aa0180501",
|
|
126
126
|
token: auth?.token,
|
|
127
127
|
tokenExpiresAt: auth?.tokenExpiresAt,
|
|
128
128
|
email: auth?.email,
|
|
@@ -259,6 +259,11 @@ function tryResolveProject(args) {
|
|
|
259
259
|
slug: args.project ?? tryReadCanopyJson(dir)?.slug
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
+
/** A deploy version argument (`3` or `v3`) as a number; anything else throws. */
|
|
263
|
+
function parseVersionArg(raw) {
|
|
264
|
+
if (!/^v?\d+$/.test(raw)) throw new Error(`Invalid version "${raw}" — expected a number like 3 or v3.`);
|
|
265
|
+
return Number(raw.replace(/^v/, ""));
|
|
266
|
+
}
|
|
262
267
|
const GITHUB_HOST = /^(?:github\.com|[a-z0-9][a-z0-9-]*\.ghe\.com)$/;
|
|
263
268
|
/**
|
|
264
269
|
* The GitHub repository a git remote URL points at, or null when it is not on
|
|
@@ -349,4 +354,4 @@ function siteHeaderLine(cliVersion) {
|
|
|
349
354
|
return `canopy ${cliVersion} · ${c.envOverride || !c.profileId ? c.apiUrl : `${c.profileId} (${c.projectDomain ?? new URL(c.apiUrl).hostname})`}`;
|
|
350
355
|
}
|
|
351
356
|
//#endregion
|
|
352
|
-
export {
|
|
357
|
+
export { upsertProfileAuth as C, isProfileId as E, setActiveProfile as S, getBakedProfile as T, DEFAULT_CLI_CLIENT_ID as _, parseGithubRemote as a, listBakedProfiles as b, projectDialect as c, projectUrl as d, resolveProject as f, tryResolveProject as g, tryReadCanopyJson as h, siteHeaderLine as i, projectDirArgs as l, stagingUrl as m, setInvocationProfile as n, parseRepositoryArg as o, rewriteCanopyJsonSlug as p, siteConfig as r, parseVersionArg as s, projectDir as t, projectFlagArgs as u, DEFAULT_ISSUER as v, writeConfigFile as w, readConfigFile as x, clearAllProfileTokens as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
2
|
-
import {
|
|
1
|
+
import { t as version } from "./package-DtU4jB_Z.mjs";
|
|
2
|
+
import { i as reportErrors } from "./ui-BPq6-hKS.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
|
-
import { d as
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as
|
|
1
|
+
import { d as projectUrl, f as resolveProject, m as stagingUrl, s as parseVersionArg, u as projectFlagArgs } from "./site-C0nf9RXY.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-D4KUT6Ly.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, 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/staging.ts
|
|
@@ -52,10 +52,8 @@ const stagingCommand = defineCommand({
|
|
|
52
52
|
run: reportErrors("staging use", async ({ args }) => {
|
|
53
53
|
const { slug } = resolveProject(args);
|
|
54
54
|
let target;
|
|
55
|
-
if (args.version !== void 0)
|
|
56
|
-
|
|
57
|
-
target = Number(args.version.replace(/^v/, ""));
|
|
58
|
-
} else {
|
|
55
|
+
if (args.version !== void 0) target = parseVersionArg(args.version);
|
|
56
|
+
else {
|
|
59
57
|
requireTty("pass a version, e.g. `canopy staging use v3`.");
|
|
60
58
|
const { deploys, live, staging: staged } = await apiRequest("GET", `/projects/${slug}/deploys`);
|
|
61
59
|
if (deploys.length === 0) throw new Error("This project has no deploys yet.");
|
|
@@ -129,13 +127,7 @@ const stagingCommand = defineCommand({
|
|
|
129
127
|
},
|
|
130
128
|
run: reportErrors("staging destroy", async ({ args }) => {
|
|
131
129
|
const { slug } = resolveProject(args);
|
|
132
|
-
if (!args.yes)
|
|
133
|
-
requireTty("pass --yes to destroy without confirmation.");
|
|
134
|
-
if (unwrap(await p.text({ message: `This deletes "${slug}"'s staging database, files and backend (live is untouched). Type the slug to confirm.` })).trim() !== slug) {
|
|
135
|
-
p.cancel("Aborted.");
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
130
|
+
if (!args.yes && !await confirmTypedSlug(slug, `This deletes "${slug}"'s staging database, files and backend (live is untouched). Type the slug to confirm.`, "pass --yes to destroy without confirmation.")) return;
|
|
139
131
|
const spin = spinner$1();
|
|
140
132
|
spin.start(`Destroying staging for ${slug}…`);
|
|
141
133
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{name}} — a Canopy React SPA
|
|
2
2
|
|
|
3
|
-
A Vite + React single-page app on [Canopy](
|
|
3
|
+
A Vite + React single-page app on [Canopy]({{dashboardUrl}}),
|
|
4
4
|
Monks' managed platform for internal projects. Everything is served behind
|
|
5
5
|
company login; there is no infrastructure to manage and none should be added.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ npx skills add mediamonks/canopy
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
If that fails the skill isn't published yet — the SDK surface is documented on
|
|
18
|
-
the [Canopy dashboard](
|
|
18
|
+
the [Canopy dashboard]({{dashboardUrl}}).
|
|
19
19
|
|
|
20
20
|
## Working on this project
|
|
21
21
|
|
|
@@ -29,7 +29,7 @@ the [Canopy dashboard](https://dashboard.thanarie.dev).
|
|
|
29
29
|
- `canopy dev --local [--pull]` — offline sandbox with local data instead;
|
|
30
30
|
writes never reach the platform. Prefer it for destructive experiments.
|
|
31
31
|
- `canopy deploy` — builds (`npm run build`) and publishes `dist/`; live
|
|
32
|
-
(behind company login) at
|
|
32
|
+
(behind company login) at {{url}}.
|
|
33
33
|
- Risky change (schema migration, backend rework)? `canopy deploy --staging`
|
|
34
34
|
first — a private copy with its own database cloned from live — verify, then
|
|
35
35
|
`canopy promote` ships the exact tested version. Never promote with failing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# {{name}}
|
|
2
2
|
|
|
3
|
-
A [Canopy](
|
|
4
|
-
(behind company login) at
|
|
3
|
+
A [Canopy]({{dashboardUrl}}) project — Vite + React. Live
|
|
4
|
+
(behind company login) at {{url}} after the first
|
|
5
5
|
`canopy deploy`.
|
|
6
6
|
|
|
7
7
|
- `npm install` — once, then:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{name}} — a Canopy static app
|
|
2
2
|
|
|
3
|
-
A no-build web app on [Canopy](
|
|
3
|
+
A no-build web app on [Canopy]({{dashboardUrl}}), Monks' managed
|
|
4
4
|
platform for internal projects. Everything is served behind company login;
|
|
5
5
|
there is no infrastructure to manage and none should be added.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ npx skills add mediamonks/canopy
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
If that fails the skill isn't published yet — the SDK surface is documented on
|
|
18
|
-
the [Canopy dashboard](
|
|
18
|
+
the [Canopy dashboard]({{dashboardUrl}}).
|
|
19
19
|
|
|
20
20
|
## Working on this project
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ the [Canopy dashboard](https://dashboard.thanarie.dev).
|
|
|
28
28
|
- `canopy dev --local [--pull]` — offline sandbox with local data instead;
|
|
29
29
|
writes never reach the platform. Prefer it for destructive experiments.
|
|
30
30
|
- `canopy deploy` — publish; live (behind company login) at
|
|
31
|
-
|
|
31
|
+
{{url}}.
|
|
32
32
|
- Risky change (schema migration, backend rework)? `canopy deploy --staging`
|
|
33
33
|
first — a private copy with its own database cloned from live — verify, then
|
|
34
34
|
`canopy promote` ships the exact tested version. Never promote with failing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# {{name}}
|
|
2
2
|
|
|
3
|
-
A [Canopy](
|
|
4
|
-
login) at
|
|
3
|
+
A [Canopy]({{dashboardUrl}}) project. Live (behind company
|
|
4
|
+
login) at {{url}} after the first `canopy deploy`.
|
|
5
5
|
|
|
6
6
|
- `canopy dev` — develop locally against the live platform (real data!)
|
|
7
7
|
- `canopy dev --local [--pull]` — offline sandbox with local data instead
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# {{name}} — a Canopy React SPA with a backend Worker
|
|
2
2
|
|
|
3
3
|
A Vite + React single-page app plus a per-project backend Worker on
|
|
4
|
-
[Canopy](
|
|
4
|
+
[Canopy]({{dashboardUrl}}), Monks' managed platform for internal
|
|
5
5
|
projects. Everything is served behind company login; there is no
|
|
6
6
|
infrastructure to manage and none should be added.
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ npx skills add mediamonks/canopy
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
If that fails the skill isn't published yet — the SDK surface is documented on
|
|
19
|
-
the [Canopy dashboard](
|
|
19
|
+
the [Canopy dashboard]({{dashboardUrl}}).
|
|
20
20
|
|
|
21
21
|
## Working on this project
|
|
22
22
|
|
|
@@ -42,7 +42,7 @@ the [Canopy dashboard](https://dashboard.thanarie.dev).
|
|
|
42
42
|
- `canopy dev --local [--pull]` — offline sandbox with local data instead;
|
|
43
43
|
writes never reach the platform. Prefer it for destructive experiments.
|
|
44
44
|
- `canopy deploy` — builds (`npm run build`) and publishes; live (behind
|
|
45
|
-
company login) at
|
|
45
|
+
company login) at {{url}}.
|
|
46
46
|
- Defining your own tables (raw `sql()` / Drizzle)? Use the migrations flow —
|
|
47
47
|
`canopy docs migrations`. Never invent a `DATABASE_URL` (none exists):
|
|
48
48
|
generate migrations locally, and `canopy deploy` applies them.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# {{name}}
|
|
2
2
|
|
|
3
|
-
A [Canopy](
|
|
3
|
+
A [Canopy]({{dashboardUrl}}) project — Vite + React with a
|
|
4
4
|
backend Worker (`worker/`). Live (behind company login) at
|
|
5
|
-
|
|
5
|
+
{{url}} after the first `canopy deploy`.
|
|
6
6
|
|
|
7
7
|
- `npm install` — once, then:
|
|
8
8
|
- `canopy dev` — develop locally against the live platform (real data!);
|