@zibby/skills 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/browser.d.ts +19 -0
- package/dist/chat-memory.d.ts +355 -0
- package/dist/chat-notify.d.ts +409 -0
- package/dist/core-tools.d.ts +131 -0
- package/dist/function-skill.d.ts +149 -0
- package/dist/git.d.ts +72 -0
- package/dist/github.d.ts +777 -0
- package/dist/github.js +4 -3
- package/dist/gitlab.d.ts +396 -0
- package/dist/gitlab.js +19 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +145 -126
- package/dist/integrations.d.ts +110 -0
- package/dist/jira.d.ts +547 -0
- package/dist/lark.d.ts +161 -0
- package/dist/linear.d.ts +344 -0
- package/dist/llm-billing.d.ts +294 -0
- package/dist/memory.d.ts +137 -0
- package/dist/package.json +67 -17
- package/dist/plane.d.ts +24 -0
- package/dist/report.d.ts +354 -0
- package/dist/report.js +9 -9
- package/dist/sentry.d.ts +43 -0
- package/dist/skill-installer.d.ts +86 -0
- package/dist/slack.d.ts +284 -0
- package/dist/test-runner.d.ts +220 -0
- package/dist/trackers/github-adapter.d.ts +96 -0
- package/dist/trackers/github-adapter.js +4 -3
- package/dist/trackers/index.d.ts +27 -0
- package/dist/trackers/index.js +16 -15
- package/dist/trackers/jira-adapter.d.ts +90 -0
- package/dist/trackers/linear-adapter.d.ts +89 -0
- package/dist/trackers/plane-adapter.d.ts +101 -0
- package/dist/trackers/types.d.ts +335 -0
- package/dist/workflow-builder.d.ts +245 -0
- package/docs/apps/agent-ops.md +6 -6
- package/docs/apps/deploy.md +1 -1
- package/docs/apps/index.md +1 -1
- package/docs/apps/managing.md +1 -1
- package/docs/cli-reference.md +65 -65
- package/docs/cloning-repositories.md +9 -9
- package/docs/cloud/bundles.md +8 -8
- package/docs/cloud/dedicated-egress.md +6 -6
- package/docs/cloud/env-vars.md +29 -29
- package/docs/cloud/limits.md +11 -11
- package/docs/cloud/triggering.md +16 -16
- package/docs/concepts/agents.md +4 -4
- package/docs/concepts/sessions.md +7 -7
- package/docs/concepts/state.md +1 -1
- package/docs/concepts/sub-graphs.md +9 -9
- package/docs/get-started/deploy.md +14 -14
- package/docs/get-started/install.md +4 -4
- package/docs/get-started/run-locally.md +12 -12
- package/docs/get-started/trigger-and-logs.md +14 -14
- package/docs/get-started/use-from-agents.md +17 -17
- package/docs/get-started/your-first-workflow.md +8 -8
- package/docs/integrations/gitlab.md +1 -1
- package/docs/integrations/lark.md +2 -2
- package/docs/integrations/linear.md +1 -1
- package/docs/integrations/notion.md +2 -2
- package/docs/integrations/plane.md +1 -1
- package/docs/integrations/slack.md +1 -1
- package/docs/intro.md +4 -4
- package/docs/legacy/test-automation.md +2 -2
- package/docs/packages/cli.md +11 -11
- package/docs/packages/core.md +2 -2
- package/docs/packages/mcp-cli.md +18 -18
- package/docs/packages/skills.md +2 -2
- package/docs/packages/ui-memory.md +1 -1
- package/docs/recipes/bug-autofix.md +1 -1
- package/docs/recipes/index.md +3 -3
- package/docs/recipes/pipeline-supervisor.md +4 -4
- package/docs/recipes/sentry-triage.md +7 -7
- package/docs/recipes/test.md +6 -6
- package/docs/skills/browser.md +2 -2
- package/docs/skills/chat-memory.md +1 -1
- package/docs/skills/core-tools.md +1 -1
- package/docs/skills/function-skill.md +1 -1
- package/docs/skills/github.md +2 -2
- package/docs/skills/index.md +1 -1
- package/docs/skills/jira.md +1 -1
- package/docs/skills/lark.md +1 -1
- package/docs/skills/memory.md +2 -2
- package/docs/skills/sentry.md +1 -1
- package/docs/skills/slack.md +2 -2
- package/package.json +67 -17
package/dist/github.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{resolveIntegrationToken as
|
|
1
|
+
import{resolveIntegrationToken as $}from"@zibby/core/backend-client.js";var R=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"}),N=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"}});async function l(f,a={}){let{token:t}=await $("github"),i=f.startsWith("https://")?f:`https://api.github.com${f}`,r={Authorization:`Bearer ${t}`,Accept:a.accept||"application/vnd.github.v3+json","User-Agent":"Zibby-App",...a.body?{"Content-Type":"application/json"}:{}},e=await fetch(i,{method:a.method||"GET",headers:r,body:a.body?JSON.stringify(a.body):void 0});if(!e.ok){let s=await e.text().catch(()=>"");throw new Error(`GitHub API ${e.status}: ${s.slice(0,300)}`)}return a.raw?e.text():e.json()}var P={id:"github",serverName:"github",allowedTools:["mcp__github__*"],requiresIntegration:R.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
|
|
@@ -20,6 +20,7 @@ You have access to the user's GitHub repositories. Available tools:
|
|
|
20
20
|
- github_get_pr_diff: Get PR diff
|
|
21
21
|
- github_list_pr_files: List PR changed files
|
|
22
22
|
- github_list_pr_comments: Get PR comments
|
|
23
|
+
- github_create_review: Post a review on a PR \u2014 a summary body plus optional inline comments on specific file/line positions, with an event (COMMENT, APPROVE, or REQUEST_CHANGES)
|
|
23
24
|
- github_create_issue: Create new issue
|
|
24
25
|
- github_list_issues: List issues in a repo (filter by state/labels/since cursor) \u2014 excludes PRs
|
|
25
26
|
- github_get_issue: Get a single issue's full detail (title, body, state, labels, assignee, url)
|
|
@@ -35,6 +36,6 @@ When user says "check out repo-name" or "clone repo-name":
|
|
|
35
36
|
3. STOP. Do not offer to inspect files or ask what to do next.
|
|
36
37
|
|
|
37
38
|
When user just wants to "look at" or "read" files (not clone):
|
|
38
|
-
- Use github_get_file to read individual files via API`,resolve(){let
|
|
39
|
+
- Use github_get_file to read individual files via API`,resolve(){let f={};for(let a of this.envKeys)process.env[a]&&(f[a]=process.env[a]);return{command:"npx",args:["-y","@modelcontextprotocol/server-github@latest"],env:f}},async handleToolCall(f,a){try{switch(f){case"github_search_issues":{let t=a.query;if(!t)return JSON.stringify({error:"query is required"});let i=await l(`/search/issues?q=${encodeURIComponent(t)}&per_page=${a.limit||20}`),r=(i.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(s=>s.name),createdAt:e.created_at}));return JSON.stringify({total:i.total_count,items:r})}case"github_search_code":{let t=a.query;if(!t)return JSON.stringify({error:"query is required"});let i=a.repo?`+repo:${a.repo}`:"",r=a.language?`+language:${a.language}`:"",e=await l(`/search/code?q=${encodeURIComponent(t)}${i}${r}&per_page=${a.limit||15}`),s=(e.items||[]).map(n=>({name:n.name,path:n.path,repo:n.repository?.full_name,url:n.html_url,score:n.score}));return JSON.stringify({total:e.total_count,items:s})}case"github_get_pr":{let{owner:t,repo:i,number:r}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/pulls/${r}`);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,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(s=>s.name)})}case"github_get_pr_diff":{let{owner:t,repo:i,number:r}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/pulls/${r}`,{accept:"application/vnd.github.v3.diff",raw:!0}),s=e.length>15e3;return JSON.stringify({number:r,diff:s?e.slice(0,15e3):e,truncated:s,totalLength:e.length})}case"github_list_pr_files":{let{owner:t,repo:i,number:r}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/pulls/${r}/files?per_page=100`);return JSON.stringify({total:e.length,files:e.map(s=>({filename:s.filename,status:s.status,additions:s.additions,deletions:s.deletions,patch:s.patch?.slice(0,3e3)}))})}case"github_list_pr_comments":{let{owner:t,repo:i,number:r}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/pulls/${r}/comments?per_page=50`),s=await l(`/repos/${t}/${i}/issues/${r}/comments?per_page=50`),n=[...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})),...s.map(o=>({type:"issue",user:o.user?.login,body:o.body?.slice(0,1e3),createdAt:o.created_at}))].sort((o,p)=>new Date(o.createdAt)-new Date(p.createdAt));return JSON.stringify({total:n.length,comments:n})}case"github_create_review":{let{owner:t,repo:i,number:r,body:e,event:s,comments:n}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let o=(s||"COMMENT").toUpperCase();if(!["COMMENT","APPROVE","REQUEST_CHANGES"].includes(o))return JSON.stringify({error:`event must be COMMENT, APPROVE, or REQUEST_CHANGES (got ${s})`});let p=Array.isArray(n)?n.filter(m=>m&&m.path&&m.body&&(m.line!=null||m.position!=null)).map(m=>{let y={path:m.path,body:String(m.body)};return m.line!=null?(y.line=Number(m.line),y.side=m.side==="LEFT"?"LEFT":"RIGHT"):y.position=Number(m.position),y}):[];if(o!=="APPROVE"&&!e&&p.length===0)return JSON.stringify({error:"a COMMENT or REQUEST_CHANGES review needs a body and/or inline comments"});let d={event:o};e&&(d.body=String(e)),p.length>0&&(d.comments=p);let c=await l(`/repos/${t}/${i}/pulls/${r}/reviews`,{method:"POST",body:d});return JSON.stringify({ok:!0,id:c.id,state:c.state,event:o,commentsPosted:p.length,url:c.html_url})}case"github_list_commits":{let{owner:t,repo:i,branch:r,path:e,limit:s}=a;if(!t||!i)return JSON.stringify({error:"owner and repo are required"});let n=`/repos/${t}/${i}/commits?per_page=${s||20}`;r&&(n+=`&sha=${encodeURIComponent(r)}`),e&&(n+=`&path=${encodeURIComponent(e)}`);let o=await l(n);return JSON.stringify({total:o.length,commits:o.map(p=>({sha:p.sha?.slice(0,8),fullSha:p.sha,message:p.commit?.message?.slice(0,300),author:p.commit?.author?.name,date:p.commit?.author?.date,url:p.html_url}))})}case"github_get_commit":{let{owner:t,repo:i,sha:r}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and sha are required"});let e=await l(`/repos/${t}/${i}/commits/${r}`);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(s=>({filename:s.filename,status:s.status,additions:s.additions,deletions:s.deletions,patch:s.patch?.slice(0,3e3)}))})}case"github_get_file":{let{owner:t,repo:i,path:r,ref:e}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and path are required"});let s=`/repos/${t}/${i}/contents/${encodeURIComponent(r)}`;e&&(s+=`?ref=${encodeURIComponent(e)}`);let n=await l(s);if(n.type!=="file")return Array.isArray(n)?JSON.stringify({type:"directory",path:r,entries:n.map(d=>({name:d.name,type:d.type,size:d.size,path:d.path}))}):JSON.stringify({error:`Not a file: ${n.type}`});let o=Buffer.from(n.content||"","base64").toString("utf-8"),p=o.length>2e4;return JSON.stringify({path:n.path,size:n.size,sha:n.sha?.slice(0,8),content:p?o.slice(0,2e4):o,truncated:p})}case"github_get_user":try{let t=await l("/installation/repositories?per_page=1");if(t.repositories&&t.repositories.length>0){let i=t.repositories[0],r=i.owner.login,e=i.owner.type,s=e==="Organization"?`/orgs/${r}`:`/users/${r}`,n=await l(s);return JSON.stringify({login:n.login,name:n.name||n.login,avatar:n.avatar_url,bio:n.bio||n.description,type:e,isOrg:e==="Organization",publicRepos:n.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 i=(await l("/installation/repositories?per_page=100")).repositories||[],r=new Map;for(let s of i)s.owner.type==="Organization"&&(r.has(s.owner.login)||r.set(s.owner.login,{login:s.owner.login,description:null,url:s.owner.url}));let e=Array.from(r.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 u=function(_){let w=_.replace(/^~(?=$|\/|\\)/,y);return n(w)},{owner:t,repo:i,destination:r}=a;if(!t||!i)return JSON.stringify({error:"owner and repo are required"});let{execSync:e}=await import("child_process"),{join:s,resolve:n}=await import("path"),{existsSync:o,mkdirSync:p}=await import("fs"),{homedir:d,platform:c}=await import("os"),{token:m}=await $("github"),y=d(),b=r?u(r):s(y,"zibby-repos"),h=s(b,i);if(p(b,{recursive:!0}),o(h))return JSON.stringify({error:`Directory ${h} already exists. Remove it first or use a different destination.`,existingPath:h});try{let _=`https://x-access-token:${m}@github.com/${t}/${i}.git`;e(`git clone ${_} "${h}"`,{stdio:"pipe"});let w=c()==="win32",g;return w?g=e(`dir "${h}"`,{encoding:"utf-8",shell:"cmd.exe"}):g=e(`ls -la "${h}"`,{encoding:"utf-8"}),JSON.stringify({success:!0,path:h,message:`Cloned ${t}/${i} to ${h}`,contents:g.split(`
|
|
39
40
|
`).slice(0,30).join(`
|
|
40
|
-
`),instructions:"IMPORTANT: Show the contents field to the user - it contains the directory listing."})}catch(f){return JSON.stringify({error:`Clone failed: ${f.message}`})}}case"github_search_repos":{let{query:t,limit:i}=a;if(!t)return JSON.stringify({error:"query is required"});let r=await this.handleToolCall("github_list_repos",{limit:200},{}),e=JSON.parse(r);if(e.error)return JSON.stringify(e);let s=t.toLowerCase(),n=e.repos.filter(o=>o.name.toLowerCase().includes(s)||o.fullName.toLowerCase().includes(s)||o.description&&o.description.toLowerCase().includes(s));return JSON.stringify({query:t,count:n.length,repos:n.slice(0,i||20)})}case"github_list_repos":{let{owner:t,type:i,sort:r,direction:e,limit:s}=a,n=100,o=s||200,u=[];if(!t){let p=1,h=!0;for(;h&&u.length<o;){let m=`/installation/repositories?per_page=${n}&page=${p}`,$=(await c(m)).repositories||[];if($.length===0)break;u=u.concat($),h=$.length===n,p++}let g=u.slice(0,o).map(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})),f=g.filter(m=>m.private).length,w=g.filter(m=>!m.private).length;return JSON.stringify({count:g.length,repos:g,privateCount:f,publicCount:w,message:`Found ${f} private and ${w} public repos`})}let d=await c(`/orgs/${t}`).then(()=>!0).catch(()=>!1),l=1,_=!0;for(;_&&u.length<o;){let p;d?p=`/orgs/${t}/repos?per_page=${n}&page=${l}&type=${i||"all"}&sort=${r||"updated"}&direction=${e||"desc"}`:p=`/users/${t}/repos?per_page=${n}&page=${l}&type=${i||"all"}&sort=${r||"updated"}&direction=${e||"desc"}`;let h=await c(p),g=Array.isArray(h)?h:[];if(g.length===0)break;u=u.concat(g),_=g.length===n,l++}let y=u.slice(0,o).map(p=>({name:p.name,fullName:p.full_name,private:p.private,description:p.description,language:p.language,defaultBranch:p.default_branch,updatedAt:p.updated_at,stars:p.stargazers_count,url:p.html_url}));return JSON.stringify({count:y.length,repos:y})}case"github_create_issue":{let{owner:t,repo:i,title:r,body:e}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and title are required"});let s=await c(`/repos/${t}/${i}/issues`,{method:"POST",body:{title:r,body:e||""}});return JSON.stringify({number:s.number,url:s.html_url,title:s.title})}case"github_list_issues":{let{owner:t,repo:i,state:r,labels:e,since:s,assignee:n,sort:o,direction:u,limit:d}=a||{};if(!t||!i)return JSON.stringify({error:"owner and repo are required"});let l=new URLSearchParams;l.set("state",r||"open"),l.set("per_page",String(d||30)),l.set("sort",o||"updated"),l.set("direction",u||"desc"),e&&l.set("labels",Array.isArray(e)?e.join(","):e),s&&l.set("since",s),n&&l.set("assignee",n);let _=await c(`/repos/${t}/${i}/issues?${l.toString()}`),y=(Array.isArray(_)?_:[]).filter(p=>!p.pull_request).map(p=>({number:p.number,title:p.title,state:p.state,labels:(p.labels||[]).map(h=>typeof h=="string"?h:h.name),assignee:p.assignee?.login||null,assignees:(p.assignees||[]).map(h=>h.login),user:p.user?.login,comments:p.comments,url:p.html_url,createdAt:p.created_at,updatedAt:p.updated_at}));return JSON.stringify({count:y.length,issues:y})}case"github_get_issue":{let{owner:t,repo:i,number:r}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await c(`/repos/${t}/${i}/issues/${r}`);return e.pull_request?JSON.stringify({error:`#${r} 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(s=>typeof s=="string"?s:s.name),assignee:e.assignee?.login||null,assignees:(e.assignees||[]).map(s=>s.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:i,number:r,limit:e}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let s=await c(`/repos/${t}/${i}/issues/${r}/comments?per_page=${e||100}`),n=(Array.isArray(s)?s:[]).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:n.length,comments:n})}case"github_add_issue_comment":{let{owner:t,repo:i,number:r,body:e}=a||{};if(!t||!i||!r||!e)return JSON.stringify({error:"owner, repo, number, and body are required"});let s=await c(`/repos/${t}/${i}/issues/${r}/comments`,{method:"POST",body:{body:e}});return JSON.stringify({ok:!0,id:s.id,url:s.html_url})}case"github_close_issue":{let{owner:t,repo:i,number:r,stateReason:e}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let s={state:"closed"};e&&(s.state_reason=e);let n=await c(`/repos/${t}/${i}/issues/${r}`,{method:"PATCH",body:s});return JSON.stringify({ok:!0,number:n.number,state:n.state,stateReason:n.state_reason||null,url:n.html_url})}case"github_reopen_issue":{let{owner:t,repo:i,number:r}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await c(`/repos/${t}/${i}/issues/${r}`,{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:i,number:r,labels:e,mode:s}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let n=Array.isArray(e)?e:e?[e]:[];if(!n.length)return JSON.stringify({error:"labels (string or array) is required"});let o=s||"add";if(o==="set"){let d=await c(`/repos/${t}/${i}/issues/${r}`,{method:"PATCH",body:{labels:n}});return JSON.stringify({ok:!0,number:d.number,labels:(d.labels||[]).map(l=>typeof l=="string"?l:l.name)})}if(o==="remove"){for(let l of n)await c(`/repos/${t}/${i}/issues/${r}/labels/${encodeURIComponent(l)}`,{method:"DELETE"});let d=await c(`/repos/${t}/${i}/issues/${r}`);return JSON.stringify({ok:!0,number:d.number,labels:(d.labels||[]).map(l=>typeof l=="string"?l:l.name)})}let u=await c(`/repos/${t}/${i}/issues/${r}/labels`,{method:"POST",body:{labels:n}});return JSON.stringify({ok:!0,number:r,labels:(Array.isArray(u)?u:[]).map(d=>typeof d=="string"?d:d.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 repositories for a user or org. If no owner given, lists the authenticated user's repos.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Org or user login. Omit to list your own repos."},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: 30)"}}}},{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_list_commits",description:"List recent commits on a branch, optionally filtered by file path",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},branch:{type:"string",description:"Branch name (default: repo default branch)"},path:{type:"string",description:"Filter commits touching this file path"},limit:{type:"number",description:"Max commits (default: 20)"}},required:["owner","repo"]}},{name:"github_get_commit",description:"Get details of a specific commit \u2014 message, stats, file diffs",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},sha:{type:"string",description:"Commit SHA (full or short)"}},required:["owner","repo","sha"]}},{name:"github_get_file",description:"Read a file (or list a directory) from a GitHub repo. Works on any branch/ref.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},path:{type:"string",description:'File or directory path (e.g. "src/auth/login.ts")'},ref:{type:"string",description:"Branch, tag, or commit SHA (default: repo default branch)"}},required:["owner","repo","path"]}},{name:"github_create_issue",description:"Create a GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},title:{type:"string",description:"Issue title"},body:{type:"string",description:"Issue body (markdown)"}},required:["owner","repo","title"]}},{name:"github_list_issues",description:"List issues in a repo (excludes pull requests). Filter by state, labels, and an updated-since cursor for polling.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},state:{type:"string",enum:["open","closed","all"],description:"Filter by state (default: open)"},labels:{type:"array",items:{type:"string"},description:"Only issues carrying ALL of these labels"},since:{type:"string",description:"ISO-8601 timestamp; only issues updated at/after this (polling cursor)"},assignee:{type:"string",description:'Filter by assignee login, "none", or "*"'},sort:{type:"string",enum:["created","updated","comments"],description:"Sort field (default: updated)"},direction:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max issues (default: 30, max 100 per page)"}},required:["owner","repo"]}},{name:"github_get_issue",description:"Get a single GitHub issue with full detail (title, body, state, labels, assignee, url)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_get_issue_comments",description:"Get the comment thread on a GitHub issue (chronological)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},limit:{type:"number",description:"Max comments (default: 100)"}},required:["owner","repo","number"]}},{name:"github_add_issue_comment",description:"Add a comment to a GitHub issue. Also the way to record a PR link on an issue (post a markdown link).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},body:{type:"string",description:"Comment body (markdown)"}},required:["owner","repo","number","body"]}},{name:"github_close_issue",description:"Close a GitHub issue. Optionally set the close reason (completed or not_planned).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},stateReason:{type:"string",enum:["completed","not_planned"],description:"Why the issue was closed (optional)"}},required:["owner","repo","number"]}},{name:"github_reopen_issue",description:"Reopen a closed GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_label_issue",description:"Add, set (replace all), or remove labels on a GitHub issue. Labels back state-like transitions on GitHub.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},labels:{type:"array",items:{type:"string"},description:"Label name(s)"},mode:{type:"string",enum:["add","set","remove"],description:"add appends, set replaces all, remove deletes (default: add)"}},required:["owner","repo","number","labels"]}}]};export{J as githubSkill};
|
|
41
|
+
`),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:i}=a;if(!t)return JSON.stringify({error:"query is required"});let r=await this.handleToolCall("github_list_repos",{limit:200},{}),e=JSON.parse(r);if(e.error)return JSON.stringify(e);let s=t.toLowerCase(),n=e.repos.filter(o=>o.name.toLowerCase().includes(s)||o.fullName.toLowerCase().includes(s)||o.description&&o.description.toLowerCase().includes(s));return JSON.stringify({query:t,count:n.length,repos:n.slice(0,i||20)})}case"github_list_repos":{let{owner:t,type:i,sort:r,direction:e,limit:s}=a,n=100,o=s||200,p=[];if(!t){let u=1,b=!0;for(;b&&p.length<o;){let g=`/installation/repositories?per_page=${n}&page=${u}`,S=(await l(g)).repositories||[];if(S.length===0)break;p=p.concat(S),b=S.length===n,u++}let h=p.slice(0,o).map(g=>({name:g.name,fullName:g.full_name,private:g.private,description:g.description,language:g.language,defaultBranch:g.default_branch,updatedAt:g.updated_at,stars:g.stargazers_count,url:g.html_url})),_=h.filter(g=>g.private).length,w=h.filter(g=>!g.private).length;return JSON.stringify({count:h.length,repos:h,privateCount:_,publicCount:w,message:`Found ${_} private and ${w} public repos`})}let d=await l(`/orgs/${t}`).then(()=>!0).catch(()=>!1),c=1,m=!0;for(;m&&p.length<o;){let u;d?u=`/orgs/${t}/repos?per_page=${n}&page=${c}&type=${i||"all"}&sort=${r||"updated"}&direction=${e||"desc"}`:u=`/users/${t}/repos?per_page=${n}&page=${c}&type=${i||"all"}&sort=${r||"updated"}&direction=${e||"desc"}`;let b=await l(u),h=Array.isArray(b)?b:[];if(h.length===0)break;p=p.concat(h),m=h.length===n,c++}let y=p.slice(0,o).map(u=>({name:u.name,fullName:u.full_name,private:u.private,description:u.description,language:u.language,defaultBranch:u.default_branch,updatedAt:u.updated_at,stars:u.stargazers_count,url:u.html_url}));return JSON.stringify({count:y.length,repos:y})}case"github_create_issue":{let{owner:t,repo:i,title:r,body:e}=a;if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and title are required"});let s=await l(`/repos/${t}/${i}/issues`,{method:"POST",body:{title:r,body:e||""}});return JSON.stringify({number:s.number,url:s.html_url,title:s.title})}case"github_list_issues":{let{owner:t,repo:i,state:r,labels:e,since:s,assignee:n,sort:o,direction:p,limit:d}=a||{};if(!t||!i)return JSON.stringify({error:"owner and repo are required"});let c=new URLSearchParams;c.set("state",r||"open"),c.set("per_page",String(d||30)),c.set("sort",o||"updated"),c.set("direction",p||"desc"),e&&c.set("labels",Array.isArray(e)?e.join(","):e),s&&c.set("since",s),n&&c.set("assignee",n);let m=await l(`/repos/${t}/${i}/issues?${c.toString()}`),y=(Array.isArray(m)?m:[]).filter(u=>!u.pull_request).map(u=>({number:u.number,title:u.title,state:u.state,labels:(u.labels||[]).map(b=>typeof b=="string"?b:b.name),assignee:u.assignee?.login||null,assignees:(u.assignees||[]).map(b=>b.login),user:u.user?.login,comments:u.comments,url:u.html_url,createdAt:u.created_at,updatedAt:u.updated_at}));return JSON.stringify({count:y.length,issues:y})}case"github_get_issue":{let{owner:t,repo:i,number:r}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/issues/${r}`);return e.pull_request?JSON.stringify({error:`#${r} 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(s=>typeof s=="string"?s:s.name),assignee:e.assignee?.login||null,assignees:(e.assignees||[]).map(s=>s.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:i,number:r,limit:e}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let s=await l(`/repos/${t}/${i}/issues/${r}/comments?per_page=${e||100}`),n=(Array.isArray(s)?s:[]).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:n.length,comments:n})}case"github_add_issue_comment":{let{owner:t,repo:i,number:r,body:e}=a||{};if(!t||!i||!r||!e)return JSON.stringify({error:"owner, repo, number, and body are required"});let s=await l(`/repos/${t}/${i}/issues/${r}/comments`,{method:"POST",body:{body:e}});return JSON.stringify({ok:!0,id:s.id,url:s.html_url})}case"github_close_issue":{let{owner:t,repo:i,number:r,stateReason:e}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let s={state:"closed"};e&&(s.state_reason=e);let n=await l(`/repos/${t}/${i}/issues/${r}`,{method:"PATCH",body:s});return JSON.stringify({ok:!0,number:n.number,state:n.state,stateReason:n.state_reason||null,url:n.html_url})}case"github_reopen_issue":{let{owner:t,repo:i,number:r}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let e=await l(`/repos/${t}/${i}/issues/${r}`,{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:i,number:r,labels:e,mode:s}=a||{};if(!t||!i||!r)return JSON.stringify({error:"owner, repo, and number are required"});let n=Array.isArray(e)?e:e?[e]:[];if(!n.length)return JSON.stringify({error:"labels (string or array) is required"});let o=s||"add";if(o==="set"){let d=await l(`/repos/${t}/${i}/issues/${r}`,{method:"PATCH",body:{labels:n}});return JSON.stringify({ok:!0,number:d.number,labels:(d.labels||[]).map(c=>typeof c=="string"?c:c.name)})}if(o==="remove"){for(let c of n)await l(`/repos/${t}/${i}/issues/${r}/labels/${encodeURIComponent(c)}`,{method:"DELETE"});let d=await l(`/repos/${t}/${i}/issues/${r}`);return JSON.stringify({ok:!0,number:d.number,labels:(d.labels||[]).map(c=>typeof c=="string"?c:c.name)})}let p=await l(`/repos/${t}/${i}/issues/${r}/labels`,{method:"POST",body:{labels:n}});return JSON.stringify({ok:!0,number:r,labels:(Array.isArray(p)?p:[]).map(d=>typeof d=="string"?d:d.name)})}default:return JSON.stringify({error:`Unknown tool: ${f}`})}}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 repositories for a user or org. If no owner given, lists the authenticated user's repos.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Org or user login. Omit to list your own repos."},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: 30)"}}}},{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_create_review",description:"Post a review on a pull request: a summary body plus optional inline comments anchored to file/line, with an event (COMMENT, APPROVE, or REQUEST_CHANGES). Use this to deliver a code review back to the PR.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"PR number"},body:{type:"string",description:"The review summary (markdown). Shown as the top-level review comment."},event:{type:"string",enum:["COMMENT","APPROVE","REQUEST_CHANGES"],description:"Review verdict. Default COMMENT (no approval state). Use REQUEST_CHANGES for blocking issues."},comments:{type:"array",description:"Optional inline comments, each anchored to a changed line.",items:{type:"object",properties:{path:{type:"string",description:"File path as it appears in the diff"},line:{type:"number",description:"Line number in the file's NEW version (the right side of the diff)"},side:{type:"string",enum:["LEFT","RIGHT"],description:"RIGHT (new) or LEFT (old). Default RIGHT."},body:{type:"string",description:"The inline comment text (markdown)"}},required:["path","line","body"]}}},required:["owner","repo","number"]}},{name:"github_list_commits",description:"List recent commits on a branch, optionally filtered by file path",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},branch:{type:"string",description:"Branch name (default: repo default branch)"},path:{type:"string",description:"Filter commits touching this file path"},limit:{type:"number",description:"Max commits (default: 20)"}},required:["owner","repo"]}},{name:"github_get_commit",description:"Get details of a specific commit \u2014 message, stats, file diffs",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},sha:{type:"string",description:"Commit SHA (full or short)"}},required:["owner","repo","sha"]}},{name:"github_get_file",description:"Read a file (or list a directory) from a GitHub repo. Works on any branch/ref.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},path:{type:"string",description:'File or directory path (e.g. "src/auth/login.ts")'},ref:{type:"string",description:"Branch, tag, or commit SHA (default: repo default branch)"}},required:["owner","repo","path"]}},{name:"github_create_issue",description:"Create a GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},title:{type:"string",description:"Issue title"},body:{type:"string",description:"Issue body (markdown)"}},required:["owner","repo","title"]}},{name:"github_list_issues",description:"List issues in a repo (excludes pull requests). Filter by state, labels, and an updated-since cursor for polling.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},state:{type:"string",enum:["open","closed","all"],description:"Filter by state (default: open)"},labels:{type:"array",items:{type:"string"},description:"Only issues carrying ALL of these labels"},since:{type:"string",description:"ISO-8601 timestamp; only issues updated at/after this (polling cursor)"},assignee:{type:"string",description:'Filter by assignee login, "none", or "*"'},sort:{type:"string",enum:["created","updated","comments"],description:"Sort field (default: updated)"},direction:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max issues (default: 30, max 100 per page)"}},required:["owner","repo"]}},{name:"github_get_issue",description:"Get a single GitHub issue with full detail (title, body, state, labels, assignee, url)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_get_issue_comments",description:"Get the comment thread on a GitHub issue (chronological)",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},limit:{type:"number",description:"Max comments (default: 100)"}},required:["owner","repo","number"]}},{name:"github_add_issue_comment",description:"Add a comment to a GitHub issue. Also the way to record a PR link on an issue (post a markdown link).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},body:{type:"string",description:"Comment body (markdown)"}},required:["owner","repo","number","body"]}},{name:"github_close_issue",description:"Close a GitHub issue. Optionally set the close reason (completed or not_planned).",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},stateReason:{type:"string",enum:["completed","not_planned"],description:"Why the issue was closed (optional)"}},required:["owner","repo","number"]}},{name:"github_reopen_issue",description:"Reopen a closed GitHub issue",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"}},required:["owner","repo","number"]}},{name:"github_label_issue",description:"Add, set (replace all), or remove labels on a GitHub issue. Labels back state-like transitions on GitHub.",input_schema:{type:"object",properties:{owner:{type:"string",description:"Repository owner"},repo:{type:"string",description:"Repository name"},number:{type:"number",description:"Issue number"},labels:{type:"array",items:{type:"string"},description:"Label name(s)"},mode:{type:"string",enum:["add","set","remove"],description:"add appends, set replaces all, remove deletes (default: add)"}},required:["owner","repo","number","labels"]}}]};export{P as githubSkill};
|
package/dist/gitlab.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Low-level GitLab REST helper. Throws on non-2xx, returns parsed JSON
|
|
3
|
+
* (or raw text when opts.raw). Exported so a future gitlabAdapter (neutral
|
|
4
|
+
* tracker layer) can reach endpoints the tools don't cover without
|
|
5
|
+
* re-implementing auth — keep this the single auth chokepoint.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} path API path beginning with `/` (relative to /api/v4),
|
|
8
|
+
* or a full https:// url.
|
|
9
|
+
* @param {{ method?: string, body?: object, raw?: boolean }} [opts]
|
|
10
|
+
*/
|
|
11
|
+
export function glFetch(path: string, opts?: {
|
|
12
|
+
method?: string;
|
|
13
|
+
body?: object;
|
|
14
|
+
raw?: boolean;
|
|
15
|
+
}): Promise<any>;
|
|
16
|
+
export namespace gitlabSkill {
|
|
17
|
+
let id: string;
|
|
18
|
+
let serverName: string;
|
|
19
|
+
let allowedTools: string[];
|
|
20
|
+
let requiresIntegration: "gitlab";
|
|
21
|
+
let envKeys: string[];
|
|
22
|
+
let description: string;
|
|
23
|
+
let promptFragment: string;
|
|
24
|
+
function resolve(): {
|
|
25
|
+
command: any;
|
|
26
|
+
args: any[];
|
|
27
|
+
env: {};
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
function handleToolCall(name: any, args: any): Promise<string>;
|
|
31
|
+
let tools: ({
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
input_schema: {
|
|
35
|
+
type: string;
|
|
36
|
+
properties: {
|
|
37
|
+
projectId: {
|
|
38
|
+
type: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
iid: {
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
state?: undefined;
|
|
46
|
+
targetBranch?: undefined;
|
|
47
|
+
sourceBranch?: undefined;
|
|
48
|
+
authorUsername?: undefined;
|
|
49
|
+
labels?: undefined;
|
|
50
|
+
search?: undefined;
|
|
51
|
+
orderBy?: undefined;
|
|
52
|
+
sort?: undefined;
|
|
53
|
+
limit?: undefined;
|
|
54
|
+
body?: undefined;
|
|
55
|
+
path?: undefined;
|
|
56
|
+
oldPath?: undefined;
|
|
57
|
+
newLine?: undefined;
|
|
58
|
+
oldLine?: undefined;
|
|
59
|
+
diffRefs?: undefined;
|
|
60
|
+
comments?: undefined;
|
|
61
|
+
assigneeUsername?: undefined;
|
|
62
|
+
updatedAfter?: undefined;
|
|
63
|
+
};
|
|
64
|
+
required: string[];
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
input_schema: {
|
|
70
|
+
type: string;
|
|
71
|
+
properties: {
|
|
72
|
+
projectId: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
state: {
|
|
77
|
+
type: string;
|
|
78
|
+
enum: string[];
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
targetBranch: {
|
|
82
|
+
type: string;
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
sourceBranch: {
|
|
86
|
+
type: string;
|
|
87
|
+
description: string;
|
|
88
|
+
};
|
|
89
|
+
authorUsername: {
|
|
90
|
+
type: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
labels: {
|
|
94
|
+
type: string;
|
|
95
|
+
items: {
|
|
96
|
+
type: string;
|
|
97
|
+
};
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
search: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
orderBy: {
|
|
105
|
+
type: string;
|
|
106
|
+
enum: string[];
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
sort: {
|
|
110
|
+
type: string;
|
|
111
|
+
enum: string[];
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
limit: {
|
|
115
|
+
type: string;
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
iid?: undefined;
|
|
119
|
+
body?: undefined;
|
|
120
|
+
path?: undefined;
|
|
121
|
+
oldPath?: undefined;
|
|
122
|
+
newLine?: undefined;
|
|
123
|
+
oldLine?: undefined;
|
|
124
|
+
diffRefs?: undefined;
|
|
125
|
+
comments?: undefined;
|
|
126
|
+
assigneeUsername?: undefined;
|
|
127
|
+
updatedAfter?: undefined;
|
|
128
|
+
};
|
|
129
|
+
required: string[];
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
input_schema: {
|
|
135
|
+
type: string;
|
|
136
|
+
properties: {
|
|
137
|
+
projectId: {
|
|
138
|
+
type: string;
|
|
139
|
+
description: string;
|
|
140
|
+
};
|
|
141
|
+
iid: {
|
|
142
|
+
type: string;
|
|
143
|
+
description: string;
|
|
144
|
+
};
|
|
145
|
+
limit: {
|
|
146
|
+
type: string;
|
|
147
|
+
description: string;
|
|
148
|
+
};
|
|
149
|
+
state?: undefined;
|
|
150
|
+
targetBranch?: undefined;
|
|
151
|
+
sourceBranch?: undefined;
|
|
152
|
+
authorUsername?: undefined;
|
|
153
|
+
labels?: undefined;
|
|
154
|
+
search?: undefined;
|
|
155
|
+
orderBy?: undefined;
|
|
156
|
+
sort?: undefined;
|
|
157
|
+
body?: undefined;
|
|
158
|
+
path?: undefined;
|
|
159
|
+
oldPath?: undefined;
|
|
160
|
+
newLine?: undefined;
|
|
161
|
+
oldLine?: undefined;
|
|
162
|
+
diffRefs?: undefined;
|
|
163
|
+
comments?: undefined;
|
|
164
|
+
assigneeUsername?: undefined;
|
|
165
|
+
updatedAfter?: undefined;
|
|
166
|
+
};
|
|
167
|
+
required: string[];
|
|
168
|
+
};
|
|
169
|
+
} | {
|
|
170
|
+
name: string;
|
|
171
|
+
description: string;
|
|
172
|
+
input_schema: {
|
|
173
|
+
type: string;
|
|
174
|
+
properties: {
|
|
175
|
+
projectId: {
|
|
176
|
+
type: string;
|
|
177
|
+
description: string;
|
|
178
|
+
};
|
|
179
|
+
iid: {
|
|
180
|
+
type: string;
|
|
181
|
+
description: string;
|
|
182
|
+
};
|
|
183
|
+
body: {
|
|
184
|
+
type: string;
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
state?: undefined;
|
|
188
|
+
targetBranch?: undefined;
|
|
189
|
+
sourceBranch?: undefined;
|
|
190
|
+
authorUsername?: undefined;
|
|
191
|
+
labels?: undefined;
|
|
192
|
+
search?: undefined;
|
|
193
|
+
orderBy?: undefined;
|
|
194
|
+
sort?: undefined;
|
|
195
|
+
limit?: undefined;
|
|
196
|
+
path?: undefined;
|
|
197
|
+
oldPath?: undefined;
|
|
198
|
+
newLine?: undefined;
|
|
199
|
+
oldLine?: undefined;
|
|
200
|
+
diffRefs?: undefined;
|
|
201
|
+
comments?: undefined;
|
|
202
|
+
assigneeUsername?: undefined;
|
|
203
|
+
updatedAfter?: undefined;
|
|
204
|
+
};
|
|
205
|
+
required: string[];
|
|
206
|
+
};
|
|
207
|
+
} | {
|
|
208
|
+
name: string;
|
|
209
|
+
description: string;
|
|
210
|
+
input_schema: {
|
|
211
|
+
type: string;
|
|
212
|
+
properties: {
|
|
213
|
+
projectId: {
|
|
214
|
+
type: string;
|
|
215
|
+
description: string;
|
|
216
|
+
};
|
|
217
|
+
iid: {
|
|
218
|
+
type: string;
|
|
219
|
+
description: string;
|
|
220
|
+
};
|
|
221
|
+
path: {
|
|
222
|
+
type: string;
|
|
223
|
+
description: string;
|
|
224
|
+
};
|
|
225
|
+
oldPath: {
|
|
226
|
+
type: string;
|
|
227
|
+
description: string;
|
|
228
|
+
};
|
|
229
|
+
newLine: {
|
|
230
|
+
type: string;
|
|
231
|
+
description: string;
|
|
232
|
+
};
|
|
233
|
+
oldLine: {
|
|
234
|
+
type: string;
|
|
235
|
+
description: string;
|
|
236
|
+
};
|
|
237
|
+
body: {
|
|
238
|
+
type: string;
|
|
239
|
+
description: string;
|
|
240
|
+
};
|
|
241
|
+
diffRefs: {
|
|
242
|
+
type: string;
|
|
243
|
+
description: string;
|
|
244
|
+
};
|
|
245
|
+
state?: undefined;
|
|
246
|
+
targetBranch?: undefined;
|
|
247
|
+
sourceBranch?: undefined;
|
|
248
|
+
authorUsername?: undefined;
|
|
249
|
+
labels?: undefined;
|
|
250
|
+
search?: undefined;
|
|
251
|
+
orderBy?: undefined;
|
|
252
|
+
sort?: undefined;
|
|
253
|
+
limit?: undefined;
|
|
254
|
+
comments?: undefined;
|
|
255
|
+
assigneeUsername?: undefined;
|
|
256
|
+
updatedAfter?: undefined;
|
|
257
|
+
};
|
|
258
|
+
required: string[];
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
261
|
+
name: string;
|
|
262
|
+
description: string;
|
|
263
|
+
input_schema: {
|
|
264
|
+
type: string;
|
|
265
|
+
properties: {
|
|
266
|
+
projectId: {
|
|
267
|
+
type: string;
|
|
268
|
+
description: string;
|
|
269
|
+
};
|
|
270
|
+
iid: {
|
|
271
|
+
type: string;
|
|
272
|
+
description: string;
|
|
273
|
+
};
|
|
274
|
+
body: {
|
|
275
|
+
type: string;
|
|
276
|
+
description: string;
|
|
277
|
+
};
|
|
278
|
+
diffRefs: {
|
|
279
|
+
type: string;
|
|
280
|
+
description: string;
|
|
281
|
+
};
|
|
282
|
+
comments: {
|
|
283
|
+
type: string;
|
|
284
|
+
description: string;
|
|
285
|
+
items: {
|
|
286
|
+
type: string;
|
|
287
|
+
properties: {
|
|
288
|
+
path: {
|
|
289
|
+
type: string;
|
|
290
|
+
description: string;
|
|
291
|
+
};
|
|
292
|
+
oldPath: {
|
|
293
|
+
type: string;
|
|
294
|
+
description: string;
|
|
295
|
+
};
|
|
296
|
+
newLine: {
|
|
297
|
+
type: string;
|
|
298
|
+
description: string;
|
|
299
|
+
};
|
|
300
|
+
oldLine: {
|
|
301
|
+
type: string;
|
|
302
|
+
description: string;
|
|
303
|
+
};
|
|
304
|
+
body: {
|
|
305
|
+
type: string;
|
|
306
|
+
description: string;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
required: string[];
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
state?: undefined;
|
|
313
|
+
targetBranch?: undefined;
|
|
314
|
+
sourceBranch?: undefined;
|
|
315
|
+
authorUsername?: undefined;
|
|
316
|
+
labels?: undefined;
|
|
317
|
+
search?: undefined;
|
|
318
|
+
orderBy?: undefined;
|
|
319
|
+
sort?: undefined;
|
|
320
|
+
limit?: undefined;
|
|
321
|
+
path?: undefined;
|
|
322
|
+
oldPath?: undefined;
|
|
323
|
+
newLine?: undefined;
|
|
324
|
+
oldLine?: undefined;
|
|
325
|
+
assigneeUsername?: undefined;
|
|
326
|
+
updatedAfter?: undefined;
|
|
327
|
+
};
|
|
328
|
+
required: string[];
|
|
329
|
+
};
|
|
330
|
+
} | {
|
|
331
|
+
name: string;
|
|
332
|
+
description: string;
|
|
333
|
+
input_schema: {
|
|
334
|
+
type: string;
|
|
335
|
+
properties: {
|
|
336
|
+
projectId: {
|
|
337
|
+
type: string;
|
|
338
|
+
description: string;
|
|
339
|
+
};
|
|
340
|
+
state: {
|
|
341
|
+
type: string;
|
|
342
|
+
enum: string[];
|
|
343
|
+
description: string;
|
|
344
|
+
};
|
|
345
|
+
labels: {
|
|
346
|
+
type: string;
|
|
347
|
+
items: {
|
|
348
|
+
type: string;
|
|
349
|
+
};
|
|
350
|
+
description: string;
|
|
351
|
+
};
|
|
352
|
+
assigneeUsername: {
|
|
353
|
+
type: string;
|
|
354
|
+
description: string;
|
|
355
|
+
};
|
|
356
|
+
authorUsername: {
|
|
357
|
+
type: string;
|
|
358
|
+
description: string;
|
|
359
|
+
};
|
|
360
|
+
updatedAfter: {
|
|
361
|
+
type: string;
|
|
362
|
+
description: string;
|
|
363
|
+
};
|
|
364
|
+
search: {
|
|
365
|
+
type: string;
|
|
366
|
+
description: string;
|
|
367
|
+
};
|
|
368
|
+
orderBy: {
|
|
369
|
+
type: string;
|
|
370
|
+
enum: string[];
|
|
371
|
+
description: string;
|
|
372
|
+
};
|
|
373
|
+
sort: {
|
|
374
|
+
type: string;
|
|
375
|
+
enum: string[];
|
|
376
|
+
description: string;
|
|
377
|
+
};
|
|
378
|
+
limit: {
|
|
379
|
+
type: string;
|
|
380
|
+
description: string;
|
|
381
|
+
};
|
|
382
|
+
iid?: undefined;
|
|
383
|
+
targetBranch?: undefined;
|
|
384
|
+
sourceBranch?: undefined;
|
|
385
|
+
body?: undefined;
|
|
386
|
+
path?: undefined;
|
|
387
|
+
oldPath?: undefined;
|
|
388
|
+
newLine?: undefined;
|
|
389
|
+
oldLine?: undefined;
|
|
390
|
+
diffRefs?: undefined;
|
|
391
|
+
comments?: undefined;
|
|
392
|
+
};
|
|
393
|
+
required: string[];
|
|
394
|
+
};
|
|
395
|
+
})[];
|
|
396
|
+
}
|
package/dist/gitlab.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var b=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"}),I=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"}});function j(){let d=process.env.GITLAB_API_URL;if(d)return d.replace(/\/+$/,"");let s=(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||"https://gitlab.com").trim().replace(/\/+$/,"");return/\/api\/v\d+$/.test(s)?s:`${s}/api/v4`}function A(){if(process.env.GITLAB_OAUTH_TOKEN)return{Authorization:`Bearer ${process.env.GITLAB_OAUTH_TOKEN}`};let d=process.env.GITLAB_TOKEN;if(!d)throw new Error("GitLab is not connected: set GITLAB_TOKEN (personal/project access token, api scope) or GITLAB_OAUTH_TOKEN.");return{"PRIVATE-TOKEN":d}}async function u(d,s={}){let r=/^https?:\/\//.test(d)?d:`${j()}${d}`,i={Accept:"application/json","User-Agent":"Zibby-App",...A(),...s.body?{"Content-Type":"application/json"}:{}},e=await fetch(r,{method:s.method||"GET",headers:i,body:s.body?JSON.stringify(s.body):void 0});if(!e.ok){let n=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${n.slice(0,300)}`)}return s.raw?e.text():e.json()}function h(d){let s=String(d);return/^\d+$/.test(s)?s:encodeURIComponent(s)}var O={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:b.GITLAB,envKeys:["GITLAB_TOKEN","GITLAB_OAUTH_TOKEN","GITLAB_INSTANCE_URL","GITLAB_API_URL"],description:"GitLab \u2014 merge requests, diffs, MR reviews/discussions, issues",promptFragment:`## GitLab (connected)
|
|
2
|
+
You have access to the user's GitLab projects via the REST API (cloud gitlab.com OR self-hosted). A "merge request" (MR) is GitLab's pull request. An MR is addressed by a PROJECT (numeric id OR full path like "group/repo") and an \`iid\` (the per-project MR number shown in the URL). For projects, prefer the full path form ("group/subgroup/repo") \u2014 it's what users have. Available tools:
|
|
3
|
+
|
|
4
|
+
### Merge requests
|
|
5
|
+
- gitlab_get_mr: Get an MR's details (title, description, author, source/target branch, state, web url, diff_refs)
|
|
6
|
+
- gitlab_get_mr_changes: Get the MR's changed files with per-file diffs \u2014 THIS is the code to review
|
|
7
|
+
- gitlab_list_mrs: List a project's merge requests (filter by state: opened|closed|merged|all)
|
|
8
|
+
- gitlab_list_mr_notes: Get the discussion/notes thread on an MR
|
|
9
|
+
- gitlab_post_mr_note: Post a general (non-inline) comment on an MR
|
|
10
|
+
- gitlab_post_mr_discussion: Post an INLINE review comment anchored to a file + line in the MR diff. Needs diff_refs (pass them from gitlab_get_mr / gitlab_get_mr_changes, or omit and the tool fetches them). Provide newLine for added/changed lines (or oldLine for removed/context lines).
|
|
11
|
+
|
|
12
|
+
### Issues
|
|
13
|
+
- gitlab_get_issue: Get a single issue (by project + issue iid) \u2014 title, description, state, labels, assignee, web url
|
|
14
|
+
- gitlab_list_issues: List a project's issues (filter by state: opened|closed|all, labels, updatedAfter cursor)
|
|
15
|
+
- gitlab_add_issue_comment: Add a comment to an issue (also the way to record an MR link on a ticket)
|
|
16
|
+
|
|
17
|
+
### Notes
|
|
18
|
+
- A code-review flow is: gitlab_get_mr (context + diff_refs) \u2192 gitlab_get_mr_changes (the diff) \u2192 gitlab_post_mr_discussion per inline finding \u2192 gitlab_post_mr_note for the summary.
|
|
19
|
+
- If an inline position is rejected by GitLab (bad line anchor), fall back to gitlab_post_mr_note with the file/line in the text.`,resolve(){let d={};for(let s of this.envKeys)process.env[s]&&(d[s]=process.env[s]);return{command:null,args:[],env:d,description:this.description}},async handleToolCall(d,s){try{switch(d){case"gitlab_get_mr":{let{projectId:r,iid:i}=s||{};if(!r||!i)return JSON.stringify({error:"projectId and iid are required"});let e=await u(`/projects/${h(r)}/merge_requests/${i}`);return JSON.stringify({iid:e.iid,projectId:e.project_id,title:e.title,description:(e.description||"").slice(0,5e3),state:e.state,author:e.author?.username,sourceBranch:e.source_branch,targetBranch:e.target_branch,draft:e.draft??e.work_in_progress??!1,mergeStatus:e.merge_status,changesCount:e.changes_count,labels:Array.isArray(e.labels)?e.labels:[],webUrl:e.web_url,createdAt:e.created_at,updatedAt:e.updated_at,mergedAt:e.merged_at,diffRefs:e.diff_refs||null})}case"gitlab_get_mr_changes":{let{projectId:r,iid:i}=s||{};if(!r||!i)return JSON.stringify({error:"projectId and iid are required"});let e=await u(`/projects/${h(r)}/merge_requests/${i}/changes`),n=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:n.length,diffRefs:e.diff_refs||null,files:n.map(a=>({oldPath:a.old_path,newPath:a.new_path,newFile:!!a.new_file,deletedFile:!!a.deleted_file,renamedFile:!!a.renamed_file,diff:typeof a.diff=="string"?a.diff.slice(0,3e3):""}))})}case"gitlab_list_mrs":{let{projectId:r,state:i,targetBranch:e,sourceBranch:n,authorUsername:a,labels:c,search:l,sort:f,orderBy:p,limit:m}=s||{};if(!r)return JSON.stringify({error:"projectId is required"});let t=new URLSearchParams;t.set("state",i||"opened"),t.set("per_page",String(m||20)),t.set("order_by",p||"updated_at"),t.set("sort",f||"desc"),e&&t.set("target_branch",e),n&&t.set("source_branch",n),a&&t.set("author_username",a),c&&t.set("labels",Array.isArray(c)?c.join(","):c),l&&t.set("search",l);let g=await u(`/projects/${h(r)}/merge_requests?${t.toString()}`),_=(Array.isArray(g)?g:[]).map(o=>({iid:o.iid,title:o.title,state:o.state,author:o.author?.username,sourceBranch:o.source_branch,targetBranch:o.target_branch,draft:o.draft??o.work_in_progress??!1,labels:Array.isArray(o.labels)?o.labels:[],webUrl:o.web_url,createdAt:o.created_at,updatedAt:o.updated_at}));return JSON.stringify({count:_.length,mergeRequests:_})}case"gitlab_list_mr_notes":{let{projectId:r,iid:i,limit:e}=s||{};if(!r||!i)return JSON.stringify({error:"projectId and iid are required"});let n=await u(`/projects/${h(r)}/merge_requests/${i}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(n)?n.length:0,notes:(Array.isArray(n)?n:[]).map(a=>({id:a.id,author:a.author?.username,body:(a.body||"").slice(0,1e3),system:!!a.system,createdAt:a.created_at}))})}case"gitlab_post_mr_note":{let{projectId:r,iid:i,body:e}=s||{};if(!r||!i||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let n=await u(`/projects/${h(r)}/merge_requests/${i}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:n.id,createdAt:n.created_at})}case"gitlab_post_mr_discussion":{let{projectId:r,iid:i,path:e,oldPath:n,newLine:a,oldLine:c,body:l}=s||{};if(!r||!i||!e||!l)return JSON.stringify({error:"projectId, iid, path, and body are required"});if(a==null&&c==null)return JSON.stringify({error:"newLine (added/changed line) or oldLine (removed/context line) is required to anchor an inline comment"});let f=h(r),p=s.diffRefs||null;if(p||(p=(await u(`/projects/${f}/merge_requests/${i}`)).diff_refs||null),!p||!p.head_sha)return JSON.stringify({error:"could not resolve diff_refs for this MR \u2014 cannot anchor an inline comment. Use gitlab_post_mr_note instead."});let m={base_sha:p.base_sha,start_sha:p.start_sha,head_sha:p.head_sha,position_type:"text",new_path:e,old_path:n||e};a!=null&&(m.new_line=Number(a)),c!=null&&(m.old_line=Number(c));try{let t=await u(`/projects/${f}/merge_requests/${i}/discussions`,{method:"POST",body:{body:String(l),position:m}});return JSON.stringify({ok:!0,discussionId:t.id})}catch(t){return JSON.stringify({ok:!1,error:`inline anchor rejected (${t.message}). The line must be part of the MR diff. Fall back to gitlab_post_mr_note with the file/line in the text.`})}}case"gitlab_create_mr_review":{let{projectId:r,iid:i,body:e,comments:n}=s||{};if(!r||!i)return JSON.stringify({error:"projectId and iid are required"});let a=h(r),c=Array.isArray(n)?n.filter(t=>t&&t.path&&t.body&&(t.newLine!=null||t.oldLine!=null)):[];if(!e&&c.length===0)return JSON.stringify({error:"a review needs a body and/or inline comments"});let l=s.diffRefs||null;c.length>0&&!l&&(l=(await u(`/projects/${a}/merge_requests/${i}`)).diff_refs||null);let f=!1;e&&(await u(`/projects/${a}/merge_requests/${i}/notes`,{method:"POST",body:{body:String(e)}}),f=!0);let p=0,m=[];if(c.length>0&&l)for(let t of c){let g={base_sha:l.base_sha,start_sha:l.start_sha,head_sha:l.head_sha,position_type:"text",new_path:t.path,old_path:t.oldPath||t.path};t.newLine!=null&&(g.new_line=Number(t.newLine)),t.oldLine!=null&&(g.old_line=Number(t.oldLine));try{await u(`/projects/${a}/merge_requests/${i}/discussions`,{method:"POST",body:{body:String(t.body),position:g}}),p+=1}catch(_){m.push(`${t.path}:${t.newLine??t.oldLine} \u2014 ${_.message}`)}}else c.length>0&&!l&&m.push("no diff_refs available \u2014 inline comments skipped (pass diffRefs from gitlab_get_mr)");return JSON.stringify({ok:!0,notePosted:f,inlinePosted:p,inlineErrors:m.length?m:void 0})}case"gitlab_list_issues":{let{projectId:r,state:i,labels:e,assigneeUsername:n,authorUsername:a,updatedAfter:c,search:l,sort:f,orderBy:p,limit:m}=s||{};if(!r)return JSON.stringify({error:"projectId is required"});let t=new URLSearchParams;t.set("state",i||"opened"),t.set("per_page",String(m||30)),t.set("order_by",p||"updated_at"),t.set("sort",f||"desc"),e&&t.set("labels",Array.isArray(e)?e.join(","):e),n&&t.set("assignee_username",n),a&&t.set("author_username",a),c&&t.set("updated_after",c),l&&t.set("search",l);let g=await u(`/projects/${h(r)}/issues?${t.toString()}`),_=(Array.isArray(g)?g:[]).map(o=>({iid:o.iid,title:o.title,state:o.state,labels:Array.isArray(o.labels)?o.labels:[],author:o.author?.username,assignees:(o.assignees||[]).map(y=>y.username),userNotesCount:o.user_notes_count,webUrl:o.web_url,createdAt:o.created_at,updatedAt:o.updated_at}));return JSON.stringify({count:_.length,issues:_})}case"gitlab_get_issue":{let{projectId:r,iid:i}=s||{};if(!r||!i)return JSON.stringify({error:"projectId and iid are required"});let e=await u(`/projects/${h(r)}/issues/${i}`);return JSON.stringify({iid:e.iid,projectId:e.project_id,title:e.title,description:(e.description||"").slice(0,5e3),state:e.state,labels:Array.isArray(e.labels)?e.labels:[],author:e.author?.username,assignees:(e.assignees||[]).map(n=>n.username),milestone:e.milestone?.title||null,webUrl:e.web_url,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at})}case"gitlab_add_issue_comment":{let{projectId:r,iid:i,body:e}=s||{};if(!r||!i||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let n=await u(`/projects/${h(r)}/issues/${i}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:n.id,createdAt:n.created_at})}default:return JSON.stringify({error:`Unknown tool: ${d}`})}}catch(r){return JSON.stringify({error:r.message})}},tools:[{name:"gitlab_get_mr",description:"Get a GitLab merge request \u2014 title, description, branches, state, author, web url, and diff_refs (needed to anchor inline review comments).",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},iid:{type:"number",description:"Merge request iid (the per-project MR number in the URL)"}},required:["projectId","iid"]}},{name:"gitlab_get_mr_changes",description:"Get the changed files of a GitLab merge request with per-file diffs \u2014 the actual code changes to review. Also returns diff_refs for inline comments.",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},iid:{type:"number",description:"Merge request iid"}},required:["projectId","iid"]}},{name:"gitlab_list_mrs",description:"List a GitLab project's merge requests, filtered by state and other criteria. Returns newest-updated first.",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},state:{type:"string",enum:["opened","closed","merged","locked","all"],description:"Filter by state (default: opened)"},targetBranch:{type:"string",description:"Filter by target branch"},sourceBranch:{type:"string",description:"Filter by source branch"},authorUsername:{type:"string",description:"Filter by author username"},labels:{type:"array",items:{type:"string"},description:"Only MRs carrying ALL of these labels"},search:{type:"string",description:"Search title and description"},orderBy:{type:"string",enum:["created_at","updated_at","title"],description:"Sort field (default: updated_at)"},sort:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max MRs (default: 20)"}},required:["projectId"]}},{name:"gitlab_list_mr_notes",description:"List the discussion notes on a GitLab merge request (chronological).",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},limit:{type:"number",description:"Max notes (default 50)"}},required:["projectId","iid"]}},{name:"gitlab_post_mr_note",description:"Post a general (non-inline) comment on a GitLab merge request. Use for a review summary or a top-level remark.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},body:{type:"string",description:"Comment body (markdown)"}},required:["projectId","iid","body"]}},{name:"gitlab_post_mr_discussion",description:"Post an INLINE review comment anchored to a file + line in a GitLab merge request diff. Provide newLine (added/changed line) or oldLine (removed/context line). Pass diffRefs from gitlab_get_mr/gitlab_get_mr_changes, or omit to have the tool fetch them. If the line anchor is rejected, fall back to gitlab_post_mr_note.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},path:{type:"string",description:"New file path as it appears in the diff"},oldPath:{type:"string",description:"Old file path (defaults to path)"},newLine:{type:"number",description:"Line number in the NEW version of the file (for added/changed lines)"},oldLine:{type:"number",description:"Line number in the OLD version (for removed/context lines)"},body:{type:"string",description:"The inline comment text (markdown)"},diffRefs:{type:"object",description:"The MR diff_refs ({ base_sha, start_sha, head_sha }) from gitlab_get_mr. Omit and the tool fetches them."}},required:["projectId","iid","path","body"]}},{name:"gitlab_create_mr_review",description:"Post a full review on a GitLab merge request in one call: a summary note plus optional inline comments anchored to file/line in the diff. Convenience wrapper over gitlab_post_mr_note + gitlab_post_mr_discussion.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},body:{type:"string",description:"The review summary (markdown). Posted as a top-level MR note."},diffRefs:{type:"object",description:"The MR diff_refs ({ base_sha, start_sha, head_sha }) from gitlab_get_mr \u2014 required to anchor inline comments. Omit and the tool fetches them."},comments:{type:"array",description:"Optional inline comments, each anchored to a changed line in a file.",items:{type:"object",properties:{path:{type:"string",description:"New file path as it appears in the diff"},oldPath:{type:"string",description:"Old file path (defaults to path)"},newLine:{type:"number",description:"Line number in the NEW version of the file (for added/changed lines)"},oldLine:{type:"number",description:"Line number in the OLD version (for removed/context lines)"},body:{type:"string",description:"The inline comment text (markdown)"}},required:["path","body"]}}},required:["projectId","iid"]}},{name:"gitlab_list_issues",description:"List a GitLab project's issues, filtered by state, labels, and an updatedAfter polling cursor. Returns newest-updated first.",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},state:{type:"string",enum:["opened","closed","all"],description:"Filter by state (default: opened)"},labels:{type:"array",items:{type:"string"},description:"Only issues carrying ALL of these labels"},assigneeUsername:{type:"string",description:"Filter by assignee username"},authorUsername:{type:"string",description:"Filter by author username"},updatedAfter:{type:"string",description:"ISO-8601 timestamp; only issues updated after this (polling cursor)"},search:{type:"string",description:"Search title and description"},orderBy:{type:"string",enum:["created_at","updated_at"],description:"Sort field (default: updated_at)"},sort:{type:"string",enum:["asc","desc"],description:"Sort direction (default: desc)"},limit:{type:"number",description:"Max issues (default: 30)"}},required:["projectId"]}},{name:"gitlab_get_issue",description:"Get a single GitLab issue with full detail (title, description, state, labels, assignees, web url).",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Issue iid (the per-project issue number in the URL)"}},required:["projectId","iid"]}},{name:"gitlab_add_issue_comment",description:"Add a comment to a GitLab issue. Also the way to record an MR link on a ticket (post a markdown link).",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Issue iid"},body:{type:"string",description:"Comment body (markdown)"}},required:["projectId","iid","body"]}}]};export{O as gitlabSkill,u as glFetch};
|