@creator-notes/cnotes 0.150.0 → 0.152.0
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/brief.js +15 -1
- package/dist/commands/canvas.js +11 -7
- package/dist/commands/operations.js +7 -0
- package/dist/lib/api-client.js +3 -0
- package/dist/lib/board-checks.js +21 -3
- package/dist/lib/session-brief.js +77 -5
- package/dist/lib/shared-rows.js +2 -1
- package/dist/lib/update-notice.js +56 -0
- package/dist/mcp-server.js +2 -2
- package/package.json +1 -1
- package/skills/cnotes/SKILL.md +1 -1
- package/skills/cnotes/references/canvas-layout.md +2 -2
- package/skills/cnotes/references/canvas.md +10 -6
- package/skills/cnotes/references/operations.md +3 -1
package/dist/commands/brief.js
CHANGED
|
@@ -4,6 +4,8 @@ import { handleError, ValidationError } from "../lib/errors.js";
|
|
|
4
4
|
import { outputJson } from "../lib/output.js";
|
|
5
5
|
import { BEFORE_WRITING, briefIsEmpty, loadSessionBrief, renderBrief } from "../lib/session-brief.js";
|
|
6
6
|
import { conventionBriefLines, fetchConventions } from "../lib/conventions.js";
|
|
7
|
+
import { printUpdateNotice } from "../lib/update-notice.js";
|
|
8
|
+
import { isCompiledBinary } from "../lib/runtime.js";
|
|
7
9
|
/**
|
|
8
10
|
* `cnotes brief "<task>"`: what the workspace already knows about a task,
|
|
9
11
|
* before you act on it. The same brief `operations begin --prompt` returns,
|
|
@@ -23,10 +25,17 @@ brief, so you only need this when you are not opening a run. It opens with
|
|
|
23
25
|
the workspace's conventions, one title each (conventions.rules in --json): the
|
|
24
26
|
title is the rule, and \`cnotes notes get <id>\` has the why. A canvas whose
|
|
25
27
|
goal has been judged carries a "done:" line (canvases[].done in --json): met,
|
|
26
|
-
partly met or not met, and each part of its Done when that is not true yet.
|
|
28
|
+
partly met or not met, and each part of its Done when that is not true yet. A
|
|
29
|
+
canvas that holds two or more of the notes found is listed as well, with how
|
|
30
|
+
many it holds (canvases[].holds in --json): that is where the next note on the
|
|
31
|
+
topic belongs. The
|
|
27
32
|
brief ends on one line, beforeWriting in --json: name the kind of request
|
|
28
33
|
before you write.
|
|
29
34
|
|
|
35
|
+
When this cnotes is older than the one the server was deployed with, a line on
|
|
36
|
+
stderr says so and names the update command. CNOTES_NO_UPDATE_CHECK=1 turns it
|
|
37
|
+
off.
|
|
38
|
+
|
|
30
39
|
Examples:
|
|
31
40
|
$ cnotes brief "set the Amplitude API key in production"
|
|
32
41
|
$ cnotes brief "reprice the Team plan" --json
|
|
@@ -43,6 +52,11 @@ Examples:
|
|
|
43
52
|
fetchConventions(api, cfg.workspaceId),
|
|
44
53
|
]);
|
|
45
54
|
const result = brief ?? { query: task, notes: [], canvases: [], changes: [] };
|
|
55
|
+
// On stderr, before the brief: an agent that is behind should hear it first.
|
|
56
|
+
printUpdateNotice(program.version() ?? "", {
|
|
57
|
+
compiledBinary: isCompiledBinary(),
|
|
58
|
+
installUrl: `${cfg.serverUrl.replace(/\/+$/, "")}/install.sh`,
|
|
59
|
+
});
|
|
46
60
|
if (cfg.json) {
|
|
47
61
|
outputJson({ ...(conventions ? { conventions } : {}), ...result, beforeWriting: BEFORE_WRITING });
|
|
48
62
|
return;
|
package/dist/commands/canvas.js
CHANGED
|
@@ -786,12 +786,16 @@ Examples:
|
|
|
786
786
|
Sections are containers: they are listed, but a card inside one is not an
|
|
787
787
|
overlap. Read-only.
|
|
788
788
|
|
|
789
|
-
The read check says how many characters \`cnotes canvas read\`
|
|
790
|
-
board and whether that fits one tool result (100,000 characters).
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
789
|
+
The read check says how many characters \`cnotes canvas read\` prints for this
|
|
790
|
+
board as JSON and whether that fits one tool result (100,000 characters). It
|
|
791
|
+
also says what a plain \`canvas read\` answers with: every body, or a map once
|
|
792
|
+
the markdown passes 60,000 characters (read.readsAs "bodies" or "map" and
|
|
793
|
+
read.markdownChars in --json). The link check lists mentions that show a title
|
|
794
|
+
their note no longer has, quote cards pinned to a version their note has moved
|
|
795
|
+
past, arrows between two notes that no note body records, and mentions with no
|
|
796
|
+
relationship type (a \`references\` mention reads back as one). It looks only
|
|
797
|
+
at mentions of notes on this canvas. Each finding comes with its fix. --json
|
|
798
|
+
carries them as read and links.
|
|
795
799
|
|
|
796
800
|
Examples:
|
|
797
801
|
$ cnotes canvas status CANVAS-361
|
|
@@ -813,7 +817,7 @@ Examples:
|
|
|
813
817
|
? Promise.resolve(null)
|
|
814
818
|
: api.get("/api/canvas/read", { canvas: canvasId, workspaceId: cfg.workspaceId }),
|
|
815
819
|
]);
|
|
816
|
-
const checks = read ? boardChecks(read.result) : null;
|
|
820
|
+
const checks = read ? boardChecks(read.result, read.markdown) : null;
|
|
817
821
|
const items = layoutItemsFrom(data);
|
|
818
822
|
const overlaps = findOverlaps(items);
|
|
819
823
|
const spills = findFrameSpills(items);
|
|
@@ -9,6 +9,8 @@ import { loadConfig, setActiveAgentRunId, registerAgentRun, unregisterAgentRun,
|
|
|
9
9
|
import { resolveHostAgentSession } from "../lib/claude-session.js";
|
|
10
10
|
import { allWorkspaceRubrics, loadRubricMap } from "../lib/rubrics.js";
|
|
11
11
|
import { BEFORE_STOPPING, BEFORE_WRITING, briefIsEmpty, loadSessionBrief, renderBrief } from "../lib/session-brief.js";
|
|
12
|
+
import { printUpdateNotice } from "../lib/update-notice.js";
|
|
13
|
+
import { isCompiledBinary } from "../lib/runtime.js";
|
|
12
14
|
import { conventionBriefLines, fetchConventions } from "../lib/conventions.js";
|
|
13
15
|
import { hasLessonFlags, lessonsFromFlags, postLessons, renderRecorded } from "../lib/lessons.js";
|
|
14
16
|
import { renderProposalsForCaller } from "../lib/waiting-proposals.js";
|
|
@@ -169,6 +171,11 @@ start fresh, or --detached to open your own run alongside it.
|
|
|
169
171
|
opts.brief === false ? Promise.resolve(null) : fetchConventions(api, cfg.workspaceId),
|
|
170
172
|
]);
|
|
171
173
|
const typeRubrics = allWorkspaceRubrics(rubricMap);
|
|
174
|
+
// A cnotes behind the server says so before the work starts, -q or not.
|
|
175
|
+
printUpdateNotice(program.version() ?? "", {
|
|
176
|
+
compiledBinary: isCompiledBinary(),
|
|
177
|
+
installUrl: `${cfg.serverUrl.replace(/\/+$/, "")}/install.sh`,
|
|
178
|
+
});
|
|
172
179
|
reportHeadlineWarnings(readHeadlineWarnings(result));
|
|
173
180
|
// Proposals waiting on the caller, and the ones that overlap, reach
|
|
174
181
|
// the agent even under -q (on stderr), so it hears of another agent's
|
package/dist/lib/api-client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { ApiError, asCliError, CliError, EXIT_CODES, isPermanentNetworkError, isRefusedBeforeSend } from "./errors.js";
|
|
3
3
|
import { noteTrialStarted } from "./trial-notice.js";
|
|
4
|
+
import { noteServerCliVersion } from "./update-notice.js";
|
|
4
5
|
import { loadConfig, getActiveAgentRunId, getServerConfig } from "./auth-store.js";
|
|
5
6
|
import { inPlaceProposalId, resolveProposal } from "./config.js";
|
|
6
7
|
import { detectAgentClient } from "./agent-client.js";
|
|
@@ -190,6 +191,8 @@ export class ApiClient {
|
|
|
190
191
|
if (res.ok || !isRetryable(res.status) || (!replaySafe && res.status !== 429)) {
|
|
191
192
|
// A write that started the workspace's free trial says so (trial-notice.ts).
|
|
192
193
|
noteTrialStarted(res.headers);
|
|
194
|
+
// The cnotes version the server ships with, for the update notice (update-notice.ts).
|
|
195
|
+
noteServerCliVersion(res.headers);
|
|
193
196
|
return res;
|
|
194
197
|
}
|
|
195
198
|
// Retryable server error — wait and retry
|
package/dist/lib/board-checks.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* Only what this board holds can be checked: a mention of a note that is not on
|
|
17
17
|
* the board is skipped, since its current title is not in the read.
|
|
18
18
|
*/
|
|
19
|
+
import { CANVAS_READ_BUDGET } from "./share-link.js";
|
|
19
20
|
/** What one tool result holds, in characters (about 25,000 tokens). */
|
|
20
21
|
export const ONE_RESULT_CHARS = 100_000;
|
|
21
22
|
const str = (v) => (typeof v === "string" ? v : "");
|
|
@@ -30,7 +31,7 @@ function labelOf(el) {
|
|
|
30
31
|
const TITLED_MENTION = /\[([^\]\[:]+?)(@v\d+)?: ([^\]]+)\]\(relationship:[a-z0-9-]+\)/g;
|
|
31
32
|
/** `[[TARGET]]`: a mention with no relationship type. `[[verb::TARGET]]` carries `::` and is typed. */
|
|
32
33
|
const BARE_MENTION = /\[\[([^\]\[|:]+)\]\]/g;
|
|
33
|
-
export function boardChecks(result) {
|
|
34
|
+
export function boardChecks(result, markdown) {
|
|
34
35
|
const root = (result ?? {});
|
|
35
36
|
const elements = (Array.isArray(root.elements) ? root.elements : []);
|
|
36
37
|
const edges = (Array.isArray(root.edges) ? root.edges : []);
|
|
@@ -96,8 +97,13 @@ export function boardChecks(result) {
|
|
|
96
97
|
continue;
|
|
97
98
|
unmirroredArrows.push({ from: a, to: b, label: typeof edge.label === "string" ? edge.label : null });
|
|
98
99
|
}
|
|
100
|
+
// `canvas read` steps back to a map by the markdown's length, not the
|
|
101
|
+
// JSON's, so a board can fit one tool result here and still read as a map.
|
|
102
|
+
const readsAs = typeof markdown === "string"
|
|
103
|
+
? { markdownChars: markdown.length, readsAs: markdown.length <= CANVAS_READ_BUDGET ? "bodies" : "map" }
|
|
104
|
+
: {};
|
|
99
105
|
return {
|
|
100
|
-
read: { chars, approxTokens: Math.round(chars / 4), fitsOneResult: chars <= ONE_RESULT_CHARS, quoteChars, largest },
|
|
106
|
+
read: { chars, approxTokens: Math.round(chars / 4), fitsOneResult: chars <= ONE_RESULT_CHARS, ...readsAs, quoteChars, largest },
|
|
101
107
|
links: { staleTitles, stalePins, untypedMentions, unmirroredArrows },
|
|
102
108
|
};
|
|
103
109
|
}
|
|
@@ -115,6 +121,17 @@ export function renderBoardChecks(checks, warn = "!") {
|
|
|
115
121
|
lines.push(` Largest: ${read.largest.map((l) => `${l.ref} ${Math.round(l.share * 100)}%`).join(", ")}.`);
|
|
116
122
|
lines.push(" Sources a reader opens on demand belong in a list card (`canvas add-list`), which reads back as titles only.");
|
|
117
123
|
}
|
|
124
|
+
if (read.readsAs && read.markdownChars !== undefined) {
|
|
125
|
+
const md = read.markdownChars.toLocaleString("en-US");
|
|
126
|
+
const budget = CANVAS_READ_BUDGET.toLocaleString("en-US");
|
|
127
|
+
if (read.readsAs === "bodies") {
|
|
128
|
+
lines.push(` \`cnotes canvas read\` returns every body: ${md} characters of markdown, and it answers with a map only over ${budget}.`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
lines.push(`${warn} \`cnotes canvas read\` answers with a map, not the bodies: the markdown is ${md} characters and a read holds ${budget}.`);
|
|
132
|
+
lines.push(" Read one frame with `canvas read-section SECTION-n`, or every body with `canvas read <canvasId> --full`.");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
118
135
|
const found = links.staleTitles.length + links.stalePins.length + links.untypedMentions.length + links.unmirroredArrows.length;
|
|
119
136
|
if (found === 0) {
|
|
120
137
|
lines.push("Links: no stale titles, stale quote cards, untyped mentions or unmirrored arrows.");
|
|
@@ -143,7 +160,8 @@ export function renderBoardChecks(checks, warn = "!") {
|
|
|
143
160
|
lines.push(`${warn} ${count(links.untypedMentions.length, "mention has", "mentions have")} no relationship type:`);
|
|
144
161
|
for (const u of links.untypedMentions)
|
|
145
162
|
lines.push(` ${u.in} names ${u.target} as [[${u.target}]]`);
|
|
146
|
-
lines.push(" Say what the link is: [[depends-on::NOTE-12]].");
|
|
163
|
+
lines.push(" Say what the link is: [[depends-on::NOTE-12]]. A pure citation can stay: a `references` mention reads back in this form.");
|
|
164
|
+
lines.push(" Only mentions of notes on this canvas are listed.");
|
|
147
165
|
}
|
|
148
166
|
return lines.join("\n");
|
|
149
167
|
}
|
|
@@ -3,6 +3,10 @@ import { doneReadingFrom, doneVerdictLine } from "./done-line.js";
|
|
|
3
3
|
export const BRIEF_LIMIT = 8;
|
|
4
4
|
export const BRIEF_CANVAS_LIMIT = 3;
|
|
5
5
|
export const BRIEF_CHANGE_LIMIT = 5;
|
|
6
|
+
/** A canvas joins the brief for the notes it holds once it holds this many of them. */
|
|
7
|
+
export const BRIEF_HOME_MIN_NOTES = 2;
|
|
8
|
+
/** The most canvases the brief adds that way. */
|
|
9
|
+
export const BRIEF_HOME_LIMIT = 3;
|
|
6
10
|
const flat = (s) => (typeof s === "string" ? s.replace(/\s+/g, " ").trim() : "");
|
|
7
11
|
/**
|
|
8
12
|
* Snippets often just repeat the title, whole or cut off with an ellipsis.
|
|
@@ -56,6 +60,66 @@ export function briefFromSearch(query, data, limit = BRIEF_LIMIT) {
|
|
|
56
60
|
}
|
|
57
61
|
return { query, notes, canvases };
|
|
58
62
|
}
|
|
63
|
+
/** Pull one note's canvases out of a `/api/canvas/for-note` response. */
|
|
64
|
+
export function homesFromResponse(data) {
|
|
65
|
+
const rows = data?.canvases;
|
|
66
|
+
const out = [];
|
|
67
|
+
for (const r of Array.isArray(rows) ? rows : []) {
|
|
68
|
+
const id = typeof r.id === "string" ? r.id : "";
|
|
69
|
+
const displayId = typeof r.displayId === "string" ? r.displayId : "";
|
|
70
|
+
if (!id && !displayId)
|
|
71
|
+
continue;
|
|
72
|
+
out.push({ id, displayId, title: flat(r.name), goal: flat(r.goal) });
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Add the canvases the found notes live on. `homes` holds one list per found
|
|
78
|
+
* note, in the notes' order. A canvas the search already named gains `holds`;
|
|
79
|
+
* one it did not name joins when it holds BRIEF_HOME_MIN_NOTES or more of the
|
|
80
|
+
* notes, the fullest first and at most BRIEF_HOME_LIMIT. One shared note is
|
|
81
|
+
* not enough: a hub board holds one note from most topics.
|
|
82
|
+
*/
|
|
83
|
+
export function withNoteHomes(canvases, homes) {
|
|
84
|
+
const tally = new Map();
|
|
85
|
+
homes.forEach((list, noteIndex) => {
|
|
86
|
+
const seen = new Set();
|
|
87
|
+
for (const home of list) {
|
|
88
|
+
const key = home.id || home.displayId;
|
|
89
|
+
if (seen.has(key))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(key);
|
|
92
|
+
const row = tally.get(key);
|
|
93
|
+
if (row)
|
|
94
|
+
row.count += 1;
|
|
95
|
+
else
|
|
96
|
+
tally.set(key, { home, count: 1, firstNote: noteIndex });
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
if (tally.size === 0)
|
|
100
|
+
return canvases;
|
|
101
|
+
const named = new Set();
|
|
102
|
+
const out = canvases.map((c) => {
|
|
103
|
+
for (const [key, row] of tally) {
|
|
104
|
+
if (c.ref !== row.home.displayId && c.ref !== row.home.id)
|
|
105
|
+
continue;
|
|
106
|
+
named.add(key);
|
|
107
|
+
return { ...c, holds: row.count };
|
|
108
|
+
}
|
|
109
|
+
return c;
|
|
110
|
+
});
|
|
111
|
+
const added = [...tally.entries()]
|
|
112
|
+
.filter(([key, row]) => !named.has(key) && row.count >= BRIEF_HOME_MIN_NOTES)
|
|
113
|
+
.sort((a, b) => b[1].count - a[1].count || a[1].firstNote - b[1].firstNote)
|
|
114
|
+
.slice(0, BRIEF_HOME_LIMIT)
|
|
115
|
+
.map(([, row]) => ({
|
|
116
|
+
ref: row.home.displayId || row.home.id,
|
|
117
|
+
title: row.home.title,
|
|
118
|
+
about: row.home.goal,
|
|
119
|
+
holds: row.count,
|
|
120
|
+
}));
|
|
121
|
+
return [...out, ...added];
|
|
122
|
+
}
|
|
59
123
|
/** Pull brief rows out of a `/api/timeline?query=` search response. */
|
|
60
124
|
export function changesFromTimeline(data, limit = BRIEF_CHANGE_LIMIT) {
|
|
61
125
|
const results = data?.results;
|
|
@@ -92,15 +156,22 @@ export async function loadSessionBrief(api, workspaceId, prompt) {
|
|
|
92
156
|
if (search === null && timeline === null)
|
|
93
157
|
return null;
|
|
94
158
|
const found = briefFromSearch(query, search);
|
|
95
|
-
// After the search, since the lessons are looked up on the notes it found
|
|
96
|
-
//
|
|
97
|
-
// never runs the judge.
|
|
98
|
-
const [lessons,
|
|
159
|
+
// After the search, since the lessons are looked up on the notes it found,
|
|
160
|
+
// the verdicts on the canvases it found, and the homes on the notes again.
|
|
161
|
+
// Reading a verdict is free and never runs the judge.
|
|
162
|
+
const [lessons, judged, homes] = await Promise.all([
|
|
99
163
|
fetchLessons(api, workspaceId, found.notes.map((n) => n.displayId))
|
|
100
164
|
.then(lessonsFromResponse)
|
|
101
165
|
.catch(() => null),
|
|
102
166
|
Promise.all(found.canvases.map((c) => withDoneReading(api, workspaceId, c))),
|
|
167
|
+
Promise.all(found.notes.map((n) => api
|
|
168
|
+
.get("/api/canvas/for-note", { workspaceId, displayId: n.displayId })
|
|
169
|
+
.then(homesFromResponse)
|
|
170
|
+
.catch(() => []))),
|
|
103
171
|
]);
|
|
172
|
+
// A canvas that joins for the notes it holds gets its verdict too.
|
|
173
|
+
const withHomes = withNoteHomes(judged, homes);
|
|
174
|
+
const canvases = await Promise.all(withHomes.map((c, i) => (i < judged.length ? c : withDoneReading(api, workspaceId, c))));
|
|
104
175
|
return {
|
|
105
176
|
...found,
|
|
106
177
|
canvases,
|
|
@@ -177,7 +248,8 @@ export function renderBrief(brief, now = Date.now()) {
|
|
|
177
248
|
if (brief.canvases.length > 0) {
|
|
178
249
|
lines.push("Canvases:");
|
|
179
250
|
for (const c of brief.canvases) {
|
|
180
|
-
|
|
251
|
+
const holds = c.holds ? ` (holds ${c.holds} of the notes above)` : "";
|
|
252
|
+
lines.push(` ${c.ref} ${c.title}${holds}`);
|
|
181
253
|
if (c.about)
|
|
182
254
|
lines.push(` ${clip(c.about, 140)}`);
|
|
183
255
|
// Never clipped: the part that is not yet true is the reason to print it.
|
package/dist/lib/shared-rows.js
CHANGED
|
@@ -24,7 +24,8 @@ export function sharedDetail(item) {
|
|
|
24
24
|
if (item.kind === "decide") {
|
|
25
25
|
if (item.blocked)
|
|
26
26
|
return `${item.title} · ${blockedReason(item)}`;
|
|
27
|
-
|
|
27
|
+
const handle = item.draftId ?? (item.proposalId ? (item.displayId ?? item.proposalId) : undefined);
|
|
28
|
+
return `${item.title} · asks you to decide${handle ? ` · cnotes draft status ${handle}` : ""}`;
|
|
28
29
|
}
|
|
29
30
|
return item.title;
|
|
30
31
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one line that tells an agent its cnotes is behind the server it talks to.
|
|
3
|
+
*
|
|
4
|
+
* The npm update check (cn.ts, update-notifier) speaks only to a person at a
|
|
5
|
+
* terminal, so an agent never heard of a newer CLI: one session ran ten
|
|
6
|
+
* versions behind (29 Nov 2026) and learned it from a local note. Commands it
|
|
7
|
+
* was missing exited 0 on failures the newer CLI reports. The server ships
|
|
8
|
+
* with the CLI's source, so every answer to a CLI request names the version it
|
|
9
|
+
* was deployed with in a header, and the two commands an agent starts work
|
|
10
|
+
* with (`brief`, `operations begin`) say so on stderr when this CLI is older.
|
|
11
|
+
* No request of its own, and stdout stays the command's output.
|
|
12
|
+
*/
|
|
13
|
+
/** Must match CLI_VERSION_HEADER in lib/auth/server.ts. */
|
|
14
|
+
export const CLI_VERSION_HEADER = "X-CN-Cli-Version";
|
|
15
|
+
const SEMVER = /^(\d+)\.(\d+)\.(\d+)/;
|
|
16
|
+
/** True when `current` is an older release than `latest`. Anything unreadable is not older. */
|
|
17
|
+
export function isOlderVersion(current, latest) {
|
|
18
|
+
const a = SEMVER.exec(current);
|
|
19
|
+
const b = SEMVER.exec(latest);
|
|
20
|
+
if (!a || !b)
|
|
21
|
+
return false;
|
|
22
|
+
for (let i = 1; i <= 3; i++) {
|
|
23
|
+
const diff = Number(a[i]) - Number(b[i]);
|
|
24
|
+
if (diff !== 0)
|
|
25
|
+
return diff < 0;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/** The stderr line, or null when this CLI is not behind the server's. */
|
|
30
|
+
export function updateNotice(current, serverVersion, opts = {}) {
|
|
31
|
+
if (!serverVersion || !isOlderVersion(current, serverVersion))
|
|
32
|
+
return null;
|
|
33
|
+
const how = opts.compiledBinary
|
|
34
|
+
? `re-run the installer (\`curl -fsSL ${opts.installUrl ?? "https://creatornotes.app/install.sh"} | sh\`)`
|
|
35
|
+
: "`npm i -g @creator-notes/cnotes@latest`";
|
|
36
|
+
return (`note: this cnotes is ${current} and the server works with ${serverVersion.trim()}. ` +
|
|
37
|
+
`Commands and exit codes added since then are missing here. Update before you go on: ${how}.`);
|
|
38
|
+
}
|
|
39
|
+
/** The newest CLI version a response named in this process. */
|
|
40
|
+
let seen = null;
|
|
41
|
+
export function noteServerCliVersion(headers) {
|
|
42
|
+
const value = headers.get(CLI_VERSION_HEADER);
|
|
43
|
+
if (value)
|
|
44
|
+
seen = value;
|
|
45
|
+
}
|
|
46
|
+
/** Print the notice once per process. The update-notifier opt-outs silence it too. */
|
|
47
|
+
let printed = false;
|
|
48
|
+
export function printUpdateNotice(current, opts = {}, env = process.env) {
|
|
49
|
+
if (printed || env.CNOTES_NO_UPDATE_CHECK || env.NO_UPDATE_NOTIFIER)
|
|
50
|
+
return;
|
|
51
|
+
const line = updateNotice(current, seen, opts);
|
|
52
|
+
if (!line)
|
|
53
|
+
return;
|
|
54
|
+
printed = true;
|
|
55
|
+
process.stderr.write(`${line}\n`);
|
|
56
|
+
}
|
package/dist/mcp-server.js
CHANGED
|
@@ -381,7 +381,7 @@ sharedTool("cnotes_canvas_list", async ({ includeArchived }) => withErrorHandlin
|
|
|
381
381
|
...(includeArchived ? { includeArchived: "true" } : {}),
|
|
382
382
|
})));
|
|
383
383
|
sharedTool("cnotes_canvas_get", async ({ canvasId }) => withErrorHandling(() => api.get(`/api/canvas/${encodeURIComponent(canvasId)}`, { workspaceId, format: "markdown" })));
|
|
384
|
-
server.tool("cnotes_canvas_status", "See a canvas's whole layout BEFORE placing or moving anything by x/y: every item (cards, text, lists, portals, sections) as one list of rectangles {kind, ref, x, y, width, height}, the pairs that overlap, and with `near` a free spot next to an anchor. Sections are containers, never overlaps. Also checks the board as an agent reads it: `read` is the size of the read
|
|
384
|
+
server.tool("cnotes_canvas_status", "See a canvas's whole layout BEFORE placing or moving anything by x/y: every item (cards, text, lists, portals, sections) as one list of rectangles {kind, ref, x, y, width, height}, the pairs that overlap, and with `near` a free spot next to an anchor. Sections are containers, never overlaps. Also checks the board as an agent reads it: `read` is the size of the read, whether it fits one tool result (100,000 characters), and whether a plain canvas read returns every body or the map (`readsAs`: the map once the markdown passes 60,000); `links` lists mentions showing a title their note no longer has, quote cards pinned to a version their note has moved past, arrows between two notes that no note body records, and mentions with no relationship type. Run it before calling a board done. Read-only.", {
|
|
385
385
|
canvasId: z.string().describe("Canvas ID"),
|
|
386
386
|
near: z.string().optional().describe("Find a free spot next to this item (display id or node id) or point 'x,y'"),
|
|
387
387
|
width: z.number().optional().default(340).describe("Width of the box to find room for (default: a note card)"),
|
|
@@ -393,7 +393,7 @@ server.tool("cnotes_canvas_status", "See a canvas's whole layout BEFORE placing
|
|
|
393
393
|
]);
|
|
394
394
|
const items = layoutItemsFrom(data);
|
|
395
395
|
const overlaps = findOverlaps(items).map((o) => ({ a: o.a.ref, b: o.b.ref, area: o.area }));
|
|
396
|
-
const checks = boardChecks(read.result);
|
|
396
|
+
const checks = boardChecks(read.result, read.markdown);
|
|
397
397
|
if (!near)
|
|
398
398
|
return { items, overlaps, ...checks };
|
|
399
399
|
const anchor = resolveAnchor(items, near);
|
package/package.json
CHANGED
package/skills/cnotes/SKILL.md
CHANGED
|
@@ -47,7 +47,7 @@ When the writes belong together but cannot be one command (several notes and new
|
|
|
47
47
|
|
|
48
48
|
1. `cnotes operations begin --prompt "<past-tense headline, e.g. Added a risks list to the Q1 roadmap>" --json`, as its own command; check its exit code before writing (a pipe hides it). The response carries `typeRubrics`, the brief, and the proposals waiting on you (read those first, [references/drafts.md](references/drafts.md) step 8); `-q` prints only the run id. Canvas writes in one run stay on one canvas: end it and begin another before touching a second board.
|
|
49
49
|
2. Write. Audience-facing prose (note bodies, banners, pre-reads) goes through [references/humanizer.md](references/humanizer.md) first; transcripts, quotes and other raw capture are stored verbatim.
|
|
50
|
-
3. **Grade what you wrote.** `cnotes quality <displayIds...> --fail-below 4` hands back each note's rubric and body. Grade them all at once with `cnotes quality record --grades-file grades.json` (one `{displayId, level, criteria, nextStep?, gradedVersion?}` per note, one reason per rubric criterion), then revise only a note below 4 with `cnotes versions create`. A
|
|
50
|
+
3. **Grade what you wrote.** `cnotes quality <displayIds...> --fail-below 4` hands back each note's rubric and body. Grade them all at once with `cnotes quality record --grades-file grades.json` (one `{displayId, level, criteria, nextStep?, gradedVersion?}` per note, one reason per rubric criterion), then revise only a note below 4 with `cnotes versions create`. A grade with `unsure: true` is a guess at any level, and `needs_agent` means the grader abstained: check `missing` against the note yourself.
|
|
51
51
|
4. **Read it back.** `cnotes canvas status <canvasId>` reports the size of the board's read and its stale links; fix what it flags. Then `cnotes canvas read <canvasId>` (a long board answers with its map; read the frame you changed with `read-section`): every claim appears in a note with a display ID, the spine reads at fit zoom as faces and connectives, the hero is the board's plain name and the banner carries the claim, and the banner makes sense to someone who was not in the session and never says who asked for the board. A write that touches no canvas gets the same test with `cnotes notes get <id> --expand`, read as the next session will.
|
|
52
52
|
5. **Close with what the notes were worth.** `cnotes operations end --useful <ids> --dead-end <ids>` names the notes that answered the task and the ones that led nowhere; `--corrected <id> --correction "<what was right>"` marks one that was wrong (fix it with `versions create` too, when you can). The next run's brief starts from these. Then link the result.
|
|
53
53
|
|
|
@@ -52,7 +52,7 @@ A layout document is `{ root, edges?, origin?, placement? }` where `root` is one
|
|
|
52
52
|
|
|
53
53
|
The schema is strict: an unknown or typo'd key anywhere in the doc (e.g. `gapp`, `positionx`) is rejected with the offending key named, rather than silently ignored. Validation errors return `details.issues` with the full path (`doc.root.items[2].direction`), the allowed values, and what you sent.
|
|
54
54
|
|
|
55
|
-
`placement` (top-level, optional) controls where the whole layout sits relative to existing content: `"auto"` (default, collision-aware, below existing content / de-collide), `"append"` (always below everything), `"exact"` (honor `origin` verbatim). `origin` is the top-left corner; omit it and `auto`/`append` pick a safe one for you.
|
|
55
|
+
`placement` (top-level, optional) controls where the whole layout sits relative to existing content: `"auto"` (default, collision-aware, below existing content / de-collide), `"append"` (always below everything), `"exact"` (honor `origin` verbatim). `origin` is the top-left corner; omit it and `auto`/`append` pick a safe one for you: below the lowest card or section frame, on the left edge the frames and cards already share, so a section added to a column of sections lines up with them. A section's border lands 21px under the block's top, since its name sits in that band; with `"exact"`, a section root therefore starts at `origin.y + 21`.
|
|
56
56
|
|
|
57
57
|
## Leaf item shapes
|
|
58
58
|
|
|
@@ -382,7 +382,7 @@ What makes a board readable at fit zoom:
|
|
|
382
382
|
|
|
383
383
|
1. Write the layout doc to a temp file (`/tmp/layout.json`).
|
|
384
384
|
2. Run `cnotes canvas place <canvasId> --spec /tmp/layout.json --json`.
|
|
385
|
-
3. The response includes `items[]` (with resolved `positionX/Y`, `width`, `height`, `id`, and
|
|
385
|
+
3. The response includes `items[]` (with resolved `positionX/Y`, `width`, `height`, `id`, your `key`, and on a note item the `noteId` it shows, an `@key` resolved to its display id), `edges[]` (with resolved edge ids), and `bbox` (the bounding box of the whole layout).
|
|
386
386
|
|
|
387
387
|
## Constraints
|
|
388
388
|
|
|
@@ -35,12 +35,16 @@ cnotes canvas get <canvasId>
|
|
|
35
35
|
# See the whole layout before touching x/y: every item's box by kind, the pairs
|
|
36
36
|
# that overlap, and with --near a free spot next to an anchor.
|
|
37
37
|
# It also checks the board as an agent reads it. Read: the characters
|
|
38
|
-
# `canvas read`
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
38
|
+
# `canvas read` prints as JSON and whether that fits one tool result (100,000),
|
|
39
|
+
# and what a plain `canvas read` answers with: every body, or the map once the
|
|
40
|
+
# markdown passes 60,000 (`read.readsAs` "bodies" or "map", `read.markdownChars`).
|
|
41
|
+
# Links: mentions that show a title their note no longer has, quote cards pinned
|
|
42
|
+
# to a version their note has moved past, arrows between two notes that no note
|
|
43
|
+
# body records, and mentions with no relationship type (a `references` mention
|
|
44
|
+
# reads back as one; a pure citation can stay). Only mentions of notes on this
|
|
45
|
+
# canvas are checked. Each finding prints its fix; --json carries them as `read`
|
|
46
|
+
# and `links`. Run it before you call a board done. --no-checks skips them (they
|
|
47
|
+
# cost one more read of the canvas).
|
|
44
48
|
cnotes canvas status <canvasId> [--near <displayId|nodeId|x,y>] [--size 340x130] [--no-checks]
|
|
45
49
|
|
|
46
50
|
# Read a canvas as STRUCTURE, not just content — one round-trip to think across it.
|
|
@@ -41,7 +41,9 @@ When an AI agent is doing a **batch of work**, creating notes, modifying 2+ enti
|
|
|
41
41
|
# With --prompt it also returns a brief (brief.notes, brief.canvases,
|
|
42
42
|
# brief.changes): the notes, canvases and recent changes most relevant to the
|
|
43
43
|
# task. Read it BEFORE suggesting anything; a Decision, Guide or Metric there
|
|
44
|
-
# may already settle what you were about to propose.
|
|
44
|
+
# may already settle what you were about to propose. A canvas that holds two
|
|
45
|
+
# or more of the notes found is listed too, with `holds`: add to that board
|
|
46
|
+
# before you build one beside it. Not opening a run?
|
|
45
47
|
# `cnotes brief "<task>"` returns the same brief, read-only.
|
|
46
48
|
cnotes operations begin --prompt "Reorganized the roadmap into quarters" --json
|
|
47
49
|
cnotes types show Insight # or pull from .typeRubrics in the begin response
|