Skip to content

feat: add note (小记) and board resource commands - #5

Merged
chen201724 merged 1 commit into
mainfrom
feat/notes-and-board-resources
Jul 24, 2026
Merged

feat: add note (小记) and board resource commands#5
chen201724 merged 1 commit into
mainfrom
feat/notes-and-board-resources

Conversation

@chen201724

Copy link
Copy Markdown
Member

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 — 小记 over GET/POST /notes and GET/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 --all drains by the server's has_more flag via a new page-number pagination helper.
  • resource get/create/update — structured board resources (画板: mindmap/flowchart/architecturediagram) over /yfm/boards, with --doc-id/--url mutual exclusion, --dsl/--dsl-file input, 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 check fully green: 437 unit tests, mock e2e 46 passed / 22 conditional skips.

🤖 Generated with Claude Code

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>
@chen201724
chen201724 merged commit ec06cfa into main Jul 24, 2026
2 checks passed
@chen201724
chen201724 deleted the feat/notes-and-board-resources branch July 24, 2026 04:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/client/api/note.ts
): Promise<V2NoteCreateResult> {
// POST /notes uses `{ success, data }`, not the standard API envelope.
const res = await http.post<NoteCreateEnvelope>('/notes', payload);
return res.data;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/commands/note.ts

function mergeNotePages(pages: V2NoteListResult[]): V2NoteListResult {
return {
pin_notes: pages.flatMap((page) => page.pin_notes ?? []),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/commands/note.ts
Comment on lines +100 to +104
return {
pin_notes: pages.flatMap((page) => page.pin_notes ?? []),
notes: pages.flatMap((page) => page.notes ?? []),
has_more: false,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant