@zibby/skills 0.1.39 → 0.1.40
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.
- package/README.md +94 -5
- package/dist/chat-notify.js +4 -4
- package/dist/figma.d.ts +124 -0
- package/dist/figma.js +19 -0
- package/dist/github.js +2 -2
- package/dist/gitlab.js +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +105 -79
- package/dist/integrations.d.ts +6 -0
- package/dist/integrations.js +1 -1
- package/dist/jira.js +3 -3
- package/dist/lark.js +1 -1
- package/dist/linear.js +3 -3
- package/dist/llm-billing.js +1 -1
- package/dist/notion.d.ts +76 -0
- package/dist/notion.js +9 -0
- package/dist/package.json +10 -8
- package/dist/plane.js +1 -1
- package/dist/sentry.js +1 -1
- package/dist/slack.js +1 -1
- package/dist/trackers/github-adapter.js +2 -2
- package/dist/trackers/index.js +1 -1
- package/dist/trackers/jira-adapter.js +4 -4
- package/dist/trackers/linear-adapter.js +8 -8
- package/docs/concepts/sub-graphs.md +1 -1
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,8 +1,73 @@
|
|
|
1
1
|
# @zibby/skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@zibby/skills)
|
|
4
|
+
[](https://www.npmjs.com/package/@zibby/skills)
|
|
5
|
+
[](./LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
[Deutsch](./i18n/README.de.md) | [Español](./i18n/README.es.md) | [français](./i18n/README.fr.md) | [日本語](./i18n/README.ja.md) | [한국어](./i18n/README.ko.md) | [Português](./i18n/README.pt.md) | [Русский](./i18n/README.ru.md) | [中文](./i18n/README.zh.md)
|
|
8
|
+
|
|
9
|
+
📖 **Full docs:** [docs.zibby.app](https://docs.zibby.app) · [Get Started](https://docs.zibby.app/get-started/install) · [Concepts](https://docs.zibby.app/concepts/graph) · [CLI Reference](https://docs.zibby.app/cli-reference) · [Cloud](https://docs.zibby.app/cloud/triggering)
|
|
10
|
+
|
|
11
|
+
> **The skill layer for [@zibby/agent-workflow](https://github.com/ZibbyDev/agent-workflow).** Built-in skill definitions that give a workflow node the tools it needs — function tools, MCP servers, browser, issue trackers, memory. Vendor-neutral, JavaScript-first.
|
|
12
|
+
|
|
13
|
+
`@zibby/skills` is the batteries-included companion to [`@zibby/agent-workflow`](https://github.com/ZibbyDev/agent-workflow) ([npm](https://www.npmjs.com/package/@zibby/agent-workflow)) — *"Graph-based AI agent workflow orchestration."* The workflow engine ships **zero skills** on purpose; this package is where the built-in ones live.
|
|
14
|
+
|
|
15
|
+
A **skill** is the contract between a workflow node and a tool. It tells the engine what the tool does, how to start it, and what it needs. The engine never hardcodes any skill by name — it reads the skill definition and wires things up generically for both Claude and Cursor agents.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
@zibby/agent-workflow node @zibby/skills
|
|
19
|
+
────────────────────────── ─────────────
|
|
20
|
+
skills: ['add'] ──► getSkill('add')
|
|
21
|
+
│
|
|
22
|
+
▼
|
|
23
|
+
skill.resolve() → { command, args, env }
|
|
24
|
+
│
|
|
25
|
+
┌────────┴────────┐
|
|
26
|
+
▼ ▼
|
|
27
|
+
Claude SDK Cursor CLI
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Used with @zibby/agent-workflow
|
|
33
|
+
|
|
34
|
+
You don't use `@zibby/skills` on its own — it plugs into [@zibby/agent-workflow](https://github.com/ZibbyDev/agent-workflow). A node names the skills it wants in its `skills:` array, and the workflow engine resolves them at run time:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @zibby/agent-workflow @zibby/skills
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
// 1. Import the package to register all built-in skills
|
|
42
|
+
import '@zibby/skills';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Define a skill once…
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { skill } from '@zibby/skills';
|
|
49
|
+
|
|
50
|
+
export const add = skill('add', {
|
|
51
|
+
description: 'Add two numbers',
|
|
52
|
+
input: { a: 'number', b: 'number' },
|
|
53
|
+
handler: async ({ a, b }) => ({ result: a + b })
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
…and an **@zibby/agent-workflow node** requests it by id:
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
// Used by an @zibby/agent-workflow node
|
|
61
|
+
export const mathNode = {
|
|
62
|
+
name: 'do_math',
|
|
63
|
+
skills: ['add'],
|
|
64
|
+
prompt: (state) => `Add ${state.a} and ${state.b}`,
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When the engine runs `do_math`, it sees `skills: ['add']`, looks the skill up, calls `resolve()`, and hands the resulting tool to whichever agent runs the node. See [`@zibby/agent-workflow`](https://www.npmjs.com/package/@zibby/agent-workflow) for how nodes, graphs, and state fit together.
|
|
69
|
+
|
|
70
|
+
---
|
|
6
71
|
|
|
7
72
|
## Quick start
|
|
8
73
|
|
|
@@ -16,6 +81,8 @@ Import the package to register all built-in skills:
|
|
|
16
81
|
import '@zibby/skills';
|
|
17
82
|
```
|
|
18
83
|
|
|
84
|
+
---
|
|
85
|
+
|
|
19
86
|
## The `skill()` factory
|
|
20
87
|
|
|
21
88
|
One function to create any skill. Auto-detects the type and auto-registers.
|
|
@@ -34,7 +101,7 @@ export const add = skill('add', {
|
|
|
34
101
|
});
|
|
35
102
|
```
|
|
36
103
|
|
|
37
|
-
Use it in
|
|
104
|
+
Use it in an @zibby/agent-workflow node:
|
|
38
105
|
|
|
39
106
|
```javascript
|
|
40
107
|
export const mathNode = {
|
|
@@ -65,6 +132,8 @@ export const linear = skill('linear', {
|
|
|
65
132
|
});
|
|
66
133
|
```
|
|
67
134
|
|
|
135
|
+
---
|
|
136
|
+
|
|
68
137
|
## Built-in skills
|
|
69
138
|
|
|
70
139
|
| ID | Server | MCP Package |
|
|
@@ -74,6 +143,8 @@ export const linear = skill('linear', {
|
|
|
74
143
|
| `github` | `github` | `@modelcontextprotocol/server-github` |
|
|
75
144
|
| `slack` | `slack` | `@modelcontextprotocol/server-slack` |
|
|
76
145
|
|
|
146
|
+
---
|
|
147
|
+
|
|
77
148
|
## Function skill API
|
|
78
149
|
|
|
79
150
|
```javascript
|
|
@@ -128,6 +199,8 @@ export const healthCheck = skill('health_check', {
|
|
|
128
199
|
});
|
|
129
200
|
```
|
|
130
201
|
|
|
202
|
+
---
|
|
203
|
+
|
|
131
204
|
## MCP skill API
|
|
132
205
|
|
|
133
206
|
```javascript
|
|
@@ -180,6 +253,8 @@ export const database = skill('database', {
|
|
|
180
253
|
});
|
|
181
254
|
```
|
|
182
255
|
|
|
256
|
+
---
|
|
257
|
+
|
|
183
258
|
## How it works under the hood
|
|
184
259
|
|
|
185
260
|
```
|
|
@@ -205,10 +280,12 @@ export const database = skill('database', {
|
|
|
205
280
|
|
|
206
281
|
**Claude**: The SDK receives `mcpServers` as a parameter. It spawns the MCP server as a child process, connects via stdio, routes tool calls through it.
|
|
207
282
|
|
|
208
|
-
**Cursor**: The
|
|
283
|
+
**Cursor**: The engine writes `~/.cursor/mcp.json` to disk before spawning the `agent` CLI. Cursor reads that file and manages MCP servers itself.
|
|
209
284
|
|
|
210
285
|
The strategies never reference any skill by name. They loop over the skill definitions and call `resolve()` on each.
|
|
211
286
|
|
|
287
|
+
---
|
|
288
|
+
|
|
212
289
|
## API
|
|
213
290
|
|
|
214
291
|
```javascript
|
|
@@ -217,12 +294,24 @@ import {
|
|
|
217
294
|
registerSkill, // Register a raw skill definition
|
|
218
295
|
getSkill, // Get a skill by ID
|
|
219
296
|
hasSkill, // Check if a skill is registered
|
|
220
|
-
getAllSkills,
|
|
297
|
+
getAllSkills, // Get all registered skills (Map)
|
|
221
298
|
listSkillIds, // Get array of registered skill IDs
|
|
222
299
|
SKILLS, // Built-in skill ID constants
|
|
223
300
|
} from '@zibby/skills';
|
|
224
301
|
```
|
|
225
302
|
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Companion packages
|
|
306
|
+
|
|
307
|
+
| Package | What it adds |
|
|
308
|
+
|---|---|
|
|
309
|
+
| [`@zibby/agent-workflow`](https://www.npmjs.com/package/@zibby/agent-workflow) | The graph engine. Skills here plug into its nodes. |
|
|
310
|
+
| [`@zibby/cli`](https://www.npmjs.com/package/@zibby/cli) | `zibby` command — scaffold, dev server, deploy, trigger, logs. |
|
|
311
|
+
| [`@zibby/core`](https://www.npmjs.com/package/@zibby/core) | Built-in agent strategies (Claude / Cursor / Codex / Gemini / OpenAI Assistant), MCP client, runtime. |
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
226
315
|
## License
|
|
227
316
|
|
|
228
317
|
MIT
|
package/dist/chat-notify.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{existsSync as b}from"fs";import{fileURLToPath as S}from"url";import{dirname as v,resolve as N}from"path";import{resolveIntegrationToken as O}from"@zibby/core/backend-client.js";var y=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",PLANE:"plane",LINEAR:"linear"}),J=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"}});function w(){if(process.env.MCP_SLACK_PATH)return process.env.MCP_SLACK_PATH;let r=v(S(import.meta.url)),e=N(r,"..","bin","mcp-slack.mjs");return b(e)?e:null}async function _(r,e={}){let{token:t}=await O("slack"),s=["conversations.list","users.list","users.profile.get","users.lookupByEmail","usergroups.list","usergroups.users.list","conversations.history","conversations.replies"].includes(r),n=`https://slack.com/api/${r}`,a={Authorization:`Bearer ${t}`},d;if(s){let l=new URLSearchParams(e).toString();l&&(n+=`?${l}`)}else a["Content-Type"]="application/json; charset=utf-8",d=JSON.stringify(e);let i=await(await fetch(n,{method:s?"GET":"POST",headers:a,body:d})).json();if(!i.ok)throw new Error(`Slack API error: ${i.error}`);return i}var
|
|
1
|
+
import{existsSync as b}from"fs";import{fileURLToPath as S}from"url";import{dirname as v,resolve as N}from"path";import{resolveIntegrationToken as O}from"@zibby/core/backend-client.js";var y=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",PLANE:"plane",LINEAR:"linear",FIGMA:"figma"}),J=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"}});function w(){if(process.env.MCP_SLACK_PATH)return process.env.MCP_SLACK_PATH;let r=v(S(import.meta.url)),e=N(r,"..","bin","mcp-slack.mjs");return b(e)?e:null}async function _(r,e={}){let{token:t}=await O("slack"),s=["conversations.list","users.list","users.profile.get","users.lookupByEmail","usergroups.list","usergroups.users.list","conversations.history","conversations.replies"].includes(r),n=`https://slack.com/api/${r}`,a={Authorization:`Bearer ${t}`},d;if(s){let l=new URLSearchParams(e).toString();l&&(n+=`?${l}`)}else a["Content-Type"]="application/json; charset=utf-8",d=JSON.stringify(e);let i=await(await fetch(n,{method:s?"GET":"POST",headers:a,body:d})).json();if(!i.ok)throw new Error(`Slack API error: ${i.error}`);return i}var u={id:"slack",serverName:"slack",allowedTools:["mcp__slack__*"],requiresIntegration:y.SLACK,envKeys:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"],description:"Slack MCP Server",promptFragment:`## Slack (connected)
|
|
2
2
|
You have access to the user's Slack workspace. Use these tools:
|
|
3
3
|
- slack_list_channels, slack_post_message, slack_reply_to_thread
|
|
4
4
|
- slack_add_reaction, slack_get_channel_history, slack_get_thread_replies
|
|
5
5
|
- slack_get_users, slack_get_user_profile
|
|
6
6
|
- slack_lookup_user_by_email (precise email\u2192user_id, prefer this over scanning slack_get_users)
|
|
7
|
-
- slack_list_usergroups, slack_get_usergroup_members (workspace-defined teams like @oncall, @platform)`,resolve(){let r=w();if(!r)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[t]&&(e[t]=process.env[t]);for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[r],env:e,alwaysLoad:!0}},async handleToolCall(r,e){try{switch(r){case"slack_list_channels":{let t=await _("conversations.list",{types:"public_channel",limit:100});return JSON.stringify({channels:(t.channels||[]).map(s=>({id:s.id,name:s.name,topic:s.topic?.value}))})}case"slack_post_message":{if(!e.channel||!e.text)return JSON.stringify({error:"channel and text are required"});let t=await _("chat.postMessage",{channel:e.channel,text:e.text,...e.blocks?{blocks:e.blocks}:{}});return JSON.stringify({ok:!0,ts:t.ts,channel:t.channel})}case"slack_reply_to_thread":{if(!e.channel||!e.thread_ts||!e.text)return JSON.stringify({error:"channel, thread_ts, and text are required"});let t=await _("chat.postMessage",{channel:e.channel,thread_ts:e.thread_ts,text:e.text});return JSON.stringify({ok:!0,ts:t.ts})}case"slack_add_reaction":return!e.channel||!e.timestamp||!e.reaction?JSON.stringify({error:"channel, timestamp, and reaction are required"}):(await _("reactions.add",{channel:e.channel,timestamp:e.timestamp,name:e.reaction}),JSON.stringify({ok:!0}));case"slack_get_channel_history":{if(!e.channel)return JSON.stringify({error:"channel is required"});let t=await _("conversations.history",{channel:e.channel,limit:e.limit||20});return JSON.stringify({messages:(t.messages||[]).map(s=>({user:s.user,text:s.text,ts:s.ts}))})}case"slack_get_thread_replies":{if(!e.channel||!e.thread_ts)return JSON.stringify({error:"channel and thread_ts are required"});let t=await _("conversations.replies",{channel:e.channel,ts:e.thread_ts});return JSON.stringify({messages:(t.messages||[]).map(s=>({user:s.user,text:s.text,ts:s.ts}))})}case"slack_get_users":{let t=await _("users.list",{limit:100});return JSON.stringify({users:(t.members||[]).filter(s=>!s.is_bot&&!s.deleted).map(s=>({id:s.id,name:s.real_name||s.name}))})}case"slack_get_user_profile":{if(!e.user_id)return JSON.stringify({error:"user_id is required"});let t=await _("users.profile.get",{user:e.user_id});return JSON.stringify({profile:t.profile})}case"slack_lookup_user_by_email":{if(!e.email)return JSON.stringify({error:"email is required"});try{let t=await _("users.lookupByEmail",{email:e.email});return JSON.stringify({ok:!0,user:{id:t.user?.id,name:t.user?.real_name||t.user?.name,email:t.user?.profile?.email||e.email}})}catch(t){if(/users_not_found/.test(t.message))return JSON.stringify({ok:!1,reason:"users_not_found"});throw t}}case"slack_list_usergroups":{let t=await _("usergroups.list",{});return JSON.stringify({usergroups:(t.usergroups||[]).map(s=>({id:s.id,handle:s.handle,name:s.name,description:s.description||"",user_count:Number(s.user_count||0)}))})}case"slack_get_usergroup_members":{if(!e.usergroup)return JSON.stringify({error:"usergroup id is required"});let t=await _("usergroups.users.list",{usergroup:e.usergroup});return JSON.stringify({users:t.users||[]})}case"slack_search_users":{if(!e.query||typeof e.query!="string")return JSON.stringify({error:"query is required"});let t=e.query.trim().toLowerCase();if(!t)return JSON.stringify({ok:!0,matches:[]});let s=Math.max(1,Math.min(Number(e.limit)||5,25)),n=[],a,d=5;for(let i=0;i<d;i+=1){let l={limit:200};a&&(l.cursor=a);let c=await _("users.list",l);for(let o of c.members||[])o.deleted||o.is_bot||n.push(o);if(a=c.response_metadata?.next_cursor,!a)break}let u=[];for(let i of n){let l=(i.real_name||"").toLowerCase(),c=(i.profile?.display_name||"").toLowerCase(),o=(i.name||"").toLowerCase(),p=0;l.includes(t)&&(p+=100-Math.abs(l.length-t.length)),c.includes(t)&&(p+=60-Math.abs(c.length-t.length)),o.includes(t)&&(p+=30-Math.abs(o.length-t.length)),(l===t||c===t)&&(p+=200),p>0&&u.push({id:i.id,name:i.real_name||i.profile?.display_name||i.name,email:i.profile?.email||void 0,_score:p})}return u.sort((i,l)=>l._score-i._score),JSON.stringify({ok:!0,matches:u.slice(0,s).map(({_score:i,...l})=>l),scanned:n.length})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"slack_list_channels",description:"List public channels in the workspace",input_schema:{type:"object",properties:{}}},{name:"slack_post_message",description:"Post a message to a Slack channel or DM. Pass `blocks` (Block Kit) for a rich card; `text` is the required notification fallback.",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID or name"},text:{type:"string",description:"Notification/fallback text (required)"},blocks:{type:"array",description:"Block Kit blocks for rich formatting (optional). Each block is a Slack Block Kit object (header/section/divider/context). section blocks may carry a button accessory with a url."}},required:["channel","text"]}},{name:"slack_reply_to_thread",description:"Reply to a specific message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"},text:{type:"string",description:"Reply text"}},required:["channel","thread_ts","text"]}},{name:"slack_add_reaction",description:"Add an emoji reaction to a message",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},timestamp:{type:"string",description:"Message timestamp"},reaction:{type:"string",description:"Emoji name without colons"}},required:["channel","timestamp","reaction"]}},{name:"slack_get_channel_history",description:"Get recent messages from a channel",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},limit:{type:"number",description:"Number of messages"}},required:["channel"]}},{name:"slack_get_thread_replies",description:"Get all replies in a message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"}},required:["channel","thread_ts"]}},{name:"slack_get_users",description:"List workspace users with basic profiles",input_schema:{type:"object",properties:{}}},{name:"slack_get_user_profile",description:"Get detailed profile for a specific user",input_schema:{type:"object",properties:{user_id:{type:"string",description:"Slack user ID"}},required:["user_id"]}},{name:"slack_lookup_user_by_email",description:"Find a Slack user by email. Returns { ok:true, user:{id,name,email} } on hit, { ok:false } when no user has that email. Prefer this over slack_get_users for email-based routing \u2014 single API call, exact match.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"slack_list_usergroups",description:"List workspace-defined user groups (e.g. @oncall, @platform). Each item has { id, handle, name, description, user_count }. Use the id with slack_get_usergroup_members to expand the membership.",input_schema:{type:"object",properties:{}}},{name:"slack_get_usergroup_members",description:"List user IDs that belong to a Slack usergroup. Pair with slack_post_message to DM each member, or use the group id directly in a channel message as <!subteam^ID> to @-mention.",input_schema:{type:"object",properties:{usergroup:{type:"string",description:"Usergroup id, e.g. S012ABC"}},required:["usergroup"]}},{name:"slack_search_users",description:'Fuzzy-search workspace users by display name or real name. Use when the user said something like "send to Sam" without an email. Returns up to `limit` ranked matches { id, name, email }. Slack has no native name-search API \u2014 this scans paginated users.list + does substring scoring (real_name > display_name > name). For large workspaces consider higher limit + ask the user to confirm if multiple hit.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}]};import{existsSync as I}from"fs";import{fileURLToPath as T}from"url";import{dirname as A,resolve as L}from"path";import{resolveIntegrationToken as C}from"@zibby/core/backend-client.js";function E(){if(process.env.MCP_LARK_PATH)return process.env.MCP_LARK_PATH;let r=A(T(import.meta.url)),e=L(r,"..","bin","mcp-lark.mjs");return I(e)?e:null}var R=6e3*1e3,g=null;async function P(){let{appId:r,appSecret:e,host:t}=await C("lark");if(g&&g.appId===r&&g.expiresAt>Date.now())return{token:g.token,host:t};let n=await(await fetch(`${t}/open-apis/auth/v3/tenant_access_token/internal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_id:r,app_secret:e})})).json();if(n.code!==0)throw new Error(`Lark tenant_access_token failed: ${n.msg||n.code}`);return g={token:n.tenant_access_token,expiresAt:Date.now()+R,appId:r},{token:n.tenant_access_token,host:t}}async function f(r,e,t={}){let{token:s,host:n}=await P(),a=`${n}${e}`,d={method:r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json; charset=utf-8"}};r!=="GET"&&(d.body=JSON.stringify(t));let i=await(await fetch(a,d)).json();if(i.code!==0)throw new Error(`Lark API ${e} error: ${i.msg||i.code}`);return i.data||{}}function k(r){return JSON.stringify({text:r})}function x(r){return!r||typeof r!="string"||r.startsWith("oc_")?"chat_id":r.startsWith("ou_")?"open_id":r.startsWith("on_")?"union_id":r.startsWith("cli_")?"app_id":r.includes("@")?"email":"chat_id"}var h={id:"lark",serverName:"lark",allowedTools:["mcp__lark__*"],requiresIntegration:y.LARK,description:"Lark / Feishu messaging \u2014 send messages and reply in threads.",envKeys:[],promptFragment:`## Lark (connected)
|
|
7
|
+
- slack_list_usergroups, slack_get_usergroup_members (workspace-defined teams like @oncall, @platform)`,resolve(){let r=w();if(!r)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[t]&&(e[t]=process.env[t]);for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[r],env:e,alwaysLoad:!0}},async handleToolCall(r,e){try{switch(r){case"slack_list_channels":{let t=await _("conversations.list",{types:"public_channel",limit:100});return JSON.stringify({channels:(t.channels||[]).map(s=>({id:s.id,name:s.name,topic:s.topic?.value}))})}case"slack_post_message":{if(!e.channel||!e.text)return JSON.stringify({error:"channel and text are required"});let t=await _("chat.postMessage",{channel:e.channel,text:e.text,...e.blocks?{blocks:e.blocks}:{}});return JSON.stringify({ok:!0,ts:t.ts,channel:t.channel})}case"slack_reply_to_thread":{if(!e.channel||!e.thread_ts||!e.text)return JSON.stringify({error:"channel, thread_ts, and text are required"});let t=await _("chat.postMessage",{channel:e.channel,thread_ts:e.thread_ts,text:e.text});return JSON.stringify({ok:!0,ts:t.ts})}case"slack_add_reaction":return!e.channel||!e.timestamp||!e.reaction?JSON.stringify({error:"channel, timestamp, and reaction are required"}):(await _("reactions.add",{channel:e.channel,timestamp:e.timestamp,name:e.reaction}),JSON.stringify({ok:!0}));case"slack_get_channel_history":{if(!e.channel)return JSON.stringify({error:"channel is required"});let t=await _("conversations.history",{channel:e.channel,limit:e.limit||20});return JSON.stringify({messages:(t.messages||[]).map(s=>({user:s.user,text:s.text,ts:s.ts}))})}case"slack_get_thread_replies":{if(!e.channel||!e.thread_ts)return JSON.stringify({error:"channel and thread_ts are required"});let t=await _("conversations.replies",{channel:e.channel,ts:e.thread_ts});return JSON.stringify({messages:(t.messages||[]).map(s=>({user:s.user,text:s.text,ts:s.ts}))})}case"slack_get_users":{let t=await _("users.list",{limit:100});return JSON.stringify({users:(t.members||[]).filter(s=>!s.is_bot&&!s.deleted).map(s=>({id:s.id,name:s.real_name||s.name}))})}case"slack_get_user_profile":{if(!e.user_id)return JSON.stringify({error:"user_id is required"});let t=await _("users.profile.get",{user:e.user_id});return JSON.stringify({profile:t.profile})}case"slack_lookup_user_by_email":{if(!e.email)return JSON.stringify({error:"email is required"});try{let t=await _("users.lookupByEmail",{email:e.email});return JSON.stringify({ok:!0,user:{id:t.user?.id,name:t.user?.real_name||t.user?.name,email:t.user?.profile?.email||e.email}})}catch(t){if(/users_not_found/.test(t.message))return JSON.stringify({ok:!1,reason:"users_not_found"});throw t}}case"slack_list_usergroups":{let t=await _("usergroups.list",{});return JSON.stringify({usergroups:(t.usergroups||[]).map(s=>({id:s.id,handle:s.handle,name:s.name,description:s.description||"",user_count:Number(s.user_count||0)}))})}case"slack_get_usergroup_members":{if(!e.usergroup)return JSON.stringify({error:"usergroup id is required"});let t=await _("usergroups.users.list",{usergroup:e.usergroup});return JSON.stringify({users:t.users||[]})}case"slack_search_users":{if(!e.query||typeof e.query!="string")return JSON.stringify({error:"query is required"});let t=e.query.trim().toLowerCase();if(!t)return JSON.stringify({ok:!0,matches:[]});let s=Math.max(1,Math.min(Number(e.limit)||5,25)),n=[],a,d=5;for(let i=0;i<d;i+=1){let l={limit:200};a&&(l.cursor=a);let c=await _("users.list",l);for(let o of c.members||[])o.deleted||o.is_bot||n.push(o);if(a=c.response_metadata?.next_cursor,!a)break}let m=[];for(let i of n){let l=(i.real_name||"").toLowerCase(),c=(i.profile?.display_name||"").toLowerCase(),o=(i.name||"").toLowerCase(),p=0;l.includes(t)&&(p+=100-Math.abs(l.length-t.length)),c.includes(t)&&(p+=60-Math.abs(c.length-t.length)),o.includes(t)&&(p+=30-Math.abs(o.length-t.length)),(l===t||c===t)&&(p+=200),p>0&&m.push({id:i.id,name:i.real_name||i.profile?.display_name||i.name,email:i.profile?.email||void 0,_score:p})}return m.sort((i,l)=>l._score-i._score),JSON.stringify({ok:!0,matches:m.slice(0,s).map(({_score:i,...l})=>l),scanned:n.length})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"slack_list_channels",description:"List public channels in the workspace",input_schema:{type:"object",properties:{}}},{name:"slack_post_message",description:"Post a message to a Slack channel or DM. Pass `blocks` (Block Kit) for a rich card; `text` is the required notification fallback.",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID or name"},text:{type:"string",description:"Notification/fallback text (required)"},blocks:{type:"array",description:"Block Kit blocks for rich formatting (optional). Each block is a Slack Block Kit object (header/section/divider/context). section blocks may carry a button accessory with a url."}},required:["channel","text"]}},{name:"slack_reply_to_thread",description:"Reply to a specific message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"},text:{type:"string",description:"Reply text"}},required:["channel","thread_ts","text"]}},{name:"slack_add_reaction",description:"Add an emoji reaction to a message",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},timestamp:{type:"string",description:"Message timestamp"},reaction:{type:"string",description:"Emoji name without colons"}},required:["channel","timestamp","reaction"]}},{name:"slack_get_channel_history",description:"Get recent messages from a channel",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},limit:{type:"number",description:"Number of messages"}},required:["channel"]}},{name:"slack_get_thread_replies",description:"Get all replies in a message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"}},required:["channel","thread_ts"]}},{name:"slack_get_users",description:"List workspace users with basic profiles",input_schema:{type:"object",properties:{}}},{name:"slack_get_user_profile",description:"Get detailed profile for a specific user",input_schema:{type:"object",properties:{user_id:{type:"string",description:"Slack user ID"}},required:["user_id"]}},{name:"slack_lookup_user_by_email",description:"Find a Slack user by email. Returns { ok:true, user:{id,name,email} } on hit, { ok:false } when no user has that email. Prefer this over slack_get_users for email-based routing \u2014 single API call, exact match.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"slack_list_usergroups",description:"List workspace-defined user groups (e.g. @oncall, @platform). Each item has { id, handle, name, description, user_count }. Use the id with slack_get_usergroup_members to expand the membership.",input_schema:{type:"object",properties:{}}},{name:"slack_get_usergroup_members",description:"List user IDs that belong to a Slack usergroup. Pair with slack_post_message to DM each member, or use the group id directly in a channel message as <!subteam^ID> to @-mention.",input_schema:{type:"object",properties:{usergroup:{type:"string",description:"Usergroup id, e.g. S012ABC"}},required:["usergroup"]}},{name:"slack_search_users",description:'Fuzzy-search workspace users by display name or real name. Use when the user said something like "send to Sam" without an email. Returns up to `limit` ranked matches { id, name, email }. Slack has no native name-search API \u2014 this scans paginated users.list + does substring scoring (real_name > display_name > name). For large workspaces consider higher limit + ask the user to confirm if multiple hit.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}]};import{existsSync as I}from"fs";import{fileURLToPath as T}from"url";import{dirname as A,resolve as L}from"path";import{resolveIntegrationToken as C}from"@zibby/core/backend-client.js";function E(){if(process.env.MCP_LARK_PATH)return process.env.MCP_LARK_PATH;let r=A(T(import.meta.url)),e=L(r,"..","bin","mcp-lark.mjs");return I(e)?e:null}var R=6e3*1e3,g=null;async function P(){let{appId:r,appSecret:e,host:t}=await C("lark");if(g&&g.appId===r&&g.expiresAt>Date.now())return{token:g.token,host:t};let n=await(await fetch(`${t}/open-apis/auth/v3/tenant_access_token/internal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_id:r,app_secret:e})})).json();if(n.code!==0)throw new Error(`Lark tenant_access_token failed: ${n.msg||n.code}`);return g={token:n.tenant_access_token,expiresAt:Date.now()+R,appId:r},{token:n.tenant_access_token,host:t}}async function f(r,e,t={}){let{token:s,host:n}=await P(),a=`${n}${e}`,d={method:r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json; charset=utf-8"}};r!=="GET"&&(d.body=JSON.stringify(t));let i=await(await fetch(a,d)).json();if(i.code!==0)throw new Error(`Lark API ${e} error: ${i.msg||i.code}`);return i.data||{}}function k(r){return JSON.stringify({text:r})}function x(r){return!r||typeof r!="string"||r.startsWith("oc_")?"chat_id":r.startsWith("ou_")?"open_id":r.startsWith("on_")?"union_id":r.startsWith("cli_")?"app_id":r.includes("@")?"email":"chat_id"}var h={id:"lark",serverName:"lark",allowedTools:["mcp__lark__*"],requiresIntegration:y.LARK,description:"Lark / Feishu messaging \u2014 send messages and reply in threads.",envKeys:[],promptFragment:`## Lark (connected)
|
|
8
8
|
You can send messages and replies on Lark. Use:
|
|
9
9
|
- lark_send_message: post a message to a chat, user, or DM
|
|
10
10
|
- lark_reply: reply to an existing message (threaded)
|
|
11
11
|
- lark_list_chats: list chats the bot is a member of
|
|
12
12
|
- lark_get_chat_history: fetch recent messages in a chat
|
|
13
13
|
- lark_lookup_user_by_email: resolve an email \u2192 open_id for direct DM (prefer this over emailing through lark_send_message when the agent has a user_id already)
|
|
14
|
-
When responding to an incoming event, prefer lark_reply with the source message_id so the response threads cleanly.`,resolve(){let r=E();if(!r)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[r],env:e,alwaysLoad:!0}},tools:[{name:"lark_send_message",description:"Send a text message to a Lark chat, user, or DM. receive_id can be a chat_id (oc_*), open_id (ou_*), union_id (on_*), or email.",input_schema:{type:"object",properties:{receive_id:{type:"string",description:"Target id: chat_id (oc_*), open_id (ou_*), union_id (on_*), or email"},text:{type:"string",description:"Message text"}},required:["receive_id","text"]}},{name:"lark_reply",description:"Reply to an existing Lark message (creates a thread). Use the message_id from the inbound event.",input_schema:{type:"object",properties:{message_id:{type:"string",description:"Lark message id (om_*) to reply to"},text:{type:"string",description:"Reply text"}},required:["message_id","text"]}},{name:"lark_list_chats",description:"List chats (groups + DMs) the bot is a member of.",input_schema:{type:"object",properties:{page_size:{type:"number",description:"Max results (default 50)"}}}},{name:"lark_get_chat_history",description:"Fetch recent messages in a chat.",input_schema:{type:"object",properties:{chat_id:{type:"string",description:"Chat id (oc_*)"},page_size:{type:"number",description:"Max messages (default 20)"}},required:["chat_id"]}},{name:"lark_lookup_user_by_email",description:"Resolve an email address to a Lark user id (open_id). Returns { ok:true, user:{open_id,email,name} } on hit, { ok:false } if no Lark user has that email. Use the open_id as `receive_id` in lark_send_message to DM.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"lark_search_users",description:'Fuzzy-search users by name across chats the bot is a member of. Lark has no public org-wide user search API for bots \u2014 this walks the bot\'s chat memberships and matches names client-side. Best for "send to Sam" style routing where you have a name but no email. Returns up to `limit` ranked matches { open_id, name }.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against user names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}],async handleToolCall(r,e){try{switch(r){case"lark_send_message":{if(!e.receive_id||!e.text)return JSON.stringify({error:"receive_id and text are required"});let t=x(e.receive_id),s=await f("POST",`/open-apis/im/v1/messages?receive_id_type=${t}`,{receive_id:e.receive_id,msg_type:"text",content:k(e.text)});return JSON.stringify({ok:!0,message_id:s.message_id})}case"lark_reply":{if(!e.message_id||!e.text)return JSON.stringify({error:"message_id and text are required"});let t=await f("POST",`/open-apis/im/v1/messages/${encodeURIComponent(e.message_id)}/reply`,{msg_type:"text",content:k(e.text)});return JSON.stringify({ok:!0,message_id:t.message_id})}case"lark_list_chats":{let t=e.page_size||50,n=((await f("GET",`/open-apis/im/v1/chats?page_size=${t}`)).items||[]).map(a=>({chat_id:a.chat_id,name:a.name,description:a.description,owner_id:a.owner_id,chat_mode:a.chat_mode}));return JSON.stringify({chats:n})}case"lark_get_chat_history":{if(!e.chat_id)return JSON.stringify({error:"chat_id is required"});let t=e.page_size||20,n=((await f("GET",`/open-apis/im/v1/messages?container_id_type=chat&container_id=${encodeURIComponent(e.chat_id)}&page_size=${t}&sort_type=ByCreateTimeDesc`)).items||[]).map(a=>({message_id:a.message_id,sender_id:a.sender?.id,sender_type:a.sender?.sender_type,msg_type:a.msg_type,content:a.body?.content,create_time:a.create_time}));return JSON.stringify({messages:n})}case"lark_lookup_user_by_email":{if(!e.email)return JSON.stringify({error:"email is required"});let s=((await f("POST","/open-apis/contact/v3/users/batch_get_id?user_id_type=open_id",{emails:[e.email]})).user_list||[]).find(n=>n.email===e.email&&n.user_id);return JSON.stringify(s?{ok:!0,user:{open_id:s.user_id,email:s.email,name:s.name||void 0}}:{ok:!1,reason:"no_lark_user_for_email"})}case"lark_search_users":{if(!e.query||typeof e.query!="string")return JSON.stringify({error:"query is required"});let t=e.query.trim().toLowerCase();if(!t)return JSON.stringify({ok:!0,matches:[]});let s=Math.max(1,Math.min(Number(e.limit)||5,25)),n=200,d=((await f("GET","/open-apis/im/v1/chats?page_size=100")).items||[]).map(c=>c.chat_id),
|
|
14
|
+
When responding to an incoming event, prefer lark_reply with the source message_id so the response threads cleanly.`,resolve(){let r=E();if(!r)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[r],env:e,alwaysLoad:!0}},tools:[{name:"lark_send_message",description:"Send a text message to a Lark chat, user, or DM. receive_id can be a chat_id (oc_*), open_id (ou_*), union_id (on_*), or email.",input_schema:{type:"object",properties:{receive_id:{type:"string",description:"Target id: chat_id (oc_*), open_id (ou_*), union_id (on_*), or email"},text:{type:"string",description:"Message text"}},required:["receive_id","text"]}},{name:"lark_reply",description:"Reply to an existing Lark message (creates a thread). Use the message_id from the inbound event.",input_schema:{type:"object",properties:{message_id:{type:"string",description:"Lark message id (om_*) to reply to"},text:{type:"string",description:"Reply text"}},required:["message_id","text"]}},{name:"lark_list_chats",description:"List chats (groups + DMs) the bot is a member of.",input_schema:{type:"object",properties:{page_size:{type:"number",description:"Max results (default 50)"}}}},{name:"lark_get_chat_history",description:"Fetch recent messages in a chat.",input_schema:{type:"object",properties:{chat_id:{type:"string",description:"Chat id (oc_*)"},page_size:{type:"number",description:"Max messages (default 20)"}},required:["chat_id"]}},{name:"lark_lookup_user_by_email",description:"Resolve an email address to a Lark user id (open_id). Returns { ok:true, user:{open_id,email,name} } on hit, { ok:false } if no Lark user has that email. Use the open_id as `receive_id` in lark_send_message to DM.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"lark_search_users",description:'Fuzzy-search users by name across chats the bot is a member of. Lark has no public org-wide user search API for bots \u2014 this walks the bot\'s chat memberships and matches names client-side. Best for "send to Sam" style routing where you have a name but no email. Returns up to `limit` ranked matches { open_id, name }.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against user names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}],async handleToolCall(r,e){try{switch(r){case"lark_send_message":{if(!e.receive_id||!e.text)return JSON.stringify({error:"receive_id and text are required"});let t=x(e.receive_id),s=await f("POST",`/open-apis/im/v1/messages?receive_id_type=${t}`,{receive_id:e.receive_id,msg_type:"text",content:k(e.text)});return JSON.stringify({ok:!0,message_id:s.message_id})}case"lark_reply":{if(!e.message_id||!e.text)return JSON.stringify({error:"message_id and text are required"});let t=await f("POST",`/open-apis/im/v1/messages/${encodeURIComponent(e.message_id)}/reply`,{msg_type:"text",content:k(e.text)});return JSON.stringify({ok:!0,message_id:t.message_id})}case"lark_list_chats":{let t=e.page_size||50,n=((await f("GET",`/open-apis/im/v1/chats?page_size=${t}`)).items||[]).map(a=>({chat_id:a.chat_id,name:a.name,description:a.description,owner_id:a.owner_id,chat_mode:a.chat_mode}));return JSON.stringify({chats:n})}case"lark_get_chat_history":{if(!e.chat_id)return JSON.stringify({error:"chat_id is required"});let t=e.page_size||20,n=((await f("GET",`/open-apis/im/v1/messages?container_id_type=chat&container_id=${encodeURIComponent(e.chat_id)}&page_size=${t}&sort_type=ByCreateTimeDesc`)).items||[]).map(a=>({message_id:a.message_id,sender_id:a.sender?.id,sender_type:a.sender?.sender_type,msg_type:a.msg_type,content:a.body?.content,create_time:a.create_time}));return JSON.stringify({messages:n})}case"lark_lookup_user_by_email":{if(!e.email)return JSON.stringify({error:"email is required"});let s=((await f("POST","/open-apis/contact/v3/users/batch_get_id?user_id_type=open_id",{emails:[e.email]})).user_list||[]).find(n=>n.email===e.email&&n.user_id);return JSON.stringify(s?{ok:!0,user:{open_id:s.user_id,email:s.email,name:s.name||void 0}}:{ok:!1,reason:"no_lark_user_for_email"})}case"lark_search_users":{if(!e.query||typeof e.query!="string")return JSON.stringify({error:"query is required"});let t=e.query.trim().toLowerCase();if(!t)return JSON.stringify({ok:!0,matches:[]});let s=Math.max(1,Math.min(Number(e.limit)||5,25)),n=200,d=((await f("GET","/open-apis/im/v1/chats?page_size=100")).items||[]).map(c=>c.chat_id),m=new Set,i=[];for(let c of d){if(i.length>=n)break;try{let o=await f("GET",`/open-apis/im/v1/chats/${encodeURIComponent(c)}/members?member_id_type=open_id&page_size=100`);for(let p of o.items||[])if(!(!p.member_id||m.has(p.member_id))&&(m.add(p.member_id),i.push({open_id:p.member_id,name:p.name||""}),i.length>=n))break}catch(o){console.warn(`[lark] member scan failed for ${c}: ${o.message}`)}}let l=[];for(let c of i){let o=(c.name||"").toLowerCase();if(!o)continue;let p=0;o.includes(t)&&(p+=100-Math.abs(o.length-t.length)),o===t&&(p+=200),p>0&&l.push({open_id:c.open_id,name:c.name,_score:p})}return l.sort((c,o)=>o._score-c._score),JSON.stringify({ok:!0,matches:l.slice(0,s).map(({_score:c,...o})=>o),scanned:i.length})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(t){return JSON.stringify({error:t.message})}}};var V={id:"chat_notify",description:"Chat notification meta-skill \u2014 routes to whichever messaging integration (Slack OR Lark) the user has configured for this project.",envKeys:[...u.envKeys||[],...h.envKeys||[]],get serverName(){if(process.env.SLACK_CHANNEL)return u.serverName;if(process.env.LARK_RECEIVE_ID)return h.serverName},get allowedTools(){return process.env.SLACK_CHANNEL?u.allowedTools||[]:process.env.LARK_RECEIVE_ID?h.allowedTools||[]:[]},promptFragment:`## Chat notifications (Slack OR Lark \u2014 at least one connected)
|
|
15
15
|
You can post chat messages via either:
|
|
16
16
|
- slack_post_message (channel, text) \u2014 Slack, when SLACK_CHANNEL is set
|
|
17
17
|
- lark_send_message (receive_id, text) \u2014 Lark, when LARK_RECEIVE_ID is set
|
|
18
|
-
Use whichever the user has configured.`,resolve(r){return process.env.SLACK_CHANNEL&&typeof
|
|
18
|
+
Use whichever the user has configured.`,resolve(r){return process.env.SLACK_CHANNEL&&typeof u.resolve=="function"?u.resolve(r):process.env.LARK_RECEIVE_ID&&typeof h.resolve=="function"?h.resolve(r):null},async handleToolCall(r,e,t){return typeof r=="string"&&r.startsWith("slack_")?u.handleToolCall(r,e,t):typeof r=="string"&&r.startsWith("lark_")?h.handleToolCall(r,e,t):JSON.stringify({error:`chat_notify: unknown tool "${r}". Expected slack_* or lark_*.`})},get tools(){return[...u.tools||[],...h.tools||[]]}};export{V as chatNotifySkill};
|
package/dist/figma.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export namespace figmaSkill {
|
|
2
|
+
let id: string;
|
|
3
|
+
let serverName: string;
|
|
4
|
+
let allowedTools: string[];
|
|
5
|
+
let requiresIntegration: "figma";
|
|
6
|
+
let envKeys: any[];
|
|
7
|
+
let description: string;
|
|
8
|
+
let promptFragment: string;
|
|
9
|
+
function resolve(): {
|
|
10
|
+
command: any;
|
|
11
|
+
args: any[];
|
|
12
|
+
env: {};
|
|
13
|
+
description: string;
|
|
14
|
+
type?: undefined;
|
|
15
|
+
alwaysLoad?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: string;
|
|
18
|
+
command: string;
|
|
19
|
+
args: any[];
|
|
20
|
+
env: {};
|
|
21
|
+
description: string;
|
|
22
|
+
alwaysLoad: boolean;
|
|
23
|
+
};
|
|
24
|
+
function handleToolCall(name: any, args: any): Promise<string>;
|
|
25
|
+
let tools: ({
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
input_schema: {
|
|
29
|
+
type: string;
|
|
30
|
+
properties: {
|
|
31
|
+
fileKey?: undefined;
|
|
32
|
+
depth?: undefined;
|
|
33
|
+
ids?: undefined;
|
|
34
|
+
scale?: undefined;
|
|
35
|
+
};
|
|
36
|
+
required?: undefined;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
input_schema: {
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
fileKey: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
depth: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
ids?: undefined;
|
|
53
|
+
scale?: undefined;
|
|
54
|
+
};
|
|
55
|
+
required: string[];
|
|
56
|
+
};
|
|
57
|
+
} | {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
input_schema: {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
fileKey: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
ids: {
|
|
68
|
+
type: string;
|
|
69
|
+
items: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
depth: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
scale?: undefined;
|
|
79
|
+
};
|
|
80
|
+
required: string[];
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
input_schema: {
|
|
86
|
+
type: string;
|
|
87
|
+
properties: {
|
|
88
|
+
fileKey: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
ids: {
|
|
93
|
+
type: string;
|
|
94
|
+
items: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
description: string;
|
|
98
|
+
};
|
|
99
|
+
scale: {
|
|
100
|
+
type: string;
|
|
101
|
+
description: string;
|
|
102
|
+
};
|
|
103
|
+
depth?: undefined;
|
|
104
|
+
};
|
|
105
|
+
required: string[];
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
input_schema: {
|
|
111
|
+
type: string;
|
|
112
|
+
properties: {
|
|
113
|
+
fileKey: {
|
|
114
|
+
type: string;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
depth?: undefined;
|
|
118
|
+
ids?: undefined;
|
|
119
|
+
scale?: undefined;
|
|
120
|
+
};
|
|
121
|
+
required: string[];
|
|
122
|
+
};
|
|
123
|
+
})[];
|
|
124
|
+
}
|
package/dist/figma.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{existsSync as p}from"fs";import{fileURLToPath as h}from"url";import{dirname as u,resolve as y}from"path";import{resolveIntegrationToken as _}from"@zibby/core/backend-client.js";var g=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",PLANE:"plane",LINEAR:"linear",FIGMA:"figma"}),b=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"}});function N(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let s=u(h(import.meta.url)),n=y(s,"..","bin","mcp-skill.mjs");return p(n)?n:null}async function f(s,n={}){let{token:e}=await _("figma"),r=s.startsWith("https://")?s:`https://api.figma.com${s}`,o={"X-Figma-Token":e,Accept:"application/json",...n.body?{"Content-Type":"application/json"}:{}},i=await fetch(r,{method:n.method||"GET",headers:o,body:n.body?JSON.stringify(n.body):void 0});if(!i.ok){let d=await i.text().catch(()=>"");throw new Error(`Figma API ${i.status}: ${d.slice(0,300)}`)}return i.json()}var T={id:"figma",serverName:"figma",allowedTools:["mcp__figma__*"],requiresIntegration:g.FIGMA,envKeys:[],description:"Figma \u2014 read files, nodes, comments, and render frames as PNGs",promptFragment:`## Figma (connected)
|
|
2
|
+
You have read access to the user's Figma files via the Figma REST API. Tools:
|
|
3
|
+
|
|
4
|
+
### Identity
|
|
5
|
+
- figma_get_me: Get the authenticated Figma user (handle, email, id)
|
|
6
|
+
|
|
7
|
+
### Files & nodes
|
|
8
|
+
- figma_get_file: Get a file's document tree by fileKey. The fileKey is the token in a Figma URL: figma.com/file/<fileKey>/<name> (or /design/<fileKey>/). Pass an optional depth to limit how deep the node tree is returned (1-2 is usually enough to find frames/pages).
|
|
9
|
+
- figma_get_nodes: Get specific nodes from a file by their node ids (comma-separated or array). Use this after figma_get_file to drill into a particular frame/component without re-fetching the whole tree.
|
|
10
|
+
|
|
11
|
+
### Rendering
|
|
12
|
+
- figma_render_png: Render one or more nodes of a file to PNG and return the image URLs. Pass fileKey + node ids; optional scale (0.01-4, default 1). Returns a map of nodeId \u2192 image URL you can show the user or download.
|
|
13
|
+
|
|
14
|
+
### Comments
|
|
15
|
+
- figma_get_comments: Read the comments on a file.
|
|
16
|
+
|
|
17
|
+
### Notes
|
|
18
|
+
- The fileKey is NOT the file name \u2014 it's the opaque id segment in the URL.
|
|
19
|
+
- Node ids look like "1:23" and come from figma_get_file / figma_get_nodes output.`,resolve(){let s=N();if(!s)return{command:null,args:[],env:{},description:this.description};let n={};for(let e of this.envKeys)process.env[e]&&(n[e]=process.env[e]);return{type:"stdio",command:"node",args:[s,"../dist/figma.js","figmaSkill"],env:n,description:this.description,alwaysLoad:!0}},async handleToolCall(s,n){try{switch(s){case"figma_get_me":{let e=await f("/v1/me");return JSON.stringify({id:e.id,handle:e.handle,email:e.email,imgUrl:e.img_url})}case"figma_get_file":{let{fileKey:e,depth:r}=n||{};if(!e)return JSON.stringify({error:"fileKey is required"});let o=`/v1/files/${encodeURIComponent(e)}`;if(r!=null){let t=Number(r);!Number.isNaN(t)&&t>0&&(o+=`?depth=${t}`)}let i=await f(o),d=(i.document?.children||[]).map(t=>({id:t.id,name:t.name,type:t.type,childCount:Array.isArray(t.children)?t.children.length:0,children:(t.children||[]).slice(0,50).map(a=>({id:a.id,name:a.name,type:a.type}))}));return JSON.stringify({name:i.name,lastModified:i.lastModified,version:i.version,editorType:i.editorType,role:i.role,pages:d})}case"figma_get_nodes":{let{fileKey:e,ids:r,depth:o}=n||{};if(!e)return JSON.stringify({error:"fileKey is required"});let d=(Array.isArray(r)?r:r?String(r).split(","):[]).map(m=>String(m).trim()).filter(Boolean);if(d.length===0)return JSON.stringify({error:"ids is required (comma-separated or array of node ids)"});let t=new URLSearchParams;if(t.set("ids",d.join(",")),o!=null){let m=Number(o);!Number.isNaN(m)&&m>0&&t.set("depth",String(m))}let a=await f(`/v1/files/${encodeURIComponent(e)}/nodes?${t.toString()}`),l={};for(let[m,c]of Object.entries(a.nodes||{}))l[m]=c?.document?{id:c.document.id,name:c.document.name,type:c.document.type,document:c.document}:c;return JSON.stringify({name:a.name,nodes:l})}case"figma_render_png":{let{fileKey:e,ids:r,scale:o}=n||{};if(!e)return JSON.stringify({error:"fileKey is required"});let d=(Array.isArray(r)?r:r?String(r).split(","):[]).map(m=>String(m).trim()).filter(Boolean);if(d.length===0)return JSON.stringify({error:"ids is required (comma-separated or array of node ids)"});let t=new URLSearchParams;t.set("ids",d.join(",")),t.set("format","png");let a=Number(o);(Number.isNaN(a)||a<=0)&&(a=1),a=Math.min(4,Math.max(.01,a)),t.set("scale",String(a));let l=await f(`/v1/images/${encodeURIComponent(e)}?${t.toString()}`);return l.err?JSON.stringify({error:`Figma render error: ${l.err}`}):JSON.stringify({scale:a,format:"png",images:l.images||{}})}case"figma_get_comments":{let{fileKey:e}=n||{};if(!e)return JSON.stringify({error:"fileKey is required"});let o=((await f(`/v1/files/${encodeURIComponent(e)}/comments`)).comments||[]).map(i=>({id:i.id,message:i.message,user:i.user?.handle,createdAt:i.created_at,resolvedAt:i.resolved_at||null,parentId:i.parent_id||null}));return JSON.stringify({count:o.length,comments:o})}default:return JSON.stringify({error:`Unknown tool: ${s}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"figma_get_me",description:"Get the authenticated Figma user profile (handle, email, id)",input_schema:{type:"object",properties:{}}},{name:"figma_get_file",description:"Get a Figma file's document tree by fileKey (the opaque id segment in a figma.com/file/<fileKey>/ or /design/<fileKey>/ URL \u2014 NOT the file name). Returns a summarized map of pages and their top-level frames/nodes. Use figma_get_nodes to drill into a specific node.",input_schema:{type:"object",properties:{fileKey:{type:"string",description:'The file key from the Figma URL (e.g. "aBcD1234" in figma.com/design/aBcD1234/My-File)'},depth:{type:"number",description:"Optional: limit how deep the node tree is traversed (1-2 is usually enough to list pages/frames). Omit for the full tree."}},required:["fileKey"]}},{name:"figma_get_nodes",description:"Get specific nodes from a Figma file by their node ids. Use after figma_get_file to inspect a particular frame/component without re-fetching the whole file.",input_schema:{type:"object",properties:{fileKey:{type:"string",description:"The file key from the Figma URL"},ids:{type:"array",items:{type:"string"},description:'Node ids to fetch (e.g. ["1:23","4:56"]). A comma-separated string is also accepted.'},depth:{type:"number",description:"Optional: limit traversal depth within each node."}},required:["fileKey","ids"]}},{name:"figma_render_png",description:"Render one or more Figma nodes to PNG and return the image URLs (a map of nodeId \u2192 URL). Use this to show or download a visual of a frame/component.",input_schema:{type:"object",properties:{fileKey:{type:"string",description:"The file key from the Figma URL"},ids:{type:"array",items:{type:"string"},description:'Node ids to render (e.g. ["1:23"]). A comma-separated string is also accepted.'},scale:{type:"number",description:"Render scale, 0.01\u20134 (default 1). 2 for retina/hi-dpi."}},required:["fileKey","ids"]}},{name:"figma_get_comments",description:"Read the comments on a Figma file",input_schema:{type:"object",properties:{fileKey:{type:"string",description:"The file key from the Figma URL"}},required:["fileKey"]}}]};export{T as figmaSkill};
|
package/dist/github.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as J}from"fs";import{fileURLToPath as I}from"url";import{dirname as E,resolve as
|
|
1
|
+
import{existsSync as J}from"fs";import{fileURLToPath as I}from"url";import{dirname as E,resolve as G}from"path";import{resolveIntegrationToken as q}from"@zibby/core/backend-client.js";var P=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",PLANE:"plane",LINEAR:"linear",FIGMA:"figma"}),L=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"}});function k(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let y=E(I(import.meta.url)),a=G(y,"..","bin","mcp-skill.mjs");return J(a)?a:null}async function l(y,a={}){let{token:t}=await q("github"),n=y.startsWith("https://")?y:`https://api.github.com${y}`,i={Authorization:`Bearer ${t}`,Accept:a.accept||"application/vnd.github.v3+json","User-Agent":"Zibby-App",...a.body?{"Content-Type":"application/json"}:{}},e=await fetch(n,{method:a.method||"GET",headers:i,body:a.body?JSON.stringify(a.body):void 0});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`GitHub API ${e.status}: ${r.slice(0,300)}`)}return a.raw?e.text():e.json()}var z={id:"github",serverName:"github",allowedTools:["mcp__github__*"],requiresIntegration:P.GITHUB,envKeys:["GITHUB_TOKEN"],description:"GitHub \u2014 issues, PRs, commits, code search, file reading",promptFragment:`## GitHub (connected)
|
|
2
2
|
You have access to the user's GitHub repositories. Available tools:
|
|
3
3
|
|
|
4
4
|
### Discovery
|
|
@@ -39,6 +39,6 @@ When user says "check out repo-name" or "clone repo-name":
|
|
|
39
39
|
3. STOP. Do not offer to inspect files or ask what to do next.
|
|
40
40
|
|
|
41
41
|
When user just wants to "look at" or "read" files (not clone):
|
|
42
|
-
- Use github_get_file to read individual files via API`,resolve(){let y=
|
|
42
|
+
- Use github_get_file to read individual files via API`,resolve(){let y=k();if(!y)return{command:null,args:[],env:{},description:this.description};let a={};for(let t of this.envKeys)process.env[t]&&(a[t]=process.env[t]);return{type:"stdio",command:"node",args:[y,"../dist/github.js","githubSkill"],env:a,description:this.description,alwaysLoad:!0}},async handleToolCall(y,a){try{switch(y){case"github_search_issues":{let t=a.query;if(!t)return JSON.stringify({error:"query is required"});let n=await l(`/search/issues?q=${encodeURIComponent(t)}&per_page=${a.limit||20}`),i=(n.items||[]).map(e=>({number:e.number,title:e.title,state:e.state,repo:e.repository_url?.split("/").slice(-2).join("/"),url:e.html_url,user:e.user?.login,isPR:!!e.pull_request,labels:(e.labels||[]).map(r=>r.name),createdAt:e.created_at}));return JSON.stringify({total:n.total_count,items:i})}case"github_search_code":{let t=a.query;if(!t)return JSON.stringify({error:"query is required"});let n=a.repo?`+repo:${a.repo}`:"",i=a.language?`+language:${a.language}`:"",e=await l(`/search/code?q=${encodeURIComponent(t)}${n}${i}&per_page=${a.limit||15}`),r=(e.items||[]).map(s=>({name:s.name,path:s.path,repo:s.repository?.full_name,url:s.html_url,score:s.score}));return JSON.stringify({total:e.total_count,items:r})}case"github_get_pr":{let{owner:t,repo:n,number:i}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/pulls/${i}`);return JSON.stringify({number:e.number,title:e.title,state:e.state,merged:e.merged,body:e.body?.slice(0,5e3),user:e.user?.login,branch:e.head?.ref,headSha:e.head?.sha,base:e.base?.ref,changedFiles:e.changed_files,additions:e.additions,deletions:e.deletions,createdAt:e.created_at,mergedAt:e.merged_at,url:e.html_url,labels:(e.labels||[]).map(r=>r.name)})}case"github_get_pr_diff":{let{owner:t,repo:n,number:i}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/pulls/${i}`,{accept:"application/vnd.github.v3.diff",raw:!0}),r=e.length>15e3;return JSON.stringify({number:i,diff:r?e.slice(0,15e3):e,truncated:r,totalLength:e.length})}case"github_list_pr_files":{let{owner:t,repo:n,number:i}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/pulls/${i}/files?per_page=100`);return JSON.stringify({total:e.length,files:e.map(r=>({filename:r.filename,status:r.status,additions:r.additions,deletions:r.deletions,patch:r.patch?.slice(0,3e3)}))})}case"github_list_pr_comments":{let{owner:t,repo:n,number:i}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/pulls/${i}/comments?per_page=50`),r=await l(`/repos/${t}/${n}/issues/${i}/comments?per_page=50`),s=[...e.map(o=>({type:"review",user:o.user?.login,body:o.body?.slice(0,1e3),path:o.path,line:o.line,createdAt:o.created_at})),...r.map(o=>({type:"issue",user:o.user?.login,body:o.body?.slice(0,1e3),createdAt:o.created_at}))].sort((o,d)=>new Date(o.createdAt)-new Date(d.createdAt));return JSON.stringify({total:s.length,comments:s})}case"github_get_review_thread":{let{owner:t,repo:n,number:i,commentId:e}=a||{};if(!t||!n||!i||!e)return JSON.stringify({error:"owner, repo, number, and commentId are required"});let r=await l(`/repos/${t}/${n}/pulls/comments/${e}`),s=r.in_reply_to_id||r.id,o=[];try{o=await l(`/repos/${t}/${n}/pulls/${i}/comments?per_page=100`)}catch{o=[r]}(!Array.isArray(o)||o.length===0)&&(o=[r]);let d=o.filter(u=>u.id===s||u.in_reply_to_id===s).sort((u,h)=>new Date(u.created_at)-new Date(h.created_at)),c=d.length?d:[r],p=c.find(u=>u.id===s)||c[0];return JSON.stringify({rootCommentId:s,path:p.path,line:p.line??p.original_line??null,side:p.side||"RIGHT",diffHunk:typeof p.diff_hunk=="string"?p.diff_hunk.slice(0,3e3):null,commitId:p.commit_id||p.original_commit_id||null,notes:c.map(u=>({id:u.id,user:u.user?.login,body:(u.body||"").slice(0,4e3),createdAt:u.created_at,isRoot:u.id===s,url:u.html_url}))})}case"github_reply_review_thread":{let{owner:t,repo:n,number:i,commentId:e,body:r}=a||{};if(!t||!n||!i||!e||!r)return JSON.stringify({error:"owner, repo, number, commentId, and body are required"});let s=await l(`/repos/${t}/${n}/pulls/${i}/comments/${e}/replies`,{method:"POST",body:{body:String(r)}});return JSON.stringify({ok:!0,id:s.id,url:s.html_url,inReplyTo:s.in_reply_to_id})}case"github_reply_issue_comment":{let{owner:t,repo:n,number:i,body:e}=a||{};if(!t||!n||!i||!e)return JSON.stringify({error:"owner, repo, number, and body are required"});let r=await l(`/repos/${t}/${n}/issues/${i}/comments`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:r.id,url:r.html_url})}case"github_create_review":{let{owner:t,repo:n,number:i,body:e,event:r,comments:s}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let o=(r||"COMMENT").toUpperCase();if(!["COMMENT","APPROVE","REQUEST_CHANGES"].includes(o))return JSON.stringify({error:`event must be COMMENT, APPROVE, or REQUEST_CHANGES (got ${r})`});let d=Array.isArray(s)?s.filter(u=>u&&u.path&&u.body&&(u.line!=null||u.position!=null)).map(u=>{let h={path:u.path,body:String(u.body)};return u.line!=null?(h.line=Number(u.line),h.side=u.side==="LEFT"?"LEFT":"RIGHT"):h.position=Number(u.position),h}):[];if(o!=="APPROVE"&&!e&&d.length===0)return JSON.stringify({error:"a COMMENT or REQUEST_CHANGES review needs a body and/or inline comments"});let c={event:o};e&&(c.body=String(e)),d.length>0&&(c.comments=d);let p=await l(`/repos/${t}/${n}/pulls/${i}/reviews`,{method:"POST",body:c});return JSON.stringify({ok:!0,id:p.id,state:p.state,event:o,commentsPosted:d.length,url:p.html_url})}case"github_list_commits":{let{owner:t,repo:n,branch:i,path:e,limit:r}=a;if(!t||!n)return JSON.stringify({error:"owner and repo are required"});let s=`/repos/${t}/${n}/commits?per_page=${r||20}`;i&&(s+=`&sha=${encodeURIComponent(i)}`),e&&(s+=`&path=${encodeURIComponent(e)}`);let o=await l(s);return JSON.stringify({total:o.length,commits:o.map(d=>({sha:d.sha?.slice(0,8),fullSha:d.sha,message:d.commit?.message?.slice(0,300),author:d.commit?.author?.name,date:d.commit?.author?.date,url:d.html_url}))})}case"github_get_commit":{let{owner:t,repo:n,sha:i}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and sha are required"});let e=await l(`/repos/${t}/${n}/commits/${i}`);return JSON.stringify({sha:e.sha?.slice(0,8),message:e.commit?.message,author:e.commit?.author?.name,date:e.commit?.author?.date,stats:e.stats,files:(e.files||[]).map(r=>({filename:r.filename,status:r.status,additions:r.additions,deletions:r.deletions,patch:r.patch?.slice(0,3e3)}))})}case"github_get_file":{let{owner:t,repo:n,path:i,ref:e}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and path are required"});let r=`/repos/${t}/${n}/contents/${encodeURIComponent(i)}`;e&&(r+=`?ref=${encodeURIComponent(e)}`);let s=await l(r);if(s.type!=="file")return Array.isArray(s)?JSON.stringify({type:"directory",path:i,entries:s.map(c=>({name:c.name,type:c.type,size:c.size,path:c.path}))}):JSON.stringify({error:`Not a file: ${s.type}`});let o=Buffer.from(s.content||"","base64").toString("utf-8"),d=o.length>2e4;return JSON.stringify({path:s.path,size:s.size,sha:s.sha?.slice(0,8),content:d?o.slice(0,2e4):o,truncated:d})}case"github_get_user":try{let t=await l("/installation/repositories?per_page=1");if(t.repositories&&t.repositories.length>0){let n=t.repositories[0],i=n.owner.login,e=n.owner.type,r=e==="Organization"?`/orgs/${i}`:`/users/${i}`,s=await l(r);return JSON.stringify({login:s.login,name:s.name||s.login,avatar:s.avatar_url,bio:s.bio||s.description,type:e,isOrg:e==="Organization",publicRepos:s.public_repos,message:"Showing GitHub App installation owner (GitHub Apps cannot access /user endpoint)"})}return JSON.stringify({error:"No repositories accessible to this GitHub App installation"})}catch(t){return JSON.stringify({error:`GitHub App cannot access /user endpoint. Use github_list_repos instead. (${t.message})`})}case"github_list_orgs":try{let n=(await l("/installation/repositories?per_page=100")).repositories||[],i=new Map;for(let r of n)r.owner.type==="Organization"&&(i.has(r.owner.login)||i.set(r.owner.login,{login:r.owner.login,description:null,url:r.owner.url}));let e=Array.from(i.values());return JSON.stringify({count:e.length,orgs:e,message:"Extracted from accessible repositories (GitHub Apps cannot access /user/orgs directly)"})}catch(t){return JSON.stringify({error:`GitHub App cannot list orgs via /user/orgs. Error: ${t.message}`})}case"github_clone":{let g=function(_){let S=_.replace(/^~(?=$|\/|\\)/,h);return s(S)},{owner:t,repo:n,destination:i}=a;if(!t||!n)return JSON.stringify({error:"owner and repo are required"});let{execSync:e}=await import("child_process"),{join:r,resolve:s}=await import("path"),{existsSync:o,mkdirSync:d}=await import("fs"),{homedir:c,platform:p}=await import("os"),{token:u}=await q("github"),h=c(),b=i?g(i):r(h,"zibby-repos"),f=r(b,n);if(d(b,{recursive:!0}),o(f))return JSON.stringify({error:`Directory ${f} already exists. Remove it first or use a different destination.`,existingPath:f});try{let _=`https://x-access-token:${u}@github.com/${t}/${n}.git`;e(`git clone ${_} "${f}"`,{stdio:"pipe"});let S=p()==="win32",m;return S?m=e(`dir "${f}"`,{encoding:"utf-8",shell:"cmd.exe"}):m=e(`ls -la "${f}"`,{encoding:"utf-8"}),JSON.stringify({success:!0,path:f,message:`Cloned ${t}/${n} to ${f}`,contents:m.split(`
|
|
43
43
|
`).slice(0,30).join(`
|
|
44
44
|
`),instructions:"IMPORTANT: Show the contents field to the user - it contains the directory listing."})}catch(_){return JSON.stringify({error:`Clone failed: ${_.message}`})}}case"github_search_repos":{let{query:t,limit:n}=a;if(!t)return JSON.stringify({error:"query is required"});let i=await this.handleToolCall("github_list_repos",{limit:200},{}),e=JSON.parse(i);if(e.error)return JSON.stringify(e);let r=t.toLowerCase(),s=e.repos.filter(o=>o.name.toLowerCase().includes(r)||o.fullName.toLowerCase().includes(r)||o.description&&o.description.toLowerCase().includes(r));return JSON.stringify({query:t,count:s.length,repos:s.slice(0,n||20)})}case"github_list_repos":{let{owner:t,type:n,sort:i,direction:e,limit:r,query:s}=a,o=100,d=r||200,c=[],p=m=>({name:m.name,fullName:m.full_name,private:m.private,description:m.description,language:m.language,defaultBranch:m.default_branch,updatedAt:m.updated_at,stars:m.stargazers_count,url:m.html_url,fullPath:m.full_name,webUrl:m.html_url,visibility:m.visibility||(m.private?"private":"public")}),u=m=>{if(!s)return!0;let w=String(s).toLowerCase();return m.name&&m.name.toLowerCase().includes(w)||m.fullName&&m.fullName.toLowerCase().includes(w)||m.description&&m.description.toLowerCase().includes(w)};if(!t){let m=1,w=!0;for(;w&&c.length<d;){let v=`/installation/repositories?per_page=${o}&page=${m}`,O=(await l(v)).repositories||[];if(O.length===0)break;c=c.concat(O),w=O.length===o,m++}let R=c.map(p).filter(u),$=R.slice(0,d),T=R.length>$.length,N=$.filter(v=>v.private).length,A=$.filter(v=>!v.private).length;return JSON.stringify({count:$.length,repos:$,truncated:T,privateCount:N,publicCount:A,message:`Found ${N} private and ${A} public repos`})}let h=await l(`/orgs/${t}`).then(()=>!0).catch(()=>!1),g=1,b=!0;for(;b&&c.length<d;){let m;h?m=`/orgs/${t}/repos?per_page=${o}&page=${g}&type=${n||"all"}&sort=${i||"updated"}&direction=${e||"desc"}`:m=`/users/${t}/repos?per_page=${o}&page=${g}&type=${n||"all"}&sort=${i||"updated"}&direction=${e||"desc"}`;let w=await l(m),R=Array.isArray(w)?w:[];if(R.length===0)break;c=c.concat(R),b=R.length===o,g++}let f=c.map(p).filter(u),_=f.slice(0,d),S=f.length>_.length;return JSON.stringify({count:_.length,repos:_,truncated:S})}case"github_create_issue":{let{owner:t,repo:n,title:i,body:e}=a;if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and title are required"});let r=await l(`/repos/${t}/${n}/issues`,{method:"POST",body:{title:i,body:e||""}});return JSON.stringify({number:r.number,url:r.html_url,title:r.title})}case"github_list_issues":{let{owner:t,repo:n,state:i,labels:e,since:r,assignee:s,sort:o,direction:d,limit:c}=a||{};if(!t||!n)return JSON.stringify({error:"owner and repo are required"});let p=new URLSearchParams;p.set("state",i||"open"),p.set("per_page",String(c||30)),p.set("sort",o||"updated"),p.set("direction",d||"desc"),e&&p.set("labels",Array.isArray(e)?e.join(","):e),r&&p.set("since",r),s&&p.set("assignee",s);let u=await l(`/repos/${t}/${n}/issues?${p.toString()}`),h=(Array.isArray(u)?u:[]).filter(g=>!g.pull_request).map(g=>({number:g.number,title:g.title,state:g.state,labels:(g.labels||[]).map(b=>typeof b=="string"?b:b.name),assignee:g.assignee?.login||null,assignees:(g.assignees||[]).map(b=>b.login),user:g.user?.login,comments:g.comments,url:g.html_url,createdAt:g.created_at,updatedAt:g.updated_at}));return JSON.stringify({count:h.length,issues:h})}case"github_get_issue":{let{owner:t,repo:n,number:i}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/issues/${i}`);return e.pull_request?JSON.stringify({error:`#${i} is a pull request, not an issue`,isPR:!0}):JSON.stringify({number:e.number,title:e.title,body:e.body||"",state:e.state,stateReason:e.state_reason||null,labels:(e.labels||[]).map(r=>typeof r=="string"?r:r.name),assignee:e.assignee?.login||null,assignees:(e.assignees||[]).map(r=>r.login),user:e.user?.login,milestone:e.milestone?.title||null,comments:e.comments,url:e.html_url,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at})}case"github_get_issue_comments":{let{owner:t,repo:n,number:i,limit:e}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let r=await l(`/repos/${t}/${n}/issues/${i}/comments?per_page=${e||100}`),s=(Array.isArray(r)?r:[]).map(o=>({id:o.id,user:o.user?.login,body:o.body||"",createdAt:o.created_at,updatedAt:o.updated_at,url:o.html_url}));return JSON.stringify({count:s.length,comments:s})}case"github_add_issue_comment":{let{owner:t,repo:n,number:i,body:e}=a||{};if(!t||!n||!i||!e)return JSON.stringify({error:"owner, repo, number, and body are required"});let r=await l(`/repos/${t}/${n}/issues/${i}/comments`,{method:"POST",body:{body:e}});return JSON.stringify({ok:!0,id:r.id,url:r.html_url})}case"github_close_issue":{let{owner:t,repo:n,number:i,stateReason:e}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let r={state:"closed"};e&&(r.state_reason=e);let s=await l(`/repos/${t}/${n}/issues/${i}`,{method:"PATCH",body:r});return JSON.stringify({ok:!0,number:s.number,state:s.state,stateReason:s.state_reason||null,url:s.html_url})}case"github_reopen_issue":{let{owner:t,repo:n,number:i}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${n}/issues/${i}`,{method:"PATCH",body:{state:"open"}});return JSON.stringify({ok:!0,number:e.number,state:e.state,url:e.html_url})}case"github_label_issue":{let{owner:t,repo:n,number:i,labels:e,mode:r}=a||{};if(!t||!n||!i)return JSON.stringify({error:"owner, repo, and number are required"});let s=Array.isArray(e)?e:e?[e]:[];if(!s.length)return JSON.stringify({error:"labels (string or array) is required"});let o=r||"add";if(o==="set"){let c=await l(`/repos/${t}/${n}/issues/${i}`,{method:"PATCH",body:{labels:s}});return JSON.stringify({ok:!0,number:c.number,labels:(c.labels||[]).map(p=>typeof p=="string"?p:p.name)})}if(o==="remove"){for(let p of s)await l(`/repos/${t}/${n}/issues/${i}/labels/${encodeURIComponent(p)}`,{method:"DELETE"});let c=await l(`/repos/${t}/${n}/issues/${i}`);return JSON.stringify({ok:!0,number:c.number,labels:(c.labels||[]).map(p=>typeof p=="string"?p:p.name)})}let d=await l(`/repos/${t}/${n}/issues/${i}/labels`,{method:"POST",body:{labels:s}});return JSON.stringify({ok:!0,number:i,labels:(Array.isArray(d)?d:[]).map(c=>typeof c=="string"?c:c.name)})}default:return JSON.stringify({error:`Unknown tool: ${y}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"github_get_user",description:"Get the authenticated GitHub user profile and their organizations",input_schema:{type:"object",properties:{}}},{name:"github_list_orgs",description:"List GitHub organizations the authenticated user belongs to",input_schema:{type:"object",properties:{}}},{name:"github_list_repos",description:"List the repositories this token/installation can access (omit owner) \u2014 or a specific user/org's repos (pass owner). Use this to discover a RELATED repo worth cloning when a change's correctness depends on another accessible repo. Each repo carries a normalized { fullPath, name, webUrl, defaultBranch, visibility } shape (identical to gitlab_list_projects) alongside legacy fields, plus a truncated flag.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Org or user login. Omit to list every repo your token/installation can access."},query:{type:"string",description:"Optional term matched against repo name/full-name/description"},type:{type:"string",enum:["all","public","private","forks","sources","member"],description:"Filter by type (default: all)"},sort:{type:"string",enum:["created","updated","pushed","full_name"],description:"Sort field (default: updated)"},direction:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max repos to return (default: 200, hard-capped at the fetch ceiling)"}}}},{name:"github_clone",description:'Clone a GitHub repository to the local filesystem. Use when user says "check out" or "clone" a repo.',input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner (user or org name)"},repo:{type:"string",description:"Repository name"},destination:{type:"string",description:"Destination directory. Accepts absolute paths, ~-prefixed paths, or relative names. Defaults to ~/zibby-repos/<repo>."}},required:["owner","repo"]}},{name:"github_search_repos",description:"Search accessible repositories by name or description. Use this when the user asks to find a specific repo.",input_schema:{type:"object",properties:{query:{type:"string",description:'Search term to match against repo name or description (e.g., "electron", "my-app")'},limit:{type:"number",description:"Max results (default: 20)"}},required:["query"]}},{name:"github_search_issues",description:"Search GitHub issues and pull requests",input_schema:{type:"object",properties:{query:{type:"string",description:'GitHub search query (e.g. "SCRUM-123", "login bug repo:org/app")'},limit:{type:"number",description:"Max results (default: 20)"}},required:["query"]}},{name:"github_search_code",description:"Search code across GitHub repositories by keyword",input_schema:{type:"object",properties:{query:{type:"string",description:'Code search query (e.g. "handleLogin", "class AuthService")'},repo:{type:"string",description:'Scope to a specific repo (e.g. "org/app"). Optional.'},language:{type:"string",description:'Filter by language (e.g. "javascript", "python"). Optional.'},limit:{type:"number",description:"Max results (default: 15)"}},required:["query"]}},{name:"github_get_pr",description:"Get details of a pull request \u2014 title, description, branch, stats",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"}},required:["owner","repo","number"]}},{name:"github_get_pr_diff",description:"Get the unified diff of a pull request \u2014 the actual code changes",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"}},required:["owner","repo","number"]}},{name:"github_list_pr_files",description:"List files changed in a PR with per-file patches",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"}},required:["owner","repo","number"]}},{name:"github_list_pr_comments",description:"Get all review and issue comments on a PR",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"}},required:["owner","repo","number"]}},{name:"github_get_review_thread",description:"Read a PR review-comment THREAD given any comment id in it: the root review comment + all its replies, plus the anchored diff context (file, line, the original diff hunk). Use this to understand a human's reply to a previous review comment before replying in-thread.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"},commentId:{type:"number",description:"Any review-comment id in the thread (the root or any reply)"}},required:["owner","repo","number","commentId"]}},{name:"github_reply_review_thread",description:"Reply IN-THREAD to an existing PR review-comment thread (a conversational reply nested under the thread the human commented on \u2014 NOT a fresh full review). Pass any comment id in the thread.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"},commentId:{type:"number",description:"Any review-comment id in the thread to reply to"},body:{type:"string",description:"The reply text (markdown)"}},required:["owner","repo","number","commentId","body"]}},{name:"github_reply_issue_comment",description:"Post a reply on a PR's top-level conversation (a new issue comment on the PR). Use when the human replied to a non-inline/summary comment rather than an inline review thread. Quote or @-mention for context since issue comments are not threaded.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"},body:{type:"string",description:"The reply text (markdown)"}},required:["owner","repo","number","body"]}},{name:"github_create_review",description:"Post a review on a pull request: a summary body plus optional inline comments anchored to file/line, with an event (COMMENT, APPROVE, or REQUEST_CHANGES). Use this to deliver a code review back to the PR.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"},body:{type:"string",description:"The review summary (markdown). Shown as the top-level review comment."},event:{type:"string",enum:["COMMENT","APPROVE","REQUEST_CHANGES"],description:"Review verdict. Default COMMENT (no approval state). Use REQUEST_CHANGES for blocking issues."},comments:{type:"array",description:"Optional inline comments, each anchored to a changed line.",items:{type:"object",properties:{path:{type:"string",description:"File path as it appears in the diff"},line:{type:"number",description:"Line number in the file's NEW version (the right side of the diff)"},side:{type:"string",enum:["LEFT","RIGHT"],description:"RIGHT (new) or LEFT (old). Default RIGHT."},body:{type:"string",description:"The inline comment text (markdown)"}},required:["path","line","body"]}}},required:["owner","repo","number"]}},{name:"github_list_commits",description:"List recent commits on a branch, optionally filtered by file path",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},branch:{type:"string",description:"Branch name (default: repo default branch)"},path:{type:"string",description:"Filter commits touching this file path"},limit:{type:"number",description:"Max commits (default: 20)"}},required:["owner","repo"]}},{name:"github_get_commit",description:"Get details of a specific commit \u2014 message, stats, file diffs",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},sha:{type:"string",description:"Commit SHA (full or short)"}},required:["owner","repo","sha"]}},{name:"github_get_file",description:"Read a file (or list a directory) from a GitHub repo. Works on any branch/ref.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},path:{type:"string",description:'File or directory path (e.g. "src/auth/login.ts")'},ref:{type:"string",description:"Branch, tag, or commit SHA (default: repo default branch)"}},required:["owner","repo","path"]}},{name:"github_create_issue",description:"Create a GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},title:{type:"string",description:"Issue title"},body:{type:"string",description:"Issue body (markdown)"}},required:["owner","repo","title"]}},{name:"github_list_issues",description:"List issues in a repo (excludes pull requests). Filter by state, labels, and an updated-since cursor for polling.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},state:{type:"string",enum:["open","closed","all"],description:"Filter by state (default: open)"},labels:{type:"array",items:{type:"string"},description:"Only issues carrying ALL of these labels"},since:{type:"string",description:"ISO-8601 timestamp; only issues updated at/after this (polling cursor)"},assignee:{type:"string",description:'Filter by assignee login, "none", or "*"'},sort:{type:"string",enum:["created","updated","comments"],description:"Sort field (default: updated)"},direction:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max issues (default: 30, max 100 per page)"}},required:["owner","repo"]}},{name:"github_get_issue",description:"Get a single GitHub issue with full detail (title, body, state, labels, assignee, url)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_get_issue_comments",description:"Get the comment thread on a GitHub issue (chronological)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},limit:{type:"number",description:"Max comments (default: 100)"}},required:["owner","repo","number"]}},{name:"github_add_issue_comment",description:"Add a comment to a GitHub issue. Also the way to record a PR link on an issue (post a markdown link).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},body:{type:"string",description:"Comment body (markdown)"}},required:["owner","repo","number","body"]}},{name:"github_close_issue",description:"Close a GitHub issue. Optionally set the close reason (completed or not_planned).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},stateReason:{type:"string",enum:["completed","not_planned"],description:"Why the issue was closed (optional)"}},required:["owner","repo","number"]}},{name:"github_reopen_issue",description:"Reopen a closed GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_label_issue",description:"Add, set (replace all), or remove labels on a GitHub issue. Labels back state-like transitions on GitHub.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},labels:{type:"array",items:{type:"string"},description:"Label name(s)"},mode:{type:"string",enum:["add","set","remove"],description:"add appends, set replaces all, remove deletes (default: add)"}},required:["owner","repo","number","labels"]}}]};export{z as githubSkill};
|