@zibby/skills 0.1.42 → 0.1.43
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/index.d.ts +1 -3
- package/dist/index.js +88 -106
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/reviewMemory.d.ts +0 -90
- package/dist/reviewMemory.js +0 -19
package/dist/package.json
CHANGED
package/package.json
CHANGED
package/dist/reviewMemory.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export namespace reviewMemorySkill {
|
|
2
|
-
let id: string;
|
|
3
|
-
let serverName: string;
|
|
4
|
-
let allowedTools: string[];
|
|
5
|
-
let description: string;
|
|
6
|
-
let promptFragment: string;
|
|
7
|
-
function resolve(): {
|
|
8
|
-
command: any;
|
|
9
|
-
args: any[];
|
|
10
|
-
env: {};
|
|
11
|
-
description: string;
|
|
12
|
-
type?: undefined;
|
|
13
|
-
alwaysLoad?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
type: string;
|
|
16
|
-
command: string;
|
|
17
|
-
args: any[];
|
|
18
|
-
env: {};
|
|
19
|
-
description: string;
|
|
20
|
-
alwaysLoad: boolean;
|
|
21
|
-
};
|
|
22
|
-
function handleToolCall(name: any, args: any): Promise<string>;
|
|
23
|
-
let tools: ({
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
input_schema: {
|
|
27
|
-
type: string;
|
|
28
|
-
properties: {
|
|
29
|
-
scope: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
query: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
scopePrefix?: undefined;
|
|
38
|
-
content?: undefined;
|
|
39
|
-
metadata?: undefined;
|
|
40
|
-
headSha?: undefined;
|
|
41
|
-
};
|
|
42
|
-
required: string[];
|
|
43
|
-
};
|
|
44
|
-
} | {
|
|
45
|
-
name: string;
|
|
46
|
-
description: string;
|
|
47
|
-
input_schema: {
|
|
48
|
-
type: string;
|
|
49
|
-
properties: {
|
|
50
|
-
scopePrefix: {
|
|
51
|
-
type: string;
|
|
52
|
-
description: string;
|
|
53
|
-
};
|
|
54
|
-
scope?: undefined;
|
|
55
|
-
query?: undefined;
|
|
56
|
-
content?: undefined;
|
|
57
|
-
metadata?: undefined;
|
|
58
|
-
headSha?: undefined;
|
|
59
|
-
};
|
|
60
|
-
required: string[];
|
|
61
|
-
};
|
|
62
|
-
} | {
|
|
63
|
-
name: string;
|
|
64
|
-
description: string;
|
|
65
|
-
input_schema: {
|
|
66
|
-
type: string;
|
|
67
|
-
properties: {
|
|
68
|
-
scope: {
|
|
69
|
-
type: string;
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
content: {
|
|
73
|
-
type: string;
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
metadata: {
|
|
77
|
-
type: string;
|
|
78
|
-
description: string;
|
|
79
|
-
};
|
|
80
|
-
headSha: {
|
|
81
|
-
type: string;
|
|
82
|
-
description: string;
|
|
83
|
-
};
|
|
84
|
-
query?: undefined;
|
|
85
|
-
scopePrefix?: undefined;
|
|
86
|
-
};
|
|
87
|
-
required: string[];
|
|
88
|
-
};
|
|
89
|
-
})[];
|
|
90
|
-
}
|
package/dist/reviewMemory.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{existsSync as a,readFileSync as u,mkdirSync as w,writeFileSync as h,renameSync as y}from"node:fs";import{homedir as _}from"node:os";import{join as d,dirname as m,resolve as f}from"node:path";import{fileURLToPath as v}from"node:url";function S(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let e=m(v(import.meta.url)),t=f(e,"..","bin","mcp-skill.mjs");return a(t)?t:null}function g(){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 e=d(_(),".zibby","config.json");return a(e)&&JSON.parse(u(e,"utf-8")).sessionToken||null}catch{return null}}function P(){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"}async function O(e,t){let r=g();if(!r)throw new Error("No backend credential (PROJECT_API_TOKEN). Review memory is only available inside a Zibby run.");let o=`${P()}/credits/review-memory`,n=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({op:e,...t})});if(!n.ok){let s=await n.text().catch(()=>"");throw new Error(`Review memory ${e} failed (${n.status}): ${s.slice(0,300)}`)}return n.json()}function R(){let e=process.env.ZIBBY_SELF_HOST;return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function A(){if(!R()||(process.env.ZIBBY_REVIEW_MEMORY_BACKEND||"").trim().toLowerCase()==="none")return null;let t=process.env.ZIBBY_REVIEW_MEMORY_PATH,r=t&&t.trim()?t.trim():d(".zibby","review-memory.json");return f(process.cwd(),r)}function i(e){try{if(!a(e))return{};let t=u(e,"utf-8");if(!t.trim())return{};let r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function b(e,t){let r=m(e);w(r,{recursive:!0});let o=`${e}.tmp-${process.pid}-${Date.now()}`;h(o,`${JSON.stringify(t,null,2)}
|
|
2
|
-
`,"utf-8"),y(o,e)}function l(e){return!e||typeof e!="object"?null:{scope:e.scope,content:e.content,metadata:e.metadata||null,headSha:e.headSha||null,createdAt:e.createdAt||null,updatedAt:e.updatedAt||null}}function T(e,t,r){if(t==="store"){let o=i(e),n=new Date().toISOString(),s=o[r.scope],p={scope:r.scope,content:r.content,metadata:r.metadata!=null?r.metadata:void 0,headSha:r.headSha!=null?r.headSha:void 0,createdAt:s&&s.createdAt||n,updatedAt:n};return o[r.scope]=p,b(e,o),{stored:!0,scope:r.scope,headSha:p.headSha||null,updatedAt:n}}if(t==="recall"){let n=i(e)[r.scope];return n?{found:!0,memory:l(n)}:{found:!1,memory:null}}if(t==="recall-prefix"){let o=i(e),n=Object.values(o).filter(s=>s&&typeof s.scope=="string"&&s.scope.startsWith(r.scopePrefix)).map(l).slice(0,25);return{count:n.length,truncated:!1,memories:n}}return{error:`Unknown op: ${t}`}}async function c(e,t){let r=A();return r?T(r,e,t):O(e,t)}var k={id:"review-memory",serverName:"review_memory",allowedTools:["mcp__review_memory__*"],description:"Review memory \u2014 persist & recall per-PR (configurable-scope) review notes across stateless runs",promptFragment:`## Review Memory (per-PR, configurable scope)
|
|
3
|
-
Persist what you pulled, found, and reasoned during a review so a FOLLOW-UP
|
|
4
|
-
run (a fresh stateless task replying on the same PR) can recall it. Storage is
|
|
5
|
-
keyed by a \`scope\` STRING you choose \u2014 nothing is hardcoded to per-PR:
|
|
6
|
-
- per-PR: scope = "review:owner/repo#<prNumber>" (the usual choice)
|
|
7
|
-
- per-repo: scope = "repo:owner/repo"
|
|
8
|
-
- per-org: scope = "org:owner"
|
|
9
|
-
Same tools, different scope string \u2014 pick the granularity you need.
|
|
10
|
-
|
|
11
|
-
Tools:
|
|
12
|
-
- review_memory_recall: At the START of a review, recall any prior note for
|
|
13
|
-
this PR's scope (e.g. "review:owner/repo#42"). If found, build on it instead
|
|
14
|
-
of re-deriving everything.
|
|
15
|
-
- review_memory_recall_prefix: List notes whose scope starts with a prefix
|
|
16
|
-
(e.g. "review:owner/repo#") \u2014 e.g. to see prior reviews across a repo.
|
|
17
|
-
- review_memory_store: At the END (or when you learn something durable), store
|
|
18
|
-
a concise note under the PR's scope. Pass headSha so a later run knows which
|
|
19
|
-
commit the note describes. Overwrites the prior note for that exact scope.`,resolve(){let e=S();if(!e)return{command:null,args:[],env:{},description:this.description};let t={};for(let r of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","ZIBBY_SELF_HOST","ZIBBY_REVIEW_MEMORY_BACKEND","ZIBBY_REVIEW_MEMORY_PATH"])process.env[r]&&(t[r]=process.env[r]);return{type:"stdio",command:"node",args:[e,"../dist/reviewMemory.js","reviewMemorySkill"],env:t,description:this.description,alwaysLoad:!0}},async handleToolCall(e,t){try{switch(e){case"review_memory_recall":{let r=typeof t?.scope=="string"?t.scope.trim():"";if(!r)return JSON.stringify({error:"scope is required"});let o=await c("recall",{scope:r});return JSON.stringify(o)}case"review_memory_recall_prefix":{let r=typeof t?.scopePrefix=="string"?t.scopePrefix.trim():"";if(!r)return JSON.stringify({error:"scopePrefix is required"});let o=await c("recall-prefix",{scopePrefix:r});return JSON.stringify(o)}case"review_memory_store":{let r=typeof t?.scope=="string"?t.scope.trim():"";if(!r)return JSON.stringify({error:"scope is required"});if(typeof t?.content!="string"||t.content.length===0)return JSON.stringify({error:"content is required (non-empty string)"});let o={scope:r,content:t.content};t.metadata!=null&&(o.metadata=t.metadata),t.headSha!=null&&(o.headSha=String(t.headSha));let n=await c("store",o);return JSON.stringify(n)}default:return JSON.stringify({error:`Unknown tool: ${e}`})}}catch(r){return JSON.stringify({error:r.message})}},tools:[{name:"review_memory_recall",description:'Recall the prior review note for a scope (exact match). Use at the start of a review to build on what an earlier run pulled/found/reasoned. scope is the storage key \u2014 e.g. "review:owner/repo#42" for per-PR.',input_schema:{type:"object",properties:{scope:{type:"string",description:'Storage key. Per-PR: "review:owner/repo#<prNumber>". Per-repo: "repo:owner/repo". Per-org: "org:owner". Or any custom string.'},query:{type:"string",description:"Optional free-text hint (reserved for future semantic recall; v1 ignores it \u2014 recall is exact-scope)."}},required:["scope"]}},{name:"review_memory_recall_prefix",description:'List review notes whose scope STARTS WITH a prefix (e.g. "review:owner/repo#" to see all prior PR reviews in a repo). Capped at 25 most-relevant.',input_schema:{type:"object",properties:{scopePrefix:{type:"string",description:'Scope prefix to match, e.g. "review:owner/repo#" or "repo:owner/".'}},required:["scopePrefix"]}},{name:"review_memory_store",description:"Store (overwrite) the review note for a scope so a follow-up run can recall it. Write a concise summary of what you pulled, found, and reasoned. Pass headSha so a later run knows which commit the note describes.",input_schema:{type:"object",properties:{scope:{type:"string",description:'Storage key. Per-PR: "review:owner/repo#<prNumber>". Or per-repo/per-org/custom. Same key you recall by.'},content:{type:"string",description:"The note: what was pulled, what was found, the reasoning. Free-form markdown/text."},metadata:{type:"object",description:"Optional structured metadata (e.g. {filesReviewed, verdict, severity})."},headSha:{type:"string",description:"Optional PR head commit SHA this note describes \u2014 lets a later run detect new commits."}},required:["scope","content"]}}]};export{k as reviewMemorySkill};
|