@creator-notes/cnotes 0.117.0 → 0.118.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.117.0",
3
+ "version": "0.118.0",
4
4
  "description": "CreatorNotes CLI: create notes, build canvases, search knowledge from the terminal",
5
5
  "author": {
6
6
  "name": "CreatorNotes",
@@ -726,6 +726,63 @@ Sending it back as a verdict stays with the person, in the browser.
726
726
  handleError(error, cfg.json);
727
727
  }
728
728
  });
729
+ draft
730
+ .command("prepare")
731
+ .description("Prepare the answer to a proposal asked of your person, for them to give: accept or send it back, with why")
732
+ .argument("[draft]", "Proposal handle (PROPOSAL-n, as operations begin lists it) or id")
733
+ .option("--accept", "Recommend accepting it")
734
+ .option("--send-back", "Recommend sending it back")
735
+ .requiredOption("--note <text>", "Why, in one line the person reads before deciding")
736
+ .addHelpText("after", `
737
+ For another agent of the person a proposal in place was asked of, under its
738
+ own key. The person reads your recommendation on the review in the browser or
739
+ on the phone and gives the answer with one tap; nothing lands until they do.
740
+ Then stop: preparing is your whole part.
741
+
742
+ The key that built the proposal (opened it, wrote into it, or asked for it)
743
+ cannot prepare its answer (403, exit 7). Two agents on one login key count as
744
+ one agent, so give each its own key: cnotes auth keys create --name "<agent>".
745
+ A proposal with no record of which key built it is left to the person.
746
+
747
+ An accept is refused while a check blocks it; prepare a send-back instead,
748
+ saying what should change. Any later write into the proposal clears what you
749
+ prepared, so prepare after the last change you reviewed.
750
+
751
+ --json: { prepared, verdict }.
752
+
753
+ Examples:
754
+ $ cnotes draft prepare PROPOSAL-7 --accept --note "Matches DECISION-1 and the checks pass"
755
+ $ cnotes draft prepare PROPOSAL-7 --send-back --note "It drops the monthly option DECISION-1 keeps"
756
+ `)
757
+ .action(async (ref, opts) => {
758
+ const cfg = resolveBaseConfig(program.opts());
759
+ const api = new ApiClient(cfg.serverUrl, cfg.token, cfg.workspaceId);
760
+ try {
761
+ if (Boolean(opts.accept) === Boolean(opts.sendBack)) {
762
+ throw new ValidationError("Choose one: --accept or --send-back");
763
+ }
764
+ const inPlaceId = await inPlaceTarget(api, ref, cfg);
765
+ if (!inPlaceId) {
766
+ throw new ValidationError("Only a proposal in place can be prepared. Name it by its handle: cnotes draft prepare PROPOSAL-n.");
767
+ }
768
+ const verdict = opts.accept ? "accept" : "send_back";
769
+ const result = await api.post(`/api/proposals/${inPlaceId}`, {
770
+ action: "prepare",
771
+ verdict,
772
+ note: opts.note,
773
+ });
774
+ if (cfg.quiet)
775
+ console.log(inPlaceId);
776
+ else if (cfg.json)
777
+ outputJson(result);
778
+ else {
779
+ console.log(`Prepared: ${verdict === "accept" ? "accept" : "send it back"}. The person reads it on the review and gives the answer; your part is done, so stop here.`);
780
+ }
781
+ }
782
+ catch (error) {
783
+ handleError(error, cfg.json);
784
+ }
785
+ });
729
786
  draft
730
787
  .command("propose")
731
788
  .description("Propose a new text for a SHARED note from inside the draft; the note changes only when a person approves the draft")
@@ -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
+ }
@@ -1,6 +1,10 @@
1
1
  import { ApiError } from "./errors.js";
2
2
  import { liveWorkspaceId } from "./config.js";
3
3
  import { proposalHandle } from "./draft-ref.js";
4
+ /** One line for a prepared answer: who recommends what, and why. */
5
+ export function preparedLine(p) {
6
+ return `Prepared by ${p.byKeyName}: ${p.verdict === "accept" ? "accept it" : "send it back"}. ${p.note}`;
7
+ }
4
8
  const PROPOSAL_ID = /^[a-z0-9]{32}$/;
5
9
  /** Whether a 404 means "not a proposal in place" rather than a real failure. */
6
10
  export function isNotFound(error) {
@@ -59,6 +63,12 @@ export function inPlaceStatusLines(s) {
59
63
  else {
60
64
  out.push(s.decision.line);
61
65
  }
66
+ if (s.prepared) {
67
+ out.push(`${preparedLine(s.prepared)} The person gives the answer.`);
68
+ }
69
+ else if (p.isReviewer && p.isOwner && p.status === "open" && p.message) {
70
+ out.push(`Another agent of yours, under its own key, may prepare the answer for you to give: cnotes draft prepare ${p.displayId} --accept|--send-back --note "<why>".`);
71
+ }
62
72
  if (p.intent)
63
73
  out.push(`Why: ${p.intent}`);
64
74
  if (p.message) {
@@ -20,6 +20,9 @@ export function renderProposalsForCaller(result) {
20
20
  const parts = [`${p.displayId} "${p.name}"`, `built by ${p.builtBy}`];
21
21
  if (p.sentBack)
22
22
  parts.push("sent back");
23
+ if (p.prepared) {
24
+ parts.push(`${p.prepared.byKeyName} prepared: ${p.prepared.verdict === "accept" ? "accept" : "send back"}`);
25
+ }
23
26
  if (p.overlaps.length > 0)
24
27
  parts.push(overlapText(p.overlaps));
25
28
  lines.push(` ${parts.join(" · ")}`);
@@ -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.118.0",
4
4
  "description": "CLI for CreatorNotes — create notes, build canvases, search knowledge from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -243,6 +243,29 @@ As the builder, a status line reading "Merged runs 2 and 4 of 4. Runs 1 and 3
243
243
  are still proposed." means the rest is yours again: fix it and ask, or
244
244
  dismiss it.
245
245
 
246
+ ### Preparing the answer for your own person
247
+
248
+ When another agent of the same person built a proposal in place and asked
249
+ that person, you cannot accept it: no key of theirs lands their own agents'
250
+ work. You can prepare the answer they give. `operations begin` lists it under
251
+ waiting on you, with "built by you via Codex (Slack)". Read it with `cnotes
252
+ draft status PROPOSAL-n` and its rewordings, check it against what it rewords,
253
+ then:
254
+
255
+ ```bash
256
+ cnotes draft prepare PROPOSAL-n --accept --note "<why it should land>"
257
+ cnotes draft prepare PROPOSAL-n --send-back --note "<what should change>"
258
+ ```
259
+
260
+ The person reads "<your key's name> recommends landing it" with your line on
261
+ the review, in the browser or on the phone, and gives the answer with one
262
+ tap. Then stop. You need your own key (`cnotes auth keys create --name
263
+ "<agent>"`): the key that opened, wrote into or asked for the proposal is
264
+ refused, and two agents on one login key count as one. An accept is refused
265
+ while a check blocks; prepare a send-back that says what to fix. A later write
266
+ into the proposal clears what you prepared, and `operations begin` says
267
+ "<agent> prepared: accept" so a second reviewer does not start again.
268
+
246
269
  ## What to rely on
247
270
  - **One line says who it waits on.** `draft status`, `draft checkout` and
248
271
  `workspace current` print it: nobody asked yet, the changes a person asked
@@ -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