mcpField
C
cli-anything-joplin

cli-anything-joplin

github.com/hkuds生产力57.6k245 次安装5 周前更新
代码仓库

关于 cli-anything-joplin

cli-anything-joplin 是通过 Joplin 终端程序自动化笔记本、笔记、待办事项等操作的 Python 命令行工具,适用于脚本或 Agent 工作流,并支持 JSON 输出和项目状态保存。

主要功能

  1. 01管理笔记本、笔记和待办事项
  2. 02处理标签与附件
  3. 03搜索、同步及导入导出
  4. 04保存项目状态与历史记录
  5. 05输出机器可读的 JSON

适用场景

  1. 01自动更新笔记和待办事项
  2. 02运行可重复的笔记本工作流
  3. 03导入或导出 Joplin 数据

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/hkuds/cli-anything --skill cli-anything-joplin

安装后在 Claude Code 中输入/cli-anything-joplin确认已加载。

详细介绍

cli-anything-joplin

使用此技能,通过一个由真实 joplin 终端二进制文件支持的有状态框架,自动化 Joplin 笔记本、笔记、待办、标签、附件、搜索、同步以及导入/导出工作流。

要求

  • Python 3.10+
  • Joplin 终端二进制文件可作为 joplin 使用
  • 可选:传入 --profile 以指定特定的 Joplin 配置文件

安装

cd joplin/agent-harness
pip install -e .

用法

# REPL mode (default)
cli-anything-joplin

# Machine-readable one-shot command
cli-anything-joplin --json notebooks list

# Stateful project
cli-anything-joplin project new --name demo -o ./demo.joplin-harness.json
cli-anything-joplin --project ./demo.joplin-harness.json notes create "Meeting note"

# Dry-run (no auto-save)
cli-anything-joplin --json --dry-run --project ./demo.joplin-harness.json notes create temp

JSON 输出约定

当启用 --json 时,命令返回:

  • ok:布尔值
  • command:稳定的命令标识符,例如 notes.list、todos.toggle
  • data:命令负载
  • error:成功时为 null,失败时为 { type, message }

命令组

  • project:new、open、save、info、json、status
  • notebooks:list、create、use、remove
  • notes:list、create、set、get、remove、copy、move、rename
  • todos:list、create、toggle、clear、done、undone
  • tags:list、add、remove、notetags、tagnotes
  • search:run
  • sync:run(--target、--upgrade、--use-lock)
  • interop:import、export
  • config:get、set、list、export、import-file
  • attach:add
  • status:show、restore
  • backend:version、dump、keymap、geoloc、export-sync-status
  • server:status、start、stop
  • e2ee:status、target-status、decrypt、decrypt-file
  • session:status、undo、redo、history

Agent 指南

  • 优先使用 --json 以获得可解析的输出。
  • 在运行多步工作流时使用 --project,以便持久化历史记录。
  • 一次性修改命令会自动保存项目,除非设置了 --dry-run。
  • REPL 模式不会自动保存;请显式运行 project save。
  • 某些 Joplin 命令行构建会将 search 限制在 GUI 模式下;如果你看到 "only available in GUI mode",请将搜索视为尽力而为。
  • Joplin 3.6.x 在 npm 全局布局中可能存在损坏的 version 命令; 该框架会回退到已安装包的元数据来处理 backend version, 依次探测符号链接解析后的二进制目录、Windows 风格的同级 node_modules/joplin、Unix 风格的父级 lib/node_modules/joplin, 最后是 npm root -g。
  • 命令结果中的后端 stdout/stderr 是逐字原样的;不要假设 警告已从笔记正文或导出中剥离。
  • 失败时,使用与成功时相同的 command 字段来解析 error (config.import_file、e2ee.decrypt_file)。多词子命令在组和子命令之间 使用单个点。

测试工作流

# Quick feedback loop
python -m pytest -q cli_anything/joplin/tests/test_core.py
python -m pytest -q cli_anything/joplin/tests/test_full_e2e.py::TestCLISubprocess

# Real backend (joplin must be in PATH)
python -m pytest -v cli_anything/joplin/tests/test_full_e2e.py::TestBackendCommands
python -m pytest -v cli_anything/joplin/tests/test_full_e2e.py::TestBackendWorkflows
python -m pytest -v cli_anything/joplin/tests/test_full_e2e.py::TestBackendIntegration

# Full suite
python -m pytest -v --tb=no cli_anything/joplin/tests

# Verify the installed console script entry point
CLI_ANYTHING_FORCE_INSTALLED=1 python -m pytest -v -s cli_anything/joplin/tests/test_full_e2e.py

当前验证基线(Windows + Joplin CLI 3.6.2):

  • python -m pytest -q cli_anything/joplin/tests/test_core.py -> 107 passed
  • python -m pytest -q cli_anything/joplin/tests -> 134 passed, 1 skipped

评论

支持 Markdown