@mediamonks/canopy-cli 0.5.0 → 0.5.1

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-Bi5FfVSP.mjs";
2
+ import { t as version } from "./package-CHoZKzaw.mjs";
3
3
  import { r as siteHeaderLine, t as setInvocationProfile } from "./site-BJjoePQS.mjs";
4
4
  import { i as runRefresh, r as notifyOfUpdate } from "./version-check-Cuh6HaLX.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -73,9 +73,9 @@ const main = defineCommand({
73
73
  description: "canopy — create and deploy vibecoded projects"
74
74
  },
75
75
  subCommands: {
76
- login: () => import("./login-Bz-rwlFF.mjs").then((m) => m.loginCommand),
77
- whoami: () => import("./login-Bz-rwlFF.mjs").then((m) => m.whoamiCommand),
78
- logout: () => import("./login-Bz-rwlFF.mjs").then((m) => m.logoutCommand),
76
+ login: () => import("./login-BO6abf40.mjs").then((m) => m.loginCommand),
77
+ whoami: () => import("./login-BO6abf40.mjs").then((m) => m.whoamiCommand),
78
+ logout: () => import("./login-BO6abf40.mjs").then((m) => m.logoutCommand),
79
79
  create: () => import("./projects-ijfe7Ffx.mjs").then((m) => m.createCommand),
80
80
  init: () => import("./projects-ijfe7Ffx.mjs").then((m) => m.initCommand),
81
81
  projects: () => import("./projects-ijfe7Ffx.mjs").then((m) => m.projectsCommand),
@@ -89,8 +89,8 @@ const main = defineCommand({
89
89
  usage: () => import("./usage-DQpH7A3X.mjs").then((m) => m.usageCommand),
90
90
  open: () => import("./open-DnlYDqrU.mjs").then((m) => m.openCommand),
91
91
  docs: () => import("./docs-DvSPpSIR.mjs").then((m) => m.docsCommand),
92
- skill: () => import("./skill-IAAa2EkK.mjs").then((m) => m.skillCommand),
93
- upgrade: () => import("./upgrade-DNxR-zh7.mjs").then((m) => m.upgradeCommand),
92
+ skill: () => import("./skill-CW0QSbAJ.mjs").then((m) => m.skillCommand),
93
+ upgrade: () => import("./upgrade-CGz1yzsW.mjs").then((m) => m.upgradeCommand),
94
94
  logs: planned("logs", "Tail worker logs", "2")
95
95
  }
96
96
  });
@@ -4,6 +4,122 @@ import { defineCommand } from "citty";
4
4
  import * as p from "@clack/prompts";
5
5
  import { createHash, randomBytes } from "node:crypto";
6
6
  import { createServer } from "node:http";
