@zibby/skills 0.1.51 → 0.1.53
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/dist/chat-notify.js +3 -3
- package/dist/datasetStore.d.ts +5 -8
- package/dist/datasetStore.js +14 -13
- package/dist/figma.js +2 -2
- package/dist/git-write.js +1 -1
- package/dist/github.js +2 -2
- package/dist/gitlab.js +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +107 -100
- package/dist/integrations.d.ts +6 -0
- package/dist/integrations.js +1 -1
- package/dist/jira.js +1 -1
- package/dist/lark.js +2 -2
- package/dist/linear.js +3 -3
- package/dist/linkedin.d.ts +84 -0
- package/dist/linkedin.js +7 -0
- package/dist/llm-billing.js +1 -1
- package/dist/notion.js +2 -2
- package/dist/opendesign.js +2 -2
- package/dist/package.json +2 -2
- package/dist/plane.js +1 -1
- package/dist/sentry.js +1 -1
- package/dist/slack.js +2 -2
- package/dist/trackers/github-adapter.js +2 -2
- package/dist/trackers/index.js +9 -9
- package/dist/trackers/jira-adapter.js +3 -3
- package/dist/trackers/linear-adapter.js +10 -10
- package/package.json +2 -2
package/dist/chat-notify.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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",OPEN_DESIGN:"open_design"}),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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"}});function
|
|
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",OPEN_DESIGN:"open_design",LINKEDIN:"linkedin"}),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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin:{id:"linkedin",name:"LinkedIn",connectPath:"/integrations?provider=linkedin"}});function I(){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 d(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}`},m;if(s){let l=new URLSearchParams(e).toString();l&&(n+=`?${l}`)}else a["Content-Type"]="application/json; charset=utf-8",m=JSON.stringify(e);let i=await(await fetch(n,{method:s?"GET":"POST",headers:a,body:m})).json();if(!i.ok)throw new Error(`Slack API error: ${i.error}`);return i}var _={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=T();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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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,m=5;for(let i=0;i<m;i+=1){let l={limit:200};a&&(l.cursor=a);let c=await d("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 w}from"url";import{dirname as A,resolve as C}from"path";import{resolveIntegrationToken as E}from"@zibby/core/backend-client.js";function L(){if(process.env.MCP_LARK_PATH)return process.env.MCP_LARK_PATH;let r=A(w(import.meta.url)),e=C(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 E("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}`,m={method:r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json; charset=utf-8"}};r!=="GET"&&(m.body=JSON.stringify(t));let i=await(await fetch(a,m)).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=I();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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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 d("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,m=5;for(let i=0;i<m;i+=1){let l={limit:200};a&&(l.cursor=a);let c=await d("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 T}from"fs";import{fileURLToPath as w}from"url";import{dirname as A,resolve as L}from"path";import{resolveIntegrationToken as E}from"@zibby/core/backend-client.js";function C(){if(process.env.MCP_LARK_PATH)return process.env.MCP_LARK_PATH;let r=A(w(import.meta.url)),e=L(r,"..","bin","mcp-lark.mjs");return T(e)?e:null}var R=6e3*1e3,g=null;async function P(){let{appId:r,appSecret:e,host:t}=await E("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}`,m={method:r,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json; charset=utf-8"}};r!=="GET"&&(m.body=JSON.stringify(t));let i=await(await fetch(a,m)).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=
|
|
14
|
+
When responding to an incoming event, prefer lark_reply with the source message_id so the response threads cleanly.`,resolve(){let r=C();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,m=((await f("GET","/open-apis/im/v1/chats?page_size=100")).items||[]).map(c=>c.chat_id),u=new Set,i=[];for(let c of m){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||u.has(p.member_id))&&(u.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:[..._.envKeys||[],...h.envKeys||[]],get serverName(){if(process.env.SLACK_CHANNEL)return _.serverName;if(process.env.LARK_RECEIVE_ID)return h.serverName;if(process.env.SLACK_BOT_TOKEN)return _.serverName},get allowedTools(){return process.env.SLACK_CHANNEL?_.allowedTools||[]:process.env.LARK_RECEIVE_ID?h.allowedTools||[]:process.env.SLACK_BOT_TOKEN?_.allowedTools||[]:[]},promptFragment:`## Chat notifications (Slack OR Lark \u2014 at least one connected)
|
|
15
15
|
You can post chat messages via:
|
|
16
16
|
- slack_post_message (channel, text[, blocks]) \u2014 Slack. The \`channel\` is REQUIRED on every call.
|
|
17
17
|
- lark_send_message (receive_id, text) \u2014 Lark.
|
package/dist/datasetStore.d.ts
CHANGED
|
@@ -26,15 +26,15 @@ export namespace datasetStoreSkill {
|
|
|
26
26
|
input_schema: {
|
|
27
27
|
type: string;
|
|
28
28
|
properties: {
|
|
29
|
-
|
|
29
|
+
store: {
|
|
30
30
|
type: string;
|
|
31
31
|
description: string;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
record: {
|
|
34
34
|
type: string;
|
|
35
35
|
description: string;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
description: {
|
|
38
38
|
type: string;
|
|
39
39
|
description: string;
|
|
40
40
|
};
|
|
@@ -58,11 +58,7 @@ export namespace datasetStoreSkill {
|
|
|
58
58
|
input_schema: {
|
|
59
59
|
type: string;
|
|
60
60
|
properties: {
|
|
61
|
-
|
|
62
|
-
type: string;
|
|
63
|
-
description: string;
|
|
64
|
-
};
|
|
65
|
-
dataset: {
|
|
61
|
+
store: {
|
|
66
62
|
type: string;
|
|
67
63
|
description: string;
|
|
68
64
|
};
|
|
@@ -99,6 +95,7 @@ export namespace datasetStoreSkill {
|
|
|
99
95
|
description: string;
|
|
100
96
|
};
|
|
101
97
|
record?: undefined;
|
|
98
|
+
description?: undefined;
|
|
102
99
|
};
|
|
103
100
|
required: any[];
|
|
104
101
|
};
|
package/dist/datasetStore.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import{existsSync as c,readFileSync as
|
|
2
|
-
You have
|
|
3
|
-
stateless runs. Unlike key-value memory (for picking up where you left
|
|
4
|
-
this is for accumulating DATA you want to QUERY and AGGREGATE later \u2014 e.g.
|
|
1
|
+
import{existsSync as c,readFileSync as u}from"node:fs";import{homedir as p}from"node:os";import{join as l,dirname as y,resolve as m}from"node:path";import{fileURLToPath as f}from"node:url";function g(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=y(f(import.meta.url)),t=m(r,"..","bin","mcp-skill.mjs");return c(t)?t:null}function h(){if(process.env.PROJECT_API_TOKEN)return process.env.PROJECT_API_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let r=l(p(),".zibby","config.json");return c(r)&&JSON.parse(u(r,"utf-8")).sessionToken||null}catch{return null}}function O(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://api-prod.zibby.app"}function b(){return(typeof process.env.WORKFLOW_TYPE=="string"?process.env.WORKFLOW_TYPE.trim():"")||"agent"}function _(){let r={};for(let[t,e]of Object.entries(process.env)){let o=/^ZIBBY_STORE__(.+)$/.exec(t);if(!o)continue;let n=typeof e=="string"?e.trim():"";n&&(r[o[1]]=n)}return r}function i(r){let t=_(),e=Object.keys(t),o=typeof r=="string"?r.trim():"";return o?Object.prototype.hasOwnProperty.call(t,o)?{storeId:t[o],name:o}:{error:`unknown store '${o}'; available: ${e.join(", ")}`}:e.length===1?{storeId:t[e[0]],name:e[0]}:e.length===0?{error:"no stores bound to this agent"}:{error:`multiple stores are bound; pass \`store\` (one of: ${e.join(", ")})`}}async function a(r,t,e){let o=h();if(!o)throw new Error("No backend credential (PROJECT_API_TOKEN). Dataset store is only available inside a Zibby run.");let n=`${O()}/datasets/stores/${encodeURIComponent(r)}/${t}`,s=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let d=await s.text().catch(()=>"");throw new Error(`Store ${t} failed (${s.status}): ${d.slice(0,300)}`)}return s.json()}var T={id:"dataset-store",serverName:"dataset_store",allowedTools:["mcp__dataset_store__*"],description:"Dataset store \u2014 a durable, queryable store for structured JSON records; append rows now, run SQL-style aggregations/reports later",promptFragment:`## Dataset Store (durable, queryable structured-record store)
|
|
2
|
+
You have one or more durable stores for STRUCTURED records that survive across
|
|
3
|
+
your stateless runs. Unlike key-value memory (for picking up where you left
|
|
4
|
+
off), this is for accumulating DATA you want to QUERY and AGGREGATE later \u2014 e.g.
|
|
5
5
|
per-run metrics, processed items, findings \u2014 and turn into a report.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Your bound stores are listed in the "AVAILABLE STORES" block below (each with a
|
|
8
|
+
name + description). Pick one BY DESCRIPTION and pass its \`store\` NAME (e.g.
|
|
9
|
+
"scorecards") to the tools \u2014 NOT an id. If exactly one store is bound you may
|
|
10
|
+
omit \`store\` and it defaults to that one. You can ONLY write to a bound store
|
|
11
|
+
name; any other name is rejected. Each appended record is an arbitrary JSON
|
|
12
|
+
object, auto-tagged with YOUR agent type so you can later filter to your writes.
|
|
12
13
|
|
|
13
14
|
Tools:
|
|
14
|
-
- dataset_append: Append ONE structured JSON \`record\` to a
|
|
15
|
-
durably persist a row of data each run (e.g. {repo, stars, ts}).
|
|
16
|
-
- dataset_query: Run a SQL-style query over a
|
|
15
|
+
- dataset_append: Append ONE structured JSON \`record\` to a store (by \`store\`
|
|
16
|
+
name). Use to durably persist a row of data each run (e.g. {repo, stars, ts}).
|
|
17
|
+
- dataset_query: Run a SQL-style query over a store \u2014 select/aggregate
|
|
17
18
|
(count|sum|avg|min|max), filter (where), group (groupBy), order, limit, and
|
|
18
|
-
bound by month (since/until). Use to compute reports from what you've stored.`,resolve(){let r=
|
|
19
|
+
bound by month (since/until). Use to compute reports from what you've stored.`,resolve(){let r=g();if(!r)return{command:null,args:[],env:{},description:this.description};let t={};for(let e of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","WORKFLOW_TYPE"])process.env[e]&&(t[e]=process.env[e]);for(let e of Object.keys(process.env))/^ZIBBY_STORE__.+$/.test(e)&&process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[r,"../dist/datasetStore.js","datasetStoreSkill"],env:t,description:this.description,alwaysLoad:!1}},async handleToolCall(r,t){try{switch(r){case"dataset_append":{if(t?.record==null||typeof t.record!="object"||Array.isArray(t.record))return JSON.stringify({error:"record is required (a JSON object)"});let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o=typeof t?.agent=="string"&&t.agent.trim()?t.agent.trim():b(),n={record:t.record,agent:o};typeof t?.description=="string"&&t.description.trim()&&(n.description=t.description.trim());let s=await a(e.storeId,"append",n);return JSON.stringify({...s,store:e.name,storeId:e.storeId})}case"dataset_query":{let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o={};for(let s of["select","where","groupBy","orderBy","limit","since","until","agent"])t?.[s]!=null&&(o[s]=t[s]);let n=await a(e.storeId,"query",o);return JSON.stringify({...n,store:e.name,storeId:e.storeId})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"dataset_append",description:"Append ONE structured JSON record to a bound store, durably. Records persist across your stateless runs and are auto-tagged with your agent type so you can filter to your own writes later. Use to accumulate data you will query/aggregate (e.g. per-run metrics, processed items). Append ONE record per call.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to write to (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store; you can ONLY write to a bound store name.'},record:{type:"object",description:'An arbitrary JSON object \u2014 one row of data. Its keys become queryable fields (e.g. {"repo":"owner/x","stars":1200}). One record per call.'},description:{type:"string",description:"Optional, informational note about this write. The store already exists from deploy, so this is not required and does not create anything."},agent:{type:"string",description:"Optional writing-agent tag. Defaults to your own agent type \u2014 leave unset to auto-tag."}},required:["record"]}},{name:"dataset_query",description:"Run a SQL-style query over a bound store to build reports: select/aggregate (count|sum|avg|min|max), filter, group, order, limit, and bound by month. Returns { columns, rows }. Use this to compute summaries/aggregations from records you appended earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to query (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store.'},select:{type:"array",description:"Columns to return. Each item is { field?, agg?, as? }. agg \u2208 count|sum|avg|min|max; omit field for count(*). Omit `select` entirely to return raw rows."},where:{type:"array",description:"Filters, ANDed. Each item is { field, op, value }; op \u2208 eq|ne|gt|gte|lt|lte|like. `field` is a JSON key of the stored record."},groupBy:{type:"array",description:"Field names to group by (array of strings) for aggregation."},orderBy:{type:"array",description:"Sort spec. Each item is { field|as, dir }; dir \u2208 asc|desc."},limit:{type:"number",description:"Maximum number of rows to return."},since:{type:"string",description:"Inclusive lower bound month, 'yyyy-MM' (e.g. '2026-01')."},until:{type:"string",description:"Inclusive upper bound month, 'yyyy-MM' (e.g. '2026-06')."},agent:{type:"string",description:"Filter to records written by one agent namespace. Omit to query across all writers."}},required:[]}}]};export{T as datasetStoreSkill};
|
package/dist/figma.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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",OPEN_DESIGN:"open_design"}),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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"}});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
|
|
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",OPEN_DESIGN:"open_design",LINKEDIN:"linkedin"}),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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin:{id:"linkedin",name:"LinkedIn",connectPath:"/integrations?provider=linkedin"}});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 A={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
2
|
You have read access to the user's Figma files via the Figma REST API. Tools:
|
|
3
3
|
|
|
4
4
|
### Identity
|
|
@@ -16,4 +16,4 @@ You have read access to the user's Figma files via the Figma REST API. Tools:
|
|
|
16
16
|
|
|
17
17
|
### Notes
|
|
18
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{
|
|
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{A as figmaSkill};
|
package/dist/git-write.js
CHANGED
|
@@ -9,7 +9,7 @@ When a test ticket lacks context, use this workflow:
|
|
|
9
9
|
2. Use git_explore to understand the project structure
|
|
10
10
|
3. Use shell commands (grep, cat) to read specific files for deeper understanding
|
|
11
11
|
4. Use GitHub/GitLab skills to read related PRs and commits
|
|
12
|
-
5. Build well-informed test specs and save them to files before running tests`,resolve(){return null},async handleToolCall(m,n,r){let i=r?.options?.workspace||process.cwd();try{switch(m){case"git_checkout":return await Q(n,i);case"git_list_repos":return V(n,i);case"git_explore":return Y(n,i);default:return JSON.stringify({error:`Unknown tool: ${m}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"git_checkout",description:"Clone a git repository locally (or pull latest if already cloned). Auto-authenticates with GitHub/GitLab tokens if available.",input_schema:{type:"object",properties:{url:{type:"string",description:'Repository URL (e.g. "https://github.com/org/repo" or "org/repo" shorthand for GitHub)'},branch:{type:"string",description:"Branch to checkout (default: repo default branch)"},shallow:{type:"boolean",description:"Shallow clone with depth 1 (default: true, faster)"},name:{type:"string",description:"Local directory name override (default: repo name from URL)"}},required:["url"]}},{name:"git_list_repos",description:"List locally cloned repositories",input_schema:{type:"object",properties:{}}},{name:"git_explore",description:"Quick structural overview of a cloned repo: key files, package.json info, directory tree (top 2 levels), detected framework/language",input_schema:{type:"object",properties:{repo:{type:"string",description:"Repo name (as listed by git_list_repos)"},depth:{type:"number",description:"Directory tree depth (default: 2)"}},required:["repo"]}}]};async function Q(m,n){let{url:r,branch:i,shallow:t=!0,name:e}=m;!r.includes("://")&&!r.startsWith("git@")&&(r=`https://github.com/${r}`);let s=e||W(r.replace(/\.git$/,"")),a=G(n,E);F(a,{recursive:!0});let o=A(a,s),p=r,d=process.env.GITHUB_TOKEN,l=process.env.GITLAB_TOKEN,c=process.env.GITLAB_URL;if(r.includes("github.com")&&d)p=r.replace("https://github.com",`https://x-access-token:${d}@github.com`);else if(l&&c)try{let u=new URL(c).host;r.includes(u)&&(p=r.replace(`https://${u}`,`https://oauth2:${l}@${u}`))}catch{}if(O(A(o,".git"))){let u=i?`git -C "${o}" fetch origin ${i} && git -C "${o}" checkout ${i} && git -C "${o}" pull origin ${i}`:`git -C "${o}" pull`;await I(u,n);let _=await I(`git -C "${o}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"updated",repo:s,path:o,branch:i||"default",head:_})}let h=["git","clone"];t&&h.push("--depth","1"),i&&h.push("--branch",i),h.push(`"${p}"`,`"${o}"`),await I(h.join(" "),n);let y=await I(`git -C "${o}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"cloned",repo:s,path:o,branch:i||"default",shallow:t,head:y})}function V(m,n){let r=G(n,E);if(!O(r))return JSON.stringify({repos:[],message:"No repos cloned yet"});let i=[];for(let t of U(r,{withFileTypes:!0})){if(!t.isDirectory())continue;let e=A(r,t.name);if(!O(A(e,".git")))continue;let s=K(e);i.push({name:t.name,path:e,lastModified:s.mtime.toISOString()})}return JSON.stringify({repos:i,total:i.length,directory:r})}function Y(m,n){let{repo:r,depth:i=2}=m,t=G(n,E,r);if(!O(t))return JSON.stringify({error:`Repo not found: ${r}. Run git_checkout first.`});let e={repo:r,path:t},s=A(t,"package.json");if(O(s))try{let h=JSON.parse(z(s,"utf-8"));e.packageJson={name:h.name,version:h.version,scripts:h.scripts?Object.keys(h.scripts):[],dependencies:h.dependencies?Object.keys(h.dependencies).slice(0,30):[],devDependencies:h.devDependencies?Object.keys(h.devDependencies).slice(0,20):[]},h.dependencies?.react?e.framework="React":h.dependencies?.next?e.framework="Next.js":h.dependencies?.vue?e.framework="Vue":h.dependencies?.angular?e.framework="Angular":h.dependencies?.express?e.framework="Express":h.dependencies?.fastify&&(e.framework="Fastify")}catch{}let a=A(t,"pyproject.toml");O(a)&&(e.language="Python");let o=A(t,"go.mod");O(o)&&(e.language="Go");let p=A(t,"Cargo.toml");O(p)&&(e.language="Rust"),O(s)&&(e.language=e.language||"JavaScript/TypeScript");let d=[];function l(h,y,u){if(u>i)return;let _;try{_=U(h,{withFileTypes:!0})}catch{return}let v=_.filter(f=>!f.name.startsWith(".")&&f.name!=="node_modules"&&f.name!=="__pycache__"&&f.name!=="dist"&&f.name!=="build"&&f.name!==".git").sort((f,g)=>f.isDirectory()!==g.isDirectory()?f.isDirectory()?-1:1:f.name.localeCompare(g.name));for(let f of v){let g=f.isDirectory();d.push(`${y}${g?"\u{1F4C1}":"\u{1F4C4}"} ${f.name}`),g&&u<i&&l(A(h,f.name),`${y} `,u+1)}}l(t,"",1),e.tree=d.slice(0,80),d.length>80&&(e.treeTruncated=!0);let c=["README.md","README.rst","src/App.tsx","src/App.jsx","src/App.js","src/routes.tsx","src/routes.js","app/routes.tsx","app/routes.js","src/index.tsx","src/index.ts","src/main.tsx","src/main.ts","pages/_app.tsx","pages/_app.js","app/layout.tsx","docker-compose.yml","Dockerfile",".env.example"];return e.keyFilesFound=c.filter(h=>O(A(t,h))),JSON.stringify(e)}import{existsSync as Z}from"fs";import{fileURLToPath as X}from"url";import{dirname as ee,resolve as te}from"path";import{resolveIntegrationToken as C}from"@zibby/core/backend-client.js";var L=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",OPEN_DESIGN:"open_design"}),be=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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"}});function re(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let m=ee(X(import.meta.url)),n=te(m,"..","bin","mcp-skill.mjs");return Z(n)?n:null}async function b(m,n={}){let{token:r}=await C("github"),i=m.startsWith("https://")?m:`https://api.github.com${m}`,t={Authorization:`Bearer ${r}`,Accept:n.accept||"application/vnd.github.v3+json","User-Agent":"Zibby-App",...n.body?{"Content-Type":"application/json"}:{}},e=await fetch(i,{method:n.method||"GET",headers:t,body:n.body?JSON.stringify(n.body):void 0});if(!e.ok){let s=await e.text().catch(()=>"");throw new Error(`GitHub API ${e.status}: ${s.slice(0,300)}`)}return n.raw?e.text():e.json()}var q={id:"github",serverName:"github",allowedTools:["mcp__github__*"],requiresIntegration:L.GITHUB,envKeys:["GITHUB_TOKEN"],description:"GitHub \u2014 issues, PRs, commits, code search, file reading",promptFragment:`## GitHub (connected)
|
|
12
|
+
5. Build well-informed test specs and save them to files before running tests`,resolve(){return null},async handleToolCall(m,n,r){let i=r?.options?.workspace||process.cwd();try{switch(m){case"git_checkout":return await Q(n,i);case"git_list_repos":return V(n,i);case"git_explore":return Y(n,i);default:return JSON.stringify({error:`Unknown tool: ${m}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"git_checkout",description:"Clone a git repository locally (or pull latest if already cloned). Auto-authenticates with GitHub/GitLab tokens if available.",input_schema:{type:"object",properties:{url:{type:"string",description:'Repository URL (e.g. "https://github.com/org/repo" or "org/repo" shorthand for GitHub)'},branch:{type:"string",description:"Branch to checkout (default: repo default branch)"},shallow:{type:"boolean",description:"Shallow clone with depth 1 (default: true, faster)"},name:{type:"string",description:"Local directory name override (default: repo name from URL)"}},required:["url"]}},{name:"git_list_repos",description:"List locally cloned repositories",input_schema:{type:"object",properties:{}}},{name:"git_explore",description:"Quick structural overview of a cloned repo: key files, package.json info, directory tree (top 2 levels), detected framework/language",input_schema:{type:"object",properties:{repo:{type:"string",description:"Repo name (as listed by git_list_repos)"},depth:{type:"number",description:"Directory tree depth (default: 2)"}},required:["repo"]}}]};async function Q(m,n){let{url:r,branch:i,shallow:t=!0,name:e}=m;!r.includes("://")&&!r.startsWith("git@")&&(r=`https://github.com/${r}`);let s=e||W(r.replace(/\.git$/,"")),a=G(n,E);F(a,{recursive:!0});let o=A(a,s),p=r,d=process.env.GITHUB_TOKEN,l=process.env.GITLAB_TOKEN,c=process.env.GITLAB_URL;if(r.includes("github.com")&&d)p=r.replace("https://github.com",`https://x-access-token:${d}@github.com`);else if(l&&c)try{let u=new URL(c).host;r.includes(u)&&(p=r.replace(`https://${u}`,`https://oauth2:${l}@${u}`))}catch{}if(O(A(o,".git"))){let u=i?`git -C "${o}" fetch origin ${i} && git -C "${o}" checkout ${i} && git -C "${o}" pull origin ${i}`:`git -C "${o}" pull`;await I(u,n);let _=await I(`git -C "${o}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"updated",repo:s,path:o,branch:i||"default",head:_})}let h=["git","clone"];t&&h.push("--depth","1"),i&&h.push("--branch",i),h.push(`"${p}"`,`"${o}"`),await I(h.join(" "),n);let y=await I(`git -C "${o}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"cloned",repo:s,path:o,branch:i||"default",shallow:t,head:y})}function V(m,n){let r=G(n,E);if(!O(r))return JSON.stringify({repos:[],message:"No repos cloned yet"});let i=[];for(let t of U(r,{withFileTypes:!0})){if(!t.isDirectory())continue;let e=A(r,t.name);if(!O(A(e,".git")))continue;let s=K(e);i.push({name:t.name,path:e,lastModified:s.mtime.toISOString()})}return JSON.stringify({repos:i,total:i.length,directory:r})}function Y(m,n){let{repo:r,depth:i=2}=m,t=G(n,E,r);if(!O(t))return JSON.stringify({error:`Repo not found: ${r}. Run git_checkout first.`});let e={repo:r,path:t},s=A(t,"package.json");if(O(s))try{let h=JSON.parse(z(s,"utf-8"));e.packageJson={name:h.name,version:h.version,scripts:h.scripts?Object.keys(h.scripts):[],dependencies:h.dependencies?Object.keys(h.dependencies).slice(0,30):[],devDependencies:h.devDependencies?Object.keys(h.devDependencies).slice(0,20):[]},h.dependencies?.react?e.framework="React":h.dependencies?.next?e.framework="Next.js":h.dependencies?.vue?e.framework="Vue":h.dependencies?.angular?e.framework="Angular":h.dependencies?.express?e.framework="Express":h.dependencies?.fastify&&(e.framework="Fastify")}catch{}let a=A(t,"pyproject.toml");O(a)&&(e.language="Python");let o=A(t,"go.mod");O(o)&&(e.language="Go");let p=A(t,"Cargo.toml");O(p)&&(e.language="Rust"),O(s)&&(e.language=e.language||"JavaScript/TypeScript");let d=[];function l(h,y,u){if(u>i)return;let _;try{_=U(h,{withFileTypes:!0})}catch{return}let v=_.filter(f=>!f.name.startsWith(".")&&f.name!=="node_modules"&&f.name!=="__pycache__"&&f.name!=="dist"&&f.name!=="build"&&f.name!==".git").sort((f,g)=>f.isDirectory()!==g.isDirectory()?f.isDirectory()?-1:1:f.name.localeCompare(g.name));for(let f of v){let g=f.isDirectory();d.push(`${y}${g?"\u{1F4C1}":"\u{1F4C4}"} ${f.name}`),g&&u<i&&l(A(h,f.name),`${y} `,u+1)}}l(t,"",1),e.tree=d.slice(0,80),d.length>80&&(e.treeTruncated=!0);let c=["README.md","README.rst","src/App.tsx","src/App.jsx","src/App.js","src/routes.tsx","src/routes.js","app/routes.tsx","app/routes.js","src/index.tsx","src/index.ts","src/main.tsx","src/main.ts","pages/_app.tsx","pages/_app.js","app/layout.tsx","docker-compose.yml","Dockerfile",".env.example"];return e.keyFilesFound=c.filter(h=>O(A(t,h))),JSON.stringify(e)}import{existsSync as Z}from"fs";import{fileURLToPath as X}from"url";import{dirname as ee,resolve as te}from"path";import{resolveIntegrationToken as C}from"@zibby/core/backend-client.js";var L=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",OPEN_DESIGN:"open_design",LINKEDIN:"linkedin"}),be=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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin:{id:"linkedin",name:"LinkedIn",connectPath:"/integrations?provider=linkedin"}});function re(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let m=ee(X(import.meta.url)),n=te(m,"..","bin","mcp-skill.mjs");return Z(n)?n:null}async function b(m,n={}){let{token:r}=await C("github"),i=m.startsWith("https://")?m:`https://api.github.com${m}`,t={Authorization:`Bearer ${r}`,Accept:n.accept||"application/vnd.github.v3+json","User-Agent":"Zibby-App",...n.body?{"Content-Type":"application/json"}:{}},e=await fetch(i,{method:n.method||"GET",headers:t,body:n.body?JSON.stringify(n.body):void 0});if(!e.ok){let s=await e.text().catch(()=>"");throw new Error(`GitHub API ${e.status}: ${s.slice(0,300)}`)}return n.raw?e.text():e.json()}var q={id:"github",serverName:"github",allowedTools:["mcp__github__*"],requiresIntegration:L.GITHUB,envKeys:["GITHUB_TOKEN"],description:"GitHub \u2014 issues, PRs, commits, code search, file reading",promptFragment:`## GitHub (connected)
|
|
13
13
|
You have access to the user's GitHub repositories. Available tools:
|
|
14
14
|
|
|
15
15
|
### Discovery
|
package/dist/github.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as k}from"fs";import{fileURLToPath as E}from"url";import{dirname as J,resolve as
|
|
1
|
+
import{existsSync as k}from"fs";import{fileURLToPath as E}from"url";import{dirname as J,resolve as I}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",OPEN_DESIGN:"open_design",LINKEDIN:"linkedin"}),H=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"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin:{id:"linkedin",name:"LinkedIn",connectPath:"/integrations?provider=linkedin"}});function G(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let b=J(E(import.meta.url)),a=I(b,"..","bin","mcp-skill.mjs");return k(a)?a:null}async function u(b,a={}){let{token:t}=await q("github"),n=b.startsWith("https://")?b:`https://api.github.com${b}`,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 F={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
|
|
@@ -41,6 +41,6 @@ When user says "check out repo-name" or "clone repo-name":
|
|
|
41
41
|
3. STOP. Do not offer to inspect files or ask what to do next.
|
|
42
42
|
|
|
43
43
|
When user just wants to "look at" or "read" files (not clone):
|
|
44
|
-
- Use github_get_file to read individual files via API`,resolve(){let b=
|
|
44
|
+
- Use github_get_file to read individual files via API`,resolve(){let b=G();if(!b)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:[b,"../dist/github.js","githubSkill"],env:a,description:this.description,alwaysLoad:!0}},async handleToolCall(b,a){try{switch(b){case"github_search_issues":{let t=a.query;if(!t)return JSON.stringify({error:"query is required"});let n=await u(`/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 u(`/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 u(`/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 u(`/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 u(`/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 u(`/repos/${t}/${n}/pulls/${i}/comments?per_page=50`),r=await u(`/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,l)=>new Date(o.createdAt)-new Date(l.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 u(`/repos/${t}/${n}/pulls/comments/${e}`),s=r.in_reply_to_id||r.id,o=[];try{o=await u(`/repos/${t}/${n}/pulls/${i}/comments?per_page=100`)}catch{o=[r]}(!Array.isArray(o)||o.length===0)&&(o=[r]);let l=o.filter(d=>d.id===s||d.in_reply_to_id===s).sort((d,h)=>new Date(d.created_at)-new Date(h.created_at)),c=l.length?l:[r],p=c.find(d=>d.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(d=>({id:d.id,user:d.user?.login,body:(d.body||"").slice(0,4e3),createdAt:d.created_at,isRoot:d.id===s,url:d.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 u(`/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 u(`/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 l=Array.isArray(s)?s.filter(d=>d&&d.path&&d.body&&(d.line!=null||d.position!=null)).map(d=>{let h={path:d.path,body:String(d.body)};return d.line!=null?(h.line=Number(d.line),h.side=d.side==="LEFT"?"LEFT":"RIGHT"):h.position=Number(d.position),h}):[];if(o!=="APPROVE"&&!e&&l.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)),l.length>0&&(c.comments=l);let p=await u(`/repos/${t}/${n}/pulls/${i}/reviews`,{method:"POST",body:c});return JSON.stringify({ok:!0,id:p.id,state:p.state,event:o,commentsPosted:l.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 u(s);return JSON.stringify({total:o.length,commits:o.map(l=>({sha:l.sha?.slice(0,8),fullSha:l.sha,message:l.commit?.message?.slice(0,300),author:l.commit?.author?.name,date:l.commit?.author?.date,url:l.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 u(`/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 u(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"),l=o.length>2e4;return JSON.stringify({path:s.path,size:s.size,sha:s.sha?.slice(0,8),content:l?o.slice(0,2e4):o,truncated:l})}case"github_get_user":try{let t=await u("/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 u(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 u("/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:l}=await import("fs"),{homedir:c,platform:p}=await import("os"),{token:d}=await q("github"),h=c(),y=i?g(i):r(h,"zibby-repos"),f=r(y,n);if(l(y,{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:${d}@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(`
|
|
45
45
|
`).slice(0,30).join(`
|
|
46
46
|
`),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,l=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")}),d=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<l;){let O=`/installation/repositories?per_page=${o}&page=${m}`,v=(await u(O)).repositories||[];if(v.length===0)break;c=c.concat(v),w=v.length===o,m++}let R=c.map(p).filter(d),$=R.slice(0,l),T=R.length>$.length,N=$.filter(O=>O.private).length,A=$.filter(O=>!O.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 u(`/orgs/${t}`).then(()=>!0).catch(()=>!1),g=1,y=!0;for(;y&&c.length<l;){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 u(m),R=Array.isArray(w)?w:[];if(R.length===0)break;c=c.concat(R),y=R.length===o,g++}let f=c.map(p).filter(d),_=f.slice(0,l),S=f.length>_.length;return JSON.stringify({count:_.length,repos:_,truncated:S})}case"github_create_pr":{let{owner:t,repo:n,head:i,title:e}=a||{};if(!t||!n||!i||!e)return JSON.stringify({error:"owner, repo, head (source branch), and title are required"});let r=a.base;if(!r)try{r=(await u(`/repos/${t}/${n}`)).default_branch||"main"}catch{r="main"}let s={title:String(e),head:String(i),base:String(r),body:a.body?String(a.body):"",draft:!!a.draft};try{let o=await u(`/repos/${t}/${n}/pulls`,{method:"POST",body:s});return JSON.stringify({success:!0,pr_url:o.html_url,number:o.number,branch:i,base:r,repo:`${t}/${n}`,provider:"github",draft:!!o.draft,state:o.state})}catch(o){let l=String(o.message||o);if(/GitHub API 422/.test(l))return JSON.stringify({success:!1,branch:i,base:r,repo:`${t}/${n}`,provider:"github",skippedReason:l});throw o}}case"github_merge_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=a.mergeMethod||"squash";if(!["merge","squash","rebase"].includes(e))return JSON.stringify({error:`mergeMethod must be merge, squash, or rebase (got ${e})`});let r={merge_method:e};a.commitTitle&&(r.commit_title=String(a.commitTitle)),a.commitMessage&&(r.commit_message=String(a.commitMessage));try{let s=await u(`/repos/${t}/${n}/pulls/${i}/merge`,{method:"PUT",body:r});return JSON.stringify({success:!0,merged:!0,sha:s.sha,number:i,provider:"github"})}catch(s){let o=String(s.message||s);if(/GitHub API (405|409|404)/.test(o))return JSON.stringify({success:!1,number:i,provider:"github",skippedReason:o});throw 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 u(`/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:l,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",l||"desc"),e&&p.set("labels",Array.isArray(e)?e.join(","):e),r&&p.set("since",r),s&&p.set("assignee",s);let d=await u(`/repos/${t}/${n}/issues?${p.toString()}`),h=(Array.isArray(d)?d:[]).filter(g=>!g.pull_request).map(g=>({number:g.number,title:g.title,state:g.state,labels:(g.labels||[]).map(y=>typeof y=="string"?y:y.name),assignee:g.assignee?.login||null,assignees:(g.assignees||[]).map(y=>y.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 u(`/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 u(`/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 u(`/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 u(`/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 u(`/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 u(`/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 u(`/repos/${t}/${n}/issues/${i}/labels/${encodeURIComponent(p)}`,{method:"DELETE"});let c=await u(`/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 l=await u(`/repos/${t}/${n}/issues/${i}/labels`,{method:"POST",body:{labels:s}});return JSON.stringify({ok:!0,number:i,labels:(Array.isArray(l)?l:[]).map(c=>typeof c=="string"?c:c.name)})}default:return JSON.stringify({error:`Unknown tool: ${b}`})}}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_pr",description:"Open a pull request on GitHub (POST /repos/{owner}/{repo}/pulls). The head (source) branch must already be pushed. Returns the REAL pr_url from GitHub \u2014 never fabricate a PR url. Expected business outcomes (no commits between base and head, a PR already exists for this branch, base==head, missing head) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},head:{type:"string",description:'Source branch to merge FROM (must already be pushed). For a cross-fork PR use "fork-owner:branch".'},base:{type:"string",description:"Target branch to merge INTO (default: the repo's default branch)"},title:{type:"string",description:"PR title"},body:{type:"string",description:"PR description (markdown)"},draft:{type:"boolean",description:"Open as a draft PR (default: false)"}},required:["owner","repo","head","title"]}},{name:"github_merge_pr",description:"Merge a pull request on GitHub (PUT /repos/{owner}/{repo}/pulls/{number}/merge). mergeMethod is merge | squash | rebase (default squash). Returns { success:true, merged:true, sha } with the REAL merge SHA from GitHub. Expected non-mergeable outcomes (405 = draft / failing checks / branch protection, 409 = head sha moved / conflict, 404 = not found) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number to merge"},mergeMethod:{type:"string",enum:["merge","squash","rebase"],description:"How to merge (default: squash)"},commitTitle:{type:"string",description:"Title for the merge/squash commit (optional)"},commitMessage:{type:"string",description:"Body for the merge/squash commit (optional)"}},required:["owner","repo","number"]}},{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{F as githubSkill};
|