@mediamonks/canopy-cli 0.7.62 → 0.7.63

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.
@@ -17,6 +17,7 @@ canopy preview off
17
17
  canopy preview image <file>
18
18
  canopy preview image --remove
19
19
  canopy preview icon <file>
20
+ canopy preview icon <svg-file> --png <png-file>
20
21
  canopy preview icon --remove
21
22
  ```
22
23
 
@@ -37,16 +38,20 @@ them.
37
38
  - `icon <file>`: a square logo for the browser tab and the dashboard. PNG,
38
39
  WebP, ICO or SVG, up to 256 KB. An SVG with scripts, event handlers,
39
40
  embedded HTML or links to other files is refused. `--remove` takes it away.
41
+ - `--png <file>` (with `icon`): a PNG version of an SVG icon. Chat apps don't
42
+ show SVG icons, so without one shared links show no icon. The dashboard
43
+ makes it for you when you upload the SVG there.
40
44
 
41
45
  ## Examples
42
46
 
43
47
  ```bash
44
- canopy preview icon logo.svg
48
+ canopy preview icon logo.svg --png logo.png
45
49
  canopy preview image card.png
46
50
  canopy preview on
47
51
  ```
48
52
 
49
- Sets an icon and a preview image, then turns the preview on.
53
+ Sets an SVG icon with its PNG version for chat apps and a preview image, then
54
+ turns the preview on.
50
55
 
51
56
  ```bash
52
57
  canopy preview off --project retro-board
@@ -51,3 +51,9 @@ their coloured initials.
51
51
  SVG icons must be plain pictures. An SVG with scripts, event handlers,
52
52
  embedded HTML or links to other files is refused; exporting it again from a
53
53
  design tool usually fixes that.
54
+
55
+ Chat apps don't show SVG icons. When you upload an SVG in Settings, the
56
+ dashboard also makes a PNG version for chat apps, and shared links use that.
57
+ If your SVG icon was added before that, or from the CLI, Settings shows a
58
+ **Make a PNG version** button. From the CLI, add one with
59
+ `canopy preview icon logo.svg --png logo.png`.
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Cc9gi9C-.mjs";
1
+ import { t as version } from "./package-sCoeuYM_.mjs";
2
2
  import { r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
4
  import { n as agentHeaders } from "./api-C2cvuMD1.mjs";
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Cc9gi9C-.mjs";
1
+ import { t as version } from "./package-sCoeuYM_.mjs";
2
2
  import { f as resolveProject, g as tryResolveProject, h as tryReadCanopyJson, l as projectDirArgs, r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-C2cvuMD1.mjs";
4
4
  import { i as reportErrors, n as formatDateTime } from "./ui-CVzXhfWN.mjs";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-Cc9gi9C-.mjs";
2
+ import { t as version } from "./package-sCoeuYM_.mjs";
3
3
  import { i as siteHeaderLine, n as setInvocationProfile } from "./site-Bz-fEyKS.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -74,22 +74,22 @@ const main = defineCommand({
74
74
  roles: () => import("./roles-wEgE5ICf.mjs").then((m) => m.rolesCommand),
75
75
  members: () => import("./roles-wEgE5ICf.mjs").then((m) => m.membersCommand),
76
76
  schedule: () => import("./schedule-D6tTBal3.mjs").then((m) => m.scheduleCommand),
77
- feedback: () => import("./feedback-w28FscrZ.mjs").then((m) => m.feedbackCommand),
77
+ feedback: () => import("./feedback-CD-it40n.mjs").then((m) => m.feedbackCommand),
78
78
  db: () => import("./db-BKo39uJt.mjs").then((m) => m.dbCommand),
79
79
  files: () => import("./files-DVFs1rmn.mjs").then((m) => m.filesCommand),
80
80
  usage: () => import("./usage-DcDBqrLf.mjs").then((m) => m.usageCommand),
81
81
  ai: () => import("./ai-CGYbKeZq.mjs").then((m) => m.aiCommand),
82
82
  open: () => import("./open-B2fimu3z.mjs").then((m) => m.openCommand),
83
83
  browse: () => import("./browse-CAidI-BT.mjs").then((m) => m.browseCommand),
84
- docs: () => import("./docs-D1SWYMZ-.mjs").then((m) => m.docsCommand),
85
- skill: () => import("./skill-BUWRlQd3.mjs").then((m) => m.skillCommand),
86
- upgrade: () => import("./upgrade-B-ELQVun.mjs").then((m) => m.upgradeCommand),
84
+ docs: () => import("./docs-HB4AzryH.mjs").then((m) => m.docsCommand),
85
+ skill: () => import("./skill-DIiVaOl6.mjs").then((m) => m.skillCommand),
86
+ upgrade: () => import("./upgrade-BHhEx9h6.mjs").then((m) => m.upgradeCommand),
87
87
  logs: () => import("./logs-DTXFm5DB.mjs").then((m) => m.logsCommand),
88
- mcp: () => import("./mcp-LQyQtnsW.mjs").then((m) => m.mcpCommand),
88
+ mcp: () => import("./mcp-D8rMLltM.mjs").then((m) => m.mcpCommand),
89
89
  repo: () => import("./repo-xl6Rb6BC.mjs").then((m) => m.repoCommand),
90
90
  template: () => import("./project-template-Ckh8JDkS.mjs").then((m) => m.templateCommand),
91
91
  audience: () => import("./audience-BspIO-MA.mjs").then((m) => m.audienceCommand),
92
- preview: () => import("./preview-BRehGrPg.mjs").then((m) => m.previewCommand)
92
+ preview: () => import("./preview-C7AYjcx7.mjs").then((m) => m.previewCommand)
93
93
  }
94
94
  });
