About this project
cb365 offers command-line access to Microsoft 365 services, serving as an alternative to writing custom Graph API applications or manual UI interaction. It enables automation of tasks such as creating tasks, sending mail, managing calendars, posting to Teams, and interacting with SharePoint, OneDrive, Planner, and Loop. The tool provides structured JSON output, making it suitable for consumption by scripts and AI agents.
Key features and target audiences include:
* **DevOps and platform engineers**: For scripting M365 operations like creating tasks from CI or posting build results to Teams.
* **AI agent builders**: Designed with `--json` output and safety flags for autonomous workflows.
* **IT admins**: A CLI alternative to PowerShell for Graph API operations.
* **Developers**: Reduces boilerplate Graph SDK code for common M365 tasks.
cb365 wraps the Microsoft Graph API, handling complexities like:
* **Authentication**: Supports device-code, client credentials, and certificate flows, storing tokens securely in the OS keychain.
* **Safety**: Incorporates 44 hardcoded rules, requiring `--force` for deletes and `--confirm` for broadcasts, with `--dry-run` available for all write operations. Tokens are never exposed in output.
* **Output**: Provides `--json`, `--plain` (TSV), and human-readable table formats, designed for pipeline integration.
* **Profiles**: Manages delegated and app-only authentication side-by-side, allowing easy tenant switching.
* **No dependencies**: A single Go binary with no runtime requirements.
Installation is available via `go install` or pre-built release binaries. Users must register an Entra ID App and configure necessary API permissions. Authentication supports delegated (device code) for interactive use, and app-only (client secret or certificate) for unattended automation, with client secrets accepted only from standard input for security.
Commands are available for various M365 workloads:
* **Auth**: Login, status, logout, profile management.
* **To Do**: List, create, update, complete, and delete task lists and tasks.
* **Mail**: List, get, mark read, move, permanently delete, draft, send, and search messages.
* **Calendar**: List, get, create, update, and delete events.
* **Contacts**: List, get, search, create, and update contacts.
* **Planner**: List plans, create plans, manage buckets, and manage tasks.
* **Teams**: List channels, send messages to channels and chats, and soft-delete channel messages.
* **SharePoint**: List/search sites, get site details, manage lists and list items, and manage files (list, get, upload).
* **OneDrive**: List, get, upload, delete files, and create folders.
* **Loop**: List workspaces and pages, download/export pages, delete pages, upload files, and create folders.
Global flags include `--json`, `--plain`, `--profile`, `--dry-run`, and `--verbose`. The tool emphasizes keeping business content out of process arguments by supporting indirect values from files or stdin. Safety rules are hardcoded, covering write protection, calendar-specific rules (e.g., timezone validation, duplicate detection, attendee count guards), mail safety (e.g., `--confirm` for sending, recipient count guards), and token safety (secure storage, no output exposure).
For AI agent integration, `--json` output provides structured data. Agents are advised to treat M365 content as untrusted data and to use explicit allowlists for commands and confirmation flags for side effects. Error handling uses standard Unix exit codes, with errors printed to stderr.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.