@codemieai/code 0.0.46 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,5 +5,5 @@
5
5
  "name": "AI/Run CodeMie",
6
6
  "email": "support@codemieai.com"
7
7
  },
8
- "version": "1.0.12"
8
+ "version": "1.0.14"
9
9
  }
@@ -0,0 +1,182 @@
1
+ # Microsoft Graph API Skill for Claude Code
2
+
3
+ Work with your Microsoft 365 account from Claude Code — emails, calendar, SharePoint, Teams, OneDrive, contacts, and org chart — all via the Microsoft Graph API.
4
+
5
+ ---
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Log in (first time only)
10
+
11
+ ```bash
12
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js login
13
+ ```
14
+
15
+ You'll see a message like:
16
+ ```
17
+ ============================================================
18
+ To sign in, use a web browser to open the page https://microsoft.com/devicelogin
19
+ and enter the code ABCD-1234 to authenticate.
20
+ ============================================================
21
+ ```
22
+
23
+ Open the URL in your browser, enter the code, and sign in with your Microsoft account.
24
+ Your token is cached at `~/.ms_graph_token_cache.json` — you won't need to log in again until it expires (tokens refresh automatically).
25
+
26
+ ### 2. Ask Claude anything
27
+
28
+ After logging in, just ask Claude naturally:
29
+
30
+ - *"Show me my unread emails"*
31
+ - *"What meetings do I have this week?"*
32
+ - *"Find the Q4 report in SharePoint"*
33
+ - *"What did Alice send me in Teams?"*
34
+ - *"Who reports to me?"*
35
+
36
+ Claude will use this skill automatically.
37
+
38
+ ---
39
+
40
+ ## No dependencies required
41
+
42
+ The CLI uses **only built-in Node.js modules** — no `pip install`, no `npm install`.
43
+ Node.js >= 18 is the only requirement, which CodeMie already provides.
44
+
45
+ ---
46
+
47
+ ## CLI Reference
48
+
49
+ ```
50
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js <command> [options]
51
+ ```
52
+
53
+ ### Auth commands
54
+
55
+ | Command | Description |
56
+ |---------|-------------|
57
+ | `login` | Authenticate (device code flow) |
58
+ | `logout` | Remove cached credentials |
59
+ | `status` | Check if you're logged in |
60
+
61
+ ### Data commands
62
+
63
+ | Command | Key options | Description |
64
+ |---------|-------------|-------------|
65
+ | `me` | | Your profile |
66
+ | `emails` | `--limit N`, `--unread`, `--search QUERY`, `--read ID`, `--send TO --subject S --body B`, `--folder NAME` | Work with Outlook emails |
67
+ | `calendar` | `--limit N`, `--create TITLE --start DT --end DT`, `--availability` | Calendar events |
68
+ | `sharepoint` | `--sites`, `--site ID [--path P]`, `--download ID` | SharePoint files |
69
+ | `teams` | `--chats`, `--messages CHAT_ID`, `--send MSG --chat-id ID`, `--teams-list` | Teams messages |
70
+ | `onedrive` | `[--path P]`, `--upload FILE`, `--download ID`, `--info ID` | OneDrive files |
71
+ | `people` | `--search NAME`, `--contacts` | People & contacts |
72
+ | `org` | `--manager`, `--reports` | Org chart |
73
+
74
+ Add `--json` to any command for machine-readable JSON output.
75
+
76
+ ---
77
+
78
+ ## Examples
79
+
80
+ ```bash
81
+ # List 20 most recent emails
82
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js emails --limit 20
83
+
84
+ # Read a specific email (paste the ID from list output)
85
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js emails --read AAMkAGI2...
86
+
87
+ # Send an email
88
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js emails \
89
+ --send colleague@company.com \
90
+ --subject "Quick question" \
91
+ --body "Are you free tomorrow at 2pm?"
92
+
93
+ # Upcoming calendar events
94
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js calendar --limit 5
95
+
96
+ # Create a meeting
97
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js calendar \
98
+ --create "Design Review" \
99
+ --start "2024-03-20T14:00" \
100
+ --end "2024-03-20T15:00" \
101
+ --timezone "Europe/Berlin"
102
+
103
+ # List SharePoint sites you follow
104
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js sharepoint --sites
105
+
106
+ # Browse a site's documents
107
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js sharepoint \
108
+ --site "contoso.sharepoint.com,abc123,def456" \
109
+ --path "Documents/2024"
110
+
111
+ # Download a OneDrive file
112
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js onedrive --download ITEM_ID --output report.xlsx
113
+
114
+ # Upload to OneDrive
115
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js onedrive \
116
+ --upload ./presentation.pptx \
117
+ --dest "Documents/presentations/deck.pptx"
118
+
119
+ # Recent Teams chats
120
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js teams --chats
121
+
122
+ # Read a chat conversation
123
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js teams --messages 19:abc123@thread.v2
124
+
125
+ # Search your contacts
126
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js people --search "John"
127
+
128
+ # Your manager
129
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js org --manager
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Token Cache
135
+
136
+ Credentials are stored in `~/.ms_graph_token_cache.json`.
137
+ - Access tokens refresh automatically (they last ~1 hour, silently renewed via refresh token)
138
+ - Refresh tokens last ~90 days by default in Azure
139
+ - Run `logout` to remove the cache: `node msgraph.js logout`
140
+
141
+ ---
142
+
143
+ ## Permissions
144
+
145
+ The script requests these Microsoft Graph scopes on first login:
146
+
147
+ | Scope | Used for |
148
+ |-------|---------|
149
+ | `User.Read` | Profile (`me`, `org`) |
150
+ | `Mail.Read` | Reading emails |
151
+ | `Mail.Send` | Sending emails |
152
+ | `Calendars.Read` / `Calendars.ReadWrite` | Calendar events |
153
+ | `Files.Read` / `Files.ReadWrite` | OneDrive files |
154
+ | `Sites.Read.All` | SharePoint sites |
155
+ | `Chat.Read` / `Chat.ReadWrite` | Teams chats |
156
+ | `People.Read` | People rankings |
157
+ | `Contacts.Read` | Outlook contacts |
158
+ | `offline_access` | Silent token refresh |
159
+
160
+ If your organization restricts some permissions, certain commands may return `Permission denied`.
161
+
162
+ ---
163
+
164
+ ## Troubleshooting
165
+
166
+ **`NOT_LOGGED_IN`**
167
+ ```bash
168
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js login
169
+ ```
170
+
171
+ **`TOKEN_EXPIRED`**
172
+ ```bash
173
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js login
174
+ ```
175
+
176
+ **`Permission denied (403)`**
177
+ Your organization may have restricted that Graph API permission. Contact your IT admin.
178
+
179
+ **`Authentication expired (401)`**
180
+ ```bash
181
+ node .codemie/claude-plugin/skills/msgraph/scripts/msgraph.js login
182
+ ```
@@ -0,0 +1,230 @@
1
+ ---
2
+ name: msgraph
3
+ description: >
4
+ Work with Microsoft 365 services via the Graph API — emails, calendar events, SharePoint sites,
5
+ Teams chats, OneDrive files, contacts, and org chart. Use this skill whenever the user asks
6
+ about their emails, inbox, unread messages, meetings, calendar, Teams messages or chats,
7
+ SharePoint documents, OneDrive files, colleagues, manager, direct reports, or any personal/
8
+ organizational Microsoft data. Invoke proactively any time the user mentions Outlook, Teams,
9
+ SharePoint, OneDrive, or wants to interact with their Microsoft 365 account. The skill uses
10
+ a local Node.js CLI (msgraph.js) that handles authentication, token caching, and all API calls.
11
+ ---
12
+
13
+ # Microsoft Graph API Skill
14
+
15
+ This skill lets you interact with Microsoft 365 services on behalf of the user using the
16
+ Microsoft Graph API. The Node.js CLI at `scripts/msgraph.js` handles everything — no Python
17
+ or extra packages needed, only the Node.js that CodeMie already requires.
18
+
19
+ ## Setup & Authentication
20
+
21
+ **Check login status first** — always run this before any other command:
22
+
23
+ ```bash
24
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js status
25
+ ```
26
+
27
+ **Output interpretation:**
28
+ - `Logged in as: user@company.com` → proceed with any command below
29
+ - `NOT_LOGGED_IN` → follow the Login Flow below
30
+ - `TOKEN_EXPIRED` → session expired, also follow the Login Flow below
31
+
32
+ ### Login Flow (first time or after expiry)
33
+
34
+ ```bash
35
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js login
36
+ ```
37
+
38
+ This starts the **Device Code Flow** — it will print a URL and a short code like:
39
+ ```
40
+ To sign in, use a web browser to open the page https://microsoft.com/devicelogin
41
+ and enter the code ABCD-1234 to authenticate.
42
+ ```
43
+
44
+ Tell the user exactly that message, then wait. Once they complete login in the browser,
45
+ the token is cached at `~/.ms_graph_token_cache.json` and all subsequent commands run silently.
46
+
47
+ ### When NOT logged in or token expired
48
+
49
+ If status returns `NOT_LOGGED_IN` or `TOKEN_EXPIRED`, tell the user:
50
+
51
+ > "You need to log in to Microsoft first. Run this command in your terminal:
52
+ > ```
53
+ > node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js login
54
+ > ```
55
+ > A code and URL will appear — open the URL in your browser and enter the code."
56
+
57
+ ---
58
+
59
+ ## Available Commands
60
+
61
+ ### Profile & Org
62
+
63
+ ```bash
64
+ # Your profile
65
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js me
66
+
67
+ # Your manager
68
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js org --manager
69
+
70
+ # Your direct reports
71
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js org --reports
72
+ ```
73
+
74
+ ### Emails
75
+
76
+ ```bash
77
+ # List recent emails (default 10)
78
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails
79
+
80
+ # More emails
81
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --limit 25
82
+
83
+ # Unread only
84
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --unread
85
+
86
+ # Search emails
87
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --search "invoice Q4"
88
+
89
+ # Read a specific email by ID (copy ID from list output)
90
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --read MESSAGE_ID
91
+
92
+ # Send an email
93
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --send recipient@example.com --subject "Hello" --body "Message text"
94
+
95
+ # Browse specific folder (inbox, sentitems, drafts, deleteditems, junkemail)
96
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --folder sentitems --limit 5
97
+
98
+ # Machine-readable JSON output
99
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js emails --json
100
+ ```
101
+
102
+ ### Calendar
103
+
104
+ ```bash
105
+ # Upcoming events (default 10)
106
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js calendar
107
+
108
+ # More events
109
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js calendar --limit 20
110
+
111
+ # Create an event
112
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js calendar --create "Team Standup" \
113
+ --start "2024-03-20T09:00" --end "2024-03-20T09:30" \
114
+ --location "Teams" --timezone "Europe/Berlin"
115
+
116
+ # Check availability for a time window
117
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js calendar --availability \
118
+ --start "2024-03-20T09:00:00" --end "2024-03-20T18:00:00"
119
+ ```
120
+
121
+ ### SharePoint
122
+
123
+ ```bash
124
+ # List followed/joined SharePoint sites
125
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js sharepoint --sites
126
+
127
+ # Browse files in a specific site (use ID from --sites output)
128
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js sharepoint --site SITE_ID
129
+
130
+ # Browse a subfolder within a site
131
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js sharepoint --site SITE_ID --path "Documents/Reports"
132
+
133
+ # Download a file
134
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js sharepoint --download ITEM_ID --output report.xlsx
135
+ ```
136
+
137
+ ### Teams
138
+
139
+ ```bash
140
+ # List all Teams chats
141
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js teams --chats
142
+
143
+ # Read messages from a chat (use chat ID from --chats output)
144
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js teams --messages CHAT_ID
145
+
146
+ # Send a message to a chat
147
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js teams --send "Hello team!" --chat-id CHAT_ID
148
+
149
+ # List teams you're a member of
150
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js teams --teams-list
151
+ ```
152
+
153
+ ### OneDrive
154
+
155
+ ```bash
156
+ # List root files
157
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js onedrive
158
+
159
+ # Browse a folder
160
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js onedrive --path "Documents"
161
+
162
+ # Upload a file
163
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js onedrive --upload ./report.pdf --dest "Documents/report.pdf"
164
+
165
+ # Download a file by ID
166
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js onedrive --download ITEM_ID --output local_copy.pdf
167
+
168
+ # File metadata
169
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js onedrive --info ITEM_ID
170
+ ```
171
+
172
+ ### People & Contacts
173
+
174
+ ```bash
175
+ # Frequent collaborators (AI-ranked by Microsoft)
176
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js people
177
+
178
+ # Search people by name
179
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js people --search "Alice"
180
+
181
+ # Outlook address book contacts
182
+ node ${CLAUDE_PLUGIN_ROOT}/skills/msgraph/scripts/msgraph.js people --contacts
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Workflow Patterns
188
+
189
+ ### "Show me my emails"
190
+ 1. Run `status` → check login
191
+ 2. Run `emails --limit 15` → show results
192
+ 3. If user wants to read one, run `emails --read ID`
193
+
194
+ ### "What's on my calendar today/this week?"
195
+ 1. Run `calendar --limit 10`
196
+ 2. Parse dates in output and filter for user's timeframe
197
+
198
+ ### "Find a file in SharePoint"
199
+ 1. Run `sharepoint --sites` → list sites
200
+ 2. Run `sharepoint --site SITE_ID` → browse files
201
+ 3. Use `--path` to drill into folders
202
+ 4. Offer `--download ITEM_ID` if user wants the file
203
+
204
+ ### "Check my Teams messages"
205
+ 1. Run `teams --chats` → list chats
206
+ 2. User picks a chat → run `teams --messages CHAT_ID`
207
+
208
+ ### "Who's my manager?" / "Who reports to me?"
209
+ - Run `org --manager` or `org --reports`
210
+
211
+ ---
212
+
213
+ ## Error Handling
214
+
215
+ | Exit code | Meaning |
216
+ |-----------|---------|
217
+ | 0 | Success |
218
+ | 1 | API error (shown in output) |
219
+ | 2 | NOT_LOGGED_IN — user must run `login` |
220
+
221
+ When you see `Permission denied` errors, it means the OAuth scope isn't granted for that operation.
222
+ This can happen if the user's organization has restricted certain Graph API permissions.
223
+
224
+ ---
225
+
226
+ ## Dependencies
227
+
228
+ **None** — the script uses only built-in Node.js modules (`https`, `fs`, `path`, `os`).
229
+ Node.js >= 18 is required, which is already a CodeMie prerequisite.
230
+ IMPORTANT: you must work with current date (get it from sh/bash)