@creator-notes/cnotes 0.145.0 → 0.146.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creator-notes-cli",
3
- "version": "0.145.0",
3
+ "version": "0.146.0",
4
4
  "description": "CreatorNotes CLI: create notes, build canvases, search knowledge from the terminal",
5
5
  "author": {
6
6
  "name": "CreatorNotes",
@@ -12,7 +12,7 @@ import { explainTruncation, listNotes, SERVER_LIST_CAP } from "../lib/notes-list
12
12
  import { formatLinkedItemHeading, groupLinkedByRelation, parseExpandArgs, projectExpandPayload, renderExpandContentOnly, } from "../lib/expand-notes.js";
13
13
  import { noteBatchIdempotencyKey, resolveNoteBatchItems } from "../lib/note-batch.js";
14
14
  import { describeUnresolvedMentions, lintNarratedVerbMentions, lintPlainTextDisplayIdsBatch, hasGenericMention, fetchRelationshipTypeOptions, } from "../lib/mention-lint.js";
15
- import { attachRubricsToResults, loadRubricMap, rubricsForTypes, } from "../lib/rubrics.js";
15
+ import { attachTypes, gradableIds, loadRubricMap, rubricsForTypes, } from "../lib/rubrics.js";
16
16
  import { DECISION_CARD_RULE, } from "../lib/decision-citation.js";
17
17
  import { registerNotesImport } from "./notes-import.js";
18
18
  import { orderByDisplayId } from "../lib/mcp-spec.js";
@@ -593,10 +593,10 @@ Examples:
593
593
 
594
594
  Output (--json):
595
595
  Returns an object, not an array. Created notes are under the "results" key
596
- (not "notes"/"ok"); each carries displayId, title, type, and rubric (null when
597
- the type has no validationPrompt). A top-level "rubrics" array is also present
598
- for types that have one. Prefer reading .results[].rubric — agents that jq down
599
- to only displayId will miss a sibling top-level array. "selfCheck" is the
596
+ (not "notes"/"ok"); each carries displayId, title, type and url. The
597
+ top-level "rubrics" array holds each used type's rubric once, for types that
598
+ have one: read it before revising, since a filter down to .results[] leaves
599
+ it out. "next" says how to put the notes on a canvas. "selfCheck" is the
600
600
  command that grades the new notes against those rubrics; run it and revise
601
601
  anything below 4 before ending the operation. Read results with:
602
602
  cnotes notes create --json --notes '…' | jq -r '.results[] | "\\(.displayId) \\(.type)"'
@@ -745,25 +745,22 @@ Output (--json):
745
745
  emitUnresolved();
746
746
  return;
747
747
  }
748
- // Echo rubrics for the types just used. Attach them ON EACH result so
749
- // a `.results[]` jq filter still carries the standard (a sibling
750
- // top-level `rubrics` array is invisible to agents that only extract
751
- // displayId). Zero LLM — stored validationPrompt only. Non-fatal.
748
+ // Echo the rubric of each type just used, once, under `rubrics`; each
749
+ // result carries its `type` to look it up by. Zero LLM: the stored
750
+ // validationPrompt only. Non-fatal.
752
751
  const rubricMap = await loadRubricMap(api, cfg.workspaceId);
753
752
  const typeByKey = new Map(notes.map((n) => [n.key, n.type]));
754
753
  const rawResults = (data.results || []);
755
754
  // Each new note's link, and what is left to do for a person to see it:
756
755
  // a note just created is on no canvas (the first-run walk, 29 Nov 2026).
757
- const results = attachRubricsToResults(rawResults, typeByKey, rubricMap).map((r) => r.displayId ? { ...r, url: noteUrl(cfg.serverUrl, cfg.workspaceId, String(r.displayId)) } : r);
756
+ const results = attachTypes(rawResults, typeByKey).map((r) => r.displayId ? { ...r, url: noteUrl(cfg.serverUrl, cfg.workspaceId, String(r.displayId)) } : r);
758
757
  const next = alreadyExists ? null : placeNextLine(results.filter((r) => r.displayId).map((r) => String(r.displayId)));
