@mediamonks/canopy-cli 0.7.56 → 0.7.58
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-DDVTX_nO.mjs → ai-00f2Mgqh.mjs} +2 -2
- package/dist/{api-MIRoGsB6.mjs → api-fmc8CEMT.mjs} +4 -0
- package/dist/{audience-8U1dwxcU.mjs → audience-ByM1jUH3.mjs} +2 -2
- package/dist/{browse-CVBq2IB4.mjs → browse-CxwKuka0.mjs} +1 -1
- package/dist/{calls-Cnt16FiF.mjs → calls-DsbRjCcy.mjs} +2 -2
- package/dist/{db-CXeAa-Qy.mjs → db-BU-ni9fj.mjs} +3 -3
- package/dist/{deploy-C1mwXvJY.mjs → deploy-k2DzsLxO.mjs} +393 -17
- package/dist/dev-BtacZ4HE.mjs +2 -0
- package/dist/{dev--vOKyg1k.mjs → dev-qp1VRNM_.mjs} +6 -6
- package/dist/docs/cli-deploy.md +20 -3
- package/dist/docs/cli-download.md +1 -1
- package/dist/docs/cli-promote.md +2 -0
- package/dist/docs/cli-rollback.md +3 -1
- package/dist/docs/cli-staging.md +2 -0
- package/dist/docs/cli-versions.md +79 -0
- package/dist/docs/cli.md +2 -0
- package/dist/docs/index.json +6 -1
- package/dist/docs/platform-deploys-and-rollbacks.md +40 -5
- package/dist/docs/platform-project-data.md +7 -0
- package/dist/docs/static-serving.md +34 -2
- package/dist/{docs-DgMINV-7.mjs → docs-ZBBQi3uK.mjs} +3 -3
- package/dist/{egress-Cy3UBgEM.mjs → egress-Bzn2VKDe.mjs} +2 -2
- package/dist/{feedback-DymVKtj0.mjs → feedback-B0-6QTSh.mjs} +3 -3
- package/dist/{files-CYTMMRC0.mjs → files-CBbAtHIK.mjs} +2 -2
- package/dist/index.mjs +38 -37
- package/dist/{local-DCo1A00D.mjs → local-C1i2uhAf.mjs} +2 -2
- package/dist/{login-BpmefYHv.mjs → login-Baso-JE0.mjs} +2 -2
- package/dist/{logs-CWr7tRhN.mjs → logs-c76jVOhb.mjs} +2 -2
- package/dist/{mcp-D0TZcRce.mjs → mcp-DmcjX8Kn.mjs} +2 -2
- package/dist/{migrations-CkGa1pmn.mjs → migrations-ChafLorm.mjs} +1 -1
- package/dist/{open-D2WqNBiq.mjs → open-Doat726T.mjs} +1 -1
- package/dist/{package-BpSdSdZI.mjs → package-BzvVsyRl.mjs} +1 -1
- package/dist/project-template--mESzwea.mjs +2 -0
- package/dist/{project-template-DjbT9RRU.mjs → project-template-BnX47DpF.mjs} +2 -2
- package/dist/{projects-Dcq37hny.mjs → projects-DOqpkUVT.mjs} +4 -4
- package/dist/{rename-DTg_3_BJ.mjs → rename-RA_oYbRT.mjs} +2 -2
- package/dist/{repo-ZjkxQKwh.mjs → repo-DD3eK1P_.mjs} +2 -2
- package/dist/repo-DayXVvyj.mjs +2 -0
- package/dist/{roles-2dF7LkZB.mjs → roles-BS8-Gvv-.mjs} +2 -2
- package/dist/{roles-B5E2tfbN.mjs → roles-tqf4sYDM.mjs} +1 -1
- package/dist/{schedule-_u2Ab1WH.mjs → schedule-D8AQ8MVF.mjs} +2 -2
- package/dist/{secrets-H1bQRNBr.mjs → secrets-Bi7BYCla.mjs} +2 -2
- package/dist/skill/canopy/SKILL.md +8 -0
- package/dist/{skill-BHDQdPTC.mjs → skill-k3HLr7rK.mjs} +2 -2
- package/dist/{staging-BZJwA_iG.mjs → staging-BxG3Cffd.mjs} +2 -2
- package/dist/{token-BEV5lbld.mjs → token-bHdy_IoX.mjs} +2 -2
- package/dist/{ui-7cyGNbu5.mjs → ui-9f_lF2Ak.mjs} +1 -1
- package/dist/{upgrade-BYTMPnOF.mjs → upgrade-DkjbsYNs.mjs} +2 -2
- package/dist/{usage-iYp64st3.mjs → usage-DFs2TERV.mjs} +2 -2
- package/dist/versions-Cgw7sB3h.mjs +106 -0
- package/package.json +1 -1
- package/dist/dev-CCMeTwvP.mjs +0 -2
- package/dist/project-template-D-e33lix.mjs +0 -2
- package/dist/repo-C_gmPkLX.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as projectUrl, f as resolveProject, m as stagingUrl, s as parseVersionArg, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, n as formatDateTime, o as spinner$1, s as unwrap, t as confirmTypedSlug } from "./ui-9f_lF2Ak.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
//#region src/staging.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as resolveProject, l as projectDirArgs, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
-
import { a as apiRequest } from "./api-
|
|
3
|
-
import { i as reportErrors, n as formatDateTime } from "./ui-
|
|
2
|
+
import { a as apiRequest } from "./api-fmc8CEMT.mjs";
|
|
3
|
+
import { i as reportErrors, n as formatDateTime } from "./ui-9f_lF2Ak.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
const tokenCommand = defineCommand({
|
|
6
6
|
meta: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as PACKAGE_NAME } from "./version-check-CcsA1QjI.mjs";
|
|
2
|
-
import { i as reportErrors } from "./ui-
|
|
2
|
+
import { i as reportErrors } from "./ui-9f_lF2Ak.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-k3HLr7rK.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 { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
-
import { a as apiRequest, m as withContext } from "./api-
|
|
3
|
-
import { i as reportErrors } from "./ui-
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
|
|
3
|
+
import { i as reportErrors } from "./ui-9f_lF2Ak.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/usage.ts
|
|
6
6
|
/**
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { f as resolveProject, u as projectFlagArgs } from "./site-BcZ0LOvm.mjs";
|
|
2
|
+
import { a as apiRequest, m as withContext } from "./api-fmc8CEMT.mjs";
|
|
3
|
+
import { a as requireTty, i as reportErrors, s as unwrap } from "./ui-9f_lF2Ak.mjs";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
//#region src/versions.ts
|
|
7
|
+
/**
|
|
8
|
+
* `canopy versions` — the project's deploy versions (OpenSpec deploy-retention).
|
|
9
|
+
*
|
|
10
|
+
* (none) the retention setting and how many versions are kept / expired
|
|
11
|
+
* retention show or turn version retention on or off
|
|
12
|
+
*
|
|
13
|
+
* With retention on the platform keeps the 20 newest versions, the live and
|
|
14
|
+
* staging versions with the one below each, and everything newer than live;
|
|
15
|
+
* its hourly pass expires the rest (files gone, history kept).
|
|
16
|
+
*/
|
|
17
|
+
const formatSize = (bytes) => bytes >= 1024 ** 3 ? `${(bytes / 1024 ** 3).toFixed(1)} GB` : bytes >= 1024 ** 2 ? `${(bytes / 1024 ** 2).toFixed(1)} MB` : `${Math.max(0, Math.round(bytes / 1024))} kB`;
|
|
18
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
19
|
+
/** "on" / "off" as a boolean, or null for anything else (case and spaces forgiven). */
|
|
20
|
+
function parseSwitch(raw) {
|
|
21
|
+
const wanted = raw.trim().toLowerCase();
|
|
22
|
+
return wanted === "on" ? true : wanted === "off" ? false : null;
|
|
23
|
+
}
|
|
24
|
+
/** What `canopy versions` and `canopy versions retention` print. */
|
|
25
|
+
function describeRetention(slug, s) {
|
|
26
|
+
const lines = s.enabled ? [`${slug}: version retention is on — keeps the ${s.keepRecent} most recent versions, the live and staging versions with the one below each, and everything newer than live.`] : [`${slug}: version retention is off — every version keeps its files.`];
|
|
27
|
+
lines.push(` ${plural(s.kept, "version")} kept (${formatSize(s.bytes)})` + (s.expired > 0 ? `, ${s.expired} expired` : ""));
|
|
28
|
+
if (s.enabled && s.wouldExpire.versions > 0) lines.push(` ${plural(s.wouldExpire.versions, "version")} expire within the hour.`);
|
|
29
|
+
if (!s.enabled && s.wouldExpire.versions > 0) lines.push(` Turning it on would expire ${plural(s.wouldExpire.versions, "version")} (${formatSize(s.wouldExpire.bytes)}): \`canopy versions retention on\`.`);
|
|
30
|
+
return lines;
|
|
31
|
+
}
|
|
32
|
+
let subcommandRan = false;
|
|
33
|
+
const retentionCommand = defineCommand({
|
|
34
|
+
meta: {
|
|
35
|
+
name: "retention",
|
|
36
|
+
description: "Show or turn version retention on or off (on | off)"
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
...projectFlagArgs,
|
|
40
|
+
state: {
|
|
41
|
+
type: "positional",
|
|
42
|
+
description: "on | off (omit to show)",
|
|
43
|
+
required: false
|
|
44
|
+
},
|
|
45
|
+
yes: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
default: false,
|
|
48
|
+
description: "Don't ask before turning on retention that expires versions"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
run: reportErrors("versions retention", async ({ args }) => {
|
|
52
|
+
subcommandRan = true;
|
|
53
|
+
const { slug } = resolveProject(args);
|
|
54
|
+
const path = `/projects/${slug}/deploy-retention`;
|
|
55
|
+
const print = (s) => {
|
|
56
|
+
for (const line of describeRetention(slug, s)) console.log(line);
|
|
57
|
+
};
|
|
58
|
+
if (!args.state?.trim()) {
|
|
59
|
+
print(await withContext(apiRequest("GET", path), { action: `read the version retention of "${slug}"` }));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const enabled = parseSwitch(args.state);
|
|
63
|
+
if (enabled === null) {
|
|
64
|
+
console.error(`unknown state "${args.state.trim()}" — expected on or off.`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
const context = { action: `change the version retention of "${slug}"` };
|
|
68
|
+
if (enabled && !args.yes) {
|
|
69
|
+
const preview = await withContext(apiRequest("PUT", path, {
|
|
70
|
+
enabled,
|
|
71
|
+
dryRun: true
|
|
72
|
+
}), context);
|
|
73
|
+
if (!preview.enabled || preview.wouldExpire.versions > 0) {
|
|
74
|
+
const n = preview.wouldExpire.versions;
|
|
75
|
+
if (n > 0) {
|
|
76
|
+
requireTty("pass --yes to turn on retention that expires versions.");
|
|
77
|
+
if (!unwrap(await p.confirm({
|
|
78
|
+
message: `This expires ${plural(n, "version")} of "${slug}" (${formatSize(preview.wouldExpire.bytes)}) within the hour. Expired versions can no longer be rolled back to, pinned or downloaded. Continue?`,
|
|
79
|
+
initialValue: false
|
|
80
|
+
}))) {
|
|
81
|
+
p.cancel("Aborted.");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
print(await withContext(apiRequest("PUT", path, { enabled }), context));
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
const summaryRun = reportErrors("versions", async ({ args }) => {
|
|
91
|
+
const { slug } = resolveProject(args);
|
|
92
|
+
const settings = await withContext(apiRequest("GET", `/projects/${slug}/deploy-retention`), { action: `read the versions of "${slug}"` });
|
|
93
|
+
for (const line of describeRetention(slug, settings)) console.log(line);
|
|
94
|
+
console.log(" History: `canopy rollback` lists versions; the dashboard's Deploys tab too.");
|
|
95
|
+
});
|
|
96
|
+
const versionsCommand = defineCommand({
|
|
97
|
+
meta: {
|
|
98
|
+
name: "versions",
|
|
99
|
+
description: "Deploy versions: how many are kept, and version retention"
|
|
100
|
+
},
|
|
101
|
+
args: { ...projectFlagArgs },
|
|
102
|
+
subCommands: { retention: retentionCommand },
|
|
103
|
+
run: (context) => subcommandRan ? void 0 : summaryRun(context)
|
|
104
|
+
});
|
|
105
|
+
//#endregion
|
|
106
|
+
export { versionsCommand };
|
package/package.json
CHANGED
package/dist/dev-CCMeTwvP.mjs
DELETED
package/dist/repo-C_gmPkLX.mjs
DELETED