agentsmesh 0.18.0 → 0.19.0

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/cli.js CHANGED
@@ -1,185 +1,201 @@
1
1
  #!/usr/bin/env node
2
- import {resolve,join,sep,dirname,extname,basename,relative,win32,posix,normalize}from'path';import {rm as rm$1,readFile,readdir,stat,mkdir,writeFile,rename,lstat,unlink,chmod,access,realpath,readlink,symlink,mkdtemp,cp as cp$1,copyFile}from'fs/promises';import {realpathSync,rmSync,statSync,existsSync,mkdtempSync,readdirSync,symlinkSync,mkdirSync,constants,readFileSync}from'fs';import {z as z$1}from'zod';import {parse,stringify}from'yaml';import {homedir,tmpdir,hostname}from'os';import {execFile}from'child_process';import {fileURLToPath,pathToFileURL,URL}from'url';import {promisify}from'util';import*as JR from'tar';import {createHash}from'crypto';import {parse as parse$1}from'smol-toml';import {Buffer as Buffer$1}from'buffer';import {createRequire}from'module';import {createTwoFilesPatch}from'diff';import f1 from'chokidar';import*as FG from'readline';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListToolsRequestSchema,CallToolRequestSchema,ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import {toJSONSchema}from'zod/v4/core';var IR=Object.defineProperty;var s=(t,e)=>IR(t,"name",{value:e,configurable:true});var d=(t,e)=>()=>(t&&(e=t(t=0)),e);var gg=(t,e)=>{for(var r in e)IR(t,r,{get:e[r],enumerable:true});};function CR(){di=true;}function ER(){SR=true;}function Pa(t){SR?process.stderr.write(t):process.stdout.write(t);}function n$(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function dl(t,e){return n$()?e:`${t}${e}${xa.reset}`}function s$(t,e){let r=[...t].length;return t+" ".repeat(Math.max(0,e-r))}var xa,di,SR,I,ft=d(()=>{xa={green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",reset:"\x1B[0m"},di=false,SR=false;s(CR,"muteLogger");s(ER,"redirectLoggerToStderr");s(Pa,"out");s(n$,"noColor");s(dl,"c");s(s$,"pad");I={info(t){di||Pa(dl(xa.cyan,t)+`
3
- `);},warn(t){di||process.stderr.write(dl(xa.yellow,"\u26A0 ")+t+`
4
- `);},error(t){di||process.stderr.write(dl(xa.red,"\u2717 ")+t+`
5
- `);},success(t){di||Pa(dl(xa.green,"\u2713 ")+t+`
6
- `);},debug(t){di||process.env.AGENTSMESH_DEBUG==="1"&&Pa(dl(xa.cyan,"[debug] ")+t+`
7
- `);},table(t){if(di||t.length===0)return;let e=t[0].length,r=[];for(let n=0;n<e;n++){let i=0;for(let a=0;a<t.length;a++){let c=[...t[a][n]].length;c>i&&(i=c);}r[n]=i;}let o="+"+r.map(n=>"-".repeat(n+2)).join("+")+"+";Pa(o+`
8
- `);for(let n=0;n<t.length;n++){let a="| "+t[n].map((c,l)=>s$(c,r[l])).join(" | ")+" |";Pa(a+`
9
- `);}Pa(o+`
10
- `);}};});var un,wr,Na,po,Fa,He,dn=d(()=>{un=class extends Error{static{s(this,"AgentsMeshError");}code;constructor(e,r,o){super(r,o),this.name="AgentsMeshError",this.code=e;}},wr=class extends un{static{s(this,"ConfigNotFoundError");}path;constructor(e,r){super("AM_CONFIG_NOT_FOUND",r?.message??`agentsmesh.yaml not found at ${e}. Run 'agentsmesh init' to create one.`,r),this.name="ConfigNotFoundError",this.path=e;}},Na=class extends un{static{s(this,"ConfigValidationError");}issues;constructor(e,r,o){super("AM_CONFIG_INVALID",`Invalid config at ${e}: ${r.join("; ")}. Fix the YAML and try again.`,o),this.name="ConfigValidationError",this.issues=r;}},po=class extends un{static{s(this,"TargetNotFoundError");}target;constructor(e,r){let o=r?.supported?` Supported: ${r.supported.join(", ")}.`:"";super("AM_TARGET_NOT_FOUND",`Unknown target "${e}".${o}`,r),this.name="TargetNotFoundError",this.target=e;}},Fa=class extends un{static{s(this,"LockAcquisitionError");}lockPath;holder;constructor(e,r,o){super("AM_LOCK_ACQUISITION_FAILED",`Could not acquire generate lock at ${e}: currently held by ${r}. Wait for the other process to finish, or remove ${e} manually if you are sure no agentsmesh process is running.`,o),this.name="LockAcquisitionError",this.lockPath=e,this.holder=r;}},He=class extends un{static{s(this,"FileSystemError");}path;errnoCode;constructor(e,r,o){super("AM_FILESYSTEM",r,o),this.name="FileSystemError",this.path=e,this.errnoCode=o?.errnoCode;}};});function xR(t){let e=extname(t).toLowerCase();if(e.length>0)return u$.has(e);let r=basename(t).toLowerCase();return d$.has(r)}function DR(t){return t.replace(/\r\n?/g,`
11
- `)}function hg(t){return g$.has(extname(t).toLowerCase())?493:void 0}var fg,u$,d$,g$,yg=d(()=>{fg="\uFEFF",u$=new Set([".md",".mdc",".mdx",".markdown",".txt",".json",".jsonc",".yaml",".yml",".toml",".ini",".sh",".bash",".zsh",".ps1",".js",".mjs",".cjs",".ts",".tsx",".html",".css"]),d$=new Set([".gitignore",".cursorignore",".cursorindexingignore",".aiignore",".agentignore",".clineignore",".geminiignore",".codeiumignore",".continueignore",".copilotignore",".windsurfignore",".junieignore",".kiroignore",".rooignore",".antigravityignore"]);s(xR,"shouldNormalizeLineEndings");s(DR,"normalizeLineEndings");g$=new Set([".sh",".bash",".zsh"]);s(hg,"executableModeFor");});async function v(t,e){let r;try{r=await realpath(t);}catch(n){let i=n;if(i.code==="ENOENT"||i.code==="ENOTDIR"||i.code==="ELOOP")return [];throw new He(t,`Failed to read directory ${t}: ${i.message}. Check permissions.`,{cause:n,errnoCode:i.code})}let o=e??new Set;if(o.has(r))return [];o.add(r);try{let n=await readdir(t,{withFileTypes:!0}),i=[];for(let a of n){let c=join(t,a.name);a.isDirectory()||a.isSymbolicLink()&&await stat(c).then(m=>m.isDirectory(),()=>!1)?i.push(...await v(c,o)):i.push(c);}return i}catch(n){let i=n;if(i.code==="ENOENT"||i.code==="ENOTDIR"||i.code==="EACCES")return [];throw new He(t,`Failed to read directory ${t}: ${i.message}. Check permissions.`,{cause:n,errnoCode:i.code})}}async function _g(t,e){let r=resolve(t);try{if(!(await lstat(e)).isSymbolicLink()||resolve(dirname(e),await readlink(e))===r)return;await unlink(e);}catch(o){if(o.code!=="ENOENT")throw o}await symlink(r,e,"dir");}var FR=d(()=>{dn();s(v,"readDirRecursive");s(_g,"ensureCacheSymlink");});async function y(t){try{let e=await readFile(t,"utf-8");return e.startsWith(fg)?e.slice(fg.length):e}catch(e){let r=e;if(r.code==="ENOENT")return null;throw new He(t,`Failed to read ${t}: ${r.message}. Ensure the file exists and is readable.`,{cause:e,errnoCode:r.code})}}async function _(t,e,r){let o=dirname(t);await mkdir(o,{recursive:true});try{let c=await lstat(t);if(c.isDirectory())throw new He(t,`Failed to write ${t}: target exists and is a directory. Remove it or choose a different path.`,{errnoCode:"EISDIR"});c.isSymbolicLink()&&await unlink(t).catch(l=>{if(l.code!=="ENOENT")throw l});}catch(c){if(c instanceof He||c.code!=="ENOENT")throw c}let n=`${t}.tmp`,i=xR(t)?DR(e):e,a=r?.mode??hg(t);try{try{(await lstat(n)).isSymbolicLink()&&await unlink(n);}catch(l){if(l.code!=="ENOENT")throw l}let c={encoding:"utf-8",flag:"w"};a!==void 0&&(c.mode=a),await writeFile(n,i,c),await rename(n,t),a!==void 0&&await chmod(t,a);}catch(c){await rm$1(n,{force:true}).catch(()=>{});let l=c;throw new He(t,`Failed to write ${t}: ${l.message}. Check permissions and disk space.`,{cause:c,errnoCode:l.code})}}async function j(t){try{return await access(t,constants.F_OK),!0}catch{return false}}async function L(t){await mkdir(t,{recursive:true});}var T=d(()=>{dn();yg();FR();yg();s(y,"readFileSafe");s(_,"writeFileAtomic");s(j,"exists");s(L,"mkdirp");});function Tr(t){return Ig.includes(t)}var Ig,$R=d(()=>{Ig=["aider","amazon-q","amp","antigravity","augment-code","claude-code","cline","codex-cli","continue","copilot","crush","cursor","deepagents-cli","factory-droid","gemini-cli","goose","jules","junie","kilo-code","kiro","opencode","pi-agent","qwen-code","replit-agent","roo-code","rovodev","trae","warp","windsurf","zed"];s(Tr,"isBuiltinTargetId");});var kt,Rg,uo=d(()=>{$R();kt=Ig,Rg="codex-cli";});var jR,ze,va,hl,x$,D$,fl,N$,F$,gi,gn=d(()=>{uo();jR=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],ze=z$1.enum(kt),va=z$1.enum(jR),hl=z$1.object({skills:z$1.array(z$1.string()).optional(),commands:z$1.array(z$1.string()).optional(),rules:z$1.array(z$1.string()).optional(),agents:z$1.array(z$1.string()).optional()}).strict(),x$=z$1.object({name:z$1.string(),source:z$1.string(),version:z$1.string().optional(),target:ze.optional(),features:z$1.array(va),path:z$1.string().optional(),pick:hl.optional()}),D$=z$1.object({strategy:z$1.enum(["merge","lock","last-wins"]).default("merge"),lock_features:z$1.array(z$1.string()).default([])}),fl=z$1.union([z$1.boolean(),z$1.object({project:z$1.boolean().optional(),global:z$1.boolean().optional()}).strict()]),N$=z$1.object({commands_to_skills:z$1.object({"codex-cli":fl.optional()}).passthrough().optional(),agents_to_skills:z$1.object({"gemini-cli":fl.optional(),cline:fl.optional(),"codex-cli":fl.optional(),windsurf:fl.optional()}).passthrough().optional()}).strict().optional(),F$=z$1.object({id:z$1.string().regex(/^[a-z][a-z0-9-]*$/),source:z$1.string(),version:z$1.string().optional(),strict:z$1.boolean().optional()}).strict(),gi=z$1.object({version:z$1.literal(1),targets:z$1.array(ze).default([...kt]),features:z$1.array(va).default([...jR]),extends:z$1.array(x$).default([]),overrides:z$1.record(z$1.string(),z$1.record(z$1.string(),z$1.unknown())).default({}),collaboration:D$.default({strategy:"merge",lock_features:[]}),conversions:N$,plugins:z$1.array(F$).default([]),pluginTargets:z$1.array(z$1.string().regex(/^[a-z][a-z0-9-]*$/)).default([])});});async function M$(t){let e=resolve(t);for(;;){let r=join(e,Cg);if(await j(r))return r;let o=dirname(e);if(o===e)return null;e=o;}}async function $$(t){let e=await y(t);if(e===null)throw new wr(t);let r=parse(e),o=gi.safeParse(r);if(!o.success){let n=o.error.issues.map(i=>i.message);throw new Na(t,n,{cause:o.error})}return o.data}function Sg(t,e){let r={...t};for(let[o,n]of Object.entries(e)){if(n==null)continue;let i=r[o];typeof n=="object"&&!Array.isArray(n)&&n!==null&&typeof i=="object"&&i!==null&&!Array.isArray(i)?r[o]=Sg(i,n):r[o]=n;}return r}function j$(t,e){let r={...t};return Array.isArray(e.targets)&&e.targets.length>0&&(r.targets=e.targets),Array.isArray(e.features)&&e.features.length>0&&(r.features=e.features),typeof e.overrides=="object"&&e.overrides!==null&&!Array.isArray(e.overrides)&&(r.overrides=Sg(r.overrides??{},e.overrides)),typeof e.conversions=="object"&&e.conversions!==null&&!Array.isArray(e.conversions)&&(r.conversions=Sg(r.conversions??{},e.conversions)),Array.isArray(e.extends)&&e.extends.length>0&&(r.extends=[...t.extends??[],...e.extends]),r}async function tp(t){let e=join(t,Cg),r=await $$(e),o=join(t,G$),n=await y(o);if(n!==null){let i=parse(n);if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let a=j$(r,i),c=gi.safeParse(a);if(c.success)r=c.data;else {let l=c.error.issues.map(m=>m.message).join("; ");I.warn(`Ignoring invalid agentsmesh.local.yaml at ${o}: ${l}. Using project config instead.`);}}}return {config:r,configDir:t}}async function ep(t){let e=await M$(t);if(e===null)throw new wr(join(t,Cg));return tp(dirname(e))}var Cg,G$,rp=d(()=>{T();ft();dn();gn();Cg="agentsmesh.yaml",G$="agentsmesh.local.yaml";s(M$,"findConfigPath");s($$,"loadConfig");s(Sg,"deepMergeObjects");s(j$,"mergeLocalConfig");s(tp,"loadConfigFromExactDir");s(ep,"loadConfigFromDir");});function yl(t,e="project"){if(e==="project")return {scope:e,rootBase:t,configDir:t,canonicalDir:join(t,".agentsmesh")};let r=homedir(),o=join(r,".agentsmesh");return {scope:e,rootBase:r,configDir:o,canonicalDir:o}}async function Tt(t,e="project"){if(e==="project"){let{config:o,configDir:n}=await ep(t);return {config:o,context:{scope:e,rootBase:n,configDir:n,canonicalDir:join(n,".agentsmesh")}}}let r=yl(t,e);try{let{config:o}=await tp(r.configDir);return {config:o,context:r}}catch(o){throw o instanceof wr?new wr(o.path,{cause:o,message:`agentsmesh.yaml not found at ${o.path} (global scope). Run 'agentsmesh init --global' to create it under ~/.agentsmesh, or drop the --global flag to operate on the current project.`}):o}}var Oe=d(()=>{rp();dn();s(yl,"resolveScopeContext");s(Tt,"loadScopedConfig");});function HR(t,e){if(t.startsWith("-"))throw new Error(`agentsmesh refuses ${e} starting with "-" (option-injection guard): ${t}`)}async function op(t,e,r,o,n){let i="cloneUrl"in t?"gitlab":"git",a="cloneUrl"in t?`${t.namespace}/${t.project}`:t.url,c=t.ref??"HEAD",l=n(i,a,c),m=join(o,l),p=join(m,BR),u=`${m}.tmp`,g=join(u,BR);if(!r.refresh&&await WR(p))return Ag(p);try{return await rm$1(u,{recursive:!0,force:!0}),await mkdir(u,{recursive:!0}),await Y$(J$(t),g),t.ref&&await X$(g,t.ref),await rm$1(m,{recursive:!0,force:!0}),await rename(u,m),Ag(p)}catch(f){if(await rm$1(u,{recursive:true,force:true}),r.allowOfflineFallback!==false&&await WR(p))return console.warn(`[agentsmesh] Remote fetch failed for ${e}; using cached version. Error: ${f instanceof Error?f.message:String(f)}`),Ag(p);throw f}}async function Ag(t){return {resolvedPath:t,version:await Z$(t)}}async function WR(t){return j(t)}function J$(t){if("cloneUrl"in t){let e=process.env.AGENTSMESH_GITLAB_TOKEN;if(e){let r=new URL(t.cloneUrl);if(r.protocol==="https:")return r.username="oauth2",r.password=e,r.toString()}return t.cloneUrl}return t.url}async function Y$(t,e){HR(t,"clone-url"),await kg(["clone",t,e]);}async function X$(t,e){HR(e,"ref"),await kg(["checkout",e],t);}async function Z$(t){return kg(["rev-parse","HEAD"],t)}async function kg(t,e){let{stdout:r}=await V$("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return r.trim()}var V$,BR,wg=d(()=>{T();V$=promisify(execFile),BR="repo";s(HR,"ensureNotFlag");s(op,"fetchGitRemoteExtend");s(Ag,"readCachedRepo");s(WR,"hasCachedRepo");s(J$,"resolveCloneUrl");s(Y$,"cloneRepo");s(X$,"checkoutRef");s(Z$,"getHeadSha");s(kg,"runGit");});async function rj(t,e){let r=typeof t.headers?.get=="function"?t.headers.get("content-length"):null;if(r!==null){let m=Number(r);if(Number.isFinite(m)&&m>e)throw new Error(`remote response declared ${m} bytes; exceeds cap of ${e}`)}let o=t.body;if(!o){let m=await t.arrayBuffer();if(m.byteLength>e)throw new Error(`remote response is ${m.byteLength} bytes; exceeds cap of ${e}`);return new Uint8Array(m)}let n=o.getReader(),i=[],a=0;for(;;){let{done:m,value:p}=await n.read();if(m)break;if(p){if(a+=p.byteLength,a>e)throw await n.cancel().catch(()=>{}),new Error(`remote response exceeded cap of ${e} bytes during streaming`);i.push(p);}}let c=new Uint8Array(a),l=0;for(let m of i)c.set(m,l),l+=m.byteLength;return c}async function YR(t,e,r){let o=`https://api.github.com/repos/${t}/${e}/releases/latest`,n={Accept:"application/vnd.github+json"};r&&(n.Authorization=`Bearer ${r}`);let i=await globalThis.fetch(o,{headers:n});if(!i.ok)throw new Error(`Failed to resolve latest release for ${t}/${e}: ${i.status} ${i.statusText}`);let a=await i.json();if(!a.tag_name||typeof a.tag_name!="string")throw new Error(`No tag_name in releases/latest response for ${t}/${e}`);return a.tag_name}async function XR(t,e,r,o,n,i=false){let a=r.token??process.env.AGENTSMESH_GITHUB_TOKEN,c=r.refresh===true,l=t.tag;if(l==="latest")try{l=await YR(t.org,t.repo,a);}catch(S){if(!i)throw S;return nj(t,e,r,o,n,a)}let m=n("github",`${t.org}/${t.repo}`,l),p=join(o,m);if(!c&&await j(p)){let S=await Tg(p);if(S)return {resolvedPath:join(p,S),version:l}}let u=`https://github.com/${t.org}/${t.repo}/tarball/${l}`,g={};a&&(g.Authorization=`Bearer ${a}`);let f;try{let S=await globalThis.fetch(u,{headers:g,redirect:"follow"});if(!S.ok)throw new Error(`HTTP ${S.status}: ${S.statusText}`);f=await rj(S,ej);}catch(S){if(r.allowOfflineFallback!==false&&await j(p)){let D=await Tg(p);if(D)return console.warn(`[agentsmesh] Network failed for ${e}; using cached version. Error: ${S instanceof Error?S.message:String(S)}`),{resolvedPath:join(p,D),version:l}}throw S}await rm$1(p,{recursive:true,force:true}),await mkdir(p,{recursive:true});let h=join(p,"archive.tar.gz");await writeFile(h,f);try{await JR.extract({file:h,cwd:p,strict:!0,filter:s((S,A)=>!(oj(S)||A&&"type"in A&&(A.type==="Link"||A.type==="SymbolicLink")),"filter")});}finally{await rm$1(h,{force:true}).catch(()=>{});}let O=await Tg(p);if(!O)throw new Error(`Extend "${e}": archive has no top-level directory. Expected a single top-level directory inside the archive.`);return {resolvedPath:join(p,O),version:l}}async function Tg(t){let r=(await readdir(t,{withFileTypes:true})).filter(o=>o.isDirectory()&&!o.name.startsWith("."));return r.length===1?r[0].name:null}function VR(t,e,r){return r?`https://x-access-token:${encodeURIComponent(r)}@github.com/${t}/${e}.git`:`https://github.com/${t}/${e}.git`}function oj(t){let e=t.replace(/\\/g,"/");return e.startsWith("/")||e.split("/").includes("..")}async function nj(t,e,r,o,n,i){let a=i?[VR(t.org,t.repo,i)]:[VR(t.org,t.repo),`ssh://git@github.com/${t.org}/${t.repo}.git`],c;for(let l of a){let m={url:l};try{return await op(m,e,r,o,n)}catch(p){c=p;}}throw c instanceof Error?c:new Error("Failed to clone GitHub default branch")}var ej,ZR=d(()=>{T();wg();ej=500*1024*1024;s(rj,"readBoundedResponse");s(YR,"resolveLatestTag");s(XR,"fetchGithubRemoteExtend");s(Tg,"findExtractTopDir");s(VR,"buildGithubCloneUrl");s(oj,"isZipSlipPath");s(nj,"fetchGithubDefaultBranch");});function QR(t,e,r){if(!t.startsWith(e))return null;let o=t.slice(e.length).trim();if(!o)return null;let n=o.lastIndexOf("@");if(n<0)return [o,r];let i=o.slice(0,n).trim(),a=o.slice(n+1).trim();return !i||!a?null:[i,a]}function qR(t){let e=QR(t,"github:","latest");if(!e)return null;let[r,o]=e,n=r.indexOf("/");if(n<0)return null;let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();return !i||!a||!o?null:{org:i,repo:a,tag:o}}function tS(t){let e=QR(t,"gitlab:");if(!e)return null;let[r,o]=e,n=r.lastIndexOf("/");if(n<0)return null;let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();return !i||!a?null:{namespace:i,project:a,ref:o,cloneUrl:`https://gitlab.com/${i}/${a}.git`}}function eS(t){if(!t.startsWith("git+"))return null;let e=t.slice(4).trim();if(!e)return null;let r=e.lastIndexOf("#"),o=(r<0?e:e.slice(0,r)).trim(),n=r<0?void 0:e.slice(r+1).trim();if(!o||r>=0&&!n)return null;let i;try{i=new URL(o);}catch{return null}return ["https:","http:","ssh:","file:"].includes(i.protocol)?{url:o,ref:n}:null}function fi(t){let e=qR(t);if(e)return {kind:"github",...e};let r=tS(t);if(r)return {kind:"gitlab",...r};let o=eS(t);return o?{kind:"git",...o}:null}function bg(t){return fi(t)!==null}var Il=d(()=>{s(QR,"splitSourceRef");s(qR,"parseGithubSource");s(tS,"parseGitlabSource");s(eS,"parseGitSource");s(fi,"parseRemoteSource");s(bg,"isSupportedRemoteSource");});function cj(t){let e=fi(t);return e?e.kind==="github"?Ga("github",`${e.org}/${e.repo}`,e.tag):e.kind==="gitlab"?Ga("gitlab",`${e.namespace}/${e.project}`,e.ref??"HEAD"):Ga("git",e.url,e.ref??"HEAD"):null}async function nS(t,e){let r=cj(t);if(!r)return;let o=e??Le(),n=join(o,r);await rm$1(n,{recursive:true,force:true});}async function sS(t,e){let r=t??Le(),o=e??Number(process.env.AGENTSMESH_CACHE_MAX_AGE_DAYS??30)*864e5,n;try{n=await readdir(r);}catch{return}let i=Date.now();await Promise.all(n.map(async a=>{let c=join(r,a);try{let{mtimeMs:l}=await stat(c);i-l>o&&await rm$1(c,{recursive:!0,force:!0});}catch{}}));}var Pg=d(()=>{Rl();Il();s(cj,"cacheKeyFromSource");s(nS,"cleanInstallCache");s(sS,"sweepStaleCache");});function Ga(t,e,r){let o=s(i=>i.replace(/[^a-zA-Z0-9_.-]/g,"_").replace(/^\.+/,"_"),"safe"),n;if(t==="github"){let[i,a]=e.split("/",2);i&&a?n=`${o(i)}--${o(a)}--${o(r)}`:n=`${o(t)}__${o(e)}__${o(r)}`;}else n=`${o(t)}__${o(e)}__${o(r)}`;if(n.length>cS){let i=createHash("sha256").update(n).digest("hex").slice(0,16);n=`${n.slice(0,cS-18)}--${i}`;}return n}function Le(){let t=process.env.AGENTSMESH_CACHE;if(t){let e=t.trim();if(!e)return join(homedir(),".agentsmesh","cache");if(!/^([A-Za-z]:[\\/]|\/)/.test(e))throw new Error(`AGENTSMESH_CACHE must be an absolute path (got: "${e}").`);if(e==="/"||/^[A-Za-z]:[\\/]?$/.test(e))throw new Error(`AGENTSMESH_CACHE must not be the filesystem root (got: "${e}").`);return e}return join(homedir(),".agentsmesh","cache")}async function Ma(t,e,r={}){let o=fi(t);if(!o)throw t.startsWith("github:")?new Error(`Invalid github: source: "${t}" for extend "${e}"`):t.startsWith("gitlab:")?new Error(`Invalid gitlab: source: "${t}" for extend "${e}"`):t.startsWith("git+")?new Error(`Invalid git+ source: "${t}" for extend "${e}"`):new Error(`Invalid remote source: "${t}" for extend "${e}". Use github:org/repo@tag, gitlab:group/project@ref, or git+https://host/org/repo.git#ref.`);let n=r.cacheDir??Le();return sS(n).catch(()=>{}),o.kind==="github"?XR(o,e,r,n,Ga,!t.includes("@")):op(o,e,r,n,Ga)}var cS,Rl=d(()=>{wg();ZR();Il();Pg();cS=80;s(Ga,"buildCacheKey");s(Le,"getCacheDir");s(Ma,"fetchRemoteExtend");});function dj(t){return t.startsWith("http://")||t.startsWith("https://")}async function $a(t,e,r={}){if(t.extends.length===0)return [];if(r.refreshCache===true&&t.extends.some(n=>bg(n.source))){let n=Le();await rm$1(n,{recursive:true,force:true}),await mkdir(n,{recursive:true});}let o=[];for(let n of t.extends){if(dj(n.source))throw new Error(`Remote extends (http/https) not supported: "${n.source}" for extend "${n.name}". Use github:org/repo@tag, gitlab:group/project@ref, git+https://host/org/repo.git#ref, or a local path (e.g. ./shared/).`);if(bg(n.source)){let a=await Ma(n.source,n.name,{cacheDir:Le(),refresh:r.refreshCache===true});o.push({name:n.name,resolvedPath:a.resolvedPath,features:[...n.features],target:n.target,version:a.version,path:n.path,pick:n.pick});continue}let i=resolve(e,n.source);if(!await j(i))throw new Error(`Extend "${n.name}": path does not exist: ${i}. Check extends.source in agentsmesh.yaml.`);o.push({name:n.name,resolvedPath:i,features:[...n.features],target:n.target,path:n.path,pick:n.pick});}return o}var np=d(()=>{T();Rl();Il();s(dj,"isOtherRemoteSource");s($a,"resolveExtendPaths");});function k(t){if(t.indexOf("---")!==0)return {frontmatter:{},body:t.trim()};let r=t.indexOf("---",3);if(r===-1)return {frontmatter:{},body:t.trim()};let o=t.slice(3,r).trim(),n=t.slice(r+3).trim();return {frontmatter:o===""?{}:parse(o)??{},body:n}}function P(t,e){return Object.keys(t).length===0?e:`---
2
+ import {resolve,join,sep,dirname,extname,basename,relative,win32,posix,normalize,isAbsolute}from'path';import {rm,readFile,readdir,stat,mkdir,writeFile,rename,lstat,unlink,chmod,access,realpath,mkdtemp,cp as cp$1,readlink,symlink,copyFile}from'fs/promises';import {realpathSync,rmSync,statSync,existsSync,mkdtempSync,readdirSync,symlinkSync,mkdirSync,constants,readFileSync}from'fs';import {z}from'zod';import {parse,stringify}from'yaml';import {homedir,tmpdir,hostname}from'os';import {execFile}from'child_process';import {fileURLToPath,URL,pathToFileURL}from'url';import {promisify}from'util';import*as zS from'tar';import {createHash}from'crypto';import {parse as parse$1}from'smol-toml';import {Buffer as Buffer$1}from'buffer';import {createRequire}from'module';import {createTwoFilesPatch}from'diff';import fZ from'chokidar';import*as XG from'readline';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListToolsRequestSchema,CallToolRequestSchema,ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import {toJSONSchema}from'zod/v4/core';var yS=Object.defineProperty;var s=(t,e)=>yS(t,"name",{value:e,configurable:true});var d=(t,e)=>()=>(t&&(e=t(t=0)),e);var og=(t,e)=>{for(var r in e)yS(t,r,{get:e[r],enumerable:true});};function IS(){Si=true;}function SS(){RS=true;}function Ka(t){RS?process.stderr.write(t):process.stdout.write(t);}function d0(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function Fc(t,e){return d0()?e:`${t}${e}${Wa.reset}`}function f0(t,e){let r=[...t].length;return t+" ".repeat(Math.max(0,e-r))}var Wa,Si,RS,y,ot=d(()=>{Wa={green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",reset:"\x1B[0m"},Si=false,RS=false;s(IS,"muteLogger");s(SS,"redirectLoggerToStderr");s(Ka,"out");s(d0,"noColor");s(Fc,"c");s(f0,"pad");y={info(t){Si||Ka(Fc(Wa.cyan,t)+`
3
+ `);},warn(t){Si||process.stderr.write(Fc(Wa.yellow,"\u26A0 ")+t+`
4
+ `);},error(t){Si||process.stderr.write(Fc(Wa.red,"\u2717 ")+t+`
5
+ `);},success(t){Si||Ka(Fc(Wa.green,"\u2713 ")+t+`
6
+ `);},debug(t){Si||process.env.AGENTSMESH_DEBUG==="1"&&Ka(Fc(Wa.cyan,"[debug] ")+t+`
7
+ `);},table(t){if(Si||t.length===0)return;let e=t[0].length,r=[];for(let o=0;o<e;o++){let i=0;for(let a=0;a<t.length;a++){let l=[...t[a][o]].length;l>i&&(i=l);}r[o]=i;}let n="+"+r.map(o=>"-".repeat(o+2)).join("+")+"+";Ka(n+`
8
+ `);for(let o=0;o<t.length;o++){let a="| "+t[o].map((l,c)=>f0(l,r[c])).join(" | ")+" |";Ka(a+`
9
+ `);}Ka(n+`
10
+ `);}};});var yo,Nr,za,_n,Va,be,_o=d(()=>{yo=class extends Error{static{s(this,"AgentsMeshError");}code;constructor(e,r,n){super(r,n),this.name="AgentsMeshError",this.code=e;}},Nr=class extends yo{static{s(this,"ConfigNotFoundError");}path;constructor(e,r){super("AM_CONFIG_NOT_FOUND",r?.message??`agentsmesh.yaml not found at ${e}. Run 'agentsmesh init' to create one.`,r),this.name="ConfigNotFoundError",this.path=e;}},za=class extends yo{static{s(this,"ConfigValidationError");}issues;constructor(e,r,n){super("AM_CONFIG_INVALID",`Invalid config at ${e}: ${r.join("; ")}. Fix the YAML and try again.`,n),this.name="ConfigValidationError",this.issues=r;}},_n=class extends yo{static{s(this,"TargetNotFoundError");}target;constructor(e,r){let n=r?.supported?` Supported: ${r.supported.join(", ")}.`:"";super("AM_TARGET_NOT_FOUND",`Unknown target "${e}".${n}`,r),this.name="TargetNotFoundError",this.target=e;}},Va=class extends yo{static{s(this,"LockAcquisitionError");}lockPath;holder;constructor(e,r,n){super("AM_LOCK_ACQUISITION_FAILED",`Could not acquire generate lock at ${e}: currently held by ${r}. Wait for the other process to finish, or remove ${e} manually if you are sure no agentsmesh process is running.`,n),this.name="LockAcquisitionError",this.lockPath=e,this.holder=r;}},be=class extends yo{static{s(this,"FileSystemError");}path;errnoCode;constructor(e,r,n){super("AM_FILESYSTEM",r,n),this.name="FileSystemError",this.path=e,this.errnoCode=n?.errnoCode;}};});function Ap(t){let e=extname(t).toLowerCase();if(e.length>0)return S0.has(e);let r=basename(t).toLowerCase();return C0.has(r)}function wp(t){return t.replace(/\r\n?/g,`
11
+ `)}function lg(t){return k0.has(extname(t).toLowerCase())?493:void 0}var Ja,S0,C0,k0,bp=d(()=>{Ja="\uFEFF",S0=new Set([".md",".mdc",".mdx",".markdown",".txt",".json",".jsonc",".yaml",".yml",".toml",".ini",".sh",".bash",".zsh",".ps1",".js",".mjs",".cjs",".ts",".tsx",".html",".css"]),C0=new Set([".gitignore",".cursorignore",".cursorindexingignore",".aiignore",".agentignore",".clineignore",".geminiignore",".codeiumignore",".continueignore",".copilotignore",".windsurfignore",".junieignore",".kiroignore",".rooignore",".antigravityignore"]);s(Ap,"shouldNormalizeLineEndings");s(wp,"normalizeLineEndings");k0=new Set([".sh",".bash",".zsh"]);s(lg,"executableModeFor");});function PS(t){if(t.length>T0)return true;let e=new Map;for(let r of t){let n=(e.get(r)??0)+1;if(n>=x0)return true;e.set(r,n);}return false}async function v(t,e,r){let n=r??[basename(t)],o;try{o=await realpath(t);}catch(a){let l=a;if(l.code==="ENOENT"||l.code==="ENOTDIR"||l.code==="ELOOP")return [];throw new be(t,`Failed to read directory ${t}: ${l.message}. Check permissions.`,{cause:a,errnoCode:l.code})}let i=e??new Set;if(i.has(o))return [];i.add(o);try{let a=await readdir(t,{withFileTypes:!0}),l=[];for(let c of a){let m=join(t,c.name);if(c.isDirectory()||c.isSymbolicLink()&&await stat(m).then(u=>u.isDirectory(),()=>!1)){let u=[...n,c.name];if(PS(u))continue;l.push(...await v(m,i,u));}else l.push(m);}return l}catch(a){let l=a;if(l.code==="ENOENT"||l.code==="ENOTDIR"||l.code==="EACCES")return [];throw new be(t,`Failed to read directory ${t}: ${l.message}. Check permissions.`,{cause:a,errnoCode:l.code})}}async function Ya(t,e){let r=e??[basename(t)];try{let n=await readdir(t,{withFileTypes:!0}),o=[];for(let i of n){if(i.isSymbolicLink())continue;let a=join(t,i.name);if(i.isDirectory()){let l=[...r,i.name];if(PS(l))continue;o.push(...await Ya(a,l));}else i.isFile()&&o.push(a);}return o}catch(n){let o=n;if(o.code==="ENOENT"||o.code==="ENOTDIR"||o.code==="EACCES")return [];throw new be(t,`Failed to read directory ${t}: ${o.message}. Check permissions.`,{cause:n,errnoCode:o.code})}}async function cg(t,e){let r=resolve(t);try{if(!(await lstat(e)).isSymbolicLink()||resolve(dirname(e),await readlink(e))===r)return;await unlink(e);}catch(n){if(n.code!=="ENOENT")throw n}await symlink(r,e,"dir");}var T0,x0,TS=d(()=>{_o();T0=32,x0=3;s(PS,"shouldSkipRecursiveBranch");s(v,"readDirRecursive");s(Ya,"readDirRecursiveNoSymlinks");s(cg,"ensureCacheSymlink");});async function _(t){try{let e=await readFile(t,"utf-8");return e.startsWith(Ja)?e.slice(Ja.length):e}catch(e){let r=e;if(r.code==="ENOENT")return null;throw new be(t,`Failed to read ${t}: ${r.message}. Ensure the file exists and is readable.`,{cause:e,errnoCode:r.code})}}async function I(t,e,r){let n=dirname(t);await mkdir(n,{recursive:true});try{let l=await lstat(t);if(l.isDirectory())throw new be(t,`Failed to write ${t}: target exists and is a directory. Remove it or choose a different path.`,{errnoCode:"EISDIR"});l.isSymbolicLink()&&await unlink(t).catch(c=>{if(c.code!=="ENOENT")throw c});}catch(l){if(l instanceof be||l.code!=="ENOENT")throw l}let o=`${t}.tmp`,i=Ap(t)?wp(e):e,a=r?.mode??lg(t);try{try{(await lstat(o)).isSymbolicLink()&&await unlink(o);}catch(c){if(c.code!=="ENOENT")throw c}let l={encoding:"utf-8",flag:"w"};a!==void 0&&(l.mode=a),await writeFile(o,i,l),await rename(o,t),a!==void 0&&await chmod(t,a);}catch(l){await rm(o,{force:true}).catch(()=>{});let c=l;throw new be(t,`Failed to write ${t}: ${c.message}. Check permissions and disk space.`,{cause:l,errnoCode:c.code})}}async function $(t){try{return await access(t,constants.F_OK),!0}catch{return false}}async function O(t){await mkdir(t,{recursive:true});}var w=d(()=>{_o();bp();TS();bp();s(_,"readFileSafe");s(I,"writeFileAtomic");s($,"exists");s(O,"mkdirp");});function Pe(t){return mg.includes(t)}var mg,FS=d(()=>{mg=["aider","amazon-q","amp","antigravity","augment-code","claude-code","cline","codex-cli","continue","copilot","crush","cursor","deepagents-cli","factory-droid","gemini-cli","goose","jules","junie","kilo-code","kiro","opencode","pi-agent","qwen-code","replit-agent","roo-code","rovodev","trae","warp","windsurf","zed"];s(Pe,"isBuiltinTargetId");});var Ft,pg,Rn=d(()=>{FS();Ft=mg,pg="codex-cli";});var vS,Qe,Xa,U0,Mc,B0,K0,vc,W0,H0,ki,Ro=d(()=>{Rn();vS=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],Qe=z.enum(Ft),Xa=z.enum(vS),U0=z.enum(["rules","commands","agents","skills"]),Mc=z.object({skills:z.array(z.string()).optional(),commands:z.array(z.string()).optional(),rules:z.array(z.string()).optional(),agents:z.array(z.string()).optional()}).strict(),B0=z.object({name:z.string(),source:z.string(),version:z.string().optional(),target:Qe.optional(),as:U0.optional(),features:z.array(Xa),path:z.string().optional(),pick:Mc.optional()}),K0=z.object({strategy:z.enum(["merge","lock","last-wins"]).default("merge"),lock_features:z.array(z.string()).default([])}),vc=z.union([z.boolean(),z.object({project:z.boolean().optional(),global:z.boolean().optional()}).strict()]),W0=z.object({commands_to_skills:z.object({"codex-cli":vc.optional()}).passthrough().optional(),agents_to_skills:z.object({"gemini-cli":vc.optional(),cline:vc.optional(),"codex-cli":vc.optional(),windsurf:vc.optional()}).passthrough().optional()}).strict().optional(),H0=z.object({id:z.string().regex(/^[a-z][a-z0-9-]*$/),source:z.string(),version:z.string().optional(),strict:z.boolean().optional()}).strict(),ki=z.object({version:z.literal(1),targets:z.array(Qe).default([...Ft]),features:z.array(Xa).default([...vS]),extends:z.array(B0).default([]),overrides:z.record(z.string(),z.record(z.string(),z.unknown())).default({}),collaboration:K0.default({strategy:"merge",lock_features:[]}),conversions:W0,plugins:z.array(H0).default([]),pluginTargets:z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)).default([])});});async function J0(t){let e=resolve(t);for(;;){let r=join(e,dg);if(await $(r))return r;let n=dirname(e);if(n===e)return null;e=n;}}async function Y0(t){let e=await _(t);if(e===null)throw new Nr(t);let r=parse(e),n=ki.safeParse(r);if(!n.success){let o=n.error.issues.map(i=>i.message);throw new za(t,o,{cause:n.error})}return n.data}function ug(t,e){let r={...t};for(let[n,o]of Object.entries(e)){if(o==null)continue;let i=r[n];typeof o=="object"&&!Array.isArray(o)&&o!==null&&typeof i=="object"&&i!==null&&!Array.isArray(i)?r[n]=ug(i,o):r[n]=o;}return r}function X0(t,e){let r={...t};return Array.isArray(e.targets)&&e.targets.length>0&&(r.targets=e.targets),Array.isArray(e.features)&&e.features.length>0&&(r.features=e.features),typeof e.overrides=="object"&&e.overrides!==null&&!Array.isArray(e.overrides)&&(r.overrides=ug(r.overrides??{},e.overrides)),typeof e.conversions=="object"&&e.conversions!==null&&!Array.isArray(e.conversions)&&(r.conversions=ug(r.conversions??{},e.conversions)),Array.isArray(e.extends)&&e.extends.length>0&&(r.extends=[...t.extends??[],...e.extends]),r}async function Tp(t){let e=join(t,dg),r=await Y0(e),n=join(t,V0),o=await _(n);if(o!==null){let i=parse(o);if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let a=X0(r,i),l=ki.safeParse(a);if(l.success)r=l.data;else {let c=l.error.issues.map(m=>m.message).join("; ");y.warn(`Ignoring invalid agentsmesh.local.yaml at ${n}: ${c}. Using project config instead.`);}}}return {config:r,configDir:t}}async function xp(t){let e=await J0(t);if(e===null)throw new Nr(join(t,dg));return Tp(dirname(e))}var dg,V0,Dp=d(()=>{w();ot();_o();Ro();dg="agentsmesh.yaml",V0="agentsmesh.local.yaml";s(J0,"findConfigPath");s(Y0,"loadConfig");s(ug,"deepMergeObjects");s(X0,"mergeLocalConfig");s(Tp,"loadConfigFromExactDir");s(xp,"loadConfigFromDir");});function Ei(t,e="project"){if(e==="project")return {scope:e,rootBase:t,configDir:t,canonicalDir:join(t,".agentsmesh")};let r=homedir(),n=join(r,".agentsmesh");return {scope:e,rootBase:r,configDir:n,canonicalDir:n}}async function yt(t,e="project"){if(e==="project"){let{config:n,configDir:o}=await xp(t);return {config:n,context:{scope:e,rootBase:o,configDir:o,canonicalDir:join(o,".agentsmesh")}}}let r=Ei(t,e);try{let{config:n}=await Tp(r.configDir);return {config:n,context:r}}catch(n){throw n instanceof Nr?new Nr(n.path,{cause:n,message:`agentsmesh.yaml not found at ${n.path} (global scope). Run 'agentsmesh init --global' to create it under ~/.agentsmesh, or drop the --global flag to operate on the current project.`}):n}}var Yt=d(()=>{Dp();_o();s(Ei,"resolveScopeContext");s(yt,"loadScopedConfig");});function US(t,e){if(t.startsWith("-"))throw new Error(`agentsmesh refuses ${e} starting with "-" (option-injection guard): ${t}`)}async function Np(t,e,r,n,o){let i="cloneUrl"in t?"gitlab":"git",a="cloneUrl"in t?`${t.namespace}/${t.project}`:t.url,l=t.ref??"HEAD",c=o(i,a,l),m=join(n,c),p=join(m,GS),u=`${m}.tmp`,f=join(u,GS);if(!r.refresh&&await jS(p))return yg(p);try{return await rm(u,{recursive:!0,force:!0}),await mkdir(u,{recursive:!0}),await sB(oB(t),f),t.ref&&await iB(f,t.ref),await rm(m,{recursive:!0,force:!0}),await rename(u,m),yg(p)}catch(g){if(await rm(u,{recursive:true,force:true}),r.allowOfflineFallback!==false&&await jS(p))return console.warn(`[agentsmesh] Remote fetch failed for ${e}; using cached version. Error: ${g instanceof Error?g.message:String(g)}`),yg(p);throw g}}async function yg(t){return {resolvedPath:t,version:await aB(t)}}async function jS(t){return $(t)}function oB(t){if("cloneUrl"in t){let e=process.env.AGENTSMESH_GITLAB_TOKEN;if(e){let r=new URL(t.cloneUrl);if(r.protocol==="https:")return r.username="oauth2",r.password=e,r.toString()}return t.cloneUrl}return t.url}async function sB(t,e){US(t,"clone-url"),await _g(["clone",t,e]);}async function iB(t,e){US(e,"ref"),await _g(["checkout",e],t);}async function aB(t){return _g(["rev-parse","HEAD"],t)}async function _g(t,e){let{stdout:r}=await nB("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return r.trim()}var nB,GS,Rg=d(()=>{w();nB=promisify(execFile),GS="repo";s(US,"ensureNotFlag");s(Np,"fetchGitRemoteExtend");s(yg,"readCachedRepo");s(jS,"hasCachedRepo");s(oB,"resolveCloneUrl");s(sB,"cloneRepo");s(iB,"checkoutRef");s(aB,"getHeadSha");s(_g,"runGit");});function pB(){let t=process.env.AGENTSMESH_MAX_TARBALL_MB;if(t===void 0||t==="")return Gc*1024*1024;let e=Number(t);return !Number.isFinite(e)||!Number.isInteger(e)?(console.warn(`[agentsmesh] AGENTSMESH_MAX_TARBALL_MB="${t}" is not an integer; using default ${Gc} MiB.`),Gc*1024*1024):e<KS||e>WS?(console.warn(`[agentsmesh] AGENTSMESH_MAX_TARBALL_MB=${e} is outside [${KS}, ${WS}]; using default ${Gc} MiB.`),Gc*1024*1024):e*1024*1024}async function dB(t,e){let r=typeof t.headers?.get=="function"?t.headers.get("content-length"):null;if(r!==null){let m=Number(r);if(Number.isFinite(m)&&m>e)throw new Error(`remote response declared ${m} bytes; exceeds cap of ${e}`)}let n=t.body;if(!n){let m=await t.arrayBuffer();if(m.byteLength>e)throw new Error(`remote response is ${m.byteLength} bytes; exceeds cap of ${e}`);return new Uint8Array(m)}let o=n.getReader(),i=[],a=0;for(;;){let{done:m,value:p}=await o.read();if(m)break;if(p){if(a+=p.byteLength,a>e)throw await o.cancel().catch(()=>{}),new Error(`remote response exceeded cap of ${e} bytes during streaming`);i.push(p);}}let l=new Uint8Array(a),c=0;for(let m of i)l.set(m,c),c+=m.byteLength;return l}async function VS(t,e,r){let n=`https://api.github.com/repos/${t}/${e}/releases/latest`,o={Accept:"application/vnd.github+json"};r&&(o.Authorization=`Bearer ${r}`);let i=await globalThis.fetch(n,{headers:o});if(!i.ok)throw new Error(`Failed to resolve latest release for ${t}/${e}: ${i.status} ${i.statusText}`);let a=await i.json();if(!a.tag_name||typeof a.tag_name!="string")throw new Error(`No tag_name in releases/latest response for ${t}/${e}`);return a.tag_name}async function JS(t,e,r,n,o,i=false){let a=r.token??process.env.AGENTSMESH_GITHUB_TOKEN,l=r.refresh===true,c=t.tag;if(c==="latest")try{c=await VS(t.org,t.repo,a);}catch(S){if(!i)throw S;return gB(t,e,r,n,o,a)}let m=o("github",`${t.org}/${t.repo}`,c),p=join(n,m);if(!l&&await $(p)){let S=await Ig(p);if(S)return {resolvedPath:join(p,S),version:c}}let u=`https://github.com/${t.org}/${t.repo}/tarball/${c}`,f={};a&&(f.Authorization=`Bearer ${a}`);let g;try{let S=await globalThis.fetch(u,{headers:f,redirect:"follow"});if(!S.ok)throw new Error(`HTTP ${S.status}: ${S.statusText}`);g=await dB(S,uB);}catch(S){if(r.allowOfflineFallback!==false&&await $(p)){let P=await Ig(p);if(P)return console.warn(`[agentsmesh] Network failed for ${e}; using cached version. Error: ${S instanceof Error?S.message:String(S)}`),{resolvedPath:join(p,P),version:c}}throw S}await rm(p,{recursive:true,force:true}),await mkdir(p,{recursive:true});let h=join(p,"archive.tar.gz");await writeFile(h,g);try{await zS.extract({file:h,cwd:p,strict:!0,filter:s((S,k)=>!(fB(S)||k&&"type"in k&&(k.type==="Link"||k.type==="SymbolicLink")),"filter")});}finally{await rm(h,{force:true}).catch(()=>{});}let R=await Ig(p);if(!R)throw new Error(`Extend "${e}": archive has no top-level directory. Expected a single top-level directory inside the archive.`);return {resolvedPath:join(p,R),version:c}}async function Ig(t){let r=(await readdir(t,{withFileTypes:true})).filter(n=>n.isDirectory()&&!n.name.startsWith("."));return r.length===1?r[0].name:null}function HS(t,e,r){return r?`https://x-access-token:${encodeURIComponent(r)}@github.com/${t}/${e}.git`:`https://github.com/${t}/${e}.git`}function fB(t){let e=t.replace(/\\/g,"/");return e.startsWith("/")||e.split("/").includes("..")}async function gB(t,e,r,n,o,i){let a=i?[HS(t.org,t.repo,i)]:[HS(t.org,t.repo),`ssh://git@github.com/${t.org}/${t.repo}.git`],l;for(let c of a){let m={url:c};try{return await Np(m,e,r,n,o)}catch(p){l=p;}}throw l instanceof Error?l:new Error("Failed to clone GitHub default branch")}var Gc,KS,WS,uB,YS=d(()=>{w();Rg();Gc=500,KS=1,WS=4096;s(pB,"resolveMaxTarballBytes");uB=pB();s(dB,"readBoundedResponse");s(VS,"resolveLatestTag");s(JS,"fetchGithubRemoteExtend");s(Ig,"findExtractTopDir");s(HS,"buildGithubCloneUrl");s(fB,"isZipSlipPath");s(gB,"fetchGithubDefaultBranch");});function XS(t,e,r){if(!t.startsWith(e))return null;let n=t.slice(e.length).trim();if(!n)return null;let o=n.lastIndexOf("@");if(o<0)return [n,r];let i=n.slice(0,o).trim(),a=n.slice(o+1).trim();return !i||!a?null:[i,a]}function ZS(t){let e=XS(t,"github:","latest");if(!e)return null;let[r,n]=e,o=r.indexOf("/");if(o<0)return null;let i=r.slice(0,o).trim(),a=r.slice(o+1).trim();return !i||!a||!n?null:{org:i,repo:a,tag:n}}function QS(t){let e=XS(t,"gitlab:");if(!e)return null;let[r,n]=e,o=r.lastIndexOf("/");if(o<0)return null;let i=r.slice(0,o).trim(),a=r.slice(o+1).trim();return !i||!a?null:{namespace:i,project:a,ref:n,cloneUrl:`https://gitlab.com/${i}/${a}.git`}}function qS(t){if(!t.startsWith("git+"))return null;let e=t.slice(4).trim();if(!e)return null;let r=e.lastIndexOf("#"),n=(r<0?e:e.slice(0,r)).trim(),o=r<0?void 0:e.slice(r+1).trim();if(!n||r>=0&&!o)return null;let i;try{i=new URL(n);}catch{return null}return ["https:","http:","ssh:","file:"].includes(i.protocol)?{url:n,ref:o}:null}function Li(t){let e=ZS(t);if(e)return {kind:"github",...e};let r=QS(t);if(r)return {kind:"gitlab",...r};let n=qS(t);return n?{kind:"git",...n}:null}function Sg(t){return Li(t)!==null}var jc=d(()=>{s(XS,"splitSourceRef");s(ZS,"parseGithubSource");s(QS,"parseGitlabSource");s(qS,"parseGitSource");s(Li,"parseRemoteSource");s(Sg,"isSupportedRemoteSource");});function RB(t){let e=Li(t);return e?e.kind==="github"?Za("github",`${e.org}/${e.repo}`,e.tag):e.kind==="gitlab"?Za("gitlab",`${e.namespace}/${e.project}`,e.ref??"HEAD"):Za("git",e.url,e.ref??"HEAD"):null}async function rC(t,e){let r=RB(t);if(!r)return;let n=e??Te(),o=join(n,r);await rm(o,{recursive:true,force:true});}async function nC(t,e){let r=t??Te(),n=e??Number(process.env.AGENTSMESH_CACHE_MAX_AGE_DAYS??30)*864e5,o;try{o=await readdir(r);}catch{return}let i=Date.now();await Promise.all(o.map(async a=>{let l=join(r,a);try{let{mtimeMs:c}=await stat(l);i-c>n&&await rm(l,{recursive:!0,force:!0});}catch{}}));}var Cg=d(()=>{Uc();jc();s(RB,"cacheKeyFromSource");s(rC,"cleanInstallCache");s(nC,"sweepStaleCache");});function Za(t,e,r){let n=s(i=>i.replace(/[^a-zA-Z0-9_.-]/g,"_").replace(/^\.+/,"_"),"safe"),o;if(t==="github"){let[i,a]=e.split("/",2);i&&a?o=`${n(i)}--${n(a)}--${n(r)}`:o=`${n(t)}__${n(e)}__${n(r)}`;}else o=`${n(t)}__${n(e)}__${n(r)}`;if(o.length>iC){let i=createHash("sha256").update(o).digest("hex").slice(0,16);o=`${o.slice(0,iC-18)}--${i}`;}return o}function Te(){let t=process.env.AGENTSMESH_CACHE;if(t){let e=t.trim();if(!e)return join(homedir(),".agentsmesh","cache");if(!/^([A-Za-z]:[\\/]|\/)/.test(e))throw new Error(`AGENTSMESH_CACHE must be an absolute path (got: "${e}").`);if(e==="/"||/^[A-Za-z]:[\\/]?$/.test(e))throw new Error(`AGENTSMESH_CACHE must not be the filesystem root (got: "${e}").`);return e}return join(homedir(),".agentsmesh","cache")}async function Qa(t,e,r={}){let n=Li(t);if(!n)throw t.startsWith("github:")?new Error(`Invalid github: source: "${t}" for extend "${e}"`):t.startsWith("gitlab:")?new Error(`Invalid gitlab: source: "${t}" for extend "${e}"`):t.startsWith("git+")?new Error(`Invalid git+ source: "${t}" for extend "${e}"`):new Error(`Invalid remote source: "${t}" for extend "${e}". Use github:org/repo@tag, gitlab:group/project@ref, or git+https://host/org/repo.git#ref.`);let o=r.cacheDir??Te();return nC(o).catch(()=>{}),n.kind==="github"?JS(n,e,r,o,Za,!t.includes("@")):Np(n,e,r,o,Za)}var iC,Uc=d(()=>{Rg();YS();jc();Cg();iC=80;s(Za,"buildCacheKey");s(Te,"getCacheDir");s(Qa,"fetchRemoteExtend");});function EB(t){return t.startsWith("http://")||t.startsWith("https://")}async function qa(t,e,r={}){if(t.extends.length===0)return [];if(r.refreshCache===true&&t.extends.some(o=>Sg(o.source))){let o=Te();await rm(o,{recursive:true,force:true}),await mkdir(o,{recursive:true});}let n=[];for(let o of t.extends){if(EB(o.source))throw new Error(`Remote extends (http/https) not supported: "${o.source}" for extend "${o.name}". Use github:org/repo@tag, gitlab:group/project@ref, git+https://host/org/repo.git#ref, or a local path (e.g. ./shared/).`);if(Sg(o.source)){let a=await Qa(o.source,o.name,{cacheDir:Te(),refresh:r.refreshCache===true});n.push({name:o.name,resolvedPath:a.resolvedPath,features:[...o.features],target:o.target,as:o.as,version:a.version,path:o.path,pick:o.pick});continue}let i=resolve(e,o.source);if(!await $(i))throw new Error(`Extend "${o.name}": path does not exist: ${i}. Check extends.source in agentsmesh.yaml.`);n.push({name:o.name,resolvedPath:i,features:[...o.features],target:o.target,as:o.as,path:o.path,pick:o.pick});}return n}var Fp=d(()=>{w();Uc();jc();s(EB,"isOtherRemoteSource");s(qa,"resolveExtendPaths");});function b(t){if(t.indexOf("---")!==0)return {frontmatter:{},body:t.trim()};let r=t.indexOf("---",3);if(r===-1)return {frontmatter:{},body:t.trim()};let n=t.slice(3,r).trim(),o=t.slice(r+3).trim();return {frontmatter:n===""?{}:parse(n)??{},body:o}}function AB(t){if(t.indexOf("---")!==0)return t.trim();let e=t.indexOf("---",3);return e===-1?t.trim():t.slice(e+3).trim()}function Fr(t,e){try{return {ok:!0,value:b(t)}}catch(r){let n=r instanceof Error?r.message:String(r);return {ok:false,error:new Error(`Failed to parse frontmatter in ${e}: ${n}`,{cause:r}),bodyFallback:AB(t)}}}function Io(t,e,r){let n=Fr(t,e);if(n.ok)return n.value;if(r)return r(n.error,e),null;throw n.error}function T(t,e){return Object.keys(t).length===0?e:`---
12
12
  ${stringify(t,{lineWidth:0}).trimEnd()}
13
13
  ---
14
14
 
15
- ${e}`}var M=d(()=>{s(k,"parseFrontmatter");s(P,"serializeFrontmatter");});function _j(t){let e=t.replace(/\.[^.]*$/,"").toUpperCase();return hj.has(e)}function lS(t){let e=[],r=t.split(/[\\/]/);for(let o of r)if(!(o===""||o==="."||o==="..")){if(yj.test(o)){e.push({segment:o,reason:"illegal-character"});continue}if(/[. ]$/.test(o)){e.push({segment:o,reason:"trailing-dot-or-space"});continue}_j(o)&&e.push({segment:o,reason:"reserved-name"});}return e}var hj,yj,mS=d(()=>{hj=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]),yj=new RegExp('[<>:"|?*\\u0000-\\u001F]');s(_j,"segmentReservedName");s(lS,"findWindowsPathIssues");});function fn(t,e){let r=lS(e);if(r.length===0)return;let o=r.map(n=>`${n.segment} (${n.reason})`).join(", ");throw new sp(t,e,`canonical ${t} name "${e}" is not portable to Windows: ${o}. Rename the file.`)}function ip(t,e,r){let o=new Map;for(let n of e){let i=n.lastIndexOf("/"),a=n.lastIndexOf("\\"),c=Math.max(i,a),l=c===-1?n:n.slice(c+1),m=l.endsWith(r)?l.slice(0,-r.length):l,p=o.get(m);if(p!==void 0&&p!==n)throw new sp(t,m,`canonical ${t} files collide on slug "${m}": ${p} vs ${n}. Rename one.`);o.set(m,n);}}var sp,Sl=d(()=>{mS();sp=class extends Error{static{s(this,"CanonicalNameError");}feature;name;constructor(e,r,o){super(o),this.feature=e,this.name=r;}};s(fn,"assertCanonicalName");s(ip,"assertNoBasenameCollisions");});function uS(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}async function hi(t){let r=(await v(t)).filter(n=>{if(!n.endsWith(".md"))return false;let i=basename(n,".md");return i==="_root"||!i.startsWith("_")}),o=[];for(let n of r){let i=await y(n);if(!i)continue;let{frontmatter:a,body:c}=k(i),l=basename(n,".md");fn("rule",l);let m=l==="_root",p=a.root===true,u=a.trigger,g=typeof u=="string"&&Ij.includes(u)?u:void 0,f=a.codex_emit,h=f==="execution"?"execution":f==="advisory"?"advisory":void 0,R=a.codex_instruction==="override"?"override":void 0;o.push({source:n,root:m||p,targets:uS(a.targets),description:typeof a.description=="string"?a.description:"",globs:uS(a.globs),body:c,...g!==void 0&&{trigger:g},...h!==void 0&&{codexEmit:h},...R!==void 0&&{codexInstructionVariant:R}});}return o}var Ij,ap=d(()=>{T();M();Sl();Ij=["always_on","model_decision","glob","manual"];s(uS,"toStrArray");s(hi,"parseRules");});function gS(t){return t===true||t==="true"||t===1||t==="1"}function fS(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function yi(t){let r=(await v(t)).filter(n=>n.endsWith(".md")&&!basename(n).startsWith("_"));ip("command",r,".md");let o=[];for(let n of r){let i=await y(n);if(!i)continue;let{frontmatter:a,body:c}=k(i),l=basename(n,".md");fn("command",l);let m=fS(a.allowedTools),p=fS(a["allowed-tools"]),u=m.length>0?m:p;o.push({source:n,name:l,description:typeof a.description=="string"?a.description:"",allowedTools:u,outputStyle:gS(a.outputStyle)||gS(a["output-style"]),body:c});}return o}var cp=d(()=>{T();M();Sl();s(gS,"toBool");s(fS,"toToolsArray");s(yi,"parseCommands");});function _i(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function yS(t){return t===true||t==="true"||t===1||t==="1"}function _S(t){if(typeof t=="number"&&Number.isInteger(t)&&t>=0)return t;if(typeof t=="string"){let e=parseInt(t,10);return Number.isInteger(e)&&e>=0?e:0}return 0}function Rj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function Ii(t){let r=(await v(t)).filter(n=>n.endsWith(".md")&&!basename(n).startsWith("_"));ip("agent",r,".md");let o=[];for(let n of r){let i=await y(n);if(!i)continue;let{frontmatter:a,body:c}=k(i),l=basename(n,".md");fn("agent",l);let m=_i(a.tools),p=_i(a.tools),u=m.length>0?m:p,g=_i(a.disallowedTools),f=_i(a["disallowed-tools"]),h=g.length>0?g:f,O=_i(a.mcpServers),R=_i(a["mcp-servers"]),S=O.length>0?O:R,A=_i(a.skills),D=_S(a.maxTurns),N=_S(a["max-turns"]),G=D>0?D:N>0?N:0;o.push({source:n,name:l,description:typeof a.description=="string"?a.description:"",tools:u,disallowedTools:h,model:typeof a.model=="string"?a.model:"",permissionMode:typeof a.permissionMode=="string"?a.permissionMode:typeof a["permission-mode"]=="string"?a["permission-mode"]:"",maxTurns:G,mcpServers:S,hooks:Rj(a.hooks),skills:A,memory:typeof a.memory=="string"?a.memory:"",outputStyle:yS(a.outputStyle)||yS(a["output-style"]),body:c});}return o}var lp=d(()=>{T();M();Sl();s(_i,"toStrArray");s(yS,"toBool");s(_S,"toInt");s(Rj,"toHooks");s(Ii,"parseAgents");});async function Ej(t){return await y(t)??""}function Lj(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function IS(t){let e=await v(t),r=[];for(let o of e){let i=o.slice(t.length+1).replace(/\\/g,"/");if(i===mp||i.endsWith(`/${mp}`))continue;let a=i.split("/")[0];if(Oj.some(l=>a===l)||i===".DS_Store"||i.endsWith("/.DS_Store"))continue;let c=await Ej(o);r.push({relativePath:i,absolutePath:o,content:c});}return r.sort((o,n)=>o.relativePath.localeCompare(n.relativePath))}async function RS(t){let e=join(t,mp),r=await y(e);if(!r)return null;let{frontmatter:o,body:n}=k(r),i=await IS(t),c=(typeof o.name=="string"?Lj(o.name):"")||basename(t);return fn("skill",c),{source:e,name:c,description:typeof o.description=="string"?o.description:"",body:n,supportingFiles:i}}async function ja(t){let e;try{e=await readdir(t,{withFileTypes:!0});}catch{return []}let r=[];for(let o of e){if(!o.isDirectory()||o.name.startsWith("_"))continue;fn("skill",o.name);let n=join(t,o.name),i=join(n,mp),a=await y(i);if(!a)continue;let{frontmatter:c,body:l}=k(a),m=await IS(n);r.push({source:i,name:o.name,description:typeof c.description=="string"?c.description:"",body:l,supportingFiles:m});}return r.sort((o,n)=>o.name.localeCompare(n.name))}var mp,Oj,pp=d(()=>{T();M();Sl();s(Ej,"readContent");mp="SKILL.md",Oj=[".git","node_modules"];s(Lj,"sanitizeSkillName");s(IS,"listSupportingFiles");s(RS,"parseSkillDirectory");s(ja,"parseSkills");});function SS(t){return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}function Aj(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.type=="string"?e.type:"stdio",o=SS(e.env),n=typeof e.description=="string"?e.description:void 0,i=typeof e.url=="string"?e.url:"";if(i)return {...n!==void 0&&{description:n},type:r,url:i,headers:SS(e.headers),env:o};let a=typeof e.command=="string"?e.command:"";if(!a)return null;let c=Array.isArray(e.args)?e.args.filter(l=>typeof l=="string"):[];return {...n!==void 0&&{description:n},type:r,command:a,args:c,env:o}}function kj(t){let e="",r=0,o=t.length;for(;r<o;){let n=t[r];if(n==='"'){for(e+=n,r++;r<o;){let i=t[r];if(e+=i,i==="\\")r++,r<o&&(e+=t[r]);else if(i==='"')break;r++;}r++;continue}if(n==="/"&&t[r+1]==="*"){for(r+=2;r<o;){if(t[r]==="*"&&t[r+1]==="/"){r+=2;break}r++;}continue}if(n==="/"&&t[r+1]==="/"){for(r+=2;r<o&&t[r]!==`
16
- `;)r++;continue}e+=n,r++;}return e}async function br(t){let e=await y(t);if(!e)return null;let r;try{r=JSON.parse(kj(e));}catch{return null}if(!r||typeof r!="object")return null;let o=r.mcpServers;if(o===void 0||typeof o!="object"||o===null)return null;let n={};for(let[i,a]of Object.entries(o)){let c=Aj(a);c&&(n[i]=c);}return {mcpServers:n}}var Cl=d(()=>{T();s(SS,"parseStringMap");s(Aj,"parseServer");s(kj,"stripJsonComments");s(br,"parseMcp");});function Dg(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}async function up(t){let e=await y(t);if(e===null)return null;if(!e.trim())return {allow:[],deny:[],ask:[]};let r;try{r=parse(e);}catch{return null}if(!r||typeof r!="object")return null;let o=r,n=Dg(o.allow),i=Dg(o.deny),a=Dg(o.ask);return {allow:n,deny:i,ask:a}}var Ng=d(()=>{T();s(Dg,"ensureStringArray");s(up,"parsePermissions");});function CS(t){return typeof t=="string"?t.trim():""}function Kt(t){return CS(t.command)}function me(t){return CS(t.prompt)}function Fg(t){let e=Kt(t),r=me(t);return t.type==="prompt"?r||e:e||r}function hn(t){return Kt(t).length>0}function go(t){return Fg(t).length>0}var Pr=d(()=>{s(CS,"trimString");s(Kt,"getHookCommand");s(me,"getHookPrompt");s(Fg,"getHookText");s(hn,"hasHookCommand");s(go,"hasHookText");});function Pj(t){if(!t||typeof t!="object")return null;let e=t,r=e.matcher;if(typeof r!="string")return null;let o=Fg(e);if(!o)return null;let n=typeof e.type=="string"&&bj.includes(e.type)?e.type:void 0,i=typeof e.timeout=="number"&&Number.isFinite(e.timeout)?e.timeout:void 0,a=me(e)||void 0;return {matcher:r,command:o,...i!==void 0&&{timeout:i},...n&&{type:n},...a&&{prompt:a}}}async function dp(t){let e=await y(t);if(e===null)return null;if(!e.trim())return {};let r;try{r=parse(e);}catch{return null}if(!r||typeof r!="object")return null;let o={},n=r;for(let[i,a]of Object.entries(n)){if(!Array.isArray(a))continue;let c=[];for(let l of a){let m=Pj(l);m&&c.push(m);}c.length>0&&(o[i]=c);}return o}var bj,vg=d(()=>{T();Pr();bj=["command","prompt"];s(Pj,"toHookEntry");s(dp,"parseHooks");});async function gp(t){let e=await y(t);if(e===null||!e.trim())return [];let r=e.split(/\r?\n/),o=[];for(let n of r){let i=n.trim();i===""||i.startsWith("#")||o.push(i);}return o}var Gg=d(()=>{T();s(gp,"parseIgnore");});async function Ae(t){let e=join(t,".agentsmesh"),r=await j(e)?e:t,[o,n,i,a,c,l,m,p]=await Promise.all([hi(join(r,"rules")),yi(join(r,"commands")),Ii(join(r,"agents")),ja(join(r,"skills")),br(join(r,"mcp.json")),up(join(r,"permissions.yaml")),dp(join(r,"hooks.yaml")),gp(join(r,"ignore"))]);return {rules:o,commands:n,agents:i,skills:a,mcp:c,permissions:l,hooks:m,ignore:p}}var Ri=d(()=>{ap();cp();lp();pp();Cl();Ng();vg();Gg();T();s(Ae,"loadCanonicalFiles");});function ES(t){return basename(t.source,".md")}function Ua(t,e){let r=new Map(t.rules.map(p=>[ES(p),p]));for(let p of e.rules)r.set(ES(p),p);let o=new Map(t.commands.map(p=>[p.name,p]));for(let p of e.commands)o.set(p.name,p);let n=new Map(t.agents.map(p=>[p.name,p]));for(let p of e.agents)n.set(p.name,p);let i=new Map(t.skills.map(p=>[p.name,p]));for(let p of e.skills)i.set(p.name,p);let a=Dj(t.mcp,e.mcp),c=Nj(t.permissions,e.permissions),l=Fj(t.hooks,e.hooks),m=vj(t.ignore,e.ignore);return {rules:Array.from(r.values()),commands:Array.from(o.values()),agents:Array.from(n.values()),skills:Array.from(i.values()),mcp:a,permissions:c,hooks:l,ignore:m}}function Dj(t,e){if(!t&&!e)return null;let r=t?.mcpServers??{},o=e?.mcpServers??{};return {mcpServers:{...r,...o}}}function Nj(t,e){if(!t&&!e)return null;let r=Mg(t?.allow??[],e?.allow??[]),o=Mg(t?.deny??[],e?.deny??[]),n=Mg(t?.ask??[],e?.ask??[]);return {allow:r,deny:o,ask:n}}function Mg(t,e){let r=new Set(t),o=[...t];for(let n of e)r.has(n)||(r.add(n),o.push(n));return o}function Fj(t,e){if(!t&&!e)return null;let r={},o=new Set([...Object.keys(t??{}),...Object.keys(e??{})]);for(let n of o){let i=e?.[n],a=t?.[n];r[n]=i!==void 0&&i.length>0?i:a??[];}return r}function vj(t,e){let r=new Set(t),o=[...t];for(let n of e)r.has(n)||(r.add(n),o.push(n));return o}var $g=d(()=>{s(ES,"ruleSlug");s(Ua,"mergeCanonicalFiles");s(Dj,"mergeMcp");s(Nj,"mergePermissions");s(Mg,"mergeUniqueStrings");s(Fj,"mergeHooks");s(vj,"mergeIgnore");});async function fp(t){let e=null,r=0;for(let o of OS){let n=0;for(let i of o.paths)await j(join(t,i))&&n++;n>r&&(r=n,e=o.target);}return r>0?e:null}var OS,LS,jg=d(()=>{T();OS=[{target:"claude-code",paths:["CLAUDE.md",".claude/rules",".claude/commands",".claude/agents",".claude/skills",".claude/settings.json",".claudeignore"]},{target:"cursor",paths:[".cursorrules",".cursor/rules",".cursor",".cursor/mcp.json"]},{target:"copilot",paths:[".github/copilot-instructions.md",".github/copilot",".github/instructions",".github/prompts",".github/skills",".github/agents",".github/hooks"]},{target:"gemini-cli",paths:["GEMINI.md",".gemini",".gemini/settings.json"]},{target:"codex-cli",paths:[".codex",".codex/config.toml","AGENTS.md","codex.md"]},{target:"windsurf",paths:[".windsurfrules",".windsurf",".windsurf/workflows"]},{target:"cline",paths:[".clinerules",".cline"]},{target:"continue",paths:[".continue",".continuerc.json"]},{target:"junie",paths:[".junie",".junie/guidelines.md"]},{target:"kiro",paths:[".kiro",".kiro/steering",".kiro/settings/mcp.json"]},{target:"kilo-code",paths:[".kilo",".kilo/rules",".kilo/commands",".kilo/agents",".kilo/skills",".kilocodeignore",".kilocode",".kilocodemodes","kilo.jsonc","kilo.json"]}];s(fp,"detectNativeFormat");LS=OS.map(t=>t.paths[0]).filter(t=>t!==void 0);});function et(t){return t.includes("\\")||xr.test(t)?win32:posix}function Pt(t){return t.replace(/\\/g,"/")}function V(t,e){let r=et(t),o=r.normalize(r===win32?e.replace(/\//g,"\\"):Pt(e));return o.endsWith(r.sep)&&o.length>1?o.slice(0,-1):o}function kS(t,e){return et(t).isAbsolute(e)||xr.test(e)}function Ka(t){let e=t,r="";for(;$j.test(e);)r=e.at(-1)+r,e=e.slice(0,-1);return {candidate:e,suffix:r}}function wS(t,e){let r=et(e),o=t.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"");return o&&o!==t?V(e,r.join(e,o)):null}var xr,$j,re=d(()=>{xr=/^[A-Za-z]:[\\/]/,$j=/[.!?:;]+$/;s(et,"pathApi");s(Pt,"normalizeSeparators");s(V,"normalizeForProject");s(kS,"isAbsoluteForProject");s(Ka,"stripTrailingPunctuation");s(wS,"rootFallbackPath");});function jj(t){return Object.prototype.hasOwnProperty.call(TS,t)}function Uj(t){return Object.prototype.hasOwnProperty.call(bS,t)}function PS(t,e){if(t!==void 0)return typeof t=="boolean"?t:t[e]}function Ba(t,e,r,o="project"){let n=t.conversions?.commands_to_skills?.[e],i=PS(n,o);return i!==void 0?i:jj(e)?TS[e]:r??false}function Ve(t,e,r,o="project"){let n=t.conversions?.agents_to_skills?.[e],i=PS(n,o);return i!==void 0?i:Uj(e)?bS[e]:r??false}var TS,bS,Wa=d(()=>{TS={amp:true,"codex-cli":true,goose:true,kiro:true,warp:true},bS={amp:true,"gemini-cli":false,cline:true,"codex-cli":false,windsurf:true,goose:true,antigravity:true,continue:true,warp:true};s(jj,"usesCommandSkillProjection");s(Uj,"usesAgentSkillProjection");s(PS,"resolveConversionValue");s(Ba,"shouldConvertCommandsToSkills");s(Ve,"shouldConvertAgentsToSkills");});function Nr(t,e){return e!==void 0?{level:t,flavor:e}:{level:t}}function Dr(t){return typeof t=="string"?{level:t}:t}function xS(t){return {rules:Dr(t.rules),additionalRules:Dr(t.additionalRules),commands:Dr(t.commands),agents:Dr(t.agents),skills:Dr(t.skills),mcp:Dr(t.mcp),hooks:Dr(t.hooks),ignore:Dr(t.ignore),permissions:Dr(t.permissions)}}var Si=d(()=>{s(Nr,"cap");s(Dr,"normalizeCapabilityValue");s(xS,"normalizeTargetCapabilities");});function DS(t){for(let e of zt)if(e.sharedArtifacts){for(let[r,o]of Object.entries(e.sharedArtifacts))if(o==="owner"&&t.startsWith(r))return e.id}return null}function Kj(t){let e=[];for(let o of t)if(o.sharedArtifacts)for(let[n,i]of Object.entries(o.sharedArtifacts))i==="owner"&&e.push({targetId:o.id,prefix:n});let r=[];for(let o=0;o<e.length;o++)for(let n=o+1;n<e.length;n++){let i=e[o],a=e[n];i===void 0||a===void 0||(i.prefix===a.prefix||i.prefix.startsWith(a.prefix)||a.prefix.startsWith(i.prefix))&&r.push({a:i,b:a});}return r}function NS(t){let e=Kj(t);if(e.length===0)return;let r=e.map(({a:o,b:n})=>` - "${o.targetId}" owns "${o.prefix}" and "${n.targetId}" owns "${n.prefix}"`);throw new Error(`Shared-artifact ownership conflict: two targets claim the same or overlapping prefix.
15
+ ${e}`}var j=d(()=>{s(b,"parseFrontmatter");s(AB,"extractBody");s(Fr,"tryParseFrontmatter");s(Io,"parseOrSkipFrontmatter");s(T,"serializeFrontmatter");});function PB(t){let e=t.replace(/\.[^.]*$/,"").toUpperCase();return wB.has(e)}function aC(t){let e=[],r=t.split(/[\\/]/);for(let n of r)if(!(n===""||n==="."||n==="..")){if(bB.test(n)){e.push({segment:n,reason:"illegal-character"});continue}if(/[. ]$/.test(n)){e.push({segment:n,reason:"trailing-dot-or-space"});continue}PB(n)&&e.push({segment:n,reason:"reserved-name"});}return e}var wB,bB,lC=d(()=>{wB=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]),bB=new RegExp('[<>:"|?*\\u0000-\\u001F]');s(PB,"segmentReservedName");s(aC,"findWindowsPathIssues");});function So(t,e){let r=aC(e);if(r.length===0)return;let n=r.map(o=>`${o.segment} (${o.reason})`).join(", ");throw new vp(t,e,`canonical ${t} name "${e}" is not portable to Windows: ${n}. Rename the file.`)}function Mp(t,e,r){let n=new Map;for(let o of e){let i=o.lastIndexOf("/"),a=o.lastIndexOf("\\"),l=Math.max(i,a),c=l===-1?o:o.slice(l+1),m=c.endsWith(r)?c.slice(0,-r.length):c,p=n.get(m);if(p!==void 0&&p!==o)throw new vp(t,m,`canonical ${t} files collide on slug "${m}": ${p} vs ${o}. Rename one.`);n.set(m,o);}}var vp,Bc=d(()=>{lC();vp=class extends Error{static{s(this,"CanonicalNameError");}feature;name;constructor(e,r,n){super(n),this.feature=e,this.name=r;}};s(So,"assertCanonicalName");s(Mp,"assertNoBasenameCollisions");});function tl(t,e,r,n,o={}){if(r.length===0)return;let i=new Set(n),a=o.handledByOtherReader,l=new Set,c=0;for(let p of r){if(i.has(p)||basename(p).startsWith("."))continue;let u=extname(p).toLowerCase();DB.has(u)&&(a?.has(u)||(l.add(u),c++));}if(c===0)return;let m=[...l].sort().join(", ");y.warn(`Skipped ${c} ${t} file(s) in ${e} (format${l.size===1?"":"s"}: ${m}). agentsmesh ${t} are parsed from .md files only.`);}var DB,$p=d(()=>{ot();DB=new Set([".toml",".yaml",".yml",".json"]);s(tl,"warnIfUnrecognizedResourceFormats");});function mC(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}async function Cs(t,e={}){let r=await v(t),n=r.filter(i=>{if(!i.endsWith(".md"))return false;let a=basename(i,".md");return a==="_root"||!a.startsWith("_")});tl("rules",t,r,n,{handledByOtherReader:e.handledByOtherReader});let o=[];for(let i of n){let a=await _(i);if(!a)continue;let l=Io(a,i,e.onParseError);if(!l)continue;let{frontmatter:c,body:m}=l,p=basename(i,".md");So("rule",p);let u=p==="_root",f=c.root===true,g=c.trigger,h=typeof g=="string"&&NB.includes(g)?g:void 0,R=c.codex_emit,C=R==="execution"?"execution":R==="advisory"?"advisory":void 0,k=c.codex_instruction==="override"?"override":void 0;o.push({source:i,root:u||f,targets:mC(c.targets),description:typeof c.description=="string"?c.description:"",globs:mC(c.globs),body:m,...h!==void 0&&{trigger:h},...C!==void 0&&{codexEmit:C},...k!==void 0&&{codexInstructionVariant:k}});}return o}var NB,Kc=d(()=>{w();j();Bc();$p();NB=["always_on","model_decision","glob","manual"];s(mC,"toStrArray");s(Cs,"parseRules");});function uC(t){return t===true||t==="true"||t===1||t==="1"}function dC(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function ks(t,e={}){let r=await v(t),n=r.filter(i=>i.endsWith(".md")&&!basename(i).startsWith("_"));tl("commands",t,r,n,{handledByOtherReader:e.handledByOtherReader}),Mp("command",n,".md");let o=[];for(let i of n){let a=await _(i);if(!a)continue;let l=Io(a,i,e.onParseError);if(!l)continue;let{frontmatter:c,body:m}=l,p=basename(i,".md");So("command",p);let u=dC(c.allowedTools),f=dC(c["allowed-tools"]),g=u.length>0?u:f;o.push({source:i,name:p,description:typeof c.description=="string"?c.description:"",allowedTools:g,outputStyle:uC(c.outputStyle)||uC(c["output-style"]),body:m});}return o}var Wc=d(()=>{w();j();Bc();$p();s(uC,"toBool");s(dC,"toToolsArray");s(ks,"parseCommands");});function Oi(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function gC(t){return t===true||t==="true"||t===1||t==="1"}function hC(t){if(typeof t=="number"&&Number.isInteger(t)&&t>=0)return t;if(typeof t=="string"){let e=parseInt(t,10);return Number.isInteger(e)&&e>=0?e:0}return 0}function FB(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function Es(t,e={}){let r=await v(t),n=r.filter(i=>i.endsWith(".md")&&!basename(i).startsWith("_"));tl("agents",t,r,n,{handledByOtherReader:e.handledByOtherReader}),Mp("agent",n,".md");let o=[];for(let i of n){let a=await _(i);if(!a)continue;let l=Io(a,i,e.onParseError);if(!l)continue;let{frontmatter:c,body:m}=l,p=basename(i,".md");So("agent",p);let u=Oi(c.tools),f=Oi(c.tools),g=u.length>0?u:f,h=Oi(c.disallowedTools),R=Oi(c["disallowed-tools"]),C=h.length>0?h:R,S=Oi(c.mcpServers),k=Oi(c["mcp-servers"]),P=S.length>0?S:k,N=Oi(c.skills),F=hC(c.maxTurns),W=hC(c["max-turns"]),z=F>0?F:W>0?W:0;o.push({source:i,name:p,description:typeof c.description=="string"?c.description:"",tools:g,disallowedTools:C,model:typeof c.model=="string"?c.model:"",permissionMode:typeof c.permissionMode=="string"?c.permissionMode:typeof c["permission-mode"]=="string"?c["permission-mode"]:"",maxTurns:z,mcpServers:P,hooks:FB(c.hooks),skills:N,memory:typeof c.memory=="string"?c.memory:"",outputStyle:gC(c.outputStyle)||gC(c["output-style"]),body:m});}return o}var Hc=d(()=>{w();j();Bc();$p();s(Oi,"toStrArray");s(gC,"toBool");s(hC,"toInt");s(FB,"toHooks");s(Es,"parseAgents");});function kg(t){let e=t.toLowerCase(),r=e.lastIndexOf("."),n=r>0?e.slice(0,r):e;return vB.get(n)}function In(t){return kg(t)!==void 0}function Gp(t){return kg(t)==="preserved"}function jp(t){return kg(t)==="noise"}function yC(t){return MB.has(t)}function _C(t){return $B.has(t)}var vB,MB,$B,Co=d(()=>{vB=new Map([["contributing","noise"],["changelog","noise"],["changes","noise"],["history","noise"],["code_of_conduct","noise"],["security","noise"],["support","noise"],["maintainers","noise"],["governance","noise"],["authors","noise"],["contributors","noise"],["codeowners","noise"],["citation","noise"],["acknowledgments","noise"],["acknowledgements","noise"],["license","preserved"],["license-mit","preserved"],["license-apache","preserved"],["license-bsd","preserved"],["license-gpl","preserved"],["notice","preserved"],["copying","preserved"],["copyright","preserved"],["readme","preserved"]]),MB=new Set([".git",".github",".gitlab","node_modules",".vscode",".idea"]),$B=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock",".gitignore",".gitattributes",".editorconfig",".DS_Store"]);s(kg,"boilerplateKind");s(In,"isBoilerplate");s(Gp,"isPreservedBoilerplate");s(jp,"isNoiseBoilerplate");s(yC,"isRepoNonContentDir");s(_C,"isRepoNonContentFile");});async function UB(t){return await _(t)??""}function KB(t){let e=t.lastIndexOf(".");return e<0?true:BB.has(t.slice(e).toLowerCase())}function HB(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function RC(t){let e=await v(t),r=[];for(let n of e){let i=n.slice(t.length+1).replace(/\\/g,"/");if(i===Up||i.endsWith(`/${Up}`))continue;let a=i.split("/")[0];if(WB.some(m=>a===m)||i===".DS_Store"||i.endsWith("/.DS_Store"))continue;let l=i.includes("/")?i.slice(i.lastIndexOf("/")+1):i;if(KB(l)&&jp(l))continue;let c=await UB(n);r.push({relativePath:i,absolutePath:n,content:c});}return r.sort((n,o)=>n.relativePath.localeCompare(o.relativePath))}async function Bp(t,e={}){let r=join(t,Up),n=await _(r);if(!n)return null;let o=Io(n,r,e.onParseError);if(!o)return null;let{frontmatter:i,body:a}=o,l=await RC(t),m=(typeof i.name=="string"?HB(i.name):"")||basename(t);return So("skill",m),{source:r,name:m,description:typeof i.description=="string"?i.description:"",body:a,supportingFiles:l}}async function Ls(t,e={}){let r;try{r=await readdir(t,{withFileTypes:!0});}catch{return []}let n=[];for(let o of r){if(!o.isDirectory()||o.name.startsWith("_"))continue;So("skill",o.name);let i=join(t,o.name),a=join(i,Up),l=await _(a);if(!l)continue;let c=Io(l,a,e.onParseError);if(!c)continue;let{frontmatter:m,body:p}=c,u=await RC(i);n.push({source:a,name:o.name,description:typeof m.description=="string"?m.description:"",body:p,supportingFiles:u});}return n.sort((o,i)=>o.name.localeCompare(i.name))}var Up,BB,WB,el=d(()=>{w();j();Co();Bc();s(UB,"readContent");Up="SKILL.md",BB=new Set([".md",".mdx",".rst",".txt"]);s(KB,"isMarkdownLikeDoc");WB=[".git","node_modules"];s(HB,"sanitizeSkillName");s(RC,"listSupportingFiles");s(Bp,"parseSkillDirectory");s(Ls,"parseSkills");});function IC(t){return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}function zB(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.type=="string"?e.type:"stdio",n=IC(e.env),o=typeof e.description=="string"?e.description:void 0,i=typeof e.url=="string"?e.url:"";if(i)return {...o!==void 0&&{description:o},type:r,url:i,headers:IC(e.headers),env:n};let a=typeof e.command=="string"?e.command:"";if(!a)return null;let l=Array.isArray(e.args)?e.args.filter(c=>typeof c=="string"):[];return {...o!==void 0&&{description:o},type:r,command:a,args:l,env:n}}function VB(t){let e="",r=0,n=t.length;for(;r<n;){let o=t[r];if(o==='"'){for(e+=o,r++;r<n;){let i=t[r];if(e+=i,i==="\\")r++,r<n&&(e+=t[r]);else if(i==='"')break;r++;}r++;continue}if(o==="/"&&t[r+1]==="*"){for(r+=2;r<n;){if(t[r]==="*"&&t[r+1]==="/"){r+=2;break}r++;}continue}if(o==="/"&&t[r+1]==="/"){for(r+=2;r<n&&t[r]!==`
16
+ `;)r++;continue}e+=o,r++;}return e}async function vr(t){let e=await _(t);if(!e)return null;let r;try{r=JSON.parse(VB(e));}catch{return null}if(!r||typeof r!="object")return null;let n=r.mcpServers;if(n===void 0||typeof n!="object"||n===null)return null;let o={};for(let[i,a]of Object.entries(n)){let l=zB(a);l&&(o[i]=l);}return {mcpServers:o}}var zc=d(()=>{w();s(IC,"parseStringMap");s(zB,"parseServer");s(VB,"stripJsonComments");s(vr,"parseMcp");});function Lg(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}async function Kp(t){let e=await _(t);if(e===null)return null;if(!e.trim())return {allow:[],deny:[],ask:[]};let r;try{r=parse(e);}catch{return null}if(!r||typeof r!="object")return null;let n=r,o=Lg(n.allow),i=Lg(n.deny),a=Lg(n.ask);return {allow:o,deny:i,ask:a}}var Og=d(()=>{w();s(Lg,"ensureStringArray");s(Kp,"parsePermissions");});function SC(t){return typeof t=="string"?t.trim():""}function zt(t){return SC(t.command)}function he(t){return SC(t.prompt)}function Ag(t){let e=zt(t),r=he(t);return t.type==="prompt"?r||e:e||r}function ko(t){return zt(t).length>0}function Sn(t){return Ag(t).length>0}var Mr=d(()=>{s(SC,"trimString");s(zt,"getHookCommand");s(he,"getHookPrompt");s(Ag,"getHookText");s(ko,"hasHookCommand");s(Sn,"hasHookText");});function ZB(t){if(!t||typeof t!="object")return null;let e=t,r=e.matcher;if(typeof r!="string")return null;let n=Ag(e);if(!n)return null;let o=typeof e.type=="string"&&XB.includes(e.type)?e.type:void 0,i=typeof e.timeout=="number"&&Number.isFinite(e.timeout)?e.timeout:void 0,a=he(e)||void 0;return {matcher:r,command:n,...i!==void 0&&{timeout:i},...o&&{type:o},...a&&{prompt:a}}}async function Wp(t){let e=await _(t);if(e===null)return null;if(!e.trim())return {};let r;try{r=parse(e);}catch{return null}if(!r||typeof r!="object")return null;let n={},o=r;for(let[i,a]of Object.entries(o)){if(!Array.isArray(a))continue;let l=[];for(let c of a){let m=ZB(c);m&&l.push(m);}l.length>0&&(n[i]=l);}return n}var XB,wg=d(()=>{w();Mr();XB=["command","prompt"];s(ZB,"toHookEntry");s(Wp,"parseHooks");});async function Hp(t){let e=await _(t);if(e===null||!e.trim())return [];let r=e.split(/\r?\n/),n=[];for(let o of r){let i=o.trim();i===""||i.startsWith("#")||n.push(i);}return n}var bg=d(()=>{w();s(Hp,"parseIgnore");});async function Ee(t,e={}){let r=join(t,".agentsmesh"),n=await $(r)?r:t,[o,i,a,l,c,m,p,u]=await Promise.all([Cs(join(n,"rules"),e),ks(join(n,"commands"),e),Es(join(n,"agents"),e),Ls(join(n,"skills"),e),vr(join(n,"mcp.json")),Kp(join(n,"permissions.yaml")),Wp(join(n,"hooks.yaml")),Hp(join(n,"ignore"))]);return {rules:o,commands:i,agents:a,skills:l,mcp:c,permissions:m,hooks:p,ignore:u}}var Ai=d(()=>{Kc();Wc();Hc();el();zc();Og();wg();bg();w();s(Ee,"loadCanonicalFiles");});function CC(t){return basename(t.source,".md")}function rl(t,e){let r=new Map(t.rules.map(p=>[CC(p),p]));for(let p of e.rules)r.set(CC(p),p);let n=new Map(t.commands.map(p=>[p.name,p]));for(let p of e.commands)n.set(p.name,p);let o=new Map(t.agents.map(p=>[p.name,p]));for(let p of e.agents)o.set(p.name,p);let i=new Map(t.skills.map(p=>[p.name,p]));for(let p of e.skills)i.set(p.name,p);let a=qB(t.mcp,e.mcp),l=tK(t.permissions,e.permissions),c=eK(t.hooks,e.hooks),m=rK(t.ignore,e.ignore);return {rules:Array.from(r.values()),commands:Array.from(n.values()),agents:Array.from(o.values()),skills:Array.from(i.values()),mcp:a,permissions:l,hooks:c,ignore:m}}function qB(t,e){if(!t&&!e)return null;let r=t?.mcpServers??{},n=e?.mcpServers??{};return {mcpServers:{...r,...n}}}function tK(t,e){if(!t&&!e)return null;let r=Pg(t?.allow??[],e?.allow??[]),n=Pg(t?.deny??[],e?.deny??[]),o=Pg(t?.ask??[],e?.ask??[]);return {allow:r,deny:n,ask:o}}function Pg(t,e){let r=new Set(t),n=[...t];for(let o of e)r.has(o)||(r.add(o),n.push(o));return n}function eK(t,e){if(!t&&!e)return null;let r={},n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]);for(let o of n){let i=e?.[o],a=t?.[o];r[o]=i!==void 0&&i.length>0?i:a??[];}return r}function rK(t,e){let r=new Set(t),n=[...t];for(let o of e)r.has(o)||(r.add(o),n.push(o));return n}var Tg=d(()=>{s(CC,"ruleSlug");s(rl,"mergeCanonicalFiles");s(qB,"mergeMcp");s(tK,"mergePermissions");s(Pg,"mergeUniqueStrings");s(eK,"mergeHooks");s(rK,"mergeIgnore");});function cK(t){return typeof t=="string"?t:t.level}function kC(t){return lK.includes(t)}function EC(t,e,r,n){for(let o of aK){let i=cK(e[o.feature]);if(i==="none")continue;let a=typeof t.generators[o.generator]=="function",l=kC(o.feature)&&typeof t.emitScopedSettings=="function";a||l||r.addIssue({code:"custom",path:[...n,o.feature],message:`Capability "${o.feature}" is "${i}" but generators.${o.generator}`+(kC(o.feature)?" or emitScopedSettings":"")+" is missing."});}}function zp(t){return dK.parse(t)}var Lo,LC,nK,oK,OC,sK,iK,aK,lK,mK,pK,uK,dK,xg=d(()=>{Lo=z.union([z.enum(["native","embedded","partial","none"]),z.object({level:z.enum(["native","embedded","partial","none"]),flavor:z.string().optional()})]),LC=z.object({rules:Lo,additionalRules:Lo,commands:Lo,agents:Lo,skills:Lo,mcp:Lo,hooks:Lo,ignore:Lo,permissions:Lo}),nK=z.object({name:z.string(),generateRules:z.function(),importFrom:z.function(),generateCommands:z.function().optional(),generateAgents:z.function().optional(),generateSkills:z.function().optional(),generateMcp:z.function().optional(),generatePermissions:z.function().optional(),generateHooks:z.function().optional(),generateIgnore:z.function().optional(),lint:z.function().optional()}).passthrough(),oK=z.object({rulePath:z.function(),commandPath:z.function(),agentPath:z.function()}),OC=z.object({paths:oK}).passthrough(),sK=z.object({capabilities:LC,detectionPaths:z.array(z.string()),layout:OC,scopeExtras:z.function().optional()}).passthrough(),iK=["global","globalCapabilities","globalDetectionPaths","generateScopeExtras"],aK=[{feature:"commands",generator:"generateCommands"},{feature:"agents",generator:"generateAgents"},{feature:"skills",generator:"generateSkills"},{feature:"mcp",generator:"generateMcp"},{feature:"hooks",generator:"generateHooks"},{feature:"ignore",generator:"generateIgnore"},{feature:"permissions",generator:"generatePermissions"}],lK=["mcp","hooks","ignore","permissions"];s(cK,"capabilityLevel");s(kC,"canUseScopedSettings");s(EC,"validateCapabilityImplementations");mK=z.object({commandsToSkills:z.boolean().optional(),agentsToSkills:z.boolean().optional()}).strict(),pK=z.object({displayName:z.string().min(1),category:z.enum(["cli","ide","agent-platform"]),officialUrl:z.string().min(1),shortDescription:z.string().min(1)}).passthrough(),uK=z.object({id:z.string().regex(/^[a-z][a-z0-9-]*$/,"Target id must be lowercase with hyphens"),metadata:pK,generators:nK,capabilities:LC,emptyImportMessage:z.string(),lintRules:z.union([z.function(),z.null()]),project:OC,globalSupport:sK.optional(),buildImportPaths:z.function(),detectionPaths:z.array(z.string()),excludeFromStarterInit:z.boolean().optional(),conversionDefaults:mK.optional(),emitScopedSettings:z.function().optional(),mergeGeneratedOutputContent:z.function().optional(),postProcessHookOutputs:z.function().optional(),preservesManualActivation:z.boolean().optional()}).passthrough(),dK=uK.superRefine((t,e)=>{for(let r of iK)r in t&&e.addIssue({code:"custom",path:[r],message:`Use globalSupport instead of legacy field "${r}".`});EC(t,t.capabilities,e,["capabilities"]),t.globalSupport!==void 0&&EC(t,t.globalSupport.capabilities,e,["globalSupport","capabilities"]);});s(zp,"validateDescriptor");});function AC(){if(Dg)return Dg;let t=bt.filter(r=>r!==void 0&&typeof r.id=="string"),e=new Map(t.map(r=>[r.id,r]));return t.length===bt.length&&(Dg=e),e}function Jp(t){let e=zp(t);Vp.set(e.id,e);}function et(t){return Vp.get(t)??AC().get(t)}function Yp(){return [...Vp.values()]}function wC(){return [...new Set([...AC().keys(),...Vp.keys()])]}var Vp,Dg,se=d(()=>{Pt();xg();Vp=new Map;s(AC,"builtinDescriptors");s(Jp,"registerTargetDescriptor");s(et,"getDescriptor");s(Yp,"getAllDescriptors");s(wC,"getAllRegisteredDescriptorIds");});function bC(t,e){return et(t)?.conversionDefaults?.[e]}function PC(t,e){if(t!==void 0)return typeof t=="boolean"?t:t[e]}function nl(t,e,r,n="project"){let o=t.conversions?.commands_to_skills?.[e],i=PC(o,n);if(i!==void 0)return i;let a=bC(e,"commandsToSkills");return a!==void 0?a:r??false}function qe(t,e,r,n="project"){let o=t.conversions?.agents_to_skills?.[e],i=PC(o,n);if(i!==void 0)return i;let a=bC(e,"agentsToSkills");return a!==void 0?a:r??false}var ol=d(()=>{se();s(bC,"builtinDefault");s(PC,"resolveConversionValue");s(nl,"shouldConvertCommandsToSkills");s(qe,"shouldConvertAgentsToSkills");});function Gr(t,e){return e!==void 0?{level:t,flavor:e}:{level:t}}function $r(t){return typeof t=="string"?{level:t}:t}function TC(t){return {rules:$r(t.rules),additionalRules:$r(t.additionalRules),commands:$r(t.commands),agents:$r(t.agents),skills:$r(t.skills),mcp:$r(t.mcp),hooks:$r(t.hooks),ignore:$r(t.ignore),permissions:$r(t.permissions)}}var wi=d(()=>{s(Gr,"cap");s($r,"normalizeCapabilityValue");s(TC,"normalizeTargetCapabilities");});function xC(t){for(let e of bt)if(e.sharedArtifacts){for(let[r,n]of Object.entries(e.sharedArtifacts))if(n==="owner"&&t.startsWith(r))return e.id}return null}function fK(t){let e=[];for(let n of t)if(n.sharedArtifacts)for(let[o,i]of Object.entries(n.sharedArtifacts))i==="owner"&&e.push({targetId:n.id,prefix:o});let r=[];for(let n=0;n<e.length;n++)for(let o=n+1;o<e.length;o++){let i=e[n],a=e[o];i===void 0||a===void 0||(i.prefix===a.prefix||i.prefix.startsWith(a.prefix)||a.prefix.startsWith(i.prefix))&&r.push({a:i,b:a});}return r}function DC(t){let e=fK(t);if(e.length===0)return;let r=e.map(({a:n,b:o})=>` - "${n.targetId}" owns "${n.prefix}" and "${o.targetId}" owns "${o.prefix}"`);throw new Error(`Shared-artifact ownership conflict: two targets claim the same or overlapping prefix.
17
17
  `+r.join(`
18
18
  `)+`
19
- Resolve by changing one target's role to 'consumer' or by namespacing its prefix.`)}var Ug=d(()=>{xt();s(DS,"ownerTargetIdForSharedPath");s(Kj,"findSharedArtifactOwnershipConflicts");s(NS,"assertSharedArtifactOwnersUnique");});function Bj(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function W(t){return `${Ha}${t}`}function bt(t){let e={name:W(t.name),description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],P(e,t.body.trim()||"")}function hp(t,e){if(t["x-agentsmesh-kind"]!=="command")return null;let r=typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"",o=e.startsWith(Ha)?e.slice(Ha.length):e.startsWith(El)?e.slice(El.length):"",n=(r||o).trim();return n?{name:n,description:typeof t.description=="string"?t.description:"",allowedTools:Bj(t["x-agentsmesh-allowed-tools"])}:null}function yp(t,e){return P({description:t.description,"allowed-tools":t.allowedTools},e.trim()||"")}var Ha,El,St=d(()=>{M();Ha="am-command-",El="ab-command-";s(Bj,"toStringArray");s(W,"commandSkillDirName");s(bt,"serializeCommandSkill");s(hp,"parseCommandSkillFrontmatter");s(yp,"serializeImportedCommand");});function _p(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function Wj(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,o]of Object.entries(t))Array.isArray(o)&&(e[r]=o.filter(n=>n!==null&&typeof n=="object"&&typeof n.matcher=="string"&&typeof n.command=="string"));return e}function $(t){return `${za}${t}`}function Lt(t){let e={name:$(t.name),description:t.description||void 0,"x-agentsmesh-kind":"agent","x-agentsmesh-name":t.name,"x-agentsmesh-tools":t.tools.length>0?t.tools:void 0,"x-agentsmesh-disallowed-tools":t.disallowedTools.length>0?t.disallowedTools:void 0,"x-agentsmesh-model":t.model||void 0,"x-agentsmesh-permission-mode":t.permissionMode||void 0,"x-agentsmesh-max-turns":t.maxTurns>0?t.maxTurns:void 0,"x-agentsmesh-mcp-servers":t.mcpServers.length>0?t.mcpServers:void 0,"x-agentsmesh-hooks":Object.keys(t.hooks).length>0?t.hooks:void 0,"x-agentsmesh-skills":t.skills.length>0?t.skills:void 0,"x-agentsmesh-memory":t.memory||void 0};return Object.keys(e).forEach(r=>{e[r]===void 0&&delete e[r];}),P(e,t.body.trim()||"")}function fo(t,e){if(t["x-agentsmesh-kind"]!=="agent")return null;let r=typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"",o=e.startsWith(za)?e.slice(za.length):e.startsWith(Ol)?e.slice(Ol.length):"",n=(r||o).trim();return n?{name:n,description:typeof t.description=="string"?t.description:"",tools:_p(t["x-agentsmesh-tools"]),disallowedTools:_p(t["x-agentsmesh-disallowed-tools"]),model:typeof t["x-agentsmesh-model"]=="string"?t["x-agentsmesh-model"]:"",permissionMode:typeof t["x-agentsmesh-permission-mode"]=="string"?t["x-agentsmesh-permission-mode"]:"",maxTurns:typeof t["x-agentsmesh-max-turns"]=="number"?t["x-agentsmesh-max-turns"]:Number(t["x-agentsmesh-max-turns"]??0),mcpServers:_p(t["x-agentsmesh-mcp-servers"]),hooks:Wj(t["x-agentsmesh-hooks"]),skills:_p(t["x-agentsmesh-skills"]),memory:typeof t["x-agentsmesh-memory"]=="string"?t["x-agentsmesh-memory"]:""}:null}function Je(t,e){let r={name:t.name,description:t.description,tools:t.tools,disallowedTools:t.disallowedTools.length>0?t.disallowedTools:void 0,model:t.model||void 0,permissionMode:t.permissionMode||void 0,maxTurns:t.maxTurns>0?t.maxTurns:void 0,mcpServers:t.mcpServers.length>0?t.mcpServers:void 0,hooks:Object.keys(t.hooks).length>0?t.hooks:void 0,skills:t.skills.length>0?t.skills:void 0,memory:t.memory||void 0};return Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];}),P(r,e.trim()||"")}var za,Ol,st=d(()=>{M();za="am-agent-",Ol="ab-agent-";s(_p,"toStringArray");s(Wj,"toHooks");s($,"projectedAgentSkillDirName");s(Lt,"serializeProjectedAgentSkill");s(fo,"parseProjectedAgentSkillFrontmatter");s(Je,"serializeImportedAgent");});function Ll(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kg(t,e){return new RegExp(`${Ll(t)}[\\s\\S]*?${Ll(e)}`,"g")}function $S(t,e,r,o){let n=Kg(e,r);if(n.test(t))return t.replace(n,o).trim();let i=t.trim();return i?`${i}
19
+ Resolve by changing one target's role to 'consumer' or by namespacing its prefix.`)}var Ng=d(()=>{Pt();s(xC,"ownerTargetIdForSharedPath");s(fK,"findSharedArtifactOwnershipConflicts");s(DC,"assertSharedArtifactOwnersUnique");});function gK(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function H(t){return `${sl}${t}`}function Nt(t){let e={name:H(t.name),description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],T(e,t.body.trim()||"")}function Xp(t,e){if(t["x-agentsmesh-kind"]!=="command")return null;let r=typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"",n=e.startsWith(sl)?e.slice(sl.length):e.startsWith(Vc)?e.slice(Vc.length):"",o=(r||n).trim();return o?{name:o,description:typeof t.description=="string"?t.description:"",allowedTools:gK(t["x-agentsmesh-allowed-tools"])}:null}function Zp(t,e){return T({description:t.description,"allowed-tools":t.allowedTools},e.trim()||"")}var sl,Vc,kt=d(()=>{j();sl="am-command-",Vc="ab-command-";s(gK,"toStringArray");s(H,"commandSkillDirName");s(Nt,"serializeCommandSkill");s(Xp,"parseCommandSkillFrontmatter");s(Zp,"serializeImportedCommand");});function Qp(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function hK(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,n]of Object.entries(t))Array.isArray(n)&&(e[r]=n.filter(o=>o!==null&&typeof o=="object"&&typeof o.matcher=="string"&&typeof o.command=="string"));return e}function U(t){return `${il}${t}`}function Tt(t){let e={name:U(t.name),description:t.description||void 0,"x-agentsmesh-kind":"agent","x-agentsmesh-name":t.name,"x-agentsmesh-tools":t.tools.length>0?t.tools:void 0,"x-agentsmesh-disallowed-tools":t.disallowedTools.length>0?t.disallowedTools:void 0,"x-agentsmesh-model":t.model||void 0,"x-agentsmesh-permission-mode":t.permissionMode||void 0,"x-agentsmesh-max-turns":t.maxTurns>0?t.maxTurns:void 0,"x-agentsmesh-mcp-servers":t.mcpServers.length>0?t.mcpServers:void 0,"x-agentsmesh-hooks":Object.keys(t.hooks).length>0?t.hooks:void 0,"x-agentsmesh-skills":t.skills.length>0?t.skills:void 0,"x-agentsmesh-memory":t.memory||void 0};return Object.keys(e).forEach(r=>{e[r]===void 0&&delete e[r];}),T(e,t.body.trim()||"")}function al(t,e){if(t["x-agentsmesh-kind"]!=="agent")return null;let r=typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"",n=e.startsWith(il)?e.slice(il.length):e.startsWith(Jc)?e.slice(Jc.length):"",o=(r||n).trim();return o?{name:o,description:typeof t.description=="string"?t.description:"",tools:Qp(t["x-agentsmesh-tools"]),disallowedTools:Qp(t["x-agentsmesh-disallowed-tools"]),model:typeof t["x-agentsmesh-model"]=="string"?t["x-agentsmesh-model"]:"",permissionMode:typeof t["x-agentsmesh-permission-mode"]=="string"?t["x-agentsmesh-permission-mode"]:"",maxTurns:typeof t["x-agentsmesh-max-turns"]=="number"?t["x-agentsmesh-max-turns"]:Number(t["x-agentsmesh-max-turns"]??0),mcpServers:Qp(t["x-agentsmesh-mcp-servers"]),hooks:hK(t["x-agentsmesh-hooks"]),skills:Qp(t["x-agentsmesh-skills"]),memory:typeof t["x-agentsmesh-memory"]=="string"?t["x-agentsmesh-memory"]:""}:null}function Os(t,e){let r={name:t.name,description:t.description,tools:t.tools,disallowedTools:t.disallowedTools.length>0?t.disallowedTools:void 0,model:t.model||void 0,permissionMode:t.permissionMode||void 0,maxTurns:t.maxTurns>0?t.maxTurns:void 0,mcpServers:t.mcpServers.length>0?t.mcpServers:void 0,hooks:Object.keys(t.hooks).length>0?t.hooks:void 0,skills:t.skills.length>0?t.skills:void 0,memory:t.memory||void 0};return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];}),T(r,e.trim()||"")}var il,Jc,mt=d(()=>{j();il="am-agent-",Jc="ab-agent-";s(Qp,"toStringArray");s(hK,"toHooks");s(U,"projectedAgentSkillDirName");s(Tt,"serializeProjectedAgentSkill");s(al,"parseProjectedAgentSkillFrontmatter");s(Os,"serializeImportedAgent");});function Yc(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fg(t,e){return new RegExp(`${Yc(t)}[\\s\\S]*?${Yc(e)}`,"g")}function $C(t,e,r,n){let o=Fg(e,r);if(o.test(t))return t.replace(o,n).trim();let i=t.trim();return i?`${i}
20
20
 
21
- ${o}`:o}function Bg(t,e,r){return t.replace(Kg(e,r),"").trim()}function Vj(t){let e=t.replace(/\\/g,"/"),r=e.lastIndexOf(".agentsmesh/");return r>=0?e.slice(r+12):e.startsWith("rules/")?e:join("rules",basename(e)).replace(/\\/g,"/")}function Jj(t){return {source:Vj(t.source),description:t.description,globs:t.globs,targets:t.targets}}function Yj(t){return `${GS}${JSON.stringify(Jj(t))}${MS}`}function Xj(t){let e=[Yj(t)];return t.description.trim()&&e.push(`## ${t.description.trim()}`,""),e.push(t.body.trim(),vS),e.filter(r=>r.length>0).join(`
22
- `)}function Zj(t){return t.length===0?"":[Ip,...t.map(Xj),Rp].join(`
23
- `)}function it(t,e){let r=Zj(e),o=Bg(t,Ip,Rp);return r?o?`${o}
21
+ ${n}`:n}function vg(t,e,r){return t.replace(Fg(e,r),"").trim()}function RK(t){let e=t.replace(/\\/g,"/"),r=e.lastIndexOf(".agentsmesh/");return r>=0?e.slice(r+12):e.startsWith("rules/")?e:join("rules",basename(e)).replace(/\\/g,"/")}function IK(t){return {source:RK(t.source),description:t.description,globs:t.globs,targets:t.targets}}function SK(t){return `${vC}${JSON.stringify(IK(t))}${MC}`}function CK(t){let e=[SK(t)];return t.description.trim()&&e.push(`## ${t.description.trim()}`,""),e.push(t.body.trim(),FC),e.filter(r=>r.length>0).join(`
22
+ `)}function kK(t){return t.length===0?"":[qp,...t.map(CK),tu].join(`
23
+ `)}function lt(t,e){let r=kK(e),n=vg(t,qp,tu);return r?n?`${n}
24
24
 
25
- ${r}`:r:o}function FS(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Qj(t){try{let e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return typeof r.source!="string"||!r.source.startsWith("rules/")?null:{source:r.source,description:typeof r.description=="string"?r.description:"",globs:FS(r.globs),targets:FS(r.targets)}}catch{return null}}function qj(t,e){let r=t.trim();if(!e.trim())return r;let o=`## ${e.trim()}`;return r.startsWith(o)?r.slice(o.length).trim():r}function jS(t){let e=[],r=Kg(Ip,Rp);return {rootContent:t.replace(r,n=>{let i=n.replace(Ip,"").replace(Rp,"").trim(),a=new RegExp(`${Ll(GS)}([\\s\\S]*?)${Ll(MS)}([\\s\\S]*?)${Ll(vS)}`,"g");for(let c of i.matchAll(a)){let l=c[1],m=c[2];if(l===void 0||m===void 0)continue;let p=Qj(l);p&&e.push({...p,body:qj(m,p.description)});}return ""}).trim(),rules:e}}var Al,kl,Ip,Rp,vS,GS,MS,Mt=d(()=>{Al="<!-- agentsmesh:root-generation-contract:start -->",kl="<!-- agentsmesh:root-generation-contract:end -->",Ip="<!-- agentsmesh:embedded-rules:start -->",Rp="<!-- agentsmesh:embedded-rules:end -->",vS="<!-- agentsmesh:embedded-rule:end -->",GS="<!-- agentsmesh:embedded-rule:start ",MS=" -->";s(Ll,"escapeRegExp");s(Kg,"managedBlockPattern");s($S,"replaceManagedBlock");s(Bg,"stripManagedBlock");s(Vj,"ruleSource");s(Jj,"markerForRule");s(Yj,"embeddedRuleStart");s(Xj,"renderRule");s(Zj,"renderEmbeddedRulesBlock");s(it,"appendEmbeddedRulesBlock");s(FS,"toStringArray");s(Qj,"parseMarker");s(qj,"stripGeneratedHeading");s(jS,"extractEmbeddedRules");});function Wg(t){return t.replace(/\s+/g," ").trim()}function KS(t){let e=t.trim();if(e.includes(Al)&&e.includes(kl))return $S(e,Al,kl,Va);let r=Wg(e);if(r.includes(Wg(Va)))return e;for(let o of US)if(r.includes(Wg(o)))return e.replace(o,Va);return e?`${e}
25
+ ${r}`:r:n}function NC(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function EK(t){try{let e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return typeof r.source!="string"||!r.source.startsWith("rules/")?null:{source:r.source,description:typeof r.description=="string"?r.description:"",globs:NC(r.globs),targets:NC(r.targets)}}catch{return null}}function LK(t,e){let r=t.trim();if(!e.trim())return r;let n=`## ${e.trim()}`;return r.startsWith(n)?r.slice(n.length).trim():r}function GC(t){let e=[],r=Fg(qp,tu);return {rootContent:t.replace(r,o=>{let i=o.replace(qp,"").replace(tu,"").trim(),a=new RegExp(`${Yc(vC)}([\\s\\S]*?)${Yc(MC)}([\\s\\S]*?)${Yc(FC)}`,"g");for(let l of i.matchAll(a)){let c=l[1],m=l[2];if(c===void 0||m===void 0)continue;let p=EK(c);p&&e.push({...p,body:LK(m,p.description)});}return ""}).trim(),rules:e}}var Xc,Zc,qp,tu,FC,vC,MC,Ut=d(()=>{Xc="<!-- agentsmesh:root-generation-contract:start -->",Zc="<!-- agentsmesh:root-generation-contract:end -->",qp="<!-- agentsmesh:embedded-rules:start -->",tu="<!-- agentsmesh:embedded-rules:end -->",FC="<!-- agentsmesh:embedded-rule:end -->",vC="<!-- agentsmesh:embedded-rule:start ",MC=" -->";s(Yc,"escapeRegExp");s(Fg,"managedBlockPattern");s($C,"replaceManagedBlock");s(vg,"stripManagedBlock");s(RK,"ruleSource");s(IK,"markerForRule");s(SK,"embeddedRuleStart");s(CK,"renderRule");s(kK,"renderEmbeddedRulesBlock");s(lt,"appendEmbeddedRulesBlock");s(NC,"toStringArray");s(EK,"parseMarker");s(LK,"stripGeneratedHeading");s(GC,"extractEmbeddedRules");});function Mg(t){return t.replace(/\s+/g," ").trim()}function UC(t){let e=t.trim();if(e.includes(Xc)&&e.includes(Zc))return $C(e,Xc,Zc,ll);let r=Mg(e);if(r.includes(Mg(ll)))return e;for(let n of jC)if(r.includes(Mg(n)))return e.replace(n,ll);return e?`${e}
26
26
 
27
- ${Va}`:Va}function BS(t){let e=Bg(t,Al,kl);e=e.replace(`
27
+ ${ll}`:ll}function BC(t){let e=vg(t,Xc,Zc);e=e.replace(`
28
28
 
29
- ${Va}`,"");for(let r of US)e=e.replace(`
29
+ ${ll}`,"");for(let r of jC)e=e.replace(`
30
30
 
31
- ${r}`,"");return e.trim()}var Hg,tU,eU,rU,oU,nU,sU,iU,aU,cU,lU,mU,pU,uU,dU,gU,fU,Va,US,zg=d(()=>{Mt();Hg="AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is `.agentsmesh/`; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports.",tU="AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is the `.agentsmesh` directory at the project root; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports.",eU="AgentsMesh syncs AI coding tool configuration from a single canonical `.agentsmesh` directory. All target-specific files (`.claude/`, `.cursor/`, `AGENTS.md`, etc.) are generated artifacts \u2014 edit canonical config first, then regenerate. The import/generate contract is bidirectional and lossless: embedded or projected features round-trip without data loss.",rU="Create agents, skills, commands, rules, hooks, and MCP in `.agentsmesh`, then run `agentsmesh generate` to sync each tool's native files. Edit `.agentsmesh`, not generated outputs.",oU="Use Claude-style Markdown in `.agentsmesh`: `agents/*.md`, `commands/*.md`, and `skills/*/SKILL.md`; keep rules in `rules/*.md`, hooks in `hooks.yaml`, MCP in `mcp.json`, permissions in `permissions.yaml`, and ignore patterns in `ignore`, then run `agentsmesh generate`.",nU="Create canonical files in `.agentsmesh`: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Then run `agentsmesh generate`.",sU="`.agentsmesh` is the only folder you edit or add these files in: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Do not edit generated tool files; run `agentsmesh generate`.",iU="`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, and `merge` as needed; never edit generated tool files.",aU=Hg,cU=`## Project-Specific Rules
31
+ ${r}`,"");return e.trim()}var $g,OK,AK,wK,bK,PK,TK,xK,DK,NK,FK,vK,MK,$K,GK,jK,UK,ll,jC,Gg=d(()=>{Ut();$g="AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is `.agentsmesh/`; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports.",OK="AgentsMesh is a config sync library for AI coding tools. The only canonical source of truth is the `.agentsmesh` directory at the project root; files emitted into target formats such as `AGENTS.md`, `.claude/`, `.cursor/`, `.junie/`, and similar directories are generated artifacts. When making changes, edit canonical config first, then regenerate and verify the target outputs. Preserve the library's bidirectional contract: import native tool config into canonical form, generate back to target-specific layouts, and keep projected or embedded features round-trippable rather than treating them as plain text exports.",AK="AgentsMesh syncs AI coding tool configuration from a single canonical `.agentsmesh` directory. All target-specific files (`.claude/`, `.cursor/`, `AGENTS.md`, etc.) are generated artifacts \u2014 edit canonical config first, then regenerate. The import/generate contract is bidirectional and lossless: embedded or projected features round-trip without data loss.",wK="Create agents, skills, commands, rules, hooks, and MCP in `.agentsmesh`, then run `agentsmesh generate` to sync each tool's native files. Edit `.agentsmesh`, not generated outputs.",bK="Use Claude-style Markdown in `.agentsmesh`: `agents/*.md`, `commands/*.md`, and `skills/*/SKILL.md`; keep rules in `rules/*.md`, hooks in `hooks.yaml`, MCP in `mcp.json`, permissions in `permissions.yaml`, and ignore patterns in `ignore`, then run `agentsmesh generate`.",PK="Create canonical files in `.agentsmesh`: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Then run `agentsmesh generate`.",TK="`.agentsmesh` is the only folder you edit or add these files in: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Do not edit generated tool files; run `agentsmesh generate`.",xK="`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, and `merge` as needed; never edit generated tool files.",DK=$g,NK=`## Project-Specific Rules
32
32
 
33
- ${Hg}`,lU=`## AgentsMesh Generation Contract
33
+ ${$g}`,FK=`## AgentsMesh Generation Contract
34
34
 
35
- ${Hg}`,mU=`## AgentsMesh Generation Contract
35
+ ${$g}`,vK=`## AgentsMesh Generation Contract
36
36
 
37
- ${tU}`,pU=`## AgentsMesh Generation Contract
37
+ ${OK}`,MK=`## AgentsMesh Generation Contract
38
38
 
39
- ${eU}`,uU=`## AgentsMesh Generation Contract
39
+ ${AK}`,$K=`## AgentsMesh Generation Contract
40
40
 
41
- ${rU}`,dU=`## AgentsMesh Generation Contract
41
+ ${wK}`,GK=`## AgentsMesh Generation Contract
42
42
 
43
- ${oU}`,gU=`## AgentsMesh Generation Contract
43
+ ${bK}`,jK=`## AgentsMesh Generation Contract
44
44
 
45
- ${nU}`,fU=`## AgentsMesh Generation Contract
45
+ ${PK}`,UK=`## AgentsMesh Generation Contract
46
46
 
47
- ${sU}`,Va=`${Al}
47
+ ${TK}`,ll=`${Xc}
48
48
  ## AgentsMesh Generation Contract
49
49
 
50
- ${iU}
51
- ${kl}`;s(Wg,"normalizeWhitespace");US=[fU,gU,dU,uU,pU,mU,lU,cU,aU];s(KS,"appendAgentsmeshRootInstructionParagraph");s(BS,"stripAgentsmeshRootInstructionParagraph");});function pe(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function Ja(t){let e=await y(t);return e?k(e).frontmatter:{}}function Vt(t,e){return typeof t[e]=="string"?t[e]:void 0}function Vg(t){let e=t.hooks;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function hU(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function yU(t,e){let r=basename(t,".md")==="_root",o={...e};return delete o.root,{root:r,...o}}async function K(t,e,r){let o=await Ja(t),n=basename(t,".md")==="_root"?BS(r):r.trim(),i=yU(t,hU({...o,...e})),a={root:i.root===true,description:typeof i.description=="string"?i.description:""};a.root===false&&(a.globs=pe(i.globs));for(let[c,l]of Object.entries(i))c==="root"||c==="description"||c==="globs"||l===void 0||(a[c]=l);return P(a,n||"")}var Jg=d(()=>{T();M();zg();s(pe,"toStringArray");s(Ja,"readExistingFrontmatter");s(Vt,"readString");s(Vg,"readHooks");s(hU,"pruneUndefined");s(yU,"serializeCanonicalRuleFrontmatter");s(K,"serializeImportedRuleWithFallback");});async function ht(t,e,r){let o=await Ja(t),n=(()=>{let c=pe(o.allowedTools);return c.length>0?c:pe(o["allowed-tools"])})(),i=e.hasDescription?e.description??"":typeof o.description=="string"?o.description:"",a=e.hasAllowedTools?e.allowedTools??[]:n;return P({description:i,"allowed-tools":a},r.trim()||"")}async function ho(t,e,r){let o=await Ja(t),n=basename(dirname(t)),i=Vt(e,"name")??Vt(o,"name")??n,a=Vt(e,"description")??Vt(o,"description")??"";return P({name:i,description:a},r.trim()||"")}async function Bt(t,e,r){let o=await Ja(t),n=Object.prototype.hasOwnProperty.call(e,"tools")?pe(e.tools):(()=>{let O=pe(o.tools);return O.length>0?O:[]})(),i=Object.prototype.hasOwnProperty.call(e,"disallowedTools")?pe(e.disallowedTools):Object.prototype.hasOwnProperty.call(e,"disallowed-tools")?pe(e["disallowed-tools"]):pe(o.disallowedTools),a=Object.prototype.hasOwnProperty.call(e,"mcpServers")?pe(e.mcpServers):Object.prototype.hasOwnProperty.call(e,"mcp-servers")?pe(e["mcp-servers"]):pe(o.mcpServers),c=Object.prototype.hasOwnProperty.call(e,"skills")?pe(e.skills):pe(o.skills),l=e.maxTurns??e["max-turns"]??o.maxTurns,m=typeof l=="number"?l:Number(l??0),p=Vg(e)??Vg(o),u={name:Vt(e,"name")??Vt(o,"name")??basename(t,".md"),description:Vt(e,"description")??Vt(o,"description")??"",tools:n};i.length>0&&(u.disallowedTools=i);let g=Vt(e,"model")??Vt(o,"model");g&&(u.model=g);let f=Vt(e,"permissionMode")??Vt(e,"permission-mode")??Vt(o,"permissionMode")??Vt(o,"permission-mode");f&&(u.permissionMode=f),Number.isInteger(m)&&m>0&&(u.maxTurns=m),a.length>0&&(u.mcpServers=a),p&&Object.keys(p).length>0&&(u.hooks=p),c.length>0&&(u.skills=c);let h=Vt(e,"memory")??Vt(o,"memory");return h&&(u.memory=h),P(u,r.trim()||"")}var zS=d(()=>{M();Jg();s(ht,"serializeImportedCommandWithFallback");s(ho,"serializeImportedSkillWithFallback");s(Bt,"serializeImportedAgentWithFallback");});var lt=d(()=>{Jg();zS();});function Sp(t){let e=t.split("/").filter(Boolean);return e.length===0||e.some(o=>o.startsWith("."))?false:!e.join("/").startsWith("tests/e2e/fixtures/")}async function Ye(t){await rm$1(t,{recursive:true,force:true});}var Ya=d(()=>{s(Sp,"shouldImportScopedAgentsRule");s(Ye,"removePathIfExists");});function tt(t,e){let r=[];for(let o of t.skills){let n={name:o.name,description:o.description||void 0};n.description===void 0&&delete n.description,r.push({path:`${e}/${o.name}/SKILL.md`,content:P(n,o.body.trim()||"")});for(let i of o.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");r.push({path:`${e}/${o.name}/${a}`,content:i.content});}}return r}async function Z(t,e,r,o,n){let i=await readdir(join(t,e),{encoding:"utf8",withFileTypes:true}).catch(()=>null);if(i!==null)for(let a of i){if(!a.isDirectory())continue;let c=join(t,e,a.name),l=join(c,"SKILL.md"),m=await y(l);if(m===null)continue;let p=join(t,wl,a.name),u=join(p,"SKILL.md"),{frontmatter:g,body:f}=k(n(m,l,u)),h=hp(g,a.name);if(h){await Ye(join(t,wl,a.name));let A=join(t,VS);await L(A);let D=join(A,`${h.name}.md`);await _(D,yp(h,n(f,l,D))),o.push({fromTool:r,fromPath:l,toPath:`${VS}/${h.name}.md`,feature:"commands"});continue}let O=fo(g,a.name);if(O){await Ye(join(t,wl,a.name));let A=join(t,JS);await L(A);let D=join(A,`${O.name}.md`);await _(D,Je(O,n(f,l,D))),o.push({fromTool:r,fromPath:l,toPath:`${JS}/${O.name}.md`,feature:"agents"});continue}let R=await ho(u,{...g,name:a.name},f);await L(p),await _(u,R),o.push({fromTool:r,fromPath:l,toPath:`${wl}/${a.name}/SKILL.md`,feature:"skills"});let S=await v(c);for(let A of S){if(A===l)continue;let D=relative(c,A).replace(/\\/g,"/"),N=await y(A);if(N===null)continue;let G=join(p,D);await L(dirname(G)),await _(G,n(N,A,G)),o.push({fromTool:r,fromPath:A,toPath:`${wl}/${a.name}/${D}`,feature:"skills"});}}}var wl,VS,JS,Q=d(()=>{T();M();lt();st();St();Ya();wl=".agentsmesh/skills",VS=".agentsmesh/commands",JS=".agentsmesh/agents";s(tt,"generateEmbeddedSkills");s(Z,"importEmbeddedSkills");});var yo,Ze,oe,_n,In,Qe,Ci,YS,XS,Xa=d(()=>{yo="aider",Ze="CONVENTIONS.md",oe=".aider/skills",_n=".aiderignore",In="CONVENTIONS.md",Qe=".aider/skills",Ci=".aiderignore",YS=".agentsmesh/rules",XS=".agentsmesh/ignore";});function ZS(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(yo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:Ze,content:n}]:[]}function QS(t){return tt(t,oe)}function qS(t){return t.commands.map(e=>({path:`${oe}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function tC(t){return t.agents.map(e=>({path:`${oe}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function eC(t){return t.ignore.length===0?[]:[{path:_n,content:t.ignore.join(`
52
- `)}]}var rC=d(()=>{Q();Mt();st();St();Xa();s(ZS,"generateRules");s(QS,"generateSkills");s(qS,"generateCommands");s(tC,"generateAgents");s(eC,"generateIgnore");});async function $t(t,e,r){let o=join(t,e),i={...await LU(o),...r};await L(dirname(o)),await _(o,JSON.stringify({mcpServers:i},null,2));}async function LU(t){let e=await y(t);if(e===null)return {};let r;try{r=JSON.parse(e);}catch{return {}}if(!r||typeof r!="object"||Array.isArray(r))return {};let o=r.mcpServers;if(!o||typeof o!="object"||Array.isArray(o))return {};let n={};for(let[i,a]of Object.entries(o))!a||typeof a!="object"||Array.isArray(a)||(n[i]=a);return n}var Fr=d(()=>{T();s($t,"writeMcpWithMerge");s(LU,"readExistingServers");});function Rn(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}function qe(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function _s(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function _o(t){return !t||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}var tr=d(()=>{s(Rn,"toGlobsArray");s(qe,"toToolsArray");s(_s,"toStringArray");s(_o,"toStringRecord");});function wU(t,e){return e.some(r=>t.endsWith(r))}async function yt(t){let r=(await v(t.srcDir)).filter(n=>wU(n,t.extensions)),o=[];for(let n of r){let i=await y(n);if(!i)continue;let a=relative(t.srcDir,n).replace(/\\/g,"/"),c=await t.mapEntry({srcPath:n,relativePath:a,content:i,normalizeTo:s((l,m=i)=>t.normalize(m,n,l),"normalizeTo")});c&&(await L(dirname(c.destPath)),await _(c.destPath,c.content),o.push({fromTool:t.fromTool,fromPath:n,toPath:c.toPath,feature:c.feature}));}return o}var ke=d(()=>{T();s(wU,"matchesExtension");s(yt,"importFileDirectory");});function oC(t){return typeof t=="string"?t:void 0}function TU(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}function Xg(t,e){return e?e(t):t}function bU(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:o,body:n}=k(e.normalizeTo(r)),i=Xg(o,t.frontmatterRemap),a=TU({root:false,description:oC(i.description),globs:Array.isArray(i.globs)?i.globs:void 0,...i});return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await K(r,a,n)}}}function PU(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:o,body:n}=k(e.normalizeTo(r)),i=Xg(o,t.frontmatterRemap),a=await ht(r,{hasDescription:true,description:oC(i.description),hasAllowedTools:true,allowedTools:_s(i["allowed-tools"])},n);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:a}}}function xU(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:o,body:n}=k(e.normalizeTo(r)),i=Xg(o,t.frontmatterRemap);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await Bt(r,i,n)}}}function nC(t){if(t.map)return t.map;switch(t.preset){case "rule":return bU(t);case "command":return PU(t);case "agent":return xU(t);default:throw new Error(`ImportFeatureSpec for ${t.feature} (mode: ${t.mode}) needs a \`preset\` or \`map\``)}}var sC=d(()=>{M();lt();tr();s(oC,"pickString");s(TU,"pruneUndefined");s(Xg,"applyRemap");s(bU,"ruleMapper");s(PU,"commandMapper");s(xU,"agentMapper");s(nC,"resolveMapper");});function Zg(t,e){return t?t[e]??[]:[]}var iC,aC=d(()=>{iC=["rules","commands","agents","skills","mcp","hooks","permissions","ignore"];s(Zg,"resolveScopedSources");});async function FU(t,e,r,o,n){if(!t.canonicalRootFilename)throw new Error(`singleFile spec for ${t.feature} must set canonicalRootFilename`);let i=join(r,t.canonicalDir);for(let a of e){let c=join(r,a),l=await y(c);if(l===null)continue;await L(i);let m=join(i,t.canonicalRootFilename),p=s(R=>n(l,c,R),"normalizeTo");if(t.map){let R=await t.map({absolutePath:c,relativePath:a,content:l,destDir:i,normalizeTo:p});if(!R)continue;return await _(R.destPath,R.content),[{fromTool:o,fromPath:c,toPath:R.toPath,feature:t.feature}]}let{frontmatter:u,body:g}=k(p(m)),f=t.frontmatterRemap?t.frontmatterRemap(u):u,h=t.markAsRoot?{...f,root:true}:f,O=await K(m,h,g);return await _(m,O),[{fromTool:o,fromPath:c,toPath:`${t.canonicalDir}/${t.canonicalRootFilename}`,feature:t.feature}]}return []}async function vU(t,e,r,o,n){let i=nC(t),a=join(r,t.canonicalDir),c=[];for(let l of e){let m=join(r,l),p=await yt({srcDir:m,destDir:a,extensions:[...t.extensions??[".md"]],fromTool:o,normalize:n,mapEntry:s(async({srcPath:u,relativePath:g,content:f,normalizeTo:h})=>{let O=await i({absolutePath:u,relativePath:g,content:f,destDir:a,normalizeTo:s(R=>h(R),"normalizeTo")});return O?{destPath:O.destPath,toPath:O.toPath,feature:t.feature,content:O.content}:null},"mapEntry")});c.push(...p);}return c}function lC(t){let e=t.canonicalFilename;return e.includes("/")||e.includes("\\")?e:posix.join(t.canonicalDir,e)}async function GU(t,e,r,o){if(!t.canonicalFilename)throw new Error(`flatFile spec for ${t.feature} must set canonicalFilename`);let n=lC(t);for(let i of e){let a=join(r,i),c=await y(a);if(c===null)continue;let l=join(r,n);return await L(dirname(l)),await _(l,c.trimEnd()),[{fromTool:o,fromPath:a,toPath:n,feature:t.feature}]}return []}function MU(t){let e;try{e=JSON.parse(t);}catch{return {}}if(!e||typeof e!="object")return {};let r=e.mcpServers;if(!r||typeof r!="object"||Array.isArray(r))return {};let o={};for(let[n,i]of Object.entries(r)){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,c=typeof a.description=="string"?a.description:void 0;if(typeof a.command=="string"){o[n]={type:typeof a.type=="string"?a.type:"stdio",command:a.command,args:_s(a.args),env:_o(a.env),description:c};continue}typeof a.url=="string"&&(o[n]={type:typeof a.type=="string"?a.type:"http",url:a.url,headers:_o(a.headers),env:_o(a.env),description:c});}return o}async function $U(t,e,r,o){if(!t.canonicalFilename)throw new Error(`mcpJson spec for ${t.feature} must set canonicalFilename`);let n=lC(t);for(let i of e){let a=join(r,i),c=await y(a);if(c===null)continue;let l=MU(c);return Object.keys(l).length===0?[]:(await $t(r,n,l),[{fromTool:o,fromPath:a,toPath:n,feature:t.feature}])}return []}function cC(t,e,r,o,n){switch(t.mode){case "singleFile":return FU(t,e,r,o,n);case "directory":return vU(t,e,r,o,n);case "flatFile":return GU(t,e,r,o);case "mcpJson":return $U(t,e,r,o)}}async function jU(t,e,r,o,n){let i=Zg(t.source,e),a=Zg(t.fallbacks,e);if(i.length===0&&a.length===0)return [];if(i.length>0){let c=await cC(t,i,r,o,n);if(c.length>0)return c}return a.length>0?cC(t,a,r,o,n):[]}function UU(t,e){let r=t[e];return r?Array.isArray(r)?r:[r]:[]}async function z(t,e,r,o){let n=t.importer;if(!n)return [];let i=o?.normalize??await U(t.id,e,r),a=[];for(let c of iC)for(let l of UU(n,c))a.push(...await jU(l,r,e,t.id,i));return a}var Ct=d(()=>{mt();T();Fr();M();tr();lt();ke();sC();aC();s(FU,"runSingleFile");s(vU,"runDirectory");s(lC,"resolveCanonicalFilePath");s(GU,"runFlatFile");s(MU,"parseMcpJson");s($U,"runMcpJson");s(cC,"dispatchSpec");s(jU,"runSpec");s(UU,"specsForFeature");s(z,"runDescriptorImport");});async function mC(t,e={}){let r=e.scope??"project",o=[],n=await U(yo,t,r);return o.push(...await z(Cp,t,r,{normalize:n})),await Z(t,r==="global"?Qe:oe,yo,o,n),o}var pC=d(()=>{mt();Q();Ct();Xa();Qg();s(mC,"importFromAider");});function KU(t,e){return dC(e).some(o=>BU(t,o))}function uC(t,e){return t.filter(r=>KU(r,e))}function dC(t){let e=t.match(/^(.+)\{([^}]+)\}(.*)$/);if(!e)return [t];let[,r,o,n]=e;if(!o)return [t];let i=o.split(",").map(c=>c.trim()),a=[];for(let c of i)for(let l of dC(r+c+n))a.push(l);return a}function BU(t,e){return WU(e).test(t)}function WU(t){let e=[],r=0;for(;r<t.length;){if(t.startsWith("**",r)){let i=t.slice(r+2);if(i.length===0&&e.length===0)e.push(".*");else if(e.push(i.startsWith("/")?"(?:[^/]+/)*":"(?:/[^/]+)*?"),i.startsWith("/")){r+=3;continue}r+=2;continue}if(t[r]==="*"){e.push("[^/]*"),r+=1;continue}if(t[r]==="?"){e.push("[^/]"),r+=1;continue}if(t[r]==="{"){e.push("(?:"),r+=1;continue}if(t[r]==="}"){e.push(")"),r+=1;continue}if(t[r]===","){e.push("|"),r+=1;continue}".^$+?()[]{}|\\".includes(t[r])?e.push("\\"+t[r]):e.push(t[r]),r+=1;}let o="^"+e.join("")+"$";return new RegExp(o)}var gC=d(()=>{s(KU,"globMatch");s(uC,"globFilter");s(dC,"expandBraces");s(BU,"matchOne");s(WU,"globToRegex");});function H(t,e,r,o={}){let n=[],{rules:i}=t;if(i.length===0)return [];if(i.some(c=>c.root)||n.push({level:"error",file:relative(e,i[0].source),message:"Rules exist but no root rule (_root.md or root: true). Add a root rule."}),o.checkGlobMatches===false)return n;for(let c of i){if(c.globs.length===0)continue;let l=false;for(let m of c.globs)if(uC(r,m).length>0){l=true;break}l||n.push({level:"warning",file:relative(e,c.source),message:`globs "${c.globs.join(", ")}" match 0 files in project`});}return n}var _t=d(()=>{gC();s(H,"validateRules");});function hC(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:yo}))}var yC=d(()=>{_t();Xa();s(hC,"lintRules");});function b(t,e,r){return {level:"warning",file:t,target:e,message:r}}function HU(t){return t.length===0?"":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function Rs(t,e,r,o){let n=o?.unsupportedBy??e,i=HU(r);return b(".agentsmesh/hooks.yaml",e,`${t} is not supported by ${n}; only ${i} are projected.`)}var Et=d(()=>{s(b,"createWarning");s(HU,"formatOxfordComma");s(Rs,"createUnsupportedHookWarning");});function _C(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","aider","Aider has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function IC(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","aider","Aider has no permissions config; canonical permissions are not projected.")]}function RC(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","aider","Aider has no MCP config file; canonical MCP servers are not projected.")]}var SC=d(()=>{Et();s(_C,"lintHooks");s(IC,"lintPermissions");s(RC,"lintMcp");});function C(t,e){return et(t).relative(t,e).replace(/\\/g,"/")}async function E(t,e){return v(et(t).join(t,e)).catch(()=>[])}function EC(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}function ZU(t,e,r,o){let n=posix.dirname(e),i=posix.dirname(r);for(;n!==o&&n!==".";)EC(t,n,i),n=posix.dirname(n),i=posix.dirname(i);}function x(t,e,r,o){t.set(e,`${r}/${basename(e,o)}.md`);}function F(t,e,r){if(!e.startsWith(`${r}/`))return;let o=e.slice(r.length+1);if(!o)return;if(!o.includes("/")){if(!o.endsWith(".md")||basename(o)==="SKILL.md")return;let u=basename(o,".md");t.set(e,`${CC}/${u}/SKILL.md`);return}let[n,...i]=o.split("/"),a=i.join("/");if(!n||!a)return;let c=n.startsWith(Ha)?Ha:n.startsWith(El)?El:null;if(c&&a==="SKILL.md"){t.set(e,`${YU}/${n.slice(c.length)}.md`);return}let l=n.startsWith(za)?za:n.startsWith(Ol)?Ol:null;if(l&&a==="SKILL.md"){t.set(e,`${XU}/${n.slice(l.length)}.md`);return}let m=`${CC}/${n}`;a==="SKILL.md"&&EC(t,`${r}/${n}`,m);let p=`${m}/${a}`;t.set(e,p),a!=="SKILL.md"&&ZU(t,e,p,`${r}/${n}`);}function QU(t){return t.split("/").filter(Boolean)[0]??""}async function qU(){if(qg!==void 0)return qg;let{BUILTIN_TARGETS:t}=await Promise.resolve().then(()=>(xt(),OC)),e=new Set;for(let r of t)for(let o of [r.project.rootInstructionPath,r.project.skillDir,...r.project.managedOutputs?.dirs??[],...r.project.managedOutputs?.files??[],...r.detectionPaths,r.globalSupport?.layout.rootInstructionPath,r.globalSupport?.layout.skillDir,...r.globalSupport?.layout.managedOutputs?.dirs??[],...r.globalSupport?.layout.managedOutputs?.files??[],...r.globalSupport?.detectionPaths??[]])if(o!==void 0){let n=QU(o);n.startsWith(".")&&e.add(n);}return qg=e,e}function ef(t){return t.split("/").some(e=>e.startsWith("."))}async function t0(t){let e=[],r=await qU(),o=et(t);async function n(i){let a=o.join(t,i),c=await readdir(a,{withFileTypes:true}).catch(()=>[]);for(let l of c){let m=i?`${i}/${l.name}`:l.name;if(l.isDirectory()){if(r.has(l.name)||ef(m))continue;await n(m);continue}if(l.isSymbolicLink()&&await stat(o.join(t,m)).then(p=>p.isDirectory(),()=>false)){if(r.has(l.name)||ef(m))continue;await n(m);continue}(l.name==="AGENTS.md"||l.name==="AGENTS.override.md")&&e.push(o.join(t,m));}}return s(n,"walk"),await n(""),e}async function Ep(t,e){let r=await t0(e);for(let o of r){let n=C(e,o),i=n.endsWith("/AGENTS.md")&&n!=="AGENTS.md"&&!n.endsWith("/AGENTS.override.md"),a=n.endsWith("/AGENTS.override.md")&&n!=="AGENTS.override.md";if(!i&&!a)continue;let c=posix.dirname(n);if(ef(c))continue;let l=c.replace(/\//g,"-");t.set(n,`${JU}/${l}.md`);}}var JU,YU,XU,CC,qg,It=d(()=>{re();T();St();st();JU=".agentsmesh/rules",YU=".agentsmesh/commands",XU=".agentsmesh/agents",CC=".agentsmesh/skills";s(C,"rel");s(E,"listFiles");s(EC,"addDirectoryMapping");s(ZU,"addAncestorMappings");s(x,"addSimpleFileMapping");s(F,"addSkillLikeMapping");s(QU,"firstPathSegment");s(qU,"targetRootSegments");s(ef,"hasHiddenSegment");s(t0,"listScopedAgentsFiles");s(Ep,"addScopedAgentsMappings");});var w,rt,Ot,gt=d(()=>{w=".agentsmesh/rules",rt=".agentsmesh/commands",Ot=".agentsmesh/agents";});async function rf(t,e,r="project"){if(r==="global"){t.set(In,`${w}/_root.md`);for(let o of await E(e,Qe))F(t,C(e,o),Qe);t.set(Ci,".agentsmesh/ignore");return}t.set(Ze,`${w}/_root.md`);for(let o of await E(e,oe))F(t,C(e,o),oe);t.set(_n,".agentsmesh/ignore");}var LC=d(()=>{It();Xa();gt();s(rf,"buildAiderImportPaths");});var Ei,vr,Oi,Ss,bl,AC,kC,Pl=d(()=>{Ei="amazon-q",vr=".amazonq/rules",Oi=".amazonq/mcp.json",Ss=".aws/amazonq/rules",bl=".aws/amazonq/mcp.json",AC=".agentsmesh/rules",kC=".agentsmesh/mcp.json";});async function of(t,e,r="project"){let o=r==="global"?Ss:vr;for(let n of await E(e,o)){let i=C(e,n);x(t,i,w,".md");}}var wC=d(()=>{It();Pl();gt();s(of,"buildAmazonQImportPaths");});var er,ne,Io,nf,Sn,rr,Cn,TC,Li=d(()=>{er="AGENTS.md",ne=".agents/skills",Io=".amp/settings.json",nf=".config/amp",Sn=`${nf}/AGENTS.md`,rr=`${nf}/skills`,Cn=`${nf}/settings.json`,TC=".agentsmesh/rules";});async function sf(t,e,r="project"){if(r==="global"){t.set(Sn,`${w}/_root.md`);for(let o of await E(e,rr))F(t,C(e,o),rr);t.set(Cn,".agentsmesh/mcp.json");return}t.set(er,`${w}/_root.md`);for(let o of await E(e,ne))F(t,C(e,o),ne);t.set(Io,".agentsmesh/mcp.json");}var bC=d(()=>{It();Li();gt();s(sf,"buildAmpImportPaths");});var Ai,Op,Ro,Gr,xl,Mr,En,Dl,So,On,Nl,Za,af,ki,Lp,PC,wi=d(()=>{Ai="antigravity",Op=".agents",Ro=`${Op}/rules`,Gr=`${Ro}/general.md`,xl=`${Ro}/_root.md`,Mr=`${Op}/skills`,En=`${Op}/workflows`,Dl=`${Op}/antigravity/mcp_config.json`,So=".gemini/antigravity/GEMINI.md",On=".gemini/antigravity/skills",Nl=".gemini/antigravity/workflows",Za=".gemini/antigravity/mcp_config.json",af=".agentsmesh/rules/_root.md",ki=".agentsmesh/rules",Lp=".agentsmesh/commands",PC=".agentsmesh/mcp.json";});async function cf(t,e,r="project"){if(r==="global"){t.set(So,`${w}/_root.md`);for(let o of await E(e,On))F(t,C(e,o),On);t.set(Za,".agentsmesh/mcp.json");return}t.set(Gr,`${w}/_root.md`),t.set(xl,`${w}/_root.md`);for(let o of await E(e,Ro)){let n=C(e,o);n===Gr||n===xl||x(t,n,w,".md");}for(let o of await E(e,En))x(t,C(e,o),rt,".md");for(let o of await E(e,Mr))F(t,C(e,o),Mr);}var xC=d(()=>{It();wi();gt();s(cf,"buildAntigravityImportPaths");});var se,Ap,we,or,Te,Co,Eo,kp,Ln,An,Oo,kn,lf,mf,pf,uf,Ti=d(()=>{se="augment-code",Ap=".augment",we=`${Ap}/rules`,or=`${Ap}/commands`,Te=`${Ap}/skills`,Co=`${Ap}/settings.json`,Eo=".augmentignore",kp=".augment",Ln=`${kp}/rules`,An=`${kp}/commands`,Oo=`${kp}/skills`,kn=`${kp}/settings.json`,lf=".agentsmesh/rules",mf=".agentsmesh/mcp.json",pf=".agentsmesh/hooks.yaml",uf=".agentsmesh/ignore";});async function df(t,e,r="project"){if(r==="global"){for(let o of await E(e,Ln))x(t,C(e,o),w,".md");for(let o of await E(e,An))x(t,C(e,o),rt,".md");for(let o of await E(e,Oo))F(t,C(e,o),Oo);t.set(kn,".agentsmesh/mcp.json");return}for(let o of await E(e,we))x(t,C(e,o),w,".md");for(let o of await E(e,or))x(t,C(e,o),rt,".md");for(let o of await E(e,Te))F(t,C(e,o),Te);t.set(Co,".agentsmesh/mcp.json"),t.set(Eo,".agentsmesh/ignore");}var DC=d(()=>{It();Ti();gt();s(df,"buildAugmentCodeImportPaths");});var NC,Cs,FC,Fl,vl,Gl,Ml,$l,wn,gf,jl,Qa,Ul,Kl,wp,Tp,ff,Bl,hf,bi,vC,Tn=d(()=>{NC="claude-code",Cs=".claude/CLAUDE.md",FC="CLAUDE.md",Fl=".claude/rules",vl=".claude/commands",Gl=".claude/agents",Ml=".claude/skills",$l=".claude/settings.json",wn=".claude/hooks.json",gf=".claude/output-styles",jl=".claudeignore",Qa=".mcp.json",Ul=".claude.json",Kl=".agentsmesh/rules",wp=".agentsmesh/commands",Tp=".agentsmesh/agents",ff=".agentsmesh/skills",Bl=".agentsmesh/mcp.json",hf=".agentsmesh/permissions.yaml",bi=".agentsmesh/hooks.yaml",vC=".agentsmesh/ignore";});async function yf(t,e,r="project"){if(t.set(".claude/CLAUDE.md",`${w}/_root.md`),t.set(wn,bi),r==="project"&&t.set("CLAUDE.md",`${w}/_root.md`),r==="global")for(let o of await E(e,".agents/skills"))F(t,C(e,o),".agents/skills");for(let o of await E(e,".claude/rules"))x(t,C(e,o),w,".md");for(let o of await E(e,".claude/commands"))x(t,C(e,o),rt,".md");for(let o of await E(e,".claude/agents"))x(t,C(e,o),Ot,".md");for(let o of await E(e,".claude/skills"))F(t,C(e,o),".claude/skills");}var GC=d(()=>{It();Tn();gt();s(yf,"buildClaudeCodeImportPaths");});var Es,bn,Pi,Pn,MC,Jt,Lo,Os,xi,Di,Ni,Fi,_f,Ls,bp,If,Rf,Sf,$C,nr=d(()=>{Es="cline",bn=".clinerules",Pi=".clineignore",Pn=".cline/cline_mcp_settings.json",MC=".cline/mcp_settings.json",Jt=".cline/skills",Lo=".clinerules/workflows",Os="AGENTS.md",xi=".clinerules/hooks",Di="Documents/Cline/Rules",Ni="Documents/Cline/Workflows",Fi="Documents/Cline/Hooks",_f=".agentsmesh/hooks.yaml",Ls=".agentsmesh/rules",bp=".agentsmesh/commands",If=".agentsmesh/ignore",Rf=".agentsmesh/mcp.json",Sf=".agentsmesh/agents",$C=".agentsmesh/skills";});async function Cf(t,e,r="project"){if(r==="global"){for(let o of await E(e,Di))x(t,C(e,o),w,".md");for(let o of await E(e,Ni))x(t,C(e,o),rt,".md");for(let o of await E(e,Jt))F(t,C(e,o),Jt);t.set(Pn,".agentsmesh/mcp.json");return}t.set(".clinerules/_root.md",`${w}/_root.md`);for(let o of await E(e,".clinerules")){let n=C(e,o);!n.endsWith(".md")||n.includes("/workflows/")||basename(n)==="_root.md"||x(t,n,w,".md");}for(let o of await E(e,".clinerules/workflows"))x(t,C(e,o),rt,".md");for(let o of await E(e,".cline/skills"))F(t,C(e,o),".cline/skills");}var jC=d(()=>{It();nr();gt();s(Cf,"buildClineImportPaths");});async function Ef(t,e,r="project"){if(r==="global"?(t.set(".codex/AGENTS.md",`${w}/_root.md`),t.set(".codex/AGENTS.override.md",`${w}/_root.md`)):(t.set("AGENTS.md",`${w}/_root.md`),t.set("codex.md",`${w}/_root.md`),await Ep(t,e)),r==="project")for(let o of await E(e,".codex/instructions"))x(t,C(e,o),w,".md");for(let o of await E(e,".codex/rules")){let n=C(e,o);n.endsWith(".rules")?x(t,n,w,".rules"):n.endsWith(".md")&&x(t,n,w,".md");}for(let o of await E(e,".codex/agents"))x(t,C(e,o),Ot,".toml");for(let o of await E(e,".agents/skills"))F(t,C(e,o),".agents/skills");}var UC=d(()=>{It();gt();s(Ef,"buildCodexCliImportPaths");});var qa,$r,Ao,Of,Pp,xn,Lf,be,tc,Wl,xp,Dp,Af,ko=d(()=>{qa="continue",$r=".continue/rules",Ao=".continue/prompts",Of=".continue/mcpServers",Pp=`${Of}/agentsmesh.json`,xn=`${$r}/general.md`,Lf=`${$r}/_root.md`,be=".continue/skills",tc=".continue/AGENTS.md",Wl=".continue/config.yaml",xp=".agentsmesh/rules",Dp=".agentsmesh/commands",Af=".agentsmesh/mcp.json";});async function kf(t,e,r="project"){t.set(xn,`${w}/_root.md`),t.set(Lf,`${w}/_root.md`);for(let o of await E(e,".continue/rules")){let n=C(e,o);n===xn||n===Lf||x(t,n,w,".md");}for(let o of await E(e,".continue/prompts"))t.set(C(e,o),`${rt}/${basename(o,".md")}.md`);for(let o of await E(e,".continue/skills"))F(t,C(e,o),".continue/skills");if(r==="global")for(let o of await E(e,".agents/skills"))F(t,C(e,o),".agents/skills");}var KC=d(()=>{It();ko();gt();s(kf,"buildContinueImportPaths");});function o0(t,e){if(e.endsWith(".instructions.md")){t.set(e,`${w}/${basename(e,".instructions.md")}.md`);return}x(t,e,w,".md");}async function wf(t,e){t.set(".github/copilot-instructions.md",`${w}/_root.md`);for(let r of await E(e,".github/copilot"))t.set(C(e,r),`${w}/${basename(r,".instructions.md")}.md`);for(let r of await E(e,".github/instructions"))o0(t,C(e,r));for(let r of await E(e,".github/prompts"))t.set(C(e,r),`${rt}/${basename(r,".prompt.md")}.md`);for(let r of await E(e,".github/agents"))t.set(C(e,r),`${Ot}/${basename(r,".agent.md")}.md`);for(let r of await E(e,".github/skills"))F(t,C(e,r),".github/skills");}var BC=d(()=>{It();gt();s(o0,"addCopilotInstructionMapping");s(wf,"buildCopilotImportPaths");});var sr,ir,Yt,Pe,Dn,WC,Fp,xe,vi,vp,Gp,Mp,ec=d(()=>{sr="crush",ir="CRUSH.md",Yt=".crush/skills",Pe="crush.json",Dn=".crushignore",WC=".config/crush",Fp=`${WC}/crush.json`,xe=".config/crush/skills",vi=`${WC}/CRUSH.md`,vp=".agentsmesh/rules",Gp=".agentsmesh/ignore",Mp=".agentsmesh/mcp.json";});async function Tf(t,e,r="project"){if(r==="global"){for(let o of await E(e,xe))F(t,C(e,o),xe);return}t.set(ir,`${vp}/_root.md`),t.set(Pe,Mp),t.set(Dn,Gp);for(let o of await E(e,Yt))F(t,C(e,o),Yt);}var HC=d(()=>{It();ec();s(Tf,"buildCrushImportPaths");});var zC,As,VC,ar,Nn,cr,rc,wo,To,bo,$p,jr,bf,n0,oc,Ur,Hl,ks,ws,Po,Ts,bs,JC,nc,Pf,zl,xf,jt=d(()=>{zC="cursor",As="AGENTS.md",VC=".cursorrules",ar=".cursor/rules",Nn=`${ar}/general.mdc`,cr=".cursor/commands",rc=".cursor/agents",wo=".cursor/skills",To=".cursor/mcp.json",bo=".cursor/hooks.json",$p=".cursor/settings.json",jr=".cursorignore",bf=".cursorindexingignore",n0=".agentsmesh-exports/cursor",oc=`${n0}/user-rules.md`,Ur=".cursor/AGENTS.md",Hl=To,ks=wo,ws=rc,Po=".agentsmesh/rules",Ts=".agentsmesh/commands",bs=".agentsmesh/agents",JC=".agentsmesh/skills",nc=".agentsmesh/mcp.json",Pf=".agentsmesh/permissions.yaml",zl=".agentsmesh/hooks.yaml",xf=".agentsmesh/ignore";});async function Df(t,e,r="project"){if(r==="global"){t.set(To,".agentsmesh/mcp.json"),t.set(".cursor/AGENTS.md",`${w}/_root.md`);for(let o of await E(e,".cursor/rules"))x(t,C(e,o),w,".mdc");for(let o of await E(e,".cursor/commands"))x(t,C(e,o),rt,".md");for(let o of await E(e,".cursor/agents"))x(t,C(e,o),Ot,".md");for(let o of await E(e,".cursor/skills"))F(t,C(e,o),".cursor/skills");return}t.set("AGENTS.md",`${w}/_root.md`);for(let o of await E(e,".cursor/rules"))x(t,C(e,o),w,".mdc");for(let o of await E(e,".cursor/commands"))x(t,C(e,o),rt,".md");for(let o of await E(e,".cursor/agents"))x(t,C(e,o),Ot,".md");for(let o of await E(e,".cursor/skills"))F(t,C(e,o),".cursor/skills");}var YC=d(()=>{It();jt();gt();s(Df,"buildCursorImportPaths");});var xo,lr,ie,Fn,vn,Kr,Gi,XC,sc=d(()=>{xo="deepagents-cli",lr=".deepagents/AGENTS.md",ie=".deepagents/skills",Fn=".mcp.json",vn=".deepagents/AGENTS.md",Kr=".deepagents/skills",Gi=".deepagents/.mcp.json",XC=".agentsmesh/rules";});async function Nf(t,e,r="project"){if(r==="global"){t.set(vn,`${w}/_root.md`);for(let o of await E(e,Kr))F(t,C(e,o),Kr);t.set(Gi,".agentsmesh/mcp.json");return}t.set(lr,`${w}/_root.md`);for(let o of await E(e,ie))F(t,C(e,o),ie);t.set(Fn,".agentsmesh/mcp.json");}var ZC=d(()=>{It();sc();gt();s(Nf,"buildDeepagentsCliImportPaths");});var mr,pr,_e,Do,No,Gn,Fo,Mi,Ps,QC,$i=d(()=>{mr="factory-droid",pr="AGENTS.md",_e=".factory/skills",Do=".factory/droids",No=".factory/mcp.json",Gn=".factory/AGENTS.md",Fo=".factory/skills",Mi=".factory/droids",Ps=".factory/mcp.json",QC=".agentsmesh/rules";});async function Ff(t,e,r="project"){if(r==="global"){t.set(Gn,`${w}/_root.md`);for(let o of await E(e,Mi))x(t,C(e,o),Ot,".md");for(let o of await E(e,Fo))F(t,C(e,o),Fo);t.set(Ps,".agentsmesh/mcp.json");return}t.set(pr,`${w}/_root.md`);for(let o of await E(e,Do))x(t,C(e,o),Ot,".md");for(let o of await E(e,_e))F(t,C(e,o),_e);t.set(No,".agentsmesh/mcp.json");}var qC=d(()=>{It();$i();gt();s(Ff,"buildFactoryDroidImportPaths");});async function vf(t,e){for(let r of await E(e,".gemini/rules"))x(t,C(e,r),w,".md");for(let r of await E(e,".gemini/commands")){let o=C(e,r);if(!o.endsWith(".toml")&&!o.endsWith(".md"))continue;let n=o.replace(/\.(toml|md)$/i,""),i=".gemini/commands/",l=(n.startsWith(i)?n.slice(i.length):n).split("/").filter(Boolean).join(":");t.set(o,`${rt}/${l}.md`);}for(let r of await E(e,".gemini/agents"))x(t,C(e,r),Ot,".md");for(let r of await E(e,".gemini/skills"))F(t,C(e,r),".gemini/skills");}var tE=d(()=>{It();gt();s(vf,"buildGeminiCliImportPaths");});var vo,ur,ue,Mn,eE,$n,ji,dr,rE,oE,ic=d(()=>{vo="goose",ur=".goosehints",ue=".agents/skills",Mn=".gooseignore",eE=".config/goose",$n=`${eE}/.goosehints`,ji=`${eE}/.gooseignore`,dr=".agents/skills",rE=".agentsmesh/rules",oE=".agentsmesh/ignore";});async function Gf(t,e,r="project"){if(r==="global"){t.set($n,`${w}/_root.md`);for(let o of await E(e,dr))F(t,C(e,o),dr);t.set(ji,".agentsmesh/ignore");return}t.set(ur,`${w}/_root.md`);for(let o of await E(e,ue))F(t,C(e,o),ue);t.set(Mn,".agentsmesh/ignore");}var nE=d(()=>{It();ic();gt();s(Gf,"buildGooseImportPaths");});var jn,Br,sE,ac=d(()=>{jn="jules",Br="AGENTS.md",sE=".agentsmesh/rules";});async function Mf(t,e,r="project"){r!=="global"&&t.set(Br,`${w}/_root.md`);}var iE=d(()=>{ac();gt();s(Mf,"buildJulesImportPaths");});var Ui,xs,jp,aE,Go,cE,s0,Vl,Ki,Jl,cc,lc,Yl,Xl,Zl,Ql,ql,i0,Up,Bi,lE,$f,Kp,mE,pE,uE,dE,mc=d(()=>{Ui="junie",xs=".junie",jp=`${xs}/guidelines.md`,aE=`${xs}/ci-guidelines.md`,Go=`${xs}/AGENTS.md`,cE="AGENTS.md",s0=`${xs}/mcp`,Vl=`${s0}/mcp.json`,Ki=`${xs}/skills`,Jl=`${xs}/rules`,cc=`${xs}/commands`,lc=`${xs}/agents`,Yl=".aiignore",Xl=".junie",Zl=`${Xl}/skills`,Ql=`${Xl}/agents`,ql=`${Xl}/commands`,i0=`${Xl}/mcp`,Up=`${i0}/mcp.json`,Bi=`${Xl}/AGENTS.md`,lE=".agents/skills",$f=".agentsmesh/rules/_root.md",Kp=".agentsmesh/rules",mE=".agentsmesh/commands",pE=".agentsmesh/agents",uE=".agentsmesh/mcp.json",dE=".agentsmesh/ignore";});async function jf(t,e){t.set(jp,`${w}/_root.md`),t.set(Go,`${w}/_root.md`),t.set("AGENTS.md",`${w}/_root.md`);for(let r of await E(e,".junie/rules"))x(t,C(e,r),w,".md");for(let r of await E(e,".junie/commands"))x(t,C(e,r),rt,".md");for(let r of await E(e,".junie/agents"))x(t,C(e,r),Ot,".md");for(let r of await E(e,".junie/skills"))F(t,C(e,r),".junie/skills");}var gE=d(()=>{It();mc();gt();s(jf,"buildJunieImportPaths");});var de,tm,Mo,Un,Kn,Bn,Wr,Ds,pc,Bp,Wi,uc,Hi,em,Wp,dc,Ns,zi,Vi,Ji,Fs,gc,Hp,fE,vs,fc,Yi,hE,yE,Xi=d(()=>{de="kilo-code",tm=".kilo",Mo="AGENTS.md",Un=`${tm}/rules`,Kn=`${tm}/commands`,Bn=`${tm}/agents`,Wr=`${tm}/skills`,Ds=`${tm}/mcp.json`,pc=".kilocodeignore",Bp=".kilocode",Wi=`${Bp}/rules`,uc=`${Bp}/workflows`,Hi=`${Bp}/skills`,em=`${Bp}/mcp.json`,Wp=".kilocodemodes",dc=".kilo",Ns=`${dc}/AGENTS.md`,zi=`${dc}/rules`,Vi=`${dc}/commands`,Ji=`${dc}/agents`,Fs=`${dc}/skills`,gc=`${dc}/mcp.json`,Hp=".kilocodeignore",fE=".agents/skills",vs=".agentsmesh/rules",fc=".agentsmesh/commands",Yi=".agentsmesh/agents",hE=".agentsmesh/mcp.json",yE=".agentsmesh/ignore";});async function Uf(t,e,r="project"){if(r==="global"){t.set(Ns,`${w}/_root.md`);for(let o of await E(e,zi))x(t,C(e,o),w,".md");for(let o of await E(e,Vi))x(t,C(e,o),rt,".md");for(let o of await E(e,Ji))x(t,C(e,o),Ot,".md");for(let o of await E(e,Fs))F(t,C(e,o),Fs);t.set(gc,".agentsmesh/mcp.json");return}t.set(Mo,`${w}/_root.md`);for(let o of await E(e,Un))x(t,C(e,o),w,".md");for(let o of await E(e,Kn))x(t,C(e,o),rt,".md");for(let o of await E(e,Bn))x(t,C(e,o),Ot,".md");for(let o of await E(e,Wr))F(t,C(e,o),Wr);t.set(Ds,".agentsmesh/mcp.json");for(let o of await E(e,Wi)){let n=C(e,o);if(basename(n)==="00-root.md"){t.set(n,`${w}/_root.md`);continue}x(t,n,w,".md");}for(let o of await E(e,uc))x(t,C(e,o),rt,".md");for(let o of await E(e,Hi))F(t,C(e,o),Hi);t.set(em,".agentsmesh/mcp.json");}var _E=d(()=>{It();Xi();gt();s(Uf,"buildKiloCodeImportPaths");});var De,Hr,rm,zr,ge,Vr,Gs,IE,hc,yc,Zi,Jr,Ms,Qi,om,nm,RE,Kf,Bf,SE,CE,Wf,EE,_c=d(()=>{De="kiro",Hr="AGENTS.md",rm=".kiro",zr=`${rm}/steering`,ge=`${rm}/skills`,Vr=`${rm}/agents`,Gs=`${rm}/hooks`,IE=`${rm}/settings`,hc=`${IE}/mcp.json`,yc=".kiroignore",Zi=".kiro/steering",Jr=".kiro/steering/AGENTS.md",Ms=".kiro/skills",Qi=".kiro/agents",om=".kiro/settings/mcp.json",nm=".kiro/settings/kiroignore",RE=".agents/skills",Kf=".agentsmesh/rules/_root.md",Bf=".agentsmesh/rules",SE=".agentsmesh/agents",CE=".agentsmesh/mcp.json",Wf=".agentsmesh/hooks.yaml",EE=".agentsmesh/ignore";});async function Hf(t,e,r="project"){if(r==="global"){t.set(Jr,`${w}/_root.md`);for(let o of await E(e,Zi)){let n=C(e,o);n!==Jr&&x(t,n,w,".md");}for(let o of await E(e,Ms))F(t,C(e,o),Ms);for(let o of await E(e,Qi))x(t,C(e,o),Ot,".md");return}t.set(Hr,`${w}/_root.md`);for(let o of await E(e,zr))x(t,C(e,o),w,".md");for(let o of await E(e,ge))F(t,C(e,o),ge);for(let o of await E(e,Vr))x(t,C(e,o),Ot,".md");}var OE=d(()=>{It();_c();gt();s(Hf,"buildKiroImportPaths");});var Yr,zp,$o,Wn,Hn,zn,Xr,jo,Ic,$s,qi,ta,ea,js,Us,LE,sm,Vp,Jp,zf,ra=d(()=>{Yr="opencode",zp=".opencode",$o="AGENTS.md",Wn=`${zp}/rules`,Hn=`${zp}/commands`,zn=`${zp}/agents`,Xr=`${zp}/skills`,jo="opencode.json",Ic=".config/opencode",$s=`${Ic}/AGENTS.md`,qi=`${Ic}/rules`,ta=`${Ic}/commands`,ea=`${Ic}/agents`,js=`${Ic}/skills`,Us=`${Ic}/opencode.json`,LE=".agents/skills",sm=".agentsmesh/rules",Vp=".agentsmesh/commands",Jp=".agentsmesh/agents",zf=".agentsmesh/mcp.json";});async function Vf(t,e,r="project"){if(r==="global"){t.set($s,`${w}/_root.md`);for(let o of await E(e,qi))x(t,C(e,o),w,".md");for(let o of await E(e,ta))x(t,C(e,o),rt,".md");for(let o of await E(e,ea))x(t,C(e,o),Ot,".md");for(let o of await E(e,js))F(t,C(e,o),js);t.set(Us,".agentsmesh/mcp.json");return}t.set($o,`${w}/_root.md`);for(let o of await E(e,Wn))x(t,C(e,o),w,".md");for(let o of await E(e,Hn))x(t,C(e,o),rt,".md");for(let o of await E(e,zn))x(t,C(e,o),Ot,".md");for(let o of await E(e,Xr))F(t,C(e,o),Xr);t.set(jo,".agentsmesh/mcp.json");}var AE=d(()=>{It();ra();gt();s(Vf,"buildOpencodeImportPaths");});var Uo,gr,Xt,kE,Vn,fr,wE,Rc=d(()=>{Uo="pi-agent",gr="AGENTS.md",Xt=".pi/skills",kE=".pi/agent",Vn=`${kE}/AGENTS.md`,fr=`${kE}/skills`,wE=".agentsmesh/rules";});async function Jf(t,e,r="project"){if(r==="global"){t.set(Vn,`${w}/_root.md`);for(let o of await E(e,fr))F(t,C(e,o),fr);return}t.set(gr,`${w}/_root.md`);for(let o of await E(e,Xt))F(t,C(e,o),Xt);}var Yf=d(()=>{It();Rc();gt();s(Jf,"buildPiAgentImportPaths");});var Ko,hr,Jn,Bo,Wo,Ne,Ks,Bs,Yn,oa,Ws,Ho,Hs,Xf,TE,bE,Sc=d(()=>{Ko="qwen-code",hr="QWEN.md",Jn=".qwen/rules",Bo=".qwen/commands",Wo=".qwen/agents",Ne=".qwen/skills",Ks=".qwen/settings.json",Bs=".qwenignore",Yn=".qwen/QWEN.md",oa=".qwen/settings.json",Ws=".qwen/commands",Ho=".qwen/skills",Hs=".qwen/agents",Xf=".agentsmesh/rules",TE=".agentsmesh/commands",bE=".agentsmesh/agents";});async function Zf(t,e,r="project"){if(r==="global"){t.set(Yn,`${w}/_root.md`),t.set(oa,".agentsmesh/mcp.json");for(let o of await E(e,Ws))x(t,C(e,o),rt,".md");for(let o of await E(e,Hs))x(t,C(e,o),Ot,".md");for(let o of await E(e,Ho))F(t,C(e,o),Ho);return}t.set(hr,`${w}/_root.md`),t.set(Ks,".agentsmesh/mcp.json"),t.set(Bs,".agentsmesh/ignore");for(let o of await E(e,Jn))x(t,C(e,o),w,".md");for(let o of await E(e,Bo))x(t,C(e,o),rt,".md");for(let o of await E(e,Wo))x(t,C(e,o),Ot,".md");for(let o of await E(e,Ne))F(t,C(e,o),Ne);}var PE=d(()=>{It();gt();Sc();s(Zf,"buildQwenCodeImportPaths");});var zo,Zr,Ie,xE,Cc=d(()=>{zo="replit-agent",Zr="replit.md",Ie=".agents/skills",xE=".agentsmesh/rules";});async function Qf(t,e,r="project"){if(r!=="global"){t.set(Zr,`${w}/_root.md`);for(let o of await E(e,Ie))F(t,C(e,o),Ie);}}var qf=d(()=>{It();Cc();gt();s(Qf,"buildReplitAgentImportPaths");});var zs,na,Qr,im,Xn,Zn,Vo,am,cm,Ec,lm,Yp,Vs,Js,Qn,sa,mm,Ys,DE,ia,Xp,NE,FE,aa=d(()=>{zs="roo-code",na=".roo",Qr=`${na}/rules/00-root.md`,im=".roorules",Xn=`${na}/rules`,Zn=`${na}/commands`,Vo=`${na}/skills`,am=`${na}/mcp.json`,cm=".rooignore",Ec=".roomodes",lm="settings/custom_modes.yaml",Yp=".roo",Vs=`${Yp}/rules`,Js=`${Yp}/commands`,Qn=`${Yp}/skills`,sa="mcp_settings.json",mm=".rooignore",Ys=`${Yp}/AGENTS.md`,DE=".agents/skills",ia=".agentsmesh/rules",Xp=".agentsmesh/commands",NE=".agentsmesh/mcp.json",FE=".agentsmesh/ignore";});async function th(t,e,r="project"){if(r==="global"){t.set(Ys,`${w}/_root.md`);for(let o of await E(e,Vs))x(t,C(e,o),w,".md");for(let o of await E(e,Js))x(t,C(e,o),rt,".md");for(let o of await E(e,Qn))F(t,C(e,o),Qn);t.set(sa,".agentsmesh/mcp.json");return}t.set(Qr,`${w}/_root.md`),t.set(im,`${w}/_root.md`);for(let o of await E(e,Xn)){let n=C(e,o);n!==Qr&&x(t,n,w,".md");}for(let o of await E(e,".roo")){let n=C(e,o);/^\.roo\/rules-[^/]+\/.+\.md$/.test(n)&&x(t,n,w,".md");}for(let o of await E(e,Zn))x(t,C(e,o),rt,".md");for(let o of await E(e,Vo))F(t,C(e,o),Vo);}var vE=d(()=>{It();aa();gt();s(th,"buildRooCodeImportPaths");});var Jo,yr,GE,Zt,qn,ME,ts,Fe,Oc,$E,Lc=d(()=>{Jo="rovodev",yr="AGENTS.md",GE=".rovodev",Zt=`${GE}/skills`,qn=`${GE}/mcp.json`,ME=".rovodev",ts=".rovodev/AGENTS.md",Fe=".rovodev/skills",Oc=".rovodev/mcp.json",$E=".agentsmesh/rules";});async function eh(t,e,r="project"){if(r==="global"){t.set(ts,`${w}/_root.md`);for(let o of await E(e,Fe))F(t,C(e,o),Fe);t.set(Oc,".agentsmesh/mcp.json");return}t.set(yr,`${w}/_root.md`);for(let o of await E(e,Zt))F(t,C(e,o),Zt);t.set(qn,".agentsmesh/mcp.json");}var jE=d(()=>{It();Lc();gt();s(eh,"buildRovodevImportPaths");});var _r,Zp,ve,Ge,Ir,ca,Ac,es,Rr,qr,pm,UE,um,KE,BE,kc=d(()=>{_r="trae",Zp=".trae",ve=`${Zp}/rules`,Ge=`${ve}/project_rules.md`,Ir=`${Zp}/skills`,ca=`${Zp}/mcp.json`,Ac=`${Zp}/.ignore`,es=".trae/user_rules",Rr=".trae/user_rules/rules.md",qr=".trae/skills",pm=".trae/mcp.json",UE=".agents/skills",um=".agentsmesh/rules",KE=".agentsmesh/mcp.json",BE=".agentsmesh/ignore";});async function rh(t,e,r="project"){if(r==="global"){t.set(Rr,`${w}/_root.md`);for(let o of await E(e,es)){let n=C(e,o);n!==Rr&&x(t,n,w,".md");}for(let o of await E(e,qr))F(t,C(e,o),qr);return}t.set(Ge,`${w}/_root.md`);for(let o of await E(e,ve)){let n=C(e,o);n!==Ge&&x(t,n,w,".md");}for(let o of await E(e,Ir))F(t,C(e,o),Ir);}var WE=d(()=>{It();kc();gt();s(rh,"buildTraeImportPaths");});var Yo,to,oh,ae,Xs,Re,HE,wc=d(()=>{Yo="warp",to="AGENTS.md",oh="WARP.md",ae=".warp/skills",Xs=".mcp.json",Re=".warp/skills",HE=".agentsmesh/rules";});async function nh(t,e,r="project"){if(r==="global"){for(let o of await E(e,Re))F(t,C(e,o),Re);return}t.set(to,`${w}/_root.md`);for(let o of await E(e,ae))F(t,C(e,o),ae);t.set(Xs,".agentsmesh/mcp.json");}var zE=d(()=>{It();wc();gt();s(nh,"buildWarpImportPaths");});async function sh(t,e){t.set("AGENTS.md",`${w}/_root.md`),t.set(".windsurfrules",`${w}/_root.md`),await Ep(t,e);for(let r of await E(e,".windsurf/rules"))x(t,C(e,r),w,".md");for(let r of await E(e,".windsurf/workflows"))x(t,C(e,r),rt,".md");for(let r of await E(e,".windsurf/skills"))F(t,C(e,r),".windsurf/skills");}var VE=d(()=>{It();gt();s(sh,"buildWindsurfImportPaths");});var eo,Xo,c0,Zo,JE,la=d(()=>{eo=".rules",Xo=".zed/settings.json",c0=".config/zed",Zo=`${c0}/settings.json`,JE=".agentsmesh/rules";});async function ih(t,e,r="project"){if(r==="global"){t.set(Zo,".agentsmesh/mcp.json");return}t.set(eo,`${w}/_root.md`),t.set(Xo,".agentsmesh/mcp.json");}var YE=d(()=>{la();gt();s(ih,"buildZedImportPaths");});var XE=d(()=>{LC();wC();bC();xC();DC();GC();jC();UC();KC();BC();HC();YC();ZC();qC();tE();nE();iE();gE();_E();OE();AE();Yf();PE();qf();vE();jE();WE();zE();VE();YE();});var Rt=d(()=>{XE();});var l0,m0,p0,ZE,Cp,Qg=d(()=>{St();st();rC();pC();yC();SC();Rt();Xa();l0={name:yo,primaryRootInstructionPath:Ze,generateRules:ZS,generateCommands:qS,generateAgents:tC,generateSkills:QS,generateIgnore:eC,importFrom:mC},m0={rootInstructionPath:Ze,skillDir:oe,managedOutputs:{dirs:[oe],files:[Ze,_n]},paths:{rulePath(t){return Ze},commandPath(t){return `${oe}/${W(t)}/SKILL.md`},agentPath(t){return `${oe}/${$(t)}/SKILL.md`}}},p0={rootInstructionPath:In,skillDir:Qe,managedOutputs:{dirs:[Qe],files:[In,Ci]},rewriteGeneratedPath(t){return t===Ze?In:t===_n?Ci:t.startsWith(`${oe}/`)?t.replace(`${oe}/`,`${Qe}/`):t},paths:{rulePath(t){return In},commandPath(t){return `${Qe}/${W(t)}/SKILL.md`},agentPath(t){return `${Qe}/${$(t)}/SKILL.md`}}},ZE={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"native",permissions:"none"},Cp={id:yo,metadata:{displayName:"Aider",category:"cli",officialUrl:"https://aider.chat",shortDescription:"Open-source terminal AI pair programmer"},generators:l0,capabilities:ZE,emptyImportMessage:"No Aider config found (CONVENTIONS.md, .aider/skills, or .aiderignore).",lintRules:hC,lint:{hooks:_C,permissions:IC,mcp:RC},supportsConversion:{commands:true,agents:true},project:m0,globalSupport:{capabilities:ZE,detectionPaths:[In,Ci,Qe],layout:p0},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Ze],global:[In]},canonicalDir:YS,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[_n],global:[Ci]},canonicalDir:".agentsmesh",canonicalFilename:XS}},buildImportPaths:rf,detectionPaths:[Ze,_n]};});function QE(t){let e=[];for(let r of t.rules){if(r.targets.length>0&&!r.targets.includes(Ei))continue;let o=r.root?"_root":basename(r.source,".md");e.push({path:`${vr}/${o}.md`,content:r.body.trim()});}return e}function qE(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Oi,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var tO=d(()=>{Pl();s(QE,"generateRules");s(qE,"generateMcp");});async function eO(t,e){let r=e?.scope??"project";return z(Qp,t,r)}var rO=d(()=>{Ct();ah();s(eO,"importFromAmazonQ");});function oO(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Ei}))}var nO=d(()=>{_t();Pl();s(oO,"lintRules");});var d0,g0,f0,h0,Qp,ah=d(()=>{tO();rO();nO();Rt();Pl();d0={name:Ei,generateRules:QE,generateMcp:qE,importFrom:eO},g0={managedOutputs:{dirs:[vr],files:[Oi]},paths:{rulePath(t,e){return `${vr}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},f0={managedOutputs:{dirs:[Ss],files:[bl]},rewriteGeneratedPath(t){return t.startsWith(`${vr}/`)?t.replace(`${vr}/`,`${Ss}/`):t===Oi?bl:t},paths:{rulePath(t,e){return `${Ss}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},h0={rules:"native",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Qp={id:Ei,metadata:{displayName:"Amazon Q Developer",category:"ide",officialUrl:"https://aws.amazon.com/q/developer",shortDescription:"AWS AI coding assistant"},generators:d0,capabilities:{rules:"native",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Amazon Q Developer config found (.amazonq/rules/ or .amazonq/mcp.json).",lintRules:oO,project:g0,globalSupport:{capabilities:h0,detectionPaths:[Ss,bl],layout:f0},importer:{rules:{feature:"rules",mode:"directory",source:{project:[vr],global:[Ss]},canonicalDir:AC,extensions:[".md"],preset:"rule"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Oi],global:[bl]},canonicalDir:".agentsmesh",canonicalFilename:kC}},buildImportPaths:of,detectionPaths:[vr,Oi]};});function sO(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes("amp")),o=e?.body.trim()??"",n=it(o,r);return n?[{path:er,content:n}]:[]}function iO(t){return tt(t,ne)}function aO(t){return t.commands.map(e=>({path:`${ne}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function cO(t){return t.agents.map(e=>({path:`${ne}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}var lO=d(()=>{Q();Mt();st();St();Li();s(sO,"generateRules");s(iO,"generateSkills");s(aO,"generateCommands");s(cO,"generateAgents");});function ct(t,e,r){return t.startsWith(`${e}/`)&&!r.includes("codex-cli")?`.agents/skills/${t.slice(e.length+1)}`:null}var Qt=d(()=>{s(ct,"mirrorSkillsToAgents");});async function pO(t,e,r){let o=await y(join(t,e));if(o===null)return;let n;try{n=JSON.parse(o);}catch{return}if(n===null||typeof n!="object"||Array.isArray(n))return;let i=n,a=i["amp.mcpServers"]??i.mcpServers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let c={};for(let[l,m]of Object.entries(a))!m||typeof m!="object"||Array.isArray(m)||(c[l]=m);Object.keys(c).length!==0&&(await $t(t,mO,c),r.push({fromTool:"amp",fromPath:e,toPath:mO,feature:"mcp"}));}var mO,uO=d(()=>{T();Fr();Li();mO=".agentsmesh/mcp.json";s(pO,"importAmpMcp");});async function dO(t,e={}){let r=e.scope??"project",o=[],n=await U("amp",t,r);return o.push(...await z(qp,t,r,{normalize:n})),await Z(t,r==="global"?rr:ne,"amp",o,n),await pO(t,r==="global"?Cn:Io,o),o}var gO=d(()=>{mt();Q();Ct();uO();Li();ch();s(dO,"importFromAmp");});function fO(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:"amp"}))}var hO=d(()=>{_t();Li();s(fO,"lintRules");});function yO(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","amp","Amp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function _O(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","amp","Amp permissions are managed via amp.permissions in settings.json; canonical permissions are not projected.")]}function IO(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","amp","Amp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var RO=d(()=>{Et();s(yO,"lintHooks");s(_O,"lintPermissions");s(IO,"lintIgnore");});function S0(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let o=JSON.parse(e);if(o===null||typeof o!="object"||Array.isArray(o))return t;let n=o;return n["amp.mcpServers"]!==void 0&&(r["amp.mcpServers"]=n["amp.mcpServers"]),JSON.stringify(r,null,2)}var _0,I0,R0,SO,qp,ch=d(()=>{St();st();lO();Qt();gO();hO();RO();Rt();Li();_0={name:"amp",primaryRootInstructionPath:er,generateRules:sO,generateCommands:aO,generateAgents:cO,generateSkills:iO,importFrom:dO},I0={rootInstructionPath:er,skillDir:ne,managedOutputs:{dirs:[ne],files:[er,Io]},paths:{rulePath(t){return er},commandPath(t){return `${ne}/${W(t)}/SKILL.md`},agentPath(t){return `${ne}/${$(t)}/SKILL.md`}}},R0={rootInstructionPath:Sn,skillDir:rr,managedOutputs:{dirs:[rr],files:[Sn,Cn]},rewriteGeneratedPath(t){return t===er?Sn:t===Io?Cn:t.startsWith(`${ne}/`)?t.replace(`${ne}/`,`${rr}/`):t},mirrorGlobalPath(t,e){return ct(t,rr,e)},paths:{rulePath(t){return Sn},commandPath(t){return `${rr}/${W(t)}/SKILL.md`},agentPath(t){return `${rr}/${$(t)}/SKILL.md`}}},SO={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(S0,"mergeAmpSettings");qp={id:"amp",metadata:{displayName:"Amp",category:"cli",officialUrl:"https://ampcode.com",shortDescription:"Sourcegraph's coding agent"},generators:_0,capabilities:SO,emptyImportMessage:"No Amp config found (AGENTS.md, .agents/skills, or .amp/settings.json).",lintRules:fO,lint:{hooks:yO,permissions:_O,ignore:IO},supportsConversion:{commands:true,agents:true},project:I0,globalSupport:{capabilities:SO,detectionPaths:[Sn,Cn],layout:R0},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[er],global:[Sn]},canonicalDir:TC,canonicalRootFilename:"_root.md",markAsRoot:true}},emitScopedSettings(t,e){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Io,content:JSON.stringify({"amp.mcpServers":t.mcp.mcpServers},null,2)}]},mergeGeneratedOutputContent(t,e,r,o){return o===Io||o===Cn?S0(t,r):null},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:sf,detectionPaths:[er,Io]};});function CO(t){let e=t.rules.find(o=>o.root);if(!e)return [];let r=[{path:Gr,content:e.body.trim()||""}];for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("antigravity"))continue;let n=basename(o.source,".md");r.push({path:`${Ro}/${n}.md`,content:o.body.trim()||""});}return r}function EO(t){return t.commands.map(e=>{let r=e.description.trim(),o=e.body.trim(),n=r&&o&&!o.startsWith(r)?`${r}
50
+ ${xK}
51
+ ${Zc}`;s(Mg,"normalizeWhitespace");jC=[UK,jK,GK,$K,MK,vK,FK,NK,DK];s(UC,"appendAgentsmeshRootInstructionParagraph");s(BC,"stripAgentsmeshRootInstructionParagraph");});function ye(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function cl(t){let e=await _(t);return e?b(e).frontmatter:{}}function Xt(t,e){return typeof t[e]=="string"?t[e]:void 0}function jg(t){let e=t.hooks;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function BK(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function KK(t,e){let r=basename(t,".md")==="_root",n={...e};return delete n.root,{root:r,...n}}async function K(t,e,r){let n=await cl(t),o=basename(t,".md")==="_root"?BC(r):r.trim(),i=KK(t,BK({...n,...e})),a={root:i.root===true,description:typeof i.description=="string"?i.description:""};a.root===false&&(a.globs=ye(i.globs));for(let[l,c]of Object.entries(i))l==="root"||l==="description"||l==="globs"||c===void 0||(a[l]=c);return T(a,o||"")}var Ug=d(()=>{w();j();Gg();s(ye,"toStringArray");s(cl,"readExistingFrontmatter");s(Xt,"readString");s(jg,"readHooks");s(BK,"pruneUndefined");s(KK,"serializeCanonicalRuleFrontmatter");s(K,"serializeImportedRuleWithFallback");});async function _t(t,e,r){let n=await cl(t),o=(()=>{let l=ye(n.allowedTools);return l.length>0?l:ye(n["allowed-tools"])})(),i=e.hasDescription?e.description??"":typeof n.description=="string"?n.description:"",a=e.hasAllowedTools?e.allowedTools??[]:o;return T({description:i,"allowed-tools":a},r.trim()||"")}async function Cn(t,e,r){let n=await cl(t),o=basename(dirname(t)),i=Xt(e,"name")??Xt(n,"name")??o,a=Xt(e,"description")??Xt(n,"description")??"";return T({name:i,description:a},r.trim()||"")}async function Vt(t,e,r){let n=await cl(t),o=Object.prototype.hasOwnProperty.call(e,"tools")?ye(e.tools):(()=>{let R=ye(n.tools);return R.length>0?R:[]})(),i=Object.prototype.hasOwnProperty.call(e,"disallowedTools")?ye(e.disallowedTools):Object.prototype.hasOwnProperty.call(e,"disallowed-tools")?ye(e["disallowed-tools"]):ye(n.disallowedTools),a=Object.prototype.hasOwnProperty.call(e,"mcpServers")?ye(e.mcpServers):Object.prototype.hasOwnProperty.call(e,"mcp-servers")?ye(e["mcp-servers"]):ye(n.mcpServers),l=Object.prototype.hasOwnProperty.call(e,"skills")?ye(e.skills):ye(n.skills),c=e.maxTurns??e["max-turns"]??n.maxTurns,m=typeof c=="number"?c:Number(c??0),p=jg(e)??jg(n),u={name:Xt(e,"name")??Xt(n,"name")??basename(t,".md"),description:Xt(e,"description")??Xt(n,"description")??"",tools:o};i.length>0&&(u.disallowedTools=i);let f=Xt(e,"model")??Xt(n,"model");f&&(u.model=f);let g=Xt(e,"permissionMode")??Xt(e,"permission-mode")??Xt(n,"permissionMode")??Xt(n,"permission-mode");g&&(u.permissionMode=g),Number.isInteger(m)&&m>0&&(u.maxTurns=m),a.length>0&&(u.mcpServers=a),p&&Object.keys(p).length>0&&(u.hooks=p),l.length>0&&(u.skills=l);let h=Xt(e,"memory")??Xt(n,"memory");return h&&(u.memory=h),T(u,r.trim()||"")}var HC=d(()=>{j();Ug();s(_t,"serializeImportedCommandWithFallback");s(Cn,"serializeImportedSkillWithFallback");s(Vt,"serializeImportedAgentWithFallback");});var ut=d(()=>{Ug();HC();});function eu(t){let e=t.split("/").filter(Boolean);return e.length===0||e.some(n=>n.startsWith("."))?false:!e.join("/").startsWith("tests/e2e/fixtures/")}async function kn(t){await rm(t,{recursive:true,force:true});}var Qc=d(()=>{s(eu,"shouldImportScopedAgentsRule");s(kn,"removePathIfExists");});function rt(t,e){let r=[];for(let n of t.skills){let o={name:n.name,description:n.description||void 0};o.description===void 0&&delete o.description,r.push({path:`${e}/${n.name}/SKILL.md`,content:T(o,n.body.trim()||"")});for(let i of n.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");r.push({path:`${e}/${n.name}/${a}`,content:i.content});}}return r}async function q(t,e,r,n,o){let i=await readdir(join(t,e),{encoding:"utf8",withFileTypes:true}).catch(()=>null);if(i!==null)for(let a of i){if(!a.isDirectory())continue;let l=join(t,e,a.name),c=join(l,"SKILL.md"),m=await _(c);if(m===null)continue;let p=join(t,qc,a.name),u=join(p,"SKILL.md"),{frontmatter:f,body:g}=b(o(m,c,u)),h=Xp(f,a.name);if(h){await kn(join(t,qc,a.name));let k=join(t,zC);await O(k);let P=join(k,`${h.name}.md`);await I(P,Zp(h,o(g,c,P))),n.push({fromTool:r,fromPath:c,toPath:`${zC}/${h.name}.md`,feature:"commands"});continue}let R=al(f,a.name);if(R){await kn(join(t,qc,a.name));let k=join(t,VC);await O(k);let P=join(k,`${R.name}.md`);await I(P,Os(R,o(g,c,P))),n.push({fromTool:r,fromPath:c,toPath:`${VC}/${R.name}.md`,feature:"agents"});continue}let C=await Cn(u,{...f,name:a.name},g);await O(p),await I(u,C),n.push({fromTool:r,fromPath:c,toPath:`${qc}/${a.name}/SKILL.md`,feature:"skills"});let S=await v(l);for(let k of S){if(k===c)continue;let P=relative(l,k).replace(/\\/g,"/"),N=await _(k);if(N===null)continue;let F=join(p,P);await O(dirname(F)),await I(F,o(N,k,F)),n.push({fromTool:r,fromPath:k,toPath:`${qc}/${a.name}/${P}`,feature:"skills"});}}}var qc,zC,VC,tt=d(()=>{w();j();ut();mt();kt();Qc();qc=".agentsmesh/skills",zC=".agentsmesh/commands",VC=".agentsmesh/agents";s(rt,"generateEmbeddedSkills");s(q,"importEmbeddedSkills");});var En,er,ie,Oo,Ao,rr,bi,JC,YC,ml=d(()=>{En="aider",er="CONVENTIONS.md",ie=".aider/skills",Oo=".aiderignore",Ao="CONVENTIONS.md",rr=".aider/skills",bi=".aiderignore",JC=".agentsmesh/rules",YC=".agentsmesh/ignore";});function XC(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(En)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:er,content:o}]:[]}function ZC(t){return rt(t,ie)}function QC(t){return t.commands.map(e=>({path:`${ie}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function qC(t){return t.agents.map(e=>({path:`${ie}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function tk(t){return t.ignore.length===0?[]:[{path:Oo,content:t.ignore.join(`
52
+ `)}]}var ek=d(()=>{tt();Ut();mt();kt();ml();s(XC,"generateRules");s(ZC,"generateSkills");s(QC,"generateCommands");s(qC,"generateAgents");s(tk,"generateIgnore");});function nt(t){return t.includes("\\")||jr.test(t)?win32:posix}function vt(t){return t.replace(/\\/g,"/")}function Y(t,e){let r=nt(t),n=r.normalize(r===win32?e.replace(/\//g,"\\"):vt(e));return n.endsWith(r.sep)&&n.length>1?n.slice(0,-1):n}function nk(t,e){return nt(t).isAbsolute(e)||jr.test(e)}function pl(t){let e=t,r="";for(;XK.test(e);)r=e.at(-1)+r,e=e.slice(0,-1);return {candidate:e,suffix:r}}function ok(t,e){let r=nt(e),n=t.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"");return n&&n!==t?Y(e,r.join(e,n)):null}var jr,XK,ae=d(()=>{jr=/^[A-Za-z]:[\\/]/,XK=/[.!?:;]+$/;s(nt,"pathApi");s(vt,"normalizeSeparators");s(Y,"normalizeForProject");s(nk,"isAbsoluteForProject");s(pl,"stripTrailingPunctuation");s(ok,"rootFallbackPath");});async function sk(t,e,r="project"){let n=new Map,o=et(t);return o&&await o.buildImportPaths(n,e,r),n}var ik=d(()=>{se();s(sk,"buildImportReferenceMap");});function qK(t){let e=[t.project,t.globalSupport?.layout].filter(o=>o!==void 0),r=[...t.detectionPaths,...e.flatMap(o=>o.managedOutputs?.dirs??[]),...e.flatMap(o=>o.managedOutputs?.files??[])],n=new Set;for(let o of r){let i=o.split("/")[0];i&&i.startsWith(".")&&i.length>1&&n.add(`${i}/`);}return n}function tW(){let t=new Set([".agentsmesh/"]);for(let e of bt)for(let r of qK(e))t.add(r);return Array.from(t)}function eW(){let t=new Set([...tW(),...Bg.rootRelativePrefixes]),e=new Set([...QK,...Bg.meshRootSegments]);return {protectedSchemes:[...ZK,...Bg.protectedSchemes],rootRelativePrefixes:Array.from(t),meshRootSegments:e}}function ru(){return Kg||(Kg=eW()),Kg}var ZK,QK,Bg,Kg,ak=d(()=>{Pt();ZK=[/\b[A-Za-z][A-Za-z0-9+.-]+:[^\s<>()\]]+/g,/\b[\w.-]+@[\w.-]+:[^\s<>()\]]+/g,/\b[\w.+-]+@[\w.-]+\.[A-Za-z]{2,}\b/g,/\/\/[A-Za-z0-9][\w.-]*\.[A-Za-z]{2,}[^\s<>()\]]*/g],QK=new Set(["skills","rules","commands","agents","packs"]),Bg={protectedSchemes:[],rootRelativePrefixes:[],meshRootSegments:[]};s(qK,"topLevelDotfilePrefixes");s(tW,"buildDefaultRootRelativePrefixes");s(eW,"rebuild");s(ru,"getLinkFormatRegistry");});function Ur(t){let e=vt(t);return ru().rootRelativePrefixes.some(r=>e.startsWith(r))}function nW(t){let e=vt(t).replace(/^\.\//,"");if(e.startsWith("../")||e.startsWith("/")||jr.test(e)||/^[a-zA-Z]:/.test(e)||Ur(e))return false;let r=e.split("/").filter(n=>n.length>0)[0];return r!==void 0&&ru().meshRootSegments.has(r)}function tm(t,e,r){let n=nt(e),o=Y(e,e),i=Y(e,r),a=vt(t);if(jr.test(t)){let l=Y(e,t);return n===win32||l.startsWith(`${o}${n.sep}`)?[l]:[l]}if(n.isAbsolute(t)){let l=Y(e,t);return l.startsWith(o)||existsSync(t)?[l]:[Y(e,n.join(e,t))]}if(a.startsWith("./")||a.startsWith("../")){let l=Y(e,n.join(n.dirname(i),a)),c=ok(a,o);return c&&c!==l?[l,c]:[l]}if(Ur(a))return [Y(e,n.join(o,a))];if(a.includes("/")){let l=Y(e,n.join(o,".agentsmesh")),c=nW(a)?Y(e,n.join(l,a)):null,m=Y(e,n.join(o,a)),p=Y(e,n.join(n.dirname(i),a));return c!==null?[c,m,p]:[m,p]}return oW.has(a)?[]:a.includes(".")?[Y(e,n.join(n.dirname(i),a))]:[]}function em(t,e){let r=[e];if(!nk(t,e)||!existsSync(e))return r;try{let n=[realpathSync(e),realpathSync.native(e)];for(let o of n)o!==e&&!r.includes(o)&&r.push(o);}catch{}return r}function pk(t,e,r){let n=e>0?t.at(e-1):"",o=r<t.length?t.at(r):"";return n==="*"||o==="*"}function nu(t){let e=[];for(let r of ru().protectedSchemes){let n=r.flags.includes("g")?r:new RegExp(r.source,`${r.flags}g`);for(let o of t.matchAll(n))e.push([o.index??0,(o.index??0)+o[0].length]);}for(let r of t.matchAll(sW))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(iW))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(aW))e.push([r.index??0,(r.index??0)+r[0].length]);return e}var oW,sW,iW,aW,mk,ul,As=d(()=>{ae();ak();s(Ur,"isRootRelativePathToken");s(nW,"isMeshRootRelativePathToken");oW=new Set(["AGENTS.md","CLAUDE.md","GEMINI.md","codex.md",".windsurfrules",".cursorrules"]),sW=/^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm,iW=/<!-- agentsmesh:root-generation-contract:start -->[\s\S]*?<!-- agentsmesh:root-generation-contract:end -->/g,aW=/<!-- agentsmesh:embedded-rules:start -->[\s\S]*?<!-- agentsmesh:embedded-rules:end -->/g,mk=/(?:\.\.[\\/]|\.\/|\.\\|\/[A-Za-z0-9._-]|[A-Za-z]:[\\/][A-Za-z0-9._-]|\.agentsmesh[\\/]|\.claude[\\/]|\.cursor[\\/]|\.github[\\/]|\.continue[\\/]|\.junie[\\/]|\.kiro[\\/]|\.gemini[\\/]|\.clinerules[\\/]|\.cline[\\/]|\.codex[\\/]|\.agents[\\/]|\.windsurf[\\/]|\.roo[\\/]|(?:[A-Za-z0-9._-]+[\\/])+|[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+)[A-Za-z0-9._@%+~:\\/-]*/g,ul=/(?::(\d+)){1,2}$/;s(tm,"resolveProjectPath");s(em,"expandResolvedPaths");s(pk,"isGlobAdjacent");s(nu,"protectedRanges");});function lW(t){return t===void 0||t.role==="inline-code"||t.role==="bracketed"||t.role==="quoted"||t.role==="at-prefix"||t.role==="bracket-label"||t.role==="bare-prose"}function uk(t){return lW(t.tokenContext)}function Wg(t,e){let r=nt(t),n=Y(t,t),o=Y(t,e);if(o===n)return true;let i=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(i)}function dk(t){let e=nt(t);return Y(t,e.join(t,".agentsmesh"))}function Br(t,e){let r=nt(t),n=dk(t),o=Y(t,e);if(o===n)return true;let i=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(i)}function fk(t,e,r){let n=nt(t),o=dk(t),i=Y(t,e);if(!Br(t,i))return null;let a=n.relative(o,i).replace(/\\/g,"/");return a.startsWith("..")||a.length===0?null:r&&!a.endsWith("/")?`${a}/`:a}function Hg(t,e,r){let o=nt(t).relative(Y(t,t),Y(t,e)).replace(/\\/g,"/");if(o.startsWith(".."))return null;let i=o.length>0?o:".";return r&&!i.endsWith("/")?`${i}/`:i}function dl(t,e,r){let n=Hg(t,e,r);return n===null?null:{kind:"projectRoot",rest:n,text:n}}function zg(t,e,r,n,o){let i=nt(t),a=Y(t,t),l=Y(t,e),c=Y(t,r);if(!Wg(t,c))return dl(t,c,n)?.text??null;let m=Y(t,i.dirname(l));if(!Wg(t,m)&&m!==a)return dl(t,c,n)?.text??null;let p=i.relative(m,c).replace(/\\/g,"/");if(i.isAbsolute(p)||jr.test(p))return Hg(t,c,n);let u=Y(t,i.join(m,p));return Wg(t,u)?(p===""||p==="."?p=".":o.explicitCurrentDirLinks===true&&m!==a&&!p.startsWith("../")&&!p.startsWith("./")&&(p=`./${p}`),n&&!p.endsWith("/")?`${p}/`:p):Hg(t,c,n)}var Vg=d(()=>{ae();s(lW,"isReadingContext");s(uk,"isReadingContextOptions");s(Wg,"isUnderProjectRoot");s(dk,"agentsMeshRoot");s(Br,"isUnderAgentsMesh");s(fk,"toAgentsMeshRootRelative");s(Hg,"toProjectRootRelative");s(dl,"toProjectRootReference");s(zg,"formatLinkPathForDestinationLegacy");});function gk(t,e,r,n,o={}){let i=o.scope??"project",a=Y(t,r);if(uk(o)&&Br(t,e)&&Br(t,a)){let m=nt(t),p=Y(t,t),u=m.relative(p,a).replace(/\\/g,"/");if(!u.startsWith("..")&&u.length>0)return n&&!u.endsWith("/")?`${u}/`:u}if(o.forceRelative)return zg(t,e,r,n,o);if(i==="global"&&!Br(t,e))return dl(t,a,n)?.text??null;let l=(()=>{if(Br(t,a))return a;let m=o.logicalMeshSourceAbsolute;return m&&Br(t,Y(t,m))?Y(t,m):null})();if(!l)return dl(t,a,n)?.text??null;if(n||(o.pathIsDirectory?.(a)??false)){let m=fk(t,l,n);return m!==null?m:dl(t,l,n)?.text??null}return zg(t,e,r,n,o)}var hk=d(()=>{As();ae();Vg();Vg();s(gk,"formatLinkPathForDestination");});function yk(t,e,r,n){let o=nt(e),i=vt(t);if(!Ur(i))return null;let a=i.split("/").filter(m=>m.length>0);if(a.length<3)return null;let l=Y(e,r),c=o.dirname(l);for(let m=1;m<=a.length-1;m++){let p=a.slice(m).join("/"),u=Y(e,o.join(c,p));if(u!==l&&n(u))return u}return null}var _k=d(()=>{ae();As();s(yk,"resolveByDestinationSuffixStrip");});function Rk(t){let e=null,r=false,n=null,o=null,i=null;for(let c of tm(t.candidate,t.projectRoot,t.sourceFile)){let m=null,p=null;for(let u of em(t.projectRoot,c)){let f=Y(t.projectRoot,u),g=Y(t.projectRoot,t.translatePath(f)),h=t.pathExists(f),R=t.pathExists(g);if(R&&g!==f){e=g,n=f,r=true;break}(h||R)&&m===null&&(m=g,p=f),e===null&&(e=g);}if(!r&&m!==null&&o===null&&(o=m,i=p),r)break}if(!r){let c=yk(t.candidate,t.projectRoot,t.destinationFile,t.pathExists);c!==null&&(e=c,r=true);}!r&&o!==null&&(e=o,i!==null&&(n=i),r=true);let a=vt(t.destinationFile),l=a.includes("/.agentsmesh/")||a.startsWith(".agentsmesh/");return !r&&e!==null&&vt(t.rawToken).startsWith(".agentsmesh/")&&l&&(r=true),{translatedPath:e,resolvedBeforeTranslate:n,matchedPath:r}}var Ik=d(()=>{ae();As();_k();s(Rk,"resolveLinkTarget");});function Sk(t,e,r){return e>=2&&t[e-2]==="~"&&t[e-1]==="/"?true:e>=1&&t[e-1]==="~"&&r.startsWith("/")}function Ck(t,e,r){if(e<=0||t[e-1]!=="(")return false;let n=e+r.length,o=t[n];return o!==")"&&o!=="#"&&o!=="?"&&o!==" "&&o!==" "?false:t[e-2]==="]"}function kk(t){let e=vt(t);return e.startsWith("./")||e.startsWith("../")?true:e.startsWith("/")||jr.test(e)||Ur(e)?false:e.includes("/")}var Ek=d(()=>{ae();As();s(Sk,"isTildeHomeRelativePathToken");s(Ck,"isMarkdownLinkDestinationToken");s(kk,"isRelativePathToken");});function cW(t,e,r){let n=e+r.length;if(t[n]!=="]"||t[n+1]!=="(")return false;let o=n+2,i="";for(;o<t.length;){let a=t[o];if(a===")"||a==="#"||a==="?"||a===" "||a===" "||a===`
53
+ `)break;i+=a,o++;}return i===r}function Lk(t,e,r){let n=t.lastIndexOf(`
54
+ `,e-1)+1,o=t.slice(n,e);if(!/^\s*\[[^\]\n]+\]:\s*<?\s*$/.test(o))return false;let i=r<t.length?t[r]:"";return i===""||i===`
55
+ `||i==="\r"||i===">"||i===" "||i===" "||i==='"'||i==="'"||i===":"||i==="#"||i==="?"}function Ok(t,e,r){let n=e>0?t[e-1]:"",o=r<t.length?t[r]:"";return n==="`"&&o==="`"?{role:"inline-code"}:Lk(t,e,r)?{role:"markdown-link-dest"}:n==="<"&&o===">"?{role:"bracketed"}:n==="'"&&o==="'"||n==='"'&&o==='"'?{role:"quoted"}:n==="@"?{role:"at-prefix"}:n==="("&&t[e-2]==="]"?{role:"markdown-link-dest"}:n==="["&&o==="]"?{role:"bracket-label"}:{role:"bare-prose"}}function Ak(t,e,r,n,o){if(e<0||r>t.length)return false;let{candidate:i}=pl(n),a=i.replace(ul,""),l=vt(a),c=e+a.length,m=t[e-1],p=t[r];return Lk(t,e,c)||m==="'"&&p==="'"||m==='"'&&p==='"'||m==="`"&&p==="`"||m==="<"&&p===">"?true:m==="["&&p==="]"?!(!o&&!Ur(l)&&cW(t,e,n)):m==="@"?true:m==="("&&t[e-2]==="]"?p===")"||p==="#"||p==="?"||p===" "||p===" ":o?Ur(l)?true:l.includes("/")||l.includes("\\")?l.startsWith("./")||l.startsWith("../")?true:(l.split(/[\\/]/).filter(Boolean).at(-1)??"").includes("."):false:false}var wk=d(()=>{ae();As();s(cW,"markdownBracketLabelDuplicatesDestination");s(Lk,"isMarkdownReferenceDefinitionDestination");s(Ok,"getTokenContext");s(Ak,"shouldRewritePathToken");});function ou(t){let e=new Set,r=nu(t.content);return {content:t.content.replace(mk,(o,i,a)=>{if(r.some(([Dt,Ze])=>i>=Dt&&i<Ze)||!Ak(a,i,i+o.length,o,t.rewriteBarePathTokens===true)||Sk(a,i,o)||pk(a,i,i+o.length))return o;let{candidate:l,suffix:c}=pl(o);if(!l)return o;let m=ul.exec(l),p=m?l.slice(0,m.index):l,u=m?m[0]:"";if(!p)return o;let f=Ok(a,i,i+p.length);if(f.role!=="markdown-link-dest"&&jr.test(p))return o;let{translatedPath:g,resolvedBeforeTranslate:h,matchedPath:R}=Rk({candidate:p,rawToken:l,projectRoot:t.projectRoot,sourceFile:t.sourceFile,destinationFile:t.destinationFile,translatePath:t.translatePath,pathExists:t.pathExists}),C=h;if(!R||!g)return g&&e.add(g),o;let S=vt(p),k=p.endsWith("/")||t.pathIsDirectory?.(g)===true;if(k&&!S.includes("/")&&!S.includes("\\"))return o;if(C===null){let Dt=vt(l);if(Dt.startsWith("agentsmesh/")&&(Dt=`.${Dt}`),Dt.startsWith(".agentsmesh/")||Dt.includes("/.agentsmesh/")){let Ze=nt(t.projectRoot),ja=Y(t.projectRoot,t.projectRoot),Ua=Dt.replace(/^\.\//,"");C=Y(t.projectRoot,Ze.join(ja,Ua));}}let P=nt(t.projectRoot);if(t.scope==="global"){let Dt=vt(l),Ze=Dt.startsWith(".agentsmesh/")||Dt.includes("/.agentsmesh/"),ja=Ur(Dt)||kk(Dt),Ua=C!==null&&Br(t.projectRoot,C),Dc=Br(t.projectRoot,g);if(C===g&&!Dc&&!Ua&&!Ze){let Ba=vt(P.relative(t.projectRoot,Y(t.projectRoot,t.sourceFile))).split("/").filter(Boolean)[0]??"",u0=(C!==null?vt(P.relative(t.projectRoot,C)):"").split("/").filter(Boolean)[0]??"";if(Ba.length>0&&Ba===u0)return o}if(!ja&&!Ze&&!Ua&&!Dc)return o}let N=Y(t.projectRoot,t.destinationFile),F=Y(t.projectRoot,g),W=vt(P.relative(t.projectRoot,N)),z=vt(P.relative(t.projectRoot,F)),Q=W.split("/").filter(Boolean)[0]??"",at=z.split("/").filter(Boolean)[0]??"",oe=!vt(p).startsWith(".agentsmesh/")&&!k&&Q.length>0&&Q===at&&Q.startsWith(".")&&Q!==".agentsmesh"||f.role==="markdown-link-dest"||Ck(a,i,p),Dr=gk(t.projectRoot,t.destinationFile,g,p.endsWith("/"),{explicitCurrentDirLinks:t.explicitCurrentDirLinks===true||oe,scope:t.scope??"project",pathIsDirectory:t.pathIsDirectory,logicalMeshSourceAbsolute:k?null:C,forceRelative:oe,tokenContext:f,originalToken:p});return Dr?`${Dr}${u}${c}`:o}),missing:[...e]}}var Jg=d(()=>{ae();As();hk();Ik();Ek();wk();s(ou,"rewriteFileLinks");});function Pk(t,e){let r=[t.normalize(e)];if(!existsSync(e))return r;try{let n=[realpathSync(e),realpathSync.native(e)];for(let o of n){let i=t.normalize(o);r.includes(i)||r.push(i);}}catch{}return r}async function B(t,e,r="project"){let n=nt(e),o=new Map,i=Array.from(new Set([t,...Ft]));for(let c of i){let m=await sk(c,e,r);for(let[p,u]of m.entries())o.set(p,u);}let a=new Map;for(let[c,m]of o.entries()){let p=n.normalize(n.join(e,m));for(let u of Pk(n,n.join(e,c)))a.set(u,p);}let l=new Set;for(let c of new Set(o.values())){let m=n.normalize(n.join(e,c));l.add(m);for(let p of Pk(n,m))l.add(n.normalize(p));}return (c,m,p)=>ou({content:c,projectRoot:e,sourceFile:m,destinationFile:p,translatePath:s(u=>a.get(u)??u,"translatePath"),pathExists:s(u=>{let f=n.normalize(u);return a.has(u)||a.has(f)||existsSync(u)||l.has(f)},"pathExists"),explicitCurrentDirLinks:false,rewriteBarePathTokens:true,scope:r,pathIsDirectory:s(u=>{try{return statSync(u).isDirectory()}catch{return false}},"pathIsDirectory")}).content}var dt=d(()=>{ae();ik();Jg();Rn();s(Pk,"pathVariants");s(B,"createImportReferenceNormalizer");});async function Bt(t,e,r){let n=join(t,e),i={...await dW(n),...r};await O(dirname(n)),await I(n,JSON.stringify({mcpServers:i},null,2));}async function dW(t){let e=await _(t);if(e===null)return {};let r;try{r=JSON.parse(e);}catch{return {}}if(!r||typeof r!="object"||Array.isArray(r))return {};let n=r.mcpServers;if(!n||typeof n!="object"||Array.isArray(n))return {};let o={};for(let[i,a]of Object.entries(n))!a||typeof a!="object"||Array.isArray(a)||(o[i]=a);return o}var Kr=d(()=>{w();s(Bt,"writeMcpWithMerge");s(dW,"readExistingServers");});function wo(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}function nr(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function ws(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Ln(t){return !t||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}var or=d(()=>{s(wo,"toGlobsArray");s(nr,"toToolsArray");s(ws,"toStringArray");s(Ln,"toStringRecord");});function hW(t,e){return e.some(r=>t.endsWith(r))}async function Rt(t){let r=(await v(t.srcDir)).filter(o=>hW(o,t.extensions)),n=[];for(let o of r){let i=await _(o);if(!i)continue;let a=relative(t.srcDir,o).replace(/\\/g,"/"),l=await t.mapEntry({srcPath:o,relativePath:a,content:i,normalizeTo:s((c,m=i)=>t.normalize(m,o,c),"normalizeTo")});l&&(await O(dirname(l.destPath)),await I(l.destPath,l.content),n.push({fromTool:t.fromTool,fromPath:o,toPath:l.toPath,feature:l.feature}));}return n}var xe=d(()=>{w();s(hW,"matchesExtension");s(Rt,"importFileDirectory");});function xk(t){return typeof t=="string"?t:void 0}function yW(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}function Xg(t,e){return e?e(t):t}function _W(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=b(e.normalizeTo(r)),i=Xg(n,t.frontmatterRemap),a=yW({root:false,description:xk(i.description),globs:Array.isArray(i.globs)?i.globs:void 0,...i});return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await K(r,a,o)}}}function RW(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=b(e.normalizeTo(r)),i=Xg(n,t.frontmatterRemap),a=await _t(r,{hasDescription:true,description:xk(i.description),hasAllowedTools:true,allowedTools:ws(i["allowed-tools"])},o);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:a}}}function IW(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=b(e.normalizeTo(r)),i=Xg(n,t.frontmatterRemap);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await Vt(r,i,o)}}}function Dk(t){if(t.map)return t.map;switch(t.preset){case "rule":return _W(t);case "command":return RW(t);case "agent":return IW(t);default:throw new Error(`ImportFeatureSpec for ${t.feature} (mode: ${t.mode}) needs a \`preset\` or \`map\``)}}var Nk=d(()=>{j();ut();or();s(xk,"pickString");s(yW,"pruneUndefined");s(Xg,"applyRemap");s(_W,"ruleMapper");s(RW,"commandMapper");s(IW,"agentMapper");s(Dk,"resolveMapper");});function Zg(t,e){return t?t[e]??[]:[]}var Fk,vk=d(()=>{Fk=["rules","commands","agents","skills","mcp","hooks","permissions","ignore"];s(Zg,"resolveScopedSources");});async function EW(t,e,r,n,o){if(!t.canonicalRootFilename)throw new Error(`singleFile spec for ${t.feature} must set canonicalRootFilename`);let i=join(r,t.canonicalDir);for(let a of e){let l=join(r,a),c=await _(l);if(c===null)continue;await O(i);let m=join(i,t.canonicalRootFilename),p=s(S=>o(c,l,S),"normalizeTo");if(t.map){let S;try{S=await t.map({absolutePath:l,relativePath:a,content:c,destDir:i,normalizeTo:p});}catch(k){let P=k instanceof Error?k.message:String(k);process.stderr.write(`\u26A0 skipping ${l}: ${P}
56
+ `);continue}if(!S)continue;return await I(S.destPath,S.content),[{fromTool:n,fromPath:l,toPath:S.toPath,feature:t.feature}]}let u=Fr(p(m),l);if(!u.ok){process.stderr.write(`\u26A0 skipping ${l}: ${u.error.message}
57
+ `);continue}let{frontmatter:f,body:g}=u.value,h=t.frontmatterRemap?t.frontmatterRemap(f):f,R=t.markAsRoot?{...h,root:true}:h,C=await K(m,R,g);return await I(m,C),[{fromTool:n,fromPath:l,toPath:`${t.canonicalDir}/${t.canonicalRootFilename}`,feature:t.feature}]}return []}async function LW(t,e,r,n,o){let i=Dk(t),a=join(r,t.canonicalDir),l=[];for(let c of e){let m=join(r,c),p=await Rt({srcDir:m,destDir:a,extensions:[...t.extensions??[".md"]],fromTool:n,normalize:o,mapEntry:s(async({srcPath:u,relativePath:f,content:g,normalizeTo:h})=>{if(Gp(basename(u)))return null;let R;try{R=await i({absolutePath:u,relativePath:f,content:g,destDir:a,normalizeTo:s(C=>h(C),"normalizeTo")});}catch(C){let S=C instanceof Error?C.message:String(C);return process.stderr.write(`\u26A0 skipping ${u}: ${S}
58
+ `),null}return R?{destPath:R.destPath,toPath:R.toPath,feature:t.feature,content:R.content}:null},"mapEntry")});l.push(...p);}return l}function $k(t){let e=t.canonicalFilename;return e.includes("/")||e.includes("\\")?e:posix.join(t.canonicalDir,e)}async function OW(t,e,r,n){if(!t.canonicalFilename)throw new Error(`flatFile spec for ${t.feature} must set canonicalFilename`);let o=$k(t);for(let i of e){let a=join(r,i),l=await _(a);if(l===null)continue;let c=join(r,o);return await O(dirname(c)),await I(c,l.trimEnd()),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}]}return []}function AW(t){let e;try{e=JSON.parse(t);}catch{return {}}if(!e||typeof e!="object")return {};let r=e.mcpServers;if(!r||typeof r!="object"||Array.isArray(r))return {};let n={};for(let[o,i]of Object.entries(r)){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,l=typeof a.description=="string"?a.description:void 0;if(typeof a.command=="string"){n[o]={type:typeof a.type=="string"?a.type:"stdio",command:a.command,args:ws(a.args),env:Ln(a.env),description:l};continue}typeof a.url=="string"&&(n[o]={type:typeof a.type=="string"?a.type:"http",url:a.url,headers:Ln(a.headers),env:Ln(a.env),description:l});}return n}async function wW(t,e,r,n){if(!t.canonicalFilename)throw new Error(`mcpJson spec for ${t.feature} must set canonicalFilename`);let o=$k(t);for(let i of e){let a=join(r,i),l=await _(a);if(l===null)continue;let c=AW(l);return Object.keys(c).length===0?[]:(await Bt(r,o,c),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}])}return []}function Mk(t,e,r,n,o){switch(t.mode){case "singleFile":return EW(t,e,r,n,o);case "directory":return LW(t,e,r,n,o);case "flatFile":return OW(t,e,r,n);case "mcpJson":return wW(t,e,r,n)}}async function bW(t,e,r,n,o){let i=Zg(t.source,e),a=Zg(t.fallbacks,e);if(i.length===0&&a.length===0)return [];if(i.length>0){let l=await Mk(t,i,r,n,o);if(l.length>0)return l}return a.length>0?Mk(t,a,r,n,o):[]}function PW(t,e){let r=t[e];return r?Array.isArray(r)?r:[r]:[]}async function J(t,e,r,n){let o=t.importer;if(!o)return [];let i=n?.normalize??await B(t.id,e,r),a=[];for(let l of Fk)for(let c of PW(o,l))a.push(...await bW(c,r,e,t.id,i));return a}var Et=d(()=>{dt();w();Kr();j();or();ut();xe();Nk();Co();vk();s(EW,"runSingleFile");s(LW,"runDirectory");s($k,"resolveCanonicalFilePath");s(OW,"runFlatFile");s(AW,"parseMcpJson");s(wW,"runMcpJson");s(Mk,"dispatchSpec");s(bW,"runSpec");s(PW,"specsForFeature");s(J,"runDescriptorImport");});async function Gk(t,e={}){let r=e.scope??"project",n=[],o=await B(En,t,r);return n.push(...await J(su,t,r,{normalize:o})),await q(t,r==="global"?rr:ie,En,n,o),n}var jk=d(()=>{dt();tt();Et();ml();Qg();s(Gk,"importFromAider");});function TW(t,e){return Bk(e).some(n=>xW(t,n))}function Uk(t,e){return t.filter(r=>TW(r,e))}function Bk(t){let e=t.match(/^(.+)\{([^}]+)\}(.*)$/);if(!e)return [t];let[,r,n,o]=e;if(!n)return [t];let i=n.split(",").map(l=>l.trim()),a=[];for(let l of i)for(let c of Bk(r+l+o))a.push(c);return a}function xW(t,e){return DW(e).test(t)}function DW(t){let e=[],r=0;for(;r<t.length;){if(t.startsWith("**",r)){let i=t.slice(r+2);if(i.length===0&&e.length===0)e.push(".*");else if(e.push(i.startsWith("/")?"(?:[^/]+/)*":"(?:/[^/]+)*?"),i.startsWith("/")){r+=3;continue}r+=2;continue}if(t[r]==="*"){e.push("[^/]*"),r+=1;continue}if(t[r]==="?"){e.push("[^/]"),r+=1;continue}if(t[r]==="{"){e.push("(?:"),r+=1;continue}if(t[r]==="}"){e.push(")"),r+=1;continue}if(t[r]===","){e.push("|"),r+=1;continue}".^$+?()[]{}|\\".includes(t[r])?e.push("\\"+t[r]):e.push(t[r]),r+=1;}let n="^"+e.join("")+"$";return new RegExp(n)}var Kk=d(()=>{s(TW,"globMatch");s(Uk,"globFilter");s(Bk,"expandBraces");s(xW,"matchOne");s(DW,"globToRegex");});function V(t,e,r,n={}){let o=[],{rules:i}=t;if(i.length===0)return [];if(i.some(l=>l.root)||o.push({level:"error",file:relative(e,i[0].source),message:"Rules exist but no root rule (_root.md or root: true). Add a root rule."}),n.checkGlobMatches===false)return o;for(let l of i){if(l.globs.length===0)continue;let c=false;for(let m of l.globs)if(Uk(r,m).length>0){c=true;break}c||o.push({level:"warning",file:relative(e,l.source),message:`globs "${l.globs.join(", ")}" match 0 files in project`});}return o}var It=d(()=>{Kk();s(V,"validateRules");});function Hk(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:En}))}var zk=d(()=>{It();ml();s(Hk,"lintRules");});function x(t,e,r){return {level:"warning",file:t,target:e,message:r}}function NW(t){return t.length===0?"":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function Ps(t,e,r,n){let o=n?.unsupportedBy??e,i=NW(r);return x(".agentsmesh/hooks.yaml",e,`${t} is not supported by ${o}; only ${i} are projected.`)}var Lt=d(()=>{s(x,"createWarning");s(NW,"formatOxfordComma");s(Ps,"createUnsupportedHookWarning");});function Vk(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","aider","Aider has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Jk(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","aider","Aider has no permissions config; canonical permissions are not projected.")]}function Yk(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","aider","Aider has no MCP config file; canonical MCP servers are not projected.")]}var Xk=d(()=>{Lt();s(Vk,"lintHooks");s(Jk,"lintPermissions");s(Yk,"lintMcp");});function E(t,e){return nt(t).relative(t,e).replace(/\\/g,"/")}async function L(t,e){return v(nt(t).join(t,e)).catch(()=>[])}function Qk(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}function jW(t,e,r,n){let o=posix.dirname(e),i=posix.dirname(r);for(;o!==n&&o!==".";)Qk(t,o,i),o=posix.dirname(o),i=posix.dirname(i);}function D(t,e,r,n){t.set(e,`${r}/${basename(e,n)}.md`);}function M(t,e,r){if(!e.startsWith(`${r}/`))return;let n=e.slice(r.length+1);if(!n)return;if(!n.includes("/")){if(!n.endsWith(".md")||basename(n)==="SKILL.md")return;let u=basename(n,".md");t.set(e,`${Zk}/${u}/SKILL.md`);return}let[o,...i]=n.split("/"),a=i.join("/");if(!o||!a)return;let l=o.startsWith(sl)?sl:o.startsWith(Vc)?Vc:null;if(l&&a==="SKILL.md"){t.set(e,`${$W}/${o.slice(l.length)}.md`);return}let c=o.startsWith(il)?il:o.startsWith(Jc)?Jc:null;if(c&&a==="SKILL.md"){t.set(e,`${GW}/${o.slice(c.length)}.md`);return}let m=`${Zk}/${o}`;a==="SKILL.md"&&Qk(t,`${r}/${o}`,m);let p=`${m}/${a}`;t.set(e,p),a!=="SKILL.md"&&jW(t,e,p,`${r}/${o}`);}function UW(t){return t.split("/").filter(Boolean)[0]??""}async function BW(){if(qg!==void 0)return qg;let{BUILTIN_TARGETS:t}=await Promise.resolve().then(()=>(Pt(),qk)),e=new Set;for(let r of t)for(let n of [r.project.rootInstructionPath,r.project.skillDir,...r.project.managedOutputs?.dirs??[],...r.project.managedOutputs?.files??[],...r.detectionPaths,r.globalSupport?.layout.rootInstructionPath,r.globalSupport?.layout.skillDir,...r.globalSupport?.layout.managedOutputs?.dirs??[],...r.globalSupport?.layout.managedOutputs?.files??[],...r.globalSupport?.detectionPaths??[]])if(n!==void 0){let o=UW(n);o.startsWith(".")&&e.add(o);}return qg=e,e}function eh(t){return t.split("/").some(e=>e.startsWith("."))}async function KW(t){let e=[],r=await BW(),n=nt(t);async function o(i){let a=n.join(t,i),l=await readdir(a,{withFileTypes:true}).catch(()=>[]);for(let c of l){let m=i?`${i}/${c.name}`:c.name;if(c.isDirectory()){if(r.has(c.name)||eh(m))continue;await o(m);continue}if(c.isSymbolicLink()&&await stat(n.join(t,m)).then(p=>p.isDirectory(),()=>false)){if(r.has(c.name)||eh(m))continue;await o(m);continue}(c.name==="AGENTS.md"||c.name==="AGENTS.override.md")&&e.push(n.join(t,m));}}return s(o,"walk"),await o(""),e}async function iu(t,e){let r=await KW(e);for(let n of r){let o=E(e,n),i=o.endsWith("/AGENTS.md")&&o!=="AGENTS.md"&&!o.endsWith("/AGENTS.override.md"),a=o.endsWith("/AGENTS.override.md")&&o!=="AGENTS.override.md";if(!i&&!a)continue;let l=posix.dirname(o);if(eh(l))continue;let c=l.replace(/\//g,"-");t.set(o,`${MW}/${c}.md`);}}var MW,$W,GW,Zk,qg,St=d(()=>{ae();w();kt();mt();MW=".agentsmesh/rules",$W=".agentsmesh/commands",GW=".agentsmesh/agents",Zk=".agentsmesh/skills";s(E,"rel");s(L,"listFiles");s(Qk,"addDirectoryMapping");s(jW,"addAncestorMappings");s(D,"addSimpleFileMapping");s(M,"addSkillLikeMapping");s(UW,"firstPathSegment");s(BW,"targetRootSegments");s(eh,"hasHiddenSegment");s(KW,"listScopedAgentsFiles");s(iu,"addScopedAgentsMappings");});var A,st,Ot,ht=d(()=>{A=".agentsmesh/rules",st=".agentsmesh/commands",Ot=".agentsmesh/agents";});async function rh(t,e,r="project"){if(r==="global"){t.set(Ao,`${A}/_root.md`);for(let n of await L(e,rr))M(t,E(e,n),rr);t.set(bi,".agentsmesh/ignore");return}t.set(er,`${A}/_root.md`);for(let n of await L(e,ie))M(t,E(e,n),ie);t.set(Oo,".agentsmesh/ignore");}var tE=d(()=>{St();ml();ht();s(rh,"buildAiderImportPaths");});var Pi,Wr,Ti,Ts,nm,eE,rE,om=d(()=>{Pi="amazon-q",Wr=".amazonq/rules",Ti=".amazonq/mcp.json",Ts=".aws/amazonq/rules",nm=".aws/amazonq/mcp.json",eE=".agentsmesh/rules",rE=".agentsmesh/mcp.json";});async function nh(t,e,r="project"){let n=r==="global"?Ts:Wr;for(let o of await L(e,n)){let i=E(e,o);D(t,i,A,".md");}}var nE=d(()=>{St();om();ht();s(nh,"buildAmazonQImportPaths");});var sr,le,On,oh,bo,ir,Po,oE,xi=d(()=>{sr="AGENTS.md",le=".agents/skills",On=".amp/settings.json",oh=".config/amp",bo=`${oh}/AGENTS.md`,ir=`${oh}/skills`,Po=`${oh}/settings.json`,oE=".agentsmesh/rules";});async function sh(t,e,r="project"){if(r==="global"){t.set(bo,`${A}/_root.md`);for(let n of await L(e,ir))M(t,E(e,n),ir);t.set(Po,".agentsmesh/mcp.json");return}t.set(sr,`${A}/_root.md`);for(let n of await L(e,le))M(t,E(e,n),le);t.set(On,".agentsmesh/mcp.json");}var sE=d(()=>{St();xi();ht();s(sh,"buildAmpImportPaths");});var Di,au,Hr,ar,sm,zr,An,im,wn,bn,am,fl,ih,Ni,lu,iE,Fi=d(()=>{Di="antigravity",au=".agents",Hr=`${au}/rules`,ar=`${Hr}/general.md`,sm=`${Hr}/_root.md`,zr=`${au}/skills`,An=`${au}/workflows`,im=`${au}/antigravity/mcp_config.json`,wn=".gemini/antigravity/GEMINI.md",bn=".gemini/antigravity/skills",am=".gemini/antigravity/workflows",fl=".gemini/antigravity/mcp_config.json",ih=".agentsmesh/rules/_root.md",Ni=".agentsmesh/rules",lu=".agentsmesh/commands",iE=".agentsmesh/mcp.json";});async function ah(t,e,r="project"){if(r==="global"){t.set(wn,`${A}/_root.md`);for(let n of await L(e,bn))M(t,E(e,n),bn);t.set(fl,".agentsmesh/mcp.json");return}t.set(ar,`${A}/_root.md`),t.set(sm,`${A}/_root.md`);for(let n of await L(e,Hr)){let o=E(e,n);o===ar||o===sm||D(t,o,A,".md");}for(let n of await L(e,An))D(t,E(e,n),st,".md");for(let n of await L(e,zr))M(t,E(e,n),zr);}var aE=d(()=>{St();Fi();ht();s(ah,"buildAntigravityImportPaths");});var ce,cu,De,lr,Ne,Pn,Tn,mu,To,xo,xn,Do,lh,ch,mh,ph,vi=d(()=>{ce="augment-code",cu=".augment",De=`${cu}/rules`,lr=`${cu}/commands`,Ne=`${cu}/skills`,Pn=`${cu}/settings.json`,Tn=".augmentignore",mu=".augment",To=`${mu}/rules`,xo=`${mu}/commands`,xn=`${mu}/skills`,Do=`${mu}/settings.json`,lh=".agentsmesh/rules",ch=".agentsmesh/mcp.json",mh=".agentsmesh/hooks.yaml",ph=".agentsmesh/ignore";});async function uh(t,e,r="project"){if(r==="global"){for(let n of await L(e,To))D(t,E(e,n),A,".md");for(let n of await L(e,xo))D(t,E(e,n),st,".md");for(let n of await L(e,xn))M(t,E(e,n),xn);t.set(Do,".agentsmesh/mcp.json");return}for(let n of await L(e,De))D(t,E(e,n),A,".md");for(let n of await L(e,lr))D(t,E(e,n),st,".md");for(let n of await L(e,Ne))M(t,E(e,n),Ne);t.set(Pn,".agentsmesh/mcp.json"),t.set(Tn,".agentsmesh/ignore");}var lE=d(()=>{St();vi();ht();s(uh,"buildAugmentCodeImportPaths");});var cE,xs,mE,lm,cm,mm,pm,um,No,dh,dm,gl,fm,gm,pu,uu,fh,hm,gh,Mi,pE,Fo=d(()=>{cE="claude-code",xs=".claude/CLAUDE.md",mE="CLAUDE.md",lm=".claude/rules",cm=".claude/commands",mm=".claude/agents",pm=".claude/skills",um=".claude/settings.json",No=".claude/hooks.json",dh=".claude/output-styles",dm=".claudeignore",gl=".mcp.json",fm=".claude.json",gm=".agentsmesh/rules",pu=".agentsmesh/commands",uu=".agentsmesh/agents",fh=".agentsmesh/skills",hm=".agentsmesh/mcp.json",gh=".agentsmesh/permissions.yaml",Mi=".agentsmesh/hooks.yaml",pE=".agentsmesh/ignore";});async function hh(t,e,r="project"){if(t.set(".claude/CLAUDE.md",`${A}/_root.md`),t.set(No,Mi),r==="project"&&t.set("CLAUDE.md",`${A}/_root.md`),r==="global")for(let n of await L(e,".agents/skills"))M(t,E(e,n),".agents/skills");for(let n of await L(e,".claude/rules"))D(t,E(e,n),A,".md");for(let n of await L(e,".claude/commands"))D(t,E(e,n),st,".md");for(let n of await L(e,".claude/agents"))D(t,E(e,n),Ot,".md");for(let n of await L(e,".claude/skills"))M(t,E(e,n),".claude/skills");}var uE=d(()=>{St();Fo();ht();s(hh,"buildClaudeCodeImportPaths");});var Ds,vo,$i,Mo,dE,Zt,Dn,Ns,Gi,ji,Ui,Bi,yh,Fs,du,_h,Rh,fE,gE,cr=d(()=>{Ds="cline",vo=".clinerules",$i=".clineignore",Mo=".cline/cline_mcp_settings.json",dE=".cline/mcp_settings.json",Zt=".cline/skills",Dn=".clinerules/workflows",Ns="AGENTS.md",Gi=".clinerules/hooks",ji="Documents/Cline/Rules",Ui="Documents/Cline/Workflows",Bi="Documents/Cline/Hooks",yh=".agentsmesh/hooks.yaml",Fs=".agentsmesh/rules",du=".agentsmesh/commands",_h=".agentsmesh/ignore",Rh=".agentsmesh/mcp.json",fE=".agentsmesh/agents",gE=".agentsmesh/skills";});async function Ih(t,e,r="project"){if(r==="global"){for(let n of await L(e,ji))D(t,E(e,n),A,".md");for(let n of await L(e,Ui))D(t,E(e,n),st,".md");for(let n of await L(e,Zt))M(t,E(e,n),Zt);t.set(Mo,".agentsmesh/mcp.json");return}t.set(".clinerules/_root.md",`${A}/_root.md`);for(let n of await L(e,".clinerules")){let o=E(e,n);!o.endsWith(".md")||o.includes("/workflows/")||basename(o)==="_root.md"||D(t,o,A,".md");}for(let n of await L(e,".clinerules/workflows"))D(t,E(e,n),st,".md");for(let n of await L(e,".cline/skills"))M(t,E(e,n),".cline/skills");}var hE=d(()=>{St();cr();ht();s(Ih,"buildClineImportPaths");});async function Sh(t,e,r="project"){if(r==="global"?(t.set(".codex/AGENTS.md",`${A}/_root.md`),t.set(".codex/AGENTS.override.md",`${A}/_root.md`)):(t.set("AGENTS.md",`${A}/_root.md`),t.set("codex.md",`${A}/_root.md`),await iu(t,e)),r==="project")for(let n of await L(e,".codex/instructions"))D(t,E(e,n),A,".md");for(let n of await L(e,".codex/rules")){let o=E(e,n);o.endsWith(".rules")?D(t,o,A,".rules"):o.endsWith(".md")&&D(t,o,A,".md");}for(let n of await L(e,".codex/agents"))D(t,E(e,n),Ot,".toml");for(let n of await L(e,".agents/skills"))M(t,E(e,n),".agents/skills");}var yE=d(()=>{St();ht();s(Sh,"buildCodexCliImportPaths");});var hl,Vr,Nn,Ch,fu,$o,kh,Fe,yl,ym,gu,hu,Eh,Fn=d(()=>{hl="continue",Vr=".continue/rules",Nn=".continue/prompts",Ch=".continue/mcpServers",fu=`${Ch}/agentsmesh.json`,$o=`${Vr}/general.md`,kh=`${Vr}/_root.md`,Fe=".continue/skills",yl=".continue/AGENTS.md",ym=".continue/config.yaml",gu=".agentsmesh/rules",hu=".agentsmesh/commands",Eh=".agentsmesh/mcp.json";});async function Lh(t,e,r="project"){t.set($o,`${A}/_root.md`),t.set(kh,`${A}/_root.md`);for(let n of await L(e,".continue/rules")){let o=E(e,n);o===$o||o===kh||D(t,o,A,".md");}for(let n of await L(e,".continue/prompts"))t.set(E(e,n),`${st}/${basename(n,".md")}.md`);for(let n of await L(e,".continue/skills"))M(t,E(e,n),".continue/skills");if(r==="global")for(let n of await L(e,".agents/skills"))M(t,E(e,n),".agents/skills");}var _E=d(()=>{St();Fn();ht();s(Lh,"buildContinueImportPaths");});function zW(t,e){if(e.endsWith(".instructions.md")){t.set(e,`${A}/${basename(e,".instructions.md")}.md`);return}D(t,e,A,".md");}async function Oh(t,e){t.set(".github/copilot-instructions.md",`${A}/_root.md`);for(let r of await L(e,".github/copilot"))t.set(E(e,r),`${A}/${basename(r,".instructions.md")}.md`);for(let r of await L(e,".github/instructions"))zW(t,E(e,r));for(let r of await L(e,".github/prompts"))t.set(E(e,r),`${st}/${basename(r,".prompt.md")}.md`);for(let r of await L(e,".github/agents"))t.set(E(e,r),`${Ot}/${basename(r,".agent.md")}.md`);for(let r of await L(e,".github/skills"))M(t,E(e,r),".github/skills");}var RE=d(()=>{St();ht();s(zW,"addCopilotInstructionMapping");s(Oh,"buildCopilotImportPaths");});var mr,pr,Qt,ve,Go,IE,_u,Me,Ki,Ru,Iu,Su,_l=d(()=>{mr="crush",pr="CRUSH.md",Qt=".crush/skills",ve="crush.json",Go=".crushignore",IE=".config/crush",_u=`${IE}/crush.json`,Me=".config/crush/skills",Ki=`${IE}/CRUSH.md`,Ru=".agentsmesh/rules",Iu=".agentsmesh/ignore",Su=".agentsmesh/mcp.json";});async function Ah(t,e,r="project"){if(r==="global"){for(let n of await L(e,Me))M(t,E(e,n),Me);return}t.set(pr,`${Ru}/_root.md`),t.set(ve,Su),t.set(Go,Iu);for(let n of await L(e,Qt))M(t,E(e,n),Qt);}var SE=d(()=>{St();_l();s(Ah,"buildCrushImportPaths");});var CE,vs,kE,ur,jo,dr,fr,me,$e,vn,Cu,Jr,wh,VW,Rl,Yr,Mn,Ms,$s,EE,Il,bh,_m,Ph,Kt=d(()=>{CE="cursor",vs="AGENTS.md",kE=".cursorrules",ur=".cursor/rules",jo=`${ur}/general.mdc`,dr=".cursor/commands",fr=".cursor/agents",me=".cursor/skills",$e=".cursor/mcp.json",vn=".cursor/hooks.json",Cu=".cursor/settings.json",Jr=".cursorignore",wh=".cursorindexingignore",VW=".agentsmesh-exports/cursor",Rl=`${VW}/user-rules.md`,Yr=".cursor/AGENTS.md",Mn=".agentsmesh/rules",Ms=".agentsmesh/commands",$s=".agentsmesh/agents",EE=".agentsmesh/skills",Il=".agentsmesh/mcp.json",bh=".agentsmesh/permissions.yaml",_m=".agentsmesh/hooks.yaml",Ph=".agentsmesh/ignore";});async function Th(t,e,r="project"){if(r==="global"){t.set($e,".agentsmesh/mcp.json"),t.set(".cursor/AGENTS.md",`${A}/_root.md`);for(let n of await L(e,".cursor/rules"))D(t,E(e,n),A,".mdc");for(let n of await L(e,".cursor/commands"))D(t,E(e,n),st,".md");for(let n of await L(e,".cursor/agents"))D(t,E(e,n),Ot,".md");for(let n of await L(e,".cursor/skills"))M(t,E(e,n),".cursor/skills");return}t.set("AGENTS.md",`${A}/_root.md`);for(let n of await L(e,".cursor/rules"))D(t,E(e,n),A,".mdc");for(let n of await L(e,".cursor/commands"))D(t,E(e,n),st,".md");for(let n of await L(e,".cursor/agents"))D(t,E(e,n),Ot,".md");for(let n of await L(e,".cursor/skills"))M(t,E(e,n),".cursor/skills");}var LE=d(()=>{St();Kt();ht();s(Th,"buildCursorImportPaths");});var $n,gr,pe,Uo,Bo,Xr,Wi,OE,Sl=d(()=>{$n="deepagents-cli",gr=".deepagents/AGENTS.md",pe=".deepagents/skills",Uo=".mcp.json",Bo=".deepagents/AGENTS.md",Xr=".deepagents/skills",Wi=".deepagents/.mcp.json",OE=".agentsmesh/rules";});async function xh(t,e,r="project"){if(r==="global"){t.set(Bo,`${A}/_root.md`);for(let n of await L(e,Xr))M(t,E(e,n),Xr);t.set(Wi,".agentsmesh/mcp.json");return}t.set(gr,`${A}/_root.md`);for(let n of await L(e,pe))M(t,E(e,n),pe);t.set(Uo,".agentsmesh/mcp.json");}var AE=d(()=>{St();Sl();ht();s(xh,"buildDeepagentsCliImportPaths");});var hr,yr,Le,Gn,jn,Ko,Un,Hi,Gs,wE,zi=d(()=>{hr="factory-droid",yr="AGENTS.md",Le=".factory/skills",Gn=".factory/droids",jn=".factory/mcp.json",Ko=".factory/AGENTS.md",Un=".factory/skills",Hi=".factory/droids",Gs=".factory/mcp.json",wE=".agentsmesh/rules";});async function Dh(t,e,r="project"){if(r==="global"){t.set(Ko,`${A}/_root.md`);for(let n of await L(e,Hi))D(t,E(e,n),Ot,".md");for(let n of await L(e,Un))M(t,E(e,n),Un);t.set(Gs,".agentsmesh/mcp.json");return}t.set(yr,`${A}/_root.md`);for(let n of await L(e,Gn))D(t,E(e,n),Ot,".md");for(let n of await L(e,Le))M(t,E(e,n),Le);t.set(jn,".agentsmesh/mcp.json");}var bE=d(()=>{St();zi();ht();s(Dh,"buildFactoryDroidImportPaths");});async function Nh(t,e){for(let r of await L(e,".gemini/rules"))D(t,E(e,r),A,".md");for(let r of await L(e,".gemini/commands")){let n=E(e,r);if(!n.endsWith(".toml")&&!n.endsWith(".md"))continue;let o=n.replace(/\.(toml|md)$/i,""),i=".gemini/commands/",c=(o.startsWith(i)?o.slice(i.length):o).split("/").filter(Boolean).join(":");t.set(n,`${st}/${c}.md`);}for(let r of await L(e,".gemini/agents"))D(t,E(e,r),Ot,".md");for(let r of await L(e,".gemini/skills"))M(t,E(e,r),".gemini/skills");}var PE=d(()=>{St();ht();s(Nh,"buildGeminiCliImportPaths");});var Bn,_r,Oe,Wo,TE,Ho,Vi,Rr,xE,DE,Cl=d(()=>{Bn="goose",_r=".goosehints",Oe=".agents/skills",Wo=".gooseignore",TE=".config/goose",Ho=`${TE}/.goosehints`,Vi=`${TE}/.gooseignore`,Rr=".agents/skills",xE=".agentsmesh/rules",DE=".agentsmesh/ignore";});async function Fh(t,e,r="project"){if(r==="global"){t.set(Ho,`${A}/_root.md`);for(let n of await L(e,Rr))M(t,E(e,n),Rr);t.set(Vi,".agentsmesh/ignore");return}t.set(_r,`${A}/_root.md`);for(let n of await L(e,Oe))M(t,E(e,n),Oe);t.set(Wo,".agentsmesh/ignore");}var NE=d(()=>{St();Cl();ht();s(Fh,"buildGooseImportPaths");});var zo,Zr,FE,kl=d(()=>{zo="jules",Zr="AGENTS.md",FE=".agentsmesh/rules";});async function vh(t,e,r="project"){r!=="global"&&t.set(Zr,`${A}/_root.md`);}var vE=d(()=>{kl();ht();s(vh,"buildJulesImportPaths");});var Ji,js,ku,ME,Kn,$E,JW,Rm,Yi,Im,El,Ll,Sm,Cm,km,Em,Lm,YW,Eu,Xi,GE,Mh,Lu,jE,UE,BE,KE,Ol=d(()=>{Ji="junie",js=".junie",ku=`${js}/guidelines.md`,ME=`${js}/ci-guidelines.md`,Kn=`${js}/AGENTS.md`,$E="AGENTS.md",JW=`${js}/mcp`,Rm=`${JW}/mcp.json`,Yi=`${js}/skills`,Im=`${js}/rules`,El=`${js}/commands`,Ll=`${js}/agents`,Sm=".aiignore",Cm=".junie",km=`${Cm}/skills`,Em=`${Cm}/agents`,Lm=`${Cm}/commands`,YW=`${Cm}/mcp`,Eu=`${YW}/mcp.json`,Xi=`${Cm}/AGENTS.md`,GE=".agents/skills",Mh=".agentsmesh/rules/_root.md",Lu=".agentsmesh/rules",jE=".agentsmesh/commands",UE=".agentsmesh/agents",BE=".agentsmesh/mcp.json",KE=".agentsmesh/ignore";});async function $h(t,e){t.set(ku,`${A}/_root.md`),t.set(Kn,`${A}/_root.md`),t.set("AGENTS.md",`${A}/_root.md`);for(let r of await L(e,".junie/rules"))D(t,E(e,r),A,".md");for(let r of await L(e,".junie/commands"))D(t,E(e,r),st,".md");for(let r of await L(e,".junie/agents"))D(t,E(e,r),Ot,".md");for(let r of await L(e,".junie/skills"))M(t,E(e,r),".junie/skills");}var WE=d(()=>{St();Ol();ht();s($h,"buildJunieImportPaths");});var _e,Om,Wn,Vo,Jo,Yo,Qr,Us,Al,Ou,Zi,wl,Qi,Am,Au,bl,Bs,qi,ta,ea,Ks,Pl,wu,HE,Ws,Tl,ra,zE,VE,na=d(()=>{_e="kilo-code",Om=".kilo",Wn="AGENTS.md",Vo=`${Om}/rules`,Jo=`${Om}/commands`,Yo=`${Om}/agents`,Qr=`${Om}/skills`,Us=`${Om}/mcp.json`,Al=".kilocodeignore",Ou=".kilocode",Zi=`${Ou}/rules`,wl=`${Ou}/workflows`,Qi=`${Ou}/skills`,Am=`${Ou}/mcp.json`,Au=".kilocodemodes",bl=".kilo",Bs=`${bl}/AGENTS.md`,qi=`${bl}/rules`,ta=`${bl}/commands`,ea=`${bl}/agents`,Ks=`${bl}/skills`,Pl=`${bl}/mcp.json`,wu=".kilocodeignore",HE=".agents/skills",Ws=".agentsmesh/rules",Tl=".agentsmesh/commands",ra=".agentsmesh/agents",zE=".agentsmesh/mcp.json",VE=".agentsmesh/ignore";});async function Gh(t,e,r="project"){if(r==="global"){t.set(Bs,`${A}/_root.md`);for(let n of await L(e,qi))D(t,E(e,n),A,".md");for(let n of await L(e,ta))D(t,E(e,n),st,".md");for(let n of await L(e,ea))D(t,E(e,n),Ot,".md");for(let n of await L(e,Ks))M(t,E(e,n),Ks);t.set(Pl,".agentsmesh/mcp.json");return}t.set(Wn,`${A}/_root.md`);for(let n of await L(e,Vo))D(t,E(e,n),A,".md");for(let n of await L(e,Jo))D(t,E(e,n),st,".md");for(let n of await L(e,Yo))D(t,E(e,n),Ot,".md");for(let n of await L(e,Qr))M(t,E(e,n),Qr);t.set(Us,".agentsmesh/mcp.json");for(let n of await L(e,Zi)){let o=E(e,n);if(basename(o)==="00-root.md"){t.set(o,`${A}/_root.md`);continue}D(t,o,A,".md");}for(let n of await L(e,wl))D(t,E(e,n),st,".md");for(let n of await L(e,Qi))M(t,E(e,n),Qi);t.set(Am,".agentsmesh/mcp.json");}var JE=d(()=>{St();na();ht();s(Gh,"buildKiloCodeImportPaths");});var Ge,qr,wm,tn,Re,en,Hs,ZW,xl,Dl,oa,rn,zs,sa,bm,Pm,YE,jh,Uh,XE,ZE,Bh,QE,Nl=d(()=>{Ge="kiro",qr="AGENTS.md",wm=".kiro",tn=`${wm}/steering`,Re=`${wm}/skills`,en=`${wm}/agents`,Hs=`${wm}/hooks`,ZW=`${wm}/settings`,xl=`${ZW}/mcp.json`,Dl=".kiroignore",oa=".kiro/steering",rn=".kiro/steering/AGENTS.md",zs=".kiro/skills",sa=".kiro/agents",bm=".kiro/settings/mcp.json",Pm=".kiro/settings/kiroignore",YE=".agents/skills",jh=".agentsmesh/rules/_root.md",Uh=".agentsmesh/rules",XE=".agentsmesh/agents",ZE=".agentsmesh/mcp.json",Bh=".agentsmesh/hooks.yaml",QE=".agentsmesh/ignore";});async function Kh(t,e,r="project"){if(r==="global"){t.set(rn,`${A}/_root.md`);for(let n of await L(e,oa)){let o=E(e,n);o!==rn&&D(t,o,A,".md");}for(let n of await L(e,zs))M(t,E(e,n),zs);for(let n of await L(e,sa))D(t,E(e,n),Ot,".md");return}t.set(qr,`${A}/_root.md`);for(let n of await L(e,tn))D(t,E(e,n),A,".md");for(let n of await L(e,Re))M(t,E(e,n),Re);for(let n of await L(e,en))D(t,E(e,n),Ot,".md");}var qE=d(()=>{St();Nl();ht();s(Kh,"buildKiroImportPaths");});var nn,bu,Hn,Xo,Zo,Qo,on,zn,Fl,Vs,ia,aa,la,Js,Ys,tL,Tm,Pu,Tu,Wh,ca=d(()=>{nn="opencode",bu=".opencode",Hn="AGENTS.md",Xo=`${bu}/rules`,Zo=`${bu}/commands`,Qo=`${bu}/agents`,on=`${bu}/skills`,zn="opencode.json",Fl=".config/opencode",Vs=`${Fl}/AGENTS.md`,ia=`${Fl}/rules`,aa=`${Fl}/commands`,la=`${Fl}/agents`,Js=`${Fl}/skills`,Ys=`${Fl}/opencode.json`,tL=".agents/skills",Tm=".agentsmesh/rules",Pu=".agentsmesh/commands",Tu=".agentsmesh/agents",Wh=".agentsmesh/mcp.json";});async function Hh(t,e,r="project"){if(r==="global"){t.set(Vs,`${A}/_root.md`);for(let n of await L(e,ia))D(t,E(e,n),A,".md");for(let n of await L(e,aa))D(t,E(e,n),st,".md");for(let n of await L(e,la))D(t,E(e,n),Ot,".md");for(let n of await L(e,Js))M(t,E(e,n),Js);t.set(Ys,".agentsmesh/mcp.json");return}t.set(Hn,`${A}/_root.md`);for(let n of await L(e,Xo))D(t,E(e,n),A,".md");for(let n of await L(e,Zo))D(t,E(e,n),st,".md");for(let n of await L(e,Qo))D(t,E(e,n),Ot,".md");for(let n of await L(e,on))M(t,E(e,n),on);t.set(zn,".agentsmesh/mcp.json");}var eL=d(()=>{St();ca();ht();s(Hh,"buildOpencodeImportPaths");});var Vn,Ir,qt,rL,qo,Sr,nL,vl=d(()=>{Vn="pi-agent",Ir="AGENTS.md",qt=".pi/skills",rL=".pi/agent",qo=`${rL}/AGENTS.md`,Sr=`${rL}/skills`,nL=".agentsmesh/rules";});async function zh(t,e,r="project"){if(r==="global"){t.set(qo,`${A}/_root.md`);for(let n of await L(e,Sr))M(t,E(e,n),Sr);return}t.set(Ir,`${A}/_root.md`);for(let n of await L(e,qt))M(t,E(e,n),qt);}var Vh=d(()=>{St();vl();ht();s(zh,"buildPiAgentImportPaths");});var Jn,Cr,ts,Yn,Xn,je,Xs,Zs,es,ma,Qs,Zn,qs,Jh,oL,sL,Ml=d(()=>{Jn="qwen-code",Cr="QWEN.md",ts=".qwen/rules",Yn=".qwen/commands",Xn=".qwen/agents",je=".qwen/skills",Xs=".qwen/settings.json",Zs=".qwenignore",es=".qwen/QWEN.md",ma=".qwen/settings.json",Qs=".qwen/commands",Zn=".qwen/skills",qs=".qwen/agents",Jh=".agentsmesh/rules",oL=".agentsmesh/commands",sL=".agentsmesh/agents";});async function Yh(t,e,r="project"){if(r==="global"){t.set(es,`${A}/_root.md`),t.set(ma,".agentsmesh/mcp.json");for(let n of await L(e,Qs))D(t,E(e,n),st,".md");for(let n of await L(e,qs))D(t,E(e,n),Ot,".md");for(let n of await L(e,Zn))M(t,E(e,n),Zn);return}t.set(Cr,`${A}/_root.md`),t.set(Xs,".agentsmesh/mcp.json"),t.set(Zs,".agentsmesh/ignore");for(let n of await L(e,ts))D(t,E(e,n),A,".md");for(let n of await L(e,Yn))D(t,E(e,n),st,".md");for(let n of await L(e,Xn))D(t,E(e,n),Ot,".md");for(let n of await L(e,je))M(t,E(e,n),je);}var iL=d(()=>{St();ht();Ml();s(Yh,"buildQwenCodeImportPaths");});var Qn,sn,Ae,aL,$l=d(()=>{Qn="replit-agent",sn="replit.md",Ae=".agents/skills",aL=".agentsmesh/rules";});async function Xh(t,e,r="project"){if(r!=="global"){t.set(sn,`${A}/_root.md`);for(let n of await L(e,Ae))M(t,E(e,n),Ae);}}var Zh=d(()=>{St();$l();ht();s(Xh,"buildReplitAgentImportPaths");});var ti,pa,an,xm,rs,ns,qn,Dm,Nm,Gl,Fm,xu,ei,ri,os,ua,vm,ni,lL,da,Du,cL,mL,fa=d(()=>{ti="roo-code",pa=".roo",an=`${pa}/rules/00-root.md`,xm=".roorules",rs=`${pa}/rules`,ns=`${pa}/commands`,qn=`${pa}/skills`,Dm=`${pa}/mcp.json`,Nm=".rooignore",Gl=".roomodes",Fm="settings/custom_modes.yaml",xu=".roo",ei=`${xu}/rules`,ri=`${xu}/commands`,os=`${xu}/skills`,ua="mcp_settings.json",vm=".rooignore",ni=`${xu}/AGENTS.md`,lL=".agents/skills",da=".agentsmesh/rules",Du=".agentsmesh/commands",cL=".agentsmesh/mcp.json",mL=".agentsmesh/ignore";});async function Qh(t,e,r="project"){if(r==="global"){t.set(ni,`${A}/_root.md`);for(let n of await L(e,ei))D(t,E(e,n),A,".md");for(let n of await L(e,ri))D(t,E(e,n),st,".md");for(let n of await L(e,os))M(t,E(e,n),os);t.set(ua,".agentsmesh/mcp.json");return}t.set(an,`${A}/_root.md`),t.set(xm,`${A}/_root.md`);for(let n of await L(e,rs)){let o=E(e,n);o!==an&&D(t,o,A,".md");}for(let n of await L(e,".roo")){let o=E(e,n);/^\.roo\/rules-[^/]+\/.+\.md$/.test(o)&&D(t,o,A,".md");}for(let n of await L(e,ns))D(t,E(e,n),st,".md");for(let n of await L(e,qn))M(t,E(e,n),qn);}var pL=d(()=>{St();fa();ht();s(Qh,"buildRooCodeImportPaths");});var to,kr,uL,te,ss,dL,is,Ue,jl,fL,Ul=d(()=>{to="rovodev",kr="AGENTS.md",uL=".rovodev",te=`${uL}/skills`,ss=`${uL}/mcp.json`,dL=".rovodev",is=".rovodev/AGENTS.md",Ue=".rovodev/skills",jl=".rovodev/mcp.json",fL=".agentsmesh/rules";});async function qh(t,e,r="project"){if(r==="global"){t.set(is,`${A}/_root.md`);for(let n of await L(e,Ue))M(t,E(e,n),Ue);t.set(jl,".agentsmesh/mcp.json");return}t.set(kr,`${A}/_root.md`);for(let n of await L(e,te))M(t,E(e,n),te);t.set(ss,".agentsmesh/mcp.json");}var gL=d(()=>{St();Ul();ht();s(qh,"buildRovodevImportPaths");});var Er,Nu,Be,Ke,Lr,ga,Bl,as,Or,ln,Mm,hL,$m,yL,_L,Kl=d(()=>{Er="trae",Nu=".trae",Be=`${Nu}/rules`,Ke=`${Be}/project_rules.md`,Lr=`${Nu}/skills`,ga=`${Nu}/mcp.json`,Bl=`${Nu}/.ignore`,as=".trae/user_rules",Or=".trae/user_rules/rules.md",ln=".trae/skills",Mm=".trae/mcp.json",hL=".agents/skills",$m=".agentsmesh/rules",yL=".agentsmesh/mcp.json",_L=".agentsmesh/ignore";});async function ty(t,e,r="project"){if(r==="global"){t.set(Or,`${A}/_root.md`);for(let n of await L(e,as)){let o=E(e,n);o!==Or&&D(t,o,A,".md");}for(let n of await L(e,ln))M(t,E(e,n),ln);return}t.set(Ke,`${A}/_root.md`);for(let n of await L(e,Be)){let o=E(e,n);o!==Ke&&D(t,o,A,".md");}for(let n of await L(e,Lr))M(t,E(e,n),Lr);}var RL=d(()=>{St();Kl();ht();s(ty,"buildTraeImportPaths");});var eo,cn,ey,ue,oi,We,IL,Wl=d(()=>{eo="warp",cn="AGENTS.md",ey="WARP.md",ue=".warp/skills",oi=".mcp.json",We=".warp/skills",IL=".agentsmesh/rules";});async function ry(t,e,r="project"){if(r==="global"){for(let n of await L(e,We))M(t,E(e,n),We);return}t.set(cn,`${A}/_root.md`);for(let n of await L(e,ue))M(t,E(e,n),ue);t.set(oi,".agentsmesh/mcp.json");}var SL=d(()=>{St();Wl();ht();s(ry,"buildWarpImportPaths");});async function ny(t,e){t.set("AGENTS.md",`${A}/_root.md`),t.set(".windsurfrules",`${A}/_root.md`),await iu(t,e);for(let r of await L(e,".windsurf/rules"))D(t,E(e,r),A,".md");for(let r of await L(e,".windsurf/workflows"))D(t,E(e,r),st,".md");for(let r of await L(e,".windsurf/skills"))M(t,E(e,r),".windsurf/skills");}var CL=d(()=>{St();ht();s(ny,"buildWindsurfImportPaths");});var mn,ro,QW,no,kL,ha=d(()=>{mn=".rules",ro=".zed/settings.json",QW=".config/zed",no=`${QW}/settings.json`,kL=".agentsmesh/rules";});async function oy(t,e,r="project"){if(r==="global"){t.set(no,".agentsmesh/mcp.json");return}t.set(mn,`${A}/_root.md`),t.set(ro,".agentsmesh/mcp.json");}var EL=d(()=>{ha();ht();s(oy,"buildZedImportPaths");});var LL=d(()=>{tE();nE();sE();aE();lE();uE();hE();yE();_E();RE();SE();LE();AE();bE();PE();NE();vE();WE();JE();qE();eL();Vh();iL();Zh();pL();gL();RL();SL();CL();EL();});var Ct=d(()=>{LL();});var qW,tH,eH,OL,su,Qg=d(()=>{kt();mt();ek();jk();zk();Xk();Ct();ml();qW={name:En,primaryRootInstructionPath:er,generateRules:XC,generateCommands:QC,generateAgents:qC,generateSkills:ZC,generateIgnore:tk,importFrom:Gk},tH={rootInstructionPath:er,skillDir:ie,managedOutputs:{dirs:[ie],files:[er,Oo]},paths:{rulePath(t){return er},commandPath(t){return `${ie}/${H(t)}/SKILL.md`},agentPath(t){return `${ie}/${U(t)}/SKILL.md`}}},eH={rootInstructionPath:Ao,skillDir:rr,managedOutputs:{dirs:[rr],files:[Ao,bi]},rewriteGeneratedPath(t){return t===er?Ao:t===Oo?bi:t.startsWith(`${ie}/`)?t.replace(`${ie}/`,`${rr}/`):t},paths:{rulePath(t){return Ao},commandPath(t){return `${rr}/${H(t)}/SKILL.md`},agentPath(t){return `${rr}/${U(t)}/SKILL.md`}}},OL={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"native",permissions:"none"},su={id:En,metadata:{displayName:"Aider",category:"cli",officialUrl:"https://aider.chat",shortDescription:"Open-source terminal AI pair programmer"},generators:qW,capabilities:OL,emptyImportMessage:"No Aider config found (CONVENTIONS.md, .aider/skills, or .aiderignore).",lintRules:Hk,lint:{hooks:Vk,permissions:Jk,mcp:Yk},supportsConversion:{commands:true,agents:true},project:tH,globalSupport:{capabilities:OL,detectionPaths:[Ao,bi,rr],layout:eH},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[er],global:[Ao]},canonicalDir:JC,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Oo],global:[bi]},canonicalDir:".agentsmesh",canonicalFilename:YC}},buildImportPaths:rh,detectionPaths:[er,Oo]};});function AL(t){let e=[];for(let r of t.rules){if(r.targets.length>0&&!r.targets.includes(Pi))continue;let n=r.root?"_root":basename(r.source,".md");e.push({path:`${Wr}/${n}.md`,content:r.body.trim()});}return e}function wL(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Ti,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var bL=d(()=>{om();s(AL,"generateRules");s(wL,"generateMcp");});async function PL(t,e){let r=e?.scope??"project";return J(Fu,t,r)}var TL=d(()=>{Et();sy();s(PL,"importFromAmazonQ");});function xL(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Pi}))}var DL=d(()=>{It();om();s(xL,"lintRules");});var nH,oH,sH,iH,Fu,sy=d(()=>{bL();TL();DL();Ct();om();nH={name:Pi,generateRules:AL,generateMcp:wL,importFrom:PL},oH={managedOutputs:{dirs:[Wr],files:[Ti]},paths:{rulePath(t,e){return `${Wr}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},sH={managedOutputs:{dirs:[Ts],files:[nm]},rewriteGeneratedPath(t){return t.startsWith(`${Wr}/`)?t.replace(`${Wr}/`,`${Ts}/`):t===Ti?nm:t},paths:{rulePath(t,e){return `${Ts}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},iH={rules:"native",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Fu={id:Pi,metadata:{displayName:"Amazon Q Developer",category:"ide",officialUrl:"https://aws.amazon.com/q/developer",shortDescription:"AWS AI coding assistant"},generators:nH,capabilities:{rules:"native",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Amazon Q Developer config found (.amazonq/rules/ or .amazonq/mcp.json).",lintRules:xL,project:oH,globalSupport:{capabilities:iH,detectionPaths:[Ts,nm],layout:sH},importer:{rules:{feature:"rules",mode:"directory",source:{project:[Wr],global:[Ts]},canonicalDir:eE,extensions:[".md"],preset:"rule"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Ti],global:[nm]},canonicalDir:".agentsmesh",canonicalFilename:rE}},buildImportPaths:nh,detectionPaths:[Wr,Ti]};});function NL(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes("amp")),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:sr,content:o}]:[]}function FL(t){return rt(t,le)}function vL(t){return t.commands.map(e=>({path:`${le}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function ML(t){return t.agents.map(e=>({path:`${le}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}var $L=d(()=>{tt();Ut();mt();kt();xi();s(NL,"generateRules");s(FL,"generateSkills");s(vL,"generateCommands");s(ML,"generateAgents");});function pt(t,e,r){let n=r.some(o=>aH.includes(o));return t.startsWith(`${e}/`)&&!n?`.agents/skills/${t.slice(e.length+1)}`:null}var aH,ee=d(()=>{aH=["amp","antigravity","codex-cli","goose","replit-agent"];s(pt,"mirrorSkillsToAgents");});async function jL(t,e,r){let n=await _(join(t,e));if(n===null)return;let o;try{o=JSON.parse(n);}catch{return}if(o===null||typeof o!="object"||Array.isArray(o))return;let i=o,a=i["amp.mcpServers"]??i.mcpServers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let l={};for(let[c,m]of Object.entries(a))!m||typeof m!="object"||Array.isArray(m)||(l[c]=m);Object.keys(l).length!==0&&(await Bt(t,GL,l),r.push({fromTool:"amp",fromPath:e,toPath:GL,feature:"mcp"}));}var GL,UL=d(()=>{w();Kr();xi();GL=".agentsmesh/mcp.json";s(jL,"importAmpMcp");});async function BL(t,e={}){let r=e.scope??"project",n=[],o=await B("amp",t,r);return n.push(...await J(vu,t,r,{normalize:o})),await q(t,r==="global"?ir:le,"amp",n,o),await jL(t,r==="global"?Po:On,n),n}var KL=d(()=>{dt();tt();Et();UL();xi();iy();s(BL,"importFromAmp");});function WL(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:"amp"}))}var HL=d(()=>{It();xi();s(WL,"lintRules");});function zL(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","amp","Amp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function VL(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","amp","Amp permissions are managed via amp.permissions in settings.json; canonical permissions are not projected.")]}function JL(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","amp","Amp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var YL=d(()=>{Lt();s(zL,"lintHooks");s(VL,"lintPermissions");s(JL,"lintIgnore");});function uH(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let n=JSON.parse(e);if(n===null||typeof n!="object"||Array.isArray(n))return t;let o=n;return o["amp.mcpServers"]!==void 0&&(r["amp.mcpServers"]=o["amp.mcpServers"]),JSON.stringify(r,null,2)}var cH,mH,pH,XL,vu,iy=d(()=>{kt();mt();$L();ee();KL();HL();YL();Ct();xi();cH={name:"amp",primaryRootInstructionPath:sr,generateRules:NL,generateCommands:vL,generateAgents:ML,generateSkills:FL,importFrom:BL},mH={rootInstructionPath:sr,skillDir:le,managedOutputs:{dirs:[le],files:[sr,On]},paths:{rulePath(t){return sr},commandPath(t){return `${le}/${H(t)}/SKILL.md`},agentPath(t){return `${le}/${U(t)}/SKILL.md`}}},pH={rootInstructionPath:bo,skillDir:ir,managedOutputs:{dirs:[ir],files:[bo,Po]},rewriteGeneratedPath(t){return t===sr?bo:t===On?Po:t.startsWith(`${le}/`)?t.replace(`${le}/`,`${ir}/`):t},mirrorGlobalPath(t,e){return pt(t,ir,e)},paths:{rulePath(t){return bo},commandPath(t){return `${ir}/${H(t)}/SKILL.md`},agentPath(t){return `${ir}/${U(t)}/SKILL.md`}}},XL={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(uH,"mergeAmpSettings");vu={id:"amp",metadata:{displayName:"Amp",category:"cli",officialUrl:"https://ampcode.com",shortDescription:"Sourcegraph's coding agent"},generators:cH,capabilities:XL,emptyImportMessage:"No Amp config found (AGENTS.md, .agents/skills, or .amp/settings.json).",lintRules:WL,lint:{hooks:zL,permissions:VL,ignore:JL},supportsConversion:{commands:true,agents:true},project:mH,globalSupport:{capabilities:XL,detectionPaths:[bo,Po],layout:pH},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[sr],global:[bo]},canonicalDir:oE,canonicalRootFilename:"_root.md",markAsRoot:true}},emitScopedSettings(t,e){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:On,content:JSON.stringify({"amp.mcpServers":t.mcp.mcpServers},null,2)}]},mergeGeneratedOutputContent(t,e,r,n){return n===On||n===Po?uH(t,r):null},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:sh,detectionPaths:[sr,On],conversionDefaults:{commandsToSkills:true,agentsToSkills:true}};});function ZL(t){let e=t.rules.find(n=>n.root);if(!e)return [];let r=[{path:ar,content:e.body.trim()||""}];for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("antigravity"))continue;let o=basename(n.source,".md");r.push({path:`${Hr}/${o}.md`,content:n.body.trim()||""});}return r}function QL(t){return t.commands.map(e=>{let r=e.description.trim(),n=e.body.trim(),o=r&&n&&!n.startsWith(r)?`${r}
53
59
 
54
- ${o}`:o||r;return {path:`${En}/${e.name}.md`,content:n}})}function OO(t){return tt(t,Mr)}function LO(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Dl,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function AO(t){return t.agents.map(e=>({path:`${Mr}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function kO(t){let e=t.rules.find(o=>o.root),r=t.rules.filter(o=>o.root?false:o.targets.length===0||o.targets.includes("antigravity"));return it(e?.body.trim()??"",r)}var wO=d(()=>{Q();Mt();st();wi();s(CO,"generateRules");s(EO,"generateCommands");s(OO,"generateSkills");s(LO,"generateMcp");s(AO,"generateAgents");s(kO,"renderAntigravityGlobalInstructions");});function E0(t){let e=t.replace(/\\/g,"/");return !e.startsWith("rules/")||e.endsWith("/")||!e.endsWith(".md")?null:e}async function Qo(t){let e=jS(t.content),r=[];if(e.rules.length===0)return {rootContent:e.rootContent,results:r};await L(join(t.projectRoot,t.rulesDir));for(let o of e.rules){let n=E0(o.source);if(n===null||n==="rules/_root.md")continue;let i=join(t.projectRoot,".agentsmesh",n),a=t.normalize(o.body,t.sourcePath,i),{frontmatter:c,body:l}=k(a),m=await K(i,{...c,root:false,description:o.description||void 0,globs:o.globs.length>0?o.globs:void 0,targets:o.targets.length>0?o.targets:void 0},l);await _(i,m),r.push({fromTool:t.fromTool,fromPath:t.sourcePath,toPath:`.agentsmesh/${n}`,feature:"rules"});}return {rootContent:e.rootContent,results:r}}var Tc=d(()=>{T();M();Mt();lt();s(E0,"canonicalRulePath");s(Qo,"splitEmbeddedRulesToCanonical");});async function O0(t,e,r,o){let n=o==="global"?So:Gr,i=o==="project"?[n,xl]:[n];for(let a of i){let c=join(t,a),l=await y(c);if(l===null)continue;let m=join(t,af),p=await Qo({content:l,projectRoot:t,rulesDir:ki,sourcePath:c,fromTool:Ai,normalize:r});e.push(...p.results);let{body:u}=k(r(p.rootContent,c,m)),g=await K(m,{root:true},u);await L(join(t,ki)),await _(m,g),e.push({fromTool:Ai,fromPath:c,toPath:af,feature:"rules"});return}}async function bO(t,e={}){let r=e.scope??"project",o=[],n=await U(Ai,t,r);return await O0(t,o,n,r),o.push(...await z(tu,t,r,{normalize:n})),await Z(t,r==="global"?On:Mr,Ai,o,n),o}var PO=d(()=>{mt();T();M();Q();Ct();lt();Tc();wi();mh();s(O0,"importRootRule");s(bO,"importFromAntigravity");});var NO,FO,vO=d(()=>{M();lt();wi();NO=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(basename(t)==="general.md"||basename(t)==="_root.md")return null;let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${ki}/${t}`,content:await K(o,{root:false,description:typeof n.description=="string"?n.description:void 0,globs:Array.isArray(n.globs)?n.globs:void 0},i)}},"nonRootRuleMapper"),FO=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Lp}/${t}`,content:await ht(o,{hasDescription:typeof n.description=="string",description:typeof n.description=="string"?n.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"workflowMapper");});function GO(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Ai}))}var MO=d(()=>{_t();wi();s(GO,"lintRules");});var L0,A0,k0,w0,tu,mh=d(()=>{Si();st();wO();wi();PO();vO();MO();Rt();L0={name:"antigravity",primaryRootInstructionPath:Gr,generateRules:CO,generateCommands:EO,generateAgents:AO,generateSkills:OO,generateMcp:LO,importFrom:bO},A0={rootInstructionPath:Gr,skillDir:".agents/skills",rewriteGeneratedPath(t){return t===Dl?null:t},paths:{rulePath(t,e){return `${Ro}/${t}.md`},commandPath(t,e){return `${En}/${t}.md`},agentPath(t){return `${Mr}/${$(t)}/SKILL.md`}}},k0={rootInstructionPath:So,renderPrimaryRootInstruction:kO,skillDir:On,managedOutputs:{dirs:[On,Nl],files:[So,Za]},rewriteGeneratedPath(t){return t===Gr?So:t.startsWith(`${Ro}/`)?null:t.startsWith(".agents/skills/")?t.replace(".agents/skills",On):t.startsWith(`${En}/`)?t.replace(En,Nl):t===Dl?Za:t},paths:{rulePath(t,e){return So},commandPath(t,e){return `${Nl}/${t}.md`},agentPath(t){return `${Mr}/${$(t)}/SKILL.md`}}},w0={rules:"native",additionalRules:"embedded",commands:Nr("partial","workflows"),agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},tu={id:"antigravity",metadata:{displayName:"Antigravity",category:"ide",officialUrl:"https://antigravity.google",shortDescription:"Google's agentic IDE"},generators:L0,capabilities:{rules:"native",additionalRules:"native",commands:Nr("partial","workflows"),agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Antigravity config found (.agents/rules/, .agents/skills/, or .agents/workflows/).",supportsConversion:{agents:true},lintRules:GO,project:A0,globalSupport:{capabilities:w0,detectionPaths:[".gemini/antigravity/GEMINI.md",".gemini/antigravity/skills",".gemini/antigravity/workflows",".gemini/antigravity/mcp_config.json"],layout:k0},importer:{rules:{feature:"rules",mode:"directory",source:{project:[Ro]},canonicalDir:ki,extensions:[".md"],map:NO},commands:{feature:"commands",mode:"directory",source:{project:[En],global:[Nl]},canonicalDir:Lp,extensions:[".md"],map:FO},mcp:{feature:"mcp",mode:"flatFile",source:{global:[Za]},canonicalDir:".agentsmesh",canonicalFilename:PC}},buildImportPaths:cf,detectionPaths:[".agents/rules/general.md",".agents/rules/",".agents/skills/",".agents/workflows/"]};});function b0(t){let e={};return t.description&&(e.description=t.description),t.globs.length>0||t.trigger==="manual"||t.trigger==="model_decision"?(e.agent_requested=true,t.globs.length>0&&(e.globs=t.globs)):e.always_apply=true,e}function P0(t){let e={};return t.description&&(e.description=t.description),e}function $O(t){let e=[];for(let r of t.rules)if(!(r.targets.length>0&&!r.targets.includes(se)))if(r.root){let o={always_apply:true};r.description&&(o.description=r.description),e.push({path:`${we}/_root.md`,content:P(o,r.body.trim())});}else {let o=basename(r.source,".md");e.push({path:`${we}/${o}.md`,content:P(b0(r),r.body.trim())});}return e}function jO(t){return t.commands.map(e=>({path:`${or}/${e.name}.md`,content:P(P0(e),e.body.trim())}))}function UO(t){return tt(t,Te)}function KO(t){return t.ignore.length===0?[]:[{path:Eo,content:t.ignore.join(`
55
- `)}]}var BO=d(()=>{Q();M();Ti();s(b0,"ruleFrontmatter");s(P0,"commandFrontmatter");s($O,"generateRules");s(jO,"generateCommands");s(UO,"generateSkills");s(KO,"generateIgnore");});function D0(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!i||typeof i!="object")continue;let a=i,c=typeof a.matcher=="string"?a.matcher:".*",l=Array.isArray(a.hooks)?a.hooks:[];for(let m of l){let p=typeof m.command=="string"?m.command:void 0;if(!p)continue;let u={matcher:c,type:"command",command:p};typeof m.timeout=="number"&&(u.timeout=m.timeout),n.push(u);}}n.length>0&&(e[r]=n);}return e}async function HO(t,e,r){let o=await y(join(t,e));if(o===null)return;let n;try{n=JSON.parse(o);}catch{return}if(n.mcpServers&&typeof n.mcpServers=="object"){let a=n.mcpServers;await $t(t,mf,a),r.push({fromTool:se,fromPath:join(t,e),toPath:mf,feature:"mcp"});}let i=n.hooks;if(i&&typeof i=="object"&&!Array.isArray(i)){let a=D0(i);if(Object.keys(a).length>0){let c=join(t,pf);await L(dirname(c)),await _(c,stringify(a)),r.push({fromTool:se,fromPath:join(t,e),toPath:pf,feature:"hooks"});}}}async function zO(t,e,r){let o=await y(join(t,e));if(o===null)return;let n=o.split(`
56
- `).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"));if(n.length===0)return;let i=join(t,uf);await L(dirname(i)),await _(i,n.join(`
57
- `)),r.push({fromTool:se,fromPath:join(t,e),toPath:uf,feature:"ignore"});}var VO=d(()=>{T();Fr();Ti();s(D0,"augmentHooksToCanonical");s(HO,"importAugmentSettings");s(zO,"importAugmentIgnore");});function N0(t,e){let r={root:e,description:typeof t.description=="string"?t.description:void 0,globs:Array.isArray(t.globs)?t.globs:[]};return t.agent_requested===true&&(r.trigger="model_decision"),r}async function F0(t,e,r,o){let n=o==="global"?Ln:we,i=join(t,lf);e.push(...await yt({srcDir:join(t,n),destDir:i,extensions:[".md"],fromTool:se,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:c})=>{let l=a==="_root.md"||basename(a)==="_root.md",m=join(i,a),{frontmatter:p,body:u}=k(c(m));return {destPath:m,toPath:`${lf}/${a}`,feature:"rules",content:await K(m,N0(p,l),u)}},"mapEntry")}));}async function v0(t,e,r,o){let n=o==="global"?An:or,i=join(t,".agentsmesh/commands");e.push(...await yt({srcDir:join(t,n),destDir:i,extensions:[".md"],fromTool:se,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:c})=>{let l=basename(a,".md"),m=join(i,`${l}.md`),{frontmatter:p,body:u}=k(c(m)),g=typeof p.description=="string"?p.description:"";return {destPath:m,toPath:`.agentsmesh/commands/${l}.md`,feature:"commands",content:await ht(m,{description:g,hasDescription:true,hasAllowedTools:false},u)}},"mapEntry")}));}async function YO(t,e={}){let r=e.scope??"project",o=[],n=await U(se,t,r);return await F0(t,o,n,r),await v0(t,o,n,r),await Z(t,r==="global"?Oo:Te,se,o,n),await HO(t,r==="global"?kn:Co,o),r==="project"&&await zO(t,Eo,o),o}var XO=d(()=>{mt();ke();Q();lt();M();VO();Ti();s(N0,"canonicalRuleMeta");s(F0,"importRules");s(v0,"importCommands");s(YO,"importFromAugmentCode");});function ZO(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:se}))}var QO=d(()=>{_t();Ti();s(ZO,"lintRules");});function tL(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=new Set(qO);return Object.keys(t.hooks).filter(r=>!e.has(r)).map(r=>Rs(r,"augment-code",qO,{unsupportedBy:"AugmentCode hooks"}))}var qO,eL=d(()=>{Et();qO=["PreToolUse","PostToolUse","SessionStart","SessionEnd","Stop"];s(tL,"lintHooks");});function M0(t){let e={};for(let[r,o]of Object.entries(t)){if(!o||o.length===0)continue;let n=o.map(i=>({matcher:i.matcher,hooks:[{type:"command",command:i.command,...i.timeout!==void 0?{timeout:i.timeout}:{}}]}));e[r]=n;}return e}function $0(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let o=JSON.parse(e);if(o===null||typeof o!="object"||Array.isArray(o))return t;let n=o;return n.mcpServers!==void 0&&(r.mcpServers=n.mcpServers),n.hooks!==void 0&&(r.hooks=n.hooks),JSON.stringify(r,null,2)}function j0(t){let e={};return t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&(e.mcpServers=t.mcp.mcpServers),t.hooks&&Object.keys(t.hooks).length>0&&(e.hooks=M0(t.hooks)),Object.keys(e).length===0?null:JSON.stringify(e,null,2)}var G0,U0,K0,B0,W0,rL,oL=d(()=>{BO();XO();QO();eL();Rt();Ti();G0={name:se,generateRules:$O,generateCommands:jO,generateSkills:UO,generateIgnore:KO,importFrom:YO};s(M0,"serializeHooksForSettings");s($0,"mergeAugmentSettings");s(j0,"buildSettingsContent");U0={skillDir:Te,managedOutputs:{dirs:[we,or,Te],files:[Co,Eo]},paths:{rulePath(t){return `${we}/${t}.md`},commandPath(t){return `${or}/${t}.md`},agentPath(t){return null}}},K0={skillDir:Oo,managedOutputs:{dirs:[Ln,An,Oo],files:[kn]},rewriteGeneratedPath(t){return t.startsWith(`${we}/`)?t.replace(`${we}/`,`${Ln}/`):t.startsWith(`${or}/`)?t.replace(`${or}/`,`${An}/`):t.startsWith(`${Te}/`)?t.replace(`${Te}/`,`${Oo}/`):t===Co?kn:t===Eo?null:t},paths:{rulePath(t){return `${Ln}/${t}.md`},commandPath(t){return `${An}/${t}.md`},agentPath(t){return null}}},B0={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},W0={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},rL={id:se,metadata:{displayName:"Augment Code",category:"ide",officialUrl:"https://www.augmentcode.com",shortDescription:"Codebase-aware AI for IDEs"},generators:G0,capabilities:B0,emptyImportMessage:"No AugmentCode config found (.augment/rules, .augment/commands, .augment/skills, .augment/settings.json, or .augmentignore).",lintRules:ZO,lint:{hooks:tL},project:U0,globalSupport:{capabilities:W0,detectionPaths:[Ln,An,Oo,kn],layout:K0},emitScopedSettings(t){let e=j0(t);return e===null?[]:[{path:Co,content:e}]},mergeGeneratedOutputContent(t,e,r,o){return o===Co||o===kn?$0(t,r):null},buildImportPaths:df,detectionPaths:[we,or,Te,Co,Eo]};});function nL(t){if(!t.hooks||Object.keys(t.hooks).length===0)return {};let e={};for(let[r,o]of Object.entries(t.hooks)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!go(i))continue;let a=Kt(i),c=me(i),l=i.type==="prompt"?c||a:a||c,m={type:i.type==="prompt"?"prompt":"command",[i.type==="prompt"?"prompt":"command"]:l};i.timeout!==void 0&&(m.timeout=i.timeout),n.push({matcher:i.matcher,hooks:[m]});}n.length>0&&(e[r]=n);}return e}var sL=d(()=>{Pr();s(nL,"buildClaudeHooksObjectFromCanonical");});function iL(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Cs,content:r.body.trim()?r.body:""});let o=t.rules.filter(n=>!n.root&&(n.targets.length===0||n.targets.includes("claude-code")));for(let n of o){let i=basename(n.source,".md"),a={};n.description&&(a.description=n.description),n.globs.length>0&&(a.globs=n.globs);let c=P(a,n.body.trim()||"");e.push({path:`${Fl}/${i}.md`,content:c});}return e}function aL(t){return t.commands.map(e=>{let r={description:e.description,"allowed-tools":e.allowedTools.length>0?e.allowedTools:void 0};r["allowed-tools"]===void 0&&delete r["allowed-tools"];let o=P(r,e.body.trim()||"");return {path:`${vl}/${e.name}.md`,content:o}})}function cL(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,permissionMode:e.permissionMode||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,mcpServers:e.mcpServers.length>0?e.mcpServers:void 0,hooks:Object.keys(e.hooks).length>0?e.hooks:void 0,skills:e.skills.length>0?e.skills:void 0,memory:e.memory||void 0};Object.keys(r).forEach(a=>{r[a]===void 0&&delete r[a];});let o=e.body.trim()||"",n=/^##\s*Role\b/m.test(o)?o:`## Role
60
+ ${n}`:n||r;return {path:`${An}/${e.name}.md`,content:o}})}function qL(t){return rt(t,zr)}function tO(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:im,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function eO(t){return t.agents.map(e=>({path:`${zr}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function rO(t){let e=t.rules.find(n=>n.root),r=t.rules.filter(n=>n.root?false:n.targets.length===0||n.targets.includes("antigravity"));return lt(e?.body.trim()??"",r)}var nO=d(()=>{tt();Ut();mt();Fi();s(ZL,"generateRules");s(QL,"generateCommands");s(qL,"generateSkills");s(tO,"generateMcp");s(eO,"generateAgents");s(rO,"renderAntigravityGlobalInstructions");});function fH(t){let e=t.replace(/\\/g,"/");return !e.startsWith("rules/")||e.endsWith("/")||!e.endsWith(".md")?null:e}async function oo(t){let e=GC(t.content),r=[];if(e.rules.length===0)return {rootContent:e.rootContent,results:r};await O(join(t.projectRoot,t.rulesDir));for(let n of e.rules){let o=fH(n.source);if(o===null||o==="rules/_root.md")continue;let i=join(t.projectRoot,".agentsmesh",o),a=t.normalize(n.body,t.sourcePath,i),{frontmatter:l,body:c}=b(a),m=await K(i,{...l,root:false,description:n.description||void 0,globs:n.globs.length>0?n.globs:void 0,targets:n.targets.length>0?n.targets:void 0},c);await I(i,m),r.push({fromTool:t.fromTool,fromPath:t.sourcePath,toPath:`.agentsmesh/${o}`,feature:"rules"});}return {rootContent:e.rootContent,results:r}}var Hl=d(()=>{w();j();Ut();ut();s(fH,"canonicalRulePath");s(oo,"splitEmbeddedRulesToCanonical");});async function gH(t,e,r,n){let o=n==="global"?wn:ar,i=n==="project"?[o,sm]:[o];for(let a of i){let l=join(t,a),c=await _(l);if(c===null)continue;let m=join(t,ih),p=await oo({content:c,projectRoot:t,rulesDir:Ni,sourcePath:l,fromTool:Di,normalize:r});e.push(...p.results);let{body:u}=b(r(p.rootContent,l,m)),f=await K(m,{root:true},u);await O(join(t,Ni)),await I(m,f),e.push({fromTool:Di,fromPath:l,toPath:ih,feature:"rules"});return}}async function sO(t,e={}){let r=e.scope??"project",n=[],o=await B(Di,t,r);return await gH(t,n,o,r),n.push(...await J(Mu,t,r,{normalize:o})),await q(t,r==="global"?bn:zr,Di,n,o),n}var iO=d(()=>{dt();w();j();tt();Et();ut();Hl();Fi();ly();s(gH,"importRootRule");s(sO,"importFromAntigravity");});var cO,mO,pO=d(()=>{j();ut();Fi();cO=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(basename(t)==="general.md"||basename(t)==="_root.md")return null;let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Ni}/${t}`,content:await K(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"nonRootRuleMapper"),mO=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${lu}/${t}`,content:await _t(n,{hasDescription:typeof o.description=="string",description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"workflowMapper");});function uO(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Di}))}var dO=d(()=>{It();Fi();s(uO,"lintRules");});var hH,yH,_H,RH,Mu,ly=d(()=>{wi();mt();nO();Fi();iO();pO();dO();Ct();hH={name:"antigravity",primaryRootInstructionPath:ar,generateRules:ZL,generateCommands:QL,generateAgents:eO,generateSkills:qL,generateMcp:tO,importFrom:sO},yH={rootInstructionPath:ar,skillDir:".agents/skills",managedOutputs:{dirs:[Hr,An,zr],files:[ar]},rewriteGeneratedPath(t){return t===im?null:t},paths:{rulePath(t,e){return `${Hr}/${t}.md`},commandPath(t,e){return `${An}/${t}.md`},agentPath(t){return `${zr}/${U(t)}/SKILL.md`}}},_H={rootInstructionPath:wn,renderPrimaryRootInstruction:rO,skillDir:bn,managedOutputs:{dirs:[bn,am],files:[wn,fl]},rewriteGeneratedPath(t){return t===ar?wn:t.startsWith(`${Hr}/`)?null:t.startsWith(".agents/skills/")?t.replace(".agents/skills",bn):t.startsWith(`${An}/`)?t.replace(An,am):t===im?fl:t},paths:{rulePath(t,e){return wn},commandPath(t,e){return `${am}/${t}.md`},agentPath(t){return `${bn}/${U(t)}/SKILL.md`}}},RH={rules:"native",additionalRules:"embedded",commands:Gr("partial","workflows"),agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Mu={id:"antigravity",metadata:{displayName:"Antigravity",category:"ide",officialUrl:"https://antigravity.google",shortDescription:"Google's agentic IDE"},generators:hH,capabilities:{rules:"native",additionalRules:"native",commands:Gr("partial","workflows"),agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Antigravity config found (.agents/rules/, .agents/skills/, or .agents/workflows/).",supportsConversion:{agents:true},lintRules:uO,project:yH,globalSupport:{capabilities:RH,detectionPaths:[".gemini/antigravity/GEMINI.md",".gemini/antigravity/skills",".gemini/antigravity/workflows",".gemini/antigravity/mcp_config.json"],layout:_H},importer:{rules:{feature:"rules",mode:"directory",source:{project:[Hr]},canonicalDir:Ni,extensions:[".md"],map:cO},commands:{feature:"commands",mode:"directory",source:{project:[An],global:[am]},canonicalDir:lu,extensions:[".md"],map:mO},mcp:{feature:"mcp",mode:"flatFile",source:{global:[fl]},canonicalDir:".agentsmesh",canonicalFilename:iE}},buildImportPaths:ah,detectionPaths:[".agents/rules/general.md",".agents/rules/",".agents/skills/",".agents/workflows/"],conversionDefaults:{agentsToSkills:true}};});function SH(t){let e={};return t.description&&(e.description=t.description),t.globs.length>0||t.trigger==="manual"||t.trigger==="model_decision"?(e.agent_requested=true,t.globs.length>0&&(e.globs=t.globs)):e.always_apply=true,e}function CH(t){let e={};return t.description&&(e.description=t.description),e}function fO(t){let e=[];for(let r of t.rules)if(!(r.targets.length>0&&!r.targets.includes(ce)))if(r.root){let n={always_apply:true};r.description&&(n.description=r.description),e.push({path:`${De}/_root.md`,content:T(n,r.body.trim())});}else {let n=basename(r.source,".md");e.push({path:`${De}/${n}.md`,content:T(SH(r),r.body.trim())});}return e}function gO(t){return t.commands.map(e=>({path:`${lr}/${e.name}.md`,content:T(CH(e),e.body.trim())}))}function hO(t){return rt(t,Ne)}function yO(t){return t.ignore.length===0?[]:[{path:Tn,content:t.ignore.join(`
61
+ `)}]}var _O=d(()=>{tt();j();vi();s(SH,"ruleFrontmatter");s(CH,"commandFrontmatter");s(fO,"generateRules");s(gO,"generateCommands");s(hO,"generateSkills");s(yO,"generateIgnore");});function EH(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!i||typeof i!="object")continue;let a=i,l=typeof a.matcher=="string"?a.matcher:".*",c=Array.isArray(a.hooks)?a.hooks:[];for(let m of c){let p=typeof m.command=="string"?m.command:void 0;if(!p)continue;let u={matcher:l,type:"command",command:p};typeof m.timeout=="number"&&(u.timeout=m.timeout),o.push(u);}}o.length>0&&(e[r]=o);}return e}async function IO(t,e,r){let n=await _(join(t,e));if(n===null)return;let o;try{o=JSON.parse(n);}catch{return}if(o.mcpServers&&typeof o.mcpServers=="object"){let a=o.mcpServers;await Bt(t,ch,a),r.push({fromTool:ce,fromPath:join(t,e),toPath:ch,feature:"mcp"});}let i=o.hooks;if(i&&typeof i=="object"&&!Array.isArray(i)){let a=EH(i);if(Object.keys(a).length>0){let l=join(t,mh);await O(dirname(l)),await I(l,stringify(a)),r.push({fromTool:ce,fromPath:join(t,e),toPath:mh,feature:"hooks"});}}}async function SO(t,e,r){let n=await _(join(t,e));if(n===null)return;let o=n.split(`
62
+ `).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"));if(o.length===0)return;let i=join(t,ph);await O(dirname(i)),await I(i,o.join(`
63
+ `)),r.push({fromTool:ce,fromPath:join(t,e),toPath:ph,feature:"ignore"});}var CO=d(()=>{w();Kr();vi();s(EH,"augmentHooksToCanonical");s(IO,"importAugmentSettings");s(SO,"importAugmentIgnore");});function LH(t,e){let r={root:e,description:typeof t.description=="string"?t.description:void 0,globs:Array.isArray(t.globs)?t.globs:[]};return t.agent_requested===true&&(r.trigger="model_decision"),r}async function OH(t,e,r,n){let o=n==="global"?To:De,i=join(t,lh);e.push(...await Rt({srcDir:join(t,o),destDir:i,extensions:[".md"],fromTool:ce,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:l})=>{let c=a==="_root.md"||basename(a)==="_root.md",m=join(i,a),{frontmatter:p,body:u}=b(l(m));return {destPath:m,toPath:`${lh}/${a}`,feature:"rules",content:await K(m,LH(p,c),u)}},"mapEntry")}));}async function AH(t,e,r,n){let o=n==="global"?xo:lr,i=join(t,".agentsmesh/commands");e.push(...await Rt({srcDir:join(t,o),destDir:i,extensions:[".md"],fromTool:ce,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:l})=>{let c=basename(a,".md"),m=join(i,`${c}.md`),{frontmatter:p,body:u}=b(l(m)),f=typeof p.description=="string"?p.description:"";return {destPath:m,toPath:`.agentsmesh/commands/${c}.md`,feature:"commands",content:await _t(m,{description:f,hasDescription:true,hasAllowedTools:false},u)}},"mapEntry")}));}async function EO(t,e={}){let r=e.scope??"project",n=[],o=await B(ce,t,r);return await OH(t,n,o,r),await AH(t,n,o,r),await q(t,r==="global"?xn:Ne,ce,n,o),await IO(t,r==="global"?Do:Pn,n),r==="project"&&await SO(t,Tn,n),n}var LO=d(()=>{dt();xe();tt();ut();j();CO();vi();s(LH,"canonicalRuleMeta");s(OH,"importRules");s(AH,"importCommands");s(EO,"importFromAugmentCode");});function OO(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:ce}))}var AO=d(()=>{It();vi();s(OO,"lintRules");});function bO(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=new Set(wO);return Object.keys(t.hooks).filter(r=>!e.has(r)).map(r=>Ps(r,"augment-code",wO,{unsupportedBy:"AugmentCode hooks"}))}var wO,PO=d(()=>{Lt();wO=["PreToolUse","PostToolUse","SessionStart","SessionEnd","Stop"];s(bO,"lintHooks");});function bH(t){let e={};for(let[r,n]of Object.entries(t)){if(!n||n.length===0)continue;let o=n.map(i=>({matcher:i.matcher,hooks:[{type:"command",command:i.command,...i.timeout!==void 0?{timeout:i.timeout}:{}}]}));e[r]=o;}return e}function PH(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let n=JSON.parse(e);if(n===null||typeof n!="object"||Array.isArray(n))return t;let o=n;return o.mcpServers!==void 0&&(r.mcpServers=o.mcpServers),o.hooks!==void 0&&(r.hooks=o.hooks),JSON.stringify(r,null,2)}function TH(t){let e={};return t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&(e.mcpServers=t.mcp.mcpServers),t.hooks&&Object.keys(t.hooks).length>0&&(e.hooks=bH(t.hooks)),Object.keys(e).length===0?null:JSON.stringify(e,null,2)}var wH,xH,DH,NH,FH,TO,xO=d(()=>{_O();LO();AO();PO();Ct();vi();wH={name:ce,generateRules:fO,generateCommands:gO,generateSkills:hO,generateIgnore:yO,importFrom:EO};s(bH,"serializeHooksForSettings");s(PH,"mergeAugmentSettings");s(TH,"buildSettingsContent");xH={skillDir:Ne,managedOutputs:{dirs:[De,lr,Ne],files:[Pn,Tn]},paths:{rulePath(t){return `${De}/${t}.md`},commandPath(t){return `${lr}/${t}.md`},agentPath(t){return null}}},DH={skillDir:xn,managedOutputs:{dirs:[To,xo,xn],files:[Do]},rewriteGeneratedPath(t){return t.startsWith(`${De}/`)?t.replace(`${De}/`,`${To}/`):t.startsWith(`${lr}/`)?t.replace(`${lr}/`,`${xo}/`):t.startsWith(`${Ne}/`)?t.replace(`${Ne}/`,`${xn}/`):t===Pn?Do:t===Tn?null:t},paths:{rulePath(t){return `${To}/${t}.md`},commandPath(t){return `${xo}/${t}.md`},agentPath(t){return null}}},NH={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},FH={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},TO={id:ce,metadata:{displayName:"Augment Code",category:"ide",officialUrl:"https://www.augmentcode.com",shortDescription:"Codebase-aware AI for IDEs"},generators:wH,capabilities:NH,emptyImportMessage:"No AugmentCode config found (.augment/rules, .augment/commands, .augment/skills, .augment/settings.json, or .augmentignore).",lintRules:OO,lint:{hooks:bO},project:xH,globalSupport:{capabilities:FH,detectionPaths:[To,xo,xn,Do],layout:DH},emitScopedSettings(t){let e=TH(t);return e===null?[]:[{path:Pn,content:e}]},mergeGeneratedOutputContent(t,e,r,n){return n===Pn||n===Do?PH(t,r):null},buildImportPaths:uh,detectionPaths:[De,lr,Ne,Pn,Tn]};});function DO(t){if(!t.hooks||Object.keys(t.hooks).length===0)return {};let e={};for(let[r,n]of Object.entries(t.hooks)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!Sn(i))continue;let a=zt(i),l=he(i),c=i.type==="prompt"?l||a:a||l,m={type:i.type==="prompt"?"prompt":"command",[i.type==="prompt"?"prompt":"command"]:c};i.timeout!==void 0&&(m.timeout=i.timeout),o.push({matcher:i.matcher,hooks:[m]});}o.length>0&&(e[r]=o);}return e}var NO=d(()=>{Mr();s(DO,"buildClaudeHooksObjectFromCanonical");});function FO(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:xs,content:r.body.trim()?r.body:""});let n=t.rules.filter(o=>!o.root&&(o.targets.length===0||o.targets.includes("claude-code")));for(let o of n){let i=basename(o.source,".md"),a={};o.description&&(a.description=o.description),o.globs.length>0&&(a.globs=o.globs);let l=T(a,o.body.trim()||"");e.push({path:`${lm}/${i}.md`,content:l});}return e}function vO(t){return t.commands.map(e=>{let r={description:e.description,"allowed-tools":e.allowedTools.length>0?e.allowedTools:void 0};r["allowed-tools"]===void 0&&delete r["allowed-tools"];let n=T(r,e.body.trim()||"");return {path:`${cm}/${e.name}.md`,content:n}})}function MO(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,permissionMode:e.permissionMode||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,mcpServers:e.mcpServers.length>0?e.mcpServers:void 0,hooks:Object.keys(e.hooks).length>0?e.hooks:void 0,skills:e.skills.length>0?e.skills:void 0,memory:e.memory||void 0};Object.keys(r).forEach(a=>{r[a]===void 0&&delete r[a];});let n=e.body.trim()||"",o=/^##\s*Role\b/m.test(n)?n:`## Role
58
64
 
59
- ${o}`,i=P(r,n);return {path:`${Gl}/${e.name}.md`,content:i}})}function lL(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Qa,content:e}]}function mL(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=r.body.trim()||"",i=!n||/^##\s*Purpose\b/m.test(n)?n:`## Purpose
65
+ ${n}`,i=T(r,o);return {path:`${mm}/${e.name}.md`,content:i}})}function $O(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:gl,content:e}]}function GO(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=r.body.trim()||"",i=!o||/^##\s*Purpose\b/m.test(o)?o:`## Purpose
60
66
 
61
- ${n}`,a=P(o,i);e.push({path:`${Ml}/${r.name}/SKILL.md`,content:a});for(let c of r.supportingFiles){let l=c.relativePath.replace(/\\/g,"/");e.push({path:`${Ml}/${r.name}/${l}`,content:c.content});}}return e}function pL(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];if(e.length===0&&r.length===0&&o.length===0)return [];let n=JSON.stringify({permissions:{allow:e,deny:r,ask:o}},null,2);return [{path:$l,content:n}]}function uL(t,e){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let r=nL(t);if(Object.keys(r).length===0)return [];if(e?.scope==="global")return [{path:wn,content:JSON.stringify(r,null,2)}];let o=JSON.stringify({hooks:r},null,2);return [{path:$l,content:o}]}function dL(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
62
- `);return [{path:jl,content:e}]}var gL=d(()=>{M();Tn();sL();s(iL,"generateRules");s(aL,"generateCommands");s(cL,"generateAgents");s(lL,"generateMcp");s(mL,"generateSkills");s(pL,"generatePermissions");s(uL,"generateHooks");s(dL,"generateIgnore");});function V0(t){let e=t.description.trim();return e||(basename(t.source)||"rule").replace(/\.md$/i,"")||"Rule"}function fL(t){let e=t.rules.find(n=>n.root),r=(e?.body??"").trim();return r?`# Global Instructions
67
+ ${o}`,a=T(n,i);e.push({path:`${pm}/${r.name}/SKILL.md`,content:a});for(let l of r.supportingFiles){let c=l.relativePath.replace(/\\/g,"/");e.push({path:`${pm}/${r.name}/${c}`,content:l.content});}}return e}function jO(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];if(e.length===0&&r.length===0&&n.length===0)return [];let o=JSON.stringify({permissions:{allow:e,deny:r,ask:n}},null,2);return [{path:um,content:o}]}function UO(t,e){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let r=DO(t);if(Object.keys(r).length===0)return [];if(e?.scope==="global")return [{path:No,content:JSON.stringify(r,null,2)}];let n=JSON.stringify({hooks:r},null,2);return [{path:um,content:n}]}function BO(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
68
+ `);return [{path:dm,content:e}]}var KO=d(()=>{j();Fo();NO();s(FO,"generateRules");s(vO,"generateCommands");s(MO,"generateAgents");s($O,"generateMcp");s(GO,"generateSkills");s(jO,"generatePermissions");s(UO,"generateHooks");s(BO,"generateIgnore");});function $H(t){let e=t.description.trim();return e||(basename(t.source)||"rule").replace(/\.md$/i,"")||"Rule"}function WO(t){let e=t.rules.find(o=>o.root),r=(e?.body??"").trim();return r?`# Global Instructions
63
69
 
64
- ## ${e?V0(e):"Guidance"}
70
+ ## ${e?$H(e):"Guidance"}
65
71
 
66
72
  ${r}
67
- `:""}var hL=d(()=>{s(V0,"ruleSectionTitle");s(fL,"renderClaudeGlobalPrimaryInstructions");});function _L(t,e){return t===null?"created":t!==e?"updated":"unchanged"}async function IL(t,e,r,o){if(r!=="global")return [];let n=o.has("agents"),i=o.has("commands");if(!n&&!i)return [];let a=[];if(n)for(let c of t.agents){if(!c.outputStyle)continue;let l={name:c.name,description:c.description||void 0},m=P(l,c.body.trim()),p=`${gf}/${c.name}.md`,u=await y(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:_L(u,m)});}if(i)for(let c of t.commands){if(!c.outputStyle)continue;let l={name:c.name,description:c.description||void 0},m=P(l,c.body.trim()),p=`${gf}/${c.name}.md`,u=await y(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:_L(u,m)});}return a}var RL=d(()=>{T();M();Tn();s(_L,"computeStatus");s(IL,"generateClaudeGlobalExtras");});var SL,CL,EL,OL=d(()=>{M();lt();tr();Tn();SL=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Kl}/${t}`,content:await K(o,{...n,root:false},i)}},"claudeRuleMapper"),CL=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o)),a=qe(n.allowedTools),c=a.length>0?a:qe(n["allowed-tools"]);return {destPath:o,toPath:`${wp}/${t}`,content:await ht(o,{description:typeof n.description=="string"?n.description:void 0,hasDescription:Object.prototype.hasOwnProperty.call(n,"description"),allowedTools:c,hasAllowedTools:Object.prototype.hasOwnProperty.call(n,"allowedTools")||Object.prototype.hasOwnProperty.call(n,"allowed-tools")},i)}},"claudeCommandMapper"),EL=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Tp}/${t}`,content:await Bt(o,n,i)}},"claudeAgentMapper");});function LL(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(i=>({...i,target:NC}))}var AL=d(()=>{_t();Tn();s(LL,"lintRules");});var J0,kL,Y0,X0,eu,uh=d(()=>{gL();Tn();Qt();hL();RL();dh();OL();AL();Rt();J0={name:"claude-code",primaryRootInstructionPath:Cs,generateRules:iL,generateCommands:aL,generateAgents:cL,generateSkills:mL,generateMcp:lL,generatePermissions:pL,generateHooks:uL,generateIgnore:dL,importFrom:ru},kL={rootInstructionPath:Cs,skillDir:".claude/skills",managedOutputs:{dirs:[".claude/agents",".claude/commands",".claude/rules",".claude/skills"],files:[".claude/CLAUDE.md",".claude/settings.json",".claudeignore",".mcp.json"]},paths:{rulePath(t,e){return `.claude/rules/${t}.md`},commandPath(t,e){return `.claude/commands/${t}.md`},agentPath(t,e){return `.claude/agents/${t}.md`}}},Y0={rootInstructionPath:Cs,skillDir:".claude/skills",renderPrimaryRootInstruction:fL,managedOutputs:{dirs:[".claude/agents",".claude/commands",".claude/rules",".claude/skills",".claude/output-styles",".agents/skills"],files:[".claude/CLAUDE.md",".claude/settings.json",Ul,wn,".claudeignore"]},rewriteGeneratedPath(t){return t===Qa?Ul:t},mirrorGlobalPath(t,e){return ct(t,".claude/skills",e)},paths:kL.paths},X0={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"native"},eu={id:"claude-code",metadata:{displayName:"Claude Code",category:"cli",officialUrl:"https://www.anthropic.com/claude-code",shortDescription:"Anthropic's terminal coding agent"},generators:J0,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"native"},emptyImportMessage:"No Claude Code config found (CLAUDE.md or .claude/rules/*.md).",lintRules:LL,project:kL,globalSupport:{capabilities:X0,detectionPaths:[".claude/CLAUDE.md",".claude/rules",".claude/commands",".claude/agents",".claude/skills",".claude/settings.json",".claude/hooks.json",".claude/output-styles",".claudeignore",".claude.json",".agents/skills"],layout:Y0,scopeExtras:IL},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Cs,FC],global:[Cs]},canonicalDir:Kl,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Fl],global:[Fl]},canonicalDir:Kl,extensions:[".md"],map:SL}],commands:{feature:"commands",mode:"directory",source:{project:[vl],global:[vl]},canonicalDir:wp,extensions:[".md"],map:CL},agents:{feature:"agents",mode:"directory",source:{project:[Gl],global:[Gl]},canonicalDir:Tp,extensions:[".md"],map:EL},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Qa],global:[Ul]},canonicalDir:".agentsmesh",canonicalFilename:Bl},ignore:{feature:"ignore",mode:"flatFile",source:{project:[jl],global:[jl]},canonicalDir:".agentsmesh",canonicalFilename:vC}},buildImportPaths:yf,detectionPaths:["CLAUDE.md",".claude/rules",".claude/commands"]};});function Q0(t){let e=basename(t,".md");return e==="_root"?"root":e}function wL(t){let e=[],r=t.rules.find(o=>o.root);if(r){let o=r.body.trim()?r.body:"";e.push({path:Os,content:o});}for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("cline"))continue;let n=Q0(o.source),i={description:o.description||void 0,paths:o.globs.length>0?o.globs:void 0};Object.keys(i).forEach(c=>{i[c]===void 0&&delete i[c];});let a=Object.keys(i).length>0?P(i,o.body.trim()||""):o.body.trim()||"";e.push({path:`${bn}/${n}.md`,content:a});}return e}function TL(t){return t.commands.map(e=>{let r=e.description.trim(),o=e.body.trim(),n=r&&o?`${r}
73
+ `:""}var HO=d(()=>{s($H,"ruleSectionTitle");s(WO,"renderClaudeGlobalPrimaryInstructions");});function VO(t,e){return t===null?"created":t!==e?"updated":"unchanged"}async function JO(t,e,r,n){if(r!=="global")return [];let o=n.has("agents"),i=n.has("commands");if(!o&&!i)return [];let a=[];if(o)for(let l of t.agents){if(!l.outputStyle)continue;let c={name:l.name,description:l.description||void 0},m=T(c,l.body.trim()),p=`${dh}/${l.name}.md`,u=await _(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:VO(u,m)});}if(i)for(let l of t.commands){if(!l.outputStyle)continue;let c={name:l.name,description:l.description||void 0},m=T(c,l.body.trim()),p=`${dh}/${l.name}.md`,u=await _(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:VO(u,m)});}return a}var YO=d(()=>{w();j();Fo();s(VO,"computeStatus");s(JO,"generateClaudeGlobalExtras");});function XO(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!i||typeof i!="object")continue;let a=i,l=typeof a.matcher=="string"?a.matcher:"";if(!l)continue;let c=Array.isArray(a.hooks)?a.hooks:[];for(let m of c){let p=m.type==="prompt"?"prompt":"command";if(!Sn({...m,type:p}))continue;let u=p==="prompt"?he(m)||zt(m):zt(m)||he(m),f={matcher:l,type:p,command:u};typeof m.timeout=="number"&&(f.timeout=m.timeout),o.push(f);}}o.length>0&&(e[r]=o);}return e}async function ZO(t,e){let r=join(t,No),n=await _(r);if(n===null)return false;let o;try{o=JSON.parse(n);}catch{return false}if(!o||typeof o!="object"||Array.isArray(o))return false;let i=XO(o);if(Object.keys(i).length===0)return false;let a=stringify(i),l=join(t,Mi);return await O(dirname(l)),await I(l,a),e.push({fromTool:"claude-code",fromPath:r,toPath:Mi,feature:"hooks"}),true}async function QO(t,e){let r=e.some(m=>m.feature==="hooks"&&m.fromPath.replace(/\\/g,"/").endsWith(No)),n=join(t,um),o=await _(n);if(!o)return;let i;try{i=JSON.parse(o);}catch{return}if(!e.some(m=>m.feature==="mcp")&&i.mcpServers&&typeof i.mcpServers=="object"){let m=i.mcpServers;await Bt(t,hm,m),e.push({fromTool:"claude-code",fromPath:n,toPath:hm,feature:"mcp"});}let l=i.permissions;if(l&&typeof l=="object"&&!Array.isArray(l)){let m=l,p=Array.isArray(m.allow)?m.allow.filter(g=>typeof g=="string"):[],u=Array.isArray(m.deny)?m.deny.filter(g=>typeof g=="string"):[],f=Array.isArray(m.ask)?m.ask.filter(g=>typeof g=="string"):[];if(p.length>0||u.length>0||f.length>0){let g=stringify({allow:p,deny:u,ask:f}),h=join(t,gh);await O(dirname(h)),await I(h,g),e.push({fromTool:"claude-code",fromPath:n,toPath:gh,feature:"permissions"});}}let c=i.hooks;if(!r&&c&&typeof c=="object"&&!Array.isArray(c)){let m=XO(c);if(Object.keys(m).length>0){let p=stringify(m),u=join(t,Mi);await O(dirname(u)),await I(u,p),e.push({fromTool:"claude-code",fromPath:n,toPath:Mi,feature:"hooks"});}}}var qO=d(()=>{Mr();w();Kr();Fo();s(XO,"claudeHooksToCanonical");s(ZO,"importClaudeHooksJson");s(QO,"importSettings");});async function eA(t,e,r){let n=join(t,pm),o=join(t,fh),a=(await v(n)).filter(l=>l.endsWith("SKILL.md"));for(let l of a){let c=dirname(l),m=basename(c),p=join(o,m),u=await _(l);if(u===null)continue;let f=r(u,l,join(p,"SKILL.md")),g=Fr(f,l);if(!g.ok){process.stderr.write(`\u26A0 skipping ${l}: ${g.error.message}
74
+ `);continue}let h=await v(c);for(let R of h){let C=await _(R);if(C===null)continue;let S=relative(c,R),k=join(p,S);await O(dirname(k));let P=r(C,R,k);await I(k,S==="SKILL.md"?await Cn(k,g.value.frontmatter,g.value.body):P);let N=`${fh}/${m}/${S}`;e.push({fromTool:"claude-code",fromPath:R,toPath:N,feature:"skills"});}}}var rA=d(()=>{w();j();ut();Fo();s(eA,"importClaudeSkills");});async function nA(t,e={}){let r=e.scope??"project",n=[],o=await B("claude-code",t,r);return n.push(...await J($u,t,r,{normalize:o})),await eA(t,n,o),await ZO(t,n),await QO(t,n),n}var oA=d(()=>{dt();Et();qO();rA();py();s(nA,"importFromClaudeCode");});var sA,iA,aA,lA=d(()=>{j();ut();or();Fo();sA=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${gm}/${t}`,content:await K(n,{...o,root:false},i)}},"claudeRuleMapper"),iA=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n)),a=nr(o.allowedTools),l=a.length>0?a:nr(o["allowed-tools"]);return {destPath:n,toPath:`${pu}/${t}`,content:await _t(n,{description:typeof o.description=="string"?o.description:void 0,hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),allowedTools:l,hasAllowedTools:Object.prototype.hasOwnProperty.call(o,"allowedTools")||Object.prototype.hasOwnProperty.call(o,"allowed-tools")},i)}},"claudeCommandMapper"),aA=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${uu}/${t}`,content:await Vt(n,o,i)}},"claudeAgentMapper");});function cA(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:cE}))}var mA=d(()=>{It();Fo();s(cA,"lintRules");});var UH,pA,BH,KH,$u,py=d(()=>{KO();Fo();ee();HO();YO();oA();lA();mA();Ct();UH={name:"claude-code",primaryRootInstructionPath:xs,generateRules:FO,generateCommands:vO,generateAgents:MO,generateSkills:GO,generateMcp:$O,generatePermissions:jO,generateHooks:UO,generateIgnore:BO,importFrom:nA},pA={rootInstructionPath:xs,skillDir:".claude/skills",managedOutputs:{dirs:[".claude/agents",".claude/commands",".claude/rules",".claude/skills"],files:[".claude/CLAUDE.md",".claude/settings.json",".claudeignore",".mcp.json"]},paths:{rulePath(t,e){return `.claude/rules/${t}.md`},commandPath(t,e){return `.claude/commands/${t}.md`},agentPath(t,e){return `.claude/agents/${t}.md`}}},BH={rootInstructionPath:xs,skillDir:".claude/skills",renderPrimaryRootInstruction:WO,managedOutputs:{dirs:[".claude/agents",".claude/commands",".claude/rules",".claude/skills",".claude/output-styles",".agents/skills"],files:[".claude/CLAUDE.md",".claude/settings.json",fm,No,".claudeignore"]},rewriteGeneratedPath(t){return t===gl?fm:t},mirrorGlobalPath(t,e){return pt(t,".claude/skills",e)},paths:pA.paths},KH={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"native"},$u={id:"claude-code",metadata:{displayName:"Claude Code",category:"cli",officialUrl:"https://www.anthropic.com/claude-code",shortDescription:"Anthropic's terminal coding agent"},generators:UH,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"native"},emptyImportMessage:"No Claude Code config found (CLAUDE.md or .claude/rules/*.md).",lintRules:cA,project:pA,globalSupport:{capabilities:KH,detectionPaths:[".claude/CLAUDE.md",".claude/rules",".claude/commands",".claude/agents",".claude/skills",".claude/settings.json",".claude/hooks.json",".claude/output-styles",".claudeignore",".claude.json",".agents/skills"],layout:BH,scopeExtras:JO},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[xs,mE],global:[xs]},canonicalDir:gm,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[lm],global:[lm]},canonicalDir:gm,extensions:[".md"],map:sA}],commands:{feature:"commands",mode:"directory",source:{project:[cm],global:[cm]},canonicalDir:pu,extensions:[".md"],map:iA},agents:{feature:"agents",mode:"directory",source:{project:[mm],global:[mm]},canonicalDir:uu,extensions:[".md"],map:aA},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[gl],global:[fm]},canonicalDir:".agentsmesh",canonicalFilename:hm},ignore:{feature:"ignore",mode:"flatFile",source:{project:[dm],global:[dm]},canonicalDir:".agentsmesh",canonicalFilename:pE}},buildImportPaths:hh,detectionPaths:["CLAUDE.md",".claude/rules",".claude/commands"]};});function HH(t){let e=basename(t,".md");return e==="_root"?"root":e}function uA(t){let e=[],r=t.rules.find(n=>n.root);if(r){let n=r.body.trim()?r.body:"";e.push({path:Ns,content:n});}for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("cline"))continue;let o=HH(n.source),i={description:n.description||void 0,paths:n.globs.length>0?n.globs:void 0};Object.keys(i).forEach(l=>{i[l]===void 0&&delete i[l];});let a=Object.keys(i).length>0?T(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${vo}/${o}.md`,content:a});}return e}function dA(t){return t.commands.map(e=>{let r=e.description.trim(),n=e.body.trim(),o=r&&n?`${r}
68
75
 
69
- ${o}`:r||o;return {path:`${Lo}/${e.name}.md`,content:n}})}function bL(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
70
- `);return [{path:Pi,content:e}]}function PL(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Pn,content:e}]}function xL(t){return t.agents.map(e=>({path:`${Jt}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function q0(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function gh(t){return t.replace(/[\r\n]+/g," ")}function tK(t,e,r){return ["#!/usr/bin/env bash",`# agentsmesh-event: ${gh(t)}`,`# agentsmesh-matcher: ${gh(r)}`,`# agentsmesh-command: ${gh(e)}`,"set -eu",e,""].join(`
71
- `)}function DL(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=[];for(let[r,o]of Object.entries(t.hooks)){if(!Array.isArray(o))continue;let n=0;for(let i of o)hn(i)&&(e.push({path:`${xi}/${q0(r)}-${n}.sh`,content:tK(r,i.command,i.matcher)}),n++);}return e}function NL(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${Jt}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Jt}/${r.name}/${a}`,content:i.content});}}return e}var FL=d(()=>{Pr();M();st();nr();s(Q0,"ruleSlug");s(wL,"generateRules");s(TL,"generateCommands");s(bL,"generateIgnore");s(PL,"generateMcp");s(xL,"generateAgents");s(q0,"safeEventName");s(gh,"safeShellLine");s(tK,"buildHookScript");s(DL,"generateHooks");s(NL,"generateSkills");});async function GL(t,e,r){if(t==="workflows"||t.startsWith("workflows/"))return null;let o=t.replace(/\\/g,"/");if(o==="_root.md")return null;let n=join(e,o),{frontmatter:i,body:a}=k(r(n)),c=Rn(i.paths??i.globs),l={root:false,description:typeof i.description=="string"?i.description:void 0,globs:c.length>0?c:void 0};return Object.keys(l).forEach(m=>{l[m]===void 0&&delete l[m];}),{destPath:n,toPath:`${Ls}/${o}`,feature:"rules",content:await K(n,l,a)}}async function ML(t,e,r){let o=join(e,t),{frontmatter:n,body:i}=k(r(o)),a=Object.prototype.hasOwnProperty.call(n,"description"),c=a&&typeof n.description=="string"?n.description:"",l=a,m=i;if(!l){let p=i.indexOf(`
76
+ ${n}`:r||n;return {path:`${Dn}/${e.name}.md`,content:o}})}function fA(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
77
+ `);return [{path:$i,content:e}]}function gA(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Mo,content:e}]}function hA(t){return t.agents.map(e=>({path:`${Zt}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function zH(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function dy(t){return t.replace(/[\r\n]+/g," ")}function VH(t,e,r){return ["#!/usr/bin/env bash",`# agentsmesh-event: ${dy(t)}`,`# agentsmesh-matcher: ${dy(r)}`,`# agentsmesh-command: ${dy(e)}`,"set -eu",e,""].join(`
78
+ `)}function yA(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=[];for(let[r,n]of Object.entries(t.hooks)){if(!Array.isArray(n))continue;let o=0;for(let i of n)ko(i)&&(e.push({path:`${Gi}/${zH(r)}-${o}.sh`,content:VH(r,i.command,i.matcher)}),o++);}return e}function _A(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${Zt}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Zt}/${r.name}/${a}`,content:i.content});}}return e}var RA=d(()=>{Mr();j();mt();cr();s(HH,"ruleSlug");s(uA,"generateRules");s(dA,"generateCommands");s(fA,"generateIgnore");s(gA,"generateMcp");s(hA,"generateAgents");s(zH,"safeEventName");s(dy,"safeShellLine");s(VH,"buildHookScript");s(yA,"generateHooks");s(_A,"generateSkills");});async function SA(t,e,r){if(t==="workflows"||t.startsWith("workflows/"))return null;let n=t.replace(/\\/g,"/");if(n==="_root.md")return null;let o=join(e,n),{frontmatter:i,body:a}=b(r(o)),l=wo(i.paths??i.globs),c={root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0};return Object.keys(c).forEach(m=>{c[m]===void 0&&delete c[m];}),{destPath:o,toPath:`${Fs}/${n}`,feature:"rules",content:await K(o,c,a)}}async function CA(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=b(r(n)),a=Object.prototype.hasOwnProperty.call(o,"description"),l=a&&typeof o.description=="string"?o.description:"",c=a,m=i;if(!c){let p=i.indexOf(`
72
79
 
73
80
  `);if(p>0){let u=i.slice(0,p).trim();u&&!u.includes(`
74
- `)&&(c=u,l=true,m=i.slice(p+2));}}return {destPath:o,toPath:`${bp}/${t}`,feature:"commands",content:await ht(o,{description:c,hasDescription:l,allowedTools:[],hasAllowedTools:Object.prototype.hasOwnProperty.call(n,"allowedTools")||Object.prototype.hasOwnProperty.call(n,"allowed-tools")},m)}}var fh=d(()=>{M();lt();tr();nr();s(GL,"mapClineRuleFile");s(ML,"mapClineWorkflowFile");});async function $L(t,e,r){let o=join(t,Ls),n=join(t,bn),i=join(t,bn),a=false;try{a=(await stat(i)).isFile();}catch{}if(a){let p=await y(i);if(p!==null){await L(o);let u=join(o,"_root.md"),{frontmatter:g,body:f}=k(r(p,i,u)),O=g.root===true?g:{...g,root:true},R=await K(u,O,f);await _(u,R),e.push({fromTool:"cline",fromPath:i,toPath:`${Ls}/_root.md`,feature:"rules"});}return a}let c=null,l=join(n,"_root.md"),m=await y(l);if(m===null){let p=join(t,Os),u=await y(p);if(u!==null){c=p,await L(o);let g=join(o,"_root.md"),{frontmatter:f,body:h}=k(r(u,p,g)),R=f.root===true?f:{...f,root:true},S=await K(g,R,h);await _(g,S),e.push({fromTool:"cline",fromPath:p,toPath:`${Ls}/_root.md`,feature:"rules"});}else {let h=(await v(n)).filter(O=>O.endsWith(".md")&&!O.includes("/workflows/")).sort()[0];if(h){let O=await y(h);if(O!==null){c=h,await L(o);let R=join(o,"_root.md"),{frontmatter:S,body:A}=k(r(O,h,R)),N=S.root===true?S:{...S,root:true},G=await K(R,N,A);await _(R,G),e.push({fromTool:"cline",fromPath:h,toPath:`${Ls}/_root.md`,feature:"rules"});}}}}else {c=l,await L(o);let p=join(o,"_root.md"),{frontmatter:u,body:g}=k(r(m,l,p)),h=u.root===true?u:{...u,root:true},O=await K(p,h,g);await _(p,O),e.push({fromTool:"cline",fromPath:l,toPath:`${Ls}/_root.md`,feature:"rules"});}return e.push(...await yt({srcDir:n,destDir:o,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(async({srcPath:p,relativePath:u,normalizeTo:g})=>p===c?null:GL(u,o,g),"mapEntry")})),a}var jL=d(()=>{T();M();lt();ke();fh();nr();s($L,"importClineRules");});function rK(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.command=="string"?e.command:"";if(!r)return null;let o=typeof e.type=="string"?e.type:typeof e.transportType=="string"?e.transportType:"stdio",n=Array.isArray(e.args)?e.args.filter(l=>typeof l=="string"):[],i=e.env,a=i!==null&&typeof i=="object"&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(l=>typeof l[1]=="string")):{},c=typeof e.description=="string"?e.description:void 0;return {...c!==void 0&&{description:c},type:o,command:r,args:n,env:a}}async function UL(t,e){let r=[Pn,MC].map(l=>join(t,l)),o=null,n=null;for(let l of r){let m=await y(l);if(m!==null){o=l,n=m;break}}if(n===null)return;let i=o??r[0],a;try{a=JSON.parse(n);}catch{}let c=a?.mcpServers;if(c!==void 0&&typeof c=="object"&&c!==null&&Object.keys(c).length>0){let l={};for(let[m,p]of Object.entries(c)){let u=rK(p);u&&(l[m]=u);}Object.keys(l).length>0&&(await L(join(t,".agentsmesh")),await _(join(t,Rf),JSON.stringify({mcpServers:l},null,2)),e.push({fromTool:Es,fromPath:i,toPath:Rf,feature:"mcp"}));}}var KL=d(()=>{T();nr();s(rK,"mapClineServerToCanonical");s(UL,"importClineMcp");});function BL(t){return oK.some(e=>e.test(t))}var oK,WL=d(()=>{oK=[/^\./,/^_ab-agent-/,/^_ab-command-/,/\.fixture\./,/\.test\./];s(BL,"isReservedArtifactName");});async function sK(t){let e=await v(t).catch(()=>[]),r=[];for(let o of e){let n=relative(t,o).replace(/\\/g,"/"),i=basename(n);if(BL(i))continue;let a=await y(o);a!==null&&r.push({absolutePath:o,relativePath:n,content:a});}return r}async function qo(t,e,r){let o=await sK(e),n=join(r.projectRoot,r.destCanonicalSkillsDir,t);for(let i of o){let a=join(n,i.relativePath);await L(dirname(a));let c=r.normalize(i.content,i.absolutePath,a);if(i.relativePath==="SKILL.md"){let{frontmatter:l,body:m}=k(c),p=await ho(a,{...l,name:t},m);await _(a,p);}else await _(a,c);r.results.push({fromTool:r.targetName,fromPath:i.absolutePath,toPath:`${r.destCanonicalSkillsDir}/${t}/${i.relativePath}`,feature:"skills"});}}async function zL(t,e,r,o){let n=join(o.projectRoot,o.destCanonicalSkillsDir,t);await L(n);let i=join(n,"SKILL.md"),a=o.normalize(r,e,i),{frontmatter:c,body:l}=k(a),m=await ho(i,{...c,name:t},l);await _(i,m),o.results.push({fromTool:o.targetName,fromPath:e,toPath:`${o.destCanonicalSkillsDir}/${t}/SKILL.md`,feature:"skills"});}async function Zs(t){let e=new Map;try{let o=(await v(t)).filter(n=>basename(n)==="SKILL.md");for(let n of o){let i=dirname(n),a=basename(i);e.set(a,i);}}catch{}return e}var Pc=d(()=>{T();M();lt();WL();s(sK,"readNativeSkill");s(qo,"importDirectorySkill");s(zL,"importFlatSkill");s(Zs,"findDirectorySkills");});async function VL(t,e,r,o=Jt){let n=join(t,o),i=await Zs(n),a={projectRoot:t,sourceSkillsDir:o,destCanonicalSkillsDir:$C,targetName:"cline",normalize:r,results:e};for(let[c,l]of i){let m=join(l,"SKILL.md"),p=await y(m);if(!p)continue;let u=k(p),g=fo(u.frontmatter,c);if(g){let f=join(t,Sf);await L(f);let h=join(f,`${g.name}.md`);await _(h,Je(g,r(u.body,m,h))),e.push({fromTool:"cline",fromPath:m,toPath:`${Sf}/${g.name}.md`,feature:"agents"});continue}await qo(c,l,a);}}var JL=d(()=>{T();M();st();Pc();nr();s(VL,"importClineSkills");});function _h(t,e){return t.match(new RegExp(`^# agentsmesh-${e}:\\s*(.+)$`,"m"))?.[1]?.trim()??null}async function YL(t,e){let o=(await v(t).catch(()=>[])).filter(n=>basename(n).endsWith(".sh")&&dirname(n)===t);for(let n of o){let i=await y(n);if(!i)continue;let a=_h(i,"event"),c=_h(i,"command");if(!a||!c)continue;let l=_h(i,"matcher")??"*";e[a]||(e[a]=[]),e[a].push({matcher:l,command:c});}}async function ZL(t,e){let r={};if(await YL(join(t,xi),r),await YL(join(t,Fi),r),Object.keys(r).length===0)return;let o=join(t,_f);await L(dirname(o)),await _(o,stringify(r)),e.push({fromTool:Es,fromPath:join(t,Fi),toPath:_f,feature:"hooks"});}var QL=d(()=>{T();nr();s(_h,"extractMeta");s(YL,"loadHooksFromDir");s(ZL,"importClineHooks");});async function iu(t){let e=[],r=await U(Es,t),o=await $L(t,e,r),n=join(t,Pi),i=await y(n);if(i!==null&&i.trim()){let c=i.split(/\r?\n/),l=[];for(let m of c){let p=m.trim();p&&!p.startsWith("#")&&l.push(p);}if(l.length>0){await L(join(t,".agentsmesh"));let m=join(t,If);await _(m,l.join(`
75
- `)),e.push({fromTool:"cline",fromPath:n,toPath:If,feature:"ignore"});}}await UL(t,e);let a=join(t,bp);return o||e.push(...await yt({srcDir:join(t,Lo),destDir:a,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(({relativePath:c,normalizeTo:l})=>ML(c,a,l),"mapEntry")})),await VL(t,e,r),await ZL(t,e),e}var Ih=d(()=>{mt();T();ke();fh();jL();nr();KL();JL();QL();s(iu,"importFromCline");});function qL(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(i=>({...i,target:Es}))}var tA=d(()=>{_t();nr();s(qL,"lintRules");});function eA(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>b(e.source,"cline","cline workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function rA(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","cline","cline hooks are emitted as .clinerules/hooks/*.sh wrapper scripts with a `#!/usr/bin/env bash` header; they require a POSIX shell (git-bash or WSL) to execute on Windows.")]:[]:[]}var oA=d(()=>{Et();s(eA,"lintCommands");s(rA,"lintHooks");});var cK,lK,mK,pK,nA,sA=d(()=>{FL();Si();nr();Ih();tA();oA();Rt();Wa();st();cK={name:"cline",primaryRootInstructionPath:Os,generateRules:wL,generateCommands:TL,generateAgents:xL,generateSkills:NL,generateMcp:PL,generateHooks:DL,generateIgnore:bL,importFrom:iu},lK={rootInstructionPath:Os,skillDir:".cline/skills",managedOutputs:{dirs:[".cline/skills",".clinerules",".clinerules/hooks",".clinerules/workflows"],files:["AGENTS.md",".cline/cline_mcp_settings.json",".clineignore",".clinerules/typescript.md"]},paths:{rulePath(t,e){return `${bn}/${t}.md`},commandPath(t,e){return `${Lo}/${t}.md`},agentPath(t,e){return Ve(e,"cline")?`.cline/skills/${$(t)}/SKILL.md`:null}}},mK={skillDir:Jt,managedOutputs:{dirs:[Di,Ni,Fi,Jt,".agents/skills"],files:[Pn,Pi]},rewriteGeneratedPath(t){return t===Os?null:t.startsWith(`${xi}/`)?`${Fi}/${t.slice(xi.length+1)}`:t.startsWith(`${Lo}/`)?`${Ni}/${t.slice(Lo.length+1)}`:t.startsWith(`${bn}/`)?`${Di}/${t.slice(bn.length+1)}`:t},mirrorGlobalPath(t,e){return t.startsWith(`${Jt}/`)?`.agents/skills/${t.slice(Jt.length+1)}`:null},paths:{rulePath(t,e){return `${Di}/${t}.md`},commandPath(t,e){return `${Ni}/${t}.md`},agentPath(t,e){return Ve(e,"cline")?`.cline/skills/${$(t)}/SKILL.md`:null}}},pK={rules:"native",additionalRules:"native",commands:Nr("native","workflows"),agents:"embedded",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},nA={id:"cline",metadata:{displayName:"Cline",category:"ide",officialUrl:"https://cline.bot",shortDescription:"Autonomous coding agent for VS Code"},generators:cK,capabilities:{rules:"native",additionalRules:"native",commands:Nr("native","workflows"),agents:"embedded",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Cline config found (.clinerules, .clineignore, .cline/cline_mcp_settings.json, or .cline/skills).",supportsConversion:{agents:true},lintRules:qL,lint:{commands:eA,hooks:rA},project:lK,globalSupport:{capabilities:pK,detectionPaths:[Di,Ni,Fi,Jt,Pn,Pi],layout:mK},buildImportPaths:Cf,detectionPaths:[".clinerules",".cline"]};});var qt,iA,os,pa,aA,oo,cA,au,ua,tn,da,ns,Rh,xc,gm,Sh,lA,Ch,mA,pA,Eh,Oh,Lh,ce=d(()=>{qt="codex-cli",iA="codex.md",os="AGENTS.md",pa=".codex/AGENTS.md",aA=".codex/AGENTS.override.md",oo=".agents/skills",cA=".codex/skills",au=".codex/config.toml",ua=".codex/instructions",tn=".codex/rules",da=".codex/agents",ns=".agentsmesh/rules",Rh=".agentsmesh/commands",xc=".agentsmesh/agents",gm=".agentsmesh/skills",Sh=".agentsmesh/mcp.json",lA="am-codex-rule:v1",Ch="# am-json: ",mA="# am-body-b64-begin",pA="# am-body-b64-end",Eh="# am64:",Oh="<!-- agentsmesh:codex-rule-index:start -->",Lh="<!-- agentsmesh:codex-rule-index:end -->";});function Ah(t){return basename(t,".md")}function fm(t){return `${ua}/${Ah(t.source)}.md`}function uA(t){let e={root:t.root,description:t.description||void 0,globs:t.globs.length>0?t.globs:void 0,targets:t.targets.length>0?t.targets:void 0,codex_emit:t.codexEmit||void 0,codex_instruction:t.codexInstructionVariant&&t.codexInstructionVariant!=="default"?t.codexInstructionVariant:void 0};return Object.keys(e).forEach(r=>{e[r]===void 0&&delete e[r];}),P(e,t.body.trim()||"")}function dK(t){let e=[];return t.root?e.push("Applies to the whole project."):t.globs.length>0?e.push(`Applies to ${t.globs.map(r=>`\`${r}\``).join(", ")}.`):e.push("General guidance with no file glob restriction."),t.codexInstructionVariant==="override"&&e.push("Override guidance when this rule conflicts with broader instructions."),t.codexEmit==="execution"&&e.push(`Enforced in \`${tn}/${Ah(t.source)}.rules\`.`),t.targets.length>0&&e.push(`Targeted to ${t.targets.map(r=>`\`${r}\``).join(", ")}.`),e.join(" ")}function dA(t,e){let r=t.trim(),o=e.filter(a=>!a.root);if(o.length===0)return r;let n=o.map(a=>`- [${a.description||Ah(a.source)}](${fm(a)}): ${dK(a)}`),i=[Oh,"## Additional Rule Files",...n,Lh].join(`
81
+ `)&&(l=u,c=true,m=i.slice(p+2));}}return {destPath:n,toPath:`${du}/${t}`,feature:"commands",content:await _t(n,{description:l,hasDescription:c,allowedTools:[],hasAllowedTools:Object.prototype.hasOwnProperty.call(o,"allowedTools")||Object.prototype.hasOwnProperty.call(o,"allowed-tools")},m)}}var fy=d(()=>{j();ut();or();cr();s(SA,"mapClineRuleFile");s(CA,"mapClineWorkflowFile");});async function kA(t,e,r){let n=join(t,Fs),o=join(t,vo),i=join(t,vo),a=false;try{a=(await stat(i)).isFile();}catch{}if(a){let p=await _(i);if(p!==null){await O(n);let u=join(n,"_root.md"),{frontmatter:f,body:g}=b(r(p,i,u)),R=f.root===true?f:{...f,root:true},C=await K(u,R,g);await I(u,C),e.push({fromTool:"cline",fromPath:i,toPath:`${Fs}/_root.md`,feature:"rules"});}return a}let l=null,c=join(o,"_root.md"),m=await _(c);if(m===null){let p=join(t,Ns),u=await _(p);if(u!==null){l=p,await O(n);let f=join(n,"_root.md"),{frontmatter:g,body:h}=b(r(u,p,f)),C=g.root===true?g:{...g,root:true},S=await K(f,C,h);await I(f,S),e.push({fromTool:"cline",fromPath:p,toPath:`${Fs}/_root.md`,feature:"rules"});}else {let h=(await v(o)).filter(R=>R.endsWith(".md")&&!R.includes("/workflows/")).sort()[0];if(h){let R=await _(h);if(R!==null){l=h,await O(n);let C=join(n,"_root.md"),{frontmatter:S,body:k}=b(r(R,h,C)),N=S.root===true?S:{...S,root:true},F=await K(C,N,k);await I(C,F),e.push({fromTool:"cline",fromPath:h,toPath:`${Fs}/_root.md`,feature:"rules"});}}}}else {l=c,await O(n);let p=join(n,"_root.md"),{frontmatter:u,body:f}=b(r(m,c,p)),h=u.root===true?u:{...u,root:true},R=await K(p,h,f);await I(p,R),e.push({fromTool:"cline",fromPath:c,toPath:`${Fs}/_root.md`,feature:"rules"});}return e.push(...await Rt({srcDir:o,destDir:n,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(async({srcPath:p,relativePath:u,normalizeTo:f})=>p===l?null:SA(u,n,f),"mapEntry")})),a}var EA=d(()=>{w();j();ut();xe();fy();cr();s(kA,"importClineRules");});function YH(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.command=="string"?e.command:"";if(!r)return null;let n=typeof e.type=="string"?e.type:typeof e.transportType=="string"?e.transportType:"stdio",o=Array.isArray(e.args)?e.args.filter(c=>typeof c=="string"):[],i=e.env,a=i!==null&&typeof i=="object"&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(c=>typeof c[1]=="string")):{},l=typeof e.description=="string"?e.description:void 0;return {...l!==void 0&&{description:l},type:n,command:r,args:o,env:a}}async function LA(t,e){let r=[Mo,dE].map(c=>join(t,c)),n=null,o=null;for(let c of r){let m=await _(c);if(m!==null){n=c,o=m;break}}if(o===null)return;let i=n??r[0],a;try{a=JSON.parse(o);}catch{}let l=a?.mcpServers;if(l!==void 0&&typeof l=="object"&&l!==null&&Object.keys(l).length>0){let c={};for(let[m,p]of Object.entries(l)){let u=YH(p);u&&(c[m]=u);}Object.keys(c).length>0&&(await O(join(t,".agentsmesh")),await I(join(t,Rh),JSON.stringify({mcpServers:c},null,2)),e.push({fromTool:Ds,fromPath:i,toPath:Rh,feature:"mcp"}));}}var OA=d(()=>{w();cr();s(YH,"mapClineServerToCanonical");s(LA,"importClineMcp");});function AA(t){return XH.some(e=>e.test(t))}var XH,wA=d(()=>{XH=[/^\./,/^_ab-agent-/,/^_ab-command-/,/\.fixture\./,/\.test\./];s(AA,"isReservedArtifactName");});async function QH(t){let e=await v(t).catch(()=>[]),r=[];for(let n of e){let o=relative(t,n).replace(/\\/g,"/"),i=basename(o);if(AA(i))continue;let a=await _(n);a!==null&&r.push({absolutePath:n,relativePath:o,content:a});}return r}async function Um(t,e,r){let n=await QH(e),o=join(r.projectRoot,r.destCanonicalSkillsDir,t);for(let i of n){let a=join(o,i.relativePath);await O(dirname(a));let l=r.normalize(i.content,i.absolutePath,a);if(i.relativePath==="SKILL.md"){let{frontmatter:c,body:m}=b(l),p=await Cn(a,{...c,name:t},m);await I(a,p);}else await I(a,l);r.results.push({fromTool:r.targetName,fromPath:i.absolutePath,toPath:`${r.destCanonicalSkillsDir}/${t}/${i.relativePath}`,feature:"skills"});}}async function PA(t,e,r,n){let o=join(n.projectRoot,n.destCanonicalSkillsDir,t);await O(o);let i=join(o,"SKILL.md"),a=n.normalize(r,e,i),{frontmatter:l,body:c}=b(a),m=await Cn(i,{...l,name:t},c);await I(i,m),n.results.push({fromTool:n.targetName,fromPath:e,toPath:`${n.destCanonicalSkillsDir}/${t}/SKILL.md`,feature:"skills"});}async function Bm(t){let e=new Map;try{let n=(await v(t)).filter(o=>basename(o)==="SKILL.md");for(let o of n){let i=dirname(o),a=basename(i);e.set(a,i);}}catch{}return e}async function Vl(t,e,r=[]){for(let n of t){let o=join(e.projectRoot,n),i=await Bm(o);if(i.size===0)continue;let a=false;for(let[l,c]of i){let m=join(c,"SKILL.md"),p=await _(m);if(p===null)continue;a=true;let{frontmatter:u,body:f}=b(p),g={skillName:l,skillDir:c,skillMdPath:m,rawContent:p,frontmatter:u,rawBody:f,options:e},h=false;for(let R of r)if(await R.recognize(g)){h=true;break}h||await Um(l,c,e);}if(a)return}}function Jl(t){return {async recognize(e){let r=al(e.frontmatter,e.skillName);if(!r)return false;let{options:n}=e;await kn(join(n.projectRoot,n.destCanonicalSkillsDir,e.skillName));let o=join(n.projectRoot,t.canonicalAgentsDir);await O(o);let i=join(o,`${r.name}.md`),a=n.normalize(e.rawBody,e.skillMdPath,i);return await I(i,Os(r,a)),n.results.push({fromTool:n.targetName,fromPath:e.skillMdPath,toPath:`${t.canonicalAgentsDir}/${r.name}.md`,feature:"agents"}),true}}}function TA(t){return {async recognize(e){let r=Xp(e.frontmatter,e.skillName);if(!r)return false;let{options:n}=e;await kn(join(n.projectRoot,n.destCanonicalSkillsDir,e.skillName));let o=join(n.projectRoot,t.canonicalCommandsDir);await O(o);let i=join(o,`${r.name}.md`),a=n.normalize(e.rawBody,e.skillMdPath,i);return await I(i,Zp(r,a)),n.results.push({fromTool:n.targetName,fromPath:e.skillMdPath,toPath:`${t.canonicalCommandsDir}/${r.name}.md`,feature:"commands"}),true}}}var Yl=d(()=>{w();j();ut();wA();mt();kt();Qc();s(QH,"readNativeSkill");s(Um,"importDirectorySkill");s(PA,"importFlatSkill");s(Bm,"findDirectorySkills");s(Vl,"importSkillsDirectory");s(Jl,"projectedAgentRecognizer");s(TA,"commandSkillRecognizer");});async function xA(t,e,r,n=Zt){await Vl([n],{projectRoot:t,destCanonicalSkillsDir:gE,targetName:"cline",normalize:r,results:e},[Jl({canonicalAgentsDir:fE})]);}var DA=d(()=>{Yl();cr();s(xA,"importClineSkills");});function yy(t,e){return t.match(new RegExp(`^# agentsmesh-${e}:\\s*(.+)$`,"m"))?.[1]?.trim()??null}async function NA(t,e){let n=(await v(t).catch(()=>[])).filter(o=>basename(o).endsWith(".sh")&&dirname(o)===t);for(let o of n){let i=await _(o);if(!i)continue;let a=yy(i,"event"),l=yy(i,"command");if(!a||!l)continue;let c=yy(i,"matcher")??"*";e[a]||(e[a]=[]),e[a].push({matcher:c,command:l});}}async function vA(t,e){let r={};if(await NA(join(t,Gi),r),await NA(join(t,Bi),r),Object.keys(r).length===0)return;let n=join(t,yh);await O(dirname(n)),await I(n,stringify(r)),e.push({fromTool:Ds,fromPath:join(t,Bi),toPath:yh,feature:"hooks"});}var MA=d(()=>{w();cr();s(yy,"extractMeta");s(NA,"loadHooksFromDir");s(vA,"importClineHooks");});async function $A(t){let e=[],r=await B(Ds,t),n=await kA(t,e,r),o=join(t,$i),i=await _(o);if(i!==null&&i.trim()){let l=i.split(/\r?\n/),c=[];for(let m of l){let p=m.trim();p&&!p.startsWith("#")&&c.push(p);}if(c.length>0){await O(join(t,".agentsmesh"));let m=join(t,_h);await I(m,c.join(`
82
+ `)),e.push({fromTool:"cline",fromPath:o,toPath:_h,feature:"ignore"});}}await LA(t,e);let a=join(t,du);return n||e.push(...await Rt({srcDir:join(t,Dn),destDir:a,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(({relativePath:l,normalizeTo:c})=>CA(l,a,c),"mapEntry")})),await xA(t,e,r),await vA(t,e),e}var GA=d(()=>{dt();w();xe();fy();EA();cr();OA();DA();MA();s($A,"importFromCline");});function jA(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:Ds}))}var UA=d(()=>{It();cr();s(jA,"lintRules");});function BA(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>x(e.source,"cline","cline workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function KA(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","cline","cline hooks are emitted as .clinerules/hooks/*.sh wrapper scripts with a `#!/usr/bin/env bash` header; they require a POSIX shell (git-bash or WSL) to execute on Windows.")]:[]:[]}var WA=d(()=>{Lt();s(BA,"lintCommands");s(KA,"lintHooks");});var ez,rz,nz,oz,HA,zA=d(()=>{RA();wi();cr();GA();UA();WA();Ct();ol();mt();ez={name:"cline",primaryRootInstructionPath:Ns,generateRules:uA,generateCommands:dA,generateAgents:hA,generateSkills:_A,generateMcp:gA,generateHooks:yA,generateIgnore:fA,importFrom:$A},rz={rootInstructionPath:Ns,skillDir:".cline/skills",managedOutputs:{dirs:[".cline/skills",".clinerules",".clinerules/hooks",".clinerules/workflows"],files:["AGENTS.md",".cline/cline_mcp_settings.json",".clineignore",".clinerules/typescript.md"]},paths:{rulePath(t,e){return `${vo}/${t}.md`},commandPath(t,e){return `${Dn}/${t}.md`},agentPath(t,e){return qe(e,"cline")?`.cline/skills/${U(t)}/SKILL.md`:null}}},nz={skillDir:Zt,managedOutputs:{dirs:[ji,Ui,Bi,Zt,".agents/skills"],files:[Mo,$i]},rewriteGeneratedPath(t){return t===Ns?null:t.startsWith(`${Gi}/`)?`${Bi}/${t.slice(Gi.length+1)}`:t.startsWith(`${Dn}/`)?`${Ui}/${t.slice(Dn.length+1)}`:t.startsWith(`${vo}/`)?`${ji}/${t.slice(vo.length+1)}`:t},mirrorGlobalPath(t,e){return t.startsWith(`${Zt}/`)?`.agents/skills/${t.slice(Zt.length+1)}`:null},paths:{rulePath(t,e){return `${ji}/${t}.md`},commandPath(t,e){return `${Ui}/${t}.md`},agentPath(t,e){return qe(e,"cline")?`.cline/skills/${U(t)}/SKILL.md`:null}}},oz={rules:"native",additionalRules:"native",commands:Gr("native","workflows"),agents:"embedded",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},HA={id:"cline",metadata:{displayName:"Cline",category:"ide",officialUrl:"https://cline.bot",shortDescription:"Autonomous coding agent for VS Code"},generators:ez,capabilities:{rules:"native",additionalRules:"native",commands:Gr("native","workflows"),agents:"embedded",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Cline config found (.clinerules, .clineignore, .cline/cline_mcp_settings.json, or .cline/skills).",supportsConversion:{agents:true},lintRules:jA,lint:{commands:BA,hooks:KA},project:rz,globalSupport:{capabilities:oz,detectionPaths:[ji,Ui,Bi,Zt,Mo,$i],layout:nz},buildImportPaths:Ih,detectionPaths:[".clinerules",".cline"],conversionDefaults:{agentsToSkills:true}};});var Ie,VA,cs,_a,JA,so,YA,ju,Ra,io,Ia,ms,XA,Wm,ZA,_y,QA,Ry,qA,tw,Iy,Sy,Cy,de=d(()=>{Ie="codex-cli",VA="codex.md",cs="AGENTS.md",_a=".codex/AGENTS.md",JA=".codex/AGENTS.override.md",so=".agents/skills",YA=".codex/skills",ju=".codex/config.toml",Ra=".codex/instructions",io=".codex/rules",Ia=".codex/agents",ms=".agentsmesh/rules",XA=".agentsmesh/commands",Wm=".agentsmesh/agents",ZA=".agentsmesh/skills",_y=".agentsmesh/mcp.json",QA="am-codex-rule:v1",Ry="# am-json: ",qA="# am-body-b64-begin",tw="# am-body-b64-end",Iy="# am64:",Sy="<!-- agentsmesh:codex-rule-index:start -->",Cy="<!-- agentsmesh:codex-rule-index:end -->";});function ky(t){return basename(t,".md")}function Hm(t){return `${Ra}/${ky(t.source)}.md`}function ew(t){let e={root:t.root,description:t.description||void 0,globs:t.globs.length>0?t.globs:void 0,targets:t.targets.length>0?t.targets:void 0,codex_emit:t.codexEmit||void 0,codex_instruction:t.codexInstructionVariant&&t.codexInstructionVariant!=="default"?t.codexInstructionVariant:void 0};return Object.keys(e).forEach(r=>{e[r]===void 0&&delete e[r];}),T(e,t.body.trim()||"")}function iz(t){let e=[];return t.root?e.push("Applies to the whole project."):t.globs.length>0?e.push(`Applies to ${t.globs.map(r=>`\`${r}\``).join(", ")}.`):e.push("General guidance with no file glob restriction."),t.codexInstructionVariant==="override"&&e.push("Override guidance when this rule conflicts with broader instructions."),t.codexEmit==="execution"&&e.push(`Enforced in \`${io}/${ky(t.source)}.rules\`.`),t.targets.length>0&&e.push(`Targeted to ${t.targets.map(r=>`\`${r}\``).join(", ")}.`),e.join(" ")}function rw(t,e){let r=t.trim(),n=e.filter(a=>!a.root);if(n.length===0)return r;let o=n.map(a=>`- [${a.description||ky(a.source)}](${Hm(a)}): ${iz(a)}`),i=[Sy,"## Additional Rule Files",...o,Cy].join(`
76
83
  `);return r?`${r}
77
84
 
78
- ${i}`:i}function gA(t){let e=Oh.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=Lh.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return t.replace(new RegExp(`\\n?${e}[\\s\\S]*?${r}\\n?`,"g"),`
79
- `).trim()}var cu=d(()=>{M();ce();s(Ah,"ruleSlug");s(fm,"codexInstructionMirrorPath");s(uA,"serializeCodexInstructionMirror");s(dK,"summarizeRule");s(dA,"appendCodexRuleIndex");s(gA,"stripCodexRuleIndex");});function fK(t){return /(^|\n)\s*[A-Za-z_][A-Za-z0-9_]*\s*\(/.test(t)}function hK(t){return t.split(`
85
+ ${i}`:i}function nw(t){let e=Sy.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=Cy.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return t.replace(new RegExp(`\\n?${e}[\\s\\S]*?${r}\\n?`,"g"),`
86
+ `).trim()}var Uu=d(()=>{j();de();s(ky,"ruleSlug");s(Hm,"codexInstructionMirrorPath");s(ew,"serializeCodexInstructionMirror");s(iz,"summarizeRule");s(rw,"appendCodexRuleIndex");s(nw,"stripCodexRuleIndex");});function lz(t){return /(^|\n)\s*[A-Za-z_][A-Za-z0-9_]*\s*\(/.test(t)}function cz(t){return t.split(`
80
87
  `).map(e=>e.length>0?`# ${e}`:"#").join(`
81
- `)}function yK(t){let e=t.trim();return e?fK(e)?`${e}
82
- `:`${["# agentsmesh: canonical execution rule body is not Codex DSL","# The original body is preserved below as comments.","# Replace with Codex rules DSL (for example prefix_rule(...)) to enforce behavior.","#",...hK(e).split(`
88
+ `)}function mz(t){let e=t.trim();return e?lz(e)?`${e}
89
+ `:`${["# agentsmesh: canonical execution rule body is not Codex DSL","# The original body is preserved below as comments.","# Replace with Codex rules DSL (for example prefix_rule(...)) to enforce behavior.","#",...cz(e).split(`
83
90
  `),"#","# Example template:","# prefix_rule(",'# pattern = ["git", "status"],','# decision = "allow",','# justification = "Allow safe status checks",',"# )"].join(`
84
91
  `)}
85
- `:""}function kh(t){let e=t.rules.find(o=>o.root),r=[];e&&r.push({path:os,content:dA(e.body,t.rules)});for(let o of t.rules){if(o.root)continue;let n=basename(o.source,".md");o.targets.length>0&&!o.targets.includes("codex-cli")||(o.codexEmit==="execution"&&r.push({path:`${tn}/${n}.rules`,content:yK(o.body)}),r.push({path:fm(o),content:uA(o)}));}return r}function wh(t){let e=t.rules.find(o=>o.root),r=t.rules.filter(o=>o.root||o.codexEmit==="execution"?false:o.targets.length===0||o.targets.includes("codex-cli"));return it(e?.body.trim()??"",r)}var fA=d(()=>{Mt();ce();cu();s(fK,"looksLikeCodexRulesDsl");s(hK,"toCodexRulesComments");s(yK,"toSafeCodexRulesContent");s(kh,"generateRules");s(wh,"renderCodexGlobalInstructions");});function Th(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${oo}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${oo}/${r.name}/${a}`,content:i.content});}}return e}function _K(t){return {path:`${oo}/${W(t.name)}/SKILL.md`,content:bt(t)}}function bh(t){return t.commands.map(_K)}var hA=d(()=>{M();ce();St();s(Th,"generateSkills");s(_K,"commandToSkillOutput");s(bh,"generateCommands");});function Ph(t){return t.agents.map(e=>({path:`${da}/${e.name}.toml`,content:IK(e)}))}function IK(t){let e=[];e.push(`name = ${JSON.stringify(t.name)}`),t.description&&e.push(`description = ${JSON.stringify(t.description)}`),t.model&&e.push(`model = ${JSON.stringify(t.model)}`),t.permissionMode==="read-only"||t.permissionMode==="deny"?e.push('sandbox_mode = "read-only"'):t.permissionMode==="allow"&&e.push('sandbox_mode = "workspace-write"');let r=t.body.trim()||"";if(r.includes("'''")){let o=r.replace(/\\/g,"\\\\").replace(/"/g,'\\"');e.push(`developer_instructions = """
86
- ${o}
92
+ `:""}function Ey(t){let e=t.rules.find(n=>n.root),r=[];e&&r.push({path:cs,content:rw(e.body,t.rules)});for(let n of t.rules){if(n.root)continue;let o=basename(n.source,".md");n.targets.length>0&&!n.targets.includes("codex-cli")||(n.codexEmit==="execution"&&r.push({path:`${io}/${o}.rules`,content:mz(n.body)}),r.push({path:Hm(n),content:ew(n)}));}return r}function Ly(t){let e=t.rules.find(n=>n.root),r=t.rules.filter(n=>n.root||n.codexEmit==="execution"?false:n.targets.length===0||n.targets.includes("codex-cli"));return lt(e?.body.trim()??"",r)}var ow=d(()=>{Ut();de();Uu();s(lz,"looksLikeCodexRulesDsl");s(cz,"toCodexRulesComments");s(mz,"toSafeCodexRulesContent");s(Ey,"generateRules");s(Ly,"renderCodexGlobalInstructions");});function Oy(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${so}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${so}/${r.name}/${a}`,content:i.content});}}return e}function pz(t){return {path:`${so}/${H(t.name)}/SKILL.md`,content:Nt(t)}}function Ay(t){return t.commands.map(pz)}var sw=d(()=>{j();de();kt();s(Oy,"generateSkills");s(pz,"commandToSkillOutput");s(Ay,"generateCommands");});function wy(t){return t.agents.map(e=>({path:`${Ia}/${e.name}.toml`,content:uz(e)}))}function uz(t){let e=[];e.push(`name = ${JSON.stringify(t.name)}`),t.description&&e.push(`description = ${JSON.stringify(t.description)}`),t.model&&e.push(`model = ${JSON.stringify(t.model)}`),t.permissionMode==="read-only"||t.permissionMode==="deny"?e.push('sandbox_mode = "read-only"'):t.permissionMode==="allow"&&e.push('sandbox_mode = "workspace-write"');let r=t.body.trim()||"";if(r.includes("'''")){let n=r.replace(/\\/g,"\\\\").replace(/"/g,'\\"');e.push(`developer_instructions = """
93
+ ${n}
87
94
  """`);}else e.push(`developer_instructions = '''
88
95
  ${r}
89
96
  '''`);return e.join(`
90
97
  `)+`
91
- `}var yA=d(()=>{ce();s(Ph,"generateAgents");s(IK,"serializeAgentToCodexToml");});function lu(t){return "command"in t}function _A(t){return "url"in t}var mu=d(()=>{s(lu,"isStdioMcpServer");s(_A,"isUrlMcpServer");});function xh(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Object.fromEntries(Object.entries(t.mcp.mcpServers).flatMap(([o,n])=>lu(n)?[[o,n]]:[]));if(Object.keys(e).length===0)return [];let r=RK(e);return [{path:au,content:r}]}function RK(t){let e=[];for(let[r,o]of Object.entries(t)){let n=IA(r)?`"${r}"`:r,i=[];i.push(`[mcp_servers.${n}]`),i.push(`command = ${JSON.stringify(o.command)}`);let a="["+o.args.map(l=>JSON.stringify(l)).join(", ")+"]";i.push(`args = ${a}`);let c=Object.entries(o.env);if(c.length>0){let l=c.map(([m,p])=>`${IA(m)?JSON.stringify(m):m} = ${JSON.stringify(p)}`).join(", ");i.push(`env = { ${l} }`);}e.push(i.join(`
98
+ `}var iw=d(()=>{de();s(wy,"generateAgents");s(uz,"serializeAgentToCodexToml");});function Bu(t){return "command"in t}function aw(t){return "url"in t}var Ku=d(()=>{s(Bu,"isStdioMcpServer");s(aw,"isUrlMcpServer");});function by(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Object.fromEntries(Object.entries(t.mcp.mcpServers).flatMap(([n,o])=>Bu(o)?[[n,o]]:[]));if(Object.keys(e).length===0)return [];let r=dz(e);return [{path:ju,content:r}]}function dz(t){let e=[];for(let[r,n]of Object.entries(t)){let o=lw(r)?`"${r}"`:r,i=[];i.push(`[mcp_servers.${o}]`),i.push(`command = ${JSON.stringify(n.command)}`);let a="["+n.args.map(c=>JSON.stringify(c)).join(", ")+"]";i.push(`args = ${a}`);let l=Object.entries(n.env);if(l.length>0){let c=l.map(([m,p])=>`${lw(m)?JSON.stringify(m):m} = ${JSON.stringify(p)}`).join(", ");i.push(`env = { ${c} }`);}e.push(i.join(`
92
99
  `));}return e.join(`
93
100
 
94
101
  `)+`
95
- `}function IA(t){return !/^[A-Za-z0-9_-]+$/.test(t)}var RA=d(()=>{mu();ce();s(xh,"generateMcp");s(RK,"serializeMcpToToml");s(IA,"needsTomlQuoting");});var SA=d(()=>{fA();hA();yA();RA();});var CA=d(()=>{SA();});function EK(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,r=typeof e.command=="string"?e.command:"";if(!r)return null;let o=Array.isArray(e.args)?e.args.filter(a=>typeof a=="string"):[],n=e.env,i=n!==null&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="string")):{};return {type:"stdio",command:r,args:o,env:i}}async function EA(t,e){let r=join(t,au),o=await y(r);if(o===null)return;let n;try{n=parse$1(o);}catch{return}let i=n.mcp_servers;if(!i||typeof i!="object"||Array.isArray(i)||Object.keys(i).length===0)return;let a={};for(let[c,l]of Object.entries(i)){let m=EK(l);m&&(a[c]=m);}Object.keys(a).length!==0&&(await $t(t,Sh,a),e.push({fromTool:qt,fromPath:r,toPath:Sh,feature:"mcp"}));}var OA=d(()=>{T();Fr();ce();s(EK,"mapTomlServerToCanonical");s(EA,"importMcp");});async function LA(t,e,r){let o={projectRoot:t,sourceSkillsDir:oo,destCanonicalSkillsDir:gm,targetName:qt,normalize:r,results:e};for(let n of [oo,cA]){let i=join(t,n),a=await readdir(i,{encoding:"utf8",withFileTypes:true}).catch(()=>null);if(a===null)continue;let c=false;for(let l of a){if(!l.isDirectory()&&!l.isSymbolicLink())continue;let m=join(i,l.name),p=join(m,"SKILL.md"),u=await y(p);if(!u)continue;c=true;let g=l.name,f=join(t,gm,g,"SKILL.md"),h=r(u,p,f),{frontmatter:O,body:R}=k(h),S=hp(O,l.name);if(S){await Ye(join(t,gm,g));let D=join(t,Rh);await L(D);let N=join(D,`${S.name}.md`);await _(N,yp(S,r(R,p,N))),e.push({fromTool:qt,fromPath:p,toPath:`${Rh}/${S.name}.md`,feature:"commands"});continue}let A=fo(O,l.name);if(A){await Ye(join(t,gm,g));let D=join(t,xc);await L(D);let N=join(D,`${A.name}.md`);await _(N,Je(A,r(R,p,N))),e.push({fromTool:qt,fromPath:p,toPath:`${xc}/${A.name}.md`,feature:"agents"});continue}await qo(g,m,o);}if(c)return}}var AA=d(()=>{T();M();St();st();Ya();Pc();ce();s(LA,"importSkills");});async function kA(t,e,r){let o=join(t,da),n=join(t,xc);try{let a=(await v(o)).filter(c=>c.endsWith(".toml"));for(let c of a){let l=await y(c);if(!l)continue;let m=parse$1(l);if(!m||typeof m!="object")continue;let p=typeof m.name=="string"?m.name:basename(c,".toml"),u=typeof m.description=="string"?m.description:"",g=typeof m.developer_instructions=="string"?m.developer_instructions.trim():"",f=typeof m.model=="string"?m.model:"",h=typeof m.sandbox_mode=="string"?m.sandbox_mode:"",O=h==="read-only"?"read-only":h==="workspace-write"?"allow":"",R=Array.isArray(m.mcp_servers)?m.mcp_servers.filter(G=>typeof G=="string"):[];await L(n);let S=join(n,`${p}.md`),A=r(g,c,S),N=Je({name:p,description:u,tools:[],disallowedTools:[],model:f,permissionMode:O,maxTurns:0,mcpServers:R,hooks:{},skills:[],memory:""},A);await _(S,N),e.push({fromTool:qt,fromPath:c,toPath:`${xc}/${p}.md`,feature:"agents"});}}catch{}}var wA=d(()=>{T();st();ce();s(kA,"importCodexAgentsFromToml");});function TA(t){if(!t.includes(lA))return null;let e=t.split(`
96
- `).find(l=>l.startsWith(Ch));if(!e)return null;let r;try{r=JSON.parse(e.slice(Ch.length));}catch{return null}if(!r||typeof r!="object")return null;let o=r,n=typeof o.description=="string"?o.description:"",i=Array.isArray(o.globs)?o.globs.filter(l=>typeof l=="string"):[],a=[],c=false;for(let l of t.split(`
97
- `)){let m=l.trimEnd();if(m===mA){c=true;continue}if(m===pA){c=false;continue}c&&m.startsWith(Eh)&&a.push(m.slice(Eh.length));}if(a.length===0)return null;try{let l=Buffer$1.from(a.join(""),"base64").toString("utf8");return {meta:{description:n,globs:i},body:l}}catch{return null}}var bA=d(()=>{ce();s(TA,"tryParseEmbeddedCanonicalFromCodexRules");});async function xA(t,e,r){let o=[],n=join(t,tn);try{let i=await v(n),a=i.filter(l=>l.endsWith(".md"));for(let l of a){let m=await y(l);if(!m)continue;let p=relative(n,l).replace(/\\/g,"/"),u=join(e,p),{frontmatter:g,body:f}=k(r(m,l,u));await L(e);let h=g.root===!0?g:{...g,root:!1},O=await K(u,h,f);await _(u,O),o.push({fromTool:qt,fromPath:l,toPath:`${ns}/${p}`,feature:"rules"});}let c=i.filter(l=>l.endsWith(".rules"));for(let l of c){let m=await y(l);if(!m)continue;let p=relative(n,l).replace(/\\/g,"/").replace(/\.rules$/i,".md"),u=join(e,p);await L(e);let g=TA(m);if(g){let f=await K(u,{description:g.meta.description,globs:g.meta.globs,root:!1},r(g.body,l,u));await _(u,f);}else {let f=await K(u,{root:!1,description:"",globs:[],codex_emit:"execution"},r(m.trim(),l,u));await _(u,f);}o.push({fromTool:qt,fromPath:l,toPath:`${ns}/${p}`,feature:"rules"});}}catch{}return o}var DA=d(()=>{T();M();lt();ce();bA();s(xA,"importCodexNonRootRuleFiles");});async function FA(t,e,r,o,n){let i=join(t,iA),a=join(t,os),c=join(t,aA),l=join(t,pa),m=n==="global"?await y(c):null,p=n==="global"?await y(l):null,u=n==="project"?await y(a):null,g=n==="project"?await y(i):null,f=m!==null?c:p!==null?l:u!==null?a:i,h=join(t,ns),O=m??p??u??g;if(O!==null){await L(h);let R=join(h,"_root.md"),S=f===a||f===l||f===c?gA(O):O,A=await Qo({content:S,projectRoot:t,rulesDir:ns,sourcePath:f,fromTool:"codex-cli",normalize:r});e.push(...A.results);let D=r(f===a||f===l||f===c?o(A.rootContent,f,R):A.rootContent,f,R),{frontmatter:N,body:G}=k(D),J=N.root===true?N:{...N,root:true},X=await K(R,J,G);await _(R,X),e.push({fromTool:"codex-cli",fromPath:f,toPath:`${ns}/_root.md`,feature:"rules"});}await bK(t,h,e,r),e.push(...await xA(t,h,r)),n!=="global"&&e.push(...await yt({srcDir:t,destDir:h,extensions:["AGENTS.md","AGENTS.override.md"],fromTool:"codex-cli",normalize:r,mapEntry:s(async({srcPath:R,normalizeTo:S})=>{let A=relative(t,dirname(R)).replace(/\\/g,"/"),D=basename(R),N=D==="AGENTS.override.md";if(!A||A==="."||!N&&D!=="AGENTS.md")return null;let G=A.replace(/\//g,"-");if(!Sp(A))return await Ye(join(h,`${G}.md`)),null;let J=join(h,`${G}.md`),{frontmatter:X,body:q}=k(S(J));return {destPath:J,toPath:`${ns}/${G}.md`,feature:"rules",content:await K(J,{...X,root:false,globs:[`${A}/**`],...N?{codex_instruction:"override"}:{}},q)}},"mapEntry")}));}async function bK(t,e,r,o){try{let i=(await v(join(t,ua))).filter(c=>c.endsWith(".md")),a=join(t,ua);for(let c of i){let l=relative(a,c).replace(/\\/g,"/");if(l==="_root.md")continue;let m=await y(c);if(!m)continue;let p=join(e,l),{frontmatter:u,body:g}=k(o(m,c,p));await L(e);let f=u.root===!0?u:{...u,root:!1},h=await K(p,f,g);await _(p,h),r.push({fromTool:qt,fromPath:c,toPath:`${ns}/${l}`,feature:"rules"});}}catch{}}var vA=d(()=>{T();M();lt();Tc();ke();Ya();ce();DA();cu();s(FA,"importCodexRules");s(bK,"importInstructionMirrors");});async function pu(t,e){let r=e?.scope??"project",o=[],n=await U(qt,t,r),i=await U("windsurf",t,r);return await FA(t,o,n,i,r),await LA(t,o,n),await kA(t,o,n),await EA(t,o),o}var Fh=d(()=>{mt();ce();OA();AA();wA();vA();s(pu,"importFromCodex");});function GA(t,e,r){let{rules:o}=t;return o.length===0?[]:o.some(i=>i.root)?[]:[{level:"warning",file:relative(e,o[0].source),target:qt,message:"Codex needs a root rule to generate AGENTS.md. Add root: true to a rule."}]}var MA=d(()=>{ce();s(GA,"lintRules");});function $A(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,o]of Object.entries(t.mcp.mcpServers))if(typeof o.description=="string"&&o.description&&e.push(b(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" has a description, but codex-cli does not project MCP descriptions into .codex/config.toml.`)),"url"in o||"type"in o){let n="type"in o?o.type:"url";e.push(b(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" uses ${n} transport; codex-cli only generates stdio MCP servers.`));}return e}var jA=d(()=>{Et();s($A,"lintMcp");});function UA(t){return fm(t)}var KA=d(()=>{cu();s(UA,"codexAdvisoryInstructionPath");});var xK,DK,NK,FK,WA,HA=d(()=>{CA();ce();Fh();MA();jA();Rt();Wa();KA();St();xK={name:"codex-cli",primaryRootInstructionPath:os,generateRules:kh,generateCommands:bh,generateAgents:Ph,generateSkills:Th,generateMcp:xh,importFrom:pu},DK={rootInstructionPath:os,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${tn}/${e}.rules`]},skillDir:".agents/skills",managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/instructions"],files:["AGENTS.md",".codex/config.toml"]},paths:{rulePath(t,e){return UA(e)},commandPath(t,e){return Ba(e,"codex-cli")?`${oo}/${W(t)}/SKILL.md`:null},agentPath(t,e){return `${da}/${t}.toml`}}},NK={rootInstructionPath:pa,renderPrimaryRootInstruction:wh,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${tn}/${e}.rules`]},skillDir:oo,managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/rules"],files:[pa,".codex/config.toml"]},rewriteGeneratedPath(t){return t===os?pa:t.startsWith(`${ua}/`)?null:t},paths:{rulePath(t,e){return e.codexEmit==="execution"?`${tn}/${t}.rules`:pa},commandPath(t,e){return Ba(e,"codex-cli")?`${oo}/${W(t)}/SKILL.md`:null},agentPath(t,e){return `${da}/${t}.toml`}}},FK={rules:"native",additionalRules:"embedded",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},WA={id:"codex-cli",metadata:{displayName:"Codex CLI",category:"cli",officialUrl:"https://github.com/openai/codex",shortDescription:"OpenAI's terminal coding agent"},generators:xK,capabilities:{rules:"native",additionalRules:"native",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Codex config found (codex.md or AGENTS.md).",supportsConversion:{commands:true},lintRules:GA,lint:{mcp:$A},project:DK,globalSupport:{capabilities:FK,detectionPaths:[".codex/AGENTS.md",".codex/AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules",".agents/skills"],layout:NK},buildImportPaths:Ef,sharedArtifacts:{".agents/skills/":"owner"},detectionPaths:["codex.md","AGENTS.md","AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules"]};});function GK(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function zA(t){return `${Ao}/${t}.md`}function VA(t){let e={description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],P(e,t.body.trim()||"")}function JA(t,e){let r=basename(e,".md");return {name:((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||r).trim(),description:typeof t.description=="string"?t.description:"",allowedTools:GK(t["x-agentsmesh-allowed-tools"])}}function YA(t,e){let r={description:t.description||void 0,"allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return r.description===void 0&&delete r.description,r["allowed-tools"]===void 0&&delete r["allowed-tools"],P(r,e.trim()||"")}var uu=d(()=>{M();ko();s(GK,"toStringArray");s(zA,"continueCommandRulePath");s(VA,"serializeCommandRule");s(JA,"parseCommandRuleFrontmatter");s(YA,"serializeImportedCommand");});function XA(t){let e=[],r=t.rules.find(o=>o.root);if(r){let o={};r.description&&(o.description=r.description),e.push({path:xn,content:P(o,r.body.trim()||"")});}for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("continue"))continue;let n=basename(o.source,".md"),i={};o.description&&(i.description=o.description),o.globs.length>0&&(i.globs=o.globs),e.push({path:`${$r}/${n}.md`,content:P(i,o.body.trim()||"")});}return e}function ZA(t){return t.commands.map(e=>({path:`${Ao}/${e.name}.md`,content:VA(e)}))}function QA(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Pp,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function qA(t){return t.agents.map(e=>({path:`${be}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function tk(t){return tt(t,be)}var ek=d(()=>{Q();st();M();uu();ko();s(XA,"generateRules");s(ZA,"generateCommands");s(QA,"generateMcp");s(qA,"generateAgents");s(tk,"generateSkills");});function UK(t,e){let o=(e===".json"?JSON.parse(t):parse(t)??{}).mcpServers;if(!o||typeof o!="object"||Array.isArray(o))return {};let n={};for(let[i,a]of Object.entries(o)){if(!a||typeof a!="object"||Array.isArray(a))continue;let c=a;typeof c.command=="string"&&(n[i]={type:typeof c.type=="string"?c.type:"stdio",command:c.command,args:_s(c.args),env:_o(c.env),description:typeof c.description=="string"?c.description:void 0});}return n}async function KK(t,e){let r=(await v(join(t,Of))).filter(i=>[".json",".yaml",".yml"].includes(extname(i))),o={},n=[];for(let i of r){let a=await y(i);a&&(Object.assign(o,UK(a,extname(i))),n.push(i));}if(Object.keys(o).length!==0){await $t(t,Af,o);for(let i of n)e.push({fromTool:qa,fromPath:i,toPath:Af,feature:"mcp"});}}async function du(t){let e=[],r=await U(qa,t);return e.push(...await z(gu,t,"project",{normalize:r})),await Z(t,be,qa,e,r),await KK(t,e),e}var vh=d(()=>{mt();T();Q();Ct();Fr();tr();ko();Gh();s(UK,"readMcpServers");s(KK,"importMcp");s(du,"importFromContinue");});function BK(t){return t==="general.md"||t==="_root.md"}var ok,nk,sk=d(()=>{M();lt();uu();ko();s(BK,"isContinueRootRulePath");ok=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=BK(t),n=o?"_root.md":t,i=join(r,n),{frontmatter:a,body:c}=k(e(i)),l={description:typeof a.description=="string"?a.description:void 0,globs:Array.isArray(a.globs)?a.globs:void 0,root:o};return l.description===void 0&&delete l.description,l.globs===void 0&&delete l.globs,{destPath:i,toPath:`${xp}/${n}`,content:await K(i,l,c)}},"continueRuleMapper"),nk=s(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:o})=>{let n=join(o,e),{frontmatter:i,body:a}=k(r(n)),c=JA(i,t),l=c.name||e.replace(/\.md$/,"").replace(/^.*\//,""),m=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",p=m?`${m}/${l}.md`:`${l}.md`,u=join(o,p),g=await ht(u,{description:c.description,hasDescription:!!c.description,allowedTools:c.allowedTools,hasAllowedTools:c.allowedTools.length>0},k(YA(c,a)).body);return {destPath:u,toPath:`${Dp}/${p}`,content:g}},"continueCommandMapper");});function ik(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:qa}))}var ak=d(()=>{_t();ko();s(ik,"lintRules");});function ck(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>b(e.source,"continue","Continue invokable prompt rules do not natively enforce canonical allowed-tools metadata."))}var lk=d(()=>{Et();s(ck,"lintCommands");});function VK(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var mk,pk=d(()=>{T();ko();s(VK,"computeStatus");mk=s(async(t,e,r,o)=>{if(r!=="global")return [];let n=o.has("rules"),i=o.has("commands"),a=o.has("mcp");if(!(n&&t.rules.length>0||i&&t.commands.length>0||a&&t.mcp!==null&&Object.keys(t.mcp.mcpServers).length>0))return [];let l={name:"agentsmesh",version:1,schema:"v1"};if(n&&t.rules.length>0&&(l.rules=t.rules.map(u=>({name:u.description||basename(u.source,".md"),rule:u.body.trim()}))),i&&t.commands.length>0&&(l.prompts=t.commands.map(u=>{let g={name:u.name};return u.description&&(g.description=u.description),g.prompt=u.body.trim(),g})),a&&t.mcp!==null){let u=Object.entries(t.mcp.mcpServers);u.length>0&&(l.mcpServers=u.map(([g,f])=>({name:g,...f})));}let m=stringify(l),p=await y(join(e,Wl));return [{target:"continue",path:Wl,content:m,currentContent:p??void 0,status:VK(p,m)}]},"generateContinueGlobalConfig");});function YK(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var uk,dk=d(()=>{T();ko();pk();s(YK,"computeStatus");uk=s(async(t,e,r,o)=>{let n=await mk(t,e,r,o);if(r!=="global"||!o.has("rules"))return n;let i=t.rules.find(l=>l.root);if(!i)return n;let a=i.body.trim(),c=await y(join(e,tc));return [...n,{target:"continue",path:tc,content:a,currentContent:c??void 0,status:YK(c,a)}]},"generateContinueScopeExtras");});var XK,ZK,QK,qK,gu,Gh=d(()=>{st();ek();ko();vh();sk();ak();lk();uu();Rt();dk();XK={name:"continue",primaryRootInstructionPath:xn,generateRules:XA,generateCommands:ZA,generateAgents:qA,generateSkills:tk,generateMcp:QA,importFrom:du},ZK={rootInstructionPath:xn,skillDir:".continue/skills",managedOutputs:{dirs:[".continue/prompts",".continue/rules",".continue/skills"],files:[".continue/mcpServers/agentsmesh.json"]},paths:{rulePath(t,e){return `${$r}/${t}.md`},commandPath(t,e){return zA(t)},agentPath(t){return `${be}/${$(t)}/SKILL.md`}}},QK={rootInstructionPath:xn,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[tc]}],skillDir:be,managedOutputs:{dirs:[$r,Ao,be,".agents/skills"],files:[Pp,tc,Wl]},mirrorGlobalPath(t,e){return t.startsWith(`${be}/`)?`.agents/skills/${t.slice(be.length+1)}`:null},paths:{rulePath(t,e){return `${$r}/${t}.md`},commandPath(t,e){return `${Ao}/${t}.md`},agentPath(t){return `${be}/${$(t)}/SKILL.md`}}},qK={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},gu={id:"continue",metadata:{displayName:"Continue",category:"ide",officialUrl:"https://continue.dev",shortDescription:"Open-source AI code assistant"},generators:XK,capabilities:{rules:"native",additionalRules:"native",commands:"embedded",agents:"none",skills:"embedded",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Continue config found (.continue/rules/*.md, .continue/skills, or .continue/mcpServers/*).",supportsConversion:{agents:true},lintRules:ik,lint:{commands:ck},project:ZK,globalSupport:{capabilities:qK,detectionPaths:[$r,Ao,".continue/mcpServers",be],layout:QK,scopeExtras:uk},importer:{rules:{feature:"rules",mode:"directory",source:{project:[$r],global:[$r]},canonicalDir:xp,extensions:[".md"],map:ok},commands:{feature:"commands",mode:"directory",source:{project:[Ao],global:[Ao]},canonicalDir:Dp,extensions:[".md"],map:nk}},buildImportPaths:kf,detectionPaths:[".continue/rules",".continue/skills",".continue/mcpServers"]};});var ss,ga,gk,fa,Qs,rn,on,ha,ya,fu,hu,fk,$h,hk,qs,Dc,is,Nc,_a,jh,Uh,Sr=d(()=>{ss="copilot",ga=".github/copilot-instructions.md",gk=".github/copilot",fa=".github/instructions",Qs=".github/prompts",rn=".github/hooks",on=".github/skills",ha=".github/agents",ya=".agentsmesh/rules",fu=".agentsmesh/commands",hu=".agentsmesh/agents",fk=".agentsmesh/skills",$h=".agentsmesh/hooks.yaml",hk=".github/copilot-hooks",qs=".copilot/copilot-instructions.md",Dc=".copilot/agents",is=".copilot/skills",Nc=".copilot/prompts",_a=".copilot/AGENTS.md",jh=".claude/skills",Uh=".agents/skills";});function yk(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function yu(t){return `${Qs}/${t}.prompt.md`}function _k(t){let e={agent:"agent",description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],P(e,t.body.trim()||"")}function Ik(t,e){let o=((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||basename(e,".prompt.md")).trim(),n=yk(t["x-agentsmesh-allowed-tools"]),i=n.length>0?n:yk(t.tools);return {name:o,description:typeof t.description=="string"?t.description:"",allowedTools:i}}var _u=d(()=>{M();Sr();s(yk,"toStringArray");s(yu,"commandPromptPath");s(_k,"serializeCommandPrompt");s(Ik,"parseCommandPromptFrontmatter");});function Iu(t){return hn(t)}var Kh=d(()=>{Pr();s(Iu,"hasHookCommand");});function rB(t){let e=basename(t,".md");return e==="_root"?"root":e}function oB(t){switch(t){case "PreToolUse":return "preToolUse";case "PostToolUse":return "postToolUse";case "Notification":return "notification";case "UserPromptSubmit":return "userPromptSubmitted";default:return null}}function Rk(t){let e=[],r=t.rules.find(o=>o.root);r?.body.trim()&&e.push(r.body.trim());for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("copilot"))continue;let n=o.body.trim();if(!n)continue;let i=o.description?`## ${o.description}`:null;i?e.push(`${i}
102
+ `}function lw(t){return !/^[A-Za-z0-9_-]+$/.test(t)}var cw=d(()=>{Ku();de();s(by,"generateMcp");s(dz,"serializeMcpToToml");s(lw,"needsTomlQuoting");});var mw=d(()=>{ow();sw();iw();cw();});var pw=d(()=>{mw();});function hz(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,r=typeof e.command=="string"?e.command:"";if(!r)return null;let n=Array.isArray(e.args)?e.args.filter(a=>typeof a=="string"):[],o=e.env,i=o!==null&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).filter(a=>typeof a[1]=="string")):{};return {type:"stdio",command:r,args:n,env:i}}async function uw(t,e){let r=join(t,ju),n=await _(r);if(n===null)return;let o;try{o=parse$1(n);}catch{return}let i=o.mcp_servers;if(!i||typeof i!="object"||Array.isArray(i)||Object.keys(i).length===0)return;let a={};for(let[l,c]of Object.entries(i)){let m=hz(c);m&&(a[l]=m);}Object.keys(a).length!==0&&(await Bt(t,_y,a),e.push({fromTool:Ie,fromPath:r,toPath:_y,feature:"mcp"}));}var dw=d(()=>{w();Kr();de();s(hz,"mapTomlServerToCanonical");s(uw,"importMcp");});async function fw(t,e,r){await Vl([so,YA],{projectRoot:t,destCanonicalSkillsDir:ZA,targetName:Ie,normalize:r,results:e},[TA({canonicalCommandsDir:XA}),Jl({canonicalAgentsDir:Wm})]);}var gw=d(()=>{Yl();de();s(fw,"importSkills");});async function hw(t,e,r){let n=join(t,Ia),o=join(t,Wm);try{let a=(await v(n)).filter(l=>l.endsWith(".toml"));for(let l of a){let c=await _(l);if(!c)continue;let m=parse$1(c);if(!m||typeof m!="object")continue;let p=typeof m.name=="string"?m.name:basename(l,".toml"),u=typeof m.description=="string"?m.description:"",f=typeof m.developer_instructions=="string"?m.developer_instructions.trim():"",g=typeof m.model=="string"?m.model:"",h=typeof m.sandbox_mode=="string"?m.sandbox_mode:"",R=h==="read-only"?"read-only":h==="workspace-write"?"allow":"",C=Array.isArray(m.mcp_servers)?m.mcp_servers.filter(F=>typeof F=="string"):[];await O(o);let S=join(o,`${p}.md`),k=r(f,l,S),N=Os({name:p,description:u,tools:[],disallowedTools:[],model:g,permissionMode:R,maxTurns:0,mcpServers:C,hooks:{},skills:[],memory:""},k);await I(S,N),e.push({fromTool:Ie,fromPath:l,toPath:`${Wm}/${p}.md`,feature:"agents"});}}catch{}}var yw=d(()=>{w();mt();de();s(hw,"importCodexAgentsFromToml");});function _w(t){if(!t.includes(QA))return null;let e=t.split(`
103
+ `).find(c=>c.startsWith(Ry));if(!e)return null;let r;try{r=JSON.parse(e.slice(Ry.length));}catch{return null}if(!r||typeof r!="object")return null;let n=r,o=typeof n.description=="string"?n.description:"",i=Array.isArray(n.globs)?n.globs.filter(c=>typeof c=="string"):[],a=[],l=false;for(let c of t.split(`
104
+ `)){let m=c.trimEnd();if(m===qA){l=true;continue}if(m===tw){l=false;continue}l&&m.startsWith(Iy)&&a.push(m.slice(Iy.length));}if(a.length===0)return null;try{let c=Buffer$1.from(a.join(""),"base64").toString("utf8");return {meta:{description:o,globs:i},body:c}}catch{return null}}var Rw=d(()=>{de();s(_w,"tryParseEmbeddedCanonicalFromCodexRules");});async function Sw(t,e,r){let n=[],o=join(t,io);try{let i=await v(o),a=i.filter(c=>c.endsWith(".md"));for(let c of a){let m=await _(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/"),u=join(e,p),{frontmatter:f,body:g}=b(r(m,c,u));await O(e);let h=f.root===!0?f:{...f,root:!1},R=await K(u,h,g);await I(u,R),n.push({fromTool:Ie,fromPath:c,toPath:`${ms}/${p}`,feature:"rules"});}let l=i.filter(c=>c.endsWith(".rules"));for(let c of l){let m=await _(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/").replace(/\.rules$/i,".md"),u=join(e,p);await O(e);let f=_w(m);if(f){let g=await K(u,{description:f.meta.description,globs:f.meta.globs,root:!1},r(f.body,c,u));await I(u,g);}else {let g=await K(u,{root:!1,description:"",globs:[],codex_emit:"execution"},r(m.trim(),c,u));await I(u,g);}n.push({fromTool:Ie,fromPath:c,toPath:`${ms}/${p}`,feature:"rules"});}}catch{}return n}var Cw=d(()=>{w();j();ut();de();Rw();s(Sw,"importCodexNonRootRuleFiles");});async function Ew(t,e,r,n,o){let i=join(t,VA),a=join(t,cs),l=join(t,JA),c=join(t,_a),m=o==="global"?await _(l):null,p=o==="global"?await _(c):null,u=o==="project"?await _(a):null,f=o==="project"?await _(i):null,g=m!==null?l:p!==null?c:u!==null?a:i,h=join(t,ms),R=m??p??u??f;if(R!==null){await O(h);let C=join(h,"_root.md"),S=g===a||g===c||g===l?nw(R):R,k=await oo({content:S,projectRoot:t,rulesDir:ms,sourcePath:g,fromTool:"codex-cli",normalize:r});e.push(...k.results);let P=r(g===a||g===c||g===l?n(k.rootContent,g,C):k.rootContent,g,C),{frontmatter:N,body:F}=b(P),W=N.root===true?N:{...N,root:true},z=await K(C,W,F);await I(C,z),e.push({fromTool:"codex-cli",fromPath:g,toPath:`${ms}/_root.md`,feature:"rules"});}await Cz(t,h,e,r),e.push(...await Sw(t,h,r)),o!=="global"&&e.push(...await Rt({srcDir:t,destDir:h,extensions:["AGENTS.md","AGENTS.override.md"],fromTool:"codex-cli",normalize:r,mapEntry:s(async({srcPath:C,normalizeTo:S})=>{let k=relative(t,dirname(C)).replace(/\\/g,"/"),P=basename(C),N=P==="AGENTS.override.md";if(!k||k==="."||!N&&P!=="AGENTS.md")return null;let F=k.replace(/\//g,"-");if(!eu(k))return await kn(join(h,`${F}.md`)),null;let W=join(h,`${F}.md`),{frontmatter:z,body:Q}=b(S(W));return {destPath:W,toPath:`${ms}/${F}.md`,feature:"rules",content:await K(W,{...z,root:false,globs:[`${k}/**`],...N?{codex_instruction:"override"}:{}},Q)}},"mapEntry")}));}async function Cz(t,e,r,n){try{let i=(await v(join(t,Ra))).filter(l=>l.endsWith(".md")),a=join(t,Ra);for(let l of i){let c=relative(a,l).replace(/\\/g,"/");if(c==="_root.md")continue;let m=await _(l);if(!m)continue;let p=join(e,c),{frontmatter:u,body:f}=b(n(m,l,p));await O(e);let g=u.root===!0?u:{...u,root:!1},h=await K(p,g,f);await I(p,h),r.push({fromTool:Ie,fromPath:l,toPath:`${ms}/${c}`,feature:"rules"});}}catch{}}var Lw=d(()=>{w();j();ut();Hl();xe();Qc();de();Cw();Uu();s(Ew,"importCodexRules");s(Cz,"importInstructionMirrors");});async function Ow(t,e){let r=e?.scope??"project",n=[],o=await B(Ie,t,r),i=await B("windsurf",t,r);return await Ew(t,n,o,i,r),await fw(t,n,o),await hw(t,n,o),await uw(t,n),n}var Aw=d(()=>{dt();de();dw();gw();yw();Lw();s(Ow,"importFromCodex");});function ww(t,e,r){let{rules:n}=t;return n.length===0?[]:n.some(i=>i.root)?[]:[{level:"warning",file:relative(e,n[0].source),target:Ie,message:"Codex needs a root rule to generate AGENTS.md. Add root: true to a rule."}]}var bw=d(()=>{de();s(ww,"lintRules");});function Pw(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,n]of Object.entries(t.mcp.mcpServers))if(typeof n.description=="string"&&n.description&&e.push(x(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" has a description, but codex-cli does not project MCP descriptions into .codex/config.toml.`)),"url"in n||"type"in n){let o="type"in n?n.type:"url";e.push(x(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" uses ${o} transport; codex-cli only generates stdio MCP servers.`));}return e}var Tw=d(()=>{Lt();s(Pw,"lintMcp");});function xw(t){return Hm(t)}var Dw=d(()=>{Uu();s(xw,"codexAdvisoryInstructionPath");});var Ez,Lz,Oz,Az,Fw,vw=d(()=>{pw();de();Aw();bw();Tw();Ct();ol();Dw();kt();Ez={name:"codex-cli",primaryRootInstructionPath:cs,generateRules:Ey,generateCommands:Ay,generateAgents:wy,generateSkills:Oy,generateMcp:by,importFrom:Ow},Lz={rootInstructionPath:cs,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${io}/${e}.rules`]},skillDir:".agents/skills",managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/instructions"],files:["AGENTS.md",".codex/config.toml"]},paths:{rulePath(t,e){return xw(e)},commandPath(t,e){return nl(e,"codex-cli")?`${so}/${H(t)}/SKILL.md`:null},agentPath(t,e){return `${Ia}/${t}.toml`}}},Oz={rootInstructionPath:_a,renderPrimaryRootInstruction:Ly,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${io}/${e}.rules`]},skillDir:so,managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/rules"],files:[_a,".codex/config.toml"]},rewriteGeneratedPath(t){return t===cs?_a:t.startsWith(`${Ra}/`)?null:t},paths:{rulePath(t,e){return e.codexEmit==="execution"?`${io}/${t}.rules`:_a},commandPath(t,e){return nl(e,"codex-cli")?`${so}/${H(t)}/SKILL.md`:null},agentPath(t,e){return `${Ia}/${t}.toml`}}},Az={rules:"native",additionalRules:"embedded",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Fw={id:"codex-cli",metadata:{displayName:"Codex CLI",category:"cli",officialUrl:"https://github.com/openai/codex",shortDescription:"OpenAI's terminal coding agent"},generators:Ez,capabilities:{rules:"native",additionalRules:"native",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Codex config found (codex.md or AGENTS.md).",supportsConversion:{commands:true},lintRules:ww,lint:{mcp:Pw},project:Lz,globalSupport:{capabilities:Az,detectionPaths:[".codex/AGENTS.md",".codex/AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules",".agents/skills"],layout:Oz},buildImportPaths:Sh,sharedArtifacts:{".agents/skills/":"owner"},detectionPaths:["codex.md","AGENTS.md","AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules"],excludeFromStarterInit:true,conversionDefaults:{commandsToSkills:true,agentsToSkills:false}};});function bz(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function Mw(t){return `${Nn}/${t}.md`}function $w(t){let e={description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],T(e,t.body.trim()||"")}function Gw(t,e){let r=basename(e,".md");return {name:((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||r).trim(),description:typeof t.description=="string"?t.description:"",allowedTools:bz(t["x-agentsmesh-allowed-tools"])}}function jw(t,e){let r={description:t.description||void 0,"allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return r.description===void 0&&delete r.description,r["allowed-tools"]===void 0&&delete r["allowed-tools"],T(r,e.trim()||"")}var Wu=d(()=>{j();Fn();s(bz,"toStringArray");s(Mw,"continueCommandRulePath");s($w,"serializeCommandRule");s(Gw,"parseCommandRuleFrontmatter");s(jw,"serializeImportedCommand");});function Uw(t){let e=[],r=t.rules.find(n=>n.root);if(r){let n={};r.description&&(n.description=r.description),e.push({path:$o,content:T(n,r.body.trim()||"")});}for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("continue"))continue;let o=basename(n.source,".md"),i={};n.description&&(i.description=n.description),n.globs.length>0&&(i.globs=n.globs),e.push({path:`${Vr}/${o}.md`,content:T(i,n.body.trim()||"")});}return e}function Bw(t){return t.commands.map(e=>({path:`${Nn}/${e.name}.md`,content:$w(e)}))}function Kw(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:fu,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function Ww(t){return t.agents.map(e=>({path:`${Fe}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function Hw(t){return rt(t,Fe)}var zw=d(()=>{tt();mt();j();Wu();Fn();s(Uw,"generateRules");s(Bw,"generateCommands");s(Kw,"generateMcp");s(Ww,"generateAgents");s(Hw,"generateSkills");});function Dz(t,e){let n=(e===".json"?JSON.parse(t):parse(t)??{}).mcpServers;if(!n||typeof n!="object"||Array.isArray(n))return {};let o={};for(let[i,a]of Object.entries(n)){if(!a||typeof a!="object"||Array.isArray(a))continue;let l=a;typeof l.command=="string"&&(o[i]={type:typeof l.type=="string"?l.type:"stdio",command:l.command,args:ws(l.args),env:Ln(l.env),description:typeof l.description=="string"?l.description:void 0});}return o}async function Nz(t,e){let r=(await v(join(t,Ch))).filter(i=>[".json",".yaml",".yml"].includes(extname(i))),n={},o=[];for(let i of r){let a=await _(i);a&&(Object.assign(n,Dz(a,extname(i))),o.push(i));}if(Object.keys(n).length!==0){await Bt(t,Eh,n);for(let i of o)e.push({fromTool:hl,fromPath:i,toPath:Eh,feature:"mcp"});}}async function Jw(t){let e=[],r=await B(hl,t);return e.push(...await J(Hu,t,"project",{normalize:r})),await q(t,Fe,hl,e,r),await Nz(t,e),e}var Yw=d(()=>{dt();w();tt();Et();Kr();or();Fn();xy();s(Dz,"readMcpServers");s(Nz,"importMcp");s(Jw,"importFromContinue");});function Fz(t){return t==="general.md"||t==="_root.md"}var Xw,Zw,Qw=d(()=>{j();ut();Wu();Fn();s(Fz,"isContinueRootRulePath");Xw=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=Fz(t),o=n?"_root.md":t,i=join(r,o),{frontmatter:a,body:l}=b(e(i)),c={description:typeof a.description=="string"?a.description:void 0,globs:Array.isArray(a.globs)?a.globs:void 0,root:n};return c.description===void 0&&delete c.description,c.globs===void 0&&delete c.globs,{destPath:i,toPath:`${gu}/${o}`,content:await K(i,c,l)}},"continueRuleMapper"),Zw=s(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:n})=>{let o=join(n,e),{frontmatter:i,body:a}=b(r(o)),l=Gw(i,t),c=l.name||e.replace(/\.md$/,"").replace(/^.*\//,""),m=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",p=m?`${m}/${c}.md`:`${c}.md`,u=join(n,p),f=await _t(u,{description:l.description,hasDescription:!!l.description,allowedTools:l.allowedTools,hasAllowedTools:l.allowedTools.length>0},b(jw(l,a)).body);return {destPath:u,toPath:`${hu}/${p}`,content:f}},"continueCommandMapper");});function qw(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:hl}))}var tb=d(()=>{It();Fn();s(qw,"lintRules");});function eb(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>x(e.source,"continue","Continue invokable prompt rules do not natively enforce canonical allowed-tools metadata."))}var rb=d(()=>{Lt();s(eb,"lintCommands");});function Gz(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var nb,ob=d(()=>{w();Fn();s(Gz,"computeStatus");nb=s(async(t,e,r,n)=>{if(r!=="global")return [];let o=n.has("rules"),i=n.has("commands"),a=n.has("mcp");if(!(o&&t.rules.length>0||i&&t.commands.length>0||a&&t.mcp!==null&&Object.keys(t.mcp.mcpServers).length>0))return [];let c={name:"agentsmesh",version:1,schema:"v1"};if(o&&t.rules.length>0&&(c.rules=t.rules.map(u=>({name:u.description||basename(u.source,".md"),rule:u.body.trim()}))),i&&t.commands.length>0&&(c.prompts=t.commands.map(u=>{let f={name:u.name};return u.description&&(f.description=u.description),f.prompt=u.body.trim(),f})),a&&t.mcp!==null){let u=Object.entries(t.mcp.mcpServers);u.length>0&&(c.mcpServers=u.map(([f,g])=>({name:f,...g})));}let m=stringify(c),p=await _(join(e,ym));return [{target:"continue",path:ym,content:m,currentContent:p??void 0,status:Gz(p,m)}]},"generateContinueGlobalConfig");});function Uz(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var sb,ib=d(()=>{w();Fn();ob();s(Uz,"computeStatus");sb=s(async(t,e,r,n)=>{let o=await nb(t,e,r,n);if(r!=="global"||!n.has("rules"))return o;let i=t.rules.find(c=>c.root);if(!i)return o;let a=i.body.trim(),l=await _(join(e,yl));return [...o,{target:"continue",path:yl,content:a,currentContent:l??void 0,status:Uz(l,a)}]},"generateContinueScopeExtras");});var Bz,Kz,Wz,Hz,Hu,xy=d(()=>{mt();zw();Fn();Yw();Qw();tb();rb();Wu();Ct();ib();Bz={name:"continue",primaryRootInstructionPath:$o,generateRules:Uw,generateCommands:Bw,generateAgents:Ww,generateSkills:Hw,generateMcp:Kw,importFrom:Jw},Kz={rootInstructionPath:$o,skillDir:".continue/skills",managedOutputs:{dirs:[".continue/prompts",".continue/rules",".continue/skills"],files:[".continue/mcpServers/agentsmesh.json"]},paths:{rulePath(t,e){return `${Vr}/${t}.md`},commandPath(t,e){return Mw(t)},agentPath(t){return `${Fe}/${U(t)}/SKILL.md`}}},Wz={rootInstructionPath:$o,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[yl]}],skillDir:Fe,managedOutputs:{dirs:[Vr,Nn,Fe,".agents/skills"],files:[fu,yl,ym]},mirrorGlobalPath(t,e){return t.startsWith(`${Fe}/`)?`.agents/skills/${t.slice(Fe.length+1)}`:null},paths:{rulePath(t,e){return `${Vr}/${t}.md`},commandPath(t,e){return `${Nn}/${t}.md`},agentPath(t){return `${Fe}/${U(t)}/SKILL.md`}}},Hz={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Hu={id:"continue",metadata:{displayName:"Continue",category:"ide",officialUrl:"https://continue.dev",shortDescription:"Open-source AI code assistant"},generators:Bz,capabilities:{rules:"native",additionalRules:"native",commands:"embedded",agents:"none",skills:"embedded",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},emptyImportMessage:"No Continue config found (.continue/rules/*.md, .continue/skills, or .continue/mcpServers/*).",supportsConversion:{agents:true},lintRules:qw,lint:{commands:eb},project:Kz,globalSupport:{capabilities:Hz,detectionPaths:[Vr,Nn,".continue/mcpServers",Fe],layout:Wz,scopeExtras:sb},importer:{rules:{feature:"rules",mode:"directory",source:{project:[Vr],global:[Vr]},canonicalDir:gu,extensions:[".md"],map:Xw},commands:{feature:"commands",mode:"directory",source:{project:[Nn],global:[Nn]},canonicalDir:hu,extensions:[".md"],map:Zw}},buildImportPaths:Lh,detectionPaths:[".continue/rules",".continue/skills",".continue/mcpServers"],conversionDefaults:{agentsToSkills:true}};});var ps,Sa,ab,Ca,si,ao,lo,ka,Ea,zu,Vu,lb,Ny,cb,ii,Xl,us,Zl,La,Fy,vy,wr=d(()=>{ps="copilot",Sa=".github/copilot-instructions.md",ab=".github/copilot",Ca=".github/instructions",si=".github/prompts",ao=".github/hooks",lo=".github/skills",ka=".github/agents",Ea=".agentsmesh/rules",zu=".agentsmesh/commands",Vu=".agentsmesh/agents",lb=".agentsmesh/skills",Ny=".agentsmesh/hooks.yaml",cb=".github/copilot-hooks",ii=".copilot/copilot-instructions.md",Xl=".copilot/agents",us=".copilot/skills",Zl=".copilot/prompts",La=".copilot/AGENTS.md",Fy=".claude/skills",vy=".agents/skills";});function mb(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function Ju(t){return `${si}/${t}.prompt.md`}function pb(t){let e={agent:"agent",description:t.description||void 0,"x-agentsmesh-kind":"command","x-agentsmesh-name":t.name,"x-agentsmesh-allowed-tools":t.allowedTools.length>0?t.allowedTools:void 0};return e.description===void 0&&delete e.description,e["x-agentsmesh-allowed-tools"]===void 0&&delete e["x-agentsmesh-allowed-tools"],T(e,t.body.trim()||"")}function ub(t,e){let n=((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||basename(e,".prompt.md")).trim(),o=mb(t["x-agentsmesh-allowed-tools"]),i=o.length>0?o:mb(t.tools);return {name:n,description:typeof t.description=="string"?t.description:"",allowedTools:i}}var Yu=d(()=>{j();wr();s(mb,"toStringArray");s(Ju,"commandPromptPath");s(pb,"serializeCommandPrompt");s(ub,"parseCommandPromptFrontmatter");});function Xu(t){return ko(t)}var My=d(()=>{Mr();s(Xu,"hasHookCommand");});function Jz(t){let e=basename(t,".md");return e==="_root"?"root":e}function Yz(t){switch(t){case "PreToolUse":return "preToolUse";case "PostToolUse":return "postToolUse";case "Notification":return "notification";case "UserPromptSubmit":return "userPromptSubmitted";default:return null}}function db(t){let e=[],r=t.rules.find(n=>n.root);r?.body.trim()&&e.push(r.body.trim());for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("copilot"))continue;let o=n.body.trim();if(!o)continue;let i=n.description?`## ${n.description}`:null;i?e.push(`${i}
98
105
 
99
- ${n}`):e.push(n);}return e.join(`
106
+ ${o}`):e.push(o);}return e.join(`
100
107
 
101
- `)}function Sk(t){let e=t.rules.find(o=>o.root),r=[];e&&r.push({path:ga,content:e.body.trim()||""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("copilot")||o.globs.length===0)continue;let n=rB(o.source),i={description:o.description||void 0,applyTo:o.globs.length===1?o.globs[0]:o.globs};Object.keys(i).forEach(c=>{i[c]===void 0&&delete i[c];});let a=P(i,o.body.trim()||"");r.push({path:`${fa}/${n}.instructions.md`,content:a});}return r}function Ck(t){return t.commands.map(e=>({path:yu(e.name),content:_k(e)}))}function Ek(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${on}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${on}/${r.name}/${a}`,content:i.content});}}return e}function Ok(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0,"mcp-servers":e.mcpServers.length>0?e.mcpServers:void 0,skills:e.skills.length>0?e.skills:void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=P(r,e.body.trim()||"");return {path:`${ha}/${e.name}.agent.md`,content:o}})}function Lk(t){if(!t.hooks)return [];let e=Object.fromEntries(Object.entries(t.hooks).flatMap(([r,o])=>{let n=oB(r);if(!n||!Array.isArray(o))return [];let i=o.filter(a=>typeof a=="object"&&a!==null&&Iu(a)).map((a,c)=>{let m={type:"command",bash:`./scripts/${r.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}-${c}.sh`,comment:`Matcher: ${a.matcher}`};return a.timeout!==void 0&&(m.timeoutSec=Math.ceil(a.timeout/1e3)),m});return i.length>0?[[n,i]]:[]}));return Object.keys(e).length===0?[]:[{path:`${rn}/agentsmesh.json`,content:JSON.stringify({version:1,hooks:e},null,2)}]}var Ak=d(()=>{M();Sr();_u();Kh();s(rB,"ruleSlug");s(oB,"mapHookEvent");s(Rk,"renderCopilotGlobalInstructions");s(Sk,"generateRules");s(Ck,"generateCommands");s(Ek,"generateSkills");s(Ok,"generateAgents");s(Lk,"generateHooks");});function sB(t){switch(t){case "preToolUse":return "PreToolUse";case "postToolUse":return "PostToolUse";case "notification":return "Notification";case "userPromptSubmitted":return "UserPromptSubmit";default:return null}}function iB(t){return typeof t!="string"?"*":t.match(/^Matcher:\s*(.+)$/)?.[1]?.trim()||"*"}function Tk(t){let e=t.match(/^# agentsmesh-command:\s*(.+)$/m);return e?.[1]?e[1].trim():t.replace(/^#!.*\n/,"").replace(/^#.*\n/gm,"").replace(/^HOOK_DIR=.*\n/gm,"").replace(/^set -e[u]?\n?/m,"").trim()}async function bk(t,e){let r=join(t,rn),n=(await v(r).catch(()=>[])).filter(p=>p.endsWith(".json")),i={};for(let p of n){let u=await y(p);if(!u)continue;let g;try{g=JSON.parse(u);}catch{continue}if(!(!g||typeof g.hooks!="object"||g.hooks===null))for(let[f,h]of Object.entries(g.hooks)){let O=sB(f);if(!(!O||!Array.isArray(h)))for(let R of h){if(!R||typeof R!="object")continue;let S=R,A=typeof S.bash=="string"?S.bash:"";if(!A)continue;let D=join(r,A.replace(/^\.\//,"")),N=await y(D);if(!N)continue;let G=Tk(N);G&&(i[O]||(i[O]=[]),i[O].push({matcher:iB(S.comment),command:G,type:"command"}));}}}let a=join(t,hk),l=(await v(a).catch(()=>[])).filter(p=>dirname(p)===a&&/^[^-]+-\d+\.sh$/i.test(basename(p)));for(let p of l){let u=await y(p);if(!u)continue;let g=basename(p,".sh"),f=g.lastIndexOf("-"),h=f>0?g.slice(0,f):g;i[h]||(i[h]=[]),i[h].push({matcher:"*",command:Tk(u),type:"command"});}if(Object.keys(i).length===0)return;let m=join(t,$h);await L(dirname(m)),await _(m,stringify(i)),e.push({fromTool:ss,fromPath:join(t,rn),toPath:$h,feature:"hooks"});}var Pk=d(()=>{T();Sr();s(sB,"mapCopilotHookEvent");s(iB,"extractMatcher");s(Tk,"extractWrapperCommand");s(bk,"importHooks");});async function xk(t,e,r,o=on){let n=join(t,o),i=await Zs(n),a={projectRoot:t,sourceSkillsDir:o,destCanonicalSkillsDir:fk,targetName:ss,normalize:r,results:e};for(let[c,l]of i)await qo(c,l,a);}var Dk=d(()=>{Pc();Sr();s(xk,"importSkills");});async function Ru(t,e={}){let r=e.scope??"project",o=[],n=await U(ss,t,r);return o.push(...await z(Su,t,r,{normalize:n})),await xk(t,o,n,r==="global"?is:on),r==="project"&&await bk(t,o),o}var Bh=d(()=>{mt();Ct();Sr();Pk();Dk();Wh();s(Ru,"importFromCopilot");});function Nk(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Fk,vk,Gk,Mk,$k=d(()=>{M();lt();tr();_u();Sr();s(Nk,"pruneUndefined");Fk=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=t.replace(/\.instructions\.md$/i,".md"),n=join(r,o),{frontmatter:i,body:a}=k(e(n)),c=Rn(i.globs),l=Nk({root:false,description:typeof i.description=="string"?i.description:void 0,globs:c.length>0?c:void 0});return {destPath:n,toPath:`${ya}/${o}`,content:await K(n,l,a)}},"copilotLegacyRuleMapper"),vk=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=t.endsWith(".instructions.md")?t.replace(/\.instructions\.md$/i,".md"):t,n=join(r,o),{frontmatter:i,body:a}=k(e(n)),c=Rn(i.applyTo!==void 0?i.applyTo:i.globs),l=Nk({root:false,description:typeof i.description=="string"?i.description:void 0,globs:c.length>0?c:void 0});return {destPath:n,toPath:`${ya}/${o}`,content:await K(n,l,a)}},"copilotNewRuleMapper"),Gk=s(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:o})=>{let n=e.replace(/\.prompt\.md$/i,".md"),i=join(o,n),{frontmatter:a,body:c}=k(r(i)),l=Ik(a,t),m=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",p=`${l.name}.md`,u=m?`${m}/${p}`:p,g=join(o,u);return {destPath:g,toPath:`${fu}/${u}`,content:await ht(g,{description:l.description,hasDescription:Object.prototype.hasOwnProperty.call(a,"description"),allowedTools:l.allowedTools,hasAllowedTools:Object.prototype.hasOwnProperty.call(a,"tools")||Object.prototype.hasOwnProperty.call(a,"x-agentsmesh-allowed-tools")},c)}},"copilotCommandMapper"),Mk=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(!t.endsWith(".agent.md"))return null;let o=t.replace(/\.agent\.md$/i,".md"),n=basename(o,".md"),i=join(r,o),{frontmatter:a,body:c}=k(e(i));return {destPath:i,toPath:`${hu}/${o}`,content:await Bt(i,{...a,name:typeof a.name=="string"?a.name:n},c)}},"copilotAgentMapper");});function jk(t,e,r,o){let i=H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(c=>({...c,target:ss})),a=t.rules.filter(c=>!c.root&&c.globs.length===0);return [...i,...a.map(c=>({level:"warning",file:c.source,target:ss,message:"Copilot path-specific instructions require applyTo globs; non-root rules without globs are not generated."}))]}var Uk=d(()=>{_t();Sr();s(jk,"lintRules");});function Kk(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>b(e.source,"copilot","Copilot prompt files do not enforce canonical allowed-tools natively."))}function Bk(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","Notification","UserPromptSubmit"],r=new Set(e),o=Object.keys(t.hooks).filter(i=>!r.has(i)).map(i=>Rs(i,"copilot",e,{unsupportedBy:"Copilot hooks"}));return Object.values(t.hooks).some(i=>Array.isArray(i)&&i.length>0)&&o.push(b(".agentsmesh/hooks.yaml","copilot","copilot hooks are emitted as .github/hooks/scripts/*.sh wrapper scripts with a `#!/usr/bin/env bash` header; they require a POSIX shell (git-bash or WSL) to execute on Windows.")),o}var Wk=d(()=>{Et();s(Kk,"lintCommands");s(Bk,"lintHooks");});function pB(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function uB(t,e){let r=relative(t,e).replace(/\\/g,"/");return !r||r.startsWith("../")?null:r}function dB(t,e){let r=t.match(zk);if(!r?.groups)return t;let o=r.groups.prefix??"",n=r.groups.suffix??"";return `${o}"$HOOK_DIR/${e}"${n}`}async function gB(t,e){let o=e.match(zk)?.groups?.path;if(!o)return null;let n=join(t,o),i=await y(n);if(i===null)return null;let a=uB(t,n);return a?{assetPath:`${rn}/scripts/${a}`,content:i,rewrittenCommand:dB(e,a)}:null}function fB(t,e){return `${rn}/scripts/${pB(t)}-${e}.sh`}function Hk(t){return t.replace(/[\r\n]+/g," ")}function hB(t,e){return ["#!/usr/bin/env bash",`# agentsmesh-matcher: ${Hk(e)}`,`# agentsmesh-command: ${Hk(t)}`,"set -eu",t,""].join(`
102
- `)}async function Vk(t,e,r){if(!e.hooks)return r;let o=[],n=new Map;for(let[i,a]of Object.entries(e.hooks)){if(!Array.isArray(a))continue;let c=0;for(let l of a){if(!Iu(l))continue;let m=fB(i,c),p=l.command,u=await gB(t,l.command);u&&(p=u.rewrittenCommand,n.has(u.assetPath)||n.set(u.assetPath,{path:u.assetPath,content:u.content}));let g=hB(p,l.matcher).replace(`set -eu
108
+ `)}function fb(t){let e=t.rules.find(n=>n.root),r=[];e&&r.push({path:Sa,content:e.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("copilot")||n.globs.length===0)continue;let o=Jz(n.source),i={description:n.description||void 0,applyTo:n.globs.length===1?n.globs[0]:n.globs};Object.keys(i).forEach(l=>{i[l]===void 0&&delete i[l];});let a=T(i,n.body.trim()||"");r.push({path:`${Ca}/${o}.instructions.md`,content:a});}return r}function gb(t){return t.commands.map(e=>({path:Ju(e.name),content:pb(e)}))}function hb(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${lo}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${lo}/${r.name}/${a}`,content:i.content});}}return e}function yb(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0,"mcp-servers":e.mcpServers.length>0?e.mcpServers:void 0,skills:e.skills.length>0?e.skills:void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=T(r,e.body.trim()||"");return {path:`${ka}/${e.name}.agent.md`,content:n}})}function _b(t){if(!t.hooks)return [];let e=Object.fromEntries(Object.entries(t.hooks).flatMap(([r,n])=>{let o=Yz(r);if(!o||!Array.isArray(n))return [];let i=n.filter(a=>typeof a=="object"&&a!==null&&Xu(a)).map((a,l)=>{let m={type:"command",bash:`./scripts/${r.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}-${l}.sh`,comment:`Matcher: ${a.matcher}`};return a.timeout!==void 0&&(m.timeoutSec=Math.ceil(a.timeout/1e3)),m});return i.length>0?[[o,i]]:[]}));return Object.keys(e).length===0?[]:[{path:`${ao}/agentsmesh.json`,content:JSON.stringify({version:1,hooks:e},null,2)}]}var Rb=d(()=>{j();wr();Yu();My();s(Jz,"ruleSlug");s(Yz,"mapHookEvent");s(db,"renderCopilotGlobalInstructions");s(fb,"generateRules");s(gb,"generateCommands");s(hb,"generateSkills");s(yb,"generateAgents");s(_b,"generateHooks");});function Zz(t){switch(t){case "preToolUse":return "PreToolUse";case "postToolUse":return "PostToolUse";case "notification":return "Notification";case "userPromptSubmitted":return "UserPromptSubmit";default:return null}}function Qz(t){return typeof t!="string"?"*":t.match(/^Matcher:\s*(.+)$/)?.[1]?.trim()||"*"}function Cb(t){let e=t.match(/^# agentsmesh-command:\s*(.+)$/m);return e?.[1]?e[1].trim():t.replace(/^#!.*\n/,"").replace(/^#.*\n/gm,"").replace(/^HOOK_DIR=.*\n/gm,"").replace(/^set -e[u]?\n?/m,"").trim()}async function kb(t,e){let r=join(t,ao),o=(await v(r).catch(()=>[])).filter(p=>p.endsWith(".json")),i={};for(let p of o){let u=await _(p);if(!u)continue;let f;try{f=JSON.parse(u);}catch{continue}if(!(!f||typeof f.hooks!="object"||f.hooks===null))for(let[g,h]of Object.entries(f.hooks)){let R=Zz(g);if(!(!R||!Array.isArray(h)))for(let C of h){if(!C||typeof C!="object")continue;let S=C,k=typeof S.bash=="string"?S.bash:"";if(!k)continue;let P=join(r,k.replace(/^\.\//,"")),N=await _(P);if(!N)continue;let F=Cb(N);F&&(i[R]||(i[R]=[]),i[R].push({matcher:Qz(S.comment),command:F,type:"command"}));}}}let a=join(t,cb),c=(await v(a).catch(()=>[])).filter(p=>dirname(p)===a&&/^[^-]+-\d+\.sh$/i.test(basename(p)));for(let p of c){let u=await _(p);if(!u)continue;let f=basename(p,".sh"),g=f.lastIndexOf("-"),h=g>0?f.slice(0,g):f;i[h]||(i[h]=[]),i[h].push({matcher:"*",command:Cb(u),type:"command"});}if(Object.keys(i).length===0)return;let m=join(t,Ny);await O(dirname(m)),await I(m,stringify(i)),e.push({fromTool:ps,fromPath:join(t,ao),toPath:Ny,feature:"hooks"});}var Eb=d(()=>{w();wr();s(Zz,"mapCopilotHookEvent");s(Qz,"extractMatcher");s(Cb,"extractWrapperCommand");s(kb,"importHooks");});async function Lb(t,e,r,n=lo){let o=join(t,n),i=await Bm(o),a={projectRoot:t,destCanonicalSkillsDir:lb,targetName:ps,normalize:r,results:e};for(let[l,c]of i)await Um(l,c,a);}var Ob=d(()=>{Yl();wr();s(Lb,"importSkills");});async function Ab(t,e={}){let r=e.scope??"project",n=[],o=await B(ps,t,r);return n.push(...await J(Zu,t,r,{normalize:o})),await Lb(t,n,o,r==="global"?us:lo),r==="project"&&await kb(t,n),n}var wb=d(()=>{dt();Et();wr();Eb();Ob();$y();s(Ab,"importFromCopilot");});function bb(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var Pb,Tb,xb,Db,Nb=d(()=>{j();ut();or();Yu();wr();s(bb,"pruneUndefined");Pb=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=t.replace(/\.instructions\.md$/i,".md"),o=join(r,n),{frontmatter:i,body:a}=b(e(o)),l=wo(i.globs),c=bb({root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0});return {destPath:o,toPath:`${Ea}/${n}`,content:await K(o,c,a)}},"copilotLegacyRuleMapper"),Tb=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=t.endsWith(".instructions.md")?t.replace(/\.instructions\.md$/i,".md"):t,o=join(r,n),{frontmatter:i,body:a}=b(e(o)),l=wo(i.applyTo!==void 0?i.applyTo:i.globs),c=bb({root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0});return {destPath:o,toPath:`${Ea}/${n}`,content:await K(o,c,a)}},"copilotNewRuleMapper"),xb=s(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:n})=>{let o=e.replace(/\.prompt\.md$/i,".md"),i=join(n,o),{frontmatter:a,body:l}=b(r(i)),c=ub(a,t),m=o.includes("/")?o.slice(0,o.lastIndexOf("/")):"",p=`${c.name}.md`,u=m?`${m}/${p}`:p,f=join(n,u);return {destPath:f,toPath:`${zu}/${u}`,content:await _t(f,{description:c.description,hasDescription:Object.prototype.hasOwnProperty.call(a,"description"),allowedTools:c.allowedTools,hasAllowedTools:Object.prototype.hasOwnProperty.call(a,"tools")||Object.prototype.hasOwnProperty.call(a,"x-agentsmesh-allowed-tools")},l)}},"copilotCommandMapper"),Db=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(!t.endsWith(".agent.md"))return null;let n=t.replace(/\.agent\.md$/i,".md"),o=basename(n,".md"),i=join(r,n),{frontmatter:a,body:l}=b(e(i));return {destPath:i,toPath:`${Vu}/${n}`,content:await Vt(i,{...a,name:typeof a.name=="string"?a.name:o},l)}},"copilotAgentMapper");});function Fb(t,e,r,n){let i=V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(l=>({...l,target:ps})),a=t.rules.filter(l=>!l.root&&l.globs.length===0);return [...i,...a.map(l=>({level:"warning",file:l.source,target:ps,message:"Copilot path-specific instructions require applyTo globs; non-root rules without globs are not generated."}))]}var vb=d(()=>{It();wr();s(Fb,"lintRules");});function Mb(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>x(e.source,"copilot","Copilot prompt files do not enforce canonical allowed-tools natively."))}function $b(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","Notification","UserPromptSubmit"],r=new Set(e),n=Object.keys(t.hooks).filter(i=>!r.has(i)).map(i=>Ps(i,"copilot",e,{unsupportedBy:"Copilot hooks"}));return Object.values(t.hooks).some(i=>Array.isArray(i)&&i.length>0)&&n.push(x(".agentsmesh/hooks.yaml","copilot","copilot hooks are emitted as .github/hooks/scripts/*.sh wrapper scripts with a `#!/usr/bin/env bash` header; they require a POSIX shell (git-bash or WSL) to execute on Windows.")),n}var Gb=d(()=>{Lt();s(Mb,"lintCommands");s($b,"lintHooks");});function nV(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function oV(t,e){let r=relative(t,e).replace(/\\/g,"/");return !r||r.startsWith("../")?null:r}function sV(t,e){let r=t.match(Ub);if(!r?.groups)return t;let n=r.groups.prefix??"",o=r.groups.suffix??"";return `${n}"$HOOK_DIR/${e}"${o}`}async function iV(t,e){let n=e.match(Ub)?.groups?.path;if(!n)return null;let o=join(t,n),i=await _(o);if(i===null)return null;let a=oV(t,o);return a?{assetPath:`${ao}/scripts/${a}`,content:i,rewrittenCommand:sV(e,a)}:null}function aV(t,e){return `${ao}/scripts/${nV(t)}-${e}.sh`}function jb(t){return t.replace(/[\r\n]+/g," ")}function lV(t,e){return ["#!/usr/bin/env bash",`# agentsmesh-matcher: ${jb(e)}`,`# agentsmesh-command: ${jb(t)}`,"set -eu",t,""].join(`
109
+ `)}async function Bb(t,e,r){if(!e.hooks)return r;let n=[],o=new Map;for(let[i,a]of Object.entries(e.hooks)){if(!Array.isArray(a))continue;let l=0;for(let c of a){if(!Xu(c))continue;let m=aV(i,l),p=c.command,u=await iV(t,c.command);u&&(p=u.rewrittenCommand,o.has(u.assetPath)||o.set(u.assetPath,{path:u.assetPath,content:u.content}));let f=lV(p,c.matcher).replace(`set -eu
103
110
  `,`set -eu
104
111
  HOOK_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
105
- `);o.push({path:m,content:g}),c++;}}return [...r,...o,...n.values()]}var zk,Jk=d(()=>{T();Sr();Kh();zk=/^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;s(pB,"safePhaseName");s(uB,"toRepoRelative");s(dB,"rewriteWrapperCommand");s(gB,"buildAssetOutput");s(fB,"wrapperPath");s(Hk,"safeShellLine");s(hB,"buildWrapper");s(Vk,"addHookScriptAssets");});function _B(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var Yk,Xk=d(()=>{T();Sr();s(_B,"computeStatus");Yk=s(async(t,e,r,o)=>{if(r!=="global"||!o.has("rules"))return [];let n=t.rules.find(c=>c.root);if(!n)return [];let i=n.body.trim(),a=await y(join(e,_a));return [{target:"copilot",path:_a,content:i,currentContent:a??void 0,status:_B(a,i)}]},"generateCopilotGlobalExtras");});var RB,SB,CB,EB,Su,Wh=d(()=>{Ak();Sr();Bh();$k();Uk();Rt();_u();Wk();Jk();Xk();RB={name:"copilot",primaryRootInstructionPath:ga,generateRules:Sk,generateCommands:Ck,generateAgents:Ok,generateSkills:Ek,generateHooks:Lk,importFrom:Ru},SB={rootInstructionPath:ga,outputFamilies:[{id:"instructions",kind:"additional",pathPrefix:".github/instructions/"}],extraRuleOutputPaths(t){if(t.root||t.globs.length===0)return [];let e=basename(t.source,".md");return [`${fa}/${e}.instructions.md`]},skillDir:".github/skills",managedOutputs:{dirs:[".github/agents",".github/instructions",".github/prompts",".github/skills",".github/hooks/scripts"],files:[".github/copilot-instructions.md",".github/hooks/agentsmesh.json"]},paths:{rulePath(t,e){return `${fa}/${t}.instructions.md`},commandPath(t,e){return yu(t)},agentPath(t,e){return `${ha}/${t}.agent.md`}}},CB={rootInstructionPath:qs,renderPrimaryRootInstruction:Rk,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[_a]}],skillDir:is,managedOutputs:{dirs:[Dc,is,Nc,Uh,jh],files:[qs,_a]},rewriteGeneratedPath(t){return t===ga?qs:t.startsWith(`${fa}/`)?qs:t.startsWith(`${Qs}/`)?t.replace(`${Qs}/`,`${Nc}/`):t.startsWith(`${ha}/`)?t.replace(`${ha}/`,`${Dc}/`):t.startsWith(`${on}/`)?t.replace(`${on}/`,`${is}/`):t.startsWith(`${rn}/`)?null:t},mirrorGlobalPath(t,e){if(t.startsWith(`${is}/`)&&!e.includes("codex-cli")){let r=t.slice(is.length+1);return [`.agents/skills/${r}`,`${jh}/${r}`]}return null},paths:{rulePath(t,e){return qs},commandPath(t,e){return `${Nc}/${t}.prompt.md`},agentPath(t,e){return `${Dc}/${t}.agent.md`}}},EB={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},Su={id:"copilot",metadata:{displayName:"GitHub Copilot",category:"ide",officialUrl:"https://github.com/features/copilot",shortDescription:"GitHub's AI pair programmer"},generators:RB,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"none",hooks:"partial",ignore:"none",permissions:"none"},emptyImportMessage:"No Copilot config found (.github/copilot-instructions.md, .github/copilot or .github/instructions, .github/prompts, .github/skills, .github/agents, or .github/hooks).",lintRules:jk,lint:{commands:Kk,hooks:Bk},postProcessHookOutputs:s(async(t,e,r)=>Vk(t,e,[...r]),"postProcessHookOutputs"),project:SB,globalSupport:{capabilities:EB,detectionPaths:[qs,_a,Dc,is,Nc,Uh],layout:CB,scopeExtras:Yk},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[ga],global:[qs]},canonicalDir:ya,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[gk]},canonicalDir:ya,extensions:[".instructions.md"],map:Fk},{feature:"rules",mode:"directory",source:{project:[fa]},canonicalDir:ya,extensions:[".instructions.md",".md"],map:vk}],commands:{feature:"commands",mode:"directory",source:{project:[Qs],global:[Nc]},canonicalDir:fu,extensions:[".prompt.md"],map:Gk},agents:{feature:"agents",mode:"directory",source:{project:[ha],global:[Dc]},canonicalDir:hu,extensions:[".agent.md"],map:Mk}},buildImportPaths:wf,detectionPaths:[".github/copilot-instructions.md",".github/copilot",".github/instructions",".github/prompts",".github/skills",".github/agents",".github/hooks"]};});function Cu(t){return {$schema:"https://charm.land/crush.json",...t}}var Zk=d(()=>{s(Cu,"buildCrushConfigJson");});function Qk(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(sr)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:ir,content:n}]:[]}function qk(t){return tt(t,Yt)}function tw(t){return t.commands.map(e=>({path:`${Yt}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function ew(t){return t.agents.map(e=>({path:`${Yt}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function rw(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Cu({mcp:t.mcp.mcpServers});return [{path:Pe,content:JSON.stringify(e,null,2)}]}function ow(t){if(!t.hooks)return [];let e=OB(t);if(Object.keys(e).length===0)return [];let r=Cu({hooks:e});return [{path:Pe,content:JSON.stringify(r,null,2)}]}function nw(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];if(e.length===0&&r.length===0&&o.length===0)return [];let n={};e.length>0&&(n.allowed_tools=e),r.length>0&&(n.denied_tools=r);let i=Cu({permissions:n});return [{path:Pe,content:JSON.stringify(i,null,2)}]}function sw(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
106
- `);return [{path:Dn,content:e}]}function OB(t){if(!t.hooks)return {};let e={};for(let[r,o]of Object.entries(t.hooks)){if(!Array.isArray(o))continue;let n=[];for(let i of o){let a=typeof i.command=="string"?i.command.trim():"";if(!a)continue;let c={matcher:i.matcher,command:a};i.timeout!==void 0&&(c.timeout=i.timeout),n.push(c);}n.length>0&&(e[r]=n);}return e}var iw=d(()=>{Q();Mt();st();St();ec();Zk();s(Qk,"generateRules");s(qk,"generateSkills");s(tw,"generateCommands");s(ew,"generateAgents");s(rw,"generateMcp");s(ow,"generateHooks");s(nw,"generatePermissions");s(sw,"generateIgnore");s(OB,"buildCrushHooksFromCanonical");});async function cw(t,e={}){let r=e.scope??"project",o=[],n=await U(sr,t,r);return o.push(...await z(Eu,t,r,{normalize:n})),await Z(t,r==="global"?xe:Yt,sr,o,n),await LB(t,o),o}async function LB(t,e){let r=join(t,Pe),o=await y(r);if(o===null)return;let n;try{n=JSON.parse(o);}catch{return}if(!n||typeof n!="object"||Array.isArray(n))return;let i=n,a=AB(i.mcp);if(Object.keys(a).length>0){let l=Mp,m=join(t,l);await L(dirname(m)),await _(m,JSON.stringify({mcpServers:a},null,2)),e.push({fromTool:sr,fromPath:r,toPath:l,feature:"mcp"});}let c=kB(i.hooks);if(c!==null&&Object.keys(c).length>0){let l=".agentsmesh/hooks.yaml",m=join(t,l);await L(dirname(m));let p=wB(c);await _(m,p),e.push({fromTool:sr,fromPath:r,toPath:l,feature:"hooks"});}}function AB(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,o]of Object.entries(t)){if(!o||typeof o!="object"||Array.isArray(o))continue;let n=o,i=typeof n.description=="string"?n.description:void 0;if(typeof n.command=="string"){e[r]={type:typeof n.type=="string"?n.type:"stdio",command:n.command,args:_s(n.args),env:_o(n.env),...i!==void 0?{description:i}:{}};continue}typeof n.url=="string"&&(e[r]={type:typeof n.type=="string"?n.type:"http",url:n.url,headers:_o(n.headers),env:_o(n.env),...i!==void 0?{description:i}:{}});}return e}function kB(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,c=typeof a.command=="string"?a.command.trim():"";if(!c)continue;let m={matcher:typeof a.matcher=="string"?a.matcher:"",command:c};typeof a.timeout=="number"&&(m.timeout=a.timeout),n.push(m);}n.length>0&&(e[r]=n);}return Object.keys(e).length>0?e:null}function wB(t){let e=[];for(let[r,o]of Object.entries(t)){e.push(`${r}:`);for(let n of o)e.push(` - matcher: ${JSON.stringify(n.matcher)}`),e.push(` command: ${JSON.stringify(n.command)}`),n.timeout!==void 0&&e.push(` timeout: ${n.timeout}`);}return e.join(`
107
- `)}var lw=d(()=>{mt();Q();Ct();T();tr();zh();ec();s(cw,"importFromCrush");s(LB,"importCrushConfigJson");s(AB,"parseCrushMcpServers");s(kB,"parseCrushHooks");s(wB,"serializeHooksYaml");});function mw(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:sr}))}var pw=d(()=>{_t();ec();s(mw,"lintRules");});function uw(t){return t.commands.length===0?[]:[b(".agentsmesh/commands","crush","Crush has no native slash-command format; commands are projected as skills via supportsConversion.")]}var dw=d(()=>{Et();s(uw,"lintCommands");});function Vh(t){try{let e=JSON.parse(t);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return {}}}function fw(t,e){let r=Vh(t),o=bB.parse(JSON.parse(e)),n={...r};o.permissions!==void 0&&(n.permissions=o.permissions),o.hooks!==void 0&&(n.hooks=o.hooks);let i=n.permissions;return i&&typeof i=="object"&&!Array.isArray(i)&&!("ask"in i)&&(i.ask=[]),JSON.stringify(n,null,2)}function hw(t,e){let r=Vh(t),o=PB.parse(JSON.parse(e)),n={...r};return o.mcpServers!==void 0&&(n.mcpServers=o.mcpServers),o.hooks!==void 0&&(n.hooks=o.hooks),o.experimental!==void 0&&(n.experimental=o.experimental),o.context!==void 0&&(n.context=o.context),JSON.stringify(n,null,2)}function yw(t,e){let r=Vh(t),o=TB.parse(JSON.parse(e)),n={...r};return o.$schema!==void 0&&(n.$schema=o.$schema),o.mcp!==void 0&&(n.mcp=o.mcp),o.hooks!==void 0&&(n.hooks=o.hooks),o.permissions!==void 0&&(n.permissions=o.permissions),o.options!==void 0&&(n.options=o.options),JSON.stringify(n,null,2)}var gw,TB,bB,PB,Ou=d(()=>{gw=[".claude/settings.json",".gemini/settings.json"],TB=z$1.object({$schema:z$1.string().optional(),mcp:z$1.record(z$1.string(),z$1.unknown()).optional(),hooks:z$1.record(z$1.string(),z$1.unknown()).optional(),permissions:z$1.record(z$1.string(),z$1.unknown()).optional(),options:z$1.record(z$1.string(),z$1.unknown()).optional()}).passthrough(),bB=z$1.object({permissions:z$1.object({allow:z$1.array(z$1.string()).optional(),deny:z$1.array(z$1.string()).optional()}).passthrough().optional(),hooks:z$1.record(z$1.string(),z$1.unknown()).optional()}).passthrough(),PB=z$1.object({mcpServers:z$1.record(z$1.string(),z$1.unknown()).optional(),hooks:z$1.record(z$1.string(),z$1.unknown()).optional(),experimental:z$1.record(z$1.string(),z$1.unknown()).optional(),context:z$1.record(z$1.string(),z$1.unknown()).optional()}).passthrough();s(Vh,"parseJsonObject");s(fw,"mergeSettingsJson");s(hw,"mergeGeminiSettingsJson");s(yw,"mergeCrushConfigJson");});var xB,DB,NB,FB,vB,Eu,zh=d(()=>{St();st();iw();Qt();lw();pw();dw();Rt();Ou();ec();xB={name:sr,primaryRootInstructionPath:ir,generateRules:Qk,generateCommands:tw,generateAgents:ew,generateSkills:qk,generateMcp:rw,generateHooks:ow,generatePermissions:nw,generateIgnore:sw,importFrom:cw},DB={rootInstructionPath:ir,skillDir:Yt,managedOutputs:{dirs:[Yt],files:[ir,Pe,Dn]},paths:{rulePath(t){return ir},commandPath(t){return `${Yt}/${W(t)}/SKILL.md`},agentPath(t){return `${Yt}/${$(t)}/SKILL.md`}}},NB={rootInstructionPath:vi,skillDir:xe,managedOutputs:{dirs:[xe],files:[vi,Fp]},rewriteGeneratedPath(t){return t===ir?vi:t===Pe?Fp:t===Dn?null:t.startsWith(`${Yt}/`)?t.replace(`${Yt}/`,`${xe}/`):t},mirrorGlobalPath(t,e){return ct(t,xe,e)},paths:{rulePath(t){return vi},commandPath(t){return `${xe}/${W(t)}/SKILL.md`},agentPath(t){return `${xe}/${$(t)}/SKILL.md`}}},FB={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"partial"},vB={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"none",permissions:"none"},Eu={id:sr,metadata:{displayName:"Crush",category:"cli",officialUrl:"https://github.com/charmbracelet/crush",shortDescription:"Charm's TUI coding agent"},generators:xB,capabilities:FB,emptyImportMessage:"No Crush config found (CRUSH.md, .crush/skills/, crush.json, or .crushignore).",lintRules:mw,lint:{commands:uw},supportsConversion:{commands:true,agents:true},project:DB,globalSupport:{capabilities:vB,detectionPaths:[vi,Fp,xe],layout:NB},mergeGeneratedOutputContent(t,e,r,o){let n=e?.content??t;return n!==null&&o===Pe?yw(n,r):null},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[ir],global:[vi]},canonicalDir:vp,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Dn]},canonicalDir:".agentsmesh",canonicalFilename:Gp}},buildImportPaths:Tf,detectionPaths:[ir,Pe,Yt,Dn],sharedArtifacts:{".crush/skills/":"owner"}};});function Jh(t){let e=[],r=t.rules.find(i=>i.root);if(r){let i=r.body.trim()?r.body:"";e.push({path:As,content:i});let a={alwaysApply:true};r.description&&(a.description=r.description);let c=P(a,i);e.push({path:Nn,content:c});}let o=t.rules.filter(i=>!i.root&&(i.targets.length===0||i.targets.includes("cursor")));for(let i of o){let a=basename(i.source,".md"),l={alwaysApply:i.trigger==="always_on"};i.description&&(l.description=i.description),i.globs.length>0&&(l.globs=i.globs);let m=P(l,i.body.trim()||"");e.push({path:`${ar}/${a}.mdc`,content:m});}let n=_w(t);return n.trim()&&e.push({path:Ur,content:n}),e}function _w(t){let e=t.rules.find(n=>n.root),r=t.rules.filter(n=>!n.root&&(n.targets.length===0||n.targets.includes("cursor"))),o=[];return e?.body.trim()?o.push(it(e.body,r)):r.length>0&&o.push(it("",r)),o.filter(Boolean).join(`
112
+ `);n.push({path:m,content:f}),l++;}}return [...r,...n,...o.values()]}var Ub,Kb=d(()=>{w();wr();My();Ub=/^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;s(nV,"safePhaseName");s(oV,"toRepoRelative");s(sV,"rewriteWrapperCommand");s(iV,"buildAssetOutput");s(aV,"wrapperPath");s(jb,"safeShellLine");s(lV,"buildWrapper");s(Bb,"addHookScriptAssets");});function mV(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var Wb,Hb=d(()=>{w();wr();s(mV,"computeStatus");Wb=s(async(t,e,r,n)=>{if(r!=="global"||!n.has("rules"))return [];let o=t.rules.find(l=>l.root);if(!o)return [];let i=o.body.trim(),a=await _(join(e,La));return [{target:"copilot",path:La,content:i,currentContent:a??void 0,status:mV(a,i)}]},"generateCopilotGlobalExtras");});var uV,dV,fV,gV,Zu,$y=d(()=>{Rb();wr();wb();Nb();vb();Ct();Yu();Gb();Kb();Hb();uV={name:"copilot",primaryRootInstructionPath:Sa,generateRules:fb,generateCommands:gb,generateAgents:yb,generateSkills:hb,generateHooks:_b,importFrom:Ab},dV={rootInstructionPath:Sa,outputFamilies:[{id:"instructions",kind:"additional",pathPrefix:".github/instructions/"}],extraRuleOutputPaths(t){if(t.root||t.globs.length===0)return [];let e=basename(t.source,".md");return [`${Ca}/${e}.instructions.md`]},skillDir:".github/skills",managedOutputs:{dirs:[".github/agents",".github/instructions",".github/prompts",".github/skills",".github/hooks/scripts"],files:[".github/copilot-instructions.md",".github/hooks/agentsmesh.json"]},paths:{rulePath(t,e){return `${Ca}/${t}.instructions.md`},commandPath(t,e){return Ju(t)},agentPath(t,e){return `${ka}/${t}.agent.md`}}},fV={rootInstructionPath:ii,renderPrimaryRootInstruction:db,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[La]}],skillDir:us,managedOutputs:{dirs:[Xl,us,Zl,vy,Fy],files:[ii,La]},rewriteGeneratedPath(t){return t===Sa?ii:t.startsWith(`${Ca}/`)?ii:t.startsWith(`${si}/`)?t.replace(`${si}/`,`${Zl}/`):t.startsWith(`${ka}/`)?t.replace(`${ka}/`,`${Xl}/`):t.startsWith(`${lo}/`)?t.replace(`${lo}/`,`${us}/`):t.startsWith(`${ao}/`)?null:t},mirrorGlobalPath(t,e){if(t.startsWith(`${us}/`)&&!e.includes("codex-cli")){let r=t.slice(us.length+1);return [`.agents/skills/${r}`,`${Fy}/${r}`]}return null},paths:{rulePath(t,e){return ii},commandPath(t,e){return `${Zl}/${t}.prompt.md`},agentPath(t,e){return `${Xl}/${t}.agent.md`}}},gV={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},Zu={id:"copilot",metadata:{displayName:"GitHub Copilot",category:"ide",officialUrl:"https://github.com/features/copilot",shortDescription:"GitHub's AI pair programmer"},generators:uV,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"none",hooks:"partial",ignore:"none",permissions:"none"},emptyImportMessage:"No Copilot config found (.github/copilot-instructions.md, .github/copilot or .github/instructions, .github/prompts, .github/skills, .github/agents, or .github/hooks).",lintRules:Fb,lint:{commands:Mb,hooks:$b},postProcessHookOutputs:s(async(t,e,r)=>Bb(t,e,[...r]),"postProcessHookOutputs"),project:dV,globalSupport:{capabilities:gV,detectionPaths:[ii,La,Xl,us,Zl,vy],layout:fV,scopeExtras:Wb},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Sa],global:[ii]},canonicalDir:Ea,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[ab]},canonicalDir:Ea,extensions:[".instructions.md"],map:Pb},{feature:"rules",mode:"directory",source:{project:[Ca]},canonicalDir:Ea,extensions:[".instructions.md",".md"],map:Tb}],commands:{feature:"commands",mode:"directory",source:{project:[si],global:[Zl]},canonicalDir:zu,extensions:[".prompt.md"],map:xb},agents:{feature:"agents",mode:"directory",source:{project:[ka],global:[Xl]},canonicalDir:Vu,extensions:[".agent.md"],map:Db}},buildImportPaths:Oh,detectionPaths:[".github/copilot-instructions.md",".github/copilot",".github/instructions",".github/prompts",".github/skills",".github/agents",".github/hooks"]};});function Qu(t){return {$schema:"https://charm.land/crush.json",...t}}var zb=d(()=>{s(Qu,"buildCrushConfigJson");});function Vb(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(mr)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:pr,content:o}]:[]}function Jb(t){return rt(t,Qt)}function Yb(t){return t.commands.map(e=>({path:`${Qt}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function Xb(t){return t.agents.map(e=>({path:`${Qt}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function Zb(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Qu({mcp:t.mcp.mcpServers});return [{path:ve,content:JSON.stringify(e,null,2)}]}function Qb(t){if(!t.hooks)return [];let e=hV(t);if(Object.keys(e).length===0)return [];let r=Qu({hooks:e});return [{path:ve,content:JSON.stringify(r,null,2)}]}function qb(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];if(e.length===0&&r.length===0&&n.length===0)return [];let o={};e.length>0&&(o.allowed_tools=e),r.length>0&&(o.denied_tools=r);let i=Qu({permissions:o});return [{path:ve,content:JSON.stringify(i,null,2)}]}function tP(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
113
+ `);return [{path:Go,content:e}]}function hV(t){if(!t.hooks)return {};let e={};for(let[r,n]of Object.entries(t.hooks)){if(!Array.isArray(n))continue;let o=[];for(let i of n){let a=typeof i.command=="string"?i.command.trim():"";if(!a)continue;let l={matcher:i.matcher,command:a};i.timeout!==void 0&&(l.timeout=i.timeout),o.push(l);}o.length>0&&(e[r]=o);}return e}var eP=d(()=>{tt();Ut();mt();kt();_l();zb();s(Vb,"generateRules");s(Jb,"generateSkills");s(Yb,"generateCommands");s(Xb,"generateAgents");s(Zb,"generateMcp");s(Qb,"generateHooks");s(qb,"generatePermissions");s(tP,"generateIgnore");s(hV,"buildCrushHooksFromCanonical");});async function nP(t,e={}){let r=e.scope??"project",n=[],o=await B(mr,t,r);return n.push(...await J(qu,t,r,{normalize:o})),await q(t,r==="global"?Me:Qt,mr,n,o),await yV(t,n),n}async function yV(t,e){let r=join(t,ve),n=await _(r);if(n===null)return;let o;try{o=JSON.parse(n);}catch{return}if(!o||typeof o!="object"||Array.isArray(o))return;let i=o,a=_V(i.mcp);if(Object.keys(a).length>0){let c=Su,m=join(t,c);await O(dirname(m)),await I(m,JSON.stringify({mcpServers:a},null,2)),e.push({fromTool:mr,fromPath:r,toPath:c,feature:"mcp"});}let l=RV(i.hooks);if(l!==null&&Object.keys(l).length>0){let c=".agentsmesh/hooks.yaml",m=join(t,c);await O(dirname(m));let p=IV(l);await I(m,p),e.push({fromTool:mr,fromPath:r,toPath:c,feature:"hooks"});}}function _V(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,n]of Object.entries(t)){if(!n||typeof n!="object"||Array.isArray(n))continue;let o=n,i=typeof o.description=="string"?o.description:void 0;if(typeof o.command=="string"){e[r]={type:typeof o.type=="string"?o.type:"stdio",command:o.command,args:ws(o.args),env:Ln(o.env),...i!==void 0?{description:i}:{}};continue}typeof o.url=="string"&&(e[r]={type:typeof o.type=="string"?o.type:"http",url:o.url,headers:Ln(o.headers),env:Ln(o.env),...i!==void 0?{description:i}:{}});}return e}function RV(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,l=typeof a.command=="string"?a.command.trim():"";if(!l)continue;let m={matcher:typeof a.matcher=="string"?a.matcher:"",command:l};typeof a.timeout=="number"&&(m.timeout=a.timeout),o.push(m);}o.length>0&&(e[r]=o);}return Object.keys(e).length>0?e:null}function IV(t){let e=[];for(let[r,n]of Object.entries(t)){e.push(`${r}:`);for(let o of n)e.push(` - matcher: ${JSON.stringify(o.matcher)}`),e.push(` command: ${JSON.stringify(o.command)}`),o.timeout!==void 0&&e.push(` timeout: ${o.timeout}`);}return e.join(`
114
+ `)}var oP=d(()=>{dt();tt();Et();w();or();jy();_l();s(nP,"importFromCrush");s(yV,"importCrushConfigJson");s(_V,"parseCrushMcpServers");s(RV,"parseCrushHooks");s(IV,"serializeHooksYaml");});function sP(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:mr}))}var iP=d(()=>{It();_l();s(sP,"lintRules");});function aP(t){return t.commands.length===0?[]:[x(".agentsmesh/commands","crush","Crush has no native slash-command format; commands are projected as skills via supportsConversion.")]}var lP=d(()=>{Lt();s(aP,"lintCommands");});function Uy(t){try{let e=JSON.parse(t);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return {}}}function mP(t,e){let r=Uy(t),n=CV.parse(JSON.parse(e)),o={...r};n.permissions!==void 0&&(o.permissions=n.permissions),n.hooks!==void 0&&(o.hooks=n.hooks);let i=o.permissions;return i&&typeof i=="object"&&!Array.isArray(i)&&!("ask"in i)&&(i.ask=[]),JSON.stringify(o,null,2)}function pP(t,e){let r=Uy(t),n=kV.parse(JSON.parse(e)),o={...r};return n.mcpServers!==void 0&&(o.mcpServers=n.mcpServers),n.hooks!==void 0&&(o.hooks=n.hooks),n.experimental!==void 0&&(o.experimental=n.experimental),n.context!==void 0&&(o.context=n.context),JSON.stringify(o,null,2)}function uP(t,e){let r=Uy(t),n=SV.parse(JSON.parse(e)),o={...r};return n.$schema!==void 0&&(o.$schema=n.$schema),n.mcp!==void 0&&(o.mcp=n.mcp),n.hooks!==void 0&&(o.hooks=n.hooks),n.permissions!==void 0&&(o.permissions=n.permissions),n.options!==void 0&&(o.options=n.options),JSON.stringify(o,null,2)}var cP,SV,CV,kV,td=d(()=>{cP=[".claude/settings.json",".gemini/settings.json"],SV=z.object({$schema:z.string().optional(),mcp:z.record(z.string(),z.unknown()).optional(),hooks:z.record(z.string(),z.unknown()).optional(),permissions:z.record(z.string(),z.unknown()).optional(),options:z.record(z.string(),z.unknown()).optional()}).passthrough(),CV=z.object({permissions:z.object({allow:z.array(z.string()).optional(),deny:z.array(z.string()).optional()}).passthrough().optional(),hooks:z.record(z.string(),z.unknown()).optional()}).passthrough(),kV=z.object({mcpServers:z.record(z.string(),z.unknown()).optional(),hooks:z.record(z.string(),z.unknown()).optional(),experimental:z.record(z.string(),z.unknown()).optional(),context:z.record(z.string(),z.unknown()).optional()}).passthrough();s(Uy,"parseJsonObject");s(mP,"mergeSettingsJson");s(pP,"mergeGeminiSettingsJson");s(uP,"mergeCrushConfigJson");});var EV,LV,OV,AV,wV,qu,jy=d(()=>{kt();mt();eP();ee();oP();iP();lP();Ct();td();_l();EV={name:mr,primaryRootInstructionPath:pr,generateRules:Vb,generateCommands:Yb,generateAgents:Xb,generateSkills:Jb,generateMcp:Zb,generateHooks:Qb,generatePermissions:qb,generateIgnore:tP,importFrom:nP},LV={rootInstructionPath:pr,skillDir:Qt,managedOutputs:{dirs:[Qt],files:[pr,ve,Go]},paths:{rulePath(t){return pr},commandPath(t){return `${Qt}/${H(t)}/SKILL.md`},agentPath(t){return `${Qt}/${U(t)}/SKILL.md`}}},OV={rootInstructionPath:Ki,skillDir:Me,managedOutputs:{dirs:[Me],files:[Ki,_u]},rewriteGeneratedPath(t){return t===pr?Ki:t===ve?_u:t===Go?null:t.startsWith(`${Qt}/`)?t.replace(`${Qt}/`,`${Me}/`):t},mirrorGlobalPath(t,e){return pt(t,Me,e)},paths:{rulePath(t){return Ki},commandPath(t){return `${Me}/${H(t)}/SKILL.md`},agentPath(t){return `${Me}/${U(t)}/SKILL.md`}}},AV={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"partial"},wV={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"native",ignore:"none",permissions:"none"},qu={id:mr,metadata:{displayName:"Crush",category:"cli",officialUrl:"https://github.com/charmbracelet/crush",shortDescription:"Charm's TUI coding agent"},generators:EV,capabilities:AV,emptyImportMessage:"No Crush config found (CRUSH.md, .crush/skills/, crush.json, or .crushignore).",lintRules:sP,lint:{commands:aP},supportsConversion:{commands:true,agents:true},project:LV,globalSupport:{capabilities:wV,detectionPaths:[Ki,_u,Me],layout:OV},mergeGeneratedOutputContent(t,e,r,n){let o=e?.content??t;return o!==null&&n===ve?uP(o,r):null},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[pr],global:[Ki]},canonicalDir:Ru,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Go]},canonicalDir:".agentsmesh",canonicalFilename:Iu}},buildImportPaths:Ah,detectionPaths:[pr,ve,Qt,Go],sharedArtifacts:{".crush/skills/":"owner"}};});function By(t){let e=[],r=t.rules.find(i=>i.root);if(r){let i=r.body.trim()?r.body:"";e.push({path:vs,content:i});let a={alwaysApply:true};r.description&&(a.description=r.description);let l=T(a,i);e.push({path:jo,content:l});}let n=t.rules.filter(i=>!i.root&&(i.targets.length===0||i.targets.includes("cursor")));for(let i of n){let a=basename(i.source,".md"),c={alwaysApply:i.trigger==="always_on"};i.description&&(c.description=i.description),i.globs.length>0&&(c.globs=i.globs);let m=T(c,i.body.trim()||"");e.push({path:`${ur}/${a}.mdc`,content:m});}let o=dP(t);return o.trim()&&e.push({path:Yr,content:o}),e}function dP(t){let e=t.rules.find(o=>o.root),r=t.rules.filter(o=>!o.root&&(o.targets.length===0||o.targets.includes("cursor"))),n=[];return e?.body.trim()?n.push(lt(e.body,r)):r.length>0&&n.push(lt("",r)),n.filter(Boolean).join(`
108
115
 
109
- `)}var Iw=d(()=>{M();Mt();jt();s(Jh,"generateRules");s(_w,"renderCursorGlobalUserRules");});function Yh(t){return t.commands.map(e=>({path:`${cr}/${e.name}.md`,content:e.body.trim()||""}))}var Rw=d(()=>{jt();s(Yh,"generateCommands");});function Xh(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:To,content:e}]}var Sw=d(()=>{jt();s(Xh,"generateMcp");});function Zh(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${wo}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${wo}/${r.name}/${a}`,content:i.content});}}return e}var Cw=d(()=>{M();jt();s(Zh,"generateSkills");});function Qh(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,permissionMode:e.permissionMode||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,mcpServers:e.mcpServers.length>0?e.mcpServers:void 0,hooks:Object.keys(e.hooks).length>0?e.hooks:void 0,skills:e.skills.length>0?e.skills:void 0,memory:e.memory||void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=P(r,e.body.trim()||"");return {path:`${rc}/${e.name}.md`,content:o}})}var Ew=d(()=>{M();jt();s(Qh,"generateAgents");});function qh(t){return []}var Ow=d(()=>{s(qh,"generatePermissions");});function MB(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!go(i))continue;let a=Kt(i),c=me(i),l=i.type==="prompt"?c||a:a||c,m={type:i.type==="prompt"?"prompt":"command",[i.type==="prompt"?"prompt":"command"]:l};i.timeout!==void 0&&(m.timeout=i.timeout),n.push({matcher:i.matcher,hooks:[m]});}n.length>0&&(e[r]=n);}return e}function ty(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=MB(t.hooks);if(Object.keys(e).length===0)return [];let r=JSON.stringify({version:1,hooks:e},null,2);return [{path:bo,content:r}]}var Lw=d(()=>{Pr();jt();s(MB,"toCursorHooks");s(ty,"generateHooks");});function ey(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
110
- `);return [{path:jr,content:e}]}var Aw=d(()=>{jt();s(ey,"generateIgnore");});var kw=d(()=>{Iw();Rw();Sw();Cw();Ew();Ow();Lw();Aw();});var ww=d(()=>{kw();});async function Au(t,e,r,o){let n=t.replace(/\.mdc$/i,".md"),i=join(e,n),c=k(r(i)).frontmatter.alwaysApply===true,l=c?join(e,"_root.md"):i,{frontmatter:m,body:p}=k(r(l));c&&o();let u={...m,root:c};if(delete u.alwaysApply,!c){let g=$B(m);g!==null&&(u.trigger=g);}return {destPath:l,toPath:`${Po}/${c?"_root.md":n}`,feature:"rules",content:await K(l,u,p)}}function $B(t){return t.alwaysApply!==false?null:(Array.isArray(t.globs)?t.globs:[]).length>0?"glob":(typeof t.description=="string"?t.description:"").trim().length>0?"model_decision":"manual"}async function Tw(t,e,r){let o=join(e,t),{frontmatter:n,body:i}=k(r(o)),a=qe(n.allowedTools),c=a.length>0?a:qe(n["allowed-tools"]);return {destPath:o,toPath:`${Ts}/${t}`,feature:"commands",content:await ht(o,{description:typeof n.description=="string"?n.description:"",hasDescription:Object.prototype.hasOwnProperty.call(n,"description"),allowedTools:c,hasAllowedTools:Object.prototype.hasOwnProperty.call(n,"allowedTools")||Object.prototype.hasOwnProperty.call(n,"allowed-tools")},i)}}async function bw(t,e,r){let o=join(e,t),{frontmatter:n,body:i}=k(r(o));return {destPath:o,toPath:`${bs}/${t}`,feature:"agents",content:await Bt(o,n,i)}}var ry=d(()=>{M();lt();tr();jt();s(Au,"mapCursorRuleFile");s($B,"deriveCursorTrigger");s(Tw,"mapCursorCommandFile");s(bw,"mapCursorAgentFile");});async function Fc(t){let e=join(t.projectRoot,Po);await L(e);let r=join(e,"_root.md"),o=await Qo({content:t.content,projectRoot:t.projectRoot,rulesDir:Po,sourcePath:t.sourcePath,fromTool:"cursor",normalize:t.normalize});t.results.push(...o.results);let n=t.normalize(o.rootContent,t.sourcePath,r);if(!n.trim()&&o.results.length>0)return true;let{frontmatter:i,body:a}=k(n),c=i.root===true?i:{...i,root:true},l=await K(r,c,a);return await _(r,l),t.results.push({fromTool:"cursor",fromPath:t.sourcePath,toPath:`${Po}/_root.md`,feature:"rules"}),true}var oy=d(()=>{T();M();Tc();lt();jt();s(Fc,"importCursorRootFile");});async function xw(t,e,r){let o=join(t,Po),n=false,i=join(t,ar);if(e.push(...await yt({srcDir:i,destDir:o,extensions:[".mdc"],fromTool:"cursor",normalize:r,mapEntry:s(async({srcPath:a,relativePath:c,normalizeTo:l})=>{if(n){let m=await y(a);if(m!==null){let{frontmatter:p}=k(m);if(p.alwaysApply===true)return null}}return Au(c,o,l,()=>{n=true;})},"mapEntry")})),!n){let a=join(t,As),c=await y(a);c!==null&&(n=await Fc({projectRoot:t,results:e,sourcePath:a,content:c,normalize:r}));}if(!n){let a=join(t,VC),c=await y(a);c!==null&&await Fc({projectRoot:t,results:e,sourcePath:a,content:c,normalize:r});}}var Dw=d(()=>{T();M();ke();ry();oy();jt();s(xw,"importCursorRules");});function Nw(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!i||typeof i!="object")continue;let a=i,c=typeof a.matcher=="string"?a.matcher:"";if(!c)continue;let l=Array.isArray(a.hooks)?a.hooks:[];for(let m of l){let p=m.type==="prompt"?"prompt":"command";if(!go({...m,type:p}))continue;let u=p==="prompt"?me(m)||Kt(m):Kt(m)||me(m),g={matcher:c,type:p,command:u};typeof m.timeout=="number"&&(g.timeout=m.timeout),n.push(g);}}n.length>0&&(e[r]=n);}return e}async function Tu(t,e){let r=false,o=join(t,bo),n=await y(o);if(n)try{let p=JSON.parse(n);if(p.hooks&&typeof p.hooks=="object"){let u=Nw(p.hooks);if(Object.keys(u).length>0){let g=stringify(u),f=join(t,zl);await L(dirname(f)),await _(f,g),e.push({fromTool:"cursor",fromPath:o,toPath:zl,feature:"hooks"}),r=!0;}}}catch{}let i=join(t,$p),a=await y(i);if(!a)return;let c;try{c=JSON.parse(a);}catch{return}let l=c.permissions;if(l&&typeof l=="object"&&!Array.isArray(l)){let p=l,u=Array.isArray(p.allow)?p.allow.filter(f=>typeof f=="string"):[],g=Array.isArray(p.deny)?p.deny.filter(f=>typeof f=="string"):[];if(u.length>0||g.length>0){let f=stringify({allow:u,deny:g}),h=join(t,Pf);await L(dirname(h)),await _(h,f),e.push({fromTool:"cursor",fromPath:i,toPath:Pf,feature:"permissions"});}}let m=r?void 0:c.hooks;if(m&&typeof m=="object"&&!Array.isArray(m)){let p=Nw(m);if(Object.keys(p).length>0){let u=stringify(p),g=join(t,zl);await L(dirname(g)),await _(g,u),e.push({fromTool:"cursor",fromPath:i,toPath:zl,feature:"hooks"});}}}async function bu(t,e){let r=[{path:join(t,jr),label:jr},{path:join(t,bf),label:bf}],o=[],n=[];for(let a of r){let c=await y(a.path);if(c!==null){n.push(a.label);for(let l of c.split(/\r?\n/)){let m=l.trim();m&&!o.includes(m)&&o.push(m);}}}if(o.length===0)return;let i=join(t,xf);await L(dirname(i)),await _(i,o.join(`
116
+ `)}var fP=d(()=>{j();Ut();Kt();s(By,"generateRules");s(dP,"renderCursorGlobalUserRules");});function Ky(t){return t.commands.map(e=>({path:`${dr}/${e.name}.md`,content:e.body.trim()||""}))}var gP=d(()=>{Kt();s(Ky,"generateCommands");});function Wy(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:$e,content:e}]}var hP=d(()=>{Kt();s(Wy,"generateMcp");});function Hy(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${me}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${me}/${r.name}/${a}`,content:i.content});}}return e}var yP=d(()=>{j();Kt();s(Hy,"generateSkills");});function zy(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,permissionMode:e.permissionMode||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,mcpServers:e.mcpServers.length>0?e.mcpServers:void 0,hooks:Object.keys(e.hooks).length>0?e.hooks:void 0,skills:e.skills.length>0?e.skills:void 0,memory:e.memory||void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=T(r,e.body.trim()||"");return {path:`${fr}/${e.name}.md`,content:n}})}var _P=d(()=>{j();Kt();s(zy,"generateAgents");});function Vy(t){return []}var RP=d(()=>{s(Vy,"generatePermissions");});function PV(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!Sn(i))continue;let a=zt(i),l=he(i),c=i.type==="prompt"?l||a:a||l,m={type:i.type==="prompt"?"prompt":"command",[i.type==="prompt"?"prompt":"command"]:c};i.timeout!==void 0&&(m.timeout=i.timeout),o.push({matcher:i.matcher,hooks:[m]});}o.length>0&&(e[r]=o);}return e}function Jy(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=PV(t.hooks);if(Object.keys(e).length===0)return [];let r=JSON.stringify({version:1,hooks:e},null,2);return [{path:vn,content:r}]}var IP=d(()=>{Mr();Kt();s(PV,"toCursorHooks");s(Jy,"generateHooks");});function Yy(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
117
+ `);return [{path:Jr,content:e}]}var SP=d(()=>{Kt();s(Yy,"generateIgnore");});var CP=d(()=>{fP();gP();hP();yP();_P();RP();IP();SP();});var kP=d(()=>{CP();});async function rd(t,e,r,n){let o=t.replace(/\.mdc$/i,".md"),i=join(e,o),l=b(r(i)).frontmatter.alwaysApply===true,c=l?join(e,"_root.md"):i,{frontmatter:m,body:p}=b(r(c));l&&n();let u={...m,root:l};if(delete u.alwaysApply,!l){let f=TV(m);f!==null&&(u.trigger=f);}return {destPath:c,toPath:`${Mn}/${l?"_root.md":o}`,feature:"rules",content:await K(c,u,p)}}function TV(t){return t.alwaysApply!==false?null:(Array.isArray(t.globs)?t.globs:[]).length>0?"glob":(typeof t.description=="string"?t.description:"").trim().length>0?"model_decision":"manual"}async function EP(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=b(r(n)),a=nr(o.allowedTools),l=a.length>0?a:nr(o["allowed-tools"]);return {destPath:n,toPath:`${Ms}/${t}`,feature:"commands",content:await _t(n,{description:typeof o.description=="string"?o.description:"",hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),allowedTools:l,hasAllowedTools:Object.prototype.hasOwnProperty.call(o,"allowedTools")||Object.prototype.hasOwnProperty.call(o,"allowed-tools")},i)}}async function LP(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=b(r(n));return {destPath:n,toPath:`${$s}/${t}`,feature:"agents",content:await Vt(n,o,i)}}var Xy=d(()=>{j();ut();or();Kt();s(rd,"mapCursorRuleFile");s(TV,"deriveCursorTrigger");s(EP,"mapCursorCommandFile");s(LP,"mapCursorAgentFile");});async function Ql(t){let e=join(t.projectRoot,Mn);await O(e);let r=join(e,"_root.md"),n=await oo({content:t.content,projectRoot:t.projectRoot,rulesDir:Mn,sourcePath:t.sourcePath,fromTool:"cursor",normalize:t.normalize});t.results.push(...n.results);let o=t.normalize(n.rootContent,t.sourcePath,r);if(!o.trim()&&n.results.length>0)return true;let{frontmatter:i,body:a}=b(o),l=i.root===true?i:{...i,root:true},c=await K(r,l,a);return await I(r,c),t.results.push({fromTool:"cursor",fromPath:t.sourcePath,toPath:`${Mn}/_root.md`,feature:"rules"}),true}var Zy=d(()=>{w();j();Hl();ut();Kt();s(Ql,"importCursorRootFile");});async function AP(t,e,r){let n=join(t,Mn),o=false,i=join(t,ur);if(e.push(...await Rt({srcDir:i,destDir:n,extensions:[".mdc"],fromTool:"cursor",normalize:r,mapEntry:s(async({srcPath:a,relativePath:l,normalizeTo:c})=>{if(o){let m=await _(a);if(m!==null){let{frontmatter:p}=b(m);if(p.alwaysApply===true)return null}}return rd(l,n,c,()=>{o=true;})},"mapEntry")})),!o){let a=join(t,vs),l=await _(a);l!==null&&(o=await Ql({projectRoot:t,results:e,sourcePath:a,content:l,normalize:r}));}if(!o){let a=join(t,kE),l=await _(a);l!==null&&await Ql({projectRoot:t,results:e,sourcePath:a,content:l,normalize:r});}}var wP=d(()=>{w();j();xe();Xy();Zy();Kt();s(AP,"importCursorRules");});function bP(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!i||typeof i!="object")continue;let a=i,l=typeof a.matcher=="string"?a.matcher:"";if(!l)continue;let c=Array.isArray(a.hooks)?a.hooks:[];for(let m of c){let p=m.type==="prompt"?"prompt":"command";if(!Sn({...m,type:p}))continue;let u=p==="prompt"?he(m)||zt(m):zt(m)||he(m),f={matcher:l,type:p,command:u};typeof m.timeout=="number"&&(f.timeout=m.timeout),o.push(f);}}o.length>0&&(e[r]=o);}return e}async function sd(t,e){let r=false,n=join(t,vn),o=await _(n);if(o)try{let p=JSON.parse(o);if(p.hooks&&typeof p.hooks=="object"){let u=bP(p.hooks);if(Object.keys(u).length>0){let f=stringify(u),g=join(t,_m);await O(dirname(g)),await I(g,f),e.push({fromTool:"cursor",fromPath:n,toPath:_m,feature:"hooks"}),r=!0;}}}catch{}let i=join(t,Cu),a=await _(i);if(!a)return;let l;try{l=JSON.parse(a);}catch{return}let c=l.permissions;if(c&&typeof c=="object"&&!Array.isArray(c)){let p=c,u=Array.isArray(p.allow)?p.allow.filter(g=>typeof g=="string"):[],f=Array.isArray(p.deny)?p.deny.filter(g=>typeof g=="string"):[];if(u.length>0||f.length>0){let g=stringify({allow:u,deny:f}),h=join(t,bh);await O(dirname(h)),await I(h,g),e.push({fromTool:"cursor",fromPath:i,toPath:bh,feature:"permissions"});}}let m=r?void 0:l.hooks;if(m&&typeof m=="object"&&!Array.isArray(m)){let p=bP(m);if(Object.keys(p).length>0){let u=stringify(p),f=join(t,_m);await O(dirname(f)),await I(f,u),e.push({fromTool:"cursor",fromPath:i,toPath:_m,feature:"hooks"});}}}async function id(t,e){let r=[{path:join(t,Jr),label:Jr},{path:join(t,wh),label:wh}],n=[],o=[];for(let a of r){let l=await _(a.path);if(l!==null){o.push(a.label);for(let c of l.split(/\r?\n/)){let m=c.trim();m&&!n.includes(m)&&n.push(m);}}}if(n.length===0)return;let i=join(t,Ph);await O(dirname(i)),await I(i,n.join(`
111
118
  `)+`
112
- `),e.push({fromTool:"cursor",fromPath:join(t,n[0]),toPath:xf,feature:"ignore"});}var sy=d(()=>{Pr();T();jt();s(Nw,"cursorHooksToCanonical");s(Tu,"importSettings");s(bu,"importIgnore");});async function Pu(t,e,r,o=wo){let n=join(t,o),i=await Zs(n),a={projectRoot:t,sourceSkillsDir:o,destCanonicalSkillsDir:JC,targetName:"cursor",normalize:r,results:e};for(let[p,u]of i)await qo(p,u,a);let c=await v(n).catch(()=>[]),l=c.filter(p=>p.endsWith(".md")),m=new Set(Array.from(i.values()).flatMap(p=>c.filter(u=>u.startsWith(p))));for(let p of l){if(m.has(p))continue;let u=await y(p);if(!u)continue;let g=basename(p,".md");await zL(g,p,u,a);}}var iy=d(()=>{T();Pc();jt();s(Pu,"importSkills");});async function Fw(t){if(await j(join(t,ar)))return true;let e=[join(t,Ur),join(t,oc),join(t,Hl),join(t,bo),join(t,jr),join(t,ks),join(t,ws),join(t,cr)];for(let i of e){let a=await y(i);if(a!==null&&a.trim()!=="")return true}return !!((await v(join(t,ks))).some(i=>i.endsWith(".md"))||(await v(join(t,ws))).some(i=>i.endsWith(".md"))||(await v(join(t,cr))).some(i=>i.endsWith(".md")))}async function vw(t,e,r){let o=join(t,Po),n=false,i=join(t,ar),a=await yt({srcDir:i,destDir:o,extensions:[".mdc"],fromTool:vc,normalize:r,mapEntry:s(async({srcPath:c,relativePath:l,normalizeTo:m})=>{if(n){let p=await y(c);if(p!==null){let{frontmatter:u}=k(p);if(u.alwaysApply===true)return null}}return Au(l,o,m,()=>{n=true;})},"mapEntry")});return e.push(...a),n}async function Gw(t,e,r){let o=join(t,oc),n=await y(o);return n===null||n.trim()===""?false:Fc({projectRoot:t,results:e,sourcePath:o,content:n.trim(),normalize:r})}async function Mw(t,e,r){let o=join(t,Ur),n=await y(o);return n===null||n.trim()===""?false:Fc({projectRoot:t,results:e,sourcePath:o,content:n.trim(),normalize:r})}async function $w(t,e){let r=join(t,Hl),o=await y(r);if(o===null||o.trim()==="")return;let n;try{n=JSON.parse(o);}catch{return}if(!n||typeof n!="object"||!("mcpServers"in n))return;let i=join(t,nc);await L(dirname(i)),await _(i,o),e.push({fromTool:vc,fromPath:r,toPath:nc,feature:"mcp"});}async function jw(t,e,r){let o=join(t,ws),n=join(t,bs);e.push(...await yt({srcDir:o,destDir:n,extensions:[".md"],fromTool:vc,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>bw(i,n,a),"mapEntry")}));}async function Uw(t,e,r){let o=join(t,cr),n=join(t,Ts);e.push(...await yt({srcDir:o,destDir:n,extensions:[".md"],fromTool:vc,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>Tw(i,n,a),"mapEntry")}));}var vc,Kw=d(()=>{T();M();ke();jt();oy();ry();vc="cursor";s(Fw,"hasGlobalCursorArtifacts");s(vw,"importGlobalCursorRulesFromDir");s(Gw,"importGlobalUserRules");s(Mw,"importGlobalDotCursorAgents");s($w,"importGlobalMcp");s(jw,"importGlobalAgents");s(Uw,"importGlobalCommands");});async function Bw(t){if(!await Fw(t))return [];let e=[],r=await U(vc,t,"global"),o=await vw(t,e,r);return o||(o=await Gw(t,e,r)),o||await Mw(t,e,r),await $w(t,e),await Pu(t,e,r,ks),await jw(t,e,r),await Uw(t,e,r),await Tu(t,e),await bu(t,e),e}var Ww=d(()=>{mt();jt();iy();sy();Kw();s(Bw,"importFromCursorGlobalExports");});async function WB(t,e){let r=join(t,To),o=await y(r);if(!o)return;let n;try{n=JSON.parse(o);}catch{return}if(!n||typeof n!="object"||!("mcpServers"in n))return;let i=n.mcpServers;await $t(t,nc,i),e.push({fromTool:"cursor",fromPath:r,toPath:nc,feature:"mcp"});}async function xu(t,e={}){if(e.scope==="global")return Bw(t);let r=[],o=await U("cursor",t);return await xw(t,r,o),r.push(...await z(Du,t,"project",{normalize:o})),await Pu(t,r,o),await WB(t,r),await Tu(t,r),await bu(t,r),r}var ay=d(()=>{mt();T();Ct();Fr();Dw();sy();iy();Ww();jt();cy();s(WB,"importMcp");s(xu,"importFromCursor");});var zw,Vw,Jw=d(()=>{M();lt();tr();jt();zw=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o)),a=qe(n.allowedTools),c=a.length>0?a:qe(n["allowed-tools"]);return {destPath:o,toPath:`${Ts}/${t}`,content:await ht(o,{description:typeof n.description=="string"?n.description:"",hasDescription:Object.prototype.hasOwnProperty.call(n,"description"),allowedTools:c,hasAllowedTools:Object.prototype.hasOwnProperty.call(n,"allowedTools")||Object.prototype.hasOwnProperty.call(n,"allowed-tools")},i)}},"cursorCommandMapper"),Vw=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${bs}/${t}`,content:await Bt(o,n,i)}},"cursorAgentMapper");});function Yw(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(i=>({...i,target:zC}))}var Xw=d(()=>{_t();jt();s(Yw,"lintRules");});function Zw(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>b(e.source,"cursor","Cursor command files are plain Markdown; command description and allowed-tools metadata are not projected."))}function Qw(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,o]of Object.entries(t.mcp.mcpServers)){let n=o.env&&Object.keys(o.env).length>0,i="url"in o,a="headers"in o;(n||i||a)&&e.push(b(".agentsmesh/mcp.json","cursor",`MCP server "${r}" uses env vars or URL/header interpolation; Cursor handling may differ from canonical MCP.`));}return e}function qw(t){if(!t.permissions)return [];let e=t.permissions.ask?.length??0;return t.permissions.allow.length>0||t.permissions.deny.length>0||e>0?[b(".agentsmesh/permissions.yaml","cursor","Cursor permissions are partial; tool-level allow/deny may lose fidelity.")]:[]}var tT=d(()=>{Et();s(Zw,"lintCommands");s(Qw,"lintMcp");s(qw,"lintPermissions");});var HB,zB,VB,JB,Du,cy=d(()=>{ww();jt();Qt();ay();Jw();Xw();Rt();tT();HB={name:"cursor",primaryRootInstructionPath:Nn,generateRules:Jh,generateCommands:Yh,generateAgents:Qh,generateSkills:Zh,generateMcp:Xh,generatePermissions:qh,generateHooks:ty,generateIgnore:ey,importFrom:xu},zB={rootInstructionPath:Nn,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[As,Ur]}],skillDir:".cursor/skills",managedOutputs:{dirs:[".cursor/agents",".cursor/commands",".cursor/rules",".cursor/skills"],files:[".cursor/hooks.json",".cursor/mcp.json",".cursorignore","AGENTS.md"]},paths:{rulePath(t,e){return `.cursor/rules/${t}.mdc`},commandPath(t,e){return `.cursor/commands/${t}.md`},agentPath(t,e){return `.cursor/agents/${t}.md`}}},VB={rootInstructionPath:Nn,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[As,Ur]}],skillDir:ks,managedOutputs:{dirs:[ar,cr,ws,ks],files:[Nn,Ur,Hl,bo,jr,oc]},rewriteGeneratedPath(t){return t===As?null:t===Ur||t===Nn||t.startsWith(`${ar}/`)||t.startsWith(`${cr}/`)||t.startsWith(`${rc}/`)||t.startsWith(`${wo}/`)||t===To||t===bo||t===jr?t:t===$p?null:t},mirrorGlobalPath(t,e){return ct(t,wo,e)},paths:{rulePath(t,e){return `${ar}/${t}.mdc`},commandPath(t,e){return `${cr}/${t}.md`},agentPath(t,e){return `${ws}/${t}.md`}}},JB={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},Du={id:"cursor",metadata:{displayName:"Cursor",category:"ide",officialUrl:"https://cursor.com",shortDescription:"AI-first code editor"},generators:HB,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"partial"},emptyImportMessage:"No Cursor config found (AGENTS.md or .cursor/rules/*.mdc; with --global: ~/.cursor/{rules/*.mdc,AGENTS.md,mcp.json,hooks.json,cursorignore,skills/,agents/,commands/} and legacy ~/.agentsmesh-exports/cursor/user-rules.md).",lintRules:Yw,lint:{commands:Zw,mcp:Qw,permissions:qw},project:zB,globalSupport:{capabilities:JB,detectionPaths:[Nn,Ur,To,bo,jr,wo,ws,cr,oc],layout:VB},importer:{commands:{feature:"commands",mode:"directory",source:{project:[cr]},canonicalDir:Ts,extensions:[".md"],map:zw},agents:{feature:"agents",mode:"directory",source:{project:[rc]},canonicalDir:bs,extensions:[".md"],map:Vw}},buildImportPaths:Df,detectionPaths:[".cursor/rules",".cursor/mcp.json"],preservesManualActivation:true};});function eT(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(xo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:lr,content:n}]:[]}function rT(t){return tt(t,ie)}function oT(t){return t.commands.map(e=>({path:`${ie}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function nT(t){return t.agents.map(e=>({path:`${ie}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function sT(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Fn,content:e}]}var iT=d(()=>{Q();Mt();st();St();sc();s(eT,"generateRules");s(rT,"generateSkills");s(oT,"generateCommands");s(nT,"generateAgents");s(sT,"generateMcp");});async function aT(t,e={}){let r=e.scope??"project",o=[],n=await U(xo,t,r);return o.push(...await z(Nu,t,r,{normalize:n})),await Z(t,r==="global"?Kr:ie,xo,o,n),o}var cT=d(()=>{mt();Q();Ct();sc();ly();s(aT,"importFromDeepagentsCli");});function lT(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:xo}))}var mT=d(()=>{_t();sc();s(lT,"lintRules");});function pT(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","deepagents-cli","Deep Agents CLI hooks are global-only (~/.deepagents/hooks.json); project-level canonical hooks are not projected.")]:[]:[]}function uT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","deepagents-cli","Deep Agents CLI permissions are managed via shell allow-lists (--shell-allow-list); canonical permissions are not projected.")]}function dT(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","deepagents-cli","Deep Agents CLI has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var gT=d(()=>{Et();s(pT,"lintHooks");s(uT,"lintPermissions");s(dT,"lintIgnore");});var YB,XB,ZB,QB,qB,Nu,ly=d(()=>{St();st();iT();cT();mT();gT();Rt();sc();YB={name:xo,primaryRootInstructionPath:lr,generateRules:eT,generateCommands:oT,generateAgents:nT,generateSkills:rT,generateMcp:sT,importFrom:aT},XB={rootInstructionPath:lr,skillDir:ie,managedOutputs:{dirs:[ie],files:[lr,Fn]},paths:{rulePath(t){return lr},commandPath(t){return `${ie}/${W(t)}/SKILL.md`},agentPath(t){return `${ie}/${$(t)}/SKILL.md`}}},ZB={rootInstructionPath:vn,skillDir:Kr,managedOutputs:{dirs:[Kr],files:[vn,Gi]},rewriteGeneratedPath(t){return t===lr?vn:t===Fn?Gi:t.startsWith(`${ie}/`)?t.replace(`${ie}/`,`${Kr}/`):t},paths:{rulePath(t){return vn},commandPath(t){return `${Kr}/${W(t)}/SKILL.md`},agentPath(t){return `${Kr}/${$(t)}/SKILL.md`}}},QB={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},qB={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Nu={id:xo,metadata:{displayName:"Deep Agents CLI",category:"cli",officialUrl:"https://github.com/langchain-ai/deepagents",shortDescription:"LangChain Deep Agents framework CLI"},generators:YB,capabilities:QB,emptyImportMessage:"No Deep Agents CLI config found (.deepagents/AGENTS.md, .deepagents/skills, or .mcp.json).",lintRules:lT,lint:{hooks:pT,permissions:uT,ignore:dT},supportsConversion:{commands:true,agents:true},project:XB,globalSupport:{capabilities:qB,detectionPaths:[vn,Gi],layout:ZB},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[lr],global:[vn]},canonicalDir:XC,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Fn],global:[Gi]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:Nf,detectionPaths:[lr,Fn]};});function fT(t){let e={name:t.name};return t.description&&(e.description=t.description.slice(0,500)),t.model?e.model=t.model:e.model="inherit",t.tools.length>0&&(e.tools=t.tools),P(e,t.body.trim()||"")}var hT=d(()=>{M();s(fT,"serializeDroid");});function yT(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(mr)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:pr,content:n}]:[]}function _T(t){return tt(t,_e)}function IT(t){return t.commands.map(e=>({path:`${_e}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function RT(t){return t.agents.map(e=>({path:`${Do}/${e.name}.md`,content:fT(e)}))}function ST(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:No,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var CT=d(()=>{Q();Mt();St();hT();$i();s(yT,"generateRules");s(_T,"generateSkills");s(IT,"generateCommands");s(RT,"generateAgents");s(ST,"generateMcp");});async function OT(t,e,r){let o=await y(join(t,e));if(o===null)return;let n;try{n=JSON.parse(o);}catch{return}if(n===null||typeof n!="object"||Array.isArray(n))return;let a=n.mcpServers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let c={};for(let[l,m]of Object.entries(a))!m||typeof m!="object"||Array.isArray(m)||(c[l]=m);Object.keys(c).length!==0&&(await $t(t,ET,c),r.push({fromTool:mr,fromPath:e,toPath:ET,feature:"mcp"}));}var ET,LT=d(()=>{T();Fr();$i();ET=".agentsmesh/mcp.json";s(OT,"importFactoryDroidMcp");});async function AT(t,e={}){let r=e.scope??"project",o=[],n=await U(mr,t,r);return o.push(...await z(Fu,t,r,{normalize:n})),await Z(t,r==="global"?Fo:_e,mr,o,n),await OT(t,r==="global"?Ps:No,o),o}var kT=d(()=>{mt();Q();Ct();LT();$i();my();s(AT,"importFromFactoryDroid");});function wT(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:mr}))}var TT=d(()=>{_t();$i();s(wT,"lintRules");});function bT(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","factory-droid","Factory Droid hooks are configured via settings.json events (PreToolUse/PostToolUse), not standalone files; canonical hooks are not projected.")]:[]:[]}function PT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","factory-droid","Factory Droid permissions are managed via CLI flags (--skip-permissions-unsafe); canonical permissions are not projected.")]}function xT(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","factory-droid","Factory Droid has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var DT=d(()=>{Et();s(bT,"lintHooks");s(PT,"lintPermissions");s(xT,"lintIgnore");});var eW,rW,oW,NT,Fu,my=d(()=>{CT();$i();kT();TT();DT();Rt();St();eW={name:mr,primaryRootInstructionPath:pr,generateRules:yT,generateCommands:IT,generateAgents:RT,generateSkills:_T,generateMcp:ST,importFrom:AT},rW={rootInstructionPath:pr,skillDir:_e,managedOutputs:{dirs:[_e,Do],files:[pr,No]},paths:{rulePath(t){return pr},commandPath(t){return `${_e}/${W(t)}/SKILL.md`},agentPath(t){return `${Do}/${t}.md`}}},oW={rootInstructionPath:Gn,skillDir:Fo,managedOutputs:{dirs:[Fo,Mi],files:[Gn,Ps]},rewriteGeneratedPath(t){return t===pr?Gn:t===No?Ps:t.startsWith(`${_e}/`)?t.replace(`${_e}/`,`${Fo}/`):t.startsWith(`${Do}/`)?t.replace(`${Do}/`,`${Mi}/`):t},paths:{rulePath(t){return Gn},commandPath(t){return `${Fo}/${W(t)}/SKILL.md`},agentPath(t){return `${Mi}/${t}.md`}}},NT={rules:"native",additionalRules:"embedded",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Fu={id:mr,metadata:{displayName:"Factory Droid",category:"agent-platform",officialUrl:"https://www.factory.ai",shortDescription:"Factory.ai's coding droid"},generators:eW,capabilities:NT,emptyImportMessage:"No Factory Droid config found (AGENTS.md, .factory/skills, or .factory/mcp.json).",lintRules:wT,lint:{hooks:bT,permissions:PT,ignore:xT},supportsConversion:{commands:true},project:rW,globalSupport:{capabilities:NT,detectionPaths:[Gn,Ps,Mi],layout:oW},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[pr],global:[Gn]},canonicalDir:QC,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:Ff,detectionPaths:[pr,No,Do]};});var ti,Cr,nn,FT,vT,Me,vu,Ia,Gu,_m,ei,GT,MT,ri,Mu,Im,Rm,py,uy,Gc,dy,Mc,$c,$u,jc,Ra,Sm,Wt=d(()=>{ti="gemini-cli",Cr="GEMINI.md",nn="AGENTS.md",FT=".gemini/rules",vT=".gemini/GEMINI.md",Me=".gemini/commands",vu=".gemini/policies",Ia=".gemini/settings.json",Gu=".geminiignore",_m=".gemini/skills",ei=".gemini/agents",GT=".gemini/system.md",MT=`${vu}/permissions.toml`,ri=".agentsmesh/rules",Mu=".agentsmesh/commands",Im=".agentsmesh/agents",Rm=".agentsmesh/skills",py=".agentsmesh/mcp.json",uy=".agentsmesh/hooks.yaml",Gc=".agentsmesh/ignore",dy=".agentsmesh/permissions.yaml",Mc=".gemini/GEMINI.md",$c=".gemini/AGENTS.md",$u=".gemini/settings.json",jc=".gemini/commands",Ra=".gemini/skills",Sm=".gemini/agents";});function gy(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>!(i.root||i.targets.length>0&&!i.targets.includes("gemini-cli")));if(!e&&r.length===0)return [];let o=it(e?.body.trim()??"",r),n=[{path:Cr,content:o}];return e&&n.push({path:nn,content:e.body.trim()}),n}var $T=d(()=>{Mt();Wt();s(gy,"generateRules");});function jT(t,e){let r=t.split(":").filter(Boolean),o=r.length>0?r.pop():t;return [e,...r,`${o}.toml`].join("/")}var UT=d(()=>{s(jT,"canonicalCommandNameToGeminiTomlPath");});function nW(t){let e=t.replace(/\r\n/g,`
119
+ `),e.push({fromTool:"cursor",fromPath:join(t,o[0]),toPath:Ph,feature:"ignore"});}var qy=d(()=>{Mr();w();Kt();s(bP,"cursorHooksToCanonical");s(sd,"importSettings");s(id,"importIgnore");});async function ad(t,e,r,n=me){let o=join(t,n),i=await Bm(o),a={projectRoot:t,destCanonicalSkillsDir:EE,targetName:"cursor",normalize:r,results:e};for(let[p,u]of i)await Um(p,u,a);let l=await v(o).catch(()=>[]),c=l.filter(p=>p.endsWith(".md")),m=new Set(Array.from(i.values()).flatMap(p=>l.filter(u=>u.startsWith(p))));for(let p of c){if(m.has(p))continue;let u=await _(p);if(!u)continue;let f=basename(p,".md");await PA(f,p,u,a);}}var t_=d(()=>{w();Yl();Kt();s(ad,"importSkills");});async function PP(t){if(await $(join(t,ur)))return true;let e=[join(t,Yr),join(t,Rl),join(t,$e),join(t,vn),join(t,Jr),join(t,me),join(t,fr),join(t,dr)];for(let i of e){let a=await _(i);if(a!==null&&a.trim()!=="")return true}return !!((await v(join(t,me))).some(i=>i.endsWith(".md"))||(await v(join(t,fr))).some(i=>i.endsWith(".md"))||(await v(join(t,dr))).some(i=>i.endsWith(".md")))}async function TP(t,e,r){let n=join(t,Mn),o=false,i=join(t,ur),a=await Rt({srcDir:i,destDir:n,extensions:[".mdc"],fromTool:ql,normalize:r,mapEntry:s(async({srcPath:l,relativePath:c,normalizeTo:m})=>{if(o){let p=await _(l);if(p!==null){let{frontmatter:u}=b(p);if(u.alwaysApply===true)return null}}return rd(c,n,m,()=>{o=true;})},"mapEntry")});return e.push(...a),o}async function xP(t,e,r){let n=join(t,Rl),o=await _(n);return o===null||o.trim()===""?false:Ql({projectRoot:t,results:e,sourcePath:n,content:o.trim(),normalize:r})}async function DP(t,e,r){let n=join(t,Yr),o=await _(n);return o===null||o.trim()===""?false:Ql({projectRoot:t,results:e,sourcePath:n,content:o.trim(),normalize:r})}async function NP(t,e){let r=join(t,$e),n=await _(r);if(n===null||n.trim()==="")return;let o;try{o=JSON.parse(n);}catch{return}if(!o||typeof o!="object"||!("mcpServers"in o))return;let i=join(t,Il);await O(dirname(i)),await I(i,n),e.push({fromTool:ql,fromPath:r,toPath:Il,feature:"mcp"});}async function FP(t,e,r){let n=join(t,fr),o=join(t,$s);e.push(...await Rt({srcDir:n,destDir:o,extensions:[".md"],fromTool:ql,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>LP(i,o,a),"mapEntry")}));}async function vP(t,e,r){let n=join(t,dr),o=join(t,Ms);e.push(...await Rt({srcDir:n,destDir:o,extensions:[".md"],fromTool:ql,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>EP(i,o,a),"mapEntry")}));}var ql,MP=d(()=>{w();j();xe();Kt();Zy();Xy();ql="cursor";s(PP,"hasGlobalCursorArtifacts");s(TP,"importGlobalCursorRulesFromDir");s(xP,"importGlobalUserRules");s(DP,"importGlobalDotCursorAgents");s(NP,"importGlobalMcp");s(FP,"importGlobalAgents");s(vP,"importGlobalCommands");});async function $P(t){if(!await PP(t))return [];let e=[],r=await B(ql,t,"global"),n=await TP(t,e,r);return n||(n=await xP(t,e,r)),n||await DP(t,e,r),await NP(t,e),await ad(t,e,r,me),await FP(t,e,r),await vP(t,e,r),await sd(t,e),await id(t,e),e}var GP=d(()=>{dt();Kt();t_();qy();MP();s($P,"importFromCursorGlobalExports");});async function vV(t,e){let r=join(t,$e),n=await _(r);if(!n)return;let o;try{o=JSON.parse(n);}catch{return}if(!o||typeof o!="object"||!("mcpServers"in o))return;let i=o.mcpServers;await Bt(t,Il,i),e.push({fromTool:"cursor",fromPath:r,toPath:Il,feature:"mcp"});}async function jP(t,e={}){if(e.scope==="global")return $P(t);let r=[],n=await B("cursor",t);return await AP(t,r,n),r.push(...await J(ld,t,"project",{normalize:n})),await ad(t,r,n),await vV(t,r),await sd(t,r),await id(t,r),r}var UP=d(()=>{dt();w();Et();Kr();wP();qy();t_();GP();Kt();e_();s(vV,"importMcp");s(jP,"importFromCursor");});var KP,WP,HP=d(()=>{j();ut();or();Kt();KP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n)),a=nr(o.allowedTools),l=a.length>0?a:nr(o["allowed-tools"]);return {destPath:n,toPath:`${Ms}/${t}`,content:await _t(n,{description:typeof o.description=="string"?o.description:"",hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),allowedTools:l,hasAllowedTools:Object.prototype.hasOwnProperty.call(o,"allowedTools")||Object.prototype.hasOwnProperty.call(o,"allowed-tools")},i)}},"cursorCommandMapper"),WP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${$s}/${t}`,content:await Vt(n,o,i)}},"cursorAgentMapper");});function zP(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:CE}))}var VP=d(()=>{It();Kt();s(zP,"lintRules");});function JP(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>x(e.source,"cursor","Cursor command files are plain Markdown; command description and allowed-tools metadata are not projected."))}function YP(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,n]of Object.entries(t.mcp.mcpServers)){let o=n.env&&Object.keys(n.env).length>0,i="url"in n,a="headers"in n;(o||i||a)&&e.push(x(".agentsmesh/mcp.json","cursor",`MCP server "${r}" uses env vars or URL/header interpolation; Cursor handling may differ from canonical MCP.`));}return e}function XP(t){if(!t.permissions)return [];let e=t.permissions.ask?.length??0;return t.permissions.allow.length>0||t.permissions.deny.length>0||e>0?[x(".agentsmesh/permissions.yaml","cursor","Cursor permissions are partial; tool-level allow/deny may lose fidelity.")]:[]}var ZP=d(()=>{Lt();s(JP,"lintCommands");s(YP,"lintMcp");s(XP,"lintPermissions");});var MV,$V,GV,jV,ld,e_=d(()=>{kP();Kt();ee();UP();HP();VP();Ct();ZP();MV={name:"cursor",primaryRootInstructionPath:jo,generateRules:By,generateCommands:Ky,generateAgents:zy,generateSkills:Hy,generateMcp:Wy,generatePermissions:Vy,generateHooks:Jy,generateIgnore:Yy,importFrom:jP},$V={rootInstructionPath:jo,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[vs,Yr]}],skillDir:".cursor/skills",managedOutputs:{dirs:[".cursor/agents",".cursor/commands",".cursor/rules",".cursor/skills"],files:[".cursor/hooks.json",".cursor/mcp.json",".cursorignore","AGENTS.md"]},paths:{rulePath(t,e){return `.cursor/rules/${t}.mdc`},commandPath(t,e){return `.cursor/commands/${t}.md`},agentPath(t,e){return `.cursor/agents/${t}.md`}}},GV={rootInstructionPath:jo,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[vs,Yr]}],skillDir:me,managedOutputs:{dirs:[ur,dr,fr,me],files:[jo,Yr,$e,vn,Jr,Rl]},rewriteGeneratedPath(t){return t===vs?null:t===Yr||t===jo||t.startsWith(`${ur}/`)||t.startsWith(`${dr}/`)||t.startsWith(`${fr}/`)||t.startsWith(`${me}/`)||t===$e||t===vn||t===Jr?t:t===Cu?null:t},mirrorGlobalPath(t,e){return pt(t,me,e)},paths:{rulePath(t,e){return `${ur}/${t}.mdc`},commandPath(t,e){return `${dr}/${t}.md`},agentPath(t,e){return `${fr}/${t}.md`}}},jV={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},ld={id:"cursor",metadata:{displayName:"Cursor",category:"ide",officialUrl:"https://cursor.com",shortDescription:"AI-first code editor"},generators:MV,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"partial"},emptyImportMessage:"No Cursor config found (AGENTS.md or .cursor/rules/*.mdc; with --global: ~/.cursor/{rules/*.mdc,AGENTS.md,mcp.json,hooks.json,cursorignore,skills/,agents/,commands/} and legacy ~/.agentsmesh-exports/cursor/user-rules.md).",lintRules:zP,lint:{commands:JP,mcp:YP,permissions:XP},project:$V,globalSupport:{capabilities:jV,detectionPaths:[jo,Yr,$e,vn,Jr,me,fr,dr,Rl],layout:GV},importer:{commands:{feature:"commands",mode:"directory",source:{project:[dr]},canonicalDir:Ms,extensions:[".md"],map:KP},agents:{feature:"agents",mode:"directory",source:{project:[fr]},canonicalDir:$s,extensions:[".md"],map:WP}},buildImportPaths:Th,detectionPaths:[".cursor/rules",".cursor/mcp.json"],preservesManualActivation:true};});function QP(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes($n)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:gr,content:o}]:[]}function qP(t){return rt(t,pe)}function tT(t){return t.commands.map(e=>({path:`${pe}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function eT(t){return t.agents.map(e=>({path:`${pe}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function rT(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Uo,content:e}]}var nT=d(()=>{tt();Ut();mt();kt();Sl();s(QP,"generateRules");s(qP,"generateSkills");s(tT,"generateCommands");s(eT,"generateAgents");s(rT,"generateMcp");});async function oT(t,e={}){let r=e.scope??"project",n=[],o=await B($n,t,r);return n.push(...await J(cd,t,r,{normalize:o})),await q(t,r==="global"?Xr:pe,$n,n,o),n}var sT=d(()=>{dt();tt();Et();Sl();r_();s(oT,"importFromDeepagentsCli");});function iT(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:$n}))}var aT=d(()=>{It();Sl();s(iT,"lintRules");});function lT(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","deepagents-cli","Deep Agents CLI hooks are global-only (~/.deepagents/hooks.json); project-level canonical hooks are not projected.")]:[]:[]}function cT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","deepagents-cli","Deep Agents CLI permissions are managed via shell allow-lists (--shell-allow-list); canonical permissions are not projected.")]}function mT(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","deepagents-cli","Deep Agents CLI has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var pT=d(()=>{Lt();s(lT,"lintHooks");s(cT,"lintPermissions");s(mT,"lintIgnore");});var UV,BV,KV,WV,HV,cd,r_=d(()=>{kt();mt();nT();sT();aT();pT();Ct();Sl();UV={name:$n,primaryRootInstructionPath:gr,generateRules:QP,generateCommands:tT,generateAgents:eT,generateSkills:qP,generateMcp:rT,importFrom:oT},BV={rootInstructionPath:gr,skillDir:pe,managedOutputs:{dirs:[pe],files:[gr,Uo]},paths:{rulePath(t){return gr},commandPath(t){return `${pe}/${H(t)}/SKILL.md`},agentPath(t){return `${pe}/${U(t)}/SKILL.md`}}},KV={rootInstructionPath:Bo,skillDir:Xr,managedOutputs:{dirs:[Xr],files:[Bo,Wi]},rewriteGeneratedPath(t){return t===gr?Bo:t===Uo?Wi:t.startsWith(`${pe}/`)?t.replace(`${pe}/`,`${Xr}/`):t},paths:{rulePath(t){return Bo},commandPath(t){return `${Xr}/${H(t)}/SKILL.md`},agentPath(t){return `${Xr}/${U(t)}/SKILL.md`}}},WV={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},HV={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},cd={id:$n,metadata:{displayName:"Deep Agents CLI",category:"cli",officialUrl:"https://github.com/langchain-ai/deepagents",shortDescription:"LangChain Deep Agents framework CLI"},generators:UV,capabilities:WV,emptyImportMessage:"No Deep Agents CLI config found (.deepagents/AGENTS.md, .deepagents/skills, or .mcp.json).",lintRules:iT,lint:{hooks:lT,permissions:cT,ignore:mT},supportsConversion:{commands:true,agents:true},project:BV,globalSupport:{capabilities:HV,detectionPaths:[Bo,Wi],layout:KV},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[gr],global:[Bo]},canonicalDir:OE,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Uo],global:[Wi]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:xh,detectionPaths:[gr,Uo]};});function uT(t){let e={name:t.name};return t.description&&(e.description=t.description.slice(0,500)),t.model?e.model=t.model:e.model="inherit",t.tools.length>0&&(e.tools=t.tools),T(e,t.body.trim()||"")}var dT=d(()=>{j();s(uT,"serializeDroid");});function fT(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(hr)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:yr,content:o}]:[]}function gT(t){return rt(t,Le)}function hT(t){return t.commands.map(e=>({path:`${Le}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function yT(t){return t.agents.map(e=>({path:`${Gn}/${e.name}.md`,content:uT(e)}))}function _T(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:jn,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var RT=d(()=>{tt();Ut();kt();dT();zi();s(fT,"generateRules");s(gT,"generateSkills");s(hT,"generateCommands");s(yT,"generateAgents");s(_T,"generateMcp");});async function ST(t,e,r){let n=await _(join(t,e));if(n===null)return;let o;try{o=JSON.parse(n);}catch{return}if(o===null||typeof o!="object"||Array.isArray(o))return;let a=o.mcpServers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let l={};for(let[c,m]of Object.entries(a))!m||typeof m!="object"||Array.isArray(m)||(l[c]=m);Object.keys(l).length!==0&&(await Bt(t,IT,l),r.push({fromTool:hr,fromPath:e,toPath:IT,feature:"mcp"}));}var IT,CT=d(()=>{w();Kr();zi();IT=".agentsmesh/mcp.json";s(ST,"importFactoryDroidMcp");});async function kT(t,e={}){let r=e.scope??"project",n=[],o=await B(hr,t,r);return n.push(...await J(md,t,r,{normalize:o})),await q(t,r==="global"?Un:Le,hr,n,o),await ST(t,r==="global"?Gs:jn,n),n}var ET=d(()=>{dt();tt();Et();CT();zi();n_();s(kT,"importFromFactoryDroid");});function LT(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:hr}))}var OT=d(()=>{It();zi();s(LT,"lintRules");});function AT(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","factory-droid","Factory Droid hooks are configured via settings.json events (PreToolUse/PostToolUse), not standalone files; canonical hooks are not projected.")]:[]:[]}function wT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","factory-droid","Factory Droid permissions are managed via CLI flags (--skip-permissions-unsafe); canonical permissions are not projected.")]}function bT(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","factory-droid","Factory Droid has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var PT=d(()=>{Lt();s(AT,"lintHooks");s(wT,"lintPermissions");s(bT,"lintIgnore");});var VV,JV,YV,TT,md,n_=d(()=>{RT();zi();ET();OT();PT();Ct();kt();VV={name:hr,primaryRootInstructionPath:yr,generateRules:fT,generateCommands:hT,generateAgents:yT,generateSkills:gT,generateMcp:_T,importFrom:kT},JV={rootInstructionPath:yr,skillDir:Le,managedOutputs:{dirs:[Le,Gn],files:[yr,jn]},paths:{rulePath(t){return yr},commandPath(t){return `${Le}/${H(t)}/SKILL.md`},agentPath(t){return `${Gn}/${t}.md`}}},YV={rootInstructionPath:Ko,skillDir:Un,managedOutputs:{dirs:[Un,Hi],files:[Ko,Gs]},rewriteGeneratedPath(t){return t===yr?Ko:t===jn?Gs:t.startsWith(`${Le}/`)?t.replace(`${Le}/`,`${Un}/`):t.startsWith(`${Gn}/`)?t.replace(`${Gn}/`,`${Hi}/`):t},paths:{rulePath(t){return Ko},commandPath(t){return `${Un}/${H(t)}/SKILL.md`},agentPath(t){return `${Hi}/${t}.md`}}},TT={rules:"native",additionalRules:"embedded",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},md={id:hr,metadata:{displayName:"Factory Droid",category:"agent-platform",officialUrl:"https://www.factory.ai",shortDescription:"Factory.ai's coding droid"},generators:VV,capabilities:TT,emptyImportMessage:"No Factory Droid config found (AGENTS.md, .factory/skills, or .factory/mcp.json).",lintRules:LT,lint:{hooks:AT,permissions:wT,ignore:bT},supportsConversion:{commands:true},project:JV,globalSupport:{capabilities:TT,detectionPaths:[Ko,Gs,Hi],layout:YV},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[yr],global:[Ko]},canonicalDir:wE,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:Dh,detectionPaths:[yr,jn,Gn]};});var ai,br,co,xT,DT,He,pd,Oa,ud,Jm,li,NT,FT,ci,dd,Ym,Xm,o_,s_,tc,i_,ec,rc,fd,nc,Aa,Zm,Jt=d(()=>{ai="gemini-cli",br="GEMINI.md",co="AGENTS.md",xT=".gemini/rules",DT=".gemini/GEMINI.md",He=".gemini/commands",pd=".gemini/policies",Oa=".gemini/settings.json",ud=".geminiignore",Jm=".gemini/skills",li=".gemini/agents",NT=".gemini/system.md",FT=`${pd}/permissions.toml`,ci=".agentsmesh/rules",dd=".agentsmesh/commands",Ym=".agentsmesh/agents",Xm=".agentsmesh/skills",o_=".agentsmesh/mcp.json",s_=".agentsmesh/hooks.yaml",tc=".agentsmesh/ignore",i_=".agentsmesh/permissions.yaml",ec=".gemini/GEMINI.md",rc=".gemini/AGENTS.md",fd=".gemini/settings.json",nc=".gemini/commands",Aa=".gemini/skills",Zm=".gemini/agents";});function a_(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>!(i.root||i.targets.length>0&&!i.targets.includes("gemini-cli")));if(!e&&r.length===0)return [];let n=lt(e?.body.trim()??"",r),o=[{path:br,content:n}];return e&&o.push({path:co,content:e.body.trim()}),o}var vT=d(()=>{Ut();Jt();s(a_,"generateRules");});function MT(t,e){let r=t.split(":").filter(Boolean),n=r.length>0?r.pop():t;return [e,...r,`${n}.toml`].join("/")}var $T=d(()=>{s(MT,"canonicalCommandNameToGeminiTomlPath");});function XV(t){let e=t.replace(/\r\n/g,`
113
120
  `);return e.includes('"""')?JSON.stringify(e):`"""
114
121
  ${e}
115
- """`}function sW(t){return [`description = ${JSON.stringify(t.description||t.name)}`,`prompt = ${nW(t.body.trim()||"")}`].join(`
122
+ """`}function ZV(t){return [`description = ${JSON.stringify(t.description||t.name)}`,`prompt = ${XV(t.body.trim()||"")}`].join(`
116
123
  `)+`
117
- `}function fy(t){return t.commands.map(e=>({path:jT(e.name,Me),content:sW(e)}))}var KT=d(()=>{Wt();UT();s(nW,"serializeTomlMultilineLiteral");s(sW,"serializeGeminiCommand");s(fy,"generateCommands");});function hy(t){return t.agents.map(e=>{let r={name:e.name,kind:"local",description:e.description||void 0,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,permissionMode:e.permissionMode||void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=P(r,e.body.trim()||"");return {path:`${ei}/${e.name}.md`,content:o}})}var BT=d(()=>{M();Wt();s(hy,"generateAgents");});function yy(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${_m}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${_m}/${r.name}/${a}`,content:i.content});}}return e}var WT=d(()=>{M();Wt();s(yy,"generateSkills");});function iW(t){switch(t){case "PreToolUse":return "BeforeTool";case "PostToolUse":return "AfterTool";case "Notification":return "Notification";default:return null}}function _y(t){let e={},r=false;if(t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&(e.mcpServers=t.mcp.mcpServers,r=true),t.agents.length>0&&(e.experimental={enableAgents:true},r=true),t.hooks){let o=Object.entries(t.hooks).flatMap(([n,i])=>{let a=iW(n);if(!a||!Array.isArray(i))return [];let c=i.filter(l=>typeof l=="object"&&l!==null&&hn(l)).map((l,m)=>({matcher:l.matcher,hooks:[{name:`${a}-${m+1}`,type:"command",command:Kt(l),timeout:l.timeout}]}));return c.length>0?[[a,c]]:[]});o.length>0&&(e.hooks=Object.fromEntries(o),r=true);}return r&&(e.context={fileName:[Cr,nn]}),Object.keys(e).length===0?[]:[{path:Ia,content:JSON.stringify(e,null,2)}]}var Iy=d(()=>{Pr();Wt();s(iW,"mapHookEvent");s(_y,"generateGeminiSettingsFiles");});function Ry(t){return !t.ignore||t.ignore.length===0?[]:[{path:Gu,content:t.ignore.join(`
118
- `)}]}var HT=d(()=>{Wt();s(Ry,"generateIgnore");});var zT=d(()=>{$T();KT();BT();WT();Iy();HT();});var VT=d(()=>{zT();});function Sa(t){return JSON.stringify(t)}function aW(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cW(t){let e=t.match(/^Bash\((.*)\)$/);if(e&&typeof e[1]=="string")return {kind:"bash",prefix:e[1]};let r=t.match(/^Read\((.*)\)$/);return r&&typeof r[1]=="string"?{kind:"read",path:r[1]}:t==="Read"||t==="Grep"||t==="LS"||t==="WebFetch"?{kind:"tool",tool:t}:{kind:"unknown",raw:t}}function ju(t,e,r){return ["[[rule]]",`decision = ${Sa(t)}`,`priority = ${e}`,...r,""].join(`
119
- `)}function JT(t,e,r){let o=cW(t),n={Read:"read_file",Grep:"grep_search",LS:"list_directory",WebFetch:"web_fetch",Bash:"run_shell_command"};if(o.kind==="tool"){let i=n[o.tool]??o.tool;return ju(e,r,[`toolName = ${Sa(i)}`])}if(o.kind==="bash"){let i=o.prefix.replace(/:\*$/u,"").replace(/\*$/u,"").trim();return ju(e,r,[`toolName = ${Sa(n.Bash)}`,`commandPrefix = ${Sa(i)}`])}return o.kind==="read"?ju(e,r,[`toolName = ${Sa(n.Read)}`,`argsPattern = ${Sa(aW(o.path))}`]):ju(e,r,[`toolName = ${Sa(o.raw)}`])}function YT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions;if(e.length+r.length===0)return [];let n=[];return e.forEach((i,a)=>{let c=JT(i,"allow",100+a);c&&n.push(c);}),r.forEach((i,a)=>{let c=JT(i,"deny",200+a);c&&n.push(c);}),n.length===0?[]:[{path:MT,content:n.join(`
120
- `)}]}var XT=d(()=>{Wt();s(Sa,"escapeTomlBasicString");s(aW,"escapeRegexLiteral");s(cW,"parsePermissionExpr");s(ju,"ruleForDecision");s(JT,"permissionExprToGeminiRule");s(YT,"generateGeminiPermissionsPolicies");});function Sy(t){switch(t){case "BeforeTool":case "preToolUse":return "PreToolUse";case "AfterTool":case "postToolUse":return "PostToolUse";case "Notification":case "notification":return "Notification";default:return null}}function Uu(t){let e=t.indexOf("---"),r=t.indexOf("+++");if(e===0&&(r===-1||e<=r))return k(t);if(r===0){let o=t.indexOf("+++",3);if(o!==-1)try{let n=t.slice(3,o).trim(),i=t.slice(o+3).trim();return {frontmatter:n===""?{}:parse$1(n)??{},body:i}}catch{return {frontmatter:{},body:t.trim()}}}return {frontmatter:{},body:t.trim()}}var Cy=d(()=>{M();s(Sy,"mapGeminiHookEvent");s(Uu,"parseFlexibleFrontmatter");});async function Ey(t,e){let r=join(t,Ia),o=await y(r);if(o===null)return;let n;try{n=JSON.parse(o);}catch{}if(!n)return;let i=n.mcpServers;if(i!==void 0&&typeof i=="object"&&i!==null&&Object.keys(i).length>0){let l=join(t,py);await L(join(t,".agentsmesh")),await _(l,JSON.stringify({mcpServers:i},null,2)),e.push({fromTool:"gemini-cli",fromPath:r,toPath:py,feature:"mcp"});}let a=n.ignorePatterns;if(Array.isArray(a)&&a.length>0&&a.every(l=>typeof l=="string")){let l=join(t,Gc);await L(join(t,".agentsmesh")),await _(l,a.join(`
124
+ `}function l_(t){return t.commands.map(e=>({path:MT(e.name,He),content:ZV(e)}))}var GT=d(()=>{Jt();$T();s(XV,"serializeTomlMultilineLiteral");s(ZV,"serializeGeminiCommand");s(l_,"generateCommands");});function c_(t){return t.agents.map(e=>{let r={name:e.name,kind:"local",description:e.description||void 0,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0,maxTurns:e.maxTurns>0?e.maxTurns:void 0,permissionMode:e.permissionMode||void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=T(r,e.body.trim()||"");return {path:`${li}/${e.name}.md`,content:n}})}var jT=d(()=>{j();Jt();s(c_,"generateAgents");});function m_(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${Jm}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Jm}/${r.name}/${a}`,content:i.content});}}return e}var UT=d(()=>{j();Jt();s(m_,"generateSkills");});function QV(t){switch(t){case "PreToolUse":return "BeforeTool";case "PostToolUse":return "AfterTool";case "Notification":return "Notification";default:return null}}function p_(t){let e={},r=false;if(t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&(e.mcpServers=t.mcp.mcpServers,r=true),t.agents.length>0&&(e.experimental={enableAgents:true},r=true),t.hooks){let n=Object.entries(t.hooks).flatMap(([o,i])=>{let a=QV(o);if(!a||!Array.isArray(i))return [];let l=i.filter(c=>typeof c=="object"&&c!==null&&ko(c)).map((c,m)=>({matcher:c.matcher,hooks:[{name:`${a}-${m+1}`,type:"command",command:zt(c),timeout:c.timeout}]}));return l.length>0?[[a,l]]:[]});n.length>0&&(e.hooks=Object.fromEntries(n),r=true);}return r&&(e.context={fileName:[br,co]}),Object.keys(e).length===0?[]:[{path:Oa,content:JSON.stringify(e,null,2)}]}var u_=d(()=>{Mr();Jt();s(QV,"mapHookEvent");s(p_,"generateGeminiSettingsFiles");});function d_(t){return !t.ignore||t.ignore.length===0?[]:[{path:ud,content:t.ignore.join(`
125
+ `)}]}var BT=d(()=>{Jt();s(d_,"generateIgnore");});var KT=d(()=>{vT();GT();jT();UT();u_();BT();});var WT=d(()=>{KT();});function wa(t){return JSON.stringify(t)}function qV(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function t1(t){let e=t.match(/^Bash\((.*)\)$/);if(e&&typeof e[1]=="string")return {kind:"bash",prefix:e[1]};let r=t.match(/^Read\((.*)\)$/);return r&&typeof r[1]=="string"?{kind:"read",path:r[1]}:t==="Read"||t==="Grep"||t==="LS"||t==="WebFetch"?{kind:"tool",tool:t}:{kind:"unknown",raw:t}}function gd(t,e,r){return ["[[rule]]",`decision = ${wa(t)}`,`priority = ${e}`,...r,""].join(`
126
+ `)}function HT(t,e,r){let n=t1(t),o={Read:"read_file",Grep:"grep_search",LS:"list_directory",WebFetch:"web_fetch",Bash:"run_shell_command"};if(n.kind==="tool"){let i=o[n.tool]??n.tool;return gd(e,r,[`toolName = ${wa(i)}`])}if(n.kind==="bash"){let i=n.prefix.replace(/:\*$/u,"").replace(/\*$/u,"").trim();return gd(e,r,[`toolName = ${wa(o.Bash)}`,`commandPrefix = ${wa(i)}`])}return n.kind==="read"?gd(e,r,[`toolName = ${wa(o.Read)}`,`argsPattern = ${wa(qV(n.path))}`]):gd(e,r,[`toolName = ${wa(n.raw)}`])}function zT(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions;if(e.length+r.length===0)return [];let o=[];return e.forEach((i,a)=>{let l=HT(i,"allow",100+a);l&&o.push(l);}),r.forEach((i,a)=>{let l=HT(i,"deny",200+a);l&&o.push(l);}),o.length===0?[]:[{path:FT,content:o.join(`
127
+ `)}]}var VT=d(()=>{Jt();s(wa,"escapeTomlBasicString");s(qV,"escapeRegexLiteral");s(t1,"parsePermissionExpr");s(gd,"ruleForDecision");s(HT,"permissionExprToGeminiRule");s(zT,"generateGeminiPermissionsPolicies");});function f_(t){switch(t){case "BeforeTool":case "preToolUse":return "PreToolUse";case "AfterTool":case "postToolUse":return "PostToolUse";case "Notification":case "notification":return "Notification";default:return null}}function hd(t){let e=t.indexOf("---"),r=t.indexOf("+++");if(e===0&&(r===-1||e<=r))return b(t);if(r===0){let n=t.indexOf("+++",3);if(n!==-1)try{let o=t.slice(3,n).trim(),i=t.slice(n+3).trim();return {frontmatter:o===""?{}:parse$1(o)??{},body:i}}catch{return {frontmatter:{},body:t.trim()}}}return {frontmatter:{},body:t.trim()}}var g_=d(()=>{j();s(f_,"mapGeminiHookEvent");s(hd,"parseFlexibleFrontmatter");});async function h_(t,e){let r=join(t,Oa),n=await _(r);if(n===null)return;let o;try{o=JSON.parse(n);}catch{}if(!o)return;let i=o.mcpServers;if(i!==void 0&&typeof i=="object"&&i!==null&&Object.keys(i).length>0){let c=join(t,o_);await O(join(t,".agentsmesh")),await I(c,JSON.stringify({mcpServers:i},null,2)),e.push({fromTool:"gemini-cli",fromPath:r,toPath:o_,feature:"mcp"});}let a=o.ignorePatterns;if(Array.isArray(a)&&a.length>0&&a.every(c=>typeof c=="string")){let c=join(t,tc);await O(join(t,".agentsmesh")),await I(c,a.join(`
121
128
  `)+`
122
- `),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Gc,feature:"ignore"});}let c=n.hooks;if(c!==void 0&&typeof c=="object"&&c!==null){let l=Object.entries(c).flatMap(([m,p])=>{let u=Sy(m);if(!u||!Array.isArray(p))return [];let g=p.filter(f=>f!==null&&typeof f=="object"&&typeof f.matcher=="string"&&Array.isArray(f.hooks)).flatMap(f=>f.hooks.filter(h=>h!==null&&typeof h=="object"&&hn(h)).map(h=>({matcher:f.matcher,command:Kt(h),type:"command",timeout:typeof h.timeout=="number"?h.timeout:void 0})));if(g.length===0){let f=p.filter(h=>h!==null&&typeof h=="object"&&typeof h.matcher=="string"&&hn(h)).map(h=>({matcher:h.matcher,command:Kt(h),type:"command"}));return f.length>0?[[u,f]]:[]}return g.length>0?[[u,g]]:[]});if(l.length>0){let m=Object.fromEntries(l),p=join(t,uy);await L(join(t,".agentsmesh")),await _(p,stringify(m,{lineWidth:0}).trimEnd()),e.push({fromTool:"gemini-cli",fromPath:r,toPath:uy,feature:"hooks"});}}}var ZT=d(()=>{Pr();T();Wt();Cy();s(Ey,"importGeminiSettings");});async function QT(t,e){let r=join(t,Gu),o=await y(r);if(o!==null&&o.trim()){let n=o.split(/\r?\n/).map(i=>i.trim()).filter(i=>i&&!i.startsWith("#"));if(n.length>0){await L(join(t,".agentsmesh"));let i=join(t,Gc);await _(i,n.join(`
129
+ `),e.push({fromTool:"gemini-cli",fromPath:r,toPath:tc,feature:"ignore"});}let l=o.hooks;if(l!==void 0&&typeof l=="object"&&l!==null){let c=Object.entries(l).flatMap(([m,p])=>{let u=f_(m);if(!u||!Array.isArray(p))return [];let f=p.filter(g=>g!==null&&typeof g=="object"&&typeof g.matcher=="string"&&Array.isArray(g.hooks)).flatMap(g=>g.hooks.filter(h=>h!==null&&typeof h=="object"&&ko(h)).map(h=>({matcher:g.matcher,command:zt(h),type:"command",timeout:typeof h.timeout=="number"?h.timeout:void 0})));if(f.length===0){let g=p.filter(h=>h!==null&&typeof h=="object"&&typeof h.matcher=="string"&&ko(h)).map(h=>({matcher:h.matcher,command:zt(h),type:"command"}));return g.length>0?[[u,g]]:[]}return f.length>0?[[u,f]]:[]});if(c.length>0){let m=Object.fromEntries(c),p=join(t,s_);await O(join(t,".agentsmesh")),await I(p,stringify(m,{lineWidth:0}).trimEnd()),e.push({fromTool:"gemini-cli",fromPath:r,toPath:s_,feature:"hooks"});}}}var JT=d(()=>{Mr();w();Jt();g_();s(h_,"importGeminiSettings");});async function YT(t,e){let r=join(t,ud),n=await _(r);if(n!==null&&n.trim()){let o=n.split(/\r?\n/).map(i=>i.trim()).filter(i=>i&&!i.startsWith("#"));if(o.length>0){await O(join(t,".agentsmesh"));let i=join(t,tc);await I(i,o.join(`
123
130
  `)+`
124
- `),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Gc,feature:"ignore"});}}}var Ly=d(()=>{T();Wt();Cy();ZT();s(QT,"importGeminiIgnore");});function dW(t){return t.replace(/\\(.)/g,"$1")}function gW(t){switch(t){case "read_file":return "Read";case "grep_search":return "Grep";case "list_directory":return "LS";case "web_fetch":return "WebFetch";case "run_shell_command":return "Bash";default:return null}}function fW(t){return `Bash(${t}:*)`}function hW(t){return `Read(${dW(t)})`}async function qT(t){let e=[],r=join(t,vu),o;try{o=await v(r);}catch{return e}let n=o.filter(u=>u.endsWith(".toml"));if(n.length===0)return e;let i=[],a=[],c=new Set,l=new Set;for(let u of n){let g=await y(u);if(!g)continue;let f;try{f=parse$1(g);}catch{continue}let h=f&&typeof f=="object"&&"rule"in f?f.rule:void 0;if(Array.isArray(h))for(let O of h){if(!O||typeof O!="object")continue;let R=O,S=typeof R.toolName=="string"?R.toolName:null,A=typeof R.decision=="string"?R.decision:null;if(!S||!A)continue;let D=gW(S);if(!D)continue;let N=null;D==="Bash"?typeof R.commandPrefix=="string"&&R.commandPrefix.trim()&&(N=fW(R.commandPrefix.trim())):D==="Read"?typeof R.argsPattern=="string"&&R.argsPattern.trim()?N=hW(R.argsPattern.trim()):N="Read":N=D,N&&(A==="allow"?c.has(N)||(c.add(N),i.push(N)):A==="deny"&&(l.has(N)||(l.add(N),a.push(N))));}}if(i.length===0&&a.length===0)return e;await L(join(t,".agentsmesh"));let m=join(t,dy),p=stringify({allow:i,deny:a});return await _(m,p.trimEnd()+`
125
- `),e.push({fromTool:ti,fromPath:join(t,vu),toPath:dy,feature:"permissions"}),e}var tb=d(()=>{T();Wt();s(dW,"unescapeRegexLiteral");s(gW,"toolNameToPermissionBase");s(fW,"commandPrefixToBashExpr");s(hW,"argsPatternToReadExpr");s(qT,"importGeminiPolicies");});function Ay(t,e){let r=new Set([e,e.replace(/\\/g,"/"),e.replace(/\//g,"\\")]);try{r.add(realpathSync(e)),r.add(realpathSync.native(e));}catch{}return Array.from(r).reduce((n,i)=>{let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return n.replace(new RegExp(`${a}[/\\\\]\\.agentsmesh[/\\\\]`,"g"),".agentsmesh/").replaceAll(`${i}/.agentsmesh`,".agentsmesh").replaceAll(`${i}\\.agentsmesh`,".agentsmesh")},t).replace(/(?:[A-Za-z]:)?[^\s"'`()<>]+[/\\]\.agentsmesh[/\\]/g,".agentsmesh/")}var rb=d(()=>{s(Ay,"stripProjectRootCanonicalPrefix");});async function nb(t,e,r){let o=join(t,_m),i=(await v(o)).filter(c=>basename(c)==="SKILL.md");for(let c of i){let l=await y(c);if(!l)continue;let m=basename(c.slice(0,-9)),p=k(l),u=fo(p.frontmatter,m);if(u){let A=join(t,Im);await L(A);let D=join(A,`${u.name}.md`);await _(D,Je(u,r(p.body,c,D))),e.push({fromTool:"gemini-cli",fromPath:c,toPath:`${Im}/${u.name}.md`,feature:"agents"});continue}let g=join(t,Rm,m,"SKILL.md"),f=r(l,c,g),h=join(t,Rm,m);await L(h);let{frontmatter:O,body:R}=k(f);await _(g,await ho(g,{...O,name:m},R)),e.push({fromTool:"gemini-cli",fromPath:c,toPath:`${Rm}/${m}/SKILL.md`,feature:"skills"});let S=await v(dirname(c));for(let A of S){if(A===c)continue;let D=await y(A);if(D===null)continue;let N=relative(dirname(c),A).replace(/\\/g,"/"),G=join(h,N);await L(dirname(G)),await _(G,r(D,A,G)),e.push({fromTool:"gemini-cli",fromPath:A,toPath:`${Rm}/${m}/${N}`,feature:"skills"});}}let a=join(t,ei);try{let l=(await v(a)).filter(m=>m.endsWith(".md"));for(let m of l){let p=await y(m);if(!p)continue;let{frontmatter:u,body:g}=k(p),h=relative(a,m).replace(/\\/g,"/").replace(/\.md$/i,".md"),O=join(t,Im);await L(O);let R=join(O,h),S=r(g,m,R);await _(R,await Bt(R,{...u,name:typeof u.name=="string"?u.name:basename(h,".md"),maxTurns:u.maxTurns??u["max-turns"]??u.max_turns,permissionMode:u.permissionMode??u["permission-mode"]??u.permission_mode,disallowedTools:u.disallowedTools??u["disallowed-tools"]??u.disallowed_tools},S)),e.push({fromTool:"gemini-cli",fromPath:m,toPath:`${Im}/${h}`,feature:"agents"});}}catch{}}var sb=d(()=>{T();M();lt();st();Wt();s(nb,"importGeminiSkillsAndAgents");});async function yW(t,e,r){let o=await U("codex-cli",t),n=join(t,ri),i=join(t,nn),a=join(t,vT),c=[i,a,join(t,Cr),join(t,GT)],l=null,m=c[c.length-1];for(let N of c){let G=await y(N);if(G!==null){l=G,m=N;break}}if(l===null)return;await L(n);let p=join(n,"_root.md"),u=m===i||m===a?o(l,m,p):l,g=await Qo({content:u,projectRoot:t,rulesDir:ri,sourcePath:m,fromTool:ti,normalize:r});e.push(...g.results);let f=r(g.rootContent,m,p),h=Ay(f.replace(/\.agents\/skills\//g,".agentsmesh/skills/").replace(/\.agents\\skills\\/g,".agentsmesh/skills/"),t),{frontmatter:O,body:R}=k(h),A=O.root===true?O:{...O,root:true},D=Ay(await K(p,A,R),t);await _(p,D),e.push({fromTool:ti,fromPath:m,toPath:`${ri}/_root.md`,feature:"rules"});}async function Bu(t){let e=[],r=await U(ti,t);return await yW(t,e,r),e.push(...await z(Wu,t,"project",{normalize:r})),await nb(t,e,r),await Ey(t,e),await QT(t,e),e.push(...await qT(t)),e}var Ty=d(()=>{mt();T();M();lt();Tc();Ct();Wt();by();Ly();tb();rb();sb();s(yW,"importRootRule");s(Bu,"importFromGemini");});async function ab(t,e,r){let o=t.replace(/\\/g,"/"),n=join(e,o),{frontmatter:i,body:a}=Uu(r(n)),c=Rn(i.globs),l={root:false,description:typeof i.description=="string"?i.description:void 0,globs:c.length>0?c:void 0};return Object.keys(l).forEach(m=>{l[m]===void 0&&delete l[m];}),{destPath:n,toPath:`${ri}/${o}`,feature:"rules",content:await K(n,l,a)}}async function cb(t,e,r){let o=t.replace(/\.(toml|md)$/i,".md").replace(/\\/g,"/"),n=join(e,o),i=r(n),{frontmatter:a,body:c}=t.endsWith(".toml")?IW(i):Uu(i),l=qe(a.allowedTools),m=qe(a["allowed-tools"]),p=l.length>0?l:m;return {destPath:n,toPath:`${Mu}/${o}`,feature:"commands",content:await ht(n,{description:typeof a.description=="string"?a.description:"",hasDescription:Object.prototype.hasOwnProperty.call(a,"description"),allowedTools:p,hasAllowedTools:Object.prototype.hasOwnProperty.call(a,"allowedTools")||Object.prototype.hasOwnProperty.call(a,"allowed-tools")},c)}}function IW(t){try{let e=parse$1(t);return {frontmatter:e,body:typeof e.prompt=="string"?e.prompt:""}}catch{return {frontmatter:{},body:t.trim()}}}var lb=d(()=>{lt();tr();Ly();Wt();s(ab,"mapGeminiRuleFile");s(cb,"mapGeminiCommandFile");s(IW,"parseTomlCommand");});var mb,pb,ub=d(()=>{lb();mb=s(({relativePath:t,destDir:e,normalizeTo:r})=>ab(t,e,r),"geminiRuleMapper"),pb=s(({relativePath:t,destDir:e,normalizeTo:r})=>cb(t,e,r),"geminiCommandMapper");});function db(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(i=>({...i,target:ti}))}var gb=d(()=>{_t();Wt();s(db,"lintRules");});function fb(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>b(e.source,"gemini-cli","Gemini TOML command files do not project canonical allowed-tools metadata."))}function hb(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","Notification"],r=new Set(e);return Object.keys(t.hooks).filter(o=>!r.has(o)).map(o=>Rs(o,"gemini-cli",e))}var yb=d(()=>{Et();s(fb,"lintCommands");s(hb,"lintHooks");});function _b(t,e){return e==="project"&&oi("gemini-cli",e)?.ignore.flavor!=="settings-embedded"?[]:_y(t)}var Ib=d(()=>{xt();Iy();s(_b,"emitScopedGeminiSettings");});var RW,SW,CW,EW,Wu,by=d(()=>{VT();Si();XT();Wt();Ty();ub();gb();Rt();Wa();st();yb();Ib();Qt();Ou();RW={name:"gemini-cli",primaryRootInstructionPath:Cr,generateRules:gy,generateCommands:fy,generateAgents:hy,generateSkills:yy,generateIgnore:Ry,generatePermissions:YT,importFrom:Bu},SW={rootInstructionPath:Cr,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[nn]}],extraRuleOutputPaths(){return [nn]},skillDir:".gemini/skills",managedOutputs:{dirs:[".gemini/agents",".gemini/commands",".gemini/skills",".agents/skills"],files:["AGENTS.md","GEMINI.md",".gemini/settings.json",".gemini/policies/permissions.toml",".geminiignore"]},mirrorGlobalPath(t,e){return ct(t,".gemini/skills",e)},paths:{rulePath(t,e){return Cr},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),o=r.pop()??t;return `${Me}/${r.join("/")}/${o}.toml`}return `${Me}/${t}.toml`},agentPath(t,e){return Ve(e,"gemini-cli")?`.gemini/skills/${$(t)}/SKILL.md`:`${ei}/${t}.md`}}},CW={rootInstructionPath:Mc,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[$c]}],extraRuleOutputPaths(){return [$c]},skillDir:Ra,managedOutputs:{dirs:[jc,Ra,Sm],files:[Mc,$c,$u]},rewriteGeneratedPath(t){return t===Cr?Mc:t===nn?$c:t===Ia?$u:t.startsWith(`${Me}/`)?t.replace(`${Me}/`,`${jc}/`):t.startsWith(".gemini/skills/")?t.replace(".gemini/skills/",`${Ra}/`):t.startsWith(`${ei}/`)?t.replace(`${ei}/`,`${Sm}/`):t.startsWith(".gemini/policies/")||t===".geminiignore"?null:t},mirrorGlobalPath(t,e){return ct(t,Ra,e)},paths:{rulePath(t,e){return Mc},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),o=r.pop()??t;return `${jc}/${r.join("/")}/${o}.toml`}return `${jc}/${t}.toml`},agentPath(t,e){return Ve(e,"gemini-cli")?`${Ra}/${$(t)}/SKILL.md`:`${Sm}/${t}.md`}}},EW={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:"none",permissions:"none"},Wu={id:"gemini-cli",metadata:{displayName:"Gemini CLI",category:"cli",officialUrl:"https://github.com/google-gemini/gemini-cli",shortDescription:"Google's terminal Gemini agent"},generators:RW,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:Nr("native","settings-embedded"),permissions:"partial"},emptyImportMessage:"No Gemini CLI config found (GEMINI.md or .gemini/rules, .gemini/commands, .gemini/settings.json).",lintRules:db,lint:{commands:fb,hooks:hb},emitScopedSettings:_b,mergeGeneratedOutputContent(t,e,r,o){let n=e?.content??t;return n!==null&&o===Ia?hw(n,r):null},project:SW,globalSupport:{capabilities:EW,detectionPaths:[Mc,$c,$u,jc,Ra,Sm],layout:CW},importer:{rules:{feature:"rules",mode:"directory",source:{project:[FT]},canonicalDir:ri,extensions:[".md"],map:mb},commands:{feature:"commands",mode:"directory",source:{project:[Me]},canonicalDir:Mu,extensions:[".md",".toml"],map:pb}},buildImportPaths:vf,detectionPaths:["GEMINI.md",".gemini"]};});function Rb(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(vo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:ur,content:n}]:[]}function Sb(t){return tt(t,ue)}function Cb(t){return t.commands.map(e=>({path:`${ue}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function Eb(t){return t.agents.map(e=>({path:`${ue}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function Ob(t){return t.ignore.length===0?[]:[{path:Mn,content:t.ignore.join(`
126
- `)}]}var Lb=d(()=>{Q();Mt();st();St();ic();s(Rb,"generateRules");s(Sb,"generateSkills");s(Cb,"generateCommands");s(Eb,"generateAgents");s(Ob,"generateIgnore");});async function Ab(t,e={}){let r=e.scope??"project",o=[],n=await U(vo,t,r);return o.push(...await z(Hu,t,r,{normalize:n})),await Z(t,r==="global"?dr:ue,vo,o,n),o}var kb=d(()=>{mt();Q();Ct();ic();Py();s(Ab,"importFromGoose");});function wb(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:vo}))}var Tb=d(()=>{_t();ic();s(wb,"lintRules");});function bb(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","goose","Goose has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Pb(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","goose","Goose permissions are managed at runtime via permission.yaml in ~/.config/goose/; canonical permissions are not projected.")]}function xb(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","goose","Goose MCP extensions are configured globally in ~/.config/goose/config.yaml; project-level MCP is not projected.")]}var Db=d(()=>{Et();s(bb,"lintHooks");s(Pb,"lintPermissions");s(xb,"lintMcp");});var OW,LW,AW,Nb,Hu,Py=d(()=>{St();st();Lb();Qt();kb();Tb();Db();Rt();ic();OW={name:vo,primaryRootInstructionPath:ur,generateRules:Rb,generateCommands:Cb,generateAgents:Eb,generateSkills:Sb,generateIgnore:Ob,importFrom:Ab},LW={rootInstructionPath:ur,skillDir:ue,managedOutputs:{dirs:[ue],files:[ur,Mn]},paths:{rulePath(t){return ur},commandPath(t){return `${ue}/${W(t)}/SKILL.md`},agentPath(t){return `${ue}/${$(t)}/SKILL.md`}}},AW={rootInstructionPath:$n,skillDir:dr,managedOutputs:{dirs:[dr],files:[$n,ji]},rewriteGeneratedPath(t){return t===ur?$n:t===Mn?ji:(t.startsWith(`${ue}/`),t)},mirrorGlobalPath(t,e){return ct(t,dr,e)},paths:{rulePath(t){return $n},commandPath(t){return `${dr}/${W(t)}/SKILL.md`},agentPath(t){return `${dr}/${$(t)}/SKILL.md`}}},Nb={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"native",permissions:"none"},Hu={id:vo,metadata:{displayName:"Goose",category:"cli",officialUrl:"https://block.github.io/goose",shortDescription:"Block's open-source AI agent"},generators:OW,capabilities:Nb,emptyImportMessage:"No Goose config found (.goosehints, .agents/skills, or .gooseignore).",lintRules:wb,lint:{hooks:bb,permissions:Pb,mcp:xb},supportsConversion:{commands:true,agents:true},project:LW,globalSupport:{capabilities:Nb,detectionPaths:[$n,ji,dr],layout:AW},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[ur],global:[$n]},canonicalDir:rE,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Mn],global:[ji]},canonicalDir:".agentsmesh",canonicalFilename:oE}},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:Gf,detectionPaths:[ur,Mn]};});function Fb(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(jn)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:Br,content:n}]:[]}var vb=d(()=>{Mt();ac();s(Fb,"generateRules");});async function Gb(t,e={}){let r=e.scope??"project",o=await U(jn,t,r);return z(zu,t,r,{normalize:o})}var Mb=d(()=>{mt();Ct();ac();xy();s(Gb,"importFromJules");});function $b(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:jn}))}var jb=d(()=>{_t();ac();s($b,"lintRules");});function Ub(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","jules","Jules has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Kb(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","jules","Jules has no permissions system; canonical permissions are not projected.")]}function Bb(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","jules","Jules is a cloud-based agent with no dedicated ignore file; canonical ignore patterns are not projected.")]}function Wb(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","jules","Jules is a cloud-based agent with no MCP support; canonical MCP servers are not projected.")]}function Hb(t){return t.commands.length===0?[]:[b(".agentsmesh/commands","jules","Jules has no command system; canonical commands are not projected.")]}var zb=d(()=>{Et();s(Ub,"lintHooks");s(Kb,"lintPermissions");s(Bb,"lintIgnore");s(Wb,"lintMcp");s(Hb,"lintCommands");});var kW,wW,TW,zu,xy=d(()=>{vb();Mb();jb();zb();Rt();ac();kW={name:jn,primaryRootInstructionPath:Br,generateRules:Fb,importFrom:Gb},wW={rootInstructionPath:Br,managedOutputs:{dirs:[],files:[Br]},paths:{rulePath(t){return Br},commandPath(){return null},agentPath(){return null}}},TW={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"none",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},zu={id:jn,metadata:{displayName:"Jules",category:"agent-platform",officialUrl:"https://jules.google",shortDescription:"Google's autonomous coding agent"},generators:kW,capabilities:TW,emptyImportMessage:"No Jules config found (AGENTS.md).",lintRules:$b,lint:{hooks:Ub,permissions:Kb,ignore:Bb,mcp:Wb,commands:Hb},project:wW,importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Br]},canonicalDir:sE,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:Mf,detectionPaths:[Br]};});function Vb(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Go,content:r.body.trim()||""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("junie"))continue;let n=basename(o.source,".md");e.push({path:`${Jl}/${n}.md`,content:o.body.trim()||""});}return e}function PW(t){let e={};return t.description&&(e.description=t.description),t.type!=="stdio"&&(e.type=t.type),lu(t)?(e.command=t.command,e.args=t.args):(e.url=t.url,Object.keys(t.headers).length>0&&(e.headers=t.headers)),Object.keys(t.env).length>0&&(e.env=t.env),e}function Jb(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Object.fromEntries(Object.entries(t.mcp.mcpServers).map(([r,o])=>[r,PW(o)]));return [{path:Vl,content:JSON.stringify({mcpServers:e},null,2)}]}function Yb(t){return t.commands.map(e=>{let r={description:e.description||void 0};return r.description===void 0&&delete r.description,{path:`${cc}/${e.name}.md`,content:P(r,e.body.trim()||"")}})}function Xb(t){return t.agents.map(e=>{let r={name:e.name,description:e.description||void 0,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,skills:e.skills.length>0?e.skills:void 0};return Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];}),{path:`${lc}/${e.name}.md`,content:P(r,e.body.trim()||"")}})}function Zb(t){return t.ignore.length===0?[]:[{path:Yl,content:t.ignore.join(`
127
- `)}]}function Qb(t){return tt(t,Ki)}function qb(t){let e=t.rules.find(o=>o.root),r=t.rules.filter(o=>o.root?false:o.targets.length===0||o.targets.includes("junie"));return it(e?.body.trim()??"",r)}var tP=d(()=>{mu();Q();Mt();M();mc();s(Vb,"generateRules");s(PW,"toJunieMcpServer");s(Jb,"generateMcp");s(Yb,"generateCommands");s(Xb,"generateAgents");s(Zb,"generateIgnore");s(Qb,"generateSkills");s(qb,"renderJunieGlobalInstructions");});async function xW(t,e,r){let o=[Go,jp,aE,cE],n=join(t,$f);for(let i of o){let a=join(t,i),c=await y(a);if(c===null)continue;let l=await Qo({content:c,projectRoot:t,rulesDir:Kp,sourcePath:a,fromTool:Ui,normalize:r});e.push(...l.results);let{frontmatter:m,body:p}=k(r(l.rootContent,a,n)),u=await K(n,{root:true,description:typeof m.description=="string"?m.description:void 0,globs:Array.isArray(m.globs)?m.globs:void 0},p);await _(n,u),e.push({fromTool:Ui,fromPath:a,toPath:$f,feature:"rules"});return}}async function Vu(t){let e=[],r=await U(Ui,t);return await xW(t,e,r),e.push(...await z(Ju,t,"project",{normalize:r})),await Z(t,Ki,Ui,e,r),e}var Dy=d(()=>{mt();T();M();Q();Tc();lt();Ct();mc();Ny();s(xW,"importRootRule");s(Vu,"importFromJunie");});function rP(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Ui}))}var oP=d(()=>{_t();mc();s(rP,"lintRules");});function nP(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,o]of Object.entries(t.mcp.mcpServers))_A(o)&&e.push(b(".agentsmesh/mcp.json","junie",`MCP server "${r}" uses ${o.type} transport; Junie project mcp.json currently documents stdio MCP servers only.`));return e}var sP=d(()=>{mu();Et();s(nP,"lintMcp");});var DW,NW,FW,vW,Ju,Ny=d(()=>{tP();mc();Qt();Dy();oP();sP();Rt();DW={name:"junie",primaryRootInstructionPath:Go,generateRules:Vb,generateCommands:Yb,generateAgents:Xb,generateSkills:Qb,generateMcp:Jb,generateIgnore:Zb,importFrom:Vu},NW={rootInstructionPath:Go,skillDir:".junie/skills",managedOutputs:{dirs:[".junie/agents",".junie/commands",".junie/rules",".junie/skills"],files:[".aiignore",".junie/AGENTS.md",".junie/mcp/mcp.json"]},paths:{rulePath(t,e){return `${Jl}/${t}.md`},commandPath(t,e){return `${cc}/${t}.md`},agentPath(t,e){return `${lc}/${t}.md`}}},FW={rootInstructionPath:Bi,renderPrimaryRootInstruction:qb,skillDir:Zl,managedOutputs:{dirs:[Zl,Ql,ql,lE],files:[Bi,Up]},rewriteGeneratedPath(t){return t===Go?Bi:t.startsWith(`${Jl}/`)?Bi:t.startsWith(`${Ki}/`)?t.replace(`${Ki}/`,`${Zl}/`):t.startsWith(`${cc}/`)?t.replace(`${cc}/`,`${ql}/`):t.startsWith(`${lc}/`)?t.replace(`${lc}/`,`${Ql}/`):t===Vl?Up:t===Yl?null:t},mirrorGlobalPath(t,e){return ct(t,".junie/skills",e)},paths:{rulePath(t,e){return Bi},commandPath(t,e){return `${ql}/${t}.md`},agentPath(t,e){return `${Ql}/${t}.md`}}},vW={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Ju={id:"junie",metadata:{displayName:"Junie",category:"ide",officialUrl:"https://www.jetbrains.com/junie",shortDescription:"JetBrains AI coding agent"},generators:DW,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Junie config found (.junie/guidelines.md, .junie/AGENTS.md, .junie/skills, .junie/mcp/mcp.json, or .aiignore).",lintRules:rP,lint:{mcp:nP},project:NW,globalSupport:{capabilities:vW,detectionPaths:[Bi,Zl,Ql,ql,Up],layout:FW},importer:{rules:{feature:"rules",mode:"directory",source:{project:[".junie/rules"]},canonicalDir:Kp,extensions:[".md"],preset:"rule"},commands:{feature:"commands",mode:"directory",source:{project:[".junie/commands"]},canonicalDir:mE,extensions:[".md"],preset:"command"},agents:{feature:"agents",mode:"directory",source:{project:[".junie/agents"]},canonicalDir:pE,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Vl]},canonicalDir:".agentsmesh",canonicalFilename:uE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Yl]},canonicalDir:".agentsmesh",canonicalFilename:dE}},buildImportPaths:jf,detectionPaths:[".junie/guidelines.md",".junie/AGENTS.md",".junie/skills",".junie/mcp/mcp.json",".aiignore"]};});function aP(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Mo,content:r.body.trim()?r.body:""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes(de))continue;let n=basename(o.source,".md"),i={};o.description&&(i.description=o.description),o.globs.length>0&&(i.globs=o.globs);let a=Object.keys(i).length>0?P(i,o.body.trim()||""):o.body.trim()||"";e.push({path:`${Un}/${n}.md`,content:a});}return e}function cP(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Kn}/${e.name}.md`,content:P(r,e.body.trim()||"")}})}function lP(t){return t.agents.map(e=>{let r=basename(e.source,".md"),o={mode:"subagent"};return e.description&&(o.description=e.description),e.model&&(o.model=e.model),e.tools.length>0&&(o.tools=e.tools),e.disallowedTools.length>0&&(o.disallowedTools=e.disallowedTools),{path:`${Bn}/${r}.md`,content:P(o,e.body.trim()||"")}})}function mP(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Ds,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function pP(t){return t.ignore.length===0?[]:[{path:pc,content:t.ignore.join(`
128
- `)}]}function uP(t){return tt(t,Wr)}var dP=d(()=>{Q();M();Xi();s(aP,"generateRules");s(cP,"generateCommands");s(lP,"generateAgents");s(mP,"generateMcp");s(pP,"generateIgnore");s(uP,"generateSkills");});var Yu,Xu,gP,vy=d(()=>{M();lt();Xi();Yu=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${vs}/${t}`,content:await K(o,{root:false,description:typeof n.description=="string"?n.description:void 0,globs:Array.isArray(n.globs)?n.globs:void 0},i)}},"kiloNonRootRuleMapper"),Xu=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${fc}/${t}`,content:await ht(o,{hasDescription:Object.prototype.hasOwnProperty.call(n,"description"),description:typeof n.description=="string"?n.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"kiloCommandMapper"),gP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Yi}/${t}`,content:await Bt(o,n,i)}},"kiloAgentMapper");});async function fP(t){try{return await stat(t),!0}catch{return false}}async function $W(t,e,r){let o=join(t,Wi);if(!await fP(o))return;let n=join(t,vs),i=join(o,My),c=e.some(l=>l.toPath===Gy)?null:await y(i);if(c!==null){let l=join(t,Gy),m=r(c,i,l),{body:p}=k(m),u=await K(l,{root:true},p);await _(l,u),e.push({feature:"rules",fromTool:de,fromPath:`${Wi}/${My}`,toPath:Gy});}e.push(...await yt({srcDir:o,destDir:n,extensions:[".md"],fromTool:de,normalize:r,mapEntry:s(async({srcPath:l,relativePath:m,content:p,normalizeTo:u})=>{let g=await Yu({absolutePath:l,relativePath:m,content:p,destDir:n,normalizeTo:u});return m===My||!g?null:{...g,feature:"rules"}},"mapEntry")}));}async function jW(t,e,r){let o=join(t,uc);if(!await fP(o))return;let n=join(t,fc);e.push(...await yt({srcDir:o,destDir:n,extensions:[".md"],fromTool:de,normalize:r,mapEntry:s(async({srcPath:i,relativePath:a,content:c,normalizeTo:l})=>{let m=await Xu({absolutePath:i,relativePath:a,content:c,destDir:n,normalizeTo:l});return m?{...m,feature:"commands"}:null},"mapEntry")}));}async function UW(t,e,r){let o=join(t,Wp),n=await y(o);if(n===null)return;let i;try{i=parse(n);}catch{return}if(!(!i||!Array.isArray(i.customModes)))for(let a of i.customModes){if(!a||typeof a!="object")continue;let c=a;if(typeof c.slug!="string"||c.slug.length===0)continue;let l=c.slug,m=join(t,Yi,`${l}.md`),p=typeof c.description=="string"?c.description:"",u=typeof c.roleDefinition=="string"?c.roleDefinition.trim():"",g=typeof c.whenToUse=="string"?c.whenToUse.trim():"",f=g?`${u}
131
+ `),e.push({fromTool:"gemini-cli",fromPath:r,toPath:tc,feature:"ignore"});}}}var __=d(()=>{w();Jt();g_();JT();s(YT,"importGeminiIgnore");});function s1(t){return t.replace(/\\(.)/g,"$1")}function i1(t){switch(t){case "read_file":return "Read";case "grep_search":return "Grep";case "list_directory":return "LS";case "web_fetch":return "WebFetch";case "run_shell_command":return "Bash";default:return null}}function a1(t){return `Bash(${t}:*)`}function l1(t){return `Read(${s1(t)})`}async function XT(t){let e=[],r=join(t,pd),n;try{n=await v(r);}catch{return e}let o=n.filter(u=>u.endsWith(".toml"));if(o.length===0)return e;let i=[],a=[],l=new Set,c=new Set;for(let u of o){let f=await _(u);if(!f)continue;let g;try{g=parse$1(f);}catch{continue}let h=g&&typeof g=="object"&&"rule"in g?g.rule:void 0;if(Array.isArray(h))for(let R of h){if(!R||typeof R!="object")continue;let C=R,S=typeof C.toolName=="string"?C.toolName:null,k=typeof C.decision=="string"?C.decision:null;if(!S||!k)continue;let P=i1(S);if(!P)continue;let N=null;P==="Bash"?typeof C.commandPrefix=="string"&&C.commandPrefix.trim()&&(N=a1(C.commandPrefix.trim())):P==="Read"?typeof C.argsPattern=="string"&&C.argsPattern.trim()?N=l1(C.argsPattern.trim()):N="Read":N=P,N&&(k==="allow"?l.has(N)||(l.add(N),i.push(N)):k==="deny"&&(c.has(N)||(c.add(N),a.push(N))));}}if(i.length===0&&a.length===0)return e;await O(join(t,".agentsmesh"));let m=join(t,i_),p=stringify({allow:i,deny:a});return await I(m,p.trimEnd()+`
132
+ `),e.push({fromTool:ai,fromPath:join(t,pd),toPath:i_,feature:"permissions"}),e}var ZT=d(()=>{w();Jt();s(s1,"unescapeRegexLiteral");s(i1,"toolNameToPermissionBase");s(a1,"commandPrefixToBashExpr");s(l1,"argsPatternToReadExpr");s(XT,"importGeminiPolicies");});function R_(t,e){let r=new Set([e,e.replace(/\\/g,"/"),e.replace(/\//g,"\\")]);try{r.add(realpathSync(e)),r.add(realpathSync.native(e));}catch{}return Array.from(r).reduce((o,i)=>{let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return o.replace(new RegExp(`${a}[/\\\\]\\.agentsmesh[/\\\\]`,"g"),".agentsmesh/").replaceAll(`${i}/.agentsmesh`,".agentsmesh").replaceAll(`${i}\\.agentsmesh`,".agentsmesh")},t).replace(/(?:[A-Za-z]:)?[^\s"'`()<>]+[/\\]\.agentsmesh[/\\]/g,".agentsmesh/")}var qT=d(()=>{s(R_,"stripProjectRootCanonicalPrefix");});async function ex(t,e,r){let n=join(t,Jm),i=(await v(n)).filter(l=>basename(l)==="SKILL.md");for(let l of i){let c=await _(l);if(!c)continue;let m=basename(l.slice(0,-9)),p=b(c),u=al(p.frontmatter,m);if(u){let k=join(t,Ym);await O(k);let P=join(k,`${u.name}.md`);await I(P,Os(u,r(p.body,l,P))),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${Ym}/${u.name}.md`,feature:"agents"});continue}let f=join(t,Xm,m,"SKILL.md"),g=r(c,l,f),h=join(t,Xm,m);await O(h);let{frontmatter:R,body:C}=b(g);await I(f,await Cn(f,{...R,name:m},C)),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${Xm}/${m}/SKILL.md`,feature:"skills"});let S=await v(dirname(l));for(let k of S){if(k===l)continue;let P=await _(k);if(P===null)continue;let N=relative(dirname(l),k).replace(/\\/g,"/"),F=join(h,N);await O(dirname(F)),await I(F,r(P,k,F)),e.push({fromTool:"gemini-cli",fromPath:k,toPath:`${Xm}/${m}/${N}`,feature:"skills"});}}let a=join(t,li);try{let c=(await v(a)).filter(m=>m.endsWith(".md"));for(let m of c){let p=await _(m);if(!p)continue;let{frontmatter:u,body:f}=b(p),h=relative(a,m).replace(/\\/g,"/").replace(/\.md$/i,".md"),R=join(t,Ym);await O(R);let C=join(R,h),S=r(f,m,C);await I(C,await Vt(C,{...u,name:typeof u.name=="string"?u.name:basename(h,".md"),maxTurns:u.maxTurns??u["max-turns"]??u.max_turns,permissionMode:u.permissionMode??u["permission-mode"]??u.permission_mode,disallowedTools:u.disallowedTools??u["disallowed-tools"]??u.disallowed_tools},S)),e.push({fromTool:"gemini-cli",fromPath:m,toPath:`${Ym}/${h}`,feature:"agents"});}}catch{}}var rx=d(()=>{w();j();ut();mt();Jt();s(ex,"importGeminiSkillsAndAgents");});async function c1(t,e,r){let n=await B("codex-cli",t),o=join(t,ci),i=join(t,co),a=join(t,DT),l=[i,a,join(t,br),join(t,NT)],c=null,m=l[l.length-1];for(let N of l){let F=await _(N);if(F!==null){c=F,m=N;break}}if(c===null)return;await O(o);let p=join(o,"_root.md"),u=m===i||m===a?n(c,m,p):c,f=await oo({content:u,projectRoot:t,rulesDir:ci,sourcePath:m,fromTool:ai,normalize:r});e.push(...f.results);let g=r(f.rootContent,m,p),h=R_(g.replace(/\.agents\/skills\//g,".agentsmesh/skills/").replace(/\.agents\\skills\\/g,".agentsmesh/skills/"),t),{frontmatter:R,body:C}=b(h),k=R.root===true?R:{...R,root:true},P=R_(await K(p,k,C),t);await I(p,P),e.push({fromTool:ai,fromPath:m,toPath:`${ci}/_root.md`,feature:"rules"});}async function nx(t){let e=[],r=await B(ai,t);return await c1(t,e,r),e.push(...await J(_d,t,"project",{normalize:r})),await ex(t,e,r),await h_(t,e),await YT(t,e),e.push(...await XT(t)),e}var ox=d(()=>{dt();w();j();ut();Hl();Et();Jt();C_();__();ZT();qT();rx();s(c1,"importRootRule");s(nx,"importFromGemini");});async function ix(t,e,r){let n=t.replace(/\\/g,"/"),o=join(e,n),{frontmatter:i,body:a}=hd(r(o)),l=wo(i.globs),c={root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0};return Object.keys(c).forEach(m=>{c[m]===void 0&&delete c[m];}),{destPath:o,toPath:`${ci}/${n}`,feature:"rules",content:await K(o,c,a)}}async function ax(t,e,r){let n=t.replace(/\.(toml|md)$/i,".md").replace(/\\/g,"/"),o=join(e,n),i=r(o),{frontmatter:a,body:l}=t.endsWith(".toml")?p1(i):hd(i),c=nr(a.allowedTools),m=nr(a["allowed-tools"]),p=c.length>0?c:m;return {destPath:o,toPath:`${dd}/${n}`,feature:"commands",content:await _t(o,{description:typeof a.description=="string"?a.description:"",hasDescription:Object.prototype.hasOwnProperty.call(a,"description"),allowedTools:p,hasAllowedTools:Object.prototype.hasOwnProperty.call(a,"allowedTools")||Object.prototype.hasOwnProperty.call(a,"allowed-tools")},l)}}function p1(t){try{let e=parse$1(t);return {frontmatter:e,body:typeof e.prompt=="string"?e.prompt:""}}catch{return {frontmatter:{},body:t.trim()}}}var lx=d(()=>{ut();or();__();Jt();s(ix,"mapGeminiRuleFile");s(ax,"mapGeminiCommandFile");s(p1,"parseTomlCommand");});var cx,mx,px=d(()=>{lx();cx=s(({relativePath:t,destDir:e,normalizeTo:r})=>ix(t,e,r),"geminiRuleMapper"),mx=s(({relativePath:t,destDir:e,normalizeTo:r})=>ax(t,e,r),"geminiCommandMapper");});function ux(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:ai}))}var dx=d(()=>{It();Jt();s(ux,"lintRules");});function fx(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>x(e.source,"gemini-cli","Gemini TOML command files do not project canonical allowed-tools metadata."))}function gx(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","Notification"],r=new Set(e);return Object.keys(t.hooks).filter(n=>!r.has(n)).map(n=>Ps(n,"gemini-cli",e))}var hx=d(()=>{Lt();s(fx,"lintCommands");s(gx,"lintHooks");});function yx(t,e){return e==="project"&&mi("gemini-cli",e)?.ignore.flavor!=="settings-embedded"?[]:p_(t)}var _x=d(()=>{Pt();u_();s(yx,"emitScopedGeminiSettings");});var u1,d1,f1,g1,_d,C_=d(()=>{WT();wi();VT();Jt();ox();px();dx();Ct();ol();mt();hx();_x();ee();td();u1={name:"gemini-cli",primaryRootInstructionPath:br,generateRules:a_,generateCommands:l_,generateAgents:c_,generateSkills:m_,generateIgnore:d_,generatePermissions:zT,importFrom:nx},d1={rootInstructionPath:br,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[co]}],extraRuleOutputPaths(){return [co]},skillDir:".gemini/skills",managedOutputs:{dirs:[".gemini/agents",".gemini/commands",".gemini/skills",".agents/skills"],files:["AGENTS.md","GEMINI.md",".gemini/settings.json",".gemini/policies/permissions.toml",".geminiignore"]},mirrorGlobalPath(t,e){return pt(t,".gemini/skills",e)},paths:{rulePath(t,e){return br},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${He}/${r.join("/")}/${n}.toml`}return `${He}/${t}.toml`},agentPath(t,e){return qe(e,"gemini-cli")?`.gemini/skills/${U(t)}/SKILL.md`:`${li}/${t}.md`}}},f1={rootInstructionPath:ec,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[rc]}],extraRuleOutputPaths(){return [rc]},skillDir:Aa,managedOutputs:{dirs:[nc,Aa,Zm],files:[ec,rc,fd]},rewriteGeneratedPath(t){return t===br?ec:t===co?rc:t===Oa?fd:t.startsWith(`${He}/`)?t.replace(`${He}/`,`${nc}/`):t.startsWith(".gemini/skills/")?t.replace(".gemini/skills/",`${Aa}/`):t.startsWith(`${li}/`)?t.replace(`${li}/`,`${Zm}/`):t.startsWith(".gemini/policies/")||t===".geminiignore"?null:t},mirrorGlobalPath(t,e){return pt(t,Aa,e)},paths:{rulePath(t,e){return ec},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${nc}/${r.join("/")}/${n}.toml`}return `${nc}/${t}.toml`},agentPath(t,e){return qe(e,"gemini-cli")?`${Aa}/${U(t)}/SKILL.md`:`${Zm}/${t}.md`}}},g1={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:"none",permissions:"none"},_d={id:"gemini-cli",metadata:{displayName:"Gemini CLI",category:"cli",officialUrl:"https://github.com/google-gemini/gemini-cli",shortDescription:"Google's terminal Gemini agent"},generators:u1,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:Gr("native","settings-embedded"),permissions:"partial"},emptyImportMessage:"No Gemini CLI config found (GEMINI.md or .gemini/rules, .gemini/commands, .gemini/settings.json).",lintRules:ux,lint:{commands:fx,hooks:gx},emitScopedSettings:yx,mergeGeneratedOutputContent(t,e,r,n){let o=e?.content??t;return o!==null&&n===Oa?pP(o,r):null},project:d1,globalSupport:{capabilities:g1,detectionPaths:[ec,rc,fd,nc,Aa,Zm],layout:f1},importer:{rules:{feature:"rules",mode:"directory",source:{project:[xT]},canonicalDir:ci,extensions:[".md"],map:cx},commands:{feature:"commands",mode:"directory",source:{project:[He]},canonicalDir:dd,extensions:[".md",".toml"],map:mx}},buildImportPaths:Nh,detectionPaths:["GEMINI.md",".gemini"],conversionDefaults:{agentsToSkills:false}};});function Rx(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Bn)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:_r,content:o}]:[]}function Ix(t){return rt(t,Oe)}function Sx(t){return t.commands.map(e=>({path:`${Oe}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function Cx(t){return t.agents.map(e=>({path:`${Oe}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function kx(t){return t.ignore.length===0?[]:[{path:Wo,content:t.ignore.join(`
133
+ `)}]}var Ex=d(()=>{tt();Ut();mt();kt();Cl();s(Rx,"generateRules");s(Ix,"generateSkills");s(Sx,"generateCommands");s(Cx,"generateAgents");s(kx,"generateIgnore");});async function Lx(t,e={}){let r=e.scope??"project",n=[],o=await B(Bn,t,r);return n.push(...await J(Rd,t,r,{normalize:o})),await q(t,r==="global"?Rr:Oe,Bn,n,o),n}var Ox=d(()=>{dt();tt();Et();Cl();k_();s(Lx,"importFromGoose");});function Ax(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Bn}))}var wx=d(()=>{It();Cl();s(Ax,"lintRules");});function bx(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","goose","Goose has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Px(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","goose","Goose permissions are managed at runtime via permission.yaml in ~/.config/goose/; canonical permissions are not projected.")]}function Tx(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","goose","Goose MCP extensions are configured globally in ~/.config/goose/config.yaml; project-level MCP is not projected.")]}var xx=d(()=>{Lt();s(bx,"lintHooks");s(Px,"lintPermissions");s(Tx,"lintMcp");});var h1,y1,_1,Dx,Rd,k_=d(()=>{kt();mt();Ex();ee();Ox();wx();xx();Ct();Cl();h1={name:Bn,primaryRootInstructionPath:_r,generateRules:Rx,generateCommands:Sx,generateAgents:Cx,generateSkills:Ix,generateIgnore:kx,importFrom:Lx},y1={rootInstructionPath:_r,skillDir:Oe,managedOutputs:{dirs:[Oe],files:[_r,Wo]},paths:{rulePath(t){return _r},commandPath(t){return `${Oe}/${H(t)}/SKILL.md`},agentPath(t){return `${Oe}/${U(t)}/SKILL.md`}}},_1={rootInstructionPath:Ho,skillDir:Rr,managedOutputs:{dirs:[Rr],files:[Ho,Vi]},rewriteGeneratedPath(t){return t===_r?Ho:t===Wo?Vi:t},mirrorGlobalPath(t,e){return pt(t,Rr,e)},paths:{rulePath(t){return Ho},commandPath(t){return `${Rr}/${H(t)}/SKILL.md`},agentPath(t){return `${Rr}/${U(t)}/SKILL.md`}}},Dx={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"native",permissions:"none"},Rd={id:Bn,metadata:{displayName:"Goose",category:"cli",officialUrl:"https://block.github.io/goose",shortDescription:"Block's open-source AI agent"},generators:h1,capabilities:Dx,emptyImportMessage:"No Goose config found (.goosehints, .agents/skills, or .gooseignore).",lintRules:Ax,lint:{hooks:bx,permissions:Px,mcp:Tx},supportsConversion:{commands:true,agents:true},project:y1,globalSupport:{capabilities:Dx,detectionPaths:[Ho,Vi,Rr],layout:_1},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[_r],global:[Ho]},canonicalDir:xE,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Wo],global:[Vi]},canonicalDir:".agentsmesh",canonicalFilename:DE}},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:Fh,detectionPaths:[_r,Wo],conversionDefaults:{commandsToSkills:true,agentsToSkills:true}};});function Nx(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(zo)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:Zr,content:o}]:[]}var Fx=d(()=>{Ut();kl();s(Nx,"generateRules");});async function vx(t,e={}){let r=e.scope??"project",n=await B(zo,t,r);return J(Id,t,r,{normalize:n})}var Mx=d(()=>{dt();Et();kl();E_();s(vx,"importFromJules");});function $x(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:zo}))}var Gx=d(()=>{It();kl();s($x,"lintRules");});function jx(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","jules","Jules has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Ux(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","jules","Jules has no permissions system; canonical permissions are not projected.")]}function Bx(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","jules","Jules is a cloud-based agent with no dedicated ignore file; canonical ignore patterns are not projected.")]}function Kx(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","jules","Jules is a cloud-based agent with no MCP support; canonical MCP servers are not projected.")]}function Wx(t){return t.commands.length===0?[]:[x(".agentsmesh/commands","jules","Jules has no command system; canonical commands are not projected.")]}var Hx=d(()=>{Lt();s(jx,"lintHooks");s(Ux,"lintPermissions");s(Bx,"lintIgnore");s(Kx,"lintMcp");s(Wx,"lintCommands");});var R1,I1,S1,Id,E_=d(()=>{Fx();Mx();Gx();Hx();Ct();kl();R1={name:zo,primaryRootInstructionPath:Zr,generateRules:Nx,importFrom:vx},I1={rootInstructionPath:Zr,managedOutputs:{dirs:[],files:[Zr]},paths:{rulePath(t){return Zr},commandPath(){return null},agentPath(){return null}}},S1={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"none",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},Id={id:zo,metadata:{displayName:"Jules",category:"agent-platform",officialUrl:"https://jules.google",shortDescription:"Google's autonomous coding agent"},generators:R1,capabilities:S1,emptyImportMessage:"No Jules config found (AGENTS.md).",lintRules:$x,lint:{hooks:jx,permissions:Ux,ignore:Bx,mcp:Kx,commands:Wx},project:I1,importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Zr]},canonicalDir:FE,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:vh,detectionPaths:[Zr]};});function zx(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Kn,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("junie"))continue;let o=basename(n.source,".md");e.push({path:`${Im}/${o}.md`,content:n.body.trim()||""});}return e}function k1(t){let e={};return t.description&&(e.description=t.description),t.type!=="stdio"&&(e.type=t.type),Bu(t)?(e.command=t.command,e.args=t.args):(e.url=t.url,Object.keys(t.headers).length>0&&(e.headers=t.headers)),Object.keys(t.env).length>0&&(e.env=t.env),e}function Vx(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Object.fromEntries(Object.entries(t.mcp.mcpServers).map(([r,n])=>[r,k1(n)]));return [{path:Rm,content:JSON.stringify({mcpServers:e},null,2)}]}function Jx(t){return t.commands.map(e=>{let r={description:e.description||void 0};return r.description===void 0&&delete r.description,{path:`${El}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function Yx(t){return t.agents.map(e=>{let r={name:e.name,description:e.description||void 0,tools:e.tools.length>0?e.tools:void 0,disallowedTools:e.disallowedTools.length>0?e.disallowedTools:void 0,model:e.model||void 0,skills:e.skills.length>0?e.skills:void 0};return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];}),{path:`${Ll}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function Xx(t){return t.ignore.length===0?[]:[{path:Sm,content:t.ignore.join(`
134
+ `)}]}function Zx(t){return rt(t,Yi)}function Qx(t){let e=t.rules.find(n=>n.root),r=t.rules.filter(n=>n.root?false:n.targets.length===0||n.targets.includes("junie"));return lt(e?.body.trim()??"",r)}var qx=d(()=>{Ku();tt();Ut();j();Ol();s(zx,"generateRules");s(k1,"toJunieMcpServer");s(Vx,"generateMcp");s(Jx,"generateCommands");s(Yx,"generateAgents");s(Xx,"generateIgnore");s(Zx,"generateSkills");s(Qx,"renderJunieGlobalInstructions");});async function E1(t,e,r){let n=[Kn,ku,ME,$E],o=join(t,Mh);for(let i of n){let a=join(t,i),l=await _(a);if(l===null)continue;let c=await oo({content:l,projectRoot:t,rulesDir:Lu,sourcePath:a,fromTool:Ji,normalize:r});e.push(...c.results);let{frontmatter:m,body:p}=b(r(c.rootContent,a,o)),u=await K(o,{root:true,description:typeof m.description=="string"?m.description:void 0,globs:Array.isArray(m.globs)?m.globs:void 0},p);await I(o,u),e.push({fromTool:Ji,fromPath:a,toPath:Mh,feature:"rules"});return}}async function eD(t){let e=[],r=await B(Ji,t);return await E1(t,e,r),e.push(...await J(Sd,t,"project",{normalize:r})),await q(t,Yi,Ji,e,r),e}var rD=d(()=>{dt();w();j();tt();Hl();ut();Et();Ol();L_();s(E1,"importRootRule");s(eD,"importFromJunie");});function nD(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Ji}))}var oD=d(()=>{It();Ol();s(nD,"lintRules");});function sD(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,n]of Object.entries(t.mcp.mcpServers))aw(n)&&e.push(x(".agentsmesh/mcp.json","junie",`MCP server "${r}" uses ${n.type} transport; Junie project mcp.json currently documents stdio MCP servers only.`));return e}var iD=d(()=>{Ku();Lt();s(sD,"lintMcp");});var L1,O1,A1,w1,Sd,L_=d(()=>{qx();Ol();ee();rD();oD();iD();Ct();L1={name:"junie",primaryRootInstructionPath:Kn,generateRules:zx,generateCommands:Jx,generateAgents:Yx,generateSkills:Zx,generateMcp:Vx,generateIgnore:Xx,importFrom:eD},O1={rootInstructionPath:Kn,skillDir:".junie/skills",managedOutputs:{dirs:[".junie/agents",".junie/commands",".junie/rules",".junie/skills"],files:[".aiignore",".junie/AGENTS.md",".junie/mcp/mcp.json"]},paths:{rulePath(t,e){return `${Im}/${t}.md`},commandPath(t,e){return `${El}/${t}.md`},agentPath(t,e){return `${Ll}/${t}.md`}}},A1={rootInstructionPath:Xi,renderPrimaryRootInstruction:Qx,skillDir:km,managedOutputs:{dirs:[km,Em,Lm,GE],files:[Xi,Eu]},rewriteGeneratedPath(t){return t===Kn?Xi:t.startsWith(`${Im}/`)?Xi:t.startsWith(`${Yi}/`)?t.replace(`${Yi}/`,`${km}/`):t.startsWith(`${El}/`)?t.replace(`${El}/`,`${Lm}/`):t.startsWith(`${Ll}/`)?t.replace(`${Ll}/`,`${Em}/`):t===Rm?Eu:t===Sm?null:t},mirrorGlobalPath(t,e){return pt(t,".junie/skills",e)},paths:{rulePath(t,e){return Xi},commandPath(t,e){return `${Lm}/${t}.md`},agentPath(t,e){return `${Em}/${t}.md`}}},w1={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Sd={id:"junie",metadata:{displayName:"Junie",category:"ide",officialUrl:"https://www.jetbrains.com/junie",shortDescription:"JetBrains AI coding agent"},generators:L1,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Junie config found (.junie/guidelines.md, .junie/AGENTS.md, .junie/skills, .junie/mcp/mcp.json, or .aiignore).",lintRules:nD,lint:{mcp:sD},project:O1,globalSupport:{capabilities:w1,detectionPaths:[Xi,km,Em,Lm,Eu],layout:A1},importer:{rules:{feature:"rules",mode:"directory",source:{project:[".junie/rules"]},canonicalDir:Lu,extensions:[".md"],preset:"rule"},commands:{feature:"commands",mode:"directory",source:{project:[".junie/commands"]},canonicalDir:jE,extensions:[".md"],preset:"command"},agents:{feature:"agents",mode:"directory",source:{project:[".junie/agents"]},canonicalDir:UE,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Rm]},canonicalDir:".agentsmesh",canonicalFilename:BE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Sm]},canonicalDir:".agentsmesh",canonicalFilename:KE}},buildImportPaths:$h,detectionPaths:[".junie/guidelines.md",".junie/AGENTS.md",".junie/skills",".junie/mcp/mcp.json",".aiignore"]};});function lD(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Wn,content:r.body.trim()?r.body:""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(_e))continue;let o=basename(n.source,".md"),i={};n.description&&(i.description=n.description),n.globs.length>0&&(i.globs=n.globs);let a=Object.keys(i).length>0?T(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${Vo}/${o}.md`,content:a});}return e}function cD(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Jo}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function mD(t){return t.agents.map(e=>{let r=basename(e.source,".md"),n={mode:"subagent"};return e.description&&(n.description=e.description),e.model&&(n.model=e.model),e.tools.length>0&&(n.tools=e.tools),e.disallowedTools.length>0&&(n.disallowedTools=e.disallowedTools),{path:`${Yo}/${r}.md`,content:T(n,e.body.trim()||"")}})}function pD(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Us,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function uD(t){return t.ignore.length===0?[]:[{path:Al,content:t.ignore.join(`
135
+ `)}]}function dD(t){return rt(t,Qr)}var fD=d(()=>{tt();j();na();s(lD,"generateRules");s(cD,"generateCommands");s(mD,"generateAgents");s(pD,"generateMcp");s(uD,"generateIgnore");s(dD,"generateSkills");});var Cd,kd,gD,A_=d(()=>{j();ut();na();Cd=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Ws}/${t}`,content:await K(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"kiloNonRootRuleMapper"),kd=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Tl}/${t}`,content:await _t(n,{hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"kiloCommandMapper"),gD=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${ra}/${t}`,content:await Vt(n,o,i)}},"kiloAgentMapper");});async function hD(t){try{return await stat(t),!0}catch{return false}}async function T1(t,e,r){let n=join(t,Zi);if(!await hD(n))return;let o=join(t,Ws),i=join(n,b_),l=e.some(c=>c.toPath===w_)?null:await _(i);if(l!==null){let c=join(t,w_),m=r(l,i,c),{body:p}=b(m),u=await K(c,{root:true},p);await I(c,u),e.push({feature:"rules",fromTool:_e,fromPath:`${Zi}/${b_}`,toPath:w_});}e.push(...await Rt({srcDir:n,destDir:o,extensions:[".md"],fromTool:_e,normalize:r,mapEntry:s(async({srcPath:c,relativePath:m,content:p,normalizeTo:u})=>{let f=await Cd({absolutePath:c,relativePath:m,content:p,destDir:o,normalizeTo:u});return m===b_||!f?null:{...f,feature:"rules"}},"mapEntry")}));}async function x1(t,e,r){let n=join(t,wl);if(!await hD(n))return;let o=join(t,Tl);e.push(...await Rt({srcDir:n,destDir:o,extensions:[".md"],fromTool:_e,normalize:r,mapEntry:s(async({srcPath:i,relativePath:a,content:l,normalizeTo:c})=>{let m=await kd({absolutePath:i,relativePath:a,content:l,destDir:o,normalizeTo:c});return m?{...m,feature:"commands"}:null},"mapEntry")}));}async function D1(t,e,r){let n=join(t,Au),o=await _(n);if(o===null)return;let i;try{i=parse(o);}catch{return}if(!(!i||!Array.isArray(i.customModes)))for(let a of i.customModes){if(!a||typeof a!="object")continue;let l=a;if(typeof l.slug!="string"||l.slug.length===0)continue;let c=l.slug,m=join(t,ra,`${c}.md`),p=typeof l.description=="string"?l.description:"",u=typeof l.roleDefinition=="string"?l.roleDefinition.trim():"",f=typeof l.whenToUse=="string"?l.whenToUse.trim():"",g=f?`${u}
129
136
 
130
137
  ## When to use
131
138
 
132
- ${g}`:u,h={};p&&(h.description=p),typeof c.name=="string"&&c.name.length>0&&(h.name=c.name);let O=await Bt(m,h,f),R=r(O,o,m);await _(m,R),e.push({feature:"agents",fromTool:de,fromPath:o,toPath:`${Yi}/${l}.md`});}}async function Zu(t,e={}){let r=e.scope??"project",o=[],n=await U(de,t,r);return o.push(...await z(Qu,t,r,{normalize:n})),await Z(t,Wr,de,o,n),r==="project"&&(await $W(t,o,n),await jW(t,o,n),await UW(t,o,n),await Z(t,Hi,de,o,n)),o}var Gy,My,$y=d(()=>{mt();Q();ke();Ct();T();lt();M();vy();Xi();jy();Gy=`${vs}/_root.md`,My="00-root.md";s(fP,"pathExists");s($W,"importLegacyRules");s(jW,"importLegacyWorkflows");s(UW,"importLegacyModes");s(Zu,"importFromKiloCode");});function hP(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:de}))}var yP=d(()=>{_t();Xi();s(hP,"lintRules");});function _P(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","kilo-code","kilo-code does not support user-defined lifecycle hooks; canonical hooks are not projected.")]:[]:[]}function IP(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","kilo-code","kilo-code permissions live in kilo.jsonc, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}var RP=d(()=>{Et();s(_P,"lintHooks");s(IP,"lintPermissions");});var KW,BW,WW,SP,Qu,jy=d(()=>{dP();Xi();Qt();$y();vy();yP();RP();Rt();KW={name:de,primaryRootInstructionPath:Mo,generateRules:aP,generateCommands:cP,generateAgents:lP,generateSkills:uP,generateMcp:mP,generateIgnore:pP,importFrom:Zu},BW={rootInstructionPath:Mo,skillDir:Wr,managedOutputs:{dirs:[Un,Kn,Bn,Wr],files:[Mo,Ds,pc]},paths:{rulePath(t,e){return `${Un}/${t}.md`},commandPath(t,e){return `${Kn}/${t}.md`},agentPath(t,e){return `${Bn}/${t}.md`}}},WW={rootInstructionPath:Ns,skillDir:Fs,managedOutputs:{dirs:[zi,Vi,Ji,Fs,fE],files:[Ns,gc,Hp]},rewriteGeneratedPath(t){return t===Mo?Ns:t},mirrorGlobalPath(t,e){return ct(t,Fs,e)},paths:{rulePath(t,e){return `${zi}/${t}.md`},commandPath(t,e){return `${Vi}/${t}.md`},agentPath(t,e){return `${Ji}/${t}.md`}}},SP={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Qu={id:de,metadata:{displayName:"Kilo Code",category:"ide",officialUrl:"https://kilocode.ai",shortDescription:"Open-source AI coding agent for VS Code"},generators:KW,capabilities:SP,emptyImportMessage:"No Kilo Code config found (AGENTS.md, .kilo/rules, .kilo/commands, .kilo/agents, .kilo/skills, .kilo/mcp.json, .kilocodeignore, .kilocode/, or .kilocodemodes).",lintRules:hP,lint:{hooks:_P,permissions:IP},project:BW,globalSupport:{capabilities:SP,detectionPaths:[Ns,zi,Vi,Ji,Fs,gc,Hp],layout:WW},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Mo],global:[Ns]},canonicalDir:vs,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Un],global:[zi]},canonicalDir:vs,extensions:[".md"],map:Yu}],commands:{feature:"commands",mode:"directory",source:{project:[Kn],global:[Vi]},canonicalDir:fc,extensions:[".md"],map:Xu},agents:{feature:"agents",mode:"directory",source:{project:[Bn],global:[Ji]},canonicalDir:Yi,extensions:[".md"],map:gP},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Ds,em],global:[gc]},canonicalDir:".agentsmesh",canonicalFilename:hE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[pc],global:[Hp]},canonicalDir:".agentsmesh",canonicalFilename:yE}},buildImportPaths:Uf,detectionPaths:[Un,Kn,Bn,Wr,Ds,Wi,uc,Hi,em,Wp,pc,"kilo.jsonc","kilo.json"]};});function CP(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function VW(t){return t.type==="prompt"?t.prompt:t.command}function JW(t,e){let r=EP[t];return t==="PreToolUse"||t==="PostToolUse"?{type:r,tools:[e||"*"]}:{type:r}}function OP(t){let e=[];for(let[r,o]of Object.entries(t)){let n=r;if(!(n in EP)||!Array.isArray(o))continue;let i=1;for(let a of o){let c=VW(a);if(!c)continue;let l={name:`${CP(r)} ${i}`,version:"1",when:JW(n,a.matcher),then:a.type==="prompt"?{type:"askAgent",prompt:c}:{type:"shellCommand",command:c}};e.push({name:`${CP(r)}-${i}.kiro.hook`,content:JSON.stringify(l,null,2)}),i+=1;}}return e}function YW(t){let e=zW.get(t.when.type);if(!e)return null;let r=t.when.tools?.[0]??t.when.patterns?.[0]??"*";return t.then.type==="askAgent"&&typeof t.then.prompt=="string"?{event:e,entry:{matcher:r,command:t.then.prompt,prompt:t.then.prompt,type:"prompt"}}:t.then.type==="shellCommand"&&typeof t.then.command=="string"?{event:e,entry:{matcher:r,command:t.then.command,type:"command"}}:null}function LP(t){let e;try{e=JSON.parse(t);}catch{return null}if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return !r.when||!r.then||typeof r.when.type!="string"?null:YW(r)}function AP(t){return stringify(t).trimEnd()}var EP,zW,Uy=d(()=>{EP={UserPromptSubmit:"promptSubmit",SubagentStop:"agentStop",PreToolUse:"preToolUse",PostToolUse:"postToolUse"},zW=new Map([["promptSubmit","UserPromptSubmit"],["agentStop","SubagentStop"],["preToolUse","PreToolUse"],["postToolUse","PostToolUse"]]);s(CP,"toKebab");s(VW,"hookText");s(JW,"toWhen");s(OP,"generateKiroHooks");s(YW,"toCanonicalEntry");s(LP,"parseKiroHookFile");s(AP,"serializeCanonicalHooks");});function ZW(t){let e={};return t.globs.length>0?(e.inclusion="fileMatch",e.fileMatchPattern=t.globs.length===1?t.globs[0]:t.globs):t.trigger==="manual"?e.inclusion="manual":t.trigger==="model_decision"?e.inclusion="auto":e.inclusion="always",t.description&&(e.description=t.description),e}function kP(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Hr,content:r.body.trim()||""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes(De))continue;let n=basename(o.source,".md");e.push({path:`${zr}/${n}.md`,content:P(ZW(o),o.body.trim()||"")});}return e}function wP(t){return t.commands.map(e=>({path:`${ge}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function TP(t){return tt(t,ge)}function bP(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:hc,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function PP(t){return !t.hooks||Object.keys(t.hooks).length===0?[]:OP(t.hooks).map(e=>({path:`${Gs}/${e.name}`,content:e.content}))}function xP(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=P(r,e.body.trim()||"");return {path:`${Vr}/${e.name}.md`,content:o}})}function DP(t){return t.ignore.length===0?[]:[{path:yc,content:t.ignore.join(`
133
- `)}]}var NP=d(()=>{Q();St();M();Uy();_c();s(ZW,"steeringFrontmatter");s(kP,"generateRules");s(wP,"generateCommands");s(TP,"generateSkills");s(bP,"generateMcp");s(PP,"generateHooks");s(xP,"generateAgents");s(DP,"generateIgnore");});function qW(t){let e=typeof t.inclusion=="string"?t.inclusion:"",r={root:false,description:typeof t.description=="string"?t.description:void 0,globs:Rn(t.fileMatchPattern)};return e==="manual"&&(r.trigger="manual"),e==="auto"&&(r.trigger="model_decision"),e==="fileMatch"&&(r.trigger="glob"),r}async function tH(t,e,r,o){let n=o==="global"?[Jr,Hr]:[Hr,Jr];for(let i of n){let a=join(t,i),c=await y(a);if(c===null)continue;let l=join(t,Kf),{frontmatter:m,body:p}=k(r(c,a,l));await _(l,await K(l,{...m,root:true},p)),e.push({fromTool:De,fromPath:a,toPath:Kf,feature:"rules"});return}}async function eH(t,e,r){let o=join(t,Bf);e.push(...await yt({srcDir:join(t,zr),destDir:o,extensions:[".md"],fromTool:De,normalize:r,mapEntry:s(async({relativePath:n,normalizeTo:i})=>{if(basename(n)==="AGENTS.md")return null;let a=join(o,n),{frontmatter:c,body:l}=k(i(a));return {destPath:a,toPath:`${Bf}/${n}`,feature:"rules",content:await K(a,qW(c),l)}},"mapEntry")}));}async function rH(t,e){let r={};for(let n of await v(join(t,Gs))){if(!n.endsWith(".kiro.hook"))continue;let i=LP(await y(n)??"");i&&(r[i.event]??=[],r[i.event].push(i.entry));}if(Object.keys(r).length===0)return;let o=join(t,Wf);await L(join(t,".agentsmesh")),await _(o,AP(r)),e.push({fromTool:De,fromPath:join(t,Gs),toPath:Wf,feature:"hooks"});}async function qu(t,e={}){let r=e.scope??"project",o=[],n=await U(De,t,r);return await tH(t,o,n,r),await eH(t,o,n),o.push(...await z(td,t,r,{normalize:n})),await Z(t,ge,De,o,n),r==="project"&&await rH(t,o),o}var Ky=d(()=>{mt();Q();ke();Ct();lt();tr();T();M();Uy();_c();By();s(qW,"canonicalRuleMeta");s(tH,"importRoot");s(eH,"importNonRootRules");s(rH,"importHooks");s(qu,"importFromKiro");});function FP(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:De}))}var vP=d(()=>{_t();_c();s(FP,"lintRules");});function GP(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","UserPromptSubmit","SubagentStop"],r=new Set(e);return Object.keys(t.hooks).filter(o=>!r.has(o)).map(o=>Rs(o,"kiro",e,{unsupportedBy:"Kiro hooks"}))}var MP=d(()=>{Et();s(GP,"lintHooks");});var oH,nH,sH,iH,td,By=d(()=>{St();NP();Qt();Ky();vP();MP();Rt();_c();oH={name:De,primaryRootInstructionPath:Hr,generateRules:kP,generateCommands:wP,generateAgents:xP,generateSkills:TP,generateMcp:bP,generateHooks:PP,generateIgnore:DP,importFrom:qu},nH={rootInstructionPath:Hr,skillDir:ge,managedOutputs:{dirs:[".kiro/hooks",".kiro/skills",".kiro/steering",".kiro/agents"],files:["AGENTS.md",".kiro/settings/mcp.json",".kiroignore"]},paths:{rulePath(t,e){return `${zr}/${t}.md`},commandPath(t){return `${ge}/${W(t)}/SKILL.md`},agentPath(t,e){return `${Vr}/${t}.md`}}},sH={rootInstructionPath:Jr,skillDir:Ms,managedOutputs:{dirs:[Zi,Ms,Qi,RE],files:[Jr,om,nm]},rewriteGeneratedPath(t){return t===Hr?Jr:t.startsWith(`${zr}/`)?t.replace(`${zr}/`,`${Zi}/`):t.startsWith(`${ge}/`)?t.replace(`${ge}/`,`${Ms}/`):t.startsWith(`${Vr}/`)?t.replace(`${Vr}/`,`${Qi}/`):t===hc?om:t===yc?nm:t.startsWith(`${Gs}/`)?null:t},mirrorGlobalPath(t,e){return ct(t,".kiro/skills",e)},paths:{rulePath(t,e){return `${Zi}/${t}.md`},commandPath(t){return `${ge}/${W(t)}/SKILL.md`},agentPath(t,e){return `${Qi}/${t}.md`}}},iH={rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},td={id:De,metadata:{displayName:"Kiro",category:"ide",officialUrl:"https://kiro.dev",shortDescription:"AWS spec-driven AI IDE"},generators:oH,capabilities:{rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Kiro config found (AGENTS.md, .kiro/steering, .kiro/skills, .kiro/agents, .kiro/hooks, .kiro/settings/mcp.json, or .kiroignore).",supportsConversion:{commands:true},lintRules:FP,lint:{hooks:GP},project:nH,globalSupport:{capabilities:iH,detectionPaths:[Zi,Jr,Ms,Qi,om,nm],layout:sH},importer:{agents:{feature:"agents",mode:"directory",source:{project:[Vr],global:[Vr]},canonicalDir:SE,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[hc],global:[om]},canonicalDir:".agentsmesh",canonicalFilename:CE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[yc],global:[nm]},canonicalDir:".agentsmesh",canonicalFilename:EE}},buildImportPaths:Hf,detectionPaths:[zr,ge,Vr,Gs,hc,yc]};});function jP(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:$o,content:r.body.trim()?r.body:""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes(Yr))continue;let n=basename(o.source,".md"),i={};o.description&&(i.description=o.description),o.globs.length>0&&(i.globs=o.globs);let a=Object.keys(i).length>0?P(i,o.body.trim()||""):o.body.trim()||"";e.push({path:`${Wn}/${n}.md`,content:a});}return e}function UP(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Hn}/${e.name}.md`,content:P(r,e.body.trim()||"")}})}function KP(t){return t.agents.map(e=>{let r=basename(e.source,".md"),o={mode:"subagent"};return e.description&&(o.description=e.description),e.model&&(o.model=e.model),e.tools.length>0&&(o.tools=e.tools),e.disallowedTools.length>0&&(o.disallowedTools=e.disallowedTools),{path:`${zn}/${r}.md`,content:P(o,e.body.trim()||"")}})}function aH(t){if("url"in t){let r={type:"remote",url:t.url};return Object.keys(t.headers).length>0&&(r.headers=t.headers),t.description&&(r.description=t.description),r}let e={type:"local",command:[t.command,...t.args]};return Object.keys(t.env).length>0&&(e.environment=t.env),t.description&&(e.description=t.description),e}function BP(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e={};for(let[r,o]of Object.entries(t.mcp.mcpServers))e[r]=aH(o);return [{path:jo,content:JSON.stringify({mcp:e},null,2)}]}function WP(t){return tt(t,Xr)}var HP=d(()=>{Q();M();ra();s(jP,"generateRules");s(UP,"generateCommands");s(KP,"generateAgents");s(aH,"toOpenCodeMcpServer");s(BP,"generateMcp");s(WP,"generateSkills");});function Wy(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,o]of Object.entries(t))typeof o=="string"&&(e[r]=o);return e}function lH(t){let e;try{e=JSON.parse(t);}catch{return {}}if(!e||typeof e!="object"||Array.isArray(e))return {};let r=e.mcp;if(!r||typeof r!="object"||Array.isArray(r))return {};let o={};for(let[n,i]of Object.entries(r)){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i;if(typeof a.url=="string"){o[n]={type:"url",url:a.url,headers:Wy(a.headers),env:Wy(a.environment),...typeof a.description=="string"?{description:a.description}:{}};continue}if(Array.isArray(a.command)&&a.command.length>0){let c=a.command,l=c[0];if(l===void 0)continue;let m=c.slice(1);o[n]={type:"stdio",command:l,args:m,env:Wy(a.environment),...typeof a.description=="string"?{description:a.description}:{}};}}return o}async function mH(t,e,r){let n=join(t,e==="global"?Us:jo),i=await y(n);if(i===null)return;let a=lH(i);Object.keys(a).length!==0&&(await $t(t,zf,a),r.push({feature:"mcp",fromTool:Yr,fromPath:n,toPath:zf}));}async function zP(t,e={}){let r=e.scope??"project",o=[],n=await U(Yr,t,r);return o.push(...await z(ed,t,r,{normalize:n})),await Z(t,Xr,Yr,o,n),await mH(t,r,o),o}var VP=d(()=>{mt();Q();Ct();Fr();T();ra();Hy();s(Wy,"toStringRecord");s(lH,"parseOpenCodeMcp");s(mH,"importMcp");s(zP,"importFromOpenCode");});var JP,YP,XP,ZP=d(()=>{M();lt();ra();JP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${sm}/${t}`,content:await K(o,{root:false,description:typeof n.description=="string"?n.description:void 0,globs:Array.isArray(n.globs)?n.globs:void 0},i)}},"opencodeNonRootRuleMapper"),YP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Vp}/${t}`,content:await ht(o,{hasDescription:Object.prototype.hasOwnProperty.call(n,"description"),description:typeof n.description=="string"?n.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"opencodeCommandMapper"),XP=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Jp}/${t}`,content:await Bt(o,n,i)}},"opencodeAgentMapper");});function QP(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Yr}))}var qP=d(()=>{_t();ra();s(QP,"lintRules");});function tx(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","opencode","opencode hooks are plugin-based (TypeScript/JavaScript); canonical config hooks are not projected.")]:[]:[]}function ex(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","opencode","opencode permissions live in opencode.json, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}function rx(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","opencode","opencode has no dedicated ignore file; canonical ignore patterns are not projected. Configure watcher.ignore in opencode.json manually.")]}var ox=d(()=>{Et();s(tx,"lintHooks");s(ex,"lintPermissions");s(rx,"lintIgnore");});var pH,uH,dH,nx,ed,Hy=d(()=>{HP();ra();Qt();VP();ZP();qP();ox();Rt();pH={name:Yr,primaryRootInstructionPath:$o,generateRules:jP,generateCommands:UP,generateAgents:KP,generateSkills:WP,generateMcp:BP,importFrom:zP},uH={rootInstructionPath:$o,skillDir:Xr,managedOutputs:{dirs:[Wn,Hn,zn,Xr],files:[$o,jo]},paths:{rulePath(t){return `${Wn}/${t}.md`},commandPath(t){return `${Hn}/${t}.md`},agentPath(t){return `${zn}/${t}.md`}}},dH={rootInstructionPath:$s,skillDir:js,managedOutputs:{dirs:[qi,ta,ea,js,LE],files:[$s,Us]},rewriteGeneratedPath(t){return t===$o?$s:t===jo?Us:t},mirrorGlobalPath(t,e){return ct(t,js,e)},paths:{rulePath(t){return `${qi}/${t}.md`},commandPath(t){return `${ta}/${t}.md`},agentPath(t){return `${ea}/${t}.md`}}},nx={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},ed={id:Yr,metadata:{displayName:"OpenCode",category:"cli",officialUrl:"https://opencode.ai",shortDescription:"Open-source terminal AI agent"},generators:pH,capabilities:nx,emptyImportMessage:"No OpenCode config found (AGENTS.md, .opencode/rules, .opencode/commands, .opencode/agents, .opencode/skills, or opencode.json).",lintRules:QP,lint:{hooks:tx,permissions:ex,ignore:rx},project:uH,globalSupport:{capabilities:nx,detectionPaths:[$s,qi,ta,ea,js,Us],layout:dH},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[$o],global:[$s]},canonicalDir:sm,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Wn],global:[qi]},canonicalDir:sm,extensions:[".md"],map:JP}],commands:{feature:"commands",mode:"directory",source:{project:[Hn],global:[ta]},canonicalDir:Vp,extensions:[".md"],map:YP},agents:{feature:"agents",mode:"directory",source:{project:[zn],global:[ea]},canonicalDir:Jp,extensions:[".md"],map:XP}},buildImportPaths:Vf,detectionPaths:[Wn,Hn,zn,Xr,jo,"opencode.jsonc"]};});function sx(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Uo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:gr,content:n}]:[]}function ix(t){return tt(t,Xt)}function ax(t){return t.commands.map(e=>({path:`${Xt}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function cx(t){return t.agents.map(e=>({path:`${Xt}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}var lx=d(()=>{Q();Mt();st();St();Rc();s(sx,"generateRules");s(ix,"generateSkills");s(ax,"generateCommands");s(cx,"generateAgents");});async function mx(t,e={}){let r=e.scope??"project",o=[],n=await U(Uo,t,r);return o.push(...await z(rd,t,r,{normalize:n})),await Z(t,r==="global"?fr:Xt,Uo,o,n),o}var px=d(()=>{mt();Q();Ct();Rc();Vy();s(mx,"importFromPiAgent");});function ux(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Uo}))}var dx=d(()=>{_t();Rc();s(ux,"lintRules");});function gx(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","pi-agent","Pi Coding Agent has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function fx(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","pi-agent","Pi Coding Agent has no dedicated permissions config; canonical permissions are not projected.")]}function hx(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","pi-agent","Pi Coding Agent has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}function yx(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","pi-agent","Pi Coding Agent manages MCP servers via extensions, not a dedicated config file; canonical MCP servers are not projected.")]}var _x=d(()=>{Et();s(gx,"lintHooks");s(fx,"lintPermissions");s(hx,"lintIgnore");s(yx,"lintMcp");});var gH,fH,hH,Ix,rd,Vy=d(()=>{St();st();lx();Qt();px();dx();_x();Yf();Rc();gH={name:Uo,primaryRootInstructionPath:gr,generateRules:sx,generateCommands:ax,generateAgents:cx,generateSkills:ix,importFrom:mx},fH={rootInstructionPath:gr,skillDir:Xt,managedOutputs:{dirs:[Xt],files:[gr]},paths:{rulePath(t){return gr},commandPath(t){return `${Xt}/${W(t)}/SKILL.md`},agentPath(t){return `${Xt}/${$(t)}/SKILL.md`}}},hH={rootInstructionPath:Vn,skillDir:fr,managedOutputs:{dirs:[fr],files:[Vn]},rewriteGeneratedPath(t){return t===gr?Vn:t.startsWith(`${Xt}/`)?t.replace(`${Xt}/`,`${fr}/`):t},mirrorGlobalPath(t,e){return ct(t,fr,e)},paths:{rulePath(t){return Vn},commandPath(t){return `${fr}/${W(t)}/SKILL.md`},agentPath(t){return `${fr}/${$(t)}/SKILL.md`}}},Ix={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},rd={id:Uo,metadata:{displayName:"Pi Agent",category:"cli",officialUrl:"https://github.com/pi-labs/pi-agent",shortDescription:"Pi coding agent"},generators:gH,capabilities:Ix,emptyImportMessage:"No Pi Coding Agent config found (AGENTS.md or .pi/skills).",lintRules:ux,lint:{hooks:gx,permissions:fx,ignore:hx,mcp:yx},supportsConversion:{commands:true,agents:true},project:fH,globalSupport:{capabilities:Ix,detectionPaths:[Vn],layout:hH},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[gr],global:[Vn]},canonicalDir:wE,canonicalRootFilename:"_root.md",markAsRoot:true}},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:Jf,detectionPaths:[gr,Xt]};});function Rx(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:hr,content:r.body.trim()?r.body:""});let o=t.rules.filter(n=>!n.root&&(n.targets.length===0||n.targets.includes(Ko)));for(let n of o){let i=basename(n.source,".md"),a={};n.description&&(a.description=n.description),n.globs.length>0&&(a.globs=n.globs);let c=P(a,n.body.trim()||"");e.push({path:`${Jn}/${i}.md`,content:c});}return e}function Sx(t){return t.commands.map(e=>{let r={description:e.description,"allowed-tools":e.allowedTools.length>0?e.allowedTools:void 0};r["allowed-tools"]===void 0&&delete r["allowed-tools"];let o=P(r,e.body.trim()||"");return {path:`${Bo}/${e.name}.md`,content:o}})}function Cx(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=P(r,e.body.trim()||"");return {path:`${Wo}/${e.name}.md`,content:o}})}function Ex(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=P(o,r.body.trim()||"");e.push({path:`${Ne}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Ne}/${r.name}/${a}`,content:i.content});}}return e}function Ox(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Ks,content:e}]}function Lx(t){return !t.ignore||t.ignore.length===0?[]:[{path:Bs,content:t.ignore.join(`
134
- `)}]}var Ax=d(()=>{M();Sc();s(Rx,"generateRules");s(Sx,"generateCommands");s(Cx,"generateAgents");s(Ex,"generateSkills");s(Ox,"generateMcp");s(Lx,"generateIgnore");});async function kx(t,e={}){let r=e.scope??"project",o=[],n=await U(Ko,t,r);return o.push(...await z(od,t,r,{normalize:n})),await Z(t,r==="global"?Ho:Ne,Ko,o,n),o}var wx=d(()=>{mt();Ct();Q();Sc();Jy();s(kx,"importFromQwenCode");});function Tx(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Ko}))}var bx=d(()=>{_t();Sc();s(Tx,"lintRules");});var _H,IH,RH,SH,CH,od,Jy=d(()=>{Ax();wx();bx();Rt();Sc();_H={name:Ko,primaryRootInstructionPath:hr,generateRules:Rx,generateCommands:Sx,generateAgents:Cx,generateSkills:Ex,generateMcp:Ox,generateIgnore:Lx,importFrom:kx},IH={rootInstructionPath:hr,skillDir:Ne,managedOutputs:{dirs:[Jn,Bo,Wo,Ne],files:[hr,Ks,Bs]},paths:{rulePath(t,e){return e.root?hr:`${Jn}/${t}.md`},commandPath(t){return `${Bo}/${t}.md`},agentPath(t){return `${Wo}/${t}.md`}}},RH={rootInstructionPath:Yn,skillDir:Ho,managedOutputs:{dirs:[Ws,Hs,Ho],files:[Yn,oa]},rewriteGeneratedPath(t){return t===hr?Yn:t===Ks?oa:t===Bs?null:t.startsWith(`${Bo}/`)?t.replace(`${Bo}/`,`${Ws}/`):t.startsWith(`${Wo}/`)?t.replace(`${Wo}/`,`${Hs}/`):t.startsWith(`${Ne}/`)?t.replace(`${Ne}/`,`${Ho}/`):t.startsWith(`${Jn}/`)?null:t},paths:{rulePath(t,e){return Yn},commandPath(t){return `${Ws}/${t}.md`},agentPath(t){return `${Hs}/${t}.md`}}},SH={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},CH={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},od={id:Ko,metadata:{displayName:"Qwen Code",category:"cli",officialUrl:"https://github.com/QwenLM/qwen-code",shortDescription:"Alibaba's Qwen coding CLI"},generators:_H,capabilities:SH,emptyImportMessage:"No Qwen Code config found (QWEN.md or .qwen/rules, .qwen/commands, .qwen/settings.json).",lintRules:Tx,project:IH,globalSupport:{capabilities:CH,detectionPaths:[Yn,oa,Ws,Hs,Ho],layout:RH},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[hr],global:[Yn]},canonicalDir:Xf,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Jn],global:[]},canonicalDir:Xf,extensions:[".md"],preset:"rule"}],commands:{feature:"commands",mode:"directory",source:{project:[Bo],global:[Ws]},canonicalDir:TE,extensions:[".md"],preset:"command"},agents:{feature:"agents",mode:"directory",source:{project:[Wo],global:[Hs]},canonicalDir:bE,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Ks],global:[oa]},canonicalDir:".agentsmesh",canonicalFilename:".agentsmesh/mcp.json"},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Bs],global:[]},canonicalDir:".agentsmesh",canonicalFilename:".agentsmesh/ignore"}},buildImportPaths:Zf,detectionPaths:[hr,".qwen/settings.json",".qwen/commands",".qwen/rules"]};});function Px(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(zo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:Zr,content:n}]:[]}function xx(t){return tt(t,Ie)}function Dx(t){return t.commands.map(e=>({path:`${Ie}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function Nx(t){return t.agents.map(e=>({path:`${Ie}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}var Fx=d(()=>{Q();Mt();st();St();Cc();s(Px,"generateRules");s(xx,"generateSkills");s(Dx,"generateCommands");s(Nx,"generateAgents");});async function vx(t,e={}){let r=e.scope??"project",o=[],n=await U(zo,t,r);return o.push(...await z(nd,t,r,{normalize:n})),await Z(t,Ie,zo,o,n),o}var Gx=d(()=>{mt();Q();Ct();Cc();Yy();s(vx,"importFromReplitAgent");});function Mx(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:zo}))}var $x=d(()=>{_t();Cc();s(Mx,"lintRules");});function jx(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","replit-agent","Replit Agent has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function Ux(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","replit-agent","Replit Agent permissions are managed in the cloud UI; canonical permissions are not projected.")]}function Kx(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","replit-agent","Replit Agent has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}function Bx(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","replit-agent","Replit Agent MCP servers are configured via the Integrations UI, not file-based; canonical MCP config is not projected.")]}var Wx=d(()=>{Et();s(jx,"lintHooks");s(Ux,"lintPermissions");s(Kx,"lintIgnore");s(Bx,"lintMcp");});var EH,OH,LH,nd,Yy=d(()=>{St();st();Fx();Gx();$x();Wx();qf();Cc();EH={name:zo,primaryRootInstructionPath:Zr,generateRules:Px,generateCommands:Dx,generateAgents:Nx,generateSkills:xx,importFrom:vx},OH={rootInstructionPath:Zr,skillDir:Ie,managedOutputs:{dirs:[Ie],files:[Zr]},paths:{rulePath(t){return Zr},commandPath(t){return `${Ie}/${W(t)}/SKILL.md`},agentPath(t){return `${Ie}/${$(t)}/SKILL.md`}}},LH={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},nd={id:zo,metadata:{displayName:"Replit Agent",category:"agent-platform",officialUrl:"https://replit.com",shortDescription:"Replit's autonomous coding agent"},generators:EH,capabilities:LH,emptyImportMessage:"No Replit Agent config found (replit.md or .agents/skills).",lintRules:Mx,lint:{hooks:jx,permissions:Ux,ignore:Kx,mcp:Bx},supportsConversion:{commands:true,agents:true},project:OH,sharedArtifacts:{".agents/skills/":"consumer"},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Zr]},canonicalDir:xE,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:Qf,detectionPaths:[Zr]};});function zx(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Qr,content:r.body.trim()||""});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes(zs))continue;let n=basename(o.source,".md");e.push({path:`${Xn}/${n}.md`,content:o.body.trim()||""});}return e}function Vx(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Zn}/${e.name}.md`,content:P(r,e.body.trim()||"")}})}function Jx(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:am,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function Yx(t){return t.ignore.length===0?[]:[{path:cm,content:t.ignore.join(`
135
- `)}]}function Xx(t){return tt(t,Vo)}function Zx(t){if(t.agents.length===0)return [];let e=t.agents.map(r=>{let n={slug:basename(r.source,".md"),name:r.name};return r.description&&(n.description=r.description),r.body.trim()&&(n.roleDefinition=r.body.trim()),n});return [{path:Ec,content:stringify({customModes:e})}]}var Qx=d(()=>{Q();M();aa();s(zx,"generateRules");s(Vx,"generateCommands");s(Jx,"generateMcp");s(Yx,"generateIgnore");s(Xx,"generateSkills");s(Zx,"generateAgents");});var sd,tD,Xy=d(()=>{M();lt();aa();sd=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(t==="00-root.md")return null;let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${ia}/${t}`,content:await K(o,{root:false,description:typeof n.description=="string"?n.description:void 0,globs:Array.isArray(n.globs)?n.globs:void 0},i)}},"rooNonRootRuleMapper"),tD=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let o=join(r,t),{frontmatter:n,body:i}=k(e(o));return {destPath:o,toPath:`${Xp}/${t}`,content:await ht(o,{hasDescription:true,description:typeof n.description=="string"?n.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"rooCommandMapper");});async function wH(t,e,r){let o=join(t,na),n;try{n=await readdir(o,{withFileTypes:!0});}catch{return}let i=n.filter(c=>c.isDirectory()&&c.name.startsWith("rules-")).map(c=>c.name),a=join(t,ia);for(let c of i)e.push(...await yt({srcDir:join(o,c),destDir:a,extensions:[".md"],fromTool:zs,normalize:r,mapEntry:s(async({srcPath:l,relativePath:m,content:p,normalizeTo:u})=>{let g=await sd({absolutePath:l,relativePath:m,content:p,destDir:a,normalizeTo:u});return g?{...g,feature:"rules"}:null},"mapEntry")}));}async function eD(t,e={}){let r=e.scope??"project",o=[],n=await U(zs,t,r);return o.push(...await z(id,t,r,{normalize:n})),await wH(t,o,n),await Z(t,Vo,zs,o,n),o}var rD=d(()=>{mt();Q();ke();Ct();Xy();aa();Qy();s(wH,"importPerModeRules");s(eD,"importFromRooCode");});function oD(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:zs}))}var nD=d(()=>{_t();aa();s(oD,"lintRules");});function NH(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var xH,DH,FH,vH,GH,id,Qy=d(()=>{T();Qx();aa();Qt();rD();Xy();nD();Rt();xH={name:"roo-code",primaryRootInstructionPath:Qr,generateRules:zx,generateCommands:Vx,generateSkills:Xx,generateMcp:Jx,generateIgnore:Yx,generateAgents:Zx,importFrom:eD},DH={rootInstructionPath:Qr,skillDir:".roo/skills",managedOutputs:{dirs:[".roo/rules",".roo/commands",".roo/skills"],files:[".roo/mcp.json",".rooignore",".roorules",Ec]},paths:{rulePath(t,e){return `${Xn}/${t}.md`},commandPath(t,e){return `${Zn}/${t}.md`},agentPath(t,e){return null}}};s(NH,"computeStatus");FH=s(async(t,e,r,o)=>{if(r!=="global")return [];if(!o.has("agents")||t.agents.length===0)return [];let n=t.agents.map(c=>{let m={slug:basename(c.source,".md"),name:c.name};return c.description&&(m.description=c.description),c.body.trim()&&(m.roleDefinition=c.body.trim()),m}),i=stringify({customModes:n}),a=await y(join(e,lm));return [{target:"roo-code",path:lm,content:i,currentContent:a??void 0,status:NH(a,i)}]},"generateRooGlobalExtras"),vH={rootInstructionPath:Ys,skillDir:Qn,managedOutputs:{dirs:[Vs,Js,Qn,DE],files:[Ys,sa,mm,lm]},rewriteGeneratedPath(t){return t===Qr?Ys:t===Ec?null:t.startsWith(`${Xn}/`)?t.replace(`${Xn}/`,`${Vs}/`):t.startsWith(`${Zn}/`)?t.replace(`${Zn}/`,`${Js}/`):t.startsWith(`${Vo}/`)?t.replace(`${Vo}/`,`${Qn}/`):t===am?sa:t===cm?mm:t},mirrorGlobalPath(t,e){return ct(t,Qn,e)},paths:{rulePath(t,e){return `${Vs}/${t}.md`},commandPath(t,e){return `${Js}/${t}.md`},agentPath(t,e){return null}}},GH={rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},id={id:"roo-code",metadata:{displayName:"Roo Code",category:"ide",officialUrl:"https://roocode.com",shortDescription:"Open-source AI VS Code extension"},generators:xH,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Roo Code config found (.roo/rules, .roo/commands, .roo/skills, .roo/mcp.json, .rooignore, or .roorules).",lintRules:oD,project:DH,globalSupport:{capabilities:GH,detectionPaths:[Vs,Js,Qn,sa,mm,Ys,lm],layout:vH,scopeExtras:FH},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Qr,im],global:[Ys,Qr,im]},canonicalDir:ia,canonicalRootFilename:"_root.md",markAsRoot:true,frontmatterRemap:s(({description:t,globs:e})=>({description:typeof t=="string"?t:void 0,globs:Array.isArray(e)?e:void 0}),"frontmatterRemap")},{feature:"rules",mode:"directory",source:{project:[Xn],global:[Vs]},canonicalDir:ia,extensions:[".md"],map:sd}],commands:{feature:"commands",mode:"directory",source:{project:[Zn],global:[Js]},canonicalDir:Xp,extensions:[".md"],map:tD},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[am],global:[sa]},canonicalDir:".agentsmesh",canonicalFilename:NE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[cm],global:[mm]},canonicalDir:".agentsmesh",canonicalFilename:FE}},buildImportPaths:th,detectionPaths:[".roo/rules",".roo/commands",".roo/skills",".roo/mcp.json",".rooignore",".roorules",Ec]};});function sD(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Jo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:yr,content:n}]:[]}function iD(t){return tt(t,Zt)}function aD(t){return t.commands.map(e=>({path:`${Zt}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function cD(t){return t.agents.map(e=>({path:`${Zt}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function lD(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:qn,content:e}]}var mD=d(()=>{Q();Mt();st();St();Lc();s(sD,"generateRules");s(iD,"generateSkills");s(aD,"generateCommands");s(cD,"generateAgents");s(lD,"generateMcp");});async function pD(t,e={}){let r=e.scope??"project",o=[],n=await U(Jo,t,r);return o.push(...await z(ad,t,r,{normalize:n})),await Z(t,r==="global"?Fe:Zt,Jo,o,n),o}var uD=d(()=>{mt();Q();Ct();Lc();qy();s(pD,"importFromRovodev");});function dD(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Jo}))}var gD=d(()=>{_t();Lc();s(dD,"lintRules");});function fD(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","rovodev","Rovo Dev has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function hD(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","rovodev","Rovo Dev permissions are managed in config.yaml; canonical permissions are not projected.")]}function yD(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","rovodev","Rovo Dev has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var _D=d(()=>{Et();s(fD,"lintHooks");s(hD,"lintPermissions");s(yD,"lintIgnore");});var MH,$H,jH,UH,KH,ad,qy=d(()=>{St();st();mD();Qt();uD();gD();_D();Rt();Lc();MH={name:Jo,primaryRootInstructionPath:yr,generateRules:sD,generateCommands:aD,generateAgents:cD,generateSkills:iD,generateMcp:lD,importFrom:pD},$H={rootInstructionPath:yr,skillDir:Zt,managedOutputs:{dirs:[Zt],files:[yr,qn]},paths:{rulePath(t){return yr},commandPath(t){return `${Zt}/${W(t)}/SKILL.md`},agentPath(t){return `${Zt}/${$(t)}/SKILL.md`}}},jH={rootInstructionPath:ts,skillDir:Fe,managedOutputs:{dirs:[Fe],files:[ts,Oc]},rewriteGeneratedPath(t){return t===yr?ts:t.startsWith(`${Zt}/`)?t.replace(`${Zt}/`,`${Fe}/`):t===qn?Oc:t},mirrorGlobalPath(t,e){return ct(t,Fe,e)},paths:{rulePath(t){return ts},commandPath(t){return `${Fe}/${W(t)}/SKILL.md`},agentPath(t){return `${Fe}/${$(t)}/SKILL.md`}}},UH={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},KH={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},ad={id:Jo,metadata:{displayName:"Rovo Dev",category:"cli",officialUrl:"https://www.atlassian.com/solutions/devops/rovo-dev",shortDescription:"Atlassian's coding agent"},generators:MH,capabilities:UH,emptyImportMessage:"No Rovo Dev config found (AGENTS.md, .rovodev/skills, or .rovodev/mcp.json).",lintRules:dD,lint:{hooks:fD,permissions:hD,ignore:yD},supportsConversion:{commands:true,agents:true},project:$H,globalSupport:{capabilities:KH,detectionPaths:[ME,ts,Fe],layout:jH},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[yr],global:[ts]},canonicalDir:$E,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[qn],global:[Oc]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:eh,detectionPaths:[yr,Zt,qn]};});function ID(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Ge,content:r.body.trim()});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes(_r))continue;let n=basename(o.source,".md");e.push({path:`${ve}/${n}.md`,content:o.body.trim()});}return e}function RD(t){return tt(t,Ir)}function SD(t){return t.mcp===null||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:ca,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function CD(t){return t.ignore.length===0?[]:[{path:Ac,content:t.ignore.join(`
136
- `)}]}var ED=d(()=>{Q();kc();s(ID,"generateRules");s(RD,"generateSkills");s(SD,"generateMcp");s(CD,"generateIgnore");});async function HH(t,e,r,o){let n=o==="global"?[Rr,Ge]:[Ge,Rr];for(let i of n){let a=join(t,i),c=await y(a);if(c===null)continue;let l=join(t,OD),{frontmatter:m,body:p}=k(r(c,a,l));await L(join(t,um)),await _(l,await K(l,{...m,root:true},p)),e.push({fromTool:_r,fromPath:a,toPath:OD,feature:"rules"});return}}async function zH(t,e,r,o){let n=join(t,o==="global"?es:ve),i=join(t,um);e.push(...await yt({srcDir:n,destDir:i,extensions:[".md"],fromTool:_r,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:c})=>{let l=basename(a);if(l==="project_rules.md"||l==="rules.md")return null;let m=join(i,a),{frontmatter:p,body:u}=k(c(m));return {destPath:m,toPath:`${um}/${a}`,feature:"rules",content:await K(m,{...p,root:false},u)}},"mapEntry")}));}async function LD(t,e={}){let r=e.scope??"project",o=[],n=await U(_r,t,r);return await HH(t,o,n,r),await zH(t,o,n,r),o.push(...await z(cd,t,r,{normalize:n})),await Z(t,r==="global"?qr:Ir,_r,o,n),o}var OD,AD=d(()=>{mt();Q();ke();Ct();lt();T();M();kc();t_();OD=`${um}/_root.md`;s(HH,"importRoot");s(zH,"importNonRootRules");s(LD,"importFromTrae");});function kD(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:_r}))}var wD=d(()=>{_t();kc();s(kD,"lintRules");});var VH,JH,YH,XH,cd,t_=d(()=>{ED();Qt();AD();wD();Rt();kc();VH={name:_r,primaryRootInstructionPath:Ge,generateRules:ID,generateSkills:RD,generateMcp:SD,generateIgnore:CD,importFrom:LD},JH={rootInstructionPath:Ge,skillDir:Ir,managedOutputs:{dirs:[ve,Ir],files:[ca,Ac]},paths:{rulePath(t,e){return `${ve}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},YH={rootInstructionPath:Rr,skillDir:qr,managedOutputs:{dirs:[es,qr,UE],files:[Rr,pm]},rewriteGeneratedPath(t){return t===Ge?Rr:t.startsWith(`${ve}/`)?t.replace(`${ve}/`,`${es}/`):t.startsWith(`${Ir}/`)?t.replace(`${Ir}/`,`${qr}/`):t===ca?pm:t===Ac?null:t},mirrorGlobalPath(t,e){return ct(t,qr,e)},paths:{rulePath(t,e){return t==="_root"?Rr:`${es}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},XH={rules:"native",additionalRules:"native",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},cd={id:_r,metadata:{displayName:"Trae",category:"ide",officialUrl:"https://www.trae.ai",shortDescription:"ByteDance's adaptive AI IDE"},generators:VH,capabilities:{rules:"native",additionalRules:"native",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Trae config found (.trae/rules/project_rules.md, .trae/rules/*.md, .trae/skills/, .trae/mcp.json, or .trae/.ignore).",lintRules:kD,project:JH,globalSupport:{capabilities:XH,detectionPaths:[Rr,es,qr,pm],layout:YH},importer:{mcp:{feature:"mcp",mode:"mcpJson",source:{project:[ca],global:[pm]},canonicalDir:".agentsmesh",canonicalFilename:KE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Ac]},canonicalDir:".agentsmesh",canonicalFilename:BE}},buildImportPaths:rh,detectionPaths:[ve,ca,Ge]};});function TD(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Yo)),o=e?.body.trim()??"",n=it(o,r);return n?[{path:to,content:n}]:[]}function bD(t){return tt(t,ae)}function PD(t){return t.commands.map(e=>({path:`${ae}/${W(e.name)}/SKILL.md`,content:bt(e)}))}function xD(t){return t.agents.map(e=>({path:`${ae}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}function DD(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Xs,content:e}]}var ND=d(()=>{Q();Mt();st();St();wc();s(TD,"generateRules");s(bD,"generateSkills");s(PD,"generateCommands");s(xD,"generateAgents");s(DD,"generateMcp");});async function FD(t,e={}){let r=e.scope??"project",o=[],n=await U(Yo,t,r);return o.push(...await z(ld,t,r,{normalize:n})),await Z(t,r==="global"?Re:ae,Yo,o,n),o}var vD=d(()=>{mt();Q();Ct();wc();e_();s(FD,"importFromWarp");});function GD(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:Yo}))}var MD=d(()=>{_t();wc();s(GD,"lintRules");});function $D(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","warp","Warp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function jD(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","warp","Warp permissions are UI-managed; canonical permissions are not projected.")]}function UD(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","warp","Warp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var KD=d(()=>{Et();s($D,"lintHooks");s(jD,"lintPermissions");s(UD,"lintIgnore");});var ZH,QH,qH,tz,ez,ld,e_=d(()=>{St();st();ND();Qt();vD();MD();KD();Rt();wc();ZH={name:Yo,primaryRootInstructionPath:to,generateRules:TD,generateCommands:PD,generateAgents:xD,generateSkills:bD,generateMcp:DD,importFrom:FD},QH={rootInstructionPath:to,skillDir:ae,managedOutputs:{dirs:[ae],files:[to,Xs]},paths:{rulePath(t){return to},commandPath(t){return `${ae}/${W(t)}/SKILL.md`},agentPath(t){return `${ae}/${$(t)}/SKILL.md`}}},qH={rootInstructionPath:void 0,skillDir:Re,managedOutputs:{dirs:[Re],files:[]},rewriteGeneratedPath(t){return t.startsWith(`${ae}/`)?t.replace(`${ae}/`,`${Re}/`):t},mirrorGlobalPath(t,e){return ct(t,Re,e)},paths:{rulePath(){return Re},commandPath(t){return `${Re}/${W(t)}/SKILL.md`},agentPath(t){return `${Re}/${$(t)}/SKILL.md`}}},tz={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},ez={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},ld={id:Yo,metadata:{displayName:"Warp",category:"cli",officialUrl:"https://www.warp.dev",shortDescription:"AI-powered terminal"},generators:ZH,capabilities:tz,emptyImportMessage:"No Warp config found (WARP.md, AGENTS.md, .warp/skills, or .mcp.json).",lintRules:GD,lint:{hooks:$D,permissions:jD,ignore:UD},supportsConversion:{commands:true,agents:true},project:QH,globalSupport:{capabilities:ez,detectionPaths:[Re],layout:qH},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[oh,to]},canonicalDir:HE,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Xs]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:nh,detectionPaths:[to,oh,Xs]};});var sn,r_,si,BD,Bc,an,Wc,Hc,WD,ii,so,zc,o_,n_,s_,i_,a_,c_,Vc,Jc,Cm,md,pd,ud,HD,fe=d(()=>{sn="windsurf",r_=".windsurfrules",si=".windsurf/rules",BD=".windsurfignore",Bc=".codeiumignore",an="AGENTS.md",Wc=".windsurf/hooks.json",Hc=".windsurf/mcp_config.example.json",WD=".windsurf/mcp_config.json",ii=".windsurf/workflows",so=".windsurf/skills",zc=".agentsmesh/rules",o_=".agentsmesh/commands",n_=".agentsmesh/agents",s_=".agentsmesh/skills",i_=".agentsmesh/ignore",a_=".agentsmesh/hooks.yaml",c_=".agentsmesh/mcp.json",Vc=".codeium/windsurf/memories/global_rules.md",Jc=".codeium/windsurf/skills",Cm=".codeium/windsurf/global_workflows",md=".codeium/windsurf/hooks.json",pd=".codeium/windsurf/mcp_config.json",ud=".codeium/.codeiumignore",HD=".agents/skills";});function oz(t){let e=basename(t,".md");return e==="_root"?"root":e}function nz(t){if(t.length===0)return null;let e=t.map(r=>r.split("/")[0]??"").filter(r=>/^[A-Za-z0-9._-]+$/.test(r));return e.length!==t.length?null:e.every(r=>r===e[0])?e[0]:null}function l_(t){let e=[],r=t.rules.find(o=>o.root);if(!r)return [];e.push({path:an,content:r.body.trim()});for(let o of t.rules){if(o.root||o.targets.length>0&&!o.targets.includes("windsurf"))continue;let n=oz(o.source),i=o.trigger||(o.globs.length>0?"glob":void 0),a={description:o.description||void 0,trigger:i,glob:o.globs.length===1?o.globs[0]:void 0,globs:o.globs.length>1?o.globs:void 0};Object.keys(a).forEach(m=>{a[m]===void 0&&delete a[m];});let c=Object.keys(a).length>0?P(a,o.body.trim()||""):o.body.trim()||"";e.push({path:`${si}/${n}.md`,content:c});let l=nz(o.globs);l&&(l!==n&&e.push({path:`${si}/${l}.md`,content:c}),e.push({path:`${l}/AGENTS.md`,content:o.body.trim()||""}));}return e}var zD=d(()=>{M();fe();s(oz,"ruleSlug");s(nz,"directoryScopedRuleDir");s(l_,"generateRules");});function m_(t){return !t.ignore||t.ignore.length===0?[]:[{path:Bc,content:t.ignore.join(`
137
- `)}]}var VD=d(()=>{fe();s(m_,"generateIgnore");});function p_(t){return t.commands.map(e=>{let r={description:e.description.trim()||void 0,allowedTools:e.allowedTools.length>0?e.allowedTools:void 0};Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n];});let o=Object.keys(r).length>0?P(r,e.body.trim()||""):e.body.trim();return {path:`${ii}/${e.name}.md`,content:o}})}var JD=d(()=>{M();fe();s(p_,"generateCommands");});function u_(t){return t.agents.map(e=>({path:`${so}/${$(e.name)}/SKILL.md`,content:Lt(e)}))}var YD=d(()=>{st();fe();s(u_,"generateAgents");});function d_(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Hc,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var XD=d(()=>{fe();s(d_,"generateMcp");});function sz(t){let e={PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use",Notification:"notification",UserPromptSubmit:"user_prompt_submit",SubagentStart:"subagent_start",SubagentStop:"subagent_stop"};return e[t]?e[t]:t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function iz(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!go(i))continue;let a=Kt(i),c=me(i),l=i.type==="prompt"?c||a:a||c;l&&n.push({command:l,show_output:true});}n.length>0&&(e[sz(r)]=n);}return e}function g_(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=iz(t.hooks);return Object.keys(e).length===0?[]:[{path:Wc,content:JSON.stringify({hooks:e},null,2)}]}var ZD=d(()=>{Pr();fe();s(sz,"windsurfEventName");s(iz,"toWindsurfHooks");s(g_,"generateHooks");});function f_(t){let e=[];for(let r of t.skills){let o={name:r.name,description:r.description||void 0};o.description===void 0&&delete o.description;let n=Object.keys(o).length>0?P(o,r.body.trim()||""):r.body.trim()||"";e.push({path:`${so}/${r.name}/SKILL.md`,content:n});for(let i of r.supportingFiles)e.push({path:`${so}/${r.name}/${i.relativePath}`,content:i.content});}return e}var QD=d(()=>{M();fe();s(f_,"generateSkills");});var qD=d(()=>{zD();VD();JD();YD();XD();ZD();QD();});var tN=d(()=>{qD();});function eN(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function rN(t,e,r){let o=join(t,ii),i=(await v(o)).filter(c=>c.endsWith(".md")),a=join(t,o_);for(let c of i){let l=await y(c);if(!l)continue;let m=relative(o,c).replace(/\\/g,"/");await L(a);let p=join(a,m),u=r(l,c,p),{frontmatter:g,body:f}=k(u),h=await ht(p,{description:typeof g.description=="string"?g.description:"",hasDescription:Object.prototype.hasOwnProperty.call(g,"description"),allowedTools:(()=>{let O=eN(g.allowedTools);return O.length>0?O:eN(g["allowed-tools"])})(),hasAllowedTools:Object.prototype.hasOwnProperty.call(g,"allowedTools")||Object.prototype.hasOwnProperty.call(g,"allowed-tools")},f);await _(p,h),e.push({fromTool:sn,fromPath:c,toPath:`${o_}/${m}`,feature:"commands"});}}var oN=d(()=>{T();M();lt();fe();s(eN,"toStringArray");s(rN,"importWorkflows");});async function nN(t,e,r,o=so){let n=join(t,o),i=await Zs(n),a={projectRoot:t,sourceSkillsDir:o,destCanonicalSkillsDir:s_,targetName:"windsurf",normalize:r,results:e};for(let[c,l]of i){let m=join(l,"SKILL.md"),p=await y(m);if(!p)continue;let u=k(p),g=fo(u.frontmatter,c);if(g){await Ye(join(t,s_,c));let f=join(t,n_);await L(f);let h=join(f,`${g.name}.md`);await _(h,Je(g,r(u.body,m,h))),e.push({fromTool:"windsurf",fromPath:m,toPath:`${n_}/${g.name}.md`,feature:"agents"});continue}await qo(c,l,a);}}var sN=d(()=>{T();M();st();Ya();Pc();fe();s(nN,"importSkills");});async function aN(t,e){let r=join(t,Wc),o=await y(r);if(o)try{let n=JSON.parse(o);if(!n.hooks||typeof n.hooks!="object"||Array.isArray(n.hooks))return;let i=mz(n.hooks);if(Object.keys(i).length===0)return;let a=join(t,a_);await L(dirname(a)),await _(a,stringify(i)),e.push({fromTool:sn,fromPath:r,toPath:a_,feature:"hooks"});}catch{}}function lz(t){return {pre_tool_use:"PreToolUse",post_tool_use:"PostToolUse",notification:"Notification",user_prompt_submit:"UserPromptSubmit",subagent_start:"SubagentStart",subagent_stop:"SubagentStop"}[t]??t}function mz(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=lz(r),i=[];for(let a of o){if(!a||typeof a!="object")continue;let c=a;if(typeof c.command=="string"&&c.command.trim()){i.push({matcher:".*",type:"command",command:c.command});continue}let l=typeof c.matcher=="string"&&c.matcher.trim()?c.matcher:".*",m=Array.isArray(c.hooks)?c.hooks:[];for(let p of m){if(!p||typeof p!="object")continue;let u=p,g=typeof u.command=="string"?u.command:typeof u.prompt=="string"?u.prompt:"";if(!g.trim())continue;let f={matcher:l,type:u.type==="prompt"?"prompt":"command",command:g};typeof u.timeout=="number"&&(f.timeout=u.timeout),i.push(f);}}i.length>0&&(e[n]=i);}return e}async function cN(t,e){let r=[Hc,WD];for(let o of r){let n=join(t,o),i=await y(n);if(i)try{let a=JSON.parse(i);if(!a.mcpServers||typeof a.mcpServers!="object")continue;let c=join(t,c_);await L(dirname(c)),await _(c,JSON.stringify({mcpServers:a.mcpServers},null,2)),e.push({fromTool:sn,fromPath:n,toPath:c_,feature:"mcp"});return}catch{}}}var lN=d(()=>{T();fe();s(aN,"importWindsurfHooks");s(lz,"canonicalHookEventName");s(mz,"windsurfHooksToCanonical");s(cN,"importWindsurfMcp");});async function gd(t,e){let r=e?.scope??"project",o=[],n=await U(sn,t),i=await U("codex-cli",t),a=join(t,zc),c=join(t,r_),l=await y(c);if(l!==null){await L(a);let g=join(a,"_root.md"),f=n(l,c,g).trim(),h=await K(g,{root:true},f);await _(g,h),o.push({fromTool:"windsurf",fromPath:c,toPath:`${zc}/_root.md`,feature:"rules"});}if(l===null){let g=join(t,an),f=await y(g);if(f!==null){await L(a);let h=join(a,"_root.md"),O=n(i(f,g,h),g,h).trim(),R=await K(h,{root:true},O);await _(h,R),o.push({fromTool:"windsurf",fromPath:g,toPath:`${zc}/_root.md`,feature:"rules"});}}r!=="global"&&o.push(...await yt({srcDir:t,destDir:a,extensions:["AGENTS.md"],fromTool:"windsurf",normalize:n,mapEntry:s(async({srcPath:g,normalizeTo:f})=>{let h=relative(t,dirname(g)).replace(/\\/g,"/");if(!h||h==="."||basename(g)!=="AGENTS.md")return null;let O=h.replace(/\//g,"-");if(!Sp(h))return await Ye(join(a,`${O}.md`)),null;let R=join(a,`${O}.md`);return {destPath:R,toPath:`${zc}/${O}.md`,feature:"rules",content:await K(R,{root:false,globs:[`${h}/**`]},f(R))}},"mapEntry")}));let m=join(t,si);o.push(...await yt({srcDir:m,destDir:a,extensions:[".md"],fromTool:"windsurf",normalize:n,mapEntry:s(async({relativePath:g,normalizeTo:f})=>{if(g==="_root.md"&&l!==null)return null;let h=join(a,g),{frontmatter:O,body:R}=k(f(h)),S={...O};return typeof S.glob=="string"&&S.glob.trim()&&(S.globs=[S.glob],delete S.glob),{destPath:h,toPath:`${zc}/${g}`,feature:"rules",content:await K(h,{...S,root:false},R)}},"mapEntry")}));let p=join(t,BD),u=await y(p);if((u===null||!u.trim())&&(p=join(t,Bc),u=await y(p)),u!==null&&u.trim()){let g=u.split(/\r?\n/),f=[];for(let h of g){let O=h.trim();O&&!O.startsWith("#")&&f.push(O);}if(f.length>0){await L(join(t,".agentsmesh"));let h=join(t,i_);await _(h,f.join(`
138
- `)),o.push({fromTool:"windsurf",fromPath:p,toPath:i_,feature:"ignore"});}}return await rN(t,o,n),await nN(t,o,n),await aN(t,o),await cN(t,o),o}var y_=d(()=>{mt();T();M();lt();ke();Ya();fe();oN();sN();lN();s(gd,"importFromWindsurf");});function mN(t,e,r){let o=[],{rules:n}=t;n.length>0&&(n.some(c=>c.root)||o.push({level:"warning",file:relative(e,n[0].source),target:sn,message:"Windsurf needs a root rule to generate AGENTS.md. Add root: true to a rule."}));let i=[];return t.permissions&&(t.permissions.allow.length>0||t.permissions.deny.length>0)&&i.push("permissions"),i.length>0&&o.push({level:"warning",file:".agentsmesh",target:sn,message:`Windsurf cannot project these features yet: ${i.join(", ")}.`}),o}var pN=d(()=>{fe();s(mN,"lintRules");});function uN(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>b(e.source,"windsurf","windsurf workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function dN(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[b(".agentsmesh/mcp.json","windsurf","Windsurf MCP is partial; generated .windsurf/mcp_config.example.json is a reference artifact and may require manual setup.")]}var gN=d(()=>{Et();s(uN,"lintCommands");s(dN,"lintMcp");});function fz(t){if(t.length===0)return null;let e=t.map(r=>r.split("/")[0]??"").filter(r=>/^[A-Za-z0-9._-]+$/.test(r));return e.length!==t.length?null:e.every(r=>r===e[0])?e[0]:null}var hz,yz,_z,Iz,fN,hN=d(()=>{tN();Si();fe();Qt();y_();pN();gN();Rt();Wa();st();s(fz,"directoryScopedRuleDir");hz={name:"windsurf",primaryRootInstructionPath:an,generateRules:l_,generateCommands:p_,generateAgents:u_,generateSkills:f_,generateMcp:d_,generateHooks:g_,generateIgnore:m_,importFrom:gd},yz={rootInstructionPath:an,extraRuleOutputPaths(t){if(t.root)return [an];let e=fz(t.globs);return e!==null?[`${e}/AGENTS.md`]:[]},skillDir:so,managedOutputs:{dirs:[".windsurf/rules",".windsurf/skills",".windsurf/workflows"],files:["AGENTS.md",".codeiumignore",".windsurf/hooks.json",".windsurf/mcp_config.example.json"]},paths:{rulePath(t,e){return `${si}/${t}.md`},commandPath(t,e){return `${ii}/${t}.md`},agentPath(t,e){return Ve(e,"windsurf")?`.windsurf/skills/${$(t)}/SKILL.md`:null}}},_z={rootInstructionPath:Vc,skillDir:Jc,managedOutputs:{dirs:[Jc,Cm,HD],files:[Vc,md,pd,ud]},rewriteGeneratedPath(t){return t===an?Vc:t.startsWith(`${si}/`)||/\/AGENTS\.md$/.test(t)?null:t.startsWith(`${so}/`)?t.replace(`${so}/`,`${Jc}/`):t.startsWith(`${ii}/`)?t.replace(`${ii}/`,`${Cm}/`):t===Wc?md:t===Hc?pd:t===Bc?ud:t},mirrorGlobalPath(t,e){return ct(t,".codeium/windsurf/skills",e)},paths:{rulePath(t,e){return Vc},commandPath(t,e){return `${Cm}/${t}.md`},agentPath(t,e){return Ve(e,"windsurf")?`${Jc}/${$(t)}/SKILL.md`:null}}},Iz={rules:"native",additionalRules:"partial",commands:Nr("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},fN={id:"windsurf",metadata:{displayName:"Windsurf",category:"ide",officialUrl:"https://windsurf.com",shortDescription:"Codeium's agentic IDE"},generators:hz,capabilities:{rules:"native",additionalRules:"native",commands:Nr("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Windsurf config found (.windsurfrules, .windsurf/rules, .windsurfignore, or .codeiumignore).",supportsConversion:{agents:true},lintRules:mN,lint:{commands:uN,mcp:dN},project:yz,globalSupport:{capabilities:Iz,detectionPaths:[Vc,Jc,Cm,md,pd,ud],layout:_z},buildImportPaths:sh,detectionPaths:[".windsurfrules",".windsurf"]};});function yN(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes("zed")),o=e?.body.trim()??"",n=it(o,r);return n?[{path:eo,content:n}]:[]}var _N=d(()=>{Mt();la();s(yN,"generateRules");});async function RN(t,e,r){let o=await y(join(t,e));if(o===null)return;let n;try{n=JSON.parse(o);}catch{return}if(n===null||typeof n!="object"||Array.isArray(n))return;let a=n.context_servers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let c={};for(let[l,m]of Object.entries(a)){if(!m||typeof m!="object"||Array.isArray(m))continue;let p={...m};delete p.source,c[l]=p;}Object.keys(c).length!==0&&(await $t(t,IN,c),r.push({fromTool:"zed",fromPath:e,toPath:IN,feature:"mcp"}));}var IN,SN=d(()=>{T();Fr();la();IN=".agentsmesh/mcp.json";s(RN,"importZedMcp");});async function CN(t,e={}){let r=e.scope??"project",o=[],n=await U("zed",t,r);return o.push(...await z(fd,t,r,{normalize:n})),await RN(t,r==="global"?Zo:Xo,o),o}var EN=d(()=>{mt();Ct();SN();la();__();s(CN,"importFromZed");});function ON(t,e,r,o){return H(t,e,r,{checkGlobMatches:o?.scope!=="global"}).map(n=>({...n,target:"zed"}))}var LN=d(()=>{_t();la();s(ON,"lintRules");});function AN(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[b(".agentsmesh/hooks.yaml","zed","Zed has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function kN(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,o=t.permissions.ask??[];return e.length===0&&r.length===0&&o.length===0?[]:[b(".agentsmesh/permissions.yaml","zed","Zed permissions are managed via agent.tool_permissions in settings.json; canonical permissions are not projected.")]}function wN(t){return t.ignore.length===0?[]:[b(".agentsmesh/ignore","zed","Zed has no dedicated ignore file and relies on file_scan_exclusions in settings.json; canonical ignore patterns are not projected.")]}var TN=d(()=>{Et();s(AN,"lintHooks");s(kN,"lintPermissions");s(wN,"lintIgnore");});function Az(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let o=JSON.parse(e);if(o===null||typeof o!="object"||Array.isArray(o))return t;let n=o;return n.context_servers!==void 0&&(r.context_servers=n.context_servers),JSON.stringify(r,null,2)}var Sz,Cz,Ez,Oz,Lz,fd,__=d(()=>{_N();EN();LN();TN();Rt();la();Sz={name:"zed",primaryRootInstructionPath:eo,generateRules:yN,importFrom:CN},Cz={rootInstructionPath:eo,managedOutputs:{dirs:[],files:[eo,Xo]},paths:{rulePath(t){return eo},commandPath(){return null},agentPath(){return null}}},Ez={rootInstructionPath:void 0,managedOutputs:{dirs:[],files:[Zo]},rewriteGeneratedPath(t){return t===Xo?Zo:t},paths:{rulePath(){return Zo},commandPath(){return null},agentPath(){return null}}},Oz={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Lz={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(Az,"mergeZedSettings");fd={id:"zed",metadata:{displayName:"Zed",category:"ide",officialUrl:"https://zed.dev",shortDescription:"Collaborative AI editor"},generators:Sz,capabilities:Oz,emptyImportMessage:"No Zed config found (.rules or .zed/settings.json).",lintRules:ON,lint:{hooks:AN,permissions:kN,ignore:wN},project:Cz,globalSupport:{capabilities:Lz,detectionPaths:[Zo],layout:Ez},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[eo],global:[]},canonicalDir:JE,canonicalRootFilename:"_root.md",markAsRoot:true}},emitScopedSettings(t,e){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let r={};for(let[o,n]of Object.entries(t.mcp.mcpServers))r[o]=n;return [{path:Xo,content:JSON.stringify({context_servers:r},null,2)}]},mergeGeneratedOutputContent(t,e,r,o){return o===Xo||o===Zo?Az(t,r):null},buildImportPaths:ih,detectionPaths:[eo,Xo]};});var OC={};gg(OC,{BUILTIN_TARGETS:()=>zt,TARGET_IDS:()=>kt,getBuiltinTargetDefinition:()=>Er,getEffectiveTargetSupportLevel:()=>hd,getTargetCapabilities:()=>oi,getTargetDetectionPaths:()=>R_,getTargetLayout:()=>vt,getTargetManagedOutputs:()=>S_,getTargetPrimaryRootInstructionPath:()=>wz,getTargetSkillDir:()=>Om,isBuiltinTargetId:()=>Tr,resolveTargetFeatureGenerator:()=>Yc,rewriteGeneratedOutputPath:()=>C_});function kz(){return I_||(NS(zt),I_=new Map(zt.map(t=>[t.id,t]))),I_}function Er(t){return kz().get(t)}function oi(t,e="project"){let r=Er(t)??ut(t);if(!r)return;let o=e==="global"?r.globalSupport?.capabilities??r.capabilities:r.capabilities;return xS(o)}function R_(t,e="project"){let r=Er(t)??ut(t);return r?e==="global"?r.globalSupport?.detectionPaths??[]:r.detectionPaths:[]}function vt(t,e="project"){let r=Er(t)??ut(t);if(r)return e==="global"?r.globalSupport?.layout:r.project}function wz(t,e="project"){return vt(t,e)?.rootInstructionPath}function Om(t,e="project"){return vt(t,e)?.skillDir}function S_(t,e="project"){return vt(t,e)?.managedOutputs}function C_(t,e,r="project"){let o=vt(t,r);return o?o.rewriteGeneratedPath?o.rewriteGeneratedPath(e):e:null}function bN(t,e,r,o){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?!Ba(r,t.id,true,o):e==="agents"&&t.supportsConversion?.agents?!Ve(r,t.id,true,o):false}function Tz(t,e,r,o){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?Ba(r,t.id,true,o):e==="agents"&&t.supportsConversion?.agents?Ve(r,t.id,true,o):false}function hd(t,e,r,o="project"){let n=oi(t,o)?.[e]?.level??"none",i=Er(t)??ut(t);return n==="none"&&Tz(i,e,r,o)?"embedded":n!=="embedded"?n:bN(i,e,r,o)?"none":n}function Yc(t,e,r,o="project"){let n=Er(t)??ut(t);if(!n?.generators||bN(n,e,r,o))return;let i=bz[e];return i===null?void 0:i(n.generators)}var zt,I_,bz,xt=d(()=>{Wa();Si();je();Ug();uo();Qg();ah();ch();mh();oL();uh();sA();HA();Gh();Wh();zh();cy();ly();my();by();Py();xy();Ny();jy();By();Hy();Vy();Jy();Yy();Qy();qy();t_();e_();hN();__();zt=[Cp,Qp,qp,tu,rL,eu,nA,WA,gu,Su,Eu,Du,Nu,Fu,Wu,Hu,zu,Ju,Qu,td,ed,rd,od,nd,id,ad,cd,ld,fN,fd];s(kz,"builtinTargetsMap");s(Er,"getBuiltinTargetDefinition");s(oi,"getTargetCapabilities");s(R_,"getTargetDetectionPaths");s(vt,"getTargetLayout");s(wz,"getTargetPrimaryRootInstructionPath");s(Om,"getTargetSkillDir");s(S_,"getTargetManagedOutputs");s(C_,"rewriteGeneratedOutputPath");s(bN,"isFeatureSuppressedByConversion");s(Tz,"isConversionUpgrading");s(hd,"getEffectiveTargetSupportLevel");bz={rules:s(t=>t.generateRules,"rules"),additionalRules:null,commands:s(t=>t.generateCommands,"commands"),agents:s(t=>t.generateAgents,"agents"),skills:s(t=>t.generateSkills,"skills"),mcp:s(t=>t.generateMcp,"mcp"),permissions:s(t=>t.generatePermissions,"permissions"),hooks:s(t=>t.generateHooks,"hooks"),ignore:s(t=>t.generateIgnore,"ignore")};s(Yc,"resolveTargetFeatureGenerator");});function Gz(t){return typeof t=="string"?t:t.level}function PN(t){return vz.includes(t)}function xN(t,e,r,o){for(let n of Fz){let i=Gz(e[n.feature]);if(i==="none")continue;let a=typeof t.generators[n.generator]=="function",c=PN(n.feature)&&typeof t.emitScopedSettings=="function";a||c||r.addIssue({code:"custom",path:[...o,n.feature],message:`Capability "${n.feature}" is "${i}" but generators.${n.generator}`+(PN(n.feature)?" or emitScopedSettings":"")+" is missing."});}}function yd(t){return $z.parse(t)}var ms,DN,Pz,xz,NN,Dz,Nz,Fz,vz,Mz,$z,E_=d(()=>{ms=z$1.union([z$1.enum(["native","embedded","partial","none"]),z$1.object({level:z$1.enum(["native","embedded","partial","none"]),flavor:z$1.string().optional()})]),DN=z$1.object({rules:ms,additionalRules:ms,commands:ms,agents:ms,skills:ms,mcp:ms,hooks:ms,ignore:ms,permissions:ms}),Pz=z$1.object({name:z$1.string(),generateRules:z$1.function(),importFrom:z$1.function(),generateCommands:z$1.function().optional(),generateAgents:z$1.function().optional(),generateSkills:z$1.function().optional(),generateMcp:z$1.function().optional(),generatePermissions:z$1.function().optional(),generateHooks:z$1.function().optional(),generateIgnore:z$1.function().optional(),lint:z$1.function().optional()}).passthrough(),xz=z$1.object({rulePath:z$1.function(),commandPath:z$1.function(),agentPath:z$1.function()}),NN=z$1.object({paths:xz}).passthrough(),Dz=z$1.object({capabilities:DN,detectionPaths:z$1.array(z$1.string()),layout:NN,scopeExtras:z$1.function().optional()}).passthrough(),Nz=["global","globalCapabilities","globalDetectionPaths","generateScopeExtras"],Fz=[{feature:"commands",generator:"generateCommands"},{feature:"agents",generator:"generateAgents"},{feature:"skills",generator:"generateSkills"},{feature:"mcp",generator:"generateMcp"},{feature:"hooks",generator:"generateHooks"},{feature:"ignore",generator:"generateIgnore"},{feature:"permissions",generator:"generatePermissions"}],vz=["mcp","hooks","ignore","permissions"];s(Gz,"capabilityLevel");s(PN,"canUseScopedSettings");s(xN,"validateCapabilityImplementations");Mz=z$1.object({id:z$1.string().regex(/^[a-z][a-z0-9-]*$/,"Target id must be lowercase with hyphens"),generators:Pz,capabilities:DN,emptyImportMessage:z$1.string(),lintRules:z$1.union([z$1.function(),z$1.null()]),project:NN,globalSupport:Dz.optional(),buildImportPaths:z$1.function(),detectionPaths:z$1.array(z$1.string())}).passthrough(),$z=Mz.superRefine((t,e)=>{for(let r of Nz)r in t&&e.addIssue({code:"custom",path:[r],message:`Use globalSupport instead of legacy field "${r}".`});xN(t,t.capabilities,e,["capabilities"]),t.globalSupport!==void 0&&xN(t,t.globalSupport.capabilities,e,["globalSupport","capabilities"]);});s(yd,"validateDescriptor");});function jz(){return O_||(O_=new Map(zt.map(t=>[t.id,t]))),O_}function _d(t){let e=yd(t);L_.set(e.id,e);}function ut(t){return L_.get(t)??jz().get(t)}function Id(){return [...L_.values()]}var L_,O_,je=d(()=>{xt();E_();L_=new Map;s(jz,"builtinDescriptors");s(_d,"registerTargetDescriptor");s(ut,"getDescriptor");s(Id,"getAllDescriptors");});async function FN(t,e,r="project"){let o=new Map,n=ut(t);return n&&await n.buildImportPaths(o,e,r),o}var vN=d(()=>{je();s(FN,"buildImportReferenceMap");});function Bz(t){let e=[t.project,t.globalSupport?.layout].filter(n=>n!==void 0),r=[...t.detectionPaths,...e.flatMap(n=>n.managedOutputs?.dirs??[]),...e.flatMap(n=>n.managedOutputs?.files??[])],o=new Set;for(let n of r){let i=n.split("/")[0];i&&i.startsWith(".")&&i.length>1&&o.add(`${i}/`);}return o}function Wz(){let t=new Set([".agentsmesh/"]);for(let e of zt)for(let r of Bz(e))t.add(r);return Array.from(t)}function Hz(){let t=new Set([...Wz(),...A_.rootRelativePrefixes]),e=new Set([...Kz,...A_.meshRootSegments]);return {protectedSchemes:[...Uz,...A_.protectedSchemes],rootRelativePrefixes:Array.from(t),meshRootSegments:e}}function Rd(){return k_||(k_=Hz()),k_}var Uz,Kz,A_,k_,GN=d(()=>{xt();Uz=[/\b[A-Za-z][A-Za-z0-9+.-]+:[^\s<>()\]]+/g,/\b[\w.-]+@[\w.-]+:[^\s<>()\]]+/g,/\b[\w.+-]+@[\w.-]+\.[A-Za-z]{2,}\b/g,/\/\/[A-Za-z0-9][\w.-]*\.[A-Za-z]{2,}[^\s<>()\]]*/g],Kz=new Set(["skills","rules","commands","agents","packs"]),A_={protectedSchemes:[],rootRelativePrefixes:[],meshRootSegments:[]};s(Bz,"topLevelDotfilePrefixes");s(Wz,"buildDefaultRootRelativePrefixes");s(Hz,"rebuild");s(Rd,"getLinkFormatRegistry");});function io(t){let e=Pt(t);return Rd().rootRelativePrefixes.some(r=>e.startsWith(r))}function Vz(t){let e=Pt(t).replace(/^\.\//,"");if(e.startsWith("../")||e.startsWith("/")||xr.test(e)||/^[a-zA-Z]:/.test(e)||io(e))return false;let r=e.split("/").filter(o=>o.length>0)[0];return r!==void 0&&Rd().meshRootSegments.has(r)}function Lm(t,e,r){let o=et(e),n=V(e,e),i=V(e,r),a=Pt(t);if(xr.test(t)){let c=V(e,t);return o===win32||c.startsWith(`${n}${o.sep}`)?[c]:[c]}if(o.isAbsolute(t)){let c=V(e,t);return c.startsWith(n)||existsSync(t)?[c]:[V(e,o.join(e,t))]}if(a.startsWith("./")||a.startsWith("../")){let c=V(e,o.join(o.dirname(i),a)),l=wS(a,n);return l&&l!==c?[c,l]:[c]}if(io(a))return [V(e,o.join(n,a))];if(a.includes("/")){let c=V(e,o.join(n,".agentsmesh")),l=Vz(a)?V(e,o.join(c,a)):null,m=V(e,o.join(n,a)),p=V(e,o.join(o.dirname(i),a));return l!==null?[l,m,p]:[m,p]}return Jz.has(a)?[]:a.includes(".")?[V(e,o.join(o.dirname(i),a))]:[]}function Am(t,e){let r=[e];if(!kS(t,e)||!existsSync(e))return r;try{let o=[realpathSync(e),realpathSync.native(e)];for(let n of o)n!==e&&!r.includes(n)&&r.push(n);}catch{}return r}function UN(t,e,r){let o=e>0?t.at(e-1):"",n=r<t.length?t.at(r):"";return o==="*"||n==="*"}function Sd(t){let e=[];for(let r of Rd().protectedSchemes){let o=r.flags.includes("g")?r:new RegExp(r.source,`${r.flags}g`);for(let n of t.matchAll(o))e.push([n.index??0,(n.index??0)+n[0].length]);}for(let r of t.matchAll(Yz))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(Xz))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(Zz))e.push([r.index??0,(r.index??0)+r[0].length]);return e}var Jz,Yz,Xz,Zz,jN,Xc,ai=d(()=>{re();GN();s(io,"isRootRelativePathToken");s(Vz,"isMeshRootRelativePathToken");Jz=new Set(["AGENTS.md","CLAUDE.md","GEMINI.md","codex.md",".windsurfrules",".cursorrules"]),Yz=/^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm,Xz=/<!-- agentsmesh:root-generation-contract:start -->[\s\S]*?<!-- agentsmesh:root-generation-contract:end -->/g,Zz=/<!-- agentsmesh:embedded-rules:start -->[\s\S]*?<!-- agentsmesh:embedded-rules:end -->/g,jN=/(?:\.\.[\\/]|\.\/|\.\\|\/[A-Za-z0-9._-]|[A-Za-z]:[\\/][A-Za-z0-9._-]|\.agentsmesh[\\/]|\.claude[\\/]|\.cursor[\\/]|\.github[\\/]|\.continue[\\/]|\.junie[\\/]|\.kiro[\\/]|\.gemini[\\/]|\.clinerules[\\/]|\.cline[\\/]|\.codex[\\/]|\.agents[\\/]|\.windsurf[\\/]|\.roo[\\/]|(?:[A-Za-z0-9._-]+[\\/])+|[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+)[A-Za-z0-9._@%+~:\\/-]*/g,Xc=/(?::(\d+)){1,2}$/;s(Lm,"resolveProjectPath");s(Am,"expandResolvedPaths");s(UN,"isGlobAdjacent");s(Sd,"protectedRanges");});function Qz(t){return t===void 0||t.role==="inline-code"||t.role==="bracketed"||t.role==="quoted"||t.role==="at-prefix"||t.role==="bracket-label"||t.role==="bare-prose"}function KN(t){return Qz(t.tokenContext)}function w_(t,e){let r=et(t),o=V(t,t),n=V(t,e);if(n===o)return true;let i=o.endsWith(r.sep)?o:`${o}${r.sep}`;return n.startsWith(i)}function BN(t){let e=et(t);return V(t,e.join(t,".agentsmesh"))}function ao(t,e){let r=et(t),o=BN(t),n=V(t,e);if(n===o)return true;let i=o.endsWith(r.sep)?o:`${o}${r.sep}`;return n.startsWith(i)}function WN(t,e,r){let o=et(t),n=BN(t),i=V(t,e);if(!ao(t,i))return null;let a=o.relative(n,i).replace(/\\/g,"/");return a.startsWith("..")||a.length===0?null:r&&!a.endsWith("/")?`${a}/`:a}function T_(t,e,r){let n=et(t).relative(V(t,t),V(t,e)).replace(/\\/g,"/");if(n.startsWith(".."))return null;let i=n.length>0?n:".";return r&&!i.endsWith("/")?`${i}/`:i}function Zc(t,e,r){let o=T_(t,e,r);return o===null?null:{kind:"projectRoot",rest:o,text:o}}function b_(t,e,r,o,n){let i=et(t),a=V(t,t),c=V(t,e),l=V(t,r);if(!w_(t,l))return Zc(t,l,o)?.text??null;let m=V(t,i.dirname(c));if(!w_(t,m)&&m!==a)return Zc(t,l,o)?.text??null;let p=i.relative(m,l).replace(/\\/g,"/");if(i.isAbsolute(p)||xr.test(p))return T_(t,l,o);let u=V(t,i.join(m,p));return w_(t,u)?(p===""||p==="."?p=".":n.explicitCurrentDirLinks===true&&m!==a&&!p.startsWith("../")&&!p.startsWith("./")&&(p=`./${p}`),o&&!p.endsWith("/")?`${p}/`:p):T_(t,l,o)}var P_=d(()=>{re();s(Qz,"isReadingContext");s(KN,"isReadingContextOptions");s(w_,"isUnderProjectRoot");s(BN,"agentsMeshRoot");s(ao,"isUnderAgentsMesh");s(WN,"toAgentsMeshRootRelative");s(T_,"toProjectRootRelative");s(Zc,"toProjectRootReference");s(b_,"formatLinkPathForDestinationLegacy");});function HN(t,e,r,o,n={}){let i=n.scope??"project",a=V(t,r);if(KN(n)&&ao(t,e)&&ao(t,a)){let m=et(t),p=V(t,t),u=m.relative(p,a).replace(/\\/g,"/");if(!u.startsWith("..")&&u.length>0)return o&&!u.endsWith("/")?`${u}/`:u}if(n.forceRelative)return b_(t,e,r,o,n);if(i==="global"&&!ao(t,e))return Zc(t,a,o)?.text??null;let c=(()=>{if(ao(t,a))return a;let m=n.logicalMeshSourceAbsolute;return m&&ao(t,V(t,m))?V(t,m):null})();if(!c)return Zc(t,a,o)?.text??null;if(o||(n.pathIsDirectory?.(a)??false)){let m=WN(t,c,o);return m!==null?m:Zc(t,c,o)?.text??null}return b_(t,e,r,o,n)}var zN=d(()=>{ai();re();P_();P_();s(HN,"formatLinkPathForDestination");});function VN(t,e,r,o){let n=et(e),i=Pt(t);if(!io(i))return null;let a=i.split("/").filter(m=>m.length>0);if(a.length<3)return null;let c=V(e,r),l=n.dirname(c);for(let m=1;m<=a.length-1;m++){let p=a.slice(m).join("/"),u=V(e,n.join(l,p));if(u!==c&&o(u))return u}return null}var JN=d(()=>{re();ai();s(VN,"resolveByDestinationSuffixStrip");});function YN(t){let e=null,r=false,o=null,n=null,i=null;for(let l of Lm(t.candidate,t.projectRoot,t.sourceFile)){let m=null,p=null;for(let u of Am(t.projectRoot,l)){let g=V(t.projectRoot,u),f=V(t.projectRoot,t.translatePath(g)),h=t.pathExists(g),O=t.pathExists(f);if(O&&f!==g){e=f,o=g,r=true;break}(h||O)&&m===null&&(m=f,p=g),e===null&&(e=f);}if(!r&&m!==null&&n===null&&(n=m,i=p),r)break}if(!r){let l=VN(t.candidate,t.projectRoot,t.destinationFile,t.pathExists);l!==null&&(e=l,r=true);}!r&&n!==null&&(e=n,i!==null&&(o=i),r=true);let a=Pt(t.destinationFile),c=a.includes("/.agentsmesh/")||a.startsWith(".agentsmesh/");return !r&&e!==null&&Pt(t.rawToken).startsWith(".agentsmesh/")&&c&&(r=true),{translatedPath:e,resolvedBeforeTranslate:o,matchedPath:r}}var XN=d(()=>{re();ai();JN();s(YN,"resolveLinkTarget");});function ZN(t,e,r){return e>=2&&t[e-2]==="~"&&t[e-1]==="/"?true:e>=1&&t[e-1]==="~"&&r.startsWith("/")}function QN(t,e,r){if(e<=0||t[e-1]!=="(")return false;let o=e+r.length,n=t[o];return n!==")"&&n!=="#"&&n!=="?"&&n!==" "&&n!==" "?false:t[e-2]==="]"}function qN(t){let e=Pt(t);return e.startsWith("./")||e.startsWith("../")?true:e.startsWith("/")||xr.test(e)||io(e)?false:e.includes("/")}var tF=d(()=>{re();ai();s(ZN,"isTildeHomeRelativePathToken");s(QN,"isMarkdownLinkDestinationToken");s(qN,"isRelativePathToken");});function qz(t,e,r){let o=e+r.length;if(t[o]!=="]"||t[o+1]!=="(")return false;let n=o+2,i="";for(;n<t.length;){let a=t[n];if(a===")"||a==="#"||a==="?"||a===" "||a===" "||a===`
139
- `)break;i+=a,n++;}return i===r}function eF(t,e,r){let o=t.lastIndexOf(`
140
- `,e-1)+1,n=t.slice(o,e);if(!/^\s*\[[^\]\n]+\]:\s*<?\s*$/.test(n))return false;let i=r<t.length?t[r]:"";return i===""||i===`
141
- `||i==="\r"||i===">"||i===" "||i===" "||i==='"'||i==="'"||i===":"||i==="#"||i==="?"}function rF(t,e,r){let o=e>0?t[e-1]:"",n=r<t.length?t[r]:"";return o==="`"&&n==="`"?{role:"inline-code"}:eF(t,e,r)?{role:"markdown-link-dest"}:o==="<"&&n===">"?{role:"bracketed"}:o==="'"&&n==="'"||o==='"'&&n==='"'?{role:"quoted"}:o==="@"?{role:"at-prefix"}:o==="("&&t[e-2]==="]"?{role:"markdown-link-dest"}:o==="["&&n==="]"?{role:"bracket-label"}:{role:"bare-prose"}}function oF(t,e,r,o,n){if(e<0||r>t.length)return false;let{candidate:i}=Ka(o),a=i.replace(Xc,""),c=Pt(a),l=e+a.length,m=t[e-1],p=t[r];return eF(t,e,l)||m==="'"&&p==="'"||m==='"'&&p==='"'||m==="`"&&p==="`"||m==="<"&&p===">"?true:m==="["&&p==="]"?!(!n&&!io(c)&&qz(t,e,o)):m==="@"?true:m==="("?p===")"||p==="#"||p==="?"||p===" "||p===" ":n?io(c)?true:c.includes("/")||c.includes("\\")?c.startsWith("./")||c.startsWith("../")?true:(c.split(/[\\/]/).filter(Boolean).at(-1)??"").includes("."):false:false}var nF=d(()=>{re();ai();s(qz,"markdownBracketLabelDuplicatesDestination");s(eF,"isMarkdownReferenceDefinitionDestination");s(rF,"getTokenContext");s(oF,"shouldRewritePathToken");});function Cd(t){let e=new Set,r=Sd(t.content);return {content:t.content.replace(jN,(n,i,a)=>{if(r.some(([Ut,wt])=>i>=Ut&&i<wt)||!oF(a,i,i+n.length,n,t.rewriteBarePathTokens===true)||ZN(a,i,n)||UN(a,i,i+n.length))return n;let{candidate:c,suffix:l}=Ka(n);if(!c)return n;let m=Xc.exec(c),p=m?c.slice(0,m.index):c,u=m?m[0]:"";if(!p)return n;let g=rF(a,i,i+p.length);if(g.role!=="markdown-link-dest"&&xr.test(p))return n;let{translatedPath:f,resolvedBeforeTranslate:h,matchedPath:O}=YN({candidate:p,rawToken:c,projectRoot:t.projectRoot,sourceFile:t.sourceFile,destinationFile:t.destinationFile,translatePath:t.translatePath,pathExists:t.pathExists}),R=h;if(!O||!f)return f&&e.add(f),n;let S=Pt(p),A=p.endsWith("/")||t.pathIsDirectory?.(f)===true;if(A&&!S.includes("/")&&!S.includes("\\"))return n;if(R===null){let Ut=Pt(c);if(Ut.startsWith("agentsmesh/")&&(Ut=`.${Ut}`),Ut.startsWith(".agentsmesh/")||Ut.includes("/.agentsmesh/")){let wt=et(t.projectRoot),pn=V(t.projectRoot,t.projectRoot),kr=Ut.replace(/^\.\//,"");R=V(t.projectRoot,wt.join(pn,kr));}}let D=et(t.projectRoot);if(t.scope==="global"){let Ut=Pt(c),wt=Ut.startsWith(".agentsmesh/")||Ut.includes("/.agentsmesh/"),pn=io(Ut)||qN(Ut),kr=R!==null&&ao(t.projectRoot,R),hs=ao(t.projectRoot,f);if(R===f&&!hs&&!kr&&!wt){let _R=Pt(D.relative(t.projectRoot,V(t.projectRoot,t.sourceFile))).split("/").filter(Boolean)[0]??"",o$=(R!==null?Pt(D.relative(t.projectRoot,R)):"").split("/").filter(Boolean)[0]??"";if(_R.length>0&&_R===o$)return n}if(!pn&&!wt&&!kr&&!hs)return n}let N=V(t.projectRoot,t.destinationFile),G=V(t.projectRoot,f),J=Pt(D.relative(t.projectRoot,N)),X=Pt(D.relative(t.projectRoot,G)),q=J.split("/").filter(Boolean)[0]??"",Ft=X.split("/").filter(Boolean)[0]??"",Ht=!Pt(p).startsWith(".agentsmesh/")&&!A&&q.length>0&&q===Ft&&q.startsWith(".")&&q!==".agentsmesh"||g.role==="markdown-link-dest"||QN(a,i,p),lo=HN(t.projectRoot,t.destinationFile,f,p.endsWith("/"),{explicitCurrentDirLinks:t.explicitCurrentDirLinks===true||Ht,scope:t.scope??"project",pathIsDirectory:t.pathIsDirectory,logicalMeshSourceAbsolute:A?null:R,forceRelative:Ht,tokenContext:g,originalToken:p});return lo?`${lo}${u}${l}`:n}),missing:[...e]}}var x_=d(()=>{re();ai();zN();XN();tF();nF();s(Cd,"rewriteFileLinks");});function iF(t,e){let r=[t.normalize(e)];if(!existsSync(e))return r;try{let o=[realpathSync(e),realpathSync.native(e)];for(let n of o){let i=t.normalize(n);r.includes(i)||r.push(i);}}catch{}return r}async function U(t,e,r="project"){let o=et(e),n=new Map,i=Array.from(new Set([t,...kt]));for(let l of i){let m=await FN(l,e,r);for(let[p,u]of m.entries())n.set(p,u);}let a=new Map;for(let[l,m]of n.entries()){let p=o.normalize(o.join(e,m));for(let u of iF(o,o.join(e,l)))a.set(u,p);}let c=new Set;for(let l of new Set(n.values())){let m=o.normalize(o.join(e,l));c.add(m);for(let p of iF(o,m))c.add(o.normalize(p));}return (l,m,p)=>Cd({content:l,projectRoot:e,sourceFile:m,destinationFile:p,translatePath:s(u=>a.get(u)??u,"translatePath"),pathExists:s(u=>{let g=o.normalize(u);return a.has(u)||a.has(g)||existsSync(u)||c.has(g)},"pathExists"),explicitCurrentDirLinks:false,rewriteBarePathTokens:true,scope:r,pathIsDirectory:s(u=>{try{return statSync(u).isDirectory()}catch{return false}},"pathIsDirectory")}).content}var mt=d(()=>{re();vN();x_();uo();s(iF,"pathVariants");s(U,"createImportReferenceNormalizer");});function cF(t){let e={};for(let[r,o]of Object.entries(t)){if(!Array.isArray(o))continue;let n=[];for(let i of o){if(!i||typeof i!="object")continue;let a=i,c=typeof a.matcher=="string"?a.matcher:"";if(!c)continue;let l=Array.isArray(a.hooks)?a.hooks:[];for(let m of l){let p=m.type==="prompt"?"prompt":"command";if(!go({...m,type:p}))continue;let u=p==="prompt"?me(m)||Kt(m):Kt(m)||me(m),g={matcher:c,type:p,command:u};typeof m.timeout=="number"&&(g.timeout=m.timeout),n.push(g);}}n.length>0&&(e[r]=n);}return e}async function lF(t,e){let r=join(t,wn),o=await y(r);if(o===null)return false;let n;try{n=JSON.parse(o);}catch{return false}if(!n||typeof n!="object"||Array.isArray(n))return false;let i=cF(n);if(Object.keys(i).length===0)return false;let a=stringify(i),c=join(t,bi);return await L(dirname(c)),await _(c,a),e.push({fromTool:"claude-code",fromPath:r,toPath:bi,feature:"hooks"}),true}async function mF(t,e){let r=e.some(m=>m.feature==="hooks"&&m.fromPath.replace(/\\/g,"/").endsWith(wn)),o=join(t,$l),n=await y(o);if(!n)return;let i;try{i=JSON.parse(n);}catch{return}if(!e.some(m=>m.feature==="mcp")&&i.mcpServers&&typeof i.mcpServers=="object"){let m=i.mcpServers;await $t(t,Bl,m),e.push({fromTool:"claude-code",fromPath:o,toPath:Bl,feature:"mcp"});}let c=i.permissions;if(c&&typeof c=="object"&&!Array.isArray(c)){let m=c,p=Array.isArray(m.allow)?m.allow.filter(f=>typeof f=="string"):[],u=Array.isArray(m.deny)?m.deny.filter(f=>typeof f=="string"):[],g=Array.isArray(m.ask)?m.ask.filter(f=>typeof f=="string"):[];if(p.length>0||u.length>0||g.length>0){let f=stringify({allow:p,deny:u,ask:g}),h=join(t,hf);await L(dirname(h)),await _(h,f),e.push({fromTool:"claude-code",fromPath:o,toPath:hf,feature:"permissions"});}}let l=i.hooks;if(!r&&l&&typeof l=="object"&&!Array.isArray(l)){let m=cF(l);if(Object.keys(m).length>0){let p=stringify(m),u=join(t,bi);await L(dirname(u)),await _(u,p),e.push({fromTool:"claude-code",fromPath:o,toPath:bi,feature:"hooks"});}}}var pF=d(()=>{Pr();T();Fr();Tn();s(cF,"claudeHooksToCanonical");s(lF,"importClaudeHooksJson");s(mF,"importSettings");});async function dF(t,e,r){let o=join(t,Ml),n=join(t,ff),a=(await v(o)).filter(c=>c.endsWith("SKILL.md"));for(let c of a){let l=dirname(c),m=basename(l),p=join(n,m),u=await v(l);for(let g of u){let f=await y(g);if(f===null)continue;let h=relative(l,g),O=join(p,h);await L(dirname(O));let R=r(f,g,O),S=h==="SKILL.md"?k(R):null;await _(O,h==="SKILL.md"?await ho(O,S?.frontmatter??{},S?.body??""):R);let A=`${ff}/${m}/${h}`;e.push({fromTool:"claude-code",fromPath:g,toPath:A,feature:"skills"});}}}var gF=d(()=>{T();M();lt();Tn();s(dF,"importClaudeSkills");});async function ru(t,e={}){let r=e.scope??"project",o=[],n=await U("claude-code",t,r);return o.push(...await z(eu,t,r,{normalize:n})),await dF(t,o,n),await lF(t,o),await mF(t,o),o}var dh=d(()=>{mt();Ct();pF();gF();uh();s(ru,"importFromClaudeCode");});async function wm(t,e){let r=oV[e];if(!r)throw new Error(`No importer registered for native target: ${e}`);return r(t)}var oV,F_=d(()=>{dh();ay();Bh();Ty();Fh();y_();Ih();vh();Dy();Ky();$y();oV={"claude-code":ru,cursor:xu,copilot:Ru,"gemini-cli":Bu,"codex-cli":pu,windsurf:gd,cline:iu,continue:du,junie:Vu,kiro:qu,"kilo-code":Zu};s(wm,"importNativeToCanonical");});async function Ea(t){if(!await j(t))return false;if(await j(join(t,G_)))return true;try{let e=await readdir(t,{withFileTypes:!0});for(let r of e)if(!(!r.isDirectory()||r.name.startsWith("."))&&await j(join(t,r.name,G_)))return !0}catch{return false}return false}async function Tm(t){if(!await j(t))return [];if(await j(join(t,G_))){let e=await RS(t);return e?[e]:[]}return ja(t)}var G_,Od=d(()=>{T();pp();G_="SKILL.md";s(Ea,"isSkillPackLayout");s(Tm,"loadSkillsAtExtendPath");});function aV(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}function cV(t){return t.rules.length===0&&t.commands.length===0&&t.agents.length===0&&t.skills.length===0&&t.mcp===null&&t.permissions===null&&t.hooks===null&&t.ignore.length===0}async function Ld(t){if(!await j(t))throw new Error(`Path does not exist: ${t}`);let e=await stat(t);if(e.isDirectory())return {sliceRoot:t};if(!e.isFile()||!t.toLowerCase().endsWith(".md"))throw new Error(`Install path must be a directory or a .md file inside rules/, commands/, or agents/: ${t}`);let r=dirname(t),o=basename(r),i=basename(t).replace(/\.md$/i,"");if(o==="rules")return {sliceRoot:r,implicitPick:{rules:[i]}};if(o==="commands")return {sliceRoot:r,implicitPick:{commands:[i]}};if(o==="agents")return {sliceRoot:r,implicitPick:{agents:[i]}};throw new Error(`Single-file install only supports .md files under rules/, commands/, or agents/. Got: ${t}`)}async function lV(t){if(basename(t)==="rules")return hi(t);let r=join(t,"rules");return await j(r)?hi(r):[]}async function mV(t){if(basename(t)==="commands")return yi(t);let r=join(t,"commands");return await j(r)?yi(r):[]}async function pV(t){if(basename(t)==="agents")return Ii(t);let r=join(t,"agents");return await j(r)?Ii(r):[]}async function uV(t){if(await Ea(t))return Tm(t);let e=join(t,"skills");return await Ea(e)?Tm(e):[]}async function Ad(t){let e=join(t,".agentsmesh");if(await j(e))return Ae(t);let r=aV();if(r.rules=await lV(t),r.commands=await mV(t),r.agents=await pV(t),r.skills=await uV(t),cV(r))throw new Error(`No installable resources at ${t}. Expected .agentsmesh/, or rules/, commands/, agents/, or Anthropic-style skills (SKILL.md).`);return r}var M_=d(()=>{T();lp();Ri();cp();ap();Od();s(aV,"emptyCanonical");s(cV,"isCanonicalSliceEmpty");s(Ld,"normalizeSlicePath");s(lV,"parseRulesAt");s(mV,"parseCommandsAt");s(pV,"parseAgentsAt");s(uV,"loadSkillsForPartialSlice");s(Ad,"loadCanonicalSliceAtPath");});function dV(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function fF(t){let e=t.resolvedPath;if(!t.path){let n=join(e,".agentsmesh");if(!await j(n)){if(await Ea(e)){let a=await Tm(e);return {...dV(),skills:a}}let i=t.target??await fp(e);if(!i)throw new Error(`Extend "${t.name}": No supported agent configuration found in ${e}.
142
- Expected one of: .agentsmesh/, ${LS.join(", ")}.`);I.info(`[agentsmesh] Extend "${t.name}": ${t.target?"specified":"detected"} ${i} format, importing to .agentsmesh/...`),await wm(e,i);}return Ae(e)}let r=join(e,t.path);if(!await j(r))throw new Error(`Extend "${t.name}": path does not exist: ${r}`);if(t.target){let n=join(e,".agentsmesh");return await j(n)||(I.info(`[agentsmesh] Extend "${t.name}": path "${t.path}" with target "${t.target}" \u2014 importing at extend root, then loading canonical.`),await wm(e,t.target)),Ae(e)}let{sliceRoot:o}=await Ld(r);try{return await Ad(o)}catch(n){let i=n instanceof Error?n.message:String(n),a=new Error(`Extend "${t.name}": ${i}`);throw n instanceof Error&&(a.cause=n),a}}var hF=d(()=>{jg();T();ft();Ri();F_();Od();M_();s(dV,"emptyCanonical");s(fF,"loadCanonicalForExtend");});function kd(t,e,r,o){if(!r)return t;let n={...t};if(r.skills?.length&&e.includes("skills")){let i=new Set(r.skills),a=n.skills;n={...n,skills:a.filter(c=>i.has(c.name))};for(let c of r.skills)a.some(l=>l.name===c)||I.warn(`[agentsmesh] pick name "${c}" not found in skills from extend "${o}".`);}if(r.commands?.length&&e.includes("commands")){let i=new Set(r.commands),a=n.commands;n={...n,commands:a.filter(c=>i.has(c.name))};for(let c of r.commands)a.some(l=>l.name===c)||I.warn(`[agentsmesh] pick name "${c}" not found in commands from extend "${o}".`);}if(r.agents?.length&&e.includes("agents")){let i=new Set(r.agents),a=n.agents;n={...n,agents:a.filter(c=>i.has(c.name))};for(let c of r.agents)a.some(l=>l.name===c)||I.warn(`[agentsmesh] pick name "${c}" not found in agents from extend "${o}".`);}if(r.rules?.length&&e.includes("rules")){let i=new Set(r.rules),a=n.rules,c=s(l=>basename(l).replace(/\.md$/i,""),"stem");n={...n,rules:a.filter(l=>i.has(c(l.source)))};for(let l of r.rules)a.some(m=>c(m.source)===l)||I.warn(`[agentsmesh] pick name "${l}" not found in rules from extend "${o}".`);}return n}var j_=d(()=>{ft();s(kd,"applyExtendPick");});var hV,Qc,wd=d(()=>{hV=["rules","commands","agents","skills"],Qc=z$1.enum(hV);});var yV,yF,_F=d(()=>{gn();wd();yV=z$1.enum(["github","gitlab","git","local"]),yF=z$1.object({name:z$1.string().min(1),source:z$1.string().min(1),version:z$1.string().optional(),source_kind:yV,installed_at:z$1.string(),updated_at:z$1.string(),features:z$1.array(va).min(1),pick:hl.optional(),target:ze.optional(),path:z$1.string().optional(),paths:z$1.array(z$1.string().min(1)).min(1).optional(),as:Qc.optional(),content_hash:z$1.string()});});function IF(t){let e=fi(t);return e?e.kind==="github"?`github:${e.org}/${e.repo}`:e.kind==="gitlab"?`gitlab:${e.namespace}/${e.project}`:`git+${e.url}`:t.trim()}function IV(t,e){return e?t.length===e.length&&[...t].sort().every((r,o)=>r===[...e].sort()[o]):true}async function Td(t){let e=join(t,"pack.yaml"),r=await y(e);if(r===null)return null;try{let o=parse(r);return yF.parse(o)}catch{return null}}async function SF(t,e,r){if(!await j(t))return null;let o=IF(e),n;try{n=await readdir(t,{withFileTypes:!0});}catch{return null}for(let i of n){if(!i.isDirectory())continue;let a=join(t,i.name),c=await Td(a);if(c&&IF(c.source)===o&&c.target===r.target&&c.as===r.as&&IV(c.features,r.features))return {meta:c,packDir:a,name:c.name}}return null}async function bd(t){if(!await j(t))return [];let e;try{e=await readdir(t,{withFileTypes:!0});}catch{return []}let r=[];for(let o of e){if(!o.isDirectory())continue;let n=join(t,o.name),i=await Td(n);i&&r.push({meta:i,packDir:n,name:i.name});}return r}var Pd=d(()=>{T();_F();Il();s(IF,"sourceIdentity");s(IV,"sameFeatures");s(Td,"readPackMetadata");s(SF,"findExistingPack");s(bd,"listPacks");});function CF(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function RV(t){let[e,r,o,n,i,a,c,l]=await Promise.all([hi(join(t,"rules")),yi(join(t,"commands")),Ii(join(t,"agents")),ja(join(t,"skills")),br(join(t,"mcp.json")),up(join(t,"permissions.yaml")),dp(join(t,"hooks.yaml")),gp(join(t,"ignore"))]);return {...CF(),rules:e,commands:r,agents:o,skills:n,mcp:i,permissions:a,hooks:c,ignore:l}}async function EF(t){let e=join(t,"packs"),r=await bd(e),o=CF();for(let{meta:n,packDir:i}of r){let a=await RV(i),c=K_(a,n.features),l=kd(c,n.features,n.pick,n.name);o=Ua(o,l);}return o}var OF=d(()=>{ap();cp();lp();pp();Cl();Ng();vg();Gg();$g();ln();j_();Pd();s(CF,"emptyCanonical");s(RV,"loadPackCanonical");s(EF,"loadPacksCanonical");});function K_(t,e){if(e.length===0)return LF();let r=new Set(e.flatMap(o=>CV[o]??[]));return {rules:r.has("rules")?t.rules:[],commands:r.has("commands")?t.commands:[],agents:r.has("agents")?t.agents:[],skills:r.has("skills")?t.skills:[],mcp:r.has("mcp")?t.mcp:null,permissions:r.has("permissions")?t.permissions:null,hooks:r.has("hooks")?t.hooks:null,ignore:r.has("ignore")?t.ignore:[]}}function LF(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function he(t,e,r={},o=join(e,".agentsmesh")){let n=await $a(t,e,{refreshCache:r.refreshRemoteCache===true}),i=LF();for(let l of n){let m=await fF(l),p=K_(m,l.features),u=kd(p,l.features,l.pick,l.name);i=Ua(i,u);}let a=await EF(o);i=Ua(i,a);let c=await Ae(o);return i=Ua(i,c),{canonical:i,resolvedExtends:n}}var CV,ln=d(()=>{np();Ri();$g();hF();j_();OF();CV={rules:["rules"],commands:["commands"],agents:["agents"],skills:["skills"],mcp:["mcp"],permissions:["permissions"],hooks:["hooks"],ignore:["ignore"]};s(K_,"filterCanonicalByFeatures");s(LF,"emptyCanonical");s(he,"loadCanonicalWithExtends");});function pJ(t,e){let r=join(e,"node_modules",t),o=join(r,"package.json");if(!existsSync(o))throw new Error(`Cannot find package '${t}' in ${join(e,"node_modules")}`);let n=JSON.parse(readFileSync(o,"utf-8")),i=(typeof n.exports=="string"?n.exports:null)??(typeof n.main=="string"?n.main:null)??"index.js",a=resolve(r,i);if(!existsSync(a))throw new Error(`Package '${t}' entry '${i}' does not exist at ${a}`);return a}function uJ(t){return t.startsWith("file:")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)}async function dJ(t,e){let{source:r}=t,o;if(uJ(r)){let i=r.startsWith("file:")?fileURLToPath(r):r,a=resolve(e,i);o=pathToFileURL(a).href;}else {let i=pJ(r,e);o=pathToFileURL(i).href;}return await import(o)}function gJ(t){return "descriptor"in t?[t.descriptor]:"descriptors"in t&&Array.isArray(t.descriptors)?t.descriptors:"default"in t?[t.default]:[]}async function jd(t,e){let r;try{r=await dJ(t,e);}catch(i){throw new Error(`Plugin '${t.source}' failed to import: ${i instanceof Error?i.message:String(i)}`,{cause:i})}let o=gJ(r),n=[];for(let i of o)try{let a=yd(i);_d(a),n.push(a);}catch(a){throw new Error(`Plugin '${t.source}' exported an invalid descriptor: ${a instanceof Error?a.message:String(a)}`,{cause:a})}return {entry:t,descriptors:n}}async function ev(t,e){let r=[],o=process.env.AGENTSMESH_STRICT_PLUGINS==="1"||process.env.AGENTSMESH_STRICT_PLUGINS==="true",i=(await Promise.all(t.map(async a=>{try{let c=await jd(a,e);return r.push(c),null}catch(c){let l=`Plugin '${a.source}' failed to load: ${c instanceof Error?c.message:String(c)}`;return a.strict===true||o?new Error(l):(I.warn(l),null)}}))).filter(a=>a!==null);if(i.length>0){let a=i.map(c=>` - ${c.message}`).join(`
139
+ ${f}`:u,h={};p&&(h.description=p),typeof l.name=="string"&&l.name.length>0&&(h.name=l.name);let R=await Vt(m,h,g),C=r(R,n,m);await I(m,C),e.push({feature:"agents",fromTool:_e,fromPath:n,toPath:`${ra}/${c}.md`});}}async function yD(t,e={}){let r=e.scope??"project",n=[],o=await B(_e,t,r);return n.push(...await J(Ed,t,r,{normalize:o})),await q(t,Qr,_e,n,o),r==="project"&&(await T1(t,n,o),await x1(t,n,o),await D1(t,n,o),await q(t,Qi,_e,n,o)),n}var w_,b_,_D=d(()=>{dt();tt();xe();Et();w();ut();j();A_();na();P_();w_=`${Ws}/_root.md`,b_="00-root.md";s(hD,"pathExists");s(T1,"importLegacyRules");s(x1,"importLegacyWorkflows");s(D1,"importLegacyModes");s(yD,"importFromKiloCode");});function RD(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:_e}))}var ID=d(()=>{It();na();s(RD,"lintRules");});function SD(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","kilo-code","kilo-code does not support user-defined lifecycle hooks; canonical hooks are not projected.")]:[]:[]}function CD(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","kilo-code","kilo-code permissions live in kilo.jsonc, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}var kD=d(()=>{Lt();s(SD,"lintHooks");s(CD,"lintPermissions");});var N1,F1,v1,ED,Ed,P_=d(()=>{fD();na();ee();_D();A_();ID();kD();Ct();N1={name:_e,primaryRootInstructionPath:Wn,generateRules:lD,generateCommands:cD,generateAgents:mD,generateSkills:dD,generateMcp:pD,generateIgnore:uD,importFrom:yD},F1={rootInstructionPath:Wn,skillDir:Qr,managedOutputs:{dirs:[Vo,Jo,Yo,Qr],files:[Wn,Us,Al]},paths:{rulePath(t,e){return `${Vo}/${t}.md`},commandPath(t,e){return `${Jo}/${t}.md`},agentPath(t,e){return `${Yo}/${t}.md`}}},v1={rootInstructionPath:Bs,skillDir:Ks,managedOutputs:{dirs:[qi,ta,ea,Ks,HE],files:[Bs,Pl,wu]},rewriteGeneratedPath(t){return t===Wn?Bs:t},mirrorGlobalPath(t,e){return pt(t,Ks,e)},paths:{rulePath(t,e){return `${qi}/${t}.md`},commandPath(t,e){return `${ta}/${t}.md`},agentPath(t,e){return `${ea}/${t}.md`}}},ED={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Ed={id:_e,metadata:{displayName:"Kilo Code",category:"ide",officialUrl:"https://kilocode.ai",shortDescription:"Open-source AI coding agent for VS Code"},generators:N1,capabilities:ED,emptyImportMessage:"No Kilo Code config found (AGENTS.md, .kilo/rules, .kilo/commands, .kilo/agents, .kilo/skills, .kilo/mcp.json, .kilocodeignore, .kilocode/, or .kilocodemodes).",lintRules:RD,lint:{hooks:SD,permissions:CD},project:F1,globalSupport:{capabilities:ED,detectionPaths:[Bs,qi,ta,ea,Ks,Pl,wu],layout:v1},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Wn],global:[Bs]},canonicalDir:Ws,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Vo],global:[qi]},canonicalDir:Ws,extensions:[".md"],map:Cd}],commands:{feature:"commands",mode:"directory",source:{project:[Jo],global:[ta]},canonicalDir:Tl,extensions:[".md"],map:kd},agents:{feature:"agents",mode:"directory",source:{project:[Yo],global:[ea]},canonicalDir:ra,extensions:[".md"],map:gD},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Us,Am],global:[Pl]},canonicalDir:".agentsmesh",canonicalFilename:zE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Al],global:[wu]},canonicalDir:".agentsmesh",canonicalFilename:VE}},buildImportPaths:Gh,detectionPaths:[Vo,Jo,Yo,Qr,Us,Zi,wl,Qi,Am,Au,Al,"kilo.jsonc","kilo.json"]};});function LD(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function G1(t){return t.type==="prompt"?t.prompt:t.command}function j1(t,e){let r=OD[t];return t==="PreToolUse"||t==="PostToolUse"?{type:r,tools:[e||"*"]}:{type:r}}function AD(t){let e=[];for(let[r,n]of Object.entries(t)){let o=r;if(!(o in OD)||!Array.isArray(n))continue;let i=1;for(let a of n){let l=G1(a);if(!l)continue;let c={name:`${LD(r)} ${i}`,version:"1",when:j1(o,a.matcher),then:a.type==="prompt"?{type:"askAgent",prompt:l}:{type:"shellCommand",command:l}};e.push({name:`${LD(r)}-${i}.kiro.hook`,content:JSON.stringify(c,null,2)}),i+=1;}}return e}function U1(t){let e=$1.get(t.when.type);if(!e)return null;let r=t.when.tools?.[0]??t.when.patterns?.[0]??"*";return t.then.type==="askAgent"&&typeof t.then.prompt=="string"?{event:e,entry:{matcher:r,command:t.then.prompt,prompt:t.then.prompt,type:"prompt"}}:t.then.type==="shellCommand"&&typeof t.then.command=="string"?{event:e,entry:{matcher:r,command:t.then.command,type:"command"}}:null}function wD(t){let e;try{e=JSON.parse(t);}catch{return null}if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return !r.when||!r.then||typeof r.when.type!="string"?null:U1(r)}function bD(t){return stringify(t).trimEnd()}var OD,$1,T_=d(()=>{OD={UserPromptSubmit:"promptSubmit",SubagentStop:"agentStop",PreToolUse:"preToolUse",PostToolUse:"postToolUse"},$1=new Map([["promptSubmit","UserPromptSubmit"],["agentStop","SubagentStop"],["preToolUse","PreToolUse"],["postToolUse","PostToolUse"]]);s(LD,"toKebab");s(G1,"hookText");s(j1,"toWhen");s(AD,"generateKiroHooks");s(U1,"toCanonicalEntry");s(wD,"parseKiroHookFile");s(bD,"serializeCanonicalHooks");});function K1(t){let e={};return t.globs.length>0?(e.inclusion="fileMatch",e.fileMatchPattern=t.globs.length===1?t.globs[0]:t.globs):t.trigger==="manual"?e.inclusion="manual":t.trigger==="model_decision"?e.inclusion="auto":e.inclusion="always",t.description&&(e.description=t.description),e}function PD(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:qr,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(Ge))continue;let o=basename(n.source,".md");e.push({path:`${tn}/${o}.md`,content:T(K1(n),n.body.trim()||"")});}return e}function TD(t){return t.commands.map(e=>({path:`${Re}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function xD(t){return rt(t,Re)}function DD(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:xl,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function ND(t){return !t.hooks||Object.keys(t.hooks).length===0?[]:AD(t.hooks).map(e=>({path:`${Hs}/${e.name}`,content:e.content}))}function FD(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0,model:e.model||void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=T(r,e.body.trim()||"");return {path:`${en}/${e.name}.md`,content:n}})}function vD(t){return t.ignore.length===0?[]:[{path:Dl,content:t.ignore.join(`
140
+ `)}]}var MD=d(()=>{tt();kt();j();T_();Nl();s(K1,"steeringFrontmatter");s(PD,"generateRules");s(TD,"generateCommands");s(xD,"generateSkills");s(DD,"generateMcp");s(ND,"generateHooks");s(FD,"generateAgents");s(vD,"generateIgnore");});function H1(t){let e=typeof t.inclusion=="string"?t.inclusion:"",r={root:false,description:typeof t.description=="string"?t.description:void 0,globs:wo(t.fileMatchPattern)};return e==="manual"&&(r.trigger="manual"),e==="auto"&&(r.trigger="model_decision"),e==="fileMatch"&&(r.trigger="glob"),r}async function z1(t,e,r,n){let o=n==="global"?[rn,qr]:[qr,rn];for(let i of o){let a=join(t,i),l=await _(a);if(l===null)continue;let c=join(t,jh),{frontmatter:m,body:p}=b(r(l,a,c));await I(c,await K(c,{...m,root:true},p)),e.push({fromTool:Ge,fromPath:a,toPath:jh,feature:"rules"});return}}async function V1(t,e,r){let n=join(t,Uh);e.push(...await Rt({srcDir:join(t,tn),destDir:n,extensions:[".md"],fromTool:Ge,normalize:r,mapEntry:s(async({relativePath:o,normalizeTo:i})=>{if(basename(o)==="AGENTS.md")return null;let a=join(n,o),{frontmatter:l,body:c}=b(i(a));return {destPath:a,toPath:`${Uh}/${o}`,feature:"rules",content:await K(a,H1(l),c)}},"mapEntry")}));}async function J1(t,e){let r={};for(let o of await v(join(t,Hs))){if(!o.endsWith(".kiro.hook"))continue;let i=wD(await _(o)??"");i&&(r[i.event]??=[],r[i.event].push(i.entry));}if(Object.keys(r).length===0)return;let n=join(t,Bh);await O(join(t,".agentsmesh")),await I(n,bD(r)),e.push({fromTool:Ge,fromPath:join(t,Hs),toPath:Bh,feature:"hooks"});}async function $D(t,e={}){let r=e.scope??"project",n=[],o=await B(Ge,t,r);return await z1(t,n,o,r),await V1(t,n,o),n.push(...await J(Ld,t,r,{normalize:o})),await q(t,Re,Ge,n,o),r==="project"&&await J1(t,n),n}var GD=d(()=>{dt();tt();xe();Et();ut();or();w();j();T_();Nl();x_();s(H1,"canonicalRuleMeta");s(z1,"importRoot");s(V1,"importNonRootRules");s(J1,"importHooks");s($D,"importFromKiro");});function jD(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Ge}))}var UD=d(()=>{It();Nl();s(jD,"lintRules");});function BD(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=["PreToolUse","PostToolUse","UserPromptSubmit","SubagentStop"],r=new Set(e);return Object.keys(t.hooks).filter(n=>!r.has(n)).map(n=>Ps(n,"kiro",e,{unsupportedBy:"Kiro hooks"}))}var KD=d(()=>{Lt();s(BD,"lintHooks");});var Y1,X1,Z1,Q1,Ld,x_=d(()=>{kt();MD();ee();GD();UD();KD();Ct();Nl();Y1={name:Ge,primaryRootInstructionPath:qr,generateRules:PD,generateCommands:TD,generateAgents:FD,generateSkills:xD,generateMcp:DD,generateHooks:ND,generateIgnore:vD,importFrom:$D},X1={rootInstructionPath:qr,skillDir:Re,managedOutputs:{dirs:[".kiro/hooks",".kiro/skills",".kiro/steering",".kiro/agents"],files:["AGENTS.md",".kiro/settings/mcp.json",".kiroignore"]},paths:{rulePath(t,e){return `${tn}/${t}.md`},commandPath(t){return `${Re}/${H(t)}/SKILL.md`},agentPath(t,e){return `${en}/${t}.md`}}},Z1={rootInstructionPath:rn,skillDir:zs,managedOutputs:{dirs:[oa,zs,sa,YE],files:[rn,bm,Pm]},rewriteGeneratedPath(t){return t===qr?rn:t.startsWith(`${tn}/`)?t.replace(`${tn}/`,`${oa}/`):t.startsWith(`${Re}/`)?t.replace(`${Re}/`,`${zs}/`):t.startsWith(`${en}/`)?t.replace(`${en}/`,`${sa}/`):t===xl?bm:t===Dl?Pm:t.startsWith(`${Hs}/`)?null:t},mirrorGlobalPath(t,e){return pt(t,".kiro/skills",e)},paths:{rulePath(t,e){return `${oa}/${t}.md`},commandPath(t){return `${Re}/${H(t)}/SKILL.md`},agentPath(t,e){return `${sa}/${t}.md`}}},Q1={rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Ld={id:Ge,metadata:{displayName:"Kiro",category:"ide",officialUrl:"https://kiro.dev",shortDescription:"AWS spec-driven AI IDE"},generators:Y1,capabilities:{rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Kiro config found (AGENTS.md, .kiro/steering, .kiro/skills, .kiro/agents, .kiro/hooks, .kiro/settings/mcp.json, or .kiroignore).",supportsConversion:{commands:true},lintRules:jD,lint:{hooks:BD},project:X1,globalSupport:{capabilities:Q1,detectionPaths:[oa,rn,zs,sa,bm,Pm],layout:Z1},importer:{agents:{feature:"agents",mode:"directory",source:{project:[en],global:[en]},canonicalDir:XE,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[xl],global:[bm]},canonicalDir:".agentsmesh",canonicalFilename:ZE},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Dl],global:[Pm]},canonicalDir:".agentsmesh",canonicalFilename:QE}},buildImportPaths:Kh,detectionPaths:[tn,Re,en,Hs,xl,Dl],conversionDefaults:{commandsToSkills:true}};});function HD(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Hn,content:r.body.trim()?r.body:""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(nn))continue;let o=basename(n.source,".md"),i={};n.description&&(i.description=n.description),n.globs.length>0&&(i.globs=n.globs);let a=Object.keys(i).length>0?T(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${Xo}/${o}.md`,content:a});}return e}function zD(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Zo}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function VD(t){return t.agents.map(e=>{let r=basename(e.source,".md"),n={mode:"subagent"};return e.description&&(n.description=e.description),e.model&&(n.model=e.model),e.tools.length>0&&(n.tools=e.tools),e.disallowedTools.length>0&&(n.disallowedTools=e.disallowedTools),{path:`${Qo}/${r}.md`,content:T(n,e.body.trim()||"")}})}function q1(t){if("url"in t){let r={type:"remote",url:t.url};return Object.keys(t.headers).length>0&&(r.headers=t.headers),t.description&&(r.description=t.description),r}let e={type:"local",command:[t.command,...t.args]};return Object.keys(t.env).length>0&&(e.environment=t.env),t.description&&(e.description=t.description),e}function JD(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e={};for(let[r,n]of Object.entries(t.mcp.mcpServers))e[r]=q1(n);return [{path:zn,content:JSON.stringify({mcp:e},null,2)}]}function YD(t){return rt(t,on)}var XD=d(()=>{tt();j();ca();s(HD,"generateRules");s(zD,"generateCommands");s(VD,"generateAgents");s(q1,"toOpenCodeMcpServer");s(JD,"generateMcp");s(YD,"generateSkills");});function D_(t){if(!t||typeof t!="object"||Array.isArray(t))return {};let e={};for(let[r,n]of Object.entries(t))typeof n=="string"&&(e[r]=n);return e}function eJ(t){let e;try{e=JSON.parse(t);}catch{return {}}if(!e||typeof e!="object"||Array.isArray(e))return {};let r=e.mcp;if(!r||typeof r!="object"||Array.isArray(r))return {};let n={};for(let[o,i]of Object.entries(r)){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i;if(typeof a.url=="string"){n[o]={type:"url",url:a.url,headers:D_(a.headers),env:D_(a.environment),...typeof a.description=="string"?{description:a.description}:{}};continue}if(Array.isArray(a.command)&&a.command.length>0){let l=a.command,c=l[0];if(c===void 0)continue;let m=l.slice(1);n[o]={type:"stdio",command:c,args:m,env:D_(a.environment),...typeof a.description=="string"?{description:a.description}:{}};}}return n}async function rJ(t,e,r){let o=join(t,e==="global"?Ys:zn),i=await _(o);if(i===null)return;let a=eJ(i);Object.keys(a).length!==0&&(await Bt(t,Wh,a),r.push({feature:"mcp",fromTool:nn,fromPath:o,toPath:Wh}));}async function ZD(t,e={}){let r=e.scope??"project",n=[],o=await B(nn,t,r);return n.push(...await J(Od,t,r,{normalize:o})),await q(t,on,nn,n,o),await rJ(t,r,n),n}var QD=d(()=>{dt();tt();Et();Kr();w();ca();N_();s(D_,"toStringRecord");s(eJ,"parseOpenCodeMcp");s(rJ,"importMcp");s(ZD,"importFromOpenCode");});var qD,tN,eN,rN=d(()=>{j();ut();ca();qD=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Tm}/${t}`,content:await K(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"opencodeNonRootRuleMapper"),tN=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Pu}/${t}`,content:await _t(n,{hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"opencodeCommandMapper"),eN=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Tu}/${t}`,content:await Vt(n,o,i)}},"opencodeAgentMapper");});function nN(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:nn}))}var oN=d(()=>{It();ca();s(nN,"lintRules");});function sN(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","opencode","opencode hooks are plugin-based (TypeScript/JavaScript); canonical config hooks are not projected.")]:[]:[]}function iN(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","opencode","opencode permissions live in opencode.json, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}function aN(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","opencode","opencode has no dedicated ignore file; canonical ignore patterns are not projected. Configure watcher.ignore in opencode.json manually.")]}var lN=d(()=>{Lt();s(sN,"lintHooks");s(iN,"lintPermissions");s(aN,"lintIgnore");});var nJ,oJ,sJ,cN,Od,N_=d(()=>{XD();ca();ee();QD();rN();oN();lN();Ct();nJ={name:nn,primaryRootInstructionPath:Hn,generateRules:HD,generateCommands:zD,generateAgents:VD,generateSkills:YD,generateMcp:JD,importFrom:ZD},oJ={rootInstructionPath:Hn,skillDir:on,managedOutputs:{dirs:[Xo,Zo,Qo,on],files:[Hn,zn]},paths:{rulePath(t){return `${Xo}/${t}.md`},commandPath(t){return `${Zo}/${t}.md`},agentPath(t){return `${Qo}/${t}.md`}}},sJ={rootInstructionPath:Vs,skillDir:Js,managedOutputs:{dirs:[ia,aa,la,Js,tL],files:[Vs,Ys]},rewriteGeneratedPath(t){return t===Hn?Vs:t===zn?Ys:t},mirrorGlobalPath(t,e){return pt(t,Js,e)},paths:{rulePath(t){return `${ia}/${t}.md`},commandPath(t){return `${aa}/${t}.md`},agentPath(t){return `${la}/${t}.md`}}},cN={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Od={id:nn,metadata:{displayName:"OpenCode",category:"cli",officialUrl:"https://opencode.ai",shortDescription:"Open-source terminal AI agent"},generators:nJ,capabilities:cN,emptyImportMessage:"No OpenCode config found (AGENTS.md, .opencode/rules, .opencode/commands, .opencode/agents, .opencode/skills, or opencode.json).",lintRules:nN,lint:{hooks:sN,permissions:iN,ignore:aN},project:oJ,globalSupport:{capabilities:cN,detectionPaths:[Vs,ia,aa,la,Js,Ys],layout:sJ},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Hn],global:[Vs]},canonicalDir:Tm,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Xo],global:[ia]},canonicalDir:Tm,extensions:[".md"],map:qD}],commands:{feature:"commands",mode:"directory",source:{project:[Zo],global:[aa]},canonicalDir:Pu,extensions:[".md"],map:tN},agents:{feature:"agents",mode:"directory",source:{project:[Qo],global:[la]},canonicalDir:Tu,extensions:[".md"],map:eN}},buildImportPaths:Hh,detectionPaths:[Xo,Zo,Qo,on,zn,"opencode.jsonc"]};});function mN(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Vn)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:Ir,content:o}]:[]}function pN(t){return rt(t,qt)}function uN(t){return t.commands.map(e=>({path:`${qt}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function dN(t){return t.agents.map(e=>({path:`${qt}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}var fN=d(()=>{tt();Ut();mt();kt();vl();s(mN,"generateRules");s(pN,"generateSkills");s(uN,"generateCommands");s(dN,"generateAgents");});async function gN(t,e={}){let r=e.scope??"project",n=[],o=await B(Vn,t,r);return n.push(...await J(Ad,t,r,{normalize:o})),await q(t,r==="global"?Sr:qt,Vn,n,o),n}var hN=d(()=>{dt();tt();Et();vl();v_();s(gN,"importFromPiAgent");});function yN(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Vn}))}var _N=d(()=>{It();vl();s(yN,"lintRules");});function RN(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","pi-agent","Pi Coding Agent has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function IN(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","pi-agent","Pi Coding Agent has no dedicated permissions config; canonical permissions are not projected.")]}function SN(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","pi-agent","Pi Coding Agent has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}function CN(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","pi-agent","Pi Coding Agent manages MCP servers via extensions, not a dedicated config file; canonical MCP servers are not projected.")]}var kN=d(()=>{Lt();s(RN,"lintHooks");s(IN,"lintPermissions");s(SN,"lintIgnore");s(CN,"lintMcp");});var iJ,aJ,lJ,EN,Ad,v_=d(()=>{kt();mt();fN();ee();hN();_N();kN();Vh();vl();iJ={name:Vn,primaryRootInstructionPath:Ir,generateRules:mN,generateCommands:uN,generateAgents:dN,generateSkills:pN,importFrom:gN},aJ={rootInstructionPath:Ir,skillDir:qt,managedOutputs:{dirs:[qt],files:[Ir]},paths:{rulePath(t){return Ir},commandPath(t){return `${qt}/${H(t)}/SKILL.md`},agentPath(t){return `${qt}/${U(t)}/SKILL.md`}}},lJ={rootInstructionPath:qo,skillDir:Sr,managedOutputs:{dirs:[Sr],files:[qo]},rewriteGeneratedPath(t){return t===Ir?qo:t.startsWith(`${qt}/`)?t.replace(`${qt}/`,`${Sr}/`):t},mirrorGlobalPath(t,e){return pt(t,Sr,e)},paths:{rulePath(t){return qo},commandPath(t){return `${Sr}/${H(t)}/SKILL.md`},agentPath(t){return `${Sr}/${U(t)}/SKILL.md`}}},EN={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},Ad={id:Vn,metadata:{displayName:"Pi Agent",category:"cli",officialUrl:"https://github.com/pi-labs/pi-agent",shortDescription:"Pi coding agent"},generators:iJ,capabilities:EN,emptyImportMessage:"No Pi Coding Agent config found (AGENTS.md or .pi/skills).",lintRules:yN,lint:{hooks:RN,permissions:IN,ignore:SN,mcp:CN},supportsConversion:{commands:true,agents:true},project:aJ,globalSupport:{capabilities:EN,detectionPaths:[qo],layout:lJ},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Ir],global:[qo]},canonicalDir:nL,canonicalRootFilename:"_root.md",markAsRoot:true}},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:zh,detectionPaths:[Ir,qt]};});function LN(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Cr,content:r.body.trim()?r.body:""});let n=t.rules.filter(o=>!o.root&&(o.targets.length===0||o.targets.includes(Jn)));for(let o of n){let i=basename(o.source,".md"),a={};o.description&&(a.description=o.description),o.globs.length>0&&(a.globs=o.globs);let l=T(a,o.body.trim()||"");e.push({path:`${ts}/${i}.md`,content:l});}return e}function ON(t){return t.commands.map(e=>{let r={description:e.description,"allowed-tools":e.allowedTools.length>0?e.allowedTools:void 0};r["allowed-tools"]===void 0&&delete r["allowed-tools"];let n=T(r,e.body.trim()||"");return {path:`${Yn}/${e.name}.md`,content:n}})}function AN(t){return t.agents.map(e=>{let r={name:e.name,description:e.description,tools:e.tools.length>0?e.tools:void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=T(r,e.body.trim()||"");return {path:`${Xn}/${e.name}.md`,content:n}})}function wN(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=T(n,r.body.trim()||"");e.push({path:`${je}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${je}/${r.name}/${a}`,content:i.content});}}return e}function bN(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Xs,content:e}]}function PN(t){return !t.ignore||t.ignore.length===0?[]:[{path:Zs,content:t.ignore.join(`
141
+ `)}]}var TN=d(()=>{j();Ml();s(LN,"generateRules");s(ON,"generateCommands");s(AN,"generateAgents");s(wN,"generateSkills");s(bN,"generateMcp");s(PN,"generateIgnore");});async function xN(t,e={}){let r=e.scope??"project",n=[],o=await B(Jn,t,r);return n.push(...await J(wd,t,r,{normalize:o})),await q(t,r==="global"?Zn:je,Jn,n,o),n}var DN=d(()=>{dt();Et();tt();Ml();M_();s(xN,"importFromQwenCode");});function NN(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Jn}))}var FN=d(()=>{It();Ml();s(NN,"lintRules");});var mJ,pJ,uJ,dJ,fJ,wd,M_=d(()=>{TN();DN();FN();Ct();Ml();mJ={name:Jn,primaryRootInstructionPath:Cr,generateRules:LN,generateCommands:ON,generateAgents:AN,generateSkills:wN,generateMcp:bN,generateIgnore:PN,importFrom:xN},pJ={rootInstructionPath:Cr,skillDir:je,managedOutputs:{dirs:[ts,Yn,Xn,je],files:[Cr,Xs,Zs]},paths:{rulePath(t,e){return e.root?Cr:`${ts}/${t}.md`},commandPath(t){return `${Yn}/${t}.md`},agentPath(t){return `${Xn}/${t}.md`}}},uJ={rootInstructionPath:es,skillDir:Zn,managedOutputs:{dirs:[Qs,qs,Zn],files:[es,ma]},rewriteGeneratedPath(t){return t===Cr?es:t===Xs?ma:t===Zs?null:t.startsWith(`${Yn}/`)?t.replace(`${Yn}/`,`${Qs}/`):t.startsWith(`${Xn}/`)?t.replace(`${Xn}/`,`${qs}/`):t.startsWith(`${je}/`)?t.replace(`${je}/`,`${Zn}/`):t.startsWith(`${ts}/`)?null:t},paths:{rulePath(t,e){return es},commandPath(t){return `${Qs}/${t}.md`},agentPath(t){return `${qs}/${t}.md`}}},dJ={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},fJ={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},wd={id:Jn,metadata:{displayName:"Qwen Code",category:"cli",officialUrl:"https://github.com/QwenLM/qwen-code",shortDescription:"Alibaba's Qwen coding CLI"},generators:mJ,capabilities:dJ,emptyImportMessage:"No Qwen Code config found (QWEN.md or .qwen/rules, .qwen/commands, .qwen/settings.json).",lintRules:NN,project:pJ,globalSupport:{capabilities:fJ,detectionPaths:[es,ma,Qs,qs,Zn],layout:uJ},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Cr],global:[es]},canonicalDir:Jh,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[ts],global:[]},canonicalDir:Jh,extensions:[".md"],preset:"rule"}],commands:{feature:"commands",mode:"directory",source:{project:[Yn],global:[Qs]},canonicalDir:oL,extensions:[".md"],preset:"command"},agents:{feature:"agents",mode:"directory",source:{project:[Xn],global:[qs]},canonicalDir:sL,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Xs],global:[ma]},canonicalDir:".agentsmesh",canonicalFilename:".agentsmesh/mcp.json"},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Zs],global:[]},canonicalDir:".agentsmesh",canonicalFilename:".agentsmesh/ignore"}},buildImportPaths:Yh,detectionPaths:[Cr,".qwen/settings.json",".qwen/commands",".qwen/rules"]};});function vN(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Qn)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:sn,content:o}]:[]}function MN(t){return rt(t,Ae)}function $N(t){return t.commands.map(e=>({path:`${Ae}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function GN(t){return t.agents.map(e=>({path:`${Ae}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}var jN=d(()=>{tt();Ut();mt();kt();$l();s(vN,"generateRules");s(MN,"generateSkills");s($N,"generateCommands");s(GN,"generateAgents");});async function UN(t,e={}){let r=e.scope??"project",n=[],o=await B(Qn,t,r);return n.push(...await J(bd,t,r,{normalize:o})),await q(t,Ae,Qn,n,o),n}var BN=d(()=>{dt();tt();Et();$l();$_();s(UN,"importFromReplitAgent");});function KN(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Qn}))}var WN=d(()=>{It();$l();s(KN,"lintRules");});function HN(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","replit-agent","Replit Agent has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function zN(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","replit-agent","Replit Agent permissions are managed in the cloud UI; canonical permissions are not projected.")]}function VN(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","replit-agent","Replit Agent has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}function JN(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","replit-agent","Replit Agent MCP servers are configured via the Integrations UI, not file-based; canonical MCP config is not projected.")]}var YN=d(()=>{Lt();s(HN,"lintHooks");s(zN,"lintPermissions");s(VN,"lintIgnore");s(JN,"lintMcp");});var gJ,hJ,yJ,bd,$_=d(()=>{kt();mt();jN();BN();WN();YN();Zh();$l();gJ={name:Qn,primaryRootInstructionPath:sn,generateRules:vN,generateCommands:$N,generateAgents:GN,generateSkills:MN,importFrom:UN},hJ={rootInstructionPath:sn,skillDir:Ae,managedOutputs:{dirs:[Ae],files:[sn]},paths:{rulePath(t){return sn},commandPath(t){return `${Ae}/${H(t)}/SKILL.md`},agentPath(t){return `${Ae}/${U(t)}/SKILL.md`}}},yJ={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},bd={id:Qn,metadata:{displayName:"Replit Agent",category:"agent-platform",officialUrl:"https://replit.com",shortDescription:"Replit's autonomous coding agent"},generators:gJ,capabilities:yJ,emptyImportMessage:"No Replit Agent config found (replit.md or .agents/skills).",lintRules:KN,lint:{hooks:HN,permissions:zN,ignore:VN,mcp:JN},supportsConversion:{commands:true,agents:true},project:hJ,sharedArtifacts:{".agents/skills/":"consumer"},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[sn]},canonicalDir:aL,canonicalRootFilename:"_root.md",markAsRoot:true}},buildImportPaths:Xh,detectionPaths:[sn]};});function ZN(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:an,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(ti))continue;let o=basename(n.source,".md");e.push({path:`${rs}/${o}.md`,content:n.body.trim()||""});}return e}function QN(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${ns}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function qN(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Dm,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function tF(t){return t.ignore.length===0?[]:[{path:Nm,content:t.ignore.join(`
142
+ `)}]}function eF(t){return rt(t,qn)}function rF(t){if(t.agents.length===0)return [];let e=t.agents.map(r=>{let o={slug:basename(r.source,".md"),name:r.name};return r.description&&(o.description=r.description),r.body.trim()&&(o.roleDefinition=r.body.trim()),o});return [{path:Gl,content:stringify({customModes:e})}]}var nF=d(()=>{tt();j();fa();s(ZN,"generateRules");s(QN,"generateCommands");s(qN,"generateMcp");s(tF,"generateIgnore");s(eF,"generateSkills");s(rF,"generateAgents");});var Pd,sF,G_=d(()=>{j();ut();fa();Pd=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(t==="00-root.md")return null;let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${da}/${t}`,content:await K(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"rooNonRootRuleMapper"),sF=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=b(e(n));return {destPath:n,toPath:`${Du}/${t}`,content:await _t(n,{hasDescription:true,description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"rooCommandMapper");});async function IJ(t,e,r){let n=join(t,pa),o;try{o=await readdir(n,{withFileTypes:!0});}catch{return}let i=o.filter(l=>l.isDirectory()&&l.name.startsWith("rules-")).map(l=>l.name),a=join(t,da);for(let l of i)e.push(...await Rt({srcDir:join(n,l),destDir:a,extensions:[".md"],fromTool:ti,normalize:r,mapEntry:s(async({srcPath:c,relativePath:m,content:p,normalizeTo:u})=>{let f=await Pd({absolutePath:c,relativePath:m,content:p,destDir:a,normalizeTo:u});return f?{...f,feature:"rules"}:null},"mapEntry")}));}async function iF(t,e={}){let r=e.scope??"project",n=[],o=await B(ti,t,r);return n.push(...await J(Td,t,r,{normalize:o})),await IJ(t,n,o),await q(t,qn,ti,n,o),n}var aF=d(()=>{dt();tt();xe();Et();G_();fa();U_();s(IJ,"importPerModeRules");s(iF,"importFromRooCode");});function lF(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:ti}))}var cF=d(()=>{It();fa();s(lF,"lintRules");});function OJ(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var EJ,LJ,AJ,wJ,bJ,Td,U_=d(()=>{w();nF();fa();ee();aF();G_();cF();Ct();EJ={name:"roo-code",primaryRootInstructionPath:an,generateRules:ZN,generateCommands:QN,generateSkills:eF,generateMcp:qN,generateIgnore:tF,generateAgents:rF,importFrom:iF},LJ={rootInstructionPath:an,skillDir:".roo/skills",managedOutputs:{dirs:[".roo/rules",".roo/commands",".roo/skills"],files:[".roo/mcp.json",".rooignore",".roorules",Gl]},paths:{rulePath(t,e){return `${rs}/${t}.md`},commandPath(t,e){return `${ns}/${t}.md`},agentPath(t,e){return null}}};s(OJ,"computeStatus");AJ=s(async(t,e,r,n)=>{if(r!=="global")return [];if(!n.has("agents")||t.agents.length===0)return [];let o=t.agents.map(l=>{let m={slug:basename(l.source,".md"),name:l.name};return l.description&&(m.description=l.description),l.body.trim()&&(m.roleDefinition=l.body.trim()),m}),i=stringify({customModes:o}),a=await _(join(e,Fm));return [{target:"roo-code",path:Fm,content:i,currentContent:a??void 0,status:OJ(a,i)}]},"generateRooGlobalExtras"),wJ={rootInstructionPath:ni,skillDir:os,managedOutputs:{dirs:[ei,ri,os,lL],files:[ni,ua,vm,Fm]},rewriteGeneratedPath(t){return t===an?ni:t===Gl?null:t.startsWith(`${rs}/`)?t.replace(`${rs}/`,`${ei}/`):t.startsWith(`${ns}/`)?t.replace(`${ns}/`,`${ri}/`):t.startsWith(`${qn}/`)?t.replace(`${qn}/`,`${os}/`):t===Dm?ua:t===Nm?vm:t},mirrorGlobalPath(t,e){return pt(t,os,e)},paths:{rulePath(t,e){return `${ei}/${t}.md`},commandPath(t,e){return `${ri}/${t}.md`},agentPath(t,e){return null}}},bJ={rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Td={id:"roo-code",metadata:{displayName:"Roo Code",category:"ide",officialUrl:"https://roocode.com",shortDescription:"Open-source AI VS Code extension"},generators:EJ,capabilities:{rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Roo Code config found (.roo/rules, .roo/commands, .roo/skills, .roo/mcp.json, .rooignore, or .roorules).",lintRules:lF,project:LJ,globalSupport:{capabilities:bJ,detectionPaths:[ei,ri,os,ua,vm,ni,Fm],layout:wJ,scopeExtras:AJ},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[an,xm],global:[ni,an,xm]},canonicalDir:da,canonicalRootFilename:"_root.md",markAsRoot:true,frontmatterRemap:s(({description:t,globs:e})=>({description:typeof t=="string"?t:void 0,globs:Array.isArray(e)?e:void 0}),"frontmatterRemap")},{feature:"rules",mode:"directory",source:{project:[rs],global:[ei]},canonicalDir:da,extensions:[".md"],map:Pd}],commands:{feature:"commands",mode:"directory",source:{project:[ns],global:[ri]},canonicalDir:Du,extensions:[".md"],map:sF},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Dm],global:[ua]},canonicalDir:".agentsmesh",canonicalFilename:cL},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Nm],global:[vm]},canonicalDir:".agentsmesh",canonicalFilename:mL}},buildImportPaths:Qh,detectionPaths:[".roo/rules",".roo/commands",".roo/skills",".roo/mcp.json",".rooignore",".roorules",Gl]};});function mF(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(to)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:kr,content:o}]:[]}function pF(t){return rt(t,te)}function uF(t){return t.commands.map(e=>({path:`${te}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function dF(t){return t.agents.map(e=>({path:`${te}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function fF(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:ss,content:e}]}var gF=d(()=>{tt();Ut();mt();kt();Ul();s(mF,"generateRules");s(pF,"generateSkills");s(uF,"generateCommands");s(dF,"generateAgents");s(fF,"generateMcp");});async function hF(t,e={}){let r=e.scope??"project",n=[],o=await B(to,t,r);return n.push(...await J(xd,t,r,{normalize:o})),await q(t,r==="global"?Ue:te,to,n,o),n}var yF=d(()=>{dt();tt();Et();Ul();B_();s(hF,"importFromRovodev");});function _F(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:to}))}var RF=d(()=>{It();Ul();s(_F,"lintRules");});function IF(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","rovodev","Rovo Dev has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function SF(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","rovodev","Rovo Dev permissions are managed in config.yaml; canonical permissions are not projected.")]}function CF(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","rovodev","Rovo Dev has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var kF=d(()=>{Lt();s(IF,"lintHooks");s(SF,"lintPermissions");s(CF,"lintIgnore");});var PJ,TJ,xJ,DJ,NJ,xd,B_=d(()=>{kt();mt();gF();ee();yF();RF();kF();Ct();Ul();PJ={name:to,primaryRootInstructionPath:kr,generateRules:mF,generateCommands:uF,generateAgents:dF,generateSkills:pF,generateMcp:fF,importFrom:hF},TJ={rootInstructionPath:kr,skillDir:te,managedOutputs:{dirs:[te],files:[kr,ss]},paths:{rulePath(t){return kr},commandPath(t){return `${te}/${H(t)}/SKILL.md`},agentPath(t){return `${te}/${U(t)}/SKILL.md`}}},xJ={rootInstructionPath:is,skillDir:Ue,managedOutputs:{dirs:[Ue],files:[is,jl]},rewriteGeneratedPath(t){return t===kr?is:t.startsWith(`${te}/`)?t.replace(`${te}/`,`${Ue}/`):t===ss?jl:t},mirrorGlobalPath(t,e){return pt(t,Ue,e)},paths:{rulePath(t){return is},commandPath(t){return `${Ue}/${H(t)}/SKILL.md`},agentPath(t){return `${Ue}/${U(t)}/SKILL.md`}}},DJ={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},NJ={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},xd={id:to,metadata:{displayName:"Rovo Dev",category:"cli",officialUrl:"https://www.atlassian.com/solutions/devops/rovo-dev",shortDescription:"Atlassian's coding agent"},generators:PJ,capabilities:DJ,emptyImportMessage:"No Rovo Dev config found (AGENTS.md, .rovodev/skills, or .rovodev/mcp.json).",lintRules:_F,lint:{hooks:IF,permissions:SF,ignore:CF},supportsConversion:{commands:true,agents:true},project:TJ,globalSupport:{capabilities:NJ,detectionPaths:[dL,is,Ue],layout:xJ},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[kr],global:[is]},canonicalDir:fL,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[ss],global:[jl]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:qh,detectionPaths:[kr,te,ss]};});function EF(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Ke,content:r.body.trim()});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(Er))continue;let o=basename(n.source,".md");e.push({path:`${Be}/${o}.md`,content:n.body.trim()});}return e}function LF(t){return rt(t,Lr)}function OF(t){return t.mcp===null||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:ga,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function AF(t){return t.ignore.length===0?[]:[{path:Bl,content:t.ignore.join(`
143
+ `)}]}var wF=d(()=>{tt();Kl();s(EF,"generateRules");s(LF,"generateSkills");s(OF,"generateMcp");s(AF,"generateIgnore");});async function MJ(t,e,r,n){let o=n==="global"?[Or,Ke]:[Ke,Or];for(let i of o){let a=join(t,i),l=await _(a);if(l===null)continue;let c=join(t,bF),{frontmatter:m,body:p}=b(r(l,a,c));await O(join(t,$m)),await I(c,await K(c,{...m,root:true},p)),e.push({fromTool:Er,fromPath:a,toPath:bF,feature:"rules"});return}}async function $J(t,e,r,n){let o=join(t,n==="global"?as:Be),i=join(t,$m);e.push(...await Rt({srcDir:o,destDir:i,extensions:[".md"],fromTool:Er,normalize:r,mapEntry:s(async({relativePath:a,normalizeTo:l})=>{let c=basename(a);if(c==="project_rules.md"||c==="rules.md")return null;let m=join(i,a),{frontmatter:p,body:u}=b(l(m));return {destPath:m,toPath:`${$m}/${a}`,feature:"rules",content:await K(m,{...p,root:false},u)}},"mapEntry")}));}async function PF(t,e={}){let r=e.scope??"project",n=[],o=await B(Er,t,r);return await MJ(t,n,o,r),await $J(t,n,o,r),n.push(...await J(Dd,t,r,{normalize:o})),await q(t,r==="global"?ln:Lr,Er,n,o),n}var bF,TF=d(()=>{dt();tt();xe();Et();ut();w();j();Kl();K_();bF=`${$m}/_root.md`;s(MJ,"importRoot");s($J,"importNonRootRules");s(PF,"importFromTrae");});function xF(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Er}))}var DF=d(()=>{It();Kl();s(xF,"lintRules");});var GJ,jJ,UJ,BJ,Dd,K_=d(()=>{wF();ee();TF();DF();Ct();Kl();GJ={name:Er,primaryRootInstructionPath:Ke,generateRules:EF,generateSkills:LF,generateMcp:OF,generateIgnore:AF,importFrom:PF},jJ={rootInstructionPath:Ke,skillDir:Lr,managedOutputs:{dirs:[Be,Lr],files:[ga,Bl]},paths:{rulePath(t,e){return `${Be}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},UJ={rootInstructionPath:Or,skillDir:ln,managedOutputs:{dirs:[as,ln,hL],files:[Or,Mm]},rewriteGeneratedPath(t){return t===Ke?Or:t.startsWith(`${Be}/`)?t.replace(`${Be}/`,`${as}/`):t.startsWith(`${Lr}/`)?t.replace(`${Lr}/`,`${ln}/`):t===ga?Mm:t===Bl?null:t},mirrorGlobalPath(t,e){return pt(t,ln,e)},paths:{rulePath(t,e){return t==="_root"?Or:`${as}/${t}.md`},commandPath(t,e){return null},agentPath(t,e){return null}}},BJ={rules:"native",additionalRules:"native",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Dd={id:Er,metadata:{displayName:"Trae",category:"ide",officialUrl:"https://www.trae.ai",shortDescription:"ByteDance's adaptive AI IDE"},generators:GJ,capabilities:{rules:"native",additionalRules:"native",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},emptyImportMessage:"No Trae config found (.trae/rules/project_rules.md, .trae/rules/*.md, .trae/skills/, .trae/mcp.json, or .trae/.ignore).",lintRules:xF,project:jJ,globalSupport:{capabilities:BJ,detectionPaths:[Or,as,ln,Mm],layout:UJ},importer:{mcp:{feature:"mcp",mode:"mcpJson",source:{project:[ga],global:[Mm]},canonicalDir:".agentsmesh",canonicalFilename:yL},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Bl]},canonicalDir:".agentsmesh",canonicalFilename:_L}},buildImportPaths:ty,detectionPaths:[Be,ga,Ke]};});function NF(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(eo)),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:cn,content:o}]:[]}function FF(t){return rt(t,ue)}function vF(t){return t.commands.map(e=>({path:`${ue}/${H(e.name)}/SKILL.md`,content:Nt(e)}))}function MF(t){return t.agents.map(e=>({path:`${ue}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}function $F(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:oi,content:e}]}var GF=d(()=>{tt();Ut();mt();kt();Wl();s(NF,"generateRules");s(FF,"generateSkills");s(vF,"generateCommands");s(MF,"generateAgents");s($F,"generateMcp");});async function jF(t,e={}){let r=e.scope??"project",n=[],o=await B(eo,t,r);return n.push(...await J(Nd,t,r,{normalize:o})),await q(t,r==="global"?We:ue,eo,n,o),n}var UF=d(()=>{dt();tt();Et();Wl();W_();s(jF,"importFromWarp");});function BF(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:eo}))}var KF=d(()=>{It();Wl();s(BF,"lintRules");});function WF(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","warp","Warp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function HF(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","warp","Warp permissions are UI-managed; canonical permissions are not projected.")]}function zF(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","warp","Warp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var VF=d(()=>{Lt();s(WF,"lintHooks");s(HF,"lintPermissions");s(zF,"lintIgnore");});var KJ,WJ,HJ,zJ,VJ,Nd,W_=d(()=>{kt();mt();GF();ee();UF();KF();VF();Ct();Wl();KJ={name:eo,primaryRootInstructionPath:cn,generateRules:NF,generateCommands:vF,generateAgents:MF,generateSkills:FF,generateMcp:$F,importFrom:jF},WJ={rootInstructionPath:cn,skillDir:ue,managedOutputs:{dirs:[ue],files:[cn,oi]},paths:{rulePath(t){return cn},commandPath(t){return `${ue}/${H(t)}/SKILL.md`},agentPath(t){return `${ue}/${U(t)}/SKILL.md`}}},HJ={rootInstructionPath:void 0,skillDir:We,managedOutputs:{dirs:[We],files:[]},rewriteGeneratedPath(t){return t.startsWith(`${ue}/`)?t.replace(`${ue}/`,`${We}/`):t},mirrorGlobalPath(t,e){return pt(t,We,e)},paths:{rulePath(){return null},commandPath(t){return `${We}/${H(t)}/SKILL.md`},agentPath(t){return `${We}/${U(t)}/SKILL.md`}}},zJ={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},VJ={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},Nd={id:eo,metadata:{displayName:"Warp",category:"cli",officialUrl:"https://www.warp.dev",shortDescription:"AI-powered terminal"},generators:KJ,capabilities:zJ,emptyImportMessage:"No Warp config found (WARP.md, AGENTS.md, .warp/skills, or .mcp.json).",lintRules:BF,lint:{hooks:WF,permissions:HF,ignore:zF},supportsConversion:{commands:true,agents:true},project:WJ,globalSupport:{capabilities:VJ,detectionPaths:[We],layout:HJ},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[ey,cn]},canonicalDir:IL,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[oi]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:ry,detectionPaths:[cn,ey,oi],conversionDefaults:{commandsToSkills:true,agentsToSkills:true}};});var mo,H_,ui,JF,ic,po,ac,lc,YF,di,dn,cc,z_,XF,ZF,V_,J_,Y_,mc,pc,Qm,Fd,vd,Md,QF,Se=d(()=>{mo="windsurf",H_=".windsurfrules",ui=".windsurf/rules",JF=".windsurfignore",ic=".codeiumignore",po="AGENTS.md",ac=".windsurf/hooks.json",lc=".windsurf/mcp_config.example.json",YF=".windsurf/mcp_config.json",di=".windsurf/workflows",dn=".windsurf/skills",cc=".agentsmesh/rules",z_=".agentsmesh/commands",XF=".agentsmesh/agents",ZF=".agentsmesh/skills",V_=".agentsmesh/ignore",J_=".agentsmesh/hooks.yaml",Y_=".agentsmesh/mcp.json",mc=".codeium/windsurf/memories/global_rules.md",pc=".codeium/windsurf/skills",Qm=".codeium/windsurf/global_workflows",Fd=".codeium/windsurf/hooks.json",vd=".codeium/windsurf/mcp_config.json",Md=".codeium/.codeiumignore",QF=".agents/skills";});function YJ(t){let e=basename(t,".md");return e==="_root"?"root":e}function XJ(t){if(t.length===0)return null;let e=t.map(r=>r.split("/")[0]??"").filter(r=>/^[A-Za-z0-9._-]+$/.test(r));return e.length!==t.length?null:e.every(r=>r===e[0])?e[0]:null}function X_(t){let e=[],r=t.rules.find(n=>n.root);if(!r)return [];e.push({path:po,content:r.body.trim()});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("windsurf"))continue;let o=YJ(n.source),i=n.trigger||(n.globs.length>0?"glob":void 0),a={description:n.description||void 0,trigger:i,glob:n.globs.length===1?n.globs[0]:void 0,globs:n.globs.length>1?n.globs:void 0};Object.keys(a).forEach(m=>{a[m]===void 0&&delete a[m];});let l=Object.keys(a).length>0?T(a,n.body.trim()||""):n.body.trim()||"";e.push({path:`${ui}/${o}.md`,content:l});let c=XJ(n.globs);c&&(c!==o&&e.push({path:`${ui}/${c}.md`,content:l}),e.push({path:`${c}/AGENTS.md`,content:n.body.trim()||""}));}return e}var qF=d(()=>{j();Se();s(YJ,"ruleSlug");s(XJ,"directoryScopedRuleDir");s(X_,"generateRules");});function Z_(t){return !t.ignore||t.ignore.length===0?[]:[{path:ic,content:t.ignore.join(`
144
+ `)}]}var tv=d(()=>{Se();s(Z_,"generateIgnore");});function Q_(t){return t.commands.map(e=>{let r={description:e.description.trim()||void 0,allowedTools:e.allowedTools.length>0?e.allowedTools:void 0};Object.keys(r).forEach(o=>{r[o]===void 0&&delete r[o];});let n=Object.keys(r).length>0?T(r,e.body.trim()||""):e.body.trim();return {path:`${di}/${e.name}.md`,content:n}})}var ev=d(()=>{j();Se();s(Q_,"generateCommands");});function q_(t){return t.agents.map(e=>({path:`${dn}/${U(e.name)}/SKILL.md`,content:Tt(e)}))}var rv=d(()=>{mt();Se();s(q_,"generateAgents");});function tR(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:lc,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var nv=d(()=>{Se();s(tR,"generateMcp");});function ZJ(t){let e={PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use",Notification:"notification",UserPromptSubmit:"user_prompt_submit",SubagentStart:"subagent_start",SubagentStop:"subagent_stop"};return e[t]?e[t]:t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function QJ(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!Sn(i))continue;let a=zt(i),l=he(i),c=i.type==="prompt"?l||a:a||l;c&&o.push({command:c,show_output:true});}o.length>0&&(e[ZJ(r)]=o);}return e}function eR(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=QJ(t.hooks);return Object.keys(e).length===0?[]:[{path:ac,content:JSON.stringify({hooks:e},null,2)}]}var ov=d(()=>{Mr();Se();s(ZJ,"windsurfEventName");s(QJ,"toWindsurfHooks");s(eR,"generateHooks");});function rR(t){let e=[];for(let r of t.skills){let n={name:r.name,description:r.description||void 0};n.description===void 0&&delete n.description;let o=Object.keys(n).length>0?T(n,r.body.trim()||""):r.body.trim()||"";e.push({path:`${dn}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles)e.push({path:`${dn}/${r.name}/${i.relativePath}`,content:i.content});}return e}var sv=d(()=>{j();Se();s(rR,"generateSkills");});var iv=d(()=>{qF();tv();ev();rv();nv();ov();sv();});var av=d(()=>{iv();});function lv(t){return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}async function cv(t,e,r){let n=join(t,di),i=(await v(n)).filter(l=>l.endsWith(".md")),a=join(t,z_);for(let l of i){let c=await _(l);if(!c)continue;let m=relative(n,l).replace(/\\/g,"/");await O(a);let p=join(a,m),u=r(c,l,p),{frontmatter:f,body:g}=b(u),h=await _t(p,{description:typeof f.description=="string"?f.description:"",hasDescription:Object.prototype.hasOwnProperty.call(f,"description"),allowedTools:(()=>{let R=lv(f.allowedTools);return R.length>0?R:lv(f["allowed-tools"])})(),hasAllowedTools:Object.prototype.hasOwnProperty.call(f,"allowedTools")||Object.prototype.hasOwnProperty.call(f,"allowed-tools")},g);await I(p,h),e.push({fromTool:mo,fromPath:l,toPath:`${z_}/${m}`,feature:"commands"});}}var mv=d(()=>{w();j();ut();Se();s(lv,"toStringArray");s(cv,"importWorkflows");});async function pv(t,e,r,n=dn){await Vl([n],{projectRoot:t,destCanonicalSkillsDir:ZF,targetName:"windsurf",normalize:r,results:e},[Jl({canonicalAgentsDir:XF})]);}var uv=d(()=>{Yl();Se();s(pv,"importSkills");});async function fv(t,e){let r=join(t,ac),n=await _(r);if(n)try{let o=JSON.parse(n);if(!o.hooks||typeof o.hooks!="object"||Array.isArray(o.hooks))return;let i=rY(o.hooks);if(Object.keys(i).length===0)return;let a=join(t,J_);await O(dirname(a)),await I(a,stringify(i)),e.push({fromTool:mo,fromPath:r,toPath:J_,feature:"hooks"});}catch{}}function eY(t){return {pre_tool_use:"PreToolUse",post_tool_use:"PostToolUse",notification:"Notification",user_prompt_submit:"UserPromptSubmit",subagent_start:"SubagentStart",subagent_stop:"SubagentStop"}[t]??t}function rY(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=eY(r),i=[];for(let a of n){if(!a||typeof a!="object")continue;let l=a;if(typeof l.command=="string"&&l.command.trim()){i.push({matcher:".*",type:"command",command:l.command});continue}let c=typeof l.matcher=="string"&&l.matcher.trim()?l.matcher:".*",m=Array.isArray(l.hooks)?l.hooks:[];for(let p of m){if(!p||typeof p!="object")continue;let u=p,f=typeof u.command=="string"?u.command:typeof u.prompt=="string"?u.prompt:"";if(!f.trim())continue;let g={matcher:c,type:u.type==="prompt"?"prompt":"command",command:f};typeof u.timeout=="number"&&(g.timeout=u.timeout),i.push(g);}}i.length>0&&(e[o]=i);}return e}async function gv(t,e){let r=[lc,YF];for(let n of r){let o=join(t,n),i=await _(o);if(i)try{let a=JSON.parse(i);if(!a.mcpServers||typeof a.mcpServers!="object")continue;let l=join(t,Y_);await O(dirname(l)),await I(l,JSON.stringify({mcpServers:a.mcpServers},null,2)),e.push({fromTool:mo,fromPath:o,toPath:Y_,feature:"mcp"});return}catch{}}}var hv=d(()=>{w();Se();s(fv,"importWindsurfHooks");s(eY,"canonicalHookEventName");s(rY,"windsurfHooksToCanonical");s(gv,"importWindsurfMcp");});async function yv(t,e){let r=e?.scope??"project",n=[],o=await B(mo,t),i=await B("codex-cli",t),a=join(t,cc),l=join(t,H_),c=await _(l);if(c!==null){await O(a);let f=join(a,"_root.md"),g=o(c,l,f).trim(),h=await K(f,{root:true},g);await I(f,h),n.push({fromTool:"windsurf",fromPath:l,toPath:`${cc}/_root.md`,feature:"rules"});}if(c===null){let f=join(t,po),g=await _(f);if(g!==null){await O(a);let h=join(a,"_root.md"),R=o(i(g,f,h),f,h).trim(),C=await K(h,{root:true},R);await I(h,C),n.push({fromTool:"windsurf",fromPath:f,toPath:`${cc}/_root.md`,feature:"rules"});}}r!=="global"&&n.push(...await Rt({srcDir:t,destDir:a,extensions:["AGENTS.md"],fromTool:"windsurf",normalize:o,mapEntry:s(async({srcPath:f,normalizeTo:g})=>{let h=relative(t,dirname(f)).replace(/\\/g,"/");if(!h||h==="."||basename(f)!=="AGENTS.md")return null;let R=h.replace(/\//g,"-");if(!eu(h))return await kn(join(a,`${R}.md`)),null;let C=join(a,`${R}.md`);return {destPath:C,toPath:`${cc}/${R}.md`,feature:"rules",content:await K(C,{root:false,globs:[`${h}/**`]},g(C))}},"mapEntry")}));let m=join(t,ui);n.push(...await Rt({srcDir:m,destDir:a,extensions:[".md"],fromTool:"windsurf",normalize:o,mapEntry:s(async({relativePath:f,normalizeTo:g})=>{if(f==="_root.md"&&c!==null)return null;let h=join(a,f),{frontmatter:R,body:C}=b(g(h)),S={...R};return typeof S.glob=="string"&&S.glob.trim()&&(S.globs=[S.glob],delete S.glob),{destPath:h,toPath:`${cc}/${f}`,feature:"rules",content:await K(h,{...S,root:false},C)}},"mapEntry")}));let p=join(t,JF),u=await _(p);if((u===null||!u.trim())&&(p=join(t,ic),u=await _(p)),u!==null&&u.trim()){let f=u.split(/\r?\n/),g=[];for(let h of f){let R=h.trim();R&&!R.startsWith("#")&&g.push(R);}if(g.length>0){await O(join(t,".agentsmesh"));let h=join(t,V_);await I(h,g.join(`
145
+ `)),n.push({fromTool:"windsurf",fromPath:p,toPath:V_,feature:"ignore"});}}return await cv(t,n,o),await pv(t,n,o),await fv(t,n),await gv(t,n),n}var _v=d(()=>{dt();w();j();ut();xe();Qc();Se();mv();uv();hv();s(yv,"importFromWindsurf");});function Rv(t,e,r){let n=[],{rules:o}=t;o.length>0&&(o.some(l=>l.root)||n.push({level:"warning",file:relative(e,o[0].source),target:mo,message:"Windsurf needs a root rule to generate AGENTS.md. Add root: true to a rule."}));let i=[];return t.permissions&&(t.permissions.allow.length>0||t.permissions.deny.length>0)&&i.push("permissions"),i.length>0&&n.push({level:"warning",file:".agentsmesh",target:mo,message:`Windsurf cannot project these features yet: ${i.join(", ")}.`}),n}var Iv=d(()=>{Se();s(Rv,"lintRules");});function Sv(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>x(e.source,"windsurf","windsurf workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function Cv(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[x(".agentsmesh/mcp.json","windsurf","Windsurf MCP is partial; generated .windsurf/mcp_config.example.json is a reference artifact and may require manual setup.")]}var kv=d(()=>{Lt();s(Sv,"lintCommands");s(Cv,"lintMcp");});function aY(t){if(t.length===0)return null;let e=t.map(r=>r.split("/")[0]??"").filter(r=>/^[A-Za-z0-9._-]+$/.test(r));return e.length!==t.length?null:e.every(r=>r===e[0])?e[0]:null}var lY,cY,mY,pY,Ev,Lv=d(()=>{av();wi();Se();ee();_v();Iv();kv();Ct();ol();mt();s(aY,"directoryScopedRuleDir");lY={name:"windsurf",primaryRootInstructionPath:po,generateRules:X_,generateCommands:Q_,generateAgents:q_,generateSkills:rR,generateMcp:tR,generateHooks:eR,generateIgnore:Z_,importFrom:yv},cY={rootInstructionPath:po,extraRuleOutputPaths(t){if(t.root)return [po];let e=aY(t.globs);return e!==null?[`${e}/AGENTS.md`]:[]},skillDir:dn,managedOutputs:{dirs:[".windsurf/rules",".windsurf/skills",".windsurf/workflows"],files:["AGENTS.md",".codeiumignore",".windsurf/hooks.json",".windsurf/mcp_config.example.json"]},paths:{rulePath(t,e){return `${ui}/${t}.md`},commandPath(t,e){return `${di}/${t}.md`},agentPath(t,e){return qe(e,"windsurf")?`.windsurf/skills/${U(t)}/SKILL.md`:null}}},mY={rootInstructionPath:mc,skillDir:pc,managedOutputs:{dirs:[pc,Qm,QF],files:[mc,Fd,vd,Md]},rewriteGeneratedPath(t){return t===po?mc:t.startsWith(`${ui}/`)||/\/AGENTS\.md$/.test(t)?null:t.startsWith(`${dn}/`)?t.replace(`${dn}/`,`${pc}/`):t.startsWith(`${di}/`)?t.replace(`${di}/`,`${Qm}/`):t===ac?Fd:t===lc?vd:t===ic?Md:t},mirrorGlobalPath(t,e){return pt(t,".codeium/windsurf/skills",e)},paths:{rulePath(t,e){return mc},commandPath(t,e){return `${Qm}/${t}.md`},agentPath(t,e){return qe(e,"windsurf")?`${pc}/${U(t)}/SKILL.md`:null}}},pY={rules:"native",additionalRules:"partial",commands:Gr("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},Ev={id:"windsurf",metadata:{displayName:"Windsurf",category:"ide",officialUrl:"https://windsurf.com",shortDescription:"Codeium's agentic IDE"},generators:lY,capabilities:{rules:"native",additionalRules:"native",commands:Gr("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},emptyImportMessage:"No Windsurf config found (.windsurfrules, .windsurf/rules, .windsurfignore, or .codeiumignore).",supportsConversion:{agents:true},lintRules:Rv,lint:{commands:Sv,mcp:Cv},project:cY,globalSupport:{capabilities:pY,detectionPaths:[mc,pc,Qm,Fd,vd,Md],layout:mY},buildImportPaths:ny,detectionPaths:[".windsurfrules",".windsurf"],conversionDefaults:{agentsToSkills:true}};});function Ov(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes("zed")),n=e?.body.trim()??"",o=lt(n,r);return o?[{path:mn,content:o}]:[]}var Av=d(()=>{Ut();ha();s(Ov,"generateRules");});async function bv(t,e,r){let n=await _(join(t,e));if(n===null)return;let o;try{o=JSON.parse(n);}catch{return}if(o===null||typeof o!="object"||Array.isArray(o))return;let a=o.context_servers;if(a==null||typeof a!="object"||Array.isArray(a)||Object.keys(a).length===0)return;let l={};for(let[c,m]of Object.entries(a)){if(!m||typeof m!="object"||Array.isArray(m))continue;let p={...m};delete p.source,l[c]=p;}Object.keys(l).length!==0&&(await Bt(t,wv,l),r.push({fromTool:"zed",fromPath:e,toPath:wv,feature:"mcp"}));}var wv,Pv=d(()=>{w();Kr();ha();wv=".agentsmesh/mcp.json";s(bv,"importZedMcp");});async function Tv(t,e={}){let r=e.scope??"project",n=[],o=await B("zed",t,r);return n.push(...await J(Gd,t,r,{normalize:o})),await bv(t,r==="global"?no:ro,n),n}var xv=d(()=>{dt();Et();Pv();ha();oR();s(Tv,"importFromZed");});function Dv(t,e,r,n){return V(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:"zed"}))}var Nv=d(()=>{It();ha();s(Dv,"lintRules");});function Fv(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[x(".agentsmesh/hooks.yaml","zed","Zed has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function vv(t){if(!t.permissions)return [];let{allow:e,deny:r}=t.permissions,n=t.permissions.ask??[];return e.length===0&&r.length===0&&n.length===0?[]:[x(".agentsmesh/permissions.yaml","zed","Zed permissions are managed via agent.tool_permissions in settings.json; canonical permissions are not projected.")]}function Mv(t){return t.ignore.length===0?[]:[x(".agentsmesh/ignore","zed","Zed has no dedicated ignore file and relies on file_scan_exclusions in settings.json; canonical ignore patterns are not projected.")]}var $v=d(()=>{Lt();s(Fv,"lintHooks");s(vv,"lintPermissions");s(Mv,"lintIgnore");});function _Y(t,e){if(t===null)return e;let r;try{let i=JSON.parse(t);r=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{};}catch{r={};}let n=JSON.parse(e);if(n===null||typeof n!="object"||Array.isArray(n))return t;let o=n;return o.context_servers!==void 0&&(r.context_servers=o.context_servers),JSON.stringify(r,null,2)}var dY,fY,gY,hY,yY,Gd,oR=d(()=>{Av();xv();Nv();$v();Ct();ha();dY={name:"zed",primaryRootInstructionPath:mn,generateRules:Ov,importFrom:Tv},fY={rootInstructionPath:mn,managedOutputs:{dirs:[],files:[mn,ro]},paths:{rulePath(t){return mn},commandPath(){return null},agentPath(){return null}}},gY={rootInstructionPath:void 0,managedOutputs:{dirs:[],files:[no]},rewriteGeneratedPath(t){return t===ro?no:t},paths:{rulePath(){return no},commandPath(){return null},agentPath(){return null}}},hY={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},yY={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(_Y,"mergeZedSettings");Gd={id:"zed",metadata:{displayName:"Zed",category:"ide",officialUrl:"https://zed.dev",shortDescription:"Collaborative AI editor"},generators:dY,capabilities:hY,emptyImportMessage:"No Zed config found (.rules or .zed/settings.json).",lintRules:Dv,lint:{hooks:Fv,permissions:vv,ignore:Mv},project:fY,globalSupport:{capabilities:yY,detectionPaths:[no],layout:gY},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[mn],global:[]},canonicalDir:kL,canonicalRootFilename:"_root.md",markAsRoot:true}},emitScopedSettings(t,e){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let r={};for(let[n,o]of Object.entries(t.mcp.mcpServers))r[n]=o;return [{path:ro,content:JSON.stringify({context_servers:r},null,2)}]},mergeGeneratedOutputContent(t,e,r,n){return n===ro||n===no?_Y(t,r):null},buildImportPaths:oy,detectionPaths:[mn,ro]};});var qk={};og(qk,{BUILTIN_TARGETS:()=>bt,TARGET_IDS:()=>Ft,getBuiltinTargetDefinition:()=>Pr,getEffectiveTargetSupportLevel:()=>jd,getTargetCapabilities:()=>mi,getTargetDetectionPaths:()=>iR,getTargetLayout:()=>Gt,getTargetManagedOutputs:()=>aR,getTargetPrimaryRootInstructionPath:()=>IY,getTargetSkillDir:()=>qm,isBuiltinTargetId:()=>Pe,resolveTargetFeatureGenerator:()=>uc,rewriteGeneratedOutputPath:()=>lR});function RY(){return sR||(DC(bt),sR=new Map(bt.map(t=>[t.id,t]))),sR}function Pr(t){return RY().get(t)}function mi(t,e="project"){let r=Pr(t)??et(t);if(!r)return;let n=e==="global"?r.globalSupport?.capabilities??r.capabilities:r.capabilities;return TC(n)}function iR(t,e="project"){let r=Pr(t)??et(t);return r?e==="global"?r.globalSupport?.detectionPaths??[]:r.detectionPaths:[]}function Gt(t,e="project"){let r=Pr(t)??et(t);if(r)return e==="global"?r.globalSupport?.layout:r.project}function IY(t,e="project"){return Gt(t,e)?.rootInstructionPath}function qm(t,e="project"){return Gt(t,e)?.skillDir}function aR(t,e="project"){return Gt(t,e)?.managedOutputs}function lR(t,e,r="project"){let n=Gt(t,r);return n?n.rewriteGeneratedPath?n.rewriteGeneratedPath(e):e:null}function Gv(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?!nl(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?!qe(r,t.id,true,n):false}function SY(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?nl(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?qe(r,t.id,true,n):false}function jd(t,e,r,n="project"){let o=mi(t,n)?.[e]?.level??"none",i=Pr(t)??et(t);return o==="none"&&SY(i,e,r,n)?"embedded":o!=="embedded"?o:Gv(i,e,r,n)?"none":o}function uc(t,e,r,n="project"){let o=Pr(t)??et(t);if(!o?.generators||Gv(o,e,r,n))return;let i=CY[e];return i===null?void 0:i(o.generators)}var bt,sR,CY,Pt=d(()=>{ol();wi();se();Ng();Rn();Qg();sy();iy();ly();xO();py();zA();vw();xy();$y();jy();e_();r_();n_();C_();k_();E_();L_();P_();x_();N_();v_();M_();$_();U_();B_();K_();W_();Lv();oR();bt=[su,Fu,vu,Mu,TO,$u,HA,Fw,Hu,Zu,qu,ld,cd,md,_d,Rd,Id,Sd,Ed,Ld,Od,Ad,wd,bd,Td,xd,Dd,Nd,Ev,Gd];s(RY,"builtinTargetsMap");s(Pr,"getBuiltinTargetDefinition");s(mi,"getTargetCapabilities");s(iR,"getTargetDetectionPaths");s(Gt,"getTargetLayout");s(IY,"getTargetPrimaryRootInstructionPath");s(qm,"getTargetSkillDir");s(aR,"getTargetManagedOutputs");s(lR,"rewriteGeneratedOutputPath");s(Gv,"isFeatureSuppressedByConversion");s(SY,"isConversionUpgrading");s(jd,"getEffectiveTargetSupportLevel");CY={rules:s(t=>t.generateRules,"rules"),additionalRules:null,commands:s(t=>t.generateCommands,"commands"),agents:s(t=>t.generateAgents,"agents"),skills:s(t=>t.generateSkills,"skills"),mcp:s(t=>t.generateMcp,"mcp"),permissions:s(t=>t.generatePermissions,"permissions"),hooks:s(t=>t.generateHooks,"hooks"),ignore:s(t=>t.generateIgnore,"ignore")};s(uc,"resolveTargetFeatureGenerator");});function LY(t,e){return t.uniqueHits!==e.uniqueHits?e.uniqueHits-t.uniqueHits:t.sharedScore!==e.sharedScore?e.sharedScore-t.sharedScore:t.id.localeCompare(e.id)}async function Ud(t){let e=[];for(let n of bt){let o=0,i=0;for(let a of n.detectionPaths){if(!await $(join(t,a)))continue;let l=EY.get(a)??1;l===1?o+=1:i+=1/l;}(o>0||i>0)&&e.push({id:n.id,uniqueHits:o,sharedScore:i});}if(e.length===0)return null;e.sort(LY);let r=e[0];return r.uniqueHits===0?null:r.id}var EY,jv,cR=d(()=>{w();Pt();EY=(()=>{let t=new Map;for(let e of bt)for(let r of e.detectionPaths)t.set(r,(t.get(r)??0)+1);return t})();s(LY,"compare");s(Ud,"detectNativeFormat");jv=bt.map(t=>t.detectionPaths[0]).filter(t=>t!==void 0);});async function tp(t,e){let r=et(e);if(!r)throw new Error(`No importer registered for native target: ${e}`);return r.generators.importFrom(t)}var mR=d(()=>{se();s(tp,"importNativeToCanonical");});async function Pa(t){if(!await $(t))return false;if(await $(join(t,uR)))return true;try{let e=await readdir(t,{withFileTypes:!0});for(let r of e)if(!(!r.isDirectory()||r.name.startsWith("."))&&await $(join(t,r.name,uR)))return !0}catch{return false}return false}async function ep(t,e={}){if(!await $(t))return [];if(await $(join(t,uR))){let r=await Bp(t,e);return r?[r]:[]}return Ls(t,e)}var uR,Bd=d(()=>{w();el();uR="SKILL.md";s(Pa,"isSkillPackLayout");s(ep,"loadSkillsAtExtendPath");});async function Kd(t,e={}){return (await Es(t,e)).filter(n=>!In(basename(n.source)))}async function Wd(t,e={}){return (await ks(t,e)).filter(n=>!In(basename(n.source)))}async function Hd(t,e={}){return (await Cs(t,e)).filter(n=>!In(basename(n.source)))}async function Uv(t,e={}){return Ls(t,e)}var zd=d(()=>{Hc();Wc();Kc();el();Co();s(Kd,"importAgents");s(Wd,"importCommands");s(Hd,"importRules");s(Uv,"importSkills");});function fR(t,e){let r=t?.[e];if(!r)return [];let n=Array.isArray(r)?r:[r],o=[];for(let i of n)i.mode!=="directory"||!i.map||!i.extensions||o.push({extensions:i.extensions,map:i.map});return o}function gR(t){return t.toLowerCase().endsWith(".md")}function Kv(t,e){for(let r of fR(et(t)?.importer,e))if(r.extensions.some(n=>!gR(n)))return true;return false}function DY(t,e){let r=new Set;for(let n of fR(et(t)?.importer,e))for(let o of n.extensions)gR(o)||r.add(o.toLowerCase());return r}function NY(t){return wC().filter(e=>Kv(e,t))}async function MY(t,e,r){return FY[t](e,r)}async function $Y(t,e,r){return vY[t](e,r)}async function GY(t,e,r,n={}){let o=fR(et(e)?.importer,r),i=await v(t),a=new Set;for(let p of o)for(let u of p.extensions)gR(u)||a.add(u.toLowerCase());let l=i.filter(p=>[...a].some(u=>p.toLowerCase().endsWith(u))&&!In(basename(p)));if(l.length===0)return {entities:[],cleanup:s(async()=>{},"cleanup")};let c=await mkdtemp(join(tmpdir(),`am-tool-${r}-${e}-`)),m=s(async()=>{await rm(c,{recursive:true,force:true});},"cleanup");try{for(let u of l){let f=await _(u);if(f===null)continue;let g=relative(t,u).replaceAll("\\","/"),h=null;for(let R of o){if(!R.extensions.some(k=>u.toLowerCase().endsWith(k.toLowerCase())))continue;let S=await R.map({absolutePath:u,relativePath:g,content:f,destDir:c,normalizeTo:s(()=>f,"normalizeTo")});if(S){h=S;break}}h&&(await O(dirname(h.destPath)),await I(h.destPath,h.content));}return {entities:await MY(r,c,n),cleanup:m}}catch(p){throw await m(),p}}async function hR(t,e,r={}){let n=r.restrictToTarget,o=n?Kv(n,e)?[n]:[]:NY(e),i=new Set;for(let f of o)for(let g of DY(f,e))i.add(g);let a=await $Y(e,t,{...r.parseOpts,handledByOtherReader:i.size>0?i:void 0}),l=[],c=s(f=>basename(f.source).replace(/\.[^.]+$/,""),"slugOf"),m=new Map;for(let f of a)m.set(c(f),f);for(let f of o){let g=await GY(t,f,e,r.parseOpts??{});l.push(g.cleanup);for(let h of g.entities){let R=c(h);m.has(R)||m.set(R,h);}}return {entities:[...m.values()].sort((f,g)=>c(f).localeCompare(c(g))),cleanup:s(async()=>{await Promise.allSettled(l.map(f=>f()));},"cleanup")}}async function Vd(t,e={}){let r=await hR(t,"commands",e);return {commands:[...r.entities],cleanup:r.cleanup}}async function Jd(t,e={}){let r=await hR(t,"rules",e);return {rules:[...r.entities],cleanup:r.cleanup}}async function Yd(t,e={}){let r=await hR(t,"agents",e);return {agents:[...r.entities],cleanup:r.cleanup}}var FY,vY,Xd=d(()=>{Hc();Wc();Kc();w();se();Co();zd();s(fR,"directorySpecsFor");s(gR,"isMarkdownExtension");s(Kv,"hasNonMdEntityMapper");s(DY,"nonMdEntityExtensions");s(NY,"targetsWithNonMdEntityMapper");FY={rules:Cs,commands:ks,agents:Es},vY={rules:Hd,commands:Wd,agents:Kd};s(MY,"parseEntityDir");s($Y,"importEntities");s(GY,"readToolNativeEntities");s(hR,"readEntityDirWithMappers");s(Vd,"readCommandsDirWithMappers");s(Jd,"readRulesDirWithMappers");s(Yd,"readAgentsDirWithMappers");});function BY(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}function KY(t){return t.rules.length===0&&t.commands.length===0&&t.agents.length===0&&t.skills.length===0&&t.mcp===null&&t.permissions===null&&t.hooks===null&&t.ignore.length===0}async function Zd(t){if(!await $(t))throw new Error(`Path does not exist: ${t}`);let e=await stat(t);if(e.isDirectory())return {sliceRoot:t};if(!e.isFile()||!t.toLowerCase().endsWith(".md"))throw new Error(`Install path must be a directory or a .md file inside rules/, commands/, or agents/: ${t}`);let r=dirname(t),n=basename(r),i=basename(t).replace(/\.md$/i,"");if(n==="rules")return {sliceRoot:r,implicitPick:{rules:[i]}};if(n==="commands")return {sliceRoot:r,implicitPick:{commands:[i]}};if(n==="agents")return {sliceRoot:r,implicitPick:{agents:[i]}};throw new Error(`Single-file install only supports .md files under rules/, commands/, or agents/. Got: ${t}`)}async function RR(t,e){if(basename(t)===e)return t;let r=join(t,e);return await $(r)?r:null}async function WY(t,e,r){let n=s(async()=>{},"noop"),o=await RR(t,"rules");if(!o)return {rules:[],cleanup:n};if(!r)return {rules:await Hd(o,e),cleanup:n};let i=await Jd(o,{parseOpts:e});return {rules:[...i.rules],cleanup:i.cleanup}}async function HY(t,e,r){let n=s(async()=>{},"noop"),o=await RR(t,"commands");if(!o)return {commands:[],cleanup:n};if(!r)return {commands:await Wd(o,e),cleanup:n};let i=await Vd(o,{parseOpts:e});return {commands:[...i.commands],cleanup:i.cleanup}}async function zY(t,e,r){let n=s(async()=>{},"noop"),o=await RR(t,"agents");if(!o)return {agents:[],cleanup:n};if(!r)return {agents:await Kd(o,e),cleanup:n};let i=await Yd(o,{parseOpts:e});return {agents:[...i.agents],cleanup:i.cleanup}}async function VY(t,e){if(await Pa(t))return ep(t,e);let r=join(t,"skills");return await Pa(r)?ep(r,e):[]}async function Qd(t,e={}){let r=s(async()=>{},"noop"),n=join(t,".agentsmesh");if(await $(n))return {canonical:await Ee(t,e),cleanup:r};let o=e.enableTargetEntityMappers??false,i=BY(),a=await WY(t,e,o);i.rules=a.rules;let l=await HY(t,e,o);i.commands=l.commands;let c=await zY(t,e,o);i.agents=c.agents,i.skills=await VY(t,e);let m=s(async()=>{await Promise.allSettled([a.cleanup(),l.cleanup(),c.cleanup()]);},"mergedCleanup");if(KY(i))throw await m(),new Error(`No installable resources at ${t}. Expected .agentsmesh/, or rules/, commands/, agents/, or Anthropic-style skills (SKILL.md). Hint: pass --as commands|agents|rules|skills to force a kind for flat markdown directories.`);return {canonical:i,cleanup:m}}var IR=d(()=>{w();zd();Xd();Ai();Bd();s(BY,"emptyCanonical");s(KY,"isCanonicalSliceEmpty");s(Zd,"normalizeSlicePath");s(RR,"resolveEntityDir");s(WY,"parseRulesAt");s(HY,"parseCommandsAt");s(zY,"parseAgentsAt");s(VY,"loadSkillsForPartialSlice");s(Qd,"loadCanonicalSliceAtPath");});async function qd(t){let e=await _(t);if(!e)return "";let r=Fr(e,t);if(!r.ok)return "";let{frontmatter:n}=r.value;return typeof n.name!="string"?"":n.name.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Wv(t,e){await cp$1(t,e,{recursive:true,filter:s(r=>{let n=relative(t,r).replace(/\\/g,"/");if(n==="")return true;let o=n.split("/")[0];return !(yC(o)||!n.includes("/")&&(jp(n)||_C(n)))},"filter")});}var SR=d(()=>{w();j();Co();s(qd,"readSkillFrontmatterName");s(Wv,"cpFilteredSkill");});function CR(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}function XY(t){let e={...t},r=t.alwaysApply===true;if(e.root=r,delete e.alwaysApply,!r){let n=CR(t.globs),o=typeof t.description=="string"?t.description.trim():"";n.length>0?e.trigger="glob":o.length>0?e.trigger="model_decision":e.trigger="manual";}return e}function ZY(t){let e={...t};return e.trigger==="always"&&(e.trigger="always_on"),typeof e.glob=="string"&&(e.globs=CR(e.globs).length>0?CR(e.globs):[e.glob],delete e.glob),e}function kR(t){let e=Fr(t,"<mdc>");if(!e.ok)return e.bodyFallback;let{frontmatter:r,body:n}=e.value;if(Object.keys(r).length===0&&!t.startsWith("---"))return t;let o;return "alwaysApply"in r?o=XY(r):"trigger"in r||"glob"in r?o=ZY(r):o=r,T(o,n.trim())}var Hv=d(()=>{j();s(CR,"toStrArray");s(XY,"normalizeCursorKeys");s(ZY,"normalizeWindsurfKeys");s(kR,"normalizeMdcToCanonical");});function ER(t){return t.toLowerCase().replace(/[^a-z0-9.-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function LR(t){return t.toLowerCase().endsWith(".mdc")?basename(t).replace(/\.mdc$/i,".md"):basename(t)}function Vv(t,e,r){let o=relative(t,e).replace(/\\/g,"/").split("/");if(o.pop(),o.length===0)return r;let i=ER(o[o.length-1]);return i?`${i}-${r}`:r}var Jv=d(()=>{s(ER,"sanitizeNameSegment");s(LR,"computeDestName");s(Vv,"namespacedName");});async function rX(){let t=await mkdtemp(join(tmpdir(),"am-install-manual-")),e=join(t,"repo");return await O(join(e,".agentsmesh")),{discoveryRoot:e,cleanup:s(async()=>{await rm(t,{recursive:true,force:true});},"cleanup")}}function Qv(t,e){let r=t.toLowerCase();return !!(r.endsWith(".md")||e&&r.endsWith(".mdc"))}async function nX(t,e,r){if(!Qv(t,r))throw new Error(`Manual install only supports .md files for this collection: ${t}`);if(await O(e),t.toLowerCase().endsWith(".mdc")){let n=await _(t);if(!n)return;let o=basename(t).replace(/\.mdc$/i,".md");await writeFile(join(e,o),kR(n));}else await cp$1(t,join(e,basename(t)));}async function oX(t,e,r){if((await stat(t)).isFile())return nX(t,e,r);let o=(await v(t)).filter(l=>Qv(l,r)&&!In(basename(l)));if(o.length===0)throw new Error(`No installable files found under ${t} for manual install. Try a different --path to point at the directory holding *.md (or *.mdc) files, or omit --as so agentsmesh can auto-detect the layout.`);let i=new Map;for(let l of o){let c=LR(l);i.set(c,(i.get(c)??0)+1);}let a=new Map;await O(e);for(let l of o){let c=LR(l),p=(i.get(c)??0)>1?Vv(t,l,c):c;if(a.has(p)&&a.get(p)!==l){let f=relative(t,l).replace(/\\/g,"/").split("/").map(ER).filter(Boolean),g=c.includes(".")?"."+c.split(".").pop():"";p=f.join("-").replace(/\.(md|mdc)$/i,"")+g||p;}if(a.has(p))throw new Error(`Manual install could not resolve duplicate name "${p}" under ${t} (${a.get(p)} and ${l}).`);if(a.set(p,l),l.toLowerCase().endsWith(".mdc")){let f=await _(l);if(!f)continue;await writeFile(join(e,p),kR(f));}else await cp$1(l,join(e,p));}}async function Yv(t,e,r){if(r.length===0)return false;let n=new Set(r),o=new Map;for(let i of await v(t)){if(!i.endsWith("/SKILL.md")&&!i.endsWith("\\SKILL.md"))continue;let a=dirname(i),l=basename(a);if(!n.has(l))continue;let c=o.get(l);if(c&&c!==a)throw new Error(`Manual skill replay found duplicate skill "${l}" under ${t} (${c} and ${a}).`);o.set(l,a);}if(o.size!==r.length)return false;await O(e);for(let i of r)await cp$1(o.get(i),join(e,i),{recursive:true});return true}async function sX(t,e,r={}){if((await stat(t)).isFile()){if(basename(t)!=="SKILL.md")throw new Error(`Manual skill install expects SKILL.md or a skill directory: ${t}`);let o=basename(dirname(t)),i=join(e,o);await O(i),await cp$1(dirname(t),i,{recursive:true});return}if(await Pa(t)){if((await stat(join(t,"SKILL.md")).catch(()=>null))?.isFile()){if(await Yv(t,e,r.preferredSkillNames??[]))return;let l=await qd(join(t,"SKILL.md"))||basename(t),c=join(e,l);await O(e),await Wv(t,c);return}if(await Yv(t,e,r.preferredSkillNames??[]))return;await O(e);let o=await v(t),i=new Set;for(let a of o.filter(l=>l.endsWith("/SKILL.md")||l.endsWith("\\SKILL.md")))i.add(relative(t,dirname(a)).split(/[\\/]/)[0]);for(let a of i)await cp$1(join(t,a),join(e,a),{recursive:true});return}throw new Error(`Manual skill install expects a skill directory or skills collection at ${t}.`)}async function ef(t,e,r={}){let n=await rX();try{let o=join(n.discoveryRoot,".agentsmesh",e);return e==="skills"?await sX(t,o,r):await oX(t,o,e==="rules"),n}catch(o){throw await n.cleanup(),o}}var AR=d(()=>{w();Bd();SR();Co();Hv();Jv();s(rX,"createStageRoot");s(Qv,"isAcceptedFile");s(nX,"stageSingleFile");s(oX,"stageMarkdownCollection");s(Yv,"stagePreferredSkills");s(sX,"stageSkills");s(ef,"stageManualInstallScope");});function iX(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function qv(t){let e=t.resolvedPath;if(t.as!==void 0){let o=t.path?join(e,t.path):e;if(!await $(o))throw new Error(`Extend "${t.name}": path does not exist: ${o}`);let i=await ef(o,t.as);try{return Ee(join(i.discoveryRoot,".agentsmesh"))}finally{await i.cleanup();}}if(!t.path){let o=join(e,".agentsmesh");if(!await $(o)){if(await Pa(e)){let a=await ep(e);return {...iX(),skills:a}}let i=t.target??await Ud(e);if(!i)throw new Error(`Extend "${t.name}": No supported agent configuration found in ${e}.
146
+ Expected one of: .agentsmesh/, ${jv.join(", ")}.`);y.info(`[agentsmesh] Extend "${t.name}": ${t.target?"specified":"detected"} ${i} format, importing to .agentsmesh/...`),await tp(e,i);}return Ee(e)}let r=join(e,t.path);if(!await $(r))throw new Error(`Extend "${t.name}": path does not exist: ${r}`);if(t.target){let o=join(e,".agentsmesh");return await $(o)||(y.info(`[agentsmesh] Extend "${t.name}": path "${t.path}" with target "${t.target}" \u2014 importing at extend root, then loading canonical.`),await tp(e,t.target)),Ee(e)}let{sliceRoot:n}=await Zd(r);try{let{canonical:o}=await Qd(n);return o}catch(o){let i=o instanceof Error?o.message:String(o),a=new Error(`Extend "${t.name}": ${i}`);throw o instanceof Error&&(a.cause=o),a}}var tM=d(()=>{cR();w();ot();Ai();mR();Bd();IR();AR();s(iX,"emptyCanonical");s(qv,"loadCanonicalForExtend");});function rf(t,e,r,n){if(!r)return t;let o={...t};if(r.skills?.length&&e.includes("skills")){let i=new Set(r.skills),a=o.skills;o={...o,skills:a.filter(l=>i.has(l.name))};for(let l of r.skills)a.some(c=>c.name===l)||y.warn(`[agentsmesh] pick name "${l}" not found in skills from extend "${n}".`);}if(r.commands?.length&&e.includes("commands")){let i=new Set(r.commands),a=o.commands;o={...o,commands:a.filter(l=>i.has(l.name))};for(let l of r.commands)a.some(c=>c.name===l)||y.warn(`[agentsmesh] pick name "${l}" not found in commands from extend "${n}".`);}if(r.agents?.length&&e.includes("agents")){let i=new Set(r.agents),a=o.agents;o={...o,agents:a.filter(l=>i.has(l.name))};for(let l of r.agents)a.some(c=>c.name===l)||y.warn(`[agentsmesh] pick name "${l}" not found in agents from extend "${n}".`);}if(r.rules?.length&&e.includes("rules")){let i=new Set(r.rules),a=o.rules,l=s(c=>basename(c).replace(/\.md$/i,""),"stem");o={...o,rules:a.filter(c=>i.has(l(c.source)))};for(let c of r.rules)a.some(m=>l(m.source)===c)||y.warn(`[agentsmesh] pick name "${c}" not found in rules from extend "${n}".`);}return o}var wR=d(()=>{ot();s(rf,"applyExtendPick");});var cX,dc,nf=d(()=>{cX=["rules","commands","agents","skills"],dc=z.enum(cX);});var mX,eM,rM=d(()=>{Ro();nf();mX=z.enum(["github","gitlab","git","local"]),eM=z.object({name:z.string().min(1),source:z.string().min(1),version:z.string().optional(),source_kind:mX,installed_at:z.string(),updated_at:z.string(),features:z.array(Xa).min(1),pick:Mc.optional(),target:Qe.optional(),path:z.string().optional(),paths:z.array(z.string().min(1)).min(1).optional(),as:dc.optional(),content_hash:z.string(),license:z.string().nullable().optional()});});function nM(t){let e=Li(t);return e?e.kind==="github"?`github:${e.org}/${e.repo}`:e.kind==="gitlab"?`gitlab:${e.namespace}/${e.project}`:`git+${e.url}`:t.trim()}function uX(t,e){return e?t.length===e.length&&[...t].sort().every((r,n)=>r===[...e].sort()[n]):true}async function fi(t){let e=join(t,"pack.yaml"),r=await _(e);if(r===null)return null;try{let n=parse(r);return eM.parse(n)}catch{return null}}async function sM(t,e,r){if(!await $(t))return null;let n=nM(e),o;try{o=await readdir(t,{withFileTypes:!0});}catch{return null}for(let i of o){if(!i.isDirectory())continue;let a=join(t,i.name),l=await fi(a);if(l&&nM(l.source)===n&&l.target===r.target&&l.as===r.as&&uX(l.features,r.features))return {meta:l,packDir:a,name:l.name}}return null}async function of(t){if(!await $(t))return [];let e;try{e=await readdir(t,{withFileTypes:!0});}catch{return []}let r=[];for(let n of e){if(!n.isDirectory())continue;let o=join(t,n.name),i=await fi(o);i&&r.push({meta:i,packDir:o,name:i.name});}return r}var fc=d(()=>{w();rM();jc();s(nM,"sourceIdentity");s(uX,"sameFeatures");s(fi,"readPackMetadata");s(sM,"findExistingPack");s(of,"listPacks");});function iM(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function dX(t){let[e,r,n,o,i,a,l,c]=await Promise.all([Cs(join(t,"rules")),ks(join(t,"commands")),Es(join(t,"agents")),Ls(join(t,"skills")),vr(join(t,"mcp.json")),Kp(join(t,"permissions.yaml")),Wp(join(t,"hooks.yaml")),Hp(join(t,"ignore"))]);return {...iM(),rules:e,commands:r,agents:n,skills:o,mcp:i,permissions:a,hooks:l,ignore:c}}async function aM(t){let e=join(t,"packs"),r=await of(e),n=iM();for(let{meta:o,packDir:i}of r){let a=await dX(i),l=PR(a,o.features),c=rf(l,o.features,o.pick,o.name);n=rl(n,c);}return n}var lM=d(()=>{Kc();Wc();Hc();el();zc();Og();wg();bg();Tg();fo();wR();fc();s(iM,"emptyCanonical");s(dX,"loadPackCanonical");s(aM,"loadPacksCanonical");});function PR(t,e){if(e.length===0)return cM();let r=new Set(e.flatMap(n=>gX[n]??[]));return {rules:r.has("rules")?t.rules:[],commands:r.has("commands")?t.commands:[],agents:r.has("agents")?t.agents:[],skills:r.has("skills")?t.skills:[],mcp:r.has("mcp")?t.mcp:null,permissions:r.has("permissions")?t.permissions:null,hooks:r.has("hooks")?t.hooks:null,ignore:r.has("ignore")?t.ignore:[]}}function cM(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function ke(t,e,r={},n=join(e,".agentsmesh")){let o=await qa(t,e,{refreshCache:r.refreshRemoteCache===true}),i=cM();for(let c of o){let m=await qv(c),p=PR(m,c.features),u=rf(p,c.features,c.pick,c.name);i=rl(i,u);}let a=await aM(n);i=rl(i,a);let l=await Ee(n);return i=rl(i,l),{canonical:i,resolvedExtends:o}}var gX,fo=d(()=>{Fp();Ai();Tg();tM();wR();lM();gX={rules:["rules"],commands:["commands"],agents:["agents"],skills:["skills"],mcp:["mcp"],permissions:["permissions"],hooks:["hooks"],ignore:["ignore"]};s(PR,"filterCanonicalByFeatures");s(cM,"emptyCanonical");s(ke,"loadCanonicalWithExtends");});function m2(t,e){let r=join(e,"node_modules",t),n=join(r,"package.json");if(!existsSync(n))throw new Error(`Cannot find package '${t}' in ${join(e,"node_modules")}`);let o=JSON.parse(readFileSync(n,"utf-8")),i=(typeof o.exports=="string"?o.exports:null)??(typeof o.main=="string"?o.main:null)??"index.js",a=resolve(r,i);if(!existsSync(a))throw new Error(`Package '${t}' entry '${i}' does not exist at ${a}`);return a}function p2(t){return t.startsWith("file:")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)}async function u2(t,e){let{source:r}=t,n;if(p2(r)){let i=r.startsWith("file:")?fileURLToPath(r):r,a=resolve(e,i);n=pathToFileURL(a).href;}else {let i=m2(r,e);n=pathToFileURL(i).href;}return await import(n)}function d2(t){return "descriptor"in t?[t.descriptor]:"descriptors"in t&&Array.isArray(t.descriptors)?t.descriptors:"default"in t?[t.default]:[]}async function _f(t,e){let r;try{r=await u2(t,e);}catch(i){throw new Error(`Plugin '${t.source}' failed to import: ${i instanceof Error?i.message:String(i)}`,{cause:i})}let n=d2(r),o=[];for(let i of n)try{let a=zp(i);Jp(a),o.push(a);}catch(a){throw new Error(`Plugin '${t.source}' exported an invalid descriptor: ${a instanceof Error?a.message:String(a)}`,{cause:a})}return {entry:t,descriptors:o}}async function KM(t,e){let r=[],n=process.env.AGENTSMESH_STRICT_PLUGINS==="1"||process.env.AGENTSMESH_STRICT_PLUGINS==="true",i=(await Promise.all(t.map(async a=>{try{let l=await _f(a,e);return r.push(l),null}catch(l){let c=`Plugin '${a.source}' failed to load: ${l instanceof Error?l.message:String(l)}`;return a.strict===true||n?new Error(c):(y.warn(c),null)}}))).filter(a=>a!==null);if(i.length>0){let a=i.map(l=>` - ${l.message}`).join(`
143
147
  `);throw new Error(`agentsmesh: ${i.length} plugin(s) failed strict load:
144
- ${a}`)}return r}var Z_=d(()=>{E_();je();ft();s(pJ,"resolveNpmSpecifier");s(uJ,"isLocalSource");s(dJ,"importPluginModule");s(gJ,"extractDescriptors");s(jd,"loadPlugin");s(ev,"loadAllPlugins");});async function le(t,e){t.plugins.length!==0&&await ev(t.plugins,e);}var ds=d(()=>{Z_();s(le,"bootstrapPlugins");});function tI(t,e,r="project"){let o=[],n=[...t.targets,...t.pluginTargets??[]];for(let i of t.features){let a,c;switch(i){case "rules":c=e.rules.length,a="rules";break;case "commands":c=e.commands.length,a=c>0?`commands (${c})`:"commands";break;case "agents":c=e.agents.length,a=c>0?`agents (${c})`:"agents";break;case "skills":c=e.skills.length,a=c>0?`skills (${c})`:"skills";break;case "mcp":c=e.mcp?Object.keys(e.mcp.mcpServers).length:0,a=c>0?`mcp (${c} servers)`:"mcp";break;case "hooks":c=GJ(e.hooks),a=c>0?`hooks (${c})`:"hooks";break;case "ignore":c=e.ignore.length>0?1:0,a="ignore";break;case "permissions":c=e.permissions&&(e.permissions.allow.length>0||e.permissions.deny.length>0)?1:0,a="permissions";break;default:continue}let l={};for(let m of n)l[m]=hd(m,i,t,r);if(o.push({feature:a,count:c,support:l}),i==="rules"){let m=e.rules.filter(p=>!p.root);if(m.length>0){let p={};for(let u of n)p[u]=hd(u,"additionalRules",t,r);o.push({feature:`additional rules (${m.length})`,count:m.length,support:p});}}}return o}function GJ(t){if(!t)return 0;let e=0;for(let r of Object.values(t))Array.isArray(r)&&(e+=r.length);return e}var pv=d(()=>{xt();s(tI,"buildCompatibilityMatrix");s(GJ,"countHooks");});function uv(t){return MJ[t]??t}var MJ,dv=d(()=>{MJ={"claude-code":"Claude"};s(uv,"matrixColumnLabel");});function gv(t){return Object.fromEntries($J.map(e=>[e,Object.fromEntries(kt.map(r=>{let n=oi(r,t)?.[e];return [r,n??{level:"none"}]}))]))}function jJ(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function UJ(t,e){return jJ()?e:`${t}${e}${Nm.reset}`}function hv(t){let e=eI[t];return UJ(KJ[t],e)}var $J,fv,eI,Nm,KJ,rI=d(()=>{uo();xt();$J=["rules","additionalRules","commands","agents","skills","mcp","hooks","ignore","permissions"];s(gv,"buildSupportMatrix");fv=gv("project"),gv("global"),eI={native:"\u2713",embedded:"\u25C6",partial:"\u25D0",none:"\u2013"},Nm={green:"\x1B[32m",blue:"\x1B[34m",yellow:"\x1B[33m",dim:"\x1B[2m",cyan:"\x1B[36m",magenta:"\x1B[35m",bold:"\x1B[1m",reset:"\x1B[0m"};s(jJ,"noColor");s(UJ,"colorize");KJ={native:Nm.green,embedded:Nm.blue,partial:Nm.yellow,none:Nm.dim};s(hv,"coloredSymbol");});function oI(t,e){let r=process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="",o={cyan:"\x1B[36m",magenta:"\x1B[35m",bold:"\x1B[1m",dim:"\x1B[2m",green:"\x1B[32m",blue:"\x1B[34m",yellow:"\x1B[33m",reset:"\x1B[0m"},n=s((X,q)=>r?q:`${X}${q}${o.reset}`,"c"),i=s(X=>X.replace(/\u001b\[[0-9;]*m/g,"").length,"visibleLength"),a=s((X,q)=>{let Ft=i(X),Gt=Math.max(0,q-Ft);return X+" ".repeat(Gt)},"padWithColor"),c=Math.max(12,...e.map(X=>X.length)),l=e.map(X=>uv(X)),m=Math.max(8,c),p=Math.max(12,...t.map(X=>X.feature.length)),u=s(X=>n(o.dim,"\u250C"+X.map(q=>"\u2500".repeat(q)).join("\u252C")+"\u2510"),"border"),g=s(X=>n(o.dim,"\u251C"+X.map(q=>"\u2500".repeat(q)).join("\u253C")+"\u2524"),"sep"),f=s(X=>n(o.dim,"\u2514"+X.map(q=>"\u2500".repeat(q)).join("\u2534")+"\u2518"),"bottom"),h=[p,...e.map(()=>m)],O=u(h),R=[a(n(o.bold+o.cyan,"Feature"),p),...l.map(X=>a(n(o.bold+o.magenta,X),m))],S=n(o.dim,"\u2502")+R.join(n(o.dim,"\u2502"))+n(o.dim,"\u2502"),A=g(h),D=t.map(X=>{let q=[a(n(o.cyan,X.feature),p)];for(let Ft of e){let Gt=X.support[Ft]??"none",co=r?eI[Gt]:hv(Gt);q.push(a(` ${co} `,m));}return n(o.dim,"\u2502")+q.join(n(o.dim,"\u2502"))+n(o.dim,"\u2502")}),N=f(h),G=[O,S,A,...D,N];G.push("");let J=[n(o.green,"\u2713")+" = native",n(o.blue,"\u25C6")+" = embedded",n(o.yellow,"\u25D0")+" = partial",n(o.dim,"\u2013")+" = not supported"];return G.push(n(o.bold,"Legend: ")+J.join(" ")),G.join(`
145
- `)}var yv=d(()=>{dv();rI();s(oI,"formatMatrix");});function sI(t){let e=[];if(t.rules.length>0&&e.push(`rules: ${t.rules.map(r=>basename(r.source)).join(", ")}`),t.commands.length>0&&e.push(`commands: ${t.commands.map(r=>basename(r.source)).join(", ")}`),t.agents.length>0&&e.push(`agents: ${t.agents.map(r=>basename(r.source)).join(", ")}`),t.skills.length>0&&e.push(`skills: ${t.skills.map(r=>r.name).join(", ")}`),t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&e.push(`mcp: ${Object.keys(t.mcp.mcpServers).join(", ")}`),t.hooks){let r=Object.values(t.hooks).reduce((o,n)=>o+(Array.isArray(n)?n.length:0),0);r>0&&e.push(`hooks: ${r} entries in hooks.yaml`);}return t.ignore.length>0&&e.push("ignore: .agentsmesh/ignore"),t.permissions&&t.permissions.allow.length+t.permissions.deny.length>0&&e.push("permissions: .agentsmesh/permissions.yaml"),e.length===0?"":`
148
+ ${a}`)}return r}var UR=d(()=>{xg();se();ot();s(m2,"resolveNpmSpecifier");s(p2,"isLocalSource");s(u2,"importPluginModule");s(d2,"extractDescriptors");s(_f,"loadPlugin");s(KM,"loadAllPlugins");});async function Wt(t,e){t.plugins.length!==0&&await KM(t.plugins,e);}var fn=d(()=>{UR();s(Wt,"bootstrapPlugins");});function WR(t,e,r="project"){let n=[],o=[...t.targets,...t.pluginTargets??[]];for(let i of t.features){let a,l;switch(i){case "rules":l=e.rules.length,a="rules";break;case "commands":l=e.commands.length,a=l>0?`commands (${l})`:"commands";break;case "agents":l=e.agents.length,a=l>0?`agents (${l})`:"agents";break;case "skills":l=e.skills.length,a=l>0?`skills (${l})`:"skills";break;case "mcp":l=e.mcp?Object.keys(e.mcp.mcpServers).length:0,a=l>0?`mcp (${l} servers)`:"mcp";break;case "hooks":l=v2(e.hooks),a=l>0?`hooks (${l})`:"hooks";break;case "ignore":l=e.ignore.length>0?1:0,a="ignore";break;case "permissions":l=e.permissions&&(e.permissions.allow.length>0||e.permissions.deny.length>0)?1:0,a="permissions";break;default:continue}let c={};for(let m of o)c[m]=jd(m,i,t,r);if(n.push({feature:a,count:l,support:c}),i==="rules"){let m=e.rules.filter(p=>!p.root);if(m.length>0){let p={};for(let u of o)p[u]=jd(u,"additionalRules",t,r);n.push({feature:`additional rules (${m.length})`,count:m.length,support:p});}}}return n}function v2(t){if(!t)return 0;let e=0;for(let r of Object.values(t))Array.isArray(r)&&(e+=r.length);return e}var QM=d(()=>{Pt();s(WR,"buildCompatibilityMatrix");s(v2,"countHooks");});function qM(t){return M2[t]??t}var M2,t$=d(()=>{M2={"claude-code":"Claude"};s(qM,"matrixColumnLabel");});function e$(t){return Object.fromEntries($2.map(e=>[e,Object.fromEntries(Ft.map(r=>{let o=mi(r,t)?.[e];return [r,o??{level:"none"}]}))]))}function G2(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function j2(t,e){return G2()?e:`${t}${e}${sp.reset}`}function n$(t){let e=HR[t];return j2(U2[t],e)}var $2,r$,HR,sp,U2,zR=d(()=>{Rn();Pt();$2=["rules","additionalRules","commands","agents","skills","mcp","hooks","ignore","permissions"];s(e$,"buildSupportMatrix");r$=e$("project"),e$("global"),HR={native:"\u2713",embedded:"\u25C6",partial:"\u25D0",none:"\u2013"},sp={green:"\x1B[32m",blue:"\x1B[34m",yellow:"\x1B[33m",dim:"\x1B[2m",cyan:"\x1B[36m",magenta:"\x1B[35m",bold:"\x1B[1m",reset:"\x1B[0m"};s(G2,"noColor");s(j2,"colorize");U2={native:sp.green,embedded:sp.blue,partial:sp.yellow,none:sp.dim};s(n$,"coloredSymbol");});function VR(t,e){let r=process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="",n={cyan:"\x1B[36m",magenta:"\x1B[35m",bold:"\x1B[1m",dim:"\x1B[2m",green:"\x1B[32m",blue:"\x1B[34m",yellow:"\x1B[33m",reset:"\x1B[0m"},o=s((z,Q)=>r?Q:`${z}${Q}${n.reset}`,"c"),i=s(z=>z.replace(/\u001b\[[0-9;]*m/g,"").length,"visibleLength"),a=s((z,Q)=>{let at=i(z),At=Math.max(0,Q-at);return z+" ".repeat(At)},"padWithColor"),l=Math.max(12,...e.map(z=>z.length)),c=e.map(z=>qM(z)),m=Math.max(8,l),p=Math.max(12,...t.map(z=>z.feature.length)),u=s(z=>o(n.dim,"\u250C"+z.map(Q=>"\u2500".repeat(Q)).join("\u252C")+"\u2510"),"border"),f=s(z=>o(n.dim,"\u251C"+z.map(Q=>"\u2500".repeat(Q)).join("\u253C")+"\u2524"),"sep"),g=s(z=>o(n.dim,"\u2514"+z.map(Q=>"\u2500".repeat(Q)).join("\u2534")+"\u2518"),"bottom"),h=[p,...e.map(()=>m)],R=u(h),C=[a(o(n.bold+n.cyan,"Feature"),p),...c.map(z=>a(o(n.bold+n.magenta,z),m))],S=o(n.dim,"\u2502")+C.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502"),k=f(h),P=t.map(z=>{let Q=[a(o(n.cyan,z.feature),p)];for(let at of e){let At=z.support[at]??"none",wt=r?HR[At]:n$(At);Q.push(a(` ${wt} `,m));}return o(n.dim,"\u2502")+Q.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502")}),N=g(h),F=[R,S,k,...P,N];F.push("");let W=[o(n.green,"\u2713")+" = native",o(n.blue,"\u25C6")+" = embedded",o(n.yellow,"\u25D0")+" = partial",o(n.dim,"\u2013")+" = not supported"];return F.push(o(n.bold,"Legend: ")+W.join(" ")),F.join(`
149
+ `)}var o$=d(()=>{t$();zR();s(VR,"formatMatrix");});function YR(t){let e=[];if(t.rules.length>0&&e.push(`rules: ${t.rules.map(r=>basename(r.source)).join(", ")}`),t.commands.length>0&&e.push(`commands: ${t.commands.map(r=>basename(r.source)).join(", ")}`),t.agents.length>0&&e.push(`agents: ${t.agents.map(r=>basename(r.source)).join(", ")}`),t.skills.length>0&&e.push(`skills: ${t.skills.map(r=>r.name).join(", ")}`),t.mcp&&Object.keys(t.mcp.mcpServers).length>0&&e.push(`mcp: ${Object.keys(t.mcp.mcpServers).join(", ")}`),t.hooks){let r=Object.values(t.hooks).reduce((n,o)=>n+(Array.isArray(o)?o.length:0),0);r>0&&e.push(`hooks: ${r} entries in hooks.yaml`);}return t.ignore.length>0&&e.push("ignore: .agentsmesh/ignore"),t.permissions&&t.permissions.allow.length+t.permissions.deny.length>0&&e.push("permissions: .agentsmesh/permissions.yaml"),e.length===0?"":`
146
150
  Per-file details:
147
151
  `+e.join(`
148
152
  `)+`
149
- `}var _v=d(()=>{s(sI,"formatVerboseDetails");});var iI=d(()=>{pv();yv();_v();});var aI={};gg(aI,{runMatrix:()=>Fm});async function Fm(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",n=t.targets,i=typeof n=="string"&&n?n.split(",").map(g=>g.trim()).filter(Boolean):void 0,{config:a,context:c}=await Tt(r,o);await le(a,r);let{canonical:l}=await he(a,c.configDir,{},c.canonicalDir),m=i??[...a.targets,...a.pluginTargets??[]],p=tI(a,l,o),u=sI(l);return {exitCode:0,data:{targets:m,features:p.map(g=>({name:g.feature,support:g.support}))},verboseDetails:u||void 0}}var vm=d(()=>{Oe();ln();iI();ds();s(Fm,"runMatrix");});var cI={};gg(cI,{renderMatrix:()=>Gm});function Gm(t,e){if(t.data.features.length===0){I.info("No features enabled. Enable features in agentsmesh.yaml.");return}let r=t.data.features.map(n=>({feature:n.name,count:0,support:n.support})),o=oI(r,t.data.targets);process.stdout.write(o),process.stdout.write(`
153
+ `}var s$=d(()=>{s(YR,"formatVerboseDetails");});var XR=d(()=>{QM();o$();s$();});var ZR={};og(ZR,{runMatrix:()=>ip});async function ip(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,i=typeof o=="string"&&o?o.split(",").map(f=>f.trim()).filter(Boolean):void 0,{config:a,context:l}=await yt(r,n);await Wt(a,r);let{canonical:c}=await ke(a,l.configDir,{},l.canonicalDir),m=i??[...a.targets,...a.pluginTargets??[]],p=WR(a,c,n),u=YR(c);return {exitCode:0,data:{targets:m,features:p.map(f=>({name:f.feature,support:f.support}))},verboseDetails:u||void 0}}var ap=d(()=>{Yt();fo();XR();fn();s(ip,"runMatrix");});var QR={};og(QR,{renderMatrix:()=>lp});function lp(t,e){if(t.data.features.length===0){y.info("No features enabled. Enable features in agentsmesh.yaml.");return}let r=t.data.features.map(o=>({feature:o.name,count:0,support:o.support})),n=VR(r,t.data.targets);process.stdout.write(n),process.stdout.write(`
150
154
  `),e?.verbose&&t.verboseDetails&&(process.stdout.write(t.verboseDetails),process.stdout.write(`
151
- `));}var Mm=d(()=>{ft();iI();s(Gm,"renderMatrix");});function RR(t){let e=Object.keys(t);return {async route(r,o,n){let i=t[r];if(i){await i(o,n);return}throw new Error(`Unknown command "${r}". Available: ${e.join(", ")}`)},commands:s(()=>[...e],"commands")}}s(RR,"createRouter");ft();var OR=[{name:"--help",description:"Show this help output and exit"},{name:"--version",description:"Print CLI version and exit"},{name:"--verbose",description:"Show full error details on failure"},{name:"--json",description:"Output machine-readable JSON (single envelope to stdout)"}],LR=[{name:"init",usage:"agentsmesh init [flags]",description:"Create agentsmesh.yaml, agentsmesh.local.yaml, and canonical .agentsmesh scaffold",flags:[{name:"--global",description:"Initialize canonical home config under ~/.agentsmesh/ (global targets include claude-code, antigravity, codex-cli, cursor, gemini-cli, kilo-code)"},{name:"--yes",description:"Auto-import detected tool configs, then add example scaffold only under empty canonical paths"}]},{name:"generate",usage:"agentsmesh generate [flags]",description:"Generate target files from canonical sources",flags:[{name:"--global",description:"Generate user-level config from ~/.agentsmesh/ (e.g. claude-code, antigravity, codex-cli, gemini-cli, kilo-code; Cursor writes ~/.cursor/rules, ~/.cursor/AGENTS.md, hooks, ignore, MCP, skills, agents, commands; legacy ~/.agentsmesh-exports/cursor/user-rules.md is import-only)"},{name:"--targets <csv>",description:"Limit generation to target IDs (comma-separated)"},{name:"--check",description:"Check drift only; exit non-zero when out of sync"},{name:"--dry-run",description:"Preview file changes without writing outputs"},{name:"--force",description:"Bypass lock-strategy blocked feature violations"},{name:"--refresh-cache",description:"Refresh remote extends cache before loading"},{name:"--no-cache",description:"Alias for --refresh-cache"}]},{name:"import",usage:"agentsmesh import --from <target> [flags]",description:"Import existing tool config into canonical .agentsmesh files",flags:[{name:"--from <target>",description:"Source tool ID to import from (required)"},{name:"--global",description:"Import from user-level paths into ~/.agentsmesh/ (claude-code, antigravity, codex-cli, gemini-cli, kilo-code; cursor reads ~/.cursor/{rules,AGENTS.md,mcp.json,hooks.json,cursorignore,skills,agents,commands} and legacy ~/.agentsmesh-exports/cursor/user-rules.md)"}]},{name:"convert",usage:"agentsmesh convert --from <target> --to <target> [flags]",description:"Convert configuration directly from one tool to another",flags:[{name:"--from <target>",description:"Source tool ID to convert from (required)"},{name:"--to <target>",description:"Destination tool ID to convert to (required)"},{name:"--global",description:"Convert user-level config (use home directory paths)"},{name:"--dry-run",description:"Preview conversion without writing files"}]},{name:"install",usage:"agentsmesh install <source> [flags]",description:"Install canonical resources from local/remote sources",flags:[{name:"<source>",description:"GitHub/GitLab/tree/blob URL, git+ URL, SSH, or local path"},{name:"--sync",description:"Reinstall missing packs recorded in .agentsmesh/installs.yaml"},{name:"--path <dir>",description:"Subdirectory inside source repo when not embedded in URL"},{name:"--target <id>",description:"Native format used for import-at-root discovery (same as extends.target)"},{name:"--as <kind>",description:"Manual collection mode: rules, commands, agents, or skills"},{name:"--name <id>",description:"Override generated install entry/pack name"},{name:"--extends",description:"Write install as extends entry instead of materialized pack"},{name:"--dry-run",description:"Preview only (no YAML write, no pack write, no generate)"},{name:"--global",description:"Install into ~/.agentsmesh/ and regenerate user-level config"},{name:"--force",description:"Non-interactive mode; include invalid resources and skip selection prompts (implied by --json)"}]},{name:"diff",usage:"agentsmesh diff [flags]",description:"Show patch-style output for what generate would change",flags:[{name:"--global",description:"Diff against outputs generated from ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit diff to target IDs (comma-separated)"}]},{name:"lint",usage:"agentsmesh lint [flags]",description:"Validate canonical files against target constraints",flags:[{name:"--global",description:"Lint canonical home config under ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit linting to target IDs (comma-separated)"}]},{name:"watch",usage:"agentsmesh watch [flags]",description:"Watch canonical files and regenerate on change",flags:[{name:"--global",description:"Watch ~/.agentsmesh/ and regenerate user-level config"},{name:"--targets <csv>",description:"Limit watched generate/matrix output to target IDs"}]},{name:"check",usage:"agentsmesh check",description:"Verify canonical files still match .agentsmesh/.lock",flags:[{name:"--global",description:"Check ~/.agentsmesh/.lock"}]},{name:"merge",usage:"agentsmesh merge",description:"Resolve .agentsmesh/.lock merge conflicts from current canonical state",flags:[{name:"--global",description:"Resolve ~/.agentsmesh/.lock conflicts"}]},{name:"matrix",usage:"agentsmesh matrix [flags]",description:"Print compatibility matrix for enabled features and targets",flags:[{name:"--global",description:"Show matrix for canonical home config under ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit matrix columns to target IDs"},{name:"--verbose",description:"Include expanded feature details in matrix output"}]},{name:"target",usage:"agentsmesh target scaffold <id> [--name <displayName>] [--force]",description:"Generate a new target skeleton (files, tests, fixture) under src/targets/<id>/.",flags:[{name:"--name <displayName>",description:"Human-readable name (defaults to id)"},{name:"--force",description:"Overwrite existing files"}]},{name:"plugin",usage:"agentsmesh plugin <add|list|remove|info> [args] [flags]",description:"Manage plugin-provided targets (npm packages exporting a TargetDescriptor).",flags:[{name:"--version <v>",description:"Pin plugin version (add)"},{name:"--id <id>",description:"Override derived plugin id (add)"}]},{name:"mcp",usage:"agentsmesh mcp",description:"Start the agentsmesh MCP server (stdio)",flags:[]}];function AR(t,e=18){return t.length===0?" (no command-specific flags)":t.map(r=>` ${r.name.padEnd(e)}${r.description}`).join(`
152
- `)}s(AR,"formatFlags");function kR(){let t=LR.map(e=>`- ${e.name.padEnd(8)} ${e.description}
155
+ `));}var cp=d(()=>{ot();XR();s(lp,"renderMatrix");});function _S(t){let e=Object.keys(t);return {async route(r,n,o){let i=t[r];if(i){await i(n,o);return}throw new Error(`Unknown command "${r}". Available: ${e.join(", ")}`)},commands:s(()=>[...e],"commands")}}s(_S,"createRouter");ot();var sg=[{name:"--help",description:"Show this help output and exit"},{name:"--version",description:"Print CLI version and exit"},{name:"--verbose",description:"Show full error details on failure"},{name:"--json",description:"Output machine-readable JSON (single envelope to stdout)"}],ig=[{name:"init",usage:"agentsmesh init [flags]",description:"Create agentsmesh.yaml, agentsmesh.local.yaml, and canonical .agentsmesh scaffold",flags:[{name:"--global",description:"Initialize canonical home config under ~/.agentsmesh/ (global targets include claude-code, antigravity, codex-cli, cursor, gemini-cli, kilo-code)"},{name:"--yes",description:"Auto-import detected tool configs, then add example scaffold only under empty canonical paths"}]},{name:"generate",usage:"agentsmesh generate [flags]",description:"Generate target files from canonical sources",flags:[{name:"--global",description:"Generate user-level config from ~/.agentsmesh/ (e.g. claude-code, antigravity, codex-cli, gemini-cli, kilo-code; Cursor writes ~/.cursor/rules, ~/.cursor/AGENTS.md, hooks, ignore, MCP, skills, agents, commands; legacy ~/.agentsmesh-exports/cursor/user-rules.md is import-only)"},{name:"--targets <csv>",description:"Limit generation to target IDs (comma-separated)"},{name:"--check",description:"Check drift only; exit non-zero when out of sync"},{name:"--dry-run",description:"Preview file changes without writing outputs"},{name:"--force",description:"Bypass lock-strategy blocked feature violations"},{name:"--refresh-cache",description:"Refresh remote extends cache before loading"},{name:"--no-cache",description:"Alias for --refresh-cache"}]},{name:"import",usage:"agentsmesh import --from <target> [flags]",description:"Import existing tool config into canonical .agentsmesh files",flags:[{name:"--from <target>",description:"Source tool ID to import from (required)"},{name:"--global",description:"Import from user-level paths into ~/.agentsmesh/ (claude-code, antigravity, codex-cli, gemini-cli, kilo-code; cursor reads ~/.cursor/{rules,AGENTS.md,mcp.json,hooks.json,cursorignore,skills,agents,commands} and legacy ~/.agentsmesh-exports/cursor/user-rules.md)"}]},{name:"convert",usage:"agentsmesh convert --from <target> --to <target> [flags]",description:"Convert configuration directly from one tool to another",flags:[{name:"--from <target>",description:"Source tool ID to convert from (required)"},{name:"--to <target>",description:"Destination tool ID to convert to (required)"},{name:"--global",description:"Convert user-level config (use home directory paths)"},{name:"--dry-run",description:"Preview conversion without writing files"}]},{name:"install",usage:"agentsmesh install <source> [flags]",description:"Install rules/commands/agents/skills from a local path or remote repo. Auto-classifies anthropic-skill-pack / canonical-agentsmesh / tool-native sources. When auto-detection is ambiguous or refuses a non-standard layout, override with: --path <dir> to narrow scope, --as <kind> to force a flat collection (rules|commands|agents|skills), --target <id> to lock the native importer, or --all to install every sub-pack of a marketplace.",flags:[{name:"<source>",description:"GitHub/GitLab/tree/blob URL, git+ URL, SSH, or local path"},{name:"--sync",description:"Reinstall missing packs recorded in .agentsmesh/installs.yaml"},{name:"--path <dir>",description:"Subdirectory inside source repo when not embedded in URL"},{name:"--target <id>",description:"Native format used for import-at-root discovery (same as extends.target)"},{name:"--as <kind>",description:"Manual collection mode: rules, commands, agents, or skills"},{name:"--name <id>",description:"Override generated install entry/pack name"},{name:"--extends",description:"Write install as extends entry instead of materialized pack"},{name:"--dry-run",description:"Preview only (no YAML write, no pack write, no generate)"},{name:"--global",description:"Install into ~/.agentsmesh/ and regenerate user-level config"},{name:"--all",description:"Install every sub-pack from a marketplace source"},{name:"--force",description:"Non-interactive mode; include invalid resources and skip selection prompts (implied by --json)"}]},{name:"installs",usage:"agentsmesh installs <subcommand> [flags]",description:"Read-only inventory of installed packs (subcommands: list)",flags:[{name:"list",description:"List installed packs (NAME, SOURCE, FEATURES, INSTALLED)"},{name:"--global",description:"Read from ~/.agentsmesh/installs.yaml"}]},{name:"uninstall",usage:"agentsmesh uninstall <name>[,<name>...] [flags]",description:"Remove an installed pack; cleans installs.yaml, extends, and generated outputs",flags:[{name:"<name>",description:"Install entry name from installs.yaml (comma-separated for batch)"},{name:"--all",description:"Remove every installed pack in this scope"},{name:"--keep-pack",description:"Keep .agentsmesh/packs/<name>/ on disk; only drop yaml/extends entries"},{name:"--keep-generated",description:"Skip the post-uninstall generate pass; warn about stale target files"},{name:"--global",description:"Uninstall from ~/.agentsmesh/"},{name:"--dry-run",description:"Preview removal plan; no writes"},{name:"--force",description:"Non-interactive mode; accept all prompts (delete-anyway on modifications). Implied by --json."}]},{name:"diff",usage:"agentsmesh diff [flags]",description:"Show patch-style output for what generate would change",flags:[{name:"--global",description:"Diff against outputs generated from ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit diff to target IDs (comma-separated)"}]},{name:"lint",usage:"agentsmesh lint [flags]",description:"Validate canonical files against target constraints",flags:[{name:"--global",description:"Lint canonical home config under ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit linting to target IDs (comma-separated)"}]},{name:"watch",usage:"agentsmesh watch [flags]",description:"Watch canonical files and regenerate on change",flags:[{name:"--global",description:"Watch ~/.agentsmesh/ and regenerate user-level config"},{name:"--targets <csv>",description:"Limit watched generate/matrix output to target IDs"}]},{name:"check",usage:"agentsmesh check",description:"Verify canonical files still match .agentsmesh/.lock",flags:[{name:"--global",description:"Check ~/.agentsmesh/.lock"}]},{name:"merge",usage:"agentsmesh merge",description:"Resolve .agentsmesh/.lock merge conflicts from current canonical state",flags:[{name:"--global",description:"Resolve ~/.agentsmesh/.lock conflicts"}]},{name:"matrix",usage:"agentsmesh matrix [flags]",description:"Print compatibility matrix for enabled features and targets",flags:[{name:"--global",description:"Show matrix for canonical home config under ~/.agentsmesh/"},{name:"--targets <csv>",description:"Limit matrix columns to target IDs"},{name:"--verbose",description:"Include expanded feature details in matrix output"}]},{name:"target",usage:"agentsmesh target scaffold <id> [--name <displayName>] [--force]",description:"Generate a new target skeleton (files, tests, fixture) under src/targets/<id>/.",flags:[{name:"--name <displayName>",description:"Human-readable name (defaults to id)"},{name:"--force",description:"Overwrite existing files"}]},{name:"plugin",usage:"agentsmesh plugin <add|list|remove|info> [args] [flags]",description:"Manage plugin-provided targets (npm packages exporting a TargetDescriptor).",flags:[{name:"--version <v>",description:"Pin plugin version (add)"},{name:"--id <id>",description:"Override derived plugin id (add)"}]},{name:"mcp",usage:"agentsmesh mcp",description:"Start the agentsmesh MCP server (stdio)",flags:[]}];function Ep(t,e=18){return t.length===0?" (no command-specific flags)":t.map(r=>` ${r.name.padEnd(e)}${r.description}`).join(`
156
+ `)}s(Ep,"formatFlags");function ag(){let t=ig.map(e=>`- ${e.name.padEnd(8)} ${e.description}
153
157
  Usage: ${e.usage}
154
- ${AR(e.flags)}`).join(`
158
+ ${Ep(e.flags)}`).join(`
155
159
 
156
- `);I.info(`agentsmesh <command> [flags]
160
+ `);y.info(`agentsmesh <command> [flags]
157
161
 
158
162
  Global flags:
159
- ${AR(OR)}
163
+ ${Ep(sg)}
160
164
 
161
165
  Commands:
162
166
  ${t}
163
167
 
164
- Tip: run "agentsmesh <command> --help" for this same command reference.`);}s(kR,"printHelp");var Qm;function l$(){try{let t=createRequire(import.meta.url),e=dirname(fileURLToPath(import.meta.url)),r=e.endsWith("dist")?join(e,"..","package.json"):join(e,"..","..","package.json");return t(r).version}catch{return}}s(l$,"readPackageVersion");function m$(){if(typeof __AGENTSMESH_VERSION__<"u")return __AGENTSMESH_VERSION__;let t=globalThis.__AGENTSMESH_VERSION__;return typeof t=="string"?t:"unknown"}s(m$,"getVersionFallback");function gl(){return Qm||(Qm=l$()??m$(),Qm)}s(gl,"getVersion");function TR(){process.stdout.write(`agentsmesh v${gl()}
165
- `);}s(TR,"printVersion");ft();function Da(t,e){let r={success:e.success,command:t};e.success?r.data=e.data:(r.error=e.error,e.data!==void 0&&(r.data=e.data)),process.stdout.write(JSON.stringify(r)+`
166
- `);}s(Da,"emitJson");var mo=class extends Error{static{s(this,"CliUsageError");}constructor(e){super(e),this.name="CliUsageError";}};function bR(t,e){let r=t instanceof mo?2:1;if(e?.json)return Da(e.command??"unknown",{success:false,error:t.message}),process.exit(r);e?.verbose&&t.stack?process.stderr.write(t.stack+`
167
- `):I.error(t.message),process.exit(r);}s(bR,"handleError");ft();function Ee(t,e,r,o){if(r.json===true){let n=e.exitCode===0;Da(t,n?{success:true,data:e.data}:{success:false,error:`Command '${t}' failed`,data:e.data}),process.exit(e.exitCode);return}o(),e.exitCode!==0&&process.exit(e.exitCode);}s(Ee,"handleResult");Oe();ln();T();function xm(t){return createHash("sha256").update(t,"utf8").digest("hex")}s(xm,"hashContent");async function xd(t){try{let e=await readFile(t,"utf8");return xm(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return null;throw e}}s(xd,"hashFile");Pd();var W_=".lock",wV=[t=>t.startsWith("rules/")&&t.endsWith(".md"),t=>t.startsWith("commands/")&&t.endsWith(".md"),t=>t.startsWith("agents/")&&t.endsWith(".md"),t=>t.match(/^skills\/[^/]+\/.+$/)!==null,t=>t==="mcp.json",t=>t==="permissions.yaml",t=>t==="hooks.yaml",t=>t==="ignore"];function TV(t){return t.startsWith("packs/")?false:wV.some(e=>e(t))}s(TV,"isCanonical");var bV={rules:s(t=>t.startsWith("rules/"),"rules"),commands:s(t=>t.startsWith("commands/"),"commands"),agents:s(t=>t.startsWith("agents/"),"agents"),skills:s(t=>/^skills\/[^/]+\/.+$/.test(t),"skills"),mcp:s(t=>t==="mcp.json","mcp"),permissions:s(t=>t==="permissions.yaml","permissions"),hooks:s(t=>t==="hooks.yaml","hooks"),ignore:s(t=>t==="ignore","ignore")};async function Dd(t){let e=join(t,W_),r=await y(e);if(r===null)return null;try{let o=parse(r);return !o||typeof o!="object"?null:{generatedAt:String(o.generated_at??""),generatedBy:String(o.generated_by??""),libVersion:String(o.lib_version??""),checksums:o.checksums&&typeof o.checksums=="object"?o.checksums:{},extends:o.extends&&typeof o.extends=="object"?o.extends:{},packs:o.packs&&typeof o.packs=="object"?o.packs:{}}}catch{return null}}s(Dd,"readLock");async function Nd(t,e){let r=join(t,W_),o={generated_at:e.generatedAt,generated_by:e.generatedBy,lib_version:e.libVersion,checksums:e.checksums,extends:e.extends,packs:e.packs},n=`# Auto-generated. DO NOT EDIT MANUALLY.
168
+ Tip: run "agentsmesh <command> --help" for this same command reference.`);}s(ag,"printHelp");function Lp(t){let e=ig.find(r=>r.name===t);if(!e){ag();return}y.info(`${e.usage}
169
+
170
+ ${e.description}
171
+
172
+ Command flags:
173
+ ${Ep(e.flags)}
174
+
175
+ Global flags:
176
+ ${Ep(sg)}`);}s(Lp,"printCommandHelp");var Op;function _0(){try{let t=createRequire(import.meta.url),e=dirname(fileURLToPath(import.meta.url)),r=e.endsWith("dist")?join(e,"..","package.json"):join(e,"..","..","package.json");return t(r).version}catch{return}}s(_0,"readPackageVersion");function R0(){if(typeof __AGENTSMESH_VERSION__<"u")return __AGENTSMESH_VERSION__;let t=globalThis.__AGENTSMESH_VERSION__;return typeof t=="string"?t:"unknown"}s(R0,"getVersionFallback");function Ci(){return Op||(Op=_0()??R0(),Op)}s(Ci,"getVersion");function kS(){process.stdout.write(`agentsmesh v${Ci()}
177
+ `);}s(kS,"printVersion");ot();function Ha(t,e){let r={success:e.success,command:t};e.success?r.data=e.data:(r.error=e.error,e.data!==void 0&&(r.data=e.data)),process.stdout.write(JSON.stringify(r)+`
178
+ `);}s(Ha,"emitJson");var yn=class extends Error{static{s(this,"CliUsageError");}constructor(e){super(e),this.name="CliUsageError";}};function ES(t,e){let r=t instanceof yn?2:1;if(e?.json)return Ha(e.command??"unknown",{success:false,error:t.message}),process.exit(r);e?.verbose&&t.stack?process.stderr.write(t.stack+`
179
+ `):y.error(t.message),process.exit(r);}s(ES,"handleError");ot();function ge(t,e,r,n){if(r.json===true){let o=e.exitCode===0;Ha(t,o?{success:true,data:e.data}:{success:false,error:`Command '${t}' failed`,data:e.data}),process.exit(e.exitCode);return}n(),e.exitCode!==0&&process.exit(e.exitCode);}s(ge,"handleResult");Yt();fo();w();bp();function af(t){return createHash("sha256").update(t,"utf8").digest("hex")}s(af,"hashContent");async function lf(t){try{let e=await readFile(t);return createHash("sha256").update(e).digest("hex")}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return null;throw e}}s(lf,"hashFile");async function cf(t){try{if(!Ap(t)){let r=await readFile(t);return createHash("sha256").update(r).digest("hex")}let e=await readFile(t,"utf-8");return e.startsWith(Ja)&&(e=e.slice(Ja.length)),e=wp(e),createHash("sha256").update(e,"utf8").digest("hex")}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return null;throw e}}s(cf,"hashFileForManifest");fc();var DR=".lock",RX=[t=>t.startsWith("rules/")&&t.endsWith(".md"),t=>t.startsWith("commands/")&&t.endsWith(".md"),t=>t.startsWith("agents/")&&t.endsWith(".md"),t=>t.match(/^skills\/[^/]+\/.+$/)!==null,t=>t==="mcp.json",t=>t==="permissions.yaml",t=>t==="hooks.yaml",t=>t==="ignore"];function IX(t){return t.startsWith("packs/")?false:RX.some(e=>e(t))}s(IX,"isCanonical");var SX={rules:s(t=>t.startsWith("rules/"),"rules"),commands:s(t=>t.startsWith("commands/"),"commands"),agents:s(t=>t.startsWith("agents/"),"agents"),skills:s(t=>/^skills\/[^/]+\/.+$/.test(t),"skills"),mcp:s(t=>t==="mcp.json","mcp"),permissions:s(t=>t==="permissions.yaml","permissions"),hooks:s(t=>t==="hooks.yaml","hooks"),ignore:s(t=>t==="ignore","ignore")};async function mf(t){let e=join(t,DR),r=await _(e);if(r===null)return null;try{let n=parse(r);return !n||typeof n!="object"?null:{generatedAt:String(n.generated_at??""),generatedBy:String(n.generated_by??""),libVersion:String(n.lib_version??""),checksums:n.checksums&&typeof n.checksums=="object"?n.checksums:{},extends:n.extends&&typeof n.extends=="object"?n.extends:{},packs:n.packs&&typeof n.packs=="object"?n.packs:{}}}catch{return null}}s(mf,"readLock");async function pf(t,e){let r=join(t,DR),n={generated_at:e.generatedAt,generated_by:e.generatedBy,lib_version:e.libVersion,checksums:e.checksums,extends:e.extends,packs:e.packs},o=`# Auto-generated. DO NOT EDIT MANUALLY.
168
180
  # Tracks the state of all config files for team conflict resolution.
169
181
 
170
- `+stringify(o);await _(r,n);}s(Nd,"writeLock");async function us(t){if(!await j(t))return {};let e=await v(t),r={};for(let o of e){let n=relative(t,o).replace(/\\/g,"/");if(n===W_||!TV(n))continue;let i=await xd(o);i!==null&&(r[n]=i.startsWith("sha256:")?i:`sha256:${i}`);}return r}s(us,"buildChecksums");function Fd(t,e,r){if(r.length===0)return [];let o=r.map(a=>bV[a]).filter(a=>a!==void 0);if(o.length===0)return [];let n=new Set([...Object.keys(t),...Object.keys(e)]),i=[];for(let a of n)o.some(c=>c(a))&&t[a]!==e[a]&&i.push(a);return i}s(Fd,"detectLockedFeatureViolations");async function vd(t){let e=await bd(t),r={};for(let{meta:o}of e)r[o.name]=o.content_hash;return r}s(vd,"buildPackChecksums");async function qc(t){let e={};for(let r of t){if(r.version!==void 0){e[r.name]=r.version;continue}let o=join(r.resolvedPath,".agentsmesh"),n=await us(o),i=Object.keys(n).sort().map(l=>`${l}:${n[l]}`).join(`
171
- `),a=xm(i),c=a.startsWith("sha256:")?a:`sha256:${a}`;e[r.name]=`local:${c}`;}return e}s(qc,"buildExtendChecksums");xt();je();function tl(t){return t?(t.outputFamilies??[]).filter(e=>e.kind==="additional").flatMap(e=>[...e.explicitPaths??[]]):[]}s(tl,"getAdditionalRootDecorationPaths");function AF(t,e){for(let r of t?.outputFamilies??[])if(r.pathPrefix!==void 0&&e.startsWith(r.pathPrefix)||r.explicitPaths?.includes(e))return r.id;return "default"}s(AF,"resolveRewriteFamilyId");re();x_();function PV(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(PV,"addDirectoryMapping");function kF(t,e,r){let o=posix.dirname(e),n=posix.dirname(r);for(;o!==".agentsmesh/skills"&&o!==".";)PV(t,o,n),o=posix.dirname(o),n=posix.dirname(n);}s(kF,"addSkillDirectoryMappings");xt();function wF(t,e,r="project"){let o=vt(t,r);if(!o)return null;if(e.root)return o.rootInstructionPath??null;if(e.targets.length>0&&!e.targets.includes(t))return null;let n=posix.basename(e.source.replace(/\\/g,"/"),".md");return o.paths.rulePath(n,e)}s(wF,"ruleTargetPath");function TF(t,e,r,o="project"){let n=vt(t,o);return n?n.paths.commandPath(e,r):null}s(TF,"commandTargetPath");function bF(t,e,r,o="project"){let n=vt(t,o);return n?n.paths.agentPath(e,r):null}s(bF,"agentTargetPath");ce();Wt();fe();xt();function NV(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(NV,"addDirectoryMapping");function H_(t,e,r,o="project"){let n=new Map;for(let a of e.rules){let c=wF(t,a,o);c&&n.set(`.agentsmesh/rules/${basename(a.source)}`,c);}for(let a of e.commands){let c=TF(t,a.name,r,o);c&&n.set(`.agentsmesh/commands/${a.name}.md`,c);}for(let a of e.agents){let c=bF(t,a.name,r,o);c&&n.set(`.agentsmesh/agents/${a.name}.md`,c);}let i=Om(t,o);if(!i)return n;for(let a of e.skills){NV(n,`.agentsmesh/skills/${a.name}`,`${i}/${a.name}`),n.set(`.agentsmesh/skills/${a.name}/SKILL.md`,`${i}/${a.name}/SKILL.md`);for(let c of a.supportingFiles){let l=c.relativePath.replace(/\\/g,"/"),m=`.agentsmesh/skills/${a.name}/${l}`,p=`${i}/${a.name}/${l}`;n.set(m,p),kF(n,m,p);}}return n}s(H_,"buildReferenceMap");re();re();xt();function xF(t,e,r,o){let n=o.normalize(e),i=o.normalize(r);t.set(n,i),t.set(`${n}/`,`${i}/`);}s(xF,"addPackAbsoluteDirMapping");function FV(t){let e=new Set;for(let{relativePath:r}of t){let o=r.replace(/\\/g,"/"),n=posix.dirname(o);for(;n!=="."&&n.length>0;){e.add(n);let i=posix.dirname(n);if(i===n)break;n=i;}}return [...e]}s(FV,"skillSupportingDirPrefixes");function DF(t,e,r,o,n){let i=Om(e,n);if(!i)return;let a=et(o),c=a.join(o,".agentsmesh","packs");for(let l of r.skills){let m=a.dirname(l.source);if(!m.startsWith(c))continue;let p=a.normalize(a.join(o,i,l.name));xF(t,m,p,a),t.set(a.normalize(l.source),a.normalize(a.join(p,"SKILL.md")));for(let u of l.supportingFiles){let g=a.normalize(a.join(p,u.relativePath));t.set(a.normalize(u.absolutePath),g);}for(let u of FV(l.supportingFiles))xF(t,a.join(m,u),a.join(p,u),a);}}s(DF,"addPackSkillArtifactMappings");re();function vV(t){return `.agentsmesh/rules/${basename(t.source)}`}s(vV,"canonicalRulePath");function GV(t){return `.github/instructions/${basename(t.source,".md")}.instructions.md`}s(GV,"copilotInstructionsPath");function FF(t,e,r,o,n){if(t!=="copilot"||!o?.startsWith(".github/instructions/"))return;let i=et(r);for(let a of n.rules)a.root||a.globs.length===0||e.set(i.normalize(i.join(r,vV(a))),i.normalize(i.join(r,GV(a))));}s(FF,"applyCopilotInstructionArtifactRefs");xt();function z_(t,e){e!==void 0&&e.length>0&&!t.includes(e)&&t.push(e);}s(z_,"pushUnique");function vF(t,e,r,o){let n=[],i=r.get(`.agentsmesh/rules/${basename(e.source)}`);z_(n,i);let a=vt(t,o);if(e.root)for(let c of tl(a))z_(n,c);for(let c of a?.extraRuleOutputPaths?.(e,{refs:r,scope:o})??[])z_(n,c);return n}s(vF,"extraRuleOutputPaths");xt();function GF(t,e,r,o,n,i){let a=vt(t,e);if(!a?.mirrorGlobalPath)return;let c=a.mirrorGlobalPath(r,i??[]),l=c===null?[]:Array.isArray(c)?c:[c];for(let m of l)m!==r&&n.set(m,o);}s(GF,"addSkillMirrorSourceEntry");function $V(t){return `.agentsmesh/commands/${t.name}.md`}s($V,"canonicalCommandPath");function jV(t){return `.agentsmesh/agents/${t.name}.md`}s(jV,"canonicalAgentPath");function UV(t){return `.agentsmesh/skills/${t.name}/SKILL.md`}s(UV,"canonicalSkillPath");function MF(t,e,r,o,n,i){let a=i?.scope??"project",c=et(o),l=new Map([...H_(t,e,r,a)].map(([m,p])=>[c.normalize(c.join(o,m)),c.normalize(c.join(o,p))]));return FF(t,l,o,n,e),DF(l,t,e,o,a),l}s(MF,"buildArtifactPathMap");function $F(t,e,r,o="project",n){let i=H_(t,e,r,o),a=new Map;for(let c of e.rules)for(let l of vF(t,c,i,o))a.set(l,c.source);for(let c of e.commands){let l=i.get($V(c));l&&a.set(l,c.source);}for(let c of e.agents){let l=i.get(jV(c));l&&a.set(l,c.source);}for(let c of e.skills){let l=i.get(UV(c));l&&(a.set(l,c.source),GF(t,o,l,c.source,a,n));for(let m of c.supportingFiles){let p=`.agentsmesh/skills/${c.name}/${m.relativePath.replace(/\\/g,"/")}`,u=i.get(p);u&&(a.set(u,m.absolutePath),GF(t,o,u,m.absolutePath,a,n));}}return a}s($F,"buildOutputSourceMap");xt();je();Ug();function WV(t,e){if(!e)return null;for(let r of e){let o=ut(r);if(o?.sharedArtifacts){for(let[n,i]of Object.entries(o.sharedArtifacts))if(i==="owner"&&t.startsWith(n))return r}}return null}s(WV,"findSharedArtifactOwner");function jF(t,e,r){if(e==="global"){let o=WV(t.path,r);if(o)return o;let n=DS(t.path);if(n)return n}return t.target}s(jF,"artifactMapTargetForResult");function HV(t,e){return `${t}\0${(e??[]).join(",")}`}s(HV,"sourceMapCacheKey");function V_(t,e){let r=et(t),o=new Set;for(let n of e){let i=r.join(t,n.path);o.add(i);let a=r.dirname(i);for(;a.startsWith(t)&&!o.has(a)&&(o.add(a),a!==t);)a=r.dirname(a);}return o}s(V_,"collectPlannedPaths");function zV(t,e,r){let o=vt(t.target,e),n=AF(o,t.path);if(n!=="default")return `${t.target}:${n}`;let i=jF(t,e,r);return i===t.target?t.target:`${t.target}~via~${i}`}s(zV,"artifactCacheKey");function UF(t,e,r,o,n="project",i,a){let c=V_(o,t),l=new Map,m=new Map;return t.map(p=>{if(a?.has(p.path))return p;let u=HV(p.target,i),f=(m.get(u)??(()=>{let A=$F(p.target,e,r,n,i);return m.set(u,A),A})()).get(p.path);if(!f)return p;let h=jF(p,n,i),O=zV(p,n,i),R=l.get(O)??(()=>{let A=MF(h,e,r,o,p.path,{scope:n});return l.set(O,A),A})(),S=Cd({content:p.content,projectRoot:o,sourceFile:f,destinationFile:et(o).join(o,p.path),translatePath:s(A=>R.get(A)??A,"translatePath"),pathExists:s(A=>c.has(A)||existsSync(A),"pathExists"),explicitCurrentDirLinks:true,rewriteBarePathTokens:true,scope:n,pathIsDirectory:s(A=>{try{return statSync(A).isDirectory()}catch{return false}},"pathIsDirectory")});return S.content===p.content?p:{...p,content:S.content}})}s(UF,"rewriteGeneratedReferences");re();ai();var JV=/!?\[[^\]]*\]\(([^)]+)\)/g,YV=/^\s*\[[^\]\n]+\]:\s*(?:<([^>\n]*)>|(\S+))/gm;function XV(t){return t.endsWith(".md")||t.endsWith(".mdc")}s(XV,"isMarkdownLikeOutput");function ZV(t,e){return e.some(([r,o])=>t>=r&&t<o)}s(ZV,"isOffsetInRanges");function QV(t){let e=t.trim(),r=/^(.*?)\s+(["'])([\s\S]*?)\2\s*$/.exec(e);return r?.[1]!==void 0&&(e=r[1].trim()),e.startsWith("<")&&e.endsWith(">")&&(e=e.slice(1,-1).trim()),e}s(QV,"parseMarkdownLinkDestination");function qV(t){let e=t.trim();return !e||e.startsWith("#")||/^https?:\/\//i.test(e)||/^mailto:/i.test(e)||/^data:/i.test(e)||/^javascript:/i.test(e)||/^ftp:/i.test(e)?true:/^[a-zA-Z]:[\\/]/.test(e)?false:!!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)}s(qV,"shouldSkipLocalValidation");function tJ(t,e){if(e.has(t))return true;try{let r=statSync(t);return r.isFile()||r.isDirectory()}catch{return false}}s(tJ,"pathExistsForGenerate");function eJ(t,e,r){let n=QV(t).split("#")[0]??"",{candidate:i}=Ka(n),a=i,c=Xc.exec(a);c&&(a=a.slice(0,c.index));let l;try{l=decodeURIComponent(a);}catch{l=a;}if(qV(l))return [];let m=Lm(l,e,r);if(m.length===0){let u=et(e),g=V(e,r);m=[V(e,u.join(u.dirname(g),l)),V(e,u.join(e,l))];}let p=[];for(let u of m)for(let g of Am(e,u)){let f=V(e,g);p.includes(f)||p.push(f);}return p}s(eJ,"resolveMarkdownLinkTargets");function rJ(t,e){let r=V_(e,t),o=[];for(let n of t){if(!XV(n.path))continue;let i=V(e,et(e).join(e,n.path)),a=Sd(n.content),c=s((l,m)=>{if(ZV(m,a))return;let p=eJ(l,e,i);p.length!==0&&(p.some(u=>tJ(u,r))||o.push({generatePath:n.path,target:n.target,rawLink:l.trim(),checkedPaths:p}));},"visitDestination");for(let l of n.content.matchAll(JV)){let m=l[1];m!==void 0&&c(m,l.index??0);}for(let l of n.content.matchAll(YV)){let m=(l[1]??l[2]??"").trim();m&&c(m,l.index??0);}}return o}s(rJ,"findBrokenMarkdownLinks");function KF(t,e){let r=rJ(t,e);if(r.length===0)return;let o=r.map(n=>` ${n.generatePath} (${n.target}): "${n.rawLink}" \u2192 not found (tried: ${n.checkedPaths.join(", ")})`);throw new Error(`Generated markdown contains broken local links:
172
- ${o.join(`
182
+ `+stringify(n);await I(r,o);}s(pf,"writeLock");async function ys(t){if(!await $(t))return {};let e=await v(t),r={};for(let n of e){let o=relative(t,n).replace(/\\/g,"/");if(o===DR||!IX(o))continue;let i=await lf(n);i!==null&&(r[o]=i.startsWith("sha256:")?i:`sha256:${i}`);}return r}s(ys,"buildChecksums");function uf(t,e,r){if(r.length===0)return [];let n=r.map(a=>SX[a]).filter(a=>a!==void 0);if(n.length===0)return [];let o=new Set([...Object.keys(t),...Object.keys(e)]),i=[];for(let a of o)n.some(l=>l(a))&&t[a]!==e[a]&&i.push(a);return i}s(uf,"detectLockedFeatureViolations");async function df(t){let e=await of(t),r={};for(let{meta:n}of e)r[n.name]=n.content_hash;return r}s(df,"buildPackChecksums");async function gc(t){let e={};for(let r of t){if(r.version!==void 0){e[r.name]=r.version;continue}let n=join(r.resolvedPath,".agentsmesh"),o=await ys(n),i=Object.keys(o).sort().map(c=>`${c}:${o[c]}`).join(`
183
+ `),a=af(i),l=a.startsWith("sha256:")?a:`sha256:${a}`;e[r.name]=`local:${l}`;}return e}s(gc,"buildExtendChecksums");Pt();se();function hc(t){return t?(t.outputFamilies??[]).filter(e=>e.kind==="additional").flatMap(e=>[...e.explicitPaths??[]]):[]}s(hc,"getAdditionalRootDecorationPaths");function mM(t,e){for(let r of t?.outputFamilies??[])if(r.pathPrefix!==void 0&&e.startsWith(r.pathPrefix)||r.explicitPaths?.includes(e))return r.id;return "default"}s(mM,"resolveRewriteFamilyId");ae();Jg();function CX(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(CX,"addDirectoryMapping");function pM(t,e,r){let n=posix.dirname(e),o=posix.dirname(r);for(;n!==".agentsmesh/skills"&&n!==".";)CX(t,n,o),n=posix.dirname(n),o=posix.dirname(o);}s(pM,"addSkillDirectoryMappings");Pt();function uM(t,e,r="project"){let n=Gt(t,r);if(!n)return null;if(e.root)return n.rootInstructionPath??null;if(e.targets.length>0&&!e.targets.includes(t))return null;let o=posix.basename(e.source.replace(/\\/g,"/"),".md");return n.paths.rulePath(o,e)}s(uM,"ruleTargetPath");function dM(t,e,r,n="project"){let o=Gt(t,n);return o?o.paths.commandPath(e,r):null}s(dM,"commandTargetPath");function fM(t,e,r,n="project"){let o=Gt(t,n);return o?o.paths.agentPath(e,r):null}s(fM,"agentTargetPath");de();Jt();Se();Pt();function LX(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(LX,"addDirectoryMapping");function NR(t,e,r,n="project"){let o=new Map;for(let a of e.rules){let l=uM(t,a,n);l&&o.set(`.agentsmesh/rules/${basename(a.source)}`,l);}for(let a of e.commands){let l=dM(t,a.name,r,n);l&&o.set(`.agentsmesh/commands/${a.name}.md`,l);}for(let a of e.agents){let l=fM(t,a.name,r,n);l&&o.set(`.agentsmesh/agents/${a.name}.md`,l);}let i=qm(t,n);if(!i)return o;for(let a of e.skills){LX(o,`.agentsmesh/skills/${a.name}`,`${i}/${a.name}`),o.set(`.agentsmesh/skills/${a.name}/SKILL.md`,`${i}/${a.name}/SKILL.md`);for(let l of a.supportingFiles){let c=l.relativePath.replace(/\\/g,"/"),m=`.agentsmesh/skills/${a.name}/${c}`,p=`${i}/${a.name}/${c}`;o.set(m,p),pM(o,m,p);}}return o}s(NR,"buildReferenceMap");ae();ae();Pt();function hM(t,e,r,n){let o=n.normalize(e),i=n.normalize(r);t.set(o,i),t.set(`${o}/`,`${i}/`);}s(hM,"addPackAbsoluteDirMapping");function OX(t){let e=new Set;for(let{relativePath:r}of t){let n=r.replace(/\\/g,"/"),o=posix.dirname(n);for(;o!=="."&&o.length>0;){e.add(o);let i=posix.dirname(o);if(i===o)break;o=i;}}return [...e]}s(OX,"skillSupportingDirPrefixes");function yM(t,e,r,n,o){let i=qm(e,o);if(!i)return;let a=nt(n),l=a.join(n,".agentsmesh","packs");for(let c of r.skills){let m=a.dirname(c.source);if(!m.startsWith(l))continue;let p=a.normalize(a.join(n,i,c.name));hM(t,m,p,a),t.set(a.normalize(c.source),a.normalize(a.join(p,"SKILL.md")));for(let u of c.supportingFiles){let f=a.normalize(a.join(p,u.relativePath));t.set(a.normalize(u.absolutePath),f);}for(let u of OX(c.supportingFiles))hM(t,a.join(m,u),a.join(p,u),a);}}s(yM,"addPackSkillArtifactMappings");ae();function AX(t){return `.agentsmesh/rules/${basename(t.source)}`}s(AX,"canonicalRulePath");function wX(t){return `.github/instructions/${basename(t.source,".md")}.instructions.md`}s(wX,"copilotInstructionsPath");function RM(t,e,r,n,o){if(t!=="copilot"||!n?.startsWith(".github/instructions/"))return;let i=nt(r);for(let a of o.rules)a.root||a.globs.length===0||e.set(i.normalize(i.join(r,AX(a))),i.normalize(i.join(r,wX(a))));}s(RM,"applyCopilotInstructionArtifactRefs");Pt();function FR(t,e){e!==void 0&&e.length>0&&!t.includes(e)&&t.push(e);}s(FR,"pushUnique");function IM(t,e,r,n){let o=[],i=r.get(`.agentsmesh/rules/${basename(e.source)}`);FR(o,i);let a=Gt(t,n);if(e.root)for(let l of hc(a))FR(o,l);for(let l of a?.extraRuleOutputPaths?.(e,{refs:r,scope:n})??[])FR(o,l);return o}s(IM,"extraRuleOutputPaths");Pt();function SM(t,e,r,n,o,i){let a=Gt(t,e);if(!a?.mirrorGlobalPath)return;let l=a.mirrorGlobalPath(r,i??[]),c=l===null?[]:Array.isArray(l)?l:[l];for(let m of c)m!==r&&o.set(m,n);}s(SM,"addSkillMirrorSourceEntry");function PX(t){return `.agentsmesh/commands/${t.name}.md`}s(PX,"canonicalCommandPath");function TX(t){return `.agentsmesh/agents/${t.name}.md`}s(TX,"canonicalAgentPath");function xX(t){return `.agentsmesh/skills/${t.name}/SKILL.md`}s(xX,"canonicalSkillPath");function CM(t,e,r,n,o,i){let a=i?.scope??"project",l=nt(n),c=new Map([...NR(t,e,r,a)].map(([m,p])=>[l.normalize(l.join(n,m)),l.normalize(l.join(n,p))]));return RM(t,c,n,o,e),yM(c,t,e,n,a),c}s(CM,"buildArtifactPathMap");function kM(t,e,r,n="project",o){let i=NR(t,e,r,n),a=new Map;for(let l of e.rules)for(let c of IM(t,l,i,n))a.set(c,l.source);for(let l of e.commands){let c=i.get(PX(l));c&&a.set(c,l.source);}for(let l of e.agents){let c=i.get(TX(l));c&&a.set(c,l.source);}for(let l of e.skills){let c=i.get(xX(l));c&&(a.set(c,l.source),SM(t,n,c,l.source,a,o));for(let m of l.supportingFiles){let p=`.agentsmesh/skills/${l.name}/${m.relativePath.replace(/\\/g,"/")}`,u=i.get(p);u&&(a.set(u,m.absolutePath),SM(t,n,u,m.absolutePath,a,o));}}return a}s(kM,"buildOutputSourceMap");Pt();se();Ng();function FX(t,e){if(!e)return null;for(let r of e){let n=et(r);if(n?.sharedArtifacts){for(let[o,i]of Object.entries(n.sharedArtifacts))if(i==="owner"&&t.startsWith(o))return r}}return null}s(FX,"findSharedArtifactOwner");function EM(t,e,r){if(e==="global"){let n=FX(t.path,r);if(n)return n;let o=xC(t.path);if(o)return o}return t.target}s(EM,"artifactMapTargetForResult");function vX(t,e){return `${t}\0${(e??[]).join(",")}`}s(vX,"sourceMapCacheKey");function vR(t,e){let r=nt(t),n=new Set;for(let o of e){let i=r.join(t,o.path);n.add(i);let a=r.dirname(i);for(;a.startsWith(t)&&!n.has(a)&&(n.add(a),a!==t);)a=r.dirname(a);}return n}s(vR,"collectPlannedPaths");function MX(t,e,r){let n=Gt(t.target,e),o=mM(n,t.path);if(o!=="default")return `${t.target}:${o}`;let i=EM(t,e,r);return i===t.target?t.target:`${t.target}~via~${i}`}s(MX,"artifactCacheKey");function LM(t,e,r,n,o="project",i,a){let l=vR(n,t),c=new Map,m=new Map;return t.map(p=>{if(a?.has(p.path))return p;let u=vX(p.target,i),g=(m.get(u)??(()=>{let k=kM(p.target,e,r,o,i);return m.set(u,k),k})()).get(p.path);if(!g)return p;let h=EM(p,o,i),R=MX(p,o,i),C=c.get(R)??(()=>{let k=CM(h,e,r,n,p.path,{scope:o});return c.set(R,k),k})(),S=ou({content:p.content,projectRoot:n,sourceFile:g,destinationFile:nt(n).join(n,p.path),translatePath:s(k=>C.get(k)??k,"translatePath"),pathExists:s(k=>l.has(k)||existsSync(k),"pathExists"),explicitCurrentDirLinks:true,rewriteBarePathTokens:true,scope:o,pathIsDirectory:s(k=>{try{return statSync(k).isDirectory()}catch{return false}},"pathIsDirectory")});return S.content===p.content?p:{...p,content:S.content}})}s(LM,"rewriteGeneratedReferences");ae();As();ot();var GX=/!?\[[^\]]*\]\(([^)]+)\)/g,jX=/^\s*\[[^\]\n]+\]:\s*(?:<([^>\n]*)>|(\S+))/gm;function UX(t){return t.endsWith(".md")||t.endsWith(".mdc")}s(UX,"isMarkdownLikeOutput");function BX(t,e){return e.some(([r,n])=>t>=r&&t<n)}s(BX,"isOffsetInRanges");function KX(t){let e=t.trim(),r=/^(.*?)\s+(["'])([\s\S]*?)\2\s*$/.exec(e);return r?.[1]!==void 0&&(e=r[1].trim()),e.startsWith("<")&&e.endsWith(">")&&(e=e.slice(1,-1).trim()),e}s(KX,"parseMarkdownLinkDestination");function WX(t,e){let r=t.trim();if(!r||r.startsWith("#")||/^https?:\/\//i.test(r)||/^mailto:/i.test(r)||/^data:/i.test(r)||/^javascript:/i.test(r)||/^ftp:/i.test(r))return true;if(/^[a-zA-Z]:[\\/]/.test(r))return false;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r))return true;if(r.startsWith("/")){let n=Y(e,e),o=Y(e,r);if(!o.startsWith(`${n}/`)&&o!==n)return true}return false}s(WX,"shouldSkipLocalValidation");function HX(t){return /(?:^|\/)[^/]+\/skills\/[^/]+\//.test(t)}s(HX,"isSkillGeneratedOutput");var zX={rules:"rules",steering:"rules",commands:"commands",agents:"agents",skills:"skills",droids:"agents",instructions:"rules",prompts:"commands"},VX={".clinerules":"rules"},JX=[".agent.md",".instructions.md",".prompt.md"];function OM(t){for(let e of JX)if(t.endsWith(e))return t.slice(0,-e.length);return t.endsWith(".mdc")?t.slice(0,-4):t.endsWith(".md")?t.slice(0,-3):t}s(OM,"stripMarkdownExt");function YX(t){let e=/^[^/]+\/([^/]+)\/([^/]+)/.exec(t);if(e){let n=zX[e[1]??""];if(n){let o=e[2]??"";return n!=="skills"&&(o=OM(o)),`${n}/${o}`}}let r=/^([^/]+)\/([^/]+)/.exec(t);if(r){let n=VX[r[1]??""];if(n)return `${n}/${OM(r[2]??"")}`}return null}s(YX,"canonicalKeyFromOutputPath");function XX(t,e){if(e.has(t))return true;try{let r=statSync(t);return r.isFile()||r.isDirectory()}catch{return false}}s(XX,"pathExistsForGenerate");function ZX(t,e,r){let o=KX(t).split("#")[0]??"",{candidate:i}=pl(o),a=i,l=ul.exec(a);l&&(a=a.slice(0,l.index));let c;try{c=decodeURIComponent(a);}catch{c=a;}if(WX(c,e))return [];let m=tm(c,e,r);if(m.length===0){let u=nt(e),f=Y(e,r);m=[Y(e,u.join(u.dirname(f),c)),Y(e,u.join(e,c))];}let p=[];for(let u of m)for(let f of em(e,u)){let g=Y(e,f);p.includes(g)||p.push(g);}return p}s(ZX,"resolveMarkdownLinkTargets");function QX(t,e){let r=vR(e,t),n=[];for(let o of t){if(!UX(o.path))continue;let i=Y(e,nt(e).join(e,o.path)),a=nu(o.content),l=s((c,m)=>{if(BX(m,a))return;let p=ZX(c,e,i);p.length!==0&&(p.some(u=>XX(u,r))||n.push({generatePath:o.path,target:o.target,rawLink:c.trim(),checkedPaths:p}));},"visitDestination");for(let c of o.content.matchAll(GX)){let m=c[1];m!==void 0&&l(m,c.index??0);}for(let c of o.content.matchAll(jX)){let m=(c[1]??c[2]??"").trim();m&&l(m,c.index??0);}}return n}s(QX,"findBrokenMarkdownLinks");function AM(t,e,r={}){let n=QX(t,e);if(n.length===0)return;let o=r.packOriginatedKeys,i=[],a=[];for(let c of n){let m=YX(c.generatePath),p=o!==void 0&&m!==null&&o.has(m);HX(c.generatePath)||p?a.push(c):i.push(c);}if(a.length>0){let c=a.map(m=>` ${m.generatePath} (${m.target}): "${m.rawLink}" \u2192 not found`);y.warn(`Third-party content contains ${a.length} broken local link${a.length===1?"":"s"} (warning only; outputs from installed packs and skill subtrees are treated as advisory):
184
+ ${c.join(`
185
+ `)}`);}if(i.length===0)return;let l=i.map(c=>` ${c.generatePath} (${c.target}): "${c.rawLink}" \u2192 not found (tried: ${c.checkedPaths.join(", ")})`);throw new Error(`Generated markdown contains broken local links:
186
+ ${l.join(`
173
187
  `)}
174
- Fix canonical sources or generators so every local link targets an existing file or folder.`)}s(KF,"validateGeneratedMarkdownLinks");uo();var WF="AGENTS.md";function BF(t){switch(t){case "created":return 3;case "updated":return 2;case "unchanged":return 1;case "skipped":return 0}}s(BF,"statusRank");function oJ(t,e){return BF(e.status)<=BF(t.status)?t:{...t,status:e.status,currentContent:e.currentContent??t.currentContent}}s(oJ,"mergeDuplicateMetadata");function Md(t){return t.trim()}s(Md,"trimmedContent");function nJ(t,e){if(!t.path.endsWith(WF)||t.path!==e.path)return null;let r=Md(t.content),o=Md(e.content);if(!r||!o)return null;let n=r.includes(o),i=o.includes(r);return n===i?null:n?t:e}s(nJ,"richerAgentsResult");function sJ(t,e){if(!t.path.endsWith(WF)||t.path!==e.path)return null;let r=t.target===Rg?t:e.target===Rg?e:null,o=r===t?e:t;if(!r)return null;let n=Md(r.content).length,i=Md(o.content).length;return n===i?null:n>i?r:o}s(sJ,"richerCodexAgentsResult");function $d(t){let e=[];for(let r of t){let o=e.findIndex(i=>i.path===r.path);if(o===-1){e.push(r);continue}let n=e[o];if(n.content!==r.content){let i=nJ(n,r);if(i){e[o]=i;continue}let a=sJ(n,r);if(a){e[o]=a;continue}throw new Error(`Conflicting generated outputs for ${r.path}: ${n.target} and ${r.target} produce different content.`)}e[o]=oJ(n,r);}return e}s($d,"resolveOutputCollisions");function HF(t){let e=t.currentContent===void 0?"created":t.currentContent!==t.content?"updated":"unchanged";return t.status===e?t:{...t,status:e}}s(HF,"refreshResultStatus");T();xt();je();function VF(t,e){return t===null?"created":t!==e?"updated":"unchanged"}s(VF,"computeStatus");function iJ(t,e,r){let o=C_(t,e,r);if(o!==null)return o;let n=ut(t);if(!n)return null;let i=r==="global"?n.globalSupport?.layout:n.project;return i?(o=i.rewriteGeneratedPath?i.rewriteGeneratedPath(e):e,o):null}s(iJ,"resolveGeneratedOutputPath");async function Dm(t,e,r,o,n,i){let a=iJ(e,r.path,n);if(a===null)return null;let c=await y(join(o,a)),l=t.findIndex(u=>u.path===a&&u.target===e),m=l>=0?t[l]:void 0,p=i?.mergeContent?.(c,m,r.content,a)??r.content;return l>=0&&t.splice(l,1),t.push({target:e,path:a,content:p,currentContent:c??void 0,status:VF(c,p)}),a}s(Dm,"emitGeneratedOutput");function J_(t,e,r){return {capability:oi(t,r)?.[e]??{level:"none"},scope:r}}s(J_,"featureContext");async function Oa(t,e,r,o,n,i,a,c){if(n)for(let l of e){let m=c(l);if(!m)continue;let p=J_(l,a,i);for(let u of m(r,p)){let g=await Dm(t,l,u,o,i);if(g===null)continue;let f=vt(l,i);if(f?.mirrorGlobalPath){let h=f.mirrorGlobalPath(g,e),O=h===null?[]:Array.isArray(h)?h:[h];for(let R of O){let S=await y(join(o,R));t.push({target:l,path:R,content:u.content,currentContent:S??void 0,status:VF(S,u.content)});}}}}}s(Oa,"generateFeature");zg();xt();function aJ(t){return t?.rootInstructionPath?[t.rootInstructionPath,...tl(t)]:[]}s(aJ,"rootDecorationPaths");function JF(t,e,r="project"){return t.map(o=>{let n=vt(o.target,r);if(!n)return o;let i=aJ(n);if(i.length===0||!i.includes(o.path))return o;let c=o.path===n.rootInstructionPath&&n.renderPrimaryRootInstruction?n.renderPrimaryRootInstruction(e):o.content,l=KS(c);return l===o.content?o:{...o,content:l}})}s(JF,"decoratePrimaryRootInstructions");xt();je();Ou();function Y_(t,e,r,o,n){let a=(Er(t)??ut(t))?.mergeGeneratedOutputContent?.(e,r,o,n);if(a!=null)return a;let c=r?.content??e;return c!==null&&gw.includes(n)?fw(c,o):o}s(Y_,"mergeOutputContent");async function YF(t,e,r,o,n){for(let i of e){let a=Yc(i,"permissions",void 0,n)??ut(i)?.generators.generatePermissions;if(a)for(let c of a(r))await Dm(t,i,c,o,n,{mergeContent:s((l,m,p,u)=>Y_(i,l,m,p,u),"mergeContent")});}}s(YF,"generatePermissionsFeature");async function XF(t,e,r,o,n,i){for(let a of e){let c=Yc(a,"hooks",i,n)??ut(a)?.generators.generateHooks;if(!c)continue;let l=J_(a,"hooks",n),m=[...c(r,l)],u=(Er(a)??ut(a))?.postProcessHookOutputs;u&&(m=[...await u(o,r,m)]);for(let g of m)await Dm(t,a,g,o,n,{mergeContent:s((f,h,O,R)=>Y_(a,f,h,O,R),"mergeContent")});}}s(XF,"generateHooksFeature");async function ZF(t,e,r,o,n){for(let i of e){let c=(Er(i)??ut(i))?.emitScopedSettings;if(!c)continue;let l=c(r,n);if(l.length!==0)for(let m of l)await Dm(t,i,m,o,n,{mergeContent:s((p,u,g,f)=>Y_(i,p,u,g,f),"mergeContent")});}}s(ZF,"generateScopedSettingsFeature");async function Lr(t){let{config:e,canonical:r,projectRoot:o,scope:n="project",targetFilter:i}=t,a=[...e.targets,...e.pluginTargets??[]],c=i?a.filter(J=>i.includes(J)):a;function l(J,X){return Yc(J,X,e,n)}s(l,"resolveGen");let m=e.features.includes("rules"),p=e.features.includes("commands"),u=e.features.includes("agents"),g=e.features.includes("skills"),f=e.features.includes("mcp"),h=e.features.includes("permissions"),O=e.features.includes("hooks"),R=e.features.includes("ignore"),S=[];await Oa(S,c,r,o,m,n,"rules",J=>l(J,"rules")),await Oa(S,c,r,o,p,n,"commands",J=>l(J,"commands")),await Oa(S,c,r,o,u,n,"agents",J=>l(J,"agents")),await Oa(S,c,r,o,g,n,"skills",J=>l(J,"skills")),await Oa(S,c,r,o,f,n,"mcp",J=>l(J,"mcp")),h&&await YF(S,c,r,o,n),O&&await XF(S,c,r,o,n,e),await Oa(S,c,r,o,R,n,"ignore",J=>l(J,"ignore"));let A=new Set(e.features);for(let J of c){let q=(Er(J)??ut(J))?.globalSupport?.scopeExtras;if(q){let Ft=await q(r,o,n,A);S.push(...Ft);}}(f||R||O||u||h)&&await ZF(S,c,r,o,n);let D=JF(S,r,n),N=cJ(D,n),G=UF(D,r,e,o,n,c,N);return KF(G,o),$d(G.map(HF))}s(Lr,"generate");function cJ(t,e){let r=new Map;function o(a){let c=r.get(a);if(c)return c;let l=vt(a,e),m=new Set;if(l?.rootInstructionPath){m.add(l.rootInstructionPath);for(let p of tl(l))m.add(p);}return r.set(a,m),m}s(o,"rootPathsFor");let n=new Map;for(let a of t){if(!o(a.target).has(a.path))continue;let c=n.get(a.path)??new Set;c.add(a.target),n.set(a.path,c);}let i=new Set;for(let[a,c]of n)c.size>1&&i.add(a);return i}s(cJ,"computeSharedRootInstructionPaths");ds();ft();T();dn();var SJ=6e4,CJ=30,EJ=200,OJ=2e3;async function sv(t,e={}){let r=e.retries??CJ,o=e.retryDelayMs??EJ,n=e.staleMs??SJ;await mkdir(dirname(t),{recursive:true});let i=0;for(;;){let a=await LJ(t);if(a)return a;let c=await AJ(t);if(c!=="young"&&kJ(c,n)){await rm$1(t,{recursive:true,force:true}).catch(()=>{});continue}if(i>=r){let l=c==="young"?null:c;throw new Fa(t,TJ(l))}i++,await PJ(o);}}s(sv,"acquireProcessLock");async function LJ(t){try{await mkdir(t,{recursive:!1});}catch(i){if(i.code==="EEXIST")return null;throw i}let e=join(t,"holder.json"),r={pid:process.pid,started:Date.now(),hostname:iv()};await writeFile(e,JSON.stringify(r),"utf-8");let o=false,n=s(()=>{if(!o){o=true;try{rmSync(t,{recursive:!0,force:!0});}catch{}}},"signalHandler");return process.once("SIGINT",n),process.once("SIGTERM",n),process.once("exit",n),async()=>{o||(o=true,process.off("SIGINT",n),process.off("SIGTERM",n),process.off("exit",n),await rm$1(t,{recursive:true,force:true}).catch(()=>{}));}}s(LJ,"tryAcquire");async function AJ(t){try{let e=await readFile(join(t,"holder.json"),"utf-8"),r=JSON.parse(e);return bJ(r)?r:null}catch{try{let e=await stat(t);if(Date.now()-e.mtimeMs<OJ)return "young"}catch{}return null}}s(AJ,"inspectLock");function kJ(t,e){return !t||Date.now()-t.started>e?true:t.hostname&&t.hostname!==iv()?false:!wJ(t.pid)}s(kJ,"isStale");function wJ(t){if(!Number.isInteger(t)||t<=0)return false;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}s(wJ,"isProcessAlive");function TJ(t){return t?`${t.hostname?`${t.hostname}:`:""}pid ${t.pid} (running ${Date.now()-t.started}ms)`:"unknown (unreadable lock metadata)"}s(TJ,"describeHolder");function bJ(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.pid=="number"&&typeof e.started=="number"}s(bJ,"isLockMetadata");function iv(){return hostname()}s(iv,"getHostname");function PJ(t){return new Promise(e=>setTimeout(e,t))}s(PJ,"sleep");T();xt();async function av(t,e=t){let r=await readdir(t,{withFileTypes:true}),o=[];for(let n of r){let i=join(t,n.name);if(n.isDirectory()){o.push(...await av(i,e));continue}o.push(relative(e,i).replace(/\\/g,"/"));}return o}s(av,"listFiles");async function FJ(t,e,r){if(r.has(e))return;let o=join(t,e);await j(o)&&await rm$1(o,{recursive:true,force:true});}s(FJ,"removeIfStale");async function cv(t){let e=new Set(t.expectedPaths),r=new Set,o=t.scope??"project";for(let n of t.targets){let i=S_(n,o);if(i){for(let a of i.files)r.add(a);for(let a of i.dirs){let c=join(t.projectRoot,a);if(await j(c))for(let l of await av(c))r.add(`${a}/${l}`.replace(/\/+/g,"/"));}}}for(let n of r)await FJ(t.projectRoot,n,e);}s(cv,"cleanupStaleGeneratedOutputs");function el(t,e,r){let o=resolve(t),n=resolve(t,e);if(n===o||n.startsWith(`${o}${sep}`))return n;throw new Error(`Unsafe generated output path for ${r}: ${e}`)}s(el,"ensurePathInsideRoot");Rl();T();ft();async function q_(t,e){let r=await us(t.canonicalDir),o=e.length>0?await qc(e):{},n=await vd(join(t.canonicalDir,"packs")),i=process.env.USER??process.env.USERNAME??"unknown";await Nd(t.canonicalDir,{generatedAt:new Date().toISOString(),generatedBy:i,libVersion:gl(),checksums:r,extends:o,packs:n});try{await _g(Le(),join(t.configDir,".agentsmeshcache"));}catch(a){I.warn(`Could not create .agentsmeshcache symlink: ${a instanceof Error?a.message:String(a)}`);}}s(q_,"writeLockFile");async function Iv(t){let{mode:e,scope:r,dryRun:o,context:n,resolvedExtends:i,flags:a,root:c,options:l}=t;if(e==="check")return {exitCode:0,data:{scope:r,mode:e,files:[],summary:Ud([])}};if(o||await q_(n,i),l.printMatrix!==false){let{runMatrix:m}=await Promise.resolve().then(()=>(vm(),aI)),{renderMatrix:p}=await Promise.resolve().then(()=>(Mm(),cI)),u=await m(a,c);p(u,{verbose:a.verbose===true});}return {exitCode:0,data:{scope:r,mode:e,files:[],summary:Ud([])}}}s(Iv,"handleEmptyResults");function Rv(t,e){let r=t.filter(a=>a.status!=="skipped"),o=r.filter(a=>a.status!=="unchanged"),n=r.map(a=>({path:a.path,target:a.target,status:a.status}));return {exitCode:o.length===0?0:1,data:{scope:e,mode:"check",files:n,summary:Ud(r)}}}s(Rv,"buildCheckResult");async function Sv(t){let{results:e,dryRun:r,scope:o,mode:n,context:i,activeTargets:a,resolvedExtends:c,flags:l,root:m,options:p}=t,u=r?null:await sv(join(i.canonicalDir,".generate.lock"));try{if(!r){for(let h of e)if(h.status==="created"||h.status==="updated"){let O=el(i.rootBase,h.path,h.target);await _(O,h.content);}await cv({projectRoot:i.rootBase,targets:a,expectedPaths:e.map(h=>h.path),scope:o}),await q_(i,c);}}finally{u&&await u();}if(p.printMatrix!==false){let{runMatrix:h}=await Promise.resolve().then(()=>(vm(),aI)),{renderMatrix:O}=await Promise.resolve().then(()=>(Mm(),cI)),R=await h(l,m);O(R,{verbose:l.verbose===true});}let g=e.filter(h=>h.status!=="skipped"),f=g.map(h=>({path:h.path,target:h.target,status:h.status}));return {exitCode:0,data:{scope:o,mode:n,files:f,summary:Ud(g)}}}s(Sv,"handleGenerateOrDryRun");function Ud(t){return {created:t.filter(e=>e.status==="created").length,updated:t.filter(e=>e.status==="updated").length,unchanged:t.filter(e=>e.status==="unchanged").length}}s(Ud,"buildSummary");async function rl(t,e,r={}){if(t.features!==void 0)throw new Error("--features is no longer supported. Configure features in agentsmesh.yaml.");let o=e??process.cwd(),n=t.check===true,i=t["dry-run"]===true,a=t.force===true,c=t.global===true?"global":"project",l=t["refresh-cache"]===true||t["no-cache"]===true,m=t.targets,p=typeof m=="string"&&m?m.split(",").map(N=>N.trim()).filter(Boolean):void 0,u=n?"check":i?"dry-run":"generate",{config:g,context:f}=await Tt(o,c);await le(g,o);let h=g.collaboration?.lock_features??[];if(g.collaboration?.strategy==="lock"&&!a&&h.length>0){let N=await Dd(f.canonicalDir);if(N!==null){let G=await us(f.canonicalDir),J=Fd(N.checksums,G,h);if(J.length>0){I.error("Locked feature violation (strategy: lock). Modified files:");for(let X of J)I.error(` ${X}`);throw I.error("Run 'agentsmesh generate --force' to accept these changes."),new Error("Locked feature violation. Use --force to override.")}}}let{canonical:O,resolvedExtends:R}=await he(g,f.configDir,{refreshRemoteCache:l},f.canonicalDir),S=[...g.targets,...g.pluginTargets??[]];if(p){let N=p.filter(G=>!S.includes(G));if(N.length>0)throw new Error(`Unknown target(s) in --targets: ${N.join(", ")}. Available: ${S.join(", ")}`)}let A=p?S.filter(N=>p.includes(N)):S,D=await Lr({config:g,canonical:O,projectRoot:f.rootBase,scope:c,targetFilter:p});return D.length===0?Iv({mode:u,scope:c,dryRun:i,context:f,resolvedExtends:R,flags:t,root:o,options:r}):n?Rv(D,c):Sv({results:D,dryRun:i,scope:c,mode:u,context:f,activeTargets:A,resolvedExtends:R,flags:t,root:o,options:r})}s(rl,"runGenerate");ft();function lI(t,e){return t==="global"?`~/${e}`:e}s(lI,"formatDisplayPath");function ol(t){let{data:e}=t,{scope:r,mode:o,files:n}=e;if(n.length===0){I.info("No files to generate (no root rule or rules feature disabled)."),o==="check"&&I.success("Generated files are in sync.");return}if(o==="check"){let l=n.filter(m=>m.status!=="unchanged");if(l.length===0){I.success("Generated files are in sync.");return}for(let m of l)I.error(`[check] ${m.status} ${lI(r,m.path)} (${m.target})`);I.error("Generated files are out of sync. Run 'agentsmesh generate' to update them.");return}if(o==="dry-run"){for(let l of n)I.info(`[dry-run] ${l.status} ${lI(r,l.path)} (${l.target})`);return}for(let l of n)(l.status==="created"||l.status==="updated")&&I.success(`${l.status} ${lI(r,l.path)}`);let{created:i,updated:a,unchanged:c}=e.summary;i>0||a>0?I.info(`Generated: ${i} created, ${a} updated, ${c} unchanged`):I.info(`Nothing changed. (${c} unchanged)`);}s(ol,"renderGenerate");T();xt();uo();var WJ=["codex-cli"];function Cv(){return kt.filter(t=>!WJ.includes(t))}s(Cv,"starterInitTargetIds");var HJ=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],zJ=Cv();function Kd(t,e=zJ){let r=(t.length>0?t:e).map(n=>` - ${n}`).join(`
175
- `),o=HJ.map(n=>` - ${n}`).join(`
176
- `);return `# yaml-language-server: $schema=https://unpkg.com/agentsmesh/schemas/agentsmesh.json
177
- version: 1
188
+ Fix canonical sources or generators so every local link targets an existing file or folder.`)}s(AM,"validateGeneratedMarkdownLinks");var qX=[`${sep}.agentsmesh${sep}packs${sep}`,"/.agentsmesh/packs/"];function gf(t){return qX.some(e=>t.includes(e))}s(gf,"isUnderPacks");function wM(t){let e=new Set;for(let r of t.rules)if(gf(r.source)){let n=r.root?"_root":t2(r.source);n&&e.add(`rules/${n}`);}for(let r of t.agents)gf(r.source)&&e.add(`agents/${r.name}`);for(let r of t.commands)gf(r.source)&&e.add(`commands/${r.name}`);for(let r of t.skills)gf(r.source)&&e.add(`skills/${r.name}`);return e}s(wM,"buildPackOriginatedKeys");function t2(t){let r=t.replace(/\\/g,"/").split("/").pop()??"";return r.endsWith(".md")?r.slice(0,-3):r}s(t2,"ruleNameFromSource");Rn();var xM="AGENTS.md";function bM(t){switch(t){case "created":return 3;case "updated":return 2;case "unchanged":return 1;case "skipped":return 0}}s(bM,"statusRank");function e2(t,e){return bM(e.status)<=bM(t.status)?t:{...t,status:e.status,currentContent:e.currentContent??t.currentContent}}s(e2,"mergeDuplicateMetadata");function hf(t){return t.trim()}s(hf,"trimmedContent");var r2=[/<!-- agentsmesh:embedded-rules:start -->[\s\S]*?<!-- agentsmesh:embedded-rules:end -->\n*/g];function PM(t){let e=t;for(let r of r2)e=e.replace(r,"");return e.trim().replace(/\n{2,}/g,`
189
+
190
+ `)}s(PM,"normalizeAgentsContent");function TM(t){return /<!-- agentsmesh:embedded-rules:start -->/.test(t)}s(TM,"hasOptionalAgentsBlock");function n2(t,e){if(!t.path.endsWith(xM)||t.path!==e.path)return null;let r=hf(t.content),n=hf(e.content);if(!r||!n)return null;let o=r.includes(n),i=n.includes(r);if(o!==i)return o?t:e;if(PM(t.content)===PM(e.content)){let a=TM(t.content),l=TM(e.content);if(a!==l)return a?t:e}return null}s(n2,"richerAgentsResult");function o2(t,e){if(!t.path.endsWith(xM)||t.path!==e.path)return null;let r=t.target===pg?t:e.target===pg?e:null,n=r===t?e:t;if(!r)return null;let o=hf(r.content).length,i=hf(n.content).length;return o===i?null:o>i?r:n}s(o2,"richerCodexAgentsResult");function yf(t){let e=[];for(let r of t){let n=e.findIndex(i=>i.path===r.path);if(n===-1){e.push(r);continue}let o=e[n];if(o.content!==r.content){let i=n2(o,r);if(i){e[n]=i;continue}let a=o2(o,r);if(a){e[n]=a;continue}throw new Error(`Conflicting generated outputs for ${r.path}: ${o.target} and ${r.target} produce different content.`)}e[n]=e2(o,r);}return e}s(yf,"resolveOutputCollisions");function DM(t){let e=t.currentContent===void 0?"created":t.currentContent!==t.content?"updated":"unchanged";return t.status===e?t:{...t,status:e}}s(DM,"refreshResultStatus");w();Pt();se();function FM(t,e){return t===null?"created":t!==e?"updated":"unchanged"}s(FM,"computeStatus");function s2(t,e,r){let n=lR(t,e,r);if(n!==null)return n;let o=et(t);if(!o)return null;let i=r==="global"?o.globalSupport?.layout:o.project;return i?(n=i.rewriteGeneratedPath?i.rewriteGeneratedPath(e):e,n):null}s(s2,"resolveGeneratedOutputPath");async function op(t,e,r,n,o,i){let a=s2(e,r.path,o);if(a===null)return null;let l=await _(join(n,a)),c=t.findIndex(u=>u.path===a&&u.target===e),m=c>=0?t[c]:void 0,p=i?.mergeContent?.(l,m,r.content,a)??r.content;return c>=0&&t.splice(c,1),t.push({target:e,path:a,content:p,currentContent:l??void 0,status:FM(l,p)}),a}s(op,"emitGeneratedOutput");function $R(t,e,r){return {capability:mi(t,r)?.[e]??{level:"none"},scope:r}}s($R,"featureContext");async function xa(t,e,r,n,o,i,a,l){if(o)for(let c of e){let m=l(c);if(!m)continue;let p=$R(c,a,i);for(let u of m(r,p)){let f=await op(t,c,u,n,i);if(f===null)continue;let g=Gt(c,i);if(g?.mirrorGlobalPath){let h=g.mirrorGlobalPath(f,e),R=h===null?[]:Array.isArray(h)?h:[h];for(let C of R){let S=await _(join(n,C));t.push({target:c,path:C,content:u.content,currentContent:S??void 0,status:FM(S,u.content)});}}}}}s(xa,"generateFeature");Gg();Pt();function i2(t){return t?.rootInstructionPath?[t.rootInstructionPath,...hc(t)]:[]}s(i2,"rootDecorationPaths");function vM(t,e,r="project"){return t.map(n=>{let o=Gt(n.target,r);if(!o)return n;let i=i2(o);if(i.length===0||!i.includes(n.path))return n;let l=n.path===o.rootInstructionPath&&o.renderPrimaryRootInstruction?o.renderPrimaryRootInstruction(e):n.content,c=UC(l);return c===n.content?n:{...n,content:c}})}s(vM,"decoratePrimaryRootInstructions");Pt();se();td();function GR(t,e,r,n,o){let a=(Pr(t)??et(t))?.mergeGeneratedOutputContent?.(e,r,n,o);if(a!=null)return a;let l=r?.content??e;return l!==null&&cP.includes(o)?mP(l,n):n}s(GR,"mergeOutputContent");async function MM(t,e,r,n,o){for(let i of e){let a=uc(i,"permissions",void 0,o)??et(i)?.generators.generatePermissions;if(a)for(let l of a(r))await op(t,i,l,n,o,{mergeContent:s((c,m,p,u)=>GR(i,c,m,p,u),"mergeContent")});}}s(MM,"generatePermissionsFeature");async function $M(t,e,r,n,o,i){for(let a of e){let l=uc(a,"hooks",i,o)??et(a)?.generators.generateHooks;if(!l)continue;let c=$R(a,"hooks",o),m=[...l(r,c)],u=(Pr(a)??et(a))?.postProcessHookOutputs;u&&(m=[...await u(n,r,m)]);for(let f of m)await op(t,a,f,n,o,{mergeContent:s((g,h,R,C)=>GR(a,g,h,R,C),"mergeContent")});}}s($M,"generateHooksFeature");async function GM(t,e,r,n,o){for(let i of e){let l=(Pr(i)??et(i))?.emitScopedSettings;if(!l)continue;let c=l(r,o);if(c.length!==0)for(let m of c)await op(t,i,m,n,o,{mergeContent:s((p,u,f,g)=>GR(i,p,u,f,g),"mergeContent")});}}s(GM,"generateScopedSettingsFeature");async function Tr(t){let{config:e,canonical:r,projectRoot:n,scope:o="project",targetFilter:i}=t,a=[...e.targets,...e.pluginTargets??[]],l=i?a.filter(W=>i.includes(W)):a;function c(W,z){return uc(W,z,e,o)}s(c,"resolveGen");let m=e.features.includes("rules"),p=e.features.includes("commands"),u=e.features.includes("agents"),f=e.features.includes("skills"),g=e.features.includes("mcp"),h=e.features.includes("permissions"),R=e.features.includes("hooks"),C=e.features.includes("ignore"),S=[];await xa(S,l,r,n,m,o,"rules",W=>c(W,"rules")),await xa(S,l,r,n,p,o,"commands",W=>c(W,"commands")),await xa(S,l,r,n,u,o,"agents",W=>c(W,"agents")),await xa(S,l,r,n,f,o,"skills",W=>c(W,"skills")),await xa(S,l,r,n,g,o,"mcp",W=>c(W,"mcp")),h&&await MM(S,l,r,n,o),R&&await $M(S,l,r,n,o,e),await xa(S,l,r,n,C,o,"ignore",W=>c(W,"ignore"));let k=new Set(e.features);for(let W of l){let Q=(Pr(W)??et(W))?.globalSupport?.scopeExtras;if(Q){let at=await Q(r,n,o,k);S.push(...at);}}(g||C||R||u||h)&&await GM(S,l,r,n,o);let P=vM(S,r,o),N=a2(P,o),F=LM(P,r,e,n,o,l,N);return AM(F,n,{packOriginatedKeys:wM(r)}),yf(F.map(DM))}s(Tr,"generate");function a2(t,e){let r=new Map;function n(a){let l=r.get(a);if(l)return l;let c=Gt(a,e),m=new Set;if(c?.rootInstructionPath){m.add(c.rootInstructionPath);for(let p of hc(c))m.add(p);}return r.set(a,m),m}s(n,"rootPathsFor");let o=new Map;for(let a of t){if(!n(a.target).has(a.path))continue;let l=o.get(a.path)??new Set;l.add(a.target),o.set(a.path,l);}let i=new Set;for(let[a,l]of o)l.size>1&&i.add(a);return i}s(a2,"computeSharedRootInstructionPaths");fn();ot();w();_o();var I2=6e4,S2=30,C2=200,k2=2e3;async function Rf(t,e={}){let r=e.retries??S2,n=e.retryDelayMs??C2,o=e.staleMs??I2;await mkdir(dirname(t),{recursive:true});let i=0;for(;;){let a=await E2(t);if(a)return a;let l=await L2(t);if(l!=="young"&&O2(l,o)){await rm(t,{recursive:true,force:true}).catch(()=>{});continue}if(i>=r){let c=l==="young"?null:l;throw new Va(t,w2(c))}i++,await P2(n);}}s(Rf,"acquireProcessLock");async function E2(t){try{await mkdir(t,{recursive:!1});}catch(i){if(i.code==="EEXIST")return null;throw i}let e=join(t,"holder.json"),r={pid:process.pid,started:Date.now(),hostname:VM()};await writeFile(e,JSON.stringify(r),"utf-8");let n=false,o=s(()=>{if(!n){n=true;try{rmSync(t,{recursive:!0,force:!0});}catch{}}},"signalHandler");return process.once("SIGINT",o),process.once("SIGTERM",o),process.once("exit",o),async()=>{n||(n=true,process.off("SIGINT",o),process.off("SIGTERM",o),process.off("exit",o),await rm(t,{recursive:true,force:true}).catch(()=>{}));}}s(E2,"tryAcquire");async function L2(t){try{let e=await readFile(join(t,"holder.json"),"utf-8"),r=JSON.parse(e);return b2(r)?r:null}catch{try{let e=await stat(t);if(Date.now()-e.mtimeMs<k2)return "young"}catch{}return null}}s(L2,"inspectLock");function O2(t,e){return !t||Date.now()-t.started>e?true:t.hostname&&t.hostname!==VM()?false:!A2(t.pid)}s(O2,"isStale");function A2(t){if(!Number.isInteger(t)||t<=0)return false;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}s(A2,"isProcessAlive");function w2(t){return t?`${t.hostname?`${t.hostname}:`:""}pid ${t.pid} (running ${Date.now()-t.started}ms)`:"unknown (unreadable lock metadata)"}s(w2,"describeHolder");function b2(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.pid=="number"&&typeof e.started=="number"}s(b2,"isLockMetadata");function VM(){return hostname()}s(VM,"getHostname");function P2(t){return new Promise(e=>setTimeout(e,t))}s(P2,"sleep");w();Pt();async function JM(t,e=t){let r=await readdir(t,{withFileTypes:true}),n=[];for(let o of r){let i=join(t,o.name);if(o.isDirectory()){n.push(...await JM(i,e));continue}n.push(relative(e,i).replace(/\\/g,"/"));}return n}s(JM,"listFiles");async function N2(t,e,r){if(r.has(e))return;let n=join(t,e);await $(n)&&await rm(n,{recursive:true,force:true});}s(N2,"removeIfStale");async function YM(t){let e=new Set(t.expectedPaths),r=new Set,n=t.scope??"project";for(let o of t.targets){let i=aR(o,n);if(i){for(let a of i.files)r.add(a);for(let a of i.dirs){let l=join(t.projectRoot,a);if(await $(l))for(let c of await JM(l))r.add(`${a}/${c}`.replace(/\/+/g,"/"));}}}for(let o of r)await N2(t.projectRoot,o,e);}s(YM,"cleanupStaleGeneratedOutputs");function yc(t,e,r){let n=resolve(t),o=resolve(t,e);if(o===n||o.startsWith(`${n}${sep}`))return o;throw new Error(`Unsafe generated output path for ${r}: ${e}`)}s(yc,"ensurePathInsideRoot");Uc();w();ot();async function KR(t,e){let r=await ys(t.canonicalDir),n=e.length>0?await gc(e):{},o=await df(join(t.canonicalDir,"packs")),i=process.env.USER??process.env.USERNAME??"unknown";await pf(t.canonicalDir,{generatedAt:new Date().toISOString(),generatedBy:i,libVersion:Ci(),checksums:r,extends:n,packs:o});try{await cg(Te(),join(t.configDir,".agentsmeshcache"));}catch(a){y.warn(`Could not create .agentsmeshcache symlink: ${a instanceof Error?a.message:String(a)}`);}}s(KR,"writeLockFile");async function i$(t){let{mode:e,scope:r,dryRun:n,context:o,resolvedExtends:i,flags:a,root:l,options:c}=t;if(e==="check")return {exitCode:0,data:{scope:r,mode:e,files:[],summary:If([])}};if(n||await KR(o,i),c.printMatrix!==false){let{runMatrix:m}=await Promise.resolve().then(()=>(ap(),ZR)),{renderMatrix:p}=await Promise.resolve().then(()=>(cp(),QR)),u=await m(a,l);p(u,{verbose:a.verbose===true});}return {exitCode:0,data:{scope:r,mode:e,files:[],summary:If([])}}}s(i$,"handleEmptyResults");function a$(t,e){let r=t.filter(a=>a.status!=="skipped"),n=r.filter(a=>a.status!=="unchanged"),o=r.map(a=>({path:a.path,target:a.target,status:a.status}));return {exitCode:n.length===0?0:1,data:{scope:e,mode:"check",files:o,summary:If(r)}}}s(a$,"buildCheckResult");async function l$(t){let{results:e,dryRun:r,scope:n,mode:o,context:i,activeTargets:a,resolvedExtends:l,flags:c,root:m,options:p}=t,u=r?null:await Rf(join(i.canonicalDir,".generate.lock"));try{if(!r){for(let h of e)if(h.status==="created"||h.status==="updated"){let R=yc(i.rootBase,h.path,h.target);await I(R,h.content);}await YM({projectRoot:i.rootBase,targets:a,expectedPaths:e.map(h=>h.path),scope:n}),await KR(i,l);}}finally{u&&await u();}if(p.printMatrix!==false){let{runMatrix:h}=await Promise.resolve().then(()=>(ap(),ZR)),{renderMatrix:R}=await Promise.resolve().then(()=>(cp(),QR)),C=await h(c,m);R(C,{verbose:c.verbose===true});}let f=e.filter(h=>h.status!=="skipped"),g=f.map(h=>({path:h.path,target:h.target,status:h.status}));return {exitCode:0,data:{scope:n,mode:o,files:g,summary:If(f)}}}s(l$,"handleGenerateOrDryRun");function If(t){return {created:t.filter(e=>e.status==="created").length,updated:t.filter(e=>e.status==="updated").length,unchanged:t.filter(e=>e.status==="unchanged").length}}s(If,"buildSummary");async function _c(t,e,r={}){if(t.features!==void 0)throw new Error("--features is no longer supported. Configure features in agentsmesh.yaml.");let n=e??process.cwd(),o=t.check===true,i=t["dry-run"]===true,a=t.force===true,l=t.global===true?"global":"project",c=t["refresh-cache"]===true||t["no-cache"]===true,m=t.targets,p=typeof m=="string"&&m?m.split(",").map(N=>N.trim()).filter(Boolean):void 0,u=o?"check":i?"dry-run":"generate",{config:f,context:g}=await yt(n,l);await Wt(f,n);let h=f.collaboration?.lock_features??[];if(f.collaboration?.strategy==="lock"&&!a&&h.length>0){let N=await mf(g.canonicalDir);if(N!==null){let F=await ys(g.canonicalDir),W=uf(N.checksums,F,h);if(W.length>0){y.error("Locked feature violation (strategy: lock). Modified files:");for(let z of W)y.error(` ${z}`);throw y.error("Run 'agentsmesh generate --force' to accept these changes."),new Error("Locked feature violation. Use --force to override.")}}}let{canonical:R,resolvedExtends:C}=await ke(f,g.configDir,{refreshRemoteCache:c},g.canonicalDir),S=[...f.targets,...f.pluginTargets??[]];if(p){let N=p.filter(F=>!S.includes(F));if(N.length>0)throw new Error(`Unknown target(s) in --targets: ${N.join(", ")}. Available: ${S.join(", ")}`)}let k=p?S.filter(N=>p.includes(N)):S,P=await Tr({config:f,canonical:R,projectRoot:g.rootBase,scope:l,targetFilter:p});return P.length===0?i$({mode:u,scope:l,dryRun:i,context:g,resolvedExtends:C,flags:t,root:n,options:r}):o?a$(P,l):l$({results:P,dryRun:i,scope:l,mode:u,context:g,activeTargets:k,resolvedExtends:C,flags:t,root:n,options:r})}s(_c,"runGenerate");ot();function qR(t,e){return t==="global"?`~/${e}`:e}s(qR,"formatDisplayPath");function Rc(t){let{data:e}=t,{scope:r,mode:n,files:o}=e;if(o.length===0){y.info("No files to generate (no root rule or rules feature disabled)."),n==="check"&&y.success("Generated files are in sync.");return}if(n==="check"){let c=o.filter(m=>m.status!=="unchanged");if(c.length===0){y.success("Generated files are in sync.");return}for(let m of c)y.error(`[check] ${m.status} ${qR(r,m.path)} (${m.target})`);y.error("Generated files are out of sync. Run 'agentsmesh generate' to update them.");return}if(n==="dry-run"){for(let c of o)y.info(`[dry-run] ${c.status} ${qR(r,c.path)} (${c.target})`);return}for(let c of o)(c.status==="created"||c.status==="updated")&&y.success(`${c.status} ${qR(r,c.path)}`);let{created:i,updated:a,unchanged:l}=e.summary;i>0||a>0?y.info(`Generated: ${i} created, ${a} updated, ${l} unchanged`):y.info(`Nothing changed. (${l} unchanged)`);}s(Rc,"renderGenerate");w();Pt();Pt();Rn();function c$(){return bt.filter(t=>!t.excludeFromStarterInit).map(t=>t.id).filter(Pe)}s(c$,"starterInitTargetIds");var m$=/^# yaml-language-server: \$schema=[^\n]*\n?/;function K2(){let t=Ci();return `https://unpkg.com/agentsmesh${t&&t!=="unknown"?`@${t}`:""}/schemas`}s(K2,"schemaBaseUrl");function p$(t){return `${K2()}/${t}.json`}s(p$,"schemaUrl");function Ic(t){return `# yaml-language-server: $schema=${p$(t)}
191
+ `}s(Ic,"yamlSchemaDirective");function Da(t,e){let r=Ic(e);return m$.test(t)?t.replace(m$,r):`${r}${t}`}s(Da,"prependYamlSchemaDirective");function u$(t,e){let{$schema:r,...n}=t;return {$schema:p$(e),...n}}s(u$,"stampJsonSchemaField");var W2=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],H2=c$();function Sf(t,e=H2){let r=(t.length>0?t:e).map(o=>` - ${o}`).join(`
192
+ `),n=W2.map(o=>` - ${o}`).join(`
193
+ `);return `${Ic("agentsmesh")}version: 1
178
194
  targets:
179
195
  ${r}
180
196
  features:
181
- ${o}
182
- `}s(Kd,"buildConfig");var Bd=`---
197
+ ${n}
198
+ `}s(Sf,"buildConfig");var Cf=`---
183
199
  root: true
184
200
  description: "Project rules"
185
201
  ---
@@ -188,7 +204,7 @@ description: "Project rules"
188
204
 
189
205
  Add your project-wide instructions here.
190
206
  This file is always included in AI tool context and synced to all configured tools.
191
- `,mI=`---
207
+ `,tI=`---
192
208
  description: "Example contextual rule \u2014 rename and customize"
193
209
  # targets: [claude-code, cursor] # limit to specific tools (optional)
194
210
  # globs: ["src/**/*.ts"] # activate only for matching files (optional)
@@ -197,14 +213,14 @@ description: "Example contextual rule \u2014 rename and customize"
197
213
  # Example Rule
198
214
 
199
215
  Replace this with your coding standards, conventions, or domain-specific guidelines.
200
- `,pI=`---
216
+ `,eI=`---
201
217
  description: "Example command \u2014 rename and customize"
202
218
  # allowed-tools: [Read, Grep, Glob, Bash]
203
219
  ---
204
220
 
205
221
  Describe the task for this command here.
206
222
  Commands are invoked on-demand (e.g. /example) with a focused tool set.
207
- `,uI=`---
223
+ `,rI=`---
208
224
  name: example-agent
209
225
  description: "Example subagent \u2014 rename and customize"
210
226
  # tools: [Read, Grep, Glob]
@@ -215,7 +231,7 @@ description: "Example subagent \u2014 rename and customize"
215
231
 
216
232
  Describe this agent's role and instructions here.
217
233
  Agents are specialized subagents with restricted tools and a specific purpose.
218
- `,dI=`---
234
+ `,nI=`---
219
235
  name: example-skill
220
236
  description: "Example skill \u2014 rename and customize"
221
237
  ---
@@ -224,7 +240,7 @@ description: "Example skill \u2014 rename and customize"
224
240
 
225
241
  Describe the skill procedure here.
226
242
  Skills are reusable multi-step procedures that commands and agents can reference.
227
- `,gI=`{
243
+ `,oI=`{
228
244
  "mcpServers": {
229
245
  // agentsmesh self-serve MCP server \u2014 exposes your canonical config to AI agents.
230
246
  // Lets agents introspect rules/commands/agents/skills and trigger generate.
@@ -251,7 +267,7 @@ Skills are reusable multi-step procedures that commands and agents can reference
251
267
  // }
252
268
  }
253
269
  }
254
- `,fI=`# Lifecycle hooks \u2014 run shell commands before/after AI tool use
270
+ `,sI=`${Ic("hooks")}# Lifecycle hooks \u2014 run shell commands before/after AI tool use
255
271
  # Events: PreToolUse, PostToolUse, SubagentStart, SubagentStop
256
272
  # Matcher: tool name pattern (e.g. "Edit|Write", "Bash", "*")
257
273
  #
@@ -264,7 +280,7 @@ Skills are reusable multi-step procedures that commands and agents can reference
264
280
  # - matcher: Edit|Write
265
281
  # type: command
266
282
  # command: npm test --passWithNoTests
267
- `,hI=`# Tool permission allow/deny lists
283
+ `,iI=`${Ic("permissions")}# Tool permission allow/deny lists
268
284
  #
269
285
  # allow:
270
286
  # - Bash(npm run:*)
@@ -280,15 +296,14 @@ Skills are reusable multi-step procedures that commands and agents can reference
280
296
  allow: []
281
297
  deny: []
282
298
  ask: []
283
- `,yI=`# Patterns ignored by all configured AI tools (gitignore syntax)
299
+ `,aI=`# Patterns ignored by all configured AI tools (gitignore syntax)
284
300
  #
285
301
  # node_modules/
286
302
  # dist/
287
303
  # .env*
288
304
  # *.log
289
305
  # coverage/
290
- `,Ev=`# yaml-language-server: $schema=https://unpkg.com/agentsmesh/schemas/agentsmesh.json
291
- # Personal overrides \u2014 NOT committed to git
306
+ `,d$=`${Ic("agentsmesh")}# Personal overrides \u2014 NOT committed to git
292
307
  # Uncomment and customize for your local setup:
293
308
 
294
309
  # targets:
@@ -306,27 +321,44 @@ ask: []
306
321
  # overrides:
307
322
  # claude-code:
308
323
  # model: opus
309
- `;T();xt();function Ov(t){let e=[];for(let r of zt)for(let o of R_(r.id,t))e.push({target:r.id,path:o});return e}s(Ov,"collectDetectionPaths");function Lv(t){let e=new Map;for(let{target:r,path:o}of Ov(t)){let n=e.get(r)??[];n.push(o),e.set(r,n);}return [...e.entries()].map(([r,o])=>({id:r,paths:o}))}s(Lv,"toolIndicators");Lv("project");async function Av(t,e="project"){let r=[];for(let{id:o,paths:n}of Lv(e))for(let i of n){let a=join(t,i);if(await j(a)){r.push(o);break}}return [...new Set(r)]}s(Av,"detectExistingConfigs");T();ft();function te(t,e){return join(t,e)}s(te,"ab");async function _I(t){return await j(t)?(await readdir(t,{withFileTypes:true})).filter(r=>r.isFile()&&r.name.endsWith(".md")).length:0}s(_I,"countMdFiles");async function JJ(t){let e=te(t,"skills");if(!await j(e))return false;let r=await readdir(e,{withFileTypes:true});for(let o of r)if(o.isDirectory()&&!o.name.startsWith("_")&&await j(join(e,o.name,"SKILL.md")))return true;return false}s(JJ,"hasAnyImportedSkill");async function II(t){let e=te(t,"rules");await L(e),await _(join(e,"_root.md"),Bd),I.success("Created .agentsmesh/rules/_root.md"),await _(join(e,"_example.md"),mI),I.success("Created .agentsmesh/rules/_example.md");let r=te(t,"commands");await L(r),await _(join(r,"_example.md"),pI),I.success("Created .agentsmesh/commands/_example.md");let o=te(t,"agents");await L(o),await _(join(o,"_example.md"),uI),I.success("Created .agentsmesh/agents/_example.md");let n=te(t,join("skills","_example"));await L(n),await _(join(n,"SKILL.md"),dI),I.success("Created .agentsmesh/skills/_example/SKILL.md"),await _(te(t,"mcp.json"),gI),I.success("Created .agentsmesh/mcp.json"),await _(te(t,"hooks.yaml"),fI),I.success("Created .agentsmesh/hooks.yaml"),await _(te(t,"permissions.yaml"),hI),I.success("Created .agentsmesh/permissions.yaml"),await _(te(t,"ignore"),yI),I.success("Created .agentsmesh/ignore");}s(II,"writeScaffoldFull");async function wv(t){let e=te(t,"rules"),r=await _I(e),o=join(e,"_root.md"),n=await j(o);await L(e),r===0?(await _(o,Bd),I.success("Created .agentsmesh/rules/_root.md"),await _(join(e,"_example.md"),mI),I.success("Created .agentsmesh/rules/_example.md")):n||(await _(o,Bd),I.success("Created .agentsmesh/rules/_root.md"));let i=te(t,"commands");await _I(i)===0&&(await L(i),await _(join(i,"_example.md"),pI),I.success("Created .agentsmesh/commands/_example.md"));let a=te(t,"agents");if(await _I(a)===0&&(await L(a),await _(join(a,"_example.md"),uI),I.success("Created .agentsmesh/agents/_example.md")),!await JJ(t)){let u=te(t,join("skills","_example"));await L(u),await _(join(u,"SKILL.md"),dI),I.success("Created .agentsmesh/skills/_example/SKILL.md");}let c=te(t,"mcp.json");await j(c)||(await _(c,gI),I.success("Created .agentsmesh/mcp.json"));let l=te(t,"hooks.yaml");await j(l)||(await _(l,fI),I.success("Created .agentsmesh/hooks.yaml"));let m=te(t,"permissions.yaml");await j(m)||(await _(m,hI),I.success("Created .agentsmesh/permissions.yaml"));let p=te(t,"ignore");await j(p)||(await _(p,yI),I.success("Created .agentsmesh/ignore"));}s(wv,"writeScaffoldGapFill");Oe();var RI="agentsmesh.yaml",Tv="agentsmesh.local.yaml",XJ=["agentsmesh.local.yaml",".agentsmeshcache",".agentsmesh/.lock.tmp",".agentsmesh/packs/"],ZJ=Object.fromEntries(zt.map(t=>[t.id,(e,r)=>t.generators.importFrom(e,{scope:r})])),bv=zt.filter(t=>t.globalSupport!==void 0).map(t=>t.id);function QJ(t,e){if(e.has(t))return true;let r=t.replace(/\/$/,"");for(;r.includes("/")&&(r=r.slice(0,r.lastIndexOf("/")),r!=="");)if(e.has(r)||e.has(`${r}/`)||e.has(`${r}/**`))return true;return false}s(QJ,"isCoveredByExisting");async function qJ(t){let e=join(t,".gitignore"),r=await y(e)??"",o=new Set(r.split(`
310
- `).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"))),n=XJ.filter(a=>!QJ(a,o));if(n.length===0)return false;let i=r.endsWith(`
324
+ `;w();Pt();function f$(t){let e=[];for(let r of bt)for(let n of iR(r.id,t))e.push({target:r.id,path:n});return e}s(f$,"collectDetectionPaths");function g$(t){let e=new Map;for(let{target:r,path:n}of f$(t)){let o=e.get(r)??[];o.push(n),e.set(r,o);}return [...e.entries()].map(([r,n])=>({id:r,paths:n}))}s(g$,"toolIndicators");g$("project");async function h$(t,e="project"){let r=[];for(let{id:n,paths:o}of g$(e))for(let i of o){let a=join(t,i);if(await $(a)){r.push(n);break}}return [...new Set(r)]}s(h$,"detectExistingConfigs");w();ot();function re(t,e){return join(t,e)}s(re,"ab");async function lI(t){return await $(t)?(await readdir(t,{withFileTypes:true})).filter(r=>r.isFile()&&r.name.endsWith(".md")).length:0}s(lI,"countMdFiles");async function V2(t){let e=re(t,"skills");if(!await $(e))return false;let r=await readdir(e,{withFileTypes:true});for(let n of r)if(n.isDirectory()&&!n.name.startsWith("_")&&await $(join(e,n.name,"SKILL.md")))return true;return false}s(V2,"hasAnyImportedSkill");async function cI(t){let e=re(t,"rules");await O(e),await I(join(e,"_root.md"),Cf),y.success("Created .agentsmesh/rules/_root.md"),await I(join(e,"_example.md"),tI),y.success("Created .agentsmesh/rules/_example.md");let r=re(t,"commands");await O(r),await I(join(r,"_example.md"),eI),y.success("Created .agentsmesh/commands/_example.md");let n=re(t,"agents");await O(n),await I(join(n,"_example.md"),rI),y.success("Created .agentsmesh/agents/_example.md");let o=re(t,join("skills","_example"));await O(o),await I(join(o,"SKILL.md"),nI),y.success("Created .agentsmesh/skills/_example/SKILL.md"),await I(re(t,"mcp.json"),oI),y.success("Created .agentsmesh/mcp.json"),await I(re(t,"hooks.yaml"),sI),y.success("Created .agentsmesh/hooks.yaml"),await I(re(t,"permissions.yaml"),iI),y.success("Created .agentsmesh/permissions.yaml"),await I(re(t,"ignore"),aI),y.success("Created .agentsmesh/ignore");}s(cI,"writeScaffoldFull");async function _$(t){let e=re(t,"rules"),r=await lI(e),n=join(e,"_root.md"),o=await $(n);await O(e),r===0?(await I(n,Cf),y.success("Created .agentsmesh/rules/_root.md"),await I(join(e,"_example.md"),tI),y.success("Created .agentsmesh/rules/_example.md")):o||(await I(n,Cf),y.success("Created .agentsmesh/rules/_root.md"));let i=re(t,"commands");await lI(i)===0&&(await O(i),await I(join(i,"_example.md"),eI),y.success("Created .agentsmesh/commands/_example.md"));let a=re(t,"agents");if(await lI(a)===0&&(await O(a),await I(join(a,"_example.md"),rI),y.success("Created .agentsmesh/agents/_example.md")),!await V2(t)){let u=re(t,join("skills","_example"));await O(u),await I(join(u,"SKILL.md"),nI),y.success("Created .agentsmesh/skills/_example/SKILL.md");}let l=re(t,"mcp.json");await $(l)||(await I(l,oI),y.success("Created .agentsmesh/mcp.json"));let c=re(t,"hooks.yaml");await $(c)||(await I(c,sI),y.success("Created .agentsmesh/hooks.yaml"));let m=re(t,"permissions.yaml");await $(m)||(await I(m,iI),y.success("Created .agentsmesh/permissions.yaml"));let p=re(t,"ignore");await $(p)||(await I(p,aI),y.success("Created .agentsmesh/ignore"));}s(_$,"writeScaffoldGapFill");Yt();var mI="agentsmesh.yaml",R$="agentsmesh.local.yaml",Y2=["agentsmesh.local.yaml",".agentsmeshcache",".agentsmesh/.lock.tmp",".agentsmesh/packs/"],X2=Object.fromEntries(bt.map(t=>[t.id,(e,r)=>t.generators.importFrom(e,{scope:r})])),I$=bt.filter(t=>t.globalSupport!==void 0).map(t=>t.id);function Z2(t,e){if(e.has(t))return true;let r=t.replace(/\/$/,"");for(;r.includes("/")&&(r=r.slice(0,r.lastIndexOf("/")),r!=="");)if(e.has(r)||e.has(`${r}/`)||e.has(`${r}/**`))return true;return false}s(Z2,"isCoveredByExisting");async function Q2(t){let e=join(t,".gitignore"),r=await _(e)??"",n=new Set(r.split(`
325
+ `).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"))),o=Y2.filter(a=>!Z2(a,n));if(o.length===0)return false;let i=r.endsWith(`
311
326
  `)||r===""?"":`
312
- `;return await _(e,r+i+n.join(`
327
+ `;return await I(e,r+i+o.join(`
313
328
  `)+`
314
- `),true}s(qJ,"appendToGitignore");async function Pv(t,e={}){let r=e.global===true?"global":"project",o=yl(t,r),n=join(o.configDir,RI);if(await j(n))throw new Error(`Already initialized. ${RI} exists. Remove it first to re-init.`);let i=await Av(o.rootBase,r),a=r==="global"?i.filter(f=>bv.includes(f)):i,c=r==="global"?bv:void 0,l=[],m,p=0;if(a.length>0)if(e.yes){for(let f of a){let h=ZJ[f];if(!h)continue;let O=await h(o.rootBase,r);for(let R of O)l.push({from:relative(o.rootBase,R.fromPath).replaceAll("\\","/"),to:R.toPath.replaceAll("\\","/")});}p=a.length,await wv(o.canonicalDir),m="gap-fill",await _(n,Kd(a,c));}else await II(o.canonicalDir),m="full",await _(n,Kd([],c));else await II(o.canonicalDir),m="full",await _(n,Kd([],c));let u=join(o.configDir,Tv);await _(u,Ev);let g=false;return r==="project"&&(g=await qJ(t)),{exitCode:0,data:{scope:r,configFile:RI,localConfigFile:Tv,detectedConfigs:a,imported:l,importedToolCount:p,scaffoldType:m,gitignoreUpdated:g}}}s(Pv,"runInit");ft();function xv(t){let{data:e}=t;if(e.detectedConfigs.length>0&&I.info(`Found existing configurations: ${e.detectedConfigs.join(", ")}`),e.detectedConfigs.length>0&&e.imported.length===0&&I.info("Run 'agentsmesh init --yes' to auto-import, or 'agentsmesh import --from <tool>' manually."),e.imported.length>0){I.info("Auto-importing existing configurations (--yes)...");for(let o of e.imported)I.success(` ${o.from} \u2192 ${o.to}`);I.info(`Imported ${e.imported.length} file(s) from ${e.importedToolCount} tool(s).`);}let r=e.imported.length>0&&e.detectedConfigs.length>0?` (targets: ${e.detectedConfigs.join(", ")})`:"";I.success(`Created ${e.configFile}${r}`),I.success(`Created ${e.localConfigFile}`),e.gitignoreUpdated&&I.success("Updated .gitignore");}s(xv,"renderInit");Oe();xt();var t1=Object.fromEntries(zt.map(t=>[t.id,{importFrom:t.generators.importFrom,emptyImportMessage:t.emptyImportMessage,lintRules:t.lintRules,lint:t.lint,capabilities:t.capabilities}]));function Wd(t){let e=t1[t];if(!e)throw new Error(`Unknown target: ${t}`);return e}s(Wd,"getTargetCatalogEntry");je();ds();Cl();var i1={type:"stdio",command:"npx",args:["-y","agentsmesh","mcp"]};function a1(t){return t.mcpServers.agentsmesh!==void 0?false:(t.mcpServers.agentsmesh=i1,true)}s(a1,"injectAgentsmeshEntry");async function CI(t){let e=resolve(t,".agentsmesh/mcp.json");try{let r;try{r=await br(e)??{mcpServers:{}};}catch{r={mcpServers:{}};}if(!a1(r))return !1;let o=JSON.stringify(r,null,2)+`
315
- `;await mkdir(dirname(e),{recursive:!0});let n=`${e}.tmp.${process.pid}.${Date.now()}`;return await writeFile(n,o,"utf8"),await rename(n,e),!0}catch(r){return process.stderr.write(`[agentsmesh] warning: could not seed agentsmesh MCP server entry into mcp.json: ${r instanceof Error?r.message:String(r)}
316
- `),false}}s(CI,"seedAgentsmeshMcpEntry");function Dv(t,e){return t.map(r=>({from:relative(e,r.fromPath).replaceAll("\\","/"),to:r.toPath}))}s(Dv,"mapResults");async function Nv(t,e){let r=e??process.cwd(),o=t.from;if(typeof o!="string"||!o)throw new Error("--from is required. Example: agentsmesh import --from claude-code");let n=o.toLowerCase().trim(),i=t.global===true?"global":"project";if(Tr(n)){let p=yl(r,i),g=await Wd(n).importFrom(p.rootBase,{scope:i});return g.length>0&&await CI(p.rootBase),{exitCode:0,data:{scope:i,target:n,files:Dv(g,p.rootBase)}}}let a,c;try{({config:a,context:c}=await Tt(r,i));}catch{throw new Error(`Unknown --from "${o}" and no agentsmesh.yaml found. Run 'agentsmesh init' to enable plugin targets, or use a builtin: ${kt.join(", ")}.`)}await le(a,r);let l=ut(n);if(!l)throw new Error(`Unknown --from "${o}". Supported: ${[...kt,...a.pluginTargets??[]].join(", ")}.`);let m=await l.generators.importFrom(c.rootBase,{scope:i});return m.length>0&&await CI(c.rootBase),{exitCode:0,data:{scope:i,target:n,files:Dv(m,c.rootBase)}}}s(Nv,"runImport");Oe();ln();function Hd(t){let e=[],r={new:0,updated:0,unchanged:0,deleted:0};for(let o of t){if(o.status==="unchanged"){r.unchanged++;continue}if(o.status==="created"){r.new++;let n=createTwoFilesPatch(`${o.path} (current)`,`${o.path} (generated)`,"",o.content,void 0,void 0,{context:3});e.push({path:o.path,patch:n});continue}if(o.status==="updated"&&o.currentContent!==void 0){r.updated++;let n=createTwoFilesPatch(`${o.path} (current)`,`${o.path} (generated)`,o.currentContent,o.content,void 0,void 0,{context:3});e.push({path:o.path,patch:n});continue}}return {diffs:e,summary:r}}s(Hd,"computeDiff");function zd(t){return `${t.new} files would be created, ${t.updated} updated, ${t.unchanged} unchanged, ${t.deleted} deleted`}s(zd,"formatDiffSummary");ds();async function vv(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",n=t.targets,i=typeof n=="string"&&n?n.split(",").map(f=>f.trim()).filter(Boolean):void 0,{config:a,context:c}=await Tt(r,o);await le(a,r);let{canonical:l}=await he(a,c.configDir,{},c.canonicalDir),m=await Lr({config:a,canonical:l,projectRoot:c.rootBase,scope:o,targetFilter:i});if(m.length===0)return {exitCode:0,data:{files:[],patches:[],summary:{created:0,updated:0,unchanged:0,deleted:0}}};let{diffs:p,summary:u}=Hd(m);return {exitCode:0,data:{files:m.filter(f=>f.status!=="unchanged"&&f.status!=="skipped").map(f=>({path:f.path,target:f.target,status:f.status})),patches:p.map(f=>({path:f.path,patch:f.patch})),summary:{created:u.new,updated:u.updated,unchanged:u.unchanged,deleted:u.deleted}}}}s(vv,"runDiff");Oe();ln();T();je();Si();Et();var l1=[{canonicalKey:"permissions",capabilityKey:"permissions",featureFlag:"permissions",file:".agentsmesh/permissions.yaml",label:"permissions",hasContent:s(t=>{let e=t.permissions;if(!e)return false;let r=e.ask?.length??0;return e.allow.length+e.deny.length+r>0},"hasContent")},{canonicalKey:"hooks",capabilityKey:"hooks",featureFlag:"hooks",file:".agentsmesh/hooks.yaml",label:"hooks",hasContent:s(t=>{let e=t.hooks;return e?Object.values(e).some(r=>Array.isArray(r)&&r.length>0):false},"hasContent")},{canonicalKey:"mcp",capabilityKey:"mcp",featureFlag:"mcp",file:".agentsmesh/mcp.json",label:"MCP servers",hasContent:s(t=>{let e=t.mcp;return e?Object.keys(e.mcpServers).length>0:false},"hasContent")},{canonicalKey:"commands",capabilityKey:"commands",featureFlag:"commands",file:".agentsmesh/commands",label:"commands",hasContent:s(t=>t.commands.length>0,"hasContent")},{canonicalKey:"agents",capabilityKey:"agents",featureFlag:"agents",file:".agentsmesh/agents",label:"agents",hasContent:s(t=>t.agents.length>0,"hasContent")},{canonicalKey:"skills",capabilityKey:"skills",featureFlag:"skills",file:".agentsmesh/skills",label:"skills",hasContent:s(t=>t.skills.length>0,"hasContent")},{canonicalKey:"ignore",capabilityKey:"ignore",featureFlag:"ignore",file:".agentsmesh/ignore",label:"ignore patterns",hasContent:s(t=>t.ignore.length>0,"hasContent")}];function Gv(t){let e=new Set(t.enabledFeatures),r=[];for(let o of l1)!e.has(o.featureFlag)||!o.hasContent(t.canonical)||Dr(t.capabilities[o.capabilityKey]).level!=="none"||r.push(b(o.file,t.target,`${t.target} does not support ${o.label}; canonical entries are silently dropped during generation. Disable the feature for this target or remove the canonical content.`));return r}s(Gv,"lintSilentFeatureDrops");Et();var m1=/^(?:\s*(?:bash|sh|zsh|pwsh|powershell)\s+)?["']?(?<path>(?:\.{1,2}\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?:\s|$)/;function p1(t){let r=t.match(m1)?.groups?.path;return typeof r=="string"?r:null}s(p1,"extractScriptToken");function Mv(t){if(t.hasScriptProjection)return [];let e=t.canonical.hooks;if(!e)return [];let r=[];for(let o of Object.values(e))if(Array.isArray(o))for(let n of o){if(typeof n?.command!="string")continue;let i=p1(n.command);i&&r.push(b(".agentsmesh/hooks.yaml",t.target,`${t.target} hook command references script "${i}"; agentsmesh does not copy hook scripts into ${t.target} output, so the script must already exist relative to the hook execution directory or the generated config will fail.`));}return r}s(Mv,"lintHookScriptReferences");Et();function $v(t){if(t.preservesManualActivation)return [];let e=[];for(let r of t.canonical.rules)r.root||r.trigger==="manual"&&(r.targets.length>0&&!r.targets.includes(t.target)||e.push(b(r.source,t.target,`Rule has trigger: 'manual' (Cursor-style "@-mention only" activation), but ${t.target} loads every rule unconditionally. The rule will become always-on for ${t.target} \u2014 restrict it with \`targets: [cursor]\`, convert it to a skill with manual invocation, or remove it.`)));return e}s($v,"lintRuleScopeInversion");var u1=["node_modules",".git","dist","coverage",".agentsmesh"];async function d1(t){return (await v(t)).filter(o=>{let n=relative(t,o);return !u1.some(i=>n.includes(`/${i}/`)||n.startsWith(`${i}/`))}).map(o=>relative(t,o))}s(d1,"getProjectFiles");async function Vd(t,e,r,o,n={}){let i=n.scope??"project",a=[...t.targets,...t.pluginTargets??[]],c=o?a.filter(R=>o.includes(R)):a,l=t.features.includes("rules"),m=t.features.includes("commands"),p=t.features.includes("mcp"),u=t.features.includes("permissions"),g=t.features.includes("hooks"),f=[],h=i==="global"?[]:await d1(r);for(let R of c){let S=ut(R),A=Tr(R)?Wd(R):S;A?.capabilities&&f.push(...Gv({target:R,capabilities:A.capabilities,canonical:e,enabledFeatures:t.features})),g&&f.push(...Mv({target:R,canonical:e,hasScriptProjection:S?.postProcessHookOutputs!==void 0})),l&&f.push(...$v({target:R,canonical:e,preservesManualActivation:S?.preservesManualActivation===true})),l&&A?.lintRules&&f.push(...A.lintRules(e,r,h,{scope:i})),S?.generators.lint&&f.push(...S.generators.lint(e));let D={scope:i};m&&A?.lint?.commands&&f.push(...A.lint.commands(e,D)),p&&A?.lint?.mcp&&f.push(...A.lint.mcp(e,D)),u&&A?.lint?.permissions&&f.push(...A.lint.permissions(e,D)),g&&A?.lint?.hooks&&f.push(...A.lint.hooks(e,D));}let O=f.some(R=>R.level==="error");return {diagnostics:f,hasErrors:O}}s(Vd,"runLint");ds();async function Uv(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",n=t.targets,i=typeof n=="string"&&n?n.split(",").map(u=>u.trim()).filter(Boolean):void 0,{config:a,context:c}=await Tt(r,o);await le(a,r);let{canonical:l}=await he(a,c.configDir,{},c.canonicalDir),{diagnostics:m,hasErrors:p}=await Vd(a,l,c.configDir,i,{scope:o});return {exitCode:p?1:0,data:{diagnostics:m.map(u=>({level:u.level,file:u.file,target:u.target,message:u.message})),summary:{errors:m.filter(u=>u.level==="error").length,warnings:m.filter(u=>u.level==="warning").length}}}}s(Uv,"runLintCmd");ft();function Kv(t){let{data:e}=t;if(e.diagnostics.length===0){I.success("All checks passed.");return}let r=e.diagnostics.filter(a=>a.level==="error"),o=e.diagnostics.filter(a=>a.level==="warning");for(let a of r)I.error(`${a.file} (${a.target}): ${a.message}`);for(let a of o)I.warn(`${a.file} (${a.target}): ${a.message}`);let n=e.summary.errors,i=e.summary.warnings;I.info(`${n} error${n!==1?"s":""}, ${i} warning${i!==1?"s":""}`);}s(Kv,"renderLint");ft();function Bv(t){let{data:e}=t;if(!e.hasLock){I.error("Not initialized for collaboration. Run 'agentsmesh generate' first.");return}if(e.inSync){I.success("Lock file is in sync.");return}let r=new Set(e.lockedViolations);I.error("Conflict detected:");for(let o of e.extendsModified)I.error(` extend "${o}" was modified`);for(let o of e.modified){let n=r.has(o)?" [LOCKED]":"";I.error(` ${o} was modified${n}`);}for(let o of e.added){let n=r.has(o)?" [LOCKED]":"";I.error(` ${o} was added${n}`);}for(let o of e.removed){let n=r.has(o)?" [LOCKED]":"";I.error(` ${o} was removed${n}`);}I.info("Run 'agentsmesh merge' to resolve, or 'agentsmesh generate --force' to accept current state.");}s(Bv,"renderCheck");ft();function Wv(t){let{data:e}=t;if(e.files.length===0){I.info(`Nothing to import from ${e.target}.`);return}for(let o of e.files)I.success(`${o.from} \u2192 ${o.to}`);let r=e.scope==="global"?" --global":"";I.info(`Imported ${e.files.length} file(s). Run 'agentsmesh generate${r}' to sync to other tools.`);}s(Wv,"renderImport");ft();function Hv(t){let{summary:e}=t.data;if(e.created+e.updated+e.unchanged+e.deleted===0){I.info("No files to generate (no root rule or rules feature disabled).");return}for(let o of t.data.patches)process.stdout.write(o.patch);I.info(zd({new:e.created,updated:e.updated,unchanged:e.unchanged,deleted:e.deleted}));}s(Hv,"renderDiff");ft();function zv(t){if(!t.data.hadConflict){I.info("No conflicts to resolve.");return}I.success("Lock file conflict resolved.");}s(zv,"renderMerge");vm();Mm();Oe();ln();vm();Mm();ft();var h1=300;function y1(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(y1,"normalizeWatchPath");function _1(t,e,r){let o=y1(relative(t,e));return o===""?true:o===".lock"||o===".lock.tmp"||o===".generate.lock"||o.endsWith("/.lock")||o.endsWith("/.lock.tmp")||o.endsWith("/.generate.lock")||o.includes("/.generate.lock/")||o.startsWith(".generate.lock/")}s(_1,"shouldIgnoreWatchPath");function I1(t,e,r,o,n,i,a,c,l){return JSON.stringify({features:t,rulesCount:e,commandsCount:r,agentsCount:o,skillsCount:n,mcpServerCount:i,permissionsCount:a,hooksCount:c,ignoreCount:l})}s(I1,"featureFingerprint");async function Jv(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",{context:n}=await Tt(r,o),i=[n.canonicalDir,join(n.configDir,"agentsmesh.yaml"),join(n.configDir,"agentsmesh.local.yaml")],a=null,c=null,l=false,m=null,u=s(async()=>{if(l)return;a=null;let{config:O,context:R}=await Tt(r,o),{canonical:S}=await he(O,R.configDir,{},R.canonicalDir),A=S.mcp?Object.keys(S.mcp.mcpServers).length:0,D=S.permissions?S.permissions.allow.length+S.permissions.deny.length:0,N=S.hooks?Object.values(S.hooks).reduce((Ft,Gt)=>Ft+(Array.isArray(Gt)?Gt.length:0),0):0,G=S.ignore.length,J=I1(O.features,S.rules.length,S.commands.length,S.agents.length,S.skills.length,A,D,N,G),X=c!==null&&c!==J;if(c=J,l)return;let q=await rl(t,r,{printMatrix:false});if(ol(q),!l)if(X){let Ft=await Fm(t,r);Gm(Ft,{verbose:t.verbose===true});}else I.info("Regenerated.");},"run"),g=s(()=>{let O=u().catch(R=>{if(!l){let S=R instanceof Error?R.message:String(R);I.error(S);}}).finally(()=>{m===O&&(m=null);});m=O;},"scheduleRun"),f=s(()=>{l||(a&&clearTimeout(a),a=setTimeout(g,h1));},"schedule"),h=f1.watch(i,{ignoreInitial:true,usePolling:process.platform==="win32"});return h.on("all",(O,R)=>{_1(n.canonicalDir,R)||f();}),await new Promise((O,R)=>{h.once("ready",O),h.once("error",R);}),I.info(o==="global"?"Watching ~/.agentsmesh/ and agentsmesh.yaml...":"Watching .agentsmesh/ and agentsmesh.yaml..."),m=u(),await m,m=null,{stop:s(async()=>{l=true,a&&(clearTimeout(a),a=null),await h.close(),m&&await m;},"stop")}}s(Jv,"runWatch");Oe();np();async function Jd(t){let{config:e,configDir:r,canonicalDir:o}=t,n=await Dd(o);if(n===null)return {inSync:false,hasLock:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]};let i=await us(o),a=await $a(e,r),c=a.length>0?await qc(a):{},l=new Set(Object.keys(n.checksums)),m=new Set(Object.keys(i)),p=[],u=[],g=[];for(let S of l){let A=i[S];A===void 0?g.push(S):A!==n.checksums[S]&&p.push(S);}for(let S of m)l.has(S)||u.push(S);let f=new Set([...Object.keys(n.extends),...Object.keys(c)]),h=[];for(let S of f)c[S]!==n.extends[S]&&h.push(S);let O=Fd(n.checksums,i,e.collaboration?.lock_features??[]);return {inSync:p.length===0&&u.length===0&&g.length===0&&h.length===0,hasLock:true,modified:p,added:u,removed:g,extendsModified:h,lockedViolations:O}}s(Jd,"checkLockSync");ds();async function Yv(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",{config:n,context:i}=await Tt(r,o);await le(n,r);let a=await Jd({config:n,configDir:i.configDir,canonicalDir:i.canonicalDir});return a.hasLock?{exitCode:a.inSync?0:1,data:{hasLock:true,inSync:a.inSync,modified:[...a.modified],added:[...a.added],removed:[...a.removed],extendsModified:[...a.extendsModified],lockedViolations:[...a.lockedViolations]}}:{exitCode:1,data:{hasLock:false,inSync:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]}}}s(Yv,"runCheck");Oe();T();np();var S1=".lock",C1="<<<<<<<";async function EI(t){let e=join(t,S1),r=await y(e);return r===null?false:r.includes(C1)}s(EI,"hasLockConflict");async function Zv(t,e,r){if(!await EI(t))throw new Error("No conflict to resolve.");let n=await us(t),i=dirname(t),a=r?await $a(r,i):[],c=a.length>0?await qc(a):{},l=await vd(join(t,"packs")),m=process.env.USER??process.env.USERNAME??"unknown";await Nd(t,{generatedAt:new Date().toISOString(),generatedBy:m,libVersion:e,checksums:n,extends:c,packs:l});}s(Zv,"resolveLockConflict");async function Qv(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",{config:n,context:i}=await Tt(r,o),a=i.canonicalDir;return await EI(a)?(await Zv(a,gl(),n),{exitCode:0,data:{hadConflict:true,resolved:true}}):{exitCode:0,data:{hadConflict:false,resolved:false}}}s(Qv,"runMerge");Oe();T();Rl();var L1=promisify(execFile);function Yd(t,e){if(t.startsWith("-"))throw new Error(`agentsmesh refuses ${e} starting with "-" (option-injection guard): ${t}`)}s(Yd,"ensureNotFlag");async function OI(t){let{stdout:e}=await L1("git",t,{env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return e.trim()}s(OI,"runGit");async function qv(){try{return await OI(["--version"]),!0}catch{return false}}s(qv,"isGitAvailable");async function A1(t,e){Yd(t,"remote-url"),Yd(e,"ref");let r=[e,`refs/heads/${e}`,`refs/tags/${e}`],o;for(let n of r)try{let a=(await OI(["ls-remote",t,n])).split(`
317
- `).map(l=>l.trim()).find(l=>l.length>0);if(!a)continue;let c=a.split(/\s+/)[0];if(c&&/^[0-9a-f]{40}$/i.test(c))return c}catch(i){o=i;}throw new Error(`Could not resolve ref "${e}" for ${t}: ${o instanceof Error?o.message:String(o)}`)}s(A1,"gitLsRemoteResolve");async function tG(t,e){Yd(e,"remote-url");let r=t===""?"HEAD":t;if(Yd(r,"ref"),/^[0-9a-f]{40}$/i.test(r))return r.toLowerCase();if(r==="HEAD"){let n=(await OI(["ls-remote",e,"HEAD"])).split(`
318
- `).find(a=>a.trim().length>0);if(!n)throw new Error(`Could not resolve HEAD for ${e}`);let i=n.split(/\s+/)[0];if(!i||!/^[0-9a-f]{40}$/i.test(i))throw new Error(`Invalid ls-remote HEAD line for ${e}`);return i.toLowerCase()}return A1(e,r)}s(tG,"resolveRemoteRefForInstall");async function eG(t){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};let e=t.gitRemoteUrl;if(!e)throw new Error("Internal error: missing git remote URL");let r=await tG(t.rawRef||"HEAD",e);if(t.kind==="github"){let c=`github:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Ma(c,"install",{cacheDir:Le(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:c,version:r}}if(t.kind==="gitlab"){let c=`gitlab:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Ma(c,"install",{cacheDir:Le(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:c,version:r}}let o=r,i=`git+${(t.gitPlusBase??e).split("#")[0]}#${o}`;return {resolvedPath:(await Ma(i,"install",{cacheDir:Le(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:i,version:r}}s(eG,"fetchInstallSource");async function rG(t,e){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};try{let r=await eG(t);return {resolvedPath:r.resolvedPath,sourceForYaml:r.sourceForYaml,version:r.version}}catch(r){let o=r instanceof Error?r.message:String(r),n=new Error(`Failed to fetch from ${e}: ${o}. Check your network connection and try again.`);throw r instanceof Error&&(n.cause=r),n}}s(rG,"resolveInstallResolvedPath");function LI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean),o=r.indexOf("tree");if(o<2||o+1>=r.length)return null;let n=r[0],i=r[1],a=r[o+1],c=r.slice(o+2).join("/");return !n||!i||!a?null:{org:n,repo:i,ref:a,path:c||""}}catch{return null}}s(LI,"parseGithubTreeUrl");function AI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean),o=r.indexOf("blob");if(o<2||o+1>=r.length)return null;let n=r[0],i=r[1],a=r[o+1],c=r.slice(o+2).join("/");return !n||!i||!a||!c?null:{org:n,repo:i,ref:a,path:c}}catch{return null}}s(AI,"parseGithubBlobUrl");function kI(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean),o=r.indexOf("-");if(o<0||r[o+1]!=="tree")return null;let n=o+1;if(n+1>=r.length)return null;let i=r[n+1],a=r.slice(n+2).join("/"),c=r.slice(0,o);if(c.length<2)return null;let l=c[c.length-1],m=c.slice(0,-1).join("/");return !m||!l||!i?null:{namespace:m,project:l,ref:i,path:a||""}}catch{return null}}s(kI,"parseGitlabTreeUrl");function wI(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean),o=r.indexOf("-");if(o<0||r[o+1]!=="blob")return null;let n=o+1;if(n+1>=r.length)return null;let i=r[n+1],a=r.slice(n+2).join("/"),c=r.slice(0,o);if(c.length<2)return null;let l=c[c.length-1],m=c.slice(0,-1).join("/");return !m||!l||!i||!a?null:{namespace:m,project:l,ref:i,path:a}}catch{return null}}s(wI,"parseGitlabBlobUrl");var k1=new Set(["tree","blob","commit","releases","actions","issues","pulls","settings","wiki","discussions","security","projects","packages"]);function TI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean).map(i=>i.replace(/\.git$/i,""));if(r.length<2||r.length>2||k1.has(r[1]))return null;let o=r[0],n=r[1];return {org:o,repo:n}}catch{return null}}s(TI,"parseGithubRepoUrl");function bI(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean).map(i=>i.replace(/\.git$/i,""));if(r.length<2||r.includes("-"))return null;let o=r[r.length-1],n=r.slice(0,-1).join("/");return !n||!o?null:{namespace:n,project:o}}catch{return null}}s(bI,"parseGitlabRepoUrl");function PI(t){let e=t.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/i);return e?{org:e[1],repo:e[2].replace(/\.git$/i,"")}:null}s(PI,"parseGitSshGithub");function xI(t){let e=t.match(/^git@gitlab\.com:(.+?)(?:\.git)?$/i);if(!e)return null;let o=e[1].replace(/\.git$/i,"").split("/").filter(Boolean);if(o.length<2)return null;let n=o[o.length-1];return {namespace:o.slice(0,-1).join("/"),project:n}}s(xI,"parseGitSshGitlab");T();var b1=/^[A-Za-z]:[\\/]/,P1=/^[A-Za-z]:\//;function oG(...t){return t.some(e=>e.includes("\\")||b1.test(e))?win32:posix}s(oG,"pathApiFor");function jm(t){return t.replace(/\\/g,"/")}s(jm,"toPosixPath");function $m(t){return jm(t).replace(/^\/+|\/+$/g,"")}s($m,"normalizeInstallPathField");function Xd(t){let e=jm(t);return e===""||e==="."||e==="./."?".":e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||P1.test(e)?e:`./${e}`}s(Xd,"normalizeLocalSourceForYaml");function ci(t){return {...t,source:t.source_kind==="local"?Xd(t.source):t.source,...t.path!==void 0?{path:$m(t.path)}:{},...t.paths!==void 0?{paths:t.paths.map(e=>$m(e))}:{}}}s(ci,"normalizePersistedInstallPaths");function nG(t,e,r){let o=oG(t,e),n=o.normalize(t),i=o.normalize(e),a=$m(r),c=`${o.sep}.agentsmesh${o.sep}`,l=n.indexOf(c);if(l>=0){let p=n.slice(0,l),u=n.slice(l+c.length),g=$m(u),f=jm(o.relative(i,p))||".";return {kind:"local",rawRef:"",pathInRepo:a||g.replace(/\.md$/i,"").replace(/\/$/,""),localRoot:p,localSourceForYaml:Xd(f)}}let m=jm(o.relative(i,n))||".";return {kind:"local",rawRef:"",pathInRepo:a,localRoot:n,localSourceForYaml:Xd(m)}}s(nG,"localParsedFromAbsPath");async function DI(t,e,r){let o=t.trim(),n=r?.trim().replace(/\\/g,"/")??"";if(o.startsWith("git+")){let l=o.lastIndexOf("#"),m=l<0?o:o.slice(0,l),p=l<0?"HEAD":o.slice(l+1),u=m.slice(4);return {kind:"git",rawRef:p,gitPlusBase:u,gitRemoteUrl:u,pathInRepo:n}}if(o.startsWith("https://")||o.startsWith("http://")){let l=LI(o)??AI(o);if(l)return {kind:"github",rawRef:l.ref,org:l.org,repo:l.repo,gitRemoteUrl:`https://github.com/${l.org}/${l.repo}.git`,pathInRepo:n||l.path};let m=TI(o);if(m)return {kind:"github",rawRef:"HEAD",org:m.org,repo:m.repo,gitRemoteUrl:`https://github.com/${m.org}/${m.repo}.git`,pathInRepo:n};let p=kI(o)??wI(o);if(p)return {kind:"gitlab",rawRef:p.ref,org:p.namespace,repo:p.project,gitRemoteUrl:`https://gitlab.com/${p.namespace}/${p.project}.git`,pathInRepo:n||p.path};let u=bI(o);if(u)return {kind:"gitlab",rawRef:"HEAD",org:u.namespace,repo:u.project,gitRemoteUrl:`https://gitlab.com/${u.namespace}/${u.project}.git`,pathInRepo:n}}if(o.startsWith("git@github.com:")){let l=PI(o);if(!l)throw new Error(`Invalid GitHub SSH URL: ${o}`);return {kind:"github",rawRef:"HEAD",org:l.org,repo:l.repo,gitRemoteUrl:`https://github.com/${l.org}/${l.repo}.git`,pathInRepo:n}}if(o.startsWith("git@gitlab.com:")){let l=xI(o);if(!l)throw new Error(`Invalid GitLab SSH URL: ${o}`);return {kind:"gitlab",rawRef:"HEAD",gitRemoteUrl:`https://gitlab.com/${l.namespace}/${l.project}.git`,pathInRepo:n}}if(o.startsWith("git@")){let l=o.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(!l)throw new Error(`Invalid SSH git URL: ${o}`);let m=l[1],p=l[2].replace(/\.git$/i,"");return {kind:"git",rawRef:"HEAD",gitRemoteUrl:`ssh://git@${m}/${p}.git`,pathInRepo:n}}let i=o.match(/^github:([^/]+)\/(.+?)@([^/@]+)$/);if(i){let l=i[1],m=i[2];return {kind:"github",rawRef:i[3],org:l,repo:m,gitRemoteUrl:`https://github.com/${l}/${m}.git`,pathInRepo:n}}let a=o.match(/^gitlab:(.+)\/([^/@]+)@([^/@]+)$/);if(a){let l=a[1],m=a[2];return {kind:"gitlab",rawRef:a[3],org:l,repo:m,gitRemoteUrl:`https://gitlab.com/${l}/${m}.git`,pathInRepo:n}}let c=resolve(e,o);if(!await j(c))throw new Error(`Path does not exist: ${c}`);return nG(c,e,n)}s(DI,"parseInstallSource");T();ft();gn();T();wd();var sG=z$1.object({name:z$1.string().min(1),source:z$1.string().min(1),version:z$1.string().optional(),source_kind:z$1.enum(["github","gitlab","git","local"]),features:z$1.array(va).min(1),pick:hl.optional(),target:ze.optional(),path:z$1.string().optional(),paths:z$1.array(z$1.string().min(1)).min(1).optional(),as:Qc.optional()}),v1=z$1.object({version:z$1.literal(1),installs:z$1.array(sG).default([])});function G1(t,e){return t.length===e.length&&[...t].sort().every((r,o)=>r===[...e].sort()[o])}s(G1,"sameFeatures");function M1(t,e){return t.source===e.source&&t.target===e.target&&t.as===e.as&&G1(t.features,e.features)}s(M1,"sameInstallIdentity");function iG(t){return join(t,"installs.yaml")}s(iG,"manifestPath");async function NI(t){let e=await y(iG(t));if(e===null)return [];try{return v1.parse(parse(e)).installs.map(r=>ci(r))}catch{return []}}s(NI,"readInstallManifest");async function aG(t,e){let r=ci(e),n=(await NI(t)).filter(i=>i.name!==r.name&&!M1(i,r));n.push(r),await _(iG(t),stringify({version:1,installs:n.sort((i,a)=>i.name.localeCompare(a.name))}));}s(aG,"upsertInstallManifestEntry");function cG(t){return ci(sG.parse({name:t.name,source:t.source,version:t.version,source_kind:t.sourceKind,features:t.features,pick:t.pick,target:t.target,path:t.path,paths:t.paths,as:t.as}))}s(cG,"buildInstallManifestEntry");async function j1(t){let e=await NI(t.canonicalDir);if(e.length===0){I.info("No recorded installs found in .agentsmesh/installs.yaml.");return}let r=[];for(let o of e){let n=join(t.canonicalDir,"packs",o.name);await j(n)||r.push(o);}if(r.length===0){I.info("All recorded packs are already installed.");return}for(let o of r)await t.reinstall(o);I.success(`Reinstalled ${r.length} pack(s) from .agentsmesh/installs.yaml.`);}s(j1,"syncInstalledPacks");async function lG(t){return t.sync?(await j1({canonicalDir:t.canonicalDir,reinstall:t.reinstall}),true):false}s(lG,"maybeRunInstallSync");wd();function mG(t){return {sync:t.sync===true,dryRun:t["dry-run"]===true,force:t.force===true,useExtends:t.extends===true,explicitPath:typeof t.path=="string"?t.path:void 0,explicitTarget:typeof t.target=="string"?t.target.trim():void 0,explicitAs:typeof t.as=="string"?Qc.parse(t.as.trim()):void 0,nameOverride:typeof t.name=="string"?t.name.trim():""}}s(mG,"readInstallFlags");M_();function La(t){let e=[];return t.skills.length&&e.push("skills"),t.rules.length&&e.push("rules"),t.commands.length&&e.push("commands"),t.agents.length&&e.push("agents"),t.mcp!==null&&e.push("mcp"),t.permissions!==null&&e.push("permissions"),t.hooks!==null&&e.push("hooks"),t.ignore.length&&e.push("ignore"),e}s(La,"featuresFromCanonical");async function Zd(t){let{sliceRoot:e,implicitPick:r}=await Ld(t),o=await Ad(e);return {canonical:o,features:La(o),implicitPick:r}}s(Zd,"discoverFromContentRoot");function pG(t){return t.description.trim()?{skill:t,ok:true}:{skill:t,ok:false,reason:"missing description in frontmatter"}}s(pG,"validateSkill");function uG(t){return t.description.trim()?{rule:t,ok:true}:{rule:t,ok:false,reason:"missing description in frontmatter"}}s(uG,"validateRule");function dG(t){return t.description.trim()?{command:t,ok:true}:{command:t,ok:false,reason:"missing description in frontmatter"}}s(dG,"validateCommand");function gG(t){return t.description.trim()?{agent:t,ok:true}:{agent:t,ok:false,reason:"missing description in frontmatter"}}s(gG,"validateAgent");function Ce(t){return basename(t.source).replace(/\.md$/i,"")}s(Ce,"ruleSlug");function K1(t){if(!t)return;let e=[];return t.skills!==void 0&&e.push("skills"),t.rules!==void 0&&e.push("rules"),t.commands!==void 0&&e.push("commands"),t.agents!==void 0&&e.push("agents"),e.length>0?e:void 0}s(K1,"featuresFromImplicitPick");function sl(t,e){let{implicitPick:r}=e,o=e.scopedFeatures??K1(r);if(!r&&!o)return t;let n=new Set(o??[]),i={...t,mcp:!o||n.has("mcp")?t.mcp:null,permissions:!o||n.has("permissions")?t.permissions:null,hooks:!o||n.has("hooks")?t.hooks:null,ignore:!o||n.has("ignore")?t.ignore:[]};if(r?.skills!==void 0){let a=new Set(r.skills);i={...i,skills:r.skills.length===0?[]:i.skills.filter(c=>a.has(c.name))};}else o&&!n.has("skills")&&(i={...i,skills:[]});if(r?.rules!==void 0){let a=new Set(r.rules);i={...i,rules:r.rules.length===0?[]:i.rules.filter(c=>a.has(Ce(c)))};}else o&&!n.has("rules")&&(i={...i,rules:[]});if(r?.commands!==void 0){let a=new Set(r.commands);i={...i,commands:r.commands.length===0?[]:i.commands.filter(c=>a.has(c.name))};}else o&&!n.has("commands")&&(i={...i,commands:[]});if(r?.agents!==void 0){let a=new Set(r.agents);i={...i,agents:r.agents.length===0?[]:i.agents.filter(c=>a.has(c.name))};}else o&&!n.has("agents")&&(i={...i,agents:[]});return i}s(sl,"narrowDiscoveredForInstallScope");T();Od();T();M();var H1=new Set(["README.md","README.rst","README.txt","README","LICENSE","LICENSE.md","LICENSE.txt","LICENSE-MIT","LICENSE-APACHE","CONTRIBUTING.md","CHANGELOG.md","CODE_OF_CONDUCT.md","package.json","package-lock.json","pnpm-lock.yaml","yarn.lock",".gitignore",".gitattributes",".editorconfig",".DS_Store"]),z1=new Set([".git",".github",".gitlab","node_modules",".vscode",".idea"]);async function Qd(t){let e=await y(t);if(!e)return "";let{frontmatter:r}=k(e);return typeof r.name!="string"?"":r.name.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}s(Qd,"readSkillFrontmatterName");async function fG(t,e){await cp$1(t,e,{recursive:true,filter:s(r=>{let o=relative(t,r).replace(/\\/g,"/");if(o==="")return true;let n=o.split("/")[0];return !(z1.has(n)||!o.includes("/")&&H1.has(o))},"filter")});}s(fG,"cpFilteredSkill");async function Z1(){let t=await mkdtemp(join(tmpdir(),"am-install-manual-")),e=join(t,"repo");return await L(join(e,".agentsmesh")),{discoveryRoot:e,cleanup:s(async()=>{await rm$1(t,{recursive:true,force:true});},"cleanup")}}s(Z1,"createStageRoot");async function Q1(t,e){if((await stat(t)).isFile()){if(!t.toLowerCase().endsWith(".md"))throw new Error(`Manual install only supports .md files for this collection: ${t}`);await L(e),await cp$1(t,join(e,basename(t)));return}let o=(await v(t)).filter(i=>i.toLowerCase().endsWith(".md"));if(o.length===0)throw new Error(`No .md files found under ${t} for manual install.`);let n=new Map;await L(e);for(let i of o){let a=basename(i),c=n.get(a);if(c)throw new Error(`Manual install found duplicate file name "${a}" under ${t} (${c} and ${i}).`);n.set(a,i),await cp$1(i,join(e,a));}}s(Q1,"stageMarkdownCollection");async function hG(t,e,r){if(r.length===0)return false;let o=new Set(r),n=new Map;for(let i of await v(t)){if(!i.endsWith("/SKILL.md")&&!i.endsWith("\\SKILL.md"))continue;let a=dirname(i),c=basename(a);if(!o.has(c))continue;let l=n.get(c);if(l&&l!==a)throw new Error(`Manual skill replay found duplicate skill "${c}" under ${t} (${l} and ${a}).`);n.set(c,a);}if(n.size!==r.length)return false;await L(e);for(let i of r)await cp$1(n.get(i),join(e,i),{recursive:true});return true}s(hG,"stagePreferredSkills");async function q1(t,e,r={}){if((await stat(t)).isFile()){if(basename(t)!=="SKILL.md")throw new Error(`Manual skill install expects SKILL.md or a skill directory: ${t}`);let n=basename(dirname(t)),i=join(e,n);await L(i),await cp$1(dirname(t),i,{recursive:true});return}if(await Ea(t)){if((await stat(join(t,"SKILL.md")).catch(()=>null))?.isFile()){if(await hG(t,e,r.preferredSkillNames??[]))return;let c=await Qd(join(t,"SKILL.md"))||basename(t),l=join(e,c);await L(e),await fG(t,l);return}if(await hG(t,e,r.preferredSkillNames??[]))return;await L(e);let n=await v(t),i=new Set;for(let a of n.filter(c=>c.endsWith("/SKILL.md")||c.endsWith("\\SKILL.md")))i.add(relative(t,dirname(a)).split(/[\\/]/)[0]);for(let a of i)await cp$1(join(t,a),join(e,a),{recursive:true});return}throw new Error(`Manual skill install expects a skill directory or skills collection at ${t}.`)}s(q1,"stageSkills");async function yG(t,e,r={}){let o=await Z1();try{let n=join(o.discoveryRoot,".agentsmesh",e);return e==="skills"?await q1(t,n,r):await Q1(t,n),o}catch(n){throw await o.cleanup(),n}}s(yG,"stageManualInstallScope");async function _G(t,e,r,o){let n=await yG(t,e,{preferredSkillNames:e==="skills"?o?.skills:void 0}),{canonical:i}=await Zd(n.discoveryRoot),a=sl(i,{scopedFeatures:[e]});return {prep:{yamlTarget:r,scopedFeatures:[e],cleanup:n.cleanup},narrowed:a,discoveredFeatures:La(a)}}s(_G,"resolveManualDiscoveredForInstall");gn();jg();T();var tY=[{prefix:".gemini/commands",target:"gemini-cli"},{prefix:".github/instructions",target:"copilot"},{prefix:".github/copilot-instructions.md",target:"copilot"},{prefix:".github/copilot",target:"copilot"},{prefix:".github/prompts",target:"copilot"},{prefix:".github/skills",target:"copilot"},{prefix:".github/agents",target:"copilot"},{prefix:".github/hooks",target:"copilot"},{prefix:".claude/commands",target:"claude-code"},{prefix:".claude/rules",target:"claude-code"},{prefix:".claude/skills",target:"claude-code"},{prefix:".claude/agents",target:"claude-code"},{prefix:".cursor/commands",target:"cursor"},{prefix:".cursor/rules",target:"cursor"},{prefix:".cursor/agents",target:"cursor"},{prefix:".cursor/skills",target:"cursor"},{prefix:".continue/prompts",target:"continue"},{prefix:".continue/rules",target:"continue"},{prefix:".continue/skills",target:"continue"},{prefix:".junie/commands",target:"junie"},{prefix:".junie/rules",target:"junie"},{prefix:".junie/agents",target:"junie"},{prefix:".junie/skills",target:"junie"},{prefix:".kiro/steering",target:"kiro"},{prefix:".kiro/skills",target:"kiro"},{prefix:".kilo/commands",target:"kilo-code"},{prefix:".kilo/rules",target:"kilo-code"},{prefix:".kilo/skills",target:"kilo-code"},{prefix:".kilo/agents",target:"kilo-code"},{prefix:".kilocode/workflows",target:"kilo-code"},{prefix:".kilocode/rules",target:"kilo-code"},{prefix:".kilocode/skills",target:"kilo-code"},{prefix:".kilocodemodes",target:"kilo-code"},{prefix:".kilocodeignore",target:"kilo-code"},{prefix:".cline/skills",target:"cline"},{prefix:".clinerules/workflows",target:"cline"},{prefix:".windsurf/rules",target:"windsurf"},{prefix:".codex",target:"codex-cli"}];function eY(t){return t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}s(eY,"norm");function tg(t){let e=eY(t),r=[...tY].sort((o,n)=>n.prefix.length-o.prefix.length);for(let{prefix:o,target:n}of r)if(e===o||e.startsWith(`${o}/`))return n}s(tg,"targetHintFromNativePath");function vI(t,e){return tg(t)===e}s(vI,"pathSupportsNativePick");function IG(t,e){if(!t||!e)return;let r=tg(e);if(r&&r!==t)throw new Error(`--target "${t}" does not match the install path (native path suggests "${r}"). Omit --target to auto-detect, or point at a subtree for that target.`)}s(IG,"validateTargetMatchesPath");function RG(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)>0}s(RG,"extendPickHasArrays");T();T();Wt();async function CG(t,e){let r=join(t,...Me.split("/")),o=join(t,...e.split("/")),n=await v(o),i=[];for(let a of n){if(!/\.(toml|md)$/i.test(a))continue;let c=relative(r,a).replace(/\\/g,"/");if(c.startsWith("..")||c==="")continue;let m=c.replace(/\.(toml|md)$/i,"").split("/").filter(Boolean).join(":");m&&i.push(m);}return [...new Set(i)].sort()}s(CG,"inferGeminiCommandNamesFromFiles");Wt();nr();T();async function Aa(t){let e=await v(t),r=new Set;for(let o of e){if(basename(o)==="SKILL.md"){r.add(basename(dirname(o)));continue}!relative(t,o).replace(/\\/g,"/").includes("/")&&o.toLowerCase().endsWith(".md")&&r.add(basename(o,".md"));}return [...r].filter(Boolean).sort()}s(Aa,"skillNamesFromNativeSkillDir");T();Sr();async function EG(t,e){let r=join(t,...e.split("/"));if(e.startsWith(Qs)){let o=await v(r),n=[...new Set(o.filter(i=>i.toLowerCase().endsWith(".prompt.md")).map(i=>basename(i,".prompt.md")))].sort();return n.length?{commands:n}:{}}if(e.startsWith(".github/copilot")&&!e.includes("copilot-instructions.md")){let o=await v(r),n=[...new Set(o.filter(i=>i.includes(".instructions.md")).map(i=>basename(i).replace(/\.instructions\.md$/i,"")))].sort();return n.length?{rules:n}:{}}if(e.startsWith(".github/instructions")){let o=await v(r),n=new Set;for(let a of o){let c=basename(a);c.toLowerCase().endsWith(".instructions.md")?n.add(c.replace(/\.instructions\.md$/i,"")):c.toLowerCase().endsWith(".md")&&n.add(basename(a,".md"));}let i=[...n].sort();return i.length?{rules:i}:{}}if(e.startsWith(".github/skills")){let o=await Aa(r);return o.length?{skills:o}:{}}if(e.startsWith(".github/agents")){let o=await v(r),n=[...new Set(o.filter(i=>i.toLowerCase().endsWith(".agent.md")).map(i=>basename(i,".agent.md")))].sort();return n.length?{agents:n}:{}}return {}}s(EG,"inferCopilotPickFromPath");async function Ke(t,e){let r=await v(t),o=e.toLowerCase();return [...new Set(r.filter(n=>n.toLowerCase().endsWith(o)).map(n=>basename(n,e)))].sort()}s(Ke,"mdNames");async function LG(t,e,r){let o=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),n=join(t,...o.split("/"));if(r==="gemini-cli"){if(o===Me||o.startsWith(`${Me}/`)){let i=await CG(t,o);return i.length?{commands:i}:{}}return {}}if(r==="claude-code"){if(o.startsWith(".claude/commands")){let i=await Ke(n,".md");return i.length?{commands:i}:{}}if(o.startsWith(".claude/rules")){let i=await Ke(n,".md");return i.length?{rules:i}:{}}if(o.startsWith(".claude/agents")){let i=await Ke(n,".md");return i.length?{agents:i}:{}}if(o.startsWith(".claude/skills/")){let a=o.replace(/^\.claude\/skills\/?/,"").split("/").filter(Boolean)[0];return a?{skills:[a]}:{}}return {}}if(r==="cursor"){if(o.startsWith(".cursor/rules")){let i=await Ke(n,".mdc");return i.length?{rules:i}:{}}if(o.startsWith(".cursor/commands")){let i=await Ke(n,".md");return i.length?{commands:i}:{}}if(o.startsWith(".cursor/agents")){let i=await Ke(n,".md");return i.length?{agents:i}:{}}if(o.startsWith(".cursor/skills")){let i=await Aa(n);return i.length?{skills:i}:{}}return {}}if(r==="copilot")return EG(t,o);if(r==="windsurf"&&o.startsWith(".windsurf/rules")){let i=await Ke(n,".md");return i.length?{rules:i}:{}}if(r==="cline"){if(o.startsWith(Jt)){let i=await Aa(n);return i.length?{skills:i}:{}}if(o.startsWith(Lo)){let i=await Ke(n,".md");return i.length?{commands:i}:{}}return {}}if(r==="continue"){if(o.startsWith(".continue/rules")){let i=await Ke(n,".md");return i.length?{rules:i}:{}}if(o.startsWith(".continue/prompts")){let i=await Ke(n,".md");return i.length?{commands:i}:{}}if(o.startsWith(".continue/skills")){let i=await Aa(n);return i.length?{skills:i}:{}}return {}}if(r==="junie"){if(o.startsWith(".junie/commands")){let i=await Ke(n,".md");return i.length?{commands:i}:{}}if(o.startsWith(".junie/rules")){let i=await Ke(n,".md");return i.length?{rules:i}:{}}if(o.startsWith(".junie/agents")){let i=await Ke(n,".md");return i.length?{agents:i}:{}}if(o.startsWith(".junie/skills")){let i=await Aa(n);return i.length?{skills:i}:{}}return {}}if(r==="codex-cli"&&o.startsWith(".codex")){let i=await v(n),a=[...new Set(i.filter(c=>c.toLowerCase().endsWith(".md")).map(c=>basename(c,".md")))].sort();return a.length?{rules:a}:{}}return {}}s(LG,"inferImplicitPickFromNativePath");function AG(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)===0}s(AG,"isImplicitPickEmpty");F_();function Bm(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(Bm,"normalizePath");function pY(t,e){let r=Bm(t),o=Bm(e);return r===o||r.startsWith(`${o}/`)||o.startsWith(`${r}/`)}s(pY,"overlapsPath");function eg(t,e){let r=t??[];return r.includes(e)||r.push(e),r}s(eg,"addUnique");async function uY(t){let e=await mkdtemp(join(tmpdir(),"am-install-native-")),r=join(e,"repo"),o=s(async()=>{await rm$1(e,{recursive:true,force:true});},"cleanup");try{return await cp$1(t,r,{recursive:!0}),{stageRoot:r,cleanup:o}}catch(n){throw await o(),n}}s(uY,"makeStageRoot");function dY(t,e){let r;for(let n of t){if(n.feature==="rules"&&n.toPath.startsWith(".agentsmesh/rules/")){r={...r,rules:eg(r?.rules,basename(n.toPath,".md"))};continue}if(n.feature==="commands"&&n.toPath.startsWith(".agentsmesh/commands/")){let i=Bm(relative(join(e,".agentsmesh","commands"),join(e,n.toPath)));r={...r,commands:eg(r?.commands,i.replace(/\.md$/i,"").split("/").filter(Boolean).join(":"))};continue}if(n.feature==="agents"&&n.toPath.startsWith(".agentsmesh/agents/")){r={...r,agents:eg(r?.agents,basename(n.toPath,".md"))};continue}if(n.feature==="skills"&&n.toPath.startsWith(".agentsmesh/skills/")){let a=Bm(relative(join(e,".agentsmesh","skills"),join(e,n.toPath))).split("/")[0];a&&(r={...r,skills:eg(r?.skills,a)});}}return r&&(r.rules?.length??0)+(r.commands?.length??0)+(r.agents?.length??0)+(r.skills?.length??0)>0?r:void 0}s(dY,"buildPickFromResults");function gY(t,e,r,o){let n=join(e,...Bm(t).split("/")),i=r.filter(a=>pY(n,a.fromPath));if(i.length===0)throw new Error(`No installable native resources found under "${t}" for target "${o}".`);return {features:[...new Set(i.map(a=>a.feature))],pick:dY(i,e)}}s(gY,"scopeImportedResults");async function MI(t,e){let{stageRoot:r,cleanup:o}=await uY(t);try{let n=await wm(r,e);return {stageRoot:r,results:n,cleanup:o}}catch(n){throw await o(),n}}s(MI,"stageImportedNativeRepo");async function $I(t,e,r){let o=await MI(t,r);try{return {stageRoot:o.stageRoot,cleanup:o.cleanup,...gY(e,o.stageRoot,o.results,r)}}catch(n){throw await o.cleanup(),n}}s($I,"stageNativeInstallScope");async function bG(t,e,r,o){let n=o.explicitTarget?.trim();n&&ze.parse(n);let i=r.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");IG(n,i);let a=join(t,".agentsmesh"),c=await j(a),l=i?tg(i):void 0,m=!c&&!n?await fp(t)??void 0:void 0;if(!n&&l&&m&&l!==m)throw new Error(`Install path suggests native layout "${l}" but auto-detect imported "${m}". Use --target ${l} for this path, or install from the repo root without a conflicting subtree path.`);let p=n??l??m,u=!!i&&!!p&&!i.startsWith(".agentsmesh");if(!c&&p){if(u){let A=await $I(t,i,p);return {discoveryRoot:A.stageRoot,implicitPick:A.pick,scopedFeatures:A.features,yamlTarget:p,importHappened:true,cleanup:A.cleanup}}let S=await MI(t,p);return {discoveryRoot:i?join(S.stageRoot,i):S.stageRoot,yamlTarget:p,importHappened:true,cleanup:S.cleanup}}let g;c?i?p&&vI(i,p)?g=t:g=e:g=t:g=e;let f,h,O;if(u&&p){let S=await $I(t,i,p);g=S.stageRoot,f=S.pick,h=S.features,O=S.cleanup;}else if(g===t&&i&&p&&vI(i,p)&&(f=await LG(t,i,p),AG(f)))throw new Error(`No installable native resources found under "${i}" for target "${p}".`);let R;return n?R=n:p&&(f&&RG(f)||(h?.length??0)>0)&&(R=p),{discoveryRoot:g,implicitPick:f,scopedFeatures:h,yamlTarget:R,importHappened:O!==void 0,cleanup:O}}s(bG,"prepareInstallDiscovery");async function PG(t,e,r,o){let n=await bG(t,e,r,{explicitTarget:o}),{canonical:i,implicitPick:a}=await Zd(n.discoveryRoot),c=a??n.implicitPick,l=sl(i,{implicitPick:c,scopedFeatures:n.scopedFeatures}),m=La(l);return {prep:n,discovered:i,implicitPick:c,narrowed:l,discoveredFeatures:m}}s(PG,"resolveDiscoveredForInstall");async function xG(t){return t.explicitAs?{implicitPick:void 0,...await _G(t.contentRoot,t.explicitAs,t.explicitTarget,t.replayPick)}:PG(t.resolvedPath,t.contentRoot,t.pathInRepo,t.explicitTarget)}s(xG,"resolveInstallDiscovery");function al(t){return t==="."||t===""?void 0:t}s(al,"trimDot");function hY(t,e){let r=basename(e).replace(/\.md$/i,"");return t==="agents"?{agents:[r]}:t==="commands"?{commands:[r]}:{rules:[r]}}s(hY,"markdownPick");async function NG(t){if(!t.as)return {pathInRepo:al(t.pathInRepo)};let e=t.pathInRepo.replace(/^\/+|\/+$/g,""),r=await stat(t.contentRoot);if(t.as!=="skills"&&r.isFile()&&t.contentRoot.toLowerCase().endsWith(".md"))return {pathInRepo:al(dirname(e)),pick:hY(t.as,e||t.contentRoot)};if(t.as==="skills"){if(r.isFile()&&basename(t.contentRoot)==="SKILL.md"){let o=e?dirname(e):dirname(t.contentRoot);return {pathInRepo:al(dirname(o)),pick:{skills:[basename(o)]}}}if(r.isDirectory()){let o=e||basename(t.contentRoot),n=join(t.contentRoot.replace(/\/+$/g,""),"SKILL.md");try{if((await stat(n)).isFile()){let a=await Qd(n);return {pathInRepo:al(dirname(o)),pick:{skills:[a||basename(o)]}}}}catch{return {pathInRepo:al(e)}}}}return {pathInRepo:al(e)}}s(NG,"resolveManualInstallPersistence");ln();ft();async function mn(t){return process.stdin.isTTY?new Promise(e=>{let r=FG.createInterface({input:process.stdin,output:process.stdout});r.question(`${t} (y/n) `,o=>{r.close();let n=o.trim().toLowerCase();e(n==="y"||n==="yes");});}):false}s(mn,"confirm");function yY(t){return !!(t.skills.length||t.rules.length||t.commands.length||t.agents.length)}s(yY,"hasArrayResources");function vG(t){return yY(t)||t.mcp!==null||t.permissions!==null||t.hooks!==null||t.ignore.length>0}s(vG,"hasInstallableResources");async function GG(t,e,r,o){let n=t.skills.map(c=>pG(c)),i=n.filter(c=>c.ok).map(c=>c.skill),a=n.filter(c=>!c.ok);if(!e&&!r&&o)for(let c of a)await mn(`Include invalid skill "${c.skill.name}" anyway? (${c.reason}). You can fix it later.`)&&i.push(c.skill);else e&&(i=n.map(c=>c.skill));return r&&(i=n.filter(c=>c.ok).map(c=>c.skill)),i}s(GG,"resolveSkillPool");async function MG(t,e,r,o){let n=t.rules.map(c=>uG(c)),i=n.filter(c=>c.ok).map(c=>c.rule),a=n.filter(c=>!c.ok);if(!e&&!r&&o)for(let c of a)await mn(`Include invalid rule "${Ce(c.rule)}" anyway? (${c.reason}). You can fix it later.`)&&i.push(c.rule);else e&&(i=n.map(c=>c.rule));return r&&(i=n.filter(c=>c.ok).map(c=>c.rule)),i}s(MG,"resolveRulePool");async function $G(t,e,r,o){let n=t.commands.map(c=>dG(c)),i=n.filter(c=>c.ok).map(c=>c.command),a=n.filter(c=>!c.ok);if(!e&&!r&&o)for(let c of a)await mn(`Include invalid command "${c.command.name}" anyway? (${c.reason}). You can fix it later.`)&&i.push(c.command);else e&&(i=n.map(c=>c.command));return r&&(i=n.filter(c=>c.ok).map(c=>c.command)),i}s($G,"resolveCommandPool");async function jG(t,e,r,o){let n=t.agents.map(c=>gG(c)),i=n.filter(c=>c.ok).map(c=>c.agent),a=n.filter(c=>!c.ok);if(!e&&!r&&o)for(let c of a)await mn(`Include invalid agent "${c.agent.name}" anyway? (${c.reason}). You can fix it later.`)&&i.push(c.agent);else e&&(i=n.map(c=>c.agent));return r&&(i=n.filter(c=>c.ok).map(c=>c.agent)),i}s(jG,"resolveAgentPool");async function UG(t,e){let r=e.skills.map(a=>a.name),o=e.rules.map(a=>Ce(a)),n=e.commands.map(a=>a.name),i=e.agents.map(a=>a.name);for(let a of e.skills)t.skills.some(c=>c.name===a.name)&&(await mn(`Skill "${a.name}" already exists in merged config. Add extend anyway?`)||(r=r.filter(l=>l!==a.name)));for(let a of e.rules){let c=Ce(a);t.rules.some(l=>Ce(l)===c)&&(await mn(`Rule "${c}" already exists in merged config. Add extend anyway?`)||(o=o.filter(m=>m!==c)));}for(let a of e.commands)t.commands.some(c=>c.name===a.name)&&(await mn(`Command "${a.name}" already exists in merged config. Add extend anyway?`)||(n=n.filter(l=>l!==a.name)));for(let a of e.agents)t.agents.some(c=>c.name===a.name)&&(await mn(`Agent "${a.name}" already exists in merged config. Add extend anyway?`)||(i=i.filter(l=>l!==a.name)));return {skillNames:r,ruleSlugs:o,commandNames:n,agentNames:i}}s(UG,"resolveInstallConflicts");function KG(t,e){if(!t)return;let r={},o=t.skills?.filter(c=>e.skillNames.includes(c)),n=t.rules?.filter(c=>e.ruleSlugs.includes(c)),i=t.commands?.filter(c=>e.commandNames.includes(c)),a=t.agents?.filter(c=>e.agentNames.includes(c));return o&&o.length>0&&(r.skills=o),n&&n.length>0&&(r.rules=n),i&&i.length>0&&(r.commands=i),a&&a.length>0&&(r.agents=a),Object.keys(r).length>0?r:void 0}s(KG,"pickForSelectedResources");function _Y(t,e){let r=t.split("/").filter(Boolean);return r.length>0&&r[r.length-1]===e}s(_Y,"pathEndsWithName");function rg(t,e,r){return r!==1||e.length!==1?false:_Y(t,e[0])}s(rg,"inferSingleNamePick");function BG(t){let{pathInRepo:e,implicitPick:r,preConflictCounts:o,selected:n}=t,i={},a=n.skillNames.length>0&&(!!r?.skills?.length||n.skillNames.length<o.skills||rg(e,n.skillNames,o.skills)),c=n.ruleSlugs.length>0&&(!!r?.rules?.length||n.ruleSlugs.length<o.rules||rg(e,n.ruleSlugs,o.rules)),l=n.commandNames.length>0&&(!!r?.commands?.length||n.commandNames.length<o.commands||rg(e,n.commandNames,o.commands)),m=n.agentNames.length>0&&(!!r?.agents?.length||n.agentNames.length<o.agents||rg(e,n.agentNames,o.agents));return a&&(i.skills=[...n.skillNames]),c&&(i.rules=[...n.ruleSlugs]),l&&(i.commands=[...n.commandNames]),m&&(i.agents=[...n.agentNames]),Object.keys(i).length?i:void 0}s(BG,"buildInstallPick");function WG(t,e){let r=new Set(t);return e.skillNames.length===0&&r.delete("skills"),e.ruleSlugs.length===0&&r.delete("rules"),e.commandNames.length===0&&r.delete("commands"),e.agentNames.length===0&&r.delete("agents"),[...r]}s(WG,"deriveInstallFeatures");function IY(t){return t.skillNames.length===0&&t.ruleSlugs.length===0&&t.commandNames.length===0&&t.agentNames.length===0}s(IY,"isEmptyInstallSelection");function HG(t){let{selected:e,discoveredFeatures:r,preConflict:o}=t,n=s(c=>r.includes(c),"had"),i=n("skills")&&e.skillNames.length===0&&o.skills>0&&"skills"||n("rules")&&e.ruleSlugs.length===0&&o.rules>0&&"rules"||n("commands")&&e.commandNames.length===0&&o.commands>0&&"commands"||n("agents")&&e.agentNames.length===0&&o.agents>0&&"agents";if(i)throw new Error(`No ${i} selected to install.`);let a=r.some(c=>["mcp","permissions","hooks","ignore"].includes(c));if(IY(e)&&!a)throw new Error("No resources selected to install.")}s(HG,"ensureInstallSelection");gn();function zG(t,e){if(t.find(o=>o.name===e.name&&o.source!==e.source))throw new Error(`Extends entry "${e.name}" already exists with a different source. Use --name to provide a different name.`)}s(zG,"assertExtendNameAvailable");function RY(t,e,r){if(r===void 0){if(!t)return;let n={...t};for(let i of ["skills","commands","rules","agents"])e.includes(i)&&delete n[i];return Object.keys(n).length?n:void 0}let o={...t};for(let n of ["skills","commands","rules","agents"]){if(!(n in r))continue;let i=r[n];if(i===void 0||i.length===0){delete o[n];continue}o[n]=[...new Set([...t?.[n]??[],...i])];}return Object.keys(o).length?o:void 0}s(RY,"mergePick");function VG(t,e){let r=t.findIndex(a=>a.source===e.source);if(r<0)return [...t,{name:e.name,source:e.source,version:e.version,features:e.features,path:e.path,pick:e.pick,target:e.target}];let o=t[r],n=[...new Set([...o.features,...e.features])],i=RY(o.pick,e.features,e.pick);return t.map((a,c)=>c===r?{name:e.name,source:e.source,version:e.version??o.version,features:n,path:e.path!==void 0?e.path:o.path,pick:i,target:e.target??o.target}:a)}s(VG,"mergeExtendList");T();async function JG(t,e,r){let o=await y(t);if(o===null)throw new Error(`Missing config: ${t}`);let n=parse(o),i=VG(e.extends,r);n.extends=i;let a=stringify(n,{indent:2,lineWidth:0});await _(t,a.endsWith(`
329
+ `),true}s(Q2,"appendToGitignore");async function S$(t,e={}){let r=e.global===true?"global":"project",n=Ei(t,r),o=join(n.configDir,mI);if(await $(o))throw new Error(`Already initialized. ${mI} exists. Remove it first to re-init.`);let i=await h$(n.rootBase,r),a=r==="global"?i.filter(g=>I$.includes(g)):i,l=r==="global"?I$:void 0,c=[],m,p=0;if(a.length>0)if(e.yes){for(let g of a){let h=X2[g];if(!h)continue;let R=await h(n.rootBase,r);for(let C of R)c.push({from:relative(n.rootBase,C.fromPath).replaceAll("\\","/"),to:C.toPath.replaceAll("\\","/")});}p=a.length,await _$(n.canonicalDir),m="gap-fill",await I(o,Sf(a,l));}else await cI(n.canonicalDir),m="full",await I(o,Sf([],l));else await cI(n.canonicalDir),m="full",await I(o,Sf([],l));let u=join(n.configDir,R$);await I(u,d$);let f=false;return r==="project"&&(f=await Q2(t)),{exitCode:0,data:{scope:r,configFile:mI,localConfigFile:R$,detectedConfigs:a,imported:c,importedToolCount:p,scaffoldType:m,gitignoreUpdated:f}}}s(S$,"runInit");ot();function C$(t){let{data:e}=t;if(e.detectedConfigs.length>0&&y.info(`Found existing configurations: ${e.detectedConfigs.join(", ")}`),e.detectedConfigs.length>0&&e.imported.length===0&&y.info("Run 'agentsmesh init --yes' to auto-import, or 'agentsmesh import --from <tool>' manually."),e.imported.length>0){y.info("Auto-importing existing configurations (--yes)...");for(let n of e.imported)y.success(` ${n.from} \u2192 ${n.to}`);y.info(`Imported ${e.imported.length} file(s) from ${e.importedToolCount} tool(s).`);}let r=e.imported.length>0&&e.detectedConfigs.length>0?` (targets: ${e.detectedConfigs.join(", ")})`:"";y.success(`Created ${e.configFile}${r}`),y.success(`Created ${e.localConfigFile}`),e.gitignoreUpdated&&y.success("Updated .gitignore");}s(C$,"renderInit");Yt();Pt();var q2=Object.fromEntries(bt.map(t=>[t.id,{importFrom:t.generators.importFrom,emptyImportMessage:t.emptyImportMessage,lintRules:t.lintRules,lint:t.lint,capabilities:t.capabilities}]));function kf(t){return q2[t]}s(kf,"getTargetCatalogEntry");se();fn();zc();var sZ={type:"stdio",command:"npx",args:["-y","agentsmesh","mcp"]};function iZ(t){return t.mcpServers.agentsmesh!==void 0?false:(t.mcpServers.agentsmesh=sZ,true)}s(iZ,"injectAgentsmeshEntry");async function uI(t){let e=resolve(t,".agentsmesh/mcp.json");try{let r;try{r=await vr(e)??{mcpServers:{}};}catch{r={mcpServers:{}};}if(!iZ(r))return !1;let n=JSON.stringify(r,null,2)+`
330
+ `;await mkdir(dirname(e),{recursive:!0});let o=`${e}.tmp.${process.pid}.${Date.now()}`;return await writeFile(o,n,"utf8"),await rename(o,e),!0}catch(r){return process.stderr.write(`[agentsmesh] warning: could not seed agentsmesh MCP server entry into mcp.json: ${r instanceof Error?r.message:String(r)}
331
+ `),false}}s(uI,"seedAgentsmeshMcpEntry");function k$(t,e){return t.map(r=>({from:relative(e,r.fromPath).replaceAll("\\","/"),to:r.toPath}))}s(k$,"mapResults");async function E$(t,e){let r=e??process.cwd(),n=t.from;if(typeof n!="string"||!n)throw new Error("--from is required. Example: agentsmesh import --from claude-code");let o=n.toLowerCase().trim(),i=t.global===true?"global":"project";if(Pe(o)){let p=Ei(r,i),f=await kf(o).importFrom(p.rootBase,{scope:i});return f.length>0&&await uI(p.rootBase),{exitCode:0,data:{scope:i,target:o,files:k$(f,p.rootBase)}}}let a,l;try{({config:a,context:l}=await yt(r,i));}catch{throw new Error(`Unknown --from "${n}" and no agentsmesh.yaml found. Run 'agentsmesh init' to enable plugin targets, or use a builtin: ${Ft.join(", ")}.`)}await Wt(a,r);let c=et(o);if(!c)throw new Error(`Unknown --from "${n}". Supported: ${[...Ft,...a.pluginTargets??[]].join(", ")}.`);let m=await c.generators.importFrom(l.rootBase,{scope:i});return m.length>0&&await uI(l.rootBase),{exitCode:0,data:{scope:i,target:o,files:k$(m,l.rootBase)}}}s(E$,"runImport");Yt();fo();function Ef(t){let e=[],r={new:0,updated:0,unchanged:0,deleted:0};for(let n of t){if(n.status==="unchanged"){r.unchanged++;continue}if(n.status==="created"){r.new++;let o=createTwoFilesPatch(`${n.path} (current)`,`${n.path} (generated)`,"",n.content,void 0,void 0,{context:3});e.push({path:n.path,patch:o});continue}if(n.status==="updated"&&n.currentContent!==void 0){r.updated++;let o=createTwoFilesPatch(`${n.path} (current)`,`${n.path} (generated)`,n.currentContent,n.content,void 0,void 0,{context:3});e.push({path:n.path,patch:o});continue}}return {diffs:e,summary:r}}s(Ef,"computeDiff");function Lf(t){return `${t.new} files would be created, ${t.updated} updated, ${t.unchanged} unchanged, ${t.deleted} deleted`}s(Lf,"formatDiffSummary");fn();async function O$(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,i=typeof o=="string"&&o?o.split(",").map(g=>g.trim()).filter(Boolean):void 0,{config:a,context:l}=await yt(r,n);await Wt(a,r);let{canonical:c}=await ke(a,l.configDir,{},l.canonicalDir),m=await Tr({config:a,canonical:c,projectRoot:l.rootBase,scope:n,targetFilter:i});if(m.length===0)return {exitCode:0,data:{files:[],patches:[],summary:{created:0,updated:0,unchanged:0,deleted:0}}};let{diffs:p,summary:u}=Ef(m);return {exitCode:0,data:{files:m.filter(g=>g.status!=="unchanged"&&g.status!=="skipped").map(g=>({path:g.path,target:g.target,status:g.status})),patches:p.map(g=>({path:g.path,patch:g.patch})),summary:{created:u.new,updated:u.updated,unchanged:u.unchanged,deleted:u.deleted}}}}s(O$,"runDiff");Yt();fo();w();se();wi();Lt();var lZ=[{canonicalKey:"permissions",capabilityKey:"permissions",featureFlag:"permissions",file:".agentsmesh/permissions.yaml",label:"permissions",hasContent:s(t=>{let e=t.permissions;if(!e)return false;let r=e.ask?.length??0;return e.allow.length+e.deny.length+r>0},"hasContent")},{canonicalKey:"hooks",capabilityKey:"hooks",featureFlag:"hooks",file:".agentsmesh/hooks.yaml",label:"hooks",hasContent:s(t=>{let e=t.hooks;return e?Object.values(e).some(r=>Array.isArray(r)&&r.length>0):false},"hasContent")},{canonicalKey:"mcp",capabilityKey:"mcp",featureFlag:"mcp",file:".agentsmesh/mcp.json",label:"MCP servers",hasContent:s(t=>{let e=t.mcp;return e?Object.keys(e.mcpServers).length>0:false},"hasContent")},{canonicalKey:"commands",capabilityKey:"commands",featureFlag:"commands",file:".agentsmesh/commands",label:"commands",hasContent:s(t=>t.commands.length>0,"hasContent")},{canonicalKey:"agents",capabilityKey:"agents",featureFlag:"agents",file:".agentsmesh/agents",label:"agents",hasContent:s(t=>t.agents.length>0,"hasContent")},{canonicalKey:"skills",capabilityKey:"skills",featureFlag:"skills",file:".agentsmesh/skills",label:"skills",hasContent:s(t=>t.skills.length>0,"hasContent")},{canonicalKey:"ignore",capabilityKey:"ignore",featureFlag:"ignore",file:".agentsmesh/ignore",label:"ignore patterns",hasContent:s(t=>t.ignore.length>0,"hasContent")}];function A$(t){let e=new Set(t.enabledFeatures),r=[];for(let n of lZ)!e.has(n.featureFlag)||!n.hasContent(t.canonical)||$r(t.capabilities[n.capabilityKey]).level!=="none"||r.push(x(n.file,t.target,`${t.target} does not support ${n.label}; canonical entries are silently dropped during generation. Disable the feature for this target or remove the canonical content.`));return r}s(A$,"lintSilentFeatureDrops");Lt();var cZ=/^(?:\s*(?:bash|sh|zsh|pwsh|powershell)\s+)?["']?(?<path>(?:\.{1,2}\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?:\s|$)/;function mZ(t){let r=t.match(cZ)?.groups?.path;return typeof r=="string"?r:null}s(mZ,"extractScriptToken");function w$(t){if(t.hasScriptProjection)return [];let e=t.canonical.hooks;if(!e)return [];let r=[];for(let n of Object.values(e))if(Array.isArray(n))for(let o of n){if(typeof o?.command!="string")continue;let i=mZ(o.command);i&&r.push(x(".agentsmesh/hooks.yaml",t.target,`${t.target} hook command references script "${i}"; agentsmesh does not copy hook scripts into ${t.target} output, so the script must already exist relative to the hook execution directory or the generated config will fail.`));}return r}s(w$,"lintHookScriptReferences");Lt();function b$(t){if(t.preservesManualActivation)return [];let e=[];for(let r of t.canonical.rules)r.root||r.trigger==="manual"&&(r.targets.length>0&&!r.targets.includes(t.target)||e.push(x(r.source,t.target,`Rule has trigger: 'manual' (Cursor-style "@-mention only" activation), but ${t.target} loads every rule unconditionally. The rule will become always-on for ${t.target} \u2014 restrict it with \`targets: [cursor]\`, convert it to a skill with manual invocation, or remove it.`)));return e}s(b$,"lintRuleScopeInversion");var pZ=["node_modules",".git","dist","coverage",".agentsmesh"];async function uZ(t){return (await v(t)).filter(n=>{let o=relative(t,n);return !pZ.some(i=>o.includes(`/${i}/`)||o.startsWith(`${i}/`))}).map(n=>relative(t,n))}s(uZ,"getProjectFiles");async function Of(t,e,r,n,o={}){let i=o.scope??"project",a=[...t.targets,...t.pluginTargets??[]],l=n?a.filter(C=>n.includes(C)):a,c=t.features.includes("rules"),m=t.features.includes("commands"),p=t.features.includes("mcp"),u=t.features.includes("permissions"),f=t.features.includes("hooks"),g=[],h=i==="global"?[]:await uZ(r);for(let C of l){let S=et(C),k=Pe(C)?kf(C):S;k?.capabilities&&g.push(...A$({target:C,capabilities:k.capabilities,canonical:e,enabledFeatures:t.features})),f&&g.push(...w$({target:C,canonical:e,hasScriptProjection:S?.postProcessHookOutputs!==void 0})),c&&g.push(...b$({target:C,canonical:e,preservesManualActivation:S?.preservesManualActivation===true})),c&&k?.lintRules&&g.push(...k.lintRules(e,r,h,{scope:i})),S?.generators.lint&&g.push(...S.generators.lint(e));let P={scope:i};m&&k?.lint?.commands&&g.push(...k.lint.commands(e,P)),p&&k?.lint?.mcp&&g.push(...k.lint.mcp(e,P)),u&&k?.lint?.permissions&&g.push(...k.lint.permissions(e,P)),f&&k?.lint?.hooks&&g.push(...k.lint.hooks(e,P));}let R=g.some(C=>C.level==="error");return {diagnostics:g,hasErrors:R}}s(Of,"runLint");fn();async function T$(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,i=typeof o=="string"&&o?o.split(",").map(u=>u.trim()).filter(Boolean):void 0,{config:a,context:l}=await yt(r,n);await Wt(a,r);let{canonical:c}=await ke(a,l.configDir,{},l.canonicalDir),{diagnostics:m,hasErrors:p}=await Of(a,c,l.configDir,i,{scope:n});return {exitCode:p?1:0,data:{diagnostics:m.map(u=>({level:u.level,file:u.file,target:u.target,message:u.message})),summary:{errors:m.filter(u=>u.level==="error").length,warnings:m.filter(u=>u.level==="warning").length}}}}s(T$,"runLintCmd");ot();function x$(t){let{data:e}=t;if(e.diagnostics.length===0){y.success("All checks passed.");return}let r=e.diagnostics.filter(a=>a.level==="error"),n=e.diagnostics.filter(a=>a.level==="warning");for(let a of r)y.error(`${a.file} (${a.target}): ${a.message}`);for(let a of n)y.warn(`${a.file} (${a.target}): ${a.message}`);let o=e.summary.errors,i=e.summary.warnings;y.info(`${o} error${o!==1?"s":""}, ${i} warning${i!==1?"s":""}`);}s(x$,"renderLint");ot();function D$(t){let{data:e}=t;if(!e.hasLock){y.error("Not initialized for collaboration. Run 'agentsmesh generate' first.");return}if(e.inSync){y.success("Lock file is in sync.");return}let r=new Set(e.lockedViolations);y.error("Conflict detected:");for(let n of e.extendsModified)y.error(` extend "${n}" was modified`);for(let n of e.modified){let o=r.has(n)?" [LOCKED]":"";y.error(` ${n} was modified${o}`);}for(let n of e.added){let o=r.has(n)?" [LOCKED]":"";y.error(` ${n} was added${o}`);}for(let n of e.removed){let o=r.has(n)?" [LOCKED]":"";y.error(` ${n} was removed${o}`);}y.info("Run 'agentsmesh merge' to resolve, or 'agentsmesh generate --force' to accept current state.");}s(D$,"renderCheck");ot();function N$(t){let{data:e}=t;if(e.files.length===0){y.info(`Nothing to import from ${e.target}.`);return}for(let n of e.files)y.success(`${n.from} \u2192 ${n.to}`);let r=e.scope==="global"?" --global":"";y.info(`Imported ${e.files.length} file(s). Run 'agentsmesh generate${r}' to sync to other tools.`);}s(N$,"renderImport");ot();function F$(t){let{summary:e}=t.data;if(e.created+e.updated+e.unchanged+e.deleted===0){y.info("No files to generate (no root rule or rules feature disabled).");return}for(let n of t.data.patches)process.stdout.write(n.patch);y.info(Lf({new:e.created,updated:e.updated,unchanged:e.unchanged,deleted:e.deleted}));}s(F$,"renderDiff");ot();function v$(t){if(!t.data.hadConflict){y.info("No conflicts to resolve.");return}y.success("Lock file conflict resolved.");}s(v$,"renderMerge");ap();cp();Yt();fo();ap();cp();ot();var gZ=300;function hZ(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(hZ,"normalizeWatchPath");function yZ(t,e){let r=hZ(relative(t,e));return r===""?true:r===".lock"||r===".lock.tmp"||r===".generate.lock"||r.endsWith("/.lock")||r.endsWith("/.lock.tmp")||r.endsWith("/.generate.lock")||r.includes("/.generate.lock/")||r.startsWith(".generate.lock/")}s(yZ,"shouldIgnoreWatchPath");function _Z(t,e,r,n,o,i,a,l,c){return JSON.stringify({features:t,rulesCount:e,commandsCount:r,agentsCount:n,skillsCount:o,mcpServerCount:i,permissionsCount:a,hooksCount:l,ignoreCount:c})}s(_Z,"featureFingerprint");async function $$(t,e,r={}){let n=e??process.cwd(),o=t.global===true?"global":"project",{context:i}=await yt(n,o),a=[i.canonicalDir,join(i.configDir,"agentsmesh.yaml"),join(i.configDir,"agentsmesh.local.yaml")],l=null,c=null,m=false,p=null,u=s(async()=>{if(m)return;l=null;let{config:C,context:S}=await yt(n,o),{canonical:k}=await ke(C,S.configDir,{},S.canonicalDir),P=k.mcp?Object.keys(k.mcp.mcpServers).length:0,N=k.permissions?k.permissions.allow.length+k.permissions.deny.length:0,F=k.hooks?Object.values(k.hooks).reduce((At,wt)=>At+(Array.isArray(wt)?wt.length:0),0):0,W=k.ignore.length,z=_Z(C.features,k.rules.length,k.commands.length,k.agents.length,k.skills.length,P,N,F,W),Q=c!==null&&c!==z;if(c=z,m)return;let at=await _c(t,n,{printMatrix:false});if(Rc(at),!m){if(Q){let At=await ip(t,n);lp(At,{verbose:t.verbose===true});}else y.info("Regenerated.");r.onCycle?.({featuresChanged:Q});}},"run"),f=s(()=>{let C=u().catch(S=>{if(!m){let k=S instanceof Error?S.message:String(S);y.error(k);}}).finally(()=>{p===C&&(p=null);});p=C;},"scheduleRun"),g=s(()=>{m||(l&&clearTimeout(l),l=setTimeout(f,gZ));},"schedule"),h=r.usePolling??process.platform==="win32",R=fZ.watch(a,{ignoreInitial:true,usePolling:h,...h&&r.pollIntervalMs!==void 0?{interval:r.pollIntervalMs}:{}});return R.on("all",(C,S)=>{yZ(i.canonicalDir,S)||g();}),await new Promise((C,S)=>{R.once("ready",C),R.once("error",S);}),y.info(o==="global"?"Watching ~/.agentsmesh/ and agentsmesh.yaml...":"Watching .agentsmesh/ and agentsmesh.yaml..."),p=u(),await p,p=null,{stop:s(async()=>{m=true,l&&(clearTimeout(l),l=null),await R.close(),p&&await p;},"stop")}}s($$,"runWatch");Yt();Fp();async function Af(t){let{config:e,configDir:r,canonicalDir:n}=t,o=await mf(n);if(o===null)return {inSync:false,hasLock:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]};let i=await ys(n),a=await qa(e,r),l=a.length>0?await gc(a):{},c=new Set(Object.keys(o.checksums)),m=new Set(Object.keys(i)),p=[],u=[],f=[];for(let S of c){let k=i[S];k===void 0?f.push(S):k!==o.checksums[S]&&p.push(S);}for(let S of m)c.has(S)||u.push(S);let g=new Set([...Object.keys(o.extends),...Object.keys(l)]),h=[];for(let S of g)l[S]!==o.extends[S]&&h.push(S);let R=uf(o.checksums,i,e.collaboration?.lock_features??[]);return {inSync:p.length===0&&u.length===0&&f.length===0&&h.length===0,hasLock:true,modified:p,added:u,removed:f,extendsModified:h,lockedViolations:R}}s(Af,"checkLockSync");fn();async function G$(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:i}=await yt(r,n);await Wt(o,r);let a=await Af({config:o,configDir:i.configDir,canonicalDir:i.canonicalDir});return a.hasLock?{exitCode:a.inSync?0:1,data:{hasLock:true,inSync:a.inSync,modified:[...a.modified],added:[...a.added],removed:[...a.removed],extendsModified:[...a.extendsModified],lockedViolations:[...a.lockedViolations]}}:{exitCode:1,data:{hasLock:false,inSync:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]}}}s(G$,"runCheck");Yt();w();Fp();var IZ=".lock",SZ="<<<<<<<";async function dI(t){let e=join(t,IZ),r=await _(e);return r===null?false:r.includes(SZ)}s(dI,"hasLockConflict");async function U$(t,e,r){if(!await dI(t))throw new Error("No conflict to resolve.");let o=await ys(t),i=dirname(t),a=r?await qa(r,i):[],l=a.length>0?await gc(a):{},c=await df(join(t,"packs")),m=process.env.USER??process.env.USERNAME??"unknown";await pf(t,{generatedAt:new Date().toISOString(),generatedBy:m,libVersion:e,checksums:o,extends:l,packs:c});}s(U$,"resolveLockConflict");async function B$(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:i}=await yt(r,n),a=i.canonicalDir;return await dI(a)?(await U$(a,Ci(),o),{exitCode:0,data:{hadConflict:true,resolved:true}}):{exitCode:0,data:{hadConflict:false,resolved:false}}}s(B$,"runMerge");Yt();nf();function K$(t){let e=typeof t.path=="string"?t.path.trim():void 0,r=typeof t.target=="string"?t.target.trim():void 0,n=typeof t.as=="string"?t.as.trim():void 0;return {sync:t.sync===true,dryRun:t["dry-run"]===true,force:t.force===true,useExtends:t.extends===true,all:t.all===true,explicitPath:e||void 0,explicitTarget:r||void 0,explicitAs:n?dc.parse(n):void 0,nameOverride:typeof t.name=="string"?t.name.trim():""}}s(K$,"readInstallFlags");var EZ=".install.lock";async function wf(t,e={}){return await mkdir(t,{recursive:true}),Rf(join(t,EZ),e)}s(wf,"acquireInstallLock");Yt();w();Uc();var AZ=promisify(execFile);function bf(t,e){if(t.startsWith("-"))throw new Error(`agentsmesh refuses ${e} starting with "-" (option-injection guard): ${t}`)}s(bf,"ensureNotFlag");async function fI(t){let{stdout:e}=await AZ("git",t,{env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return e.trim()}s(fI,"runGit");async function W$(){try{return await fI(["--version"]),!0}catch{return false}}s(W$,"isGitAvailable");async function wZ(t,e){bf(t,"remote-url"),bf(e,"ref");let r=[e,`refs/heads/${e}`,`refs/tags/${e}`],n;for(let o of r)try{let a=(await fI(["ls-remote",t,o])).split(`
332
+ `).map(c=>c.trim()).find(c=>c.length>0);if(!a)continue;let l=a.split(/\s+/)[0];if(l&&/^[0-9a-f]{40}$/i.test(l))return l}catch(i){n=i;}throw new Error(`Could not resolve ref "${e}" for ${t}: ${n instanceof Error?n.message:String(n)}`)}s(wZ,"gitLsRemoteResolve");async function H$(t,e){bf(e,"remote-url");let r=t===""?"HEAD":t;if(bf(r,"ref"),/^[0-9a-f]{40}$/i.test(r))return r.toLowerCase();if(r==="HEAD"){let o=(await fI(["ls-remote",e,"HEAD"])).split(`
333
+ `).find(a=>a.trim().length>0);if(!o)throw new Error(`Could not resolve HEAD for ${e}`);let i=o.split(/\s+/)[0];if(!i||!/^[0-9a-f]{40}$/i.test(i))throw new Error(`Invalid ls-remote HEAD line for ${e}`);return i.toLowerCase()}return wZ(e,r)}s(H$,"resolveRemoteRefForInstall");async function z$(t){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};let e=t.gitRemoteUrl;if(!e)throw new Error("Internal error: missing git remote URL");let r=await H$(t.rawRef||"HEAD",e);if(t.kind==="github"){let l=`github:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Qa(l,"install",{cacheDir:Te(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}if(t.kind==="gitlab"){let l=`gitlab:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Qa(l,"install",{cacheDir:Te(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}let n=r,i=`git+${(t.gitPlusBase??e).split("#")[0]}#${n}`;return {resolvedPath:(await Qa(i,"install",{cacheDir:Te(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:i,version:r}}s(z$,"fetchInstallSource");async function V$(t,e){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};try{let r=await z$(t);return {resolvedPath:r.resolvedPath,sourceForYaml:r.sourceForYaml,version:r.version}}catch(r){let n=r instanceof Error?r.message:String(r),o=new Error(`Failed to fetch from ${e}: ${n}. Check your network connection and try again.`);throw r instanceof Error&&(o.cause=r),o}}s(V$,"resolveInstallResolvedPath");function gI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean),n=r.indexOf("tree");if(n<2||n+1>=r.length)return null;let o=r[0],i=r[1],a=r[n+1],l=r.slice(n+2).join("/");return !o||!i||!a?null:{org:o,repo:i,ref:a,path:l||""}}catch{return null}}s(gI,"parseGithubTreeUrl");function hI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean),n=r.indexOf("blob");if(n<2||n+1>=r.length)return null;let o=r[0],i=r[1],a=r[n+1],l=r.slice(n+2).join("/");return !o||!i||!a||!l?null:{org:o,repo:i,ref:a,path:l}}catch{return null}}s(hI,"parseGithubBlobUrl");function yI(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean),n=r.indexOf("-");if(n<0||r[n+1]!=="tree")return null;let o=n+1;if(o+1>=r.length)return null;let i=r[o+1],a=r.slice(o+2).join("/"),l=r.slice(0,n);if(l.length<2)return null;let c=l[l.length-1],m=l.slice(0,-1).join("/");return !m||!c||!i?null:{namespace:m,project:c,ref:i,path:a||""}}catch{return null}}s(yI,"parseGitlabTreeUrl");function _I(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean),n=r.indexOf("-");if(n<0||r[n+1]!=="blob")return null;let o=n+1;if(o+1>=r.length)return null;let i=r[o+1],a=r.slice(o+2).join("/"),l=r.slice(0,n);if(l.length<2)return null;let c=l[l.length-1],m=l.slice(0,-1).join("/");return !m||!c||!i||!a?null:{namespace:m,project:c,ref:i,path:a}}catch{return null}}s(_I,"parseGitlabBlobUrl");var bZ=new Set(["tree","blob","commit","releases","actions","issues","pulls","settings","wiki","discussions","security","projects","packages"]);function RI(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean).map(i=>i.replace(/\.git$/i,""));if(r.length<2||r.length>2||bZ.has(r[1]))return null;let n=r[0],o=r[1];return {org:n,repo:o}}catch{return null}}s(RI,"parseGithubRepoUrl");function II(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean).map(i=>i.replace(/\.git$/i,""));if(r.length<2||r.includes("-"))return null;let n=r[r.length-1],o=r.slice(0,-1).join("/");return !o||!n?null:{namespace:o,project:n}}catch{return null}}s(II,"parseGitlabRepoUrl");function SI(t){let e=t.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/i);return e?{org:e[1],repo:e[2].replace(/\.git$/i,"")}:null}s(SI,"parseGitSshGithub");function CI(t){let e=t.match(/^git@gitlab\.com:(.+?)(?:\.git)?$/i);if(!e)return null;let n=e[1].replace(/\.git$/i,"").split("/").filter(Boolean);if(n.length<2)return null;let o=n[n.length-1];return {namespace:n.slice(0,-1).join("/"),project:o}}s(CI,"parseGitSshGitlab");w();var xZ=/^[A-Za-z]:[\\/]/,DZ=/^[A-Za-z]:\//;function J$(...t){return t.some(e=>e.includes("\\")||xZ.test(e))?win32:posix}s(J$,"pathApiFor");function pp(t){return t.replace(/\\/g,"/")}s(pp,"toPosixPath");function mp(t){return pp(t).replace(/^\/+|\/+$/g,"")}s(mp,"normalizeInstallPathField");function Pf(t){let e=pp(t);return e===""||e==="."||e==="./."?".":e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||DZ.test(e)?e:`./${e}`}s(Pf,"normalizeLocalSourceForYaml");function gi(t){return {...t,source:t.source_kind==="local"?Pf(t.source):t.source,...t.path!==void 0?{path:mp(t.path)}:{},...t.paths!==void 0?{paths:t.paths.map(e=>mp(e))}:{}}}s(gi,"normalizePersistedInstallPaths");function Y$(t,e,r){let n=J$(t,e),o=n.normalize(t),i=n.normalize(e),a=mp(r),l=`${n.sep}.agentsmesh${n.sep}`,c=o.indexOf(l);if(c>=0){let p=o.slice(0,c),u=o.slice(c+l.length),f=mp(u),g=pp(n.relative(i,p))||".";return {kind:"local",rawRef:"",pathInRepo:a||f.replace(/\.md$/i,"").replace(/\/$/,""),localRoot:p,localSourceForYaml:Pf(g)}}let m=pp(n.relative(i,o))||".";return {kind:"local",rawRef:"",pathInRepo:a,localRoot:o,localSourceForYaml:Pf(m)}}s(Y$,"localParsedFromAbsPath");async function kI(t,e,r){let n=t.trim(),o=r?.trim().replace(/\\/g,"/")??"";if(n.startsWith("git+")){let p=n.lastIndexOf("#"),u=p<0?n:n.slice(0,p),f=p<0?"HEAD":n.slice(p+1),g=u.slice(4);return {kind:"git",rawRef:f,gitPlusBase:g,gitRemoteUrl:g,pathInRepo:o}}if(n.startsWith("https://")||n.startsWith("http://")){let p=gI(n)??hI(n);if(p)return {kind:"github",rawRef:p.ref,org:p.org,repo:p.repo,gitRemoteUrl:`https://github.com/${p.org}/${p.repo}.git`,pathInRepo:o||p.path};let u=RI(n);if(u)return {kind:"github",rawRef:"HEAD",org:u.org,repo:u.repo,gitRemoteUrl:`https://github.com/${u.org}/${u.repo}.git`,pathInRepo:o};let f=yI(n)??_I(n);if(f)return {kind:"gitlab",rawRef:f.ref,org:f.namespace,repo:f.project,gitRemoteUrl:`https://gitlab.com/${f.namespace}/${f.project}.git`,pathInRepo:o||f.path};let g=II(n);if(g)return {kind:"gitlab",rawRef:"HEAD",org:g.namespace,repo:g.project,gitRemoteUrl:`https://gitlab.com/${g.namespace}/${g.project}.git`,pathInRepo:o}}if(n.startsWith("git@github.com:")){let p=SI(n);if(!p)throw new Error(`Invalid GitHub SSH URL: ${n}`);return {kind:"github",rawRef:"HEAD",org:p.org,repo:p.repo,gitRemoteUrl:`https://github.com/${p.org}/${p.repo}.git`,pathInRepo:o}}if(n.startsWith("git@gitlab.com:")){let p=CI(n);if(!p)throw new Error(`Invalid GitLab SSH URL: ${n}`);return {kind:"gitlab",rawRef:"HEAD",gitRemoteUrl:`https://gitlab.com/${p.namespace}/${p.project}.git`,pathInRepo:o}}if(n.startsWith("git@")){let p=n.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(!p)throw new Error(`Invalid SSH git URL: ${n}`);let u=p[1],f=p[2].replace(/\.git$/i,"");return {kind:"git",rawRef:"HEAD",gitRemoteUrl:`ssh://git@${u}/${f}.git`,pathInRepo:o}}let i=n.match(/^github:([^/]+)\/(.+?)@([^/@]+)$/);if(i){let p=i[1],u=i[2];return {kind:"github",rawRef:i[3],org:p,repo:u,gitRemoteUrl:`https://github.com/${p}/${u}.git`,pathInRepo:o}}let a=n.match(/^github:([^/]+)\/([^/@]+)$/);if(a){let p=a[1],u=a[2];return {kind:"github",rawRef:"HEAD",org:p,repo:u,gitRemoteUrl:`https://github.com/${p}/${u}.git`,pathInRepo:o}}let l=n.match(/^gitlab:(.+)\/([^/@]+)@([^/@]+)$/);if(l){let p=l[1],u=l[2];return {kind:"gitlab",rawRef:l[3],org:p,repo:u,gitRemoteUrl:`https://gitlab.com/${p}/${u}.git`,pathInRepo:o}}let c=n.match(/^gitlab:(.+)\/([^/@]+)$/);if(c){let p=c[1],u=c[2];return {kind:"gitlab",rawRef:"HEAD",org:p,repo:u,gitRemoteUrl:`https://gitlab.com/${p}/${u}.git`,pathInRepo:o}}let m=resolve(e,n);if(!await $(m))throw new Error(`Path does not exist: ${m}`);return Y$(m,e,o)}s(kI,"parseInstallSource");IR();function gn(t){let e=[];return t.skills.length&&e.push("skills"),t.rules.length&&e.push("rules"),t.commands.length&&e.push("commands"),t.agents.length&&e.push("agents"),t.mcp!==null&&e.push("mcp"),t.permissions!==null&&e.push("permissions"),t.hooks!==null&&e.push("hooks"),t.ignore.length&&e.push("ignore"),e}s(gn,"featuresFromCanonical");async function Tf(t,e={}){let{sliceRoot:r,implicitPick:n}=await Zd(t),{canonical:o,cleanup:i}=await Qd(r,{...e,enableTargetEntityMappers:true});return {canonical:o,features:gn(o),implicitPick:n,cleanup:i}}s(Tf,"discoverFromContentRoot");function X$(t){return t.description.trim()?{skill:t,ok:true}:{skill:t,ok:false,reason:"missing description in frontmatter"}}s(X$,"validateSkill");function Z$(t){return t.description.trim()?{rule:t,ok:true}:{rule:t,ok:false,reason:"missing description in frontmatter"}}s(Z$,"validateRule");function Q$(t){return t.description.trim()?{command:t,ok:true}:{command:t,ok:false,reason:"missing description in frontmatter"}}s(Q$,"validateCommand");function q$(t){return t.description.trim()?{agent:t,ok:true}:{agent:t,ok:false,reason:"missing description in frontmatter"}}s(q$,"validateAgent");function ne(t){return basename(t.source).replace(/\.md$/i,"")}s(ne,"ruleSlug");function vZ(t){if(!t)return;let e=[];return t.skills!==void 0&&e.push("skills"),t.rules!==void 0&&e.push("rules"),t.commands!==void 0&&e.push("commands"),t.agents!==void 0&&e.push("agents"),e.length>0?e:void 0}s(vZ,"featuresFromImplicitPick");function Cc(t,e){let{implicitPick:r}=e,n=e.scopedFeatures??vZ(r);if(!r&&!n)return t;let o=new Set(n??[]),i={...t,mcp:!n||o.has("mcp")?t.mcp:null,permissions:!n||o.has("permissions")?t.permissions:null,hooks:!n||o.has("hooks")?t.hooks:null,ignore:!n||o.has("ignore")?t.ignore:[]};if(r?.skills!==void 0){let a=new Set(r.skills);i={...i,skills:r.skills.length===0?[]:i.skills.filter(l=>a.has(l.name))};}else n&&!o.has("skills")&&(i={...i,skills:[]});if(r?.rules!==void 0){let a=new Set(r.rules);i={...i,rules:r.rules.length===0?[]:i.rules.filter(l=>a.has(ne(l)))};}else n&&!o.has("rules")&&(i={...i,rules:[]});if(r?.commands!==void 0){let a=new Set(r.commands);i={...i,commands:r.commands.length===0?[]:i.commands.filter(l=>a.has(l.name))};}else n&&!o.has("commands")&&(i={...i,commands:[]});if(r?.agents!==void 0){let a=new Set(r.agents);i={...i,agents:r.agents.length===0?[]:i.agents.filter(l=>a.has(l.name))};}else n&&!o.has("agents")&&(i={...i,agents:[]});return i}s(Cc,"narrowDiscoveredForInstallScope");AR();async function tG(t,e,r,n,o={}){let i=await ef(t,e,{preferredSkillNames:e==="skills"?n?.skills:void 0}),{canonical:a,cleanup:l}=await Tf(i.discoveryRoot,o),c=Cc(a,{scopedFeatures:[e]});return {prep:{yamlTarget:r,scopedFeatures:[e],cleanup:s(async()=>{await Promise.allSettled([l(),i.cleanup()]);},"combinedCleanup")},narrowed:c,discoveredFeatures:gn(c)}}s(tG,"resolveManualDiscoveredForInstall");Ro();cR();w();Pt();var MZ=(()=>{let t=new Map;for(let r of bt){let n=r.project.managedOutputs,o=[...n?.dirs??[],...n?.files??[],...r.detectionPaths];for(let i of o){let a=i.replace(/\/$/,""),l=t.get(a)??new Set;l.add(r.id),t.set(a,l);}}let e=[];for(let[r,n]of t){if(n.size!==1)continue;let[o]=[...n];e.push({prefix:r,target:o});}return e.sort((r,n)=>n.prefix.length-r.prefix.length)})();function $Z(t){return t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}s($Z,"norm");function xf(t){let e=$Z(t);if(e){for(let{prefix:r,target:n}of MZ)if(e===r||e.startsWith(`${r}/`))return n}}s(xf,"targetHintFromNativePath");function EI(t,e){return xf(t)===e}s(EI,"pathSupportsNativePick");function eG(t,e){if(!t||!e)return;let r=xf(e);if(r&&r!==t)throw new Error(`--target "${t}" does not match the install path (native path suggests "${r}"). Omit --target to auto-detect, or point at a subtree for that target.`)}s(eG,"validateTargetMatchesPath");function rG(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)>0}s(rG,"extendPickHasArrays");w();w();Jt();async function oG(t,e){let r=join(t,...He.split("/")),n=join(t,...e.split("/")),o=await v(n),i=[];for(let a of o){if(!/\.(toml|md)$/i.test(a))continue;let l=relative(r,a).replace(/\\/g,"/");if(l.startsWith("..")||l==="")continue;let m=l.replace(/\.(toml|md)$/i,"").split("/").filter(Boolean).join(":");m&&i.push(m);}return [...new Set(i)].sort()}s(oG,"inferGeminiCommandNamesFromFiles");Jt();cr();w();async function Na(t){let e=await v(t),r=new Set;for(let n of e){if(basename(n)==="SKILL.md"){r.add(basename(dirname(n)));continue}!relative(t,n).replace(/\\/g,"/").includes("/")&&n.toLowerCase().endsWith(".md")&&r.add(basename(n,".md"));}return [...r].filter(Boolean).sort()}s(Na,"skillNamesFromNativeSkillDir");w();wr();async function sG(t,e){let r=join(t,...e.split("/"));if(e.startsWith(si)){let n=await v(r),o=[...new Set(n.filter(i=>i.toLowerCase().endsWith(".prompt.md")).map(i=>basename(i,".prompt.md")))].sort();return o.length?{commands:o}:{}}if(e.startsWith(".github/copilot")&&!e.includes("copilot-instructions.md")){let n=await v(r),o=[...new Set(n.filter(i=>i.includes(".instructions.md")).map(i=>basename(i).replace(/\.instructions\.md$/i,"")))].sort();return o.length?{rules:o}:{}}if(e.startsWith(".github/instructions")){let n=await v(r),o=new Set;for(let a of n){let l=basename(a);l.toLowerCase().endsWith(".instructions.md")?o.add(l.replace(/\.instructions\.md$/i,"")):l.toLowerCase().endsWith(".md")&&o.add(basename(a,".md"));}let i=[...o].sort();return i.length?{rules:i}:{}}if(e.startsWith(".github/skills")){let n=await Na(r);return n.length?{skills:n}:{}}if(e.startsWith(".github/agents")){let n=await v(r),o=[...new Set(n.filter(i=>i.toLowerCase().endsWith(".agent.md")).map(i=>basename(i,".agent.md")))].sort();return o.length?{agents:o}:{}}return {}}s(sG,"inferCopilotPickFromPath");async function Je(t,e){let r=await v(t),n=e.toLowerCase();return [...new Set(r.filter(o=>o.toLowerCase().endsWith(n)).map(o=>basename(o,e)))].sort()}s(Je,"mdNames");async function aG(t,e,r){let n=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),o=join(t,...n.split("/"));if(r==="gemini-cli"){if(n===He||n.startsWith(`${He}/`)){let i=await oG(t,n);return i.length?{commands:i}:{}}return {}}if(r==="claude-code"){if(n.startsWith(".claude/commands")){let i=await Je(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".claude/rules")){let i=await Je(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".claude/agents")){let i=await Je(o,".md");return i.length?{agents:i}:{}}if(n.startsWith(".claude/skills/")){let a=n.replace(/^\.claude\/skills\/?/,"").split("/").filter(Boolean)[0];return a?{skills:[a]}:{}}return {}}if(r==="cursor"){if(n.startsWith(".cursor/rules")){let i=await Je(o,".mdc");return i.length?{rules:i}:{}}if(n.startsWith(".cursor/commands")){let i=await Je(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".cursor/agents")){let i=await Je(o,".md");return i.length?{agents:i}:{}}if(n.startsWith(".cursor/skills")){let i=await Na(o);return i.length?{skills:i}:{}}return {}}if(r==="copilot")return sG(t,n);if(r==="windsurf"&&n.startsWith(".windsurf/rules")){let i=await Je(o,".md");return i.length?{rules:i}:{}}if(r==="cline"){if(n.startsWith(Zt)){let i=await Na(o);return i.length?{skills:i}:{}}if(n.startsWith(Dn)){let i=await Je(o,".md");return i.length?{commands:i}:{}}return {}}if(r==="continue"){if(n.startsWith(".continue/rules")){let i=await Je(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".continue/prompts")){let i=await Je(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".continue/skills")){let i=await Na(o);return i.length?{skills:i}:{}}return {}}if(r==="junie"){if(n.startsWith(".junie/commands")){let i=await Je(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".junie/rules")){let i=await Je(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".junie/agents")){let i=await Je(o,".md");return i.length?{agents:i}:{}}if(n.startsWith(".junie/skills")){let i=await Na(o);return i.length?{skills:i}:{}}return {}}if(r==="codex-cli"&&n.startsWith(".codex")){let i=await v(o),a=[...new Set(i.filter(l=>l.toLowerCase().endsWith(".md")).map(l=>basename(l,".md")))].sort();return a.length?{rules:a}:{}}return {}}s(aG,"inferImplicitPickFromNativePath");function lG(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)===0}s(lG,"isImplicitPickEmpty");mR();function dp(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(dp,"normalizePath");function JZ(t,e){let r=dp(t),n=dp(e);return r===n||r.startsWith(`${n}/`)||n.startsWith(`${r}/`)}s(JZ,"overlapsPath");function Df(t,e){let r=t??[];return r.includes(e)||r.push(e),r}s(Df,"addUnique");async function YZ(t){let e=await mkdtemp(join(tmpdir(),"am-install-native-")),r=join(e,"repo"),n=s(async()=>{await rm(e,{recursive:true,force:true});},"cleanup");try{return await cp$1(t,r,{recursive:!0}),{stageRoot:r,cleanup:n}}catch(o){throw await n(),o}}s(YZ,"makeStageRoot");function XZ(t,e){let r;for(let o of t){if(o.feature==="rules"&&o.toPath.startsWith(".agentsmesh/rules/")){r={...r,rules:Df(r?.rules,basename(o.toPath,".md"))};continue}if(o.feature==="commands"&&o.toPath.startsWith(".agentsmesh/commands/")){let i=dp(relative(join(e,".agentsmesh","commands"),join(e,o.toPath)));r={...r,commands:Df(r?.commands,i.replace(/\.md$/i,"").split("/").filter(Boolean).join(":"))};continue}if(o.feature==="agents"&&o.toPath.startsWith(".agentsmesh/agents/")){r={...r,agents:Df(r?.agents,basename(o.toPath,".md"))};continue}if(o.feature==="skills"&&o.toPath.startsWith(".agentsmesh/skills/")){let a=dp(relative(join(e,".agentsmesh","skills"),join(e,o.toPath))).split("/")[0];a&&(r={...r,skills:Df(r?.skills,a)});}}return r&&(r.rules?.length??0)+(r.commands?.length??0)+(r.agents?.length??0)+(r.skills?.length??0)>0?r:void 0}s(XZ,"buildPickFromResults");function ZZ(t,e,r,n){let o=join(e,...dp(t).split("/")),i=r.filter(a=>JZ(o,a.fromPath));if(i.length===0)throw new Error(`No installable native resources found under "${t}" for target "${n}". Try --path "${t}" without --target so agentsmesh can auto-detect the layout, or use --as <rules|commands|agents|skills> to install the directory as a flat collection.`);return {features:[...new Set(i.map(a=>a.feature))],pick:XZ(i,e)}}s(ZZ,"scopeImportedResults");async function OI(t,e){let{stageRoot:r,cleanup:n}=await YZ(t);try{let o=await tp(r,e);return {stageRoot:r,results:o,cleanup:n}}catch(o){throw await n(),o}}s(OI,"stageImportedNativeRepo");async function AI(t,e,r){let n=await OI(t,r);try{return {stageRoot:n.stageRoot,cleanup:n.cleanup,...ZZ(e,n.stageRoot,n.results,r)}}catch(o){throw await n.cleanup(),o}}s(AI,"stageNativeInstallScope");async function uG(t,e,r,n){let o=n.explicitTarget?.trim();o&&Qe.parse(o);let i=r.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");eG(o,i);let a=join(t,".agentsmesh"),l=await $(a),c=i?xf(i):void 0,p=!l&&!o&&(!i||c!==void 0)?await Ud(t)??void 0:void 0;if(!o&&c&&p&&c!==p)throw new Error(`Install path suggests native layout "${c}" but auto-detect imported "${p}". Use --target ${c} for this path, or install from the repo root without a conflicting subtree path.`);let u=o??c??p,f=!!i&&!!u&&!i.startsWith(".agentsmesh");if(!l&&u){if(f){let P=await AI(t,i,u);return {discoveryRoot:P.stageRoot,implicitPick:P.pick,scopedFeatures:P.features,yamlTarget:u,importHappened:true,cleanup:P.cleanup}}let k=await OI(t,u);return {discoveryRoot:i?join(k.stageRoot,i):k.stageRoot,yamlTarget:u,importHappened:true,cleanup:k.cleanup}}let g;l?i?u&&EI(i,u)?g=t:g=e:g=t:g=e;let h,R,C;if(f&&u){let k=await AI(t,i,u);g=k.stageRoot,h=k.pick,R=k.features,C=k.cleanup;}else if(g===t&&i&&u&&EI(i,u)&&(h=await aG(t,i,u),lG(h)))throw new Error(`No installable native resources found under "${i}" for target "${u}". Try --path "${i}" without --target so agentsmesh can auto-detect the layout, or use --as <rules|commands|agents|skills> to install the directory as a flat collection.`);let S;return o?S=o:u&&(h&&rG(h)||(R?.length??0)>0)&&(S=u),{discoveryRoot:g,implicitPick:h,scopedFeatures:R,yamlTarget:S,importHappened:C!==void 0,cleanup:C}}s(uG,"prepareInstallDiscovery");async function wI(t,e,r,n,o={}){let i=await uG(t,e,r,{explicitTarget:n}),{canonical:a,implicitPick:l,cleanup:c}=await Tf(i.discoveryRoot,o),m=i.cleanup,u={...i,cleanup:s(async()=>{await Promise.allSettled([c(),...m?[m()]:[]]);},"mergedCleanup")},f=l??i.implicitPick,g=Cc(a,{implicitPick:f,scopedFeatures:i.scopedFeatures}),h=gn(g);return {prep:u,discovered:a,implicitPick:f,narrowed:g,discoveredFeatures:h}}s(wI,"resolveDiscoveredForInstall");var tQ=[".claude-plugin","marketplace.json"];async function eQ(t){try{return (await stat(t)).isDirectory()}catch{return false}}s(eQ,"dirExists");function rQ(t){if(typeof t!="string"||t.length===0||t.startsWith("/"))return null;let e=t.replace(/^\.\/+/,"").replace(/\/+$/,"");return e.split("/").some(r=>r==="..")?null:e}s(rQ,"normalizeSource");async function fG(t,e,r){let n=join(t,...tQ),o;try{o=await readFile(n,"utf-8");}catch{return null}let i;try{i=JSON.parse(o);}catch{return null}if(typeof i!="object"||i===null||!Array.isArray(i.plugins))return null;let a=i.plugins,l=[];for(let c of a){if(typeof c!="object"||c===null)continue;let m=rQ(c.source);if(!m)continue;let p=join(t,m);if(!await eQ(p))continue;let u=await e(p,m);r(u)&&l.push({path:m,layout:u});}return l}s(fG,"detectMarketplaceSubPacks");async function fp(t){try{return (await stat(t)).isDirectory()}catch{return false}}s(fp,"dirExists");async function hi(t){try{return (await readdir(t,{withFileTypes:!0})).map(r=>({name:r.name,isDir:r.isDirectory(),isFile:r.isFile()}))}catch{return []}}s(hi,"listDirEntries");function gG(t){return t.endsWith(".instructions.md")?"copilot-instructions":t.endsWith(".md")?"md":t.endsWith(".mdc")?"mdc":t.endsWith(".toml")?"toml":null}s(gG,"classifyFileShape");var sQ=["rules","commands","agents","skills","mcp.json","hooks.yaml","permissions.yaml","ignore"],iQ=[".cursorrules",".windsurfrules"];async function yG(t){let e=join(t,".agentsmesh");if(!await fp(e))return null;let r=await hi(e),n=new Set(r.map(o=>o.name));for(let o of sQ)if(n.has(o))return {path:".agentsmesh"};return null}s(yG,"detectCanonical");async function _G(t){for(let e of iQ)try{if((await stat(join(t,e))).isFile())return {path:e}}catch{}return null}s(_G,"detectRootRule");async function RG(t){try{if((await stat(join(t,"SKILL.md"))).isFile())return {path:"SKILL.md"}}catch{}return null}s(RG,"detectRootSkill");Co();var lQ={rules:"rules",commands:"commands",agents:"agents",skills:"skills"},cQ=[".claude-plugin",".codex-plugin",".cursor-plugin"],mQ=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;async function IG(t){let e=join(t,"skills"),r=await hi(e);for(let n of r)if(!(!n.isDir||n.name.startsWith("_")||!mQ.test(n.name))&&await fp(join(e,n.name)))try{if((await stat(join(e,n.name,"SKILL.md"))).isFile())return {path:"skills"}}catch{continue}return null}s(IG,"detectSkillPack");async function SG(t){let e=[];for(let[r,n]of Object.entries(lQ)){let o=join(t,r),i=await hi(o),a=new Set;for(let l of i){if(!l.isFile||In(l.name))continue;let c=gG(l.name);c&&a.add(c);}for(let l of a)e.push({path:r,suggestedAs:n,fileShape:l});}return e}s(SG,"detectFlatCollections");async function CG(t){let e=[];for(let r of cQ)await fp(join(t,r))&&e.push({path:r});return e}s(CG,"detectToolNativeManifests");async function TI(t,e){let r=await yG(t);if(r)return {canonical:r,skillPack:null,rootSkill:null,rootRule:null,flatCollections:[],toolNativeManifests:[]};let n=await IG(t),o=n?null:await RG(t),i=await SG(t),a=n||o||i.length>0?null:await _G(t),l=await CG(t);return {canonical:r,skillPack:n?{path:e?`${e}/skills`:"skills"}:null,rootSkill:o?{path:e?`${e}/SKILL.md`:"SKILL.md"}:null,rootRule:a?{path:e?`${e}/${a.path}`:a.path}:null,flatCollections:i.map(c=>({...c,path:e?`${e}/${c.path}`:c.path})),toolNativeManifests:l.map(c=>({path:e?`${e}/${c.path}`:c.path}))}}s(TI,"detectFlatLayout");function PI(t){return t.canonical!==null||t.skillPack!==null||t.rootSkill!==null||t.rootRule!==null||t.flatCollections.length>0}s(PI,"hasContent");async function kG(t,e){let r=await hi(t),n=[];for(let o of r){if(!o.isDir||o.name.startsWith("."))continue;let i=join(t,o.name),a=e?`${e}/${o.name}`:o.name,l=await TI(i,a);PI(l)&&n.push({path:a,layout:l});}return n}s(kG,"collectSubPackCandidates");async function pQ(t,e){if(PI(e))return [];let r=await fG(t,TI,PI);if(r&&r.length>0)return r;let n=await kG(t,"");if(n.length>=2)return n;let o=await hi(t);for(let i of o){if(!i.isDir||i.name.startsWith("."))continue;let a=await kG(join(t,i.name),i.name);if(a.length>=2)return a}return []}s(pQ,"detectSubPacks");async function LG(t){let e=await TI(t,"");if(e.canonical)return {...e,subPacks:[]};let r=await pQ(t,e);return {...e,subPacks:r}}s(LG,"detectLayout");w();j();async function AG(t){let e;try{e=await readdir(t);}catch{return null}let r=e.sort().find(c=>c.toLowerCase().endsWith(".mdc"));if(!r)return null;let n=await _(join(t,r));if(!n)return null;let o=Fr(n,join(t,r));if(!o.ok)return null;let{frontmatter:i}=o.value,a="alwaysApply"in i,l="trigger"in i;return a&&l?null:a?"cursor":l?"windsurf":null}s(AG,"inferMdcTarget");zd();Xd();function yQ(t){let e=t.indexOf("#");return e<0?{path:t,anchor:""}:{path:t.slice(0,e),anchor:t.slice(e)}}s(yQ,"splitAnchor");function _Q(t){return t.split(sep).join("/")}s(_Q,"toForwardSlash");async function RQ(t){try{return await stat(t),!0}catch{return false}}s(RQ,"pathExists");async function TG(t){let{link:e,fromFile:r,contentRoot:n,includedPaths:o}=t,{path:i,anchor:a}=yQ(e.path);if(i===""||isAbsolute(i))return {link:e,classification:"unresolvable",resolvedRelative:null,anchor:a};let l=join(n,r,".."),c=normalize(resolve(l,i)),m=normalize(resolve(n)),p=relative(m,c);if(p.startsWith("..")||isAbsolute(p))return {link:e,classification:"unresolvable",resolvedRelative:null,anchor:a};let u=_Q(p);return await RQ(c)?o.has(u)?{link:e,classification:"in-tree-included",resolvedRelative:u,anchor:a}:{link:e,classification:"resolvable-outside",resolvedRelative:u,anchor:a}:{link:e,classification:"unresolvable",resolvedRelative:u,anchor:a}}s(TG,"resolveLink");var IQ=/^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm,SQ=/(!?)\[[^\]\n]*\]\(([^)\n]+)\)/g,CQ=/^\s*\[([^\]\n]+)\]:\s*(.+?)\s*$/gm;function kQ(t){let e=[];for(let r of t.matchAll(IQ)){let n=r.index??0;e.push([n,n+r[0].length]);}return e}s(kQ,"getFencedCodeRanges");function xG(t,e){for(let[r,n]of e)if(t>=r&&t<n)return true;return false}s(xG,"isInRanges");function DG(t){let e=t.trim(),r=/^(.*?)\s+(["'])([\s\S]*?)\2\s*$/.exec(e);return r?.[1]!==void 0&&(e=r[1].trim()),e.startsWith("<")&&e.endsWith(">")&&(e=e.slice(1,-1).trim()),e}s(DG,"normalizeDestination");function Nf(t){let e=kQ(t),r=[];for(let n of t.matchAll(SQ)){let o=n.index??0;if(xG(o,e))continue;let i=n[1]==="!",a=n[2];if(a===void 0)continue;let l=t.indexOf("(",o);if(l<0)continue;let c=l+1;r.push({kind:i?"image":"inline",destination:DG(a),destinationOffset:c,destinationLength:a.length});}for(let n of t.matchAll(CQ)){let o=n.index??0;if(xG(o,e))continue;let i=(n[1]??"").trim(),a=n[2]??"";if(i===""||a.trim()==="")continue;let l=o,c=t.indexOf("]:",l);if(c<0)continue;let m=c+2;for(;m<t.length&&(t[m]===" "||t[m]===" ");)m+=1;r.push({kind:"reference-def",destination:DG(a),label:i,destinationOffset:m,destinationLength:a.trimEnd().length});}return r}s(Nf,"scanMarkdownLinks");function NG(t,e){if(e.length===0)return t;let r=[...e].sort((o,i)=>i.offset-o.offset),n=t;for(let o of r)n=`${n.slice(0,o.offset)}${o.replacement}${n.slice(o.offset+o.length)}`;return n}s(NG,"applyRangeRewrites");function EQ(t){return !(t.length===0||t.startsWith("#")||t.startsWith("/")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))}s(EQ,"isCandidateRelativePath");function LQ(t){let e=t.replaceAll("\\","/");return e==="{baseDir}"?".":e.startsWith("{baseDir}/")?e.slice(10):e}s(LQ,"stripPath");function OQ(t){let e=t.destination;return EQ(e)?{raw:e,path:LQ(e),kind:t.kind,...t.label!==void 0?{label:t.label}:{}}:null}s(OQ,"toScannedLink");function FG(t){let e=[];for(let r of Nf(t)){let n=OQ(r);n!==null&&e.push(n);}return e}s(FG,"scanRelativeLinks");function kc(t,e){let r=t.replaceAll("\\","/"),n=e.replaceAll("\\","/"),o=r.endsWith("/")?r:`${r}/`;return n.startsWith(o)?n.slice(o.length):n}s(kc,"toForwardSlashRelative");function vG(t,e,r,n,o){let i=new Set;for(let a of e){i.add(kc(t,a.source));for(let l of a.supportingFiles)i.add(kc(t,l.absolutePath));}for(let a of r)i.add(kc(t,a.source));for(let a of n)i.add(kc(t,a.source));for(let a of o)i.add(kc(t,a.source));return i}s(vG,"buildIncludedPaths");function wQ(t,e,r,n){let o=[];for(let i of t)o.push({kind:"skill",name:i.name,body:i.body,sourcePath:i.source});for(let i of e)o.push({kind:"agent",name:i.name,body:i.body,sourcePath:i.source});for(let i of r)o.push({kind:"command",name:i.name,body:i.body,sourcePath:i.source});for(let i of n)o.push({kind:"rule",name:basename(i.source,".md"),body:i.body,sourcePath:i.source});return o}s(wQ,"listScannables");async function MG(t,e,r,n,o,i){let a=wQ(e,r,n,o),l=[];for(let c of a){let m=FG(c.body);if(m.length===0)continue;let p=kc(t,c.sourcePath),u=[];for(let f of m){let g=await TG({link:f,fromFile:p,contentRoot:t,includedPaths:i});g.classification!=="in-tree-included"&&u.push(g);}u.length>0&&l.push({entityKind:c.kind,entityName:c.name,resolved:u});}return l}s(MG,"detectBrokenLinks");Xd();async function $G(t,e,r={}){let n=new Map,o=new Map,i=[],a=[...e].sort((p,u)=>p.precedence-u.precedence);for(let p of a){let{commands:u,cleanup:f}=await Vd(join(t,p.dir),{restrictToTarget:p.target,parseOpts:r});i.push(f);for(let g of u){if(n.get(g.name)===void 0){n.set(g.name,{command:g,precedence:p.precedence});continue}let R=o.get(g.name)??[];R.push({path:g.source,precedence:p.precedence}),o.set(g.name,R);}}let l=[];for(let[p,u]of o){let f=n.get(p);if(f===void 0)throw new Error(`mergeCommands invariant: loser without winner for "${p}"`);l.push({basename:p,winnerPath:f.command.source,loserPaths:u.map(g=>g.path)});}return l.sort((p,u)=>p.basename.localeCompare(u.basename)),{commands:[...n.values()].map(p=>p.command).sort((p,u)=>p.name.localeCompare(u.name)),dedups:l,cleanup:s(async()=>{await Promise.allSettled(i.map(p=>p()));},"cleanup")}}s($G,"mergeCommands");async function GG(t,e,r={}){let[n,o,i,a]=await Promise.all([Uv(`${t}/skills`,r),Yd(`${t}/agents`,{parseOpts:r}),Jd(`${t}/rules`,{parseOpts:r}),$G(t,e.mergeFromToolDirs,r)]),l=[...o.agents],c=[...i.rules],m=vG(t,n,l,a.commands,c),p=await MG(t,n,l,a.commands,c,m),u=s(async()=>{await Promise.allSettled([i.cleanup(),o.cleanup(),a.cleanup()]);},"cleanup");return {skills:n,agents:l,commands:a.commands,rules:c,dedups:a.dedups,brokenLinks:p,cleanup:u}}s(GG,"aggregateAnthropicSkillPack");var jG={mergeFromToolDirs:[{dir:"commands",precedence:0},{dir:".claude/commands",target:"claude-code",precedence:1},{dir:".gemini/commands",target:"gemini-cli",precedence:2}]};el();function TQ(t){return {rules:[...t.rules],commands:[...t.commands],agents:[...t.agents],skills:[...t.skills],mcp:null,permissions:null,hooks:null,ignore:[]}}s(TQ,"aggregateToCanonical");function Ff(){return {}}s(Ff,"emptyPrep");async function xQ(t,e){let r=[];for(let n of e)if(n.fileShape==="mdc"&&!n.inferredTarget){let o=await AG(join(t,n.path));r.push(o?{...n,inferredTarget:o}:n);}else r.push(n);return r}s(xQ,"enrichMdcTargets");function BG(t){return t.canonical?"canonical-agentsmesh":t.skillPack||t.rootSkill?"anthropic-skill-pack":t.rootRule||t.toolNativeManifests.length>0?"tool-native":"unknown"}s(BG,"deriveSourceType");async function DQ(t,e){let r=await Bp(t,e);return {rules:[],commands:[],agents:[],skills:r?[r]:[],mcp:null,permissions:null,hooks:null,ignore:[]}}s(DQ,"rootSkillToCanonical");async function NQ(t,e){let r=join(t,e),n=await readFile(r,"utf-8").catch(()=>""),o=`Imported from ${e}`;return {rules:n?[{source:r,root:true,targets:[],description:o,globs:[],body:n}]:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}s(NQ,"rootRuleToCanonical");async function KG(t){let e=t.parseOpts??{};if(t.explicitAs)return {implicitPick:void 0,...await tG(t.contentRoot,t.explicitAs,t.explicitTarget,t.replayPick,e)};if(t.explicitTarget)return wI(t.resolvedPath,t.contentRoot,t.pathInRepo,t.explicitTarget,e);let r=await LG(t.contentRoot),n=await xQ(t.contentRoot,r.flatCollections),o={...r,flatCollections:n};if(o.skillPack&&!o.canonical){let a=await GG(t.contentRoot,jG,e),l=TQ(a);return {prep:{cleanup:a.cleanup},implicitPick:void 0,narrowed:l,discoveredFeatures:gn(l),layout:o,aggregate:a}}if(o.rootSkill&&!o.canonical&&!o.skillPack){let a=await DQ(t.contentRoot,e);return {prep:Ff(),implicitPick:void 0,narrowed:a,discoveredFeatures:gn(a),layout:o}}if(o.rootRule&&!o.canonical&&!o.skillPack&&!o.rootSkill&&o.flatCollections.length===0){let a=await NQ(t.contentRoot,o.rootRule.path);return {prep:Ff(),implicitPick:void 0,narrowed:a,discoveredFeatures:gn(a),layout:o}}return o.subPacks.length>0?{prep:Ff(),implicitPick:void 0,narrowed:{rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]},discoveredFeatures:[],layout:o}:o.flatCollections.length>0?{prep:Ff(),implicitPick:void 0,narrowed:{rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]},discoveredFeatures:[],layout:o}:{...await wI(t.resolvedPath,t.contentRoot,t.pathInRepo,t.explicitTarget,e),layout:o}}s(KG,"resolveInstallDiscovery");function HG(t){let e=new Set;t.skillPack&&e.add("skills"),t.rootSkill&&e.add("skills");for(let r of t.flatCollections)e.add(r.suggestedAs);return [...e]}s(HG,"featuresFromLayout");function FQ(t){return t.replace(/[/\\]+/g,"-").replace(/[^a-z0-9-]/gi,"").toLowerCase()}s(FQ,"subPackSlug");function WG(t,e,r){let n=HG(t.layout),o=n[0];return {name:`${e}-${FQ(t.path)}`,source:r,path:t.path,as:o,features:n}}s(WG,"targetFromSubPack");function zG(t,e,r){return {name:e,source:r,path:t.path,as:t.suggestedAs,target:t.inferredTarget,features:[t.suggestedAs]}}s(zG,"targetFromCollection");function VG(t){let{layout:e,sourceName:r,sourceForYaml:n,explicitPath:o,explicitAs:i,explicitTarget:a}=t;if(o||i||a)return {targets:[],isMarketplace:false};if(e.canonical||e.skillPack)return {targets:[],isMarketplace:false};if(e.subPacks.length>=1)return vQ(t);if(e.flatCollections.length===1){let l=e.flatCollections[0];return {targets:[zG(l,r,n)],isMarketplace:false}}return e.flatCollections.length>1?MQ(t):{targets:[],isMarketplace:false}}s(VG,"selectInstallCandidates");function vQ(t){let{layout:e,sourceName:r,sourceForYaml:n}=t;if(t.all)return {targets:e.subPacks.map(a=>WG(a,r,n)),isMarketplace:true};if(t.force||!t.tty){let a=e.subPacks.map(l=>({path:l.path,features:HG(l.layout)})).map(l=>` - ${l.path} (${l.features.join(", ")})`).join(`
334
+ `);throw new Error(`Marketplace source with ${e.subPacks.length} sub-packs. Pass --all to install all, or use --path <subpath>:
335
+ ${a}`)}return {targets:e.subPacks.map(i=>WG(i,r,n)),isMarketplace:true}}s(vQ,"selectMarketplace");function MQ(t){let{layout:e,sourceName:r,sourceForYaml:n}=t;if(t.force||!t.tty){let i=e.flatCollections.map(a=>` - ${a.path} (${a.suggestedAs}, .${a.fileShape})`).join(`
336
+ `);throw new Error(`Ambiguous source with ${e.flatCollections.length} resource collections. Pass --as <kind> to select, or --path <subpath>:
337
+ ${i}`)}return {targets:e.flatCollections.map(i=>zG(i,r,n)),isMarketplace:false}}s(MQ,"selectMultipleCollections");fn();SR();function Ec(t){return t==="."||t===""?void 0:t}s(Ec,"trimDot");function GQ(t,e){let r=basename(e).replace(/\.md$/i,"");return t==="agents"?{agents:[r]}:t==="commands"?{commands:[r]}:{rules:[r]}}s(GQ,"markdownPick");async function YG(t){if(!t.as)return {pathInRepo:Ec(t.pathInRepo)};let e=t.pathInRepo.replace(/^\/+|\/+$/g,""),r=await stat(t.contentRoot);if(t.as!=="skills"&&r.isFile()&&t.contentRoot.toLowerCase().endsWith(".md"))return {pathInRepo:Ec(dirname(e)),pick:GQ(t.as,e||t.contentRoot)};if(t.as==="skills"){if(r.isFile()&&basename(t.contentRoot)==="SKILL.md"){let n=e?dirname(e):dirname(t.contentRoot);return {pathInRepo:Ec(dirname(n)),pick:{skills:[basename(n)]}}}if(r.isDirectory()){let n=e||basename(t.contentRoot),o=join(t.contentRoot.replace(/\/+$/g,""),"SKILL.md");try{if((await stat(o)).isFile()){let a=await qd(o);return {pathInRepo:Ec(dirname(n)),pick:{skills:[a||basename(n)]}}}}catch{return {pathInRepo:Ec(e)}}}}return {pathInRepo:Ec(e)}}s(YG,"resolveManualInstallPersistence");fo();ot();ot();async function vf(t,e,r){let n=t==="install"?"Pack is installed":"Uninstall is committed",o=e==="global"?" --global":"";try{let i=await _c(e==="global"?{global:!0}:{},r,{printMatrix:!1});Rc(i),i.exitCode!==0&&y.warn(`Generate failed after ${t}. ${n}; run agentsmesh generate${o}.`);}catch(i){let a=i instanceof Error?i.message:String(i);y.warn(`Generate failed after ${t}: ${a}`),y.warn(`${n}; run agentsmesh generate${o} after resolving the issue.`);}}s(vf,"runPostOperationGenerate");async function go(t){return process.stdin.isTTY?new Promise(e=>{let r=XG.createInterface({input:process.stdin,output:process.stdout});r.question(`${t} (y/n) `,n=>{r.close();let o=n.trim().toLowerCase();e(o==="y"||o==="yes");});}):false}s(go,"confirm");function jQ(t){return !!(t.skills.length||t.rules.length||t.commands.length||t.agents.length)}s(jQ,"hasArrayResources");function ZG(t){return jQ(t)||t.mcp!==null||t.permissions!==null||t.hooks!==null||t.ignore.length>0}s(ZG,"hasInstallableResources");async function QG(t,e,r,n){let o=t.skills.map(l=>X$(l)),i=o.filter(l=>l.ok).map(l=>l.skill),a=o.filter(l=>!l.ok);if(!e&&!r&&n)for(let l of a)await go(`Include invalid skill "${l.skill.name}" anyway? (${l.reason}). You can fix it later.`)&&i.push(l.skill);else e&&(i=o.map(l=>l.skill));return r&&(i=o.filter(l=>l.ok).map(l=>l.skill)),i}s(QG,"resolveSkillPool");async function qG(t,e,r,n){let o=t.rules.map(l=>Z$(l)),i=o.filter(l=>l.ok).map(l=>l.rule),a=o.filter(l=>!l.ok);if(!e&&!r&&n)for(let l of a)await go(`Include invalid rule "${ne(l.rule)}" anyway? (${l.reason}). You can fix it later.`)&&i.push(l.rule);else e&&(i=o.map(l=>l.rule));return r&&(i=o.filter(l=>l.ok).map(l=>l.rule)),i}s(qG,"resolveRulePool");async function tj(t,e,r,n){let o=t.commands.map(l=>Q$(l)),i=o.filter(l=>l.ok).map(l=>l.command),a=o.filter(l=>!l.ok);if(!e&&!r&&n)for(let l of a)await go(`Include invalid command "${l.command.name}" anyway? (${l.reason}). You can fix it later.`)&&i.push(l.command);else e&&(i=o.map(l=>l.command));return r&&(i=o.filter(l=>l.ok).map(l=>l.command)),i}s(tj,"resolveCommandPool");async function ej(t,e,r,n){let o=t.agents.map(l=>q$(l)),i=o.filter(l=>l.ok).map(l=>l.agent),a=o.filter(l=>!l.ok);if(!e&&!r&&n)for(let l of a)await go(`Include invalid agent "${l.agent.name}" anyway? (${l.reason}). You can fix it later.`)&&i.push(l.agent);else e&&(i=o.map(l=>l.agent));return r&&(i=o.filter(l=>l.ok).map(l=>l.agent)),i}s(ej,"resolveAgentPool");async function rj(t,e){let r=e.skills.map(a=>a.name),n=e.rules.map(a=>ne(a)),o=e.commands.map(a=>a.name),i=e.agents.map(a=>a.name);for(let a of e.skills)t.skills.some(l=>l.name===a.name)&&(await go(`Skill "${a.name}" already exists in merged config. Add extend anyway?`)||(r=r.filter(c=>c!==a.name)));for(let a of e.rules){let l=ne(a);t.rules.some(c=>ne(c)===l)&&(await go(`Rule "${l}" already exists in merged config. Add extend anyway?`)||(n=n.filter(m=>m!==l)));}for(let a of e.commands)t.commands.some(l=>l.name===a.name)&&(await go(`Command "${a.name}" already exists in merged config. Add extend anyway?`)||(o=o.filter(c=>c!==a.name)));for(let a of e.agents)t.agents.some(l=>l.name===a.name)&&(await go(`Agent "${a.name}" already exists in merged config. Add extend anyway?`)||(i=i.filter(c=>c!==a.name)));return {skillNames:r,ruleSlugs:n,commandNames:o,agentNames:i}}s(rj,"resolveInstallConflicts");function nj(t,e){if(!t)return;let r={},n=t.skills?.filter(l=>e.skillNames.includes(l)),o=t.rules?.filter(l=>e.ruleSlugs.includes(l)),i=t.commands?.filter(l=>e.commandNames.includes(l)),a=t.agents?.filter(l=>e.agentNames.includes(l));return n&&n.length>0&&(r.skills=n),o&&o.length>0&&(r.rules=o),i&&i.length>0&&(r.commands=i),a&&a.length>0&&(r.agents=a),Object.keys(r).length>0?r:void 0}s(nj,"pickForSelectedResources");function UQ(t,e){let r=t.split("/").filter(Boolean);return r.length>0&&r[r.length-1]===e}s(UQ,"pathEndsWithName");function Mf(t,e,r){return r!==1||e.length!==1?false:UQ(t,e[0])}s(Mf,"inferSingleNamePick");function oj(t){let{pathInRepo:e,implicitPick:r,preConflictCounts:n,selected:o}=t,i={},a=o.skillNames.length>0&&(!!r?.skills?.length||o.skillNames.length<n.skills||Mf(e,o.skillNames,n.skills)),l=o.ruleSlugs.length>0&&(!!r?.rules?.length||o.ruleSlugs.length<n.rules||Mf(e,o.ruleSlugs,n.rules)),c=o.commandNames.length>0&&(!!r?.commands?.length||o.commandNames.length<n.commands||Mf(e,o.commandNames,n.commands)),m=o.agentNames.length>0&&(!!r?.agents?.length||o.agentNames.length<n.agents||Mf(e,o.agentNames,n.agents));return a&&(i.skills=[...o.skillNames]),l&&(i.rules=[...o.ruleSlugs]),c&&(i.commands=[...o.commandNames]),m&&(i.agents=[...o.agentNames]),Object.keys(i).length?i:void 0}s(oj,"buildInstallPick");function sj(t,e){let r=new Set(t);return e.skillNames.length===0&&r.delete("skills"),e.ruleSlugs.length===0&&r.delete("rules"),e.commandNames.length===0&&r.delete("commands"),e.agentNames.length===0&&r.delete("agents"),[...r]}s(sj,"deriveInstallFeatures");function BQ(t){return t.skillNames.length===0&&t.ruleSlugs.length===0&&t.commandNames.length===0&&t.agentNames.length===0}s(BQ,"isEmptyInstallSelection");function ij(t){let{selected:e,discoveredFeatures:r,preConflict:n}=t,o=s(l=>r.includes(l),"had"),i=o("skills")&&e.skillNames.length===0&&n.skills>0&&"skills"||o("rules")&&e.ruleSlugs.length===0&&n.rules>0&&"rules"||o("commands")&&e.commandNames.length===0&&n.commands>0&&"commands"||o("agents")&&e.agentNames.length===0&&n.agents>0&&"agents";if(i)throw new Error(`No ${i} selected to install.`);let a=r.some(l=>["mcp","permissions","hooks","ignore"].includes(l));if(BQ(e)&&!a)throw new Error("No resources selected to install.")}s(ij,"ensureInstallSelection");Ro();function aj(t,e){if(t.find(n=>n.name===e.name&&n.source!==e.source))throw new Error(`Extends entry "${e.name}" already exists with a different source. Use --name to provide a different name.`)}s(aj,"assertExtendNameAvailable");function KQ(t,e,r){if(r===void 0){if(!t)return;let o={...t};for(let i of ["skills","commands","rules","agents"])e.includes(i)&&delete o[i];return Object.keys(o).length?o:void 0}let n={...t};for(let o of ["skills","commands","rules","agents"]){if(!(o in r))continue;let i=r[o];if(i===void 0||i.length===0){delete n[o];continue}n[o]=[...new Set([...t?.[o]??[],...i])];}return Object.keys(n).length?n:void 0}s(KQ,"mergePick");function lj(t,e){let r=t.findIndex(a=>a.source===e.source);if(r<0)return [...t,{name:e.name,source:e.source,version:e.version,features:e.features,path:e.path,pick:e.pick,target:e.target,as:e.as}];let n=t[r],o=[...new Set([...n.features,...e.features])],i=KQ(n.pick,e.features,e.pick);return t.map((a,l)=>l===r?{name:e.name,source:e.source,version:e.version??n.version,features:o,path:e.path!==void 0?e.path:n.path,pick:i,target:e.target??n.target,as:e.as??n.as}:a)}s(lj,"mergeExtendList");w();async function cj(t,e,r){let n=await _(t);if(n===null)throw new Error(`Missing config: ${t}`);let o=parse(n),i=lj(e.extends,r);o.extends=i;let a=stringify(o,{indent:2,lineWidth:0});await I(t,a.endsWith(`
319
338
  `)?a:`${a}
320
- `);}s(JG,"writeAgentsmeshWithNewExtend");ft();async function YG(t){let{configDir:e,config:r,entryArgs:o,dryRun:n}=t,i=OY(o);if(zG(r.extends,i),n){I.info(`[dry-run] Would add extend:
321
- ${JSON.stringify(i,null,2)}`);return}let a=join(e,"agentsmesh.yaml");await JG(a,r,i),I.success(`Wrote extends entry "${i.name}" to agentsmesh.yaml.`);}s(YG,"writeInstallAsExtend");function OY(t){return {name:t.name,source:t.source,version:t.version,features:t.features,path:t.path,pick:t.pick,target:t.yamlTarget!==void 0?ze.parse(t.yamlTarget):void 0}}s(OY,"toNewExtendEntry");T();T();var AY="pack.yaml";async function og(t){let e=await v(t),r=[];for(let i of e.sort()){let a=relative(t,i).replace(/\\/g,"/");if(a===AY)continue;let c=await xd(i);c!==null&&r.push(`${a}:${c}`);}let o=r.join(`
322
- `);return `sha256:${xm(o)}`}s(og,"hashPackContent");async function bY(t,e){if(t.rules.length===0)return;let r=join(e,"rules");await L(r);for(let o of t.rules){let n=join(r,basename(o.source));await copyFile(o.source,n);}}s(bY,"writeRules");async function PY(t,e){if(t.commands.length===0)return;let r=join(e,"commands");await L(r);for(let o of t.commands){let n=join(r,basename(o.source));await copyFile(o.source,n);}}s(PY,"writeCommands");async function xY(t,e){if(t.agents.length===0)return;let r=join(e,"agents");await L(r);for(let o of t.agents){let n=join(r,basename(o.source));await copyFile(o.source,n);}}s(xY,"writeAgents");async function DY(t,e){if(t.skills.length===0)return;let r=join(e,"skills");await L(r);for(let o of t.skills){let n=join(r,o.name);await L(n),await copyFile(o.source,join(n,"SKILL.md"));for(let i of o.supportingFiles){let a=join(n,i.relativePath);await L(dirname(a)),await copyFile(i.absolutePath,a);}}}s(DY,"writeSkills");async function NY(t,e){t.mcp!==null&&await _(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
323
- `),t.permissions!==null&&await _(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await _(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await _(join(e,"ignore"),`${t.ignore.join(`
339
+ `);}s(cj,"writeAgentsmeshWithNewExtend");ot();async function mj(t){let{configDir:e,config:r,entryArgs:n,dryRun:o}=t,i=VQ(n);if(aj(r.extends,i),o){y.info(`[dry-run] Would add extend:
340
+ ${JSON.stringify(i,null,2)}`);return}let a=join(e,"agentsmesh.yaml");await cj(a,r,i),y.success(`Wrote extends entry "${i.name}" to agentsmesh.yaml.`);}s(mj,"writeInstallAsExtend");function VQ(t){return {name:t.name,source:t.source,version:t.version,features:t.features,path:t.path,pick:t.pick,target:t.yamlTarget!==void 0?Qe.parse(t.yamlTarget):void 0,as:t.as}}s(VQ,"toNewExtendEntry");w();w();var YQ="pack.yaml";async function $f(t){let e=await v(t),r=[];for(let i of e.sort()){let a=relative(t,i).replace(/\\/g,"/");if(a===YQ)continue;let l=await lf(i);l!==null&&r.push(`${a}:${l}`);}let n=r.join(`
341
+ `);return `sha256:${af(n)}`}s($f,"hashPackContent");w();var hn=".agentsmesh-install-manifest.json",ZQ=["pack.yaml",hn];z.object({name:z.string().min(1),source:z.string().min(1),installed_at:z.string().min(1),extends_id:z.string().nullable(),source_type:z.enum(["anthropic-skill-pack","canonical-agentsmesh","tool-native","unknown"]).nullable(),files:z.record(z.string().min(1),z.string().regex(/^sha256:[0-9a-f]{64}$/))});function QQ(t,e){return relative(t,e).replaceAll("\\","/")}s(QQ,"toForwardSlashRelative");async function Gf(t){let e=await Ya(t),r=[];for(let n of e){let o=QQ(t,n);if(ZQ.includes(o))continue;let i=await cf(n);i!==null&&r.push([o,`sha256:${i}`]);}return r.sort(([n],[o])=>n.localeCompare(o)),Object.fromEntries(r)}s(Gf,"hashPackFiles");w();var qQ=/spdx-license-identifier:\s*([A-Za-z0-9.+-]+)/i,tq=[{id:"BSD-3-Clause",pattern:/redistribution and use in source and binary forms[\s\S]+?neither the name of[\s\S]+?contributors/i},{id:"BSD-2-Clause",pattern:/redistribution and use in source and binary forms/i},{id:"AGPL-3.0",pattern:/gnu affero general public license[\s\S]+?version 3/i},{id:"LGPL-3.0",pattern:/gnu lesser general public license[\s\S]+?version 3/i},{id:"LGPL-2.1",pattern:/gnu lesser general public license[\s\S]+?version 2\.1/i},{id:"GPL-3.0",pattern:/gnu general public license[\s\S]+?version 3/i},{id:"GPL-2.0",pattern:/gnu general public license[\s\S]+?version 2/i},{id:"MPL-2.0",pattern:/mozilla public license[\s\S]+?version 2\.0/i},{id:"Apache-2.0",pattern:/apache license[\s\S]+?version 2\.0/i},{id:"MIT",pattern:/permission is hereby granted, free of charge, to any person obtaining a copy/i},{id:"ISC",pattern:/permission to use, copy, modify,? and\/or distribute this software/i},{id:"Unlicense",pattern:/this is free and unencumbered software released into the public domain/i},{id:"CC0-1.0",pattern:/cc0 1\.0 universal/i}];function pj(t){if(t.trim().length===0)return null;let e=qQ.exec(t);if(e)return e[1]??null;for(let{id:r,pattern:n}of tq)if(n.test(t))return r;return null}s(pj,"detectSpdxLicense");var rq=["LICENSE","COPYING","NOTICE","COPYRIGHT"],nq=["",".md",".txt",".rst"];async function uj(t){for(let e of rq)for(let r of nq){let n=await _(join(t,`${e}${r}`));if(n===null)continue;let o=pj(n);if(o!==null)return o}return null}s(uj,"detectLicenseInPackDir");async function iq(t,e){if(t.rules.length===0)return;let r=join(e,"rules");await O(r);for(let n of t.rules){let o=join(r,basename(n.source));await copyFile(n.source,o);}}s(iq,"writeRules");async function aq(t,e){if(t.commands.length===0)return;let r=join(e,"commands");await O(r);for(let n of t.commands){let o=join(r,basename(n.source));await copyFile(n.source,o);}}s(aq,"writeCommands");async function lq(t,e){if(t.agents.length===0)return;let r=join(e,"agents");await O(r);for(let n of t.agents){let o=join(r,basename(n.source));await copyFile(n.source,o);}}s(lq,"writeAgents");async function cq(t,e){if(t.skills.length===0)return;let r=join(e,"skills");await O(r);for(let n of t.skills){let o=join(r,n.name);await O(o),await copyFile(n.source,join(o,"SKILL.md"));for(let i of n.supportingFiles){let a=join(o,i.relativePath);await O(dirname(a)),await copyFile(i.absolutePath,a);}}}s(cq,"writeSkills");async function mq(t,e){for(let r of t)await copyFile(r.absolutePath,join(e,r.relativePath));}s(mq,"writePreservedRootFiles");async function pq(t,e){t.mcp!==null&&await I(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
342
+ `),t.permissions!==null&&await I(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await I(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await I(join(e,"ignore"),`${t.ignore.join(`
343
+ `)}
344
+ `);}s(pq,"writeSettings");function uq(t){if(t.includes("/")||t.includes("\\")||t===".."||t==="."||t.includes("\0"))throw new Error(`Invalid pack name "${t}". Pack names must be a single directory segment without path separators.`)}s(uq,"validatePackName");async function dq(t,e,r){let n=await Gf(t),o=u$({name:e.name,source:e.source,installed_at:e.installed_at,extends_id:r.extends_id??null,source_type:r.source_type??null,files:n},"install-manifest");await I(join(t,hn),`${JSON.stringify(o,null,2)}
345
+ `);}s(dq,"writeInstallManifest");async function dj(t,e,r,n,o={},i=[]){uq(e);let a=join(t,`${e}.tmp`),l=join(t,`${e}.old`),c=join(t,e);await $(a)&&await rm(a,{recursive:true,force:true}),await $(l)&&await rm(l,{recursive:true,force:true});let m,p=false;try{await O(a),await iq(r,a),await aq(r,a),await lq(r,a),await cq(r,a),await pq(r,a),await mq(i,a);let u=await $f(a),f=await uj(a);m=gi({...n,content_hash:u,license:f}),await I(join(a,"pack.yaml"),Da(stringify(m),"pack")),await dq(a,m,o),await mkdir(t,{recursive:!0}),await $(c)&&(await rename(c,l),p=!0);try{await rename(a,c);}catch(g){throw p&&(await rename(l,c).catch(()=>{}),p=!1),g}}catch(u){throw await rm(a,{recursive:true,force:true}).catch(()=>{}),u}return p&&await rm(l,{recursive:true,force:true}).catch(()=>{}),m}s(dj,"materializePack");fc();w();function MI(t,e){return [...new Set([...t,...e])]}s(MI,"union");function gq(t,e){if(t.path===void 0&&t.paths===void 0||e===void 0)return {path:void 0,paths:void 0};let n=MI(t.paths??(t.path?[t.path]:[]),[e]);return n.length===1?{path:n[0],paths:void 0}:{path:void 0,paths:n}}s(gq,"mergePathScope");function hq(t,e,r){let n={...t};for(let i of e)r&&r[i]!==void 0?n[i]=MI(n[i]??[],r[i]):delete n[i];return (n.skills?.length??0)>0||(n.rules?.length??0)>0||(n.commands?.length??0)>0||(n.agents?.length??0)>0?n:void 0}s(hq,"mergePick");async function yq(t,e){if(t.rules.length===0)return;let r=join(e,"rules");await O(r);for(let n of t.rules)await copyFile(n.source,join(r,basename(n.source)));}s(yq,"mergeRules");async function _q(t,e){if(t.commands.length===0)return;let r=join(e,"commands");await O(r);for(let n of t.commands)await copyFile(n.source,join(r,basename(n.source)));}s(_q,"mergeCommands");async function Rq(t,e){if(t.agents.length===0)return;let r=join(e,"agents");await O(r);for(let n of t.agents)await copyFile(n.source,join(r,basename(n.source)));}s(Rq,"mergeAgents");async function Iq(t,e){if(t.skills.length===0)return;let r=join(e,"skills");await O(r);for(let n of t.skills){let o=join(r,n.name);await O(o),await copyFile(n.source,join(o,"SKILL.md"));for(let i of n.supportingFiles){let a=join(o,i.relativePath);await O(dirname(a)),await copyFile(i.absolutePath,a);}}}s(Iq,"mergeSkills");async function Sq(t,e){for(let r of t)await copyFile(r.absolutePath,join(e,r.relativePath));}s(Sq,"mergePreservedRootFiles");async function Cq(t,e){t.mcp!==null&&await I(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
346
+ `),t.permissions!==null&&await I(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await I(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await I(join(e,"ignore"),`${t.ignore.join(`
347
+ `)}
348
+ `);}s(Cq,"mergeSettings");async function fj(t,e,r,n,o,i,a=[]){await yq(r,t),await _q(r,t),await Rq(r,t),await Iq(r,t),await Cq(r,t),await Sq(a,t);let l=MI(e.features,n),c=hq(e.pick,n,o),m=gq(e,i?.path),p=await $f(t),u=new Date().toISOString(),f=gi({...e,source:i?.source??e.source,...i?.version!==void 0?{version:i.version}:e.version!==void 0?{version:e.version}:{},features:l,pick:c,...i?.target!==void 0?{target:i.target}:e.target!==void 0?{target:e.target}:{},...m,...i?.as!==void 0?{as:i.as}:e.as!==void 0?{as:e.as}:{},updated_at:u,content_hash:p});return await I(join(t,"pack.yaml"),Da(stringify(f),"pack")),f}s(fj,"mergeIntoPack");Cg();Co();async function gj(t){let e=[];try{let r=await readdir(t,{withFileTypes:!0});for(let n of r)n.isFile()&&Gp(n.name)&&e.push({relativePath:n.name,absolutePath:join(t,n.name)});}catch{return []}return e.sort((r,n)=>r.relativePath.localeCompare(n.relativePath)),e}s(gj,"collectPreservedRootFiles");Ro();ot();Ro();w();nf();function Oq(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}s(Oq,"sanitize");function Aq(t){try{let r=new URL(t.replace(/^git\+/,"https://").replace(/^ssh:\/\/git@/,"https://")).pathname.split("/").filter(Boolean);if(r.length===0)return "repo";let n=r[r.length-1].replace(/\.git$/i,"");return r.length>=2?`${r[r.length-2].replace(/\.git$/i,"")}-${n}`:n}catch{return "repo"}}s(Aq,"gitUrlLastSegments");function hj(t,e,r){let n;if(t.kind==="local"){let l=(t.localRoot??"local").split(/[/\\]/).filter(Boolean);n=l[l.length-1]??"local";}else t.kind==="github"&&t.org&&t.repo?n=`${t.org}-${t.repo}`:t.kind==="gitlab"&&t.org&&t.repo?n=`${t.org.replace(/\//g,"-")}-${t.repo}`:t.gitRemoteUrl?n=Aq(t.gitRemoteUrl):n="extend";e.featureHint?n=`${n}-${e.featureHint}`:n=`${n}-pack`;let o=Oq(n)||"extend";if(!r.has(o))return o;let i=2;for(;r.has(`${o}-${i}`);)i++;return `${o}-${i}`}s(hj,"suggestExtendName");function yj(t){let{config:e,parsed:r,entryFeatures:n,nameOverride:o}=t,i=new Set(e.extends.map(a=>a.name));return o||hj(r,{featureHint:n.length===1?n[0]:void 0},i)}s(yj,"selectInstallEntryName");function _j(t){let e=t.trim();for(;e.startsWith("git+");){let c=e.lastIndexOf("#");e=(c<0?e.slice(4):e.slice(4,c)).trim();}let r=e.match(/^github:([^/]+)\/([^/@]+?)(?:\.git)?(?:@[^/]+)?$/i);if(r)return `github:${r[1].toLowerCase()}/${r[2].toLowerCase()}`;let n=e.match(/^gitlab:(.+?)\/([^/@]+?)(?:\.git)?(?:@[^/]+)?$/i);if(n)return `gitlab:${n[1].toLowerCase()}/${n[2].toLowerCase()}`;let o=e.match(/^https?:\/\/github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/i);if(o)return `github:${o[1].toLowerCase()}/${o[2].toLowerCase()}`;let i=e.match(/^https?:\/\/gitlab\.com\/(.+?)\/([^/?#]+?)(?:\.git)?(?:[/?#].*)?$/i);if(i)return `gitlab:${i[1].toLowerCase()}/${i[2].toLowerCase()}`;let a=e.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/i);if(a)return `github:${a[1].toLowerCase()}/${a[2].toLowerCase()}`;let l=e.match(/^git@gitlab\.com:(.+?)\/([^/]+?)(?:\.git)?$/i);return l?`gitlab:${l[1].toLowerCase()}/${l[2].toLowerCase()}`:null}s(_j,"canonicalRemoteIdentity");function wq(t){return t.kind==="github"&&t.org&&t.repo?`github:${t.org.toLowerCase()}/${t.repo.toLowerCase()}`:t.kind==="gitlab"&&t.org&&t.repo?`gitlab:${t.org.toLowerCase()}/${t.repo.toLowerCase()}`:t.gitRemoteUrl?_j(t.gitRemoteUrl):null}s(wq,"parsedSourceIdentity");function Rj(t,e){let r=wq(e);if(r===null)return null;for(let n of t){let o=_j(n.source);if(o!==null&&o===r)return n.name}return null}s(Rj,"findExistingInstallName");function $I(t,e){if(t.length!==e.length)return false;let r=[...t].sort(),n=[...e].sort();for(let o=0;o<r.length;o++)if(r[o]!==n[o])return false;return true}s($I,"sameFeatureSet");function Ij(t){let{manifest:e,parsed:r,entryFeatures:n,yamlTarget:o,explicitAs:i}=t,a=Rj(e,r);if(a===null)return null;let l=e.find(c=>c.name===a);return l.target!==o||l.as!==i||!$I(l.features,n)?null:l.name}s(Ij,"pickReuseEntryName");var Cj=z.object({name:z.string().min(1),source:z.string().min(1),version:z.string().optional(),source_kind:z.enum(["github","gitlab","git","local"]),features:z.array(Xa).min(1),pick:Mc.optional(),target:Qe.optional(),path:z.string().optional(),paths:z.array(z.string().min(1)).min(1).optional(),as:dc.optional()}),Tq=z.object({version:z.literal(1),installs:z.array(Cj).default([])});function xq(t,e){return t.source===e.source&&t.target===e.target&&t.as===e.as&&$I(t.features,e.features)}s(xq,"sameInstallIdentity");function GI(t){return join(t,"installs.yaml")}s(GI,"manifestPath");async function ho(t){let e=await _(GI(t));if(e===null)return [];try{return Tq.parse(parse(e)).installs.map(r=>gi(r))}catch{return []}}s(ho,"readInstallManifest");async function kj(t,e){let r=gi(e),o=(await ho(t)).filter(i=>i.name!==r.name&&!xq(i,r));o.push(r),await I(GI(t),Da(stringify({version:1,installs:o.sort((i,a)=>i.name.localeCompare(a.name))}),"installs"));}s(kj,"upsertInstallManifestEntry");async function Ej(t,e){let r=await ho(t),n=r.filter(o=>o.name!==e);return n.length===r.length?false:(await I(GI(t),Da(stringify({version:1,installs:n.sort((o,i)=>o.name.localeCompare(i.name))}),"installs")),true)}s(Ej,"removeInstallManifestEntry");function Lj(t){return gi(Cj.parse({name:t.name,source:t.source,version:t.version,source_kind:t.sourceKind,features:t.features,pick:t.pick,target:t.target,path:t.path,paths:t.paths,as:t.as}))}s(Lj,"buildInstallManifestEntry");w();function Nq(t){return t?{path:t,paths:void 0}:{path:void 0,paths:void 0}}s(Nq,"pathScope");function Fq(t,e){let r=new Set(e.skillNames),n=new Set(e.ruleSlugs),o=new Set(e.commandNames),i=new Set(e.agentNames);return {...t,skills:t.skills.filter(a=>r.has(a.name)),rules:t.rules.filter(a=>n.has(ne(a))),commands:t.commands.filter(a=>o.has(a.name)),agents:t.agents.filter(a=>i.has(a.name))}}s(Fq,"applySelection");async function Oj(t){let{canonicalDir:e,packName:r,narrowed:n,selected:o,sourceForYaml:i,version:a,sourceKind:l,entryFeatures:c,pick:m,yamlTarget:p,pathInRepo:u,manualAs:f,renameExistingPack:g,sourceType:h,contentRoot:R}=t,C=join(e,"packs"),S=Fq(n,o),k=R?await gj(R):[],P=new Date().toISOString(),N=p!==void 0?Qe.parse(p):void 0,F=await sM(C,i,{target:N,as:f,features:c}),W=r,z=c,Q=m,at=u,At;if(F){let wt=F.packDir,oe=F.meta;if(g&&F.name!==r){let Dt=join(C,r);if(await $(Dt))throw new Error(`Auto-generated pack name "${r}" collides with an existing incompatible pack. Use --name to choose a different pack name.`);await rename(F.packDir,Dt),wt=Dt,oe={...F.meta,name:r};}let Dr=await fj(wt,oe,S,c,m,{source:i,...a!==void 0?{version:a}:{},...N!==void 0?{target:N}:{},...u?{path:u}:{},...f!==void 0?{as:f}:{}},k);W=Dr.name,z=Dr.features,Q=Dr.pick,at=Dr.path,At=Dr.paths,y.success(`Updated pack "${Dr.name}" in .agentsmesh/packs/.`);}else {if(await fi(join(C,r)))throw new Error(`Auto-generated pack name "${r}" collides with an existing incompatible pack. Use --name to choose a different pack name.`);await dj(C,r,S,{name:r,source:i,...a!==void 0&&{version:a},source_kind:l,installed_at:P,updated_at:P,features:c,...m!==void 0&&{pick:m},...N!==void 0&&{target:N},...Nq(u),...f!==void 0&&{as:f}},h!==void 0?{source_type:h}:{},k),y.success(`Installed pack "${r}" to .agentsmesh/packs/.`);}await kj(e,Lj({name:W,source:i,version:a,sourceKind:l,features:z,pick:Q,target:N,path:at,paths:At,as:f})),l!=="local"&&await rC(i);}s(Oj,"installAsPack");function Aj(t,e,r){if(!r?.features&&!r?.pick)return {narrowed:t,discoveredFeatures:e};let n=Cc(t,{scopedFeatures:r.features,implicitPick:r.pick});return {narrowed:n,discoveredFeatures:gn(n)}}s(Aj,"applyReplayInstallScope");function wj(t,e){let r=[];for(let n of t.skillNames)r.push({kind:"skill",name:n,path:e});for(let n of t.ruleSlugs)r.push({kind:"rule",name:n,path:e});for(let n of t.commandNames)r.push({kind:"command",name:n,path:e});for(let n of t.agentNames)r.push({kind:"agent",name:n,path:e});return r}s(wj,"buildInstalledList");function bj(t,e,r,n,o){let i=[];for(let a of t)o.skillNames.includes(a.name)||i.push({kind:"skill",name:a.name,reason:"conflict"});for(let a of e){let l=ne(a);o.ruleSlugs.includes(l)||i.push({kind:"rule",name:l,reason:"conflict"});}for(let a of r)o.commandNames.includes(a.name)||i.push({kind:"command",name:a.name,reason:"conflict"});for(let a of n)o.agentNames.includes(a.name)||i.push({kind:"agent",name:a.name,reason:"conflict"});return i}s(bj,"buildSkippedList");async function Pj(t){let{scope:e,force:r,dryRun:n,tty:o,useExtends:i,nameOverride:a,explicitAs:l}=t,{config:c,context:m,parsed:p,sourceForYaml:u,version:f,pathInRepo:g,contentRoot:h,persisted:R}=t,{replay:C,prep:S,implicitPick:k,narrowed:P,discoveredFeatures:N,sourceType:F}=t,{narrowed:W,discoveredFeatures:z}=Aj(P,N,C);if(!ZG(W))throw new Error(k||S.scopedFeatures?"No resources match the install path or implicit selection (check pick names exist at that path).":"No supported resources found to install (skills, rules, commands, agents).");let Q=await QG(W,r,n,o),at=await qG(W,r,n,o),At=await tj(W,r,n,o),wt=await ej(W,r,n,o),oe={skills:Q.length,rules:at.length,commands:At.length,agents:wt.length},{canonical:Dr}=await ke(c,m.configDir,{},m.canonicalDir),Dt=!r&&!n&&o?await rj(Dr,{skills:Q,rules:at,commands:At,agents:wt}):{skillNames:Q.map(Ss=>Ss.name),ruleSlugs:at.map(Ss=>ne(Ss)),commandNames:At.map(Ss=>Ss.name),agentNames:wt.map(Ss=>Ss.name)};ij({selected:Dt,discoveredFeatures:z,preConflict:oe});let Ze=C?.features??sj(z,Dt);if(Ze.length===0)throw new Error("No features left to install after selection.");let ja=nj(C?.pick,Dt)??R.pick??oj({pathInRepo:R.pathInRepo??g,implicitPick:k,preConflictCounts:oe,selected:Dt}),Ua=await ho(m.canonicalDir),Dc=Ij({manifest:Ua,parsed:p,entryFeatures:Ze,yamlTarget:S.yamlTarget,explicitAs:l}),Nc=yj({config:c,parsed:p,entryFeatures:Ze,nameOverride:a||Dc||""}),kp=wj(Dt,Nc),Ba=bj(Q,at,At,wt,Dt);if(i){if(await mj({configDir:m.configDir,config:c,entryArgs:{name:Nc,source:u,version:f,features:Ze,path:R.pathInRepo,pick:ja,yamlTarget:S.yamlTarget,as:l},dryRun:n}),n)return {installed:kp,skipped:Ba}}else {if(n)return y.info(`[dry-run] Would install pack "${Nc}" to ${e==="global"?"~/.agentsmesh/packs/.":".agentsmesh/packs/."}`),{installed:kp,skipped:Ba};await Oj({canonicalDir:m.canonicalDir,packName:Nc,narrowed:W,selected:Dt,sourceForYaml:u,version:f,sourceKind:p.kind,entryFeatures:Ze,pick:ja,yamlTarget:S.yamlTarget,pathInRepo:R.pathInRepo,manualAs:l,renameExistingPack:a===""&&Dc===null,sourceType:F,contentRoot:h});}return await vf("install",e,m.rootBase),{installed:kp,skipped:Ba}}s(Pj,"executeRunInstallPoolsAndWrite");function Uf(t,e){let r=e?.input??process.stdin,n=e?.output??process.stdout;return new Promise(o=>{let i=XG.createInterface({input:r,output:n,terminal:false}),a=false;i.on("close",()=>{a||o("");}),i.question(t,l=>{a=true,i.close(),o(l);});})}s(Uf,"readLine");function xj(t,e){let r=e.resolved.length,n=r===1?"link":"links",o=[`Entity "${e.entityName}" (${e.entityKind}) has ${r} broken ${n}:`];for(let i of e.resolved)o.push(` - ${i.link.path} (${i.classification})`);o.push(""),t.write(`${o.join(`
349
+ `)}
350
+ `);}s(xj,"writeBanner");async function Dj(t,e,r){let n=[];for(let o of t){if(o.resolved.length===0)continue;if(e.bypass){xj(r,o),n.push({entityKind:o.entityKind,entityName:o.entityName,action:"leave-with-warnings"});continue}xj(r,o);let i=(await r.ask("Action: [i]nclude resolvable as supporting files / [l]eave with warnings / [a]bort install ")).trim().toLowerCase();if(i==="i"){n.push({entityKind:o.entityKind,entityName:o.entityName,action:"include-resolvable"});continue}if(i==="l"){n.push({entityKind:o.entityKind,entityName:o.entityName,action:"leave-with-warnings"});continue}return {decisions:[],aborted:true}}return {decisions:n,aborted:false}}s(Dj,"runBrokenLinkPrompt");var UI=["skills","agents","commands","rules"],BI={skills:"skill",agents:"agent",commands:"command",rules:"rule"},vj={skills:"skills",agents:"agents",commands:"commands",rules:"rules"};function va(t){return {skills:[],agents:[],commands:[],rules:[],aborted:t}}s(va,"emptySelection");function Nj(t){return {skills:[...t.skills],agents:[...t.agents],commands:[...t.commands],rules:[...t.rules],aborted:false}}s(Nj,"selectAll");function Fj(t,e,r){let n=[`Found in ${e}:`];for(let o of UI){let i=r[o];if(i.length===0)continue;let a=i.length===1?BI[o]:vj[o];n.push(` - ${i.length} ${a}`);}n.push(""),t.write(`${n.join(`
324
351
  `)}
325
- `);}s(NY,"writeSettings");function FY(t){if(t.includes("/")||t.includes("\\")||t===".."||t==="."||t.includes("\0"))throw new Error(`Invalid pack name "${t}". Pack names must be a single directory segment without path separators.`)}s(FY,"validatePackName");async function ZG(t,e,r,o){FY(e);let n=join(t,`${e}.tmp`),i=join(t,e);await j(n)&&await rm$1(n,{recursive:true,force:true}),await L(n),await bY(r,n),await PY(r,n),await xY(r,n),await DY(r,n),await NY(r,n);let a=await og(n),c=ci({...o,content_hash:a});return await _(join(n,"pack.yaml"),stringify(c)),await j(i)&&await rm$1(i,{recursive:true,force:true}),await mkdir(t,{recursive:true}),await rename(n,i),c}s(ZG,"materializePack");Pd();T();function WI(t,e){return [...new Set([...t,...e])]}s(WI,"union");function GY(t,e){if(t.path===void 0&&t.paths===void 0||e===void 0)return {path:void 0,paths:void 0};let o=WI(t.paths??(t.path?[t.path]:[]),[e]);return o.length===1?{path:o[0],paths:void 0}:{path:void 0,paths:o}}s(GY,"mergePathScope");function MY(t,e,r){let o={...t};for(let i of e)r&&r[i]!==void 0?o[i]=WI(o[i]??[],r[i]):delete o[i];return (o.skills?.length??0)>0||(o.rules?.length??0)>0||(o.commands?.length??0)>0||(o.agents?.length??0)>0?o:void 0}s(MY,"mergePick");async function $Y(t,e){if(t.rules.length===0)return;let r=join(e,"rules");await L(r);for(let o of t.rules)await copyFile(o.source,join(r,basename(o.source)));}s($Y,"mergeRules");async function jY(t,e){if(t.commands.length===0)return;let r=join(e,"commands");await L(r);for(let o of t.commands)await copyFile(o.source,join(r,basename(o.source)));}s(jY,"mergeCommands");async function UY(t,e){if(t.agents.length===0)return;let r=join(e,"agents");await L(r);for(let o of t.agents)await copyFile(o.source,join(r,basename(o.source)));}s(UY,"mergeAgents");async function KY(t,e){if(t.skills.length===0)return;let r=join(e,"skills");await L(r);for(let o of t.skills){let n=join(r,o.name);await L(n),await copyFile(o.source,join(n,"SKILL.md"));for(let i of o.supportingFiles){let a=join(n,i.relativePath);await L(dirname(a)),await copyFile(i.absolutePath,a);}}}s(KY,"mergeSkills");async function BY(t,e){t.mcp!==null&&await _(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
326
- `),t.permissions!==null&&await _(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await _(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await _(join(e,"ignore"),`${t.ignore.join(`
352
+ `);}s(Fj,"writeBanner");async function vq(t,e,r){if(r.length===0)return {selected:[],aborted:false};let n=vj[e],o=(await t.ask(`Install all ${r.length} ${n}? [y/n/c] `)).trim().toLowerCase();if(o==="y")return {selected:[...r],aborted:false};if(o==="n")return {selected:[],aborted:false};if(o!=="c")return {selected:[],aborted:true};let i=BI[e],a=[];for(let l=0;l<r.length;l++){let c=r[l],m=(await t.ask(`Install ${i} "${c}"? [y/N/a/q] `)).trim().toLowerCase();if(m==="y"){a.push(c);continue}if(!(m===""||m==="n")){if(m==="a"){for(let p=l;p<r.length;p++)a.push(r[p]);return {selected:a,aborted:false}}return m==="q"?{selected:a,aborted:false}:{selected:[],aborted:true}}}return {selected:a,aborted:false}}s(vq,"walkType");function Mq(t){let e=null;for(let r of UI)for(let n of t[r]){if(e!==null)return null;e={kind:r,id:n};}return e}s(Mq,"findSingleEntity");async function $q(t,e){let r=BI[e.kind],n=(await t.ask(`Install ${r} "${e.id}"? [y/N] `)).trim().toLowerCase();return n==="y"?{...va(false),[e.kind]:[e.id]}:va(!(n===""||n==="n"))}s($q,"runSingleEntityPrompt");async function Mj(t,e,r){if(e.bypass)return Nj(t);let n=t.skills.length+t.agents.length+t.commands.length+t.rules.length;if(n===0)return va(false);if(n===1){let a=Mq(t);if(a!==null)return Fj(r,e.packName,t),$q(r,a)}Fj(r,e.packName,t);let o=(await r.ask("Install [a]ll, [n]one, or [s]elect per type? [a/n/s] ")).trim().toLowerCase();if(o==="a")return Nj(t);if(o==="n")return va(false);if(o!=="s")return va(true);let i={skills:[],agents:[],commands:[],rules:[]};for(let a of UI){let{selected:l,aborted:c}=await vq(r,a,t[a]);if(c)return va(true);i[a]=l;}return {...i,aborted:false}}s(Mj,"runBulkPrompt");ot();function Bq(t,e,r){let n=[];for(let o of Nf(t))o.destination===e&&n.push({offset:o.destinationOffset,length:o.destinationLength,replacement:r});return n}s(Bq,"buildLinkRewrites");function Gj(t,e,r){t.warn(`Broken link in ${e.entityKind} "${e.entityName}": ${r.link.path} (${r.classification})`);}s(Gj,"warnLink");function Kq(t){let e=new Map;for(let n of t){let o=basename(n.resolvedRelative),i=e.get(o)??new Set;i.add(n.resolvedRelative),e.set(o,i);}let r=new Map;for(let[n,o]of e){if(o.size===1){let i=[...o][0];r.set(i,`references/${n}`);continue}for(let i of o){let a=i.replaceAll("/","-");r.set(i,`references/${a}`);}}return r}s(Kq,"allocateSupportingFileNames");function $j(t,e,r){return t.find(n=>n.entityKind===e&&n.entityName===r)}s($j,"findEntity");async function Wq(t,e,r,n){let o=[...e],i=new Set(o.map(l=>l.relativePath)),a=new Set;for(let l of r){if(a.has(l.resolvedRelative))continue;a.add(l.resolvedRelative);let c=n.get(l.resolvedRelative);if(c===void 0||i.has(c))continue;i.add(c);let m=posix.join(t.replaceAll("\\","/"),l.resolvedRelative);o.push({relativePath:c,absolutePath:m,content:await readFile(m,"utf-8")});}return o}s(Wq,"buildSupportingFiles");async function Hq(t,e,r,n){let o=r.resolved.filter(p=>p.classification==="resolvable-outside"),i=Kq(o),a=await Wq(t,e.supportingFiles,o,i),l=[],c=new Set;for(let p of r.resolved)if(p.classification==="resolvable-outside"){if(c.has(p.link.raw))continue;let u=i.get(p.resolvedRelative);if(u===void 0)continue;c.add(p.link.raw);let f=`./${u}${p.anchor}`;l.push(...Bq(e.body,p.link.raw,f));}else Gj(n,r,p);let m=NG(e.body,l);return {...e,body:m,supportingFiles:a}}s(Hq,"applySkillDecision");async function jj(t){let{contentRoot:e,aggregate:r,decisions:n,logger:o}=t;if(n.length===0)return r;let i=new Set;for(let l of n)l.entityKind==="skill"&&l.action==="include-resolvable"&&i.add(l.entityName);let a=[];for(let l of r.skills){let c=i.has(l.name)?$j(r.brokenLinks,"skill",l.name):void 0;a.push(c?await Hq(e,l,c,o):l);}for(let l of n){if(l.entityKind==="skill"&&l.action==="include-resolvable")continue;let c=$j(r.brokenLinks,l.entityKind,l.entityName);if(c)for(let m of c.resolved)Gj(o,c,m);}return {...r,skills:a}}s(jj,"applyBrokenLinkDecisions");var Ac=class extends Error{static{s(this,"InstallAbortError");}aborted=true;constructor(e){super(e),this.name="InstallAbortError";}};function Vq(){return {ask:s(t=>Uf(t),"ask"),write:s(t=>process.stdout.write(t),"write")}}s(Vq,"defaultAdapter");function Jq(t){return {skills:t.skills.map(e=>e.name),agents:t.agents.map(e=>e.name),commands:t.commands.map(e=>e.name),rules:t.rules.map(e=>ne(e))}}s(Jq,"bulkCandidatesFrom");function Uj(t,e){let r=new Set(e.skills),n=new Set(e.agents),o=new Set(e.commands),i=new Set(e.rules);return {skills:t.skills.filter(a=>r.has(a.name)),agents:t.agents.filter(a=>n.has(a.name)),commands:t.commands.filter(a=>o.has(a.name)),rules:t.rules.filter(a=>i.has(ne(a))),mcp:null,permissions:null,hooks:null,ignore:[]}}s(Uj,"filterCanonical");function Yq(t){let e=[];return t.skills.length>0&&e.push("skills"),t.rules.length>0&&e.push("rules"),t.commands.length>0&&e.push("commands"),t.agents.length>0&&e.push("agents"),e}s(Yq,"discoveredFeaturesOf");async function Xq(t){let e=t.adapter??Vq(),r=await Dj(t.aggregate.brokenLinks,{bypass:t.bypass},e);if(r.aborted)throw new Ac("User aborted at broken-link prompt.");let n=[...r.decisions],o=await jj({contentRoot:t.contentRoot,aggregate:t.aggregate,decisions:n,logger:y}),i=Jq(o);if(i.skills.length+i.agents.length+i.commands.length+i.rules.length===0)return {aggregate:o,narrowed:Uj(o,{skills:[],agents:[],commands:[],rules:[]}),discoveredFeatures:[]};let l=await Mj(i,{packName:t.displayName,bypass:t.bypass},e);if(l.aborted)throw new Ac("User aborted at bulk-select prompt.");let c=Uj(o,l);return {aggregate:o,narrowed:c,discoveredFeatures:Yq(c)}}s(Xq,"runSkillPackPromptFlow");function Zq(t){return basename(t)||"install source"}s(Zq,"displayNameForContentRoot");async function Bj(t){if(!t.discovery.aggregate)return {aborted:false};try{let e=await Xq({contentRoot:t.contentRoot,aggregate:t.discovery.aggregate,narrowed:t.discovery.narrowed,bypass:t.bypass,displayName:Zq(t.contentRoot)});return {aborted:!1,narrowed:e.narrowed,discoveredFeatures:e.discoveredFeatures}}catch(e){if(e instanceof Ac)return y.warn(e.message),{aborted:true};throw e}}s(Bj,"runPromptFlowWithAbort");async function Kj(t){let{discovery:e,installReport:r,persisted:n,parsed:o,sourceForYaml:i,version:a,pathInRepo:l,contentRoot:c,config:m,context:p,dryRun:u,force:f,useExtends:g,explicitAs:h,nameOverride:R,scope:C,sourceArg:S,replay:k}=t,P=process.stdin.isTTY,{prep:N,implicitPick:F}=e,{narrowed:W,discoveredFeatures:z}=e;try{let Q=await Bj({discovery:e,contentRoot:c,bypass:f||u||!P});if(Q.aborted)return {exitCode:130,data:{source:S,mode:"install",installed:[],skipped:[],dryRun:u}};if(W=Q.narrowed??W,z=Q.discoveredFeatures??z,z.length===0&&r.brokenResources.length>0){let At=r.brokenResources.map(wt=>` - ${wt.path}: ${wt.reason}`).join(`
353
+ `);throw new Error(`No installable resources after skipping invalid files (${r.brokenResources.length}):
354
+ ${At}
355
+ Fix the frontmatter in the source files (most often: unquoted scalars containing colons or square brackets), or narrow --path to a subdirectory that excludes them.`)}let at=await Pj({scope:C,force:f,dryRun:u,tty:P,useExtends:g,nameOverride:R,explicitAs:h,config:m,context:p,parsed:o,sourceForYaml:i,version:a,pathInRepo:l,contentRoot:c,persisted:n,replay:k,prep:N,implicitPick:F,narrowed:W,discoveredFeatures:z,sourceType:e.layout?BG(e.layout):void 0});return {exitCode:0,data:{source:S,mode:"install",installed:at.installed,skipped:at.skipped,dryRun:u,...r.brokenResources.length>0?{brokenResources:r.brokenResources}:{}}}}finally{N.cleanup&&await N.cleanup();}}s(Kj,"runSinglePackInstall");async function Wj(t,e,r){let n=[],o=[],i=0;for(let a of t)try{let l=await e(a);n.push(...l.installed),o.push(...l.skipped),i+=1;}catch(l){let c=l instanceof Error?l.message:String(l);r.subPackFailures.push({name:a.name,path:a.path??".",error:c});}return {exitCode:i>0?0:1,installed:n,skipped:o}}s(Wj,"runInstallMarketplace");async function Hj(t){let{pickerResult:e,installReport:r,sourceArg:n,projectRoot:o,dryRun:i,force:a,useExtends:l,nameOverride:c,replay:m,recurseInstall:p}=t;if(e.isMarketplace&&e.targets.length>0){let u=await Wj(e.targets,async f=>(await p({force:!0,"dry-run":i,path:f.path??"",target:f.target??"",name:f.name,extends:l},[n],o,{})).data,r);return {exitCode:u.exitCode,data:{source:n,mode:"install",installed:u.installed,skipped:u.skipped,dryRun:i,...r.brokenResources.length>0?{brokenResources:r.brokenResources}:{}}}}if(!e.isMarketplace&&e.targets.length===1){let u=e.targets[0];return p({force:a,"dry-run":i,path:u.path??"",as:u.as??"",target:u.target??"",name:c,extends:l},[n],o,m??{})}return null}s(Hj,"routePickerResult");Yt();w();ot();async function qq(t){let e=await ho(t.canonicalDir);if(e.length===0){y.info("No recorded installs found in .agentsmesh/installs.yaml.");return}let r=[];for(let n of e){let o=join(t.canonicalDir,"packs",n.name);await $(o)||r.push(n);}if(r.length===0){y.info("All recorded packs are already installed.");return}for(let n of r)await t.reinstall(n);y.success(`Reinstalled ${r.length} pack(s) from .agentsmesh/installs.yaml.`);}s(qq,"syncInstalledPacks");async function zj(t){return t.sync?(await qq({canonicalDir:t.canonicalDir,reinstall:t.reinstall}),true):false}s(zj,"maybeRunInstallSync");async function Vj(t){let{projectRoot:e,sync:r,dryRun:n,force:o,scope:i,recurseInstall:a}=t;if(!r)return;let{context:l}=await yt(e,i),c=[],m=[];if(await zj({sync:r,canonicalDir:l.canonicalDir,reinstall:s(async u=>{let f=u.paths&&u.paths.length>0?u.paths:[u.path];for(let g of f){let h=await a({...o?{force:true}:{},...n?{"dry-run":true}:{},...i==="global"?{global:true}:{},name:u.name,...u.target?{target:u.target}:{},...g?{path:g}:{},...u.as?{as:u.as}:{}},[u.source],e,{features:u.features,pick:u.pick});c.push(...h.data.installed),m.push(...h.data.skipped);}},"reinstall")}))return {exitCode:0,data:{source:"",mode:"sync",installed:c,skipped:m,dryRun:n}}}s(Vj,"handleSync");function Jj(){return {brokenResources:[],subPackFailures:[]}}s(Jj,"createInstallReport");function r3(t,e){if(!t)return;let r=normalize(t).replace(/\\/g,"/");if(r===".."||r.startsWith("../"))throw new Error(`Install --path "${e}" escapes the source root. Path must stay within the source.`)}s(r3,"assertPathStaysInRepo");async function Yj(t){let e=await Vj(t);if(e)return e;let{projectRoot:r,replay:n,dryRun:o,force:i,useExtends:a,all:l,explicitPath:c,explicitTarget:m,explicitAs:p,nameOverride:u,scope:f,sourceArg:g}=t;if(!g)throw new Error("Missing source. Usage: agentsmesh install <source> [--path ...] [--target ...]");let h=process.stdin.isTTY;if(!h&&!i&&!o)throw new Error("Non-interactive terminal: use --force or --dry-run for agentsmesh install.");let{config:R,context:C}=await yt(r,f);await Wt(R,r);let S=await kI(g,C.configDir,c);if(S.kind!=="local"&&!await W$())throw new Error("git is required for remote installs. Please install git and try again.");let{resolvedPath:k,sourceForYaml:P,version:N}=await V$(S,g),F=S.pathInRepo.replaceAll("\\","/").replace(/^\/+|\/+$/g,"");r3(F,S.pathInRepo);let W=F?join(k,F):k;if(!await $(W))throw new Error(`Install path does not exist: ${W}`);let z=await YG({as:p,contentRoot:W,pathInRepo:F}),Q=Jj(),at={onParseError:s((wt,oe)=>{Q.brokenResources.push({path:oe,kind:"frontmatter",reason:wt.message});},"onParseError")},At=await KG({resolvedPath:k,contentRoot:W,pathInRepo:F,explicitTarget:m,explicitAs:p,replayPick:n?.pick,parseOpts:at});if(At.layout&&!p&&!m&&!c){let wt=VG({layout:At.layout,sourceName:u||(S.org&&S.repo?`${S.org}-${S.repo}`:"source"),sourceForYaml:P,explicitPath:c,explicitAs:p,explicitTarget:m,all:l,force:i,tty:h}),oe=await Hj({pickerResult:wt,installReport:Q,sourceArg:g,projectRoot:r,dryRun:o,force:i,useExtends:a,nameOverride:u,replay:n,recurseInstall:t.recurseInstall});if(oe!==null)return oe}return Kj({discovery:At,installReport:Q,persisted:z,parsed:S,sourceForYaml:P,version:N,pathInRepo:F,contentRoot:W,config:R,context:C,dryRun:o,force:i,useExtends:a,explicitAs:p,nameOverride:u,scope:f,sourceArg:g,replay:n})}s(Yj,"runInstallLocked");async function _p(t,e,r,n){let{sync:o,dryRun:i,force:a,useExtends:l,all:c,explicitPath:m,explicitTarget:p,explicitAs:u,nameOverride:f}=K$(t),g=t.global===true?"global":"project",h=e[0]?.trim(),R;if(n===void 0){let{context:C}=await yt(r,g);R=await wf(C.canonicalDir);}try{return await Yj({args:e,projectRoot:r,replay:n,sync:o,dryRun:i,force:a,useExtends:l,all:c,explicitPath:m,explicitTarget:p,explicitAs:u,nameOverride:f,scope:g,sourceArg:h,recurseInstall:_p})}finally{await R?.();}}s(_p,"runInstall");async function Xj(t,e,r){return _p(t,e,r)}s(Xj,"runInstall");ot();function Zj(t){let{data:e}=t;if(!(e.mode==="sync"&&e.installed.length===0&&e.skipped.length===0)){if(e.installed.length>0&&!e.dryRun){let n=[...new Set(e.installed.map(o=>o.kind))].map(o=>{let i=e.installed.filter(a=>a.kind===o).length;return `${i} ${o}${i>1?"s":""}`}).join(", ");y.success(`Installed ${n}.`);}if(e.skipped.length>0)for(let r of e.skipped)y.warn(`Skipped ${r.kind} "${r.name}": ${r.reason}`);if(e.brokenResources&&e.brokenResources.length>0){let r=e.brokenResources.length;y.warn(`Skipped ${r} file${r>1?"s":""} with invalid frontmatter; see --json for details.`);}}}s(Zj,"renderInstall");Yt();fn();ot();function Qj(t){let e=new Set,r=new Set;for(let n of t)e.has(n)?r.add(n):e.add(n);return [...r]}s(Qj,"detectDuplicates");function Bf(t,e,r,n){let o=[];r.keepGenerated&&o.push(`--keep-generated: target trees will not be re-rendered; generated files derived from "${t}" may remain stale until the next generate.`);let i=r.keepPack||e===null?null:join(r.packsDir,t);return {name:t,packDir:i,manifestEntry:e,extendsEntry:n.get(t)??null,removeGenerated:!r.keepGenerated,warnings:o}}s(Bf,"buildPlan");function qj(t){if(!t.all&&t.names.length===0)throw new Error("uninstall: must provide at least one name or pass --all.");let e=new Map;for(let a of t.extends)e.has(a.name)||e.set(a.name,a);let r=new Map;for(let a of t.installs)r.set(a.name,a);if(t.all){let a=t.installs.map(m=>m.name),l=Qj(a);if(l.length>0)throw new Error(`uninstall --all: installs.yaml has duplicate names: ${l.join(", ")}. Manifest is corrupt; remove the duplicates before retrying.`);let c=t.installs.map(m=>Bf(m.name,m,t,e));for(let m of t.extends)r.has(m.name)||c.push(Bf(m.name,null,t,e));return {removals:c,skipped:[]}}let n=Qj(t.names);if(n.length>0)throw new Error(`uninstall: duplicate names requested: ${n.join(", ")}.`);let o=[],i=[];for(let a of t.names){let l=r.get(a);if(l!==void 0){o.push(Bf(a,l,t,e));continue}if(e.has(a)){o.push(Bf(a,null,t,e));continue}i.push(a);}return {removals:o,skipped:i}}s(qj,"planUninstall");w();w();fc();async function tU(t,e){let r=join(t,hn);if(await $(r))return null;let n=await fi(t);if(n===null)throw new Error(`Cannot migrate legacy pack at ${t}: pack.yaml is missing or invalid; cannot recover install provenance.`);let o=await Gf(t),i={name:n.name,source:n.source,installed_at:n.installed_at,extends_id:null,source_type:null,files:o};return e.dryRun!==true&&await I(r,`${JSON.stringify(i,null,2)}
356
+ `),e.warn(`Legacy pack "${n.name}" detected; generated baseline install manifest from current contents. Local modifications since install cannot be detected.`),{manifest:i,manifestPath:r}}s(tU,"migrateLegacyManifest");w();var i3=["pack.yaml",hn];function a3(t,e){return relative(t,e).replaceAll("\\","/")}s(a3,"toForwardSlashRelative");async function eU(t,e){let r=await Ya(t),n=new Map;for(let i of r){let a=a3(t,i);i3.includes(a)||n.set(a,i);}let o=[];for(let[i,a]of Object.entries(e)){let l=n.get(i);if(l===void 0){o.push({relativePath:i,status:"deleted"});continue}let c=await cf(l);if(c===null){o.push({relativePath:i,status:"deleted"});continue}`sha256:${c}`!==a&&o.push({relativePath:i,status:"modified"});}for(let i of n.keys())i in e||o.push({relativePath:i,status:"added"});return o.sort((i,a)=>i.relativePath<a.relativePath?-1:i.relativePath>a.relativePath?1:0),o}s(eU,"detectModifiedFiles");function rU(t,e){let r=e.modifications.length,n=r===1?"file":"files",o=[`Pack "${e.packName}" has ${r} locally modified ${n}:`];for(let i of e.modifications)o.push(` - ${i.relativePath} (${i.status})`);o.push(""),t.write(`${o.join(`
327
357
  `)}
328
- `);}s(BY,"mergeSettings");async function QG(t,e,r,o,n,i){await $Y(r,t),await jY(r,t),await UY(r,t),await KY(r,t),await BY(r,t);let a=WI(e.features,o),c=MY(e.pick,o,n),l=GY(e,i?.path),m=await og(t),p=new Date().toISOString(),u=ci({...e,source:i?.source??e.source,...i?.version!==void 0?{version:i.version}:e.version!==void 0?{version:e.version}:{},features:a,pick:c,...i?.target!==void 0?{target:i.target}:e.target!==void 0?{target:e.target}:{},...l,...i?.as!==void 0?{as:i.as}:e.as!==void 0?{as:e.as}:{},updated_at:p,content_hash:m});return await _(join(t,"pack.yaml"),stringify(u)),u}s(QG,"mergeIntoPack");Pg();gn();ft();T();function HY(t){return t?{path:t,paths:void 0}:{path:void 0,paths:void 0}}s(HY,"pathScope");function zY(t,e){let r=new Set(e.skillNames),o=new Set(e.ruleSlugs),n=new Set(e.commandNames),i=new Set(e.agentNames);return {...t,skills:t.skills.filter(a=>r.has(a.name)),rules:t.rules.filter(a=>o.has(Ce(a))),commands:t.commands.filter(a=>n.has(a.name)),agents:t.agents.filter(a=>i.has(a.name))}}s(zY,"applySelection");async function qG(t){let{canonicalDir:e,packName:r,narrowed:o,selected:n,sourceForYaml:i,version:a,sourceKind:c,entryFeatures:l,pick:m,yamlTarget:p,pathInRepo:u,manualAs:g,renameExistingPack:f}=t,h=join(e,"packs"),O=zY(o,n),R=new Date().toISOString(),S=p!==void 0?ze.parse(p):void 0,A=await SF(h,i,{target:S,as:g,features:l}),D=r,N=l,G=m,J=u,X;if(A){let q=A.packDir,Ft=A.meta;if(f&&A.name!==r){let co=join(h,r);if(await j(co))throw new Error(`Auto-generated pack name "${r}" collides with an existing incompatible pack. Use --name to choose a different pack name.`);await rename(A.packDir,co),q=co,Ft={...A.meta,name:r};}let Gt=await QG(q,Ft,O,l,m,{source:i,...a!==void 0?{version:a}:{},...S!==void 0?{target:S}:{},...u?{path:u}:{},...g!==void 0?{as:g}:{}});D=Gt.name,N=Gt.features,G=Gt.pick,J=Gt.path,X=Gt.paths,I.success(`Updated pack "${Gt.name}" in .agentsmesh/packs/.`);}else {if(await Td(join(h,r)))throw new Error(`Auto-generated pack name "${r}" collides with an existing incompatible pack. Use --name to choose a different pack name.`);await ZG(h,r,O,{name:r,source:i,...a!==void 0&&{version:a},source_kind:c,installed_at:R,updated_at:R,features:l,...m!==void 0&&{pick:m},...S!==void 0&&{target:S},...HY(u),...g!==void 0&&{as:g}}),I.success(`Installed pack "${r}" to .agentsmesh/packs/.`);}await aG(e,cG({name:D,source:i,version:a,sourceKind:c,features:N,pick:G,target:S,path:J,paths:X,as:g})),c!=="local"&&await nS(i);}s(qG,"installAsPack");function JY(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}s(JY,"sanitize");function YY(t){try{let r=new URL(t.replace(/^git\+/,"https://").replace(/^ssh:\/\/git@/,"https://")).pathname.split("/").filter(Boolean);if(r.length===0)return "repo";let o=r[r.length-1].replace(/\.git$/i,"");return r.length>=2?`${r[r.length-2].replace(/\.git$/i,"")}-${o}`:o}catch{return "repo"}}s(YY,"gitUrlLastSegments");function tM(t,e,r){let o;if(t.kind==="local"){let c=(t.localRoot??"local").split(/[/\\]/).filter(Boolean);o=c[c.length-1]??"local";}else t.kind==="github"&&t.org&&t.repo?o=`${t.org}-${t.repo}`:t.kind==="gitlab"&&t.org&&t.repo?o=`${t.org.replace(/\//g,"-")}-${t.repo}`:t.gitRemoteUrl?o=YY(t.gitRemoteUrl):o="extend";e.featureHint?o=`${o}-${e.featureHint}`:o=`${o}-pack`;let n=JY(o)||"extend";if(!r.has(n))return n;let i=2;for(;r.has(`${n}-${i}`);)i++;return `${n}-${i}`}s(tM,"suggestExtendName");function eM(t){let{config:e,parsed:r,entryFeatures:o,nameOverride:n}=t,i=new Set(e.extends.map(a=>a.name));return n||tM(r,{featureHint:o.length===1?o[0]:void 0},i)}s(eM,"selectInstallEntryName");function rM(t,e,r){if(!r?.features&&!r?.pick)return {narrowed:t,discoveredFeatures:e};let o=sl(t,{scopedFeatures:r.features,implicitPick:r.pick});return {narrowed:o,discoveredFeatures:La(o)}}s(rM,"applyReplayInstallScope");function oM(t,e){let r=[];for(let o of t.skillNames)r.push({kind:"skill",name:o,path:e});for(let o of t.ruleSlugs)r.push({kind:"rule",name:o,path:e});for(let o of t.commandNames)r.push({kind:"command",name:o,path:e});for(let o of t.agentNames)r.push({kind:"agent",name:o,path:e});return r}s(oM,"buildInstalledList");function nM(t,e,r,o,n){let i=[];for(let a of t)n.skillNames.includes(a.name)||i.push({kind:"skill",name:a.name,reason:"conflict"});for(let a of e){let c=Ce(a);n.ruleSlugs.includes(c)||i.push({kind:"rule",name:c,reason:"conflict"});}for(let a of r)n.commandNames.includes(a.name)||i.push({kind:"command",name:a.name,reason:"conflict"});for(let a of o)n.agentNames.includes(a.name)||i.push({kind:"agent",name:a.name,reason:"conflict"});return i}s(nM,"buildSkippedList");async function sM(t){let{scope:e,force:r,dryRun:o,tty:n,useExtends:i,nameOverride:a,explicitAs:c,config:l,context:m,parsed:p,sourceForYaml:u,version:g,pathInRepo:f,persisted:h,replay:O,prep:R,implicitPick:S,narrowed:A,discoveredFeatures:D}=t,{narrowed:N,discoveredFeatures:G}=rM(A,D,O);if(!vG(N))throw new Error(S||R.scopedFeatures?"No resources match the install path or implicit selection (check pick names exist at that path).":"No supported resources found to install (skills, rules, commands, agents).");let J=await GG(N,r,o,n),X=await MG(N,r,o,n),q=await $G(N,r,o,n),Ft=await jG(N,r,o,n),Gt={skills:J.length,rules:X.length,commands:q.length,agents:Ft.length},{canonical:co}=await he(l,m.configDir,{},m.canonicalDir),Ht=!r&&!o&&n?await UG(co,{skills:J,rules:X,commands:q,agents:Ft}):{skillNames:J.map(ys=>ys.name),ruleSlugs:X.map(ys=>Ce(ys)),commandNames:q.map(ys=>ys.name),agentNames:Ft.map(ys=>ys.name)};HG({selected:Ht,discoveredFeatures:G,preConflict:Gt});let lo=O?.features??WG(G,Ht);if(lo.length===0)throw new Error("No features left to install after selection.");let Ut=KG(O?.pick,Ht)??h.pick??BG({pathInRepo:h.pathInRepo??f,implicitPick:S,preConflictCounts:Gt,selected:Ht}),wt=eM({config:l,parsed:p,entryFeatures:lo,nameOverride:a}),pn=oM(Ht,wt),kr=nM(J,X,q,Ft,Ht);if(i){if(await YG({configDir:m.configDir,config:l,entryArgs:{name:wt,source:u,version:g,features:lo,path:h.pathInRepo,pick:Ut,yamlTarget:R.yamlTarget},dryRun:o}),o)return {installed:pn,skipped:kr}}else {if(o)return I.info(`[dry-run] Would install pack "${wt}" to ${e==="global"?"~/.agentsmesh/packs/.":".agentsmesh/packs/."}`),{installed:pn,skipped:kr};await qG({canonicalDir:m.canonicalDir,packName:wt,narrowed:N,selected:Ht,sourceForYaml:u,version:g,sourceKind:p.kind,entryFeatures:lo,pick:Ut,yamlTarget:R.yamlTarget,pathInRepo:h.pathInRepo,manualAs:c,renameExistingPack:a===""});}let hs=await rl(e==="global"?{global:true}:{},m.rootBase);return ol(hs),hs.exitCode!==0&&I.warn(`Generate failed after install. Fix the issue and run agentsmesh generate${e==="global"?" --global":""}.`),{installed:pn,skipped:kr}}s(sM,"executeRunInstallPoolsAndWrite");async function zI(t,e,r,o){let{sync:n,dryRun:i,force:a,useExtends:c,explicitPath:l,explicitTarget:m,explicitAs:p,nameOverride:u}=mG(t),g=t.global===true?"global":"project",f=e[0]?.trim();if(n){let{context:Ht}=await Tt(r,g),lo=[],Ut=[];if(await lG({sync:n,canonicalDir:Ht.canonicalDir,reinstall:s(async wt=>{let pn=wt.paths&&wt.paths.length>0?wt.paths:[wt.path];for(let kr of pn){let hs=await zI({...a?{force:true}:{},...i?{"dry-run":true}:{},...g==="global"?{global:true}:{},name:wt.name,...wt.target?{target:wt.target}:{},...kr?{path:kr}:{},...wt.as?{as:wt.as}:{}},[wt.source],r,{features:wt.features,pick:wt.pick});lo.push(...hs.data.installed),Ut.push(...hs.data.skipped);}},"reinstall")}))return {exitCode:0,data:{source:"",mode:"sync",installed:lo,skipped:Ut,dryRun:i}}}if(!f)throw new Error("Missing source. Usage: agentsmesh install <source> [--path ...] [--target ...]");let h=process.stdin.isTTY;if(!h&&!a&&!i)throw new Error("Non-interactive terminal: use --force or --dry-run for agentsmesh install.");let{config:O,context:R}=await Tt(r,g),S=await DI(f,R.configDir,l);if(S.kind!=="local"&&!await qv())throw new Error("git is required for remote installs. Please install git and try again.");let{resolvedPath:A,sourceForYaml:D,version:N}=await rG(S,f),G=S.pathInRepo.replace(/^\/+|\/+$/g,"");if(G){let Ht=normalize(G).replace(/\\/g,"/");if(Ht===".."||Ht.startsWith("../"))throw new Error(`Install --path "${S.pathInRepo}" escapes the source root. Path must stay within the source.`)}let J=G?join(A,G):A;if(!await j(J))throw new Error(`Install path does not exist: ${J}`);let X=await NG({as:p,contentRoot:J,pathInRepo:G}),{prep:q,implicitPick:Ft,narrowed:Gt,discoveredFeatures:co}=await xG({resolvedPath:A,contentRoot:J,pathInRepo:G,explicitTarget:m,explicitAs:p,replayPick:o?.pick});try{let Ht=await sM({scope:g,force:a,dryRun:i,tty:h,useExtends:c,nameOverride:u,explicitAs:p,config:O,context:R,parsed:S,sourceForYaml:D,version:N,pathInRepo:G,persisted:X,replay:o,prep:q,implicitPick:Ft,narrowed:Gt,discoveredFeatures:co});return {exitCode:0,data:{source:f,mode:"install",installed:Ht.installed,skipped:Ht.skipped,dryRun:i}}}finally{q.cleanup&&await q.cleanup();}}s(zI,"runInstall");async function iM(t,e,r){return zI(t,e,r)}s(iM,"runInstall");ft();function aM(t){let{data:e}=t;if(!(e.mode==="sync"&&e.installed.length===0&&e.skipped.length===0)){if(e.installed.length>0&&!e.dryRun){let o=[...new Set(e.installed.map(n=>n.kind))].map(n=>{let i=e.installed.filter(a=>a.kind===n).length;return `${i} ${n}${i>1?"s":""}`}).join(", ");I.success(`Installed ${o}.`);}if(e.skipped.length>0)for(let r of e.skipped)I.warn(`Skipped ${r.kind} "${r.name}": ${r.reason}`);}}s(aM,"renderInstall");Z_();T();var YI="agentsmesh.yaml";async function XI(t){let e=join(t,YI),r=await y(e);return r===null?{}:parse(r)??{}}s(XI,"readScopedConfigRaw");async function lM(t,e){let r=join(t,YI),o=await y(r)??`version: 1
329
- `,n=parse(o)??{};if(n.plugins||(n.plugins=[]),n.plugins.some(a=>a.id===e.id))return;let i={id:e.id,source:e.source};e.version!==void 0&&(i.version=e.version),n.plugins.push(i),await _(r,stringify(n));}s(lM,"writePluginEntry");async function mM(t,e){let r=join(t,YI),o=await y(r);if(o===null)return false;let n=parse(o)??{},i=(n.plugins??[]).length;n.plugins=(n.plugins??[]).filter(c=>c.id!==e),n.pluginTargets&&(n.pluginTargets=n.pluginTargets.filter(c=>c!==e));let a=n.plugins.length<i;return a&&await _(r,stringify(n)),a}s(mM,"removePluginEntry");async function pM(t,e,r){let o=e[0];if(o===void 0||o==="")return {exitCode:0,data:{subcommand:"list",plugins:[]},showHelp:true};switch(o){case "add":return QY(t,e.slice(1),r);case "list":return qY(r);case "remove":return tX(e.slice(1),r);case "info":return eX(e.slice(1),r);default:return {exitCode:2,data:{subcommand:"list",plugins:[]},showHelp:true,error:`Unknown plugin subcommand: ${o}`}}}s(pM,"runPlugin");async function QY(t,e,r){let o=e[0];if(!o)throw new mo("Usage: agentsmesh plugin add <source> [--version <v>] [--id <id>]");let n=typeof t.version=="string"?t.version:"latest",a=(typeof t.id=="string"?t.id:void 0)??rX(o);return await lM(r,{id:a,source:o,version:n==="latest"?void 0:n}),{exitCode:0,data:{subcommand:"add",id:a,package:o,version:n}}}s(QY,"runPluginAdd");async function qY(t){let r=(await XI(t)).plugins??[],o=[];for(let n of r){let i="\u2717",a="";try{let c=await jd(n,t);i=c.descriptors.length>0?"\u2713":"\u2713 (0 descriptors)",a=c.descriptors.map(l=>l.id).join(", ");}catch{}o.push({id:n.id,package:n.source,version:n.version,status:i,targets:a});}return {exitCode:0,data:{subcommand:"list",plugins:o}}}s(qY,"runPluginList");async function tX(t,e){let r=t[0];if(!r)throw new mo("Usage: agentsmesh plugin remove <id>");let o=await mM(e,r);return {exitCode:0,data:{subcommand:"remove",id:r,found:o}}}s(tX,"runPluginRemove");async function eX(t,e){let r=t[0];if(!r)throw new mo("Usage: agentsmesh plugin info <id>");let n=((await XI(e)).plugins??[]).find(c=>c.id===r);if(!n)return {exitCode:1,data:{subcommand:"info",id:r,package:"",descriptors:[]}};let i;try{i=await jd(n,e);}catch{return {exitCode:1,data:{subcommand:"info",id:r,package:n.source,version:n.version,descriptors:[]}}}let a=i.descriptors.map(c=>({id:c.id,description:c.emptyImportMessage}));return {exitCode:0,data:{subcommand:"info",id:r,package:n.source,version:n.version,descriptors:a}}}s(eX,"runPluginInfo");function rX(t){let e=t;if(e.startsWith("@")){let o=e.indexOf("/");o!==-1&&(e=e.slice(o+1));}e.startsWith("agentsmesh-target-")&&(e=e.slice(18)),e.startsWith("file:")&&(e=e.slice(5));let r=e.replace(/\\/g,"/").split("/");return e=r[r.length-1]??e,e=e.replace(/\.(js|ts)$/,""),e=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),e||"plugin"}s(rX,"derivePluginId");ft();function uM(t){if(t.error&&I.error(t.error),t.showHelp){aX();return}let{data:e}=t;switch(e.subcommand){case "add":oX(e.id,e.package,e.version);break;case "list":nX(e.plugins);break;case "remove":sX(e.id,e.found);break;case "info":iX(e,t.exitCode);break}}s(uM,"renderPlugin");function oX(t,e,r){I.success(`Plugin '${t}' added to agentsmesh.yaml`),I.warn("Plugins load as trusted Node.js modules and run with full process privileges. Only install plugins from sources you trust.");let o=r!=="latest"?`@${r}`:"@latest";I.info(`Next: npm install ${e}${o}`),I.info(`Then add '${t}' to pluginTargets in agentsmesh.yaml to enable it.`);}s(oX,"renderAdd");function nX(t){if(t.length===0){I.info("No plugins configured. Use: agentsmesh plugin add <source>");return}I.info("Configured plugins:");for(let e of t){let r=e.version!==void 0?`@${e.version}`:"",o=e.status??"",n=e.targets??"";I.info(` ${e.id} | ${e.package}${r} | ${o} | ${n}`);}}s(nX,"renderList");function sX(t,e){e?I.success(`Plugin '${t}' removed from agentsmesh.yaml`):I.warn(`Plugin '${t}' was not found in agentsmesh.yaml`);}s(sX,"renderRemove");function iX(t,e){if(e!==0&&t.package===""){I.error(`Plugin '${t.id}' not found in agentsmesh.yaml. Use: agentsmesh plugin add`);return}if(e!==0){I.error(`Failed to load plugin '${t.id}'`);return}I.info(`Plugin: ${t.id}`),I.info(`Source: ${t.package}${t.version!==void 0?`@${t.version}`:""}`),I.info(`Descriptors: ${t.descriptors.length}`);for(let r of t.descriptors)I.info(` - ${r.id}: ${r.description}`);}s(iX,"renderInfo");function aX(){I.info("Usage: agentsmesh plugin <subcommand> [args] [flags]"),I.info(""),I.info("Subcommands:"),I.info(" add <source> Register a plugin package in agentsmesh.yaml"),I.info(" list Show all configured plugins and load status"),I.info(" remove <id> Remove a plugin from agentsmesh.yaml"),I.info(" info <id> Show descriptor details for a configured plugin"),I.info(""),I.info("Flags (add):"),I.info(" --version <v> Pin plugin version"),I.info(" --id <id> Override derived plugin id"),I.info(""),I.info("Note: plugins load as trusted Node.js modules and run with full process privileges."),I.info(" Only install plugins from sources you trust.");}s(aX,"printPluginHelp");T();uo();function li(t){return t.toUpperCase().replace(/-/g,"_")}s(li,"toPrefix");function gs(t){return t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}s(gs,"toPascal");function ZI(t){let e=li(t.id),r=gs(t.id);return `import type { TargetGenerators } from '../catalog/target.interface.js';
358
+ `);}s(rU,"writeBanner");async function nU(t,e,r){if(t.modifications.length===0)return {action:"proceed"};if(e.bypass)return rU(r,t),{action:"delete-anyway"};rU(r,t);let n=(await r.ask("Action: [d]elete anyway / [k]eep modified files (uninstall the rest) / [a]bort ")).trim().toLowerCase();return n==="d"?{action:"delete-anyway"}:n==="k"?{action:"keep-modified"}:{action:"abort"}}s(nU,"runModifiedFilesPrompt");async function l3(t){let e=await _(join(t,hn));if(e===null)return null;try{return JSON.parse(e).files??{}}catch{return null}}s(l3,"readManifestFiles");async function c3(t,e,r){if(t.manifestEntry===null)return {plan:t,modifications:[],action:"proceed",legacyMigrated:false,packDirMissing:false};let n=join(e,t.name);if(!await $(n))return r.warn(`Pack "${t.name}" directory missing at ${n}; only manifest entries will be removed.`),{plan:t,modifications:[],action:"proceed",legacyMigrated:false,packDirMissing:true};let o=await tU(n,{warn:r.warn,dryRun:r.dryRun===true}),i=o!==null,a=o!==null&&r.dryRun===true?o.manifest.files:await l3(n);if(a===null)return {plan:t,modifications:[],action:"proceed",legacyMigrated:i,packDirMissing:false};let l=await eU(n,a);if(r.keepPack||l.length===0)return {plan:t,modifications:l,action:"proceed",legacyMigrated:i,packDirMissing:false};let c=await nU({packName:t.name,modifications:l},{bypass:r.bypassPrompts},r.adapter);return c.action==="abort"?"abort":{plan:t,modifications:l,action:c.action,legacyMigrated:i,packDirMissing:false}}s(c3,"decideOne");async function sU(t,e,r){let n=[];for(let o of t){let i=await c3(o,e,r);if(i==="abort")return {decisions:n,aborted:true};n.push(i);}return {decisions:n,aborted:false}}s(sU,"gatherUninstallDecisions");w();w();async function iU(t,e,r){if(!e.extends.some(c=>c.name===r))return false;let n=await _(t);if(n===null)throw new Error(`Missing config: ${t}`);let o=parse(n),i=Array.isArray(o.extends)?o.extends:[],a=i.filter(c=>typeof c!="object"||c===null?true:c.name!==r);if(a.length===i.length)return false;o.extends=a;let l=stringify(o,{indent:2,lineWidth:0});return await I(t,l.endsWith(`
359
+ `)?l:`${l}
360
+ `),true}s(iU,"removeAgentsmeshExtendByName");async function aU(t){let{plan:e,canonicalDir:r,configPath:n,config:o}=t,i=false;e.packDir!==null&&await $(e.packDir)&&(await rm(e.packDir,{recursive:true}),i=true);let a=await Ej(r,e.name),l=false;e.extendsEntry!==null&&(l=await iU(n,o,e.name));let c=e.packDir!==null,m=e.manifestEntry!==null,p=e.extendsEntry!==null,u=c&&!i||m&&!a||p&&!l;return {name:e.name,packDirRemoved:i,manifestEntryRemoved:a,extendsEntryRemoved:l,partial:u}}s(aU,"applyUninstall");function g3(t,e){return relative(t,e).replaceAll("\\","/")}s(g3,"toForwardSlashRel");function KI(t){return t.map(e=>({name:e,reason:"not found in installs.yaml"}))}s(KI,"buildSkipped");function lU(t,e,r){return t.plan.manifestEntry===null?null:g3(e,join(r,t.plan.name))}s(lU,"packPathFor");function cU(t,e,r){return t.map(n=>({name:n.plan.name,pack_path:lU(n,e,r),manifest_entry_removed:false,extends_entry_removed:false,generated_files_removed:0,modified_files_kept:n.modifications.map(o=>({relativePath:o.relativePath,status:o.status})),legacy_migrated:n.legacyMigrated,partial:n.action==="keep-modified"||n.plan.packDir===null}))}s(cU,"previewEntries");function mU(t,e,r,n){let o=t.action==="keep-modified"||!e.packDirRemoved;return {name:e.name,pack_path:lU(t,r,n),manifest_entry_removed:e.manifestEntryRemoved,extends_entry_removed:e.extendsEntryRemoved,generated_files_removed:0,modified_files_kept:o?t.modifications.map(i=>({relativePath:i.relativePath,status:i.status})):[],legacy_migrated:t.legacyMigrated,partial:e.partial}}s(mU,"appliedEntry");function h3(t){let e=[];for(let r of t)for(let n of r.split(",").map(o=>o.trim()).filter(Boolean))e.push(n);return e}s(h3,"parseNames");function y3(){return {ask:s(t=>Uf(t),"ask"),write:s(t=>process.stdout.write(t),"write")}}s(y3,"defaultAdapter");async function Kf(t,e,r,n={}){let o=t.global===true?"global":"project",i=t.all===true,a=t.force===true,l=t["dry-run"]===true,c=t["keep-pack"]===true,m=t["keep-generated"]===true,p=n.assumeTty===true||process.stdin.isTTY,u=h3(e),f=t.json===true;function g(S){return f||y.error(S),{exitCode:1,data:{scope:o,mode:"uninstall",removed:[],skipped:[],failed:[],dryRun:l}}}if(s(g,"validationFailure"),!i&&u.length===0)return g("Missing install name. Usage: agentsmesh uninstall <name>[,<name>...] [--all]");if(!p&&!a&&!l)return g("Non-interactive terminal: use --force or --dry-run for agentsmesh uninstall.");let{config:h,context:R}=await yt(r,o);await Wt(h,r);let C=await wf(R.canonicalDir);try{let S=await ho(R.canonicalDir),k=join(R.canonicalDir,"packs"),P=qj({names:u,all:i,keepPack:c,keepGenerated:m,installs:S,extends:h.extends,packsDir:k}),{decisions:N,aborted:F}=await sU(P.removals,k,{adapter:n.promptAdapter??y3(),warn:s(at=>y.warn(at),"warn"),bypassPrompts:a||l||!p,keepPack:c,dryRun:l});if(F)return y.warn("Uninstall aborted at modification prompt."),{exitCode:130,data:{scope:o,mode:"uninstall",removed:[],skipped:[],failed:[],dryRun:l}};for(let at of P.removals)for(let At of at.warnings)y.warn(At);if(l){for(let at of N)y.info(`[dry-run] Would uninstall pack "${at.plan.name}".`);return {exitCode:0,data:{scope:o,mode:"uninstall",removed:cU(N,R.rootBase,k),skipped:KI(P.skipped),failed:[],dryRun:!0}}}let W=join(R.configDir,"agentsmesh.yaml"),z=[],Q=[];for(let at of N){let At=at.action==="keep-modified"?{...at.plan,packDir:null}:at.plan;try{let wt=await aU({plan:At,canonicalDir:R.canonicalDir,configPath:W,config:h});z.push(mU(at,wt,R.rootBase,k));}catch(wt){let oe=wt instanceof Error?wt.message:String(wt);Q.push({name:at.plan.name,reason:oe}),f||y.error(`Failed to uninstall "${at.plan.name}": ${oe}`);}}return !m&&z.length>0?await vf("uninstall",o,R.rootBase):m&&z.length>0&&y.warn("--keep-generated: target files derived from the removed pack(s) may be stale until the next generate."),{exitCode:Q.length>0?1:0,data:{scope:o,mode:"uninstall",removed:z,skipped:KI(P.skipped),failed:Q,dryRun:!1}}}finally{await C();}}s(Kf,"runUninstall");async function uU(t,e,r){return Kf(t,e,r)}s(uU,"runUninstall");ot();function dU(t){let{data:e}=t;if(e.dryRun){if(e.removed.length===0){y.info("[dry-run] No installs matched.");return}y.info(`[dry-run] Would uninstall ${e.removed.length} pack(s):`);for(let r of e.removed){let n=r.pack_path===null?"extends-only":r.pack_path;y.info(` - ${r.name} (${n})`);}return}if(e.removed.length>0){let r=e.removed.map(n=>`"${n.name}"`).join(", ");y.success(`Uninstalled ${e.removed.length} pack(s): ${r}.`);}for(let r of e.skipped)y.warn(`Skipped "${r.name}": ${r.reason}`);for(let r of e.failed)y.error(`Failed "${r.name}": ${r.reason}`);}s(dU,"renderUninstall");Yt();w();fc();async function R3(t){let e=await _(join(t,hn));if(e===null)return {installed_at:null,source_type:null};try{let r=JSON.parse(e);return {installed_at:typeof r.installed_at=="string"?r.installed_at:null,source_type:typeof r.source_type=="string"?r.source_type:null}}catch{return {installed_at:null,source_type:null}}}s(R3,"readPackManifestMeta");function I3(t,e){return relative(t,e).replaceAll("\\","/")}s(I3,"toForwardSlashRel");async function Wf(t,e){let r=t.global===true?"global":"project",n=Ei(e,r),o=await ho(n.canonicalDir),i=join(n.canonicalDir,"packs"),a=[];for(let l of o){let c=join(i,l.name),m=await R3(c),p=await fi(c);a.push({name:l.name,source:l.source,source_kind:l.source_kind,source_type:m.source_type,version:l.version??null,features:[...l.features],target:l.target??null,installed_at:m.installed_at,pack_path:I3(n.rootBase,c),license:p?.license??null});}return {exitCode:0,data:{scope:r,subcommand:"list",installs:a}}}s(Wf,"runInstallsList");var S3=["list"];function fU(t){return {scope:t,subcommand:"list",installs:[]}}s(fU,"emptyData");async function gU(t,e,r){let n=t.global===true?"global":"project",o=e[0];return o===void 0||o===""?{exitCode:0,data:fU(n),showHelp:true}:o==="list"?Wf(t,r):{exitCode:2,data:fU(n),showHelp:true,error:`Unknown installs subcommand: "${o}". Available: ${S3.join(", ")}. Did you mean \`agentsmesh install ${o}\`?`}}s(gU,"runInstalls");ot();var Hf=[{key:"name",label:"NAME"},{key:"source",label:"SOURCE"},{key:"features",label:"FEATURES"},{key:"license",label:"LICENSE"},{key:"installed",label:"INSTALLED"}];function C3(t){return {name:t.name,source:t.source,features:t.features.join(", "),license:t.license??"-",installed:t.installed_at?t.installed_at.slice(0,10):"-"}}s(C3,"toRow");function k3(t){let e={name:0,source:0,features:0,license:0,installed:0};for(let n of Hf)e[n.key]=n.label.length;for(let n of t)for(let o of Hf)e[o.key]=Math.max(e[o.key],n[o.key].length);let r=Hf.map(n=>n.label.padEnd(e[n.key])).join(" ");y.info(r);for(let n of t)y.info(Hf.map(o=>n[o.key].padEnd(e[o.key])).join(" "));}s(k3,"renderTable");function hU(t){if(t.error&&y.error(t.error),t.showHelp){Lp("installs");return}let{data:e}=t;if(e.installs.length===0){y.info("No installed packs.");return}k3(e.installs.map(C3));}s(hU,"renderInstalls");UR();w();var VI="agentsmesh.yaml";async function JI(t){let e=join(t,VI),r=await _(e);return r===null?{}:parse(r)??{}}s(JI,"readScopedConfigRaw");async function _U(t,e){let r=join(t,VI),n=await _(r)??`version: 1
361
+ `,o=parse(n)??{};if(o.plugins||(o.plugins=[]),o.plugins.some(a=>a.id===e.id))return;let i={id:e.id,source:e.source};e.version!==void 0&&(i.version=e.version),o.plugins.push(i),await I(r,stringify(o));}s(_U,"writePluginEntry");async function RU(t,e){let r=join(t,VI),n=await _(r);if(n===null)return false;let o=parse(n)??{},i=(o.plugins??[]).length;o.plugins=(o.plugins??[]).filter(l=>l.id!==e),o.pluginTargets&&(o.pluginTargets=o.pluginTargets.filter(l=>l!==e));let a=o.plugins.length<i;return a&&await I(r,stringify(o)),a}s(RU,"removePluginEntry");async function IU(t,e,r){let n=e[0];if(n===void 0||n==="")return {exitCode:0,data:{subcommand:"list",plugins:[]},showHelp:true};switch(n){case "add":return E3(t,e.slice(1),r);case "list":return L3(r);case "remove":return O3(e.slice(1),r);case "info":return A3(e.slice(1),r);default:return {exitCode:2,data:{subcommand:"list",plugins:[]},showHelp:true,error:`Unknown plugin subcommand: ${n}`}}}s(IU,"runPlugin");async function E3(t,e,r){let n=e[0];if(!n)throw new yn("Usage: agentsmesh plugin add <source> [--version <v>] [--id <id>]");let o=typeof t.version=="string"?t.version:"latest",a=(typeof t.id=="string"?t.id:void 0)??w3(n);return await _U(r,{id:a,source:n,version:o==="latest"?void 0:o}),{exitCode:0,data:{subcommand:"add",id:a,package:n,version:o}}}s(E3,"runPluginAdd");async function L3(t){let r=(await JI(t)).plugins??[],n=[];for(let o of r){let i="\u2717",a="";try{let l=await _f(o,t);i=l.descriptors.length>0?"\u2713":"\u2713 (0 descriptors)",a=l.descriptors.map(c=>c.id).join(", ");}catch{}n.push({id:o.id,package:o.source,version:o.version,status:i,targets:a});}return {exitCode:0,data:{subcommand:"list",plugins:n}}}s(L3,"runPluginList");async function O3(t,e){let r=t[0];if(!r)throw new yn("Usage: agentsmesh plugin remove <id>");let n=await RU(e,r);return {exitCode:0,data:{subcommand:"remove",id:r,found:n}}}s(O3,"runPluginRemove");async function A3(t,e){let r=t[0];if(!r)throw new yn("Usage: agentsmesh plugin info <id>");let o=((await JI(e)).plugins??[]).find(l=>l.id===r);if(!o)return {exitCode:1,data:{subcommand:"info",id:r,package:"",descriptors:[]}};let i;try{i=await _f(o,e);}catch{return {exitCode:1,data:{subcommand:"info",id:r,package:o.source,version:o.version,descriptors:[]}}}let a=i.descriptors.map(l=>({id:l.id,description:l.emptyImportMessage}));return {exitCode:0,data:{subcommand:"info",id:r,package:o.source,version:o.version,descriptors:a}}}s(A3,"runPluginInfo");function w3(t){let e=t;if(e.startsWith("@")){let n=e.indexOf("/");n!==-1&&(e=e.slice(n+1));}e.startsWith("agentsmesh-target-")&&(e=e.slice(18)),e.startsWith("file:")&&(e=e.slice(5));let r=e.replace(/\\/g,"/").split("/");return e=r[r.length-1]??e,e=e.replace(/\.(js|ts)$/,""),e=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),e||"plugin"}s(w3,"derivePluginId");ot();function SU(t){if(t.error&&y.error(t.error),t.showHelp){D3();return}let{data:e}=t;switch(e.subcommand){case "add":b3(e.id,e.package,e.version);break;case "list":P3(e.plugins);break;case "remove":T3(e.id,e.found);break;case "info":x3(e,t.exitCode);break}}s(SU,"renderPlugin");function b3(t,e,r){y.success(`Plugin '${t}' added to agentsmesh.yaml`),y.warn("Plugins load as trusted Node.js modules and run with full process privileges. Only install plugins from sources you trust.");let n=r!=="latest"?`@${r}`:"@latest";y.info(`Next: npm install ${e}${n}`),y.info(`Then add '${t}' to pluginTargets in agentsmesh.yaml to enable it.`);}s(b3,"renderAdd");function P3(t){if(t.length===0){y.info("No plugins configured. Use: agentsmesh plugin add <source>");return}y.info("Configured plugins:");for(let e of t){let r=e.version!==void 0?`@${e.version}`:"",n=e.status??"",o=e.targets??"";y.info(` ${e.id} | ${e.package}${r} | ${n} | ${o}`);}}s(P3,"renderList");function T3(t,e){e?y.success(`Plugin '${t}' removed from agentsmesh.yaml`):y.warn(`Plugin '${t}' was not found in agentsmesh.yaml`);}s(T3,"renderRemove");function x3(t,e){if(e!==0&&t.package===""){y.error(`Plugin '${t.id}' not found in agentsmesh.yaml. Use: agentsmesh plugin add`);return}if(e!==0){y.error(`Failed to load plugin '${t.id}'`);return}y.info(`Plugin: ${t.id}`),y.info(`Source: ${t.package}${t.version!==void 0?`@${t.version}`:""}`),y.info(`Descriptors: ${t.descriptors.length}`);for(let r of t.descriptors)y.info(` - ${r.id}: ${r.description}`);}s(x3,"renderInfo");function D3(){y.info("Usage: agentsmesh plugin <subcommand> [args] [flags]"),y.info(""),y.info("Subcommands:"),y.info(" add <source> Register a plugin package in agentsmesh.yaml"),y.info(" list Show all configured plugins and load status"),y.info(" remove <id> Remove a plugin from agentsmesh.yaml"),y.info(" info <id> Show descriptor details for a configured plugin"),y.info(""),y.info("Flags (add):"),y.info(" --version <v> Pin plugin version"),y.info(" --id <id> Override derived plugin id"),y.info(""),y.info("Note: plugins load as trusted Node.js modules and run with full process privileges."),y.info(" Only install plugins from sources you trust.");}s(D3,"printPluginHelp");w();Rn();function yi(t){return t.toUpperCase().replace(/-/g,"_")}s(yi,"toPrefix");function Rs(t){return t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}s(Rs,"toPascal");function YI(t){let e=yi(t.id),r=Rs(t.id);return `import type { TargetGenerators } from '../catalog/target.interface.js';
330
362
  import type { TargetDescriptor, TargetLayout } from '../catalog/target-descriptor.js';
331
363
  import { generateRules } from './generator.js';
332
364
  import { importFrom${r} } from './importer.js';
@@ -429,7 +461,7 @@ export const descriptor = {
429
461
  buildImportPaths: build${r}ImportPaths,
430
462
  detectionPaths: [${e}_DIR],
431
463
  } satisfies TargetDescriptor;
432
- `}s(ZI,"TEMPLATE_INDEX");function QI(t){return `import { describe, it, expect } from 'vitest';
464
+ `}s(YI,"TEMPLATE_INDEX");function XI(t){return `import { describe, it, expect } from 'vitest';
433
465
  import type { CanonicalFiles } from '../../../../src/core/types.js';
434
466
  import { generateRules } from '../../../../src/targets/${t.id}/generator.js';
435
467
 
@@ -458,7 +490,7 @@ describe('generateRules (${t.id})', () => {
458
490
  expect(result).toHaveLength(0);
459
491
  });
460
492
  });
461
- `}s(QI,"TEMPLATE_GENERATOR_TEST");function qI(t){let e=gs(t.id);return `import { describe, it, expect } from 'vitest';
493
+ `}s(XI,"TEMPLATE_GENERATOR_TEST");function ZI(t){let e=Rs(t.id);return `import { describe, it, expect } from 'vitest';
462
494
  import { importFrom${e} } from '../../../../src/targets/${t.id}/importer.js';
463
495
 
464
496
  describe('importFrom${e} (${t.id})', () => {
@@ -472,10 +504,10 @@ describe('importFrom${e} (${t.id})', () => {
472
504
  expect(result).toHaveLength(0);
473
505
  });
474
506
  });
475
- `}s(qI,"TEMPLATE_IMPORTER_TEST");function tR(t){return `# ${t.displayName} Workspace
507
+ `}s(ZI,"TEMPLATE_IMPORTER_TEST");function QI(t){return `# ${t.displayName} Workspace
476
508
 
477
509
  Follow the ${t.displayName} configuration files and keep changes small.
478
- `}s(tR,"TEMPLATE_FIXTURE_ROOT_MD");function dM(t){let e=li(t.id);return `export const ${e}_TARGET = '${t.id}';
510
+ `}s(QI,"TEMPLATE_FIXTURE_ROOT_MD");function CU(t){let e=yi(t.id);return `export const ${e}_TARGET = '${t.id}';
479
511
 
480
512
  // Project-level paths
481
513
  export const ${e}_DIR = '.${t.id}';
@@ -488,21 +520,21 @@ export const ${e}_GLOBAL_RULES_DIR = '~/.${t.id}/rules';
488
520
  // Canonical paths
489
521
  export const ${e}_CANONICAL_ROOT_RULE = '.agentsmesh/rules/_root.md';
490
522
  export const ${e}_CANONICAL_RULES_DIR = '.agentsmesh/rules';
491
- `}s(dM,"TEMPLATE_CONSTANTS");function gM(t){let e=li(t.id);return `import type { CanonicalFiles } from '../../core/types.js';
523
+ `}s(CU,"TEMPLATE_CONSTANTS");function kU(t){let e=yi(t.id);return `import type { CanonicalFiles } from '../../core/types.js';
492
524
  import { ${e}_TARGET, ${e}_DIR } from './constants.js';
493
525
 
494
- export interface ${gs(t.id)}Output {
526
+ export interface ${Rs(t.id)}Output {
495
527
  path: string;
496
528
  content: string;
497
529
  }
498
530
 
499
- export function generateRules(_canonical: CanonicalFiles): ${gs(t.id)}Output[] {
531
+ export function generateRules(_canonical: CanonicalFiles): ${Rs(t.id)}Output[] {
500
532
  // TODO(agentsmesh-scaffold): implement generateRules for ${t.displayName}
501
533
  void ${e}_TARGET;
502
534
  void ${e}_DIR;
503
535
  return [];
504
536
  }
505
- `}s(gM,"TEMPLATE_GENERATOR");function fM(t){let e=gs(t.id),r=li(t.id);return `import type { ImportResult } from '../../core/types.js';
537
+ `}s(kU,"TEMPLATE_GENERATOR");function EU(t){let e=Rs(t.id),r=yi(t.id);return `import type { ImportResult } from '../../core/types.js';
506
538
  import type { TargetLayoutScope } from '../catalog/target-descriptor.js';
507
539
  import { ${r}_TARGET } from './constants.js';
508
540
 
@@ -514,7 +546,7 @@ export async function importFrom${e}(
514
546
  void ${r}_TARGET;
515
547
  return [];
516
548
  }
517
- `}s(fM,"TEMPLATE_IMPORTER");function hM(t){let e=li(t.id);return `/** Lint rules for the ${t.id} target. */
549
+ `}s(EU,"TEMPLATE_IMPORTER");function LU(t){let e=yi(t.id);return `/** Lint rules for the ${t.id} target. */
518
550
  import type { CanonicalFiles, LintDiagnostic } from '../../core/types.js';
519
551
  import { validateRules } from '../../core/lint/validate-rules.js';
520
552
  import { ${e}_TARGET } from './constants.js';
@@ -532,7 +564,7 @@ export function lintRules(
532
564
  target: ${e}_TARGET,
533
565
  }));
534
566
  }
535
- `}s(hM,"TEMPLATE_LINTER");function yM(t){return `/**
567
+ `}s(LU,"TEMPLATE_LINTER");function OU(t){return `/**
536
568
  * ${t.displayName}-specific lint hooks.
537
569
  */
538
570
 
@@ -542,7 +574,7 @@ export function lintHooks(_canonical: CanonicalFiles): LintDiagnostic[] {
542
574
  // TODO(agentsmesh-scaffold): implement target-specific hook validation for ${t.displayName}
543
575
  return [];
544
576
  }
545
- `}s(yM,"TEMPLATE_LINT_HOOKS");function _M(t){let e=gs(t.id),r=li(t.id);return `import type { TargetLayoutScope } from '../../../targets/catalog/target-descriptor.js';
577
+ `}s(OU,"TEMPLATE_LINT_HOOKS");function AU(t){let e=Rs(t.id),r=yi(t.id);return `import type { TargetLayoutScope } from '../../../targets/catalog/target-descriptor.js';
546
578
  import { ${r}_DIR } from '../../../targets/${t.id}/constants.js';
547
579
 
548
580
  export async function build${e}ImportPaths(
@@ -554,14 +586,14 @@ export async function build${e}ImportPaths(
554
586
  // Reference: src/core/reference/import-maps/kiro.ts for a full example
555
587
  void ${r}_DIR;
556
588
  }
557
- `}s(_M,"TEMPLATE_IMPORT_MAP");var lX=/^[a-z][a-z0-9-]*$/;async function IM(t){let{id:e,projectRoot:r,force:o=false}=t,n=t.displayName??e,i={id:e,displayName:n};if(!lX.test(e))throw new Error(`Invalid target id "${e}". Must match /^[a-z][a-z0-9-]*$/ (lowercase letters, digits, hyphens; start with a letter).`);if(kt.includes(e))throw new Error(`Target "${e}" already exists as a built-in target. Choose a different id.`);let a=[{rel:`src/targets/${e}/constants.ts`,content:dM(i)},{rel:`src/targets/${e}/index.ts`,content:ZI(i)},{rel:`src/targets/${e}/generator.ts`,content:gM(i)},{rel:`src/targets/${e}/importer.ts`,content:fM(i)},{rel:`src/targets/${e}/linter.ts`,content:hM(i)},{rel:`src/targets/${e}/lint.ts`,content:yM(i)},{rel:`src/core/reference/import-maps/${e}.ts`,content:_M(i)},{rel:`tests/unit/targets/${e}/generator.test.ts`,content:QI(i)},{rel:`tests/unit/targets/${e}/importer.test.ts`,content:qI(i)},{rel:`tests/e2e/fixtures/${e}-project/AGENTS.md`,content:tR(i)}],c=[],l=[];for(let p of a){let u=join(r,p.rel);if(!o&&await j(u)){l.push(u);continue}await _(u,p.content),c.push(u);}let m=["1. Run: pnpm catalog:generate (auto-discovers the new target \u2014 updates IDs, descriptors, and import-map barrel)",`2. Fill in TODO(agentsmesh-scaffold) markers in src/targets/${e}/`,`3. Run: pnpm typecheck && pnpm test -- tests/unit/targets/${e}`,"4. Run: pnpm schemas:generate && pnpm matrix:generate"];return {written:c,skipped:l,postSteps:m}}s(IM,"writeTargetScaffold");async function SM(t,e,r){let o=e[0];return o===void 0||o===""?{exitCode:0,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true}:o==="scaffold"?mX(t,e.slice(1),r):{exitCode:2,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true,error:`Unknown target subcommand: ${o}`}}s(SM,"runTarget");async function mX(t,e,r){let o=e[0];if(!o)throw new mo("Usage: agentsmesh target scaffold <id> [--name <displayName>] [--force]");let n=typeof t.name=="string"?t.name:void 0,i=t.force===true,a;try{a=await IM({id:o,displayName:n,projectRoot:r,force:i});}catch(c){return {exitCode:1,data:{id:o,written:[],skipped:[],postSteps:[]},error:c instanceof Error?c.message:String(c)}}return {exitCode:0,data:{id:o,written:a.written.map(c=>RM(c,r)),skipped:a.skipped.map(c=>RM(c,r)),postSteps:a.postSteps}}}s(mX,"runScaffold");function RM(t,e){return (t.startsWith(e)?t.slice(e.length+1):t).replaceAll("\\","/")}s(RM,"relativize");ft();function CM(t){if(t.error&&I.error(t.error),t.showHelp){pX();return}let{data:e}=t;for(let r of e.written)I.success(`created ${r}`);for(let r of e.skipped)I.warn(`skipped ${r} (already exists \u2014 use --force to overwrite)`);if(e.written.length>0){I.info(""),I.info("Next steps:");for(let r of e.postSteps)I.info(` ${r}`);}}s(CM,"renderTarget");function pX(){I.info("Usage: agentsmesh target <subcommand> [args] [flags]"),I.info(""),I.info("Subcommands:"),I.info(" scaffold <id> Generate a new target skeleton (files, tests, fixture)"),I.info(""),I.info("Flags (scaffold):"),I.info(" --name <displayName> Human-readable name (defaults to id)"),I.info(" --force Overwrite existing files");}s(pX,"printTargetHelp");je();Ri();T();Oe();ds();gn();function IX(t,e){return t===".agentsmesh"?false:!!(t.startsWith(".")||!e)}s(IX,"shouldSymlink");function RX(t){let e=mkdtempSync(join(tmpdir(),"am-convert-")),r=readdirSync(t,{withFileTypes:true});for(let o of r){if(!IX(o.name,o.isDirectory()))continue;let n=join(t,o.name),i=join(e,o.name);symlinkSync(n,i,o.isDirectory()?"dir":"file");}return mkdirSync(join(e,".agentsmesh"),{recursive:true}),e}s(RX,"createTempProjectRoot");async function sg(t,e){let r=e??process.cwd(),o=t.global===true?"global":"project",n=o==="global"?homedir():r,i=t.from,a=t.to;if(typeof i!="string"||!i)throw new Error("--from is required. Example: agentsmesh convert --from cursor --to claude-code");if(typeof a!="string"||!a)throw new Error("--to is required. Example: agentsmesh convert --from cursor --to claude-code");let c=i.toLowerCase().trim(),l=a.toLowerCase().trim();if(c===l)throw new Error("--from and --to must be different targets.");let m=Tr(c),p=Tr(l);if(!m||!p)try{let{config:R}=await Tt(r,"project");await le(R,r);}catch{let R=[];throw m||R.push(`--from "${i}"`),p||R.push(`--to "${a}"`),new Error(`Unknown ${R.join(" and ")}. Supported: ${kt.join(", ")}.`)}let u=ut(c);if(!u)throw new Error(`Unknown --from "${i}". Supported: ${kt.join(", ")}.`);if(!ut(l))throw new Error(`Unknown --to "${a}". Supported: ${kt.join(", ")}.`);let f=t["dry-run"]===true,h=f?"dry-run":"convert",O=RX(n);try{await u.generators.importFrom(O,{scope:o});let R=await Ae(O),S=gi.parse({version:1,targets:p?[l]:[],pluginTargets:p?[]:[l]}),A=await Lr({config:S,canonical:R,projectRoot:n,scope:o,targetFilter:[l]});if(!f){for(let G of A)if(G.status==="created"||G.status==="updated"){let J=el(n,G.path,G.target);await _(J,G.content);}}let D=A.filter(G=>G.status!=="skipped"),N=D.map(G=>({path:G.path,target:G.target,status:G.status}));return {exitCode:0,data:{from:c,to:l,mode:h,files:N,summary:{created:D.filter(G=>G.status==="created").length,updated:D.filter(G=>G.status==="updated").length,unchanged:D.filter(G=>G.status==="unchanged").length}}}}finally{rmSync(O,{recursive:true,force:true});}}s(sg,"runConvert");ft();function EM(t){let{data:e}=t;if(e.files.length===0){I.info(`No files found to convert from ${e.from}.`);return}if(e.mode==="dry-run"){for(let i of e.files)I.info(`[dry-run] ${i.status} ${i.path} (${i.target})`);return}for(let i of e.files)(i.status==="created"||i.status==="updated")&&I.success(`${i.status} ${i.path}`);let{created:r,updated:o,unchanged:n}=e.summary;r>0||o>0?I.info(`Converted from ${e.from} \u2192 ${e.to}: ${r} created, ${o} updated, ${n} unchanged`):I.info(`Nothing changed. (${n} unchanged)`);}s(EM,"renderConvert");var SX=/(^|\s)\/[A-Za-z]|^[A-Z]:[\\/]/,B=class extends Error{static{s(this,"McpError");}code;details;constructor(e,r,o){if(SX.test(r))throw new Error(`McpError refuses absolute fs path in message: ${r}`);super(r),this.code=e,this.details=o;}toEnvelope(){return this.details===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,details:this.details}}};function OM(t){return t.replace(/(['"`])\/[^'"`\s]+\1/gu,"$1<redacted>$1").replace(/(\s|^)\/[A-Za-z][^\s'"`]*/gu,"$1<redacted>").replace(/(\s|^)[A-Z]:[\\/][^\s'"`]*/gu,"$1<redacted>")}s(OM,"redactAbsolutePaths");async function eR(t){let e=resolve(t.projectRoot,".agentsmesh",t.feature),r=resolve(e,t.relativePath);if(!r.startsWith(e+sep)&&r!==e)throw new B("PATH_TRAVERSAL",`path escapes ${t.feature} directory`);if(Buffer.byteLength(t.content,"utf8")>1048576)throw new B("LIMIT_EXCEEDED","file body exceeds 1 MiB cap",{limit:1048576,actual:Buffer.byteLength(t.content,"utf8")});await mkdir(dirname(r),{recursive:true});let o=`${r}.tmp.${process.pid}.${Date.now()}`;return await writeFile(o,t.content,"utf8"),await rename(o,r),r}s(eR,"safeWrite");var TX=/^---\r?\n([\s\S]*?)\r?\n---\r?\n\r?\n?([\s\S]*)$/;function pi(t){let e=TX.exec(t);return e?{frontmatter:parse(e[1]??"")??{},body:e[2]??""}:{frontmatter:{},body:t}}s(pi,"parseMd");function cl(t,e){return Object.keys(t).length===0?e:`---
589
+ `}s(AU,"TEMPLATE_IMPORT_MAP");var F3=/^[a-z][a-z0-9-]*$/;async function wU(t){let{id:e,projectRoot:r,force:n=false}=t,o=t.displayName??e,i={id:e,displayName:o};if(!F3.test(e))throw new Error(`Invalid target id "${e}". Must match /^[a-z][a-z0-9-]*$/ (lowercase letters, digits, hyphens; start with a letter).`);if(Ft.includes(e))throw new Error(`Target "${e}" already exists as a built-in target. Choose a different id.`);let a=[{rel:`src/targets/${e}/constants.ts`,content:CU(i)},{rel:`src/targets/${e}/index.ts`,content:YI(i)},{rel:`src/targets/${e}/generator.ts`,content:kU(i)},{rel:`src/targets/${e}/importer.ts`,content:EU(i)},{rel:`src/targets/${e}/linter.ts`,content:LU(i)},{rel:`src/targets/${e}/lint.ts`,content:OU(i)},{rel:`src/core/reference/import-maps/${e}.ts`,content:AU(i)},{rel:`tests/unit/targets/${e}/generator.test.ts`,content:XI(i)},{rel:`tests/unit/targets/${e}/importer.test.ts`,content:ZI(i)},{rel:`tests/e2e/fixtures/${e}-project/AGENTS.md`,content:QI(i)}],l=[],c=[];for(let p of a){let u=join(r,p.rel);if(!n&&await $(u)){c.push(u);continue}await I(u,p.content),l.push(u);}let m=["1. Run: pnpm catalog:generate (auto-discovers the new target \u2014 updates IDs, descriptors, and import-map barrel)",`2. Fill in TODO(agentsmesh-scaffold) markers in src/targets/${e}/`,`3. Run: pnpm typecheck && pnpm test -- tests/unit/targets/${e}`,"4. Run: pnpm schemas:generate && pnpm matrix:generate"];return {written:l,skipped:c,postSteps:m}}s(wU,"writeTargetScaffold");async function PU(t,e,r){let n=e[0];return n===void 0||n===""?{exitCode:0,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true}:n==="scaffold"?v3(t,e.slice(1),r):{exitCode:2,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true,error:`Unknown target subcommand: ${n}`}}s(PU,"runTarget");async function v3(t,e,r){let n=e[0];if(!n)throw new yn("Usage: agentsmesh target scaffold <id> [--name <displayName>] [--force]");let o=typeof t.name=="string"?t.name:void 0,i=t.force===true,a;try{a=await wU({id:n,displayName:o,projectRoot:r,force:i});}catch(l){return {exitCode:1,data:{id:n,written:[],skipped:[],postSteps:[]},error:l instanceof Error?l.message:String(l)}}return {exitCode:0,data:{id:n,written:a.written.map(l=>bU(l,r)),skipped:a.skipped.map(l=>bU(l,r)),postSteps:a.postSteps}}}s(v3,"runScaffold");function bU(t,e){return (t.startsWith(e)?t.slice(e.length+1):t).replaceAll("\\","/")}s(bU,"relativize");ot();function TU(t){if(t.error&&y.error(t.error),t.showHelp){M3();return}let{data:e}=t;for(let r of e.written)y.success(`created ${r}`);for(let r of e.skipped)y.warn(`skipped ${r} (already exists \u2014 use --force to overwrite)`);if(e.written.length>0){y.info(""),y.info("Next steps:");for(let r of e.postSteps)y.info(` ${r}`);}}s(TU,"renderTarget");function M3(){y.info("Usage: agentsmesh target <subcommand> [args] [flags]"),y.info(""),y.info("Subcommands:"),y.info(" scaffold <id> Generate a new target skeleton (files, tests, fixture)"),y.info(""),y.info("Flags (scaffold):"),y.info(" --name <displayName> Human-readable name (defaults to id)"),y.info(" --force Overwrite existing files");}s(M3,"printTargetHelp");se();Ai();w();Yt();fn();Ro();function H3(t,e){return t===".agentsmesh"?false:!!(t.startsWith(".")||!e)}s(H3,"shouldSymlink");function z3(t){let e=mkdtempSync(join(tmpdir(),"am-convert-")),r=readdirSync(t,{withFileTypes:true});for(let n of r){if(!H3(n.name,n.isDirectory()))continue;let o=join(t,n.name),i=join(e,n.name);symlinkSync(o,i,n.isDirectory()?"dir":"file");}return mkdirSync(join(e,".agentsmesh"),{recursive:true}),e}s(z3,"createTempProjectRoot");async function Vf(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=n==="global"?homedir():r,i=t.from,a=t.to;if(typeof i!="string"||!i)throw new Error("--from is required. Example: agentsmesh convert --from cursor --to claude-code");if(typeof a!="string"||!a)throw new Error("--to is required. Example: agentsmesh convert --from cursor --to claude-code");let l=i.toLowerCase().trim(),c=a.toLowerCase().trim();if(l===c)throw new Error("--from and --to must be different targets.");let m=Pe(l),p=Pe(c);if(!m||!p)try{let{config:C}=await yt(r,"project");await Wt(C,r);}catch{let C=[];throw m||C.push(`--from "${i}"`),p||C.push(`--to "${a}"`),new Error(`Unknown ${C.join(" and ")}. Supported: ${Ft.join(", ")}.`)}let u=et(l);if(!u)throw new Error(`Unknown --from "${i}". Supported: ${Ft.join(", ")}.`);if(!et(c))throw new Error(`Unknown --to "${a}". Supported: ${Ft.join(", ")}.`);let g=t["dry-run"]===true,h=g?"dry-run":"convert",R=z3(o);try{await u.generators.importFrom(R,{scope:n});let C=await Ee(R),S=ki.parse({version:1,targets:p?[c]:[],pluginTargets:p?[]:[c]}),k=await Tr({config:S,canonical:C,projectRoot:o,scope:n,targetFilter:[c]});if(!g){for(let F of k)if(F.status==="created"||F.status==="updated"){let W=yc(o,F.path,F.target);await I(W,F.content);}}let P=k.filter(F=>F.status!=="skipped"),N=P.map(F=>({path:F.path,target:F.target,status:F.status}));return {exitCode:0,data:{from:l,to:c,mode:h,files:N,summary:{created:P.filter(F=>F.status==="created").length,updated:P.filter(F=>F.status==="updated").length,unchanged:P.filter(F=>F.status==="unchanged").length}}}}finally{rmSync(R,{recursive:true,force:true});}}s(Vf,"runConvert");ot();function xU(t){let{data:e}=t;if(e.files.length===0){y.info(`No files found to convert from ${e.from}.`);return}if(e.mode==="dry-run"){for(let i of e.files)y.info(`[dry-run] ${i.status} ${i.path} (${i.target})`);return}for(let i of e.files)(i.status==="created"||i.status==="updated")&&y.success(`${i.status} ${i.path}`);let{created:r,updated:n,unchanged:o}=e.summary;r>0||n>0?y.info(`Converted from ${e.from} \u2192 ${e.to}: ${r} created, ${n} updated, ${o} unchanged`):y.info(`Nothing changed. (${o} unchanged)`);}s(xU,"renderConvert");var V3=/(^|\s)\/[A-Za-z]|^[A-Z]:[\\/]/,G=class extends Error{static{s(this,"McpError");}code;details;constructor(e,r,n){if(V3.test(r))throw new Error(`McpError refuses absolute fs path in message: ${r}`);super(r),this.code=e,this.details=n;}toEnvelope(){return this.details===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,details:this.details}}};function Jf(t){return t.replace(/(['"`])\/[^'"`\s]+\1/gu,"$1<redacted>$1").replace(/(\s|^)\/[A-Za-z][^\s'"`]*/gu,"$1<redacted>").replace(/(\s|^)[A-Z]:[\\/][^\s'"`]*/gu,"$1<redacted>")}s(Jf,"redactAbsolutePaths");async function qI(t){let e=resolve(t.projectRoot,".agentsmesh",t.feature),r=resolve(e,t.relativePath);if(!r.startsWith(e+sep)&&r!==e)throw new G("PATH_TRAVERSAL",`path escapes ${t.feature} directory`);if(Buffer.byteLength(t.content,"utf8")>1048576)throw new G("LIMIT_EXCEEDED","file body exceeds 1 MiB cap",{limit:1048576,actual:Buffer.byteLength(t.content,"utf8")});await mkdir(dirname(r),{recursive:true});let n=`${r}.tmp.${process.pid}.${Date.now()}`;return await writeFile(n,t.content,"utf8"),await rename(n,r),r}s(qI,"safeWrite");var e8=/^---\r?\n([\s\S]*?)\r?\n---\r?\n\r?\n?([\s\S]*)$/;function Ri(t){let e=e8.exec(t);if(!e)return {frontmatter:{},body:t};let[,r,n]=e;return {frontmatter:parse(r)??{},body:n}}s(Ri,"parseMd");function wc(t,e){return Object.keys(t).length===0?e:`---
558
590
  ${stringify(t).trimEnd()}
559
591
  ---
560
592
 
561
- ${e}`}s(cl,"serializeMd");var NX=/^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/,FX={rules:"_root"};function ig(t){if(!NX.test(t)||t.includes(".."))throw new B("INVALID_NAME",`invalid name: ${t}`)}s(ig,"checkName");function ag(t,e,r){return resolve(t,".agentsmesh",e,`${r}.md`)}s(ag,"pathFor");function ll(t){let{feature:e,frontmatterSchema:r,toSummary:o}=t,n=s(c=>resolve(c,".agentsmesh",e),"featureDir");async function i(c){try{return (await readdir(n(c),{withFileTypes:!0})).filter(m=>m.isFile()&&m.name.endsWith(".md")).map(m=>m.name)}catch{return []}}s(i,"listFiles");async function a(c){try{return await stat(c),!0}catch{return false}}return s(a,"exists"),{async list(c){let l=await i(c.projectRoot),m=[];for(let p of l){let u=p.replace(/\.md$/,""),g=await readFile(join(n(c.projectRoot),p),"utf8"),{frontmatter:f}=pi(g);m.push(o(u,f));}return m},async get(c,{name:l}){ig(l);let m=ag(c.projectRoot,e,l);try{let p=await readFile(m,"utf8"),{frontmatter:u,body:g}=pi(p);return {name:l,frontmatter:u,body:g}}catch(p){let u=p.code;throw u==="ENOENT"?new B("NOT_FOUND",`${e} "${l}" not found`):new B("IO_ERROR",`failed to read ${e}`,{errno:u})}},async create(c,{name:l,frontmatter:m,body:p,dry_run:u}){ig(l);let g=r.safeParse(m);if(!g.success)throw new B("VALIDATION_FAILED","invalid frontmatter",g.error.issues);let f=ag(c.projectRoot,e,l);if(await a(f))throw new B("ALREADY_EXISTS",`${e} "${l}" exists`);if((await i(c.projectRoot)).length>=1e3)throw new B("LIMIT_EXCEEDED",`${e} dir at ${1e3} entries`);let O=cl(m,p);return u===true?{path:f,written:false}:(await eR({projectRoot:c.projectRoot,feature:e,relativePath:`${l}.md`,content:O}),{path:f,written:true})},async update(c,{name:l,frontmatter:m,body:p,merge:u,dry_run:g}){ig(l);let f=ag(c.projectRoot,e,l),h;try{let D=await readFile(f,"utf8");h=pi(D);}catch(D){let N=D.code;throw N==="ENOENT"?new B("NOT_FOUND",`${e} "${l}" not found`):new B("IO_ERROR",`failed to read ${e}`,{errno:N})}let O=m===void 0?h.frontmatter:u===true?{...h.frontmatter,...m}:m,R=r.safeParse(O);if(!R.success)throw new B("VALIDATION_FAILED","invalid frontmatter",R.error.issues);let S=p!==void 0?p:h.body,A=cl(O,S);return g===true?{path:f,written:false}:(await eR({projectRoot:c.projectRoot,feature:e,relativePath:`${l}.md`,content:A}),{path:f,written:true})},async delete(c,{name:l,force:m,dry_run:p}){if(ig(l),FX[e]===l&&m!==true)throw new B("PROTECTED_FILE",`${e} "${l}" requires force: true`);let u=ag(c.projectRoot,e,l);if(!await a(u))throw new B("NOT_FOUND",`${e} "${l}" not found`);return p===true?{path:u,deleted:false}:(await rm$1(u),{path:u,deleted:true})}}}s(ll,"createCanonicalHandlers");var vX=z$1.object({description:z$1.string().optional(),root:z$1.boolean().optional(),globs:z$1.array(z$1.string()).nullable().optional(),targets:z$1.array(z$1.string()).nullable().optional()}).passthrough(),kM=ll({feature:"rules",frontmatterSchema:vX,toSummary:s((t,e)=>({name:t,description:e.description??null,root:!!e.root,globs:e.globs??null,targets:e.targets??null}),"toSummary")});var GX=z$1.object({description:z$1.string().optional(),"allowed-tools":z$1.array(z$1.string()).optional()}).passthrough(),wM=ll({feature:"commands",frontmatterSchema:GX,toSummary:s((t,e)=>({name:t,description:e.description??null,allowedTools:e["allowed-tools"]??null}),"toSummary")});var MX=z$1.object({name:z$1.string().optional(),description:z$1.string().optional(),tools:z$1.array(z$1.string()).optional(),model:z$1.string().optional()}).passthrough(),TM=ll({feature:"agents",frontmatterSchema:MX,toSummary:s((t,e)=>({name:t,description:e.description??null,tools:e.tools??null,model:e.model??null}),"toSummary")});var $X=z$1.object({name:z$1.string().describe('Item name (e.g. "auth", "code-review")')}),jX=z$1.object({name:z$1.string().describe('Item name (e.g. "auth", "code-review")'),frontmatter:z$1.record(z$1.string(),z$1.unknown()).describe("YAML frontmatter fields (e.g. { description, globs, targets })"),body:z$1.string().describe("Markdown body content"),dry_run:z$1.boolean().optional().describe("Preview changes without writing to disk")}),UX=z$1.object({}).strict();function oR(t,e){let r=t==="rule"?"rules":t==="command"?"commands":"agents";return [{name:`list_${r}`,description:`List ${r} with summary metadata`,inputSchema:UX,handler:s(o=>e.list(o),"handler"),resourceUri:`agentsmesh://canonical/${r}`},{name:`get_${t}`,description:`Get a single ${t} by name`,inputSchema:$X,handler:s((o,n)=>e.get(o,n),"handler"),resourceUri:`agentsmesh://canonical/${r}/{name}`},{name:`create_${t}`,description:`Create a new ${t}`,inputSchema:jX,handler:s((o,n)=>e.create(o,n),"handler")},{name:`update_${t}`,description:`Update a ${t}. Default: replace frontmatter entirely. Set merge=true to shallow-merge. Omitting body preserves the existing body.`,inputSchema:z$1.object({name:z$1.string().describe("Name of the item to update"),frontmatter:z$1.record(z$1.string(),z$1.unknown()).optional().describe("New frontmatter fields (replaces by default; set merge=true to shallow-merge)"),body:z$1.string().optional().describe("New markdown body (omit to preserve existing)"),merge:z$1.boolean().optional().describe("If true, shallow-merge frontmatter instead of replacing"),dry_run:z$1.boolean().optional().describe("Preview changes without writing to disk")}),handler:s((o,n)=>e.update(o,n),"handler")},{name:`delete_${t}`,description:`Delete a ${t}. For rules: deleting _root requires force=true.`,inputSchema:z$1.object({name:z$1.string().describe("Name of the item to delete"),force:z$1.boolean().optional().describe("Required to delete protected files like _root"),dry_run:z$1.boolean().optional().describe("Preview without deleting")}),handler:s((o,n)=>e.delete(o,n),"handler")}]}s(oR,"canonicalTools");var bM=[...oR("rule",kM),...oR("command",wM),...oR("agent",TM)];async function xM(t){let e=resolve(t.projectRoot,".agentsmesh/skills",t.skillName),r=resolve(e,t.filePath);if(!r.startsWith(e+sep)&&r!==e)throw new B("PATH_TRAVERSAL","file escapes skill directory");try{return await readFile(r,"utf8")}catch(o){throw o.code==="ENOENT"?new B("NOT_FOUND",`skill file not found: ${t.filePath}`):new B("IO_ERROR","failed to read skill file")}}s(xM,"safeRead");var JX=/^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/,YX=/^[a-zA-Z0-9_][a-zA-Z0-9_/-]*\.[a-zA-Z0-9]+$/,vM=z$1.object({name:z$1.string().optional(),description:z$1.string().optional()}).passthrough();function Jm(t){if(!JX.test(t))throw new B("INVALID_NAME",`invalid skill name: ${t}`)}s(Jm,"checkName");function iR(t){if(!YX.test(t)||t.includes("..")||t.includes("//"))throw new B("PATH_TRAVERSAL",`invalid supporting-file path: ${t}`)}s(iR,"checkSupportPath");async function mg(t,e){if(Buffer.byteLength(e,"utf8")>1048576)throw new B("LIMIT_EXCEEDED","file body exceeds 1 MiB cap");await mkdir(dirname(t),{recursive:true});let r=`${t}.tmp.${process.pid}.${Date.now()}`;await writeFile(r,e,"utf8"),await rename(r,t);}s(mg,"atomicWrite");var GM=s(t=>resolve(t,".agentsmesh/skills"),"skillsDir"),Ym=s((t,e)=>resolve(GM(t),e),"skillDir"),Ta={async list(t){let e;try{e=(await readdir(GM(t.projectRoot),{withFileTypes:!0})).filter(o=>o.isDirectory()).map(o=>o.name);}catch{return []}let r=[];for(let o of e)try{let n=await readFile(resolve(Ym(t.projectRoot,o),"SKILL.md"),"utf8"),i=pi(n).frontmatter;r.push({name:o,description:i.description??null});}catch{}return r},async get(t,{name:e}){Jm(e);let r=Ym(t.projectRoot,e);try{let o=await readFile(resolve(r,"SKILL.md"),"utf8"),{frontmatter:n,body:i}=pi(o),c=(await readdir(r)).filter(l=>l!=="SKILL.md").sort();return {name:e,frontmatter:n,body:i,supportingFiles:c}}catch(o){throw o.code==="ENOENT"?new B("NOT_FOUND",`skill "${e}" not found`):new B("IO_ERROR","failed to read skill")}},async getFile(t,{name:e,path:r}){return Jm(e),iR(r),{content:await xM({projectRoot:t.projectRoot,skillName:e,filePath:r}),encoding:"utf-8"}},async create(t,e){Jm(e.name);let r=vM.safeParse(e.frontmatter);if(!r.success)throw new B("VALIDATION_FAILED","invalid frontmatter",r.error.issues);let o=Ym(t.projectRoot,e.name),n=false;try{await stat(o),n=!0;}catch{}if(n)throw new B("ALREADY_EXISTS",`skill "${e.name}" exists`);let i=e.supportingFiles??{},a=Object.keys(i);if(a.forEach(iR),a.length+1>1e3)throw new B("LIMIT_EXCEEDED","supporting files exceed cap");if(e.dry_run===true)return {path:o,written:false,supportingFilesWritten:[]};let c=resolve(o,"SKILL.md");await mg(c,cl(e.frontmatter,e.body));for(let[l,m]of Object.entries(i))await mg(resolve(o,l),m);return {path:o,written:true,supportingFilesWritten:a}},async update(t,e){Jm(e.name);let r=Ym(t.projectRoot,e.name),o;try{let p=await readFile(resolve(r,"SKILL.md"),"utf8");o=pi(p);}catch(p){throw p.code==="ENOENT"?new B("NOT_FOUND",`skill "${e.name}" not found`):new B("IO_ERROR","failed to read skill")}let n=e.frontmatter===void 0?o.frontmatter:e.merge===true?{...o.frontmatter,...e.frontmatter}:e.frontmatter,i=vM.safeParse(n);if(!i.success)throw new B("VALIDATION_FAILED","invalid frontmatter",i.error.issues);let a=e.body!==void 0?e.body:o.body,c=e.supportingFiles??{};Object.keys(c).forEach(iR);let l=[],m=[];if(e.dry_run===true)return Object.entries(c).forEach(([p,u])=>(u===null?m:l).push(p)),{path:r,written:false,supportingFilesAffected:{written:l,deleted:m}};await mg(resolve(r,"SKILL.md"),cl(n,a));for(let[p,u]of Object.entries(c)){let g=resolve(r,p);if(u===null)try{await rm$1(g),m.push(p);}catch{}else await mg(g,u),l.push(p);}return {path:r,written:true,supportingFilesAffected:{written:l,deleted:m}}},async delete(t,{name:e,dry_run:r}){Jm(e);let o=Ym(t.projectRoot,e);try{await stat(o);}catch{throw new B("NOT_FOUND",`skill "${e}" not found`)}return r===true?{path:o,deleted:false}:(await rm$1(o,{recursive:true}),{path:o,deleted:true})}};var XX=z$1.object({}).strict(),ZX=z$1.object({name:z$1.string().describe("Item name")}),MM=[{name:"list_skills",description:"List skills",inputSchema:XX,handler:s(t=>Ta.list(t),"handler"),resourceUri:"agentsmesh://canonical/skills"},{name:"get_skill",description:"Get one skill (frontmatter + body + supporting filenames)",inputSchema:ZX,handler:s((t,e)=>Ta.get(t,e),"handler"),resourceUri:"agentsmesh://canonical/skills/{name}"},{name:"get_skill_file",description:"Read a skill supporting file by name and relative path",inputSchema:z$1.object({name:z$1.string().describe("Skill name"),path:z$1.string().describe('Relative path within the skill directory (e.g. "helper.md")')}),handler:s((t,e)=>Ta.getFile(t,e),"handler"),resourceUri:"agentsmesh://canonical/skills/{name}/files/{path}"},{name:"create_skill",description:"Create a skill directory with SKILL.md and optional supporting files",inputSchema:z$1.object({name:z$1.string().describe("Skill name (becomes directory name)"),frontmatter:z$1.record(z$1.string(),z$1.unknown()).describe("YAML frontmatter for SKILL.md"),body:z$1.string().describe("Markdown body for SKILL.md"),supportingFiles:z$1.record(z$1.string(),z$1.string()).optional().describe("Map of relative-path \u2192 content for supporting files"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Ta.create(t,e),"handler")},{name:"update_skill",description:"Update a skill. supportingFiles: string value writes/replaces, null deletes, unlisted files are untouched.",inputSchema:z$1.object({name:z$1.string().describe("Skill name"),frontmatter:z$1.record(z$1.string(),z$1.unknown()).optional().describe("New frontmatter (replaces by default; merge=true to shallow-merge)"),body:z$1.string().optional().describe("New body (omit to preserve existing)"),merge:z$1.boolean().optional().describe("Shallow-merge frontmatter instead of replacing"),supportingFiles:z$1.record(z$1.string(),z$1.union([z$1.string(),z$1.null()])).optional().describe("Map of path \u2192 content (string=write, null=delete, absent=keep)"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Ta.update(t,e),"handler")},{name:"delete_skill",description:"Delete a skill",inputSchema:z$1.object({name:z$1.string(),dry_run:z$1.boolean().optional()}),handler:s((t,e)=>Ta.delete(t,e),"handler")}];async function $M(t){if(t.filename!==void 0&&t.filename!=="agentsmesh.yaml")throw new B("PATH_TRAVERSAL","only agentsmesh.yaml is writable");if(Buffer.byteLength(t.content,"utf8")>1048576)throw new B("LIMIT_EXCEEDED","config exceeds 1 MiB cap");let e=resolve(t.projectRoot,"agentsmesh.yaml"),r=`${e}.tmp.${process.pid}.${Date.now()}`;return await writeFile(r,t.content,"utf8"),await rename(r,e),e}s($M,"safeConfigWrite");gn();Cl();async function Xm(t){try{return parse(await readFile(t,"utf8"))}catch(e){if(e.code==="ENOENT")return null;throw new B("IO_ERROR","failed to read yaml")}}s(Xm,"readYaml");async function pl(t,e){if(Buffer.byteLength(e,"utf8")>1048576)throw new B("LIMIT_EXCEEDED","file exceeds 1 MiB cap");let r=`${t}.tmp.${process.pid}.${Date.now()}`;await writeFile(r,e,"utf8"),await rename(r,t);}s(pl,"atomicWrite");var We={async getConfig(t){let e=await Xm(resolve(t.projectRoot,"agentsmesh.yaml"));if(e===null)throw new B("NO_PROJECT","agentsmesh.yaml missing");return e},async listMcpServers(t){let e=resolve(t.projectRoot,".agentsmesh/mcp.json");try{return {servers:(await br(e))?.mcpServers??null}}catch{return {servers:null}}},async getPermissions(t){return await Xm(resolve(t.projectRoot,".agentsmesh/permissions.yaml"))??null},async getHooks(t){return await Xm(resolve(t.projectRoot,".agentsmesh/hooks.yaml"))??null},async getIgnore(t){try{return {patterns:(await readFile(resolve(t.projectRoot,".agentsmesh/ignore"),"utf8")).split(/\r?\n/).filter(r=>r!==""&&!r.startsWith("#"))}}catch{return {patterns:null}}},async updateConfig(t,e){let r=await Xm(resolve(t.projectRoot,"agentsmesh.yaml"))??{},o={...r},n=s((l,m)=>{m!==void 0&&(o[l]=e.merge===true&&Array.isArray(r[l])?Array.from(new Set([...r[l],...m])):m);},"apply");n("targets",e.targets),n("features",e.features),e.conversions!==void 0&&(o.conversions=e.merge===true&&r.conversions!==void 0?{...r.conversions,...e.conversions}:e.conversions);let i=gi.safeParse(o);if(!i.success)throw new B("VALIDATION_FAILED","invalid config",i.error.issues);let a=stringify(o);return e.dry_run===true?{path:resolve(t.projectRoot,"agentsmesh.yaml"),written:false}:{path:await $M({projectRoot:t.projectRoot,content:a,filename:e.filename}),written:true}},async addMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),o=await br(r).catch(()=>null)??{mcpServers:{}};if(o.mcpServers[e.name]!==void 0)throw new B("ALREADY_EXISTS",`server "${e.name}" exists`);return o.mcpServers[e.name]=e.server,e.dry_run===true?{path:r,written:false}:(await pl(r,JSON.stringify(o,null,2)+`
562
- `),{path:r,written:true})},async updateMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),o=await br(r).catch(()=>null);if(o===null||o.mcpServers[e.name]===void 0)throw new B("NOT_FOUND",`server "${e.name}" not found`);return o.mcpServers[e.name]=e.merge===true?{...o.mcpServers[e.name],...e.server}:e.server,e.dry_run===true?{path:r,written:false}:(await pl(r,JSON.stringify(o,null,2)+`
563
- `),{path:r,written:true})},async removeMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),o=await br(r).catch(()=>null);if(o===null||o.mcpServers[e.name]===void 0)throw new B("NOT_FOUND",`server "${e.name}" not found`);return delete o.mcpServers[e.name],e.dry_run===true?{path:r,removed:false}:(await pl(r,JSON.stringify(o,null,2)+`
564
- `),{path:r,removed:true})},async updatePermissions(t,e){let r=resolve(t.projectRoot,".agentsmesh/permissions.yaml"),o=await Xm(r)??{allow:[],deny:[],ask:[]},n={...o},i=s((a,c)=>{c!==void 0&&(n[a]=e.mode==="append"?Array.from(new Set([...o[a]??[],...c])):c);},"apply");return i("allow",e.allow),i("deny",e.deny),i("ask",e.ask),e.dry_run===true?{path:r,written:false}:(await pl(r,stringify(n)),{path:r,written:true})},async updateHooks(t,e){let r=resolve(t.projectRoot,".agentsmesh/hooks.yaml");return e.dry_run===true?{path:r,written:false}:(await pl(r,stringify(e.hooks)),{path:r,written:true})},async updateIgnore(t,e){let r=resolve(t.projectRoot,".agentsmesh/ignore"),o;if(e.mode==="append"){let n=(await readFile(r,"utf8").catch(()=>"")).split(/\r?\n/).filter(Boolean);o=Array.from(new Set([...n,...e.patterns]));}else o=e.patterns;return e.dry_run===true?{path:r,written:false}:(await pl(r,o.join(`
593
+ ${e}`}s(wc,"serializeMd");var i8=/^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/,a8={rules:"_root"};function Yf(t){if(!i8.test(t)||t.includes(".."))throw new G("INVALID_NAME",`invalid name: ${t}`)}s(Yf,"checkName");function Xf(t,e,r){return resolve(t,".agentsmesh",e,`${r}.md`)}s(Xf,"pathFor");function bc(t){let{feature:e,frontmatterSchema:r,toSummary:n}=t,o=s(l=>resolve(l,".agentsmesh",e),"featureDir");async function i(l){try{return (await readdir(o(l),{withFileTypes:!0})).filter(m=>m.isFile()&&m.name.endsWith(".md")).map(m=>m.name)}catch{return []}}s(i,"listFiles");async function a(l){try{return await stat(l),!0}catch{return false}}return s(a,"exists"),{async list(l){let c=await i(l.projectRoot),m=[];for(let p of c){let u=p.replace(/\.md$/,""),f=await readFile(join(o(l.projectRoot),p),"utf8"),{frontmatter:g}=Ri(f);m.push(n(u,g));}return m},async get(l,{name:c}){Yf(c);let m=Xf(l.projectRoot,e,c);try{let p=await readFile(m,"utf8"),{frontmatter:u,body:f}=Ri(p);return {name:c,frontmatter:u,body:f}}catch(p){let u=p.code;throw u==="ENOENT"?new G("NOT_FOUND",`${e} "${c}" not found`):new G("IO_ERROR",`failed to read ${e}`,{errno:u})}},async create(l,{name:c,frontmatter:m,body:p,dry_run:u}){Yf(c);let f=r.safeParse(m);if(!f.success)throw new G("VALIDATION_FAILED","invalid frontmatter",f.error.issues);let g=Xf(l.projectRoot,e,c);if(await a(g))throw new G("ALREADY_EXISTS",`${e} "${c}" exists`);if((await i(l.projectRoot)).length>=1e3)throw new G("LIMIT_EXCEEDED",`${e} dir at ${1e3} entries`);let R=wc(m,p);return u===true?{path:g,written:false}:(await qI({projectRoot:l.projectRoot,feature:e,relativePath:`${c}.md`,content:R}),{path:g,written:true})},async update(l,{name:c,frontmatter:m,body:p,merge:u,dry_run:f}){Yf(c);let g=Xf(l.projectRoot,e,c),h;try{let P=await readFile(g,"utf8");h=Ri(P);}catch(P){let N=P.code;throw N==="ENOENT"?new G("NOT_FOUND",`${e} "${c}" not found`):new G("IO_ERROR",`failed to read ${e}`,{errno:N})}let R=m===void 0?h.frontmatter:u===true?{...h.frontmatter,...m}:m,C=r.safeParse(R);if(!C.success)throw new G("VALIDATION_FAILED","invalid frontmatter",C.error.issues);let S=p!==void 0?p:h.body,k=wc(R,S);return f===true?{path:g,written:false}:(await qI({projectRoot:l.projectRoot,feature:e,relativePath:`${c}.md`,content:k}),{path:g,written:true})},async delete(l,{name:c,force:m,dry_run:p}){if(Yf(c),a8[e]===c&&m!==true)throw new G("PROTECTED_FILE",`${e} "${c}" requires force: true`);let u=Xf(l.projectRoot,e,c);if(!await a(u))throw new G("NOT_FOUND",`${e} "${c}" not found`);return p===true?{path:u,deleted:false}:(await rm(u),{path:u,deleted:true})}}}s(bc,"createCanonicalHandlers");var l8=z.object({description:z.string().optional(),root:z.boolean().optional(),globs:z.array(z.string()).nullable().optional(),targets:z.array(z.string()).nullable().optional()}).passthrough(),FU=bc({feature:"rules",frontmatterSchema:l8,toSummary:s((t,e)=>({name:t,description:e.description??null,root:!!e.root,globs:e.globs??null,targets:e.targets??null}),"toSummary")});var c8=z.object({description:z.string().optional(),"allowed-tools":z.array(z.string()).optional()}).passthrough(),vU=bc({feature:"commands",frontmatterSchema:c8,toSummary:s((t,e)=>({name:t,description:e.description??null,allowedTools:e["allowed-tools"]??null}),"toSummary")});var m8=z.object({name:z.string().optional(),description:z.string().optional(),tools:z.array(z.string()).optional(),model:z.string().optional()}).passthrough(),MU=bc({feature:"agents",frontmatterSchema:m8,toSummary:s((t,e)=>({name:t,description:e.description??null,tools:e.tools??null,model:e.model??null}),"toSummary")});var p8=z.object({name:z.string().describe('Item name (e.g. "auth", "code-review")')}),u8=z.object({name:z.string().describe('Item name (e.g. "auth", "code-review")'),frontmatter:z.record(z.string(),z.unknown()).describe("YAML frontmatter fields (e.g. { description, globs, targets })"),body:z.string().describe("Markdown body content"),dry_run:z.boolean().optional().describe("Preview changes without writing to disk")}),d8=z.object({}).strict();function eS(t,e){let r=t==="rule"?"rules":t==="command"?"commands":"agents";return [{name:`list_${r}`,description:`List ${r} with summary metadata`,inputSchema:d8,handler:s(n=>e.list(n),"handler"),resourceUri:`agentsmesh://canonical/${r}`},{name:`get_${t}`,description:`Get a single ${t} by name`,inputSchema:p8,handler:s((n,o)=>e.get(n,o),"handler"),resourceUri:`agentsmesh://canonical/${r}/{name}`},{name:`create_${t}`,description:`Create a new ${t}`,inputSchema:u8,handler:s((n,o)=>e.create(n,o),"handler")},{name:`update_${t}`,description:`Update a ${t}. Default: replace frontmatter entirely. Set merge=true to shallow-merge. Omitting body preserves the existing body.`,inputSchema:z.object({name:z.string().describe("Name of the item to update"),frontmatter:z.record(z.string(),z.unknown()).optional().describe("New frontmatter fields (replaces by default; set merge=true to shallow-merge)"),body:z.string().optional().describe("New markdown body (omit to preserve existing)"),merge:z.boolean().optional().describe("If true, shallow-merge frontmatter instead of replacing"),dry_run:z.boolean().optional().describe("Preview changes without writing to disk")}),handler:s((n,o)=>e.update(n,o),"handler")},{name:`delete_${t}`,description:`Delete a ${t}. For rules: deleting _root requires force=true.`,inputSchema:z.object({name:z.string().describe("Name of the item to delete"),force:z.boolean().optional().describe("Required to delete protected files like _root"),dry_run:z.boolean().optional().describe("Preview without deleting")}),handler:s((n,o)=>e.delete(n,o),"handler")}]}s(eS,"canonicalTools");var $U=[...eS("rule",FU),...eS("command",vU),...eS("agent",MU)];async function jU(t){let e=resolve(t.projectRoot,".agentsmesh/skills",t.skillName),r=resolve(e,t.filePath);if(!r.startsWith(e+sep)&&r!==e)throw new G("PATH_TRAVERSAL","file escapes skill directory");try{return await readFile(r,"utf8")}catch(n){throw n.code==="ENOENT"?new G("NOT_FOUND",`skill file not found: ${t.filePath}`):new G("IO_ERROR","failed to read skill file")}}s(jU,"safeRead");var I8=/^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/,S8=/^[a-zA-Z0-9_][a-zA-Z0-9_/-]*\.[a-zA-Z0-9]+$/,WU=z.object({name:z.string().optional(),description:z.string().optional()}).passthrough();function Rp(t){if(!I8.test(t))throw new G("INVALID_NAME",`invalid skill name: ${t}`)}s(Rp,"checkName");function oS(t){if(!S8.test(t)||t.includes("..")||t.includes("//"))throw new G("PATH_TRAVERSAL",`invalid supporting-file path: ${t}`)}s(oS,"checkSupportPath");async function qf(t,e){if(Buffer.byteLength(e,"utf8")>1048576)throw new G("LIMIT_EXCEEDED","file body exceeds 1 MiB cap");await mkdir(dirname(t),{recursive:true});let r=`${t}.tmp.${process.pid}.${Date.now()}`;await writeFile(r,e,"utf8"),await rename(r,t);}s(qf,"atomicWrite");var HU=s(t=>resolve(t,".agentsmesh/skills"),"skillsDir"),Ip=s((t,e)=>resolve(HU(t),e),"skillDir"),$a={async list(t){let e;try{e=(await readdir(HU(t.projectRoot),{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name);}catch{return []}let r=[];for(let n of e)try{let o=await readFile(resolve(Ip(t.projectRoot,n),"SKILL.md"),"utf8"),i=Ri(o).frontmatter;r.push({name:n,description:i.description??null});}catch{}return r},async get(t,{name:e}){Rp(e);let r=Ip(t.projectRoot,e);try{let n=await readFile(resolve(r,"SKILL.md"),"utf8"),{frontmatter:o,body:i}=Ri(n),l=(await readdir(r)).filter(c=>c!=="SKILL.md").sort();return {name:e,frontmatter:o,body:i,supportingFiles:l}}catch(n){throw n.code==="ENOENT"?new G("NOT_FOUND",`skill "${e}" not found`):new G("IO_ERROR","failed to read skill")}},async getFile(t,{name:e,path:r}){return Rp(e),oS(r),{content:await jU({projectRoot:t.projectRoot,skillName:e,filePath:r}),encoding:"utf-8"}},async create(t,e){Rp(e.name);let r=WU.safeParse(e.frontmatter);if(!r.success)throw new G("VALIDATION_FAILED","invalid frontmatter",r.error.issues);let n=Ip(t.projectRoot,e.name),o=false;try{await stat(n),o=!0;}catch{}if(o)throw new G("ALREADY_EXISTS",`skill "${e.name}" exists`);let i=e.supportingFiles??{},a=Object.keys(i);if(a.forEach(oS),a.length+1>1e3)throw new G("LIMIT_EXCEEDED","supporting files exceed cap");if(e.dry_run===true)return {path:n,written:false,supportingFilesWritten:[]};let l=resolve(n,"SKILL.md");await qf(l,wc(e.frontmatter,e.body));for(let[c,m]of Object.entries(i))await qf(resolve(n,c),m);return {path:n,written:true,supportingFilesWritten:a}},async update(t,e){Rp(e.name);let r=Ip(t.projectRoot,e.name),n;try{let p=await readFile(resolve(r,"SKILL.md"),"utf8");n=Ri(p);}catch(p){throw p.code==="ENOENT"?new G("NOT_FOUND",`skill "${e.name}" not found`):new G("IO_ERROR","failed to read skill")}let o=e.frontmatter===void 0?n.frontmatter:e.merge===true?{...n.frontmatter,...e.frontmatter}:e.frontmatter,i=WU.safeParse(o);if(!i.success)throw new G("VALIDATION_FAILED","invalid frontmatter",i.error.issues);let a=e.body!==void 0?e.body:n.body,l=e.supportingFiles??{};Object.keys(l).forEach(oS);let c=[],m=[];if(e.dry_run===true)return Object.entries(l).forEach(([p,u])=>(u===null?m:c).push(p)),{path:r,written:false,supportingFilesAffected:{written:c,deleted:m}};await qf(resolve(r,"SKILL.md"),wc(o,a));for(let[p,u]of Object.entries(l)){let f=resolve(r,p);if(u===null)try{await rm(f),m.push(p);}catch{}else await qf(f,u),c.push(p);}return {path:r,written:true,supportingFilesAffected:{written:c,deleted:m}}},async delete(t,{name:e,dry_run:r}){Rp(e);let n=Ip(t.projectRoot,e);try{await stat(n);}catch{throw new G("NOT_FOUND",`skill "${e}" not found`)}return r===true?{path:n,deleted:false}:(await rm(n,{recursive:true}),{path:n,deleted:true})}};var C8=z.object({}).strict(),k8=z.object({name:z.string().describe("Item name")}),zU=[{name:"list_skills",description:"List skills",inputSchema:C8,handler:s(t=>$a.list(t),"handler"),resourceUri:"agentsmesh://canonical/skills"},{name:"get_skill",description:"Get one skill (frontmatter + body + supporting filenames)",inputSchema:k8,handler:s((t,e)=>$a.get(t,e),"handler"),resourceUri:"agentsmesh://canonical/skills/{name}"},{name:"get_skill_file",description:"Read a skill supporting file by name and relative path",inputSchema:z.object({name:z.string().describe("Skill name"),path:z.string().describe('Relative path within the skill directory (e.g. "helper.md")')}),handler:s((t,e)=>$a.getFile(t,e),"handler"),resourceUri:"agentsmesh://canonical/skills/{name}/files/{path}"},{name:"create_skill",description:"Create a skill directory with SKILL.md and optional supporting files",inputSchema:z.object({name:z.string().describe("Skill name (becomes directory name)"),frontmatter:z.record(z.string(),z.unknown()).describe("YAML frontmatter for SKILL.md"),body:z.string().describe("Markdown body for SKILL.md"),supportingFiles:z.record(z.string(),z.string()).optional().describe("Map of relative-path \u2192 content for supporting files"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>$a.create(t,e),"handler")},{name:"update_skill",description:"Update a skill. supportingFiles: string value writes/replaces, null deletes, unlisted files are untouched.",inputSchema:z.object({name:z.string().describe("Skill name"),frontmatter:z.record(z.string(),z.unknown()).optional().describe("New frontmatter (replaces by default; merge=true to shallow-merge)"),body:z.string().optional().describe("New body (omit to preserve existing)"),merge:z.boolean().optional().describe("Shallow-merge frontmatter instead of replacing"),supportingFiles:z.record(z.string(),z.union([z.string(),z.null()])).optional().describe("Map of path \u2192 content (string=write, null=delete, absent=keep)"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>$a.update(t,e),"handler")},{name:"delete_skill",description:"Delete a skill",inputSchema:z.object({name:z.string(),dry_run:z.boolean().optional()}),handler:s((t,e)=>$a.delete(t,e),"handler")}];async function VU(t){if(t.filename!==void 0&&t.filename!=="agentsmesh.yaml")throw new G("PATH_TRAVERSAL","only agentsmesh.yaml is writable");if(Buffer.byteLength(t.content,"utf8")>1048576)throw new G("LIMIT_EXCEEDED","config exceeds 1 MiB cap");let e=resolve(t.projectRoot,"agentsmesh.yaml"),r=`${e}.tmp.${process.pid}.${Date.now()}`;return await writeFile(r,t.content,"utf8"),await rename(r,e),e}s(VU,"safeConfigWrite");Ro();zc();async function Sp(t){try{return parse(await readFile(t,"utf8"))}catch(e){if(e.code==="ENOENT")return null;throw new G("IO_ERROR","failed to read yaml")}}s(Sp,"readYaml");async function Tc(t,e){if(Buffer.byteLength(e,"utf8")>1048576)throw new G("LIMIT_EXCEEDED","file exceeds 1 MiB cap");let r=`${t}.tmp.${process.pid}.${Date.now()}`;await writeFile(r,e,"utf8"),await rename(r,t);}s(Tc,"atomicWrite");var Xe={async getConfig(t){let e=await Sp(resolve(t.projectRoot,"agentsmesh.yaml"));if(e===null)throw new G("NO_PROJECT","agentsmesh.yaml missing");return e},async listMcpServers(t){let e=resolve(t.projectRoot,".agentsmesh/mcp.json");try{return {servers:(await vr(e))?.mcpServers??null}}catch{return {servers:null}}},async getPermissions(t){return await Sp(resolve(t.projectRoot,".agentsmesh/permissions.yaml"))??null},async getHooks(t){return await Sp(resolve(t.projectRoot,".agentsmesh/hooks.yaml"))??null},async getIgnore(t){try{return {patterns:(await readFile(resolve(t.projectRoot,".agentsmesh/ignore"),"utf8")).split(/\r?\n/).filter(r=>r!==""&&!r.startsWith("#"))}}catch{return {patterns:null}}},async updateConfig(t,e){let r=await Sp(resolve(t.projectRoot,"agentsmesh.yaml"))??{},n={...r},o=s((c,m)=>{m!==void 0&&(n[c]=e.merge===true&&Array.isArray(r[c])?Array.from(new Set([...r[c],...m])):m);},"apply");o("targets",e.targets),o("features",e.features),e.conversions!==void 0&&(n.conversions=e.merge===true&&r.conversions!==void 0?{...r.conversions,...e.conversions}:e.conversions);let i=ki.safeParse(n);if(!i.success)throw new G("VALIDATION_FAILED","invalid config",i.error.issues);let a=stringify(n);return e.dry_run===true?{path:resolve(t.projectRoot,"agentsmesh.yaml"),written:false}:{path:await VU({projectRoot:t.projectRoot,content:a,filename:e.filename}),written:true}},async addMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),n=await vr(r).catch(()=>null)??{mcpServers:{}};if(n.mcpServers[e.name]!==void 0)throw new G("ALREADY_EXISTS",`server "${e.name}" exists`);return n.mcpServers[e.name]=e.server,e.dry_run===true?{path:r,written:false}:(await Tc(r,JSON.stringify(n,null,2)+`
594
+ `),{path:r,written:true})},async updateMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),n=await vr(r).catch(()=>null);if(n===null||n.mcpServers[e.name]===void 0)throw new G("NOT_FOUND",`server "${e.name}" not found`);return n.mcpServers[e.name]=e.merge===true?{...n.mcpServers[e.name],...e.server}:e.server,e.dry_run===true?{path:r,written:false}:(await Tc(r,JSON.stringify(n,null,2)+`
595
+ `),{path:r,written:true})},async removeMcpServer(t,e){let r=resolve(t.projectRoot,".agentsmesh/mcp.json"),n=await vr(r).catch(()=>null);if(n===null||n.mcpServers[e.name]===void 0)throw new G("NOT_FOUND",`server "${e.name}" not found`);return delete n.mcpServers[e.name],e.dry_run===true?{path:r,removed:false}:(await Tc(r,JSON.stringify(n,null,2)+`
596
+ `),{path:r,removed:true})},async updatePermissions(t,e){let r=resolve(t.projectRoot,".agentsmesh/permissions.yaml"),n=await Sp(r)??{allow:[],deny:[],ask:[]},o={...n},i=s((a,l)=>{l!==void 0&&(o[a]=e.mode==="append"?Array.from(new Set([...n[a]??[],...l])):l);},"apply");return i("allow",e.allow),i("deny",e.deny),i("ask",e.ask),e.dry_run===true?{path:r,written:false}:(await Tc(r,stringify(o)),{path:r,written:true})},async updateHooks(t,e){let r=resolve(t.projectRoot,".agentsmesh/hooks.yaml");return e.dry_run===true?{path:r,written:false}:(await Tc(r,stringify(e.hooks)),{path:r,written:true})},async updateIgnore(t,e){let r=resolve(t.projectRoot,".agentsmesh/ignore"),n;if(e.mode==="append"){let o=(await readFile(r,"utf8").catch(()=>"")).split(/\r?\n/).filter(Boolean);n=Array.from(new Set([...o,...e.patterns]));}else n=e.patterns;return e.dry_run===true?{path:r,written:false}:(await Tc(r,n.join(`
565
597
  `)+`
566
- `),{path:r,written:true})}};var d2=/[;&|`$<>!\\\r\n]/u,g2=/^[A-Za-z_][A-Za-z0-9_]*$/u,f2=/^[A-Za-z][A-Za-z0-9_-]*$/u,h2=/^[A-Za-z][A-Za-z0-9_-]*(\([^)]*\))?$/u,KM=/[\r\n]/u;function y2(t){return z$1.string().min(1).max(512).refine(e=>!d2.test(e),{message:`${t} must not contain shell metacharacters (;&|\`$<>!\\\\, newlines)`})}s(y2,"noShellMeta");var lR=z$1.object({type:z$1.enum(["stdio","sse","http","streamable-http","streamable_http"]).optional(),description:z$1.string().max(1024).optional(),command:y2("command").optional(),args:z$1.array(z$1.string().max(2048)).max(100).optional(),env:z$1.record(z$1.string().regex(g2,"env key must be a valid identifier"),z$1.string().max(8192)).optional(),url:z$1.string().url().max(2048).refine(t=>/^https?:\/\//u.test(t),{message:"url must use http(s) protocol"}).optional(),headers:z$1.record(z$1.string().regex(f2,"header name must be a valid identifier"),z$1.string().max(8192)).optional(),cwd:z$1.string().max(2048).optional(),disabled:z$1.boolean().optional(),timeout:z$1.number().int().nonnegative().max(36e5).optional()}).strict(),_2=z$1.object({type:z$1.enum(["command","prompt"]).optional(),command:z$1.string().min(1).max(8192).optional(),prompt:z$1.string().min(1).max(8192).optional(),timeout:z$1.number().int().nonnegative().max(36e5).optional()}).strict().refine(t=>(t.command??"").length>0||(t.prompt??"").length>0,{message:"hook entry must define command or prompt"}),BM=z$1.string().max(256).refine(t=>!KM.test(t),{message:"hook matcher must not contain newlines"}),I2=z$1.object({matcher:BM,type:z$1.enum(["command","prompt"]).optional(),command:z$1.string().min(1).max(8192).optional(),prompt:z$1.string().min(1).max(8192).optional(),timeout:z$1.number().int().nonnegative().max(36e5).optional()}).strict().refine(t=>(t.command??"").length>0||(t.prompt??"").length>0,{message:"hook entry must define command or prompt"}),R2=z$1.object({matcher:BM,hooks:z$1.array(_2).min(1).max(50)}).strict(),S2=z$1.union([I2,R2]),WM=z$1.record(z$1.string().min(1).max(64),z$1.array(S2).max(100)),C2=z$1.string().min(1).max(256).refine(t=>!KM.test(t),{message:"permission pattern must not contain newlines"}).refine(t=>h2.test(t),{message:"permission pattern must match Tool or Tool(matcher) form"}),ug=z$1.array(C2).max(500);var Zm=z$1.object({}).strict(),E2=[{name:"get_config",description:"Read agentsmesh.yaml",inputSchema:Zm,handler:s(t=>We.getConfig(t),"handler"),resourceUri:"agentsmesh://config"},{name:"list_mcp_servers",description:"List MCP servers in canonical mcp.json",inputSchema:Zm,handler:s(t=>We.listMcpServers(t),"handler"),resourceUri:"agentsmesh://canonical/mcp"},{name:"get_permissions",description:"Read permissions.yaml",inputSchema:Zm,handler:s(t=>We.getPermissions(t),"handler"),resourceUri:"agentsmesh://canonical/permissions"},{name:"get_hooks",description:"Read hooks.yaml",inputSchema:Zm,handler:s(t=>We.getHooks(t),"handler"),resourceUri:"agentsmesh://canonical/hooks"},{name:"get_ignore",description:"Read ignore patterns",inputSchema:Zm,handler:s(t=>We.getIgnore(t),"handler"),resourceUri:"agentsmesh://canonical/ignore"}],O2=[{name:"update_config",description:"Update agentsmesh.yaml. Default: replace listed fields. Set merge=true to union arrays and shallow-merge objects. Only writes agentsmesh.yaml, never agentsmesh.local.yaml.",inputSchema:z$1.object({targets:z$1.array(z$1.string()).optional().describe('Target tool IDs (e.g. ["claude-code", "cursor"])'),features:z$1.array(z$1.string()).optional().describe('Feature names (e.g. ["rules", "commands", "mcp"])'),conversions:z$1.record(z$1.string(),z$1.unknown()).optional().describe("Conversion overrides"),merge:z$1.boolean().optional().describe("If true, union arrays and shallow-merge objects instead of replacing"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>We.updateConfig(t,e),"handler")},{name:"add_mcp_server",description:"Add an MCP server entry to .agentsmesh/mcp.json. Fails if name already exists.",inputSchema:z$1.object({name:z$1.string().describe('Server name (e.g. "github", "filesystem")'),server:lR.describe('Server config (e.g. { type: "stdio", command: "npx", args: [...], env: {...} })'),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>We.addMcpServer(t,e),"handler")},{name:"update_mcp_server",description:"Update an MCP server entry (replace or merge)",inputSchema:z$1.object({name:z$1.string(),server:lR,merge:z$1.boolean().optional(),dry_run:z$1.boolean().optional()}),handler:s((t,e)=>We.updateMcpServer(t,e),"handler")},{name:"remove_mcp_server",description:"Remove an MCP server entry",inputSchema:z$1.object({name:z$1.string(),dry_run:z$1.boolean().optional()}),handler:s((t,e)=>We.removeMcpServer(t,e),"handler")},{name:"update_permissions",description:"Update permissions.yaml. mode=replace (default) overwrites listed fields; mode=append unions and dedups.",inputSchema:z$1.object({allow:ug.optional().describe('Allowed tool patterns (e.g. ["Bash(npm run:*)"])'),deny:ug.optional().describe("Denied tool patterns"),ask:ug.optional().describe("Tools requiring confirmation"),mode:z$1.enum(["replace","append"]).optional().describe("replace=overwrite, append=union+dedup (default: replace)"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>We.updatePermissions(t,e),"handler")},{name:"update_hooks",description:"Replace hooks.yaml content entirely. Read current hooks with get_hooks, modify, then write back.",inputSchema:z$1.object({hooks:WM.describe("Full hooks structure (e.g. { PreToolUse: [...], PostToolUse: [...] })"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>We.updateHooks(t,e),"handler")},{name:"update_ignore",description:"Update .agentsmesh/ignore patterns. mode=replace (default) overwrites; mode=append adds new patterns.",inputSchema:z$1.object({patterns:z$1.array(z$1.string()).describe('Gitignore-syntax patterns (e.g. ["node_modules/", "dist/", ".env*"])'),mode:z$1.enum(["replace","append"]).optional().describe("replace=overwrite, append=add (default: replace)"),dry_run:z$1.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>We.updateIgnore(t,e),"handler")}],HM=[...E2,...O2];rI();uo();function L2(){return Object.fromEntries(kt.map(t=>[t,Object.fromEntries(Object.entries(fv).map(([e,r])=>[e,r[t]]))]))}s(L2,"buildTargetIndex");var zM=L2(),mR={async list(){return zM},async get(t){let e=zM[t.targetId];if(e===void 0)throw new B("NOT_FOUND",`unknown target: ${t.targetId}`);return {targetId:t.targetId,capabilities:e}}};dn();dn();rp();Oe();ln();ds();je();uo();async function pR(t,e){let r=ut(t);if(!r)throw new po(t,{supported:[...kt,...Id().map(o=>o.id)]});return r.generators.importFrom(e.root,{scope:e.scope??"project"})}s(pR,"importFrom");async function ul(t,e={}){let r=e.scope??"project",{config:o,context:n}=await Tt(t,r);await le(o,t);let{canonical:i}=await he(o,n.configDir,{refreshRemoteCache:e.refreshRemoteCache===true},n.canonicalDir);return {config:o,canonical:i,projectRoot:n.rootBase,scope:r,configDir:n.configDir,canonicalDir:n.canonicalDir}}s(ul,"loadProjectContext");async function uR(t){let e=t.targetFilter?[...t.targetFilter]:void 0;return Vd(t.config,t.canonical,t.projectRoot,e,{scope:t.scope})}s(uR,"lint");async function dR(t){let e=await Lr(t);return {...Hd(e),results:e}}s(dR,"diff");async function gR(t){return Jd(t)}s(gR,"check");dn();ln();Ri();rp();xt();je();Ct();T();function ui(t){if(t instanceof B)throw t;if(t instanceof po)throw new B("VALIDATION_FAILED",t.message);let e=t instanceof Error?t.message:String(t);throw /unknown.*--from|unknown.*--to|unknown target/i.test(e)?new B("VALIDATION_FAILED",e):/lock/i.test(e)?new B("LOCK_HELD","generate lock is held"):new B("IO_ERROR","engine failure",{reason:e})}s(ui,"wrapEngineError");async function VM(t,e){if(e.dry_run===true)throw new B("VALIDATION_FAILED","dry_run is not supported for import \u2014 the engine writes files directly. Use diff to preview changes instead.");try{let r=await pR(e.from,{root:t.projectRoot,scope:"project"});return {imported:r.length,files:r.map(o=>({fromPath:o.fromPath,toPath:o.toPath,feature:o.feature})),warnings:[],errors:[]}}catch(r){if(r instanceof po)throw new B("VALIDATION_FAILED",`unknown target "${e.from}"`);let o=r instanceof Error?r.message:String(r);if(/unknown target|invalid target|not found/i.test(o))throw new B("VALIDATION_FAILED",o);ui(r);}}s(VM,"importFromTarget");async function JM(t,e){try{let r={from:e.from,to:e.to,"dry-run":e.dry_run===!0},o=await sg(r,t.projectRoot);return {filesAffected:o.data.summary.created+o.data.summary.updated,dryRun:e.dry_run===!0,warnings:[],errors:[]}}catch(r){let o=r instanceof Error?r.message:String(r);if(/unknown.*--from|unknown.*--to|unknown target/i.test(o))throw new B("VALIDATION_FAILED",o);ui(r);}}s(JM,"convert");async function T2(t,e){try{let r=await ul(t.projectRoot),o=e.targets&&e.targets.length>0?e.targets:void 0,i=(await Lr({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope,targetFilter:o})).filter(m=>m.status!=="skipped"),a=i.filter(m=>m.status==="created"||m.status==="updated");if(!e.dry_run)for(let m of a){let p=el(r.projectRoot,m.path,m.target);await _(p,m.content);}let c={};for(let m of a){let p=c[m.target]??{filesWritten:0};c[m.target]={filesWritten:p.filesWritten+1};}let l={filesWritten:a.length,byTarget:c,lockfileUpdated:!e.dry_run&&a.length>=0,errors:[],warnings:[]};return e.verbose===!0&&(l.files=i.map(m=>m.path)),l}catch(r){ui(r);}}s(T2,"generate");async function b2(t,e){try{let r=await ul(t.projectRoot),o=await uR({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope});return {issues:(e.severity?o.diagnostics.filter(i=>i.level===e.severity):o.diagnostics).map(i=>({level:i.level,file:i.file,target:i.target,message:i.message}))}}catch(r){ui(r);}}s(b2,"lint");async function P2(t){try{let e=await ul(t.projectRoot),r=await gR({config:e.config,configDir:e.configDir,canonicalDir:e.canonicalDir});return {drift:!r.inSync,missing:[...r.removed],extra:[...r.added],modified:[...r.modified]}}catch(e){ui(e);}}s(P2,"check");async function x2(t,e){try{let r=await ul(t.projectRoot),o=e.targets&&e.targets.length>0?e.targets:void 0,n=await dR({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope,targetFilter:o});return {willCreate:n.summary.new,willModify:n.summary.updated,willDelete:n.summary.deleted}}catch(r){ui(r);}}s(x2,"diff");var ba={generate:T2,lint:b2,check:P2,diff:x2,import:VM,convert:JM};var YM=z$1.object({}).strict(),XM=[{name:"list_target_capabilities",description:"List support matrix for all targets",inputSchema:YM,handler:s(()=>mR.list(),"handler"),resourceUri:"agentsmesh://capabilities"},{name:"get_target_capabilities",description:"Get feature support levels for a specific target (e.g. which features are native, mapped, or unsupported)",inputSchema:z$1.object({targetId:z$1.string().describe('Target tool ID (e.g. "claude-code", "cursor")')}),handler:s((t,e)=>mR.get(e),"handler"),resourceUri:"agentsmesh://capabilities/{targetId}"},{name:"generate",description:"Generate target-native config files from canonical .agentsmesh/ content. Propagates rules, commands, agents, skills, MCP, hooks, ignore, and permissions to all configured targets.",inputSchema:z$1.object({targets:z$1.array(z$1.string()).optional().describe("Filter to specific targets (default: all from agentsmesh.yaml)"),features:z$1.array(z$1.string()).optional().describe("Filter to specific features"),verbose:z$1.boolean().optional().describe("Include full file list in response"),dry_run:z$1.boolean().optional().describe("Preview without writing files")}),handler:s((t,e)=>ba.generate(t,e),"handler")},{name:"lint",description:"Lint canonical .agentsmesh/ files for schema errors, missing frontmatter, and other issues",inputSchema:z$1.object({severity:z$1.enum(["error","warning","info"]).optional().describe("Filter results by minimum severity")}),handler:s((t,e)=>ba.lint(t,e),"handler")},{name:"check",description:"Detect drift between canonical and lockfile",inputSchema:YM,handler:s(t=>ba.check(t),"handler")},{name:"diff",description:"Preview what generate would create, modify, or delete without writing",inputSchema:z$1.object({targets:z$1.array(z$1.string()).optional().describe("Filter to specific targets"),features:z$1.array(z$1.string()).optional().describe("Filter to specific features")}),handler:s((t,e)=>ba.diff(t,e),"handler")},{name:"import",description:"Import another tool's native config into canonical .agentsmesh/. Note: dry_run is not supported (the engine writes directly).",inputSchema:z$1.object({from:z$1.string().describe('Source target ID to import from (e.g. "cursor", "claude-code")'),features:z$1.array(z$1.string()).optional().describe("Restrict import to specific features"),dry_run:z$1.boolean().optional().describe("NOT SUPPORTED \u2014 will throw VALIDATION_FAILED. Use diff instead.")}),handler:s((t,e)=>ba.import(t,e),"handler")},{name:"convert",description:"Convert config directly from one tool to another (e.g. Cursor \u2192 Claude Code) without creating canonical .agentsmesh/ files",inputSchema:z$1.object({from:z$1.string().describe('Source target ID (e.g. "cursor")'),to:z$1.string().describe('Destination target ID (e.g. "claude-code")'),dry_run:z$1.boolean().optional().describe("Preview conversion without writing files")}),handler:s((t,e)=>ba.convert(t,e),"handler")}];function ZM(t){let e=toJSONSchema(t,{target:"draft-07"});return delete e.$schema,e}s(ZM,"zodToMcpSchema");var dg=[...bM,...MM,...HM,...XM],fR=dg.filter(t=>t.resourceUri!==void 0).map(t=>({uri:t.resourceUri,name:t.name,description:t.description,read:s((e,r)=>t.handler(e,r),"read")}));Ri();async function v2(t){let e=resolve(t);for(;;){try{return await stat(resolve(e,"agentsmesh.yaml")),e}catch{}let r=dirname(e);if(r===e)throw new B("NO_PROJECT","agentsmesh.yaml not found");e=r;}}s(v2,"findProjectRoot");async function hR(t){let e=await v2(t.cwd);return {projectRoot:e,loadCanonical:s(()=>Ae(e),"loadCanonical")}}s(hR,"resolveContext");async function z2(){let t=dirname(fileURLToPath(import.meta.url));for(let e of [resolve(t,"../../package.json"),resolve(t,"../package.json"),resolve(t,"../../../package.json")])try{let r=JSON.parse(await readFile(e,"utf8"));if(r.name==="agentsmesh")return r.version}catch{}return "0.0.0"}s(z2,"pkgVersion");function V2(t,e){return new RegExp("^"+t.replace(/\{[^}]+\}/g,"([^/]+)")+"$").test(e)}s(V2,"matchTemplate");function J2(t,e){let r=[...t.matchAll(/\{([^}]+)\}/g)].map(i=>i[1]),n=new RegExp("^"+t.replace(/\{[^}]+\}/g,"([^/]+)")+"$").exec(e);return n?Object.fromEntries(r.map((i,a)=>[i,n[a+1]])):{}}s(J2,"extractTemplateParams");async function qM(){let t=new Server({name:"agentsmesh-mcp",version:await z2()},{capabilities:{tools:{},resources:{}}});t.setRequestHandler(ListToolsRequestSchema,async()=>({tools:dg.map(e=>({name:e.name,description:e.description,inputSchema:ZM(e.inputSchema)}))})),t.setRequestHandler(CallToolRequestSchema,async e=>{let r=dg.find(o=>o.name===e.params.name);if(!r)return {isError:true,content:[{type:"text",text:JSON.stringify({code:"NOT_FOUND",message:`unknown tool: ${e.params.name}`})}]};try{let o=r.inputSchema.safeParse(e.params.arguments??{});if(!o.success)throw new B("VALIDATION_FAILED","invalid input",o.error.issues);let n=await hR({cwd:process.cwd()}),i=await r.handler(n,o.data);return {content:[{type:"text",text:JSON.stringify(i)}]}}catch(o){let n=o instanceof B?o.toEnvelope():{code:"IO_ERROR",message:OM(o instanceof Error?o.message:"unknown error")};return {isError:true,content:[{type:"text",text:JSON.stringify(n)}]}}}),t.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:fR.map(e=>({uri:e.uri,name:e.name,description:e.description}))})),t.setRequestHandler(ReadResourceRequestSchema,async e=>{let r=fR.find(a=>a.uri===e.params.uri||V2(a.uri,e.params.uri));if(!r)throw new B("NOT_FOUND",`resource not found: ${e.params.uri}`);let o=await hR({cwd:process.cwd()}),n=J2(r.uri,e.params.uri),i=await r.read(o,n);return {contents:[{uri:e.params.uri,mimeType:"application/json",text:JSON.stringify(i)}]}}),await t.connect(new StdioServerTransport);}s(qM,"startServer");ft();async function t$(t,e){ER(),await qM();}s(t$,"runMcp");var e$={generate:s(async(t,e)=>{let r=await rl(t,void 0,{printMatrix:t.json!==true});Ee("generate",r,t,()=>ol(r));},"generate"),init:s(async(t,e)=>{let r=await Pv(process.cwd(),{yes:t.yes===true,global:t.global===true});Ee("init",r,t,()=>xv(r));},"init"),import:s(async(t,e)=>{let r=await Nv(t);Ee("import",r,t,()=>Wv(r));},"import"),diff:s(async(t,e)=>{let r=await vv(t);Ee("diff",r,t,()=>Hv(r));},"diff"),lint:s(async(t,e)=>{let r=await Uv(t);Ee("lint",r,t,()=>Kv(r));},"lint"),check:s(async(t,e)=>{let r=await Yv(t);Ee("check",r,t,()=>Bv(r));},"check"),merge:s(async(t,e)=>{let r=await Qv(t);Ee("merge",r,t,()=>zv(r));},"merge"),matrix:s(async(t,e)=>{let r=await Fm(t);Ee("matrix",r,t,()=>Gm(r,{verbose:t.verbose===true}));},"matrix"),watch:s(async(t,e)=>{if(t.json===true){Da("watch",{success:false,error:"--json is not supported with watch"}),process.exit(1);return}let r=await Jv(t),o=s(()=>{r.stop().then(()=>process.exit(0));},"stop");process.on("SIGINT",o),process.on("SIGTERM",o);},"watch"),install:s(async(t,e)=>{t.json===true&&(t.force=true);let r=await iM(t,e,process.cwd());Ee("install",r,t,()=>aM(r));},"install"),plugin:s(async(t,e)=>{let r=await pM(t,e,process.cwd());Ee("plugin",r,t,()=>uM(r));},"plugin"),target:s(async(t,e)=>{let r=await SM(t,e,process.cwd());Ee("target",r,t,()=>CM(r));},"target"),convert:s(async(t,e)=>{let r=await sg(t);Ee("convert",r,t,()=>EM(r));},"convert"),mcp:s(async(t,e)=>{await t$();},"mcp")};function Z2(t){let e={},r=[],o="help";for(let n=0;n<t.length;n++){let i=t[n];if(o==="help"&&i==="--version")return {command:"version",flags:{},args:[]};if(o==="help"&&i==="--help")return {command:"help",flags:{},args:[]};if(i.startsWith("--")){let a=i.slice(2),c=t[n+1];c===void 0||c.startsWith("--")?e[a]=true:(e[a]=c,n++);continue}o==="help"?o=i:r.push(i);}return {command:o,flags:e,args:r}}s(Z2,"parseArgs");var Q2=RR(e$);async function q2(t){let{command:e,flags:r,args:o}=t;if(e==="help"){kR();return}if(e==="version"){TR();return}r.json===true&&CR(),await Q2.route(e,r,o);}s(q2,"main");function tZ(){let t=process.argv[1];if(!t)return false;let e=fileURLToPath(import.meta.url);try{let r=resolve(process.cwd(),t);return r===e||realpathSync(r)===realpathSync(e)}catch{return t.endsWith("cli.js")||t.includes("agentsmesh")}}s(tZ,"isMainModule");if(tZ()){let t=Z2(process.argv.slice(2));q2(t).catch(e=>bR(e instanceof Error?e:new Error(String(e)),{verbose:t.flags.verbose===true,json:t.flags.json===true,command:t.command}));}
567
- export{Z2 as parseArgs};
598
+ `),{path:r,written:true})}};var G8=/[;&|`$<>!\\\r\n]/u,j8=/^[A-Za-z_][A-Za-z0-9_]*$/u,U8=/^[A-Za-z][A-Za-z0-9_-]*$/u,B8=/^[A-Za-z][A-Za-z0-9_-]*(\([^)]*\))?$/u,XU=/[\r\n]/u;function K8(t){return z.string().min(1).max(512).refine(e=>!G8.test(e),{message:`${t} must not contain shell metacharacters (;&|\`$<>!\\\\, newlines)`})}s(K8,"noShellMeta");var aS=z.object({type:z.enum(["stdio","sse","http","streamable-http","streamable_http"]).optional(),description:z.string().max(1024).optional(),command:K8("command").optional(),args:z.array(z.string().max(2048)).max(100).optional(),env:z.record(z.string().regex(j8,"env key must be a valid identifier"),z.string().max(8192)).optional(),url:z.string().url().max(2048).refine(t=>/^https?:\/\//u.test(t),{message:"url must use http(s) protocol"}).optional(),headers:z.record(z.string().regex(U8,"header name must be a valid identifier"),z.string().max(8192)).optional(),cwd:z.string().max(2048).optional(),disabled:z.boolean().optional(),timeout:z.number().int().nonnegative().max(36e5).optional()}).strict(),W8=z.object({type:z.enum(["command","prompt"]).optional(),command:z.string().min(1).max(8192).optional(),prompt:z.string().min(1).max(8192).optional(),timeout:z.number().int().nonnegative().max(36e5).optional()}).strict().refine(t=>(t.command??"").length>0||(t.prompt??"").length>0,{message:"hook entry must define command or prompt"}),ZU=z.string().max(256).refine(t=>!XU.test(t),{message:"hook matcher must not contain newlines"}),H8=z.object({matcher:ZU,type:z.enum(["command","prompt"]).optional(),command:z.string().min(1).max(8192).optional(),prompt:z.string().min(1).max(8192).optional(),timeout:z.number().int().nonnegative().max(36e5).optional()}).strict().refine(t=>(t.command??"").length>0||(t.prompt??"").length>0,{message:"hook entry must define command or prompt"}),z8=z.object({matcher:ZU,hooks:z.array(W8).min(1).max(50)}).strict(),V8=z.union([H8,z8]),QU=z.record(z.string().min(1).max(64),z.array(V8).max(100)),J8=z.string().min(1).max(256).refine(t=>!XU.test(t),{message:"permission pattern must not contain newlines"}).refine(t=>B8.test(t),{message:"permission pattern must match Tool or Tool(matcher) form"}),eg=z.array(J8).max(500);var Cp=z.object({}).strict(),Y8=[{name:"get_config",description:"Read agentsmesh.yaml",inputSchema:Cp,handler:s(t=>Xe.getConfig(t),"handler"),resourceUri:"agentsmesh://config"},{name:"list_mcp_servers",description:"List MCP servers in canonical mcp.json",inputSchema:Cp,handler:s(t=>Xe.listMcpServers(t),"handler"),resourceUri:"agentsmesh://canonical/mcp"},{name:"get_permissions",description:"Read permissions.yaml",inputSchema:Cp,handler:s(t=>Xe.getPermissions(t),"handler"),resourceUri:"agentsmesh://canonical/permissions"},{name:"get_hooks",description:"Read hooks.yaml",inputSchema:Cp,handler:s(t=>Xe.getHooks(t),"handler"),resourceUri:"agentsmesh://canonical/hooks"},{name:"get_ignore",description:"Read ignore patterns",inputSchema:Cp,handler:s(t=>Xe.getIgnore(t),"handler"),resourceUri:"agentsmesh://canonical/ignore"}],X8=[{name:"update_config",description:"Update agentsmesh.yaml. Default: replace listed fields. Set merge=true to union arrays and shallow-merge objects. Only writes agentsmesh.yaml, never agentsmesh.local.yaml.",inputSchema:z.object({targets:z.array(z.string()).optional().describe('Target tool IDs (e.g. ["claude-code", "cursor"])'),features:z.array(z.string()).optional().describe('Feature names (e.g. ["rules", "commands", "mcp"])'),conversions:z.record(z.string(),z.unknown()).optional().describe("Conversion overrides"),merge:z.boolean().optional().describe("If true, union arrays and shallow-merge objects instead of replacing"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Xe.updateConfig(t,e),"handler")},{name:"add_mcp_server",description:"Add an MCP server entry to .agentsmesh/mcp.json. Fails if name already exists.",inputSchema:z.object({name:z.string().describe('Server name (e.g. "github", "filesystem")'),server:aS.describe('Server config (e.g. { type: "stdio", command: "npx", args: [...], env: {...} })'),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Xe.addMcpServer(t,e),"handler")},{name:"update_mcp_server",description:"Update an MCP server entry (replace or merge)",inputSchema:z.object({name:z.string(),server:aS,merge:z.boolean().optional(),dry_run:z.boolean().optional()}),handler:s((t,e)=>Xe.updateMcpServer(t,e),"handler")},{name:"remove_mcp_server",description:"Remove an MCP server entry",inputSchema:z.object({name:z.string(),dry_run:z.boolean().optional()}),handler:s((t,e)=>Xe.removeMcpServer(t,e),"handler")},{name:"update_permissions",description:"Update permissions.yaml. mode=replace (default) overwrites listed fields; mode=append unions and dedups.",inputSchema:z.object({allow:eg.optional().describe('Allowed tool patterns (e.g. ["Bash(npm run:*)"])'),deny:eg.optional().describe("Denied tool patterns"),ask:eg.optional().describe("Tools requiring confirmation"),mode:z.enum(["replace","append"]).optional().describe("replace=overwrite, append=union+dedup (default: replace)"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Xe.updatePermissions(t,e),"handler")},{name:"update_hooks",description:"Replace hooks.yaml content entirely. Read current hooks with get_hooks, modify, then write back.",inputSchema:z.object({hooks:QU.describe("Full hooks structure (e.g. { PreToolUse: [...], PostToolUse: [...] })"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Xe.updateHooks(t,e),"handler")},{name:"update_ignore",description:"Update .agentsmesh/ignore patterns. mode=replace (default) overwrites; mode=append adds new patterns.",inputSchema:z.object({patterns:z.array(z.string()).describe('Gitignore-syntax patterns (e.g. ["node_modules/", "dist/", ".env*"])'),mode:z.enum(["replace","append"]).optional().describe("replace=overwrite, append=add (default: replace)"),dry_run:z.boolean().optional().describe("Preview without writing")}),handler:s((t,e)=>Xe.updateIgnore(t,e),"handler")}],qU=[...Y8,...X8];zR();Rn();function Z8(){return Object.fromEntries(Ft.map(t=>[t,Object.fromEntries(Object.entries(r$).map(([e,r])=>[e,r[t]]))]))}s(Z8,"buildTargetIndex");var t0=Z8(),lS={async list(){return t0},async get(t){let e=t0[t.targetId];if(e===void 0)throw new G("NOT_FOUND",`unknown target: ${t.targetId}`);return {targetId:t.targetId,capabilities:e}}};_o();_o();Dp();Yt();fo();fn();se();Rn();async function cS(t,e){let r=et(t);if(!r)throw new _n(t,{supported:[...Ft,...Yp().map(n=>n.id)]});return r.generators.importFrom(e.root,{scope:e.scope??"project"})}s(cS,"importFrom");async function xc(t,e={}){let r=e.scope??"project",{config:n,context:o}=await yt(t,r);await Wt(n,t);let{canonical:i}=await ke(n,o.configDir,{refreshRemoteCache:e.refreshRemoteCache===true},o.canonicalDir);return {config:n,canonical:i,projectRoot:o.rootBase,scope:r,configDir:o.configDir,canonicalDir:o.canonicalDir}}s(xc,"loadProjectContext");async function mS(t){let e=t.targetFilter?[...t.targetFilter]:void 0;return Of(t.config,t.canonical,t.projectRoot,e,{scope:t.scope})}s(mS,"lint");async function pS(t){let e=await Tr(t);return {...Ef(e),results:e}}s(pS,"diff");async function uS(t){return Af(t)}s(uS,"check");_o();fo();Ai();Dp();Pt();se();Et();w();function Ii(t){if(t instanceof G)throw t;if(t instanceof _n)throw new G("VALIDATION_FAILED",t.message);let e=t instanceof Error?t.message:String(t);throw /unknown.*--from|unknown.*--to|unknown target/i.test(e)?new G("VALIDATION_FAILED",e):/lock/i.test(e)?new G("LOCK_HELD","generate lock is held"):new G("IO_ERROR","engine failure",{reason:e})}s(Ii,"wrapEngineError");async function e0(t,e){if(e.dry_run===true)throw new G("VALIDATION_FAILED","dry_run is not supported for import \u2014 the engine writes files directly. Use diff to preview changes instead.");try{let r=await cS(e.from,{root:t.projectRoot,scope:"project"});return {imported:r.length,files:r.map(n=>({fromPath:n.fromPath,toPath:n.toPath,feature:n.feature})),warnings:[],errors:[]}}catch(r){if(r instanceof _n)throw new G("VALIDATION_FAILED",`unknown target "${e.from}"`);let n=r instanceof Error?r.message:String(r);if(/unknown target|invalid target|not found/i.test(n))throw new G("VALIDATION_FAILED",n);Ii(r);}}s(e0,"importFromTarget");async function r0(t,e){try{let r={from:e.from,to:e.to,"dry-run":e.dry_run===!0},n=await Vf(r,t.projectRoot);return {filesAffected:n.data.summary.created+n.data.summary.updated,dryRun:e.dry_run===!0,warnings:[],errors:[]}}catch(r){let n=r instanceof Error?r.message:String(r);if(/unknown.*--from|unknown.*--to|unknown target/i.test(n))throw new G("VALIDATION_FAILED",n);Ii(r);}}s(r0,"convert");async function e9(t,e){try{let r=await xc(t.projectRoot),n=e.targets&&e.targets.length>0?e.targets:void 0,i=(await Tr({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope,targetFilter:n})).filter(m=>m.status!=="skipped"),a=i.filter(m=>m.status==="created"||m.status==="updated");if(!e.dry_run)for(let m of a){let p=yc(r.projectRoot,m.path,m.target);await I(p,m.content);}let l={};for(let m of a){let p=l[m.target]??{filesWritten:0};l[m.target]={filesWritten:p.filesWritten+1};}let c={filesWritten:a.length,byTarget:l,lockfileUpdated:!e.dry_run&&a.length>=0,errors:[],warnings:[]};return e.verbose===!0&&(c.files=i.map(m=>m.path)),c}catch(r){Ii(r);}}s(e9,"generate");async function r9(t,e){try{let r=await xc(t.projectRoot),n=await mS({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope});return {issues:(e.severity?n.diagnostics.filter(i=>i.level===e.severity):n.diagnostics).map(i=>({level:i.level,file:i.file,target:i.target,message:i.message}))}}catch(r){Ii(r);}}s(r9,"lint");async function n9(t){try{let e=await xc(t.projectRoot),r=await uS({config:e.config,configDir:e.configDir,canonicalDir:e.canonicalDir});return {drift:!r.inSync,missing:[...r.removed],extra:[...r.added],modified:[...r.modified]}}catch(e){Ii(e);}}s(n9,"check");async function o9(t,e){try{let r=await xc(t.projectRoot),n=e.targets&&e.targets.length>0?e.targets:void 0,o=await pS({config:r.config,canonical:r.canonical,projectRoot:r.projectRoot,scope:r.scope,targetFilter:n});return {willCreate:o.summary.new,willModify:o.summary.updated,willDelete:o.summary.deleted}}catch(r){Ii(r);}}s(o9,"diff");var Ga={generate:e9,lint:r9,check:n9,diff:o9,import:e0,convert:r0};var n0=z.object({}).strict(),o0=[{name:"list_target_capabilities",description:"List support matrix for all targets",inputSchema:n0,handler:s(()=>lS.list(),"handler"),resourceUri:"agentsmesh://capabilities"},{name:"get_target_capabilities",description:"Get feature support levels for a specific target (e.g. which features are native, mapped, or unsupported)",inputSchema:z.object({targetId:z.string().describe('Target tool ID (e.g. "claude-code", "cursor")')}),handler:s((t,e)=>lS.get(e),"handler"),resourceUri:"agentsmesh://capabilities/{targetId}"},{name:"generate",description:"Generate target-native config files from canonical .agentsmesh/ content. Propagates rules, commands, agents, skills, MCP, hooks, ignore, and permissions to all configured targets.",inputSchema:z.object({targets:z.array(z.string()).optional().describe("Filter to specific targets (default: all from agentsmesh.yaml)"),features:z.array(z.string()).optional().describe("Filter to specific features"),verbose:z.boolean().optional().describe("Include full file list in response"),dry_run:z.boolean().optional().describe("Preview without writing files")}),handler:s((t,e)=>Ga.generate(t,e),"handler")},{name:"lint",description:"Lint canonical .agentsmesh/ files for schema errors, missing frontmatter, and other issues",inputSchema:z.object({severity:z.enum(["error","warning","info"]).optional().describe("Filter results by minimum severity")}),handler:s((t,e)=>Ga.lint(t,e),"handler")},{name:"check",description:"Detect drift between canonical and lockfile",inputSchema:n0,handler:s(t=>Ga.check(t),"handler")},{name:"diff",description:"Preview what generate would create, modify, or delete without writing",inputSchema:z.object({targets:z.array(z.string()).optional().describe("Filter to specific targets"),features:z.array(z.string()).optional().describe("Filter to specific features")}),handler:s((t,e)=>Ga.diff(t,e),"handler")},{name:"import",description:"Import another tool's native config into canonical .agentsmesh/. Note: dry_run is not supported (the engine writes directly).",inputSchema:z.object({from:z.string().describe('Source target ID to import from (e.g. "cursor", "claude-code")'),features:z.array(z.string()).optional().describe("Restrict import to specific features"),dry_run:z.boolean().optional().describe("NOT SUPPORTED \u2014 will throw VALIDATION_FAILED. Use diff instead.")}),handler:s((t,e)=>Ga.import(t,e),"handler")},{name:"convert",description:"Convert config directly from one tool to another (e.g. Cursor \u2192 Claude Code) without creating canonical .agentsmesh/ files",inputSchema:z.object({from:z.string().describe('Source target ID (e.g. "cursor")'),to:z.string().describe('Destination target ID (e.g. "claude-code")'),dry_run:z.boolean().optional().describe("Preview conversion without writing files")}),handler:s((t,e)=>Ga.convert(t,e),"handler")}];function dS(t){if(t instanceof G)throw t;let e=t instanceof Error?t.message:String(t),r=Jf(e);throw /lock|LockAcquisitionError/i.test(r)?new G("LOCK_HELD",".install.lock is held by another process"):/missing source|usage:|non-interactive|invalid|unknown|not found|escapes the source root/i.test(r)?new G("VALIDATION_FAILED",r):new G("IO_ERROR","install pipeline failure",{reason:r})}s(dS,"wrapInstallError");function s9(t){let e={force:true};return t.path!==void 0&&(e.path=t.path),t.target!==void 0&&(e.target=t.target),t.as!==void 0&&(e.as=t.as),t.name!==void 0&&(e.name=t.name),t.extends===true&&(e.extends=true),t.all===true&&(e.all=true),t.sync===true&&(e.sync=true),t.dry_run===true&&(e["dry-run"]=true),t.global===true&&(e.global=true),e}s(s9,"toInstallFlags");function i9(t){let e={force:true};return t.all===true&&(e.all=true),t.keep_pack===true&&(e["keep-pack"]=true),t.keep_generated===true&&(e["keep-generated"]=true),t.dry_run===true&&(e["dry-run"]=true),t.global===true&&(e.global=true),e}s(i9,"toUninstallFlags");async function a9(t,e){if(typeof e.source!="string"||e.source.trim().length===0)throw new G("VALIDATION_FAILED","install: `source` is required");try{let r=await _p(s9(e),[e.source],t.projectRoot);if(r.exitCode!==0)throw new G("IO_ERROR",`install exited ${r.exitCode}`);return r.data}catch(r){dS(r);}}s(a9,"install");async function l9(t,e){if(e.all!==true&&(!Array.isArray(e.names)||e.names.length===0))throw new G("VALIDATION_FAILED","uninstall: pass `names: [...]` or set `all: true`");try{return (await Kf(i9(e),e.names??[],t.projectRoot)).data}catch(r){dS(r);}}s(l9,"uninstall");async function c9(t,e={}){try{let r={};return e.global===!0&&(r.global=!0),(await Wf(r,t.projectRoot)).data}catch(r){dS(r);}}s(c9,"installsList");var rg={install:a9,uninstall:l9,installsList:c9};var m9=z.object({source:z.string().min(1).describe("Pack source \u2014 GitHub/GitLab shorthand (`github:org/repo[@ref]`), git URL, SSH URL, or local path (`local:./relative/dir`)."),path:z.string().optional().describe("Subdirectory within the source repo to install from. Combined with `as` for manual single-category installs."),target:z.string().optional().describe("Target tool ID hint for native-format auto-discovery (e.g. `claude-code`, `cursor`). Bypasses the multi-signal classifier."),as:z.enum(["rules","commands","agents","skills"]).optional().describe("Manual install kind. When set, the source is treated as a flat collection of that category (skips the auto-classifier)."),name:z.string().optional().describe("Override the generated install entry name (default: derived from `org-repo` shorthand or the source path)."),extends:z.boolean().optional().describe("Record as an `extends:` entry in `agentsmesh.yaml` instead of materializing a pack in `.agentsmesh/packs/`. Always-on-latest semantics; resolved every `generate`."),all:z.boolean().optional().describe("Install every sub-pack from a marketplace source (`.claude-plugin/marketplace.json`) or every flat collection in a multi-collection layout."),sync:z.boolean().optional().describe("Reinstall missing packs from `.agentsmesh/installs.yaml` instead of from `source`."),dry_run:z.boolean().optional().describe("Preview what would be installed without writing."),global:z.boolean().optional().describe("Install into the global scope (`~/.agentsmesh/`) instead of the project scope. Regenerates user-level outputs.")}),p9=z.object({names:z.array(z.string().min(1)).default([]).describe("Install names to remove (from `installs.yaml`). Required unless `all: true`. Each name removes the pack directory under `.agentsmesh/packs/`, the matching `installs.yaml` row, and the matching `agentsmesh.yaml` `extends:` row when present."),all:z.boolean().optional().describe("Remove every install in the current scope. `names` is ignored when `all: true`."),keep_pack:z.boolean().optional().describe("Leave `.agentsmesh/packs/<name>/` on disk; only drop yaml entries. Useful when the user has locally-modified files."),keep_generated:z.boolean().optional().describe("Skip the post-uninstall `generate` pass. Target trees keep now-stale files until the next manual `generate`; a warning lists what will be cleaned then."),dry_run:z.boolean().optional().describe("Preview the removal plan; no writes. Legacy-manifest migration runs in memory only."),global:z.boolean().optional().describe("Uninstall from the global scope (`~/.agentsmesh/`) instead of the project scope.")}),u9=z.object({global:z.boolean().optional().describe("Read from `~/.agentsmesh/installs.yaml` instead of the project scope.")}),s0=[{name:"install",description:"Install a community pack from a URL or local path. Auto-classifies the source layout (anthropic-skill-pack, canonical-agentsmesh, tool-native, or unknown) and dispatches accordingly; `--target` / `--as` override the classifier. Always runs non-interactively (every prompt accepts its documented `--force` default).",inputSchema:m9,handler:s((t,e)=>rg.install(t,e),"handler")},{name:"uninstall",description:"Remove one or more installed packs. Drops the pack directory, the `installs.yaml` row, and the matching `agentsmesh.yaml` `extends:` row (when present), then runs `generate` so stale target files are cleaned. Mid-batch failures are isolated; survivors still apply and the response surfaces failures in `data.failed[]`.",inputSchema:p9,handler:s((t,e)=>rg.uninstall(t,e),"handler")},{name:"installs_list",description:"List installed packs in the current scope. Read-only. Hydrates `installed_at` and `source_type` from each pack manifest where available; both are `null` for legacy packs without `.agentsmesh-install-manifest.json`.",inputSchema:u9,handler:s((t,e)=>rg.installsList(t,e),"handler"),resourceUri:"agentsmesh://installs"}];function i0(t){let e=toJSONSchema(t,{target:"draft-07"});return delete e.$schema,e}s(i0,"zodToMcpSchema");var ng=[...$U,...zU,...qU,...o0,...s0],fS=ng.filter(t=>t.resourceUri!==void 0).map(t=>({uri:t.resourceUri,name:t.name,description:t.description,read:s((e,r)=>t.handler(e,r),"read")}));Ai();async function h9(t){let e=resolve(t);for(;;){try{return await stat(resolve(e,"agentsmesh.yaml")),e}catch{}let r=dirname(e);if(r===e)throw new G("NO_PROJECT","agentsmesh.yaml not found");e=r;}}s(h9,"findProjectRoot");async function gS(t){let e=await h9(t.cwd);return {projectRoot:e,loadCanonical:s(()=>Ee(e),"loadCanonical")}}s(gS,"resolveContext");async function O9(){let t=dirname(fileURLToPath(import.meta.url));for(let e of [resolve(t,"../../package.json"),resolve(t,"../package.json"),resolve(t,"../../../package.json")])try{let r=JSON.parse(await readFile(e,"utf8"));if(r.name==="agentsmesh")return r.version}catch{}return "0.0.0"}s(O9,"pkgVersion");function A9(t,e){return new RegExp("^"+t.replace(/\{[^}]+\}/g,"([^/]+)")+"$").test(e)}s(A9,"matchTemplate");function w9(t,e){let r=[...t.matchAll(/\{([^}]+)\}/g)].map(i=>i[1]),o=new RegExp("^"+t.replace(/\{[^}]+\}/g,"([^/]+)")+"$").exec(e);return o?Object.fromEntries(r.map((i,a)=>[i,o[a+1]])):{}}s(w9,"extractTemplateParams");async function l0(){let t=new Server({name:"agentsmesh-mcp",version:await O9()},{capabilities:{tools:{},resources:{}}});t.setRequestHandler(ListToolsRequestSchema,async()=>({tools:ng.map(e=>({name:e.name,description:e.description,inputSchema:i0(e.inputSchema)}))})),t.setRequestHandler(CallToolRequestSchema,async e=>{let r=ng.find(n=>n.name===e.params.name);if(!r)return {isError:true,content:[{type:"text",text:JSON.stringify({code:"NOT_FOUND",message:`unknown tool: ${e.params.name}`})}]};try{let n=r.inputSchema.safeParse(e.params.arguments??{});if(!n.success)throw new G("VALIDATION_FAILED","invalid input",n.error.issues);let o=await gS({cwd:process.cwd()}),i=await r.handler(o,n.data);return {content:[{type:"text",text:JSON.stringify(i)}]}}catch(n){let o=n instanceof G?n.toEnvelope():{code:"IO_ERROR",message:Jf(n instanceof Error?n.message:"unknown error")};return {isError:true,content:[{type:"text",text:JSON.stringify(o)}]}}}),t.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:fS.map(e=>({uri:e.uri,name:e.name,description:e.description}))})),t.setRequestHandler(ReadResourceRequestSchema,async e=>{let r=fS.find(a=>a.uri===e.params.uri||A9(a.uri,e.params.uri));if(!r)throw new G("NOT_FOUND",`resource not found: ${e.params.uri}`);let n=await gS({cwd:process.cwd()}),o=w9(r.uri,e.params.uri),i=await r.read(n,o);return {contents:[{uri:e.params.uri,mimeType:"application/json",text:JSON.stringify(i)}]}}),await t.connect(new StdioServerTransport);}s(l0,"startServer");ot();async function c0(t,e){SS(),await l0();}s(c0,"runMcp");var m0={generate:s(async(t,e)=>{let r=await _c(t,void 0,{printMatrix:t.json!==true});ge("generate",r,t,()=>Rc(r));},"generate"),init:s(async(t,e)=>{let r=await S$(process.cwd(),{yes:t.yes===true,global:t.global===true});ge("init",r,t,()=>C$(r));},"init"),import:s(async(t,e)=>{let r=await E$(t);ge("import",r,t,()=>N$(r));},"import"),diff:s(async(t,e)=>{let r=await O$(t);ge("diff",r,t,()=>F$(r));},"diff"),lint:s(async(t,e)=>{let r=await T$(t);ge("lint",r,t,()=>x$(r));},"lint"),check:s(async(t,e)=>{let r=await G$(t);ge("check",r,t,()=>D$(r));},"check"),merge:s(async(t,e)=>{let r=await B$(t);ge("merge",r,t,()=>v$(r));},"merge"),matrix:s(async(t,e)=>{let r=await ip(t);ge("matrix",r,t,()=>lp(r,{verbose:t.verbose===true}));},"matrix"),watch:s(async(t,e)=>{if(t.json===true){Ha("watch",{success:false,error:"--json is not supported with watch"}),process.exit(1);return}let r=await $$(t),n=s(()=>{r.stop().then(()=>process.exit(0));},"stop");process.on("SIGINT",n),process.on("SIGTERM",n);},"watch"),install:s(async(t,e)=>{t.json===true&&(t.force=true);let r=await Xj(t,e,process.cwd());ge("install",r,t,()=>Zj(r));},"install"),uninstall:s(async(t,e)=>{t.json===true&&(t.force=true);let r=await uU(t,e,process.cwd());ge("uninstall",r,t,()=>dU(r));},"uninstall"),installs:s(async(t,e)=>{let r=await gU(t,e,process.cwd());ge("installs",r,t,()=>hU(r));},"installs"),plugin:s(async(t,e)=>{let r=await IU(t,e,process.cwd());ge("plugin",r,t,()=>SU(r));},"plugin"),target:s(async(t,e)=>{let r=await PU(t,e,process.cwd());ge("target",r,t,()=>TU(r));},"target"),convert:s(async(t,e)=>{let r=await Vf(t);ge("convert",r,t,()=>xU(r));},"convert"),mcp:s(async(t,e)=>{await c0();},"mcp")};function T9(t){let e={},r=[],n="help";for(let o=0;o<t.length;o++){let i=t[o];if(n==="help"&&i==="--version")return {command:"version",flags:{},args:[]};if(n==="help"&&i==="--help")return {command:"help",flags:{},args:[]};if(i.startsWith("--")){let a=i.slice(2),l=t[o+1];l===void 0||l.startsWith("--")?e[a]=true:(e[a]=l,o++);continue}n==="help"?n=i:r.push(i);}return {command:n,flags:e,args:r}}s(T9,"parseArgs");var x9=_S(m0);async function D9(t){let{command:e,flags:r,args:n}=t;if(e==="help"){ag();return}if(e==="version"){kS();return}if(r.help===true){Lp(e);return}r.json===true&&IS(),await x9.route(e,r,n);}s(D9,"main");function N9(){let t=process.argv[1];if(!t)return false;let e=fileURLToPath(import.meta.url);try{let r=resolve(process.cwd(),t);return r===e||realpathSync(r)===realpathSync(e)}catch{return t.endsWith("cli.js")||t.includes("agentsmesh")}}s(N9,"isMainModule");if(N9()){let t=T9(process.argv.slice(2));D9(t).catch(e=>ES(e instanceof Error?e:new Error(String(e)),{verbose:t.flags.verbose===true,json:t.flags.json===true,command:t.command}));}
599
+ export{T9 as parseArgs};