Skip to content

purocean/yank-note-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@yank-note/cli

Official command-line interface for Yank Note.

Development

pnpm install
pnpm run typecheck
pnpm test
pnpm run build

Usage

pnpm run build
node dist/index.js help
node dist/index.js version
node dist/index.js doctor
node dist/index.js list-action
node dist/index.js list-repo
node dist/index.js exec-action base.list-repositories
node dist/index.js reload-main-window
node dist/index.js markdown-features --language en --output /tmp/yn-features.md
node dist/index.js export --absolute-path /absolute/path/to/doc.md --to html

After installation, the published binary name is:

yn-cli

Global options

yn-cli --host 127.0.0.1 --port 3044 --json <command>
  • --host <host>: override the Yank Note server host
  • --port <port>: override the Yank Note server port
  • --json: output machine-readable JSON

If --port is omitted, yn-cli reads the default Yank Note config file at ~/yank-note/config.json and falls back to 3044 when needed. If --host is omitted, yn-cli uses the configured host when available and otherwise falls back to 127.0.0.1.

Doctor

yn-cli doctor

doctor prints:

  • CLI version, Node version, and platform
  • resolved Yank Note config path
  • resolved host and port
  • whether the config file exists
  • whether the Yank Note MCP endpoint is reachable
  • whether yn_list_actions works through MCP
  • whether the base.list-repositories action is available

For automation or AI usage:

yn-cli --json doctor

MCP Transport

yn-cli uses mcporter as the MCP connector and talks to Yank Note through:

http://<host>:<port>/api/mcp/message

The current flow does not depend on private HTTP APIs outside the MCP endpoint.

List Repositories

yn-cli list-repo
yn-cli --json list-repo

This command calls the Yank Note MCP endpoint, checks for the base.list-repositories action, and prints each repository as:

<name>    <path>    enabled|disabled

List Actions

yn-cli list-action
yn-cli --json list-action

This command lists the actions exposed by Yank Note through the MCP action bridge, including each action name and its MCP-oriented description when available.

Execute Actions

yn-cli exec-action base.list-repositories
yn-cli exec-action layout.toggle-side true
yn-cli exec-action plugin.switch-todo.switch 12 false
yn-cli --json exec-action base.find-in-repository '{"pattern":"TODO","caseSensitive":false}'

Arguments are parsed one by one:

  • valid JSON literals such as true, 123, {"a":1}, and [1,2] are parsed as structured values
  • other values are passed as plain strings

Reload Main Window

yn-cli reload-main-window
yn-cli reload-main-window --url-mode dev
yn-cli --json reload-main-window --url-mode prod

This command wraps the MCP tool yn_reload_main_window. It is usually not needed for normal content work and is mainly useful when developing or debugging extensions.

Supported reload arguments:

  • --url-mode <scheme|prod|dev>: optionally switch URL mode before reloading

Markdown Features

yn-cli markdown-features
yn-cli markdown-features --language en
yn-cli markdown-features --language zh-CN --output /tmp/yn-features.md
yn-cli --json markdown-features --language en

This command fetches Yank Note's built-in extended Markdown feature documentation through MCP. When --output is provided, the content is written to the target file instead of stdout.

Export

yn-cli export --absolute-path /absolute/path/to/doc.md --to html
yn-cli export --repo main --path /docs/guide.md --to docx --output /tmp/guide.docx
yn-cli export --absolute-path /absolute/path/to/doc.md --to html --style inline --code plain --code-line-numbers false --code-copy-button false --toc 1,2
yn-cli export --absolute-path /absolute/path/to/doc.md --to pdf --page-size A4 --landscape --scale 1
yn-cli --json export --absolute-path /absolute/path/to/doc.md --to html

Supported export arguments:

  • --repo <name>: repository name
  • --path <path>: document path inside the repository
  • --absolute-path <path>: absolute markdown file path
  • --output <path>: output file path; defaults to ./<basename>.<to>
  • --from <markdown|html>: source export mode. Default: html
  • --to <docx|html|rst|adoc|pdf>: target export format. Default: html
  • --local-image <inline|upload|keep>: how local images are handled in html export. Default: inline
  • --style <include|inline|none>: how preview styles are exported in html export. Default: include
  • --code <highlight|plain>: whether code blocks stay highlighted in html export. Default: highlight
  • --toc <levels>: comma-separated heading levels such as 1,2,3. Default: empty
  • --code-line-numbers <true|false>: render code line numbers in html export. Default: true
  • --code-copy-button <true|false>: render the code copy button in html export. Default: true
  • --page-size <A3|A4|A5|Legal|Letter|Tabloid>: common PDF paper sizes. Default: A4
  • --landscape: export PDF in landscape orientation. Default: false
  • --scale <number>: PDF scale factor between 0.1 and 2. Default: 1
  • --print-background <true|false>: include CSS backgrounds in PDF output. Default: true
  • --margin-top <inches>: top PDF margin
  • --margin-bottom <inches>: bottom PDF margin
  • --margin-left <inches>: left PDF margin
  • --margin-right <inches>: right PDF margin
  • --render-timeout <ms>: timeout for preview rendering. Default: 20000
  • --image-timeout <ms>: timeout for preview images and related preview resources. Default: 60000

Parameter groups:

  • Input location: --repo, --path, --absolute-path
  • General export: --output, --from, --to, --render-timeout, --image-timeout
  • HTML export: --local-image, --style, --code, --toc, --code-line-numbers, --code-copy-button
  • PDF export: --page-size, --landscape, --scale, --print-background, --margin-top, --margin-bottom, --margin-left, --margin-right

You must provide either:

  • --absolute-path
  • or both --repo and --path

Notes:

  • PDF export only supports --from html
  • yn-cli intentionally exposes only the most common PDF options; if you need more control, export to HTML first and handle the final conversion yourself
  • Export jobs should be treated as serial work. Do not run multiple exports in parallel, especially for PDF.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors