@zibby/skills 0.1.87 → 0.1.89

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
@@ -64,6 +64,14 @@ export namespace gitlabSkill {
64
64
  squash?: undefined;
65
65
  mergeCommitMessage?: undefined;
66
66
  mergeWhenPipelineSucceeds?: undefined;
67
+ since?: undefined;
68
+ until?: undefined;
69
+ refName?: undefined;
70
+ page?: undefined;
71
+ perPage?: undefined;
72
+ withStats?: undefined;
73
+ sha?: undefined;
74
+ includeDiff?: undefined;
67
75
  state?: undefined;
68
76
  targetBranch?: undefined;
69
77
  sourceBranch?: undefined;
@@ -118,6 +126,14 @@ export namespace gitlabSkill {
118
126
  squash?: undefined;
119
127
  mergeCommitMessage?: undefined;
120
128
  mergeWhenPipelineSucceeds?: undefined;
129
+ since?: undefined;
130
+ until?: undefined;
131
+ refName?: undefined;
132
+ page?: undefined;
133
+ perPage?: undefined;
134
+ withStats?: undefined;
135
+ sha?: undefined;
136
+ includeDiff?: undefined;
121
137
  state?: undefined;
122
138
  targetBranch?: undefined;
123
139
  sourceBranch?: undefined;
@@ -175,6 +191,14 @@ export namespace gitlabSkill {
175
191
  squash?: undefined;
176
192
  mergeCommitMessage?: undefined;
177
193
  mergeWhenPipelineSucceeds?: undefined;
194
+ since?: undefined;
195
+ until?: undefined;
196
+ refName?: undefined;
197
+ page?: undefined;
198
+ perPage?: undefined;
199
+ withStats?: undefined;
200
+ sha?: undefined;
201
+ includeDiff?: undefined;
178
202
  state?: undefined;
179
203
  targetBranch?: undefined;
180
204
  sourceBranch?: undefined;
@@ -232,6 +256,14 @@ export namespace gitlabSkill {
232
256
  target_branch?: undefined;
233
257
  title?: undefined;
234
258
  description?: undefined;
259
+ since?: undefined;
260
+ until?: undefined;
261
+ refName?: undefined;
262
+ page?: undefined;
263
+ perPage?: undefined;
264
+ withStats?: undefined;
265
+ sha?: undefined;
266
+ includeDiff?: undefined;
235
267
  state?: undefined;
236
268
  targetBranch?: undefined;
237
269
  sourceBranch?: undefined;
@@ -280,6 +312,144 @@ export namespace gitlabSkill {
280
312
  squash?: undefined;
281
313
  mergeCommitMessage?: undefined;
282
314
  mergeWhenPipelineSucceeds?: undefined;
315
+ since?: undefined;
316
+ until?: undefined;
317
+ refName?: undefined;
318
+ page?: undefined;
319
+ perPage?: undefined;
320
+ withStats?: undefined;
321
+ sha?: undefined;
322
+ includeDiff?: undefined;
323
+ state?: undefined;
324
+ targetBranch?: undefined;
325
+ sourceBranch?: undefined;
326
+ authorUsername?: undefined;
327
+ labels?: undefined;
328
+ search?: undefined;
329
+ orderBy?: undefined;
330
+ sort?: undefined;
331
+ body?: undefined;
332
+ path?: undefined;
333
+ oldPath?: undefined;
334
+ newLine?: undefined;
335
+ oldLine?: undefined;
336
+ diffRefs?: undefined;
337
+ comments?: undefined;
338
+ discussionId?: undefined;
339
+ assigneeUsername?: undefined;
340
+ updatedAfter?: undefined;
341
+ };
342
+ required: string[];
343
+ };
344
+ } | {
345
+ name: string;
346
+ description: string;
347
+ input_schema: {
348
+ type: string;
349
+ properties: {
350
+ projectId: {
351
+ type: string;
352
+ description: string;
353
+ };
354
+ since: {
355
+ type: string;
356
+ description: string;
357
+ };
358
+ until: {
359
+ type: string;
360
+ description: string;
361
+ };
362
+ refName: {
363
+ type: string;
364
+ description: string;
365
+ };
366
+ page: {
367
+ type: string;
368
+ description: string;
369
+ };
370
+ perPage: {
371
+ type: string;
372
+ description: string;
373
+ };
374
+ withStats: {
375
+ type: string;
376
+ description: string;
377
+ };
378
+ query?: undefined;
379
+ limit?: undefined;
380
+ projectPath?: undefined;
381
+ branch?: undefined;
382
+ destination?: undefined;
383
+ project?: undefined;
384
+ source_branch?: undefined;
385
+ target_branch?: undefined;
386
+ title?: undefined;
387
+ description?: undefined;
388
+ iid?: undefined;
389
+ squash?: undefined;
390
+ mergeCommitMessage?: undefined;
391
+ mergeWhenPipelineSucceeds?: undefined;
392
+ sha?: undefined;
393
+ includeDiff?: undefined;
394
+ state?: undefined;
395
+ targetBranch?: undefined;
396
+ sourceBranch?: undefined;
397
+ authorUsername?: undefined;
398
+ labels?: undefined;
399
+ search?: undefined;
400
+ orderBy?: undefined;
401
+ sort?: undefined;
402
+ body?: undefined;
403
+ path?: undefined;
404
+ oldPath?: undefined;
405
+ newLine?: undefined;
406
+ oldLine?: undefined;
407
+ diffRefs?: undefined;
408
+ comments?: undefined;
409
+ discussionId?: undefined;
410
+ assigneeUsername?: undefined;
411
+ updatedAfter?: undefined;
412
+ };
413
+ required: string[];
414
+ };
415
+ } | {
416
+ name: string;
417
+ description: string;
418
+ input_schema: {
419
+ type: string;
420
+ properties: {
421
+ projectId: {
422
+ type: string;
423
+ description: string;
424
+ };
425
+ sha: {
426
+ type: string;
427
+ description: string;
428
+ };
429
+ includeDiff: {
430
+ type: string;
431
+ description: string;
432
+ };
433
+ query?: undefined;
434
+ limit?: undefined;
435
+ projectPath?: undefined;
436
+ branch?: undefined;
437
+ destination?: undefined;
438
+ project?: undefined;
439
+ source_branch?: undefined;
440
+ target_branch?: undefined;
441
+ title?: undefined;
442
+ description?: undefined;
443
+ iid?: undefined;
444
+ squash?: undefined;
445
+ mergeCommitMessage?: undefined;
446
+ mergeWhenPipelineSucceeds?: undefined;
447
+ since?: undefined;
448
+ until?: undefined;
449
+ refName?: undefined;
450
+ page?: undefined;
451
+ perPage?: undefined;
452
+ withStats?: undefined;
283
453
  state?: undefined;
284
454
  targetBranch?: undefined;
285
455
  sourceBranch?: undefined;
@@ -366,6 +536,14 @@ export namespace gitlabSkill {
366
536
  squash?: undefined;
367
537
  mergeCommitMessage?: undefined;
368
538
  mergeWhenPipelineSucceeds?: undefined;
539
+ since?: undefined;
540
+ until?: undefined;
541
+ refName?: undefined;
542
+ page?: undefined;
543
+ perPage?: undefined;
544
+ withStats?: undefined;
545
+ sha?: undefined;
546
+ includeDiff?: undefined;
369
547
  body?: undefined;
370
548
  path?: undefined;
371
549
  oldPath?: undefined;
@@ -409,6 +587,14 @@ export namespace gitlabSkill {
409
587
  squash?: undefined;
410
588
  mergeCommitMessage?: undefined;
411
589
  mergeWhenPipelineSucceeds?: undefined;
590
+ since?: undefined;
591
+ until?: undefined;
592
+ refName?: undefined;
593
+ page?: undefined;
594
+ perPage?: undefined;
595
+ withStats?: undefined;
596
+ sha?: undefined;
597
+ includeDiff?: undefined;
412
598
  state?: undefined;
413
599
  targetBranch?: undefined;
414
600
  sourceBranch?: undefined;
@@ -461,6 +647,14 @@ export namespace gitlabSkill {
461
647
  squash?: undefined;
462
648
  mergeCommitMessage?: undefined;
463
649
  mergeWhenPipelineSucceeds?: undefined;
650
+ since?: undefined;
651
+ until?: undefined;
652
+ refName?: undefined;
653
+ page?: undefined;
654
+ perPage?: undefined;
655
+ withStats?: undefined;
656
+ sha?: undefined;
657
+ includeDiff?: undefined;
464
658
  state?: undefined;
465
659
  targetBranch?: undefined;
466
660
  sourceBranch?: undefined;
@@ -532,6 +726,14 @@ export namespace gitlabSkill {
532
726
  squash?: undefined;
533
727
  mergeCommitMessage?: undefined;
534
728
  mergeWhenPipelineSucceeds?: undefined;
729
+ since?: undefined;
730
+ until?: undefined;
731
+ refName?: undefined;
732
+ page?: undefined;
733
+ perPage?: undefined;
734
+ withStats?: undefined;
735
+ sha?: undefined;
736
+ includeDiff?: undefined;
535
737
  state?: undefined;
536
738
  targetBranch?: undefined;
537
739
  sourceBranch?: undefined;
@@ -612,6 +814,14 @@ export namespace gitlabSkill {
612
814
  squash?: undefined;
613
815
  mergeCommitMessage?: undefined;
614
816
  mergeWhenPipelineSucceeds?: undefined;
817
+ since?: undefined;
818
+ until?: undefined;
819
+ refName?: undefined;
820
+ page?: undefined;
821
+ perPage?: undefined;
822
+ withStats?: undefined;
823
+ sha?: undefined;
824
+ includeDiff?: undefined;
615
825
  state?: undefined;
616
826
  targetBranch?: undefined;
617
827
  sourceBranch?: undefined;
@@ -661,6 +871,14 @@ export namespace gitlabSkill {
661
871
  squash?: undefined;
662
872
  mergeCommitMessage?: undefined;
663
873
  mergeWhenPipelineSucceeds?: undefined;
874
+ since?: undefined;
875
+ until?: undefined;
876
+ refName?: undefined;
877
+ page?: undefined;
878
+ perPage?: undefined;
879
+ withStats?: undefined;
880
+ sha?: undefined;
881
+ includeDiff?: undefined;
664
882
  state?: undefined;
665
883
  targetBranch?: undefined;
666
884
  sourceBranch?: undefined;
@@ -716,6 +934,14 @@ export namespace gitlabSkill {
716
934
  squash?: undefined;
717
935
  mergeCommitMessage?: undefined;
718
936
  mergeWhenPipelineSucceeds?: undefined;
937
+ since?: undefined;
938
+ until?: undefined;
939
+ refName?: undefined;
940
+ page?: undefined;
941
+ perPage?: undefined;
942
+ withStats?: undefined;
943
+ sha?: undefined;
944
+ includeDiff?: undefined;
719
945
  state?: undefined;
720
946
  targetBranch?: undefined;
721
947
  sourceBranch?: undefined;
@@ -800,6 +1026,14 @@ export namespace gitlabSkill {
800
1026
  squash?: undefined;
801
1027
  mergeCommitMessage?: undefined;
802
1028
  mergeWhenPipelineSucceeds?: undefined;
1029
+ since?: undefined;
1030
+ until?: undefined;
1031
+ refName?: undefined;
1032
+ page?: undefined;
1033
+ perPage?: undefined;
1034
+ withStats?: undefined;
1035
+ sha?: undefined;
1036
+ includeDiff?: undefined;
803
1037
  targetBranch?: undefined;
804
1038
  sourceBranch?: undefined;
805
1039
  body?: undefined;
package/dist/gitlab.js CHANGED
@@ -1,4 +1,4 @@
1
- import{existsSync as O}from"fs";import{fileURLToPath as v}from"url";import{dirname as N,resolve as k}from"path";var S=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",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),q=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"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},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"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});import{spawn as U,execSync as M}from"child_process";import{existsSync as C,mkdirSync as J,readdirSync as D,statSync as F,readFileSync as H}from"fs";import{resolve as W,join as z,basename as Y}from"path";function I(l,s,r,n,e="clone"){try{l(`git -C "${s}" remote set-url origin "${r}"`,{stdio:"pipe"})}catch(i){let t=String(i?.message||i);n&&(t=t.split(n).join("***")),console.error(`[${e}] WARNING: failed to strip token from .git/config: ${t}`)}}function T(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let l=N(v(import.meta.url)),s=k(l,"..","bin","mcp-skill.mjs");return O(s)?s:null}function P(){let l=process.env.GITLAB_API_URL;if(l)return l.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 $(){if(process.env.GITLAB_OAUTH_TOKEN)return{Authorization:`Bearer ${process.env.GITLAB_OAUTH_TOKEN}`};let l=process.env.GITLAB_TOKEN;if(!l)throw new Error("GitLab is not connected: set GITLAB_TOKEN (personal/project access token, api scope) or GITLAB_OAUTH_TOKEN.");return{"PRIVATE-TOKEN":l}}async function h(l,s={}){let r=/^https?:\/\//.test(l)?l:`${P()}${l}`,n={Accept:"application/json","User-Agent":"Zibby-App",...$(),...s.body?{"Content-Type":"application/json"}:{}},e=await fetch(r,{method:s.method||"GET",headers:n,body:s.body?JSON.stringify(s.body):void 0});if(!e.ok){let i=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${i.slice(0,300)}`)}return s.raw?e.text():e.json()}function A(){let l=process.env.GITLAB_API_URL;return(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||(l?l.replace(/\/api\/v\d+\/?$/,""):"")||"https://gitlab.com").trim().replace(/\/+$/,"").replace(/\/api\/v\d+$/,"")}function G(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function g(l){let s=String(l);return/^\d+$/.test(s)?s:encodeURIComponent(s)}var re={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:S.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 R}from"fs";import{fileURLToPath as N}from"url";import{dirname as v,resolve as P}from"path";var I=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",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),q=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"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},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"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});import{spawn as x,execSync as M}from"child_process";import{existsSync as J,mkdirSync as B,readdirSync as D,statSync as F,readFileSync as H}from"fs";import{resolve as W,join as Y,basename as z}from"path";function S(u,n,i,s,e="clone"){try{u(`git -C "${n}" remote set-url origin "${i}"`,{stdio:"pipe"})}catch(t){let r=String(t?.message||t);s&&(r=r.split(s).join("***")),console.error(`[${e}] WARNING: failed to strip token from .git/config: ${r}`)}}function T(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let u=v(N(import.meta.url)),n=P(u,"..","bin","mcp-skill.mjs");return R(n)?n:null}function k(){let u=process.env.GITLAB_API_URL;if(u)return u.replace(/\/+$/,"");let n=(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||"https://gitlab.com").trim().replace(/\/+$/,"");return/\/api\/v\d+$/.test(n)?n:`${n}/api/v4`}function $(){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,n={}){let i=/^https?:\/\//.test(u)?u:`${k()}${u}`,s={Accept:"application/json","User-Agent":"Zibby-App",...$(),...n.body?{"Content-Type":"application/json"}:{}},e=await fetch(i,{method:n.method||"GET",headers:s,body:n.body?JSON.stringify(n.body):void 0});if(!e.ok){let t=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${t.slice(0,300)}`)}return n.raw?e.text():e.json()}function A(){let u=process.env.GITLAB_API_URL;return(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||(u?u.replace(/\/api\/v\d+\/?$/,""):"")||"https://gitlab.com").trim().replace(/\/+$/,"").replace(/\/api\/v\d+$/,"")}function G(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function g(u){let n=String(u);return/^\d+$/.test(n)?n:encodeURIComponent(n)}var re={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:I.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
@@ -24,6 +24,6 @@ You have access to the user's GitLab projects via the REST API (cloud gitlab.com
24
24
 
25
25
  ### Notes
26
26
  - 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.
27
- - 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 l=T();if(!l)return{command:null,args:[],env:{},description:this.description};let s={};for(let r of this.envKeys)process.env[r]&&(s[r]=process.env[r]);return{type:"stdio",command:"node",args:[l,"../dist/gitlab.js","gitlabSkill"],env:s,description:this.description,alwaysLoad:!0}},async handleToolCall(l,s){try{switch(l){case"gitlab_clone":{let{projectPath:r,projectId:n,destination:e,branch:i}=s||{},t=r&&String(r).trim();if(!t&&n!=null&&(/^\d+$/.test(String(n))?t=(await h(`/projects/${g(n)}`))?.path_with_namespace:t=String(n).trim()),!t)return JSON.stringify({error:'projectPath (e.g. "group/repo") or a numeric projectId is required'});let c=G();if(!c)return JSON.stringify({error:"GitLab is not connected (no token to authenticate the clone)."});let{execSync:a}=await import("child_process"),{join:p,resolve:u}=await import("path"),{existsSync:m,mkdirSync:o}=await import("fs"),f=e?u(e):u(process.cwd(),".zibby","repos"),_=t.split("/").filter(Boolean).pop(),d=p(f,_);if(o(f,{recursive:!0}),m(d))return JSON.stringify({success:!0,path:d,message:`Already cloned at ${d}`,alreadyCloned:!0});let y=A().replace(/^https?:\/\//,""),w=A().startsWith("http://")?"http":"https",L=`${w}://oauth2:${c}@${y}/${t}.git`,R=i?`--branch "${String(i).replace(/"/g,"")}" `:"";try{a(`git clone --depth 1 ${R}${L} "${d}"`,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});let b=`${w}://${y}/${t}.git`;I(a,d,b,c,"gitlab_clone");let j=a(`ls -la "${d}"`,{encoding:"utf-8"});return JSON.stringify({success:!0,path:d,message:`Cloned ${t} to ${d}`,contents:j.split(`
27
+ - 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=T();if(!u)return{command:null,args:[],env:{},description:this.description};let n={};for(let i of this.envKeys)process.env[i]&&(n[i]=process.env[i]);return{type:"stdio",command:"node",args:[u,"../dist/gitlab.js","gitlabSkill"],env:n,description:this.description,alwaysLoad:!0}},async handleToolCall(u,n){try{switch(u){case"gitlab_clone":{let{projectPath:i,projectId:s,destination:e,branch:t}=n||{},r=i&&String(i).trim();if(!r&&s!=null&&(/^\d+$/.test(String(s))?r=(await m(`/projects/${g(s)}`))?.path_with_namespace:r=String(s).trim()),!r)return JSON.stringify({error:'projectPath (e.g. "group/repo") or a numeric projectId is required'});let c=G();if(!c)return JSON.stringify({error:"GitLab is not connected (no token to authenticate the clone)."});let{execSync:a}=await import("child_process"),{join:p,resolve:l}=await import("path"),{existsSync:h,mkdirSync:o}=await import("fs"),f=e?l(e):l(process.cwd(),".zibby","repos"),_=r.split("/").filter(Boolean).pop(),d=p(f,_);if(o(f,{recursive:!0}),h(d))return JSON.stringify({success:!0,path:d,message:`Already cloned at ${d}`,alreadyCloned:!0});let y=A().replace(/^https?:\/\//,""),w=A().startsWith("http://")?"http":"https",O=`${w}://oauth2:${c}@${y}/${r}.git`,L=t?`--branch "${String(t).replace(/"/g,"")}" `:"";try{a(`git clone --depth 1 ${L}${O} "${d}"`,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});let b=`${w}://${y}/${r}.git`;S(a,d,b,c,"gitlab_clone");let j=a(`ls -la "${d}"`,{encoding:"utf-8"});return JSON.stringify({success:!0,path:d,message:`Cloned ${r} to ${d}`,contents:j.split(`
28
28
  `).slice(0,30).join(`
29
- `)})}catch(b){let j=String(b.message||b).split(c).join("***").replace(/oauth2:[^@]*@/g,"oauth2:***@");return JSON.stringify({error:`Clone failed: ${j}`})}}case"gitlab_create_mr":{let r=s?.project??s?.projectId,n=s?.source_branch??s?.sourceBranch,{title:e}=s||{};if(!r||!n||!e)return JSON.stringify({error:'project (id or "group/repo" path), source_branch, and title are required'});let i=g(r),t=s?.target_branch??s?.targetBranch;if(!t)try{t=(await h(`/projects/${i}`)).default_branch||"main"}catch{t="main"}let c={source_branch:String(n),target_branch:String(t),title:String(e),description:s?.description?String(s.description):""};try{let a=await h(`/projects/${i}/merge_requests`,{method:"POST",body:c});return JSON.stringify({success:!0,pr_url:a.web_url,number:a.iid,branch:c.source_branch,targetBranch:c.target_branch,project:String(r),provider:"gitlab",state:a.state})}catch(a){let p=String(a.message||a);if(/GitLab API (409|400)/.test(p))return JSON.stringify({success:!1,branch:c.source_branch,targetBranch:c.target_branch,project:String(r),provider:"gitlab",skippedReason:p});throw a}}case"gitlab_accept_mr":{let r=s?.project??s?.projectId,{iid:n}=s||{};if(!r||!n)return JSON.stringify({error:'project (id or "group/repo" path) and iid are required'});let e=g(r),i={};s.squash!=null&&(i.squash=!!s.squash),s.mergeCommitMessage&&(i.merge_commit_message=String(s.mergeCommitMessage)),s.mergeWhenPipelineSucceeds!=null&&(i.merge_when_pipeline_succeeds=!!s.mergeWhenPipelineSucceeds);try{let t=await h(`/projects/${e}/merge_requests/${n}/merge`,{method:"PUT",body:i});return JSON.stringify({success:!0,merged:!0,sha:t.merge_commit_sha??t.sha??null,iid:t.iid??n,project:String(r),provider:"gitlab",state:t.state})}catch(t){let c=String(t.message||t);if(/GitLab API (405|406|404)/.test(c))return JSON.stringify({success:!1,iid:n,project:String(r),provider:"gitlab",skippedReason:c});throw t}}case"gitlab_get_mr":{let{projectId:r,iid:n}=s||{};if(!r||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(r)}/merge_requests/${n}`);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:n}=s||{};if(!r||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(r)}/merge_requests/${n}/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(t=>({oldPath:t.old_path,newPath:t.new_path,newFile:!!t.new_file,deletedFile:!!t.deleted_file,renamedFile:!!t.renamed_file,diff:typeof t.diff=="string"?t.diff.slice(0,3e3):""}))})}case"gitlab_list_mrs":{let{projectId:r,state:n,targetBranch:e,sourceBranch:i,authorUsername:t,labels:c,search:a,sort:p,orderBy:u,limit:m}=s||{};if(!r)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(m||20)),o.set("order_by",u||"updated_at"),o.set("sort",p||"desc"),e&&o.set("target_branch",e),i&&o.set("source_branch",i),t&&o.set("author_username",t),c&&o.set("labels",Array.isArray(c)?c.join(","):c),a&&o.set("search",a);let f=await h(`/projects/${g(r)}/merge_requests?${o.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:r,iid:n,limit:e}=s||{};if(!r||!n)return JSON.stringify({error:"projectId and iid are required"});let i=await h(`/projects/${g(r)}/merge_requests/${n}/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(t=>({id:t.id,author:t.author?.username,body:(t.body||"").slice(0,1e3),system:!!t.system,createdAt:t.created_at}))})}case"gitlab_post_mr_note":{let{projectId:r,iid:n,body:e}=s||{};if(!r||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let i=await h(`/projects/${g(r)}/merge_requests/${n}/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:r,iid:n,path:e,oldPath:i,newLine:t,oldLine:c,body:a}=s||{};if(!r||!n||!e||!a)return JSON.stringify({error:"projectId, iid, path, and body are required"});if(t==null&&c==null)return JSON.stringify({error:"newLine (added/changed line) or oldLine (removed/context line) is required to anchor an inline comment"});let p=g(r),u=s.diffRefs||null;if(u||(u=(await h(`/projects/${p}/merge_requests/${n}`)).diff_refs||null),!u||!u.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:u.base_sha,start_sha:u.start_sha,head_sha:u.head_sha,position_type:"text",new_path:e,old_path:i||e};t!=null&&(m.new_line=Number(t)),c!=null&&(m.old_line=Number(c));try{let o=await h(`/projects/${p}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(a),position:m}});return JSON.stringify({ok:!0,discussionId:o.id})}catch(o){return JSON.stringify({ok:!1,error:`inline anchor rejected (${o.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:n,body:e,comments:i}=s||{};if(!r||!n)return JSON.stringify({error:"projectId and iid are required"});let t=g(r),c=Array.isArray(i)?i.filter(o=>o&&o.path&&o.body&&(o.newLine!=null||o.oldLine!=null)):[];if(!e&&c.length===0)return JSON.stringify({error:"a review needs a body and/or inline comments"});let a=s.diffRefs||null;c.length>0&&!a&&(a=(await h(`/projects/${t}/merge_requests/${n}`)).diff_refs||null);let p=!1;e&&(await h(`/projects/${t}/merge_requests/${n}/notes`,{method:"POST",body:{body:String(e)}}),p=!0);let u=0,m=[];if(c.length>0&&a)for(let o of c){let f={base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha,position_type:"text",new_path:o.path,old_path:o.oldPath||o.path};o.newLine!=null&&(f.new_line=Number(o.newLine)),o.oldLine!=null&&(f.old_line=Number(o.oldLine));try{await h(`/projects/${t}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(o.body),position:f}}),u+=1}catch(_){m.push(`${o.path}:${o.newLine??o.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:p,inlinePosted:u,inlineErrors:m.length?m:void 0})}case"gitlab_get_discussion":{let{projectId:r,iid:n,discussionId:e}=s||{};if(!r||!n||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let i=await h(`/projects/${g(r)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}`),t=Array.isArray(i.notes)?i.notes:[],c=t.find(p=>p.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:t.map(p=>({id:p.id,author:p.author?.username,body:(p.body||"").slice(0,4e3),system:!!p.system,createdAt:p.created_at}))})}case"gitlab_reply_discussion":{let{projectId:r,iid:n,discussionId:e,body:i}=s||{};if(!r||!n||!e||!i)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let t=await h(`/projects/${g(r)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(i)}});return JSON.stringify({ok:!0,id:t.id,createdAt:t.created_at})}case"gitlab_list_projects":{let{query:r,limit:n}=s||{},e=Math.min(Number(n)>0?Number(n):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))),r&&i.set("search",String(r));let t=await h(`/projects?${i.toString()}`),c=Array.isArray(t)?t:[],a=c.length>e,p=c.slice(0,e).map(u=>({fullPath:u.path_with_namespace,name:u.name,webUrl:u.web_url,defaultBranch:u.default_branch||null,visibility:u.visibility||null}));return JSON.stringify({count:p.length,truncated:a,projects:p})}case"gitlab_list_issues":{let{projectId:r,state:n,labels:e,assigneeUsername:i,authorUsername:t,updatedAfter:c,search:a,sort:p,orderBy:u,limit:m}=s||{};if(!r)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(m||30)),o.set("order_by",u||"updated_at"),o.set("sort",p||"desc"),e&&o.set("labels",Array.isArray(e)?e.join(","):e),i&&o.set("assignee_username",i),t&&o.set("author_username",t),c&&o.set("updated_after",c),a&&o.set("search",a);let f=await h(`/projects/${g(r)}/issues?${o.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:r,iid:n}=s||{};if(!r||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${g(r)}/issues/${n}`);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:r,iid:n,body:e}=s||{};if(!r||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let i=await h(`/projects/${g(r)}/issues/${n}/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: ${l}`})}}catch(r){return JSON.stringify({error:r.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_create_mr",description:"Open a merge request on GitLab (POST /projects/{id}/merge_requests). The source_branch must already be pushed. Returns the REAL pr_url (the MR web_url) from GitLab \u2014 never fabricate it. Expected business outcomes (no changes between branches, an MR already exists, source==target) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{project:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},source_branch:{type:"string",description:"Source branch to merge FROM (must already be pushed)"},target_branch:{type:"string",description:"Target branch to merge INTO (default: the project's default branch)"},title:{type:"string",description:"MR title"},description:{type:"string",description:"MR description (markdown)"}},required:["project","source_branch","title"]}},{name:"gitlab_accept_mr",description:"Accept (merge) a merge request on GitLab (PUT /projects/{id}/merge_requests/{iid}/merge). Optional squash, mergeCommitMessage, mergeWhenPipelineSucceeds. Returns { success:true, merged:true, sha } with the REAL merge_commit_sha from GitLab. Expected non-mergeable outcomes (405/406 = not mergeable / WIP / conflicts / pipeline not done, 404 = not found) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{project:{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)"},squash:{type:"boolean",description:"Squash the MR commits into one on merge (optional)"},mergeCommitMessage:{type:"string",description:"Custom merge commit message (optional)"},mergeWhenPipelineSucceeds:{type:"boolean",description:"Merge automatically once the pipeline succeeds (optional)"}},required:["project","iid"]}},{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{re as gitlabSkill,h as glFetch};
29
+ `)})}catch(b){let j=String(b.message||b).split(c).join("***").replace(/oauth2:[^@]*@/g,"oauth2:***@");return JSON.stringify({error:`Clone failed: ${j}`})}}case"gitlab_create_mr":{let i=n?.project??n?.projectId,s=n?.source_branch??n?.sourceBranch,{title:e}=n||{};if(!i||!s||!e)return JSON.stringify({error:'project (id or "group/repo" path), source_branch, and title are required'});let t=g(i),r=n?.target_branch??n?.targetBranch;if(!r)try{r=(await m(`/projects/${t}`)).default_branch||"main"}catch{r="main"}let c={source_branch:String(s),target_branch:String(r),title:String(e),description:n?.description?String(n.description):""};try{let a=await m(`/projects/${t}/merge_requests`,{method:"POST",body:c});return JSON.stringify({success:!0,pr_url:a.web_url,number:a.iid,branch:c.source_branch,targetBranch:c.target_branch,project:String(i),provider:"gitlab",state:a.state})}catch(a){let p=String(a.message||a);if(/GitLab API (409|400)/.test(p))return JSON.stringify({success:!1,branch:c.source_branch,targetBranch:c.target_branch,project:String(i),provider:"gitlab",skippedReason:p});throw a}}case"gitlab_accept_mr":{let i=n?.project??n?.projectId,{iid:s}=n||{};if(!i||!s)return JSON.stringify({error:'project (id or "group/repo" path) and iid are required'});let e=g(i),t={};n.squash!=null&&(t.squash=!!n.squash),n.mergeCommitMessage&&(t.merge_commit_message=String(n.mergeCommitMessage)),n.mergeWhenPipelineSucceeds!=null&&(t.merge_when_pipeline_succeeds=!!n.mergeWhenPipelineSucceeds);try{let r=await m(`/projects/${e}/merge_requests/${s}/merge`,{method:"PUT",body:t});return JSON.stringify({success:!0,merged:!0,sha:r.merge_commit_sha??r.sha??null,iid:r.iid??s,project:String(i),provider:"gitlab",state:r.state})}catch(r){let c=String(r.message||r);if(/GitLab API (405|406|404)/.test(c))return JSON.stringify({success:!1,iid:s,project:String(i),provider:"gitlab",skippedReason:c});throw r}}case"gitlab_get_mr":{let{projectId:i,iid:s}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(i)}/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:i,iid:s}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(i)}/merge_requests/${s}/changes`),t=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:t.length,diffRefs:e.diff_refs||null,files:t.map(r=>({oldPath:r.old_path,newPath:r.new_path,newFile:!!r.new_file,deletedFile:!!r.deleted_file,renamedFile:!!r.renamed_file,diff:typeof r.diff=="string"?r.diff.slice(0,3e3):""}))})}case"gitlab_list_commits":{let{projectId:i,since:s,until:e,refName:t,page:r,perPage:c,withStats:a}=n||{};if(!i)return JSON.stringify({error:"projectId is required"});let p=new URLSearchParams;p.set("per_page",String(Math.min(Number(c)||50,100))),p.set("page",String(Number(r)||1)),s&&p.set("since",s),e&&p.set("until",e),t&&p.set("ref_name",t),a!==!1&&p.set("with_stats","true");let l=await m(`/projects/${g(i)}/repository/commits?${p.toString()}`),h=(Array.isArray(l)?l:[]).map(o=>({id:o.id,shortId:o.short_id,title:o.title,authorName:o.author_name,authorEmail:o.author_email,authoredDate:o.authored_date,committedDate:o.committed_date,parentIds:Array.isArray(o.parent_ids)?o.parent_ids:[],stats:o.stats||null}));return JSON.stringify({page:Number(r)||1,count:h.length,hasMore:h.length>=Math.min(Number(c)||50,100),commits:h})}case"gitlab_get_commit":{let{projectId:i,sha:s,includeDiff:e}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and sha are required"});let t=await m(`/projects/${g(i)}/repository/commits/${encodeURIComponent(s)}`),r;if(e!==!1){let c=await m(`/projects/${g(i)}/repository/commits/${encodeURIComponent(s)}/diff`);r=(Array.isArray(c)?c:[]).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):""}))}return JSON.stringify({id:t.id,shortId:t.short_id,title:t.title,message:typeof t.message=="string"?t.message.slice(0,2e3):"",authorName:t.author_name,authorEmail:t.author_email,authoredDate:t.authored_date,committedDate:t.committed_date,parentIds:Array.isArray(t.parent_ids)?t.parent_ids:[],stats:t.stats||null,webUrl:t.web_url,...r?{filesChanged:r.length,files:r}:{}})}case"gitlab_list_mrs":{let{projectId:i,state:s,targetBranch:e,sourceBranch:t,authorUsername:r,labels:c,search:a,sort:p,orderBy:l,limit:h}=n||{};if(!i)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",s||"opened"),o.set("per_page",String(h||20)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("target_branch",e),t&&o.set("source_branch",t),r&&o.set("author_username",r),c&&o.set("labels",Array.isArray(c)?c.join(","):c),a&&o.set("search",a);let f=await m(`/projects/${g(i)}/merge_requests?${o.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:i,iid:s,limit:e}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and iid are required"});let t=await m(`/projects/${g(i)}/merge_requests/${s}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(t)?t.length:0,notes:(Array.isArray(t)?t:[]).map(r=>({id:r.id,author:r.author?.username,body:(r.body||"").slice(0,1e3),system:!!r.system,createdAt:r.created_at}))})}case"gitlab_post_mr_note":{let{projectId:i,iid:s,body:e}=n||{};if(!i||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let t=await m(`/projects/${g(i)}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:t.id,createdAt:t.created_at})}case"gitlab_post_mr_discussion":{let{projectId:i,iid:s,path:e,oldPath:t,newLine:r,oldLine:c,body:a}=n||{};if(!i||!s||!e||!a)return JSON.stringify({error:"projectId, iid, path, and body are required"});if(r==null&&c==null)return JSON.stringify({error:"newLine (added/changed line) or oldLine (removed/context line) is required to anchor an inline comment"});let p=g(i),l=n.diffRefs||null;if(l||(l=(await m(`/projects/${p}/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 h={base_sha:l.base_sha,start_sha:l.start_sha,head_sha:l.head_sha,position_type:"text",new_path:e,old_path:t||e};r!=null&&(h.new_line=Number(r)),c!=null&&(h.old_line=Number(c));try{let o=await m(`/projects/${p}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(a),position:h}});return JSON.stringify({ok:!0,discussionId:o.id})}catch(o){return JSON.stringify({ok:!1,error:`inline anchor rejected (${o.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:i,iid:s,body:e,comments:t}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and iid are required"});let r=g(i),c=Array.isArray(t)?t.filter(o=>o&&o.path&&o.body&&(o.newLine!=null||o.oldLine!=null)):[];if(!e&&c.length===0)return JSON.stringify({error:"a review needs a body and/or inline comments"});let a=n.diffRefs||null;c.length>0&&!a&&(a=(await m(`/projects/${r}/merge_requests/${s}`)).diff_refs||null);let p=!1;e&&(await m(`/projects/${r}/merge_requests/${s}/notes`,{method:"POST",body:{body:String(e)}}),p=!0);let l=0,h=[];if(c.length>0&&a)for(let o of c){let f={base_sha:a.base_sha,start_sha:a.start_sha,head_sha:a.head_sha,position_type:"text",new_path:o.path,old_path:o.oldPath||o.path};o.newLine!=null&&(f.new_line=Number(o.newLine)),o.oldLine!=null&&(f.old_line=Number(o.oldLine));try{await m(`/projects/${r}/merge_requests/${s}/discussions`,{method:"POST",body:{body:String(o.body),position:f}}),l+=1}catch(_){h.push(`${o.path}:${o.newLine??o.oldLine} \u2014 ${_.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:p,inlinePosted:l,inlineErrors:h.length?h:void 0})}case"gitlab_get_discussion":{let{projectId:i,iid:s,discussionId:e}=n||{};if(!i||!s||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let t=await m(`/projects/${g(i)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}`),r=Array.isArray(t.notes)?t.notes:[],c=r.find(p=>p.position)||null,a=c?c.position:null;return JSON.stringify({discussionId:t.id,individualNote:!!t.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:r.map(p=>({id:p.id,author:p.author?.username,body:(p.body||"").slice(0,4e3),system:!!p.system,createdAt:p.created_at}))})}case"gitlab_reply_discussion":{let{projectId:i,iid:s,discussionId:e,body:t}=n||{};if(!i||!s||!e||!t)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let r=await m(`/projects/${g(i)}/merge_requests/${s}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(t)}});return JSON.stringify({ok:!0,id:r.id,createdAt:r.created_at})}case"gitlab_list_projects":{let{query:i,limit:s}=n||{},e=Math.min(Number(s)>0?Number(s):50,200),t=new URLSearchParams;t.set("membership","true"),t.set("simple","true"),t.set("order_by","last_activity_at"),t.set("sort","desc"),t.set("per_page",String(Math.min(e+1,100))),i&&t.set("search",String(i));let r=await m(`/projects?${t.toString()}`),c=Array.isArray(r)?r:[],a=c.length>e,p=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:p.length,truncated:a,projects:p})}case"gitlab_list_issues":{let{projectId:i,state:s,labels:e,assigneeUsername:t,authorUsername:r,updatedAfter:c,search:a,sort:p,orderBy:l,limit:h}=n||{};if(!i)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",s||"opened"),o.set("per_page",String(h||30)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("labels",Array.isArray(e)?e.join(","):e),t&&o.set("assignee_username",t),r&&o.set("author_username",r),c&&o.set("updated_after",c),a&&o.set("search",a);let f=await m(`/projects/${g(i)}/issues?${o.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:i,iid:s}=n||{};if(!i||!s)return JSON.stringify({error:"projectId and iid are required"});let e=await m(`/projects/${g(i)}/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(t=>t.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:i,iid:s,body:e}=n||{};if(!i||!s||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let t=await m(`/projects/${g(i)}/issues/${s}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:t.id,createdAt:t.created_at})}default:return JSON.stringify({error:`Unknown tool: ${u}`})}}catch(i){return JSON.stringify({error:i.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_create_mr",description:"Open a merge request on GitLab (POST /projects/{id}/merge_requests). The source_branch must already be pushed. Returns the REAL pr_url (the MR web_url) from GitLab \u2014 never fabricate it. Expected business outcomes (no changes between branches, an MR already exists, source==target) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{project:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},source_branch:{type:"string",description:"Source branch to merge FROM (must already be pushed)"},target_branch:{type:"string",description:"Target branch to merge INTO (default: the project's default branch)"},title:{type:"string",description:"MR title"},description:{type:"string",description:"MR description (markdown)"}},required:["project","source_branch","title"]}},{name:"gitlab_accept_mr",description:"Accept (merge) a merge request on GitLab (PUT /projects/{id}/merge_requests/{iid}/merge). Optional squash, mergeCommitMessage, mergeWhenPipelineSucceeds. Returns { success:true, merged:true, sha } with the REAL merge_commit_sha from GitLab. Expected non-mergeable outcomes (405/406 = not mergeable / WIP / conflicts / pipeline not done, 404 = not found) return { success:false, skippedReason } rather than erroring.",input_schema:{type:"object",properties:{project:{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)"},squash:{type:"boolean",description:"Squash the MR commits into one on merge (optional)"},mergeCommitMessage:{type:"string",description:"Custom merge commit message (optional)"},mergeWhenPipelineSucceeds:{type:"boolean",description:"Merge automatically once the pipeline succeeds (optional)"}},required:["project","iid"]}},{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_commits",description:"List a project's repository commits (the commit HISTORY \u2014 not MRs), optionally bounded by since/until ISO dates and a ref/branch, with per-commit stats (additions/deletions). Paginated: keep calling with page+1 while hasMore is true. This is the ONLY correct way to enumerate commits in a date window \u2014 gitlab_clone is shallow (depth 1) and its git log shows just one commit.",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},since:{type:"string",description:'Only commits after this ISO-8601 date/time (inclusive), e.g. "2026-01-01T00:00:00Z"'},until:{type:"string",description:'Only commits before this ISO-8601 date/time, e.g. "2026-07-01T00:00:00Z"'},refName:{type:"string",description:"Branch/tag to list (defaults to the default branch)"},page:{type:"number",description:"Page number, 1-based (default 1)"},perPage:{type:"number",description:"Commits per page, max 100 (default 50)"},withStats:{type:"boolean",description:"Include per-commit additions/deletions stats (default true)"}},required:["projectId"]}},{name:"gitlab_get_commit",description:"Get ONE commit's full detail \u2014 message, author, timestamps, stats, and (by default) its per-file diffs (each capped at 3000 chars) \u2014 so you can judge the nature/complexity of the change. Use after gitlab_list_commits.",input_schema:{type:"object",properties:{projectId:{type:"string",description:'Project numeric id OR full path (e.g. "group/repo")'},sha:{type:"string",description:"The commit sha (full or short)"},includeDiff:{type:"boolean",description:"Include per-file diffs (default true; set false for metadata-only)"}},required:["projectId","sha"]}},{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{re as gitlabSkill,m as glFetch};