@zibby/skills 0.1.44 → 0.1.46
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/codebaseMemory.d.ts +31 -0
- package/dist/codebaseMemory.js +14 -0
- package/dist/git-write.d.ts +72 -0
- package/dist/git-write.js +12 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +95 -82
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export namespace codebaseMemorySkill {
|
|
2
|
+
let id: string;
|
|
3
|
+
let serverName: string;
|
|
4
|
+
let allowedTools: string[];
|
|
5
|
+
let description: string;
|
|
6
|
+
let promptFragment: string;
|
|
7
|
+
/**
|
|
8
|
+
* stdio MCP server = the BARE binary with NO subcommand (verified for
|
|
9
|
+
* v0.8.1). Never returns { command: null } — the binary is baked into the
|
|
10
|
+
* image; if it's somehow absent the server simply fails to spawn and its
|
|
11
|
+
* tools are unavailable, which does not crash the run.
|
|
12
|
+
*/
|
|
13
|
+
function resolve(): {
|
|
14
|
+
type: string;
|
|
15
|
+
command: any;
|
|
16
|
+
args: any[];
|
|
17
|
+
env: {
|
|
18
|
+
CBM_CACHE_DIR: any;
|
|
19
|
+
};
|
|
20
|
+
description: string;
|
|
21
|
+
alwaysLoad: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Pre-run hook (graph.js calls this for every skill declared on the node,
|
|
25
|
+
* before the agent runs). Index the checked-out repo ONCE per run with the
|
|
26
|
+
* imperative `cli index_repository` path. Idempotent via a per-repo marker
|
|
27
|
+
* under CBM_CACHE_DIR; fully wrapped so it NEVER throws into the run.
|
|
28
|
+
* Returns {} — it contributes no agent-visible options.
|
|
29
|
+
*/
|
|
30
|
+
function invokeAgentOptions(): {};
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{spawnSync as d}from"node:child_process";import{existsSync as s,mkdirSync as c,readdirSync as h,writeFileSync as u}from"node:fs";import{createHash as m}from"node:crypto";import{join as n}from"node:path";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 y(){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 l(e){return m("sha256").update(e).digest("hex").slice(0,16)}var v={id:"codebase-memory",serverName:"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
|
+
The checked-out repository is indexed into a queryable code graph + semantic
|
|
3
|
+
index. Reach for these instead of blindly grepping when you need structure,
|
|
4
|
+
relationships, or "where does X live / what depends on Y":
|
|
5
|
+
- get_architecture: high-level architecture / module map \u2014 START HERE to orient.
|
|
6
|
+
- search_graph: semantic-ish search over the code graph (symbols, files, concepts).
|
|
7
|
+
- query_graph: structured query against the graph schema (use get_graph_schema first).
|
|
8
|
+
- trace_path: trace a dependency / call path between two nodes (impact analysis).
|
|
9
|
+
- detect_changes: what changed vs the indexed baseline \u2014 scope your work.
|
|
10
|
+
- get_code_snippet / search_code: pull the exact code for a node / text match.
|
|
11
|
+
- index_status / list_projects: confirm the index is present before querying.
|
|
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=y();if(!e)return{};let r=a();try{c(r,{recursive:!0})}catch{}let t=n(r,`.cbm-indexed-${l(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{u(t,`${new Date().toISOString()} status=${p.status}
|
|
14
|
+
`)}catch{}}catch{}return{}}};export{v as codebaseMemorySkill};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const gitWriteSkill: {
|
|
2
|
+
id: string;
|
|
3
|
+
description: string;
|
|
4
|
+
envKeys: string[];
|
|
5
|
+
promptFragment: string;
|
|
6
|
+
resolve(): any;
|
|
7
|
+
handleToolCall(name: any, args: any, context: any): Promise<string>;
|
|
8
|
+
tools: ({
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
input_schema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
url: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
branch: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
shallow: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
name: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
repo?: undefined;
|
|
31
|
+
depth?: undefined;
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
input_schema: {
|
|
39
|
+
type: string;
|
|
40
|
+
properties: {
|
|
41
|
+
url?: undefined;
|
|
42
|
+
branch?: undefined;
|
|
43
|
+
shallow?: undefined;
|
|
44
|
+
name?: undefined;
|
|
45
|
+
repo?: undefined;
|
|
46
|
+
depth?: undefined;
|
|
47
|
+
};
|
|
48
|
+
required?: undefined;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
input_schema: {
|
|
54
|
+
type: string;
|
|
55
|
+
properties: {
|
|
56
|
+
repo: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
depth: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
url?: undefined;
|
|
65
|
+
branch?: undefined;
|
|
66
|
+
shallow?: undefined;
|
|
67
|
+
name?: undefined;
|
|
68
|
+
};
|
|
69
|
+
required: string[];
|
|
70
|
+
};
|
|
71
|
+
})[];
|
|
72
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{spawn as O}from"child_process";import{existsSync as p,mkdirSync as j,readdirSync as S,statSync as R,readFileSync as C}from"fs";import{resolve as x,join as l,basename as N}from"path";var v=".zibby/repos";function w(u,n,r={}){return new Promise((o,i)=>{let e=O(u,{cwd:n,shell:!0,env:{...process.env,GIT_TERMINAL_PROMPT:"0",...r}}),c="",f="";e.stdout.on("data",s=>{c+=s.toString()}),e.stderr.on("data",s=>{f+=s.toString()}),e.on("close",s=>{s!==0?i(new Error(`Exit ${s}: ${f.trim()||c.trim()}`)):o(c.trim())}),e.on("error",s=>i(s))})}var $={id:"git",description:"Clone and manage git repositories for codebase analysis",envKeys:["GITHUB_TOKEN","GITLAB_TOKEN"],promptFragment:`## Git Repositories
|
|
2
|
+
You can clone and explore git repositories locally for codebase analysis:
|
|
3
|
+
- git_checkout: Clone a repo (or pull if already cloned). Supports GitHub and GitLab with auto-auth.
|
|
4
|
+
- git_list_repos: List locally cloned repos
|
|
5
|
+
- git_explore: Quick overview of a cloned repo's structure (key files, package.json, routes, etc.)
|
|
6
|
+
|
|
7
|
+
When a test ticket lacks context, use this workflow:
|
|
8
|
+
1. Clone the relevant repo with git_checkout
|
|
9
|
+
2. Use git_explore to understand the project structure
|
|
10
|
+
3. Use shell commands (grep, cat) to read specific files for deeper understanding
|
|
11
|
+
4. Use GitHub/GitLab skills to read related PRs and commits
|
|
12
|
+
5. Build well-informed test specs and save them to files before running tests`,resolve(){return null},async handleToolCall(u,n,r){let o=r?.options?.workspace||process.cwd();try{switch(u){case"git_checkout":return await L(n,o);case"git_list_repos":return D(n,o);case"git_explore":return E(n,o);default:return JSON.stringify({error:`Unknown tool: ${u}`})}}catch(i){return JSON.stringify({error:i.message})}},tools:[{name:"git_checkout",description:"Clone a git repository locally (or pull latest if already cloned). Auto-authenticates with GitHub/GitLab tokens if available.",input_schema:{type:"object",properties:{url:{type:"string",description:'Repository URL (e.g. "https://github.com/org/repo" or "org/repo" shorthand for GitHub)'},branch:{type:"string",description:"Branch to checkout (default: repo default branch)"},shallow:{type:"boolean",description:"Shallow clone with depth 1 (default: true, faster)"},name:{type:"string",description:"Local directory name override (default: repo name from URL)"}},required:["url"]}},{name:"git_list_repos",description:"List locally cloned repositories",input_schema:{type:"object",properties:{}}},{name:"git_explore",description:"Quick structural overview of a cloned repo: key files, package.json info, directory tree (top 2 levels), detected framework/language",input_schema:{type:"object",properties:{repo:{type:"string",description:"Repo name (as listed by git_list_repos)"},depth:{type:"number",description:"Directory tree depth (default: 2)"}},required:["repo"]}}]};async function L(u,n){let{url:r,branch:o,shallow:i=!0,name:e}=u;!r.includes("://")&&!r.startsWith("git@")&&(r=`https://github.com/${r}`);let c=e||N(r.replace(/\.git$/,"")),f=x(n,v);j(f,{recursive:!0});let s=l(f,c),h=r,g=process.env.GITHUB_TOKEN,m=process.env.GITLAB_TOKEN,k=process.env.GITLAB_URL;if(r.includes("github.com")&&g)h=r.replace("https://github.com",`https://x-access-token:${g}@github.com`);else if(m&&k)try{let d=new URL(k).host;r.includes(d)&&(h=r.replace(`https://${d}`,`https://oauth2:${m}@${d}`))}catch{}if(p(l(s,".git"))){let d=o?`git -C "${s}" fetch origin ${o} && git -C "${s}" checkout ${o} && git -C "${s}" pull origin ${o}`:`git -C "${s}" pull`;await w(d,n);let b=await w(`git -C "${s}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"updated",repo:c,path:s,branch:o||"default",head:b})}let t=["git","clone"];i&&t.push("--depth","1"),o&&t.push("--branch",o),t.push(`"${h}"`,`"${s}"`),await w(t.join(" "),n);let _=await w(`git -C "${s}" log -1 --format="%h %s"`,n);return JSON.stringify({action:"cloned",repo:c,path:s,branch:o||"default",shallow:i,head:_})}function D(u,n){let r=x(n,v);if(!p(r))return JSON.stringify({repos:[],message:"No repos cloned yet"});let o=[];for(let i of S(r,{withFileTypes:!0})){if(!i.isDirectory())continue;let e=l(r,i.name);if(!p(l(e,".git")))continue;let c=R(e);o.push({name:i.name,path:e,lastModified:c.mtime.toISOString()})}return JSON.stringify({repos:o,total:o.length,directory:r})}function E(u,n){let{repo:r,depth:o=2}=u,i=x(n,v,r);if(!p(i))return JSON.stringify({error:`Repo not found: ${r}. Run git_checkout first.`});let e={repo:r,path:i},c=l(i,"package.json");if(p(c))try{let t=JSON.parse(C(c,"utf-8"));e.packageJson={name:t.name,version:t.version,scripts:t.scripts?Object.keys(t.scripts):[],dependencies:t.dependencies?Object.keys(t.dependencies).slice(0,30):[],devDependencies:t.devDependencies?Object.keys(t.devDependencies).slice(0,20):[]},t.dependencies?.react?e.framework="React":t.dependencies?.next?e.framework="Next.js":t.dependencies?.vue?e.framework="Vue":t.dependencies?.angular?e.framework="Angular":t.dependencies?.express?e.framework="Express":t.dependencies?.fastify&&(e.framework="Fastify")}catch{}let f=l(i,"pyproject.toml");p(f)&&(e.language="Python");let s=l(i,"go.mod");p(s)&&(e.language="Go");let h=l(i,"Cargo.toml");p(h)&&(e.language="Rust"),p(c)&&(e.language=e.language||"JavaScript/TypeScript");let g=[];function m(t,_,d){if(d>o)return;let b;try{b=S(t,{withFileTypes:!0})}catch{return}let T=b.filter(a=>!a.name.startsWith(".")&&a.name!=="node_modules"&&a.name!=="__pycache__"&&a.name!=="dist"&&a.name!=="build"&&a.name!==".git").sort((a,y)=>a.isDirectory()!==y.isDirectory()?a.isDirectory()?-1:1:a.name.localeCompare(y.name));for(let a of T){let y=a.isDirectory();g.push(`${_}${y?"\u{1F4C1}":"\u{1F4C4}"} ${a.name}`),y&&d<o&&m(l(t,a.name),`${_} `,d+1)}}m(i,"",1),e.tree=g.slice(0,80),g.length>80&&(e.treeTruncated=!0);let k=["README.md","README.rst","src/App.tsx","src/App.jsx","src/App.js","src/routes.tsx","src/routes.js","app/routes.tsx","app/routes.js","src/index.tsx","src/index.ts","src/main.tsx","src/main.ts","pages/_app.tsx","pages/_app.js","app/layout.tsx","docker-compose.yml","Dockerfile",".env.example"];return e.keyFilesFound=k.filter(t=>p(l(i,t))),JSON.stringify(e)}var I={...$,id:"git-write"};export{I as gitWriteSkill};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export namespace SKILLS {
|
|
|
8
8
|
let PLANE: string;
|
|
9
9
|
let OPEN_DESIGN: string;
|
|
10
10
|
let GIT: string;
|
|
11
|
+
let GIT_WRITE: string;
|
|
11
12
|
let SLACK: string;
|
|
12
13
|
let LARK: string;
|
|
13
14
|
let NOTION: string;
|
|
@@ -19,6 +20,7 @@ export namespace SKILLS {
|
|
|
19
20
|
let CORE_TOOLS: string;
|
|
20
21
|
let CHAT_MEMORY: string;
|
|
21
22
|
let KV_MEMORY: string;
|
|
23
|
+
let CODEBASE_MEMORY: string;
|
|
22
24
|
let WORKFLOW_BUILDER: string;
|
|
23
25
|
let OPENAI_BILLING: string;
|
|
24
26
|
let ANTHROPIC_BILLING: string;
|
|
@@ -33,6 +35,7 @@ import { linearSkill } from './linear.js';
|
|
|
33
35
|
import { planeSkill } from './plane.js';
|
|
34
36
|
import { opendesignSkill } from './opendesign.js';
|
|
35
37
|
import { gitSkill } from './git.js';
|
|
38
|
+
import { gitWriteSkill } from './git-write.js';
|
|
36
39
|
import { slackSkill } from './slack.js';
|
|
37
40
|
import { larkSkill } from './lark.js';
|
|
38
41
|
import { notionSkill } from './notion.js';
|
|
@@ -41,11 +44,12 @@ import { sentrySkill } from './sentry.js';
|
|
|
41
44
|
import { memorySkill } from './memory.js';
|
|
42
45
|
import { chatMemorySkill } from './chat-memory.js';
|
|
43
46
|
import { kvMemorySkill } from './kvMemory.js';
|
|
47
|
+
import { codebaseMemorySkill } from './codebaseMemory.js';
|
|
44
48
|
import { testRunnerSkill } from './test-runner.js';
|
|
45
49
|
import { skillInstallerSkill } from './skill-installer.js';
|
|
46
50
|
import { coreToolsSkill } from './core-tools.js';
|
|
47
51
|
import { workflowBuilderSkill } from './workflow-builder.js';
|
|
48
|
-
export { browserSkill, jiraSkill, githubSkill, gitlabSkill, figmaSkill, linearSkill, planeSkill, opendesignSkill, gitSkill, slackSkill, larkSkill, notionSkill, chatNotifySkill, sentrySkill, memorySkill, chatMemorySkill, kvMemorySkill, testRunnerSkill, testRunnerSkill as runnerSkill, skillInstallerSkill, coreToolsSkill, workflowBuilderSkill };
|
|
52
|
+
export { browserSkill, jiraSkill, githubSkill, gitlabSkill, figmaSkill, linearSkill, planeSkill, opendesignSkill, gitSkill, gitWriteSkill, slackSkill, larkSkill, notionSkill, chatNotifySkill, sentrySkill, memorySkill, chatMemorySkill, kvMemorySkill, codebaseMemorySkill, testRunnerSkill, testRunnerSkill as runnerSkill, skillInstallerSkill, coreToolsSkill, workflowBuilderSkill };
|
|
49
53
|
export { openaiBillingSkill, anthropicBillingSkill, cursorAdminSkill, fetchOpenAICosts, fetchOpenAIProjects, fetchAnthropicCosts, fetchAnthropicWorkspaces, fetchCursorSpend, fetchAllProviders, groupByKey, meanStddev } from "./llm-billing.js";
|
|
50
54
|
export { reportObjectSchema, reportToBlockKit, reportToLarkCard, SEVERITIES as REPORT_SEVERITIES } from "./report.js";
|
|
51
55
|
export { skill, functionSkill } from "./function-skill.js";
|