759
758
  const rubrics = rubricsForTypes(notes.map((n) => n.type), rubricMap);
760
759
  // The self-check closes the loop the rubric echo opens. The command
761
760
  // does not grade and does not spend credits: it returns a
762
761
  // gradeRequest (rubric + content) for each new note. The agent grades
763
762
  // that payload and records it with `cnotes quality record`.
764
- const gradable = results
765
- .filter((r) => r.rubric && r.displayId)
766
- .map((r) => String(r.displayId));
763
+ const gradable = gradableIds(results, rubricMap);
767
764
  const selfCheck = gradable.length > 0
768
765
  ? `cnotes quality ${gradable.join(" ")} --fail-below 4 --json`
769
766
  : null;
@@ -50,16 +50,20 @@ export function allWorkspaceRubrics(map) {
50
50
  .sort((a, b) => a.type.localeCompare(b.type));
51
51
  }
52
52
  /**
53
- * Attach `type` + `rubric` onto each create result.
54
- *
55
- * `typeByKey` maps the batch item key → type string from the create request.
56
- * Types without a validationPrompt get `rubric: null` so the gap is visible
57
- * (several default types ship without one).
53
+ * Give each create result its `type`. `typeByKey` maps the batch item key →
54
+ * type string from the create request; a result with no key keeps the type
55
+ * the server sent. The rubric is not copied here: it is in the reply's
56
+ * `rubrics` list, once per type (rubricsForTypes).
58
57
  */
59
- export function attachRubricsToResults(results, typeByKey, map) {
58
+ export function attachTypes(results, typeByKey) {
60
59
  return results.map((r) => {
61
60
  const type = (r.key ? typeByKey.get(String(r.key)) : undefined) ?? String(r.type ?? "");
62
- const rubric = type ? map.get(type.toLowerCase()) ?? null : null;
63
- return { ...r, type, rubric };
61
+ return { ...r, type };
64
62
  });
65
63
  }
64
+ /** The display ids of the new notes whose type has a rubric: what the self-check grades. */
65
+ export function gradableIds(results, map) {
66
+ return results
67
+ .filter((r) => r.displayId && typeof r.type === "string" && map.has(r.type.toLowerCase()))
68
+ .map((r) => String(r.displayId));
69
+ }
@@ -34,7 +34,7 @@ import { findOverlaps, layoutItemsFrom, resolveAnchor, suggestFreeSpot } from ".
34
34
  import { boardChecks } from "./lib/board-checks.js";
35
35
  import { buildSchema } from "./lib/build-schema.js";
36
36
  import { assertMcpLocalFileReadable, getMcpLocalFileRoots, } from "./lib/mcp-local-file.js";
37
- import { attachRubricsToResults, loadRubricMap, rubricsForTypes, } from "./lib/rubrics.js";
37
+ import { attachTypes, loadRubricMap, rubricsForTypes, } from "./lib/rubrics.js";
38
38
  import { lintNarratedVerbMentions, lintPlainTextDisplayIds, lintPlainTextDisplayIdsBatch, hasGenericMention, fetchRelationshipTypeOptions, } from "./lib/mention-lint.js";
39
39
  import { DECISION_CARD_RULE } from "./lib/decision-citation.js";
40
40
  import { parseReviewRef } from "./lib/review-helpers.js";
@@ -321,11 +321,10 @@ sharedTool("cnotes_notes_create", async ({ notes, intent }) => withErrorHandling
321
321
  workspaceId,
322
322
  notes: items,
323
323
  }));
324
- // Attach rubrics ON EACH result so filtering to results[] still carries
325
- // the standard. Top-level rubrics kept for backward compatibility.
324
+ // Each used type's rubric once, under `rubrics`; each result carries its type.
326
325
  const typeByKey = new Map(items.map((n) => [n.key, n.type]));
327
326
  const rawResults = (result.results || []);
328
- const enriched = attachRubricsToResults(rawResults, typeByKey, rubricMap);
327
+ const enriched = attachTypes(rawResults, typeByKey);
329
328
  const rubrics = rubricsForTypes(items.map((n) => String(n.type)), rubricMap);
