@creator-notes/cnotes 0.126.0 → 0.127.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/dist/commands/search.js
CHANGED
|
@@ -2,6 +2,31 @@ import { ApiClient } from "../lib/api-client.js";
|
|
|
2
2
|
import { resolveConfig } from "../lib/config.js";
|
|
3
3
|
import { handleError } from "../lib/errors.js";
|
|
4
4
|
import { outputJson, outputTable, truncate } from "../lib/output.js";
|
|
5
|
+
/**
|
|
6
|
+
* What the workspace does not hold, said before the results so an agent reads
|
|
7
|
+
* it first: search always returns its nearest notes, and without this line the
|
|
8
|
+
* best of them reads as an answer. Nothing is printed when every word is held
|
|
9
|
+
* in one note.
|
|
10
|
+
*/
|
|
11
|
+
export function coverageLines(coverage) {
|
|
12
|
+
if (!coverage?.verdict || coverage.verdict === "covered")
|
|
13
|
+
return [];
|
|
14
|
+
const lines = [];
|
|
15
|
+
const missing = (coverage.missing ?? []).join(", ");
|
|
16
|
+
if (coverage.verdict === "absent") {
|
|
17
|
+
lines.push(`Not in the workspace: ${missing} (no note holds any of these words)`);
|
|
18
|
+
}
|
|
19
|
+
else if (coverage.verdict === "partial") {
|
|
20
|
+
lines.push(`Not in the workspace: ${missing}`);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
lines.push("Each word is in some note, but no one note holds them all: read before combining.");
|
|
24
|
+
}
|
|
25
|
+
if (coverage.foundByMeaning) {
|
|
26
|
+
lines.push("Some notes below match by meaning alone and may say it in other words.");
|
|
27
|
+
}
|
|
28
|
+
return lines;
|
|
29
|
+
}
|
|
5
30
|
function renderNotesSection(section) {
|
|
6
31
|
const ranking = section.error ? `error — ${section.error}` : section.ranking ?? "";
|
|
7
32
|
console.log(`NOTES (${ranking})`);
|
|
@@ -81,6 +106,12 @@ export function registerSearchCommands(program) {
|
|
|
81
106
|
.option("--canvas <canvasId>", "Scope the NOTES section to notes on a canvas")
|
|
82
107
|
.addHelpText("after", `
|
|
83
108
|
Returns labeled sections — NOTES, CANVASES, IMAGES — each ranked in its own scorer (not fused).
|
|
109
|
+
Search always returns its nearest notes, so a first line says what the workspace does NOT hold:
|
|
110
|
+
Not in the workspace: refund, policy no live note holds these words; say so, don't guess
|
|
111
|
+
...no one note holds them all every word exists, but in different notes
|
|
112
|
+
...match by meaning alone a note may say a missing word differently; read it
|
|
113
|
+
No line means one note holds every word. --json carries it as \`coverage\` (verdict
|
|
114
|
+
covered | scattered | partial | absent, with \`missing\` and \`foundByMeaning\`).
|
|
84
115
|
--type all (default) all sections
|
|
85
116
|
--type Canvas canvases only (reserved corpus)
|
|
86
117
|
--type Image images only (semantic over vision captions/OCR; IMAGE-n ids)
|
|
@@ -122,6 +153,11 @@ For a single corpus you can still call the focused commands directly:
|
|
|
122
153
|
const canvases = data.sections?.canvases;
|
|
123
154
|
const images = data.sections?.images;
|
|
124
155
|
let printedAny = false;
|
|
156
|
+
const said = coverageLines(data.coverage);
|
|
157
|
+
for (const line of said)
|
|
158
|
+
console.log(line);
|
|
159
|
+
if (said.length > 0)
|
|
160
|
+
console.log("");
|
|
125
161
|
if (notes) {
|
|
126
162
|
renderNotesSection(notes);
|
|
127
163
|
printedAny = true;
|
package/package.json
CHANGED
|
@@ -70,7 +70,7 @@ A `quote` leaf is a note's face (canvas-elements.md rules 4 and 8): `text` is th
|
|
|
70
70
|
|
|
71
71
|
`richtext` IS the **text** element (the CLI's `add-text`), the only free-form text leaf. A heading is a `richtext` leaf whose content is `"# Title"` with no `colorHex`. There is no `"type": "text"` leaf: the old heading node kind is retired and the layout engine rejects it.
|
|
72
72
|
|
|
73
|
-
**New notes in the same call.** A spec can carry a top-level `notes` array in the `notes create` shape (`{key, type, markdown|markdownFile, tags?, changeDescription?}`). A note leaf places one with `"noteId": "@<key>"` and takes `<key>` as its own key, so edges and anchors say `@<key>`; bodies cross-link with `[@<key>: Title](relationship:<verb>)
|
|
73
|
+
**New notes in the same call.** A spec can carry a top-level `notes` array in the `notes create` shape (`{key, type, markdown|markdownFile, tags?, changeDescription?}`). A note leaf places one with `"noteId": "@<key>"` and takes `<key>` as its own key, so edges and anchors say `@<key>`; bodies cross-link with `[@<key>: Title](relationship:<verb>)`, and so may a `richtext` leaf's content and a `list` leaf's description (`[@<key>: Title](relationship:<verb>)` or `[[<verb>::@<key>]]`): the server writes the new note's display id into the card or list before storing it. A `@<key>` that no item in `notes` defines is refused, naming the key, before anything is created. The notes are checked before anything is written, created only if the layout solves, need an open run, and come back under `notes` in the `notes create` response shape. A dry run creates nothing. If placing then fails, the notes still exist: fix forward, never re-run the spec.
|
|
74
74
|
|
|
75
75
|
Leaf enums (exact values): richtext `size` = `small` | `medium` | `large`, `colorHex` = a saturated hex (omit for no background); list `viewMode` = `list` | `grid`, list `size` = `sm` | `md` | `lg` | `xl`.
|
|
76
76
|
|