ClawSkills logoClawSkills

Openclaw Nextcloud

通过 CalDAV、WebDAV 和 Notes API 管理您的 Nextcloud 实例中的笔记、任务、日历、文件和联系人。用于创建笔记、管理待办事项和日历。

介绍

# OpenClaw Nextcloud Skill

该技能提供与 Nextcloud 实例的集成。它支持访问笔记、任务(待办事项)、日历、文件和联系人。

## 配置

该技能需要以下环境变量:

- `NEXTCLOUD_URL`:您的 Nextcloud 实例的基础 URL(例如 `https://cloud.example.com`)。 - `NEXTCLOUD_USER`:您的 Nextcloud 用户名。 - `NEXTCLOUD_TOKEN`:应用密码(推荐)或您的登录密码。

## 功能

### 1. 笔记(读/写) - 列出、获取、创建、更新和删除笔记。 - API:`index.php/apps/notes/api/v1/notes`

### 2. 任务 / 待办事项(读/写) - 列出、创建、更新、删除和完成任务。 - API:CalDAV (VTODO)。

### 3. 日历(读/写) - 列出、创建、更新和删除事件。 - API:CalDAV (VEVENT)。

### 4. 文件(读/写) - 列出、搜索、上传、下载和删除文件。 - API:WebDAV。

### 5. 联系人(读/写) - 列出、获取、创建、更新、删除和搜索联系人。 - API:CardDAV。

## 使用方法

通过附带的脚本运行该技能。

```bash node scripts/nextcloud.js <command> <subcommand> [options] ```

## 命令

### 笔记 - `notes list` - `notes get --id <id>` - `notes create --title <t> --content <c> [--category <cat>]` - `notes edit --id <id> [--title <t>] [--content <c>] [--category <cat>]` - `notes delete --id <id>`

### 任务 - `tasks list [--calendar <c>]` - `tasks create --title <t> [--calendar <c>] [--due <d>] [--priority <p>] [--description <d>]` - `tasks edit --uid <u> [--calendar <c>] [--title <t>] [--due <d>] [--priority <p>] [--description <d>]` - `tasks delete --uid <u> [--calendar <c>]` - `tasks complete --uid <u> [--calendar <c>]`

### 日历事件 - `calendar list [--from <iso>] [--to <iso>]`(默认为未来 7 天) - `calendar create --summary <s> --start <iso> --end <iso> [--calendar <c>] [--description <d>]` - `calendar edit --uid <u> [--calendar <c>] [--summary <s>] [--start <iso>] [--end <iso>] [--description <d>]` - `calendar delete --uid <u> [--calendar <c>]`

### 日历(列出可用日历) - `calendars list [--type <tasks|events>]`

### 文件 - `files list [--path <path>]` - `files search --query <q>` - `files get --path <path>`(下载文件内容) - `files upload --path <path> --content <content>` - `files delete --path <path>`

### 联系人 - `contacts list [--addressbook <ab>]` - `contacts get --uid <u> [--addressbook <ab>]` - `contacts search --query <q> [--addressbook <ab>]` - `contacts create --name <n> [--addressbook <ab>] [--email <e>] [--phone <p>] [--organization <o>] [--title <t>] [--note <n>]` - `contacts edit --uid <u> [--addressbook <ab>] [--name <n>] [--email <e>] [--phone <p>] [--organization <o>] [--title <t>] [--note <n>]` - `contacts delete --uid <u> [--addressbook <ab>]`

### 通讯录(列出可用通讯录) - `addressbooks list`

## 输出格式

所有输出均为 JSON 格式。

### 任务列表输出 ```json { "status": "success", "data": [ { "uid": "unique-task-id", "calendar": "Calendar Name", "summary": "Task title", "status": "NEEDS-ACTION", "due": "20260201T153000Z", "priority": 0 } ] } ``` - `due`:CalDAV 格式日期(YYYYMMDDTHHmmssZ)或 null - `priority`:0-9(0 = 未定义,1 = 最高,9 = 最低)或 null

### 日历事件列表输出 ```json { "status": "success", "data": [ { "uid": "unique-event-id", "calendar": "Calendar Name", "summary": "Event title", "start": "20260205T100000Z", "end": "20260205T110000Z" } ] } ```