330
329
  return {
331
330
  ...result,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creator-notes/cnotes",
3
- "version": "0.145.0",
3
+ "version": "0.146.0",
4
4
  "description": "CLI for CreatorNotes — create notes, build canvases, search knowledge from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -95,7 +95,7 @@ Every command follows one contract. Detail, including which key holds a note bod
95
95
  | `7` | permission denied | `cnotes workspace current` |
96
96
  | `8` | subscription required (writes on a free workspace) | [references/billing.md](references/billing.md); offer `cnotes upgrade`, never run it unasked |
97
97
 
98
- Reads return data (`notes list/get/search` emit a bare array; one note is `.[0]`); writes return an envelope (`notes create` returns `{ results, relationshipsCreated, rubrics?, hints? }`). Errors go to stderr as `{ error, code, exitCode, hint }`; read the hint before retrying. Display IDs (`DECISION-12`, `CANVAS-406`, `SECTION-7`) work everywhere a command takes an id.
98
+ Reads return data (`notes list/get/search` emit a bare array; one note is `.[0]`); writes return an envelope (`notes create` returns `{ results, relationshipsCreated, rubrics?, next?, hints? }`). Errors go to stderr as `{ error, code, exitCode, hint }`; read the hint before retrying. Display IDs (`DECISION-12`, `CANVAS-406`, `SECTION-7`) work everywhere a command takes an id.
99
99
 
100
100
  ## Getting started
101
101
 
@@ -121,7 +121,7 @@ cnotes notes create --notes '[
121
121
  # On validation failure the response lists every bad item by index + key + field
122
122
  # (and `details.items` in --json mode), so you can fix the whole batch in one shot.
123
123
  # Same batch again in the same run returns the first notes (alreadyExists: true), not a copy; after a reset or 5xx (`mayHaveCommitted: true`) re-run with the printed `--idempotency-key`.
124
- # Each .results[] item carries .type + .rubric — keep them when filtering JSON.
124
+ # Each .results[] item carries .type; each used type's rubric is under the top-level .rubrics, once. Keep both when filtering JSON.
125
125
  # Where the deployment turns the rubric check on, each item also carries
126
126
  # .quality: {level 1-4, label, missing[], nextStep, unsure}. `missing` quotes the
127
127
  # rubric clauses the note does not yet do, weakest first. Fix those with
@@ -5,7 +5,7 @@ The one contract every command follows is in the core skill (the flag table and
5
5
  ## Reads return data, writes return an envelope
6
6
 
7
7
  - `notes list`, `notes get` and `notes search` emit a bare array, so one note is `.[0]`. `notes get --expand` is the exception: an object `{ notes, linked, truncated, cap, omitted, notice }` (notes.md).
8
- - `notes create` returns `{ results, relationshipsCreated, rubrics?, hints? }`; read new notes from `results`. Each row carries `type`, `rubric`, and `quality` where the workspace grades on save.
8
+ - `notes create` returns `{ results, relationshipsCreated, rubrics?, hints? }`; read new notes from `results`. Each row carries `type`, `url`, and `quality` where the workspace grades on save; each used type's rubric is in `rubrics`, once.
9
9
  - `canvas create` returns `{ canvas: { id, displayId, url } }` with `id`, `displayId` and `url` mirrored at the top level; after `create --spec` the placement is under `layout`, and `displayId` can still be null until `canvas get` reads it.
10
10
  - `canvas place` returns `{ items, edges, bbox, successCount, notes?, arrangedSections? }`. It is best-effort, not transactional (HTTP 207): read `items[].error` and `edges[].error` before assuming success. A `quote` item adds `quoteNoteDisplayId`, `noteDisplayId`, `versionNumber` and `placed`.
11
11
  - A note body comes back under `markdown` from `canvas read` and under `content` from `notes get --json`; read the key for the command you ran. A `canvas read` whose JSON starts with `level: "cards"` or `"frames"` is a map of a long board: each frame lists its cards under `lines`, with no bodies; `next` names the commands that open a frame, chosen notes or (`--full`) every body. `notes get --content-only` prints the raw markdown with no envelope, the right read for a transcript.