@creator-notes/cnotes 0.117.0 → 0.117.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creator-notes-cli",
3
- "version": "0.117.0",
3
+ "version": "0.117.1",
4
4
  "description": "CreatorNotes CLI: create notes, build canvases, search knowledge from the terminal",
5
5
  "author": {
6
6
  "name": "CreatorNotes",
@@ -5,6 +5,7 @@ import { resolveConfig } from "../lib/config.js";
5
5
  import { handleError, ValidationError, ApiError, CliError, EXIT_CODES, } from "../lib/errors.js";
6
6
  import { outputJson, outputQuiet } from "../lib/output.js";
7
7
  import { extractStorageId } from "../lib/storage-id.js";
8
+ import { unsupportedImageTypeMessage } from "../lib/image-types.js";
8
9
  const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
9
10
  const MIME_MAP = {
10
11
  ".jpg": "image/jpeg",
@@ -134,7 +135,7 @@ Examples:
134
135
  const mimeType = getMimeType(absPath);
135
136
  if (!mimeType) {
136
137
  const ext = path.extname(absPath) || "(none)";
137
- throw new ValidationError(`Unsupported file type: ${ext}. Allowed: .jpg, .jpeg, .png, .gif, .webp`);
138
+ throw new ValidationError(unsupportedImageTypeMessage(ext));
138
139
  }
139
140
  // Read file into memory once; build fresh FormData per attempt for retry safety
140
141
  const buffer = readFileSync(absPath);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The refusal `files upload` and the stdio MCP server's `cnotes_files_upload`
3
+ * give for a file the server will not store. SVG gets its own reason because
4
+ * diagram renderers (Mermaid via Pele, statechart skills) emit it and an agent
5
+ * attaching a diagram reaches for it first; the server refuses SVG because an
6
+ * SVG file can carry script. Mirrors SVG_UPLOAD_REFUSAL in
7
+ * lib/image-constraints.ts (the CLI cannot import the app's lib).
8
+ */
9
+ export function unsupportedImageTypeMessage(ext) {
10
+ if (ext.toLowerCase() === ".svg") {
11
+ return ("SVG isn't accepted, because an SVG file can carry scripts. Convert it to PNG first " +
12
+ "(for example `rsvg-convert -o diagram.png diagram.svg`) and upload the PNG.");
13
+ }
14
+ return `Unsupported file type: ${ext}. Allowed: .jpg, .jpeg, .png, .gif, .webp`;
15
+ }
@@ -38,6 +38,7 @@ import { parseReviewRef } from "./lib/review-helpers.js";
38
38
  import { runQuery } from "./commands/query.js";
39
39
  import { isLocalDbEnabled } from "./lib/auth-store.js";
40
40
  import { explainTruncation, listNotes, SERVER_LIST_CAP } from "./lib/notes-list.js";
41
+ import { unsupportedImageTypeMessage } from "./lib/image-types.js";
41
42
  // ---------------------------------------------------------------------------
42
43
  // Environment
43
44
  // ---------------------------------------------------------------------------
@@ -1404,7 +1405,7 @@ const FILE_MIME_MAP = {
1404
1405
  ".gif": "image/gif",
1405
1406
  ".webp": "image/webp",
1406
1407
  };
1407
- server.tool("cnotes_files_upload", "Upload an image file to the workspace. Returns the public URL. Supports .jpg, .jpeg, .png, .gif, .webp (max 5MB).", {
1408
+ server.tool("cnotes_files_upload", "Upload an image file to the workspace. Returns the public URL. Supports .jpg, .jpeg, .png, .gif, .webp (max 5MB). Convert an SVG to PNG first.", {
1408
1409
  filePath: z.string().describe("Absolute path to the image file on disk"),
1409
1410
  }, async ({ filePath }) => withErrorHandling(async () => {
1410
1411
  const absPath = path.resolve(filePath);
@@ -1423,7 +1424,7 @@ server.tool("cnotes_files_upload", "Upload an image file to the workspace. Retur
1423
1424
  const ext = path.extname(absPath).toLowerCase();
1424
1425
  const mimeType = FILE_MIME_MAP[ext];
1425
1426
  if (!mimeType)
1426
- throw new Error(`Unsupported file type: ${ext}. Allowed: .jpg, .jpeg, .png, .gif, .webp`);
1427
+ throw new Error(unsupportedImageTypeMessage(ext));
1427
1428
  const buffer = readFileSync(absPath);
1428
1429
  const filename = path.basename(absPath);
1429
1430
  const buildFormData = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creator-notes/cnotes",
3
- "version": "0.117.0",
3
+ "version": "0.117.1",
4
4
  "description": "CLI for CreatorNotes — create notes, build canvases, search knowledge from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -90,6 +90,7 @@ is by design, not a bug — there is nothing to open.
90
90
  ## Files (`cnotes files` / `cnotes f`)
91
91
  ```bash
92
92
  # Upload an image to the workspace (max 5MB, supports .jpg .jpeg .png .gif .webp)
93
+ # An SVG (a rendered diagram, say) is refused: convert it first, e.g. rsvg-convert -o diagram.png diagram.svg
93
94
  cnotes files upload <path> [--markdown] # --markdown outputs ![filename](url) syntax
94
95
 
95
96
  # Read an image that's INSIDE a note. A note's content prints images as