@decaf-ts/mcp-server 1.5.1 → 1.5.2
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/assets/code/patterns/builder.enc +0 -0
- package/dist/assets/prompts/agent/agent.enc +0 -0
- package/dist/assets/prompts/agent/init.enc +0 -0
- package/dist/assets/prompts/constitution_commands.enc +0 -0
- package/dist/assets/prompts/documentation/class.enc +0 -0
- package/dist/assets/prompts/documentation/constant.enc +0 -0
- package/dist/assets/prompts/documentation/decorator.enc +0 -0
- package/dist/assets/prompts/documentation/file.enc +0 -0
- package/dist/assets/prompts/documentation/function.enc +0 -0
- package/dist/assets/prompts/documentation/interface.enc +0 -0
- package/dist/assets/prompts/documentation/iterate.enc +0 -0
- package/dist/assets/prompts/documentation/module.enc +0 -0
- package/dist/assets/prompts/documentation/prefix.enc +0 -0
- package/dist/assets/prompts/documentation/repo.enc +0 -0
- package/dist/assets/prompts/documentation/suffix.enc +0 -0
- package/dist/assets/prompts/git_commands.enc +0 -0
- package/dist/assets/prompts/jira/operational_prompts.enc +0 -0
- package/dist/assets/prompts/jira/system_prompt.enc +0 -0
- package/dist/assets/prompts/mode_commands.enc +0 -0
- package/dist/assets/prompts/plan_commands.enc +0 -0
- package/dist/assets/prompts/repository/readme.enc +0 -0
- package/dist/assets/prompts/repository/release_notes.enc +0 -0
- package/dist/assets/prompts/repository/setup.enc +0 -0
- package/dist/assets/prompts/specification_commands.enc +0 -0
- package/dist/assets/prompts/startup_command.enc +0 -0
- package/dist/assets/prompts/task_commands.enc +0 -0
- package/dist/assets/prompts/tests/coverage.enc +0 -0
- package/dist/assets/templates/AGENTS.enc +0 -0
- package/dist/assets/templates/agents_template.enc +0 -0
- package/dist/assets/templates/constitution_template.enc +0 -0
- package/dist/assets/templates/decaf/context/logCtx.enc +0 -0
- package/dist/assets/templates/decaf/services/client_based_service.enc +0 -0
- package/dist/assets/templates/decaf/services/model_service.enc +0 -0
- package/dist/assets/templates/decaf/services/service.enc +0 -0
- package/dist/assets/templates/decaf_guidelines.enc +0 -0
- package/dist/assets/templates/instructions_template.enc +0 -0
- package/dist/assets/templates/jira_templates.enc +0 -0
- package/dist/assets/templates/plan_template.enc +0 -0
- package/dist/assets/templates/specification_template.enc +0 -0
- package/dist/assets/templates/task_template.enc +0 -0
- package/dist/mcp-server.cjs +1 -1
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var e,t;e=this,t=function(e,t,r,s,n,i,o,a,c,l,p,d,u,m,h,f,g,y,b,v,w,j){"use strict";function S(e){var t=Object.create(null);return e&&Object.keys(e).forEach(r=>{if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}),t.default=e,Object.freeze(t)}var x=S(t),I=S(c);class _ extends r.MiniLogger{constructor(e,t,r){super(e,t,r)}log(e,t,s,n){const i=this.config("level");r.NumericLogLevels[i],r.NumericLogLevels[e]}}const z=(e,t,...r)=>{const s=(e=>{if("string"==typeof e)return e;if(!e)return"unknown";if("function"==typeof e)return e.name||"unknown";if("object"==typeof e&&"constructor"in e){const t=e.constructor;if(t&&t.name)return t.name}return"unknown"})(e);return new _(s,t)};var k,T,E,A,O;(e=>{e[e.NONE=0]="NONE",e[e.BASIC=1]="BASIC",e[e.ADVANCED=2]="ADVANCED",e[e.HIGH=3]="HIGH"})(k||(k={})),(e=>{e[e.NONE=0]="NONE",e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=3]="HIGH"})(T||(T={})),(e=>{e[e.FREE=0]="FREE",e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=3]="HIGH"})(E||(E={}));class N extends n.Model{get log(){return this._log||(this._log=r.Logging.for(this)),this._log}constructor(e){super(e)}logFor(e){const{sessionId:t,requestId:r,authInfo:s}=e||{};let n="string"==typeof t&&t.length>0?this.log.for(t):this.log;return s&&s.clientId&&(n=n.for(s.clientId)),r&&(n=n.for(r.toString())),n}setDescription(e){return this.description=e,this}getDescription(){return this.description}setName(e){return this.name=e,this}getName(){return this.name}setTitle(e){return this.title=e,this}}s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"description",void 0),s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"name",void 0),s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"title",void 0);class C extends N{constructor(e){super(e),this.reasoning=k.NONE,this.effort=T.NONE,this.cost=E.FREE}setReasoning(e){return this.reasoning=e,this}setEffort(e){return this.effort=e,this}setCost(e){return this.cost=e,this}}function H(e){if(!e)return;let t=e,r=t&&t._def;for(;r&&"ZodObject"!==r.typeName;){if("ZodEffects"===r.typeName&&r.schema)t=r.schema;else if("ZodOptional"===r.typeName&&r.innerType)t=r.innerType;else if("ZodDefault"===r.typeName&&r.innerType)t=r.innerType;else if("ZodNullable"===r.typeName&&r.innerType)t=r.innerType;else{if(!r.schema)return;t=r.schema}r=t&&t._def}return r&&"ZodObject"===r.typeName?r:void 0}function q(e,t="schema"){if(H(e))return e;if(e&&"object"==typeof e){const t=e.def&&"object"==typeof e.def?e.def:void 0,r=t&&(t.shape||"object"===t.type)&&t.shape||("object"===e.type?e.shape:void 0)||(t&&"object"===t.type?{}:void 0);if(t||"object"===e.type||r){const e={};if(r&&"object"==typeof r)for(const[t,s]of Object.entries(r))e[t]=D(s)?s:i.z.any();return i.z.object(e)}}throw Error(`Registration error: provided a non-canonical ${t}. Export a ZodObject (z.object(...)).`)}function J(e){if(!e)return;if(e&&"object"==typeof e&&!e._def)return e.def&&"object"==typeof e.def&&e.def.shape?e.def.shape:e;const t=H(e);return t?"function"==typeof t.shape?t.shape():t.shape||void 0:void 0}function D(e){return!(!e||"object"!=typeof e||!e._def)}s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"reasoning",void 0),s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"effort",void 0),s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"cost",void 0),(e=>{e.ASSETS="assets"})(A||(A={})),(e=>{e.PROMPT="prompts",e.DOCUMENTATION="documentation",e.CODE="code"})(O||(O={}));const P=Buffer.from("DCAF1","ascii");function $(e){let r=c.resolve(e);for(;;){if(t.existsSync(c.join(r,"package.json")))return r;const e=c.dirname(r);if(e===r)break;r=e}}const R=process.argv?.[1]?$(c.dirname(c.resolve(process.argv[1]))):void 0,M=(()=>{const e=Error().stack;if(!e)return;const t=e.split(/\r?\n/).slice(1);for(const e of t){const t=e.match(/\(?([^()]+?):\d+:\d+\)?/);if(!t)continue;let r=t[1];if(r.startsWith("file://"))try{r=u.fileURLToPath(r)}catch{continue}if(!r.includes("node:internal"))return c.dirname(r)}})(),L=M?$(M):void 0,B=R??L??process.cwd();function F(...e){return c.join(B,...e)}function W(e){let t=e;for(;;){const e=I.join(t,"lib","assets");if(x.existsSync(e))return e;const r=I.join(t,"src","assets");if(x.existsSync(r))return r;const s=I.join(t,"assets");if(x.existsSync(s))return s;const n=I.dirname(t);if(n===t)break;t=n}}function U(){const e=process.env.DECAF_ASSET_DIR||process.env.MCP_ASSET_DIR||process.env.ASSET_DIR||"";if(e&&x.existsSync(e))return e;const t=W(__dirname);if(t)return t;const r=process.argv?.[1];if(r){const e=W(I.dirname(r));if(e)return e}const s=[B,process.env.INIT_CWD].filter(Boolean);for(const e of s){const t=W(e);if(t)return t}return F("assets")}let K=class extends r.LoggedClass{constructor(e){super(),this.basePath=e||U()}listAssets(...e){const t=I.join(this.basePath,...e);return x.readdirSync(t)}listPrompts(){return this.listAssets(O.PROMPT)}getAsset(e,t="md",...r){const s=I.join(this.basePath,...r),n=(e,t=!1)=>{try{return t?(e=>{if(e.length<P.length+16+12+16)throw Error("Invalid prompt payload (too short)");if(!e.subarray(0,P.length).equals(P))throw Error("Invalid prompt payload (bad magic)");const t=process.env.ENCRYPTION_KEY||"";if(!t)throw Error("Missing encryption key. Set ENCRYPTION_KEY to load obfuscated assets.");let r=P.length;const s=e.subarray(r,r+16);r+=16;const n=e.subarray(r,r+12);r+=12;const i=e.subarray(r,r+16);r+=16;const o=e.subarray(r),a=((e,t)=>p.scryptSync(e,t,32))(t,s),c=p.createDecipheriv("aes-256-gcm",a,n);c.setAuthTag(i);const l=Buffer.concat([c.update(o),c.final()]);return d.gunzipSync(l)})(x.readFileSync(e)).toString("utf-8"):x.readFileSync(e,"utf-8")}catch(e){if("ENOENT"===e.code)return null;throw e}},i=n(I.join(s,`${e}.${t}`),"enc"===t);if(null!==i)return i;const o=n(I.join(s,e+".enc"),!0);if(null!==o)return o;throw Error("Asset not found: "+I.join(s,`${e}.${t}`))}getAllAssets(e,...t){return this.listAssets(e,...t).reduce((r,s)=>{const n=I.extname(s),i=I.basename(s,n),o=n.replace(/^\./,"")||void 0;return r[i]=this.getAsset(i,o??void 0,e,...t),r},{})}toPromptDef(e){const t=e=>"number"==typeof e?e:"string"==typeof e?(e=>{switch(e){case"none":return k.NONE;case"basic":return k.BASIC;case"advanced":return k.ADVANCED;case"high":return k.HIGH;case"medium":return T.MEDIUM;case"low":return E.LOW;case"free":return E.FREE;default:throw new l.InternalError("Cannon convert unknown level "+e)}})(e.toLowerCase()):k.NONE;return e.effort=t(e.effort),e.reasoning=t(e.reasoning),e.cost=t(e.cost),e}getPrompt(e,...t){const s=this.getAsset(r.toSnakeCase(e),"json",O.PROMPT,...t);let n;try{n=JSON.parse(s)}catch(r){throw new l.SerializationError(`Failed to parse prompt ${e} in categories ${t}: ${r}`)}return this.toPromptDef(n)}getAllPrompts(...e){const t=this.getAllAssets(O.PROMPT,...e);return Object.entries(t).reduce((t,[r,s])=>{try{t[r]=JSON.parse(s)}catch(t){throw new l.SerializationError(`Failed to parse prompt ${r} in categories ${e}: ${t}`)}return t},t)}};K=s.__decorate([o.injectable(),s.__metadata("design:paramtypes",[String])],K);class Y extends C{constructor(e){super(e)}setCb(e){return this.cb=e,this}setArgsSchema(e){return this.argsSchema=e,this}static get builder(){return new Y}static patchPrompt(e,t,s,n){const i=(t=Array.isArray(t)?t:Object.keys(t)).filter(e=>!Object.prototype.hasOwnProperty.call(s,e));if(i.length)throw new l.ValidationError("Missing replacements for placeholders: "+i.join(", "));n&&(n.verbose("Patching prompt with placeholders: "+JSON.stringify(t)),n.debug("Values: "+JSON.stringify(s)));const o=t.reduce((e,t)=>(e[t]=s[t],e),{});return r.sf(e,o)}patchPrompt(e,t,r,s){return Y.patchPrompt(e,t,r,s||this.log.for(this.patchPrompt))}build(e,t){const r=this.log.for(this.build),s=this.hasErrors();if(s)throw new l.ValidationError(s.toString());try{this.argsSchema&&q(this.argsSchema,"argsSchema");const r=J(this.argsSchema);return e.registerPrompt(this.name,{title:this.title,description:this.description,argsSchema:r},async(e,r)=>{const s=this.logFor(r);e=Object.assign({},t,e||{}),s.verbose(`Executing prompt ${this.name} with args: ${JSON.stringify(e)}`),e._meta=Object.assign(e._meta||{},{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}});const n=await Promise.resolve(this.cb(e,r));return s.verbose(`Prompt ${this.name} executed successfully.`),s.debug("Prompt execution meta: "+JSON.stringify(n._meta)),n})}catch(e){throw r.error("Failed to register prompt "+(this.name||this.constructor.name),e),e}}}s.__decorate([o.inject(K),s.__metadata("design:type",K)],Y.prototype,"assets",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],Y.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",i.ZodObject)],Y.prototype,"argsSchema",void 0),s.__decorate([a.prop(),s.__metadata("design:type",Object)],Y.prototype,"placeholders",void 0);class V extends Y{setCategory(e){return this.promptCategory=e,this}addPrefix(e){return this.prefixes=this.prefixes||[],this.prefixes.push(e),this}addSuffix(e){return this.suffixes=this.suffixes||[],this.suffixes.push(e),this}constructor(e){super(e)}build(e){const t=this.assets.getPrompt(this.name,this.promptCategory);n.Model.fromObject(this,t);const r=new Set((a.Metadata.properties(V)||[]).filter(e=>!["assets","promptCategory","prefixes","suffixes"].includes(e)));["cb","argsSchema"].forEach(e=>r.add(e));const s=this.hasErrors(...Array.from(r));if(s)throw new l.ValidationError(s.toString());const o=(this.prefixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),c=(this.suffixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),p=[...new Set([...t.placeholders,...o.map(e=>e.placeholders||[]),...c.map(e=>e.placeholders||[])].flat())].reduce((e,t)=>(e[t]=i.z.string().describe("The description for "+t),e),{});return this.setArgsSchema(i.z.object(p)),this.setCb((e,t)=>{const r=this.logFor(t).for(V).for(this.promptCategory).for(this.name);function s(e=[]){return Array.isArray(e)?e:Object.keys(e)}const n=(this.prefixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),i=(this.suffixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),o=this.assets.getPrompt(this.name,this.promptCategory),a=[...new Set([...n.map(e=>s(e.placeholders)).flat(),...i.map(e=>s(e.placeholders)).flat(),...s(o.placeholders).flat()])];return{messages:[{role:"user",content:{type:"text",text:this.patchPrompt([...n.map(e=>e.prompt),o.prompt,...i.map(e=>e.prompt)].join("\n\n"),a,e,r)}}],_meta:{}}}),super.build(e)}setReasoning(e){throw new l.InternalError("Named prompt builders don't require callback")}setEffort(e){throw new l.InternalError("Named prompt builders don't require callback")}setCost(e){throw new l.InternalError("Named prompt builders don't require callback")}setDescription(e){throw new l.InternalError("Named prompt builders don't require callback")}setTitle(e){throw new l.InternalError("Named prompt builders don't require callback")}static get builder(){return new V}}s.__decorate([n.required(),s.__metadata("design:type",String)],V.prototype,"promptCategory",void 0),s.__decorate([n.list(String),n.minlength(1),s.__metadata("design:type",Array)],V.prototype,"prefixes",void 0),s.__decorate([n.minlength(1),n.list(String),s.__metadata("design:type",Array)],V.prototype,"suffixes",void 0);const G=Y.builder.setName("example-prompt").setTitle("Example prompt").setDescription("Example prompt for testing").setArgsSchema(i.z.object({message:i.z.string().optional()})).setCb(async e=>{const t=e.message??"default";return{messages:[{role:"assistant",content:{type:"text",text:t}}],content:[],structuredContent:{message:t},result:{message:t}}}),Z=Y.builder.setName("interactive-jsdoc").setTitle("Interactive JSDoc prompt").setDescription("Interactive prompt for jogging JSDoc helpers").setArgsSchema(i.z.object({gist:i.z.string().optional()})).setCb(async e=>{const t=e.gist??"interactive jsdoc response";return{messages:[{role:"assistant",content:{type:"text",text:t}}],content:[],structuredContent:{message:t},result:{message:t}}}),Q=Object.assign(Z,{name:Z.getName()});var X;function ee(e,t=[],r=[]){const s=V.builder.setCategory(X.DOCS).setName(e);return["prefix",...t].forEach(e=>s.addPrefix(e)),["suffix",...r].forEach(e=>s.addSuffix(e)),s}(e=>{e.DOCS="documentation",e.CODE="code"})(X||(X={}));const te=[ee("class"),ee("constant"),ee("decorator"),ee("function"),ee("module"),ee("file"),ee("repo",[],["iterate"])],re=i.z.object({className:i.z.string().describe("the class name to turn into a builder")}),se=[G,Q,...te,Y.builder.setName("ts-code-dp-builder").setTitle("Typescript builder design patter prompt").setDescription("for a class, with a defined set of properties, scafold a builder design pattern").setArgsSchema(re).setReasoning(k.BASIC).setCb((e,t)=>(e.className=r.toPascalCase(e.className),{messages:[{role:"user",content:{type:"text",text:`You're a senior TypeScript developer writing typescript code.You're a senior TypeScript developer writing typescript code.\nTransform the selected class into a builder design pattern implementation in Typescript.\nuse @decaf-ts validation decorators to enforce the validation of your builder.\n\n- must extend the Model Class from @decaf-ts/decorator-validation;\n- each property must be marked as protected;\n- each property must have a setter method that returns 'this' for chaining;\n- the build() method must validate the properties using hasErrors() method from Model class;\n- if validation fails, throw an error with the validation errors;\n- if validation passes, return an instance of the original class with the set properties;\n- optionally (but do so by default) add the static builder and from methods from the example;\n- if the clasee already follows the pattern but has properties without decoration or without setters, simple add them;\n\nexample:\n\noriginal class:\n\`\`\`typescript\nexport class ${e.className} {\n description!: string;\n name!: string = "default name";\n title!: string;\n age?: string;\n dateOfBirth!: Date;\n}}\n\`\`\` \n\nresulting builder pattern implementation:\n\`\`\`typescript\nexport class ${e.className}Builder extends Model {\n\n @minlength(10\n @required()\n protected description!: string;\n \n @required()\n protected name!: string = "default value;\n \n @required()\n protected title!: string;\n \n @min(18)\n protected age?: string;\n \n @date()\n protected dateOfBirth!: Date;\n\n protected constructor(arg?: ModelArg<${e.className}Builder>>) {\n super(arg);\n Model.fromModel(this, arg);\n }\n\n setDescription(value: string) {\n this.description = value;\n return this;\n }\n\n setName(value: string) {\n this.name = value;\n return this;\n }\n\n setTitle(value: string) {\n this.title = value;\n return this;\n }\n setAge(value: number) {\n this.age = value;\n return this;\n }\n setDate(value: Date) {\n this.age = value;\n return this;\n }\n \n build(...args: any[]): ${e.className}Builder | Promise<${e.className}Builder> {\n const errs = this.hasErrors();\n if (errs) throw new Error(errs.toString());\n \n return // code that builds OBJ here\n }\n \n static get builder(): ${e.className}Builder {\n return new ${e.className}Builder(); // static method to get a new builder instance\n }\n \n static from<K extends keyof ${e.className}Builder>(obj: K, ${e.className}Builder[K]): ${e.className}Builder {\n return new ${e.className}Builder(); // static method to create a builder from an object\n }\n}\n\`\`\` \n\n`}}],_meta:{}}))];class ne extends C{setAnnotations(e){return this.annotations=Object.assign(this.annotations,e),this}setCb(e){return this.cb=e,this}setInputSchema(e){return this.inputSchema=e,this}setOutputSchema(e){return this.outputSchema=e,this}constructor(e){super(e),this.annotations={readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}static get builder(){return new ne}build(e){const t=this.hasErrors();if(t)throw Error(t.toString());try{this.inputSchema&&q(this.inputSchema,"inputSchema"),this.outputSchema&&q(this.outputSchema,"outputSchema");const t=J(this.inputSchema),r=J(this.outputSchema);return e.registerTool(this.name,{title:this.title,description:this.description,inputSchema:t,outputSchema:r,annotations:this.annotations,_meta:{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}}},async(e,t)=>{const r=this.logFor(t);r.verbose(`Executing tool ${this.name} with args: ${JSON.stringify(e)}`),t._meta=Object.assign(t._meta||{},{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}});const s=await Promise.resolve(this.cb(e,t));return r.verbose(`Tool ${this.name} executed successfully.`),r.debug("Tool execution meta: "+JSON.stringify(s._meta)),s})}catch(e){const t=e?.message||e+"";if("string"==typeof t&&t.includes("already registered"))return r.Logging.for(this).warn(`Tool ${this.name} already registered - skipping duplicate registration`),{name:this.name};throw r.Logging.for(this).error("Error building tool",e),e}}}s.__decorate([n.required(),s.__metadata("design:type",Object)],ne.prototype,"annotations",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],ne.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",Function)],ne.prototype,"inputSchema",void 0);const ie=ne.builder.setName("example-tool").setTitle("Example tool").setDescription("A smoke tool used for quick testing").setInputSchema(i.z.object({})).setCb(async()=>({content:[{type:"text",text:"example tool ok"}],result:{status:"ok"}}));Object.assign(ie,{name:ie.getName()});const oe=ne.builder.setName("file-summarizer").setTitle("File summarizer").setDescription("Summaries files for quick previews").setInputSchema(i.z.object({filePath:i.z.string().optional()})).setCb(async()=>({content:[{type:"text",text:"file summary stub"}],result:{summary:"file summary stub"}}));function ae(){try{let e=process.argv[1]?c.dirname(c.resolve(process.argv[1])):process.cwd();for(;;){const r=c.join(e,"package.json");if(t.existsSync(r))return JSON.parse(t.readFileSync(r,"utf-8"));const s=c.dirname(e);if(s===e)break;e=s}}catch{}return{}}Object.assign(oe,{name:oe.getName()});const ce=ae().version??"0.0.0",le=ae().name??"unknown";a.Metadata.registerLibrary(le,ce);const pe={mcpId:"decaf",name:"decaf-ts mcp server",title:"Decaf-TS MCP Server",description:"Provides precise coding assistance for the decaf-ts framework",version:ce,websiteUrl:"https://decaf-ts.github.io",repositoryUrl:"https://github.com/decaf-ts/mcp-server",license:"AGPL-3.0",workingDir:B,assetDir:U(),contacts:[{name:"Decaf-TS",url:"https://decaf-ts.github.io"}],tags:"server,official,decaf-ts",metadata:{},icons:[{src:"workdocs/assets/favicon.svg",mimeType:"image/svg+xml",sizes:"any"}],jira:{host:process.env.JIRA__HOST||"decaf-ts.atlassian.net",email:process.env.JIRA__EMAIL||"",apiKey:process.env.JIRA__API_KEY||process.env.JIRA__APIKEY||"",projectKey:process.env.JIRA__PROJECT_KEY||void 0,issueType:process.env.JIRA__ISSUE_TYPE||void 0,parentIssue:process.env.JIRA__PARENT_ISSUE||void 0},level:r.LogLevel.error},de=r.LoggedEnvironment.accumulate(pe);function ue(){const{host:e,email:t,apiKey:r,projectKey:s,issueType:n}=de.jira;return{host:e?.trim(),email:t?.trim(),apiKey:r?.trim(),projectKey:s?.trim(),issueType:n?.trim(),parentIssue:de.jira.parentIssue?.trim()}}function me(){const e=ue();return[{name:"JIRA__HOST",required:!0,description:"Atlassian host (e.g. decaf-ts.atlassian.net) where your Jira instance is hosted.",value:e.host},{name:"JIRA__EMAIL",required:!0,description:"Email address of the Jira account that has API access.",value:e.email},{name:"JIRA__API_KEY",required:!0,description:"API token created in your Atlassian profile (a.k.a. APIKEY alias) for authenticating requests.",sensitive:!0,value:e.apiKey},{name:"JIRA__PROJECT_KEY",required:!1,description:"Default Jira project key (e.g. DECAF) used when an issue creation request omits a project.",value:e.projectKey},{name:"JIRA__ISSUE_TYPE",required:!1,description:"Default Jira issue type (e.g. Task, Bug) used when creating issues without an explicit type.",value:e.issueType},{name:"JIRA__PARENT_ISSUE",required:!1,description:"Default parent issue key (e.g. DECAF-123) applied when a child issue is created without an explicit parent.",value:e.parentIssue}]}function he(e){const t=e.value?((e,t)=>{if(e)return t?"<configured>":e})(e.value,e.sensitive):"not set",r=e.required?"(required)":"(optional)";return`\u2022 ${e.name} ${r}: ${e.description} Current state: ${t}.`}r.Logging.setConfig(de);class fe extends Error{constructor(e){const t=me(),r=(e=>{const t=me();return`${e.length?`Missing Jira credentials: ${e.map(e=>e.name).join(", ")}.`:"Jira credentials are configured."}\n\nThis setup uses the following environment variables:\n${t.map(he).join("\n")}`})(e);super(r),this.name="MissingJiraEnvironmentError",this.descriptors=t,this.missing=e,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,fe)}}function ge(e){if(!e)return{code:"jira_error",message:"Unknown Jira error",details:{raw:e}};const t=e?.status??e?.statusCode??e?.response?.status??e?.response?.statusCode,r="number"==typeof t?t:Number(t)||void 0,s=e?.response?.data??e?.data??e?.response?.body??e?.body,n=[];"string"==typeof e?.message&&n.push(e.message),((e,t)=>{e&&(Array.isArray(e.errorMessages)&&e.errorMessages.forEach(e=>"string"==typeof e&&t.push(e)),"string"==typeof e.errorMessage&&t.push(e.errorMessage),e.errorCollection&&Array.isArray(e.errorCollection.errors)&&e.errorCollection.errors.forEach(e=>{"string"==typeof e?t.push(e):e&&"string"==typeof e.message&&t.push(e.message)}),e?.errors&&"object"==typeof e.errors&&Object.values(e.errors).forEach(e=>{"string"==typeof e?t.push(e):"string"==typeof e?.message&&t.push(e.message)}))})(s,n);const i=r?`Jira API error (${r})`:"Jira API error",o=n.length>0?n.join(" | "):i;return{code:r?"jira_"+r:e?.code??"jira_error",message:o,details:{httpStatus:r,body:s,raw:e}}}const ye=i.z.object({issueId:i.z.string().min(1),deleteSubtasks:i.z.boolean().optional().default(!0)}),be={name:"jira-issue-delete",inputSchema:ye,runTool:async(e,t)=>{try{const r=ye.parse(t),s=e.issues??e.issue??e,n=s?.delete??s?.deleteIssue;if("function"!=typeof n)throw Error("jira client delete endpoint is not available");return await n.call(s,{issueId:r.issueId,deleteSubtasks:r.deleteSubtasks}),{success:!0,message:`Issue ${t.issueId} deleted successfully`}}catch(e){throw ge(e)}}},ve=i.z.object({projectKey:i.z.string().trim().min(1).optional(),issueType:i.z.string().trim().min(1).optional(),parentIssueId:i.z.string().trim().min(1).optional(),name:i.z.string().trim().min(1).optional(),reference:i.z.string().trim().min(1).optional(),jql:i.z.string().trim().min(1).optional(),startAt:i.z.number().int().min(0).optional(),maxResults:i.z.number().int().min(1).optional(),fields:i.z.array(i.z.string()).optional(),expand:i.z.string().optional(),orderBy:i.z.string().trim().min(1).optional()});function we(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}const je={name:"jira-issue-list",inputSchema:ve,runTool:async(e,t)=>{try{const r=ve.parse(t),s=r.startAt??0,n=r.maxResults??50;let i=r.jql?.trim();if(i){if(r.orderBy){const e=r.orderBy.trim();e&&(i=/\border\s+by\b/i.test(i)?`${i}, ${e}`:`${i} ORDER BY ${e}`)}}else i=(e=>{const t=[];if(e.projectKey&&t.push(`project = "${we(e.projectKey)}"`),e.issueType&&t.push(`issuetype = "${we(e.issueType)}"`),e.parentIssueId&&t.push(`parent = "${we(e.parentIssueId)}"`),e.name&&t.push(`summary ~ "${we(e.name)}"`),e.reference){const r=we(e.reference);t.push(`(key ~ "${r}" OR summary ~ "${r}" OR text ~ "${r}")`)}if(0===t.length){const e=Error("Provide a jql query or at least one filter (project, name, reference, parent, issue type, etc.).");throw e.code="validation_error",e}let r=t.join(" AND ");if(e.orderBy){const t=e.orderBy.trim();t&&(r=/\border\s+by\b/i.test(r)?`${r}, ${t}`:`${r} ORDER BY ${t}`)}return r})(r);const o={jql:i,startAt:s,maxResults:n};r.fields&&(o.fields=r.fields),r.expand&&(o.expand=r.expand);const a=await e.search.search(o);return a?.data??a}catch(e){throw ge(e)}}},Se=i.z.object({issueId:i.z.string().min(1),expand:i.z.string().optional(),fields:i.z.array(i.z.string()).optional(),properties:i.z.array(i.z.string()).optional()}),xe={name:"jira-issue-read",inputSchema:Se,runTool:async(e,t)=>{try{const r=Se.parse(t),s={issueIdOrKey:r.issueId};r.expand&&(s.expand=r.expand),r.fields&&(s.fields=r.fields),r.properties&&(s.properties=r.properties);const n=await e.issues.get(s);return n?.data??n}catch(e){throw ge(e)}}};function Ie(e,t,r){const s=((e.url??"")+"").match(/^(attachment|jira-attachment):(.+)$/i);if(!s)return null;const n=s[2],i=r.resolveAttachment?.(n);return i?{type:"block",node:{type:"mediaSingle",attrs:{layout:"center"},content:[{type:"media",attrs:{type:"file",id:i.id,collection:i.collection??"attachments"}}]}}:null}function _e(e,t){if(!e)return[];if(!t.enableAtMentions&&!t.enableEmojiShortcodes)return[{type:"text",text:e}];let r=0;const s=[],n=/(^|[^A-Za-z0-9_])@([A-Za-z0-9._-]{1,64})/g,i=/:([a-z0-9_+-]{1,64}):/gi;for(;r<e.length;){const o=ke(t.enableAtMentions?ze(n,e,r):null,t.enableEmojiShortcodes?ze(i,e,r):null);if(!o){s.push({type:"text",text:e.slice(r)});break}if(o.index>r&&s.push({type:"text",text:e.slice(r,o.index)}),"mention"===o.kind){const{full:e,groups:n}=o,i=n[0]??"",a=n[1]??"";i&&s.push({type:"text",text:i});const c=t.resolveMention?.(a);c?s.push({type:"mention",attrs:{id:c.id,text:c.text}}):s.push({type:"text",text:"@"+a}),r=o.index+e.length;continue}if("emoji"===o.kind){const{full:e,groups:n}=o,i=`:${n[0]}:`,a=t.resolveEmoji?.(i);s.push({type:"emoji",attrs:a?{shortName:a.shortName,text:a.text}:{shortName:i}}),r=o.index+e.length;continue}}return(e=>{const t=[];for(const r of e){const e=t[t.length-1];"text"!==r.type||"text"!==e?.type||e.marks||r.marks?t.push(r):e.text=(e.text??"")+(r.text??"")}return t})(s)}function ze(e,t,r){e.lastIndex=r;const s=e.exec(t);if(!s)return null;const n=e.source.includes("@")?"mention":"emoji";return{index:s.index,full:s[0],groups:s.slice(1),kind:n}}function ke(e,t){return e?t&&e.index>t.index?t:e:t}function Te(e){const t=(e.children??[])[0];return"text"===t?.type?(t.value??"")+"":"paragraph"===t?.type?((t.children??[]).map(e=>"text"===e.type?(e.value??"")+"":"").join("")||"")+"":""}function Ee(e){const t=((e??"")+"").toLowerCase().trim();return t?"info"===t||"note"===t||"success"===t||"warning"===t||"error"===t?t:"danger"===t?"error":null:null}function Ae(e){const t=((e??"")+"").toLowerCase().trim();return!t||"neutral"!==t&&"green"!==t&&"yellow"!==t&&"red"!==t&&"blue"!==t&&"purple"!==t?null:t}function Oe(e,t){const r=[];for(const s of e??[])if(s?.type)if("text"!==s.type)if("strong"!==s.type)if("emphasis"!==s.type)if("delete"!==s.type)if("inlineCode"!==s.type)if("break"!==s.type){if("link"===s.type){const e=(s.url??"")+"",n=Ce(s.children??[],e),i=Ie(s,0,t);if(i){"inline"===i.type?r.push(i.node):r.push({type:"text",text:n,marks:[{type:"link",attrs:{href:e}}]});continue}if(t.enableSmartCards&&He(n,e)){r.push({type:"inlineCard",attrs:{url:e}});continue}r.push({type:"text",text:n,marks:[{type:"link",attrs:{href:e}}]});continue}if("textDirective"===s.type&&"status"===s.name){const e=Te(s)||"Status",t=Ae(s.attributes?.color)??"neutral";r.push({type:"status",attrs:{text:e,color:t}});continue}if("textDirective"===s.type&&"emoji"===s.name){const e=qe(s);r.push(Je(e,t));continue}}else r.push({type:"hardBreak"});else r.push({type:"text",text:(s.value??"")+"",marks:[{type:"code"}]});else r.push(...Ne(Oe(s.children??[],t),{type:"strike"}));else r.push(...Ne(Oe(s.children??[],t),{type:"em"}));else r.push(...Ne(Oe(s.children??[],t),{type:"strong"}));else r.push(..._e((s.value??"")+"",t));return r.filter(e=>!("text"===e.type&&""===(e.text??"")))}function Ne(e,t){return e.map(e=>{if("text"!==e.type)return e;const r=e.marks?[...e.marks,t]:[t];return{...e,marks:r}})}function Ce(e,t){const r=[];for(const t of e??[])"text"===t.type||"inlineCode"===t.type?r.push((t.value??"")+""):"emphasis"!==t.type&&"strong"!==t.type&&"delete"!==t.type||r.push(Ce(t.children??[],""));return r.join("")||t}function He(e,t){const r=(e??"").trim(),s=(t??"").trim();return r===s&&/^https?:\/\//i.test(s)}function qe(e){return(e.children??[]).map(e=>"text"===e.type?(e.value??"")+"":"").join("").trim()||""}function Je(e,t){const r=e.startsWith(":")?e:`:${e}:`,s=t.resolveEmoji?.(r);return s?{type:"emoji",attrs:{shortName:s.shortName,text:s.text}}:{type:"emoji",attrs:{shortName:r}}}function De(e){return e?"string"==typeof e?e:"text"===e.type||"inlineCode"===e.type?(e.value??"")+"":Array.isArray(e.children)?e.children.map(De).join(""):"":""}function Pe(e,t){if(!e?.type)return null;if((e=>"containerDirective"===e?.type&&"panel"===e?.name)(e))return((e,t)=>{const r=e.attributes??{},s=Ee(r.type)??"info",n="string"==typeof r.title?r.title:void 0,i=(e.children??[]).map(e=>Pe(e,t)).flat().filter(Boolean);return{type:"panel",attrs:{panelType:s,...n?{panelType:s,title:n}:{panelType:s}},content:i.length?i:[{type:"paragraph",content:[]}]}})(e,t);switch(e.type){case"heading":return{type:"heading",attrs:{level:Re(e.depth??1,1,6)},content:Oe(e.children??[],t)};case"paragraph":{const r=(e=>{const t=e.children??[];if(1!==t.length)return null;const r=t[0];if("image"!==r?.type)return null;const s=(r.url??"")+"";return s?{type:"mediaSingle",attrs:{layout:"center"},content:[{type:"media",attrs:{type:"external",url:s}}]}:null})(e);return r||{type:"paragraph",content:Oe(e.children??[],t)}}case"blockquote":return{type:"blockquote",content:(e.children??[]).map(e=>Pe(e,t)).flat().filter(Boolean)};case"list":return((e,t)=>t.enableTaskLists&&(e.children??[]).some(e=>"boolean"==typeof e.checked)?((e,t)=>{const r=[];let s=0;for(const n of e.children??[]){if("boolean"!=typeof n.checked)continue;s+=1;const e=(n.children??[]).map(e=>Pe(e,t)).flat().filter(Boolean);r.push({type:"taskItem",attrs:{localId:"task-"+s,state:n.checked?"DONE":"TODO"},content:e.length?e:[{type:"paragraph",content:[]}]})}return{type:"taskList",content:r}})(e,t):{type:e.ordered?"orderedList":"bulletList",content:(e.children??[]).map(e=>((e,t)=>{const r=(e.children??[]).map(e=>Pe(e,t)).flat().filter(Boolean);return{type:"listItem",content:r.length?r:[{type:"paragraph",content:[]}]}})(e,t))})(e,t);case"code":{const r=((e,t)=>{const r=(e??"").toString().trim().toLowerCase();return r?t.enableMermaid&&"mermaid"===r?"mermaid":(e=>{const t=e.trim().toLowerCase();return{js:"javascript",javascript:"javascript",jsx:"javascript",ts:"typescript",typescript:"typescript",tsx:"typescript",py:"python",python:"python",rb:"ruby",ruby:"ruby",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",yml:"yaml",yaml:"yaml",json:"json",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",go:"go",rust:"rust",java:"java",c:"c",cpp:"cpp","c++":"cpp",cs:"csharp",csharp:"csharp",php:"php",kotlin:"kotlin",swift:"swift",md:"markdown",markdown:"markdown",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"make",ini:"ini"}[t]??t})(r):null})(e.lang,t);return{type:"codeBlock",attrs:{language:r},content:[{type:"text",text:(e.value??"")+""}]}}case"thematicBreak":return{type:"rule"};case"table":return((e,t)=>({type:"table",content:(e.children??[]).map((e,r)=>({type:"tableRow",content:(e.children??[]).map(e=>({type:0===r?"tableHeader":"tableCell",content:[{type:"paragraph",content:Oe(e.children??[],t)}]}))}))}))(e,t);case"leafDirective":return"status"===e.name?(e=>{const t=Ae((e.attributes??{}).color)??"neutral";return{type:"paragraph",content:[{type:"status",attrs:{text:Te(e)||"Status",color:t}}]}})(e):"panel"===e.name?((e,t)=>{const r=e.attributes??{},s=Ee(r.type)??"info",n="string"==typeof r.title?r.title:void 0;return{type:"panel",attrs:{panelType:s,...n?{title:n}:{}},content:[{type:"paragraph",content:Oe([{type:"text",value:Te(e)}],t)}]}})(e,t):$e(e,t);default:return $e(e,t)}}function $e(e,t){if("drop"===t.unknownNodeStrategy)return null;const r=De(e);return r?{type:"paragraph",content:[{type:"text",text:r}]}:null}function Re(e,t,r){const s=Number.isFinite(e)?Math.trunc(e):t;return Math.max(t,Math.min(r,s))}const Me={resolveMention:void 0,resolveAttachment:void 0,resolveEmoji:void 0,enableSmartCards:!0,enableMermaid:!0,enableEmojiShortcodes:!0,enableAtMentions:!0,enableTaskLists:!0,unknownNodeStrategy:"text"};function Le(e,t={}){const r={...Me,...t},s=e??"",n=m.unified().use(g).use(f).use(h),i=n.parse(s),o=n.runSync(i);return Be(o),((e,t)=>{const r=[];for(const s of e.children??[]){const e=Pe(s,t);e&&(Array.isArray(e)?r.push(...e):r.push(e))}return((e,t)=>{if(!t.enableSmartCards)return e;const r=e.content.map(e=>(e=>{if("paragraph"!==e.type)return e;const t=e.content??[];if(1!==t.length)return e;const r=t[0];if("inlineCard"!==r?.type)return e;const s=r.attrs?.url;return s?[{type:"blockCard",attrs:{url:s}}]:e})(e)).flat();return{...e,content:r}})({version:1,type:"doc",content:r},t)})(o,r)}function Be(e){if(!e||!Array.isArray(e.children))return;const t=[];for(const r of e.children)"definition"!==r?.type&&("html"!==r?.type?(Be(r),t.push(r)):t.push({type:"text",value:(r.value??"")+""}));e.children=t}const Fe=i.z.object({issueId:i.z.string().min(1),transitionId:i.z.union([i.z.string(),i.z.number()]),fields:i.z.record(i.z.any()).optional(),update:i.z.record(i.z.array(i.z.object({set:i.z.any().optional(),add:i.z.any().optional(),remove:i.z.any().optional()}))).optional(),comment:i.z.string().optional()}),We={name:"jira-issue-transition",inputSchema:Fe,runTool:async(e,t)=>{try{const r=Fe.parse(t),s={id:r.transitionId};r.fields&&(s.fields=r.fields),r.update&&(s.update=r.update),r.comment&&(s.comment={body:Le(r.comment)});const n=await e.issues.transition({issueId:r.issueId,transition:s});return n?.data??n}catch(e){throw ge(e)}}},Ue=i.z.object({issueId:i.z.string().min(1),fields:i.z.record(i.z.any()).optional(),update:i.z.record(i.z.array(i.z.object({set:i.z.any().optional(),add:i.z.any().optional(),remove:i.z.any().optional(),edit:i.z.any().optional()}))).optional(),properties:i.z.array(i.z.any()).optional(),notifyUsers:i.z.boolean().optional().default(!0),issueTemplateId:i.z.string().optional(),overrideScreenSecurity:i.z.boolean().optional().default(!1),overrideEditableFlag:i.z.boolean().optional().default(!1)}),Ke={name:"jira-issue-update",inputSchema:Ue,runTool:async(e,t)=>{try{const r=Ue.parse(t),s={issueId:r.issueId};r.fields&&(s.fields=r.fields),r.update&&(s.update=r.update),r.properties&&(s.properties=r.properties),void 0!==r.notifyUsers&&(s.notifyUsers=r.notifyUsers),r.issueTemplateId&&(s.issueTemplateId=r.issueTemplateId),void 0!==r.overrideScreenSecurity&&(s.overrideScreenSecurity=r.overrideScreenSecurity),void 0!==r.overrideEditableFlag&&(s.overrideEditableFlag=r.overrideEditableFlag);const n=await e.issues.update(s);return n?.data??n}catch(e){throw ge(e)}}},Ye=i.z.object({issueId:i.z.string().min(1),assignee:i.z.union([i.z.string(),i.z.object({accountId:i.z.string().min(1)}),i.z.object({accountType:i.z.string().min(1)})])}),Ve={name:"jira-assign-issue",inputSchema:Ye,runTool:async(e,t)=>{try{const r=Ye.parse(t);let s;s="string"==typeof r.assignee?{accountId:r.assignee}:r.assignee;const n=await e.issues.assign({issueId:r.issueId,assignee:s});return n?.data??n}catch(e){throw ge(e)}}},Ge=i.z.object({issueId:i.z.string().min(1)}),Ze={name:"jira-unassign-issue",inputSchema:Ge,runTool:async(e,t)=>{try{const r=Ge.parse(t),s=await e.issues.assign({issueId:r.issueId,assignee:{accountId:"-1"}});return s?.data??s}catch(e){throw ge(e)}}},Qe=i.z.object({issueId:i.z.string().min(1),body:i.z.string().min(1),visibility:i.z.object({type:i.z.enum(["role","group"]),value:i.z.string().min(1)}).optional()}),Xe={name:"jira-comment-add",inputSchema:Qe,runTool:async(e,t)=>{try{const r=Qe.parse(t),s={body:Le(r.body)};r.visibility&&(s.visibility=r.visibility);const n=await e.issues.addComment({issueId:r.issueId,comment:s});return n?.data??n}catch(e){throw ge(e)}}},et=i.z.object({issueId:i.z.string().min(1),start:i.z.number().optional().default(0),maxResults:i.z.number().optional().default(50),orderBy:i.z.string().optional(),expand:i.z.string().optional()}),tt={name:"jira-comment-list",inputSchema:et,runTool:async(e,t)=>{try{const r=et.parse(t),s=await e.issues.getComments({issueId:r.issueId,start:r.start,maxResults:r.maxResults,orderBy:r.orderBy,expand:r.expand});return s?.data??s}catch(e){throw ge(e)}}},rt=i.z.object({link:i.z.object({relationship:i.z.enum(["Blocks","Relates to","Duplicates","Is blocked by","Is related to","Is duplicated by","Causes","Is caused by","Clone","Required","Work on","Split","Roll up"]),inwardIssue:i.z.object({id:i.z.string().optional(),key:i.z.string().optional()}),outwardIssue:i.z.object({id:i.z.string().optional(),key:i.z.string().optional()}),comment:i.z.object({body:i.z.string().optional(),visibility:i.z.object({type:i.z.enum(["role","group"]),value:i.z.string().min(1)}).optional()}).optional()})}),st={name:"jira-link-create",inputSchema:rt,runTool:async(e,t)=>{try{const r=rt.parse(t).link,s={relationship:r.relationship,inwardIssue:r.inwardIssue.id||r.inwardIssue.key,outwardIssue:r.outwardIssue.id||r.outwardIssue.key};r.comment&&(r.comment.body&&(s.comment=Le(r.comment.body)),r.comment.visibility&&(s.visibility=r.comment.visibility));const n=await e.issues.link(s);return n?.data??n}catch(e){throw ge(e)}}},nt=i.z.object({issueId:i.z.string().min(1),file:i.z.string().min(1),mimeType:i.z.string().optional(),comment:i.z.string().optional()}),it={name:"jira-attach",inputSchema:nt,runTool:async(e,r)=>{try{const s=nt.parse(r),n=c.resolve(s.file),i=await t.promises.readFile(n),o=c.basename(n),a=await e.issues.addAttachment({issueId:s.issueId,file:{name:o,content:i,mimeType:s.mimeType??"application/octet-stream"},comment:s.comment});return a?.data??a}catch(e){if(e&&e.code&&"string"==typeof e.code&&["ENOENT","EACCES"].includes(e.code))throw Error("Attachment file error: "+e.message);throw ge(e)}}},ot=i.z.object({issueId:i.z.string().min(1)}),at={name:"jira-attachment-list",inputSchema:ot,runTool:async(e,t)=>{try{const r=ot.parse(t),s=await e.issues.getAttachments({issueId:r.issueId});return s?.data??s}catch(e){throw ge(e)}}},ct=i.z.object({issueId:i.z.string().min(1),attachmentId:i.z.string().min(1)}),lt={name:"jira-attachment-delete",inputSchema:ct,runTool:async(e,t)=>{try{const r=ct.parse(t);return await e.issues.deleteAttachment({issueId:r.issueId,attachmentId:r.attachmentId}),{success:!0,message:`Attachment ${t.attachmentId} deleted successfully`}}catch(e){throw ge(e)}}},pt=i.z.object({issueId:i.z.string().min(1),timeSpent:i.z.string().min(1),comment:i.z.string().optional(),author:i.z.object({accountId:i.z.string().min(1)}).optional(),startingOn:i.z.string().optional(),artifact:i.z.string().optional()}),dt={name:"jira-worklog-add",inputSchema:pt,runTool:async(e,t)=>{try{const r=pt.parse(t),s={timeSpent:r.timeSpent};r.comment&&(s.comment=r.comment),r.author&&(s.author=r.author),r.startingOn&&(s.started=r.startingOn),r.artifact&&(s.artifact=r.artifact);const n=await e.issues.addWorklog({issueId:r.issueId,...s});return n?.data??n}catch(e){throw ge(e)}}},ut={[xe.name]:{title:"Jira Issue Read",description:"Read a Jira issue with expandable fields and properties",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[je.name]:{title:"Jira Issue List",description:"Search issues by summary, reference, parent, or JQL and list the matching tickets",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[Ke.name]:{title:"Jira Issue Update",description:"Update a Jira issue using fields, update ops, and property toggles",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[be.name]:{title:"Jira Issue Delete",description:"Delete a Jira issue and optionally remove its subtasks",annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}},[We.name]:{title:"Jira Issue Transition",description:"Transition a Jira issue while optionally adding a comment",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[Ve.name]:{title:"Jira Issue Assign",description:"Assign a Jira issue to a user or account",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[Ze.name]:{title:"Jira Issue Unassign",description:"Unassign the current owner from a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[Xe.name]:{title:"Jira Comment Add",description:"Add a comment to a Jira issue with optional visibility",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[tt.name]:{title:"Jira Comment List",description:"List comments on a Jira issue with pagination support",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[st.name]:{title:"Jira Link Create",description:"Create an issue link relationship with optional comment",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[it.name]:{title:"Jira Attachment Add",description:"Attach a local file to a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[at.name]:{title:"Jira Attachment List",description:"List attachments on a Jira issue",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[lt.name]:{title:"Jira Attachment Delete",description:"Delete an attachment from a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}},[dt.name]:{title:"Jira Worklog Add",description:"Log time spent on a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}}};async function mt(e){const t=r.Logging.for(mt);let s,n=null;try{s=(()=>{let e;try{const t=require("jira.js");e=t?.Version3Client||t.default?.Version3Client||t.default||t}catch(e){throw Error("Unable to require 'jira.js' \u2014 ensure it is installed as a dependency: "+e)}const{host:t,email:r,apiKey:s}=(()=>{const e=ue(),t=me().filter(e=>e.required&&!e.value);if(t.length>0)throw new fe(t);return{host:e.host,email:e.email,apiKey:e.apiKey}})();return new e({host:t.startsWith("http://")||t.startsWith("https://")?t:"https://"+t,authentication:{basic:{email:r,apiToken:s}}})})()}catch(e){if(!(e instanceof fe))return void t.warn("Skipping Jira tool registration; unable to create Jira client",{error:e});n=e,t.warn("Registering Jira tools without credentials; each tool will report configuration requirements.",{error:e})}const i=[xe,je,Ke,be,We,Ve,Ze,Xe,tt,st,it,at,lt,dt];for(const r of i){const i=ut[r.name];if(i)try{await e.registerTool(r.name,{title:i.title,description:i.description,inputSchema:J(r.inputSchema),annotations:i.annotations},async e=>{if(!s)throw n??Error("Jira client unavailable because credentials could not be loaded.");return r.runTool(s,e)}),t.info("Registered Jira tool "+r.name)}catch(e){t.error("Failed to register Jira tool "+r.name,{error:e})}}}async function ht(e){await(async e=>{e.registerTool("decaf-server-info",{title:"Decaf MCP Server Info",description:"Return server metadata, version, and registered prompt names for diagnostics.",inputSchema:{},outputSchema:void 0,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},async()=>{const e=se.map(e=>e.getName()).sort();return{content:[{type:"text",text:["Name: "+de.name,"Title: "+de.title,"Version: "+de.version,"Prompts: "+(e.join(", ")||"<none>")].join("\n")}]}})})(e);const t=r.Logging.for(ht);try{await mt(e)}catch(e){t.error("Failed to register Jira tools",e)}}class ft extends N{setCb(e){return this.cb=e,this}setConfig(e){return this.config=e,this}setUriOtTemplate(e){return this.uriOrTemplate=e,this}constructor(e){super(e)}static get builder(){return new ft}build(e){const t=this.hasErrors();if(t)throw Error(t.toString());try{const t="string"==typeof this.uriOrTemplate&&this.uriOrTemplate.includes("{")?new b.ResourceTemplate(new y.UriTemplate(this.uriOrTemplate),{list:void 0}):this.uriOrTemplate,r=Object.assign(this.config,{_meta:{}}),s=async(e,t)=>{const r=this.logFor(t);r.verbose(`Requesting resource ${this.name} from ${e.toString()}`);const s=await Promise.resolve(this.cb(e,t));return r.verbose(`Resource ${this.name} retrieved successfully.`),r.debug("Resource retrieval meta: "+JSON.stringify(s._meta)),s};return e.resource(this.name,t,r,s)}catch(e){throw r.Logging.for(this).error("Error registering resource "+this.name,e),e}}}s.__decorate([n.required(),s.__metadata("design:type",String)],ft.prototype,"uriOrTemplate",void 0),s.__decorate([n.required(),s.__metadata("design:type",Function)],ft.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],ft.prototype,"config",void 0);const gt=U()??I.join(__dirname,"..","assets"),yt=I.join(gt,"templates"),bt=I.join(gt,"prompts"),vt=new WeakMap;class wt extends r.LoggedClass{get client(){const e=vt.get(this);if(!e)throw Error("Mcp server requires Mcp client");return e}constructor(){super()}async load(){const e=this.log.for(this.load);for(const t of se)try{e.info("loading prompt "+t.getName());const r=t.build(this.client);e.verbose(`Loaded prompt ${r.title} from ${t.getName()} definition`)}catch(r){e.error("Failed to load prompt "+t.getName(),r)}try{await ht(this.client),e.verbose("Registered built-in tools")}catch(e){}try{await(async(e,t)=>{t.info("Registering agent templates as resources...");const r=x.readdirSync(yt).filter(e=>e.endsWith(".md"));for(const s of r){const r=I.basename(s,".md"),n=I.join(yt,s),i=ft.builder.setName(r).setTitle("Template: "+r).setDescription("Resource template for "+r).setUriOtTemplate("file:///"+n).setConfig({mimeType:"text/markdown",description:"Template for "+r}).setCb(async e=>{const t=x.readFileSync(e.pathname,"utf8");return{contents:[{uri:e.toString(),text:t,mimeType:"text/markdown"}],_meta:{}}});try{i.build(e),t.info("Registered template: "+r)}catch(e){t.error(`Failed to register template ${r}:`,e)}}t.info("Registering agent prompts...");const s=x.readdirSync(bt).filter(e=>e.endsWith(".md"));for(const r of s){const s=I.basename(r,".md"),n=I.join(bt,r),o=x.readFileSync(n,"utf8"),a=Y.builder.setName(s).setTitle("Prompt: "+s).setDescription("Dynamic prompt for "+s).setArgsSchema(i.z.object({})).setCb(async e=>({messages:[{role:"user",content:{type:"text",text:o}}],_meta:{}}));try{a.build(e),t.info("Registered prompt: "+s)}catch(e){t.error(`Failed to register prompt ${s}:`,e)}}})(this.client,e)}catch(e){}}async boot(e="stdio"){"stdio"===e&&r.Logging.setFactory(z),r.Logging.for(this.constructor.name);const t=((Array.isArray(de.icons)?de.icons:[de.icons])||[]).map(e=>{const t="string"==typeof e?.src?e.src:(e?.src??"")+"",r="string"==typeof e?.mimeType?e.mimeType:(e?.mimeType??"")+"";let s=[];return Array.isArray(e?.sizes)?s=e.sizes.map(e=>e+""):"string"==typeof e?.sizes&&(s=(e.sizes+"").split(",").map(e=>e.trim())),{src:t,mimeType:r,sizes:s}}),s={name:de.name,title:de.title,websiteUrl:de.websiteUrl,version:de.version,icons:t},n=new b.McpServer(s,{instructions:"You are an AI assistant designed to help users with programming tasks related to the Decaf-TS framework. \nProvide clear, concise, and accurate information.\nIf you don't know the answer, admit it rather than making up information.\nAlways prioritize the user's intent and provide helpful suggestions when appropriate.\n",capabilities:{logging:{},tools:{},prompts:{}}});switch(((e,t)=>{vt.set(e,t)})(this,n),n.onerror=e=>{this.log.error("MCP instance onerror",e)},e){case"stdio":e=new w.StdioServerTransport;break;case"http":e=new j.StreamableHTTPServerTransport({sessionIdGenerator:()=>v.v4(),onsessioninitialized:e=>{},onsessionclosed:e=>{},enableJsonResponse:!0,eventStore:void 0});break;default:if(!(i=e)||"object"!=typeof i||"function"!=typeof i.send&&"function"!=typeof i.close&&"function"!=typeof i.on)throw new l.InternalError("Invalid transport type: "+e)}var i;try{await this.load()}catch(e){throw e}await this.client.connect(e)}}const jt=(new e.Command).command("start").option("--transport [String]","transport mode","stdio").description("starts decaf's mcp server").action(async e=>{const r=F("package.json"),s=JSON.parse(t.readFileSync(r,"utf-8")),n=s.version,{transport:i}=e,o=(new _).for("mcp-server");if("stdio"!==i)throw Error("Unsupported transport mode: "+i);return o.info("Transport stdio"),o.debug(`running with options: ${JSON.stringify(e)} for ${s.name} version ${n}`),(new wt).boot(i)});(new e.Command).command("md-to-ast").description("pipes markdown to jira ast: `cat file.md` | npx decaf-mcp md-to-ast > ast.json").action(async e=>{const s=F("package.json"),n=JSON.parse(t.readFileSync(s,"utf-8")),i=n.version;r.Logging.for("md-to-ast").debug(`running with options: ${JSON.stringify(e)} for ${n.name} version ${i}`);const o=Le(await(async()=>{const e=[];for await(const t of process.stdin)e.push(Buffer.from(t));return Buffer.concat(e).toString("utf8")})(),{resolveMention:e=>({id:e,text:"@"+e}),resolveAttachment:e=>({id:e,collection:"attachments"})});process.stdout.write(JSON.stringify(o,null,2)+"\n")});const St=(new e.Command).name("mcp-server").command("mcp-server").description("decaf mcp server and agentic functionality");St.addCommand(jt),St.parse(process.argv)},"object"==typeof exports&&"undefined"!=typeof module?t(require("commander"),require("fs"),require("@decaf-ts/logging"),require("tslib"),require("@decaf-ts/decorator-validation"),require("zod"),require("@decaf-ts/injectable-decorators"),require("@decaf-ts/decoration"),require("path"),require("@decaf-ts/db-decorators"),require("crypto"),require("zlib"),require("url"),require("unified"),require("remark-directive"),require("remark-gfm"),require("remark-parse"),require("@modelcontextprotocol/sdk/shared/uriTemplate.js"),require("@modelcontextprotocol/sdk/server/mcp.js"),require("uuid"),require("@modelcontextprotocol/sdk/server/stdio.js"),require("@modelcontextprotocol/sdk/server/streamableHttp.js")):"function"==typeof define&&define.amd?define(["commander","fs","@decaf-ts/logging","tslib","@decaf-ts/decorator-validation","zod","@decaf-ts/injectable-decorators","@decaf-ts/decoration","path","@decaf-ts/db-decorators","crypto","zlib","url","unified","remark-directive","remark-gfm","remark-parse","@modelcontextprotocol/sdk/shared/uriTemplate.js","@modelcontextprotocol/sdk/server/mcp.js","uuid","@modelcontextprotocol/sdk/server/stdio.js","@modelcontextprotocol/sdk/server/streamableHttp.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).commander,e.fs,e.decafTsLogging,e.tslib,e.decafTsDecoratorValidation,e.zod,e.decafTsInjectableDecorators,e.decafTsDecoration,e.path,e.decafTsDbDecorators,e.crypto,e.zlib,e.url,e.unified,e.remarkDirective,e.remarkGfm,e.remarkParse,e.uriTemplate_js,e.mcp_js,e.uuid,e.stdio_js,e.streamableHttp_js);
|
|
2
|
+
var e,t;e=this,t=function(e,t,r,s,n,i,o,a,c,l,p,u,d,m,h,f,g,y,b,v,w,j){"use strict";function S(e){var t=Object.create(null);return e&&Object.keys(e).forEach(r=>{if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}),t.default=e,Object.freeze(t)}var x=S(t),I=S(c);class _ extends r.MiniLogger{constructor(e,t,r){super(e,t,r)}log(e,t,s,n){const i=this.config("level");r.NumericLogLevels[i],r.NumericLogLevels[e]}}const z=(e,t,...r)=>{const s=(e=>{if("string"==typeof e)return e;if(!e)return"unknown";if("function"==typeof e)return e.name||"unknown";if("object"==typeof e&&"constructor"in e){const t=e.constructor;if(t&&t.name)return t.name}return"unknown"})(e);return new _(s,t)};var E,k,T,A,O;(e=>{e[e.NONE=0]="NONE",e[e.BASIC=1]="BASIC",e[e.ADVANCED=2]="ADVANCED",e[e.HIGH=3]="HIGH"})(E||(E={})),(e=>{e[e.NONE=0]="NONE",e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=3]="HIGH"})(k||(k={})),(e=>{e[e.FREE=0]="FREE",e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=3]="HIGH"})(T||(T={}));class N extends n.Model{get log(){return this._log||(this._log=r.Logging.for(this)),this._log}constructor(e){super(e)}logFor(e){const{sessionId:t,requestId:r,authInfo:s}=e||{};let n="string"==typeof t&&t.length>0?this.log.for(t):this.log;return s&&s.clientId&&(n=n.for(s.clientId)),r&&(n=n.for(r.toString())),n}setDescription(e){return this.description=e,this}getDescription(){return this.description}setName(e){return this.name=e,this}getName(){return this.name}setTitle(e){return this.title=e,this}}s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"description",void 0),s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"name",void 0),s.__decorate([n.required(),s.__metadata("design:type",String)],N.prototype,"title",void 0);class C extends N{constructor(e){super(e),this.reasoning=E.NONE,this.effort=k.NONE,this.cost=T.FREE}setReasoning(e){return this.reasoning=e,this}setEffort(e){return this.effort=e,this}setCost(e){return this.cost=e,this}}function H(e){if(!e)return;let t=e,r=t&&t._def;for(;r&&"ZodObject"!==r.typeName;){if("ZodEffects"===r.typeName&&r.schema)t=r.schema;else if("ZodOptional"===r.typeName&&r.innerType)t=r.innerType;else if("ZodDefault"===r.typeName&&r.innerType)t=r.innerType;else if("ZodNullable"===r.typeName&&r.innerType)t=r.innerType;else{if(!r.schema)return;t=r.schema}r=t&&t._def}return r&&"ZodObject"===r.typeName?r:void 0}function q(e,t="schema"){if(H(e))return e;if(e&&"object"==typeof e){const t=e.def&&"object"==typeof e.def?e.def:void 0,r=t&&(t.shape||"object"===t.type)&&t.shape||("object"===e.type?e.shape:void 0)||(t&&"object"===t.type?{}:void 0);if(t||"object"===e.type||r){const e={};if(r&&"object"==typeof r)for(const[t,s]of Object.entries(r))e[t]=D(s)?s:i.z.any();return i.z.object(e)}}throw Error(`Registration error: provided a non-canonical ${t}. Export a ZodObject (z.object(...)).`)}function J(e){if(!e)return;if(e&&"object"==typeof e&&!e._def)return e.def&&"object"==typeof e.def&&e.def.shape?e.def.shape:e;const t=H(e);return t?"function"==typeof t.shape?t.shape():t.shape||void 0:void 0}function D(e){return!(!e||"object"!=typeof e||!e._def)}s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"reasoning",void 0),s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"effort",void 0),s.__decorate([n.required(),s.__metadata("design:type",Number)],C.prototype,"cost",void 0),(e=>{e.ASSETS="assets"})(A||(A={})),(e=>{e.PROMPT="prompts",e.DOCUMENTATION="documentation",e.CODE="code"})(O||(O={}));const P=Buffer.from("DCAF1","ascii");function $(e){let r=c.resolve(e);for(;;){if(t.existsSync(c.join(r,"package.json")))return r;const e=c.dirname(r);if(e===r)break;r=e}}const R=process.argv?.[1]?$(c.dirname(c.resolve(process.argv[1]))):void 0,M=(()=>{const e=Error().stack;if(!e)return;const t=e.split(/\r?\n/).slice(1);for(const e of t){const t=e.match(/\(?([^()]+?):\d+:\d+\)?/);if(!t)continue;let r=t[1];if(r.startsWith("file://"))try{r=d.fileURLToPath(r)}catch{continue}if(!r.includes("node:internal"))return c.dirname(r)}})(),L=M?$(M):void 0,F=R??L??process.cwd();function B(...e){return c.join(F,...e)}function U(e){let t=e;for(;;){const e=I.join(t,"lib","assets");if(x.existsSync(e))return e;const r=I.join(t,"src","assets");if(x.existsSync(r))return r;const s=I.join(t,"assets");if(x.existsSync(s))return s;const n=I.dirname(t);if(n===t)break;t=n}}function W(){const e=process.env.DECAF_ASSET_DIR||process.env.MCP_ASSET_DIR||process.env.ASSET_DIR||"";if(e&&x.existsSync(e))return e;const t=U(__dirname);if(t)return t;const r=process.argv?.[1];if(r){const e=U(I.dirname(r));if(e)return e}const s=[F,process.env.INIT_CWD].filter(Boolean);for(const e of s){const t=U(e);if(t)return t}return B("assets")}let K=class extends r.LoggedClass{constructor(e){super(),this.basePath=e||W()}listAssets(...e){const t=I.join(this.basePath,...e);return x.readdirSync(t)}listPrompts(){return this.listAssets(O.PROMPT)}getAsset(e,t="md",...r){const s=I.join(this.basePath,...r),n=(e,t=!1)=>{try{return t?(e=>{if(e.length<P.length+16+12+16)throw Error("Invalid prompt payload (too short)");if(!e.subarray(0,P.length).equals(P))throw Error("Invalid prompt payload (bad magic)");const t=process.env.ENCRYPTION_KEY||"";if(!t)throw Error("Missing encryption key. Set ENCRYPTION_KEY to load obfuscated assets.");let r=P.length;const s=e.subarray(r,r+16);r+=16;const n=e.subarray(r,r+12);r+=12;const i=e.subarray(r,r+16);r+=16;const o=e.subarray(r),a=((e,t)=>p.scryptSync(e,t,32))(t,s),c=p.createDecipheriv("aes-256-gcm",a,n);c.setAuthTag(i);const l=Buffer.concat([c.update(o),c.final()]);return u.gunzipSync(l)})(x.readFileSync(e)).toString("utf-8"):x.readFileSync(e,"utf-8")}catch(e){if("ENOENT"===e.code)return null;throw e}},i=n(I.join(s,`${e}.${t}`),"enc"===t);if(null!==i)return i;const o=n(I.join(s,e+".enc"),!0);if(null!==o)return o;throw Error("Asset not found: "+I.join(s,`${e}.${t}`))}getAllAssets(e,...t){return this.listAssets(e,...t).reduce((r,s)=>{const n=I.extname(s),i=I.basename(s,n),o=n.replace(/^\./,"")||void 0;return r[i]=this.getAsset(i,o??void 0,e,...t),r},{})}toPromptDef(e){const t=e=>"number"==typeof e?e:"string"==typeof e?(e=>{switch(e){case"none":return E.NONE;case"basic":return E.BASIC;case"advanced":return E.ADVANCED;case"high":return E.HIGH;case"medium":return k.MEDIUM;case"low":return T.LOW;case"free":return T.FREE;default:throw new l.InternalError("Cannon convert unknown level "+e)}})(e.toLowerCase()):E.NONE;return e.effort=t(e.effort),e.reasoning=t(e.reasoning),e.cost=t(e.cost),e}getPrompt(e,...t){const s=this.getAsset(r.toSnakeCase(e),"json",O.PROMPT,...t);let n;try{n=JSON.parse(s)}catch(r){throw new l.SerializationError(`Failed to parse prompt ${e} in categories ${t}: ${r}`)}return this.toPromptDef(n)}getAllPrompts(...e){const t=this.getAllAssets(O.PROMPT,...e);return Object.entries(t).reduce((t,[r,s])=>{try{t[r]=JSON.parse(s)}catch(t){throw new l.SerializationError(`Failed to parse prompt ${r} in categories ${e}: ${t}`)}return t},t)}};K=s.__decorate([o.injectable(),s.__metadata("design:paramtypes",[String])],K);class Y extends C{constructor(e){super(e)}setCb(e){return this.cb=e,this}setArgsSchema(e){return this.argsSchema=e,this}static get builder(){return new Y}static patchPrompt(e,t,s,n){const i=(t=Array.isArray(t)?t:Object.keys(t)).filter(e=>!Object.prototype.hasOwnProperty.call(s,e));if(i.length)throw new l.ValidationError("Missing replacements for placeholders: "+i.join(", "));n&&(n.verbose("Patching prompt with placeholders: "+JSON.stringify(t)),n.debug("Values: "+JSON.stringify(s)));const o=t.reduce((e,t)=>(e[t]=s[t],e),{});return r.sf(e,o)}patchPrompt(e,t,r,s){return Y.patchPrompt(e,t,r,s||this.log.for(this.patchPrompt))}build(e,t){const r=this.log.for(this.build),s=this.hasErrors();if(s)throw new l.ValidationError(s.toString());try{this.argsSchema&&q(this.argsSchema,"argsSchema");const r=J(this.argsSchema);return e.registerPrompt(this.name,{title:this.title,description:this.description,argsSchema:r},async(e,r)=>{const s=this.logFor(r);e=Object.assign({},t,e||{}),s.verbose(`Executing prompt ${this.name} with args: ${JSON.stringify(e)}`),e._meta=Object.assign(e._meta||{},{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}});const n=await Promise.resolve(this.cb(e,r));return s.verbose(`Prompt ${this.name} executed successfully.`),s.debug("Prompt execution meta: "+JSON.stringify(n._meta)),n})}catch(e){throw r.error("Failed to register prompt "+(this.name||this.constructor.name),e),e}}}s.__decorate([o.inject(K),s.__metadata("design:type",K)],Y.prototype,"assets",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],Y.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",i.ZodObject)],Y.prototype,"argsSchema",void 0),s.__decorate([a.prop(),s.__metadata("design:type",Object)],Y.prototype,"placeholders",void 0);class V extends Y{setCategory(e){return this.promptCategory=e,this}addPrefix(e){return this.prefixes=this.prefixes||[],this.prefixes.push(e),this}addSuffix(e){return this.suffixes=this.suffixes||[],this.suffixes.push(e),this}constructor(e){super(e)}build(e){const t=this.assets.getPrompt(this.name,this.promptCategory);n.Model.fromObject(this,t);const r=new Set((a.Metadata.properties(V)||[]).filter(e=>!["assets","promptCategory","prefixes","suffixes"].includes(e)));["cb","argsSchema"].forEach(e=>r.add(e));const s=this.hasErrors(...Array.from(r));if(s)throw new l.ValidationError(s.toString());const o=(this.prefixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),c=(this.suffixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),p=[...new Set([...t.placeholders,...o.map(e=>e.placeholders||[]),...c.map(e=>e.placeholders||[])].flat())].reduce((e,t)=>(e[t]=i.z.string().describe("The description for "+t),e),{});return this.setArgsSchema(i.z.object(p)),this.setCb((e,t)=>{const r=this.logFor(t).for(V).for(this.promptCategory).for(this.name);function s(e=[]){return Array.isArray(e)?e:Object.keys(e)}const n=(this.prefixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),i=(this.suffixes||[]).map(e=>this.assets.getPrompt(e,this.promptCategory)),o=this.assets.getPrompt(this.name,this.promptCategory),a=[...new Set([...n.map(e=>s(e.placeholders)).flat(),...i.map(e=>s(e.placeholders)).flat(),...s(o.placeholders).flat()])];return{messages:[{role:"user",content:{type:"text",text:this.patchPrompt([...n.map(e=>e.prompt),o.prompt,...i.map(e=>e.prompt)].join("\n\n"),a,e,r)}}],_meta:{}}}),super.build(e)}setReasoning(e){throw new l.InternalError("Named prompt builders don't require callback")}setEffort(e){throw new l.InternalError("Named prompt builders don't require callback")}setCost(e){throw new l.InternalError("Named prompt builders don't require callback")}setDescription(e){throw new l.InternalError("Named prompt builders don't require callback")}setTitle(e){throw new l.InternalError("Named prompt builders don't require callback")}static get builder(){return new V}}s.__decorate([n.required(),s.__metadata("design:type",String)],V.prototype,"promptCategory",void 0),s.__decorate([n.list(String),n.minlength(1),s.__metadata("design:type",Array)],V.prototype,"prefixes",void 0),s.__decorate([n.minlength(1),n.list(String),s.__metadata("design:type",Array)],V.prototype,"suffixes",void 0);const G=Y.builder.setName("example-prompt").setTitle("Example prompt").setDescription("Example prompt for testing").setArgsSchema(i.z.object({message:i.z.string().optional()})).setCb(async e=>{const t=e.message??"default";return{messages:[{role:"assistant",content:{type:"text",text:t}}],content:[],structuredContent:{message:t},result:{message:t}}}),Z=Y.builder.setName("interactive-jsdoc").setTitle("Interactive JSDoc prompt").setDescription("Interactive prompt for jogging JSDoc helpers").setArgsSchema(i.z.object({gist:i.z.string().optional()})).setCb(async e=>{const t=e.gist??"interactive jsdoc response";return{messages:[{role:"assistant",content:{type:"text",text:t}}],content:[],structuredContent:{message:t},result:{message:t}}}),Q=Object.assign(Z,{name:Z.getName()});var X;function ee(e,t=[],r=[]){const s=V.builder.setCategory(X.DOCS).setName(e);return["prefix",...t].forEach(e=>s.addPrefix(e)),["suffix",...r].forEach(e=>s.addSuffix(e)),s}(e=>{e.DOCS="documentation",e.CODE="code"})(X||(X={}));const te=[ee("class"),ee("constant"),ee("decorator"),ee("function"),ee("module"),ee("file"),ee("repo",[],["iterate"])],re=i.z.object({className:i.z.string().describe("the class name to turn into a builder")}),se=[G,Q,...te,Y.builder.setName("ts-code-dp-builder").setTitle("Typescript builder design patter prompt").setDescription("for a class, with a defined set of properties, scafold a builder design pattern").setArgsSchema(re).setReasoning(E.BASIC).setCb((e,t)=>(e.className=r.toPascalCase(e.className),{messages:[{role:"user",content:{type:"text",text:`You're a senior TypeScript developer writing typescript code.You're a senior TypeScript developer writing typescript code.\nTransform the selected class into a builder design pattern implementation in Typescript.\nuse @decaf-ts validation decorators to enforce the validation of your builder.\n\n- must extend the Model Class from @decaf-ts/decorator-validation;\n- each property must be marked as protected;\n- each property must have a setter method that returns 'this' for chaining;\n- the build() method must validate the properties using hasErrors() method from Model class;\n- if validation fails, throw an error with the validation errors;\n- if validation passes, return an instance of the original class with the set properties;\n- optionally (but do so by default) add the static builder and from methods from the example;\n- if the clasee already follows the pattern but has properties without decoration or without setters, simple add them;\n\nexample:\n\noriginal class:\n\`\`\`typescript\nexport class ${e.className} {\n description!: string;\n name!: string = "default name";\n title!: string;\n age?: string;\n dateOfBirth!: Date;\n}}\n\`\`\` \n\nresulting builder pattern implementation:\n\`\`\`typescript\nexport class ${e.className}Builder extends Model {\n\n @minlength(10\n @required()\n protected description!: string;\n \n @required()\n protected name!: string = "default value;\n \n @required()\n protected title!: string;\n \n @min(18)\n protected age?: string;\n \n @date()\n protected dateOfBirth!: Date;\n\n protected constructor(arg?: ModelArg<${e.className}Builder>>) {\n super(arg);\n Model.fromModel(this, arg);\n }\n\n setDescription(value: string) {\n this.description = value;\n return this;\n }\n\n setName(value: string) {\n this.name = value;\n return this;\n }\n\n setTitle(value: string) {\n this.title = value;\n return this;\n }\n setAge(value: number) {\n this.age = value;\n return this;\n }\n setDate(value: Date) {\n this.age = value;\n return this;\n }\n \n build(...args: any[]): ${e.className}Builder | Promise<${e.className}Builder> {\n const errs = this.hasErrors();\n if (errs) throw new Error(errs.toString());\n \n return // code that builds OBJ here\n }\n \n static get builder(): ${e.className}Builder {\n return new ${e.className}Builder(); // static method to get a new builder instance\n }\n \n static from<K extends keyof ${e.className}Builder>(obj: K, ${e.className}Builder[K]): ${e.className}Builder {\n return new ${e.className}Builder(); // static method to create a builder from an object\n }\n}\n\`\`\` \n\n`}}],_meta:{}}))];class ne extends C{setAnnotations(e){return this.annotations=Object.assign(this.annotations,e),this}setCb(e){return this.cb=e,this}setInputSchema(e){return this.inputSchema=e,this}setOutputSchema(e){return this.outputSchema=e,this}constructor(e){super(e),this.annotations={readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}static get builder(){return new ne}build(e){const t=this.hasErrors();if(t)throw Error(t.toString());try{this.inputSchema&&q(this.inputSchema,"inputSchema"),this.outputSchema&&q(this.outputSchema,"outputSchema");const t=J(this.inputSchema),r=J(this.outputSchema);return e.registerTool(this.name,{title:this.title,description:this.description,inputSchema:t,outputSchema:r,annotations:this.annotations,_meta:{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}}},async(e,t)=>{const r=this.logFor(t);r.verbose(`Executing tool ${this.name} with args: ${JSON.stringify(e)}`),t._meta=Object.assign(t._meta||{},{usage:{reasoning:this.reasoning,effort:this.effort,cost:this.cost}});const s=await Promise.resolve(this.cb(e,t));return r.verbose(`Tool ${this.name} executed successfully.`),r.debug("Tool execution meta: "+JSON.stringify(s._meta)),s})}catch(e){const t=e?.message||e+"";if("string"==typeof t&&t.includes("already registered"))return r.Logging.for(this).warn(`Tool ${this.name} already registered - skipping duplicate registration`),{name:this.name};throw r.Logging.for(this).error("Error building tool",e),e}}}s.__decorate([n.required(),s.__metadata("design:type",Object)],ne.prototype,"annotations",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],ne.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",Function)],ne.prototype,"inputSchema",void 0);const ie=ne.builder.setName("example-tool").setTitle("Example tool").setDescription("A smoke tool used for quick testing").setInputSchema(i.z.object({})).setCb(async()=>({content:[{type:"text",text:"example tool ok"}],result:{status:"ok"}}));Object.assign(ie,{name:ie.getName()});const oe=ne.builder.setName("file-summarizer").setTitle("File summarizer").setDescription("Summaries files for quick previews").setInputSchema(i.z.object({filePath:i.z.string().optional()})).setCb(async()=>({content:[{type:"text",text:"file summary stub"}],result:{summary:"file summary stub"}}));function ae(){try{let e=process.argv[1]?c.dirname(c.resolve(process.argv[1])):process.cwd();for(;;){const r=c.join(e,"package.json");if(t.existsSync(r))return JSON.parse(t.readFileSync(r,"utf-8"));const s=c.dirname(e);if(s===e)break;e=s}}catch{}return{}}Object.assign(oe,{name:oe.getName()});const ce=ae().version??"0.0.0",le=ae().name??"unknown";a.Metadata.registerLibrary(le,ce);const pe={mcpId:"decaf",name:"decaf-ts mcp server",title:"Decaf-TS MCP Server",description:"Provides precise coding assistance for the decaf-ts framework",version:ce,websiteUrl:"https://decaf-ts.github.io",repositoryUrl:"https://github.com/decaf-ts/mcp-server",license:"AGPL-3.0",workingDir:F,assetDir:W(),contacts:[{name:"Decaf-TS",url:"https://decaf-ts.github.io"}],tags:"server,official,decaf-ts",metadata:{},icons:[{src:"workdocs/assets/favicon.svg",mimeType:"image/svg+xml",sizes:"any"}],jira:{host:process.env.JIRA__HOST||"decaf-ts.atlassian.net",email:process.env.JIRA__EMAIL||"",apiKey:process.env.JIRA__API_KEY||process.env.JIRA__APIKEY||"",projectKey:process.env.JIRA__PROJECT_KEY||void 0,issueType:process.env.JIRA__ISSUE_TYPE||void 0,parentIssue:process.env.JIRA__PARENT_ISSUE||void 0},level:r.LogLevel.error},ue=r.LoggedEnvironment.accumulate(pe);function de(){const{host:e,email:t,apiKey:r,projectKey:s,issueType:n}=ue.jira;return{host:e?.trim(),email:t?.trim(),apiKey:r?.trim(),projectKey:s?.trim(),issueType:n?.trim(),parentIssue:ue.jira.parentIssue?.trim()}}function me(){const e=de();return[{name:"JIRA__HOST",required:!0,description:"Atlassian host (e.g. decaf-ts.atlassian.net) where your Jira instance is hosted.",value:e.host},{name:"JIRA__EMAIL",required:!0,description:"Email address of the Jira account that has API access.",value:e.email},{name:"JIRA__API_KEY",required:!0,description:"API token created in your Atlassian profile (a.k.a. APIKEY alias) for authenticating requests.",sensitive:!0,value:e.apiKey},{name:"JIRA__PROJECT_KEY",required:!1,description:"Default Jira project key (e.g. DECAF) used when an issue creation request omits a project.",value:e.projectKey},{name:"JIRA__ISSUE_TYPE",required:!1,description:"Default Jira issue type (e.g. Task, Bug) used when creating issues without an explicit type.",value:e.issueType},{name:"JIRA__PARENT_ISSUE",required:!1,description:"Default parent issue key (e.g. DECAF-123) applied when a child issue is created without an explicit parent.",value:e.parentIssue}]}function he(e){const t=e.value?((e,t)=>{if(e)return t?"<configured>":e})(e.value,e.sensitive):"not set",r=e.required?"(required)":"(optional)";return`\u2022 ${e.name} ${r}: ${e.description} Current state: ${t}.`}r.Logging.setConfig(ue);class fe extends Error{constructor(e){const t=me(),r=(e=>{const t=me();return`${e.length?`Missing Jira credentials: ${e.map(e=>e.name).join(", ")}.`:"Jira credentials are configured."}\n\nThis setup uses the following environment variables:\n${t.map(he).join("\n")}`})(e);super(r),this.name="MissingJiraEnvironmentError",this.descriptors=t,this.missing=e,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,fe)}}function ge(e){if(!e)return{code:"jira_error",message:"Unknown Jira error",details:{raw:e}};const t=e?.status??e?.statusCode??e?.response?.status??e?.response?.statusCode,r="number"==typeof t?t:Number(t)||void 0,s=e?.response?.data??e?.data??e?.response?.body??e?.body,n=[];"string"==typeof e?.message&&n.push(e.message),((e,t)=>{e&&(Array.isArray(e.errorMessages)&&e.errorMessages.forEach(e=>"string"==typeof e&&t.push(e)),"string"==typeof e.errorMessage&&t.push(e.errorMessage),e.errorCollection&&Array.isArray(e.errorCollection.errors)&&e.errorCollection.errors.forEach(e=>{"string"==typeof e?t.push(e):e&&"string"==typeof e.message&&t.push(e.message)}),e?.errors&&"object"==typeof e.errors&&Object.values(e.errors).forEach(e=>{"string"==typeof e?t.push(e):"string"==typeof e?.message&&t.push(e.message)}))})(s,n);const i=r?`Jira API error (${r})`:"Jira API error",o=n.length>0?n.join(" | "):i;return{code:r?"jira_"+r:e?.code??"jira_error",message:o,details:{httpStatus:r,body:s,raw:e}}}function ye(e={},t=[]){return{content:t,result:e,structuredContent:e}}const be=i.z.object({issueId:i.z.string().min(1),deleteSubtasks:i.z.boolean().optional().default(!0)}),ve={name:"jira-issue-delete",inputSchema:be,runTool:async(e,t)=>{try{const r=be.parse(t),s=e.issues??e.issue??e,n=s?.delete??s?.deleteIssue;if("function"!=typeof n)throw Error("jira client delete endpoint is not available");return await n.call(s,{issueId:r.issueId,deleteSubtasks:r.deleteSubtasks}),ye({success:!0,message:`Issue ${t.issueId} deleted successfully`})}catch(e){throw ge(e)}}},we=i.z.object({projectKey:i.z.string().trim().min(1).optional(),issueType:i.z.string().trim().min(1).optional(),parentIssueId:i.z.string().trim().min(1).optional(),name:i.z.string().trim().min(1).optional(),reference:i.z.string().trim().min(1).optional(),jql:i.z.string().trim().min(1).optional(),startAt:i.z.number().int().min(0).optional(),maxResults:i.z.number().int().min(1).optional(),fields:i.z.array(i.z.string()).optional(),expand:i.z.string().optional(),orderBy:i.z.string().trim().min(1).optional()});function je(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}const Se={name:"jira-issue-list",inputSchema:we,runTool:async(e,t)=>{try{const r=we.parse(t),s=r.startAt??0,n=r.maxResults??50;let i=r.jql?.trim();if(i){if(r.orderBy){const e=r.orderBy.trim();e&&(i=/\border\s+by\b/i.test(i)?`${i}, ${e}`:`${i} ORDER BY ${e}`)}}else i=(e=>{const t=[];if(e.projectKey&&t.push(`project = "${je(e.projectKey)}"`),e.issueType&&t.push(`issuetype = "${je(e.issueType)}"`),e.parentIssueId&&t.push(`parent = "${je(e.parentIssueId)}"`),e.name&&t.push(`summary ~ "${je(e.name)}"`),e.reference){const r=je(e.reference);t.push(`(key ~ "${r}" OR summary ~ "${r}" OR text ~ "${r}")`)}if(0===t.length){const e=Error("Provide a jql query or at least one filter (project, name, reference, parent, issue type, etc.).");throw e.code="validation_error",e}let r=t.join(" AND ");if(e.orderBy){const t=e.orderBy.trim();t&&(r=/\border\s+by\b/i.test(r)?`${r}, ${t}`:`${r} ORDER BY ${t}`)}return r})(r);const o={jql:i,startAt:s,maxResults:n};r.fields&&(o.fields=r.fields),r.expand&&(o.expand=r.expand);const a=e.issueSearch,c=a&&"function"==typeof a.searchForIssuesUsingJqlEnhancedSearch?a.searchForIssuesUsingJqlEnhancedSearch:a&&"function"==typeof a.searchForIssuesUsingJql?a.searchForIssuesUsingJql:void 0;if(!c)throw Error("Jira search API is unavailable on the client");const l=await c.call(a,o);return ye(l?.data??l)}catch(e){throw ge(e)}}},xe=i.z.object({issueId:i.z.string().min(1),expand:i.z.string().optional(),fields:i.z.array(i.z.string()).optional(),properties:i.z.array(i.z.string()).optional()}),Ie={name:"jira-issue-read",inputSchema:xe,runTool:async(e,t)=>{try{const r=xe.parse(t),s={issueIdOrKey:r.issueId};r.expand&&(s.expand=r.expand),r.fields&&(s.fields=r.fields),r.properties&&(s.properties=r.properties);const n=await e.issues.get(s);return ye(n?.data??n)}catch(e){throw ge(e)}}};function _e(e,t,r){const s=((e.url??"")+"").match(/^(attachment|jira-attachment):(.+)$/i);if(!s)return null;const n=s[2],i=r.resolveAttachment?.(n);return i?{type:"block",node:{type:"mediaSingle",attrs:{layout:"center"},content:[{type:"media",attrs:{type:"file",id:i.id,collection:i.collection??"attachments"}}]}}:null}function ze(e,t){if(!e)return[];if(!t.enableAtMentions&&!t.enableEmojiShortcodes)return[{type:"text",text:e}];let r=0;const s=[],n=/(^|[^A-Za-z0-9_])@([A-Za-z0-9._-]{1,64})/g,i=/:([a-z0-9_+-]{1,64}):/gi;for(;r<e.length;){const o=ke(t.enableAtMentions?Ee(n,e,r):null,t.enableEmojiShortcodes?Ee(i,e,r):null);if(!o){s.push({type:"text",text:e.slice(r)});break}if(o.index>r&&s.push({type:"text",text:e.slice(r,o.index)}),"mention"===o.kind){const{full:e,groups:n}=o,i=n[0]??"",a=n[1]??"";i&&s.push({type:"text",text:i});const c=t.resolveMention?.(a);c?s.push({type:"mention",attrs:{id:c.id,text:c.text}}):s.push({type:"text",text:"@"+a}),r=o.index+e.length;continue}if("emoji"===o.kind){const{full:e,groups:n}=o,i=`:${n[0]}:`,a=t.resolveEmoji?.(i);s.push({type:"emoji",attrs:a?{shortName:a.shortName,text:a.text}:{shortName:i}}),r=o.index+e.length;continue}}return(e=>{const t=[];for(const r of e){const e=t[t.length-1];"text"!==r.type||"text"!==e?.type||e.marks||r.marks?t.push(r):e.text=(e.text??"")+(r.text??"")}return t})(s)}function Ee(e,t,r){e.lastIndex=r;const s=e.exec(t);if(!s)return null;const n=e.source.includes("@")?"mention":"emoji";return{index:s.index,full:s[0],groups:s.slice(1),kind:n}}function ke(e,t){return e?t&&e.index>t.index?t:e:t}function Te(e){const t=(e.children??[])[0];return"text"===t?.type?(t.value??"")+"":"paragraph"===t?.type?((t.children??[]).map(e=>"text"===e.type?(e.value??"")+"":"").join("")||"")+"":""}function Ae(e){const t=((e??"")+"").toLowerCase().trim();return t?"info"===t||"note"===t||"success"===t||"warning"===t||"error"===t?t:"danger"===t?"error":null:null}function Oe(e){const t=((e??"")+"").toLowerCase().trim();return!t||"neutral"!==t&&"green"!==t&&"yellow"!==t&&"red"!==t&&"blue"!==t&&"purple"!==t?null:t}function Ne(e,t){const r=[];for(const s of e??[])if(s?.type)if("text"!==s.type)if("strong"!==s.type)if("emphasis"!==s.type)if("delete"!==s.type)if("inlineCode"!==s.type)if("break"!==s.type){if("link"===s.type){const e=(s.url??"")+"",n=He(s.children??[],e),i=_e(s,0,t);if(i){"inline"===i.type?r.push(i.node):r.push({type:"text",text:n,marks:[{type:"link",attrs:{href:e}}]});continue}if(t.enableSmartCards&&qe(n,e)){r.push({type:"inlineCard",attrs:{url:e}});continue}r.push({type:"text",text:n,marks:[{type:"link",attrs:{href:e}}]});continue}if("textDirective"===s.type&&"status"===s.name){const e=Te(s)||"Status",t=Oe(s.attributes?.color)??"neutral";r.push({type:"status",attrs:{text:e,color:t}});continue}if("textDirective"===s.type&&"emoji"===s.name){const e=Je(s);r.push(De(e,t));continue}}else r.push({type:"hardBreak"});else r.push({type:"text",text:(s.value??"")+"",marks:[{type:"code"}]});else r.push(...Ce(Ne(s.children??[],t),{type:"strike"}));else r.push(...Ce(Ne(s.children??[],t),{type:"em"}));else r.push(...Ce(Ne(s.children??[],t),{type:"strong"}));else r.push(...ze((s.value??"")+"",t));return r.filter(e=>!("text"===e.type&&""===(e.text??"")))}function Ce(e,t){return e.map(e=>{if("text"!==e.type)return e;const r=e.marks?[...e.marks,t]:[t];return{...e,marks:r}})}function He(e,t){const r=[];for(const t of e??[])"text"===t.type||"inlineCode"===t.type?r.push((t.value??"")+""):"emphasis"!==t.type&&"strong"!==t.type&&"delete"!==t.type||r.push(He(t.children??[],""));return r.join("")||t}function qe(e,t){const r=(e??"").trim(),s=(t??"").trim();return r===s&&/^https?:\/\//i.test(s)}function Je(e){return(e.children??[]).map(e=>"text"===e.type?(e.value??"")+"":"").join("").trim()||""}function De(e,t){const r=e.startsWith(":")?e:`:${e}:`,s=t.resolveEmoji?.(r);return s?{type:"emoji",attrs:{shortName:s.shortName,text:s.text}}:{type:"emoji",attrs:{shortName:r}}}function Pe(e){return e?"string"==typeof e?e:"text"===e.type||"inlineCode"===e.type?(e.value??"")+"":Array.isArray(e.children)?e.children.map(Pe).join(""):"":""}function $e(e,t){if(!e?.type)return null;if((e=>"containerDirective"===e?.type&&"panel"===e?.name)(e))return((e,t)=>{const r=e.attributes??{},s=Ae(r.type)??"info",n="string"==typeof r.title?r.title:void 0,i=(e.children??[]).map(e=>$e(e,t)).flat().filter(Boolean);return{type:"panel",attrs:{panelType:s,...n?{panelType:s,title:n}:{panelType:s}},content:i.length?i:[{type:"paragraph",content:[]}]}})(e,t);switch(e.type){case"heading":return{type:"heading",attrs:{level:Me(e.depth??1,1,6)},content:Ne(e.children??[],t)};case"paragraph":{const r=(e=>{const t=e.children??[];if(1!==t.length)return null;const r=t[0];if("image"!==r?.type)return null;const s=(r.url??"")+"";return s?{type:"mediaSingle",attrs:{layout:"center"},content:[{type:"media",attrs:{type:"external",url:s}}]}:null})(e);return r||{type:"paragraph",content:Ne(e.children??[],t)}}case"blockquote":return{type:"blockquote",content:(e.children??[]).map(e=>$e(e,t)).flat().filter(Boolean)};case"list":return((e,t)=>t.enableTaskLists&&(e.children??[]).some(e=>"boolean"==typeof e.checked)?((e,t)=>{const r=[];let s=0;for(const n of e.children??[]){if("boolean"!=typeof n.checked)continue;s+=1;const e=(n.children??[]).map(e=>$e(e,t)).flat().filter(Boolean);r.push({type:"taskItem",attrs:{localId:"task-"+s,state:n.checked?"DONE":"TODO"},content:e.length?e:[{type:"paragraph",content:[]}]})}return{type:"taskList",content:r}})(e,t):{type:e.ordered?"orderedList":"bulletList",content:(e.children??[]).map(e=>((e,t)=>{const r=(e.children??[]).map(e=>$e(e,t)).flat().filter(Boolean);return{type:"listItem",content:r.length?r:[{type:"paragraph",content:[]}]}})(e,t))})(e,t);case"code":{const r=((e,t)=>{const r=(e??"").toString().trim().toLowerCase();return r?t.enableMermaid&&"mermaid"===r?"mermaid":(e=>{const t=e.trim().toLowerCase();return{js:"javascript",javascript:"javascript",jsx:"javascript",ts:"typescript",typescript:"typescript",tsx:"typescript",py:"python",python:"python",rb:"ruby",ruby:"ruby",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",yml:"yaml",yaml:"yaml",json:"json",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",go:"go",rust:"rust",java:"java",c:"c",cpp:"cpp","c++":"cpp",cs:"csharp",csharp:"csharp",php:"php",kotlin:"kotlin",swift:"swift",md:"markdown",markdown:"markdown",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"make",ini:"ini"}[t]??t})(r):null})(e.lang,t);return{type:"codeBlock",attrs:{language:r},content:[{type:"text",text:(e.value??"")+""}]}}case"thematicBreak":return{type:"rule"};case"table":return((e,t)=>({type:"table",content:(e.children??[]).map((e,r)=>({type:"tableRow",content:(e.children??[]).map(e=>({type:0===r?"tableHeader":"tableCell",content:[{type:"paragraph",content:Ne(e.children??[],t)}]}))}))}))(e,t);case"leafDirective":return"status"===e.name?(e=>{const t=Oe((e.attributes??{}).color)??"neutral";return{type:"paragraph",content:[{type:"status",attrs:{text:Te(e)||"Status",color:t}}]}})(e):"panel"===e.name?((e,t)=>{const r=e.attributes??{},s=Ae(r.type)??"info",n="string"==typeof r.title?r.title:void 0;return{type:"panel",attrs:{panelType:s,...n?{title:n}:{}},content:[{type:"paragraph",content:Ne([{type:"text",value:Te(e)}],t)}]}})(e,t):Re(e,t);default:return Re(e,t)}}function Re(e,t){if("drop"===t.unknownNodeStrategy)return null;const r=Pe(e);return r?{type:"paragraph",content:[{type:"text",text:r}]}:null}function Me(e,t,r){const s=Number.isFinite(e)?Math.trunc(e):t;return Math.max(t,Math.min(r,s))}const Le={resolveMention:void 0,resolveAttachment:void 0,resolveEmoji:void 0,enableSmartCards:!0,enableMermaid:!0,enableEmojiShortcodes:!0,enableAtMentions:!0,enableTaskLists:!0,unknownNodeStrategy:"text"};function Fe(e,t={}){const r={...Le,...t},s=e??"",n=m.unified().use(g).use(f).use(h),i=n.parse(s),o=n.runSync(i);return Be(o),((e,t)=>{const r=[];for(const s of e.children??[]){const e=$e(s,t);e&&(Array.isArray(e)?r.push(...e):r.push(e))}return((e,t)=>{if(!t.enableSmartCards)return e;const r=e.content.map(e=>(e=>{if("paragraph"!==e.type)return e;const t=e.content??[];if(1!==t.length)return e;const r=t[0];if("inlineCard"!==r?.type)return e;const s=r.attrs?.url;return s?[{type:"blockCard",attrs:{url:s}}]:e})(e)).flat();return{...e,content:r}})({version:1,type:"doc",content:r},t)})(o,r)}function Be(e){if(!e||!Array.isArray(e.children))return;const t=[];for(const r of e.children)"definition"!==r?.type&&("html"!==r?.type?(Be(r),t.push(r)):t.push({type:"text",value:(r.value??"")+""}));e.children=t}const Ue=i.z.object({issueId:i.z.string().min(1),transitionId:i.z.union([i.z.string(),i.z.number()]),fields:i.z.record(i.z.any()).optional(),update:i.z.record(i.z.array(i.z.object({set:i.z.any().optional(),add:i.z.any().optional(),remove:i.z.any().optional()}))).optional(),comment:i.z.string().optional()}),We={name:"jira-issue-transition",inputSchema:Ue,runTool:async(e,t)=>{try{const r=Ue.parse(t),s={id:r.transitionId};r.fields&&(s.fields=r.fields),r.update&&(s.update=r.update),r.comment&&(s.comment={body:Fe(r.comment)});const n=await e.issues.transition({issueId:r.issueId,transition:s});return ye(n?.data??n)}catch(e){throw ge(e)}}},Ke=i.z.object({issueId:i.z.string().min(1),fields:i.z.record(i.z.any()).optional(),update:i.z.record(i.z.array(i.z.object({set:i.z.any().optional(),add:i.z.any().optional(),remove:i.z.any().optional(),edit:i.z.any().optional()}))).optional(),properties:i.z.array(i.z.any()).optional(),notifyUsers:i.z.boolean().optional().default(!0),issueTemplateId:i.z.string().optional(),overrideScreenSecurity:i.z.boolean().optional().default(!1),overrideEditableFlag:i.z.boolean().optional().default(!1)}),Ye={name:"jira-issue-update",inputSchema:Ke,runTool:async(e,t)=>{try{const r=Ke.parse(t),s={issueId:r.issueId};r.fields&&(s.fields=r.fields),r.update&&(s.update=r.update),r.properties&&(s.properties=r.properties),void 0!==r.notifyUsers&&(s.notifyUsers=r.notifyUsers),r.issueTemplateId&&(s.issueTemplateId=r.issueTemplateId),void 0!==r.overrideScreenSecurity&&(s.overrideScreenSecurity=r.overrideScreenSecurity),void 0!==r.overrideEditableFlag&&(s.overrideEditableFlag=r.overrideEditableFlag);const n=await e.issues.update(s);return ye(n?.data??n)}catch(e){throw ge(e)}}},Ve=i.z.object({issueId:i.z.string().min(1),assignee:i.z.union([i.z.string(),i.z.object({accountId:i.z.string().min(1)}),i.z.object({accountType:i.z.string().min(1)})])}),Ge={name:"jira-assign-issue",inputSchema:Ve,runTool:async(e,t)=>{try{const r=Ve.parse(t);let s;s="string"==typeof r.assignee?{accountId:r.assignee}:r.assignee;const n=await e.issues.assign({issueId:r.issueId,assignee:s});return ye(n?.data??n)}catch(e){throw ge(e)}}},Ze=i.z.object({issueId:i.z.string().min(1)}),Qe={name:"jira-unassign-issue",inputSchema:Ze,runTool:async(e,t)=>{try{const r=Ze.parse(t),s=await e.issues.assign({issueId:r.issueId,assignee:{accountId:"-1"}});return ye(s?.data??s)}catch(e){throw ge(e)}}},Xe=i.z.object({issueId:i.z.string().min(1),body:i.z.string().min(1),visibility:i.z.object({type:i.z.enum(["role","group"]),value:i.z.string().min(1)}).optional()}),et={name:"jira-comment-add",inputSchema:Xe,runTool:async(e,t)=>{try{const r=Xe.parse(t),s={body:Fe(r.body)};r.visibility&&(s.visibility=r.visibility);const n=await e.issues.addComment({issueId:r.issueId,comment:s});return ye(n?.data??n)}catch(e){throw ge(e)}}},tt=i.z.object({issueId:i.z.string().min(1),start:i.z.number().optional().default(0),maxResults:i.z.number().optional().default(50),orderBy:i.z.string().optional(),expand:i.z.string().optional()}),rt={name:"jira-comment-list",inputSchema:tt,runTool:async(e,t)=>{try{const r=tt.parse(t),s=await e.issues.getComments({issueId:r.issueId,start:r.start,maxResults:r.maxResults,orderBy:r.orderBy,expand:r.expand});return ye(s?.data??s)}catch(e){throw ge(e)}}},st=i.z.object({link:i.z.object({relationship:i.z.enum(["Blocks","Relates to","Duplicates","Is blocked by","Is related to","Is duplicated by","Causes","Is caused by","Clone","Required","Work on","Split","Roll up"]),inwardIssue:i.z.object({id:i.z.string().optional(),key:i.z.string().optional()}),outwardIssue:i.z.object({id:i.z.string().optional(),key:i.z.string().optional()}),comment:i.z.object({body:i.z.string().optional(),visibility:i.z.object({type:i.z.enum(["role","group"]),value:i.z.string().min(1)}).optional()}).optional()})}),nt={name:"jira-link-create",inputSchema:st,runTool:async(e,t)=>{try{const r=st.parse(t).link,s={relationship:r.relationship,inwardIssue:r.inwardIssue.id||r.inwardIssue.key,outwardIssue:r.outwardIssue.id||r.outwardIssue.key};r.comment&&(r.comment.body&&(s.comment=Fe(r.comment.body)),r.comment.visibility&&(s.visibility=r.comment.visibility));const n=await e.issues.link(s);return ye(n?.data??n)}catch(e){throw ge(e)}}},it=i.z.object({issueId:i.z.string().min(1),file:i.z.string().min(1),mimeType:i.z.string().optional(),comment:i.z.string().optional()}),ot={name:"jira-attach",inputSchema:it,runTool:async(e,r)=>{try{const s=it.parse(r),n=c.resolve(s.file),i=await t.promises.readFile(n),o=c.basename(n),a=await e.issues.addAttachment({issueId:s.issueId,file:{name:o,content:i,mimeType:s.mimeType??"application/octet-stream"},comment:s.comment});return ye(a?.data??a)}catch(e){if(e&&e.code&&"string"==typeof e.code&&["ENOENT","EACCES"].includes(e.code))throw Error("Attachment file error: "+e.message);throw ge(e)}}},at=i.z.object({issueId:i.z.string().min(1)}),ct={name:"jira-attachment-list",inputSchema:at,runTool:async(e,t)=>{try{const r=at.parse(t),s=await e.issues.getAttachments({issueId:r.issueId});return ye(s?.data??s)}catch(e){throw ge(e)}}},lt=i.z.object({issueId:i.z.string().min(1),attachmentId:i.z.string().min(1)}),pt={name:"jira-attachment-delete",inputSchema:lt,runTool:async(e,t)=>{try{const r=lt.parse(t);return await e.issues.deleteAttachment({issueId:r.issueId,attachmentId:r.attachmentId}),ye({success:!0,message:`Attachment ${t.attachmentId} deleted successfully`})}catch(e){throw ge(e)}}},ut=i.z.object({issueId:i.z.string().min(1),timeSpent:i.z.string().min(1),comment:i.z.string().optional(),author:i.z.object({accountId:i.z.string().min(1)}).optional(),startingOn:i.z.string().optional(),artifact:i.z.string().optional()}),dt={name:"jira-worklog-add",inputSchema:ut,runTool:async(e,t)=>{try{const r=ut.parse(t),s={timeSpent:r.timeSpent};r.comment&&(s.comment=r.comment),r.author&&(s.author=r.author),r.startingOn&&(s.started=r.startingOn),r.artifact&&(s.artifact=r.artifact);const n=await e.issues.addWorklog({issueId:r.issueId,...s});return ye(n?.data??n)}catch(e){throw ge(e)}}},mt={[Ie.name]:{title:"Jira Issue Read",description:"Read a Jira issue with expandable fields and properties",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[Se.name]:{title:"Jira Issue List",description:"Search issues by summary, reference, parent, or JQL and list the matching tickets",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[Ye.name]:{title:"Jira Issue Update",description:"Update a Jira issue using fields, update ops, and property toggles",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[ve.name]:{title:"Jira Issue Delete",description:"Delete a Jira issue and optionally remove its subtasks",annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}},[We.name]:{title:"Jira Issue Transition",description:"Transition a Jira issue while optionally adding a comment",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[Ge.name]:{title:"Jira Issue Assign",description:"Assign a Jira issue to a user or account",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[Qe.name]:{title:"Jira Issue Unassign",description:"Unassign the current owner from a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[et.name]:{title:"Jira Comment Add",description:"Add a comment to a Jira issue with optional visibility",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[rt.name]:{title:"Jira Comment List",description:"List comments on a Jira issue with pagination support",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[nt.name]:{title:"Jira Link Create",description:"Create an issue link relationship with optional comment",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[ot.name]:{title:"Jira Attachment Add",description:"Attach a local file to a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}},[ct.name]:{title:"Jira Attachment List",description:"List attachments on a Jira issue",annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},[pt.name]:{title:"Jira Attachment Delete",description:"Delete an attachment from a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}},[dt.name]:{title:"Jira Worklog Add",description:"Log time spent on a Jira issue",annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}}};async function ht(e){const t=r.Logging.for(ht);let s,n=null;try{s=(()=>{let e;try{const t=require("jira.js");e=t?.Version3Client||t.default?.Version3Client||t.default||t}catch(e){throw Error("Unable to require 'jira.js' \u2014 ensure it is installed as a dependency: "+e)}const{host:t,email:r,apiKey:s}=(()=>{const e=de(),t=me().filter(e=>e.required&&!e.value);if(t.length>0)throw new fe(t);return{host:e.host,email:e.email,apiKey:e.apiKey}})();return new e({host:t.startsWith("http://")||t.startsWith("https://")?t:"https://"+t,authentication:{basic:{email:r,apiToken:s}}})})()}catch(e){if(!(e instanceof fe))return void t.warn("Skipping Jira tool registration; unable to create Jira client",{error:e});n=e,t.warn("Registering Jira tools without credentials; each tool will report configuration requirements.",{error:e})}const i=[Ie,Se,Ye,ve,We,Ge,Qe,et,rt,nt,ot,ct,pt,dt];for(const r of i){const i=mt[r.name];if(i)try{await e.registerTool(r.name,{title:i.title,description:i.description,inputSchema:J(r.inputSchema),annotations:i.annotations},async e=>{if(!s)throw n??Error("Jira client unavailable because credentials could not be loaded.");return r.runTool(s,e)}),t.info("Registered Jira tool "+r.name)}catch(e){t.error("Failed to register Jira tool "+r.name,{error:e})}}}async function ft(e){await(async e=>{e.registerTool("decaf-server-info",{title:"Decaf MCP Server Info",description:"Return server metadata, version, and registered prompt names for diagnostics.",inputSchema:{},outputSchema:void 0,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},async()=>{const e=se.map(e=>e.getName()).sort();return{content:[{type:"text",text:["Name: "+ue.name,"Title: "+ue.title,"Version: "+ue.version,"Prompts: "+(e.join(", ")||"<none>")].join("\n")}]}})})(e);const t=r.Logging.for(ft);try{await ht(e)}catch(e){t.error("Failed to register Jira tools",e)}}class gt extends N{setCb(e){return this.cb=e,this}setConfig(e){return this.config=e,this}setUriOtTemplate(e){return this.uriOrTemplate=e,this}constructor(e){super(e)}static get builder(){return new gt}build(e){const t=this.hasErrors();if(t)throw Error(t.toString());try{const t="string"==typeof this.uriOrTemplate&&this.uriOrTemplate.includes("{")?new b.ResourceTemplate(new y.UriTemplate(this.uriOrTemplate),{list:void 0}):this.uriOrTemplate,r=Object.assign(this.config,{_meta:{}}),s=async(e,t)=>{const r=this.logFor(t);r.verbose(`Requesting resource ${this.name} from ${e.toString()}`);const s=await Promise.resolve(this.cb(e,t));return r.verbose(`Resource ${this.name} retrieved successfully.`),r.debug("Resource retrieval meta: "+JSON.stringify(s._meta)),s};return e.resource(this.name,t,r,s)}catch(e){throw r.Logging.for(this).error("Error registering resource "+this.name,e),e}}}s.__decorate([n.required(),s.__metadata("design:type",String)],gt.prototype,"uriOrTemplate",void 0),s.__decorate([n.required(),s.__metadata("design:type",Function)],gt.prototype,"cb",void 0),s.__decorate([n.required(),s.__metadata("design:type",Object)],gt.prototype,"config",void 0);const yt=W()??I.join(__dirname,"..","assets"),bt=I.join(yt,"templates"),vt=I.join(yt,"prompts"),wt=new WeakMap;class jt extends r.LoggedClass{get client(){const e=wt.get(this);if(!e)throw Error("Mcp server requires Mcp client");return e}constructor(){super()}async load(){const e=this.log.for(this.load);for(const t of se)try{e.info("loading prompt "+t.getName());const r=t.build(this.client);e.verbose(`Loaded prompt ${r.title} from ${t.getName()} definition`)}catch(r){e.error("Failed to load prompt "+t.getName(),r)}try{await ft(this.client),e.verbose("Registered built-in tools")}catch(e){}try{await(async(e,t)=>{t.info("Registering agent templates as resources...");const r=x.readdirSync(bt).filter(e=>e.endsWith(".md"));for(const s of r){const r=I.basename(s,".md"),n=I.join(bt,s),i=gt.builder.setName(r).setTitle("Template: "+r).setDescription("Resource template for "+r).setUriOtTemplate("file:///"+n).setConfig({mimeType:"text/markdown",description:"Template for "+r}).setCb(async e=>{const t=x.readFileSync(e.pathname,"utf8");return{contents:[{uri:e.toString(),text:t,mimeType:"text/markdown"}],_meta:{}}});try{i.build(e),t.info("Registered template: "+r)}catch(e){t.error(`Failed to register template ${r}:`,e)}}t.info("Registering agent prompts...");const s=x.readdirSync(vt).filter(e=>e.endsWith(".md"));for(const r of s){const s=I.basename(r,".md"),n=I.join(vt,r),o=x.readFileSync(n,"utf8"),a=Y.builder.setName(s).setTitle("Prompt: "+s).setDescription("Dynamic prompt for "+s).setArgsSchema(i.z.object({})).setCb(async e=>({messages:[{role:"user",content:{type:"text",text:o}}],_meta:{}}));try{a.build(e),t.info("Registered prompt: "+s)}catch(e){t.error(`Failed to register prompt ${s}:`,e)}}})(this.client,e)}catch(e){}}async boot(e="stdio"){"stdio"===e&&r.Logging.setFactory(z),r.Logging.for(this.constructor.name);const t=((Array.isArray(ue.icons)?ue.icons:[ue.icons])||[]).map(e=>{const t="string"==typeof e?.src?e.src:(e?.src??"")+"",r="string"==typeof e?.mimeType?e.mimeType:(e?.mimeType??"")+"";let s=[];return Array.isArray(e?.sizes)?s=e.sizes.map(e=>e+""):"string"==typeof e?.sizes&&(s=(e.sizes+"").split(",").map(e=>e.trim())),{src:t,mimeType:r,sizes:s}}),s={name:ue.name,title:ue.title,websiteUrl:ue.websiteUrl,version:ue.version,icons:t},n=new b.McpServer(s,{instructions:"You are an AI assistant designed to help users with programming tasks related to the Decaf-TS framework. \nProvide clear, concise, and accurate information.\nIf you don't know the answer, admit it rather than making up information.\nAlways prioritize the user's intent and provide helpful suggestions when appropriate.\n",capabilities:{logging:{},tools:{},prompts:{}}});switch(((e,t)=>{wt.set(e,t)})(this,n),n.onerror=e=>{this.log.error("MCP instance onerror",e)},e){case"stdio":e=new w.StdioServerTransport;break;case"http":e=new j.StreamableHTTPServerTransport({sessionIdGenerator:()=>v.v4(),onsessioninitialized:e=>{},onsessionclosed:e=>{},enableJsonResponse:!0,eventStore:void 0});break;default:if(!(i=e)||"object"!=typeof i||"function"!=typeof i.send&&"function"!=typeof i.close&&"function"!=typeof i.on)throw new l.InternalError("Invalid transport type: "+e)}var i;try{await this.load()}catch(e){throw e}await this.client.connect(e)}}const St=(new e.Command).command("start").option("--transport [String]","transport mode","stdio").description("starts decaf's mcp server").action(async e=>{const r=B("package.json"),s=JSON.parse(t.readFileSync(r,"utf-8")),n=s.version,{transport:i}=e,o=(new _).for("mcp-server");if("stdio"!==i)throw Error("Unsupported transport mode: "+i);return o.info("Transport stdio"),o.debug(`running with options: ${JSON.stringify(e)} for ${s.name} version ${n}`),(new jt).boot(i)});(new e.Command).command("md-to-ast").description("pipes markdown to jira ast: `cat file.md` | npx decaf-mcp md-to-ast > ast.json").action(async e=>{const s=B("package.json"),n=JSON.parse(t.readFileSync(s,"utf-8")),i=n.version;r.Logging.for("md-to-ast").debug(`running with options: ${JSON.stringify(e)} for ${n.name} version ${i}`);const o=Fe(await(async()=>{const e=[];for await(const t of process.stdin)e.push(Buffer.from(t));return Buffer.concat(e).toString("utf8")})(),{resolveMention:e=>({id:e,text:"@"+e}),resolveAttachment:e=>({id:e,collection:"attachments"})});process.stdout.write(JSON.stringify(o,null,2)+"\n")});const xt=(new e.Command).name("mcp-server").command("mcp-server").description("decaf mcp server and agentic functionality");xt.addCommand(St),xt.parse(process.argv)},"object"==typeof exports&&"undefined"!=typeof module?t(require("commander"),require("fs"),require("@decaf-ts/logging"),require("tslib"),require("@decaf-ts/decorator-validation"),require("zod"),require("@decaf-ts/injectable-decorators"),require("@decaf-ts/decoration"),require("path"),require("@decaf-ts/db-decorators"),require("crypto"),require("zlib"),require("url"),require("unified"),require("remark-directive"),require("remark-gfm"),require("remark-parse"),require("@modelcontextprotocol/sdk/shared/uriTemplate.js"),require("@modelcontextprotocol/sdk/server/mcp.js"),require("uuid"),require("@modelcontextprotocol/sdk/server/stdio.js"),require("@modelcontextprotocol/sdk/server/streamableHttp.js")):"function"==typeof define&&define.amd?define(["commander","fs","@decaf-ts/logging","tslib","@decaf-ts/decorator-validation","zod","@decaf-ts/injectable-decorators","@decaf-ts/decoration","path","@decaf-ts/db-decorators","crypto","zlib","url","unified","remark-directive","remark-gfm","remark-parse","@modelcontextprotocol/sdk/shared/uriTemplate.js","@modelcontextprotocol/sdk/server/mcp.js","uuid","@modelcontextprotocol/sdk/server/stdio.js","@modelcontextprotocol/sdk/server/streamableHttp.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).commander,e.fs,e.decafTsLogging,e.tslib,e.decafTsDecoratorValidation,e.zod,e.decafTsInjectableDecorators,e.decafTsDecoration,e.path,e.decafTsDbDecorators,e.crypto,e.zlib,e.url,e.unified,e.remarkDirective,e.remarkGfm,e.remarkParse,e.uriTemplate_js,e.mcp_js,e.uuid,e.stdio_js,e.streamableHttp_js);
|
|
3
3
|
//# sourceMappingURL=mcp-server.cjs.map
|