@zibby/skills 0.1.80 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-notify.js +1 -1
- package/dist/discord.js +3 -3
- package/dist/figma.d.ts +292 -0
- package/dist/figma.js +21 -8
- package/dist/git-write.js +1 -1
- package/dist/github.js +1 -1
- package/dist/gitlab.js +3 -3
- package/dist/googleDocs.js +5 -5
- package/dist/hubspot.d.ts +381 -0
- package/dist/hubspot.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +165 -152
- package/dist/integrations.d.ts +6 -0
- package/dist/integrations.js +1 -1
- package/dist/jira.js +5 -5
- package/dist/lark.js +1 -1
- package/dist/larkDocs.js +3 -3
- package/dist/linear.js +3 -3
- package/dist/llm-billing.js +1 -1
- package/dist/notion.js +5 -5
- package/dist/opendesign.js +2 -2
- package/dist/package.json +1 -1
- package/dist/plane.js +1 -1
- package/dist/sentry.js +2 -2
- package/dist/slack.js +2 -2
- package/dist/trackers/github-adapter.js +2 -2
- package/dist/trackers/index.js +7 -7
- package/dist/trackers/jira-adapter.js +4 -4
- package/dist/trackers/linear-adapter.js +7 -7
- package/package.json +1 -1
package/dist/gitlab.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as L}from"fs";import{fileURLToPath as R}from"url";import{dirname as O,resolve as N}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",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),k=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"}});function v(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let u=O(R(import.meta.url)),i=N(u,"..","bin","mcp-skill.mjs");return L(i)?i:null}function P(){let u=process.env.GITLAB_API_URL;if(u)return u.replace(/\/+$/,"");let i=(process.env.GITLAB_URL||process.env.GITLAB_INSTANCE_URL||"https://gitlab.com").trim().replace(/\/+$/,"");return/\/api\/v\d+$/.test(i)?i:`${i}/api/v4`}function T(){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 h(u,i={}){let t=/^https?:\/\//.test(u)?u:`${P()}${u}`,n={Accept:"application/json","User-Agent":"Zibby-App",...T(),...i.body?{"Content-Type":"application/json"}:{}},e=await fetch(t,{method:i.method||"GET",headers:n,body:i.body?JSON.stringify(i.body):void 0});if(!e.ok){let s=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${s.slice(0,300)}`)}return i.raw?e.text():e.json()}function I(){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 q(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function m(u){let i=String(u);return/^\d+$/.test(i)?i:encodeURIComponent(i)}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
|
|
@@ -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 u=v();if(!u)return{command:null,args:[],env:{},description:this.description};let i={};for(let t of this.envKeys)process.env[t]&&(i[t]=process.env[t]);return{type:"stdio",command:"node",args:[u,"../dist/gitlab.js","gitlabSkill"],env:i,description:this.description,alwaysLoad:!0}},async handleToolCall(u,i){try{switch(u){case"gitlab_clone":{let{projectPath:t,projectId:n,destination:e,branch:s}=i||{},r=t&&String(t).trim();if(!r&&n!=null&&(/^\d+$/.test(String(n))?r=(await h(`/projects/${m(n)}`))?.path_with_namespace:r=String(n).trim()),!r)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:p,resolve:l}=await import("path"),{existsSync:g,mkdirSync:o}=await import("fs"),_=e?l(e):l(process.cwd(),".zibby","repos"),b=r.split("/").filter(Boolean).pop(),d=p(_,b);if(o(_,{recursive:!0}),g(d))return JSON.stringify({success:!0,path:d,message:`Already cloned at ${d}`,alreadyCloned:!0});let y=I().replace(/^https?:\/\//,""),w=`${I().startsWith("http://")?"http":"https"}://oauth2:${c}@${y}/${r}.git`,
|
|
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=v();if(!u)return{command:null,args:[],env:{},description:this.description};let i={};for(let t of this.envKeys)process.env[t]&&(i[t]=process.env[t]);return{type:"stdio",command:"node",args:[u,"../dist/gitlab.js","gitlabSkill"],env:i,description:this.description,alwaysLoad:!0}},async handleToolCall(u,i){try{switch(u){case"gitlab_clone":{let{projectPath:t,projectId:n,destination:e,branch:s}=i||{},r=t&&String(t).trim();if(!r&&n!=null&&(/^\d+$/.test(String(n))?r=(await h(`/projects/${m(n)}`))?.path_with_namespace:r=String(n).trim()),!r)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:p,resolve:l}=await import("path"),{existsSync:g,mkdirSync:o}=await import("fs"),_=e?l(e):l(process.cwd(),".zibby","repos"),b=r.split("/").filter(Boolean).pop(),d=p(_,b);if(o(_,{recursive:!0}),g(d))return JSON.stringify({success:!0,path:d,message:`Already cloned at ${d}`,alreadyCloned:!0});let y=I().replace(/^https?:\/\//,""),w=`${I().startsWith("http://")?"http":"https"}://oauth2:${c}@${y}/${r}.git`,S=s?`--branch "${String(s).replace(/"/g,"")}" `:"";try{a(`git clone --depth 1 ${S}${w} "${d}"`,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});let f=a(`ls -la "${d}"`,{encoding:"utf-8"});return JSON.stringify({success:!0,path:d,message:`Cloned ${r} to ${d}`,contents:f.split(`
|
|
28
28
|
`).slice(0,30).join(`
|
|
29
|
-
`)})}catch(f){let L=String(f.message||f).split(c).join("***");return JSON.stringify({error:`Clone failed: ${L}`})}}case"gitlab_create_mr":{let t=i?.project??i?.projectId,n=i?.source_branch??i?.sourceBranch,{title:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:'project (id or "group/repo" path), source_branch, and title are required'});let s=m(t),r=i?.target_branch??i?.targetBranch;if(!r)try{r=(await h(`/projects/${s}`)).default_branch||"main"}catch{r="main"}let c={source_branch:String(n),target_branch:String(r),title:String(e),description:i?.description?String(i.description):""};try{let a=await h(`/projects/${s}/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(t),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(t),provider:"gitlab",skippedReason:p});throw a}}case"gitlab_accept_mr":{let t=i?.project??i?.projectId,{iid:n}=i||{};if(!t||!n)return JSON.stringify({error:'project (id or "group/repo" path) and iid are required'});let e=m(t),s={};i.squash!=null&&(s.squash=!!i.squash),i.mergeCommitMessage&&(s.merge_commit_message=String(i.mergeCommitMessage)),i.mergeWhenPipelineSucceeds!=null&&(s.merge_when_pipeline_succeeds=!!i.mergeWhenPipelineSucceeds);try{let r=await h(`/projects/${e}/merge_requests/${n}/merge`,{method:"PUT",body:s});return JSON.stringify({success:!0,merged:!0,sha:r.merge_commit_sha??r.sha??null,iid:r.iid??n,project:String(t),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:n,project:String(t),provider:"gitlab",skippedReason:c});throw r}}case"gitlab_get_mr":{let{projectId:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/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:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/merge_requests/${n}/changes`),s=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:s.length,diffRefs:e.diff_refs||null,files:s.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_mrs":{let{projectId:t,state:n,targetBranch:e,sourceBranch:s,authorUsername:r,labels:c,search:a,sort:p,orderBy:l,limit:g}=i||{};if(!t)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(g||20)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("target_branch",e),s&&o.set("source_branch",s),r&&o.set("author_username",r),c&&o.set("labels",Array.isArray(c)?c.join(","):c),a&&o.set("search",a);let _=await h(`/projects/${m(t)}/merge_requests?${o.toString()}`),b=(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:b.length,mergeRequests:b})}case"gitlab_list_mr_notes":{let{projectId:t,iid:n,limit:e}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(s)?s.length:0,notes:(Array.isArray(s)?s:[]).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:t,iid:n,body:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:s.id,createdAt:s.created_at})}case"gitlab_post_mr_discussion":{let{projectId:t,iid:n,path:e,oldPath:s,newLine:r,oldLine:c,body:a}=i||{};if(!t||!n||!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=m(t),l=i.diffRefs||null;if(l||(l=(await h(`/projects/${p}/merge_requests/${n}`)).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 g={base_sha:l.base_sha,start_sha:l.start_sha,head_sha:l.head_sha,position_type:"text",new_path:e,old_path:s||e};r!=null&&(g.new_line=Number(r)),c!=null&&(g.old_line=Number(c));try{let o=await h(`/projects/${p}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(a),position:g}});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:t,iid:n,body:e,comments:s}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let r=m(t),c=Array.isArray(s)?s.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=i.diffRefs||null;c.length>0&&!a&&(a=(await h(`/projects/${r}/merge_requests/${n}`)).diff_refs||null);let p=!1;e&&(await h(`/projects/${r}/merge_requests/${n}/notes`,{method:"POST",body:{body:String(e)}}),p=!0);let l=0,g=[];if(c.length>0&&a)for(let o of c){let _={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&&(_.new_line=Number(o.newLine)),o.oldLine!=null&&(_.old_line=Number(o.oldLine));try{await h(`/projects/${r}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(o.body),position:_}}),l+=1}catch(b){g.push(`${o.path}:${o.newLine??o.oldLine} \u2014 ${b.message}`)}}else c.length>0&&!a&&g.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:g.length?g:void 0})}case"gitlab_get_discussion":{let{projectId:t,iid:n,discussionId:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}`),r=Array.isArray(s.notes)?s.notes:[],c=r.find(p=>p.position)||null,a=c?c.position:null;return JSON.stringify({discussionId:s.id,individualNote:!!s.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:t,iid:n,discussionId:e,body:s}=i||{};if(!t||!n||!e||!s)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let r=await h(`/projects/${m(t)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(s)}});return JSON.stringify({ok:!0,id:r.id,createdAt:r.created_at})}case"gitlab_list_projects":{let{query:t,limit:n}=i||{},e=Math.min(Number(n)>0?Number(n):50,200),s=new URLSearchParams;s.set("membership","true"),s.set("simple","true"),s.set("order_by","last_activity_at"),s.set("sort","desc"),s.set("per_page",String(Math.min(e+1,100))),t&&s.set("search",String(t));let r=await h(`/projects?${s.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:t,state:n,labels:e,assigneeUsername:s,authorUsername:r,updatedAfter:c,search:a,sort:p,orderBy:l,limit:g}=i||{};if(!t)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(g||30)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("labels",Array.isArray(e)?e.join(","):e),s&&o.set("assignee_username",s),r&&o.set("author_username",r),c&&o.set("updated_after",c),a&&o.set("search",a);let _=await h(`/projects/${m(t)}/issues?${o.toString()}`),b=(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:b.length,issues:b})}case"gitlab_get_issue":{let{projectId:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/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(s=>s.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:n,body:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let s=await h(`/projects/${m(t)}/issues/${n}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:s.id,createdAt:s.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_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{J as gitlabSkill,h as glFetch};
|
|
29
|
+
`)})}catch(f){let A=String(f.message||f).split(c).join("***");return JSON.stringify({error:`Clone failed: ${A}`})}}case"gitlab_create_mr":{let t=i?.project??i?.projectId,n=i?.source_branch??i?.sourceBranch,{title:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:'project (id or "group/repo" path), source_branch, and title are required'});let s=m(t),r=i?.target_branch??i?.targetBranch;if(!r)try{r=(await h(`/projects/${s}`)).default_branch||"main"}catch{r="main"}let c={source_branch:String(n),target_branch:String(r),title:String(e),description:i?.description?String(i.description):""};try{let a=await h(`/projects/${s}/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(t),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(t),provider:"gitlab",skippedReason:p});throw a}}case"gitlab_accept_mr":{let t=i?.project??i?.projectId,{iid:n}=i||{};if(!t||!n)return JSON.stringify({error:'project (id or "group/repo" path) and iid are required'});let e=m(t),s={};i.squash!=null&&(s.squash=!!i.squash),i.mergeCommitMessage&&(s.merge_commit_message=String(i.mergeCommitMessage)),i.mergeWhenPipelineSucceeds!=null&&(s.merge_when_pipeline_succeeds=!!i.mergeWhenPipelineSucceeds);try{let r=await h(`/projects/${e}/merge_requests/${n}/merge`,{method:"PUT",body:s});return JSON.stringify({success:!0,merged:!0,sha:r.merge_commit_sha??r.sha??null,iid:r.iid??n,project:String(t),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:n,project:String(t),provider:"gitlab",skippedReason:c});throw r}}case"gitlab_get_mr":{let{projectId:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/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:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/merge_requests/${n}/changes`),s=Array.isArray(e.changes)?e.changes:[];return JSON.stringify({iid:e.iid,total:s.length,diffRefs:e.diff_refs||null,files:s.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_mrs":{let{projectId:t,state:n,targetBranch:e,sourceBranch:s,authorUsername:r,labels:c,search:a,sort:p,orderBy:l,limit:g}=i||{};if(!t)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(g||20)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("target_branch",e),s&&o.set("source_branch",s),r&&o.set("author_username",r),c&&o.set("labels",Array.isArray(c)?c.join(","):c),a&&o.set("search",a);let _=await h(`/projects/${m(t)}/merge_requests?${o.toString()}`),b=(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:b.length,mergeRequests:b})}case"gitlab_list_mr_notes":{let{projectId:t,iid:n,limit:e}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/notes?per_page=${e||50}&sort=asc&order_by=created_at`);return JSON.stringify({total:Array.isArray(s)?s.length:0,notes:(Array.isArray(s)?s:[]).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:t,iid:n,body:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:s.id,createdAt:s.created_at})}case"gitlab_post_mr_discussion":{let{projectId:t,iid:n,path:e,oldPath:s,newLine:r,oldLine:c,body:a}=i||{};if(!t||!n||!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=m(t),l=i.diffRefs||null;if(l||(l=(await h(`/projects/${p}/merge_requests/${n}`)).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 g={base_sha:l.base_sha,start_sha:l.start_sha,head_sha:l.head_sha,position_type:"text",new_path:e,old_path:s||e};r!=null&&(g.new_line=Number(r)),c!=null&&(g.old_line=Number(c));try{let o=await h(`/projects/${p}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(a),position:g}});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:t,iid:n,body:e,comments:s}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let r=m(t),c=Array.isArray(s)?s.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=i.diffRefs||null;c.length>0&&!a&&(a=(await h(`/projects/${r}/merge_requests/${n}`)).diff_refs||null);let p=!1;e&&(await h(`/projects/${r}/merge_requests/${n}/notes`,{method:"POST",body:{body:String(e)}}),p=!0);let l=0,g=[];if(c.length>0&&a)for(let o of c){let _={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&&(_.new_line=Number(o.newLine)),o.oldLine!=null&&(_.old_line=Number(o.oldLine));try{await h(`/projects/${r}/merge_requests/${n}/discussions`,{method:"POST",body:{body:String(o.body),position:_}}),l+=1}catch(b){g.push(`${o.path}:${o.newLine??o.oldLine} \u2014 ${b.message}`)}}else c.length>0&&!a&&g.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:g.length?g:void 0})}case"gitlab_get_discussion":{let{projectId:t,iid:n,discussionId:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and discussionId are required"});let s=await h(`/projects/${m(t)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}`),r=Array.isArray(s.notes)?s.notes:[],c=r.find(p=>p.position)||null,a=c?c.position:null;return JSON.stringify({discussionId:s.id,individualNote:!!s.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:t,iid:n,discussionId:e,body:s}=i||{};if(!t||!n||!e||!s)return JSON.stringify({error:"projectId, iid, discussionId, and body are required"});let r=await h(`/projects/${m(t)}/merge_requests/${n}/discussions/${encodeURIComponent(e)}/notes`,{method:"POST",body:{body:String(s)}});return JSON.stringify({ok:!0,id:r.id,createdAt:r.created_at})}case"gitlab_list_projects":{let{query:t,limit:n}=i||{},e=Math.min(Number(n)>0?Number(n):50,200),s=new URLSearchParams;s.set("membership","true"),s.set("simple","true"),s.set("order_by","last_activity_at"),s.set("sort","desc"),s.set("per_page",String(Math.min(e+1,100))),t&&s.set("search",String(t));let r=await h(`/projects?${s.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:t,state:n,labels:e,assigneeUsername:s,authorUsername:r,updatedAfter:c,search:a,sort:p,orderBy:l,limit:g}=i||{};if(!t)return JSON.stringify({error:"projectId is required"});let o=new URLSearchParams;o.set("state",n||"opened"),o.set("per_page",String(g||30)),o.set("order_by",l||"updated_at"),o.set("sort",p||"desc"),e&&o.set("labels",Array.isArray(e)?e.join(","):e),s&&o.set("assignee_username",s),r&&o.set("author_username",r),c&&o.set("updated_after",c),a&&o.set("search",a);let _=await h(`/projects/${m(t)}/issues?${o.toString()}`),b=(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:b.length,issues:b})}case"gitlab_get_issue":{let{projectId:t,iid:n}=i||{};if(!t||!n)return JSON.stringify({error:"projectId and iid are required"});let e=await h(`/projects/${m(t)}/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(s=>s.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:n,body:e}=i||{};if(!t||!n||!e)return JSON.stringify({error:"projectId, iid, and body are required"});let s=await h(`/projects/${m(t)}/issues/${n}/notes`,{method:"POST",body:{body:String(e)}});return JSON.stringify({ok:!0,id:s.id,createdAt:s.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_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{J as gitlabSkill,h as glFetch};
|
package/dist/googleDocs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{existsSync as E,statSync as P,readFileSync as R}from"fs";import{fileURLToPath as D}from"url";import{basename as L,dirname as G,resolve as B}from"path";import{resolveIntegrationToken as $,clearTokenCache as C}from"@zibby/core/backend-client.js";var x=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",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),X=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"},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"}});function j(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let n=G(D(import.meta.url)),e=B(n,"..","bin","mcp-skill.mjs");return E(e)?e:null}var h="https://docs.googleapis.com/v1",
|
|
1
|
+
import{existsSync as E,statSync as P,readFileSync as R}from"fs";import{fileURLToPath as D}from"url";import{basename as L,dirname as G,resolve as B}from"path";import{resolveIntegrationToken as $,clearTokenCache as C}from"@zibby/core/backend-client.js";var x=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"}),X=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"}});function j(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let n=G(D(import.meta.url)),e=B(n,"..","bin","mcp-skill.mjs");return E(e)?e:null}var h="https://docs.googleapis.com/v1",T="https://www.googleapis.com/drive/v3",U="https://www.googleapis.com/upload/drive/v3",M=5*1024*1024;function q(){let n=String(process.env.ZIBBY_INJECTED_GOOGLE_TOKEN||"").trim();if(!n)return null;let e=String(process.env.ZIBBY_INJECTED_GOOGLE_EMAIL||"").trim();return{token:n,email:e}}function J(){return String(process.env.ZIBBY_SENDER_IS_NON_OWNER||"").trim()==="1"}function F(){return String(process.env.ZIBBY_CHAT_STRICT_PERSONAL||"").trim()==="1"}var Y="You haven't connected your own Google account \u2014 connect it at https://studio.zibby.dev/integrations (Google Docs). For privacy, I can't use anyone else's Google (including the project owner's) on your behalf.",S=2e4,H=25;function k(n){if(!n||typeof n!="string")return null;let e=n.trim(),t=e.match(/\/document\/(?:u\/\d+\/)?d\/([a-zA-Z0-9_-]+)/);return t?t[1]:/^[a-zA-Z0-9_-]{20,}$/.test(e)?e:null}async function z(){let n,e=q();if(e)n=e.token;else{if(F()||J())throw new Error(Y);({token:n}=await $("google"))}if(typeof n!="string"||!n)throw new Error(`Invalid google token type: ${typeof n}`);return n}async function p(n,e={}){let t=async()=>{let i=await z(),o=await fetch(n,{method:e.method||"GET",headers:{Authorization:`Bearer ${i}`,Accept:"application/json",...e.rawBody&&e.contentType?{"Content-Type":e.contentType}:e.body?{"Content-Type":"application/json"}:{},...e.headers},body:e.rawBody?e.rawBody:e.body?JSON.stringify(e.body):void 0});if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`Google API ${o.status}: ${a.slice(0,300)}`)}let r=await o.text().catch(()=>"");if(!r||!r.trim())return{};try{return JSON.parse(r)}catch{return{raw:r}}};try{return await t()}catch(i){let o=String(i?.message||i||"").toLowerCase();if(!(o.includes("token")||o.includes("401")||o.includes("unauthorized")))throw i;return C("google"),t()}}function Z(n){let e=[],t="",i=0;for(;i<n.length;){let o=/^\[([^\]]+)\]\(([^)\s]+)\)/.exec(n.slice(i));if(o){e.push({start:t.length,end:t.length+o[1].length,link:o[2]}),t+=o[1],i+=o[0].length;continue}let r=/^\*\*([^*]+)\*\*/.exec(n.slice(i));if(r){e.push({start:t.length,end:t.length+r[1].length,bold:!0}),t+=r[1],i+=r[0].length;continue}let a=/^`([^`]+)`/.exec(n.slice(i));if(a){e.push({start:t.length,end:t.length+a[1].length,code:!0}),t+=a[1],i+=a[0].length;continue}t+=n[i],i+=1}return{text:t,styles:e}}function N(n,e){let t=String(n??"").replace(/\r\n/g,`
|
|
2
2
|
`);if(!t.trim())return{requests:[],endIndex:e};let i=t.split(`
|
|
3
|
-
`),o="",r=[],a=[];for(let s of i){let c=s,I=null,
|
|
4
|
-
`,r.push({start:
|
|
3
|
+
`),o="",r=[],a=[];for(let s of i){let c=s,I=null,b=null,f=/^(#{1,3})\s+(.*)$/.exec(c),g=/^\s*[-*]\s+(.*)$/.exec(c),m=/^\s*\d+[.)]\s+(.*)$/.exec(c);f?(I=`HEADING_${f[1].length}`,c=f[2]):g?(b="BULLET_DISC_CIRCLE_SQUARE",c=g[1]):m&&(b="NUMBERED_DECIMAL_ALPHA_ROMAN",c=m[1]);let{text:A,styles:v}=Z(c),_=e+o.length;for(let w of v)a.push({...w,start:_+w.start,end:_+w.end});o+=`${A}
|
|
4
|
+
`,r.push({start:_,end:e+o.length,named:I,bullet:b})}if(!o)return{requests:[],endIndex:e};let u=[{insertText:{location:{index:e},text:o}}];for(let s of r)s.named&&u.push({updateParagraphStyle:{range:{startIndex:s.start,endIndex:s.end},paragraphStyle:{namedStyleType:s.named},fields:"namedStyleType"}});let d=null,l=()=>{d&&(u.push({createParagraphBullets:{range:{startIndex:d.start,endIndex:d.end},bulletPreset:d.preset}}),d=null)};for(let s of r)s.bullet?d&&d.preset===s.bullet?d.end=s.end:(l(),d={start:s.start,end:s.end,preset:s.bullet}):l();l();for(let s of a)s.end<=s.start||(s.bold?u.push({updateTextStyle:{range:{startIndex:s.start,endIndex:s.end},textStyle:{bold:!0},fields:"bold"}}):s.link?u.push({updateTextStyle:{range:{startIndex:s.start,endIndex:s.end},textStyle:{link:{url:s.link}},fields:"link"}}):s.code&&u.push({updateTextStyle:{range:{startIndex:s.start,endIndex:s.end},textStyle:{weightedFontFamily:{fontFamily:"Courier New"}},fields:"weightedFontFamily"}}));return{requests:u,endIndex:e+o.length}}function K(n){let e="",t=i=>{for(let o of Array.isArray(i)?i:[]){if(e.length>=S)return;if(o.paragraph)for(let r of o.paragraph.elements||[])e+=r?.textRun?.content||"";else if(o.table)for(let r of o.table.tableRows||[])for(let a of r.tableCells||[])t(a.content);else o.tableOfContents&&t(o.tableOfContents.content)}};return t(n?.content),e.slice(0,S)}var y=n=>`https://docs.google.com/document/d/${n}/edit`;function V(n){let e=typeof n=="string"?n.trim():"";if(!e)throw new Error("imagePath is required");if(!E(e)||!P(e).isFile())throw new Error(`imagePath not found (or not a file): ${e}`);if(!/\.(png|jpe?g)$/i.test(e))throw new Error("imagePath must be a .png or .jpg/.jpeg file");let t=R(e);if(t.length>M)throw new Error(`image is ${(t.length/(1024*1024)).toFixed(1)}MB \u2014 max 5MB (Drive multipart upload cap)`);return{bytes:t,fileName:L(e),mimeType:/\.png$/i.test(e)?"image/png":"image/jpeg"}}function W(n,e,t){let i=`zibby-gdocs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return{rawBody:Buffer.concat([Buffer.from(`--${i}\r
|
|
5
5
|
Content-Type: application/json; charset=UTF-8\r
|
|
6
6
|
\r
|
|
7
7
|
${JSON.stringify(n)}\r
|
|
@@ -18,5 +18,5 @@ Docs access is PER-USER: each teammate connects their OWN Google account (Integr
|
|
|
18
18
|
- gdocs_insert_image: append a LOCAL image file (png/jpg, \u22645MB) to the end of a doc \u2014 pass { documentId, imagePath, width?, height? } (width/height in PT, optional). The image is uploaded to the user's Drive and made link-readable (anyone with the link) so Docs can render it. Returns { ok, documentId, fileId, url }.
|
|
19
19
|
- gdocs_get: read a doc back as plain text (works for app-created/user-picked docs; arbitrary docs need the extended documents.readonly connection).
|
|
20
20
|
- gdocs_list_created: list the Google Docs visible to this app (drive.file \u2192 only docs it created or the user picked).
|
|
21
|
-
These tools return { ok:false, error } on failure \u2014 treat an unavailable Google connection as "cannot deliver to Docs" and report it rather than blocking the task.`,resolve(){let n=j();if(!n)return null;let e={};for(let t of["ZIBBY_INJECTED_GOOGLE_TOKEN","ZIBBY_INJECTED_GOOGLE_EMAIL","ZIBBY_SENDER_IS_NON_OWNER","ZIBBY_CHAT_STRICT_PERSONAL"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n,"../dist/googleDocs.js","googleDocsSkill"],env:e,description:this.description,alwaysLoad:!0}},async handleToolCall(n,e){try{switch(n){case"gdocs_create_doc":{let t=typeof e?.title=="string"&&e.title.trim()?e.title.trim():null;if(!t)return JSON.stringify({ok:!1,error:"title is required"});let o=(await p(`${h}/documents`,{method:"POST",body:{title:t}}))?.documentId;if(!o)return JSON.stringify({ok:!1,error:"Google Docs create returned no documentId"});let r=O(e);if(r&&r.trim()){let{requests:a}=
|
|
22
|
-
`}}),s=d+1);let c=
|
|
21
|
+
These tools return { ok:false, error } on failure \u2014 treat an unavailable Google connection as "cannot deliver to Docs" and report it rather than blocking the task.`,resolve(){let n=j();if(!n)return null;let e={};for(let t of["ZIBBY_INJECTED_GOOGLE_TOKEN","ZIBBY_INJECTED_GOOGLE_EMAIL","ZIBBY_SENDER_IS_NON_OWNER","ZIBBY_CHAT_STRICT_PERSONAL"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n,"../dist/googleDocs.js","googleDocsSkill"],env:e,description:this.description,alwaysLoad:!0}},async handleToolCall(n,e){try{switch(n){case"gdocs_create_doc":{let t=typeof e?.title=="string"&&e.title.trim()?e.title.trim():null;if(!t)return JSON.stringify({ok:!1,error:"title is required"});let o=(await p(`${h}/documents`,{method:"POST",body:{title:t}}))?.documentId;if(!o)return JSON.stringify({ok:!1,error:"Google Docs create returned no documentId"});let r=O(e);if(r&&r.trim()){let{requests:a}=N(r,1);a.length&&await p(`${h}/documents/${o}:batchUpdate`,{method:"POST",body:{requests:a}})}return JSON.stringify({ok:!0,documentId:o,title:t,url:y(o)})}case"gdocs_append":{let t=k(e?.documentId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Google Docs documentId or URL is required"});let i=O(e);if(!i||!i.trim())return JSON.stringify({ok:!1,error:"markdown or text content is required"});let r=(await p(`${h}/documents/${t}`))?.body,a=Array.isArray(r?.content)?r.content:[],u=a.length&&a[a.length-1].endIndex||2,d=Math.max(1,u-1),l=[],s=d;d>1&&(l.push({insertText:{location:{index:d},text:`
|
|
22
|
+
`}}),s=d+1);let c=N(i,s);return l.push(...c.requests),await p(`${h}/documents/${t}:batchUpdate`,{method:"POST",body:{requests:l}}),JSON.stringify({ok:!0,documentId:t,url:y(t)})}case"gdocs_insert_image":{let t=k(e?.documentId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Google Docs documentId or URL is required"});if(!e?.imagePath||typeof e.imagePath!="string"||!e.imagePath.trim())return JSON.stringify({ok:!1,error:"imagePath is required"});let{bytes:i,fileName:o,mimeType:r}=V(e.imagePath),{rawBody:a,contentType:u}=W({name:o,mimeType:r},i,r),l=(await p(`${U}/files?uploadType=multipart&fields=id`,{method:"POST",rawBody:a,contentType:u}))?.id;if(!l)return JSON.stringify({ok:!1,error:"Drive upload returned no file id"});await p(`${T}/files/${l}/permissions`,{method:"POST",body:{role:"reader",type:"anyone"}});let s=await p(`${h}/documents/${t}`),c=Array.isArray(s?.body?.content)?s.body.content:[],I=c.length&&c[c.length-1].endIndex||2,f={location:{index:Math.max(1,I-1)},uri:`https://drive.google.com/uc?export=download&id=${l}`},g=Number(e?.width),m=Number(e?.height);return(Number.isFinite(g)&&g>0||Number.isFinite(m)&&m>0)&&(f.objectSize={...Number.isFinite(g)&&g>0?{width:{magnitude:g,unit:"PT"}}:{},...Number.isFinite(m)&&m>0?{height:{magnitude:m,unit:"PT"}}:{}}),await p(`${h}/documents/${t}:batchUpdate`,{method:"POST",body:{requests:[{insertInlineImage:f}]}}),JSON.stringify({ok:!0,documentId:t,fileId:l,url:y(t)})}case"gdocs_get":{let t=k(e?.documentId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Google Docs documentId or URL is required"});let i=await p(`${h}/documents/${t}`),o=K(i?.body);return JSON.stringify({ok:!0,documentId:t,title:i?.title||"",url:y(t),text:o,...o.length>=S?{truncated:!0}:{}})}case"gdocs_list_created":{let t=new URLSearchParams({q:"'me' in owners and mimeType='application/vnd.google-apps.document' and trashed=false",fields:"files(id,name,modifiedTime,webViewLink)",pageSize:String(H),orderBy:"modifiedTime desc"}),i=await p(`${T}/files?${t.toString()}`),o=(Array.isArray(i?.files)?i.files:[]).map(r=>({documentId:r.id,title:r.name,modifiedTime:r.modifiedTime,url:r.webViewLink||y(r.id)}));return JSON.stringify({ok:!0,count:o.length,files:o})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${n}`})}}catch(t){return JSON.stringify({ok:!1,error:t.message})}},tools:[{name:"gdocs_create_doc",description:"Create a new Google Doc with a title and optional content (markdown: #/##/### headings, - bullets, 1. numbered lists, **bold**, [links](url), `code`; or plain text). Returns { ok, documentId, url } \u2014 share the url with the user.",input_schema:{type:"object",properties:{title:{type:"string",description:"Document title."},markdown:{type:"string",description:"Document body as markdown (preferred)."},text:{type:"string",description:"Document body as plain text (used when markdown is absent)."}},required:["title"]}},{name:"gdocs_append",description:"Append markdown/text content to the END of an existing Google Doc. Only works on docs this app created or the user explicitly picked (drive.file scope). Accepts a documentId or a full docs.google.com URL. Returns { ok, documentId, url }.",input_schema:{type:"object",properties:{documentId:{type:"string",description:"Google Docs documentId OR a full https://docs.google.com/document/d/... URL."},markdown:{type:"string",description:"Content to append, as markdown (preferred)."},text:{type:"string",description:"Content to append, as plain text (used when markdown is absent)."}},required:["documentId"]}},{name:"gdocs_insert_image",description:"Append a LOCAL image file (png/jpg, max 5MB) to the END of an existing Google Doc. The image is uploaded to the user's Drive, made link-readable (role reader / type anyone \u2014 required: the Docs API only renders publicly fetchable image URIs, <2KB URI length, image <50MB and <25 megapixels), then inserted inline. Optional width/height in points (PT). Returns { ok, documentId, fileId, url }.",input_schema:{type:"object",properties:{documentId:{type:"string",description:"Google Docs documentId OR a full https://docs.google.com/document/d/... URL."},imagePath:{type:"string",description:"Local filesystem path to a .png or .jpg/.jpeg image (max 5MB)."},width:{type:"number",description:"Optional display width in points (PT)."},height:{type:"number",description:"Optional display height in points (PT)."}},required:["documentId","imagePath"]}},{name:"gdocs_get",description:"Read a Google Doc back as plain text (truncated to ~20k chars). Under the default drive.file scope this works ONLY for docs this app created or the user explicitly picked; reading arbitrary docs requires the extended documents.readonly connection. Returns { ok, documentId, title, url, text }.",input_schema:{type:"object",properties:{documentId:{type:"string",description:"Google Docs documentId OR a full https://docs.google.com/document/d/... URL."}},required:["documentId"]}},{name:"gdocs_list_created",description:"List the Google Docs visible to this integration, newest first (max 25). NOTE: under the drive.file scope this lists ONLY docs the app created or the user explicitly picked \u2014 it is NOT a full Drive search. Returns { ok, count, files:[{ documentId, title, modifiedTime, url }] }.",input_schema:{type:"object",properties:{}}}]};export{Y as NON_OWNER_REFUSAL,F as chatStrictPersonal,K as extractPlainText,p as googleApi,re as googleDocsSkill,q as injectedGoogleToken,N as markdownToRequests,k as parseDocId,Z as parseInlineMarkdown,J as senderIsNonOwner};
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
export namespace hubspotSkill {
|
|
2
|
+
let id: string;
|
|
3
|
+
let serverName: string;
|
|
4
|
+
let allowedTools: string[];
|
|
5
|
+
let requiresIntegration: "hubspot";
|
|
6
|
+
let envKeys: any[];
|
|
7
|
+
let description: string;
|
|
8
|
+
let promptFragment: string;
|
|
9
|
+
function resolve(): {
|
|
10
|
+
command: any;
|
|
11
|
+
args: any[];
|
|
12
|
+
env: {};
|
|
13
|
+
description: string;
|
|
14
|
+
type?: undefined;
|
|
15
|
+
alwaysLoad?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: string;
|
|
18
|
+
command: string;
|
|
19
|
+
args: any[];
|
|
20
|
+
env: {};
|
|
21
|
+
description: string;
|
|
22
|
+
alwaysLoad: boolean;
|
|
23
|
+
};
|
|
24
|
+
function handleToolCall(name: any, args: any): Promise<string>;
|
|
25
|
+
let tools: ({
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
input_schema: {
|
|
29
|
+
type: string;
|
|
30
|
+
properties: {
|
|
31
|
+
objectType?: undefined;
|
|
32
|
+
query?: undefined;
|
|
33
|
+
filters?: undefined;
|
|
34
|
+
properties?: undefined;
|
|
35
|
+
limit?: undefined;
|
|
36
|
+
id?: undefined;
|
|
37
|
+
associations?: undefined;
|
|
38
|
+
after?: undefined;
|
|
39
|
+
body?: undefined;
|
|
40
|
+
contactId?: undefined;
|
|
41
|
+
companyId?: undefined;
|
|
42
|
+
dealId?: undefined;
|
|
43
|
+
ticketId?: undefined;
|
|
44
|
+
timestamp?: undefined;
|
|
45
|
+
fromType?: undefined;
|
|
46
|
+
fromId?: undefined;
|
|
47
|
+
toType?: undefined;
|
|
48
|
+
toId?: undefined;
|
|
49
|
+
};
|
|
50
|
+
required?: undefined;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
input_schema: {
|
|
56
|
+
type: string;
|
|
57
|
+
properties: {
|
|
58
|
+
objectType: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
query?: undefined;
|
|
63
|
+
filters?: undefined;
|
|
64
|
+
properties?: undefined;
|
|
65
|
+
limit?: undefined;
|
|
66
|
+
id?: undefined;
|
|
67
|
+
associations?: undefined;
|
|
68
|
+
after?: undefined;
|
|
69
|
+
body?: undefined;
|
|
70
|
+
contactId?: undefined;
|
|
71
|
+
companyId?: undefined;
|
|
72
|
+
dealId?: undefined;
|
|
73
|
+
ticketId?: undefined;
|
|
74
|
+
timestamp?: undefined;
|
|
75
|
+
fromType?: undefined;
|
|
76
|
+
fromId?: undefined;
|
|
77
|
+
toType?: undefined;
|
|
78
|
+
toId?: undefined;
|
|
79
|
+
};
|
|
80
|
+
required: string[];
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
input_schema: {
|
|
86
|
+
type: string;
|
|
87
|
+
properties: {
|
|
88
|
+
objectType: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
query: {
|
|
93
|
+
type: string;
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
filters: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
items: {
|
|
100
|
+
type: string;
|
|
101
|
+
properties: {
|
|
102
|
+
propertyName: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
operator: {
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
value: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
properties: {
|
|
115
|
+
type: string;
|
|
116
|
+
items: {
|
|
117
|
+
type: string;
|
|
118
|
+
};
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
limit: {
|
|
122
|
+
type: string;
|
|
123
|
+
description: string;
|
|
124
|
+
};
|
|
125
|
+
id?: undefined;
|
|
126
|
+
associations?: undefined;
|
|
127
|
+
after?: undefined;
|
|
128
|
+
body?: undefined;
|
|
129
|
+
contactId?: undefined;
|
|
130
|
+
companyId?: undefined;
|
|
131
|
+
dealId?: undefined;
|
|
132
|
+
ticketId?: undefined;
|
|
133
|
+
timestamp?: undefined;
|
|
134
|
+
fromType?: undefined;
|
|
135
|
+
fromId?: undefined;
|
|
136
|
+
toType?: undefined;
|
|
137
|
+
toId?: undefined;
|
|
138
|
+
};
|
|
139
|
+
required: string[];
|
|
140
|
+
};
|
|
141
|
+
} | {
|
|
142
|
+
name: string;
|
|
143
|
+
description: string;
|
|
144
|
+
input_schema: {
|
|
145
|
+
type: string;
|
|
146
|
+
properties: {
|
|
147
|
+
objectType: {
|
|
148
|
+
type: string;
|
|
149
|
+
description: string;
|
|
150
|
+
};
|
|
151
|
+
id: {
|
|
152
|
+
type: string;
|
|
153
|
+
description: string;
|
|
154
|
+
};
|
|
155
|
+
properties: {
|
|
156
|
+
type: string;
|
|
157
|
+
items: {
|
|
158
|
+
type: string;
|
|
159
|
+
};
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
associations: {
|
|
163
|
+
type: string;
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
166
|
+
query?: undefined;
|
|
167
|
+
filters?: undefined;
|
|
168
|
+
limit?: undefined;
|
|
169
|
+
after?: undefined;
|
|
170
|
+
body?: undefined;
|
|
171
|
+
contactId?: undefined;
|
|
172
|
+
companyId?: undefined;
|
|
173
|
+
dealId?: undefined;
|
|
174
|
+
ticketId?: undefined;
|
|
175
|
+
timestamp?: undefined;
|
|
176
|
+
fromType?: undefined;
|
|
177
|
+
fromId?: undefined;
|
|
178
|
+
toType?: undefined;
|
|
179
|
+
toId?: undefined;
|
|
180
|
+
};
|
|
181
|
+
required: string[];
|
|
182
|
+
};
|
|
183
|
+
} | {
|
|
184
|
+
name: string;
|
|
185
|
+
description: string;
|
|
186
|
+
input_schema: {
|
|
187
|
+
type: string;
|
|
188
|
+
properties: {
|
|
189
|
+
objectType: {
|
|
190
|
+
type: string;
|
|
191
|
+
description: string;
|
|
192
|
+
};
|
|
193
|
+
properties: {
|
|
194
|
+
type: string;
|
|
195
|
+
items: {
|
|
196
|
+
type: string;
|
|
197
|
+
};
|
|
198
|
+
description: string;
|
|
199
|
+
};
|
|
200
|
+
limit: {
|
|
201
|
+
type: string;
|
|
202
|
+
description: string;
|
|
203
|
+
};
|
|
204
|
+
after: {
|
|
205
|
+
type: string;
|
|
206
|
+
description: string;
|
|
207
|
+
};
|
|
208
|
+
query?: undefined;
|
|
209
|
+
filters?: undefined;
|
|
210
|
+
id?: undefined;
|
|
211
|
+
associations?: undefined;
|
|
212
|
+
body?: undefined;
|
|
213
|
+
contactId?: undefined;
|
|
214
|
+
companyId?: undefined;
|
|
215
|
+
dealId?: undefined;
|
|
216
|
+
ticketId?: undefined;
|
|
217
|
+
timestamp?: undefined;
|
|
218
|
+
fromType?: undefined;
|
|
219
|
+
fromId?: undefined;
|
|
220
|
+
toType?: undefined;
|
|
221
|
+
toId?: undefined;
|
|
222
|
+
};
|
|
223
|
+
required: string[];
|
|
224
|
+
};
|
|
225
|
+
} | {
|
|
226
|
+
name: string;
|
|
227
|
+
description: string;
|
|
228
|
+
input_schema: {
|
|
229
|
+
type: string;
|
|
230
|
+
properties: {
|
|
231
|
+
objectType: {
|
|
232
|
+
type: string;
|
|
233
|
+
description: string;
|
|
234
|
+
};
|
|
235
|
+
properties: {
|
|
236
|
+
type: string;
|
|
237
|
+
description: string;
|
|
238
|
+
items?: undefined;
|
|
239
|
+
};
|
|
240
|
+
query?: undefined;
|
|
241
|
+
filters?: undefined;
|
|
242
|
+
limit?: undefined;
|
|
243
|
+
id?: undefined;
|
|
244
|
+
associations?: undefined;
|
|
245
|
+
after?: undefined;
|
|
246
|
+
body?: undefined;
|
|
247
|
+
contactId?: undefined;
|
|
248
|
+
companyId?: undefined;
|
|
249
|
+
dealId?: undefined;
|
|
250
|
+
ticketId?: undefined;
|
|
251
|
+
timestamp?: undefined;
|
|
252
|
+
fromType?: undefined;
|
|
253
|
+
fromId?: undefined;
|
|
254
|
+
toType?: undefined;
|
|
255
|
+
toId?: undefined;
|
|
256
|
+
};
|
|
257
|
+
required: string[];
|
|
258
|
+
};
|
|
259
|
+
} | {
|
|
260
|
+
name: string;
|
|
261
|
+
description: string;
|
|
262
|
+
input_schema: {
|
|
263
|
+
type: string;
|
|
264
|
+
properties: {
|
|
265
|
+
objectType: {
|
|
266
|
+
type: string;
|
|
267
|
+
description: string;
|
|
268
|
+
};
|
|
269
|
+
id: {
|
|
270
|
+
type: string;
|
|
271
|
+
description: string;
|
|
272
|
+
};
|
|
273
|
+
properties: {
|
|
274
|
+
type: string;
|
|
275
|
+
description: string;
|
|
276
|
+
items?: undefined;
|
|
277
|
+
};
|
|
278
|
+
query?: undefined;
|
|
279
|
+
filters?: undefined;
|
|
280
|
+
limit?: undefined;
|
|
281
|
+
associations?: undefined;
|
|
282
|
+
after?: undefined;
|
|
283
|
+
body?: undefined;
|
|
284
|
+
contactId?: undefined;
|
|
285
|
+
companyId?: undefined;
|
|
286
|
+
dealId?: undefined;
|
|
287
|
+
ticketId?: undefined;
|
|
288
|
+
timestamp?: undefined;
|
|
289
|
+
fromType?: undefined;
|
|
290
|
+
fromId?: undefined;
|
|
291
|
+
toType?: undefined;
|
|
292
|
+
toId?: undefined;
|
|
293
|
+
};
|
|
294
|
+
required: string[];
|
|
295
|
+
};
|
|
296
|
+
} | {
|
|
297
|
+
name: string;
|
|
298
|
+
description: string;
|
|
299
|
+
input_schema: {
|
|
300
|
+
type: string;
|
|
301
|
+
properties: {
|
|
302
|
+
body: {
|
|
303
|
+
type: string;
|
|
304
|
+
description: string;
|
|
305
|
+
};
|
|
306
|
+
contactId: {
|
|
307
|
+
type: string;
|
|
308
|
+
description: string;
|
|
309
|
+
};
|
|
310
|
+
companyId: {
|
|
311
|
+
type: string;
|
|
312
|
+
description: string;
|
|
313
|
+
};
|
|
314
|
+
dealId: {
|
|
315
|
+
type: string;
|
|
316
|
+
description: string;
|
|
317
|
+
};
|
|
318
|
+
ticketId: {
|
|
319
|
+
type: string;
|
|
320
|
+
description: string;
|
|
321
|
+
};
|
|
322
|
+
timestamp: {
|
|
323
|
+
type: string;
|
|
324
|
+
description: string;
|
|
325
|
+
};
|
|
326
|
+
objectType?: undefined;
|
|
327
|
+
query?: undefined;
|
|
328
|
+
filters?: undefined;
|
|
329
|
+
properties?: undefined;
|
|
330
|
+
limit?: undefined;
|
|
331
|
+
id?: undefined;
|
|
332
|
+
associations?: undefined;
|
|
333
|
+
after?: undefined;
|
|
334
|
+
fromType?: undefined;
|
|
335
|
+
fromId?: undefined;
|
|
336
|
+
toType?: undefined;
|
|
337
|
+
toId?: undefined;
|
|
338
|
+
};
|
|
339
|
+
required: string[];
|
|
340
|
+
};
|
|
341
|
+
} | {
|
|
342
|
+
name: string;
|
|
343
|
+
description: string;
|
|
344
|
+
input_schema: {
|
|
345
|
+
type: string;
|
|
346
|
+
properties: {
|
|
347
|
+
fromType: {
|
|
348
|
+
type: string;
|
|
349
|
+
description: string;
|
|
350
|
+
};
|
|
351
|
+
fromId: {
|
|
352
|
+
type: string;
|
|
353
|
+
description: string;
|
|
354
|
+
};
|
|
355
|
+
toType: {
|
|
356
|
+
type: string;
|
|
357
|
+
description: string;
|
|
358
|
+
};
|
|
359
|
+
toId: {
|
|
360
|
+
type: string;
|
|
361
|
+
description: string;
|
|
362
|
+
};
|
|
363
|
+
objectType?: undefined;
|
|
364
|
+
query?: undefined;
|
|
365
|
+
filters?: undefined;
|
|
366
|
+
properties?: undefined;
|
|
367
|
+
limit?: undefined;
|
|
368
|
+
id?: undefined;
|
|
369
|
+
associations?: undefined;
|
|
370
|
+
after?: undefined;
|
|
371
|
+
body?: undefined;
|
|
372
|
+
contactId?: undefined;
|
|
373
|
+
companyId?: undefined;
|
|
374
|
+
dealId?: undefined;
|
|
375
|
+
ticketId?: undefined;
|
|
376
|
+
timestamp?: undefined;
|
|
377
|
+
};
|
|
378
|
+
required: string[];
|
|
379
|
+
};
|
|
380
|
+
})[];
|
|
381
|
+
}
|