@mediamonks/canopy-cli 0.7.35 → 0.7.36
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/{dev-oS4nYMSn.mjs → dev-BdXslHoA.mjs} +33 -11
- package/dist/dev-BeFX_wc5.mjs +2 -0
- package/dist/{docs-CGrXLl7G.mjs → docs-Bb9hSk4h.mjs} +1 -1
- package/dist/{feedback-CrmDfqmZ.mjs → feedback-DzEKQlP6.mjs} +1 -1
- package/dist/index.mjs +7 -7
- package/dist/{local-Cc8H3NUw.mjs → local-Cyl39_Zu.mjs} +1 -1
- package/dist/{mcp-DAaO4SQc.mjs → mcp-pNp-sbfJ.mjs} +1 -1
- package/dist/{package-BOXNJrWP.mjs → package-lYhex2Gp.mjs} +1 -1
- package/dist/{skill-GPJrYL61.mjs → skill-BUA2uRR2.mjs} +1 -1
- package/dist/{upgrade-DSTg2cgu.mjs → upgrade-ZSb56qBJ.mjs} +1 -1
- package/package.json +1 -1
- package/dist/dev-CID2LCES.mjs +0 -2
|
@@ -34,7 +34,7 @@ function workerDialect(flags) {
|
|
|
34
34
|
* gateway serves it in production (dev-worker.ts). Returns the plugin plus
|
|
35
35
|
* the notice lines to print, or undefined when the project has no worker.
|
|
36
36
|
*/
|
|
37
|
-
async function workerPlugin(flags, slug, workerAttest) {
|
|
37
|
+
async function workerPlugin(flags, slug, workerAttest, remoteUser) {
|
|
38
38
|
const entry = tryReadCanopyJson(flags.dir)?.worker;
|
|
39
39
|
if (entry === void 0) return void 0;
|
|
40
40
|
if (!existsSync(join(flags.dir, entry))) {
|
|
@@ -44,17 +44,18 @@ async function workerPlugin(flags, slug, workerAttest) {
|
|
|
44
44
|
const { missingSecretNames, readDevVars, workerDevPlugin } = await import("./dev-worker-CpSB_Okh.mjs");
|
|
45
45
|
const secrets = readDevVars(flags.dir);
|
|
46
46
|
const email = siteConfig().email;
|
|
47
|
+
const user = await remoteUser?.() ?? (email ? {
|
|
48
|
+
sub: "local-dev",
|
|
49
|
+
email,
|
|
50
|
+
name: "Local Dev"
|
|
51
|
+
} : null);
|
|
47
52
|
const plugin = workerDevPlugin({
|
|
48
53
|
dir: flags.dir,
|
|
49
54
|
entry,
|
|
50
55
|
slug,
|
|
51
56
|
channel: flags.staging ? "staging" : "live",
|
|
52
57
|
secrets,
|
|
53
|
-
user
|
|
54
|
-
sub: "local-dev",
|
|
55
|
-
email,
|
|
56
|
-
name: "Local Dev"
|
|
57
|
-
} : null,
|
|
58
|
+
user,
|
|
58
59
|
dialect: workerDialect(flags),
|
|
59
60
|
workerAttest
|
|
60
61
|
});
|
|
@@ -156,6 +157,26 @@ function devProxyHeaders(token, slug, channel) {
|
|
|
156
157
|
return Object.fromEntries(headers);
|
|
157
158
|
}
|
|
158
159
|
/**
|
|
160
|
+
* The signed-in person as the platform sees them — what auth.user() answers
|
|
161
|
+
* in the browser, so env.USER in a live-data dev worker matches it.
|
|
162
|
+
* Undefined on any failure: dev still starts, with the local stub.
|
|
163
|
+
*/
|
|
164
|
+
async function fetchDevUser(apiUrl, headers) {
|
|
165
|
+
try {
|
|
166
|
+
const res = await fetch(`${apiUrl}/data/v1/auth/me`, { headers });
|
|
167
|
+
if (!res.ok) return void 0;
|
|
168
|
+
const me = await res.json();
|
|
169
|
+
if (!me.id) return void 0;
|
|
170
|
+
return {
|
|
171
|
+
sub: me.id,
|
|
172
|
+
email: me.email ?? "",
|
|
173
|
+
name: me.name ?? ""
|
|
174
|
+
};
|
|
175
|
+
} catch {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
159
180
|
* One request from Vite's /_api proxy into the --local sandbox. The response
|
|
160
181
|
* body is streamed, not buffered — realtime subscriptions (docs/48) are
|
|
161
182
|
* long-lived SSE responses — and a client that goes away aborts the sandbox
|
|
@@ -202,11 +223,12 @@ async function bridgeToSandbox(sandbox, req, res) {
|
|
|
202
223
|
async function devRemote(flags, slug) {
|
|
203
224
|
const { token, expires_at } = await withContext(apiRequest("POST", `/projects/${slug}/dev-token`), devTokenContext(slug));
|
|
204
225
|
const { apiUrl } = siteConfig();
|
|
205
|
-
const
|
|
226
|
+
const channel = flags.staging ? "staging" : "live";
|
|
227
|
+
const worker = await workerPlugin(flags, slug, void 0, () => fetchDevUser(apiUrl, devProxyHeaders(token, slug, channel)));
|
|
206
228
|
const server = await startVite(flags, { proxy: { "/_api": {
|
|
207
229
|
target: apiUrl,
|
|
208
230
|
changeOrigin: true,
|
|
209
|
-
headers: devProxyHeaders(token, slug,
|
|
231
|
+
headers: devProxyHeaders(token, slug, channel),
|
|
210
232
|
rewrite: rewriteApiPath
|
|
211
233
|
} } }, worker ? [worker.plugin] : []);
|
|
212
234
|
if (flags.staging) {
|
|
@@ -229,7 +251,7 @@ async function devRemote(flags, slug) {
|
|
|
229
251
|
async function devLocal(flags, slug) {
|
|
230
252
|
let dump;
|
|
231
253
|
if (flags.pull) {
|
|
232
|
-
const { fetchProjectDump } = await import("./local-
|
|
254
|
+
const { fetchProjectDump } = await import("./local-Cyl39_Zu.mjs");
|
|
233
255
|
console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
|
|
234
256
|
dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
|
|
235
257
|
}
|
|
@@ -245,7 +267,7 @@ async function devLocal(flags, slug) {
|
|
|
245
267
|
console.log(`Note: ai/services will be unavailable — could not reach the platform (${reason}).`);
|
|
246
268
|
}
|
|
247
269
|
const workerAttest = randomBytes(24).toString("base64url");
|
|
248
|
-
const { createSandbox } = await import("./local-
|
|
270
|
+
const { createSandbox } = await import("./local-Cyl39_Zu.mjs");
|
|
249
271
|
const sandbox = await createSandbox({
|
|
250
272
|
slug,
|
|
251
273
|
persistDir: join(flags.dir, ".canopy", "local"),
|
|
@@ -354,4 +376,4 @@ const devCommand = defineCommand({
|
|
|
354
376
|
})
|
|
355
377
|
});
|
|
356
378
|
//#endregion
|
|
357
|
-
export { rewriteApiPath as i, devCommand as n, devProxyHeaders as r, bridgeToSandbox as t };
|
|
379
|
+
export { rewriteApiPath as a, fetchDevUser as i, devCommand as n, devProxyHeaders as r, bridgeToSandbox as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-lYhex2Gp.mjs";
|
|
2
2
|
import { n as siteConfig } from "./site-DM2J10CB.mjs";
|
|
3
3
|
import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
|
|
4
4
|
import { r as reportErrors } from "./ui-C_jSc1Kz.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-lYhex2Gp.mjs";
|
|
2
2
|
import { a as projectDirArgs, c as resolveProject, d as tryResolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-DM2J10CB.mjs";
|
|
3
3
|
import { a as apiUpload, i as apiRequest, r as apiDownload } from "./api-C4rMhE7i.mjs";
|
|
4
4
|
import { r as reportErrors, t as formatDateTime } from "./ui-C_jSc1Kz.mjs";
|
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-lYhex2Gp.mjs";
|
|
3
3
|
import { r as siteHeaderLine, t as setInvocationProfile } from "./site-DM2J10CB.mjs";
|
|
4
4
|
import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
|
|
5
5
|
import { defineCommand, runMain } from "citty";
|
|
@@ -70,7 +70,7 @@ const main = defineCommand({
|
|
|
70
70
|
init: () => import("./projects-DQAhCZm8.mjs").then((m) => m.initCommand),
|
|
71
71
|
projects: () => import("./projects-DQAhCZm8.mjs").then((m) => m.projectsCommand),
|
|
72
72
|
delete: () => import("./projects-DQAhCZm8.mjs").then((m) => m.deleteCommand),
|
|
73
|
-
dev: () => import("./dev-
|
|
73
|
+
dev: () => import("./dev-BeFX_wc5.mjs").then((m) => m.devCommand),
|
|
74
74
|
deploy: () => import("./deploy-Ka2lHkyy.mjs").then((m) => m.deployCommand),
|
|
75
75
|
promote: () => import("./deploy-Ka2lHkyy.mjs").then((m) => m.promoteCommand),
|
|
76
76
|
staging: () => import("./staging-BZVty57b.mjs").then((m) => m.stagingCommand),
|
|
@@ -80,17 +80,17 @@ const main = defineCommand({
|
|
|
80
80
|
egress: () => import("./egress-If_Gsx_M.mjs").then((m) => m.egressCommand),
|
|
81
81
|
secrets: () => import("./secrets-BSEjZnxg.mjs").then((m) => m.secretsCommand),
|
|
82
82
|
schedule: () => import("./schedule-C5lMf3ny.mjs").then((m) => m.scheduleCommand),
|
|
83
|
-
feedback: () => import("./feedback-
|
|
83
|
+
feedback: () => import("./feedback-DzEKQlP6.mjs").then((m) => m.feedbackCommand),
|
|
84
84
|
db: () => import("./db-BB6O6085.mjs").then((m) => m.dbCommand),
|
|
85
85
|
usage: () => import("./usage-CUYrWxv0.mjs").then((m) => m.usageCommand),
|
|
86
86
|
ai: () => import("./ai-DHLnyqfq.mjs").then((m) => m.aiCommand),
|
|
87
87
|
open: () => import("./open-DcaQKi1v.mjs").then((m) => m.openCommand),
|
|
88
88
|
browse: () => import("./browse-Dycwj0V_.mjs").then((m) => m.browseCommand),
|
|
89
|
-
docs: () => import("./docs-
|
|
90
|
-
skill: () => import("./skill-
|
|
91
|
-
upgrade: () => import("./upgrade-
|
|
89
|
+
docs: () => import("./docs-Bb9hSk4h.mjs").then((m) => m.docsCommand),
|
|
90
|
+
skill: () => import("./skill-BUA2uRR2.mjs").then((m) => m.skillCommand),
|
|
91
|
+
upgrade: () => import("./upgrade-ZSb56qBJ.mjs").then((m) => m.upgradeCommand),
|
|
92
92
|
logs: () => import("./logs-DQQOawOG.mjs").then((m) => m.logsCommand),
|
|
93
|
-
mcp: () => import("./mcp-
|
|
93
|
+
mcp: () => import("./mcp-pNp-sbfJ.mjs").then((m) => m.mcpCommand),
|
|
94
94
|
repo: () => import("./repo-1RQ1vBMv.mjs").then((m) => m.repoCommand)
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as apiDataRequest } from "./api-C4rMhE7i.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-CxzGOEhP.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as rewriteApiPath } from "./dev-BdXslHoA.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,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-lYhex2Gp.mjs";
|
|
2
2
|
import { d as tryResolveProject, l as stagingUrl, n as siteConfig, s as projectUrl } from "./site-DM2J10CB.mjs";
|
|
3
3
|
import { i as apiRequest, t as ApiError } from "./api-C4rMhE7i.mjs";
|
|
4
4
|
import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-lYhex2Gp.mjs";
|
|
2
2
|
import { r as reportErrors } from "./ui-C_jSc1Kz.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
@@ -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-BUA2uRR2.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());
|
package/package.json
CHANGED
package/dist/dev-CID2LCES.mjs
DELETED