返回顶部
c

craft制作工艺

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
244
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

craft

Craft 文档管理

通过 Craft Connect REST API 操作 Craft 空间。支持对文档、区块、文件夹、任务、集合和评论的完整增删改查。

要求

  • - curl — 用于所有 API 请求
  • CRAFTAPIURL — 您的 Craft Connect API 基础 URL(包含用于身份验证的嵌入式链接令牌)

设置

  1. 1. 在您的 Craft 空间中创建一个 Craft Connect 链接(设置 → 连接 → 创建链接)
  2. 复制 API 基础 URL 并将其存储在 TOOLS.md 的 Craft 部分下:

CRAFTAPIURL=https://connect.craft.do/links//api/v1

  1. 3. 在发起任何调用以获取 URL 之前,请先阅读 TOOLS.md。

所有调用均使用 curl,写入时使用 -H Content-Type: application/json,读取时使用 -H Accept: application/json。

重要提示: 对查询参数中的非 ASCII 字符(例如中文)进行 URL 编码。



API 参考

连接信息

bash
curl -s $CRAFTAPIURL/connection

返回空间 ID、时区、当前时间和深度链接 URL 模板。

发现

bash

列出所有文件夹和位置


curl -s $CRAFTAPIURL/folders

列出某个位置的文档(unsorted | trash | templates | daily_notes)

curl -s $CRAFTAPIURL/documents?location=unsorted

列出文件夹中的文档

curl -s $CRAFTAPIURL/documents?folderId=

带元数据(创建/修改日期、深度链接)

curl -s $CRAFTAPIURL/documents?location=unsorted&fetchMetadata=true

日期筛选(ISO YYYY-MM-DD 或:today, yesterday, tomorrow)

curl -s $CRAFTAPIURL/documents?createdDateGte=2025-01-01&lastModifiedDateLte=today

搜索

bash

搜索所有文档(对非 ASCII 字符进行 URL 编码!)


curl -s $CRAFTAPIURL/documents/search?include=&fetchMetadata=true

在特定文档内搜索(带上下文区块)

curl -s $CRAFTAPIURL/blocks/search?blockId=&pattern=&beforeBlockCount=2&afterBlockCount=2

按文件夹或位置筛选搜索

curl -s $CRAFTAPIURL/documents/search?include=&folderIds= curl -s $CRAFTAPIURL/documents/search?include=&location=daily_notes

文档

bash

创建文档(默认为 unsorted)


curl -s -X POST $CRAFTAPIURL/documents \
-H Content-Type: application/json \
-d {documents: [{title: 我的文档}]}

在特定文件夹中创建

curl -s -X POST $CRAFTAPIURL/documents \ -H Content-Type: application/json \ -d {documents: [{title: 文档}], destination: {folderId: }}

创建为模板

curl -s -X POST $CRAFTAPIURL/documents \ -H Content-Type: application/json \ -d {documents: [{title: 模板}], destination: {destination: templates}}

删除(软删除到回收站,可恢复)

curl -s -X DELETE $CRAFTAPIURL/documents \ -H Content-Type: application/json \ -d {documentIds: []}

在位置之间移动

curl -s -X PUT $CRAFTAPIURL/documents/move \ -H Content-Type: application/json \ -d {documentIds: [], destination: {folderId: }}

从回收站恢复

curl -s -X PUT $CRAFTAPIURL/documents/move \ -H Content-Type: application/json \ -d {documentIds: [], destination: {destination: unsorted}}

读取内容

bash

获取文档内容(JSON)


curl -s $CRAFTAPIURL/blocks?id= -H Accept: application/json

获取每日笔记

curl -s $CRAFTAPIURL/blocks?date=today -H Accept: application/json

控制深度(0=仅区块,1=直接子级,-1=全部)

curl -s $CRAFTAPIURL/blocks?id=&maxDepth=1

带元数据(评论、作者、时间戳)

curl -s $CRAFTAPIURL/blocks?id=&fetchMetadata=true

写入内容

两种方法:markdown(推荐)和 blocks JSON

方法 1:Markdown(推荐)

适用于大多数内容。Craft 解析 markdown 并自动生成正确的区块类型、缩进级别和列表样式。

bash
curl -s -X POST $CRAFTAPIURL/blocks \
-H Content-Type: application/json \
-d {
markdown: ## 标题\n\n段落\n\n- 项目 1\n- 项目 2,
position: {position: end, pageId: }
}

方法 2:Blocks JSON

当您需要对 color、font、textStyle 或其他无法在纯 markdown 中表达的属性进行显式控制时使用。

bash
curl -s -X POST $CRAFTAPIURL/blocks \
-H Content-Type: application/json \
-d {
blocks: [
{type: text, textStyle: h2, markdown: ## 标题},
{type: text, color: #00A3CB, markdown: 💡 信息}
],
position: {position: end, pageId: }
}

位置选项

位置语法
追加到文档末尾{position: end, pageId: <DOCID>}
插入到文档开头
{position: start, pageId: ID>} | | 在特定区块之后 | {position: after, siblingId: } | | 在特定区块之前 | {position: before, siblingId: } | | 追加到每日笔记 | {position: end, date: today} |

更新和删除区块

bash

更新(仅更改提供的字段;其他字段保持不变)


curl -s -X PUT $CRAFTAPIURL/blocks \
-H Content-Type: application/json \
-d {blocks: [{id: , markdown: 已更新, font: serif}]}

删除区块(永久删除!)

curl -s -X DELETE $CRAFTAPIURL/blocks \ -H Content-Type: application/json \ -d {blockIds: [, ]}

在文档之间移动区块

curl -s -X PUT $CRAFTAPIURL/blocks/move \ -H Content-Type: application/json \ -d {blockIds: [], position: {position: end, pageId: }}

任务

bash

列出任务(范围:inbox, active, upcoming, logbook, document)


curl -s $CRAFTAPIURL/tasks?scope=active
curl -s $CRAFTAPIURL/tasks?scope=document&documentId=

在收件箱中创建任务

curl -s -X POST $CRAFTAPIURL/tasks \ -H Content-Type: application/json \ -d {tasks: [{markdown: 任务文本, taskInfo: {scheduleDate: tomorrow}, location: {type: inbox}}]}

在每日笔记中创建任务

curl -s -X POST $CRAFTAPIURL/tasks \ -H Content-Type: application/json \ -d {tasks: [{markdown: 任务, taskInfo: {scheduleDate: 2025-01-20, deadlineDate: 2025-01-22}, location: {type: dailyNote, date: today}}]}

在文档中创建任务

curl -s -

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 craft-connect-1776119483 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 craft-connect-1776119483 技能

通过命令行安装

skillhub install craft-connect-1776119483

下载

⬇ 下载 craft v1.0.1(免费)

文件大小: 7.37 KB | 发布时间: 2026-4-15 12:20

v1.0.1 最新 2026-4-15 12:20
- Clarified requirements for using the skill, including the need for CRAFT_API_URL and curl.
- Added step-by-step setup instructions for obtaining and storing the Craft Connect API URL.
- Improved the description to specify that the API base URL must have an embedded link token and must be stored in TOOLS.md.
- No changes to the API reference or available endpoints.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部