@mediamonks/canopy-cli 0.7.41 → 0.7.43
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-PXXMv7kO.mjs → ai-FBHTSCLZ.mjs} +2 -2
- package/dist/{api-BHzCvDcY.mjs → api-Bl6SG8Oq.mjs} +63 -5
- package/dist/{browse-DRz1DowL.mjs → browse-dyOThTyf.mjs} +2 -2
- package/dist/{db-5LfBG6N7.mjs → db-BJJGydgL.mjs} +4 -4
- package/dist/{deploy-6rYq1Iq8.mjs → deploy-ExrIeX_m.mjs} +27 -8
- package/dist/dev-BmI5kwoG.mjs +2 -0
- package/dist/{dev-D_gyIeUq.mjs → dev-adLLSY1F.mjs} +8 -8
- package/dist/{dev-worker-D78leKBJ.mjs → dev-worker-DJekKSdb.mjs} +1 -1
- package/dist/docs/ci.md +19 -1
- package/dist/docs/cli-rename.md +51 -0
- package/dist/docs/developers-architecture.md +12 -0
- package/dist/docs/git.md +5 -0
- package/dist/docs/index.json +11 -1
- package/dist/docs/platform-egress.md +14 -7
- package/dist/docs/rename.md +65 -0
- package/dist/docs/static-serving.md +13 -4
- package/dist/{docs-B9xGnLSR.mjs → docs-CaAgJWK3.mjs} +4 -4
- package/dist/{egress-CCpOsYpS.mjs → egress-C2amvqmE.mjs} +3 -3
- package/dist/{feedback-CdjtPumG.mjs → feedback-CMnG2Zvs.mjs} +4 -4
- package/dist/index.mjs +33 -32
- package/dist/{local-Dshy0NsJ.mjs → local-2xtxtoUd.mjs} +3 -3
- package/dist/{login-CKNFCp7c.mjs → login-CREcZfLH.mjs} +3 -3
- package/dist/{logs-D3WakFME.mjs → logs-BnrNZvLc.mjs} +3 -3
- package/dist/{mcp-CoVS5Mj3.mjs → mcp-BVIU4j9N.mjs} +8 -6
- package/dist/{migrations-DDJ5JJqj.mjs → migrations-D8NqjC5I.mjs} +2 -2
- package/dist/{open-BPYozPQo.mjs → open-Bpz4C2Sr.mjs} +2 -2
- package/dist/{package-SWgTmctH.mjs → package-XOtqboS1.mjs} +1 -1
- package/dist/project-template-715H_lnu.mjs +2 -0
- package/dist/{project-template-DACdMdpn.mjs → project-template-Cdr1uwwE.mjs} +3 -3
- package/dist/{projects-naWQ89Qj.mjs → projects-BRG2HnBs.mjs} +5 -5
- package/dist/rename-BGKa25Rq.mjs +81 -0
- package/dist/{repo-BCua4L-I.mjs → repo-CwT2RDoW.mjs} +5 -3
- package/dist/repo-DmFs6H9m.mjs +2 -0
- package/dist/{schedule-DjHcaxyt.mjs → schedule-BcqBspn3.mjs} +3 -3
- package/dist/{secrets-COwRvCev.mjs → secrets-BjbIi7Gp.mjs} +3 -3
- package/dist/{site-DM2J10CB.mjs → site-0i7wAJqg.mjs} +24 -1
- package/dist/{skill-DSYQA4Ls.mjs → skill-Ct-aCOzg.mjs} +2 -2
- package/dist/{src-RUf3Gfuh.mjs → src-CScXotBB.mjs} +727 -1
- package/dist/{staging-CYMTZyyM.mjs → staging-_2Js0Fkc.mjs} +3 -3
- package/dist/{token-CCpJ1ES4.mjs → token-7vSNuz-X.mjs} +3 -3
- package/dist/{ui-SBUdC9rX.mjs → ui-CLnICOne.mjs} +1 -1
- package/dist/{upgrade-B_tLCpc4.mjs → upgrade-DJogeXAF.mjs} +2 -2
- package/dist/{usage-BSPnsMXd.mjs → usage-DGGmTwjJ.mjs} +3 -3
- package/package.json +1 -1
- package/dist/dev-D38FQ2LD.mjs +0 -2
- package/dist/project-template-CMgD5hnV.mjs +0 -2
- package/dist/repo-Un_p617X.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 {
|
|
2
|
+
import { t as version } from "./package-XOtqboS1.mjs";
|
|
3
|
+
import { i as siteHeaderLine, n as setInvocationProfile } from "./site-0i7wAJqg.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
|
|
@@ -63,36 +63,37 @@ 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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
66
|
+
login: () => import("./login-CREcZfLH.mjs").then((m) => m.loginCommand),
|
|
67
|
+
whoami: () => import("./login-CREcZfLH.mjs").then((m) => m.whoamiCommand),
|
|
68
|
+
logout: () => import("./login-CREcZfLH.mjs").then((m) => m.logoutCommand),
|
|
69
|
+
create: () => import("./projects-BRG2HnBs.mjs").then((m) => m.createCommand),
|
|
70
|
+
init: () => import("./projects-BRG2HnBs.mjs").then((m) => m.initCommand),
|
|
71
|
+
projects: () => import("./projects-BRG2HnBs.mjs").then((m) => m.projectsCommand),
|
|
72
|
+
delete: () => import("./projects-BRG2HnBs.mjs").then((m) => m.deleteCommand),
|
|
73
|
+
rename: () => import("./rename-BGKa25Rq.mjs").then((m) => m.renameCommand),
|
|
74
|
+
dev: () => import("./dev-BmI5kwoG.mjs").then((m) => m.devCommand),
|
|
75
|
+
deploy: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.deployCommand),
|
|
76
|
+
promote: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.promoteCommand),
|
|
77
|
+
staging: () => import("./staging-_2Js0Fkc.mjs").then((m) => m.stagingCommand),
|
|
78
|
+
rollback: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.rollbackCommand),
|
|
79
|
+
download: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.downloadCommand),
|
|
80
|
+
token: () => import("./token-7vSNuz-X.mjs").then((m) => m.tokenCommand),
|
|
81
|
+
egress: () => import("./egress-C2amvqmE.mjs").then((m) => m.egressCommand),
|
|
82
|
+
secrets: () => import("./secrets-BjbIi7Gp.mjs").then((m) => m.secretsCommand),
|
|
83
|
+
schedule: () => import("./schedule-BcqBspn3.mjs").then((m) => m.scheduleCommand),
|
|
84
|
+
feedback: () => import("./feedback-CMnG2Zvs.mjs").then((m) => m.feedbackCommand),
|
|
85
|
+
db: () => import("./db-BJJGydgL.mjs").then((m) => m.dbCommand),
|
|
86
|
+
usage: () => import("./usage-DGGmTwjJ.mjs").then((m) => m.usageCommand),
|
|
87
|
+
ai: () => import("./ai-FBHTSCLZ.mjs").then((m) => m.aiCommand),
|
|
88
|
+
open: () => import("./open-Bpz4C2Sr.mjs").then((m) => m.openCommand),
|
|
89
|
+
browse: () => import("./browse-dyOThTyf.mjs").then((m) => m.browseCommand),
|
|
90
|
+
docs: () => import("./docs-CaAgJWK3.mjs").then((m) => m.docsCommand),
|
|
91
|
+
skill: () => import("./skill-Ct-aCOzg.mjs").then((m) => m.skillCommand),
|
|
92
|
+
upgrade: () => import("./upgrade-DJogeXAF.mjs").then((m) => m.upgradeCommand),
|
|
93
|
+
logs: () => import("./logs-BnrNZvLc.mjs").then((m) => m.logsCommand),
|
|
94
|
+
mcp: () => import("./mcp-BVIU4j9N.mjs").then((m) => m.mcpCommand),
|
|
95
|
+
repo: () => import("./repo-DmFs6H9m.mjs").then((m) => m.repoCommand),
|
|
96
|
+
template: () => import("./project-template-715H_lnu.mjs").then((m) => m.templateCommand)
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
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-
|
|
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-
|
|
3
|
-
import { a as rewriteApiPath } from "./dev-
|
|
1
|
+
import { r as apiDataRequest } from "./api-Bl6SG8Oq.mjs";
|
|
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-CScXotBB.mjs";
|
|
3
|
+
import { a as rewriteApiPath } from "./dev-adLLSY1F.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
|
-
import { _ as
|
|
2
|
-
import { n as agentHeaders } from "./api-
|
|
3
|
-
import { n as openBrowser, r as reportErrors } from "./ui-
|
|
1
|
+
import { _ as setActiveProfile, b as getBakedProfile, g as readConfigFile, h as listBakedProfiles, m as clearAllProfileTokens, r as siteConfig, v as upsertProfileAuth, x as isProfileId, y as writeConfigFile } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { n as agentHeaders } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { n as openBrowser, r as reportErrors } from "./ui-CLnICOne.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,
|
|
3
|
-
import { r as reportErrors } from "./ui-
|
|
1
|
+
import { l as resolveProject, s as projectFlagArgs } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { r as reportErrors } from "./ui-CLnICOne.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, t as ApiError } from "./api-
|
|
1
|
+
import { t as version } from "./package-XOtqboS1.mjs";
|
|
2
|
+
import { c as projectUrl, d as stagingUrl, p as tryResolveProject, r as siteConfig } from "./site-0i7wAJqg.mjs";
|
|
3
|
+
import { a as apiRequest, d as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-Bl6SG8Oq.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";
|
|
@@ -342,15 +342,16 @@ async function connect(args) {
|
|
|
342
342
|
requireSignIn();
|
|
343
343
|
const tokens = agentTokens(slug, channel);
|
|
344
344
|
await tokens.token();
|
|
345
|
+
const current = currentSlug(slug);
|
|
345
346
|
const upstream = await connectUpstream({
|
|
346
|
-
url: `${channel === "staging" ? stagingUrl(
|
|
347
|
-
project:
|
|
347
|
+
url: `${channel === "staging" ? stagingUrl(current) : projectUrl(current)}${MCP_PATH}`,
|
|
348
|
+
project: current,
|
|
348
349
|
tokens
|
|
349
350
|
});
|
|
350
351
|
const config = siteConfig();
|
|
351
352
|
return {
|
|
352
353
|
upstream,
|
|
353
|
-
slug,
|
|
354
|
+
slug: current,
|
|
354
355
|
channel,
|
|
355
356
|
where: `${config.profileId ?? config.apiUrl}, ${channel}`
|
|
356
357
|
};
|
|
@@ -375,6 +376,7 @@ const serveCommand = defineCommand({
|
|
|
375
376
|
async run({ args }) {
|
|
376
377
|
console.log = console.error;
|
|
377
378
|
console.info = console.error;
|
|
379
|
+
noticeRenamesOnly();
|
|
378
380
|
let connection;
|
|
379
381
|
try {
|
|
380
382
|
connection = await connect(args);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as apiDataRequest } from "./api-
|
|
1
|
+
import { f as tryReadCanopyJson } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { r as apiDataRequest } from "./api-Bl6SG8Oq.mjs";
|
|
3
3
|
import { readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
//#region src/migrations.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as openBrowser, r as reportErrors } from "./ui-
|
|
1
|
+
import { c as projectUrl, d as stagingUrl, l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { n as openBrowser, r as reportErrors } from "./ui-CLnICOne.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,
|
|
3
|
-
import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-
|
|
1
|
+
import { l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.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,
|
|
3
|
-
import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-
|
|
4
|
-
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-
|
|
5
|
-
import { i as offerRepoOnCreate, n as cloneProjectRepo } from "./repo-
|
|
1
|
+
import { c as projectUrl, f as tryReadCanopyJson, r as siteConfig } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.mjs";
|
|
4
|
+
import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-Cdr1uwwE.mjs";
|
|
5
|
+
import { i as offerRepoOnCreate, n as cloneProjectRepo } from "./repo-CwT2RDoW.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";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { c as projectUrl, l as resolveProject, o as projectDirArgs, u as rewriteCanopyJsonSlug } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.mjs";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
//#region src/rename.ts
|
|
7
|
+
/**
|
|
8
|
+
* canopy rename <new-slug> — change a project's slug, its address on the
|
|
9
|
+
* site (OpenSpec project-slug-rename). The old slug stays the project's: its
|
|
10
|
+
* hostnames redirect, and everything that still names it (canopy.json
|
|
11
|
+
* elsewhere, CI, MCP configs, git remotes, report keys) keeps reaching the
|
|
12
|
+
* project. The canopy.json in this directory is pointed at the new slug.
|
|
13
|
+
*/
|
|
14
|
+
/** What changes for people outside the platform — said before anything happens. */
|
|
15
|
+
function renameConsequences(from, to) {
|
|
16
|
+
return [
|
|
17
|
+
`The address becomes ${projectUrl(to)}; ${projectUrl(from)} redirects there.`,
|
|
18
|
+
`Email your project sends comes from ${to}@ instead of ${from}@.`,
|
|
19
|
+
"Visitors who signed in with the client password sign in again on the new address.",
|
|
20
|
+
"Visitors' browser storage for the project (localStorage, IndexedDB) starts empty on the new address.",
|
|
21
|
+
`Scripts, CI, MCP client configs and git remotes that say "${from}" keep working; update them when convenient.`
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
const renameCommand = defineCommand({
|
|
25
|
+
meta: {
|
|
26
|
+
name: "rename",
|
|
27
|
+
description: "Change a project's slug (its address)"
|
|
28
|
+
},
|
|
29
|
+
args: {
|
|
30
|
+
slug: {
|
|
31
|
+
type: "positional",
|
|
32
|
+
description: "The new slug",
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
...projectDirArgs,
|
|
36
|
+
yes: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
default: false,
|
|
39
|
+
description: "Skip the confirmation"
|
|
40
|
+
},
|
|
41
|
+
json: {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
default: false,
|
|
44
|
+
description: "Print the result as JSON"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
run: reportErrors("rename", async ({ args }) => {
|
|
48
|
+
const { dir, slug: from } = resolveProject(args);
|
|
49
|
+
const to = String(args.slug).trim().toLowerCase();
|
|
50
|
+
if (!args.yes) {
|
|
51
|
+
requireTty("pass --yes to rename without confirmation.");
|
|
52
|
+
p.note(renameConsequences(from, to).join("\n"), `Rename ${from} → ${to}`);
|
|
53
|
+
if (!unwrap(await p.confirm({ message: `Rename "${from}" to "${to}"?` }))) {
|
|
54
|
+
p.cancel("Aborted.");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const result = await withContext(apiRequest("POST", `/projects/${from}/rename`, { slug: to }), {
|
|
59
|
+
action: `rename "${from}"`,
|
|
60
|
+
fixes: {
|
|
61
|
+
forbidden: "Only the project's owner or a Canopy admin can rename it — ask the owner.",
|
|
62
|
+
invalid_slug: "Use 2–40 lowercase letters, digits and dashes, starting with a letter — not a name Canopy reserves (www, docs, api, …).",
|
|
63
|
+
slug_taken: "Pick another slug: this one belongs to another project, now or in the past."
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const updated = rewriteCanopyJsonSlug(dir, from, result.project.slug);
|
|
67
|
+
if (args.json) {
|
|
68
|
+
console.log(JSON.stringify({
|
|
69
|
+
...result,
|
|
70
|
+
canopy_json_updated: updated
|
|
71
|
+
}, null, 2));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
p.log.success(`Renamed to ${result.project.slug}: ${projectUrl(result.project.slug)}`);
|
|
75
|
+
if (updated) p.log.info("Updated canopy.json.");
|
|
76
|
+
if (result.refresh.pending) p.log.warn("The backend still reports the old slug as PROJECT_SLUG (it keeps working). Canopy retries; `canopy deploy` or Settings → Retry refreshes it now.");
|
|
77
|
+
if (result.slack === "no_config_token" || result.slack === "rejected") p.log.info("The project's Slack app keeps its old URLs, which still work. They move on its next manifest update.");
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
export { renameCommand };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest,
|
|
3
|
-
import { a as unwrap, i as requireTty, r as reportErrors, t as formatDateTime } from "./ui-
|
|
1
|
+
import { f as tryReadCanopyJson, l as resolveProject, o as projectDirArgs, r as siteConfig } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, d as noticeRenamesOnly, f as withContext, n as agentHeaders, u as followRename } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { a as unwrap, i as requireTty, r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.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";
|
|
@@ -328,6 +328,8 @@ async function mintRepoToken(profile, slug) {
|
|
|
328
328
|
}
|
|
329
329
|
}).catch(() => null);
|
|
330
330
|
if (!res) throw new RepoCredentialError(`could not reach Canopy (${config.apiUrl}).`);
|
|
331
|
+
noticeRenamesOnly();
|
|
332
|
+
followRename(res, slug);
|
|
331
333
|
if (res.status === 201) return await res.json();
|
|
332
334
|
const body = await res.json().catch(() => ({}));
|
|
333
335
|
if (res.status === 401) throw new RepoCredentialError(`your ${profile} sign-in has expired — ${login}.`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as apiRequest,
|
|
3
|
-
import { r as reportErrors, t as formatDateTime } from "./ui-
|
|
1
|
+
import { l as resolveProject, s as projectFlagArgs } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.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,
|
|
3
|
-
import { a as unwrap, r as reportErrors, t as formatDateTime } from "./ui-
|
|
1
|
+
import { l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
|
|
2
|
+
import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
|
|
3
|
+
import { a as unwrap, r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/secrets.ts
|
|
@@ -198,6 +198,25 @@ function projectDialect(dir) {
|
|
|
198
198
|
if (dialect !== "sqlite" && dialect !== "postgres") throw new Error(`canopy.json "dialect" must be "sqlite" or "postgres", not ${JSON.stringify(dialect)}.`);
|
|
199
199
|
return dialect;
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Point canopy.json at a project's new slug after a rename (OpenSpec
|
|
203
|
+
* project-slug-rename) — only when it still names `from`, and changing
|
|
204
|
+
* nothing else in the file. True when it was rewritten.
|
|
205
|
+
*/
|
|
206
|
+
function rewriteCanopyJsonSlug(dir, from, to) {
|
|
207
|
+
let config;
|
|
208
|
+
try {
|
|
209
|
+
config = tryReadCanopyJson(dir);
|
|
210
|
+
} catch {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
if (config?.slug !== from) return false;
|
|
214
|
+
writeFileSync(join(dir, "canopy.json"), `${JSON.stringify({
|
|
215
|
+
...config,
|
|
216
|
+
slug: to
|
|
217
|
+
}, null, 2)}\n`);
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
201
220
|
function readCanopyJson(dir) {
|
|
202
221
|
const config = tryReadCanopyJson(dir);
|
|
203
222
|
if (config === void 0) throw new Error(`No canopy.json in ${dir} — run from a project created by \`canopy create\`, add one ({"slug": "<slug>", "dist": "dist"}), or pass --project <slug>.`);
|
|
@@ -255,6 +274,10 @@ function setInvocationProfile(profile) {
|
|
|
255
274
|
function setProjectDirForPin(dir) {
|
|
256
275
|
projectDirForPin = dir;
|
|
257
276
|
}
|
|
277
|
+
/** The project directory this invocation resolved (cwd when none was named). */
|
|
278
|
+
function projectDir() {
|
|
279
|
+
return projectDirForPin ?? ".";
|
|
280
|
+
}
|
|
258
281
|
function projectProfileFromCwd() {
|
|
259
282
|
return tryReadCanopyJson(projectDirForPin ?? ".")?.profile;
|
|
260
283
|
}
|
|
@@ -277,4 +300,4 @@ function siteHeaderLine(cliVersion) {
|
|
|
277
300
|
return `canopy ${cliVersion} · ${c.envOverride || !c.profileId ? c.apiUrl : `${c.profileId} (${c.projectDomain ?? new URL(c.apiUrl).hostname})`}`;
|
|
278
301
|
}
|
|
279
302
|
//#endregion
|
|
280
|
-
export {
|
|
303
|
+
export { setActiveProfile as _, projectDialect as a, getBakedProfile as b, projectUrl as c, stagingUrl as d, tryReadCanopyJson as f, readConfigFile as g, listBakedProfiles as h, siteHeaderLine as i, resolveProject as l, clearAllProfileTokens as m, setInvocationProfile as n, projectDirArgs as o, tryResolveProject as p, siteConfig as r, projectFlagArgs as s, projectDir as t, rewriteCanopyJsonSlug as u, upsertProfileAuth as v, isProfileId as x, writeConfigFile as y };
|
|
@@ -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-XOtqboS1.mjs";
|
|
2
|
+
import { r as reportErrors } from "./ui-CLnICOne.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";
|