在介绍了 Pyto 的协议集成后,今天我们将目光投向任务管理领域。如果你使用 Beorg 来管理日常任务和项目,那么 Protocol Launcher 能让你通过深度链接实现更高效的 workflow 集成。
作为追求效率的开发者或知识工作者,你可能经常遇到这些场景:
- 在网页上看到有价值的信息,想一键添加到 Beorg 待办清单
- 从其他应用(如 Shortcuts、Alfred)快速捕获任务到 Beorg
- 在团队协作文档中嵌入链接,让成员直接打开特定文件或视图
- 通过自动化流程搜索和过滤 Beorg 中的任务
现在,通过 Protocol Launcher,你可以以类型安全的方式生成 Beorg 深度链接,让任务管理变得更加流畅。
Beorg 与深度链接
Beorg 是一款强大的 iOS/iPadOS 任务管理应用,采用 Org 模式语法的纯文本文件来组织任务。它提供了丰富的 URL Scheme 支持,允许从外部应用触发捕获、搜索、查看议程等操作。
然而,手动拼接这些 beorg:// 协议链接需要记住各种参数格式和编码规则,而且缺乏类型提示,容易出错。
核心能力:全场景任务管理集成
Protocol Launcher 为 Beorg 专门提供了 protocol-launcher/beorg 模块,支持以下核心功能:
- 打开应用:快速唤起 Beorg 应用
- 捕获任务:添加新项目到 Beorg,支持标题、笔记、计划日期、截止日期等
- 搜索项目:在 Beorg 中搜索任务并返回 JSON 结果
- 显示议程:直接打开议程视图
- 显示任务:打开任务标签页,支持搜索过滤
- 查看文件:直接定位到特定的 Org 文件
快速上手
首先,确保你的项目中已安装:
bash
npm install protocol-launcher
在代码中你可以根据场景选择两种导入方式:
- 按需加载(通过子路径导入):支持 Tree Shaking,体积更小
- 全量导入(从根包导入):写法更简单,但会引入所有应用模块
typescript
// ✅ 推荐:按需加载 Beorg 模块
import { open, capture, search, showAgenda, showTasks, viewFile } from 'protocol-launcher/beorg'
// 也可以从根包导入,但会包含所有应用模块
// import { beorg } from 'protocol-launcher'
场景一:打开 Beorg 应用 (open)
最简单的用法,直接唤起 Beorg 应用:
typescript
import { open } from 'protocol-launcher/beorg'
const url = open()
场景二:捕获新任务 (capture)
这是最常用的功能。你可以从任何地方快速添加任务到 Beorg:
typescript
import { capture } from 'protocol-launcher/beorg'
// 捕获带有标题、笔记和计划日期的任务
const url = capture({
title: '购物清单',
notes: '买鸡蛋',
scheduled: '2017-10-03',
file: 'shopping',
})
// 捕获带有截止日期、模板和编辑选项的任务
const url = capture({
title: '新项目',
notes: '完成项目开发',
deadline: '2017-10-10',
template: 'Daily Review',
edit: true,
})
注意:
file参数是文件名(不含扩展名),任务会被添加到对应的 Org 文件中。
场景三:搜索任务 (search)
在 Beorg 中搜索项目,并可选择回调 URL 来处理搜索结果:
typescript
import { search } from 'protocol-launcher/beorg'
// 简单搜索
const url = search({
search: 't bookmark',
})
// 带回调 URL 的搜索(用于 Shortcuts 自动化)
const url = search({
search: 't bookmark',
xSuccess: 'shortcuts://x-callback-url/run-shortcut?name=ProcessResults',
})
提示: 搜索结果会以 JSON 格式返回给
x-success指定的回调 URL,包含count(结果数量)和items(结果列表)。
场景四:显示议程 (showAgenda)
直接打开 Beorg 的议程视图:
typescript
import { showAgenda } from 'protocol-launcher/beorg'
const url = showAgenda()
场景五:显示任务列表 (showTasks)
打开任务标签页,可选择带搜索过滤器:
typescript
import { showTasks } from 'protocol-launcher/beorg'
// 显示所有任务
const url = showTasks({})
// 显示带搜索过滤器的任务
const url = showTasks({
search: 't bookmark',
})
场景六:查看特定文件 (viewFile)
直接定位到某个 Org 文件:
typescript
import { viewFile } from 'protocol-launcher/beorg'
const url = viewFile({
file: 'shopping',
})
为什么选择 Protocol Launcher?
- 类型安全与参数提示:TypeScript 的智能补全会确保你提供了正确的参数,避免拼接错误。
- 自动编码处理:库内部自动处理 URL 参数编码,确保生成的链接 100% 可用。
- 模块化设计:支持按需加载,构建工具只会打包你使用的代码,保持应用体积最小。
- 统一的 API 风格:与其他应用(VS Code、GitHub Desktop 等)保持一致的使用体验,学习成本低。
- 自动化集成友好:完美适配 Shortcuts、Alfred、Raycast 等自动化工具,让 workflow 更加流畅。
实战演示:构建自动化工作流
让我展示一个实际的使用场景:
typescript
// 场景:从浏览器扩展捕获任务到 Beorg
import { capture } from 'protocol-launcher/beorg'
function captureFromBrowser(title: string, url: string) {
const link = capture({
title: `阅读:${title}`,
notes: `来源:${url}`,
template: 'Reading List',
edit: true,
})
// 在浏览器中打开链接,唤起 Beorg
window.location.href = link
}
// 使用示例
captureFromBrowser('Protocol Launcher 文档', 'https://protocol-launcher.huayi-data.com/')
结语
通过 Protocol Launcher,你可以将 Beorg 深度集成到你的日常工作流中。无论是个人任务管理,还是团队知识协作,它都是连接 Web 应用与本地任务管理器的优雅桥梁。
🔗 相关链接
- Protocol Launcher 官网:https://protocol-launcher.huayi-data.com/
- Beorg 模块文档:Beorg | Protocol Launcher