### 联系人列表输出 ```json { "status": "success", "data": [ { "uid": "unique-contact-id", "addressBook": "Address Book Name", "fullName": "John Doe", "name": "Doe;John;;;", "phones": ["+1234567890"], "emails": ["[email protected]"], "organization": "ACME Inc", "title": "Developer", "note": "Met at conference" } ] } ``` - `phones`:电话号码数组或 null - `emails`:电子邮件地址数组或 null - `name`:vCard 格式的结构化姓名(Last;First;Middle;Prefix;Suffix)

### 通用格式 ```json { "status": "success", "data": [ ... ] } ```

```json { "status": "error", "message": "Error description" } ```

## 代理行为:默认日历选择

当创建任务或日历事件时,如果用户未指定日历:

1. **首次(未设置默认值):** - 运行 `calendars list --type tasks`(用于任务)或 `calendars list --type events`(用于事件) - 询问用户从列表中选择要使用的日历 - 询问是否将其设置为未来操作的默认值 - 在内存中记住他们的选择

2. **如果用户设置了默认值:** - 记住 `default_task_calendar` 和/或 `default_event_calendar` - 在后续操作中自动使用,无需询问

3. **如果用户拒绝设置默认值:** - 下次他们在未指定日历的情况下创建任务/事件时再次询问

4. **用户始终可以覆盖:** - 显式指定 `--calendar` 始终优先于默认值

### 内存键 - `default_task_calendar`:任务的默认日历名称 (VTODO) - `default_event_calendar`:事件的默认日历名称 (VEVENT)

## 代理行为:默认通讯录选择

当创建联系人时,如果用户未指定通讯录:

1. **首次(未设置默认值):** - 运行 `addressbooks list` - 询问用户从列表中选择要使用的通讯录 - 询问是否将其设置为未来操作的默认值 - 在内存中记住他们的选择

2. **如果用户设置了默认值:** - 记住 `default_addressbook` - 在后续操作中自动使用,无需询问

3. **如果用户拒绝设置默认值:** - 下次他们在未指定通讯录的情况下创建联系人时再次询问

4. **用户始终可以覆盖:** - 显式指定 `--addressbook` 始终优先于默认值

### 内存键 - `default_addressbook`:联系人的默认通讯录名称

## 代理行为:信息展示

向用户展示数据时,请以可读的方式进行格式化。输出可能会发送到 Markdown 无法渲染的消息平台(Telegram、WhatsApp 等),因此请避免使用 Markdown 格式。

### 通用指南 - 使用表情符号使输出易于浏览且友好 - 请勿使用 Markdown 格式(无 **粗体**、*斜体*、`代码`、表格或使用 - 或 * 的列表) - 使用带换行符的纯文本进行结构化 - 将技术格式(如 CalDAV 日期)转换为人类可读的格式 - 逻辑上对相关项目进行分组

### 表情符号参考 任务:✅(已完成)、⬜(待定)、🔴(高优先级)、🟡(中)、🟢(低) 日历:📅(事件)、⏰(时间)、📍(位置) 笔记:📝(笔记)、📁(分类) 文件:📄(文件)、📂(文件夹)、💾(大小) 联系人:👤(个人)、📧(电子邮件)、📱(电话)、🏢(组织) 状态:✨(已创建)、✏️(已更新)、🗑️(已删除)、❌(错误)

### 示例展示

任务: ``` 📋 Your Tasks

⬜ 🔴 Buy groceries — Due: Tomorrow 3:30 PM ⬜ 🟡 Review PR #42 — Due: Feb 5 ✅ Send email to client ```

日历事件: ``` 📅 Upcoming Events

🗓️ Team Standup ⏰ Mon, Feb 3 • 10:00 AM - 10:30 AM 📍 Zoom

🗓️ Project Review ⏰ Wed, Feb 5 • 2:00 PM - 3:00 PM ```

联系人: ``` 👤 John Doe 📧 [email protected] 📱 +1 234 567 890 🏢 ACME Inc — Developer ```

文件: ``` 📂 Documents/ 📄 report.pdf (2.3 MB) 📄 notes.txt (4 KB) 📂 Archive/ ```

### 日期/时间格式化 将 CalDAV 格式 20260205T100000Z 转换为可读格式,如 Wed, Feb 5 • 10:00 AM 在有帮助时显示相对日期:“明天”、“下周一”、“3 天后” 尽可能使用用户的本地时区

更多产品