介绍
# Clippy - Microsoft 365 CLI
源码地址:https://github.com/foeken/clippy
通过浏览器自动化(Playwright)在 M365 Web UI 上运行,而非使用 Graph API。无需注册 Azure AD 应用程序——只需使用浏览器登录。
## 安装
```bash git clone https://github.com/foeken/clippy.git cd clippy && bun install bun run src/cli.ts --help ```
或者全局链接:`bun link`
## 身份验证
```bash # Interactive login (opens browser, establishes session) clippy login --interactive
# Check auth status clippy whoami ```
### 保持会话(推荐)
保持浏览器会话活跃以防止令牌过期:
```bash # Start keepalive (keeps browser open, refreshes every 10min) clippy keepalive --interval 10 ```
为了持久化运行,请将其设置为 launchd 服务或 systemd 服务。
**健康监控:** 每次成功刷新时,Keepalive 会写入 `~/.config/clippy/keepalive-health.txt`。检查该文件是否过期(>15 分钟)以检测故障。
## 日历
```bash # Today's events clippy calendar
# Specific day clippy calendar --day tomorrow clippy calendar --day monday clippy calendar --day 2024-02-15
# Week view clippy calendar --week
# With details (description, attendees) clippy calendar --details ```
### 创建事件
```bash clippy create-event "Title" 09:00 10:00
# Full options clippy create-event "Meeting" 14:00 15:00 \ --day tomorrow \ --description "Meeting notes" \ --attendees "[email protected],[email protected]" \ --teams \ --find-room
# Recurring clippy create-event "Standup" 09:00 09:15 --repeat daily clippy create-event "Sync" 14:00 15:00 --repeat weekly --days mon,wed,fri ```
### 更新/删除事件
```bash clippy update-event 1 --title "New Title" clippy update-event 1 --start 10:00 --end 11:00 clippy delete-event 1 clippy delete-event 1 --message "Need to reschedule" ```
### 回复邀请
```bash clippy respond # List pending clippy respond accept --id <eventId> clippy respond decline --id <eventId> --message "Conflict" clippy respond tentative --id <eventId> ```
### 查找会议时间
```bash clippy findtime clippy findtime --attendees "[email protected],[email protected]" clippy findtime --duration 60 --days 5 ```
## 邮件
```bash # Inbox clippy mail clippy mail --unread clippy mail -n 20 clippy mail --search "invoice"
# Other folders clippy mail sent clippy mail drafts clippy mail archive
# Read email clippy mail -r <number>
# Download attachments clippy mail -d <number> -o ~/Downloads ```
### 发送邮件
```bash clippy send \ --to "[email protected]" \ --subject "Subject" \ --body "Message body"
# With CC, attachments, markdown clippy send \ --to "[email protected]" \ --cc "[email protected]" \ --subject "Report" \ --body "**See attached**" \ --markdown \ --attach "report.pdf" ```
### 回复/转发
```bash clippy mail --reply <number> --message "Thanks!" clippy mail --reply-all <number> --message "Got it" clippy mail --forward <number> --to-addr "[email protected]" ```
### 邮件操作
```bash clippy mail --mark-read <number> clippy mail --flag <number> clippy mail --move <number> --to archive ```
## 人员/会议室搜索
```bash clippy find "john" # People clippy find "conference" --rooms # Rooms ```
## JSON 输出
```bash clippy calendar --json clippy mail --json ```
## 配置
可以覆盖配置文件目录: ```bash export CLIPPY_PROFILE_DIR=~/.config/clippy/my-profile ```