@zibby/skills 0.1.40 → 0.1.41

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/gitlab.d.ts CHANGED
@@ -51,7 +51,56 @@ export namespace gitlabSkill {
51
51
  type: string;
52
52
  description: string;
53
53
  };
54
+ projectPath?: undefined;
54
55
  projectId?: undefined;
56
+ branch?: undefined;
57
+ destination?: undefined;
58
+ iid?: undefined;
59
+ state?: undefined;
60
+ targetBranch?: undefined;
61
+ sourceBranch?: undefined;
62
+ authorUsername?: undefined;
63
+ labels?: undefined;
64
+ search?: undefined;
65
+ orderBy?: undefined;
66
+ sort?: undefined;
67
+ body?: undefined;
68
+ path?: undefined;
69
+ oldPath?: undefined;
70
+ newLine?: undefined;
71
+ oldLine?: undefined;
72
+ diffRefs?: undefined;
73
+ comments?: undefined;
74
+ discussionId?: undefined;
75
+ assigneeUsername?: undefined;
76
+ updatedAfter?: undefined;
77
+ };
78
+ required?: undefined;
79
+ };
80
+ } | {
81
+ name: string;
82
+ description: string;
83
+ input_schema: {
84
+ type: string;
85
+ properties: {
86
+ projectPath: {
87
+ type: string;
88
+ description: string;
89
+ };
90
+ projectId: {
91
+ type: string;
92
+ description: string;
93
+ };
94
+ branch: {
95
+ type: string;
96
+ description: string;
97
+ };
98
+ destination: {
99
+ type: string;
100
+ description: string;
101
+ };
102
+ query?: undefined;
103
+ limit?: undefined;
55
104
  iid?: undefined;
56
105
  state?: undefined;
57
106
  targetBranch?: undefined;
@@ -90,6 +139,9 @@ export namespace gitlabSkill {
90
139
  };
91
140
  query?: undefined;
92
141
  limit?: undefined;
142
+ projectPath?: undefined;
143
+ branch?: undefined;
144
+ destination?: undefined;
93
145
  state?: undefined;
94
146
  targetBranch?: undefined;
95
147
  sourceBranch?: undefined;
@@ -164,6 +216,9 @@ export namespace gitlabSkill {
164
216
  description: string;
165
217
  };
166
218
  query?: undefined;
219
+ projectPath?: undefined;
220
+ branch?: undefined;
221
+ destination?: undefined;
167
222
  iid?: undefined;
168
223
  body?: undefined;
169
224
  path?: undefined;
@@ -197,6 +252,9 @@ export namespace gitlabSkill {
197
252
  description: string;
198
253
  };
199
254
  query?: undefined;
255
+ projectPath?: undefined;
256
+ branch?: undefined;
257
+ destination?: undefined;
200
258
  state?: undefined;
201
259
  targetBranch?: undefined;
202
260
  sourceBranch?: undefined;
@@ -238,6 +296,9 @@ export namespace gitlabSkill {
238
296
  };
239
297
  query?: undefined;
240
298
  limit?: undefined;
299
+ projectPath?: undefined;
300
+ branch?: undefined;
301
+ destination?: undefined;
241
302
  state?: undefined;
242
303
  targetBranch?: undefined;
243
304
  sourceBranch?: undefined;
@@ -298,6 +359,9 @@ export namespace gitlabSkill {
298
359
  };
299
360
  query?: undefined;
300
361
  limit?: undefined;
362
+ projectPath?: undefined;
363
+ branch?: undefined;
364
+ destination?: undefined;
301
365
  state?: undefined;
302
366
  targetBranch?: undefined;
303
367
  sourceBranch?: undefined;
@@ -367,6 +431,9 @@ export namespace gitlabSkill {
367
431
  };
368
432
  query?: undefined;
369
433
  limit?: undefined;
434
+ projectPath?: undefined;
435
+ branch?: undefined;
436
+ destination?: undefined;
370
437
  state?: undefined;
371
438
  targetBranch?: undefined;
372
439
  sourceBranch?: undefined;
@@ -405,6 +472,9 @@ export namespace gitlabSkill {
405
472
  };
406
473
  query?: undefined;
407
474
  limit?: undefined;
475
+ projectPath?: undefined;
476
+ branch?: undefined;
477
+ destination?: undefined;
408
478
  state?: undefined;
409
479
  targetBranch?: undefined;
410
480
  sourceBranch?: undefined;
@@ -449,6 +519,9 @@ export namespace gitlabSkill {
449
519
  };
450
520
  query?: undefined;
451
521
  limit?: undefined;
522
+ projectPath?: undefined;
523
+ branch?: undefined;
524
+ destination?: undefined;
452
525
  state?: undefined;
453
526
  targetBranch?: undefined;
454
527
  sourceBranch?: undefined;
@@ -521,6 +594,9 @@ export namespace gitlabSkill {
521
594
  description: string;
522
595
  };
523
596
  query?: undefined;
597
+ projectPath?: undefined;
598
+ branch?: undefined;
599
+ destination?: undefined;
524
600
  iid?: undefined;
525
601
  targetBranch?: undefined;
526
602
  sourceBranch?: undefined;
package/dist/gitlab.js CHANGED
@@ -1,8 +1,9 @@
1
- import{existsSync as j}from"fs";import{fileURLToPath as I}from"url";import{dirname as w,resolve as A}from"path";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",FIGMA:"figma"}),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"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"}});function L(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let u=w(I(import.meta.url)),o=A(u,"..","bin","mcp-skill.mjs");return j(o)?o:null}function O(){let u=process.env.GITLAB_API_URL;if(u)return u.replace(/\/+$/,"");let o=(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||"https://gitlab.com").trim().replace(/\/+$/,"");return/\/api\/v\d+$/.test(o)?o:`${o}/api/v4`}function R(){if(process.env.GITLAB_OAUTH_TOKEN)return{Authorization:`Bearer ${process.env.GITLAB_OAUTH_TOKEN}`};let u=process.env.GITLAB_TOKEN;if(!u)throw new Error("GitLab is not connected: set GITLAB_TOKEN (personal/project access token, api scope) or GITLAB_OAUTH_TOKEN.");return{"PRIVATE-TOKEN":u}}async function m(u,o={}){let t=/^https?:\/\//.test(u)?u:`${O()}${u}`,s={Accept:"application/json","User-Agent":"Zibby-App",...R(),...o.body?{"Content-Type":"application/json"}:{}},e=await fetch(t,{method:o.method||"GET",headers:s,body:o.body?JSON.stringify(o.body):void 0});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${r.slice(0,300)}`)}return o.raw?e.text():e.json()}function g(u){let o=String(u);return/^\d+$/.test(o)?o:encodeURIComponent(o)}var G={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)
1
+ import{existsSync as S}from"fs";import{fileURLToPath as O}from"url";import{dirname as v,resolve as R}from"path";var j=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"}),$=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"}});function N(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let p=v(O(import.meta.url)),o=R(p,"..","bin","mcp-skill.mjs");return S(o)?o:null}function T(){let p=process.env.GITLAB_API_URL;if(p)return p.replace(/\/+$/,"");let o=(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||"https://gitlab.com").trim().replace(/\/+$/,"");return/\/api\/v\d+$/.test(o)?o:`${o}/api/v4`}function P(){if(process.env.GITLAB_OAUTH_TOKEN)return{Authorization:`Bearer ${process.env.GITLAB_OAUTH_TOKEN}`};let p=process.env.GITLAB_TOKEN;if(!p)throw new Error("GitLab is not connected: set GITLAB_TOKEN (personal/project access token, api scope) or GITLAB_OAUTH_TOKEN.");return{"PRIVATE-TOKEN":p}}async function h(p,o={}){let t=/^https?:\/\//.test(p)?p:`${T()}${p}`,s={Accept:"application/json","User-Agent":"Zibby-App",...P(),...o.body?{"Content-Type":"application/json"}:{}},e=await fetch(t,{method:o.method||"GET",headers:s,body:o.body?JSON.stringify(o.body):void 0});if(!e.ok){let i=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${i.slice(0,300)}`)}return o.raw?e.text():e.json()}function I(){let p=process.env.GITLAB_API_URL;return(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||(p?p.replace(/\/api\/v\d+\/?$/,""):"")||"https://gitlab.com").trim().replace(/\/+$/,"").replace(/\/api\/v\d+$/,"")}function q(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function g(p){let o=String(p);return/^\d+$/.test(o)?o:encodeURIComponent(o)}var J={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:j.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
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
3
 
4
4
  ### Discovery
5
5
  - gitlab_list_projects: List the projects this token can access (the ones you're a member of), optionally filtered by a search query. Use to find a RELATED project worth cloning for cross-repo context.
6
+ - gitlab_clone: Clone a project locally (shallow, auto-authenticated) to read code OUTSIDE the MR diff \u2014 callers, shared types, an existing util, or a cross-repo dependency. After cloning, use Grep/Glob/Read on the returned path. Clone SPARINGLY (only when correctness needs context beyond the diff).
6
7
 
7
8
  ### Merge requests
8
9
  - gitlab_get_mr: Get an MR's details (title, description, author, source/target branch, state, web url, diff_refs)
@@ -21,4 +22,6 @@ You have access to the user's GitLab projects via the REST API (cloud gitlab.com
21
22
 
22
23
  ### Notes
23
24
  - 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.
24
- - 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 u=L();if(!u)return{command:null,args:[],env:{},description:this.description};let o={};for(let t of this.envKeys)process.env[t]&&(o[t]=process.env[t]);return{type:"stdio",command:"node",args:[u,"../dist/gitlab.js","gitlabSkill"],env:o,description:this.description,alwaysLoad:!0}},async handleToolCall(u,o){try{switch(u){case"gitlab_get_mr":{let{projectId:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(t)}/merge_requests/${s}`);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:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(t)}/merge_requests/${s}/changes`),r=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:r.length,diffRefs:e.diff_refs||null,files:r.map(n=>({oldPath:n.old_path,newPath:n.new_path,newFile:!!n.new_file,deletedFile:!!n.deleted_file,renamedFile:!!n.renamed_file,diff:typeof n.diff=="string"?n.diff.slice(0,3e3):""}))})}case"gitlab_list_mrs":{let{projectId:t,state:s,targetBranch:e,sourceBranch:r,authorUsername:n,labels:c,search:a,sort:l,orderBy:p,limit:h}=o||{};if(!t)return JSON.stringify({error:"projectId is required"});let i=new URLSearchParams;i.set("state",s||"opened"),i.set("per_page",String(h||20)),i.set("order_by",p||"updated_at"),i.set("sort",l||"desc"),e&&i.set("target_branch",e),r&&i.set("source_branch",r),n&&i.set("author_username",n),c&&i.set("labels",Array.isArray(c)?c.join(","):c),a&&i.set("search",a);let _=await m(`/projects/${g(t)}/merge_requests?${i.toString()}`),f=(Array.isArray(_)?_:[]).map(d=>({iid:d.iid,title:d.title,state:d.state,author:d.author?.username,sourceBranch:d.source_branch,targetBranch:d.target_branch,draft:d.draft??d.work_in_progress??!1,labels:Array.isArray(d.labels)?d.labels:[],webUrl:d.web_url,createdAt:d.created_at,updatedAt:d.updated_at}));return JSON.stringify({count:f.length,mergeRequests:f})}case"gitlab_list_mr_notes":{let{projectId:t,iid:s,limit:e}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let r=await m(`/projects/${g(t)}/merge_requests/${s}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(r)?r.length:0,notes:(Array.isArray(r)?r:[]).map(n=>({id:n.id,author:n.author?.username,body:(n.body||"").slice(0,1e3),system:!!n.system,createdAt:n.created_at}))})}case"gitlab_post_mr_note":{let{projectId:t,iid:s,body:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let r=await m(`/projects/${g(t)}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:r.id,createdAt:r.created_at})}case"gitlab_post_mr_discussion":{let{projectId:t,iid:s,path:e,oldPath:r,newLine:n,oldLine:c,body:a}=o||{};if(!t||!s||!e||!a)return JSON.stringify({error:"projectId, iid, path, and body are required"});if(n==null&&c==null)return JSON.stringify({error:"newLine (added/changed line) or oldLine (removed/context line) is required to anchor an inline comment"});let l=g(t),p=o.diffRefs||null;if(p||(p=(await m(`/projects/${l}/merge_requests/${s}`)).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 h={base_sha:p.base_sha,start_sha:p.start_sha,head_sha:p.head_sha,position_type:"text",new_path:e,old_path:r||e};n!=null&&(h.new_line=Number(n)),c!=null&&(h.old_line=Number(c));try{let i=await m(`/projects/${l}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(a),position:h}});return JSON.stringify({ok:!0,discussionId:i.id})}catch(i){return JSON.stringify({ok:!1,error:`inline anchor rejected (${i.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:t,iid:s,body:e,comments:r}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let n=g(t),c=Array.isArray(r)?r.filter(i=>i&&i.path&&i.body&&(i.newLine!=null||i.oldLine!=null)):[];if(!e&&c.length===0)return JSON.stringify({error:"a review needs a body and/or inline comments"});let a=o.diffRefs||null;c.length>0&&!a&&(a=(await m(`/projects/${n}/merge_requests/${s}`)).diff_refs||null);let l=!1;e&&(await m(`/projects/${n}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}}),l=!0);let p=0,h=[];if(c.length>0&&a)for(let i of c){let _={base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha,position_type:"text",new_path:i.path,old_path:i.oldPath||i.path};i.newLine!=null&&(_.new_line=Number(i.newLine)),i.oldLine!=null&&(_.old_line=Number(i.oldLine));try{await m(`/projects/${n}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(i.body),position:_}}),p+=1}catch(f){h.push(`${i.path}:${i.newLine??i.oldLine} \u2014 ${f.message}`)}}else c.length>0&&!a&&h.push("no diff_refs available \u2014 inline comments skipped (pass diffRefs from gitlab_get_mr)");return JSON.stringify({ok:!0,notePosted:l,inlinePosted:p,inlineErrors:h.length?h:void 0})}case"gitlab_get_discussion":{let{projectId:t,iid:s,discussionId:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let r=await m(`/projects/${g(t)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}`),n=Array.isArray(r.notes)?r.notes:[],c=n.find(l=>l.position)||null,a=c?c.position:null;return JSON.stringify({discussionId:r.id,individualNote:!!r.individual_note,path:a&&(a.new_path||a.old_path)||null,newLine:a?a.new_line??null:null,oldLine:a?a.old_line??null:null,diffRefs:a?{base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha}:null,notes:n.map(l=>({id:l.id,author:l.author?.username,body:(l.body||"").slice(0,4e3),system:!!l.system,createdAt:l.created_at}))})}case"gitlab_reply_discussion":{let{projectId:t,iid:s,discussionId:e,body:r}=o||{};if(!t||!s||!e||!r)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let n=await m(`/projects/${g(t)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(r)}});return JSON.stringify({ok:!0,id:n.id,createdAt:n.created_at})}case"gitlab_list_projects":{let{query:t,limit:s}=o||{},e=Math.min(Number(s)>0?Number(s):50,200),r=new URLSearchParams;r.set("membership","true"),r.set("simple","true"),r.set("order_by","last_activity_at"),r.set("sort","desc"),r.set("per_page",String(Math.min(e+1,100))),t&&r.set("search",String(t));let n=await m(`/projects?${r.toString()}`),c=Array.isArray(n)?n:[],a=c.length>e,l=c.slice(0,e).map(p=>({fullPath:p.path_with_namespace,name:p.name,webUrl:p.web_url,defaultBranch:p.default_branch||null,visibility:p.visibility||null}));return JSON.stringify({count:l.length,truncated:a,projects:l})}case"gitlab_list_issues":{let{projectId:t,state:s,labels:e,assigneeUsername:r,authorUsername:n,updatedAfter:c,search:a,sort:l,orderBy:p,limit:h}=o||{};if(!t)return JSON.stringify({error:"projectId is required"});let i=new URLSearchParams;i.set("state",s||"opened"),i.set("per_page",String(h||30)),i.set("order_by",p||"updated_at"),i.set("sort",l||"desc"),e&&i.set("labels",Array.isArray(e)?e.join(","):e),r&&i.set("assignee_username",r),n&&i.set("author_username",n),c&&i.set("updated_after",c),a&&i.set("search",a);let _=await m(`/projects/${g(t)}/issues?${i.toString()}`),f=(Array.isArray(_)?_:[]).map(d=>({iid:d.iid,title:d.title,state:d.state,labels:Array.isArray(d.labels)?d.labels:[],author:d.author?.username,assignees:(d.assignees||[]).map(y=>y.username),userNotesCount:d.user_notes_count,webUrl:d.web_url,createdAt:d.created_at,updatedAt:d.updated_at}));return JSON.stringify({count:f.length,issues:f})}case"gitlab_get_issue":{let{projectId:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(t)}/issues/${s}`);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(r=>r.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:t,iid:s,body:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let r=await m(`/projects/${g(t)}/issues/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:r.id,createdAt:r.created_at})}default:return JSON.stringify({error:`Unknown tool: ${u}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"gitlab_list_projects",description:"List the GitLab projects this token can access (the projects you are a member of), optionally filtered by a search query. Use this to discover a RELATED project worth cloning when a change's correctness depends on another accessible repo. Returns a normalized list of { fullPath, name, webUrl, defaultBranch, visibility } and a truncated flag.",input_schema:{type:"object",properties:{query:{type:"string",description:"Optional search term matched against project name/path"},limit:{type:"number",description:"Max projects (default 50, hard max 200)"}}}},{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_get_discussion",description:"Read a single GitLab merge-request DISCUSSION (thread) by its discussion id: all notes in order plus the diff position (file + line) it is anchored to. Use this to understand a human's reply to a previous review discussion before replying in-thread.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},discussionId:{type:"string",description:"The discussion id (from the Note Hook payload or gitlab_list_mr_notes)"}},required:["projectId","iid","discussionId"]}},{name:"gitlab_reply_discussion",description:"Reply IN-THREAD to an existing GitLab merge-request discussion (a conversational reply appended to the SAME thread \u2014 NOT a fresh review). Use after gitlab_get_discussion to answer a human's reply to a review comment.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},discussionId:{type:"string",description:"The discussion id to reply to"},body:{type:"string",description:"The reply text (markdown)"}},required:["projectId","iid","discussionId","body"]}},{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{G as gitlabSkill,m as glFetch};
25
+ - 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 p=N();if(!p)return{command:null,args:[],env:{},description:this.description};let o={};for(let t of this.envKeys)process.env[t]&&(o[t]=process.env[t]);return{type:"stdio",command:"node",args:[p,"../dist/gitlab.js","gitlabSkill"],env:o,description:this.description,alwaysLoad:!0}},async handleToolCall(p,o){try{switch(p){case"gitlab_clone":{let{projectPath:t,projectId:s,destination:e,branch:i}=o||{},n=t&&String(t).trim();if(!n&&s!=null&&(/^\d+$/.test(String(s))?n=(await h(`/projects/${g(s)}`))?.path_with_namespace:n=String(s).trim()),!n)return JSON.stringify({error:'projectPath (e.g. "group/repo") or a numeric projectId is required'});let c=q();if(!c)return JSON.stringify({error:"GitLab is not connected (no token to authenticate the clone)."});let{execSync:a}=await import("child_process"),{join:u,resolve:l}=await import("path"),{existsSync:m,mkdirSync:r}=await import("fs"),f=e?l(e):l(process.cwd(),".zibby","repos"),_=n.split("/").filter(Boolean).pop(),d=u(f,_);if(r(f,{recursive:!0}),m(d))return JSON.stringify({success:!0,path:d,message:`Already cloned at ${d}`,alreadyCloned:!0});let y=I().replace(/^https?:\/\//,""),A=`${I().startsWith("http://")?"http":"https"}://oauth2:${c}@${y}/${n}.git`,w=i?`--branch "${String(i).replace(/"/g,"")}" `:"";try{a(`git clone --depth 1 ${w}${A} "${d}"`,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});let b=a(`ls -la "${d}"`,{encoding:"utf-8"});return JSON.stringify({success:!0,path:d,message:`Cloned ${n} to ${d}`,contents:b.split(`
26
+ `).slice(0,30).join(`
27
+ `)})}catch(b){let L=String(b.message||b).split(c).join("***");return JSON.stringify({error:`Clone failed: ${L}`})}}case"gitlab_get_mr":{let{projectId:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(t)}/merge_requests/${s}`);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:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(t)}/merge_requests/${s}/changes`),i=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:i.length,diffRefs:e.diff_refs||null,files:i.map(n=>({oldPath:n.old_path,newPath:n.new_path,newFile:!!n.new_file,deletedFile:!!n.deleted_file,renamedFile:!!n.renamed_file,diff:typeof n.diff=="string"?n.diff.slice(0,3e3):""}))})}case"gitlab_list_mrs":{let{projectId:t,state:s,targetBranch:e,sourceBranch:i,authorUsername:n,labels:c,search:a,sort:u,orderBy:l,limit:m}=o||{};if(!t)return JSON.stringify({error:"projectId is required"});let r=new URLSearchParams;r.set("state",s||"opened"),r.set("per_page",String(m||20)),r.set("order_by",l||"updated_at"),r.set("sort",u||"desc"),e&&r.set("target_branch",e),i&&r.set("source_branch",i),n&&r.set("author_username",n),c&&r.set("labels",Array.isArray(c)?c.join(","):c),a&&r.set("search",a);let f=await h(`/projects/${g(t)}/merge_requests?${r.toString()}`),_=(Array.isArray(f)?f:[]).map(d=>({iid:d.iid,title:d.title,state:d.state,author:d.author?.username,sourceBranch:d.source_branch,targetBranch:d.target_branch,draft:d.draft??d.work_in_progress??!1,labels:Array.isArray(d.labels)?d.labels:[],webUrl:d.web_url,createdAt:d.created_at,updatedAt:d.updated_at}));return JSON.stringify({count:_.length,mergeRequests:_})}case"gitlab_list_mr_notes":{let{projectId:t,iid:s,limit:e}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let i=await h(`/projects/${g(t)}/merge_requests/${s}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(i)?i.length:0,notes:(Array.isArray(i)?i:[]).map(n=>({id:n.id,author:n.author?.username,body:(n.body||"").slice(0,1e3),system:!!n.system,createdAt:n.created_at}))})}case"gitlab_post_mr_note":{let{projectId:t,iid:s,body:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let i=await h(`/projects/${g(t)}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:i.id,createdAt:i.created_at})}case"gitlab_post_mr_discussion":{let{projectId:t,iid:s,path:e,oldPath:i,newLine:n,oldLine:c,body:a}=o||{};if(!t||!s||!e||!a)return JSON.stringify({error:"projectId, iid, path, and body are required"});if(n==null&&c==null)return JSON.stringify({error:"newLine (added/changed line) or oldLine (removed/context line) is required to anchor an inline comment"});let u=g(t),l=o.diffRefs||null;if(l||(l=(await h(`/projects/${u}/merge_requests/${s}`)).diff_refs||null),!l||!l.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:l.base_sha,start_sha:l.start_sha,head_sha:l.head_sha,position_type:"text",new_path:e,old_path:i||e};n!=null&&(m.new_line=Number(n)),c!=null&&(m.old_line=Number(c));try{let r=await h(`/projects/${u}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(a),position:m}});return JSON.stringify({ok:!0,discussionId:r.id})}catch(r){return JSON.stringify({ok:!1,error:`inline anchor rejected (${r.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:t,iid:s,body:e,comments:i}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let n=g(t),c=Array.isArray(i)?i.filter(r=>r&&r.path&&r.body&&(r.newLine!=null||r.oldLine!=null)):[];if(!e&&c.length===0)return JSON.stringify({error:"a review needs a body and/or inline comments"});let a=o.diffRefs||null;c.length>0&&!a&&(a=(await h(`/projects/${n}/merge_requests/${s}`)).diff_refs||null);let u=!1;e&&(await h(`/projects/${n}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}}),u=!0);let l=0,m=[];if(c.length>0&&a)for(let r of c){let f={base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha,position_type:"text",new_path:r.path,old_path:r.oldPath||r.path};r.newLine!=null&&(f.new_line=Number(r.newLine)),r.oldLine!=null&&(f.old_line=Number(r.oldLine));try{await h(`/projects/${n}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(r.body),position:f}}),l+=1}catch(_){m.push(`${r.path}:${r.newLine??r.oldLine} \u2014 ${_.message}`)}}else c.length>0&&!a&&m.push("no diff_refs available \u2014 inline comments skipped (pass diffRefs from gitlab_get_mr)");return JSON.stringify({ok:!0,notePosted:u,inlinePosted:l,inlineErrors:m.length?m:void 0})}case"gitlab_get_discussion":{let{projectId:t,iid:s,discussionId:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let i=await h(`/projects/${g(t)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}`),n=Array.isArray(i.notes)?i.notes:[],c=n.find(u=>u.position)||null,a=c?c.position:null;return JSON.stringify({discussionId:i.id,individualNote:!!i.individual_note,path:a&&(a.new_path||a.old_path)||null,newLine:a?a.new_line??null:null,oldLine:a?a.old_line??null:null,diffRefs:a?{base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha}:null,notes:n.map(u=>({id:u.id,author:u.author?.username,body:(u.body||"").slice(0,4e3),system:!!u.system,createdAt:u.created_at}))})}case"gitlab_reply_discussion":{let{projectId:t,iid:s,discussionId:e,body:i}=o||{};if(!t||!s||!e||!i)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let n=await h(`/projects/${g(t)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(i)}});return JSON.stringify({ok:!0,id:n.id,createdAt:n.created_at})}case"gitlab_list_projects":{let{query:t,limit:s}=o||{},e=Math.min(Number(s)>0?Number(s):50,200),i=new URLSearchParams;i.set("membership","true"),i.set("simple","true"),i.set("order_by","last_activity_at"),i.set("sort","desc"),i.set("per_page",String(Math.min(e+1,100))),t&&i.set("search",String(t));let n=await h(`/projects?${i.toString()}`),c=Array.isArray(n)?n:[],a=c.length>e,u=c.slice(0,e).map(l=>({fullPath:l.path_with_namespace,name:l.name,webUrl:l.web_url,defaultBranch:l.default_branch||null,visibility:l.visibility||null}));return JSON.stringify({count:u.length,truncated:a,projects:u})}case"gitlab_list_issues":{let{projectId:t,state:s,labels:e,assigneeUsername:i,authorUsername:n,updatedAfter:c,search:a,sort:u,orderBy:l,limit:m}=o||{};if(!t)return JSON.stringify({error:"projectId is required"});let r=new URLSearchParams;r.set("state",s||"opened"),r.set("per_page",String(m||30)),r.set("order_by",l||"updated_at"),r.set("sort",u||"desc"),e&&r.set("labels",Array.isArray(e)?e.join(","):e),i&&r.set("assignee_username",i),n&&r.set("author_username",n),c&&r.set("updated_after",c),a&&r.set("search",a);let f=await h(`/projects/${g(t)}/issues?${r.toString()}`),_=(Array.isArray(f)?f:[]).map(d=>({iid:d.iid,title:d.title,state:d.state,labels:Array.isArray(d.labels)?d.labels:[],author:d.author?.username,assignees:(d.assignees||[]).map(y=>y.username),userNotesCount:d.user_notes_count,webUrl:d.web_url,createdAt:d.created_at,updatedAt:d.updated_at}));return JSON.stringify({count:_.length,issues:_})}case"gitlab_get_issue":{let{projectId:t,iid:s}=o||{};if(!t||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(t)}/issues/${s}`);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(i=>i.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:t,iid:s,body:e}=o||{};if(!t||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let i=await h(`/projects/${g(t)}/issues/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:i.id,createdAt:i.created_at})}default:return JSON.stringify({error:`Unknown tool: ${p}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"gitlab_list_projects",description:"List the GitLab projects this token can access (the projects you are a member of), optionally filtered by a search query. Use this to discover a RELATED project worth cloning when a change's correctness depends on another accessible repo. Returns a normalized list of { fullPath, name, webUrl, defaultBranch, visibility } and a truncated flag.",input_schema:{type:"object",properties:{query:{type:"string",description:"Optional search term matched against project name/path"},limit:{type:"number",description:"Max projects (default 50, hard max 200)"}}}},{name:"gitlab_clone",description:"Clone a GitLab repository locally (shallow) so you can read code OUTSIDE the MR diff \u2014 callers of a changed symbol, shared types/contracts, an existing util, or a cross-repo dependency. Auto-authenticates with the connected GitLab token. After cloning, use Grep/Glob/Read on the returned path. Clone SPARINGLY \u2014 only when the change's correctness depends on code beyond the diff.",input_schema:{type:"object",properties:{projectPath:{type:"string",description:'Full project path, e.g. "group/subgroup/repo" (preferred).'},projectId:{type:"string",description:"Alternatively a numeric project id (resolved to its path via the API)."},branch:{type:"string",description:"Branch to clone (default: the repo default branch)."},destination:{type:"string",description:"Destination dir (default: <workspace>/.zibby/repos/<repo>)."}}}},{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_get_discussion",description:"Read a single GitLab merge-request DISCUSSION (thread) by its discussion id: all notes in order plus the diff position (file + line) it is anchored to. Use this to understand a human's reply to a previous review discussion before replying in-thread.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},discussionId:{type:"string",description:"The discussion id (from the Note Hook payload or gitlab_list_mr_notes)"}},required:["projectId","iid","discussionId"]}},{name:"gitlab_reply_discussion",description:"Reply IN-THREAD to an existing GitLab merge-request discussion (a conversational reply appended to the SAME thread \u2014 NOT a fresh review). Use after gitlab_get_discussion to answer a human's reply to a review comment.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"Project numeric id OR full path"},iid:{type:"number",description:"Merge request iid"},discussionId:{type:"string",description:"The discussion id to reply to"},body:{type:"string",description:"The reply text (markdown)"}},required:["projectId","iid","discussionId","body"]}},{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{J as gitlabSkill,h as glFetch};