7
+ //#region src/login-page.ts
8
+ /**
9
+ * Branded HTML for the local OneLogin PKCE callback (127.0.0.1:8976).
10
+ * Visual language matches apps/gateway/src/auth-page.ts.
11
+ */
12
+ function loginCallbackPage(ok) {
13
+ const title = ok ? "You're signed in" : "Sign-in didn’t finish";
14
+ return `<!doctype html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="utf-8">
18
+ <meta name="viewport" content="width=device-width, initial-scale=1">
19
+ <title>${title} · Canopy</title>
20
+ <style>
21
+ :root {
22
+ color-scheme: light;
23
+ --ink: #14201a;
24
+ --muted: #4a5c52;
25
+ --line: #d5ddd7;
26
+ --panel: rgba(255, 255, 255, 0.82);
27
+ --accent: #2f6b4f;
28
+ --bg0: #e8f0ea;
29
+ --bg1: #f7f5f0;
30
+ --bg2: #dfece3;
31
+ --mark-bg: ${ok ? "var(--accent)" : "#8a4b3a"};
32
+ }
33
+ * { box-sizing: border-box; }
34
+ body {
35
+ margin: 0;
36
+ min-height: 100vh;
37
+ font-family: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
38
+ color: var(--ink);
39
+ background:
40
+ radial-gradient(900px 480px at 12% -10%, var(--bg2), transparent 60%),
41
+ radial-gradient(700px 420px at 100% 0%, #e7efe4, transparent 55%),
42
+ linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #eef2ef);
43
+ display: grid;
44
+ place-items: center;
45
+ padding: 1.5rem;
46
+ }
47
+ main {
48
+ width: min(100%, 26rem);
49
+ background: var(--panel);
50
+ border: 1px solid var(--line);
51
+ border-radius: 1.25rem;
52
+ padding: 2rem 1.75rem 1.75rem;
53
+ backdrop-filter: blur(10px);
54
+ box-shadow: 0 18px 40px -28px rgba(20, 32, 26, 0.45);
55
+ }
56
+ .mark {
57
+ width: 2.75rem;
58
+ height: 2.75rem;
59
+ border-radius: 0.85rem;
60
+ display: grid;
61
+ place-items: center;
62
+ background: var(--mark-bg);
63
+ color: #f4faf6;
64
+ margin-bottom: 1.25rem;
65
+ }
66
+ .mark svg { width: 1.4rem; height: 1.4rem; display: block; }
67
+ .brand {
68
+ margin: 0 0 0.35rem;
69
+ font-size: 0.8rem;
70
+ font-weight: 600;
71
+ letter-spacing: 0.04em;
72
+ text-transform: uppercase;
73
+ color: var(--accent);
74
+ }
75
+ h1 {
76
+ margin: 0 0 0.75rem;
77
+ font-size: 1.45rem;
78
+ line-height: 1.25;
79
+ letter-spacing: -0.02em;
80
+ font-weight: 650;
81
+ }
82
+ p {
83
+ margin: 0;
84
+ color: var(--muted);
85
+ font-size: 0.975rem;
86
+ line-height: 1.55;
87
+ }
88
+ .hint {
89
+ margin-top: 1.35rem;
90
+ padding-top: 1rem;
91
+ border-top: 1px solid var(--line);
92
+ font-size: 0.8rem;
93
+ color: var(--muted);
94
+ }
95
+ kbd {
96
+ font: inherit;
97
+ font-size: 0.85em;
98
+ padding: 0.1em 0.35em;
99
+ border: 1px solid var(--line);
100
+ border-radius: 0.35rem;
101
+ background: rgba(255, 255, 255, 0.7);
102
+ }
103
+ </style>
104
+ </head>
105
+ <body>
106
+ <main>
107
+ <div class="mark">${ok ? `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
108
+ <path d="M20 6 9 17l-5-5"/>
109
+ </svg>` : `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
110
+ <circle cx="12" cy="12" r="9"/>
111
+ <path d="M12 8v5"/>
112
+ <path d="M12 16h.01"/>
113
+ </svg>`}</div>
114
+ <p class="brand">Canopy CLI</p>
115
+ <h1>${title}</h1>
116
+ <p>${ok ? "You can close this tab and return to the terminal — the CLI has your code." : "Return to the terminal and run canopy login again. Reloading this page won’t help."}</p>
117
+ <p class="hint">${ok ? "This tab only finishes the browser step — keep using the terminal for the rest." : "If the terminal still says it’s waiting, cancel with <kbd>Ctrl</kbd>+<kbd>C</kbd> and try again."}</p>
118
+ </main>
119
+ </body>
120
+ </html>`;
121
+ }
122
+ //#endregion
7
123
  //#region src/login.ts
8
124
  /**
9
125
  * canopy login | whoami | logout — browser PKCE flow against OneLogin (public
@@ -58,7 +174,10 @@ function waitForCallback(expectedState) {
58
174
  const code = url.searchParams.get("code");
59
175
  const state = url.searchParams.get("state");
60
176
  const ok = Boolean(code) && state === expectedState;
61
- res.writeHead(ok ? 200 : 400, { "content-type": "text/html" }).end(ok ? "<h1>Logged in</h1><p>You can close this tab and return to the terminal.</p>" : "<h1>Login failed</h1><p>Return to the terminal and try again.</p>");
177
+ res.writeHead(ok ? 200 : 400, {
178
+ "content-type": "text/html; charset=utf-8",
179
+ "cache-control": "no-store"
180
+ }).end(loginCallbackPage(ok));
62
181
  server.close();
63
182
  clearTimeout(timer);
64
183
  if (ok) resolve(code);
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.5.0";
2
+ var version = "0.5.1";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Bi5FfVSP.mjs";
1
+ import { t as version } from "./package-CHoZKzaw.mjs";
2
2
  import { n as reportErrors } from "./ui-DThlyHgo.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-IAAa2EkK.mjs");
115
+ const { skillInstalled } = await import("./skill-CW0QSbAJ.mjs");
116
116
  const refreshSkill = skillInstalled(process.cwd());
117
117
  console.log(`Upgrading via ${command}: ${command} ${cmd.join(" ")}`);
118
118
  await run(command, cmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"