@zibby/skills 0.1.94 → 0.1.96

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.
@@ -1,4 +1,4 @@
1
- import{spawnSync as d}from"node:child_process";import{existsSync as s,mkdirSync as c,readdirSync as h,writeFileSync as m}from"node:fs";import{createHash as u}from"node:crypto";import{join as n}from"node:path";import{SKILL_META as y}from"@zibby/skill-ids";function i(){return process.env.CBM_BIN||"/usr/local/bin/codebase-memory-mcp"}function a(){if(process.env.CBM_CACHE_DIR)return process.env.CBM_CACHE_DIR;let e=process.env.WORKSPACE||process.env.ZIBBY_WORKSPACE;return e?n(e,".zibby","cbm-cache"):"/tmp/zibby-cbm-cache"}function l(){let e=process.env.WORKSPACE||process.env.ZIBBY_WORKSPACE||"/workspace",r=n(e,".zibby","repos");try{if(s(r)){let t=h(r,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>n(r,o.name));if(t.length===1)return t[0];if(t.length>1)return r}}catch{}return s(e)?e:null}function _(e){return u("sha256").update(e).digest("hex").slice(0,16)}var x={id:"codebase-memory",serverName:"codebase_memory",meta:y["codebase-memory"],allowedTools:["mcp__codebase_memory__*"],description:"Codebase memory \u2014 code-graph + semantic index over the checked-out repo (architecture, graph search, dependency trace, change detection)",promptFragment:`## Codebase Memory (code-graph + semantic index over THIS repo)
1
+ import{spawnSync as d}from"node:child_process";import{existsSync as n,mkdirSync as c,readdirSync as h,writeFileSync as m}from"node:fs";import{createHash as u}from"node:crypto";import{join as s}from"node:path";import{SKILL_META as y}from"@zibby/skill-ids";function i(){return process.env.CBM_BIN||"/usr/local/bin/codebase-memory-mcp"}function a(){if(process.env.CBM_CACHE_DIR)return process.env.CBM_CACHE_DIR;let e=process.env.WORKSPACE||process.env.ZIBBY_WORKSPACE;return e?s(e,".zibby","cbm-cache"):"/tmp/zibby-cbm-cache"}function l(){let e=process.env.WORKSPACE||process.env.ZIBBY_WORKSPACE||"/workspace",r=s(e,".zibby","repos");try{if(n(r)){let t=h(r,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>s(r,o.name));if(t.length===1)return t[0];if(t.length>1)return r}}catch{}return null}function _(e){return u("sha256").update(e).digest("hex").slice(0,16)}var x={id:"codebase-memory",serverName:"codebase_memory",meta:y["codebase-memory"],allowedTools:["mcp__codebase_memory__*"],description:"Codebase memory \u2014 code-graph + semantic index over the checked-out repo (architecture, graph search, dependency trace, change detection)",promptFragment:`## Codebase Memory (code-graph + semantic index over THIS repo)
2
2
  The checked-out repository is indexed into a queryable code graph + semantic
3
3
  index. Reach for these instead of blindly grepping when you need structure,
4
4
  relationships, or "where does X live / what depends on Y":
@@ -10,5 +10,5 @@ relationships, or "where does X live / what depends on Y":
10
10
  - get_code_snippet / search_code: pull the exact code for a node / text match.
11
11
  - index_status / list_projects: confirm the index is present before querying.
12
12
  The repo is indexed for you at the start of the run; if a query comes back
13
- empty, call index_status, and only re-index (index_repository) if needed.`,resolve(){let e=a();try{c(e,{recursive:!0})}catch{}let r={CBM_CACHE_DIR:e};return process.env.WORKSPACE&&(r.WORKSPACE=process.env.WORKSPACE),{type:"stdio",command:i(),args:[],env:r,description:this.description,alwaysLoad:!0}},invokeAgentOptions(){try{let e=l();if(!e)return{};let r=a();try{c(r,{recursive:!0})}catch{}let t=n(r,`.cbm-indexed-${_(e)}`);if(s(t))return{};let o=i();if(!s(o)&&!process.env.CBM_BIN)return{};let p=d(o,["cli","index_repository",JSON.stringify({repo_path:e})],{env:{...process.env,CBM_CACHE_DIR:r},encoding:"utf-8",timeout:300*1e3,maxBuffer:32*1024*1024});try{m(t,`${new Date().toISOString()} status=${p.status}
13
+ empty, call index_status, and only re-index (index_repository) if needed.`,resolve(){let e=a();try{c(e,{recursive:!0})}catch{}let r={CBM_CACHE_DIR:e};return process.env.WORKSPACE&&(r.WORKSPACE=process.env.WORKSPACE),{type:"stdio",command:i(),args:[],env:r,description:this.description,alwaysLoad:!0}},invokeAgentOptions(){try{let e=l();if(!e)return{};let r=a();try{c(r,{recursive:!0})}catch{}let t=s(r,`.cbm-indexed-${_(e)}`);if(n(t))return{};let o=i();if(!n(o)&&!process.env.CBM_BIN)return{};let p=d(o,["cli","index_repository",JSON.stringify({repo_path:e})],{env:{...process.env,CBM_CACHE_DIR:r},encoding:"utf-8",timeout:300*1e3,maxBuffer:32*1024*1024});try{m(t,`${new Date().toISOString()} status=${p.status}
14
14
  `)}catch{}}catch{}return{}}};export{x as codebaseMemorySkill};
@@ -54,6 +54,12 @@ export namespace datasetStoreSkill {
54
54
  type?: undefined;
55
55
  sql?: undefined;
56
56
  params?: undefined;
57
+ path?: undefined;
58
+ content?: undefined;
59
+ contentBase64?: undefined;
60
+ contentType?: undefined;
61
+ prefix?: undefined;
62
+ cursor?: undefined;
57
63
  };
58
64
  required: string[];
59
65
  };
@@ -105,6 +111,12 @@ export namespace datasetStoreSkill {
105
111
  type?: undefined;
106
112
  sql?: undefined;
107
113
  params?: undefined;
114
+ path?: undefined;
115
+ content?: undefined;
116
+ contentBase64?: undefined;
117
+ contentType?: undefined;
118
+ prefix?: undefined;
119
+ cursor?: undefined;
108
120
  };
109
121
  required: any[];
110
122
  };
@@ -139,6 +151,12 @@ export namespace datasetStoreSkill {
139
151
  until?: undefined;
140
152
  sql?: undefined;
141
153
  params?: undefined;
154
+ path?: undefined;
155
+ content?: undefined;
156
+ contentBase64?: undefined;
157
+ contentType?: undefined;
158
+ prefix?: undefined;
159
+ cursor?: undefined;
142
160
  };
143
161
  required: string[];
144
162
  };
@@ -172,8 +190,137 @@ export namespace datasetStoreSkill {
172
190
  until?: undefined;
173
191
  name?: undefined;
174
192
  type?: undefined;
193
+ path?: undefined;
194
+ content?: undefined;
195
+ contentBase64?: undefined;
196
+ contentType?: undefined;
197
+ prefix?: undefined;
198
+ cursor?: undefined;
175
199
  };
176
200
  required: string[];
177
201
  };
202
+ } | {
203
+ name: string;
204
+ description: string;
205
+ input_schema: {
206
+ type: string;
207
+ properties: {
208
+ store: {
209
+ type: string;
210
+ description: string;
211
+ };
212
+ path: {
213
+ type: string;
214
+ description: string;
215
+ };
216
+ content: {
217
+ type: string;
218
+ description: string;
219
+ };
220
+ contentBase64: {
221
+ type: string;
222
+ description: string;
223
+ };
224
+ contentType: {
225
+ type: string;
226
+ description: string;
227
+ };
228
+ record?: undefined;
229
+ description?: undefined;
230
+ agent?: undefined;
231
+ select?: undefined;
232
+ where?: undefined;
233
+ groupBy?: undefined;
234
+ orderBy?: undefined;
235
+ limit?: undefined;
236
+ since?: undefined;
237
+ until?: undefined;
238
+ name?: undefined;
239
+ type?: undefined;
240
+ sql?: undefined;
241
+ params?: undefined;
242
+ prefix?: undefined;
243
+ cursor?: undefined;
244
+ };
245
+ required: string[];
246
+ };
247
+ } | {
248
+ name: string;
249
+ description: string;
250
+ input_schema: {
251
+ type: string;
252
+ properties: {
253
+ store: {
254
+ type: string;
255
+ description: string;
256
+ };
257
+ path: {
258
+ type: string;
259
+ description: string;
260
+ };
261
+ record?: undefined;
262
+ description?: undefined;
263
+ agent?: undefined;
264
+ select?: undefined;
265
+ where?: undefined;
266
+ groupBy?: undefined;
267
+ orderBy?: undefined;
268
+ limit?: undefined;
269
+ since?: undefined;
270
+ until?: undefined;
271
+ name?: undefined;
272
+ type?: undefined;
273
+ sql?: undefined;
274
+ params?: undefined;
275
+ content?: undefined;
276
+ contentBase64?: undefined;
277
+ contentType?: undefined;
278
+ prefix?: undefined;
279
+ cursor?: undefined;
280
+ };
281
+ required: string[];
282
+ };
283
+ } | {
284
+ name: string;
285
+ description: string;
286
+ input_schema: {
287
+ type: string;
288
+ properties: {
289
+ store: {
290
+ type: string;
291
+ description: string;
292
+ };
293
+ prefix: {
294
+ type: string;
295
+ description: string;
296
+ };
297
+ limit: {
298
+ type: string;
299
+ description: string;
300
+ };
301
+ cursor: {
302
+ type: string;
303
+ description: string;
304
+ };
305
+ record?: undefined;
306
+ description?: undefined;
307
+ agent?: undefined;
308
+ select?: undefined;
309
+ where?: undefined;
310
+ groupBy?: undefined;
311
+ orderBy?: undefined;
312
+ since?: undefined;
313
+ until?: undefined;
314
+ name?: undefined;
315
+ type?: undefined;
316
+ sql?: undefined;
317
+ params?: undefined;
318
+ path?: undefined;
319
+ content?: undefined;
320
+ contentBase64?: undefined;
321
+ contentType?: undefined;
322
+ };
323
+ required: any[];
324
+ };
178
325
  })[];
179
326
  }
@@ -1,4 +1,4 @@
1
- import{existsSync as p,readFileSync as m}from"node:fs";import{homedir as f}from"node:os";import{join as h,dirname as E,resolve as g}from"node:path";import{fileURLToPath as T}from"node:url";function S(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=E(T(import.meta.url)),t=g(r,"..","bin","mcp-skill.mjs");return p(t)?t:null}function l(){if(process.env.PROJECT_API_TOKEN)return process.env.PROJECT_API_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let r=h(f(),".zibby","config.json");return p(r)&&JSON.parse(m(r,"utf-8")).sessionToken||null}catch{return null}}function u(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://api-prod.zibby.app"}function d(){return(typeof process.env.WORKFLOW_TYPE=="string"?process.env.WORKFLOW_TYPE.trim():"")||"agent"}function O(){let r={};for(let[t,e]of Object.entries(process.env)){let o=/^ZIBBY_STORE__(.+)$/.exec(t);if(!o)continue;let n=typeof e=="string"?e.trim():"";n&&(r[o[1]]=n)}return r}var a={};function I(){for(let r of Object.keys(a))delete a[r]}function i(r){let t={...O(),...a},e=Object.keys(t),o=typeof r=="string"?r.trim():"";return o?Object.prototype.hasOwnProperty.call(t,o)?{storeId:t[o],name:o}:{error:`unknown store '${o}'; available: ${e.join(", ")}`}:e.length===1?{storeId:t[e[0]],name:e[0]}:e.length===0?{error:"no stores bound to this agent"}:{error:`multiple stores are bound; pass \`store\` (one of: ${e.join(", ")})`}}async function b(r){let t=l();if(!t)throw new Error("No backend credential (PROJECT_API_TOKEN). Stores are only available inside a Zibby run.");let e=await fetch(`${u()}/datasets/stores/ensure`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!e.ok){let o=await e.text().catch(()=>"");throw new Error(`ensure_store failed (${e.status}): ${o.slice(0,300)}`)}return e.json()}async function c(r,t,e){let o=l();if(!o)throw new Error("No backend credential (PROJECT_API_TOKEN). Dataset store is only available inside a Zibby run.");let n=`${u()}/datasets/stores/${encodeURIComponent(r)}/${t}`,s=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let y=await s.text().catch(()=>"");throw new Error(`Store ${t} failed (${s.status}): ${y.slice(0,300)}`)}return s.json()}var L={id:"dataset-store",serverName:"dataset_store",allowedTools:["mcp__dataset_store__*"],description:"Dataset store \u2014 a durable, queryable store for structured JSON records; append rows now, run SQL-style aggregations/reports later",promptFragment:`## Dataset Store (durable, queryable structured-record store)
1
+ import{existsSync as l,readFileSync as f}from"node:fs";import{homedir as m}from"node:os";import{join as h,dirname as g,resolve as E}from"node:path";import{fileURLToPath as b}from"node:url";function T(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let o=g(b(import.meta.url)),e=E(o,"..","bin","mcp-skill.mjs");return l(e)?e:null}function u(){if(process.env.PROJECT_API_TOKEN)return process.env.PROJECT_API_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let o=h(m(),".zibby","config.json");return l(o)&&JSON.parse(f(o,"utf-8")).sessionToken||null}catch{return null}}function y(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://api-prod.zibby.app"}function d(){return(typeof process.env.WORKFLOW_TYPE=="string"?process.env.WORKFLOW_TYPE.trim():"")||"agent"}function S(){let o={};for(let[e,t]of Object.entries(process.env)){let r=/^ZIBBY_STORE__(.+)$/.exec(e);if(!r)continue;let s=typeof t=="string"?t.trim():"";s&&(o[r[1]]=s)}return o}var p={};function w(){for(let o of Object.keys(p))delete p[o]}function a(o){let e={...S(),...p},t=Object.keys(e),r=typeof o=="string"?o.trim():"";return r?Object.prototype.hasOwnProperty.call(e,r)?{storeId:e[r],name:r}:{error:`unknown store '${r}'; available: ${t.join(", ")}`}:t.length===1?{storeId:e[t[0]],name:t[0]}:t.length===0?{error:"no stores bound to this agent"}:{error:`multiple stores are bound; pass \`store\` (one of: ${t.join(", ")})`}}async function O(o){let e=u();if(!e)throw new Error("No backend credential (PROJECT_API_TOKEN). Stores are only available inside a Zibby run.");let t=await fetch(`${y()}/datasets/stores/ensure`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!t.ok){let r=await t.text().catch(()=>"");throw new Error(`ensure_store failed (${t.status}): ${r.slice(0,300)}`)}return t.json()}async function c(o,e,t){let r=u();if(!r)throw new Error("No backend credential (PROJECT_API_TOKEN). Dataset store is only available inside a Zibby run.");let s=`${y()}/datasets/stores/${encodeURIComponent(o)}/${e}`,i=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){let n=await i.text().catch(()=>"");throw new Error(`Store ${e} failed (${i.status}): ${n.slice(0,300)}`)}return i.json()}var L={id:"dataset-store",serverName:"dataset_store",allowedTools:["mcp__dataset_store__*"],description:"Dataset store \u2014 a durable, queryable store for structured JSON records; append rows now, run SQL-style aggregations/reports later",promptFragment:`## Dataset Store (durable, queryable structured-record store)
2
2
  You have one or more durable stores for STRUCTURED records that survive across
3
3
  your stateless runs. Unlike key-value memory (for picking up where you left
4
4
  off), this is for accumulating DATA you want to QUERY and AGGREGATE later \u2014 e.g.
@@ -11,12 +11,15 @@ omit \`store\` and it defaults to that one. You can ONLY write to a bound store
11
11
  name; any other name is rejected. Each appended record is an arbitrary JSON
12
12
  object, auto-tagged with YOUR agent type so you can later filter to your writes.
13
13
 
14
- There are TWO kinds of bound store (shown as TYPE in AVAILABLE STORES):
14
+ There are THREE kinds of bound store (shown as TYPE in AVAILABLE STORES):
15
15
  \u2022 dataset \u2014 append-only structured records you QUERY/AGGREGATE later (analytics).
16
16
  \u2022 sqlite \u2014 a real, MUTABLE relational database (a SQLite file per store): CREATE
17
17
  TABLE on the fly, INSERT/UPDATE/DELETE, SELECT. Schema + data persist across
18
18
  runs. Use this when you need to UPDATE rows / track changing state (e.g. a
19
19
  queue with a status column), not just append.
20
+ \u2022 file \u2014 arbitrary FILE/BLOB storage addressed by relative path: stash raw
21
+ JSON dumps, CSVs, images, snapshots as-is and fetch them back in later runs.
22
+ Use this when the data is a document/blob, not rows.
20
23
 
21
24
  You can also CREATE your own store on demand (no deploy needed) with
22
25
  ensure_store \u2014 e.g. an agent that needs a private sqlite DB to track drafts/
@@ -33,5 +36,11 @@ Tools:
33
36
  NOT EXISTS. Returns { rowsModified, wrote }.
34
37
  - sqlite_query: (sqlite stores) Run a SELECT (optionally with \`params\` for safe
35
38
  binding). Returns { columns, rows }. Read-only \u2014 never changes data.
39
+ - file_put: (file stores) Write/overwrite ONE file at a relative path (text or
40
+ base64 binary; max 4 MiB).
41
+ - file_get: (file stores) Read a file back (text returned as text, binary as
42
+ base64).
43
+ - file_list: (file stores) List stored files (optionally by path prefix).
44
+ - file_delete: (file stores) Delete ONE file by path.
36
45
  Pick the tool that matches the store's TYPE; using a dataset tool on a sqlite
37
- store (or vice-versa) is rejected.`,resolve(){let r=S();if(!r)return{command:null,args:[],env:{},description:this.description};let t={};for(let e of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","WORKFLOW_TYPE"])process.env[e]&&(t[e]=process.env[e]);for(let e of Object.keys(process.env))/^ZIBBY_STORE__.+$/.test(e)&&process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[r,"../dist/datasetStore.js","datasetStoreSkill"],env:t,description:this.description,alwaysLoad:!1}},async handleToolCall(r,t){try{switch(r){case"dataset_append":{if(t?.record==null||typeof t.record!="object"||Array.isArray(t.record))return JSON.stringify({error:"record is required (a JSON object)"});let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o=typeof t?.agent=="string"&&t.agent.trim()?t.agent.trim():d(),n={record:t.record,agent:o};typeof t?.description=="string"&&t.description.trim()&&(n.description=t.description.trim());let s=await c(e.storeId,"append",n);return JSON.stringify({...s,store:e.name,storeId:e.storeId})}case"dataset_query":{let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o={};for(let s of["select","where","groupBy","orderBy","limit","since","until","agent"])t?.[s]!=null&&(o[s]=t[s]);let n=await c(e.storeId,"query",o);return JSON.stringify({...n,store:e.name,storeId:e.storeId})}case"ensure_store":{let e=typeof t?.name=="string"?t.name.trim():"";if(!e)return JSON.stringify({error:"name is required"});let o=typeof t?.type=="string"&&t.type.trim()?t.type.trim().toLowerCase():"sqlite",n=typeof t?.description=="string"?t.description.trim():"",s=await b({name:e,type:o,description:n,namespace:d()});return s?.storeId&&(a[e]=s.storeId),JSON.stringify({...s,store:e})}case"sqlite_exec":case"sqlite_query":{let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});if(typeof t?.sql!="string"||!t.sql.trim())return JSON.stringify({error:"sql is required (a non-empty SQL string)"});let o={sql:t.sql};Array.isArray(t?.params)&&(o.params=t.params);let n=await c(e.storeId,"sql",o);return JSON.stringify({...n,store:e.name,storeId:e.storeId})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"dataset_append",description:"Append ONE structured JSON record to a bound store, durably. Records persist across your stateless runs and are auto-tagged with your agent type so you can filter to your own writes later. Use to accumulate data you will query/aggregate (e.g. per-run metrics, processed items). Append ONE record per call.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to write to (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store; you can ONLY write to a bound store name.'},record:{type:"object",description:'An arbitrary JSON object \u2014 one row of data. Its keys become queryable fields (e.g. {"repo":"owner/x","stars":1200}). One record per call.'},description:{type:"string",description:"Optional, informational note about this write. The store already exists from deploy, so this is not required and does not create anything."},agent:{type:"string",description:"Optional writing-agent tag. Defaults to your own agent type \u2014 leave unset to auto-tag."}},required:["record"]}},{name:"dataset_query",description:"Run a SQL-style query over a bound store to build reports: select/aggregate (count|sum|avg|min|max), filter, group, order, limit, and bound by month. Returns { columns, rows }. Use this to compute summaries/aggregations from records you appended earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to query (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store.'},select:{type:"array",description:"Columns to return. Each item is { field?, agg?, as? }. agg \u2208 count|sum|avg|min|max; omit field for count(*). Omit `select` entirely to return raw rows."},where:{type:"array",description:"Filters, ANDed. Each item is { field, op, value }; op \u2208 eq|ne|gt|gte|lt|lte|like. `field` is a JSON key of the stored record."},groupBy:{type:"array",description:"Field names to group by (array of strings) for aggregation."},orderBy:{type:"array",description:"Sort spec. Each item is { field|as, dir }; dir \u2208 asc|desc."},limit:{type:"number",description:"Maximum number of rows to return."},since:{type:"string",description:"Inclusive lower bound month, 'yyyy-MM' (e.g. '2026-01')."},until:{type:"string",description:"Inclusive upper bound month, 'yyyy-MM' (e.g. '2026-06')."},agent:{type:"string",description:"Filter to records written by one agent namespace. Omit to query across all writers."}},required:[]}},{name:"ensure_store",description:'Create (or reuse) a store ON DEMAND for THIS agent \u2014 use when you need a store that was NOT declared/bound at deploy. Idempotent by name and private to this agent: calling again with the same name returns the SAME store (safe to call at the start of every run). Returns { storeId }. For type "sqlite" you then define schema with sqlite_exec (CREATE TABLE IF NOT EXISTS) and read/write via sqlite_exec/sqlite_query using this name.',input_schema:{type:"object",properties:{name:{type:"string",description:'A short logical name for the store (e.g. "linkedin_posts"). Letters, digits, _ and - only.'},type:{type:"string",enum:["sqlite","dataset"],description:'Store type. "sqlite" (default) = a mutable relational DB whose schema YOU define with SQL. "dataset" = append-only JSON records for later aggregation/analytics.'},description:{type:"string",description:"What this store is for (shown in the Storage UI)."}},required:["name"]}},{name:"sqlite_exec",description:"For SQLITE-type stores: run SQL that CHANGES data \u2014 CREATE TABLE (use IF NOT EXISTS), INSERT, UPDATE, DELETE (one or more statements in one call). The store is a real, mutable SQLite database that persists across your stateless runs. Returns { rowsModified, wrote }. Use this to build schema on the fly and to update rows / track changing state (e.g. a queue with a status column).",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:'The SQL to run. May contain multiple statements separated by ";". Prefer CREATE TABLE IF NOT EXISTS for idempotent schema.'},params:{type:"array",description:'Optional positional bind params for a SINGLE parameterized statement (safe binding of values), e.g. sql "UPDATE t SET s=? WHERE id=?" with params ["done", 1].'}},required:["sql"]}},{name:"sqlite_query",description:"For SQLITE-type stores: run a read-only SELECT (optionally with `params` for safe binding) against the store's SQLite database. Returns { columns, rows }. Never changes data. Use to read back rows/state you stored earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:"A single SELECT statement. Use ? placeholders + `params` for any values."},params:{type:"array",description:'Optional positional bind params for the SELECT, e.g. ["linkedin_personal"].'}},required:["sql"]}}]};export{I as __clearEnsuredStores,L as datasetStoreSkill};
46
+ store (or a file tool on either, etc.) is rejected.`,resolve(){let o=T();if(!o)return{command:null,args:[],env:{},description:this.description};let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","WORKFLOW_TYPE"])process.env[t]&&(e[t]=process.env[t]);for(let t of Object.keys(process.env))/^ZIBBY_STORE__.+$/.test(t)&&process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[o,"../dist/datasetStore.js","datasetStoreSkill"],env:e,description:this.description,alwaysLoad:!1}},async handleToolCall(o,e){try{switch(o){case"dataset_append":{if(e?.record==null||typeof e.record!="object"||Array.isArray(e.record))return JSON.stringify({error:"record is required (a JSON object)"});let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r=typeof e?.agent=="string"&&e.agent.trim()?e.agent.trim():d(),s={record:e.record,agent:r};typeof e?.description=="string"&&e.description.trim()&&(s.description=e.description.trim());let i=await c(t.storeId,"append",s);return JSON.stringify({...i,store:t.name,storeId:t.storeId})}case"dataset_query":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r={};for(let i of["select","where","groupBy","orderBy","limit","since","until","agent"])e?.[i]!=null&&(r[i]=e[i]);let s=await c(t.storeId,"query",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}case"ensure_store":{let t=typeof e?.name=="string"?e.name.trim():"";if(!t)return JSON.stringify({error:"name is required"});let r=typeof e?.type=="string"&&e.type.trim()?e.type.trim().toLowerCase():"sqlite",s=typeof e?.description=="string"?e.description.trim():"",i=await O({name:t,type:r,description:s,namespace:d()});return i?.storeId&&(p[t]=i.storeId),JSON.stringify({...i,store:t})}case"file_put":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:'path is required (a relative file path like "reports/2026-07.json")'});let r=typeof e?.content=="string",s=typeof e?.contentBase64=="string"&&e.contentBase64.length>0;if(!r&&!s)return JSON.stringify({error:"content (text) or contentBase64 (base64 bytes) is required"});let i={path:e.path.trim()};r?i.content=e.content:i.contentBase64=e.contentBase64,typeof e?.contentType=="string"&&e.contentType.trim()&&(i.contentType=e.contentType.trim());let n=await c(t.storeId,"put",i);return JSON.stringify({...n,store:t.name,storeId:t.storeId})}case"file_get":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:"path is required"});let r=await c(t.storeId,"get",{path:e.path.trim()}),s={ok:!0,store:t.name,storeId:t.storeId,path:r.path,size:r.size,contentType:r.contentType,lastModified:r.lastModified},i=Buffer.from(r.contentBase64||"","base64"),n=i.toString("utf8");return Buffer.compare(Buffer.from(n,"utf8"),i)===0&&!n.includes("\0")?(s.content=n,s.encoding="utf8"):(s.contentBase64=r.contentBase64,s.encoding="base64"),JSON.stringify(s)}case"file_list":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r={};typeof e?.prefix=="string"&&e.prefix.trim()&&(r.prefix=e.prefix.trim()),e?.limit!=null&&(r.limit=e.limit),typeof e?.cursor=="string"&&e.cursor&&(r.cursor=e.cursor);let s=await c(t.storeId,"list",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}case"file_delete":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:"path is required"});let r=await c(t.storeId,"delete",{path:e.path.trim()});return JSON.stringify({...r,store:t.name,storeId:t.storeId})}case"sqlite_exec":case"sqlite_query":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.sql!="string"||!e.sql.trim())return JSON.stringify({error:"sql is required (a non-empty SQL string)"});let r={sql:e.sql};Array.isArray(e?.params)&&(r.params=e.params);let s=await c(t.storeId,"sql",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}default:return JSON.stringify({error:`Unknown tool: ${o}`})}}catch(t){return JSON.stringify({error:t.message})}},tools:[{name:"dataset_append",description:"Append ONE structured JSON record to a bound store, durably. Records persist across your stateless runs and are auto-tagged with your agent type so you can filter to your own writes later. Use to accumulate data you will query/aggregate (e.g. per-run metrics, processed items). Append ONE record per call.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to write to (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store; you can ONLY write to a bound store name.'},record:{type:"object",description:'An arbitrary JSON object \u2014 one row of data. Its keys become queryable fields (e.g. {"repo":"owner/x","stars":1200}). One record per call.'},description:{type:"string",description:"Optional, informational note about this write. The store already exists from deploy, so this is not required and does not create anything."},agent:{type:"string",description:"Optional writing-agent tag. Defaults to your own agent type \u2014 leave unset to auto-tag."}},required:["record"]}},{name:"dataset_query",description:"Run a SQL-style query over a bound store to build reports: select/aggregate (count|sum|avg|min|max), filter, group, order, limit, and bound by month. Returns { columns, rows }. Use this to compute summaries/aggregations from records you appended earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to query (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store.'},select:{type:"array",description:"Columns to return. Each item is { field?, agg?, as? }. agg \u2208 count|sum|avg|min|max; omit field for count(*). Omit `select` entirely to return raw rows."},where:{type:"array",description:"Filters, ANDed. Each item is { field, op, value }; op \u2208 eq|ne|gt|gte|lt|lte|like. `field` is a JSON key of the stored record."},groupBy:{type:"array",description:"Field names to group by (array of strings) for aggregation."},orderBy:{type:"array",description:"Sort spec. Each item is { field|as, dir }; dir \u2208 asc|desc."},limit:{type:"number",description:"Maximum number of rows to return."},since:{type:"string",description:"Inclusive lower bound month, 'yyyy-MM' (e.g. '2026-01')."},until:{type:"string",description:"Inclusive upper bound month, 'yyyy-MM' (e.g. '2026-06')."},agent:{type:"string",description:"Filter to records written by one agent namespace. Omit to query across all writers."}},required:[]}},{name:"ensure_store",description:'Create (or reuse) a store ON DEMAND for THIS agent \u2014 use when you need a store that was NOT declared/bound at deploy. Idempotent by name and private to this agent: calling again with the same name returns the SAME store (safe to call at the start of every run). Returns { storeId }. For type "sqlite" you then define schema with sqlite_exec (CREATE TABLE IF NOT EXISTS) and read/write via sqlite_exec/sqlite_query using this name.',input_schema:{type:"object",properties:{name:{type:"string",description:'A short logical name for the store (e.g. "linkedin_posts"). Letters, digits, _ and - only.'},type:{type:"string",enum:["sqlite","dataset","file"],description:'Store type. "sqlite" (default) = a mutable relational DB whose schema YOU define with SQL. "dataset" = append-only JSON records for later aggregation/analytics. "file" = arbitrary file/blob storage by relative path (file_put/file_get/file_list/file_delete).'},description:{type:"string",description:"What this store is for (shown in the Storage UI)."}},required:["name"]}},{name:"sqlite_exec",description:"For SQLITE-type stores: run SQL that CHANGES data \u2014 CREATE TABLE (use IF NOT EXISTS), INSERT, UPDATE, DELETE (one or more statements in one call). The store is a real, mutable SQLite database that persists across your stateless runs. Returns { rowsModified, wrote }. Use this to build schema on the fly and to update rows / track changing state (e.g. a queue with a status column).",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:'The SQL to run. May contain multiple statements separated by ";". Prefer CREATE TABLE IF NOT EXISTS for idempotent schema.'},params:{type:"array",description:'Optional positional bind params for a SINGLE parameterized statement (safe binding of values), e.g. sql "UPDATE t SET s=? WHERE id=?" with params ["done", 1].'}},required:["sql"]}},{name:"sqlite_query",description:"For SQLITE-type stores: run a read-only SELECT (optionally with `params` for safe binding) against the store's SQLite database. Returns { columns, rows }. Never changes data. Use to read back rows/state you stored earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:"A single SELECT statement. Use ? placeholders + `params` for any values."},params:{type:"array",description:'Optional positional bind params for the SELECT, e.g. ["linkedin_personal"].'}},required:["sql"]}},{name:"file_put",description:"For FILE-type stores: write (or overwrite) ONE file at a relative path \u2014 raw JSON dumps, CSVs, images, snapshots, any blob you want to keep across your stateless runs. Text goes in `content`; binary goes base64-encoded in `contentBase64` (pass exactly one). Max 4 MiB per file. Overwriting the same path UPDATES the file. Returns { ok, path, size }.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},path:{type:"string",description:'Relative file path, e.g. "dumps/run-42.json" or "img/chart.png". Letters, digits, ".", "_", "-" and "/" only; no "..", no leading "/".'},content:{type:"string",description:"Text content (UTF-8). Use for JSON/CSV/text files."},contentBase64:{type:"string",description:"Base64-encoded binary content (images etc.). Alternative to `content`."},contentType:{type:"string",description:'Optional MIME type (e.g. "application/json", "image/png"). Defaults sensibly.'}},required:["path"]}},{name:"file_get",description:'For FILE-type stores: read ONE stored file back by its relative path. Text files come back as `content` (encoding "utf8"); binary files come back as `contentBase64` (encoding "base64"). Returns { path, size, contentType, lastModified, content|contentBase64, encoding }.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to fetch (as listed by file_list / used in file_put)."}},required:["path"]}},{name:"file_list",description:'For FILE-type stores: list the stored files \u2014 each entry has { path, size, lastModified }. Optionally filter by a path `prefix` (e.g. "dumps/"). Paginated via `cursor` when there are more results.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},prefix:{type:"string",description:'Optional path prefix filter, e.g. "dumps/" or "reports/2026".'},limit:{type:"number",description:"Max entries to return (default/max 1000)."},cursor:{type:"string",description:"Pagination cursor from a previous file_list response (nextCursor)."}},required:[]}},{name:"file_delete",description:"For FILE-type stores: delete ONE stored file by its relative path. Returns { ok, path, deleted }. Errors if the path does not exist.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to delete."}},required:["path"]}}]};export{w as __clearEnsuredStores,L as datasetStoreSkill};
package/dist/gitlab.js CHANGED
@@ -1,8 +1,8 @@
1
- import{existsSync as x}from"fs";import{fileURLToPath as E}from"url";import{dirname as U,resolve as C}from"path";var A=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"}),H=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},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 z,execSync as Y}from"child_process";import{existsSync as Q,mkdirSync as V,readdirSync as X,statSync as ee,readFileSync as te}from"fs";import{resolve as ie,join as se,basename as ne}from"path";function R(l,n,r,s,e="clone"){try{l(`git -C "${n}" remote set-url origin "${r}"`,{stdio:"pipe"})}catch(i){let t=String(i?.message||i);s&&(t=t.split(s).join("***")),console.error(`[${e}] WARNING: failed to strip token from .git/config: ${t}`)}}import $ from"crypto";var L=/<!--\s*zbfp:([a-f0-9]{8,20})\s*-->/i,O=/<!--\s*zbreview-summary\s*-->/i;function q(l){return String(l||"").replace(L,"").replace(O,"").replace(/\b(?:lines?|L)\s*#?\d+(?:\s*[-–]\s*\d+)?/gi,"").replace(/[`*_>#~]/g,"").replace(/\s+/g," ").trim().toLowerCase().slice(0,400)}function G(l,n){return $.createHash("sha256").update(`${String(l||"")}\0${q(n)}`).digest("hex").slice(0,12)}function M(l){return`
1
+ import{existsSync as M}from"fs";import{fileURLToPath as E}from"url";import{dirname as U,resolve as C}from"path";var A=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"}),H=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},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 z,execSync as Y}from"child_process";import{existsSync as Q,mkdirSync as V,readdirSync as X,statSync as ee,readFileSync as te}from"fs";import{resolve as ie,join as se,basename as ne}from"path";function R(l,n,r,s,e="clone"){try{l(`git -C "${n}" remote set-url origin "${r}"`,{stdio:"pipe"})}catch(i){let t=String(i?.message||i);s&&(t=t.split(s).join("***")),console.error(`[${e}] WARNING: failed to strip token from .git/config: ${t}`)}}import $ from"crypto";var L=/<!--\s*zbfp:([a-f0-9]{8,20})\s*-->/i,O=/<!--\s*zbreview-summary\s*-->/i;function q(l){return String(l||"").replace(L,"").replace(O,"").replace(/\b(?:lines?|L)\s*#?\d+(?:\s*[-–]\s*\d+)?/gi,"").replace(/[`*_>#~]/g,"").replace(/\s+/g," ").trim().toLowerCase().slice(0,400)}function G(l,n){return $.createHash("sha256").update(`${String(l||"")}\0${q(n)}`).digest("hex").slice(0,12)}function x(l){return`
2
2
 
3
3
  <!-- zbfp:${l} -->`}var N=`
4
4
 
5
- <!-- zbreview-summary -->`;function v(l){let n=L.exec(String(l||""));return n?n[1].toLowerCase():null}function k(l){return O.test(String(l||""))}function P(l,n){let r=new Set([...n||[]].map(i=>String(i).toLowerCase())),s=[],e=0;for(let i of Array.isArray(l)?l:[]){if(!i||!i.body)continue;let t=G(i.path,i.body);if(r.has(t)){e+=1;continue}r.add(t),s.push({...i,_fp:t,body:`${String(i.body)}${M(t)}`})}return{toPost:s,skipped:e}}function B(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let l=U(E(import.meta.url)),n=C(l,"..","bin","mcp-skill.mjs");return x(n)?n:null}function J(){let l=process.env.GITLAB_API_URL;if(l)return l.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 D(){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,n={}){let r=/^https?:\/\//.test(l)?l:`${J()}${l}`,s={Accept:"application/json","User-Agent":"Zibby-App",...D(),...n.body?{"Content-Type":"application/json"}:{}},e=await fetch(r,{method:n.method||"GET",headers:s,body:n.body?JSON.stringify(n.body):void 0});if(!e.ok){let i=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${i.slice(0,300)}`)}return n.raw?e.text():e.json()}function T(){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 F(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function g(l){let n=String(l);return/^\d+$/.test(n)?n:encodeURIComponent(n)}var ge={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:A.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)
5
+ <!-- zbreview-summary -->`;function v(l){let n=L.exec(String(l||""));return n?n[1].toLowerCase():null}function k(l){return O.test(String(l||""))}function P(l,n){let r=new Set([...n||[]].map(i=>String(i).toLowerCase())),s=[],e=0;for(let i of Array.isArray(l)?l:[]){if(!i||!i.body)continue;let t=G(i.path,i.body);if(r.has(t)){e+=1;continue}r.add(t),s.push({...i,_fp:t,body:`${String(i.body)}${x(t)}`})}return{toPost:s,skipped:e}}function B(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let l=U(E(import.meta.url)),n=C(l,"..","bin","mcp-skill.mjs");return M(n)?n:null}function J(){let l=process.env.GITLAB_API_URL;if(l)return l.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 D(){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,n={}){let r=/^https?:\/\//.test(l)?l:`${J()}${l}`,s={Accept:"application/json","User-Agent":"Zibby-App",...D(),...n.body?{"Content-Type":"application/json"}:{}},e=await fetch(r,{method:n.method||"GET",headers:s,body:n.body?JSON.stringify(n.body):void 0});if(!e.ok){let i=await e.text().catch(()=>"");throw new Error(`GitLab API ${e.status}: ${i.slice(0,300)}`)}return n.raw?e.text():e.json()}function T(){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 F(){return process.env.GITLAB_OAUTH_TOKEN||process.env.GITLAB_TOKEN||null}function g(l){let n=String(l);return/^\d+$/.test(n)?n:encodeURIComponent(n)}var ge={id:"gitlab",serverName:"gitlab",allowedTools:["mcp__gitlab__*"],requiresIntegration:A.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)
6
6
  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:
7
7
 
8
8
  ### Discovery