Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ bin.ts → cli.ts (commander program, error → exit code)
- `src/commands/book.ts` — `registerBookCommands` registers book list/get/create/update/delete, pagination, validation, and delete confirmation.
- `src/commands/doc.ts` — `registerDocCommands` registers document CRUD, body/file handling, pagination, and version reads.
- `src/commands/group.ts` — `registerGroupCommands` registers group-member list/set/remove, pagination, roles, and removal confirmation.
- `src/commands/note.ts` — `registerNoteCommands` registers note list/get/create/update, `has_more` pagination, file-backed content, and note rendering.
- `src/commands/resource.ts` — `registerResourceCommands` registers structured-board get/create/update, locator validation, and text/JSON DSL handling.
- `src/commands/search.ts` — `registerSearchCommands` registers typed doc/book search and maps the book surface name to the API's `repo` value.
- `src/commands/stats.ts` — `registerStatsCommands` registers aggregate/member/book/doc statistics, filters, sorting, and page draining.
- `src/commands/toc.ts` — `registerTocCommands` registers TOC tree reads and cross-field-validated node updates.
Expand All @@ -40,12 +42,14 @@ bin.ts → cli.ts (commander program, error → exit code)
- `src/client/api/book.ts` — book owner collection and id-or-namespace item API wrappers.
- `src/client/api/doc.ts` — document CRUD, global-id lookup, and published-version API wrappers.
- `src/client/api/group.ts` — group-member list/update/remove API wrappers.
- `src/client/api/note.ts` — note CRUD-without-delete wrappers, including the create and double-wrapped update response quirks.
- `src/client/api/resource.ts` — structured-board read/create/update wrappers using the public wire field names.
- `src/client/api/search.ts` — doc/repo search API wrapper.
- `src/client/api/stats.ts` — group aggregate and paged member/book/doc statistics API wrappers, including the live-array correction to the spec types.
- `src/client/api/toc.ts` — book TOC read/update API wrappers and update-body shape.
- `src/client/api/user.ts` — heartbeat, current-user, and user-groups API wrappers.
- `src/client/book-ref.ts` — parses a book reference as a numeric id or `group/slug` and produces the encoded `/repos/...` base path.
- `src/client/paginate.ts` — drains offset-paged endpoints for `--all` until the first short page.
- `src/client/paginate.ts` — drains offset-paged or explicit `has_more` endpoints for `--all`.
- `src/client/types.gen.ts` — generated from `spec/yuque-openapi.yaml`; edit the spec and run `npm run gen:types`, never edit this file directly.
- `src/client/types.ts` — thin compatibility adapter over the generated schemas; preserves public type names, live-API extensions, and index signatures for `--json` pass-through.
- `spec/yuque-openapi.yaml` — vendored upstream OpenAPI contract and source of truth for the supported operation surface.
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 1.2.0

- Added `note list/get/create/update` for Yuque notes (小记), including
`has_more` pagination, file-backed Markdown input, and the API's non-standard
create/update response envelopes.
- Added `resource get/create/update` for structured boards (mind maps,
flowcharts, and architecture diagrams), with document locator validation and
text/file DSL input.
- Extended the vendored OpenAPI contract, generated types, command/spec locks,
unit coverage, and always-on mock-server e2e coverage for all seven commands.

## 1.1.0

