feat: add note (小记) and board resource commands - #5
Conversation
Extend the spec-driven surface from 38 to 45 operations:
- note list/get/create/update over GET/POST /notes and GET/PUT /notes/{id},
including the two non-standard envelopes (create's {success,data} and
update's double-wrapped {data:{data}}), absorbed in the client layer
- resource get/create/update over /yfm/boards (mindmap/flowchart/
architecturediagram DSL), with --doc-id/--url mutual exclusion and local
JSON DSL validation
- has_more-driven pagination helper for note list --all (page-number model,
unlike the existing offset drain)
- spec, generated types, compat layer, unit/e2e tests, help-surface golden,
READMEs, AGENTS.md, CHANGELOG; version 1.2.0
Implemented by codex (gpt-5.6-sol); reviewed and red-light-verified.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7c1a0031e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ): Promise<V2NoteCreateResult> { | ||
| // POST /notes uses `{ success, data }`, not the standard API envelope. | ||
| const res = await http.post<NoteCreateEnvelope>('/notes', payload); | ||
| return res.data; |
There was a problem hiding this comment.
Reject failed note-create envelopes
When POST /notes returns HTTP 200 with success: false—a value explicitly permitted by the new response schema—this wrapper discards the flag, so the command prints Created note ... and exits 0 as long as data is present. Check success and raise an error before returning the created-note data so scripts do not treat a rejected creation as successful.
AGENTS.md reference: AGENTS.md:L67-L67
Useful? React with 👍 / 👎.
|
|
||
| function mergeNotePages(pages: V2NoteListResult[]): V2NoteListResult { | ||
| return { | ||
| pin_notes: pages.flatMap((page) => page.pin_notes ?? []), |
There was a problem hiding this comment.
Avoid duplicating pinned notes across pages
If the notes endpoint includes the current pin_notes collection on every page, which is valid under the added schema, note list --all appends the same pinned notes once per page. This produces duplicate rows and duplicate objects in JSON whenever has_more spans multiple pages; retain pinned notes from one page or deduplicate them by identity instead of flattening every page's collection.
Useful? React with 👍 / 👎.
| return { | ||
| pin_notes: pages.flatMap((page) => page.pin_notes ?? []), | ||
| notes: pages.flatMap((page) => page.notes ?? []), | ||
| has_more: false, | ||
| }; |
There was a problem hiding this comment.
Preserve list metadata in all-pages JSON
When a note-list response contains any additional top-level field, note list --all --json silently removes it because this reconstruction retains only pin_notes, notes, and has_more; the compatibility type deliberately permits live-API extension fields, while a non---all request passes them through. Preserve the extra response properties when aggregating pages so the JSON mode remains complete rather than projecting the payload.
AGENTS.md reference: AGENTS.md:L69-L69
Useful? React with 👍 / 👎.
Extends the spec-driven surface from 38 to 45 operations, closing the capability gap with the sibling yuque-mcp-server:
New commands
note list/get/create/update— 小记 overGET/POST /notesandGET/PUT /notes/{id}. The two non-standard envelopes (create's{success,data}, update's double-wrapped{data:{data}}) are modeled faithfully in the spec and absorbed in the client layer.note list --alldrains by the server'shas_moreflag via a new page-number pagination helper.resource get/create/update— structured board resources (画板: mindmap/flowchart/architecturediagram) over/yfm/boards, with--doc-id/--urlmutual exclusion,--dsl/--dsl-fileinput, and local JSON DSL validation on update.Process
Implemented by codex (gpt-5.6-sol) from a written brief; independently reviewed file-by-file, then red-light-verified: injected a hallucinated flag (help-surface golden went red), tampered a spec operationId (gen:types drift check + spec-coverage both went red), broke the double-envelope unwrap (client unit test went red); all restored to green.
Version bumped to 1.2.0 with CHANGELOG; READMEs (both languages) and AGENTS.md updated.
npm run checkfully green: 437 unit tests, mock e2e 46 passed / 22 conditional skips.🤖 Generated with Claude Code