Apple日历命令行工具:通过 AI 管理 macOS 日历 - Openclaw Skills

作者:互联网

2026-03-20

AI教程

什么是 Apple Calendar CLI (accli)?

Apple Calendar CLI (accli) 是一款专为 macOS 用户设计的强大工具,可直接从终端或通过自动化代理与原生日历应用交互。作为 Openclaw Skills 生态系统的一部分,它允许 AI 代理和开发人员精准地列出日历、查询事件和管理日程。

它利用 JavaScript for Automation (JXA) 提供与 macOS 系统的深度原生集成。通过使用此技能,用户可以弥合本地日历数据与自动化 AI 工作流之间的鸿沟。此 Openclaw Skills 集成非常适合那些希望在不离开终端环境的情况下实现每日规划自动化、同步日程或构建自定义生产力工具的用户。

下载入口:https://github.com/openclaw/skills/tree/main/skills/joargp/accli

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install accli

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 accli。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Apple Calendar CLI (accli) 应用场景

  • 通过向 AI 代理发送简单的文本提示来安排会议和事件。
  • 同时检查多个 macOS 日历的每日可用性和忙闲时段。
  • 通过删除或更新过时事件来自动化日历清理。
  • 使用不区分大小写的搜索查询获取特定项目或日期范围的议程摘要。
Apple Calendar CLI (accli) 工作原理
  1. 用户或 AI 代理调用 accli 命令列出可用日历并识别正确的持久化 ID。
  2. 该工具使用原生自动化协议查询 macOS 日历数据库,以检索事件或检查特定时间范围的可用性。
  3. 根据输出,用户可以通过传递摘要、开始时间和地点等参数来创建、更新或删除事件。
  4. 该技能为每项操作返回结构化 JSON 数据,允许在 Openclaw Skills 框架内进行程序化解析和复杂逻辑处理。

Apple Calendar CLI (accli) 配置指南

要开始使用此技能,请确保您使用的是 macOS 设备,并运行以下命令全局安装 CLI:

npm install -g @joargp/accli

安装后,您可能需要在 macOS 系统设置中授予终端或 IDE 访问日历数据的必要权限。您可以通过运行以下命令验证安装并设置默认日历:

accli config set-default

Apple Calendar CLI (accli) 数据架构与分类体系

该技能主要处理日历和事件对象,在启用 --json 标志时以结构化 JSON 格式返回数据。这是 Openclaw Skills 集成的推荐格式。

属性 类型 描述
id 字符串 日历或事件的持久标识符。
summary 字符串 日历事件的标题。
start ISO 8601 开始时间戳(例如,YYYY-MM-DDTHH:mm)。
end ISO 8601 事件的结束时间戳。
location 字符串 可选的物理或虚拟位置详细信息。
description 字符串 事件的详细备注或描述。
name: accli
description: This skill should be used when interacting with Apple Calendar on macOS. Use it for listing calendars, viewing events, creating/updating/deleting calendar events, and checking availability/free-busy times. Triggers on requests like "check my calendar", "schedule a meeting", "what's on my schedule", "am I free tomorrow", or any calendar-related operations.

Apple Calendar CLI (accli)

Installation

npm install -g @joargp/accli

Requirements: macOS only (uses JavaScript for Automation)

Overview

The accli tool provides command-line access to macOS Apple Calendar. It enables listing calendars, querying events, creating/updating/deleting events, and checking availability across calendars.

Quick Reference

DateTime Formats

  • Timed events: YYYY-MM-DDTHH:mm or YYYY-MM-DDTHH:mm:ss
  • All-day events: YYYY-MM-DD

Global Options

  • --json - Output as JSON (recommended for parsing)
  • --help - Show help for any command

Commands

List Calendars

accli calendars [--json]

Lists all available calendars with names and persistent IDs. Run this first to discover available calendars and their IDs.

List Events

accli events  [options]

Options:

  • --calendar-id - Persistent calendar ID (recommended over name)
  • --from - Start of range (default: now)
  • --to - End of range (default: from + 7 days)
  • --max - Maximum events to return (default: 50)
  • --query - Case-insensitive filter on summary/location/description
  • --json - Output JSON

Examples:

# Events from Work calendar for this week
accli events Work --json

# Events in January
accli events Work --from 2025-01-01 --to 2025-01-31 --json

# Search for specific events
accli events Work --query "standup" --max 10 --json

Get Single Event

accli event   [--json]

Retrieves details for a specific event by its ID.

Create Event

accli create  --summary  --start  --end  [options]

Required Options:

  • --summary - Event title
  • --start - Start time
  • --end - End time

Optional:

  • --location - Event location
  • --description - Event description
  • --all-day - Create an all-day event
  • --json - Output JSON

Examples:

# Create a timed meeting
accli create Work --summary "Team Standup" --start 2025-01-15T09:00 --end 2025-01-15T09:30 --json

# Create an all-day event
accli create Personal --summary "Vacation" --start 2025-07-01 --end 2025-07-05 --all-day --json

# Create with location and description
accli create Work --summary "Client Meeting" --start 2025-01-15T14:00 --end 2025-01-15T15:00 r
  --location "Conference Room A" --description "Q1 planning discussion" --json

Update Event

accli update   [options]

Options (all optional - only provide what to change):

  • --summary - New title
  • --start - New start time
  • --end - New end time
  • --location - New location
  • --description - New description
  • --all-day - Convert to all-day event
  • --no-all-day - Convert to timed event
  • --json - Output JSON

Example:

accli update Work event-id-123 --summary "Updated Meeting Title" --start 2025-01-15T15:00 --end 2025-01-15T16:00 --json

Delete Event

accli delete   [--json]

Permanently deletes an event. Confirm with user before executing.

Check Free/Busy

accli freebusy --calendar  --from  --to  [options]

Options:

  • --calendar - Calendar name (can repeat for multiple calendars)
  • --calendar-id - Persistent calendar ID (can repeat)
  • --from - Start of range (required)
  • --to - End of range (required)
  • --json - Output JSON

Shows busy time slots, excluding cancelled, declined, and transparent events.

Examples:

# Check availability across calendars
accli freebusy --calendar Work --calendar Personal --from 2025-01-15 --to 2025-01-16 --json

# Check specific hours
accli freebusy --calendar Work --from 2025-01-15T09:00 --to 2025-01-15T18:00 --json

Configuration

# Set default calendar (interactive)
accli config set-default

# Set default by name
accli config set-default --calendar Work

# Show current config
accli config show

# Clear default
accli config clear

When a default calendar is set, commands automatically use it if no calendar is specified.

Workflow Guidelines

Before Creating Events

  1. List calendars to get available calendar names/IDs
  2. Check free/busy to find available time slots
  3. Confirm event details with user before creating

Best Practices

  • Always use --json flag for programmatic parsing
  • Prefer --calendar-id over calendar names for reliability
  • When querying events, start with reasonable date ranges
  • Confirm with user before delete operations
  • Use ISO 8601 datetime format consistently

Common Patterns

Find a free slot and schedule:

# 1. Check availability
accli freebusy --calendar Work --from 2025-01-15T09:00 --to 2025-01-15T18:00 --json

# 2. Create event in available slot
accli create Work --summary "Meeting" --start 2025-01-15T14:00 --end 2025-01-15T15:00 --json

View today's schedule:

accli events Work --from $(date +%Y-%m-%d) --to $(date -v+1d +%Y-%m-%d) --json