Knowledge bases are now `book` across the CLI surface, aligning with Yuque's
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A scriptable toolkit for the [Yuque (语雀)](https://www.yuque.com/) Open API

[![CI][ci-image]][ci-url] [![npm version][npm-image]][npm-url] [![npm downloads][download-image]][download-url] [![License][license-image]][license-url]

[Quick Start](#quick-start) · [Commands](#commands-26) · [Scripting](#output--scripting) · [Troubleshooting](#troubleshooting) · [中文文档](./README.zh-CN.md)
[Quick Start](#quick-start) · [Commands](#commands-33) · [Scripting](#output--scripting) · [Troubleshooting](#troubleshooting) · [中文文档](./README.zh-CN.md)

</div>

Expand Down Expand Up @@ -54,7 +54,7 @@ YUQUE_TOKEN=YOUR_TOKEN npx yuque-open-cli auth status

Flags win over env vars, so a one-off `--token` override always works. Site roots are normalized (`/api/v2` is appended automatically); when unset, the host defaults to `https://www.yuque.com`.

## Commands (26)
## Commands (33)

Each command maps to the [Yuque OpenAPI](https://www.yuque.com/yuque/developer/api) — the mapping is locked by a contract test against the vendored spec.

Expand All @@ -77,6 +77,13 @@ Each command maps to the [Yuque OpenAPI](https://www.yuque.com/yuque/developer/a
| | `doc delete <book> <doc>` | Delete a doc — asks for confirmation |
| | `doc versions <doc-id>` | List a doc's version history |
| | `doc version <version-id>` | Show one version's content |
| **Notes** | `note list` | List notes (小记), with `--all` support |
| | `note get <id>` | Show a note with its full content |
| | `note create` | Create a note from `--body` or `--body-file` |
| | `note update <id>` | Update note source, HTML, abstract, and status |
| **Boards** | `resource get <src>` | Read a structured board from a document |
| | `resource create` | Create a mind map, flowchart, or architecture diagram |
| | `resource update <src>` | Update a board from text or JSON DSL |
| **TOC** | `toc get <book>` | Print a book's table of contents as a tree |
| | `toc update <book>` | Append, prepend, edit, or remove a TOC node |
| **Groups** | `group members <login>` | List members of a group |
Expand Down
11 changes: 9 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

[![CI][ci-image]][ci-url] [![npm version][npm-image]][npm-url] [![npm downloads][download-image]][download-url] [![License][license-image]][license-url]

[快速开始](#快速开始) · [命令列表](#命令列表26-个) · [脚本化](#输出与脚本化) · [常见问题](#常见问题) · [English](./README.md)
[快速开始](#快速开始) · [命令列表](#命令列表33-个) · [脚本化](#输出与脚本化) · [常见问题](#常见问题) · [English](./README.md)

</div>

Expand Down Expand Up @@ -54,7 +54,7 @@ YUQUE_TOKEN=YOUR_TOKEN npx yuque-open-cli auth status

命令行参数优先于环境变量,随手 `--token` 覆盖一次总是生效。站点地址会自动规范化(自动补 `/api/v2`);不设置时默认 `https://www.yuque.com`。

## 命令列表(26 个)
## 命令列表(33 个)

每条命令都对应[语雀 OpenAPI](https://www.yuque.com/yuque/developer/api) —— 映射关系由契约测试锁定在内置规格文件上。

Expand All @@ -77,6 +77,13 @@ YUQUE_TOKEN=YOUR_TOKEN npx yuque-open-cli auth status
| | `doc delete <book> <doc>` | 删除文档 —— 需要确认 |
| | `doc versions <doc-id>` | 列出文档的版本历史 |
| | `doc version <version-id>` | 查看某个版本的内容 |
| **小记** | `note list` | 列出小记,支持 `--all` 拉取全量 |
| | `note get <id>` | 查看小记完整内容 |
| | `note create` | 从 `--body` 或 `--body-file` 创建小记 |
| | `note update <id>` | 更新小记源文本、HTML、摘要与状态 |
| **画板** | `resource get <src>` | 读取文档中的结构化画板 |
| | `resource create` | 创建思维导图、流程图或架构图 |
| | `resource update <src>` | 使用文本或 JSON DSL 更新画板 |
| **目录** | `toc get <book>` | 以树形输出知识库目录 |
| | `toc update <book>` | 追加、头插、编辑或删除目录节点 |
| **团队** | `group members <login>` | 列出团队成员 |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yuque-open-cli",
"version": "1.1.0",
"version": "1.2.0",
"description": "Scriptable CLI toolkit for the Yuque (语雀) Open API — search, read, write, and manage docs from scripts, pipelines, and agents",
"type": "module",
"main": "dist/cli.js",
Expand Down
Loading
Loading