95
95
  const quiet = process.argv[2] === "mcp" && process.argv[3] === "serve" || process.argv[2] === "repo" && process.argv[3] === "credential";
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Cc9gi9C-.mjs";
1
+ import { t as version } from "./package-sCoeuYM_.mjs";
2
2
  import { d as projectUrl, g as tryResolveProject, m as stagingUrl, r as siteConfig } from "./site-Bz-fEyKS.mjs";
3
3
  import { a as apiRequest, f as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-C2cvuMD1.mjs";
4
4
  import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.7.62";
2
+ var version = "0.7.63";
3
3
  //#endregion
4
4
  export { version as t };
@@ -16,7 +16,8 @@ import * as p from "@clack/prompts";
16
16
  const FIXES = {
17
17
  unsupported_image_type: "A preview image must be PNG, JPEG or WebP; an icon PNG, WebP, ICO or SVG.",
18
18
  unsafe_svg: "Use a plain SVG: no scripts, event handlers, embedded HTML or links to other files. Exporting it again from a design tool usually does it.",
19
- image_too_large: "A preview image can be up to 1 MB, an icon up to 256 KB."
19
+ image_too_large: "A preview image can be up to 1 MB, an icon up to 256 KB.",
20
+ icon_not_svg: "The PNG version is only for an SVG icon; upload the PNG as the icon instead."
20
21
  };
21
22
  function size(bytes) {
22
23
  return bytes < 1024 * 1024 ? `${Math.max(1, Math.round(bytes / 1024))} KB` : `${(bytes / 1024 / 1024).toFixed(1)} MB`;
@@ -36,7 +37,8 @@ function describePreview(slug, settings) {
36
37
  return [
37
38
  settings.link_preview ? `Link preview is on: shared links to ${slug} show its name, description, image and icon.` : `Link preview is off: shared links to ${slug} show "${slug} · Sign in · Canopy".`,
38
39
  fileLine("Preview image", settings.image),
39
- fileLine("Icon", settings.icon)
40
+ fileLine("Icon", settings.icon),
41
+ ...settings.icon?.content_type === "image/svg+xml" ? [settings.icon_png ? fileLine("Icon for chat apps", settings.icon_png) : "Icon for chat apps: none. Chat apps don't show SVG icons; add one with `canopy preview icon <svg> --png <png>`."] : []
40
42
  ];
41
43
  }
42
44
  /** A content-type hint from the file name; the platform reads the bytes anyway. */
@@ -94,6 +96,10 @@ function fileCommand(kind) {
94
96
  type: "boolean",
95
97
  description: `Remove the ${what}`
96
98
  },
99
+ ...kind === "icon" ? { png: {
100
+ type: "string",
101
+ description: "A PNG version of an SVG icon, for chat apps that don't show SVG"
102
+ } } : {},
97
103
  ...projectFlagArgs
98
104
  },
99
105
  run: reportErrors(`preview ${kind}`, async ({ args }) => {
@@ -113,6 +119,15 @@ function fileCommand(kind) {
113
119
  fixes: FIXES
114
120
  });
115
121
  p.log.success(fileLine(kind === "image" ? "Preview image" : "Icon", settings[kind]));
122
+ const png = args.png;
123
+ if (kind === "icon" && settings.icon?.content_type === "image/svg+xml") if (png) {
124
+ const withPng = await withContext(apiUpload(`/projects/${slug}/preview/icon-png`, new Uint8Array(readFileSync(png)), "image/png", "PUT"), {
125
+ action: `upload ${basename(png)}`,
126
+ fixes: FIXES
127
+ });
128
+ p.log.success(fileLine("Icon for chat apps", withPng.icon_png ?? null));
129
+ } else p.log.warn("Chat apps don't show SVG icons. Add a PNG version with --png <file>, or upload the icon in the dashboard, which makes one for you.");
130
+ else if (kind === "icon" && png) p.log.info("--png is only for an SVG icon; this icon already works in chat apps.");
116
131
  if (!settings.link_preview) p.log.info(kind === "icon" ? "It is the project's mark on the dashboard now. Shared links show it once you run `canopy preview on`." : "Shared links show it once you run `canopy preview on`.");
117
132
  })
118
133
  });
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-Cc9gi9C-.mjs";
1
+ import { t as version } from "./package-sCoeuYM_.mjs";
2
2
  import { i as reportErrors } from "./ui-CVzXhfWN.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-BUWRlQd3.mjs");
115
+ const { skillInstalled } = await import("./skill-DIiVaOl6.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.7.62",
3
+ "version": "0.7.63",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"