@kelceyp/swic 0.1.6 → 0.1.8

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.
@@ -11,9 +11,9 @@ Error: ${J}`)}},W2=()=>{let f;try{f=TJ.findProjectRoot()}catch{f=mJ(process.cwd(
11
11
  `:`[${J[B]}\r
12
12
  ]`;continue}if(Q+=J[B],J[B]==="\\")X=!0;else if(Y&&J[B]==="]")Y=!1;else if(!Y&&J[B]==="[")Y=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function F0(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??Mv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===C.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=H0(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===C.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===C.ZodBranded&&f.keyType._def.type._def.typeName===C.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=U0(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function p9(f,v){if(v.mapStrategy==="record")return F0(f,v);let W=o(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||Mv(v),J=o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||Mv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,J],minItems:2,maxItems:2}}}function i9(f){let v=f.values,J=Object.keys(f.values).filter((X)=>{return typeof v[v[X]]!=="number"}).map((X)=>v[X]),Q=Array.from(new Set(J.map((X)=>typeof X)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function d9(f){return f.target==="openAi"?void 0:{not:Mv({...f,currentPath:[...f.currentPath,"not"]})}}function o9(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var k1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function t9(f,v){if(v.target==="openApi3")return s9(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((J)=>(J._def.typeName in k1)&&(!J._def.checks||!J._def.checks.length))){let J=W.reduce((Q,X)=>{let Y=k1[X._def.typeName];return Y&&!Q.includes(Y)?[...Q,Y]:Q},[]);return{type:J.length>1?J:J[0]}}else if(W.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=W.reduce((Q,X)=>{let Y=typeof X._def.value;switch(Y){case"string":case"number":case"boolean":return[...Q,Y];case"bigint":return[...Q,"integer"];case"object":if(X._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===W.length){let Q=J.filter((X,Y,w)=>w.indexOf(X)===Y);return{type:Q.length>1?Q:Q[0],enum:W.reduce((X,Y)=>{return X.includes(Y._def.value)?X:[...X,Y._def.value]},[])}}}else if(W.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((J,Q)=>[...J,...Q._def.values.filter((X)=>!J.includes(X))],[])};return s9(f,v)}var s9=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>o(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return W.length?{anyOf:W}:void 0};function e9(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:k1[f.innerType._def.typeName],nullable:!0};return{type:[k1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=o(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function vJ(f,v){let W={type:"number"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"int":W.type="integer",FQ(W,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function fJ(f,v){let W=v.target==="openAi",J={type:"object",properties:{}},Q=[],X=f.shape();for(let w in X){let B=X[w];if(B===void 0||B._def===void 0)continue;let z=eY(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let K=o(B._def,{...v,currentPath:[...v.currentPath,"properties",w],propertyPath:[...v.currentPath,"properties",w]});if(K===void 0)continue;if(J.properties[w]=K,!z)Q.push(w)}if(Q.length)J.required=Q;let Y=tY(f,v);if(Y!==void 0)J.additionalProperties=Y;return J}function tY(f,v){if(f.catchall._def.typeName!=="ZodNever")return o(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function eY(f){try{return f.isOptional()}catch{return!0}}var QJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return o(f.innerType._def,v);let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:Mv(v)},W]}:Mv(v)};var WJ=(f,v)=>{if(v.pipeStrategy==="input")return o(f.in._def,v);else if(v.pipeStrategy==="output")return o(f.out._def,v);let W=o(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=o(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,J].filter((Q)=>Q!==void 0)}};function JJ(f,v){return o(f.type._def,v)}function XJ(f,v){let J={type:"array",uniqueItems:!0,items:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Wv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Wv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function YJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[]),additionalItems:o(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[])}}function wJ(f){return{not:Mv(f)}}function GJ(f){return Mv(f)}var BJ=(f,v)=>{return o(f.innerType._def,v)};var qJ=(f,v,W)=>{switch(v){case C.ZodString:return H0(f,W);case C.ZodNumber:return vJ(f,W);case C.ZodObject:return fJ(f,W);case C.ZodBigInt:return C9(f,W);case C.ZodBoolean:return T9();case C.ZodDate:return AQ(f,W);case C.ZodUndefined:return wJ(W);case C.ZodNull:return o9(W);case C.ZodArray:return Z9(f,W);case C.ZodUnion:case C.ZodDiscriminatedUnion:return t9(f,W);case C.ZodIntersection:return a9(f,W);case C.ZodTuple:return YJ(f,W);case C.ZodRecord:return F0(f,W);case C.ZodLiteral:return c9(f,W);case C.ZodEnum:return r9(f);case C.ZodNativeEnum:return i9(f);case C.ZodNullable:return e9(f,W);case C.ZodOptional:return QJ(f,W);case C.ZodMap:return p9(f,W);case C.ZodSet:return XJ(f,W);case C.ZodLazy:return()=>f.getter()._def;case C.ZodPromise:return JJ(f,W);case C.ZodNaN:case C.ZodNever:return d9(W);case C.ZodEffects:return m9(f,W);case C.ZodAny:return Mv(W);case C.ZodUnknown:return GJ(W);case C.ZodDefault:return u9(f,W);case C.ZodBranded:return U0(f,W);case C.ZodReadonly:return BJ(f,W);case C.ZodCatch:return x9(f,W);case C.ZodPipeline:return WJ(f,W);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return((J)=>{return})(v)}};function o(f,v,W=!1){let J=v.seen.get(f);if(v.override){let w=v.override?.(f,v,J,W);if(w!==y9)return w}if(J&&!W){let w=v7(J,v);if(w!==void 0)return w}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let X=qJ(f,f.typeName,v),Y=typeof X==="function"?o(X(),v):X;if(Y)f7(f,v,Y);if(v.postProcess){let w=v.postProcess(Y,f,v);return Q.jsonSchema=Y,w}return Q.jsonSchema=Y,Y}var v7=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:O0(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,J)=>v.currentPath[J]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),Mv(v);return v.$refStrategy==="seen"?Mv(v):void 0}}},f7=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var A0=(f,v)=>{let W=I9(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[z,K])=>({...B,[z]:o(K._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??Mv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,X=o(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??Mv(W),Y=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(Y!==void 0)X.title=Y;if(W.flags.hasReferencedOpenAiAnyType){if(!J)J={};if(!J[W.openAiAnyTypeName])J[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let w=Q===void 0?J?{...X,[W.definitionPath]:J}:X:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...J,[Q]:X}};if(W.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var hQ;(function(f){f.Completable="McpCompletable"})(hQ||(hQ={}));class S1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}S1.create=(f,v)=>{return new S1({type:f,typeName:hQ.Completable,complete:v.complete,...Q7(v)})};function Q7(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{var B,z;let{message:K}=f;if(Y.code==="invalid_enum_value")return{message:K!==null&&K!==void 0?K:w.defaultError};if(typeof w.data==="undefined")return{message:(B=K!==null&&K!==void 0?K:J)!==null&&B!==void 0?B:w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:(z=K!==null&&K!==void 0?K:W)!==null&&z!==void 0?z:w.defaultError}},description:Q}}class bQ{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new HQ(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(f0.shape.method.value),this.server.assertCanSetRequestHandler(Q0.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(f0,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?A0(v.inputSchema,{strictUnions:!0}):W7,annotations:v.annotations,_meta:v._meta};if(v.outputSchema)W.outputSchema=A0(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(Q0,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let X=Q.data,Y=W.callback;try{J=await Promise.resolve(Y(X,v))}catch(w){J={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=W.callback;try{J=await Promise.resolve(Q(v))}catch(X){J={content:[{type:"text",text:X instanceof Error?X.message:String(X)}],isError:!0}}}if(W.outputSchema&&!J.isError){if(!J.structuredContent)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(W0.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(W0,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new zv(Kv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return g0;let J=W.argsSchema.shape[f.params.argument.name];if(!(J instanceof S1))return g0;let X=await J._def.complete(f.params.argument.value,f.params.context);return KJ(X)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((X)=>X.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return g0;throw new zv(Kv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=W.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return g0;let Q=await J(f.params.argument.value,f.params.context);return KJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(o1.shape.method.value),this.server.assertCanSetRequestHandler(s1.shape.method.value),this.server.assertCanSetRequestHandler(t1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(o1,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,X])=>X.enabled).map(([Q,X])=>({uri:Q,name:X.name,...X.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let X=await Q.resourceTemplate.listCallback(v);for(let Y of X.resources)J.push({...Q.metadata,...Y})}return{resources:[...W,...J]}}),this.server.setRequestHandler(s1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(t1,async(f,v)=>{let W=new URL(f.params.uri),J=this._registeredResources[W.toString()];if(J){if(!J.enabled)throw new zv(Kv.InvalidParams,`Resource ${W} disabled`);return J.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let X=Q.resourceTemplate.uriTemplate.match(W.toString());if(X)return Q.readCallback(W,X,v)}throw new zv(Kv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(e1.shape.method.value),this.server.assertCanSetRequestHandler(v0.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(e1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?X7(v.argsSchema):void 0}})})),this.server.setRequestHandler(v0,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let J=await W.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new zv(Kv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,X=W.callback;return await Promise.resolve(X(Q,v))}else{let J=W.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let J;if(typeof W[0]==="object")J=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let X=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let X=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}registerResource(f,v,W,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,J,Q){let X={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({uri:null}),update:(Y)=>{if(typeof Y.uri!=="undefined"&&Y.uri!==W){if(delete this._registeredResources[W],Y.uri)this._registeredResources[Y.uri]=X}if(typeof Y.name!=="undefined")X.name=Y.name;if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=X,X}_createRegisteredResourceTemplate(f,v,W,J,Q){let X={resourceTemplate:W,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredResourceTemplates[f],Y.name)this._registeredResourceTemplates[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.template!=="undefined")X.resourceTemplate=Y.template;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=X,X}_createRegisteredPrompt(f,v,W,J,Q){let X={title:v,description:W,argsSchema:J===void 0?void 0:G.object(J),callback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredPrompts[f],Y.name)this._registeredPrompts[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.description!=="undefined")X.description=Y.description;if(typeof Y.argsSchema!=="undefined")X.argsSchema=G.object(Y.argsSchema);if(typeof Y.callback!=="undefined")X.callback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=X,X}_createRegisteredTool(f,v,W,J,Q,X,Y,w){let B={title:v,description:W,inputSchema:J===void 0?void 0:G.object(J),outputSchema:Q===void 0?void 0:G.object(Q),annotations:X,_meta:Y,callback:w,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==f){if(delete this._registeredTools[f],z.name)this._registeredTools[z.name]=B}if(typeof z.title!=="undefined")B.title=z.title;if(typeof z.description!=="undefined")B.description=z.description;if(typeof z.paramsSchema!=="undefined")B.inputSchema=G.object(z.paramsSchema);if(typeof z.callback!=="undefined")B.callback=z.callback;if(typeof z.annotations!=="undefined")B.annotations=z.annotations;if(typeof z._meta!=="undefined")B._meta=z._meta;if(typeof z.enabled!=="undefined")B.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,J,Q,X;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let w=v[0];if(PJ(w)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!PJ(v[0]))X=v.shift()}else if(typeof w==="object"&&w!==null)X=v.shift()}let Y=v[0];return this._createRegisteredTool(f,void 0,W,J,Q,X,void 0,Y)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:X,outputSchema:Y,annotations:w,_meta:B}=v;return this._createRegisteredTool(f,J,Q,X,Y,w,B,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],X=this._createRegisteredPrompt(f,void 0,W,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:X}=v,Y=this._createRegisteredPrompt(f,J,Q,X,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(f,v){return this.server.sendLoggingMessage(f,v)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var W7={type:"object",properties:{}};function PJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(J7)}function J7(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function X7(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function KJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var g0={completion:{values:[],hasMore:!1}};import $J from"process";class RQ{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
13
13
  `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),Y7(v)}clear(){this._buffer=void 0}}function Y7(f){return O8.parse(JSON.parse(f))}function zJ(f){return JSON.stringify(f)+`
14
- `}class kQ{constructor(f=$J.stdin,v=$J.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new RQ,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=zJ(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var SQ={name:"@kelceyp/swic",version:"0.1.6",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:build":"bash tests/e2e/build-test-image.sh","test:e2e:rebuild":"bash tests/e2e/build-test-image.sh && bash tests/e2e/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.1.9","@kelceyp/swic":"^0.1.5","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",esbuild:"^0.25.11",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var G7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup" or "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},B7=Object.freeze({create:G7}),LJ=B7;var _0=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};K1();var L7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs using optimistic locking. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),expectedHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash for each doc.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,expectedHash:Y}=J,w=_0(Q),B=await Promise.all(w.map(async(q)=>{let N=xv.isdocId(q)?{kind:"id",scope:X,id:q}:{kind:"path",scope:X,path:q},$=await f.DocService.read(N);return{identifier:q,address:N,doc:$}})),z=[];for(let q of B){let M=Y||q.doc.hash,N=await f.DocService.deleteLatest(q.address,M);z.push({id:q.doc.id,deleted:N.deleted})}let K=z.filter((q)=>q.deleted),L=z.length-K.length,V={deleted:K.map((q)=>q.id),alreadyDeleted:z.filter((q)=>!q.deleted).map((q)=>q.id),message:`Deleted ${K.length} doc${K.length!==1?"s":""}`+(L>0?`, ${L} ${L!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify(V,null,2)}]}}})},M7=Object.freeze({create:L7}),VJ=M7;K1();var N7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses optimistic locking to prevent concurrent modifications.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform"),baseHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y,baseHash:w}=J,B;switch(Y.type){case"replaceOnce":B={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":B={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":B={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":B={op:"replaceAllContent",content:Y.content};break;default:throw new Error(`Unknown operation type: ${Y.type}`)}let K=xv.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},L=w;if(!L)L=(await f.DocService.read(K)).hash;let V=await f.DocService.editLatest(K,L,[B]);return{content:[{type:"text",text:`Edited doc: ${Q}
14
+ `}class kQ{constructor(f=$J.stdin,v=$J.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new RQ,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=zJ(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var SQ={name:"@kelceyp/swic",version:"0.1.8",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:build":"bash tests/e2e/build-test-image.sh","test:e2e:rebuild":"bash tests/e2e/build-test-image.sh && bash tests/e2e/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.1.9","@kelceyp/swic":"^0.1.7","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",esbuild:"^0.25.11",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var G7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup" or "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},B7=Object.freeze({create:G7}),LJ=B7;var _0=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};K1();var L7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs using optimistic locking. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),expectedHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash for each doc.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,expectedHash:Y}=J,w=_0(Q),B=await Promise.all(w.map(async(q)=>{let N=xv.isdocId(q)?{kind:"id",scope:X,id:q}:{kind:"path",scope:X,path:q},$=await f.DocService.read(N);return{identifier:q,address:N,doc:$}})),z=[];for(let q of B){let M=Y||q.doc.hash,N=await f.DocService.deleteLatest(q.address,M);z.push({id:q.doc.id,deleted:N.deleted})}let K=z.filter((q)=>q.deleted),L=z.length-K.length,V={deleted:K.map((q)=>q.id),alreadyDeleted:z.filter((q)=>!q.deleted).map((q)=>q.id),message:`Deleted ${K.length} doc${K.length!==1?"s":""}`+(L>0?`, ${L} ${L!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify(V,null,2)}]}}})},M7=Object.freeze({create:L7}),VJ=M7;K1();var N7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses optimistic locking to prevent concurrent modifications.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform"),baseHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y,baseHash:w}=J,B;switch(Y.type){case"replaceOnce":B={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":B={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":B={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":B={op:"replaceAllContent",content:Y.content};break;default:throw new Error(`Unknown operation type: ${Y.type}`)}let K=xv.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},L=w;if(!L)L=(await f.DocService.read(K)).hash;let V=await f.DocService.editLatest(K,L,[B]);return{content:[{type:"text",text:`Edited doc: ${Q}
15
15
  Applied: ${V.applied} edit operation(s)
16
16
  New hash: ${V.newHash}`}]}}})},V7=Object.freeze({create:N7}),DJ=V7;var D7=(f)=>{let v={name:"doc_list",description:"List docs with optional filtering. Returns structured JSON with doc metadata. When no scope specified, lists from both scopes with override detection.",inputSchema:{scope:G.enum(["project","shared"]).optional().describe("Optional scope filter. If omitted, lists from both scopes and detects overrides (project docs that shadow shared ones)"),pathPrefix:G.string().optional().describe('Optional path prefix filter (e.g., "auth/" to list only docs in auth namespace)'),includeContent:G.boolean().optional().default(!1).describe("Include synopsis from front matter in results")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,pathPrefix:X,includeContent:Y}=J,w=await f.DocService.list({scope:Q,pathPrefix:X,includeContent:Y===!0}),B;if(!Q){let K=w.filter((M)=>M.id.startsWith("doc")),L=w.filter((M)=>M.id.startsWith("sdoc")),V=new Set(K.map((M)=>M.path)),q=new Set(L.map((M)=>M.path));B=w.map((M)=>{let N=M.id.startsWith("doc"),$;if(N&&q.has(M.path))$="overrides";else if(!N&&V.has(M.path))$="overridden";return{id:M.id,path:M.path,scope:N?"project":"shared",override:$,synopsis:M.synopsis,modifiedAt:M.modifiedAt}})}else B=w.map((K)=>({id:K.id,path:K.path,scope:K.id.startsWith("doc")?"project":"shared",synopsis:K.synopsis,modifiedAt:K.modifiedAt}));B.sort((K,L)=>K.path.localeCompare(L.path));let z={docs:B,count:B.length};return{content:[{type:"text",text:JSON.stringify(z,null,2)}]}}})},j7=Object.freeze({create:D7}),jJ=j7;K1();var E7=(f)=>{let v={name:"doc_move",description:"Move or rename a doc to a new path. Generates a new ID. Supports cross-scope moves.",inputSchema:{source:G.string().describe('Source doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),destination:G.string().describe("Destination path (not ID) for the doc"),sourceScope:G.enum(["project","shared"]).optional().describe("Optional. Source scope. Auto-resolves if omitted."),destinationScope:G.enum(["project","shared"]).optional().describe("Optional. Destination scope. Defaults to source scope if omitted.")}};return Object.freeze({definition:v,handler:async(J)=>{let{source:Q,destination:X,sourceScope:Y,destinationScope:w}=J,z=xv.isdocId(Q)?{kind:"id",scope:Y,id:Q}:{kind:"path",scope:Y,path:Q},K=await f.DocService.read(z),L=K.id.startsWith("sdoc")?"shared":"project",V=w||L,q=L!==V;if(K.path===X&&L===V)throw new Error("Source and destination are identical");try{throw await f.DocService.read({kind:"path",scope:V,path:X}),new Error(`Destination already exists: ${V} ${X}`)}catch($){if(!($.message.includes("No doc")||$.message.includes("not found")||$.message.includes("File or directory")))throw $}let M=await f.DocService.create({address:{kind:"path",path:X,scope:V},content:K.content});await f.DocService.deleteLatest(z,K.hash);let N={oldId:K.id,newId:M.id,oldPath:K.path,newPath:X,oldScope:L,newScope:V,message:q?`Moved doc across scopes from ${L} ${K.path} (${K.id}) to ${V} ${X} (new ID: ${M.id})`:`Moved doc from ${K.path} (${K.id}) to ${X} (new ID: ${M.id})`};return{content:[{type:"text",text:JSON.stringify(N,null,2)}]}}})},O7=Object.freeze({create:E7}),EJ=O7;K1();var U7=(f)=>{let v={name:"doc_read",description:"Read one or more docs by ID or path. Returns content with optional metadata. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk read")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. If omitted, auto-resolves (checks project first, then shared, or infers from ID prefix)"),includeMetadata:G.boolean().optional().default(!1).describe("Include ID, path, and hash metadata header for each doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,includeMetadata:Y}=J,w=_0(Q),B=await Promise.all(w.map(async(L)=>{let V=xv.isdocId(L);return await f.DocService.read(V?{kind:"id",scope:X,id:L}:{kind:"path",scope:X,path:L})})),z=[];for(let L=0;L<B.length;L++){let V=B[L];if(Y)z.push(`ID: ${V.id}`),z.push(`Path: ${V.path}`),z.push(`Hash: ${V.hash}`),z.push("---");let q=V.content;if(!q.endsWith(`
17
17
  `))q+=`
18
18
  `;if(z.push(q),L<B.length-1)z.push("")}return{content:[{type:"text",text:z.join(`
19
- `)}]}}})},H7=Object.freeze({create:U7}),OJ=H7;var UJ=[LJ.create,VJ.create,DJ.create,jJ.create,EJ.create,OJ.create];var cJ=(f)=>{let{services:v}=f,W=SQ.name,J=SQ.version,Q=new bQ({name:W,version:J});return Object.freeze({start:async()=>{for(let w of UJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z))}let Y=new kQ;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},w2=async()=>{let{default:f}=await Promise.resolve().then(() => (aJ(),rJ)),{projectDataDir:v,sharedDataDir:W}=f.lazilyGetDataDirs(),J=f.createServices({projectBoundaryDir:v,sharedBoundaryDir:W});await cJ({services:J}).start()},G2=Object.freeze({create:cJ});if(import.meta.main)w2().catch(console.error);var qq=G2;export{qq as default};
19
+ `)}]}}})},H7=Object.freeze({create:U7}),OJ=H7;var UJ=[LJ.create,VJ.create,DJ.create,jJ.create,EJ.create,OJ.create];var cJ=(f)=>{let{services:v}=f,W=SQ.name,J=SQ.version,Q=new bQ({name:W,version:J});return Object.freeze({start:async()=>{for(let w of UJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z))}let Y=new kQ;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},w2=async()=>{let{default:f}=await Promise.resolve().then(() => (aJ(),rJ)),{projectDataDir:v,sharedDataDir:W}=f.lazilyGetDataDirs(),J=f.createServices({projectBoundaryDir:v,sharedBoundaryDir:W});await cJ({services:J}).start()},G2=Object.freeze({create:cJ});if(import.meta.main??import.meta.url===`file://${process.argv[1]}`)w2().catch(console.error);var qq=G2;export{qq as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kelceyp/swic",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",
5
5
  "type": "module",
6
6
  "main": "dist/server/Server.js",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@kelceyp/clibuilder": "^0.1.9",
29
- "@kelceyp/swic": "^0.1.5",
29
+ "@kelceyp/swic": "^0.1.7",
30
30
  "@modelcontextprotocol/sdk": "^1.0.0",
31
31
  "debug": "^4.4.3"
32
32
  },