@creator-notes/cnotes 0.125.5 → 0.125.7
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/.claude-plugin/plugin.json +1 -1
- package/dist/commands/canvas.js +30 -35
- package/dist/commands/notes.js +3 -9
- package/dist/lib/mcp-spec.js +636 -0
- package/dist/lib/section-update.js +21 -0
- package/dist/mcp-server.js +89 -326
- package/package.json +1 -1
- package/skills/cnotes/references/canvas.md +3 -1
package/dist/commands/canvas.js
CHANGED
|
@@ -17,6 +17,8 @@ import { findOverlaps, findFrameSpills, layoutItemsFrom, parseSize, resolveAncho
|
|
|
17
17
|
import { canvasUrl, canvasLinkForRef } from "../lib/urls.js";
|
|
18
18
|
import { CANVAS_GOAL_DESCRIPTION } from "../lib/canvas-goal.js";
|
|
19
19
|
import { canvasActionPath, commentsListPath, parseCommentStatus, } from "../lib/canvas-paths.js";
|
|
20
|
+
import { buildSectionUpdateRequest, CLI_SECTION_WORDING } from "../lib/section-update.js";
|
|
21
|
+
import { arrowToMarkers } from "../lib/mcp-spec.js";
|
|
20
22
|
import { registerCanvasMilestoneCommands } from "./canvas-milestone.js";
|
|
21
23
|
import { DISPLAY_ID_CORE } from "../lib/display-id.js";
|
|
22
24
|
import { resolveNoteBatchItems } from "../lib/note-batch.js";
|
|
@@ -358,19 +360,13 @@ function printRippleSummary(ripple, dryRun = false) {
|
|
|
358
360
|
console.error(`Warning: the grown frame now overlaps ${r.blocked.length} straddling item(s) that could not shift without breaking their own context: ${names}. Reflow them (arrange / bulk-move) and re-check with canvas get.`);
|
|
359
361
|
}
|
|
360
362
|
}
|
|
363
|
+
const ARROW_MODES = ["end", "start", "both", "none"];
|
|
364
|
+
/** `--arrow` as arrowStart/arrowEnd, the same mapping the MCP tools use (lib/mcp-spec.ts). */
|
|
361
365
|
function parseArrowMode(mode) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return { arrowStart: false, arrowEnd: true };
|
|
365
|
-
case "start":
|
|
366
|
-
return { arrowStart: true, arrowEnd: false };
|
|
367
|
-
case "both":
|
|
368
|
-
return { arrowStart: true, arrowEnd: true };
|
|
369
|
-
case "none":
|
|
370
|
-
return { arrowStart: false, arrowEnd: false };
|
|
371
|
-
default:
|
|
372
|
-
throw new ValidationError(`Invalid --arrow value "${mode}". Expected one of: end, start, both, none.`);
|
|
366
|
+
if (!ARROW_MODES.includes(mode)) {
|
|
367
|
+
throw new ValidationError(`Invalid --arrow value "${mode}". Expected one of: end, start, both, none.`);
|
|
373
368
|
}
|
|
369
|
+
return arrowToMarkers(mode);
|
|
374
370
|
}
|
|
375
371
|
function parseLineStyle(style) {
|
|
376
372
|
if (style === "solid" || style === "dashed")
|
|
@@ -2425,8 +2421,8 @@ Examples:
|
|
|
2425
2421
|
.argument("<canvasId>", "Canvas ID")
|
|
2426
2422
|
.requiredOption("--section <id>", "Section to update — SECTION-<n> display ID or a raw node ID")
|
|
2427
2423
|
.option("--name <name>", "New frame title (title case)")
|
|
2428
|
-
.option("--x <n>", "
|
|
2429
|
-
.option("--y <n>", "
|
|
2424
|
+
.option("--x <n>", "Move the frame and everything inside it: new X (top-left). Send with --y, on their own")
|
|
2425
|
+
.option("--y <n>", "Move the frame and everything inside it: new Y (top-left). Send with --x, on their own")
|
|
2430
2426
|
.option("--width <n>", "New frame width in px")
|
|
2431
2427
|
.option("--height <n>", "New frame height in px")
|
|
2432
2428
|
.option("--color <hex>", "New frame tint hex")
|
|
@@ -2445,6 +2441,9 @@ Examples:
|
|
|
2445
2441
|
|
|
2446
2442
|
# Rename without touching the id or anything inside it
|
|
2447
2443
|
$ cnotes canvas update-section CANVAS-250 --section SECTION-51 --name "Open Questions"
|
|
2444
|
+
|
|
2445
|
+
# Move the frame and the cards inside it (both axes, nothing else in the call)
|
|
2446
|
+
$ cnotes canvas update-section CANVAS-250 --section SECTION-51 --x 400 --y 2600
|
|
2448
2447
|
`)
|
|
2449
2448
|
.action(async (canvasId, opts) => {
|
|
2450
2449
|
const cfg = resolveConfig(program.opts());
|
|
@@ -2460,33 +2459,29 @@ Examples:
|
|
|
2460
2459
|
}
|
|
2461
2460
|
return n;
|
|
2462
2461
|
};
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
body.height = numeric("height", opts.height);
|
|
2477
|
-
// '' is the server's "clear the tint" sentinel.
|
|
2478
|
-
if (opts.clearColor)
|
|
2479
|
-
body.colorHex = "";
|
|
2480
|
-
else if (typeof opts.color === "string")
|
|
2481
|
-
body.colorHex = opts.color;
|
|
2482
|
-
if (opts.ripple === false)
|
|
2483
|
-
body.ripple = false;
|
|
2462
|
+
// x/y go to the move action, which carries the cards inside the
|
|
2463
|
+
// frame; every other field is an in-place update (lib/section-update.ts).
|
|
2464
|
+
const request = buildSectionUpdateRequest({
|
|
2465
|
+
sectionId: opts.section,
|
|
2466
|
+
name: typeof opts.name === "string" ? opts.name : undefined,
|
|
2467
|
+
x: opts.x !== undefined ? numeric("x", opts.x) : undefined,
|
|
2468
|
+
y: opts.y !== undefined ? numeric("y", opts.y) : undefined,
|
|
2469
|
+
width: opts.width !== undefined ? numeric("width", opts.width) : undefined,
|
|
2470
|
+
height: opts.height !== undefined ? numeric("height", opts.height) : undefined,
|
|
2471
|
+
// '' is the server's "clear the tint" sentinel.
|
|
2472
|
+
colorHex: opts.clearColor ? "" : typeof opts.color === "string" ? opts.color : undefined,
|
|
2473
|
+
ripple: opts.ripple === false ? false : undefined,
|
|
2474
|
+
}, CLI_SECTION_WORDING);
|
|
2484
2475
|
// workspaceId is what lets the server resolve a CANVAS-<n> handle (the
|
|
2485
2476
|
// form every example here uses) rather than demanding a raw Convex id.
|
|
2486
|
-
const data = await api.post(canvasActionPath(canvasId, cfg.workspaceId), body);
|
|
2477
|
+
const data = await api.post(canvasActionPath(canvasId, cfg.workspaceId), request.body);
|
|
2487
2478
|
if (cfg.json) {
|
|
2488
2479
|
outputJson(data);
|
|
2489
2480
|
}
|
|
2481
|
+
else if (request.kind === "move") {
|
|
2482
|
+
const moved = typeof data.movedNodeCount === "number" ? data.movedNodeCount : 0;
|
|
2483
|
+
console.log(`Moved section ${opts.section} with ${moved} item${moved === 1 ? "" : "s"} inside it`);
|
|
2484
|
+
}
|
|
2490
2485
|
else {
|
|
2491
2486
|
console.log(`Updated section ${opts.section}`);
|
|
2492
2487
|
printRippleSummary(data.ripple);
|
package/dist/commands/notes.js
CHANGED
|
@@ -14,6 +14,7 @@ import { describeUnresolvedMentions, lintNarratedVerbMentions, lintPlainTextDisp
|
|
|
14
14
|
import { attachRubricsToResults, loadRubricMap, rubricsForTypes, } from "../lib/rubrics.js";
|
|
15
15
|
import { DECISION_CARD_RULE, } from "../lib/decision-citation.js";
|
|
16
16
|
import { registerNotesImport } from "./notes-import.js";
|
|
17
|
+
import { orderByDisplayId } from "../lib/mcp-spec.js";
|
|
17
18
|
export function registerNotesCommands(program) {
|
|
18
19
|
const notes = program
|
|
19
20
|
.command("notes")
|
|
@@ -182,13 +183,8 @@ paragraph after headings and chip-only lines. JSON is an object
|
|
|
182
183
|
exact_ids: ids.join(","),
|
|
183
184
|
format: "markdown",
|
|
184
185
|
});
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
for (const n of found) {
|
|
188
|
-
if (typeof n.displayId === "string")
|
|
189
|
-
byDisplayId.set(n.displayId, n);
|
|
190
|
-
}
|
|
191
|
-
const missing = ids.filter((id) => !byDisplayId.has(id));
|
|
186
|
+
// In input order, so callers can index by position.
|
|
187
|
+
const { ordered, missing } = orderByDisplayId(ids, notesList);
|
|
192
188
|
if (missing.length > 0) {
|
|
193
189
|
// A note written in one of your drafts has its id from the start but
|
|
194
190
|
// lives in the draft until it lands: say which proposal holds it.
|
|
@@ -207,8 +203,6 @@ paragraph after headings and chip-only lines. JSON is an object
|
|
|
207
203
|
}
|
|
208
204
|
throw new NotFoundError(`Notes not found: ${missing.join(", ")}`, "Run `cnotes notes list` to see valid display IDs in this workspace.");
|
|
209
205
|
}
|
|
210
|
-
// Preserve input order so callers can index by position.
|
|
211
|
-
const ordered = ids.map((id) => byDisplayId.get(id));
|
|
212
206
|
if (opts.contentOnly) {
|
|
213
207
|
// Raw markdown only — no JSON envelope, no chrome. When several notes
|
|
214
208
|
// are requested, delimit each with an HTML comment (valid markdown,
|