agentsmesh 0.11.0 → 0.13.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/CHANGELOG.md +44 -0
- package/README.md +41 -26
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +2030 -1051
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +131 -130
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +2172 -1187
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2184 -1199
- package/dist/index.js.map +1 -1
- package/dist/{schema-BTitJKiN.d.ts → schema-o4oXUVBP.d.ts} +6 -0
- package/dist/{target-descriptor-D-Y6BzCL.d.ts → target-descriptor--Nw5i4v3.d.ts} +1 -1
- package/dist/targets.d.ts +3 -3
- package/dist/targets.js +2030 -1051
- package/dist/targets.js.map +1 -1
- package/package.json +1 -1
- package/schemas/agentsmesh.json +12 -3
- package/schemas/pack.json +4 -1
package/dist/cli.js
CHANGED
|
@@ -1,173 +1,174 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
`)
|
|
2
|
+
import {mkdir,lstat,unlink,writeFile,rename,rm as rm$1,access,readdir,stat,readFile,realpath,readlink,symlink,mkdtemp,cp as cp$1,copyFile}from'fs/promises';import {dirname,join,resolve,relative,sep,normalize,basename,extname,win32,posix}from'path';import {realpathSync,rmSync,mkdtempSync,readdirSync,symlinkSync,mkdirSync,constants,statSync,existsSync}from'fs';import {z}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 Mh from'tar';import {createHash}from'crypto';import {parse as parse$1}from'smol-toml';import {Buffer}from'buffer';import {createRequire}from'module';import {createTwoFilesPatch}from'diff';import Lj from'chokidar';import*as zx from'readline';var ph=Object.defineProperty;var s=(t,e)=>ph(t,"name",{value:e,configurable:true});var d=(t,e)=>()=>(t&&(e=t(t=0)),e);var lp=(t,e)=>{for(var r in e)ph(t,r,{get:e[r],enumerable:true});};function dh(){Lo=true;}function Wb(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function Ji(t,e){return Wb()?e:`${t}${e}${As.reset}`}function Bb(t,e){let r=[...t].length;return t+" ".repeat(Math.max(0,e-r))}var As,Lo,_,tt=d(()=>{As={green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",reset:"\x1B[0m"},Lo=false;s(dh,"muteLogger");s(Wb,"noColor");s(Ji,"c");s(Bb,"pad");_={info(t){Lo||process.stdout.write(Ji(As.cyan,t)+`
|
|
3
|
+
`);},warn(t){Lo||process.stderr.write(Ji(As.yellow,"\u26A0 ")+t+`
|
|
4
|
+
`);},error(t){Lo||process.stderr.write(Ji(As.red,"\u2717 ")+t+`
|
|
5
|
+
`);},success(t){Lo||process.stdout.write(Ji(As.green,"\u2713 ")+t+`
|
|
6
|
+
`);},debug(t){Lo||process.env.AGENTSMESH_DEBUG==="1"&&process.stdout.write(Ji(As.cyan,"[debug] ")+t+`
|
|
7
|
+
`);},table(t){if(Lo||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("+")+"+";process.stdout.write(n+`
|
|
8
|
+
`);for(let o=0;o<t.length;o++){let a="| "+t[o].map((l,c)=>Bb(l,r[c])).join(" | ")+" |";process.stdout.write(a+`
|
|
9
|
+
`);}process.stdout.write(n+`
|
|
10
|
+
`);}};});var bs,Gn,Al,xl,Yr,Yi=d(()=>{bs=class extends Error{static{s(this,"AgentsMeshError");}code;constructor(e,r,n){super(r,n),this.name="AgentsMeshError",this.code=e;}},Gn=class extends bs{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;}},Al=class extends bs{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;}},xl=class extends bs{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;}},Yr=class extends bs{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 uP(t){let e=extname(t).toLowerCase();if(e.length>0)return mP.has(e);let r=basename(t).toLowerCase();return pP.has(r)}function dP(t){return t.replace(/\r\n?/g,`
|
|
11
|
+
`)}async function y(t){try{let e=await readFile(t,"utf-8");return e.startsWith(Oh)?e.slice(Oh.length):e}catch(e){let r=e;if(r.code==="ENOENT")return null;throw new Yr(t,`Failed to read ${t}: ${r.message}. Ensure the file exists and is readable.`,{cause:e,errnoCode:r.code})}}async function C(t,e){let r=dirname(t);await mkdir(r,{recursive:true});try{let i=await lstat(t);if(i.isDirectory())throw new Yr(t,`Failed to write ${t}: target exists and is a directory. Remove it or choose a different path.`,{errnoCode:"EISDIR"});i.isSymbolicLink()&&await unlink(t).catch(a=>{if(a.code!=="ENOENT")throw a});}catch(i){if(i instanceof Yr||i.code!=="ENOENT")throw i}let n=`${t}.tmp`,o=uP(t)?dP(e):e;try{try{(await lstat(n)).isSymbolicLink()&&await unlink(n);}catch(i){if(i.code!=="ENOENT")throw i}await writeFile(n,o,{encoding:"utf-8",flag:"w"}),await rename(n,t);}catch(i){await rm$1(n,{force:true}).catch(()=>{});let a=i;throw new Yr(t,`Failed to write ${t}: ${a.message}. Check permissions and disk space.`,{cause:i,errnoCode:a.code})}}async function F(t){try{return await access(t,constants.F_OK),!0}catch{return false}}async function O(t){await mkdir(t,{recursive:true});}async function D(t,e){let r;try{r=await realpath(t);}catch(o){let i=o;if(i.code==="ENOENT"||i.code==="ENOTDIR"||i.code==="ELOOP")return [];throw new Yr(t,`Failed to read directory ${t}: ${i.message}. Check permissions.`,{cause:o,errnoCode:i.code})}let n=e??new Set;if(n.has(r))return [];n.add(r);try{let o=await readdir(t,{withFileTypes:!0}),i=[];for(let a of o){let l=join(t,a.name);a.isDirectory()||a.isSymbolicLink()&&await stat(l).then(m=>m.isDirectory(),()=>!1)?i.push(...await D(l,n)):i.push(l);}return i}catch(o){let i=o;if(i.code==="ENOENT"||i.code==="ENOTDIR"||i.code==="EACCES")return [];throw new Yr(t,`Failed to read directory ${t}: ${i.message}. Check permissions.`,{cause:o,errnoCode:i.code})}}async function Lh(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 Oh,mP,pP,A=d(()=>{Yi();Oh="\uFEFF",mP=new Set([".md",".mdc",".mdx",".markdown",".txt",".json",".jsonc",".yaml",".yml",".toml",".ini",".sh",".bash",".zsh",".ps1",".js",".mjs",".cjs",".ts",".tsx",".html",".css"]),pP=new Set([".gitignore",".cursorignore",".cursorindexingignore",".aiignore",".agentignore",".clineignore",".geminiignore",".codeiumignore",".continueignore",".copilotignore",".windsurfignore",".junieignore",".kiroignore",".rooignore",".antigravityignore"]);s(uP,"shouldNormalizeLineEndings");s(dP,"normalizeLineEndings");s(y,"readFileSafe");s(C,"writeFileAtomic");s(F,"exists");s(O,"mkdirp");s(D,"readDirRecursive");s(Lh,"ensureCacheSymlink");});function ve(t){return up.includes(t)}var up,wh=d(()=>{up=["amp","antigravity","claude-code","cline","codex-cli","continue","copilot","cursor","gemini-cli","goose","junie","kilo-code","kiro","opencode","roo-code","warp","windsurf","zed"];s(ve,"isBuiltinTargetId");});var ft,Xi,Xr=d(()=>{wh();ft=up,Xi="codex-cli";});var Ah,fe,Ps,qi,fP,gP,Zi,hP,yP,Qi,$n=d(()=>{Xr();Ah=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],fe=z.enum(ft),Ps=z.enum(Ah),qi=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(),fP=z.object({name:z.string(),source:z.string(),version:z.string().optional(),target:fe.optional(),features:z.array(Ps),path:z.string().optional(),pick:qi.optional()}),gP=z.object({strategy:z.enum(["merge","lock","last-wins"]).default("merge"),lock_features:z.array(z.string()).default([])}),Zi=z.union([z.boolean(),z.object({project:z.boolean().optional(),global:z.boolean().optional()}).strict()]),hP=z.object({commands_to_skills:z.object({"codex-cli":Zi.optional()}).passthrough().optional(),agents_to_skills:z.object({"gemini-cli":Zi.optional(),cline:Zi.optional(),"codex-cli":Zi.optional(),windsurf:Zi.optional()}).passthrough().optional()}).strict().optional(),yP=z.object({id:z.string().regex(/^[a-z][a-z0-9-]*$/),source:z.string(),version:z.string().optional()}).strict(),Qi=z.object({version:z.literal(1),targets:z.array(fe).default([...ft]),features:z.array(Ps).default([...Ah]),extends:z.array(fP).default([]),overrides:z.record(z.string(),z.record(z.string(),z.unknown())).default({}),collaboration:gP.default({strategy:"merge",lock_features:[]}),conversions:hP,plugins:z.array(yP).default([]),pluginTargets:z.array(z.string().regex(/^[a-z][a-z0-9-]*$/)).default([])});});async function CP(t){let e=resolve(t);for(;;){let r=join(e,fp);if(await F(r))return r;let n=dirname(e);if(n===e)return null;e=n;}}async function SP(t){let e=await y(t);if(e===null)throw new Gn(t);let r=parse(e),n=Qi.safeParse(r);if(!n.success){let o=n.error.issues.map(i=>i.message);throw new Al(t,o,{cause:n.error})}return n.data}function dp(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]=dp(i,o):r[n]=o;}return r}function RP(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=dp(r.overrides??{},e.overrides)),typeof e.conversions=="object"&&e.conversions!==null&&!Array.isArray(e.conversions)&&(r.conversions=dp(r.conversions??{},e.conversions)),Array.isArray(e.extends)&&e.extends.length>0&&(r.extends=[...t.extends??[],...e.extends]),r}async function gp(t){let e=join(t,fp),r=await SP(e),n=join(t,_P),o=await y(n);if(o!==null){let i=parse(o);if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let a=RP(r,i),l=Qi.safeParse(a);if(l.success)r=l.data;else {let c=l.error.issues.map(m=>m.message).join("; ");_.warn(`Ignoring invalid agentsmesh.local.yaml at ${n}: ${c}. Using project config instead.`);}}}return {config:r,configDir:t}}async function Ph(t){let e=await CP(t);if(e===null)throw new Gn(join(t,fp));return gp(dirname(e))}var fp,_P,Th=d(()=>{A();tt();Yi();$n();fp="agentsmesh.yaml",_P="agentsmesh.local.yaml";s(CP,"findConfigPath");s(SP,"loadConfig");s(dp,"deepMergeObjects");s(RP,"mergeLocalConfig");s(gp,"loadConfigFromExactDir");s(Ph,"loadConfigFromDir");});function ta(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 ct(t,e="project"){if(e==="project"){let{config:n,configDir:o}=await Ph(t);return {config:n,context:{scope:e,rootBase:o,configDir:o,canonicalDir:join(o,".agentsmesh")}}}let r=ta(t,e);try{let{config:n}=await gp(r.configDir);return {config:n,context:r}}catch(n){throw n instanceof Gn?new Gn(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 ge=d(()=>{Th();Yi();s(ta,"resolveScopeContext");s(ct,"loadScopedConfig");});async function Pl(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,Dh),u=`${m}.tmp`,f=join(u,Dh);if(!r.refresh&&await Nh(p))return _p(p);try{return await rm$1(u,{recursive:!0,force:!0}),await mkdir(u,{recursive:!0}),await PP(bP(t),f),t.ref&&await TP(f,t.ref),await rm$1(m,{recursive:!0,force:!0}),await rename(u,m),_p(p)}catch(g){if(await rm$1(u,{recursive:true,force:true}),r.allowOfflineFallback!==false&&await Nh(p))return console.warn(`[agentsmesh] Remote fetch failed for ${e}; using cached version. Error: ${g instanceof Error?g.message:String(g)}`),_p(p);throw g}}async function _p(t){return {resolvedPath:t,version:await DP(t)}}async function Nh(t){return F(t)}function bP(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 PP(t,e){await Cp(["clone",t,e]);}async function TP(t,e){await Cp(["checkout",e],t);}async function DP(t){return Cp(["rev-parse","HEAD"],t)}async function Cp(t,e){let{stdout:r}=await xP("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return r.trim()}var xP,Dh,Sp=d(()=>{A();xP=promisify(execFile),Dh="repo";s(Pl,"fetchGitRemoteExtend");s(_p,"readCachedRepo");s(Nh,"hasCachedRepo");s(bP,"resolveCloneUrl");s(PP,"cloneRepo");s(TP,"checkoutRef");s(DP,"getHeadSha");s(Cp,"runGit");});async function Gh(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 $h(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 Gh(t.org,t.repo,a);}catch(I){if(!i)throw I;return GP(t,e,r,n,o,a)}let m=o("github",`${t.org}/${t.repo}`,c),p=join(n,m);if(!l&&await F(p)){let I=await Rp(p);if(I)return {resolvedPath:join(p,I),version:c}}let u=`https://github.com/${t.org}/${t.repo}/tarball/${c}`,f={};a&&(f.Authorization=`Bearer ${a}`);let g;try{let I=await globalThis.fetch(u,{headers:f,redirect:"follow"});if(!I.ok)throw new Error(`HTTP ${I.status}: ${I.statusText}`);g=await I.arrayBuffer();}catch(I){if(r.allowOfflineFallback!==false&&await F(p)){let T=await Rp(p);if(T)return console.warn(`[agentsmesh] Network failed for ${e}; using cached version. Error: ${I instanceof Error?I.message:String(I)}`),{resolvedPath:join(p,T),version:c}}throw I}await rm$1(p,{recursive:true,force:true}),await mkdir(p,{recursive:true});let h=join(p,"archive.tar.gz");await writeFile(h,new Uint8Array(g));try{await Mh.extract({file:h,cwd:p,strict:!0,filter:s((I,E)=>!(MP(I)||E&&"type"in E&&(E.type==="Link"||E.type==="SymbolicLink")),"filter")});}finally{await rm$1(h,{force:true}).catch(()=>{});}let R=await Rp(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 Rp(t){let r=(await readdir(t,{withFileTypes:true})).filter(n=>n.isDirectory()&&!n.name.startsWith("."));return r.length===1?r[0].name:null}function vh(t,e,r){return r?`https://x-access-token:${encodeURIComponent(r)}@github.com/${t}/${e}.git`:`https://github.com/${t}/${e}.git`}function MP(t){let e=t.replace(/\\/g,"/");return e.startsWith("/")||e.split("/").includes("..")}async function GP(t,e,r,n,o,i){let a=i?[vh(t.org,t.repo,i)]:[vh(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 Pl(m,e,r,n,o)}catch(p){l=p;}}throw l instanceof Error?l:new Error("Failed to clone GitHub default branch")}var jh=d(()=>{A();Sp();s(Gh,"resolveLatestTag");s($h,"fetchGithubRemoteExtend");s(Rp,"findExtractTopDir");s(vh,"buildGithubCloneUrl");s(MP,"isZipSlipPath");s(GP,"fetchGithubDefaultBranch");});function Uh(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 Kh(t){let e=Uh(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 Wh(t){let e=Uh(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 Bh(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 wo(t){let e=Kh(t);if(e)return {kind:"github",...e};let r=Wh(t);if(r)return {kind:"gitlab",...r};let n=Bh(t);return n?{kind:"git",...n}:null}function Op(t){return wo(t)!==null}var ra=d(()=>{s(Uh,"splitSourceRef");s(Kh,"parseGithubSource");s(Wh,"parseGitlabSource");s(Bh,"parseGitSource");s(wo,"parseRemoteSource");s(Op,"isSupportedRemoteSource");});function KP(t){let e=wo(t);return e?e.kind==="github"?Ts("github",`${e.org}/${e.repo}`,e.tag):e.kind==="gitlab"?Ts("gitlab",`${e.namespace}/${e.project}`,e.ref??"HEAD"):Ts("git",e.url,e.ref??"HEAD"):null}async function Vh(t,e){let r=KP(t);if(!r)return;let n=e??ie(),o=join(n,r);await rm$1(o,{recursive:true,force:true});}async function Jh(t,e){let r=t??ie(),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$1(l,{recursive:!0,force:!0});}catch{}}));}var kp=d(()=>{na();ra();s(KP,"cacheKeyFromSource");s(Vh,"cleanInstallCache");s(Jh,"sweepStaleCache");});function Ts(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>Yh){let i=createHash("sha256").update(o).digest("hex").slice(0,16);o=`${o.slice(0,Yh-18)}--${i}`;}return o}function ie(){let t=process.env.AGENTSMESH_CACHE;return t||join(homedir(),".agentsmesh","cache")}async function Ds(t,e,r={}){let n=wo(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??ie();return Jh(o).catch(()=>{}),n.kind==="github"?$h(n,e,r,o,Ts,!t.includes("@")):Pl(n,e,r,o,Ts)}var Yh,na=d(()=>{Sp();jh();ra();kp();Yh=80;s(Ts,"buildCacheKey");s(ie,"getCacheDir");s(Ds,"fetchRemoteExtend");});function YP(t){return t.startsWith("http://")||t.startsWith("https://")}async function Ns(t,e,r={}){if(t.extends.length===0)return [];if(r.refreshCache===true&&t.extends.some(o=>Op(o.source))){let o=ie();await rm$1(o,{recursive:true,force:true}),await mkdir(o,{recursive:true});}let n=[];for(let o of t.extends){if(YP(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(Op(o.source)){let a=await Ds(o.source,o.name,{cacheDir:ie(),refresh:r.refreshCache===true});n.push({name:o.name,resolvedPath:a.resolvedPath,features:[...o.features],target:o.target,version:a.version,path:o.path,pick:o.pick});continue}let i=resolve(e,o.source);if(!await F(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,path:o.path,pick:o.pick});}return n}var Tl=d(()=>{A();na();ra();s(YP,"isOtherRemoteSource");s(Ns,"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 n=t.slice(3,r).trim(),o=t.slice(r+3).trim();return {frontmatter:n===""?{}:parse(n)??{},body:o}}function N(t,e){return Object.keys(t).length===0?e:`---
|
|
4
12
|
${stringify(t,{lineWidth:0}).trimEnd()}
|
|
5
13
|
---
|
|
6
14
|
|
|
7
|
-
${e}`}var v=f(()=>{i(E,"parseFrontmatter");i(T,"serializeFrontmatter");});function Gg(t){return typeof t=="string"?t.trim():""}function gt(t){return Gg(t.command)}function Gt(t){return Gg(t.prompt)}function Pm(t){let e=gt(t),r=Gt(t);return t.type==="prompt"?r||e:e||r}function Pr(t){return gt(t).length>0}function Ze(t){return Pm(t).length>0}var we=f(()=>{i(Gg,"trimString");i(gt,"getHookCommand");i(Gt,"getHookPrompt");i(Pm,"getHookText");i(Pr,"hasHookCommand");i(Ze,"hasHookText");});function H(t){return t.includes("\\")||Le.test(t)?win32:posix}function ot(t){return t.replace(/\\/g,"/")}function G(t,e){let r=H(t),n=r.normalize(r===win32?e.replace(/\//g,"\\"):ot(e));return n.endsWith(r.sep)&&n.length>1?n.slice(0,-1):n}function Bg(t,e){return H(t).isAbsolute(e)||Le.test(e)}function ls(t){let e=t,r="";for(;Ab.test(e);)r=e.at(-1)+r,e=e.slice(0,-1);return {candidate:e,suffix:r}}function Hg(t,e){let r=H(e),n=t.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"");return n&&n!==t?G(e,r.join(e,n)):null}var Le,Ab,Pt=f(()=>{Le=/^[A-Za-z]:[\\/]/,Ab=/[.!?:;]+$/;i(H,"pathApi");i(ot,"normalizeSeparators");i(G,"normalizeForProject");i(Bg,"isAbsoluteForProject");i(ls,"stripTrailingPunctuation");i(Hg,"rootFallbackPath");});function bb(t){return Object.prototype.hasOwnProperty.call(zg,t)}function Pb(t){return Object.prototype.hasOwnProperty.call(Vg,t)}function Jg(t,e){if(t!==void 0)return typeof t=="boolean"?t:t[e]}function cs(t,e,r,n="project"){let o=t.conversions?.commands_to_skills?.[e],s=Jg(o,n);return s!==void 0?s:bb(e)?zg[e]:r??false}function ae(t,e,r,n="project"){let o=t.conversions?.agents_to_skills?.[e],s=Jg(o,n);return s!==void 0?s:Pb(e)?Vg[e]:r??false}var zg,Vg,ms=f(()=>{zg={"codex-cli":true,goose:true,kiro:true},Vg={"gemini-cli":false,cline:true,"codex-cli":false,windsurf:true,goose:true,antigravity:true,continue:true};i(bb,"usesCommandSkillProjection");i(Pb,"usesAgentSkillProjection");i(Jg,"resolveConversionValue");i(cs,"shouldConvertCommandsToSkills");i(ae,"shouldConvertAgentsToSkills");});function be(t,e){return e!==void 0?{level:t,flavor:e}:{level:t}}function Ae(t){return typeof t=="string"?{level:t}:t}function Yg(t){return {rules:Ae(t.rules),additionalRules:Ae(t.additionalRules),commands:Ae(t.commands),agents:Ae(t.agents),skills:Ae(t.skills),mcp:Ae(t.mcp),hooks:Ae(t.hooks),ignore:Ae(t.ignore),permissions:Ae(t.permissions)}}var ro=f(()=>{i(be,"cap");i(Ae,"normalizeCapabilityValue");i(Yg,"normalizeTargetCapabilities");});function Xg(t){for(let e of xt)if(e.sharedArtifacts){for(let[r,n]of Object.entries(e.sharedArtifacts))if(n==="owner"&&t.startsWith(r))return e.id}return null}function xb(t){let e=[];for(let n of t)if(n.sharedArtifacts)for(let[o,s]of Object.entries(n.sharedArtifacts))s==="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 s=e[n],a=e[o];s===void 0||a===void 0||(s.prefix===a.prefix||s.prefix.startsWith(a.prefix)||a.prefix.startsWith(s.prefix))&&r.push({a:s,b:a});}return r}function Zg(t){let e=xb(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.
|
|
15
|
+
${e}`}var v=d(()=>{s(k,"parseFrontmatter");s(N,"serializeFrontmatter");});function Zh(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}async function Ao(t){let r=(await D(t)).filter(o=>{if(!o.endsWith(".md"))return false;let i=basename(o,".md");return i==="_root"||!i.startsWith("_")}),n=[];for(let o of r){let i=await y(o);if(!i)continue;let{frontmatter:a,body:l}=k(i),m=basename(o,".md")==="_root",p=a.root===true,u=a.trigger,f=typeof u=="string"&&qP.includes(u)?u:void 0,g=a.codex_emit,h=g==="execution"?"execution":g==="advisory"?"advisory":void 0,S=a.codex_instruction==="override"?"override":void 0;n.push({source:o,root:m||p,targets:Zh(a.targets),description:typeof a.description=="string"?a.description:"",globs:Zh(a.globs),body:l,...f!==void 0&&{trigger:f},...h!==void 0&&{codexEmit:h},...S!==void 0&&{codexInstructionVariant:S}});}return n}var qP,Dl=d(()=>{A();v();qP=["always_on","model_decision","glob","manual"];s(Zh,"toStrArray");s(Ao,"parseRules");});function Qh(t){return t===true||t==="true"||t===1||t==="1"}function ty(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 xo(t){let r=(await D(t)).filter(o=>o.endsWith(".md")&&!basename(o).startsWith("_")),n=[];for(let o of r){let i=await y(o);if(!i)continue;let{frontmatter:a,body:l}=k(i),c=basename(o,".md"),m=ty(a.allowedTools),p=ty(a["allowed-tools"]),u=m.length>0?m:p;n.push({source:o,name:c,description:typeof a.description=="string"?a.description:"",allowedTools:u,outputStyle:Qh(a.outputStyle)||Qh(a["output-style"]),body:l});}return n}var Nl=d(()=>{A();v();s(Qh,"toBool");s(ty,"toToolsArray");s(xo,"parseCommands");});function bo(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 ry(t){return t===true||t==="true"||t===1||t==="1"}function ny(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 QP(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function Po(t){let r=(await D(t)).filter(o=>o.endsWith(".md")&&!basename(o).startsWith("_")),n=[];for(let o of r){let i=await y(o);if(!i)continue;let{frontmatter:a,body:l}=k(i),c=basename(o,".md"),m=bo(a.tools),p=bo(a.tools),u=m.length>0?m:p,f=bo(a.disallowedTools),g=bo(a["disallowed-tools"]),h=f.length>0?f:g,R=bo(a.mcpServers),S=bo(a["mcp-servers"]),I=R.length>0?R:S,E=bo(a.skills),T=ny(a.maxTurns),P=ny(a["max-turns"]),x=T>0?T:P>0?P:0;n.push({source:o,name:c,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:x,mcpServers:I,hooks:QP(a.hooks),skills:E,memory:typeof a.memory=="string"?a.memory:"",outputStyle:ry(a.outputStyle)||ry(a["output-style"]),body:l});}return n}var Fl=d(()=>{A();v();s(bo,"toStrArray");s(ry,"toBool");s(ny,"toInt");s(QP,"toHooks");s(Po,"parseAgents");});async function rT(t){return await y(t)??""}function oT(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function oy(t){let e=await D(t),r=[];for(let n of e){let i=n.slice(t.length+1).replace(/\\/g,"/");if(i===vl||i.endsWith(`/${vl}`))continue;let a=i.split("/")[0];if(nT.some(c=>a===c)||i===".DS_Store"||i.endsWith("/.DS_Store"))continue;let l=await rT(n);r.push({relativePath:i,absolutePath:n,content:l});}return r.sort((n,o)=>n.relativePath.localeCompare(o.relativePath))}async function sy(t){let e=join(t,vl),r=await y(e);if(!r)return null;let{frontmatter:n,body:o}=k(r),i=await oy(t),a=typeof n.name=="string"?oT(n.name):"";return {source:e,name:a||basename(t),description:typeof n.description=="string"?n.description:"",body:o,supportingFiles:i}}async function Fs(t){let e;try{e=await readdir(t,{withFileTypes:!0});}catch{return []}let r=[];for(let n of e){if(!n.isDirectory()||n.name.startsWith("_"))continue;let o=join(t,n.name),i=join(o,vl),a=await y(i);if(!a)continue;let{frontmatter:l,body:c}=k(a),m=await oy(o);r.push({source:i,name:n.name,description:typeof l.description=="string"?l.description:"",body:c,supportingFiles:m});}return r.sort((n,o)=>n.name.localeCompare(o.name))}var vl,nT,Ml=d(()=>{A();v();s(rT,"readContent");vl="SKILL.md",nT=[".git","node_modules"];s(oT,"sanitizeSkillName");s(oy,"listSupportingFiles");s(sy,"parseSkillDirectory");s(Fs,"parseSkills");});function iy(t){return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}function sT(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.type=="string"?e.type:"stdio",n=iy(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:iy(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}}async function Gl(t){let e=await y(t);if(!e)return null;let r;try{r=JSON.parse(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=sT(a);l&&(o[i]=l);}return {mcpServers:o}}var Lp=d(()=>{A();s(iy,"parseStringMap");s(sT,"parseServer");s(Gl,"parseMcp");});function wp(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}async function $l(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 n=r,o=wp(n.allow),i=wp(n.deny),a=wp(n.ask);return {allow:o,deny:i,ask:a}}var Ap=d(()=>{A();s(wp,"ensureStringArray");s($l,"parsePermissions");});function ay(t){return typeof t=="string"?t.trim():""}function Ot(t){return ay(t.command)}function zt(t){return ay(t.prompt)}function xp(t){let e=Ot(t),r=zt(t);return t.type==="prompt"?r||e:e||r}function Zr(t){return Ot(t).length>0}function fr(t){return xp(t).length>0}var Me=d(()=>{s(ay,"trimString");s(Ot,"getHookCommand");s(zt,"getHookPrompt");s(xp,"getHookText");s(Zr,"hasHookCommand");s(fr,"hasHookText");});function cT(t){if(!t||typeof t!="object")return null;let e=t,r=e.matcher;if(typeof r!="string")return null;let n=xp(e);if(!n)return null;let o=typeof e.type=="string"&&lT.includes(e.type)?e.type:void 0,i=typeof e.timeout=="number"&&Number.isFinite(e.timeout)?e.timeout:void 0,a=zt(e)||void 0;return {matcher:r,command:n,...i!==void 0&&{timeout:i},...o&&{type:o},...a&&{prompt:a}}}async function jl(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 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=cT(c);m&&l.push(m);}l.length>0&&(n[i]=l);}return n}var lT,bp=d(()=>{A();Me();lT=["command","prompt"];s(cT,"toHookEntry");s(jl,"parseHooks");});async function Ul(t){let e=await y(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 Pp=d(()=>{A();s(Ul,"parseIgnore");});async function Qr(t){let e=join(t,".agentsmesh"),r=await F(e)?e:t,[n,o,i,a,l,c,m,p]=await Promise.all([Ao(join(r,"rules")),xo(join(r,"commands")),Po(join(r,"agents")),Fs(join(r,"skills")),Gl(join(r,"mcp.json")),$l(join(r,"permissions.yaml")),jl(join(r,"hooks.yaml")),Ul(join(r,"ignore"))]);return {rules:n,commands:o,agents:i,skills:a,mcp:l,permissions:c,hooks:m,ignore:p}}var oa=d(()=>{Dl();Nl();Fl();Ml();Lp();Ap();bp();Pp();A();s(Qr,"loadCanonicalFiles");});function ly(t){return basename(t.source,".md")}function vs(t,e){let r=new Map(t.rules.map(p=>[ly(p),p]));for(let p of e.rules)r.set(ly(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=pT(t.mcp,e.mcp),l=uT(t.permissions,e.permissions),c=dT(t.hooks,e.hooks),m=fT(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 pT(t,e){if(!t&&!e)return null;let r=t?.mcpServers??{},n=e?.mcpServers??{};return {mcpServers:{...r,...n}}}function uT(t,e){if(!t&&!e)return null;let r=Tp(t?.allow??[],e?.allow??[]),n=Tp(t?.deny??[],e?.deny??[]),o=Tp(t?.ask??[],e?.ask??[]);return {allow:r,deny:n,ask:o}}function Tp(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 dT(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 fT(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 Dp=d(()=>{s(ly,"ruleSlug");s(vs,"mergeCanonicalFiles");s(pT,"mergeMcp");s(uT,"mergePermissions");s(Tp,"mergeUniqueStrings");s(dT,"mergeHooks");s(fT,"mergeIgnore");});async function Kl(t){let e=null,r=0;for(let n of cy){let o=0;for(let i of n.paths)await F(join(t,i))&&o++;o>r&&(r=o,e=n.target);}return r>0?e:null}var cy,my,Np=d(()=>{A();cy=[{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(Kl,"detectNativeFormat");my=cy.map(t=>t.paths[0]).filter(t=>t!==void 0);});function V(t){return t.includes("\\")||Ge.test(t)?win32:posix}function at(t){return t.replace(/\\/g,"/")}function j(t,e){let r=V(t),n=r.normalize(r===win32?e.replace(/\//g,"\\"):at(e));return n.endsWith(r.sep)&&n.length>1?n.slice(0,-1):n}function uy(t,e){return V(t).isAbsolute(e)||Ge.test(e)}function Ms(t){let e=t,r="";for(;yT.test(e);)r=e.at(-1)+r,e=e.slice(0,-1);return {candidate:e,suffix:r}}function dy(t,e){let r=V(e),n=t.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"");return n&&n!==t?j(e,r.join(e,n)):null}var Ge,yT,$t=d(()=>{Ge=/^[A-Za-z]:[\\/]/,yT=/[.!?:;]+$/;s(V,"pathApi");s(at,"normalizeSeparators");s(j,"normalizeForProject");s(uy,"isAbsoluteForProject");s(Ms,"stripTrailingPunctuation");s(dy,"rootFallbackPath");});function IT(t){return Object.prototype.hasOwnProperty.call(fy,t)}function _T(t){return Object.prototype.hasOwnProperty.call(gy,t)}function hy(t,e){if(t!==void 0)return typeof t=="boolean"?t:t[e]}function Gs(t,e,r,n="project"){let o=t.conversions?.commands_to_skills?.[e],i=hy(o,n);return i!==void 0?i:IT(e)?fy[e]:r??false}function he(t,e,r,n="project"){let o=t.conversions?.agents_to_skills?.[e],i=hy(o,n);return i!==void 0?i:_T(e)?gy[e]:r??false}var fy,gy,$s=d(()=>{fy={amp:true,"codex-cli":true,goose:true,kiro:true,warp:true},gy={amp:true,"gemini-cli":false,cline:true,"codex-cli":false,windsurf:true,goose:true,antigravity:true,continue:true,warp:true};s(IT,"usesCommandSkillProjection");s(_T,"usesAgentSkillProjection");s(hy,"resolveConversionValue");s(Gs,"shouldConvertCommandsToSkills");s(he,"shouldConvertAgentsToSkills");});function je(t,e){return e!==void 0?{level:t,flavor:e}:{level:t}}function $e(t){return typeof t=="string"?{level:t}:t}function yy(t){return {rules:$e(t.rules),additionalRules:$e(t.additionalRules),commands:$e(t.commands),agents:$e(t.agents),skills:$e(t.skills),mcp:$e(t.mcp),hooks:$e(t.hooks),ignore:$e(t.ignore),permissions:$e(t.permissions)}}var To=d(()=>{s(je,"cap");s($e,"normalizeCapabilityValue");s(yy,"normalizeTargetCapabilities");});function Iy(t){for(let e of jt)if(e.sharedArtifacts){for(let[r,n]of Object.entries(e.sharedArtifacts))if(n==="owner"&&t.startsWith(r))return e.id}return null}function CT(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 _y(t){let e=CT(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.
|
|
8
16
|
`+r.join(`
|
|
9
17
|
`)+`
|
|
10
|
-
Resolve by changing one target's role to 'consumer' or by namespacing its prefix.`)}var
|
|
18
|
+
Resolve by changing one target's role to 'consumer' or by namespacing its prefix.`)}var Fp=d(()=>{mt();s(Iy,"ownerTargetIdForSharedPath");s(CT,"findSharedArtifactOwnershipConflicts");s(_y,"assertSharedArtifactOwnersUnique");});function ST(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 nt(t){return `${js}${t}`}function gr(t){let e={name:nt(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"],N(e,t.body.trim()||"")}function Wl(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(js)?e.slice(js.length):e.startsWith(sa)?e.slice(sa.length):"",o=(r||n).trim();return o?{name:o,description:typeof t.description=="string"?t.description:"",allowedTools:ST(t["x-agentsmesh-allowed-tools"])}:null}function Bl(t,e){return N({description:t.description,"allowed-tools":t.allowedTools},e.trim()||"")}var js,sa,Qt=d(()=>{v();js="am-command-",sa="ab-command-";s(ST,"toStringArray");s(nt,"commandSkillDirName");s(gr,"serializeCommandSkill");s(Wl,"parseCommandSkillFrontmatter");s(Bl,"serializeImportedCommand");});function Hl(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 RT(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 H(t){return `${Us}${t}`}function te(t){let e={name:H(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];}),N(e,t.body.trim()||"")}function hr(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(Us)?e.slice(Us.length):e.startsWith(ia)?e.slice(ia.length):"",o=(r||n).trim();return o?{name:o,description:typeof t.description=="string"?t.description:"",tools:Hl(t["x-agentsmesh-tools"]),disallowedTools:Hl(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:Hl(t["x-agentsmesh-mcp-servers"]),hooks:RT(t["x-agentsmesh-hooks"]),skills:Hl(t["x-agentsmesh-skills"]),memory:typeof t["x-agentsmesh-memory"]=="string"?t["x-agentsmesh-memory"]:""}:null}function ye(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];}),N(r,e.trim()||"")}var Us,ia,lt=d(()=>{v();Us="am-agent-",ia="ab-agent-";s(Hl,"toStringArray");s(RT,"toHooks");s(H,"projectedAgentSkillDirName");s(te,"serializeProjectedAgentSkill");s(hr,"parseProjectedAgentSkillFrontmatter");s(ye,"serializeImportedAgent");});function aa(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vp(t,e){return new RegExp(`${aa(t)}[\\s\\S]*?${aa(e)}`,"g")}function ky(t,e,r,n){let o=vp(e,r);if(o.test(t))return t.replace(o,n).trim();let i=t.trim();return i?`${i}
|
|
11
19
|
|
|
12
|
-
${n}`:n}function
|
|
13
|
-
`)}function
|
|
14
|
-
`)}function
|
|
20
|
+
${n}`:n}function Mp(t,e,r){return t.replace(vp(e,r),"").trim()}function ET(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 LT(t){return {source:ET(t.source),description:t.description,globs:t.globs,targets:t.targets}}function wT(t){return `${Ry}${JSON.stringify(LT(t))}${Oy}`}function AT(t){let e=[wT(t)];return t.description.trim()&&e.push(`## ${t.description.trim()}`,""),e.push(t.body.trim(),Sy),e.filter(r=>r.length>0).join(`
|
|
21
|
+
`)}function xT(t){return t.length===0?"":[zl,...t.map(AT),Vl].join(`
|
|
22
|
+
`)}function kt(t,e){let r=xT(e),n=Mp(t,zl,Vl);return r?n?`${n}
|
|
15
23
|
|
|
16
|
-
${r}`:r:n}function
|
|
24
|
+
${r}`:r:n}function Cy(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function bT(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:Cy(r.globs),targets:Cy(r.targets)}}catch{return null}}function PT(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 Ey(t){let e=[],r=vp(zl,Vl);return {rootContent:t.replace(r,o=>{let i=o.replace(zl,"").replace(Vl,"").trim(),a=new RegExp(`${aa(Ry)}([\\s\\S]*?)${aa(Oy)}([\\s\\S]*?)${aa(Sy)}`,"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=bT(c);p&&e.push({...p,body:PT(m,p.description)});}return ""}).trim(),rules:e}}var la,ca,zl,Vl,Sy,Ry,Oy,Ie=d(()=>{la="<!-- agentsmesh:root-generation-contract:start -->",ca="<!-- agentsmesh:root-generation-contract:end -->",zl="<!-- agentsmesh:embedded-rules:start -->",Vl="<!-- agentsmesh:embedded-rules:end -->",Sy="<!-- agentsmesh:embedded-rule:end -->",Ry="<!-- agentsmesh:embedded-rule:start ",Oy=" -->";s(aa,"escapeRegExp");s(vp,"managedBlockPattern");s(ky,"replaceManagedBlock");s(Mp,"stripManagedBlock");s(ET,"ruleSource");s(LT,"markerForRule");s(wT,"embeddedRuleStart");s(AT,"renderRule");s(xT,"renderEmbeddedRulesBlock");s(kt,"appendEmbeddedRulesBlock");s(Cy,"toStringArray");s(bT,"parseMarker");s(PT,"stripGeneratedHeading");s(Ey,"extractEmbeddedRules");});function Gp(t){return t.replace(/\s+/g," ").trim()}function wy(t){let e=t.trim();if(e.includes(la)&&e.includes(ca))return ky(e,la,ca,Ks);let r=Gp(e);if(r.includes(Gp(Ks)))return e;for(let n of Ly)if(r.includes(Gp(n)))return e.replace(n,Ks);return e?`${e}
|
|
17
25
|
|
|
18
|
-
${
|
|
26
|
+
${Ks}`:Ks}function Ay(t){let e=Mp(t,la,ca);e=e.replace(`
|
|
19
27
|
|
|
20
|
-
${
|
|
28
|
+
${Ks}`,"");for(let r of Ly)e=e.replace(`
|
|
21
29
|
|
|
22
|
-
${r}`,"");return e.trim()}var
|
|
30
|
+
${r}`,"");return e.trim()}var $p,TT,DT,NT,FT,vT,MT,GT,$T,jT,UT,KT,WT,BT,HT,zT,VT,Ks,Ly,jp=d(()=>{Ie();$p="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.",TT="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.",DT="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.",NT="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.",FT="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`.",vT="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`.",MT="`.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`.",GT="`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.",$T=$p,jT=`## Project-Specific Rules
|
|
23
31
|
|
|
24
|
-
${
|
|
32
|
+
${$p}`,UT=`## AgentsMesh Generation Contract
|
|
25
33
|
|
|
26
|
-
${
|
|
34
|
+
${$p}`,KT=`## AgentsMesh Generation Contract
|
|
27
35
|
|
|
28
|
-
${
|
|
36
|
+
${TT}`,WT=`## AgentsMesh Generation Contract
|
|
29
37
|
|
|
30
|
-
${
|
|
38
|
+
${DT}`,BT=`## AgentsMesh Generation Contract
|
|
31
39
|
|
|
32
|
-
${
|
|
40
|
+
${NT}`,HT=`## AgentsMesh Generation Contract
|
|
33
41
|
|
|
34
|
-
${
|
|
42
|
+
${FT}`,zT=`## AgentsMesh Generation Contract
|
|
35
43
|
|
|
36
|
-
${
|
|
44
|
+
${vT}`,VT=`## AgentsMesh Generation Contract
|
|
37
45
|
|
|
38
|
-
${
|
|
46
|
+
${MT}`,Ks=`${la}
|
|
39
47
|
## AgentsMesh Generation Contract
|
|
40
48
|
|
|
41
|
-
${
|
|
42
|
-
${Ai}`;i(Fm,"normalizeWhitespace");oh=[nP,rP,eP,tP,Qb,qb,Zb,Xb,Yb];i(sh,"appendAgentsmeshRootInstructionParagraph");i(ih,"stripAgentsmeshRootInstructionParagraph");});function jt(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 ds(t){let e=await I(t);return e?E(e).frontmatter:{}}function Rt(t,e){return typeof t[e]=="string"?t[e]:void 0}function Mm(t){let e=t.hooks;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function oP(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function sP(t,e){let r=basename(t,".md")==="_root",n={...e};return delete n.root,{root:r,...n}}async function M(t,e,r){let n=await ds(t),o=basename(t,".md")==="_root"?ih(r):r.trim(),s=sP(t,oP({...n,...e})),a={root:s.root===true,description:typeof s.description=="string"?s.description:""};a.root===false&&(a.globs=jt(s.globs));for(let[l,c]of Object.entries(s))l==="root"||l==="description"||l==="globs"||c===void 0||(a[l]=c);return T(a,o||"")}var Gm=f(()=>{A();v();$m();i(jt,"toStringArray");i(ds,"readExistingFrontmatter");i(Rt,"readString");i(Mm,"readHooks");i(oP,"pruneUndefined");i(sP,"serializeCanonicalRuleFrontmatter");i(M,"serializeImportedRuleWithFallback");});async function q(t,e,r){let n=await ds(t),o=(()=>{let l=jt(n.allowedTools);return l.length>0?l:jt(n["allowed-tools"])})(),s=e.hasDescription?e.description??"":typeof n.description=="string"?n.description:"",a=e.hasAllowedTools?e.allowedTools??[]:o;return T({description:s,"allowed-tools":a},r.trim()||"")}async function tr(t,e,r){let n=await ds(t),o=basename(dirname(t)),s=Rt(e,"name")??Rt(n,"name")??o,a=Rt(e,"description")??Rt(n,"description")??"";return T({name:s,description:a},r.trim()||"")}async function yt(t,e,r){let n=await ds(t),o=Object.prototype.hasOwnProperty.call(e,"tools")?jt(e.tools):(()=>{let C=jt(n.tools);return C.length>0?C:[]})(),s=Object.prototype.hasOwnProperty.call(e,"disallowedTools")?jt(e.disallowedTools):Object.prototype.hasOwnProperty.call(e,"disallowed-tools")?jt(e["disallowed-tools"]):jt(n.disallowedTools),a=Object.prototype.hasOwnProperty.call(e,"mcpServers")?jt(e.mcpServers):Object.prototype.hasOwnProperty.call(e,"mcp-servers")?jt(e["mcp-servers"]):jt(n.mcpServers),l=Object.prototype.hasOwnProperty.call(e,"skills")?jt(e.skills):jt(n.skills),c=e.maxTurns??e["max-turns"]??n.maxTurns,m=typeof c=="number"?c:Number(c??0),p=Mm(e)??Mm(n),u={name:Rt(e,"name")??Rt(n,"name")??basename(t,".md"),description:Rt(e,"description")??Rt(n,"description")??"",tools:o};s.length>0&&(u.disallowedTools=s);let d=Rt(e,"model")??Rt(n,"model");d&&(u.model=d);let g=Rt(e,"permissionMode")??Rt(e,"permission-mode")??Rt(n,"permissionMode")??Rt(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=Rt(e,"memory")??Rt(n,"memory");return h&&(u.memory=h),T(u,r.trim()||"")}var ch=f(()=>{v();Gm();i(q,"serializeImportedCommandWithFallback");i(tr,"serializeImportedSkillWithFallback");i(yt,"serializeImportedAgentWithFallback");});var Y=f(()=>{Gm();ch();});function aP(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 Tt(t){return `${fs}${t}`}function gs(t){let e={name:Tt(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 il(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(fs)?e.slice(fs.length):e.startsWith(bi)?e.slice(bi.length):"",o=(r||n).trim();return o?{name:o,description:typeof t.description=="string"?t.description:"",allowedTools:aP(t["x-agentsmesh-allowed-tools"])}:null}function al(t,e){return T({description:t.description,"allowed-tools":t.allowedTools},e.trim()||"")}var fs,bi,er=f(()=>{v();fs="am-command-",bi="ab-command-";i(aP,"toStringArray");i(Tt,"commandSkillDirName");i(gs,"serializeCommandSkill");i(il,"parseCommandSkillFrontmatter");i(al,"serializeImportedCommand");});function ll(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 ce(t){await rm$1(t,{recursive:true,force:true});}var hs=f(()=>{i(ll,"shouldImportScopedAgentsRule");i(ce,"removePathIfExists");});function Nt(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 s of n.supportingFiles){let a=s.relativePath.replace(/\\/g,"/");r.push({path:`${e}/${n.name}/${a}`,content:s.content});}}return r}async function kt(t,e,r,n,o){let s=await readdir(join(t,e),{encoding:"utf8",withFileTypes:true}).catch(()=>null);if(s!==null)for(let a of s){if(!a.isDirectory())continue;let l=join(t,e,a.name),c=join(l,"SKILL.md"),m=await I(c);if(m===null)continue;let p=join(t,Pi,a.name),u=join(p,"SKILL.md"),{frontmatter:d,body:g}=E(o(m,c,u)),h=il(d,a.name);if(h){await ce(join(t,Pi,a.name));let k=join(t,mh);await R(k);let D=join(k,`${h.name}.md`);await S(D,al(h,o(g,c,D))),n.push({fromTool:r,fromPath:c,toPath:`${mh}/${h.name}.md`,feature:"commands"});continue}let C=Qe(d,a.name);if(C){await ce(join(t,Pi,a.name));let k=join(t,ph);await R(k);let D=join(k,`${C.name}.md`);await S(D,le(C,o(g,c,D))),n.push({fromTool:r,fromPath:c,toPath:`${ph}/${C.name}.md`,feature:"agents"});continue}let O=await tr(u,{...d,name:a.name},g);await R(p),await S(u,O),n.push({fromTool:r,fromPath:c,toPath:`${Pi}/${a.name}/SKILL.md`,feature:"skills"});let _=await x(l);for(let k of _){if(k===c)continue;let D=relative(l,k).replace(/\\/g,"/"),b=await I(k);if(b===null)continue;let P=join(p,D);await R(dirname(P)),await S(P,o(b,k,P)),n.push({fromTool:r,fromPath:k,toPath:`${Pi}/${a.name}/${D}`,feature:"skills"});}}}var Pi,mh,ph,Et=f(()=>{A();v();Y();ht();er();hs();Pi=".agentsmesh/skills",mh=".agentsmesh/commands",ph=".agentsmesh/agents";i(Nt,"generateEmbeddedSkills");i(kt,"importEmbeddedSkills");});var no,cl,rr,Pe,xi,xe,Nr,Ti,nr,Dr,Ni,ys,jm,oo,ml,uh,so=f(()=>{no="antigravity",cl=".agents",rr=`${cl}/rules`,Pe=`${rr}/general.md`,xi=`${rr}/_root.md`,xe=`${cl}/skills`,Nr=`${cl}/workflows`,Ti=`${cl}/antigravity/mcp_config.json`,nr=".gemini/antigravity/GEMINI.md",Dr=".gemini/antigravity/skills",Ni=".gemini/antigravity/workflows",ys=".gemini/antigravity/mcp_config.json",jm=".agentsmesh/rules/_root.md",oo=".agentsmesh/rules",ml=".agentsmesh/commands",uh=".agentsmesh/mcp.json";});function dh(t){let e=t.rules.find(n=>n.root);if(!e)return [];let r=[{path:Pe,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:`${rr}/${o}.md`,content:n.body.trim()||""});}return r}function fh(t){return t.commands.map(e=>{let r=e.description.trim(),n=e.body.trim(),o=r&&n&&!n.startsWith(r)?`${r}
|
|
49
|
+
${GT}
|
|
50
|
+
${ca}`;s(Gp,"normalizeWhitespace");Ly=[VT,zT,HT,BT,WT,KT,UT,jT,$T];s(wy,"appendAgentsmeshRootInstructionParagraph");s(Ay,"stripAgentsmeshRootInstructionParagraph");});function Vt(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 Ws(t){let e=await y(t);return e?k(e).frontmatter:{}}function Dt(t,e){return typeof t[e]=="string"?t[e]:void 0}function Up(t){let e=t.hooks;return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function JT(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function YT(t,e){let r=basename(t,".md")==="_root",n={...e};return delete n.root,{root:r,...n}}async function G(t,e,r){let n=await Ws(t),o=basename(t,".md")==="_root"?Ay(r):r.trim(),i=YT(t,JT({...n,...e})),a={root:i.root===true,description:typeof i.description=="string"?i.description:""};a.root===false&&(a.globs=Vt(i.globs));for(let[l,c]of Object.entries(i))l==="root"||l==="description"||l==="globs"||c===void 0||(a[l]=c);return N(a,o||"")}var Kp=d(()=>{A();v();jp();s(Vt,"toStringArray");s(Ws,"readExistingFrontmatter");s(Dt,"readString");s(Up,"readHooks");s(JT,"pruneUndefined");s(YT,"serializeCanonicalRuleFrontmatter");s(G,"serializeImportedRuleWithFallback");});async function et(t,e,r){let n=await Ws(t),o=(()=>{let l=Vt(n.allowedTools);return l.length>0?l:Vt(n["allowed-tools"])})(),i=e.hasDescription?e.description??"":typeof n.description=="string"?n.description:"",a=e.hasAllowedTools?e.allowedTools??[]:o;return N({description:i,"allowed-tools":a},r.trim()||"")}async function yr(t,e,r){let n=await Ws(t),o=basename(dirname(t)),i=Dt(e,"name")??Dt(n,"name")??o,a=Dt(e,"description")??Dt(n,"description")??"";return N({name:i,description:a},r.trim()||"")}async function Et(t,e,r){let n=await Ws(t),o=Object.prototype.hasOwnProperty.call(e,"tools")?Vt(e.tools):(()=>{let R=Vt(n.tools);return R.length>0?R:[]})(),i=Object.prototype.hasOwnProperty.call(e,"disallowedTools")?Vt(e.disallowedTools):Object.prototype.hasOwnProperty.call(e,"disallowed-tools")?Vt(e["disallowed-tools"]):Vt(n.disallowedTools),a=Object.prototype.hasOwnProperty.call(e,"mcpServers")?Vt(e.mcpServers):Object.prototype.hasOwnProperty.call(e,"mcp-servers")?Vt(e["mcp-servers"]):Vt(n.mcpServers),l=Object.prototype.hasOwnProperty.call(e,"skills")?Vt(e.skills):Vt(n.skills),c=e.maxTurns??e["max-turns"]??n.maxTurns,m=typeof c=="number"?c:Number(c??0),p=Up(e)??Up(n),u={name:Dt(e,"name")??Dt(n,"name")??basename(t,".md"),description:Dt(e,"description")??Dt(n,"description")??"",tools:o};i.length>0&&(u.disallowedTools=i);let f=Dt(e,"model")??Dt(n,"model");f&&(u.model=f);let g=Dt(e,"permissionMode")??Dt(e,"permission-mode")??Dt(n,"permissionMode")??Dt(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=Dt(e,"memory")??Dt(n,"memory");return h&&(u.memory=h),N(u,r.trim()||"")}var Py=d(()=>{v();Kp();s(et,"serializeImportedCommandWithFallback");s(yr,"serializeImportedSkillWithFallback");s(Et,"serializeImportedAgentWithFallback");});var Z=d(()=>{Kp();Py();});function Jl(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 _e(t){await rm$1(t,{recursive:true,force:true});}var Bs=d(()=>{s(Jl,"shouldImportScopedAgentsRule");s(_e,"removePathIfExists");});function _t(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:N(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 gt(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 y(c);if(m===null)continue;let p=join(t,ma,a.name),u=join(p,"SKILL.md"),{frontmatter:f,body:g}=k(o(m,c,u)),h=Wl(f,a.name);if(h){await _e(join(t,ma,a.name));let E=join(t,Ty);await O(E);let T=join(E,`${h.name}.md`);await C(T,Bl(h,o(g,c,T))),n.push({fromTool:r,fromPath:c,toPath:`${Ty}/${h.name}.md`,feature:"commands"});continue}let R=hr(f,a.name);if(R){await _e(join(t,ma,a.name));let E=join(t,Dy);await O(E);let T=join(E,`${R.name}.md`);await C(T,ye(R,o(g,c,T))),n.push({fromTool:r,fromPath:c,toPath:`${Dy}/${R.name}.md`,feature:"agents"});continue}let S=await yr(u,{...f,name:a.name},g);await O(p),await C(u,S),n.push({fromTool:r,fromPath:c,toPath:`${ma}/${a.name}/SKILL.md`,feature:"skills"});let I=await D(l);for(let E of I){if(E===c)continue;let T=relative(l,E).replace(/\\/g,"/"),P=await y(E);if(P===null)continue;let x=join(p,T);await O(dirname(x)),await C(x,o(P,E,x)),n.push({fromTool:r,fromPath:E,toPath:`${ma}/${a.name}/${T}`,feature:"skills"});}}}var ma,Ty,Dy,ht=d(()=>{A();v();Z();lt();Qt();Bs();ma=".agentsmesh/skills",Ty=".agentsmesh/commands",Dy=".agentsmesh/agents";s(_t,"generateEmbeddedSkills");s(gt,"importEmbeddedSkills");});var Se,Ut,Ir,Wp,tn,Re,en,Ny,Do=d(()=>{Se="AGENTS.md",Ut=".agents/skills",Ir=".amp/settings.json",Wp=".config/amp",tn=`${Wp}/AGENTS.md`,Re=`${Wp}/skills`,en=`${Wp}/settings.json`,Ny=".agentsmesh/rules";});function Fy(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=kt(n,r);return o?[{path:Se,content:o}]:[]}function vy(t){return _t(t,Ut)}function My(t){return t.commands.map(e=>({path:`${Ut}/${nt(e.name)}/SKILL.md`,content:gr(e)}))}function Gy(t){return t.agents.map(e=>({path:`${Ut}/${H(e.name)}/SKILL.md`,content:te(e)}))}var $y=d(()=>{ht();Ie();lt();Qt();Do();s(Fy,"generateRules");s(vy,"generateSkills");s(My,"generateCommands");s(Gy,"generateAgents");});function ot(t,e,r){return t.startsWith(`${e}/`)&&!r.includes("codex-cli")?`.agents/skills/${t.slice(e.length+1)}`:null}var ae=d(()=>{s(ot,"mirrorSkillsToAgents");});async function Kt(t,e,r){let n=join(t,e),i={...await nD(n),...r};await O(dirname(n)),await C(n,JSON.stringify({mcpServers:i},null,2));}async function nD(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 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 rn=d(()=>{A();s(Kt,"writeMcpWithMerge");s(nD,"readExistingServers");});function nn(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}function Oe(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 Hs(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function zs(t){return !t||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}var Ke=d(()=>{s(nn,"toGlobsArray");s(Oe,"toToolsArray");s(Hs,"toStringArray");s(zs,"toStringRecord");});function iD(t,e){return e.some(r=>t.endsWith(r))}async function it(t){let r=(await D(t.srcDir)).filter(o=>iD(o,t.extensions)),n=[];for(let o of r){let i=await y(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 C(l.destPath,l.content),n.push({fromTool:t.fromTool,fromPath:o,toPath:l.toPath,feature:l.feature}));}return n}var We=d(()=>{A();s(iD,"matchesExtension");s(it,"importFileDirectory");});function jy(t){return typeof t=="string"?t:void 0}function aD(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}function Hp(t,e){return e?e(t):t}function lD(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=k(e.normalizeTo(r)),i=Hp(n,t.frontmatterRemap),a=aD({root:false,description:jy(i.description),globs:Array.isArray(i.globs)?i.globs:void 0,...i});return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await G(r,a,o)}}}function cD(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=k(e.normalizeTo(r)),i=Hp(n,t.frontmatterRemap),a=await et(r,{hasDescription:true,description:jy(i.description),hasAllowedTools:true,allowedTools:Hs(i["allowed-tools"])},o);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:a}}}function mD(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=k(e.normalizeTo(r)),i=Hp(n,t.frontmatterRemap);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await Et(r,i,o)}}}function Uy(t){if(t.map)return t.map;switch(t.preset){case "rule":return lD(t);case "command":return cD(t);case "agent":return mD(t);default:throw new Error(`ImportFeatureSpec for ${t.feature} (mode: ${t.mode}) needs a \`preset\` or \`map\``)}}var Ky=d(()=>{v();Z();Ke();s(jy,"pickString");s(aD,"pruneUndefined");s(Hp,"applyRemap");s(lD,"ruleMapper");s(cD,"commandMapper");s(mD,"agentMapper");s(Uy,"resolveMapper");});function zp(t,e){return t?t[e]??[]:[]}var Wy,By=d(()=>{Wy=["rules","commands","agents","skills","mcp","hooks","permissions","ignore"];s(zp,"resolveScopedSources");});async function dD(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 y(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=await t.map({absolutePath:l,relativePath:a,content:c,destDir:i,normalizeTo:p});if(!S)continue;return await C(S.destPath,S.content),[{fromTool:n,fromPath:l,toPath:S.toPath,feature:t.feature}]}let{frontmatter:u,body:f}=k(p(m)),g=t.frontmatterRemap?t.frontmatterRemap(u):u,h=t.markAsRoot?{...g,root:true}:g,R=await G(m,h,f);return await C(m,R),[{fromTool:n,fromPath:l,toPath:`${t.canonicalDir}/${t.canonicalRootFilename}`,feature:t.feature}]}return []}async function fD(t,e,r,n,o){let i=Uy(t),a=join(r,t.canonicalDir),l=[];for(let c of e){let m=join(r,c),p=await it({srcDir:m,destDir:a,extensions:[...t.extensions??[".md"]],fromTool:n,normalize:o,mapEntry:s(async({srcPath:u,relativePath:f,content:g,normalizeTo:h})=>{let R=await i({absolutePath:u,relativePath:f,content:g,destDir:a,normalizeTo:s(S=>h(S),"normalizeTo")});return R?{destPath:R.destPath,toPath:R.toPath,feature:t.feature,content:R.content}:null},"mapEntry")});l.push(...p);}return l}function zy(t){let e=t.canonicalFilename;return e.includes("/")||e.includes("\\")?e:posix.join(t.canonicalDir,e)}async function gD(t,e,r,n){if(!t.canonicalFilename)throw new Error(`flatFile spec for ${t.feature} must set canonicalFilename`);let o=zy(t);for(let i of e){let a=join(r,i),l=await y(a);if(l===null)continue;let c=join(r,o);return await O(dirname(c)),await C(c,l.trimEnd()),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}]}return []}function hD(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:Hs(a.args),env:zs(a.env),description:l};continue}typeof a.url=="string"&&(n[o]={type:typeof a.type=="string"?a.type:"http",url:a.url,headers:zs(a.headers),env:zs(a.env),description:l});}return n}async function yD(t,e,r,n){if(!t.canonicalFilename)throw new Error(`mcpJson spec for ${t.feature} must set canonicalFilename`);let o=zy(t);for(let i of e){let a=join(r,i),l=await y(a);if(l===null)continue;let c=hD(l);return Object.keys(c).length===0?[]:(await Kt(r,o,c),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}])}return []}function Hy(t,e,r,n,o){switch(t.mode){case "singleFile":return dD(t,e,r,n,o);case "directory":return fD(t,e,r,n,o);case "flatFile":return gD(t,e,r,n);case "mcpJson":return yD(t,e,r,n)}}async function ID(t,e,r,n,o){let i=zp(t.source,e),a=zp(t.fallbacks,e);if(i.length===0&&a.length===0)return [];if(i.length>0){let l=await Hy(t,i,r,n,o);if(l.length>0)return l}return a.length>0?Hy(t,a,r,n,o):[]}function _D(t,e){let r=t[e];return r?Array.isArray(r)?r:[r]:[]}async function q(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 Wy)for(let c of _D(o,l))a.push(...await ID(c,r,e,t.id,i));return a}var Wt=d(()=>{yt();A();rn();v();Ke();Z();We();Ky();By();s(dD,"runSingleFile");s(fD,"runDirectory");s(zy,"resolveCanonicalFilePath");s(gD,"runFlatFile");s(hD,"parseMcpJson");s(yD,"runMcpJson");s(Hy,"dispatchSpec");s(ID,"runSpec");s(_D,"specsForFeature");s(q,"runDescriptorImport");});async function Jy(t,e,r){let n=await y(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 Kt(t,Vy,l),r.push({fromTool:"amp",fromPath:e,toPath:Vy,feature:"mcp"}));}var Vy,Yy=d(()=>{A();rn();Do();Vy=".agentsmesh/mcp.json";s(Jy,"importAmpMcp");});async function Xy(t,e={}){let r=e.scope??"project",n=[],o=await B("amp",t,r);return n.push(...await q(Yl,t,r,{normalize:o})),await gt(t,r==="global"?Re:Ut,"amp",n,o),await Jy(t,r==="global"?en:Ir,n),n}var Zy=d(()=>{yt();ht();Wt();Yy();Do();Vp();s(Xy,"importFromAmp");});function SD(t,e){return Qy(e).some(n=>RD(t,n))}function qy(t,e){return t.filter(r=>SD(r,e))}function Qy(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 Qy(r+l+o))a.push(c);return a}function RD(t,e){return OD(e).test(t)}function OD(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 tI=d(()=>{s(SD,"globMatch");s(qy,"globFilter");s(Qy,"expandBraces");s(RD,"matchOne");s(OD,"globToRegex");});function X(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(qy(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 Nt=d(()=>{tI();s(X,"validateRules");});function rI(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:"amp"}))}var nI=d(()=>{Nt();Do();s(rI,"lintRules");});function $(t,e,r){return {level:"warning",file:t,target:e,message:r}}function kD(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 Vs(t,e,r,n){let o=n?.unsupportedBy??e,i=kD(r);return $(".agentsmesh/hooks.yaml",e,`${t} is not supported by ${o}; only ${i} are projected.`)}var Lt=d(()=>{s($,"createWarning");s(kD,"formatOxfordComma");s(Vs,"createUnsupportedHookWarning");});function oI(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","amp","Amp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function sI(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?[]:[$(".agentsmesh/permissions.yaml","amp","Amp permissions are managed via amp.permissions in settings.json; canonical permissions are not projected.")]}function iI(t){return t.ignore.length===0?[]:[$(".agentsmesh/ignore","amp","Amp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var aI=d(()=>{Lt();s(oI,"lintHooks");s(sI,"lintPermissions");s(iI,"lintIgnore");});function L(t,e){return V(t).relative(t,e).replace(/\\/g,"/")}async function w(t,e){return D(V(t).join(t,e)).catch(()=>[])}function cI(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}function bD(t,e,r,n){let o=posix.dirname(e),i=posix.dirname(r);for(;o!==n&&o!==".";)cI(t,o,i),o=posix.dirname(o),i=posix.dirname(i);}function M(t,e,r,n){t.set(e,`${r}/${basename(e,n)}.md`);}function U(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,`${lI}/${u}/SKILL.md`);return}let[o,...i]=n.split("/"),a=i.join("/");if(!o||!a)return;let l=o.startsWith(js)?js:o.startsWith(sa)?sa:null;if(l&&a==="SKILL.md"){t.set(e,`${AD}/${o.slice(l.length)}.md`);return}let c=o.startsWith(Us)?Us:o.startsWith(ia)?ia:null;if(c&&a==="SKILL.md"){t.set(e,`${xD}/${o.slice(c.length)}.md`);return}let m=`${lI}/${o}`;a==="SKILL.md"&&cI(t,`${r}/${o}`,m);let p=`${m}/${a}`;t.set(e,p),a!=="SKILL.md"&&bD(t,e,p,`${r}/${o}`);}function PD(t){return t.split("/").filter(Boolean)[0]??""}async function TD(){if(Jp!==void 0)return Jp;let{BUILTIN_TARGETS:t}=await Promise.resolve().then(()=>(mt(),mI)),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=PD(n);o.startsWith(".")&&e.add(o);}return Jp=e,e}function Xp(t){return t.split("/").some(e=>e.startsWith("."))}async function DD(t){let e=[],r=await TD(),n=V(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)||Xp(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)||Xp(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 Xl(t,e){let r=await DD(e);for(let n of r){let o=L(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(Xp(l))continue;let c=l.replace(/\//g,"-");t.set(o,`${wD}/${c}.md`);}}var wD,AD,xD,lI,Jp,Tt=d(()=>{$t();A();Qt();lt();wD=".agentsmesh/rules",AD=".agentsmesh/commands",xD=".agentsmesh/agents",lI=".agentsmesh/skills";s(L,"rel");s(w,"listFiles");s(cI,"addDirectoryMapping");s(bD,"addAncestorMappings");s(M,"addSimpleFileMapping");s(U,"addSkillLikeMapping");s(PD,"firstPathSegment");s(TD,"targetRootSegments");s(Xp,"hasHiddenSegment");s(DD,"listScopedAgentsFiles");s(Xl,"addScopedAgentsMappings");});var b,Q,pt,wt=d(()=>{b=".agentsmesh/rules",Q=".agentsmesh/commands",pt=".agentsmesh/agents";});async function Zp(t,e,r="project"){if(r==="global"){t.set(tn,`${b}/_root.md`);for(let n of await w(e,Re))U(t,L(e,n),Re);t.set(en,".agentsmesh/mcp.json");return}t.set(Se,`${b}/_root.md`);for(let n of await w(e,Ut))U(t,L(e,n),Ut);t.set(Ir,".agentsmesh/mcp.json");}var pI=d(()=>{Tt();Do();wt();s(Zp,"buildAmpImportPaths");});var No,Zl,_r,Be,ua,He,on,da,Cr,sn,fa,Js,qp,Fo,ql,uI,vo=d(()=>{No="antigravity",Zl=".agents",_r=`${Zl}/rules`,Be=`${_r}/general.md`,ua=`${_r}/_root.md`,He=`${Zl}/skills`,on=`${Zl}/workflows`,da=`${Zl}/antigravity/mcp_config.json`,Cr=".gemini/antigravity/GEMINI.md",sn=".gemini/antigravity/skills",fa=".gemini/antigravity/workflows",Js=".gemini/antigravity/mcp_config.json",qp=".agentsmesh/rules/_root.md",Fo=".agentsmesh/rules",ql=".agentsmesh/commands",uI=".agentsmesh/mcp.json";});async function Qp(t,e,r="project"){if(r==="global"){t.set(Cr,`${b}/_root.md`);for(let n of await w(e,sn))U(t,L(e,n),sn);t.set(Js,".agentsmesh/mcp.json");return}t.set(Be,`${b}/_root.md`),t.set(ua,`${b}/_root.md`);for(let n of await w(e,_r)){let o=L(e,n);o===Be||o===ua||M(t,o,b,".md");}for(let n of await w(e,on))M(t,L(e,n),Q,".md");for(let n of await w(e,He))U(t,L(e,n),He);}var dI=d(()=>{Tt();vo();wt();s(Qp,"buildAntigravityImportPaths");});var fI,Un,gI,ga,ha,ya,Ia,_a,an,tu,Ca,Ys,Sa,Ra,Ql,tc,eu,Oa,ru,Mo,hI,ln=d(()=>{fI="claude-code",Un=".claude/CLAUDE.md",gI="CLAUDE.md",ga=".claude/rules",ha=".claude/commands",ya=".claude/agents",Ia=".claude/skills",_a=".claude/settings.json",an=".claude/hooks.json",tu=".claude/output-styles",Ca=".claudeignore",Ys=".mcp.json",Sa=".claude.json",Ra=".agentsmesh/rules",Ql=".agentsmesh/commands",tc=".agentsmesh/agents",eu=".agentsmesh/skills",Oa=".agentsmesh/mcp.json",ru=".agentsmesh/permissions.yaml",Mo=".agentsmesh/hooks.yaml",hI=".agentsmesh/ignore";});async function nu(t,e,r="project"){if(t.set(".claude/CLAUDE.md",`${b}/_root.md`),t.set(an,Mo),r==="project"&&t.set("CLAUDE.md",`${b}/_root.md`),r==="global")for(let n of await w(e,".agents/skills"))U(t,L(e,n),".agents/skills");for(let n of await w(e,".claude/rules"))M(t,L(e,n),b,".md");for(let n of await w(e,".claude/commands"))M(t,L(e,n),Q,".md");for(let n of await w(e,".claude/agents"))M(t,L(e,n),pt,".md");for(let n of await w(e,".claude/skills"))U(t,L(e,n),".claude/skills");}var yI=d(()=>{Tt();ln();wt();s(nu,"buildClaudeCodeImportPaths");});var Kn,cn,Go,mn,II,Ft,Sr,Wn,$o,jo,Uo,Ko,ou,Bn,ec,su,iu,au,_I,ke=d(()=>{Kn="cline",cn=".clinerules",Go=".clineignore",mn=".cline/cline_mcp_settings.json",II=".cline/mcp_settings.json",Ft=".cline/skills",Sr=".clinerules/workflows",Wn="AGENTS.md",$o=".clinerules/hooks",jo="Documents/Cline/Rules",Uo="Documents/Cline/Workflows",Ko="Documents/Cline/Hooks",ou=".agentsmesh/hooks.yaml",Bn=".agentsmesh/rules",ec=".agentsmesh/commands",su=".agentsmesh/ignore",iu=".agentsmesh/mcp.json",au=".agentsmesh/agents",_I=".agentsmesh/skills";});async function lu(t,e,r="project"){if(r==="global"){for(let n of await w(e,jo))M(t,L(e,n),b,".md");for(let n of await w(e,Uo))M(t,L(e,n),Q,".md");for(let n of await w(e,Ft))U(t,L(e,n),Ft);t.set(mn,".agentsmesh/mcp.json");return}t.set(".clinerules/_root.md",`${b}/_root.md`);for(let n of await w(e,".clinerules")){let o=L(e,n);!o.endsWith(".md")||o.includes("/workflows/")||basename(o)==="_root.md"||M(t,o,b,".md");}for(let n of await w(e,".clinerules/workflows"))M(t,L(e,n),Q,".md");for(let n of await w(e,".cline/skills"))U(t,L(e,n),".cline/skills");}var CI=d(()=>{Tt();ke();wt();s(lu,"buildClineImportPaths");});async function cu(t,e,r="project"){if(r==="global"?(t.set(".codex/AGENTS.md",`${b}/_root.md`),t.set(".codex/AGENTS.override.md",`${b}/_root.md`)):(t.set("AGENTS.md",`${b}/_root.md`),t.set("codex.md",`${b}/_root.md`),await Xl(t,e)),r==="project")for(let n of await w(e,".codex/instructions"))M(t,L(e,n),b,".md");for(let n of await w(e,".codex/rules")){let o=L(e,n);o.endsWith(".rules")?M(t,o,b,".rules"):o.endsWith(".md")&&M(t,o,b,".md");}for(let n of await w(e,".codex/agents"))M(t,L(e,n),pt,".toml");for(let n of await w(e,".agents/skills"))U(t,L(e,n),".agents/skills");}var SI=d(()=>{Tt();wt();s(cu,"buildCodexCliImportPaths");});var Xs,ze,Rr,mu,rc,pn,pu,le,Zs,ka,nc,oc,uu,Or=d(()=>{Xs="continue",ze=".continue/rules",Rr=".continue/prompts",mu=".continue/mcpServers",rc=`${mu}/agentsmesh.json`,pn=`${ze}/general.md`,pu=`${ze}/_root.md`,le=".continue/skills",Zs=".continue/AGENTS.md",ka=".continue/config.yaml",nc=".agentsmesh/rules",oc=".agentsmesh/commands",uu=".agentsmesh/mcp.json";});async function du(t,e,r="project"){t.set(pn,`${b}/_root.md`),t.set(pu,`${b}/_root.md`);for(let n of await w(e,".continue/rules")){let o=L(e,n);o===pn||o===pu||M(t,o,b,".md");}for(let n of await w(e,".continue/prompts"))t.set(L(e,n),`${Q}/${basename(n,".md")}.md`);for(let n of await w(e,".continue/skills"))U(t,L(e,n),".continue/skills");if(r==="global")for(let n of await w(e,".agents/skills"))U(t,L(e,n),".agents/skills");}var RI=d(()=>{Tt();Or();wt();s(du,"buildContinueImportPaths");});function vD(t,e){if(e.endsWith(".instructions.md")){t.set(e,`${b}/${basename(e,".instructions.md")}.md`);return}M(t,e,b,".md");}async function fu(t,e){t.set(".github/copilot-instructions.md",`${b}/_root.md`);for(let r of await w(e,".github/copilot"))t.set(L(e,r),`${b}/${basename(r,".instructions.md")}.md`);for(let r of await w(e,".github/instructions"))vD(t,L(e,r));for(let r of await w(e,".github/prompts"))t.set(L(e,r),`${Q}/${basename(r,".prompt.md")}.md`);for(let r of await w(e,".github/agents"))t.set(L(e,r),`${pt}/${basename(r,".agent.md")}.md`);for(let r of await w(e,".github/skills"))U(t,L(e,r),".github/skills");}var OI=d(()=>{Tt();wt();s(vD,"addCopilotInstructionMapping");s(fu,"buildCopilotImportPaths");});var kI,Hn,EI,Ee,un,Le,qs,kr,Er,Lr,ic,Ve,gu,MD,Qs,Je,Ea,zn,Vn,wr,Jn,Yn,LI,ti,hu,La,yu,Ct=d(()=>{kI="cursor",Hn="AGENTS.md",EI=".cursorrules",Ee=".cursor/rules",un=`${Ee}/general.mdc`,Le=".cursor/commands",qs=".cursor/agents",kr=".cursor/skills",Er=".cursor/mcp.json",Lr=".cursor/hooks.json",ic=".cursor/settings.json",Ve=".cursorignore",gu=".cursorindexingignore",MD=".agentsmesh-exports/cursor",Qs=`${MD}/user-rules.md`,Je=".cursor/AGENTS.md",Ea=Er,zn=kr,Vn=qs,wr=".agentsmesh/rules",Jn=".agentsmesh/commands",Yn=".agentsmesh/agents",LI=".agentsmesh/skills",ti=".agentsmesh/mcp.json",hu=".agentsmesh/permissions.yaml",La=".agentsmesh/hooks.yaml",yu=".agentsmesh/ignore";});async function Iu(t,e,r="project"){if(r==="global"){t.set(Er,".agentsmesh/mcp.json"),t.set(".cursor/AGENTS.md",`${b}/_root.md`);for(let n of await w(e,".cursor/rules"))M(t,L(e,n),b,".mdc");for(let n of await w(e,".cursor/commands"))M(t,L(e,n),Q,".md");for(let n of await w(e,".cursor/agents"))M(t,L(e,n),pt,".md");for(let n of await w(e,".cursor/skills"))U(t,L(e,n),".cursor/skills");return}t.set("AGENTS.md",`${b}/_root.md`);for(let n of await w(e,".cursor/rules"))M(t,L(e,n),b,".mdc");for(let n of await w(e,".cursor/commands"))M(t,L(e,n),Q,".md");for(let n of await w(e,".cursor/agents"))M(t,L(e,n),pt,".md");for(let n of await w(e,".cursor/skills"))U(t,L(e,n),".cursor/skills");}var wI=d(()=>{Tt();Ct();wt();s(Iu,"buildCursorImportPaths");});async function _u(t,e){for(let r of await w(e,".gemini/rules"))M(t,L(e,r),b,".md");for(let r of await w(e,".gemini/commands")){let n=L(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,`${Q}/${c}.md`);}for(let r of await w(e,".gemini/agents"))M(t,L(e,r),pt,".md");for(let r of await w(e,".gemini/skills"))U(t,L(e,r),".gemini/skills");}var AI=d(()=>{Tt();wt();s(_u,"buildGeminiCliImportPaths");});var Ar,we,Jt,dn,xI,fn,Wo,Ae,bI,PI,ei=d(()=>{Ar="goose",we=".goosehints",Jt=".agents/skills",dn=".gooseignore",xI=".config/goose",fn=`${xI}/.goosehints`,Wo=`${xI}/.gooseignore`,Ae=".agents/skills",bI=".agentsmesh/rules",PI=".agentsmesh/ignore";});async function Cu(t,e,r="project"){if(r==="global"){t.set(fn,`${b}/_root.md`);for(let n of await w(e,Ae))U(t,L(e,n),Ae);t.set(Wo,".agentsmesh/ignore");return}t.set(we,`${b}/_root.md`);for(let n of await w(e,Jt))U(t,L(e,n),Jt);t.set(dn,".agentsmesh/ignore");}var TI=d(()=>{Tt();ei();wt();s(Cu,"buildGooseImportPaths");});var Bo,Xn,ac,DI,xr,NI,GD,wa,Ho,Aa,ri,ni,xa,ba,Pa,Ta,Da,$D,lc,zo,FI,Su,cc,vI,MI,GI,$I,oi=d(()=>{Bo="junie",Xn=".junie",ac=`${Xn}/guidelines.md`,DI=`${Xn}/ci-guidelines.md`,xr=`${Xn}/AGENTS.md`,NI="AGENTS.md",GD=`${Xn}/mcp`,wa=`${GD}/mcp.json`,Ho=`${Xn}/skills`,Aa=`${Xn}/rules`,ri=`${Xn}/commands`,ni=`${Xn}/agents`,xa=".aiignore",ba=".junie",Pa=`${ba}/skills`,Ta=`${ba}/agents`,Da=`${ba}/commands`,$D=`${ba}/mcp`,lc=`${$D}/mcp.json`,zo=`${ba}/AGENTS.md`,FI=".agents/skills",Su=".agentsmesh/rules/_root.md",cc=".agentsmesh/rules",vI=".agentsmesh/commands",MI=".agentsmesh/agents",GI=".agentsmesh/mcp.json",$I=".agentsmesh/ignore";});async function Ru(t,e){t.set(ac,`${b}/_root.md`),t.set(xr,`${b}/_root.md`),t.set("AGENTS.md",`${b}/_root.md`);for(let r of await w(e,".junie/rules"))M(t,L(e,r),b,".md");for(let r of await w(e,".junie/commands"))M(t,L(e,r),Q,".md");for(let r of await w(e,".junie/agents"))M(t,L(e,r),pt,".md");for(let r of await w(e,".junie/skills"))U(t,L(e,r),".junie/skills");}var jI=d(()=>{Tt();oi();wt();s(Ru,"buildJunieImportPaths");});var Yt,Na,br,gn,hn,yn,Ye,Zn,si,mc,Vo,ii,Jo,Fa,pc,ai,qn,Yo,Xo,Zo,Qn,li,uc,UI,to,ci,qo,KI,WI,Qo=d(()=>{Yt="kilo-code",Na=".kilo",br="AGENTS.md",gn=`${Na}/rules`,hn=`${Na}/commands`,yn=`${Na}/agents`,Ye=`${Na}/skills`,Zn=`${Na}/mcp.json`,si=".kilocodeignore",mc=".kilocode",Vo=`${mc}/rules`,ii=`${mc}/workflows`,Jo=`${mc}/skills`,Fa=`${mc}/mcp.json`,pc=".kilocodemodes",ai=".kilo",qn=`${ai}/AGENTS.md`,Yo=`${ai}/rules`,Xo=`${ai}/commands`,Zo=`${ai}/agents`,Qn=`${ai}/skills`,li=`${ai}/mcp.json`,uc=".kilocodeignore",UI=".agents/skills",to=".agentsmesh/rules",ci=".agentsmesh/commands",qo=".agentsmesh/agents",KI=".agentsmesh/mcp.json",WI=".agentsmesh/ignore";});async function Ou(t,e,r="project"){if(r==="global"){t.set(qn,`${b}/_root.md`);for(let n of await w(e,Yo))M(t,L(e,n),b,".md");for(let n of await w(e,Xo))M(t,L(e,n),Q,".md");for(let n of await w(e,Zo))M(t,L(e,n),pt,".md");for(let n of await w(e,Qn))U(t,L(e,n),Qn);t.set(li,".agentsmesh/mcp.json");return}t.set(br,`${b}/_root.md`);for(let n of await w(e,gn))M(t,L(e,n),b,".md");for(let n of await w(e,hn))M(t,L(e,n),Q,".md");for(let n of await w(e,yn))M(t,L(e,n),pt,".md");for(let n of await w(e,Ye))U(t,L(e,n),Ye);t.set(Zn,".agentsmesh/mcp.json");for(let n of await w(e,Vo)){let o=L(e,n);if(basename(o)==="00-root.md"){t.set(o,`${b}/_root.md`);continue}M(t,o,b,".md");}for(let n of await w(e,ii))M(t,L(e,n),Q,".md");for(let n of await w(e,Jo))U(t,L(e,n),Jo);t.set(Fa,".agentsmesh/mcp.json");}var BI=d(()=>{Tt();Qo();wt();s(Ou,"buildKiloCodeImportPaths");});var ce,Xe,va,Ze,Xt,qe,eo,HI,mi,pi,ts,Qe,ro,es,Ma,Ga,zI,ku,Eu,VI,JI,Lu,YI,ui=d(()=>{ce="kiro",Xe="AGENTS.md",va=".kiro",Ze=`${va}/steering`,Xt=`${va}/skills`,qe=`${va}/agents`,eo=`${va}/hooks`,HI=`${va}/settings`,mi=`${HI}/mcp.json`,pi=".kiroignore",ts=".kiro/steering",Qe=".kiro/steering/AGENTS.md",ro=".kiro/skills",es=".kiro/agents",Ma=".kiro/settings/mcp.json",Ga=".kiro/settings/kiroignore",zI=".agents/skills",ku=".agentsmesh/rules/_root.md",Eu=".agentsmesh/rules",VI=".agentsmesh/agents",JI=".agentsmesh/mcp.json",Lu=".agentsmesh/hooks.yaml",YI=".agentsmesh/ignore";});async function wu(t,e,r="project"){if(r==="global"){t.set(Qe,`${b}/_root.md`);for(let n of await w(e,ts)){let o=L(e,n);o!==Qe&&M(t,o,b,".md");}for(let n of await w(e,ro))U(t,L(e,n),ro);for(let n of await w(e,es))M(t,L(e,n),pt,".md");return}t.set(Xe,`${b}/_root.md`);for(let n of await w(e,Ze))M(t,L(e,n),b,".md");for(let n of await w(e,Xt))U(t,L(e,n),Xt);for(let n of await w(e,qe))M(t,L(e,n),pt,".md");}var XI=d(()=>{Tt();ui();wt();s(wu,"buildKiroImportPaths");});var tr,dc,Pr,In,_n,Cn,er,Tr,di,no,rs,ns,os,oo,so,ZI,$a,fc,gc,Au,ss=d(()=>{tr="opencode",dc=".opencode",Pr="AGENTS.md",In=`${dc}/rules`,_n=`${dc}/commands`,Cn=`${dc}/agents`,er=`${dc}/skills`,Tr="opencode.json",di=".config/opencode",no=`${di}/AGENTS.md`,rs=`${di}/rules`,ns=`${di}/commands`,os=`${di}/agents`,oo=`${di}/skills`,so=`${di}/opencode.json`,ZI=".agents/skills",$a=".agentsmesh/rules",fc=".agentsmesh/commands",gc=".agentsmesh/agents",Au=".agentsmesh/mcp.json";});async function xu(t,e,r="project"){if(r==="global"){t.set(no,`${b}/_root.md`);for(let n of await w(e,rs))M(t,L(e,n),b,".md");for(let n of await w(e,ns))M(t,L(e,n),Q,".md");for(let n of await w(e,os))M(t,L(e,n),pt,".md");for(let n of await w(e,oo))U(t,L(e,n),oo);t.set(so,".agentsmesh/mcp.json");return}t.set(Pr,`${b}/_root.md`);for(let n of await w(e,In))M(t,L(e,n),b,".md");for(let n of await w(e,_n))M(t,L(e,n),Q,".md");for(let n of await w(e,Cn))M(t,L(e,n),pt,".md");for(let n of await w(e,er))U(t,L(e,n),er);t.set(Tr,".agentsmesh/mcp.json");}var qI=d(()=>{Tt();ss();wt();s(xu,"buildOpencodeImportPaths");});var io,is,rr,ja,Sn,Rn,Dr,Ua,Ka,fi,Wa,hc,ao,lo,On,as,Ba,co,QI,ls,yc,t_,e_,cs=d(()=>{io="roo-code",is=".roo",rr=`${is}/rules/00-root.md`,ja=".roorules",Sn=`${is}/rules`,Rn=`${is}/commands`,Dr=`${is}/skills`,Ua=`${is}/mcp.json`,Ka=".rooignore",fi=".roomodes",Wa="settings/custom_modes.yaml",hc=".roo",ao=`${hc}/rules`,lo=`${hc}/commands`,On=`${hc}/skills`,as="mcp_settings.json",Ba=".rooignore",co=`${hc}/AGENTS.md`,QI=".agents/skills",ls=".agentsmesh/rules",yc=".agentsmesh/commands",t_=".agentsmesh/mcp.json",e_=".agentsmesh/ignore";});async function bu(t,e,r="project"){if(r==="global"){t.set(co,`${b}/_root.md`);for(let n of await w(e,ao))M(t,L(e,n),b,".md");for(let n of await w(e,lo))M(t,L(e,n),Q,".md");for(let n of await w(e,On))U(t,L(e,n),On);t.set(as,".agentsmesh/mcp.json");return}t.set(rr,`${b}/_root.md`),t.set(ja,`${b}/_root.md`);for(let n of await w(e,Sn)){let o=L(e,n);o!==rr&&M(t,o,b,".md");}for(let n of await w(e,".roo")){let o=L(e,n);/^\.roo\/rules-[^/]+\/.+\.md$/.test(o)&&M(t,o,b,".md");}for(let n of await w(e,Rn))M(t,L(e,n),Q,".md");for(let n of await w(e,Dr))U(t,L(e,n),Dr);}var r_=d(()=>{Tt();cs();wt();s(bu,"buildRooCodeImportPaths");});var Nr,nr,Pu,Bt,mo,ee,n_,gi=d(()=>{Nr="warp",nr="AGENTS.md",Pu="WARP.md",Bt=".warp/skills",mo=".mcp.json",ee=".warp/skills",n_=".agentsmesh/rules";});async function Tu(t,e,r="project"){if(r==="global"){for(let n of await w(e,ee))U(t,L(e,n),ee);return}t.set(nr,`${b}/_root.md`);for(let n of await w(e,Bt))U(t,L(e,n),Bt);t.set(mo,".agentsmesh/mcp.json");}var o_=d(()=>{Tt();gi();wt();s(Tu,"buildWarpImportPaths");});async function Du(t,e){t.set("AGENTS.md",`${b}/_root.md`),t.set(".windsurfrules",`${b}/_root.md`),await Xl(t,e);for(let r of await w(e,".windsurf/rules"))M(t,L(e,r),b,".md");for(let r of await w(e,".windsurf/workflows"))M(t,L(e,r),Q,".md");for(let r of await w(e,".windsurf/skills"))U(t,L(e,r),".windsurf/skills");}var s_=d(()=>{Tt();wt();s(Du,"buildWindsurfImportPaths");});var or,Fr,UD,vr,i_,ms=d(()=>{or=".rules",Fr=".zed/settings.json",UD=".config/zed",vr=`${UD}/settings.json`,i_=".agentsmesh/rules";});async function Nu(t,e,r="project"){if(r==="global"){t.set(vr,".agentsmesh/mcp.json");return}t.set(or,`${b}/_root.md`),t.set(Fr,".agentsmesh/mcp.json");}var a_=d(()=>{ms();wt();s(Nu,"buildZedImportPaths");});var l_=d(()=>{pI();dI();yI();CI();SI();RI();OI();wI();AI();TI();jI();BI();XI();qI();r_();o_();s_();a_();});var At=d(()=>{l_();});function HD(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 KD,WD,BD,c_,Yl,Vp=d(()=>{Qt();lt();$y();ae();Zy();nI();aI();At();Do();KD={name:"amp",primaryRootInstructionPath:Se,generateRules:Fy,generateCommands:My,generateAgents:Gy,generateSkills:vy,importFrom:Xy},WD={rootInstructionPath:Se,skillDir:Ut,managedOutputs:{dirs:[Ut],files:[Se,Ir]},paths:{rulePath(t){return Se},commandPath(t){return `${Ut}/${nt(t)}/SKILL.md`},agentPath(t){return `${Ut}/${H(t)}/SKILL.md`}}},BD={rootInstructionPath:tn,skillDir:Re,managedOutputs:{dirs:[Re],files:[tn,en]},rewriteGeneratedPath(t){return t===Se?tn:t===Ir?en:t.startsWith(`${Ut}/`)?t.replace(`${Ut}/`,`${Re}/`):t},mirrorGlobalPath(t,e){return ot(t,Re,e)},paths:{rulePath(t){return tn},commandPath(t){return `${Re}/${nt(t)}/SKILL.md`},agentPath(t){return `${Re}/${H(t)}/SKILL.md`}}},c_={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(HD,"mergeAmpSettings");Yl={id:"amp",generators:KD,capabilities:c_,emptyImportMessage:"No Amp config found (AGENTS.md, .agents/skills, or .amp/settings.json).",lintRules:rI,lint:{hooks:oI,permissions:sI,ignore:iI},supportsConversion:{commands:true,agents:true},project:WD,globalSupport:{capabilities:c_,detectionPaths:[tn,en],layout:BD},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Se],global:[tn]},canonicalDir:Ny,canonicalRootFilename:"_root.md",markAsRoot:true}},emitScopedSettings(t,e){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Ir,content:JSON.stringify({"amp.mcpServers":t.mcp.mcpServers},null,2)}]},mergeGeneratedOutputContent(t,e,r,n){return n===Ir||n===en?HD(t,r):null},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:Zp,detectionPaths:[Se,Ir]};});function m_(t){let e=t.rules.find(n=>n.root);if(!e)return [];let r=[{path:Be,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:`${_r}/${o}.md`,content:n.body.trim()||""});}return r}function p_(t){return t.commands.map(e=>{let r=e.description.trim(),n=e.body.trim(),o=r&&n&&!n.startsWith(r)?`${r}
|
|
43
51
|
|
|
44
|
-
${n}`:n||r;return {path:`${Nr}/${e.name}.md`,content:o}})}function gh(t){return Nt(t,xe)}function hh(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Ti,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function yh(t){return t.agents.map(e=>({path:`${xe}/${Z(e.name)}/SKILL.md`,content:qe(e)}))}function Ih(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 Zt(e?.body.trim()??"",r)}var _h=f(()=>{Et();Tr();ht();so();i(dh,"generateRules");i(fh,"generateCommands");i(gh,"generateSkills");i(hh,"generateMcp");i(yh,"generateAgents");i(Ih,"renderAntigravityGlobalInstructions");});async function pe(t,e,r){let n=join(t,e),s={...await gP(n),...r};await R(dirname(n)),await S(n,JSON.stringify({mcpServers:s},null,2));}async function gP(t){let e=await I(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[s,a]of Object.entries(n))!a||typeof a!="object"||Array.isArray(a)||(o[s]=a);return o}var io=f(()=>{A();i(pe,"writeMcpWithMerge");i(gP,"readExistingServers");});function Fr(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}function ue(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 Is(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function _s(t){return !t||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}var Te=f(()=>{i(Fr,"toGlobsArray");i(ue,"toToolsArray");i(Is,"toStringArray");i(_s,"toStringRecord");});function IP(t,e){return e.some(r=>t.endsWith(r))}async function tt(t){let r=(await x(t.srcDir)).filter(o=>IP(o,t.extensions)),n=[];for(let o of r){let s=await I(o);if(!s)continue;let a=relative(t.srcDir,o).replace(/\\/g,"/"),l=await t.mapEntry({srcPath:o,relativePath:a,content:s,normalizeTo:i((c,m=s)=>t.normalize(m,o,c),"normalizeTo")});l&&(await R(dirname(l.destPath)),await S(l.destPath,l.content),n.push({fromTool:t.fromTool,fromPath:o,toPath:l.toPath,feature:l.feature}));}return n}var Ne=f(()=>{A();i(IP,"matchesExtension");i(tt,"importFileDirectory");});function Sh(t){return typeof t=="string"?t:void 0}function _P(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}function Km(t,e){return e?e(t):t}function SP(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=E(e.normalizeTo(r)),s=Km(n,t.frontmatterRemap),a=_P({root:false,description:Sh(s.description),globs:Array.isArray(s.globs)?s.globs:void 0,...s});return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await M(r,a,o)}}}function CP(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=E(e.normalizeTo(r)),s=Km(n,t.frontmatterRemap),a=await q(r,{hasDescription:true,description:Sh(s.description),hasAllowedTools:true,allowedTools:Is(s["allowed-tools"])},o);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:a}}}function OP(t){return async e=>{let r=join(e.destDir,e.relativePath),{frontmatter:n,body:o}=E(e.normalizeTo(r)),s=Km(n,t.frontmatterRemap);return {destPath:r,toPath:`${t.canonicalDir}/${e.relativePath}`,content:await yt(r,s,o)}}}function Ch(t){if(t.map)return t.map;switch(t.preset){case "rule":return SP(t);case "command":return CP(t);case "agent":return OP(t);default:throw new Error(`ImportFeatureSpec for ${t.feature} (mode: ${t.mode}) needs a \`preset\` or \`map\``)}}var Oh=f(()=>{v();Y();Te();i(Sh,"pickString");i(_P,"pruneUndefined");i(Km,"applyRemap");i(SP,"ruleMapper");i(CP,"commandMapper");i(OP,"agentMapper");i(Ch,"resolveMapper");});function Wm(t,e){return t?t[e]??[]:[]}var Rh,kh=f(()=>{Rh=["rules","commands","agents","skills","mcp","hooks","permissions","ignore"];i(Wm,"resolveScopedSources");});async function EP(t,e,r,n,o){if(!t.canonicalRootFilename)throw new Error(`singleFile spec for ${t.feature} must set canonicalRootFilename`);let s=join(r,t.canonicalDir);for(let a of e){let l=join(r,a),c=await I(l);if(c===null)continue;await R(s);let m=join(s,t.canonicalRootFilename),p=i(O=>o(c,l,O),"normalizeTo");if(t.map){let O=await t.map({absolutePath:l,relativePath:a,content:c,destDir:s,normalizeTo:p});if(!O)continue;return await S(O.destPath,O.content),[{fromTool:n,fromPath:l,toPath:O.toPath,feature:t.feature}]}let{frontmatter:u,body:d}=E(p(m)),g=t.frontmatterRemap?t.frontmatterRemap(u):u,h=t.markAsRoot?{...g,root:true}:g,C=await M(m,h,d);return await S(m,C),[{fromTool:n,fromPath:l,toPath:`${t.canonicalDir}/${t.canonicalRootFilename}`,feature:t.feature}]}return []}async function wP(t,e,r,n,o){let s=Ch(t),a=join(r,t.canonicalDir),l=[];for(let c of e){let m=join(r,c),p=await tt({srcDir:m,destDir:a,extensions:[...t.extensions??[".md"]],fromTool:n,normalize:o,mapEntry:i(async({srcPath:u,relativePath:d,content:g,normalizeTo:h})=>{let C=await s({absolutePath:u,relativePath:d,content:g,destDir:a,normalizeTo:i(O=>h(O),"normalizeTo")});return C?{destPath:C.destPath,toPath:C.toPath,feature:t.feature,content:C.content}:null},"mapEntry")});l.push(...p);}return l}function wh(t){let e=t.canonicalFilename;return e.includes("/")||e.includes("\\")?e:posix.join(t.canonicalDir,e)}async function LP(t,e,r,n){if(!t.canonicalFilename)throw new Error(`flatFile spec for ${t.feature} must set canonicalFilename`);let o=wh(t);for(let s of e){let a=join(r,s),l=await I(a);if(l===null)continue;let c=join(r,o);return await R(dirname(c)),await S(c,l.trimEnd()),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}]}return []}function AP(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,s]of Object.entries(r)){if(!s||typeof s!="object"||Array.isArray(s))continue;let a=s,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:Is(a.args),env:_s(a.env),description:l};continue}typeof a.url=="string"&&(n[o]={type:typeof a.type=="string"?a.type:"http",url:a.url,headers:_s(a.headers),env:_s(a.env),description:l});}return n}async function bP(t,e,r,n){if(!t.canonicalFilename)throw new Error(`mcpJson spec for ${t.feature} must set canonicalFilename`);let o=wh(t);for(let s of e){let a=join(r,s),l=await I(a);if(l===null)continue;let c=AP(l);return Object.keys(c).length===0?[]:(await pe(r,o,c),[{fromTool:n,fromPath:a,toPath:o,feature:t.feature}])}return []}function Eh(t,e,r,n,o){switch(t.mode){case "singleFile":return EP(t,e,r,n,o);case "directory":return wP(t,e,r,n,o);case "flatFile":return LP(t,e,r,n);case "mcpJson":return bP(t,e,r,n)}}async function PP(t,e,r,n,o){let s=Wm(t.source,e),a=Wm(t.fallbacks,e);if(s.length===0&&a.length===0)return [];if(s.length>0){let l=await Eh(t,s,r,n,o);if(l.length>0)return l}return a.length>0?Eh(t,a,r,n,o):[]}function xP(t,e){let r=t[e];return r?Array.isArray(r)?r:[r]:[]}async function et(t,e,r,n){let o=t.importer;if(!o)return [];let s=n?.normalize??await z(t.id,e,r),a=[];for(let l of Rh)for(let c of xP(o,l))a.push(...await PP(c,r,e,t.id,s));return a}var qt=f(()=>{Ct();A();io();v();Te();Y();Ne();Oh();kh();i(EP,"runSingleFile");i(wP,"runDirectory");i(wh,"resolveCanonicalFilePath");i(LP,"runFlatFile");i(AP,"parseMcpJson");i(bP,"runMcpJson");i(Eh,"dispatchSpec");i(PP,"runSpec");i(xP,"specsForFeature");i(et,"runDescriptorImport");});function TP(t){let e=t.replace(/\\/g,"/");return !e.startsWith("rules/")||e.endsWith("/")||!e.endsWith(".md")?null:e}async function or(t){let e=nh(t.content),r=[];if(e.rules.length===0)return {rootContent:e.rootContent,results:r};await R(join(t.projectRoot,t.rulesDir));for(let n of e.rules){let o=TP(n.source);if(o===null||o==="rules/_root.md")continue;let s=join(t.projectRoot,".agentsmesh",o),a=t.normalize(n.body,t.sourcePath,s),{frontmatter:l,body:c}=E(a),m=await M(s,{...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 S(s,m),r.push({fromTool:t.fromTool,fromPath:t.sourcePath,toPath:`.agentsmesh/${o}`,feature:"rules"});}return {rootContent:e.rootContent,results:r}}var Ss=f(()=>{A();v();Tr();Y();i(TP,"canonicalRulePath");i(or,"splitEmbeddedRulesToCanonical");});async function NP(t,e,r,n){let o=n==="global"?nr:Pe,s=n==="project"?[o,xi]:[o];for(let a of s){let l=join(t,a),c=await I(l);if(c===null)continue;let m=join(t,jm),p=await or({content:c,projectRoot:t,rulesDir:oo,sourcePath:l,fromTool:no,normalize:r});e.push(...p.results);let{body:u}=E(r(p.rootContent,l,m)),d=await M(m,{root:true},u);await R(join(t,oo)),await S(m,d),e.push({fromTool:no,fromPath:l,toPath:jm,feature:"rules"});return}}async function Ah(t,e={}){let r=e.scope??"project",n=[],o=await z(no,t,r);return await NP(t,n,o,r),n.push(...await et(pl,t,r,{normalize:o})),await kt(t,r==="global"?Dr:xe,no,n,o),n}var bh=f(()=>{Ct();A();v();Et();qt();Y();Ss();so();Hm();i(NP,"importRootRule");i(Ah,"importFromAntigravity");});var Th,Nh,Dh=f(()=>{v();Y();so();Th=i(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:s}=E(e(n));return {destPath:n,toPath:`${oo}/${t}`,content:await M(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},s)}},"nonRootRuleMapper"),Nh=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${ml}/${t}`,content:await q(n,{hasDescription:typeof o.description=="string",description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},s)}},"workflowMapper");});function DP(t,e){return vh(e).some(n=>FP(t,n))}function Fh(t,e){return t.filter(r=>DP(r,e))}function vh(t){let e=t.match(/^(.+)\{([^}]+)\}(.*)$/);if(!e)return [t];let[,r,n,o]=e;if(!n)return [t];let s=n.split(",").map(l=>l.trim()),a=[];for(let l of s)for(let c of vh(r+l+o))a.push(c);return a}function FP(t,e){return vP(e).test(t)}function vP(t){let e=[],r=0;for(;r<t.length;){if(t.startsWith("**",r)){let s=t.slice(r+2);if(s.length===0&&e.length===0)e.push(".*");else if(e.push(s.startsWith("/")?"(?:[^/]+/)*":"(?:/[^/]+)*?"),s.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 $h=f(()=>{i(DP,"globMatch");i(Fh,"globFilter");i(vh,"expandBraces");i(FP,"matchOne");i(vP,"globToRegex");});function Q(t,e,r,n={}){let o=[],{rules:s}=t;if(s.length===0)return [];if(s.some(l=>l.root)||o.push({level:"error",file:relative(e,s[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 s){if(l.globs.length===0)continue;let c=false;for(let m of l.globs)if(Fh(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 Vt=f(()=>{$h();i(Q,"validateRules");});function Gh(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:no}))}var jh=f(()=>{Vt();so();i(Gh,"lintRules");});function w(t,e){return H(t).relative(t,e).replace(/\\/g,"/")}async function L(t,e){return x(H(t).join(t,e)).catch(()=>[])}function Kh(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}function KP(t,e,r,n){let o=posix.dirname(e),s=posix.dirname(r);for(;o!==n&&o!==".";)Kh(t,o,s),o=posix.dirname(o),s=posix.dirname(s);}function $(t,e,r,n){t.set(e,`${r}/${basename(e,n)}.md`);}function K(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,`${Uh}/${u}/SKILL.md`);return}let[o,...s]=n.split("/"),a=s.join("/");if(!o||!a)return;let l=o.startsWith(fs)?fs:o.startsWith(bi)?bi:null;if(l&&a==="SKILL.md"){t.set(e,`${jP}/${o.slice(l.length)}.md`);return}let c=o.startsWith(ps)?ps:o.startsWith(Ei)?Ei:null;if(c&&a==="SKILL.md"){t.set(e,`${UP}/${o.slice(c.length)}.md`);return}let m=`${Uh}/${o}`;a==="SKILL.md"&&Kh(t,`${r}/${o}`,m);let p=`${m}/${a}`;t.set(e,p),a!=="SKILL.md"&&KP(t,e,p,`${r}/${o}`);}function WP(t){return t.split("/").filter(Boolean)[0]??""}async function BP(){if(zm!==void 0)return zm;let{BUILTIN_TARGETS:t}=await Promise.resolve().then(()=>(it(),Wh)),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=WP(n);o.startsWith(".")&&e.add(o);}return zm=e,e}function Jm(t){return t.split("/").some(e=>e.startsWith("."))}async function HP(t){let e=[],r=await BP(),n=H(t);async function o(s){let a=n.join(t,s),l=await readdir(a,{withFileTypes:true}).catch(()=>[]);for(let c of l){let m=s?`${s}/${c.name}`:c.name;if(c.isDirectory()){if(r.has(c.name)||Jm(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)||Jm(m))continue;await o(m);continue}(c.name==="AGENTS.md"||c.name==="AGENTS.override.md")&&e.push(n.join(t,m));}}return i(o,"walk"),await o(""),e}async function ul(t,e){let r=await HP(e);for(let n of r){let o=w(e,n),s=o.endsWith("/AGENTS.md")&&o!=="AGENTS.md"&&!o.endsWith("/AGENTS.override.md"),a=o.endsWith("/AGENTS.override.md")&&o!=="AGENTS.override.md";if(!s&&!a)continue;let l=posix.dirname(o);if(Jm(l))continue;let c=l.replace(/\//g,"-");t.set(o,`${GP}/${c}.md`);}}var GP,jP,UP,Uh,zm,Dt=f(()=>{Pt();A();er();ht();GP=".agentsmesh/rules",jP=".agentsmesh/commands",UP=".agentsmesh/agents",Uh=".agentsmesh/skills";i(w,"rel");i(L,"listFiles");i(Kh,"addDirectoryMapping");i(KP,"addAncestorMappings");i($,"addSimpleFileMapping");i(K,"addSkillLikeMapping");i(WP,"firstPathSegment");i(BP,"targetRootSegments");i(Jm,"hasHiddenSegment");i(HP,"listScopedAgentsFiles");i(ul,"addScopedAgentsMappings");});var N,X,at,Ft=f(()=>{N=".agentsmesh/rules",X=".agentsmesh/commands",at=".agentsmesh/agents";});async function Ym(t,e,r="project"){if(r==="global"){t.set(nr,`${N}/_root.md`);for(let n of await L(e,Dr))K(t,w(e,n),Dr);t.set(ys,".agentsmesh/mcp.json");return}t.set(Pe,`${N}/_root.md`),t.set(xi,`${N}/_root.md`);for(let n of await L(e,rr)){let o=w(e,n);o===Pe||o===xi||$(t,o,N,".md");}for(let n of await L(e,Nr))$(t,w(e,n),X,".md");for(let n of await L(e,xe))K(t,w(e,n),xe);}var Bh=f(()=>{Dt();so();Ft();i(Ym,"buildAntigravityImportPaths");});var Hh,fn,zh,Fi,vi,$i,Mi,Gi,vr,Xm,ji,Cs,Ui,Ki,dl,fl,Zm,Wi,qm,ao,Vh,$r=f(()=>{Hh="claude-code",fn=".claude/CLAUDE.md",zh="CLAUDE.md",Fi=".claude/rules",vi=".claude/commands",$i=".claude/agents",Mi=".claude/skills",Gi=".claude/settings.json",vr=".claude/hooks.json",Xm=".claude/output-styles",ji=".claudeignore",Cs=".mcp.json",Ui=".claude.json",Ki=".agentsmesh/rules",dl=".agentsmesh/commands",fl=".agentsmesh/agents",Zm=".agentsmesh/skills",Wi=".agentsmesh/mcp.json",qm=".agentsmesh/permissions.yaml",ao=".agentsmesh/hooks.yaml",Vh=".agentsmesh/ignore";});async function Qm(t,e,r="project"){if(t.set(".claude/CLAUDE.md",`${N}/_root.md`),t.set(vr,ao),r==="project"&&t.set("CLAUDE.md",`${N}/_root.md`),r==="global")for(let n of await L(e,".agents/skills"))K(t,w(e,n),".agents/skills");for(let n of await L(e,".claude/rules"))$(t,w(e,n),N,".md");for(let n of await L(e,".claude/commands"))$(t,w(e,n),X,".md");for(let n of await L(e,".claude/agents"))$(t,w(e,n),at,".md");for(let n of await L(e,".claude/skills"))K(t,w(e,n),".claude/skills");}var Jh=f(()=>{Dt();$r();Ft();i(Qm,"buildClaudeCodeImportPaths");});var gn,Mr,lo,Gr,Yh,wt,sr,hn,co,mo,po,uo,tp,yn,gl,ep,rp,np,Xh,de=f(()=>{gn="cline",Mr=".clinerules",lo=".clineignore",Gr=".cline/cline_mcp_settings.json",Yh=".cline/mcp_settings.json",wt=".cline/skills",sr=".clinerules/workflows",hn="AGENTS.md",co=".clinerules/hooks",mo="Documents/Cline/Rules",po="Documents/Cline/Workflows",uo="Documents/Cline/Hooks",tp=".agentsmesh/hooks.yaml",yn=".agentsmesh/rules",gl=".agentsmesh/commands",ep=".agentsmesh/ignore",rp=".agentsmesh/mcp.json",np=".agentsmesh/agents",Xh=".agentsmesh/skills";});async function op(t,e,r="project"){if(r==="global"){for(let n of await L(e,mo))$(t,w(e,n),N,".md");for(let n of await L(e,po))$(t,w(e,n),X,".md");for(let n of await L(e,wt))K(t,w(e,n),wt);t.set(Gr,".agentsmesh/mcp.json");return}t.set(".clinerules/_root.md",`${N}/_root.md`);for(let n of await L(e,".clinerules")){let o=w(e,n);!o.endsWith(".md")||o.includes("/workflows/")||basename(o)==="_root.md"||$(t,o,N,".md");}for(let n of await L(e,".clinerules/workflows"))$(t,w(e,n),X,".md");for(let n of await L(e,".cline/skills"))K(t,w(e,n),".cline/skills");}var Zh=f(()=>{Dt();de();Ft();i(op,"buildClineImportPaths");});async function sp(t,e,r="project"){if(r==="global"?(t.set(".codex/AGENTS.md",`${N}/_root.md`),t.set(".codex/AGENTS.override.md",`${N}/_root.md`)):(t.set("AGENTS.md",`${N}/_root.md`),t.set("codex.md",`${N}/_root.md`),await ul(t,e)),r==="project")for(let n of await L(e,".codex/instructions"))$(t,w(e,n),N,".md");for(let n of await L(e,".codex/rules")){let o=w(e,n);o.endsWith(".rules")?$(t,o,N,".rules"):o.endsWith(".md")&&$(t,o,N,".md");}for(let n of await L(e,".codex/agents"))$(t,w(e,n),at,".toml");for(let n of await L(e,".agents/skills"))K(t,w(e,n),".agents/skills");}var qh=f(()=>{Dt();Ft();i(sp,"buildCodexCliImportPaths");});var Os,De,ir,ip,hl,jr,ap,Qt,Rs,Bi,yl,Il,lp,ar=f(()=>{Os="continue",De=".continue/rules",ir=".continue/prompts",ip=".continue/mcpServers",hl=`${ip}/agentsmesh.json`,jr=`${De}/general.md`,ap=`${De}/_root.md`,Qt=".continue/skills",Rs=".continue/AGENTS.md",Bi=".continue/config.yaml",yl=".agentsmesh/rules",Il=".agentsmesh/commands",lp=".agentsmesh/mcp.json";});async function cp(t,e,r="project"){t.set(jr,`${N}/_root.md`),t.set(ap,`${N}/_root.md`);for(let n of await L(e,".continue/rules")){let o=w(e,n);o===jr||o===ap||$(t,o,N,".md");}for(let n of await L(e,".continue/prompts"))t.set(w(e,n),`${X}/${basename(n,".md")}.md`);for(let n of await L(e,".continue/skills"))K(t,w(e,n),".continue/skills");if(r==="global")for(let n of await L(e,".agents/skills"))K(t,w(e,n),".agents/skills");}var Qh=f(()=>{Dt();ar();Ft();i(cp,"buildContinueImportPaths");});function JP(t,e){if(e.endsWith(".instructions.md")){t.set(e,`${N}/${basename(e,".instructions.md")}.md`);return}$(t,e,N,".md");}async function mp(t,e){t.set(".github/copilot-instructions.md",`${N}/_root.md`);for(let r of await L(e,".github/copilot"))t.set(w(e,r),`${N}/${basename(r,".instructions.md")}.md`);for(let r of await L(e,".github/instructions"))JP(t,w(e,r));for(let r of await L(e,".github/prompts"))t.set(w(e,r),`${X}/${basename(r,".prompt.md")}.md`);for(let r of await L(e,".github/agents"))t.set(w(e,r),`${at}/${basename(r,".agent.md")}.md`);for(let r of await L(e,".github/skills"))K(t,w(e,r),".github/skills");}var ty=f(()=>{Dt();Ft();i(JP,"addCopilotInstructionMapping");i(mp,"buildCopilotImportPaths");});var ey,In,ry,fe,Ur,ge,ks,lr,cr,mr,Sl,Fe,pp,YP,Es,ve,Hi,_n,Sn,pr,Cn,On,ny,ws,up,zi,dp,dt=f(()=>{ey="cursor",In="AGENTS.md",ry=".cursorrules",fe=".cursor/rules",Ur=`${fe}/general.mdc`,ge=".cursor/commands",ks=".cursor/agents",lr=".cursor/skills",cr=".cursor/mcp.json",mr=".cursor/hooks.json",Sl=".cursor/settings.json",Fe=".cursorignore",pp=".cursorindexingignore",YP=".agentsmesh-exports/cursor",Es=`${YP}/user-rules.md`,ve=".cursor/AGENTS.md",Hi=cr,_n=lr,Sn=ks,pr=".agentsmesh/rules",Cn=".agentsmesh/commands",On=".agentsmesh/agents",ny=".agentsmesh/skills",ws=".agentsmesh/mcp.json",up=".agentsmesh/permissions.yaml",zi=".agentsmesh/hooks.yaml",dp=".agentsmesh/ignore";});async function fp(t,e,r="project"){if(r==="global"){t.set(cr,".agentsmesh/mcp.json"),t.set(".cursor/AGENTS.md",`${N}/_root.md`);for(let n of await L(e,".cursor/rules"))$(t,w(e,n),N,".mdc");for(let n of await L(e,".cursor/commands"))$(t,w(e,n),X,".md");for(let n of await L(e,".cursor/agents"))$(t,w(e,n),at,".md");for(let n of await L(e,".cursor/skills"))K(t,w(e,n),".cursor/skills");return}t.set("AGENTS.md",`${N}/_root.md`);for(let n of await L(e,".cursor/rules"))$(t,w(e,n),N,".mdc");for(let n of await L(e,".cursor/commands"))$(t,w(e,n),X,".md");for(let n of await L(e,".cursor/agents"))$(t,w(e,n),at,".md");for(let n of await L(e,".cursor/skills"))K(t,w(e,n),".cursor/skills");}var oy=f(()=>{Dt();dt();Ft();i(fp,"buildCursorImportPaths");});async function gp(t,e){for(let r of await L(e,".gemini/rules"))$(t,w(e,r),N,".md");for(let r of await L(e,".gemini/commands")){let n=w(e,r);if(!n.endsWith(".toml")&&!n.endsWith(".md"))continue;let o=n.replace(/\.(toml|md)$/i,""),s=".gemini/commands/",c=(o.startsWith(s)?o.slice(s.length):o).split("/").filter(Boolean).join(":");t.set(n,`${X}/${c}.md`);}for(let r of await L(e,".gemini/agents"))$(t,w(e,r),at,".md");for(let r of await L(e,".gemini/skills"))K(t,w(e,r),".gemini/skills");}var sy=f(()=>{Dt();Ft();i(gp,"buildGeminiCliImportPaths");});var ur,he,Ut,Kr,iy,Wr,fo,ye,ay,ly,Ls=f(()=>{ur="goose",he=".goosehints",Ut=".agents/skills",Kr=".gooseignore",iy=".config/goose",Wr=`${iy}/.goosehints`,fo=`${iy}/.gooseignore`,ye=".agents/skills",ay=".agentsmesh/rules",ly=".agentsmesh/ignore";});async function hp(t,e,r="project"){if(r==="global"){t.set(Wr,`${N}/_root.md`);for(let n of await L(e,ye))K(t,w(e,n),ye);t.set(fo,".agentsmesh/ignore");return}t.set(he,`${N}/_root.md`);for(let n of await L(e,Ut))K(t,w(e,n),Ut);t.set(Kr,".agentsmesh/ignore");}var cy=f(()=>{Dt();Ls();Ft();i(hp,"buildGooseImportPaths");});var go,Rn,Cl,my,dr,py,XP,Vi,ho,Ji,As,bs,Yi,Xi,Zi,qi,Qi,ZP,Ol,yo,uy,yp,Rl,dy,fy,gy,hy,Ps=f(()=>{go="junie",Rn=".junie",Cl=`${Rn}/guidelines.md`,my=`${Rn}/ci-guidelines.md`,dr=`${Rn}/AGENTS.md`,py="AGENTS.md",XP=`${Rn}/mcp`,Vi=`${XP}/mcp.json`,ho=`${Rn}/skills`,Ji=`${Rn}/rules`,As=`${Rn}/commands`,bs=`${Rn}/agents`,Yi=".aiignore",Xi=".junie",Zi=`${Xi}/skills`,qi=`${Xi}/agents`,Qi=`${Xi}/commands`,ZP=`${Xi}/mcp`,Ol=`${ZP}/mcp.json`,yo=`${Xi}/AGENTS.md`,uy=".agents/skills",yp=".agentsmesh/rules/_root.md",Rl=".agentsmesh/rules",dy=".agentsmesh/commands",fy=".agentsmesh/agents",gy=".agentsmesh/mcp.json",hy=".agentsmesh/ignore";});async function Ip(t,e){t.set(Cl,`${N}/_root.md`),t.set(dr,`${N}/_root.md`),t.set("AGENTS.md",`${N}/_root.md`);for(let r of await L(e,".junie/rules"))$(t,w(e,r),N,".md");for(let r of await L(e,".junie/commands"))$(t,w(e,r),X,".md");for(let r of await L(e,".junie/agents"))$(t,w(e,r),at,".md");for(let r of await L(e,".junie/skills"))K(t,w(e,r),".junie/skills");}var yy=f(()=>{Dt();Ps();Ft();i(Ip,"buildJunieImportPaths");});var Kt,ta,fr,Br,Hr,zr,$e,kn,xs,kl,Io,Ts,_o,ea,El,Ns,En,So,Co,Oo,wn,Ds,wl,Iy,Ln,Fs,Ro,_y,Sy,ko=f(()=>{Kt="kilo-code",ta=".kilo",fr="AGENTS.md",Br=`${ta}/rules`,Hr=`${ta}/commands`,zr=`${ta}/agents`,$e=`${ta}/skills`,kn=`${ta}/mcp.json`,xs=".kilocodeignore",kl=".kilocode",Io=`${kl}/rules`,Ts=`${kl}/workflows`,_o=`${kl}/skills`,ea=`${kl}/mcp.json`,El=".kilocodemodes",Ns=".kilo",En=`${Ns}/AGENTS.md`,So=`${Ns}/rules`,Co=`${Ns}/commands`,Oo=`${Ns}/agents`,wn=`${Ns}/skills`,Ds=`${Ns}/mcp.json`,wl=".kilocodeignore",Iy=".agents/skills",Ln=".agentsmesh/rules",Fs=".agentsmesh/commands",Ro=".agentsmesh/agents",_y=".agentsmesh/mcp.json",Sy=".agentsmesh/ignore";});async function _p(t,e,r="project"){if(r==="global"){t.set(En,`${N}/_root.md`);for(let n of await L(e,So))$(t,w(e,n),N,".md");for(let n of await L(e,Co))$(t,w(e,n),X,".md");for(let n of await L(e,Oo))$(t,w(e,n),at,".md");for(let n of await L(e,wn))K(t,w(e,n),wn);t.set(Ds,".agentsmesh/mcp.json");return}t.set(fr,`${N}/_root.md`);for(let n of await L(e,Br))$(t,w(e,n),N,".md");for(let n of await L(e,Hr))$(t,w(e,n),X,".md");for(let n of await L(e,zr))$(t,w(e,n),at,".md");for(let n of await L(e,$e))K(t,w(e,n),$e);t.set(kn,".agentsmesh/mcp.json");for(let n of await L(e,Io)){let o=w(e,n);if(basename(o)==="00-root.md"){t.set(o,`${N}/_root.md`);continue}$(t,o,N,".md");}for(let n of await L(e,Ts))$(t,w(e,n),X,".md");for(let n of await L(e,_o))K(t,w(e,n),_o);t.set(ea,".agentsmesh/mcp.json");}var Cy=f(()=>{Dt();ko();Ft();i(_p,"buildKiloCodeImportPaths");});var te,Me,ra,Ge,Wt,je,An,Oy,vs,$s,Eo,Ue,bn,wo,na,oa,Ry,Sp,Cp,ky,Ey,Op,wy,Ms=f(()=>{te="kiro",Me="AGENTS.md",ra=".kiro",Ge=`${ra}/steering`,Wt=`${ra}/skills`,je=`${ra}/agents`,An=`${ra}/hooks`,Oy=`${ra}/settings`,vs=`${Oy}/mcp.json`,$s=".kiroignore",Eo=".kiro/steering",Ue=".kiro/steering/AGENTS.md",bn=".kiro/skills",wo=".kiro/agents",na=".kiro/settings/mcp.json",oa=".kiro/settings/kiroignore",Ry=".agents/skills",Sp=".agentsmesh/rules/_root.md",Cp=".agentsmesh/rules",ky=".agentsmesh/agents",Ey=".agentsmesh/mcp.json",Op=".agentsmesh/hooks.yaml",wy=".agentsmesh/ignore";});async function Rp(t,e,r="project"){if(r==="global"){t.set(Ue,`${N}/_root.md`);for(let n of await L(e,Eo)){let o=w(e,n);o!==Ue&&$(t,o,N,".md");}for(let n of await L(e,bn))K(t,w(e,n),bn);for(let n of await L(e,wo))$(t,w(e,n),at,".md");return}t.set(Me,`${N}/_root.md`);for(let n of await L(e,Ge))$(t,w(e,n),N,".md");for(let n of await L(e,Wt))K(t,w(e,n),Wt);for(let n of await L(e,je))$(t,w(e,n),at,".md");}var Ly=f(()=>{Dt();Ms();Ft();i(Rp,"buildKiroImportPaths");});var Ke,Ll,gr,Vr,Jr,Yr,We,hr,Gs,Pn,Lo,Ao,bo,xn,Tn,Ay,sa,Al,bl,kp,Po=f(()=>{Ke="opencode",Ll=".opencode",gr="AGENTS.md",Vr=`${Ll}/rules`,Jr=`${Ll}/commands`,Yr=`${Ll}/agents`,We=`${Ll}/skills`,hr="opencode.json",Gs=".config/opencode",Pn=`${Gs}/AGENTS.md`,Lo=`${Gs}/rules`,Ao=`${Gs}/commands`,bo=`${Gs}/agents`,xn=`${Gs}/skills`,Tn=`${Gs}/opencode.json`,Ay=".agents/skills",sa=".agentsmesh/rules",Al=".agentsmesh/commands",bl=".agentsmesh/agents",kp=".agentsmesh/mcp.json";});async function Ep(t,e,r="project"){if(r==="global"){t.set(Pn,`${N}/_root.md`);for(let n of await L(e,Lo))$(t,w(e,n),N,".md");for(let n of await L(e,Ao))$(t,w(e,n),X,".md");for(let n of await L(e,bo))$(t,w(e,n),at,".md");for(let n of await L(e,xn))K(t,w(e,n),xn);t.set(Tn,".agentsmesh/mcp.json");return}t.set(gr,`${N}/_root.md`);for(let n of await L(e,Vr))$(t,w(e,n),N,".md");for(let n of await L(e,Jr))$(t,w(e,n),X,".md");for(let n of await L(e,Yr))$(t,w(e,n),at,".md");for(let n of await L(e,We))K(t,w(e,n),We);t.set(hr,".agentsmesh/mcp.json");}var by=f(()=>{Dt();Po();Ft();i(Ep,"buildOpencodeImportPaths");});var Nn,xo,Be,ia,Xr,Zr,yr,aa,la,js,ca,Pl,Dn,Fn,qr,To,ma,vn,Py,No,xl,xy,Ty,Do=f(()=>{Nn="roo-code",xo=".roo",Be=`${xo}/rules/00-root.md`,ia=".roorules",Xr=`${xo}/rules`,Zr=`${xo}/commands`,yr=`${xo}/skills`,aa=`${xo}/mcp.json`,la=".rooignore",js=".roomodes",ca="settings/custom_modes.yaml",Pl=".roo",Dn=`${Pl}/rules`,Fn=`${Pl}/commands`,qr=`${Pl}/skills`,To="mcp_settings.json",ma=".rooignore",vn=`${Pl}/AGENTS.md`,Py=".agents/skills",No=".agentsmesh/rules",xl=".agentsmesh/commands",xy=".agentsmesh/mcp.json",Ty=".agentsmesh/ignore";});async function wp(t,e,r="project"){if(r==="global"){t.set(vn,`${N}/_root.md`);for(let n of await L(e,Dn))$(t,w(e,n),N,".md");for(let n of await L(e,Fn))$(t,w(e,n),X,".md");for(let n of await L(e,qr))K(t,w(e,n),qr);t.set(To,".agentsmesh/mcp.json");return}t.set(Be,`${N}/_root.md`),t.set(ia,`${N}/_root.md`);for(let n of await L(e,Xr)){let o=w(e,n);o!==Be&&$(t,o,N,".md");}for(let n of await L(e,".roo")){let o=w(e,n);/^\.roo\/rules-[^/]+\/.+\.md$/.test(o)&&$(t,o,N,".md");}for(let n of await L(e,Zr))$(t,w(e,n),X,".md");for(let n of await L(e,yr))K(t,w(e,n),yr);}var Ny=f(()=>{Dt();Do();Ft();i(wp,"buildRooCodeImportPaths");});async function Lp(t,e){t.set("AGENTS.md",`${N}/_root.md`),t.set(".windsurfrules",`${N}/_root.md`),await ul(t,e);for(let r of await L(e,".windsurf/rules"))$(t,w(e,r),N,".md");for(let r of await L(e,".windsurf/workflows"))$(t,w(e,r),X,".md");for(let r of await L(e,".windsurf/skills"))K(t,w(e,r),".windsurf/skills");}var Dy=f(()=>{Dt();Ft();i(Lp,"buildWindsurfImportPaths");});var Fy=f(()=>{Bh();Jh();Zh();qh();Qh();ty();oy();sy();cy();yy();Cy();Ly();by();Ny();Dy();});var vt=f(()=>{Fy();});var QP,tx,ex,rx,pl,Hm=f(()=>{ro();ht();_h();so();bh();Dh();jh();vt();QP={name:"antigravity",primaryRootInstructionPath:Pe,generateRules:dh,generateCommands:fh,generateAgents:yh,generateSkills:gh,generateMcp:hh,importFrom:Ah},tx={rootInstructionPath:Pe,skillDir:".agents/skills",rewriteGeneratedPath(t){return t===Ti?null:t},paths:{rulePath(t,e){return `${rr}/${t}.md`},commandPath(t,e){return `${Nr}/${t}.md`},agentPath(t){return `${xe}/${Z(t)}/SKILL.md`}}},ex={rootInstructionPath:nr,renderPrimaryRootInstruction:Ih,skillDir:Dr,managedOutputs:{dirs:[Dr,Ni],files:[nr,ys]},rewriteGeneratedPath(t){return t===Pe?nr:t.startsWith(`${rr}/`)?null:t.startsWith(".agents/skills/")?t.replace(".agents/skills",Dr):t.startsWith(`${Nr}/`)?t.replace(Nr,Ni):t===Ti?ys:t},paths:{rulePath(t,e){return nr},commandPath(t,e){return `${Ni}/${t}.md`},agentPath(t){return `${xe}/${Z(t)}/SKILL.md`}}},rx={rules:"native",additionalRules:"embedded",commands:be("partial","workflows"),agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},pl={id:"antigravity",generators:QP,capabilities:{rules:"native",additionalRules:"native",commands:be("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:Gh,project:tx,globalSupport:{capabilities:rx,detectionPaths:[".gemini/antigravity/GEMINI.md",".gemini/antigravity/skills",".gemini/antigravity/workflows",".gemini/antigravity/mcp_config.json"],layout:ex},importer:{rules:{feature:"rules",mode:"directory",source:{project:[rr]},canonicalDir:oo,extensions:[".md"],map:Th},commands:{feature:"commands",mode:"directory",source:{project:[Nr],global:[Ni]},canonicalDir:ml,extensions:[".md"],map:Nh},mcp:{feature:"mcp",mode:"flatFile",source:{global:[ys]},canonicalDir:".agentsmesh",canonicalFilename:uh}},buildImportPaths:Ym,detectionPaths:[".agents/rules/general.md",".agents/rules/",".agents/skills/",".agents/workflows/"]};});function vy(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 s of n){if(!Ze(s))continue;let a=gt(s),l=Gt(s),c=s.type==="prompt"?l||a:a||l,m={type:s.type==="prompt"?"prompt":"command",[s.type==="prompt"?"prompt":"command"]:c};s.timeout!==void 0&&(m.timeout=s.timeout),o.push({matcher:s.matcher,hooks:[m]});}o.length>0&&(e[r]=o);}return e}var $y=f(()=>{we();i(vy,"buildClaudeHooksObjectFromCanonical");});function My(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:fn,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 s=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:`${Fi}/${s}.md`,content:l});}return e}function Gy(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:`${vi}/${e.name}.md`,content:n}})}function jy(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
|
|
52
|
+
${n}`:n||r;return {path:`${on}/${e.name}.md`,content:o}})}function u_(t){return _t(t,He)}function d_(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:da,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function f_(t){return t.agents.map(e=>({path:`${He}/${H(e.name)}/SKILL.md`,content:te(e)}))}function g_(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 kt(e?.body.trim()??"",r)}var h_=d(()=>{ht();Ie();lt();vo();s(m_,"generateRules");s(p_,"generateCommands");s(u_,"generateSkills");s(d_,"generateMcp");s(f_,"generateAgents");s(g_,"renderAntigravityGlobalInstructions");});function VD(t){let e=t.replace(/\\/g,"/");return !e.startsWith("rules/")||e.endsWith("/")||!e.endsWith(".md")?null:e}async function Mr(t){let e=Ey(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=VD(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}=k(a),m=await G(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 C(i,m),r.push({fromTool:t.fromTool,fromPath:t.sourcePath,toPath:`.agentsmesh/${o}`,feature:"rules"});}return {rootContent:e.rootContent,results:r}}var hi=d(()=>{A();v();Ie();Z();s(VD,"canonicalRulePath");s(Mr,"splitEmbeddedRulesToCanonical");});async function JD(t,e,r,n){let o=n==="global"?Cr:Be,i=n==="project"?[o,ua]:[o];for(let a of i){let l=join(t,a),c=await y(l);if(c===null)continue;let m=join(t,qp),p=await Mr({content:c,projectRoot:t,rulesDir:Fo,sourcePath:l,fromTool:No,normalize:r});e.push(...p.results);let{body:u}=k(r(p.rootContent,l,m)),f=await G(m,{root:true},u);await O(join(t,Fo)),await C(m,f),e.push({fromTool:No,fromPath:l,toPath:qp,feature:"rules"});return}}async function I_(t,e={}){let r=e.scope??"project",n=[],o=await B(No,t,r);return await JD(t,n,o,r),n.push(...await q(Ic,t,r,{normalize:o})),await gt(t,r==="global"?sn:He,No,n,o),n}var __=d(()=>{yt();A();v();ht();Wt();Z();hi();vo();vu();s(JD,"importRootRule");s(I_,"importFromAntigravity");});var R_,O_,k_=d(()=>{v();Z();vo();R_=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}=k(e(n));return {destPath:n,toPath:`${Fo}/${t}`,content:await G(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"nonRootRuleMapper"),O_=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${ql}/${t}`,content:await et(n,{hasDescription:typeof o.description=="string",description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"workflowMapper");});function E_(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:No}))}var L_=d(()=>{Nt();vo();s(E_,"lintRules");});var YD,XD,ZD,qD,Ic,vu=d(()=>{To();lt();h_();vo();__();k_();L_();At();YD={name:"antigravity",primaryRootInstructionPath:Be,generateRules:m_,generateCommands:p_,generateAgents:f_,generateSkills:u_,generateMcp:d_,importFrom:I_},XD={rootInstructionPath:Be,skillDir:".agents/skills",rewriteGeneratedPath(t){return t===da?null:t},paths:{rulePath(t,e){return `${_r}/${t}.md`},commandPath(t,e){return `${on}/${t}.md`},agentPath(t){return `${He}/${H(t)}/SKILL.md`}}},ZD={rootInstructionPath:Cr,renderPrimaryRootInstruction:g_,skillDir:sn,managedOutputs:{dirs:[sn,fa],files:[Cr,Js]},rewriteGeneratedPath(t){return t===Be?Cr:t.startsWith(`${_r}/`)?null:t.startsWith(".agents/skills/")?t.replace(".agents/skills",sn):t.startsWith(`${on}/`)?t.replace(on,fa):t===da?Js:t},paths:{rulePath(t,e){return Cr},commandPath(t,e){return `${fa}/${t}.md`},agentPath(t){return `${He}/${H(t)}/SKILL.md`}}},qD={rules:"native",additionalRules:"embedded",commands:je("partial","workflows"),agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Ic={id:"antigravity",generators:YD,capabilities:{rules:"native",additionalRules:"native",commands:je("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:E_,project:XD,globalSupport:{capabilities:qD,detectionPaths:[".gemini/antigravity/GEMINI.md",".gemini/antigravity/skills",".gemini/antigravity/workflows",".gemini/antigravity/mcp_config.json"],layout:ZD},importer:{rules:{feature:"rules",mode:"directory",source:{project:[_r]},canonicalDir:Fo,extensions:[".md"],map:R_},commands:{feature:"commands",mode:"directory",source:{project:[on],global:[fa]},canonicalDir:ql,extensions:[".md"],map:O_},mcp:{feature:"mcp",mode:"flatFile",source:{global:[Js]},canonicalDir:".agentsmesh",canonicalFilename:uI}},buildImportPaths:Qp,detectionPaths:[".agents/rules/general.md",".agents/rules/",".agents/skills/",".agents/workflows/"]};});function w_(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(!fr(i))continue;let a=Ot(i),l=zt(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 A_=d(()=>{Me();s(w_,"buildClaudeHooksObjectFromCanonical");});function x_(t){let e=[],r=t.rules.find(o=>o.root);r&&e.push({path:Un,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=N(a,o.body.trim()||"");e.push({path:`${ga}/${i}.md`,content:l});}return e}function b_(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=N(r,e.body.trim()||"");return {path:`${ha}/${e.name}.md`,content:n}})}function P_(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
|
|
45
53
|
|
|
46
|
-
${n}`,
|
|
54
|
+
${n}`,i=N(r,o);return {path:`${ya}/${e.name}.md`,content:i}})}function T_(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Ys,content:e}]}function D_(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
|
|
47
55
|
|
|
48
|
-
${o}`,a=
|
|
49
|
-
`);return [{path:
|
|
56
|
+
${o}`,a=N(n,i);e.push({path:`${Ia}/${r.name}/SKILL.md`,content:a});for(let l of r.supportingFiles){let c=l.relativePath.replace(/\\/g,"/");e.push({path:`${Ia}/${r.name}/${c}`,content:l.content});}}return e}function N_(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:_a,content:o}]}function F_(t,e){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let r=w_(t);if(Object.keys(r).length===0)return [];if(e?.scope==="global")return [{path:an,content:JSON.stringify(r,null,2)}];let n=JSON.stringify({hooks:r},null,2);return [{path:_a,content:n}]}function v_(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
|
|
57
|
+
`);return [{path:Ca,content:e}]}var M_=d(()=>{v();ln();A_();s(x_,"generateRules");s(b_,"generateCommands");s(P_,"generateAgents");s(T_,"generateMcp");s(D_,"generateSkills");s(N_,"generatePermissions");s(F_,"generateHooks");s(v_,"generateIgnore");});function eN(t){let e=t.description.trim();return e||(basename(t.source)||"rule").replace(/\.md$/i,"")||"Rule"}function G_(t){let e=t.rules.find(o=>o.root),r=(e?.body??"").trim();return r?`# Global Instructions
|
|
50
58
|
|
|
51
|
-
## ${e?
|
|
59
|
+
## ${e?eN(e):"Guidance"}
|
|
52
60
|
|
|
53
61
|
${r}
|
|
54
|
-
`:""}var
|
|
62
|
+
`:""}var $_=d(()=>{s(eN,"ruleSectionTitle");s(G_,"renderClaudeGlobalPrimaryInstructions");});function U_(t,e){return t===null?"created":t!==e?"updated":"unchanged"}async function K_(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=N(c,l.body.trim()),p=`${tu}/${l.name}.md`,u=await y(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:U_(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=N(c,l.body.trim()),p=`${tu}/${l.name}.md`,u=await y(join(e,p));a.push({target:"claude-code",path:p,content:m,currentContent:u??void 0,status:U_(u,m)});}return a}var W_=d(()=>{A();v();ln();s(U_,"computeStatus");s(K_,"generateClaudeGlobalExtras");});var B_,H_,z_,V_=d(()=>{v();Z();Ke();ln();B_=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${Ra}/${t}`,content:await G(n,{...o,root:false},i)}},"claudeRuleMapper"),H_=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n)),a=Oe(o.allowedTools),l=a.length>0?a:Oe(o["allowed-tools"]);return {destPath:n,toPath:`${Ql}/${t}`,content:await et(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"),z_=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${tc}/${t}`,content:await Et(n,o,i)}},"claudeAgentMapper");});function J_(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:fI}))}var Y_=d(()=>{Nt();ln();s(J_,"lintRules");});var rN,X_,nN,oN,_c,Gu=d(()=>{M_();ln();ae();$_();W_();$u();V_();Y_();At();rN={name:"claude-code",primaryRootInstructionPath:Un,generateRules:x_,generateCommands:b_,generateAgents:P_,generateSkills:D_,generateMcp:T_,generatePermissions:N_,generateHooks:F_,generateIgnore:v_,importFrom:Cc},X_={rootInstructionPath:Un,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`}}},nN={rootInstructionPath:Un,skillDir:".claude/skills",renderPrimaryRootInstruction:G_,managedOutputs:{dirs:[".claude/agents",".claude/commands",".claude/rules",".claude/skills",".claude/output-styles",".agents/skills"],files:[".claude/CLAUDE.md",".claude/settings.json",Sa,an,".claudeignore"]},rewriteGeneratedPath(t){return t===Ys?Sa:t},mirrorGlobalPath(t,e){return ot(t,".claude/skills",e)},paths:X_.paths},oN={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"native"},_c={id:"claude-code",generators:rN,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:J_,project:X_,globalSupport:{capabilities:oN,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:nN,scopeExtras:K_},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Un,gI],global:[Un]},canonicalDir:Ra,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[ga],global:[ga]},canonicalDir:Ra,extensions:[".md"],map:B_}],commands:{feature:"commands",mode:"directory",source:{project:[ha],global:[ha]},canonicalDir:Ql,extensions:[".md"],map:H_},agents:{feature:"agents",mode:"directory",source:{project:[ya],global:[ya]},canonicalDir:tc,extensions:[".md"],map:z_},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Ys],global:[Sa]},canonicalDir:".agentsmesh",canonicalFilename:Oa},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Ca],global:[Ca]},canonicalDir:".agentsmesh",canonicalFilename:hI}},buildImportPaths:nu,detectionPaths:["CLAUDE.md",".claude/rules",".claude/commands"]};});function iN(t){let e=basename(t,".md");return e==="_root"?"root":e}function Z_(t){let e=[],r=t.rules.find(n=>n.root);if(r){let n=r.body.trim()?r.body:"";e.push({path:Wn,content:n});}for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("cline"))continue;let o=iN(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?N(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${cn}/${o}.md`,content:a});}return e}function q_(t){return t.commands.map(e=>{let r=e.description.trim(),n=e.body.trim(),o=r&&n?`${r}
|
|
55
63
|
|
|
56
|
-
${n}`:r||n;return {path:`${
|
|
57
|
-
`);return [{path:
|
|
58
|
-
`)}function
|
|
64
|
+
${n}`:r||n;return {path:`${Sr}/${e.name}.md`,content:o}})}function Q_(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
|
|
65
|
+
`);return [{path:Go,content:e}]}function tC(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:mn,content:e}]}function eC(t){return t.agents.map(e=>({path:`${Ft}/${H(e.name)}/SKILL.md`,content:te(e)}))}function aN(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function lN(t,e,r){return ["#!/usr/bin/env bash",`# agentsmesh-event: ${t}`,`# agentsmesh-matcher: ${r}`,`# agentsmesh-command: ${e}`,"set -e",e,""].join(`
|
|
66
|
+
`)}function rC(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)Zr(i)&&(e.push({path:`${$o}/${aN(r)}-${o}.sh`,content:lN(r,i.command,i.matcher)}),o++);}return e}function nC(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=N(n,r.body.trim()||"");e.push({path:`${Ft}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Ft}/${r.name}/${a}`,content:i.content});}}return e}var oC=d(()=>{Me();v();lt();ke();s(iN,"ruleSlug");s(Z_,"generateRules");s(q_,"generateCommands");s(Q_,"generateIgnore");s(tC,"generateMcp");s(eC,"generateAgents");s(aN,"safeEventName");s(lN,"buildHookScript");s(rC,"generateHooks");s(nC,"generateSkills");});async function iC(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}=k(r(o)),l=nn(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:`${Bn}/${n}`,feature:"rules",content:await G(o,c,a)}}async function aC(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=k(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(`
|
|
59
67
|
|
|
60
|
-
`);if(p>0){let u=
|
|
61
|
-
`)&&(l=u,c=true,m=
|
|
62
|
-
`)),e.push({fromTool:"cline",fromPath:o,toPath:
|
|
68
|
+
`);if(p>0){let u=i.slice(0,p).trim();u&&!u.includes(`
|
|
69
|
+
`)&&(l=u,c=true,m=i.slice(p+2));}}return {destPath:n,toPath:`${ec}/${t}`,feature:"commands",content:await et(n,{description:l,hasDescription:c,allowedTools:[],hasAllowedTools:Object.prototype.hasOwnProperty.call(o,"allowedTools")||Object.prototype.hasOwnProperty.call(o,"allowed-tools")},m)}}var ju=d(()=>{v();Z();Ke();ke();s(iC,"mapClineRuleFile");s(aC,"mapClineWorkflowFile");});async function lC(t,e,r){let n=join(t,Bn),o=join(t,cn),i=join(t,cn),a=false;try{a=(await stat(i)).isFile();}catch{}if(a){let p=await y(i);if(p!==null){await O(n);let u=join(n,"_root.md"),{frontmatter:f,body:g}=k(r(p,i,u)),R=f.root===true?f:{...f,root:true},S=await G(u,R,g);await C(u,S),e.push({fromTool:"cline",fromPath:i,toPath:`${Bn}/_root.md`,feature:"rules"});}return a}let l=null,c=join(o,"_root.md"),m=await y(c);if(m===null){let p=join(t,Wn),u=await y(p);if(u!==null){l=p,await O(n);let f=join(n,"_root.md"),{frontmatter:g,body:h}=k(r(u,p,f)),S=g.root===true?g:{...g,root:true},I=await G(f,S,h);await C(f,I),e.push({fromTool:"cline",fromPath:p,toPath:`${Bn}/_root.md`,feature:"rules"});}else {let h=(await D(o)).filter(R=>R.endsWith(".md")&&!R.includes("/workflows/")).sort()[0];if(h){let R=await y(h);if(R!==null){l=h,await O(n);let S=join(n,"_root.md"),{frontmatter:I,body:E}=k(r(R,h,S)),P=I.root===true?I:{...I,root:true},x=await G(S,P,E);await C(S,x),e.push({fromTool:"cline",fromPath:h,toPath:`${Bn}/_root.md`,feature:"rules"});}}}}else {l=c,await O(n);let p=join(n,"_root.md"),{frontmatter:u,body:f}=k(r(m,c,p)),h=u.root===true?u:{...u,root:true},R=await G(p,h,f);await C(p,R),e.push({fromTool:"cline",fromPath:c,toPath:`${Bn}/_root.md`,feature:"rules"});}return e.push(...await it({srcDir:o,destDir:n,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(async({srcPath:p,relativePath:u,normalizeTo:f})=>p===l?null:iC(u,n,f),"mapEntry")})),a}var cC=d(()=>{A();v();Z();We();ju();ke();s(lC,"importClineRules");});function mN(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 mC(t,e){let r=[mn,II].map(c=>join(t,c)),n=null,o=null;for(let c of r){let m=await y(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=mN(p);u&&(c[m]=u);}Object.keys(c).length>0&&(await O(join(t,".agentsmesh")),await C(join(t,iu),JSON.stringify({mcpServers:c},null,2)),e.push({fromTool:Kn,fromPath:i,toPath:iu,feature:"mcp"}));}}var pC=d(()=>{A();ke();s(mN,"mapClineServerToCanonical");s(mC,"importClineMcp");});function uC(t){return pN.some(e=>e.test(t))}var pN,dC=d(()=>{pN=[/^\./,/^_ab-agent-/,/^_ab-command-/,/\.fixture\./,/\.test\./];s(uC,"isReservedArtifactName");});async function dN(t){let e=await D(t).catch(()=>[]),r=[];for(let n of e){let o=relative(t,n).replace(/\\/g,"/"),i=basename(o);if(uC(i))continue;let a=await y(n);a!==null&&r.push({absolutePath:n,relativePath:o,content:a});}return r}async function Gr(t,e,r){let n=await dN(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}=k(l),p=await yr(a,{...c,name:t},m);await C(a,p);}else await C(a,l);r.results.push({fromTool:r.targetName,fromPath:i.absolutePath,toPath:`${r.destCanonicalSkillsDir}/${t}/${i.relativePath}`,feature:"skills"});}}async function gC(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}=k(a),m=await yr(i,{...l,name:t},c);await C(i,m),n.results.push({fromTool:n.targetName,fromPath:e,toPath:`${n.destCanonicalSkillsDir}/${t}/SKILL.md`,feature:"skills"});}async function po(t){let e=new Map;try{let n=(await D(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}var yi=d(()=>{A();v();Z();dC();s(dN,"readNativeSkill");s(Gr,"importDirectorySkill");s(gC,"importFlatSkill");s(po,"findDirectorySkills");});async function hC(t,e,r,n=Ft){let o=join(t,n),i=await po(o),a={projectRoot:t,sourceSkillsDir:n,destCanonicalSkillsDir:_I,targetName:"cline",normalize:r,results:e};for(let[l,c]of i){let m=join(c,"SKILL.md"),p=await y(m);if(!p)continue;let u=k(p),f=hr(u.frontmatter,l);if(f){let g=join(t,au);await O(g);let h=join(g,`${f.name}.md`);await C(h,ye(f,r(u.body,m,h))),e.push({fromTool:"cline",fromPath:m,toPath:`${au}/${f.name}.md`,feature:"agents"});continue}await Gr(l,c,a);}}var yC=d(()=>{A();v();lt();yi();ke();s(hC,"importClineSkills");});function Wu(t,e){return t.match(new RegExp(`^# agentsmesh-${e}:\\s*(.+)$`,"m"))?.[1]?.trim()??null}async function IC(t,e){let n=(await D(t).catch(()=>[])).filter(o=>basename(o).endsWith(".sh")&&dirname(o)===t);for(let o of n){let i=await y(o);if(!i)continue;let a=Wu(i,"event"),l=Wu(i,"command");if(!a||!l)continue;let c=Wu(i,"matcher")??"*";e[a]||(e[a]=[]),e[a].push({matcher:c,command:l});}}async function CC(t,e){let r={};if(await IC(join(t,$o),r),await IC(join(t,Ko),r),Object.keys(r).length===0)return;let n=join(t,ou);await O(dirname(n)),await C(n,stringify(r)),e.push({fromTool:Kn,fromPath:join(t,Ko),toPath:ou,feature:"hooks"});}var SC=d(()=>{A();ke();s(Wu,"extractMeta");s(IC,"loadHooksFromDir");s(CC,"importClineHooks");});async function kc(t){let e=[],r=await B(Kn,t),n=await lC(t,e,r),o=join(t,Go),i=await y(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,su);await C(m,c.join(`
|
|
70
|
+
`)),e.push({fromTool:"cline",fromPath:o,toPath:su,feature:"ignore"});}}await mC(t,e);let a=join(t,ec);return n||e.push(...await it({srcDir:join(t,Sr),destDir:a,extensions:[".md"],fromTool:"cline",normalize:r,mapEntry:s(({relativePath:l,normalizeTo:c})=>aC(l,a,c),"mapEntry")})),await hC(t,e,r),await CC(t,e),e}var Bu=d(()=>{yt();A();We();ju();cC();ke();pC();yC();SC();s(kc,"importFromCline");});function RC(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:Kn}))}var OC=d(()=>{Nt();ke();s(RC,"lintRules");});function kC(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>$(e.source,"cline","cline workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function EC(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".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 LC=d(()=>{Lt();s(kC,"lintCommands");s(EC,"lintHooks");});var hN,yN,IN,_N,wC,AC=d(()=>{oC();To();ke();Bu();OC();LC();At();$s();lt();hN={name:"cline",primaryRootInstructionPath:Wn,generateRules:Z_,generateCommands:q_,generateAgents:eC,generateSkills:nC,generateMcp:tC,generateHooks:rC,generateIgnore:Q_,importFrom:kc},yN={rootInstructionPath:Wn,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 `${cn}/${t}.md`},commandPath(t,e){return `${Sr}/${t}.md`},agentPath(t,e){return he(e,"cline")?`.cline/skills/${H(t)}/SKILL.md`:null}}},IN={skillDir:Ft,managedOutputs:{dirs:[jo,Uo,Ko,Ft,".agents/skills"],files:[mn,Go]},rewriteGeneratedPath(t){return t===Wn?null:t.startsWith(`${$o}/`)?`${Ko}/${t.slice($o.length+1)}`:t.startsWith(`${Sr}/`)?`${Uo}/${t.slice(Sr.length+1)}`:t.startsWith(`${cn}/`)?`${jo}/${t.slice(cn.length+1)}`:t},mirrorGlobalPath(t,e){return t.startsWith(`${Ft}/`)?`.agents/skills/${t.slice(Ft.length+1)}`:null},paths:{rulePath(t,e){return `${jo}/${t}.md`},commandPath(t,e){return `${Uo}/${t}.md`},agentPath(t,e){return he(e,"cline")?`.cline/skills/${H(t)}/SKILL.md`:null}}},_N={rules:"native",additionalRules:"native",commands:je("native","workflows"),agents:"embedded",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},wC={id:"cline",generators:hN,capabilities:{rules:"native",additionalRules:"native",commands:je("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:RC,lint:{commands:kC,hooks:EC},project:yN,globalSupport:{capabilities:_N,detectionPaths:[jo,Uo,Ko,Ft,mn,Go],layout:IN},buildImportPaths:lu,detectionPaths:[".clinerules",".cline"]};});var vt,xC,En,ps,bC,sr,PC,Ec,us,$r,ds,Ln,Hu,Ii,za,zu,TC,Vu,DC,NC,Ju,Yu,Xu,Ht=d(()=>{vt="codex-cli",xC="codex.md",En="AGENTS.md",ps=".codex/AGENTS.md",bC=".codex/AGENTS.override.md",sr=".agents/skills",PC=".codex/skills",Ec=".codex/config.toml",us=".codex/instructions",$r=".codex/rules",ds=".codex/agents",Ln=".agentsmesh/rules",Hu=".agentsmesh/commands",Ii=".agentsmesh/agents",za=".agentsmesh/skills",zu=".agentsmesh/mcp.json",TC="am-codex-rule:v1",Vu="# am-json: ",DC="# am-body-b64-begin",NC="# am-body-b64-end",Ju="# am64:",Yu="<!-- agentsmesh:codex-rule-index:start -->",Xu="<!-- agentsmesh:codex-rule-index:end -->";});function Zu(t){return basename(t,".md")}function Va(t){return `${us}/${Zu(t.source)}.md`}function FC(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];}),N(e,t.body.trim()||"")}function SN(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 \`${$r}/${Zu(t.source)}.rules\`.`),t.targets.length>0&&e.push(`Targeted to ${t.targets.map(r=>`\`${r}\``).join(", ")}.`),e.join(" ")}function vC(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||Zu(a.source)}](${Va(a)}): ${SN(a)}`),i=[Yu,"## Additional Rule Files",...o,Xu].join(`
|
|
63
71
|
`);return r?`${r}
|
|
64
72
|
|
|
65
|
-
${
|
|
66
|
-
`).trim()}var
|
|
73
|
+
${i}`:i}function MC(t){let e=Yu.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=Xu.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return t.replace(new RegExp(`\\n?${e}[\\s\\S]*?${r}\\n?`,"g"),`
|
|
74
|
+
`).trim()}var Lc=d(()=>{v();Ht();s(Zu,"ruleSlug");s(Va,"codexInstructionMirrorPath");s(FC,"serializeCodexInstructionMirror");s(SN,"summarizeRule");s(vC,"appendCodexRuleIndex");s(MC,"stripCodexRuleIndex");});function ON(t){return /(^|\n)\s*[A-Za-z_][A-Za-z0-9_]*\s*\(/.test(t)}function kN(t){return t.split(`
|
|
67
75
|
`).map(e=>e.length>0?`# ${e}`:"#").join(`
|
|
68
|
-
`)}function
|
|
69
|
-
`:`${["# 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.","#",...
|
|
76
|
+
`)}function EN(t){let e=t.trim();return e?ON(e)?`${e}
|
|
77
|
+
`:`${["# 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.","#",...kN(e).split(`
|
|
70
78
|
`),"#","# Example template:","# prefix_rule(",'# pattern = ["git", "status"],','# decision = "allow",','# justification = "Allow safe status checks",',"# )"].join(`
|
|
71
79
|
`)}
|
|
72
|
-
`:""}function
|
|
80
|
+
`:""}function qu(t){let e=t.rules.find(n=>n.root),r=[];e&&r.push({path:En,content:vC(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:`${$r}/${o}.rules`,content:EN(n.body)}),r.push({path:Va(n),content:FC(n)}));}return r}function Qu(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 kt(e?.body.trim()??"",r)}var GC=d(()=>{Ie();Ht();Lc();s(ON,"looksLikeCodexRulesDsl");s(kN,"toCodexRulesComments");s(EN,"toSafeCodexRulesContent");s(qu,"generateRules");s(Qu,"renderCodexGlobalInstructions");});function td(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=N(n,r.body.trim()||"");e.push({path:`${sr}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${sr}/${r.name}/${a}`,content:i.content});}}return e}function LN(t){return {path:`${sr}/${nt(t.name)}/SKILL.md`,content:gr(t)}}function ed(t){return t.commands.map(LN)}var $C=d(()=>{v();Ht();Qt();s(td,"generateSkills");s(LN,"commandToSkillOutput");s(ed,"generateCommands");});function rd(t){return t.agents.map(e=>({path:`${ds}/${e.name}.toml`,content:wN(e)}))}function wN(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 = """
|
|
73
81
|
${n}
|
|
74
82
|
"""`);}else e.push(`developer_instructions = '''
|
|
75
83
|
${r}
|
|
76
84
|
'''`);return e.join(`
|
|
77
85
|
`)+`
|
|
78
|
-
`}var
|
|
86
|
+
`}var jC=d(()=>{Ht();s(rd,"generateAgents");s(wN,"serializeAgentToCodexToml");});function wc(t){return "command"in t}function UC(t){return "url"in t}var Ac=d(()=>{s(wc,"isStdioMcpServer");s(UC,"isUrlMcpServer");});function nd(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=Object.fromEntries(Object.entries(t.mcp.mcpServers).flatMap(([n,o])=>wc(o)?[[n,o]]:[]));if(Object.keys(e).length===0)return [];let r=AN(e);return [{path:Ec,content:r}]}function AN(t){let e=[];for(let[r,n]of Object.entries(t)){let o=KC(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])=>`${KC(m)?JSON.stringify(m):m} = ${JSON.stringify(p)}`).join(", ");i.push(`env = { ${c} }`);}e.push(i.join(`
|
|
79
87
|
`));}return e.join(`
|
|
80
88
|
|
|
81
89
|
`)+`
|
|
82
|
-
`}function
|
|
83
|
-
`).find(c=>c.startsWith(
|
|
84
|
-
`)){let m=c.trimEnd();if(m===KI){l=true;continue}if(m===WI){l=false;continue}l&&m.startsWith(Gp)&&a.push(m.slice(Gp.length));}if(a.length===0)return null;try{let c=Buffer.from(a.join(""),"base64").toString("utf8");return {meta:{description:o,globs:s},body:c}}catch{return null}}var l_=f(()=>{Mt();i(a_,"tryParseEmbeddedCanonicalFromCodexRules");});async function m_(t,e,r){let n=[],o=join(t,_r);try{let s=await x(o),a=s.filter(c=>c.endsWith(".md"));for(let c of a){let m=await I(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/"),u=join(e,p),{frontmatter:d,body:g}=E(r(m,c,u));await R(e);let h=d.root===!0?d:{...d,root:!1},C=await M(u,h,g);await S(u,C),n.push({fromTool:Lt,fromPath:c,toPath:`${en}/${p}`,feature:"rules"});}let l=s.filter(c=>c.endsWith(".rules"));for(let c of l){let m=await I(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/").replace(/\.rules$/i,".md"),u=join(e,p);await R(e);let d=a_(m);if(d){let g=await M(u,{description:d.meta.description,globs:d.meta.globs,root:!1},r(d.body,c,u));await S(u,g);}else {let g=await M(u,{root:!1,description:"",globs:[],codex_emit:"execution"},r(m.trim(),c,u));await S(u,g);}n.push({fromTool:Lt,fromPath:c,toPath:`${en}/${p}`,feature:"rules"});}}catch{}return n}var p_=f(()=>{A();v();Y();Mt();l_();i(m_,"importCodexNonRootRuleFiles");});async function d_(t,e,r,n,o){let s=join(t,MI),a=join(t,tn),l=join(t,GI),c=join(t,Fo),m=o==="global"?await I(l):null,p=o==="global"?await I(c):null,u=o==="project"?await I(a):null,d=o==="project"?await I(s):null,g=m!==null?l:p!==null?c:u!==null?a:s,h=join(t,en),C=m??p??u??d;if(C!==null){await R(h);let O=join(h,"_root.md"),_=g===a||g===c||g===l?zI(C):C,k=await or({content:_,projectRoot:t,rulesDir:en,sourcePath:g,fromTool:"codex-cli",normalize:r});e.push(...k.results);let D=r(g===a||g===c||g===l?n(k.rootContent,g,O):k.rootContent,g,O),{frontmatter:b,body:P}=E(D),J=b.root===true?b:{...b,root:true},j=await M(O,J,P);await S(O,j),e.push({fromTool:"codex-cli",fromPath:g,toPath:`${en}/_root.md`,feature:"rules"});}await Wx(t,h,e,r),e.push(...await m_(t,h,r)),o!=="global"&&e.push(...await tt({srcDir:t,destDir:h,extensions:["AGENTS.md","AGENTS.override.md"],fromTool:"codex-cli",normalize:r,mapEntry:i(async({srcPath:O,normalizeTo:_})=>{let k=relative(t,dirname(O)).replace(/\\/g,"/"),D=basename(O),b=D==="AGENTS.override.md";if(!k||k==="."||!b&&D!=="AGENTS.md")return null;let P=k.replace(/\//g,"-");if(!ll(k))return await ce(join(h,`${P}.md`)),null;let J=join(h,`${P}.md`),{frontmatter:j,body:W}=E(_(J));return {destPath:J,toPath:`${en}/${P}.md`,feature:"rules",content:await M(J,{...j,root:false,globs:[`${k}/**`],...b?{codex_instruction:"override"}:{}},W)}},"mapEntry")}));}async function Wx(t,e,r,n){try{let s=(await x(join(t,vo))).filter(l=>l.endsWith(".md")),a=join(t,vo);for(let l of s){let c=relative(a,l).replace(/\\/g,"/");if(c==="_root.md")continue;let m=await I(l);if(!m)continue;let p=join(e,c),{frontmatter:u,body:d}=E(n(m,l,p));await R(e);let g=u.root===!0?u:{...u,root:!1},h=await M(p,g,d);await S(p,h),r.push({fromTool:Lt,fromPath:l,toPath:`${en}/${c}`,feature:"rules"});}}catch{}}var f_=f(()=>{A();v();Y();Ss();Ne();hs();Mt();p_();Gl();i(d_,"importCodexRules");i(Wx,"importInstructionMirrors");});async function Kl(t,e){let r=e?.scope??"project",n=[],o=await z(Lt,t,r),s=await z("windsurf",t,r);return await d_(t,n,o,s,r),await n_(t,n,o),await s_(t,n,o),await e_(t,n),n}var Zp=f(()=>{Ct();Mt();r_();o_();i_();f_();i(Kl,"importFromCodex");});function g_(t,e,r){let{rules:n}=t;return n.length===0?[]:n.some(s=>s.root)?[]:[{level:"warning",file:relative(e,n[0].source),target:Lt,message:"Codex needs a root rule to generate AGENTS.md. Add root: true to a rule."}]}var h_=f(()=>{Mt();i(g_,"lintRules");});function y_(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(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 n||"type"in n){let o="type"in n?n.type:"url";e.push(B(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" uses ${o} transport; codex-cli only generates stdio MCP servers.`));}return e}var I_=f(()=>{$t();i(y_,"lintMcp");});function __(t){return da(t)}var S_=f(()=>{Gl();i(__,"codexAdvisoryInstructionPath");});var Hx,zx,Vx,Jx,O_,R_=f(()=>{t_();Mt();Zp();h_();I_();vt();ms();S_();er();Hx={name:"codex-cli",primaryRootInstructionPath:tn,generateRules:Wp,generateCommands:zp,generateAgents:Vp,generateSkills:Hp,generateMcp:Jp,importFrom:Kl},zx={rootInstructionPath:tn,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${_r}/${e}.rules`]},skillDir:".agents/skills",managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/instructions"],files:["AGENTS.md",".codex/config.toml"]},paths:{rulePath(t,e){return __(e)},commandPath(t,e){return cs(e,"codex-cli")?`${ze}/${Tt(t)}/SKILL.md`:null},agentPath(t,e){return `${$o}/${t}.toml`}}},Vx={rootInstructionPath:Fo,renderPrimaryRootInstruction:Bp,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${_r}/${e}.rules`]},skillDir:ze,managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/rules"],files:[Fo,".codex/config.toml"]},rewriteGeneratedPath(t){return t===tn?Fo:t.startsWith(`${vo}/`)?null:t},paths:{rulePath(t,e){return e.codexEmit==="execution"?`${_r}/${t}.rules`:Fo},commandPath(t,e){return cs(e,"codex-cli")?`${ze}/${Tt(t)}/SKILL.md`:null},agentPath(t,e){return `${$o}/${t}.toml`}}},Jx={rules:"native",additionalRules:"embedded",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},O_={id:"codex-cli",generators:Hx,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:g_,lint:{mcp:y_},project:zx,globalSupport:{capabilities:Jx,detectionPaths:[".codex/AGENTS.md",".codex/AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules",".agents/skills"],layout:Vx},buildImportPaths:sp,sharedArtifacts:{".agents/skills/":"owner"},detectionPaths:["codex.md","AGENTS.md","AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules"]};});function Xx(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 k_(t){return `${ir}/${t}.md`}function E_(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 w_(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:Xx(t["x-agentsmesh-allowed-tools"])}}function L_(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 Wl=f(()=>{v();ar();i(Xx,"toStringArray");i(k_,"continueCommandRulePath");i(E_,"serializeCommandRule");i(w_,"parseCommandRuleFrontmatter");i(L_,"serializeImportedCommand");});function A_(t){let e=[],r=t.rules.find(n=>n.root);if(r){let n={};r.description&&(n.description=r.description),e.push({path:jr,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"),s={};n.description&&(s.description=n.description),n.globs.length>0&&(s.globs=n.globs),e.push({path:`${De}/${o}.md`,content:T(s,n.body.trim()||"")});}return e}function b_(t){return t.commands.map(e=>({path:`${ir}/${e.name}.md`,content:E_(e)}))}function P_(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:hl,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function x_(t){return t.agents.map(e=>({path:`${Qt}/${Z(e.name)}/SKILL.md`,content:qe(e)}))}function T_(t){return Nt(t,Qt)}var N_=f(()=>{Et();ht();v();Wl();ar();i(A_,"generateRules");i(b_,"generateCommands");i(P_,"generateMcp");i(x_,"generateAgents");i(T_,"generateSkills");});function tT(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[s,a]of Object.entries(n)){if(!a||typeof a!="object"||Array.isArray(a))continue;let l=a;typeof l.command=="string"&&(o[s]={type:typeof l.type=="string"?l.type:"stdio",command:l.command,args:Is(l.args),env:_s(l.env),description:typeof l.description=="string"?l.description:void 0});}return o}async function eT(t,e){let r=(await x(join(t,ip))).filter(s=>[".json",".yaml",".yml"].includes(extname(s))),n={},o=[];for(let s of r){let a=await I(s);a&&(Object.assign(n,tT(a,extname(s))),o.push(s));}if(Object.keys(n).length!==0){await pe(t,lp,n);for(let s of o)e.push({fromTool:Os,fromPath:s,toPath:lp,feature:"mcp"});}}async function Bl(t){let e=[],r=await z(Os,t);return e.push(...await et(Hl,t,"project",{normalize:r})),await kt(t,Qt,Os,e,r),await eT(t,e),e}var qp=f(()=>{Ct();A();Et();qt();io();Te();ar();Qp();i(tT,"readMcpServers");i(eT,"importMcp");i(Bl,"importFromContinue");});function rT(t){return t==="general.md"||t==="_root.md"}var F_,v_,$_=f(()=>{v();Y();Wl();ar();i(rT,"isContinueRootRulePath");F_=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=rT(t),o=n?"_root.md":t,s=join(r,o),{frontmatter:a,body:l}=E(e(s)),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:s,toPath:`${yl}/${o}`,content:await M(s,c,l)}},"continueRuleMapper"),v_=i(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:n})=>{let o=join(n,e),{frontmatter:s,body:a}=E(r(o)),l=w_(s,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),d=await q(u,{description:l.description,hasDescription:!!l.description,allowedTools:l.allowedTools,hasAllowedTools:l.allowedTools.length>0},E(L_(l,a)).body);return {destPath:u,toPath:`${Il}/${p}`,content:d}},"continueCommandMapper");});function M_(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Os}))}var G_=f(()=>{Vt();ar();i(M_,"lintRules");});function j_(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 U_=f(()=>{$t();i(j_,"lintCommands");});function iT(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var K_,W_=f(()=>{A();ar();i(iT,"computeStatus");K_=i(async(t,e,r,n)=>{if(r!=="global")return [];let o=n.has("rules"),s=n.has("commands"),a=n.has("mcp");if(!(o&&t.rules.length>0||s&&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()}))),s&&t.commands.length>0&&(c.prompts=t.commands.map(u=>{let d={name:u.name};return u.description&&(d.description=u.description),d.prompt=u.body.trim(),d})),a&&t.mcp!==null){let u=Object.entries(t.mcp.mcpServers);u.length>0&&(c.mcpServers=u.map(([d,g])=>({name:d,...g})));}let m=stringify(c),p=await I(join(e,Bi));return [{target:"continue",path:Bi,content:m,currentContent:p??void 0,status:iT(p,m)}]},"generateContinueGlobalConfig");});function lT(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var B_,H_=f(()=>{A();ar();W_();i(lT,"computeStatus");B_=i(async(t,e,r,n)=>{let o=await K_(t,e,r,n);if(r!=="global"||!n.has("rules"))return o;let s=t.rules.find(c=>c.root);if(!s)return o;let a=s.body.trim(),l=await I(join(e,Rs));return [...o,{target:"continue",path:Rs,content:a,currentContent:l??void 0,status:lT(l,a)}]},"generateContinueScopeExtras");});var cT,mT,pT,uT,Hl,Qp=f(()=>{ht();N_();ar();qp();$_();G_();U_();Wl();vt();H_();cT={name:"continue",primaryRootInstructionPath:jr,generateRules:A_,generateCommands:b_,generateAgents:x_,generateSkills:T_,generateMcp:P_,importFrom:Bl},mT={rootInstructionPath:jr,skillDir:".continue/skills",managedOutputs:{dirs:[".continue/prompts",".continue/rules",".continue/skills"],files:[".continue/mcpServers/agentsmesh.json"]},paths:{rulePath(t,e){return `${De}/${t}.md`},commandPath(t,e){return k_(t)},agentPath(t){return `${Qt}/${Z(t)}/SKILL.md`}}},pT={rootInstructionPath:jr,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Rs]}],skillDir:Qt,managedOutputs:{dirs:[De,ir,Qt,".agents/skills"],files:[hl,Rs,Bi]},mirrorGlobalPath(t,e){return t.startsWith(`${Qt}/`)?`.agents/skills/${t.slice(Qt.length+1)}`:null},paths:{rulePath(t,e){return `${De}/${t}.md`},commandPath(t,e){return `${ir}/${t}.md`},agentPath(t){return `${Qt}/${Z(t)}/SKILL.md`}}},uT={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Hl={id:"continue",generators:cT,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:M_,lint:{commands:j_},project:mT,globalSupport:{capabilities:uT,detectionPaths:[De,ir,".continue/mcpServers",Qt],layout:pT,scopeExtras:B_},importer:{rules:{feature:"rules",mode:"directory",source:{project:[De],global:[De]},canonicalDir:yl,extensions:[".md"],map:F_},commands:{feature:"commands",mode:"directory",source:{project:[ir],global:[ir]},canonicalDir:Il,extensions:[".md"],map:v_}},buildImportPaths:cp,detectionPaths:[".continue/rules",".continue/skills",".continue/mcpServers"]};});var rn,Mo,z_,Go,Mn,Cr,Or,jo,Uo,zl,Vl,V_,eu,J_,Gn,Bs,nn,Hs,Ko,ru,nu,Ie=f(()=>{rn="copilot",Mo=".github/copilot-instructions.md",z_=".github/copilot",Go=".github/instructions",Mn=".github/prompts",Cr=".github/hooks",Or=".github/skills",jo=".github/agents",Uo=".agentsmesh/rules",zl=".agentsmesh/commands",Vl=".agentsmesh/agents",V_=".agentsmesh/skills",eu=".agentsmesh/hooks.yaml",J_=".github/copilot-hooks",Gn=".copilot/copilot-instructions.md",Bs=".copilot/agents",nn=".copilot/skills",Hs=".copilot/prompts",Ko=".copilot/AGENTS.md",ru=".claude/skills",nu=".agents/skills";});function Y_(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 Jl(t){return `${Mn}/${t}.prompt.md`}function X_(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 Z_(t,e){let n=((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||basename(e,".prompt.md")).trim(),o=Y_(t["x-agentsmesh-allowed-tools"]),s=o.length>0?o:Y_(t.tools);return {name:n,description:typeof t.description=="string"?t.description:"",allowedTools:s}}var Yl=f(()=>{v();Ie();i(Y_,"toStringArray");i(Jl,"commandPromptPath");i(X_,"serializeCommandPrompt");i(Z_,"parseCommandPromptFrontmatter");});function Xl(t){return Pr(t)}var ou=f(()=>{we();i(Xl,"hasHookCommand");});function gT(t){let e=basename(t,".md");return e==="_root"?"root":e}function hT(t){switch(t){case "PreToolUse":return "preToolUse";case "PostToolUse":return "postToolUse";case "Notification":return "notification";case "UserPromptSubmit":return "userPromptSubmitted";default:return null}}function q_(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 s=n.description?`## ${n.description}`:null;s?e.push(`${s}
|
|
90
|
+
`}function KC(t){return !/^[A-Za-z0-9_-]+$/.test(t)}var WC=d(()=>{Ac();Ht();s(nd,"generateMcp");s(AN,"serializeMcpToToml");s(KC,"needsTomlQuoting");});var BC=d(()=>{GC();$C();jC();WC();});var HC=d(()=>{BC();});function PN(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 zC(t,e){let r=join(t,Ec),n=await y(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=PN(c);m&&(a[l]=m);}Object.keys(a).length!==0&&(await Kt(t,zu,a),e.push({fromTool:vt,fromPath:r,toPath:zu,feature:"mcp"}));}var VC=d(()=>{A();rn();Ht();s(PN,"mapTomlServerToCanonical");s(zC,"importMcp");});async function JC(t,e,r){let n={projectRoot:t,sourceSkillsDir:sr,destCanonicalSkillsDir:za,targetName:vt,normalize:r,results:e};for(let o of [sr,PC]){let i=join(t,o),a=await readdir(i,{encoding:"utf8",withFileTypes:true}).catch(()=>null);if(a===null)continue;let l=false;for(let c of a){if(!c.isDirectory()&&!c.isSymbolicLink())continue;let m=join(i,c.name),p=join(m,"SKILL.md"),u=await y(p);if(!u)continue;l=true;let f=c.name,g=join(t,za,f,"SKILL.md"),h=r(u,p,g),{frontmatter:R,body:S}=k(h),I=Wl(R,c.name);if(I){await _e(join(t,za,f));let T=join(t,Hu);await O(T);let P=join(T,`${I.name}.md`);await C(P,Bl(I,r(S,p,P))),e.push({fromTool:vt,fromPath:p,toPath:`${Hu}/${I.name}.md`,feature:"commands"});continue}let E=hr(R,c.name);if(E){await _e(join(t,za,f));let T=join(t,Ii);await O(T);let P=join(T,`${E.name}.md`);await C(P,ye(E,r(S,p,P))),e.push({fromTool:vt,fromPath:p,toPath:`${Ii}/${E.name}.md`,feature:"agents"});continue}await Gr(f,m,n);}if(l)return}}var YC=d(()=>{A();v();Qt();lt();Bs();yi();Ht();s(JC,"importSkills");});async function XC(t,e,r){let n=join(t,ds),o=join(t,Ii);try{let a=(await D(n)).filter(l=>l.endsWith(".toml"));for(let l of a){let c=await y(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":"",S=Array.isArray(m.mcp_servers)?m.mcp_servers.filter(x=>typeof x=="string"):[];await O(o);let I=join(o,`${p}.md`),E=r(f,l,I),P=ye({name:p,description:u,tools:[],disallowedTools:[],model:g,permissionMode:R,maxTurns:0,mcpServers:S,hooks:{},skills:[],memory:""},E);await C(I,P),e.push({fromTool:vt,fromPath:l,toPath:`${Ii}/${p}.md`,feature:"agents"});}}catch{}}var ZC=d(()=>{A();lt();Ht();s(XC,"importCodexAgentsFromToml");});function qC(t){if(!t.includes(TC))return null;let e=t.split(`
|
|
91
|
+
`).find(c=>c.startsWith(Vu));if(!e)return null;let r;try{r=JSON.parse(e.slice(Vu.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(`
|
|
92
|
+
`)){let m=c.trimEnd();if(m===DC){l=true;continue}if(m===NC){l=false;continue}l&&m.startsWith(Ju)&&a.push(m.slice(Ju.length));}if(a.length===0)return null;try{let c=Buffer.from(a.join(""),"base64").toString("utf8");return {meta:{description:o,globs:i},body:c}}catch{return null}}var QC=d(()=>{Ht();s(qC,"tryParseEmbeddedCanonicalFromCodexRules");});async function eS(t,e,r){let n=[],o=join(t,$r);try{let i=await D(o),a=i.filter(c=>c.endsWith(".md"));for(let c of a){let m=await y(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/"),u=join(e,p),{frontmatter:f,body:g}=k(r(m,c,u));await O(e);let h=f.root===!0?f:{...f,root:!1},R=await G(u,h,g);await C(u,R),n.push({fromTool:vt,fromPath:c,toPath:`${Ln}/${p}`,feature:"rules"});}let l=i.filter(c=>c.endsWith(".rules"));for(let c of l){let m=await y(c);if(!m)continue;let p=relative(o,c).replace(/\\/g,"/").replace(/\.rules$/i,".md"),u=join(e,p);await O(e);let f=qC(m);if(f){let g=await G(u,{description:f.meta.description,globs:f.meta.globs,root:!1},r(f.body,c,u));await C(u,g);}else {let g=await G(u,{root:!1,description:"",globs:[],codex_emit:"execution"},r(m.trim(),c,u));await C(u,g);}n.push({fromTool:vt,fromPath:c,toPath:`${Ln}/${p}`,feature:"rules"});}}catch{}return n}var rS=d(()=>{A();v();Z();Ht();QC();s(eS,"importCodexNonRootRuleFiles");});async function oS(t,e,r,n,o){let i=join(t,xC),a=join(t,En),l=join(t,bC),c=join(t,ps),m=o==="global"?await y(l):null,p=o==="global"?await y(c):null,u=o==="project"?await y(a):null,f=o==="project"?await y(i):null,g=m!==null?l:p!==null?c:u!==null?a:i,h=join(t,Ln),R=m??p??u??f;if(R!==null){await O(h);let S=join(h,"_root.md"),I=g===a||g===c||g===l?MC(R):R,E=await Mr({content:I,projectRoot:t,rulesDir:Ln,sourcePath:g,fromTool:"codex-cli",normalize:r});e.push(...E.results);let T=r(g===a||g===c||g===l?n(E.rootContent,g,S):E.rootContent,g,S),{frontmatter:P,body:x}=k(T),Y=P.root===true?P:{...P,root:true},K=await G(S,Y,x);await C(S,K),e.push({fromTool:"codex-cli",fromPath:g,toPath:`${Ln}/_root.md`,feature:"rules"});}await GN(t,h,e,r),e.push(...await eS(t,h,r)),o!=="global"&&e.push(...await it({srcDir:t,destDir:h,extensions:["AGENTS.md","AGENTS.override.md"],fromTool:"codex-cli",normalize:r,mapEntry:s(async({srcPath:S,normalizeTo:I})=>{let E=relative(t,dirname(S)).replace(/\\/g,"/"),T=basename(S),P=T==="AGENTS.override.md";if(!E||E==="."||!P&&T!=="AGENTS.md")return null;let x=E.replace(/\//g,"-");if(!Jl(E))return await _e(join(h,`${x}.md`)),null;let Y=join(h,`${x}.md`),{frontmatter:K,body:z}=k(I(Y));return {destPath:Y,toPath:`${Ln}/${x}.md`,feature:"rules",content:await G(Y,{...K,root:false,globs:[`${E}/**`],...P?{codex_instruction:"override"}:{}},z)}},"mapEntry")}));}async function GN(t,e,r,n){try{let i=(await D(join(t,us))).filter(l=>l.endsWith(".md")),a=join(t,us);for(let l of i){let c=relative(a,l).replace(/\\/g,"/");if(c==="_root.md")continue;let m=await y(l);if(!m)continue;let p=join(e,c),{frontmatter:u,body:f}=k(n(m,l,p));await O(e);let g=u.root===!0?u:{...u,root:!1},h=await G(p,g,f);await C(p,h),r.push({fromTool:vt,fromPath:l,toPath:`${Ln}/${c}`,feature:"rules"});}}catch{}}var sS=d(()=>{A();v();Z();hi();We();Bs();Ht();rS();Lc();s(oS,"importCodexRules");s(GN,"importInstructionMirrors");});async function xc(t,e){let r=e?.scope??"project",n=[],o=await B(vt,t,r),i=await B("windsurf",t,r);return await oS(t,n,o,i,r),await JC(t,n,o),await XC(t,n,o),await zC(t,n),n}var id=d(()=>{yt();Ht();VC();YC();ZC();sS();s(xc,"importFromCodex");});function iS(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:vt,message:"Codex needs a root rule to generate AGENTS.md. Add root: true to a rule."}]}var aS=d(()=>{Ht();s(iS,"lintRules");});function lS(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($(".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($(".agentsmesh/mcp.json","codex-cli",`MCP server "${r}" uses ${o} transport; codex-cli only generates stdio MCP servers.`));}return e}var cS=d(()=>{Lt();s(lS,"lintMcp");});function mS(t){return Va(t)}var pS=d(()=>{Lc();s(mS,"codexAdvisoryInstructionPath");});var jN,UN,KN,WN,dS,fS=d(()=>{HC();Ht();id();aS();cS();At();$s();pS();Qt();jN={name:"codex-cli",primaryRootInstructionPath:En,generateRules:qu,generateCommands:ed,generateAgents:rd,generateSkills:td,generateMcp:nd,importFrom:xc},UN={rootInstructionPath:En,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${$r}/${e}.rules`]},skillDir:".agents/skills",managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/instructions"],files:["AGENTS.md",".codex/config.toml"]},paths:{rulePath(t,e){return mS(e)},commandPath(t,e){return Gs(e,"codex-cli")?`${sr}/${nt(t)}/SKILL.md`:null},agentPath(t,e){return `${ds}/${t}.toml`}}},KN={rootInstructionPath:ps,renderPrimaryRootInstruction:Qu,extraRuleOutputPaths(t){if(t.root||t.codexEmit!=="execution")return [];let e=basename(t.source,".md");return [`${$r}/${e}.rules`]},skillDir:sr,managedOutputs:{dirs:[".agents/skills",".codex/agents",".codex/rules"],files:[ps,".codex/config.toml"]},rewriteGeneratedPath(t){return t===En?ps:t.startsWith(`${us}/`)?null:t},paths:{rulePath(t,e){return e.codexEmit==="execution"?`${$r}/${t}.rules`:ps},commandPath(t,e){return Gs(e,"codex-cli")?`${sr}/${nt(t)}/SKILL.md`:null},agentPath(t,e){return `${ds}/${t}.toml`}}},WN={rules:"native",additionalRules:"embedded",commands:"embedded",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},dS={id:"codex-cli",generators:jN,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:iS,lint:{mcp:lS},project:UN,globalSupport:{capabilities:WN,detectionPaths:[".codex/AGENTS.md",".codex/AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules",".agents/skills"],layout:KN},buildImportPaths:cu,sharedArtifacts:{".agents/skills/":"owner"},detectionPaths:["codex.md","AGENTS.md","AGENTS.override.md",".codex/config.toml",".codex/agents",".codex/rules"]};});function HN(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 gS(t){return `${Rr}/${t}.md`}function hS(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"],N(e,t.body.trim()||"")}function yS(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:HN(t["x-agentsmesh-allowed-tools"])}}function IS(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"],N(r,e.trim()||"")}var bc=d(()=>{v();Or();s(HN,"toStringArray");s(gS,"continueCommandRulePath");s(hS,"serializeCommandRule");s(yS,"parseCommandRuleFrontmatter");s(IS,"serializeImportedCommand");});function _S(t){let e=[],r=t.rules.find(n=>n.root);if(r){let n={};r.description&&(n.description=r.description),e.push({path:pn,content:N(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:`${ze}/${o}.md`,content:N(i,n.body.trim()||"")});}return e}function CS(t){return t.commands.map(e=>({path:`${Rr}/${e.name}.md`,content:hS(e)}))}function SS(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:rc,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function RS(t){return t.agents.map(e=>({path:`${le}/${H(e.name)}/SKILL.md`,content:te(e)}))}function OS(t){return _t(t,le)}var kS=d(()=>{ht();lt();v();bc();Or();s(_S,"generateRules");s(CS,"generateCommands");s(SS,"generateMcp");s(RS,"generateAgents");s(OS,"generateSkills");});function YN(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:Hs(l.args),env:zs(l.env),description:typeof l.description=="string"?l.description:void 0});}return o}async function XN(t,e){let r=(await D(join(t,mu))).filter(i=>[".json",".yaml",".yml"].includes(extname(i))),n={},o=[];for(let i of r){let a=await y(i);a&&(Object.assign(n,YN(a,extname(i))),o.push(i));}if(Object.keys(n).length!==0){await Kt(t,uu,n);for(let i of o)e.push({fromTool:Xs,fromPath:i,toPath:uu,feature:"mcp"});}}async function Pc(t){let e=[],r=await B(Xs,t);return e.push(...await q(Tc,t,"project",{normalize:r})),await gt(t,le,Xs,e,r),await XN(t,e),e}var ad=d(()=>{yt();A();ht();Wt();rn();Ke();Or();ld();s(YN,"readMcpServers");s(XN,"importMcp");s(Pc,"importFromContinue");});function ZN(t){return t==="general.md"||t==="_root.md"}var LS,wS,AS=d(()=>{v();Z();bc();Or();s(ZN,"isContinueRootRulePath");LS=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=ZN(t),o=n?"_root.md":t,i=join(r,o),{frontmatter:a,body:l}=k(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:`${nc}/${o}`,content:await G(i,c,l)}},"continueRuleMapper"),wS=s(async({absolutePath:t,relativePath:e,normalizeTo:r,destDir:n})=>{let o=join(n,e),{frontmatter:i,body:a}=k(r(o)),l=yS(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 et(u,{description:l.description,hasDescription:!!l.description,allowedTools:l.allowedTools,hasAllowedTools:l.allowedTools.length>0},k(IS(l,a)).body);return {destPath:u,toPath:`${oc}/${p}`,content:f}},"continueCommandMapper");});function xS(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Xs}))}var bS=d(()=>{Nt();Or();s(xS,"lintRules");});function PS(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>$(e.source,"continue","Continue invokable prompt rules do not natively enforce canonical allowed-tools metadata."))}var TS=d(()=>{Lt();s(PS,"lintCommands");});function eF(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var DS,NS=d(()=>{A();Or();s(eF,"computeStatus");DS=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 y(join(e,ka));return [{target:"continue",path:ka,content:m,currentContent:p??void 0,status:eF(p,m)}]},"generateContinueGlobalConfig");});function nF(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var FS,vS=d(()=>{A();Or();NS();s(nF,"computeStatus");FS=s(async(t,e,r,n)=>{let o=await DS(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 y(join(e,Zs));return [...o,{target:"continue",path:Zs,content:a,currentContent:l??void 0,status:nF(l,a)}]},"generateContinueScopeExtras");});var oF,sF,iF,aF,Tc,ld=d(()=>{lt();kS();Or();ad();AS();bS();TS();bc();At();vS();oF={name:"continue",primaryRootInstructionPath:pn,generateRules:_S,generateCommands:CS,generateAgents:RS,generateSkills:OS,generateMcp:SS,importFrom:Pc},sF={rootInstructionPath:pn,skillDir:".continue/skills",managedOutputs:{dirs:[".continue/prompts",".continue/rules",".continue/skills"],files:[".continue/mcpServers/agentsmesh.json"]},paths:{rulePath(t,e){return `${ze}/${t}.md`},commandPath(t,e){return gS(t)},agentPath(t){return `${le}/${H(t)}/SKILL.md`}}},iF={rootInstructionPath:pn,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Zs]}],skillDir:le,managedOutputs:{dirs:[ze,Rr,le,".agents/skills"],files:[rc,Zs,ka]},mirrorGlobalPath(t,e){return t.startsWith(`${le}/`)?`.agents/skills/${t.slice(le.length+1)}`:null},paths:{rulePath(t,e){return `${ze}/${t}.md`},commandPath(t,e){return `${Rr}/${t}.md`},agentPath(t){return `${le}/${H(t)}/SKILL.md`}}},aF={rules:"native",additionalRules:"native",commands:"native",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},Tc={id:"continue",generators:oF,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:xS,lint:{commands:PS},project:sF,globalSupport:{capabilities:aF,detectionPaths:[ze,Rr,".continue/mcpServers",le],layout:iF,scopeExtras:FS},importer:{rules:{feature:"rules",mode:"directory",source:{project:[ze],global:[ze]},canonicalDir:nc,extensions:[".md"],map:LS},commands:{feature:"commands",mode:"directory",source:{project:[Rr],global:[Rr]},canonicalDir:oc,extensions:[".md"],map:wS}},buildImportPaths:du,detectionPaths:[".continue/rules",".continue/skills",".continue/mcpServers"]};});var wn,fs,MS,gs,uo,Ur,Kr,hs,ys,Dc,Nc,GS,md,$S,fo,_i,An,Ci,Is,pd,ud,xe=d(()=>{wn="copilot",fs=".github/copilot-instructions.md",MS=".github/copilot",gs=".github/instructions",uo=".github/prompts",Ur=".github/hooks",Kr=".github/skills",hs=".github/agents",ys=".agentsmesh/rules",Dc=".agentsmesh/commands",Nc=".agentsmesh/agents",GS=".agentsmesh/skills",md=".agentsmesh/hooks.yaml",$S=".github/copilot-hooks",fo=".copilot/copilot-instructions.md",_i=".copilot/agents",An=".copilot/skills",Ci=".copilot/prompts",Is=".copilot/AGENTS.md",pd=".claude/skills",ud=".agents/skills";});function jS(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 Fc(t){return `${uo}/${t}.prompt.md`}function US(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"],N(e,t.body.trim()||"")}function KS(t,e){let n=((typeof t["x-agentsmesh-name"]=="string"?t["x-agentsmesh-name"]:"")||basename(e,".prompt.md")).trim(),o=jS(t["x-agentsmesh-allowed-tools"]),i=o.length>0?o:jS(t.tools);return {name:n,description:typeof t.description=="string"?t.description:"",allowedTools:i}}var vc=d(()=>{v();xe();s(jS,"toStringArray");s(Fc,"commandPromptPath");s(US,"serializeCommandPrompt");s(KS,"parseCommandPromptFrontmatter");});function Mc(t){return Zr(t)}var dd=d(()=>{Me();s(Mc,"hasHookCommand");});function mF(t){let e=basename(t,".md");return e==="_root"?"root":e}function pF(t){switch(t){case "PreToolUse":return "preToolUse";case "PostToolUse":return "postToolUse";case "Notification":return "notification";case "UserPromptSubmit":return "userPromptSubmitted";default:return null}}function WS(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}
|
|
85
93
|
|
|
86
94
|
${o}`):e.push(o);}return e.join(`
|
|
87
95
|
|
|
88
|
-
`)}function
|
|
89
|
-
`)}async function
|
|
96
|
+
`)}function BS(t){let e=t.rules.find(n=>n.root),r=[];e&&r.push({path:fs,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=mF(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=N(i,n.body.trim()||"");r.push({path:`${gs}/${o}.instructions.md`,content:a});}return r}function HS(t){return t.commands.map(e=>({path:Fc(e.name),content:US(e)}))}function zS(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=N(n,r.body.trim()||"");e.push({path:`${Kr}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Kr}/${r.name}/${a}`,content:i.content});}}return e}function VS(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=N(r,e.body.trim()||"");return {path:`${hs}/${e.name}.agent.md`,content:n}})}function JS(t){if(!t.hooks)return [];let e=Object.fromEntries(Object.entries(t.hooks).flatMap(([r,n])=>{let o=pF(r);if(!o||!Array.isArray(n))return [];let i=n.filter(a=>typeof a=="object"&&a!==null&&Mc(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:`${Ur}/agentsmesh.json`,content:JSON.stringify({version:1,hooks:e},null,2)}]}var YS=d(()=>{v();xe();vc();dd();s(mF,"ruleSlug");s(pF,"mapHookEvent");s(WS,"renderCopilotGlobalInstructions");s(BS,"generateRules");s(HS,"generateCommands");s(zS,"generateSkills");s(VS,"generateAgents");s(JS,"generateHooks");});function dF(t){switch(t){case "preToolUse":return "PreToolUse";case "postToolUse":return "PostToolUse";case "notification":return "Notification";case "userPromptSubmitted":return "UserPromptSubmit";default:return null}}function fF(t){return typeof t!="string"?"*":t.match(/^Matcher:\s*(.+)$/)?.[1]?.trim()||"*"}function qS(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\n?/m,"").trim()}async function QS(t,e){let r=join(t,Ur),o=(await D(r).catch(()=>[])).filter(p=>p.endsWith(".json")),i={};for(let p of o){let u=await y(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=dF(g);if(!(!R||!Array.isArray(h)))for(let S of h){if(!S||typeof S!="object")continue;let I=S,E=typeof I.bash=="string"?I.bash:"";if(!E)continue;let T=join(r,E.replace(/^\.\//,"")),P=await y(T);if(!P)continue;let x=qS(P);x&&(i[R]||(i[R]=[]),i[R].push({matcher:fF(I.comment),command:x,type:"command"}));}}}let a=join(t,$S),c=(await D(a).catch(()=>[])).filter(p=>dirname(p)===a&&/^[^-]+-\d+\.sh$/i.test(basename(p)));for(let p of c){let u=await y(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:qS(u),type:"command"});}if(Object.keys(i).length===0)return;let m=join(t,md);await O(dirname(m)),await C(m,stringify(i)),e.push({fromTool:wn,fromPath:join(t,Ur),toPath:md,feature:"hooks"});}var tR=d(()=>{A();xe();s(dF,"mapCopilotHookEvent");s(fF,"extractMatcher");s(qS,"extractWrapperCommand");s(QS,"importHooks");});async function eR(t,e,r,n=Kr){let o=join(t,n),i=await po(o),a={projectRoot:t,sourceSkillsDir:n,destCanonicalSkillsDir:GS,targetName:wn,normalize:r,results:e};for(let[l,c]of i)await Gr(l,c,a);}var rR=d(()=>{yi();xe();s(eR,"importSkills");});async function Gc(t,e={}){let r=e.scope??"project",n=[],o=await B(wn,t,r);return n.push(...await q($c,t,r,{normalize:o})),await eR(t,n,o,r==="global"?An:Kr),r==="project"&&await QS(t,n),n}var fd=d(()=>{yt();Wt();xe();tR();rR();gd();s(Gc,"importFromCopilot");});function nR(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var oR,sR,iR,aR,lR=d(()=>{v();Z();Ke();vc();xe();s(nR,"pruneUndefined");oR=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=t.replace(/\.instructions\.md$/i,".md"),o=join(r,n),{frontmatter:i,body:a}=k(e(o)),l=nn(i.globs),c=nR({root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0});return {destPath:o,toPath:`${ys}/${n}`,content:await G(o,c,a)}},"copilotLegacyRuleMapper"),sR=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}=k(e(o)),l=nn(i.applyTo!==void 0?i.applyTo:i.globs),c=nR({root:false,description:typeof i.description=="string"?i.description:void 0,globs:l.length>0?l:void 0});return {destPath:o,toPath:`${ys}/${n}`,content:await G(o,c,a)}},"copilotNewRuleMapper"),iR=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}=k(r(i)),c=KS(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:`${Dc}/${u}`,content:await et(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"),aR=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}=k(e(i));return {destPath:i,toPath:`${Nc}/${n}`,content:await Et(i,{...a,name:typeof a.name=="string"?a.name:o},l)}},"copilotAgentMapper");});function cR(t,e,r,n){let i=X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(l=>({...l,target:wn})),a=t.rules.filter(l=>!l.root&&l.globs.length===0);return [...i,...a.map(l=>({level:"warning",file:l.source,target:wn,message:"Copilot path-specific instructions require applyTo globs; non-root rules without globs are not generated."}))]}var mR=d(()=>{Nt();xe();s(cR,"lintRules");});function pR(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>$(e.source,"copilot","Copilot prompt files do not enforce canonical allowed-tools natively."))}function uR(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=>Vs(i,"copilot",e,{unsupportedBy:"Copilot hooks"}));return Object.values(t.hooks).some(i=>Array.isArray(i)&&i.length>0)&&n.push($(".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 dR=d(()=>{Lt();s(pR,"lintCommands");s(uR,"lintHooks");});function _F(t){return t.replace(/[^a-zA-Z0-9]/g,"-").toLowerCase()}function CF(t,e){let r=relative(t,e).replace(/\\/g,"/");return !r||r.startsWith("../")?null:r}function SF(t,e){let r=t.match(fR);if(!r?.groups)return t;let n=r.groups.prefix??"",o=r.groups.suffix??"";return `${n}"$HOOK_DIR/${e}"${o}`}async function RF(t,e){let n=e.match(fR)?.groups?.path;if(!n)return null;let o=join(t,n),i=await y(o);if(i===null)return null;let a=CF(t,o);return a?{assetPath:`${Ur}/scripts/${a}`,content:i,rewrittenCommand:SF(e,a)}:null}function OF(t,e){return `${Ur}/scripts/${_F(t)}-${e}.sh`}function kF(t,e){return ["#!/usr/bin/env bash",`# agentsmesh-matcher: ${e}`,`# agentsmesh-command: ${t}`,"set -e",t,""].join(`
|
|
97
|
+
`)}async function gR(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(!Mc(c))continue;let m=OF(i,l),p=c.command,u=await RF(t,c.command);u&&(p=u.rewrittenCommand,o.has(u.assetPath)||o.set(u.assetPath,{path:u.assetPath,content:u.content}));let f=kF(p,c.matcher).replace(`set -e
|
|
90
98
|
`,`set -e
|
|
91
99
|
HOOK_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
|
|
92
|
-
`);n.push({path:m,content:
|
|
100
|
+
`);n.push({path:m,content:f}),l++;}}return [...r,...n,...o.values()]}var fR,hR=d(()=>{A();xe();dd();fR=/^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;s(_F,"safePhaseName");s(CF,"toRepoRelative");s(SF,"rewriteWrapperCommand");s(RF,"buildAssetOutput");s(OF,"wrapperPath");s(kF,"buildWrapper");s(gR,"addHookScriptAssets");});function LF(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var yR,IR=d(()=>{A();xe();s(LF,"computeStatus");yR=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 y(join(e,Is));return [{target:"copilot",path:Is,content:i,currentContent:a??void 0,status:LF(a,i)}]},"generateCopilotGlobalExtras");});var AF,xF,bF,PF,$c,gd=d(()=>{YS();xe();fd();lR();mR();At();vc();dR();hR();IR();AF={name:"copilot",primaryRootInstructionPath:fs,generateRules:BS,generateCommands:HS,generateAgents:VS,generateSkills:zS,generateHooks:JS,importFrom:Gc},xF={rootInstructionPath:fs,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 [`${gs}/${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 `${gs}/${t}.instructions.md`},commandPath(t,e){return Fc(t)},agentPath(t,e){return `${hs}/${t}.agent.md`}}},bF={rootInstructionPath:fo,renderPrimaryRootInstruction:WS,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Is]}],skillDir:An,managedOutputs:{dirs:[_i,An,Ci,ud,pd],files:[fo,Is]},rewriteGeneratedPath(t){return t===fs?fo:t.startsWith(`${gs}/`)?fo:t.startsWith(`${uo}/`)?t.replace(`${uo}/`,`${Ci}/`):t.startsWith(`${hs}/`)?t.replace(`${hs}/`,`${_i}/`):t.startsWith(`${Kr}/`)?t.replace(`${Kr}/`,`${An}/`):t.startsWith(`${Ur}/`)?null:t},mirrorGlobalPath(t,e){if(t.startsWith(`${An}/`)&&!e.includes("codex-cli")){let r=t.slice(An.length+1);return [`.agents/skills/${r}`,`${pd}/${r}`]}return null},paths:{rulePath(t,e){return fo},commandPath(t,e){return `${Ci}/${t}.prompt.md`},agentPath(t,e){return `${_i}/${t}.agent.md`}}},PF={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},$c={id:"copilot",generators:AF,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:cR,lint:{commands:pR,hooks:uR},postProcessHookOutputs:s(async(t,e,r)=>gR(t,e,[...r]),"postProcessHookOutputs"),project:xF,globalSupport:{capabilities:PF,detectionPaths:[fo,Is,_i,An,Ci,ud],layout:bF,scopeExtras:yR},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[fs],global:[fo]},canonicalDir:ys,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[MS]},canonicalDir:ys,extensions:[".instructions.md"],map:oR},{feature:"rules",mode:"directory",source:{project:[gs]},canonicalDir:ys,extensions:[".instructions.md",".md"],map:sR}],commands:{feature:"commands",mode:"directory",source:{project:[uo],global:[Ci]},canonicalDir:Dc,extensions:[".prompt.md"],map:iR},agents:{feature:"agents",mode:"directory",source:{project:[hs],global:[_i]},canonicalDir:Nc,extensions:[".agent.md"],map:aR}},buildImportPaths:fu,detectionPaths:[".github/copilot-instructions.md",".github/copilot",".github/instructions",".github/prompts",".github/skills",".github/agents",".github/hooks"]};});function hd(t){let e=[],r=t.rules.find(i=>i.root);if(r){let i=r.body.trim()?r.body:"";e.push({path:Hn,content:i});let a={alwaysApply:true};r.description&&(a.description=r.description);let l=N(a,i);e.push({path:un,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=N(c,i.body.trim()||"");e.push({path:`${Ee}/${a}.mdc`,content:m});}let o=_R(t);return o.trim()&&e.push({path:Je,content:o}),e}function _R(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(kt(e.body,r)):r.length>0&&n.push(kt("",r)),n.filter(Boolean).join(`
|
|
93
101
|
|
|
94
|
-
`)}var
|
|
95
|
-
`);return [{path:
|
|
102
|
+
`)}var CR=d(()=>{v();Ie();Ct();s(hd,"generateRules");s(_R,"renderCursorGlobalUserRules");});function yd(t){return t.commands.map(e=>({path:`${Le}/${e.name}.md`,content:e.body.trim()||""}))}var SR=d(()=>{Ct();s(yd,"generateCommands");});function Id(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=JSON.stringify({mcpServers:t.mcp.mcpServers},null,2);return [{path:Er,content:e}]}var RR=d(()=>{Ct();s(Id,"generateMcp");});function _d(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=N(n,r.body.trim()||"");e.push({path:`${kr}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${kr}/${r.name}/${a}`,content:i.content});}}return e}var OR=d(()=>{v();Ct();s(_d,"generateSkills");});function Cd(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=N(r,e.body.trim()||"");return {path:`${qs}/${e.name}.md`,content:n}})}var kR=d(()=>{v();Ct();s(Cd,"generateAgents");});function Sd(t){return []}var ER=d(()=>{s(Sd,"generatePermissions");});function DF(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!fr(i))continue;let a=Ot(i),l=zt(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 Rd(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=DF(t.hooks);if(Object.keys(e).length===0)return [];let r=JSON.stringify({version:1,hooks:e},null,2);return [{path:Lr,content:r}]}var LR=d(()=>{Me();Ct();s(DF,"toCursorHooks");s(Rd,"generateHooks");});function Od(t){if(!t.ignore||t.ignore.length===0)return [];let e=t.ignore.join(`
|
|
103
|
+
`);return [{path:Ve,content:e}]}var wR=d(()=>{Ct();s(Od,"generateIgnore");});var AR=d(()=>{CR();SR();RR();OR();kR();ER();LR();wR();});var xR=d(()=>{AR();});async function Uc(t,e,r,n){let o=t.replace(/\.mdc$/i,".md"),i=join(e,o),l=k(r(i)).frontmatter.alwaysApply===true,c=l?join(e,"_root.md"):i,{frontmatter:m,body:p}=k(r(c));l&&n();let u={...m,root:l};if(delete u.alwaysApply,!l){let f=NF(m);f!==null&&(u.trigger=f);}return {destPath:c,toPath:`${wr}/${l?"_root.md":o}`,feature:"rules",content:await G(c,u,p)}}function NF(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 bR(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=k(r(n)),a=Oe(o.allowedTools),l=a.length>0?a:Oe(o["allowed-tools"]);return {destPath:n,toPath:`${Jn}/${t}`,feature:"commands",content:await et(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 PR(t,e,r){let n=join(e,t),{frontmatter:o,body:i}=k(r(n));return {destPath:n,toPath:`${Yn}/${t}`,feature:"agents",content:await Et(n,o,i)}}var kd=d(()=>{v();Z();Ke();Ct();s(Uc,"mapCursorRuleFile");s(NF,"deriveCursorTrigger");s(bR,"mapCursorCommandFile");s(PR,"mapCursorAgentFile");});async function Si(t){let e=join(t.projectRoot,wr);await O(e);let r=join(e,"_root.md"),n=await Mr({content:t.content,projectRoot:t.projectRoot,rulesDir:wr,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}=k(o),l=i.root===true?i:{...i,root:true},c=await G(r,l,a);return await C(r,c),t.results.push({fromTool:"cursor",fromPath:t.sourcePath,toPath:`${wr}/_root.md`,feature:"rules"}),true}var Ed=d(()=>{A();v();hi();Z();Ct();s(Si,"importCursorRootFile");});async function DR(t,e,r){let n=join(t,wr),o=false,i=join(t,Ee);if(e.push(...await it({srcDir:i,destDir:n,extensions:[".mdc"],fromTool:"cursor",normalize:r,mapEntry:s(async({srcPath:a,relativePath:l,normalizeTo:c})=>{if(o){let m=await y(a);if(m!==null){let{frontmatter:p}=k(m);if(p.alwaysApply===true)return null}}return Uc(l,n,c,()=>{o=true;})},"mapEntry")})),!o){let a=join(t,Hn),l=await y(a);l!==null&&(o=await Si({projectRoot:t,results:e,sourcePath:a,content:l,normalize:r}));}if(!o){let a=join(t,EI),l=await y(a);l!==null&&await Si({projectRoot:t,results:e,sourcePath:a,content:l,normalize:r});}}var NR=d(()=>{A();v();We();kd();Ed();Ct();s(DR,"importCursorRules");});function FR(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(!fr({...m,type:p}))continue;let u=p==="prompt"?zt(m)||Ot(m):Ot(m)||zt(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 Bc(t,e){let r=false,n=join(t,Lr),o=await y(n);if(o)try{let p=JSON.parse(o);if(p.hooks&&typeof p.hooks=="object"){let u=FR(p.hooks);if(Object.keys(u).length>0){let f=stringify(u),g=join(t,La);await O(dirname(g)),await C(g,f),e.push({fromTool:"cursor",fromPath:n,toPath:La,feature:"hooks"}),r=!0;}}}catch{}let i=join(t,ic),a=await y(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,hu);await O(dirname(h)),await C(h,g),e.push({fromTool:"cursor",fromPath:i,toPath:hu,feature:"permissions"});}}let m=r?void 0:l.hooks;if(m&&typeof m=="object"&&!Array.isArray(m)){let p=FR(m);if(Object.keys(p).length>0){let u=stringify(p),f=join(t,La);await O(dirname(f)),await C(f,u),e.push({fromTool:"cursor",fromPath:i,toPath:La,feature:"hooks"});}}}async function Hc(t,e){let r=[{path:join(t,Ve),label:Ve},{path:join(t,gu),label:gu}],n=[],o=[];for(let a of r){let l=await y(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,yu);await O(dirname(i)),await C(i,n.join(`
|
|
96
104
|
`)+`
|
|
97
|
-
`),e.push({fromTool:"cursor",fromPath:join(t,o[0]),toPath:
|
|
105
|
+
`),e.push({fromTool:"cursor",fromPath:join(t,o[0]),toPath:yu,feature:"ignore"});}var wd=d(()=>{Me();A();Ct();s(FR,"cursorHooksToCanonical");s(Bc,"importSettings");s(Hc,"importIgnore");});async function zc(t,e,r,n=kr){let o=join(t,n),i=await po(o),a={projectRoot:t,sourceSkillsDir:n,destCanonicalSkillsDir:LI,targetName:"cursor",normalize:r,results:e};for(let[p,u]of i)await Gr(p,u,a);let l=await D(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 y(p);if(!u)continue;let f=basename(p,".md");await gC(f,p,u,a);}}var Ad=d(()=>{A();yi();Ct();s(zc,"importSkills");});async function vR(t){if(await F(join(t,Ee)))return true;let e=[join(t,Je),join(t,Qs),join(t,Ea),join(t,Lr),join(t,Ve),join(t,zn),join(t,Vn),join(t,Le)];for(let i of e){let a=await y(i);if(a!==null&&a.trim()!=="")return true}return !!((await D(join(t,zn))).some(i=>i.endsWith(".md"))||(await D(join(t,Vn))).some(i=>i.endsWith(".md"))||(await D(join(t,Le))).some(i=>i.endsWith(".md")))}async function MR(t,e,r){let n=join(t,wr),o=false,i=join(t,Ee),a=await it({srcDir:i,destDir:n,extensions:[".mdc"],fromTool:Ri,normalize:r,mapEntry:s(async({srcPath:l,relativePath:c,normalizeTo:m})=>{if(o){let p=await y(l);if(p!==null){let{frontmatter:u}=k(p);if(u.alwaysApply===true)return null}}return Uc(c,n,m,()=>{o=true;})},"mapEntry")});return e.push(...a),o}async function GR(t,e,r){let n=join(t,Qs),o=await y(n);return o===null||o.trim()===""?false:Si({projectRoot:t,results:e,sourcePath:n,content:o.trim(),normalize:r})}async function $R(t,e,r){let n=join(t,Je),o=await y(n);return o===null||o.trim()===""?false:Si({projectRoot:t,results:e,sourcePath:n,content:o.trim(),normalize:r})}async function jR(t,e){let r=join(t,Ea),n=await y(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,ti);await O(dirname(i)),await C(i,n),e.push({fromTool:Ri,fromPath:r,toPath:ti,feature:"mcp"});}async function UR(t,e,r){let n=join(t,Vn),o=join(t,Yn);e.push(...await it({srcDir:n,destDir:o,extensions:[".md"],fromTool:Ri,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>PR(i,o,a),"mapEntry")}));}async function KR(t,e,r){let n=join(t,Le),o=join(t,Jn);e.push(...await it({srcDir:n,destDir:o,extensions:[".md"],fromTool:Ri,normalize:r,mapEntry:s(({relativePath:i,normalizeTo:a})=>bR(i,o,a),"mapEntry")}));}var Ri,WR=d(()=>{A();v();We();Ct();Ed();kd();Ri="cursor";s(vR,"hasGlobalCursorArtifacts");s(MR,"importGlobalCursorRulesFromDir");s(GR,"importGlobalUserRules");s($R,"importGlobalDotCursorAgents");s(jR,"importGlobalMcp");s(UR,"importGlobalAgents");s(KR,"importGlobalCommands");});async function BR(t){if(!await vR(t))return [];let e=[],r=await B(Ri,t,"global"),n=await MR(t,e,r);return n||(n=await GR(t,e,r)),n||await $R(t,e,r),await jR(t,e),await zc(t,e,r,zn),await UR(t,e,r),await KR(t,e,r),await Bc(t,e),await Hc(t,e),e}var HR=d(()=>{yt();Ct();Ad();wd();WR();s(BR,"importFromCursorGlobalExports");});async function $F(t,e){let r=join(t,Er),n=await y(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 Kt(t,ti,i),e.push({fromTool:"cursor",fromPath:r,toPath:ti,feature:"mcp"});}async function Vc(t,e={}){if(e.scope==="global")return BR(t);let r=[],n=await B("cursor",t);return await DR(t,r,n),r.push(...await q(Jc,t,"project",{normalize:n})),await zc(t,r,n),await $F(t,r),await Bc(t,r),await Hc(t,r),r}var xd=d(()=>{yt();A();Wt();rn();NR();wd();Ad();HR();Ct();bd();s($F,"importMcp");s(Vc,"importFromCursor");});var VR,JR,YR=d(()=>{v();Z();Ke();Ct();VR=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n)),a=Oe(o.allowedTools),l=a.length>0?a:Oe(o["allowed-tools"]);return {destPath:n,toPath:`${Jn}/${t}`,content:await et(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"),JR=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${Yn}/${t}`,content:await Et(n,o,i)}},"cursorAgentMapper");});function XR(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:kI}))}var ZR=d(()=>{Nt();Ct();s(XR,"lintRules");});function qR(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>$(e.source,"cursor","Cursor command files are plain Markdown; command description and allowed-tools metadata are not projected."))}function QR(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($(".agentsmesh/mcp.json","cursor",`MCP server "${r}" uses env vars or URL/header interpolation; Cursor handling may differ from canonical MCP.`));}return e}function tO(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?[$(".agentsmesh/permissions.yaml","cursor","Cursor permissions are partial; tool-level allow/deny may lose fidelity.")]:[]}var eO=d(()=>{Lt();s(qR,"lintCommands");s(QR,"lintMcp");s(tO,"lintPermissions");});var jF,UF,KF,WF,Jc,bd=d(()=>{xR();Ct();ae();xd();YR();ZR();At();eO();jF={name:"cursor",primaryRootInstructionPath:un,generateRules:hd,generateCommands:yd,generateAgents:Cd,generateSkills:_d,generateMcp:Id,generatePermissions:Sd,generateHooks:Rd,generateIgnore:Od,importFrom:Vc},UF={rootInstructionPath:un,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[Hn,Je]}],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`}}},KF={rootInstructionPath:un,outputFamilies:[{id:"root-mirrors",kind:"additional",explicitPaths:[Hn,Je]}],skillDir:zn,managedOutputs:{dirs:[Ee,Le,Vn,zn],files:[un,Je,Ea,Lr,Ve,Qs]},rewriteGeneratedPath(t){return t===Hn?null:t===Je||t===un||t.startsWith(`${Ee}/`)||t.startsWith(`${Le}/`)||t.startsWith(`${qs}/`)||t.startsWith(`${kr}/`)||t===Er||t===Lr||t===Ve?t:t===ic?null:t},mirrorGlobalPath(t,e){return ot(t,kr,e)},paths:{rulePath(t,e){return `${Ee}/${t}.mdc`},commandPath(t,e){return `${Le}/${t}.md`},agentPath(t,e){return `${Vn}/${t}.md`}}},WF={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"native",ignore:"native",permissions:"none"},Jc={id:"cursor",generators:jF,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:XR,lint:{commands:qR,mcp:QR,permissions:tO},project:UF,globalSupport:{capabilities:WF,detectionPaths:[un,Je,Er,Lr,Ve,kr,Vn,Le,Qs],layout:KF},importer:{commands:{feature:"commands",mode:"directory",source:{project:[Le]},canonicalDir:Jn,extensions:[".md"],map:VR},agents:{feature:"agents",mode:"directory",source:{project:[qs]},canonicalDir:Yn,extensions:[".md"],map:JR}},buildImportPaths:Iu,detectionPaths:[".cursor/rules",".cursor/mcp.json"],preservesManualActivation:true};});var go,be,Wr,rO,nO,me,Yc,_s,Xc,Xa,ho,oO,sO,yo,Zc,Za,qa,Pd,Td,Oi,Dd,ki,Ei,qc,Li,Cs,Qa,xt=d(()=>{go="gemini-cli",be="GEMINI.md",Wr="AGENTS.md",rO=".gemini/rules",nO=".gemini/GEMINI.md",me=".gemini/commands",Yc=".gemini/policies",_s=".gemini/settings.json",Xc=".geminiignore",Xa=".gemini/skills",ho=".gemini/agents",oO=".gemini/system.md",sO=`${Yc}/permissions.toml`,yo=".agentsmesh/rules",Zc=".agentsmesh/commands",Za=".agentsmesh/agents",qa=".agentsmesh/skills",Pd=".agentsmesh/mcp.json",Td=".agentsmesh/hooks.yaml",Oi=".agentsmesh/ignore",Dd=".agentsmesh/permissions.yaml",ki=".gemini/GEMINI.md",Ei=".gemini/AGENTS.md",qc=".gemini/settings.json",Li=".gemini/commands",Cs=".gemini/skills",Qa=".gemini/agents";});function Nd(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=kt(e?.body.trim()??"",r),o=[{path:be,content:n}];if(e){let i=e.body.trim().replace(/\.agentsmesh\/skills\//g,".agents/skills/");o.push({path:Wr,content:i});}return o}var iO=d(()=>{Ie();xt();s(Nd,"generateRules");});function aO(t,e){let r=t.split(":").filter(Boolean),n=r.length>0?r.pop():t;return [e,...r,`${n}.toml`].join("/")}var lO=d(()=>{s(aO,"canonicalCommandNameToGeminiTomlPath");});function BF(t){let e=t.replace(/\r\n/g,`
|
|
98
106
|
`);return e.includes('"""')?JSON.stringify(e):`"""
|
|
99
107
|
${e}
|
|
100
|
-
"""`}function
|
|
108
|
+
"""`}function HF(t){return [`description = ${JSON.stringify(t.description||t.name)}`,`prompt = ${BF(t.body.trim()||"")}`].join(`
|
|
101
109
|
`)+`
|
|
102
|
-
`}function
|
|
103
|
-
`)}]}var
|
|
104
|
-
`)}function
|
|
105
|
-
`)}]}var
|
|
110
|
+
`}function Fd(t){return t.commands.map(e=>({path:aO(e.name,me),content:HF(e)}))}var cO=d(()=>{xt();lO();s(BF,"serializeTomlMultilineLiteral");s(HF,"serializeGeminiCommand");s(Fd,"generateCommands");});function vd(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=N(r,e.body.trim()||"");return {path:`${ho}/${e.name}.md`,content:n}})}var mO=d(()=>{v();xt();s(vd,"generateAgents");});function Md(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=N(n,r.body.trim()||"");e.push({path:`${Xa}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles){let a=i.relativePath.replace(/\\/g,"/");e.push({path:`${Xa}/${r.name}/${a}`,content:i.content});}}return e}var pO=d(()=>{v();xt();s(Md,"generateSkills");});function zF(t){switch(t){case "PreToolUse":return "BeforeTool";case "PostToolUse":return "AfterTool";case "Notification":return "Notification";default:return null}}function Gd(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=zF(o);if(!a||!Array.isArray(i))return [];let l=i.filter(c=>typeof c=="object"&&c!==null&&Zr(c)).map((c,m)=>({matcher:c.matcher,hooks:[{name:`${a}-${m+1}`,type:"command",command:Ot(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:[be,Wr]}),Object.keys(e).length===0?[]:[{path:_s,content:JSON.stringify(e,null,2)}]}var $d=d(()=>{Me();xt();s(zF,"mapHookEvent");s(Gd,"generateGeminiSettingsFiles");});function jd(t){return !t.ignore||t.ignore.length===0?[]:[{path:Xc,content:t.ignore.join(`
|
|
111
|
+
`)}]}var uO=d(()=>{xt();s(jd,"generateIgnore");});var dO=d(()=>{iO();cO();mO();pO();$d();uO();});var fO=d(()=>{dO();});function Ss(t){return JSON.stringify(t)}function VF(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JF(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 Qc(t,e,r){return ["[[rule]]",`decision = ${Ss(t)}`,`priority = ${e}`,...r,""].join(`
|
|
112
|
+
`)}function gO(t,e,r){let n=JF(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 Qc(e,r,[`toolName = ${Ss(i)}`])}if(n.kind==="bash"){let i=n.prefix.replace(/:\*$/u,"").replace(/\*$/u,"").trim();return Qc(e,r,[`toolName = ${Ss(o.Bash)}`,`commandPrefix = ${Ss(i)}`])}return n.kind==="read"?Qc(e,r,[`toolName = ${Ss(o.Read)}`,`argsPattern = ${Ss(VF(n.path))}`]):Qc(e,r,[`toolName = ${Ss(n.raw)}`])}function hO(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=gO(i,"allow",100+a);l&&o.push(l);}),r.forEach((i,a)=>{let l=gO(i,"deny",200+a);l&&o.push(l);}),o.length===0?[]:[{path:sO,content:o.join(`
|
|
113
|
+
`)}]}var yO=d(()=>{xt();s(Ss,"escapeTomlBasicString");s(VF,"escapeRegexLiteral");s(JF,"parsePermissionExpr");s(Qc,"ruleForDecision");s(gO,"permissionExprToGeminiRule");s(hO,"generateGeminiPermissionsPolicies");});function Ud(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 tm(t){let e=t.indexOf("---"),r=t.indexOf("+++");if(e===0&&(r===-1||e<=r))return k(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 Kd=d(()=>{v();s(Ud,"mapGeminiHookEvent");s(tm,"parseFlexibleFrontmatter");});async function Wd(t,e){let r=join(t,_s),n=await y(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,Pd);await O(join(t,".agentsmesh")),await C(c,JSON.stringify({mcpServers:i},null,2)),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Pd,feature:"mcp"});}let a=o.ignorePatterns;if(Array.isArray(a)&&a.length>0&&a.every(c=>typeof c=="string")){let c=join(t,Oi);await O(join(t,".agentsmesh")),await C(c,a.join(`
|
|
106
114
|
`)+`
|
|
107
|
-
`),e.push({fromTool:"gemini-cli",fromPath:r,toPath:
|
|
115
|
+
`),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Oi,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=Ud(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"&&Zr(h)).map(h=>({matcher:g.matcher,command:Ot(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"&&Zr(h)).map(h=>({matcher:h.matcher,command:Ot(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,Td);await O(join(t,".agentsmesh")),await C(p,stringify(m,{lineWidth:0}).trimEnd()),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Td,feature:"hooks"});}}}var IO=d(()=>{Me();A();xt();Kd();s(Wd,"importGeminiSettings");});async function _O(t,e){let r=join(t,Xc),n=await y(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,Oi);await C(i,o.join(`
|
|
108
116
|
`)+`
|
|
109
|
-
`),e.push({fromTool:"gemini-cli",fromPath:r,toPath:
|
|
110
|
-
`),e.push({fromTool:jn,fromPath:join(t,lc),toPath:ku,feature:"permissions"}),e}var PC=f(()=>{A();It();i(oN,"unescapeRegexLiteral");i(sN,"toolNameToPermissionBase");i(iN,"commandPrefixToBashExpr");i(aN,"argsPatternToReadExpr");i(bC,"importGeminiPolicies");});function $u(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,s)=>{let a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return o.replace(new RegExp(`${a}[/\\\\]\\.agentsmesh[/\\\\]`,"g"),".agentsmesh/").replaceAll(`${s}/.agentsmesh`,".agentsmesh").replaceAll(`${s}\\.agentsmesh`,".agentsmesh")},t).replace(/(?:[A-Za-z]:)?[^\s"'`()<>]+[/\\]\.agentsmesh[/\\]/g,".agentsmesh/")}var TC=f(()=>{i($u,"stripProjectRootCanonicalPrefix");});async function DC(t,e,r){let n=join(t,ha),s=(await x(n)).filter(l=>basename(l)==="SKILL.md");for(let l of s){let c=await I(l);if(!c)continue;let m=basename(l.slice(0,-9)),p=E(c),u=Qe(p.frontmatter,m);if(u){let k=join(t,ya);await R(k);let D=join(k,`${u.name}.md`);await S(D,le(u,r(p.body,l,D))),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${ya}/${u.name}.md`,feature:"agents"});continue}let d=join(t,Ia,m,"SKILL.md"),g=r(c,l,d),h=join(t,Ia,m);await R(h);let{frontmatter:C,body:O}=E(g);await S(d,await tr(d,{...C,name:m},O)),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${Ia}/${m}/SKILL.md`,feature:"skills"});let _=await x(dirname(l));for(let k of _){if(k===l)continue;let D=await I(k);if(D===null)continue;let b=relative(dirname(l),k).replace(/\\/g,"/"),P=join(h,b);await R(dirname(P)),await S(P,r(D,k,P)),e.push({fromTool:"gemini-cli",fromPath:k,toPath:`${Ia}/${m}/${b}`,feature:"skills"});}}let a=join(t,Un);try{let c=(await x(a)).filter(m=>m.endsWith(".md"));for(let m of c){let p=await I(m);if(!p)continue;let{frontmatter:u,body:d}=E(p),h=relative(a,m).replace(/\\/g,"/").replace(/\.md$/i,".md"),C=join(t,ya);await R(C);let O=join(C,h),_=r(d,m,O);await S(O,await yt(O,{...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},_)),e.push({fromTool:"gemini-cli",fromPath:m,toPath:`${ya}/${h}`,feature:"agents"});}}catch{}}var FC=f(()=>{A();v();Y();ht();It();i(DC,"importGeminiSkillsAndAgents");});async function lN(t,e,r){let n=await z("codex-cli",t),o=join(t,Kn),s=join(t,Rr),a=join(t,uC),l=[s,a,join(t,_e),join(t,dC)],c=null,m=l[l.length-1];for(let b of l){let P=await I(b);if(P!==null){c=P,m=b;break}}if(c===null)return;await R(o);let p=join(o,"_root.md"),u=m===s||m===a?n(c,m,p):c,d=await or({content:u,projectRoot:t,rulesDir:Kn,sourcePath:m,fromTool:jn,normalize:r});e.push(...d.results);let g=r(d.rootContent,m,p),h=$u(g.replace(/\.agents\/skills\//g,".agentsmesh/skills/").replace(/\.agents\\skills\\/g,".agentsmesh/skills/"),t),{frontmatter:C,body:O}=E(h),k=C.root===true?C:{...C,root:true},D=$u(await M(p,k,O),t);await S(p,D),e.push({fromTool:jn,fromPath:m,toPath:`${Kn}/_root.md`,feature:"rules"});}async function gc(t){let e=[],r=await z(jn,t);return await lN(t,e,r),e.push(...await et(hc,t,"project",{normalize:r})),await DC(t,e,r),await Du(t,e),await AC(t,e),e.push(...await bC(t)),e}var ju=f(()=>{Ct();A();v();Y();Ss();qt();It();Uu();vu();PC();TC();FC();i(lN,"importRootRule");i(gc,"importFromGemini");});async function $C(t,e,r){let n=t.replace(/\\/g,"/"),o=join(e,n),{frontmatter:s,body:a}=dc(r(o)),l=Fr(s.globs),c={root:false,description:typeof s.description=="string"?s.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:`${Kn}/${n}`,feature:"rules",content:await M(o,c,a)}}async function MC(t,e,r){let n=t.replace(/\.(toml|md)$/i,".md").replace(/\\/g,"/"),o=join(e,n),s=r(o),{frontmatter:a,body:l}=t.endsWith(".toml")?mN(s):dc(s),c=ue(a.allowedTools),m=ue(a["allowed-tools"]),p=c.length>0?c:m;return {destPath:o,toPath:`${mc}/${n}`,feature:"commands",content:await q(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 mN(t){try{let e=parse$1(t);return {frontmatter:e,body:typeof e.prompt=="string"?e.prompt:""}}catch{return {frontmatter:{},body:t.trim()}}}var GC=f(()=>{Y();Te();vu();It();i($C,"mapGeminiRuleFile");i(MC,"mapGeminiCommandFile");i(mN,"parseTomlCommand");});var jC,UC,KC=f(()=>{GC();jC=i(({relativePath:t,destDir:e,normalizeTo:r})=>$C(t,e,r),"geminiRuleMapper"),UC=i(({relativePath:t,destDir:e,normalizeTo:r})=>MC(t,e,r),"geminiCommandMapper");});function WC(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(s=>({...s,target:jn}))}var BC=f(()=>{Vt();It();i(WC,"lintRules");});function HC(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 zC(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=>Ks(n,"gemini-cli",e))}var VC=f(()=>{$t();i(HC,"lintCommands");i(zC,"lintHooks");});function JC(t,e){return e==="project"&&Wn("gemini-cli",e)?.ignore.flavor!=="settings-embedded"?[]:bu(t)}var YC=f(()=>{it();Pu();i(JC,"emitScopedGeminiSettings");});function ZC(t){try{let e=JSON.parse(t);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return {}}}function qC(t,e){let r=ZC(t),n=pN.parse(JSON.parse(e)),o={...r};n.permissions!==void 0&&(o.permissions=n.permissions),n.hooks!==void 0&&(o.hooks=n.hooks);let s=o.permissions;return s&&typeof s=="object"&&!Array.isArray(s)&&!("ask"in s)&&(s.ask=[]),JSON.stringify(o,null,2)}function QC(t,e){let r=ZC(t),n=uN.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)}var XC,pN,uN,Ku=f(()=>{XC=[".claude/settings.json",".gemini/settings.json"],pN=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(),uN=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();i(ZC,"parseJsonObject");i(qC,"mergeSettingsJson");i(QC,"mergeGeminiSettingsJson");});var dN,fN,gN,hN,hc,Uu=f(()=>{RC();ro();wC();It();ju();KC();BC();vt();ms();ht();VC();YC();He();Ku();dN={name:"gemini-cli",primaryRootInstructionPath:_e,generateRules:Eu,generateCommands:wu,generateAgents:Lu,generateSkills:Au,generateIgnore:xu,generatePermissions:EC,importFrom:gc},fN={rootInstructionPath:_e,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Rr]}],extraRuleOutputPaths(){return [Rr]},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 mt(t,".gemini/skills",e)},paths:{rulePath(t,e){return _e},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${ee}/${r.join("/")}/${n}.toml`}return `${ee}/${t}.toml`},agentPath(t,e){return ae(e,"gemini-cli")?`.gemini/skills/${Z(t)}/SKILL.md`:`${Un}/${t}.md`}}},gN={rootInstructionPath:Ys,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Xs]}],extraRuleOutputPaths(){return [Xs]},skillDir:Bo,managedOutputs:{dirs:[Zs,Bo,_a],files:[Ys,Xs,pc]},rewriteGeneratedPath(t){return t===_e?Ys:t===Rr?Xs:t===Wo?pc:t.startsWith(`${ee}/`)?t.replace(`${ee}/`,`${Zs}/`):t.startsWith(".gemini/skills/")?t.replace(".gemini/skills/",`${Bo}/`):t.startsWith(`${Un}/`)?t.replace(`${Un}/`,`${_a}/`):t.startsWith(".gemini/policies/")||t===".geminiignore"?null:t},mirrorGlobalPath(t,e){return mt(t,Bo,e)},paths:{rulePath(t,e){return Ys},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${Zs}/${r.join("/")}/${n}.toml`}return `${Zs}/${t}.toml`},agentPath(t,e){return ae(e,"gemini-cli")?`${Bo}/${Z(t)}/SKILL.md`:`${_a}/${t}.md`}}},hN={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:"none",permissions:"none"},hc={id:"gemini-cli",generators:dN,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:be("native","settings-embedded"),permissions:"partial"},emptyImportMessage:"No Gemini CLI config found (GEMINI.md or .gemini/rules, .gemini/commands, .gemini/settings.json).",lintRules:WC,lint:{commands:HC,hooks:zC},emitScopedSettings:JC,mergeGeneratedOutputContent(t,e,r,n){let o=e?.content??t;return o!==null&&n===Wo?QC(o,r):null},project:fN,globalSupport:{capabilities:hN,detectionPaths:[Ys,Xs,pc,Zs,Bo,_a],layout:gN},importer:{rules:{feature:"rules",mode:"directory",source:{project:[pC]},canonicalDir:Kn,extensions:[".md"],map:jC},commands:{feature:"commands",mode:"directory",source:{project:[ee]},canonicalDir:mc,extensions:[".md",".toml"],map:UC}},buildImportPaths:gp,detectionPaths:["GEMINI.md",".gemini"]};});function tO(t){let e=t.rules.find(s=>s.root),r=t.rules.filter(s=>s.root?false:s.targets.length===0||s.targets.includes(ur)),n=e?.body.trim()??"",o=Zt(n,r);return o?[{path:he,content:o}]:[]}function eO(t){return Nt(t,Ut)}function rO(t){return t.commands.map(e=>({path:`${Ut}/${Tt(e.name)}/SKILL.md`,content:gs(e)}))}function nO(t){return t.agents.map(e=>({path:`${Ut}/${Z(e.name)}/SKILL.md`,content:qe(e)}))}function oO(t){return t.ignore.length===0?[]:[{path:Kr,content:t.ignore.join(`
|
|
111
|
-
`)}]}var
|
|
112
|
-
`)}]}function
|
|
113
|
-
`)}]}function
|
|
117
|
+
`),e.push({fromTool:"gemini-cli",fromPath:r,toPath:Oi,feature:"ignore"});}}}var Hd=d(()=>{A();xt();Kd();IO();s(_O,"importGeminiIgnore");});function QF(t){return t.replace(/\\(.)/g,"$1")}function tv(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 ev(t){return `Bash(${t}:*)`}function rv(t){return `Read(${QF(t)})`}async function CO(t){let e=[],r=join(t,Yc),n;try{n=await D(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 y(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 S=R,I=typeof S.toolName=="string"?S.toolName:null,E=typeof S.decision=="string"?S.decision:null;if(!I||!E)continue;let T=tv(I);if(!T)continue;let P=null;T==="Bash"?typeof S.commandPrefix=="string"&&S.commandPrefix.trim()&&(P=ev(S.commandPrefix.trim())):T==="Read"?typeof S.argsPattern=="string"&&S.argsPattern.trim()?P=rv(S.argsPattern.trim()):P="Read":P=T,P&&(E==="allow"?l.has(P)||(l.add(P),i.push(P)):E==="deny"&&(c.has(P)||(c.add(P),a.push(P))));}}if(i.length===0&&a.length===0)return e;await O(join(t,".agentsmesh"));let m=join(t,Dd),p=stringify({allow:i,deny:a});return await C(m,p.trimEnd()+`
|
|
118
|
+
`),e.push({fromTool:go,fromPath:join(t,Yc),toPath:Dd,feature:"permissions"}),e}var SO=d(()=>{A();xt();s(QF,"unescapeRegexLiteral");s(tv,"toolNameToPermissionBase");s(ev,"commandPrefixToBashExpr");s(rv,"argsPatternToReadExpr");s(CO,"importGeminiPolicies");});function zd(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 OO=d(()=>{s(zd,"stripProjectRootCanonicalPrefix");});async function EO(t,e,r){let n=join(t,Xa),i=(await D(n)).filter(l=>basename(l)==="SKILL.md");for(let l of i){let c=await y(l);if(!c)continue;let m=basename(l.slice(0,-9)),p=k(c),u=hr(p.frontmatter,m);if(u){let E=join(t,Za);await O(E);let T=join(E,`${u.name}.md`);await C(T,ye(u,r(p.body,l,T))),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${Za}/${u.name}.md`,feature:"agents"});continue}let f=join(t,qa,m,"SKILL.md"),g=r(c,l,f),h=join(t,qa,m);await O(h);let{frontmatter:R,body:S}=k(g);await C(f,await yr(f,{...R,name:m},S)),e.push({fromTool:"gemini-cli",fromPath:l,toPath:`${qa}/${m}/SKILL.md`,feature:"skills"});let I=await D(dirname(l));for(let E of I){if(E===l)continue;let T=await y(E);if(T===null)continue;let P=relative(dirname(l),E).replace(/\\/g,"/"),x=join(h,P);await O(dirname(x)),await C(x,r(T,E,x)),e.push({fromTool:"gemini-cli",fromPath:E,toPath:`${qa}/${m}/${P}`,feature:"skills"});}}let a=join(t,ho);try{let c=(await D(a)).filter(m=>m.endsWith(".md"));for(let m of c){let p=await y(m);if(!p)continue;let{frontmatter:u,body:f}=k(p),h=relative(a,m).replace(/\\/g,"/").replace(/\.md$/i,".md"),R=join(t,Za);await O(R);let S=join(R,h),I=r(f,m,S);await C(S,await Et(S,{...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},I)),e.push({fromTool:"gemini-cli",fromPath:m,toPath:`${Za}/${h}`,feature:"agents"});}}catch{}}var LO=d(()=>{A();v();Z();lt();xt();s(EO,"importGeminiSkillsAndAgents");});async function nv(t,e,r){let n=await B("codex-cli",t),o=join(t,yo),i=join(t,Wr),a=join(t,nO),l=[i,a,join(t,be),join(t,oO)],c=null,m=l[l.length-1];for(let P of l){let x=await y(P);if(x!==null){c=x,m=P;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 Mr({content:u,projectRoot:t,rulesDir:yo,sourcePath:m,fromTool:go,normalize:r});e.push(...f.results);let g=r(f.rootContent,m,p),h=zd(g.replace(/\.agents\/skills\//g,".agentsmesh/skills/").replace(/\.agents\\skills\\/g,".agentsmesh/skills/"),t),{frontmatter:R,body:S}=k(h),E=R.root===true?R:{...R,root:true},T=zd(await G(p,E,S),t);await C(p,T),e.push({fromTool:go,fromPath:m,toPath:`${yo}/_root.md`,feature:"rules"});}async function rm(t){let e=[],r=await B(go,t);return await nv(t,e,r),e.push(...await q(nm,t,"project",{normalize:r})),await EO(t,e,r),await Wd(t,e),await _O(t,e),e.push(...await CO(t)),e}var Yd=d(()=>{yt();A();v();Z();hi();Wt();xt();Xd();Hd();SO();OO();LO();s(nv,"importRootRule");s(rm,"importFromGemini");});async function AO(t,e,r){let n=t.replace(/\\/g,"/"),o=join(e,n),{frontmatter:i,body:a}=tm(r(o)),l=nn(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:`${yo}/${n}`,feature:"rules",content:await G(o,c,a)}}async function xO(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")?sv(i):tm(i),c=Oe(a.allowedTools),m=Oe(a["allowed-tools"]),p=c.length>0?c:m;return {destPath:o,toPath:`${Zc}/${n}`,feature:"commands",content:await et(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 sv(t){try{let e=parse$1(t);return {frontmatter:e,body:typeof e.prompt=="string"?e.prompt:""}}catch{return {frontmatter:{},body:t.trim()}}}var bO=d(()=>{Z();Ke();Hd();xt();s(AO,"mapGeminiRuleFile");s(xO,"mapGeminiCommandFile");s(sv,"parseTomlCommand");});var PO,TO,DO=d(()=>{bO();PO=s(({relativePath:t,destDir:e,normalizeTo:r})=>AO(t,e,r),"geminiRuleMapper"),TO=s(({relativePath:t,destDir:e,normalizeTo:r})=>xO(t,e,r),"geminiCommandMapper");});function NO(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(i=>({...i,target:go}))}var FO=d(()=>{Nt();xt();s(NO,"lintRules");});function vO(t){return t.commands.filter(e=>e.allowedTools.length>0).map(e=>$(e.source,"gemini-cli","Gemini TOML command files do not project canonical allowed-tools metadata."))}function MO(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=>Vs(n,"gemini-cli",e))}var GO=d(()=>{Lt();s(vO,"lintCommands");s(MO,"lintHooks");});function $O(t,e){return e==="project"&&Io("gemini-cli",e)?.ignore.flavor!=="settings-embedded"?[]:Gd(t)}var jO=d(()=>{mt();$d();s($O,"emitScopedGeminiSettings");});function KO(t){try{let e=JSON.parse(t);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return {}}}function WO(t,e){let r=KO(t),n=iv.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 BO(t,e){let r=KO(t),n=av.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)}var UO,iv,av,Zd=d(()=>{UO=[".claude/settings.json",".gemini/settings.json"],iv=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(),av=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(KO,"parseJsonObject");s(WO,"mergeSettingsJson");s(BO,"mergeGeminiSettingsJson");});var lv,cv,mv,pv,nm,Xd=d(()=>{fO();To();yO();xt();Yd();DO();FO();At();$s();lt();GO();jO();ae();Zd();lv={name:"gemini-cli",primaryRootInstructionPath:be,generateRules:Nd,generateCommands:Fd,generateAgents:vd,generateSkills:Md,generateIgnore:jd,generatePermissions:hO,importFrom:rm},cv={rootInstructionPath:be,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Wr]}],extraRuleOutputPaths(){return [Wr]},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 ot(t,".gemini/skills",e)},paths:{rulePath(t,e){return be},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${me}/${r.join("/")}/${n}.toml`}return `${me}/${t}.toml`},agentPath(t,e){return he(e,"gemini-cli")?`.gemini/skills/${H(t)}/SKILL.md`:`${ho}/${t}.md`}}},mv={rootInstructionPath:ki,outputFamilies:[{id:"compat-agents",kind:"additional",explicitPaths:[Ei]}],extraRuleOutputPaths(){return [Ei]},skillDir:Cs,managedOutputs:{dirs:[Li,Cs,Qa],files:[ki,Ei,qc]},rewriteGeneratedPath(t){return t===be?ki:t===Wr?Ei:t===_s?qc:t.startsWith(`${me}/`)?t.replace(`${me}/`,`${Li}/`):t.startsWith(".gemini/skills/")?t.replace(".gemini/skills/",`${Cs}/`):t.startsWith(`${ho}/`)?t.replace(`${ho}/`,`${Qa}/`):t.startsWith(".gemini/policies/")||t===".geminiignore"?null:t},mirrorGlobalPath(t,e){return ot(t,Cs,e)},paths:{rulePath(t,e){return ki},commandPath(t,e){if(t.includes(":")){let r=t.split(":").filter(Boolean),n=r.pop()??t;return `${Li}/${r.join("/")}/${n}.toml`}return `${Li}/${t}.toml`},agentPath(t,e){return he(e,"gemini-cli")?`${Cs}/${H(t)}/SKILL.md`:`${Qa}/${t}.md`}}},pv={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:"none",permissions:"none"},nm={id:"gemini-cli",generators:lv,capabilities:{rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"partial",ignore:je("native","settings-embedded"),permissions:"partial"},emptyImportMessage:"No Gemini CLI config found (GEMINI.md or .gemini/rules, .gemini/commands, .gemini/settings.json).",lintRules:NO,lint:{commands:vO,hooks:MO},emitScopedSettings:$O,mergeGeneratedOutputContent(t,e,r,n){let o=e?.content??t;return o!==null&&n===_s?BO(o,r):null},project:cv,globalSupport:{capabilities:pv,detectionPaths:[ki,Ei,qc,Li,Cs,Qa],layout:mv},importer:{rules:{feature:"rules",mode:"directory",source:{project:[rO]},canonicalDir:yo,extensions:[".md"],map:PO},commands:{feature:"commands",mode:"directory",source:{project:[me]},canonicalDir:Zc,extensions:[".md",".toml"],map:TO}},buildImportPaths:_u,detectionPaths:["GEMINI.md",".gemini"]};});function HO(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Ar)),n=e?.body.trim()??"",o=kt(n,r);return o?[{path:we,content:o}]:[]}function zO(t){return _t(t,Jt)}function VO(t){return t.commands.map(e=>({path:`${Jt}/${nt(e.name)}/SKILL.md`,content:gr(e)}))}function JO(t){return t.agents.map(e=>({path:`${Jt}/${H(e.name)}/SKILL.md`,content:te(e)}))}function YO(t){return t.ignore.length===0?[]:[{path:dn,content:t.ignore.join(`
|
|
119
|
+
`)}]}var XO=d(()=>{ht();Ie();lt();Qt();ei();s(HO,"generateRules");s(zO,"generateSkills");s(VO,"generateCommands");s(JO,"generateAgents");s(YO,"generateIgnore");});async function ZO(t,e={}){let r=e.scope??"project",n=[],o=await B(Ar,t,r);return n.push(...await q(om,t,r,{normalize:o})),await gt(t,r==="global"?Ae:Jt,Ar,n,o),n}var qO=d(()=>{yt();ht();Wt();ei();qd();s(ZO,"importFromGoose");});function QO(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Ar}))}var tk=d(()=>{Nt();ei();s(QO,"lintRules");});function ek(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","goose","Goose has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function rk(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?[]:[$(".agentsmesh/permissions.yaml","goose","Goose permissions are managed at runtime via permission.yaml in ~/.config/goose/; canonical permissions are not projected.")]}function nk(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[$(".agentsmesh/mcp.json","goose","Goose MCP extensions are configured globally in ~/.config/goose/config.yaml; project-level MCP is not projected.")]}var ok=d(()=>{Lt();s(ek,"lintHooks");s(rk,"lintPermissions");s(nk,"lintMcp");});var uv,dv,fv,sk,om,qd=d(()=>{Qt();lt();XO();ae();qO();tk();ok();At();ei();uv={name:Ar,primaryRootInstructionPath:we,generateRules:HO,generateCommands:VO,generateAgents:JO,generateSkills:zO,generateIgnore:YO,importFrom:ZO},dv={rootInstructionPath:we,skillDir:Jt,managedOutputs:{dirs:[Jt],files:[we,dn]},paths:{rulePath(t){return we},commandPath(t){return `${Jt}/${nt(t)}/SKILL.md`},agentPath(t){return `${Jt}/${H(t)}/SKILL.md`}}},fv={rootInstructionPath:fn,skillDir:Ae,managedOutputs:{dirs:[Ae],files:[fn,Wo]},rewriteGeneratedPath(t){return t===we?fn:t===dn?Wo:(t.startsWith(`${Jt}/`),t)},mirrorGlobalPath(t,e){return ot(t,Ae,e)},paths:{rulePath(t){return fn},commandPath(t){return `${Ae}/${nt(t)}/SKILL.md`},agentPath(t){return `${Ae}/${H(t)}/SKILL.md`}}},sk={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"native",permissions:"none"},om={id:Ar,generators:uv,capabilities:sk,emptyImportMessage:"No Goose config found (.goosehints, .agents/skills, or .gooseignore).",lintRules:QO,lint:{hooks:ek,permissions:rk,mcp:nk},supportsConversion:{commands:true,agents:true},project:dv,globalSupport:{capabilities:sk,detectionPaths:[fn,Wo,Ae],layout:fv},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[we],global:[fn]},canonicalDir:bI,canonicalRootFilename:"_root.md",markAsRoot:true},ignore:{feature:"ignore",mode:"flatFile",source:{project:[dn],global:[Wo]},canonicalDir:".agentsmesh",canonicalFilename:PI}},sharedArtifacts:{".agents/skills/":"consumer"},buildImportPaths:Cu,detectionPaths:[we,dn]};});function ik(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:xr,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:`${Aa}/${o}.md`,content:n.body.trim()||""});}return e}function hv(t){let e={};return t.description&&(e.description=t.description),t.type!=="stdio"&&(e.type=t.type),wc(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 ak(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,hv(n)]));return [{path:wa,content:JSON.stringify({mcpServers:e},null,2)}]}function lk(t){return t.commands.map(e=>{let r={description:e.description||void 0};return r.description===void 0&&delete r.description,{path:`${ri}/${e.name}.md`,content:N(r,e.body.trim()||"")}})}function ck(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:`${ni}/${e.name}.md`,content:N(r,e.body.trim()||"")}})}function mk(t){return t.ignore.length===0?[]:[{path:xa,content:t.ignore.join(`
|
|
120
|
+
`)}]}function pk(t){return _t(t,Ho)}function uk(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 kt(e?.body.trim()??"",r)}var dk=d(()=>{Ac();ht();Ie();v();oi();s(ik,"generateRules");s(hv,"toJunieMcpServer");s(ak,"generateMcp");s(lk,"generateCommands");s(ck,"generateAgents");s(mk,"generateIgnore");s(pk,"generateSkills");s(uk,"renderJunieGlobalInstructions");});async function yv(t,e,r){let n=[xr,ac,DI,NI],o=join(t,Su);for(let i of n){let a=join(t,i),l=await y(a);if(l===null)continue;let c=await Mr({content:l,projectRoot:t,rulesDir:cc,sourcePath:a,fromTool:Bo,normalize:r});e.push(...c.results);let{frontmatter:m,body:p}=k(r(c.rootContent,a,o)),u=await G(o,{root:true,description:typeof m.description=="string"?m.description:void 0,globs:Array.isArray(m.globs)?m.globs:void 0},p);await C(o,u),e.push({fromTool:Bo,fromPath:a,toPath:Su,feature:"rules"});return}}async function sm(t){let e=[],r=await B(Bo,t);return await yv(t,e,r),e.push(...await q(im,t,"project",{normalize:r})),await gt(t,Ho,Bo,e,r),e}var Qd=d(()=>{yt();A();v();ht();hi();Z();Wt();oi();tf();s(yv,"importRootRule");s(sm,"importFromJunie");});function gk(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Bo}))}var hk=d(()=>{Nt();oi();s(gk,"lintRules");});function yk(t){if(!t.mcp||Object.keys(t.mcp.mcpServers).length===0)return [];let e=[];for(let[r,n]of Object.entries(t.mcp.mcpServers))UC(n)&&e.push($(".agentsmesh/mcp.json","junie",`MCP server "${r}" uses ${n.type} transport; Junie project mcp.json currently documents stdio MCP servers only.`));return e}var Ik=d(()=>{Ac();Lt();s(yk,"lintMcp");});var Iv,_v,Cv,Sv,im,tf=d(()=>{dk();oi();ae();Qd();hk();Ik();At();Iv={name:"junie",primaryRootInstructionPath:xr,generateRules:ik,generateCommands:lk,generateAgents:ck,generateSkills:pk,generateMcp:ak,generateIgnore:mk,importFrom:sm},_v={rootInstructionPath:xr,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 `${Aa}/${t}.md`},commandPath(t,e){return `${ri}/${t}.md`},agentPath(t,e){return `${ni}/${t}.md`}}},Cv={rootInstructionPath:zo,renderPrimaryRootInstruction:uk,skillDir:Pa,managedOutputs:{dirs:[Pa,Ta,Da,FI],files:[zo,lc]},rewriteGeneratedPath(t){return t===xr?zo:t.startsWith(`${Aa}/`)?zo:t.startsWith(`${Ho}/`)?t.replace(`${Ho}/`,`${Pa}/`):t.startsWith(`${ri}/`)?t.replace(`${ri}/`,`${Da}/`):t.startsWith(`${ni}/`)?t.replace(`${ni}/`,`${Ta}/`):t===wa?lc:t===xa?null:t},mirrorGlobalPath(t,e){return ot(t,".junie/skills",e)},paths:{rulePath(t,e){return zo},commandPath(t,e){return `${Da}/${t}.md`},agentPath(t,e){return `${Ta}/${t}.md`}}},Sv={rules:"native",additionalRules:"embedded",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},im={id:"junie",generators:Iv,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:gk,lint:{mcp:yk},project:_v,globalSupport:{capabilities:Sv,detectionPaths:[zo,Pa,Ta,Da,lc],layout:Cv},importer:{rules:{feature:"rules",mode:"directory",source:{project:[".junie/rules"]},canonicalDir:cc,extensions:[".md"],preset:"rule"},commands:{feature:"commands",mode:"directory",source:{project:[".junie/commands"]},canonicalDir:vI,extensions:[".md"],preset:"command"},agents:{feature:"agents",mode:"directory",source:{project:[".junie/agents"]},canonicalDir:MI,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[wa]},canonicalDir:".agentsmesh",canonicalFilename:GI},ignore:{feature:"ignore",mode:"flatFile",source:{project:[xa]},canonicalDir:".agentsmesh",canonicalFilename:$I}},buildImportPaths:Ru,detectionPaths:[".junie/guidelines.md",".junie/AGENTS.md",".junie/skills",".junie/mcp/mcp.json",".aiignore"]};});function Ck(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:br,content:r.body.trim()?r.body:""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(Yt))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?N(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${gn}/${o}.md`,content:a});}return e}function Sk(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${hn}/${e.name}.md`,content:N(r,e.body.trim()||"")}})}function Rk(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:`${yn}/${r}.md`,content:N(n,e.body.trim()||"")}})}function Ok(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Zn,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function kk(t){return t.ignore.length===0?[]:[{path:si,content:t.ignore.join(`
|
|
121
|
+
`)}]}function Ek(t){return _t(t,Ye)}var Lk=d(()=>{ht();v();Qo();s(Ck,"generateRules");s(Sk,"generateCommands");s(Rk,"generateAgents");s(Ok,"generateMcp");s(kk,"generateIgnore");s(Ek,"generateSkills");});var am,lm,wk,rf=d(()=>{v();Z();Qo();am=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${to}/${t}`,content:await G(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"kiloNonRootRuleMapper"),lm=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${ci}/${t}`,content:await et(n,{hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"kiloCommandMapper"),wk=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${qo}/${t}`,content:await Et(n,o,i)}},"kiloAgentMapper");});async function Ak(t){try{return await stat(t),!0}catch{return false}}async function kv(t,e,r){let n=join(t,Vo);if(!await Ak(n))return;let o=join(t,to),i=join(n,of),l=e.some(c=>c.toPath===nf)?null:await y(i);if(l!==null){let c=join(t,nf),m=r(l,i,c),{body:p}=k(m),u=await G(c,{root:true},p);await C(c,u),e.push({feature:"rules",fromTool:Yt,fromPath:`${Vo}/${of}`,toPath:nf});}e.push(...await it({srcDir:n,destDir:o,extensions:[".md"],fromTool:Yt,normalize:r,mapEntry:s(async({srcPath:c,relativePath:m,content:p,normalizeTo:u})=>{let f=await am({absolutePath:c,relativePath:m,content:p,destDir:o,normalizeTo:u});return m===of||!f?null:{...f,feature:"rules"}},"mapEntry")}));}async function Ev(t,e,r){let n=join(t,ii);if(!await Ak(n))return;let o=join(t,ci);e.push(...await it({srcDir:n,destDir:o,extensions:[".md"],fromTool:Yt,normalize:r,mapEntry:s(async({srcPath:i,relativePath:a,content:l,normalizeTo:c})=>{let m=await lm({absolutePath:i,relativePath:a,content:l,destDir:o,normalizeTo:c});return m?{...m,feature:"commands"}:null},"mapEntry")}));}async function Lv(t,e,r){let n=join(t,pc),o=await y(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,qo,`${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}
|
|
114
122
|
|
|
115
123
|
## When to use
|
|
116
124
|
|
|
117
|
-
${
|
|
118
|
-
`)}]}var rR=f(()=>{Et();er();v();qu();Ms();i(UN,"steeringFrontmatter");i(YO,"generateRules");i(XO,"generateCommands");i(ZO,"generateSkills");i(qO,"generateMcp");i(QO,"generateHooks");i(tR,"generateAgents");i(eR,"generateIgnore");});function WN(t){let e=typeof t.inclusion=="string"?t.inclusion:"",r={root:false,description:typeof t.description=="string"?t.description:void 0,globs:Fr(t.fileMatchPattern)};return e==="manual"&&(r.trigger="manual"),e==="auto"&&(r.trigger="model_decision"),e==="fileMatch"&&(r.trigger="glob"),r}async function BN(t,e,r,n){let o=n==="global"?[Ue,Me]:[Me,Ue];for(let s of o){let a=join(t,s),l=await I(a);if(l===null)continue;let c=join(t,Sp),{frontmatter:m,body:p}=E(r(l,a,c));await S(c,await M(c,{...m,root:true},p)),e.push({fromTool:te,fromPath:a,toPath:Sp,feature:"rules"});return}}async function HN(t,e,r){let n=join(t,Cp);e.push(...await tt({srcDir:join(t,Ge),destDir:n,extensions:[".md"],fromTool:te,normalize:r,mapEntry:i(async({relativePath:o,normalizeTo:s})=>{if(basename(o)==="AGENTS.md")return null;let a=join(n,o),{frontmatter:l,body:c}=E(s(a));return {destPath:a,toPath:`${Cp}/${o}`,feature:"rules",content:await M(a,WN(l),c)}},"mapEntry")}));}async function zN(t,e){let r={};for(let o of await x(join(t,An))){if(!o.endsWith(".kiro.hook"))continue;let s=VO(await I(o)??"");s&&(r[s.event]??=[],r[s.event].push(s.entry));}if(Object.keys(r).length===0)return;let n=join(t,Op);await R(join(t,".agentsmesh")),await S(n,JO(r)),e.push({fromTool:te,fromPath:join(t,An),toPath:Op,feature:"hooks"});}async function kc(t,e={}){let r=e.scope??"project",n=[],o=await z(te,t,r);return await BN(t,n,o,r),await HN(t,n,o),n.push(...await et(Ec,t,r,{normalize:o})),await kt(t,Wt,te,n,o),r==="project"&&await zN(t,n),n}var Qu=f(()=>{Ct();Et();Ne();qt();Y();Te();A();v();qu();Ms();td();i(WN,"canonicalRuleMeta");i(BN,"importRoot");i(HN,"importNonRootRules");i(zN,"importHooks");i(kc,"importFromKiro");});function nR(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:te}))}var oR=f(()=>{Vt();Ms();i(nR,"lintRules");});function sR(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=>Ks(n,"kiro",e,{unsupportedBy:"Kiro hooks"}))}var iR=f(()=>{$t();i(sR,"lintHooks");});var VN,JN,YN,XN,Ec,td=f(()=>{er();rR();He();Qu();oR();iR();vt();Ms();VN={name:te,primaryRootInstructionPath:Me,generateRules:YO,generateCommands:XO,generateAgents:tR,generateSkills:ZO,generateMcp:qO,generateHooks:QO,generateIgnore:eR,importFrom:kc},JN={rootInstructionPath:Me,skillDir:Wt,managedOutputs:{dirs:[".kiro/hooks",".kiro/skills",".kiro/steering",".kiro/agents"],files:["AGENTS.md",".kiro/settings/mcp.json",".kiroignore"]},paths:{rulePath(t,e){return `${Ge}/${t}.md`},commandPath(t){return `${Wt}/${Tt(t)}/SKILL.md`},agentPath(t,e){return `${je}/${t}.md`}}},YN={rootInstructionPath:Ue,skillDir:bn,managedOutputs:{dirs:[Eo,bn,wo,Ry],files:[Ue,na,oa]},rewriteGeneratedPath(t){return t===Me?Ue:t.startsWith(`${Ge}/`)?t.replace(`${Ge}/`,`${Eo}/`):t.startsWith(`${Wt}/`)?t.replace(`${Wt}/`,`${bn}/`):t.startsWith(`${je}/`)?t.replace(`${je}/`,`${wo}/`):t===vs?na:t===$s?oa:t.startsWith(`${An}/`)?null:t},mirrorGlobalPath(t,e){return mt(t,".kiro/skills",e)},paths:{rulePath(t,e){return `${Eo}/${t}.md`},commandPath(t){return `${Wt}/${Tt(t)}/SKILL.md`},agentPath(t,e){return `${wo}/${t}.md`}}},XN={rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Ec={id:te,generators:VN,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:nR,lint:{hooks:sR},project:JN,globalSupport:{capabilities:XN,detectionPaths:[Eo,Ue,bn,wo,na,oa],layout:YN},importer:{agents:{feature:"agents",mode:"directory",source:{project:[je],global:[je]},canonicalDir:ky,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[vs],global:[na]},canonicalDir:".agentsmesh",canonicalFilename:Ey},ignore:{feature:"ignore",mode:"flatFile",source:{project:[$s],global:[oa]},canonicalDir:".agentsmesh",canonicalFilename:wy}},buildImportPaths:Rp,detectionPaths:[Ge,Wt,je,An,vs,$s]};});function lR(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:gr,content:r.body.trim()?r.body:""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(Ke))continue;let o=basename(n.source,".md"),s={};n.description&&(s.description=n.description),n.globs.length>0&&(s.globs=n.globs);let a=Object.keys(s).length>0?T(s,n.body.trim()||""):n.body.trim()||"";e.push({path:`${Vr}/${o}.md`,content:a});}return e}function cR(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Jr}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function mR(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:`${Yr}/${r}.md`,content:T(n,e.body.trim()||"")}})}function ZN(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 pR(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]=ZN(n);return [{path:hr,content:JSON.stringify({mcp:e},null,2)}]}function uR(t){return Nt(t,We)}var dR=f(()=>{Et();v();Po();i(lR,"generateRules");i(cR,"generateCommands");i(mR,"generateAgents");i(ZN,"toOpenCodeMcpServer");i(pR,"generateMcp");i(uR,"generateSkills");});function ed(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 QN(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,s]of Object.entries(r)){if(!s||typeof s!="object"||Array.isArray(s))continue;let a=s;if(typeof a.url=="string"){n[o]={type:"url",url:a.url,headers:ed(a.headers),env:ed(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:ed(a.environment),...typeof a.description=="string"?{description:a.description}:{}};}}return n}async function tD(t,e,r){let o=join(t,e==="global"?Tn:hr),s=await I(o);if(s===null)return;let a=QN(s);Object.keys(a).length!==0&&(await pe(t,kp,a),r.push({feature:"mcp",fromTool:Ke,fromPath:o,toPath:kp}));}async function fR(t,e={}){let r=e.scope??"project",n=[],o=await z(Ke,t,r);return n.push(...await et(wc,t,r,{normalize:o})),await kt(t,We,Ke,n,o),await tD(t,r,n),n}var gR=f(()=>{Ct();Et();qt();io();A();Po();rd();i(ed,"toStringRecord");i(QN,"parseOpenCodeMcp");i(tD,"importMcp");i(fR,"importFromOpenCode");});var hR,yR,IR,_R=f(()=>{v();Y();Po();hR=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${sa}/${t}`,content:await M(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},s)}},"opencodeNonRootRuleMapper"),yR=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${Al}/${t}`,content:await q(n,{hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},s)}},"opencodeCommandMapper"),IR=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${bl}/${t}`,content:await yt(n,o,s)}},"opencodeAgentMapper");});function SR(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Ke}))}var CR=f(()=>{Vt();Po();i(SR,"lintRules");});function OR(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 RR(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?[]:[B(".agentsmesh/permissions.yaml","opencode","opencode permissions live in opencode.json, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}function kR(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 ER=f(()=>{$t();i(OR,"lintHooks");i(RR,"lintPermissions");i(kR,"lintIgnore");});var eD,rD,nD,wR,wc,rd=f(()=>{dR();Po();He();gR();_R();CR();ER();vt();eD={name:Ke,primaryRootInstructionPath:gr,generateRules:lR,generateCommands:cR,generateAgents:mR,generateSkills:uR,generateMcp:pR,importFrom:fR},rD={rootInstructionPath:gr,skillDir:We,managedOutputs:{dirs:[Vr,Jr,Yr,We],files:[gr,hr]},paths:{rulePath(t){return `${Vr}/${t}.md`},commandPath(t){return `${Jr}/${t}.md`},agentPath(t){return `${Yr}/${t}.md`}}},nD={rootInstructionPath:Pn,skillDir:xn,managedOutputs:{dirs:[Lo,Ao,bo,xn,Ay],files:[Pn,Tn]},rewriteGeneratedPath(t){return t===gr?Pn:t===hr?Tn:t},mirrorGlobalPath(t,e){return mt(t,xn,e)},paths:{rulePath(t){return `${Lo}/${t}.md`},commandPath(t){return `${Ao}/${t}.md`},agentPath(t){return `${bo}/${t}.md`}}},wR={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},wc={id:Ke,generators:eD,capabilities:wR,emptyImportMessage:"No OpenCode config found (AGENTS.md, .opencode/rules, .opencode/commands, .opencode/agents, .opencode/skills, or opencode.json).",lintRules:SR,lint:{hooks:OR,permissions:RR,ignore:kR},project:rD,globalSupport:{capabilities:wR,detectionPaths:[Pn,Lo,Ao,bo,xn,Tn],layout:nD},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[gr],global:[Pn]},canonicalDir:sa,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[Vr],global:[Lo]},canonicalDir:sa,extensions:[".md"],map:hR}],commands:{feature:"commands",mode:"directory",source:{project:[Jr],global:[Ao]},canonicalDir:Al,extensions:[".md"],map:yR},agents:{feature:"agents",mode:"directory",source:{project:[Yr],global:[bo]},canonicalDir:bl,extensions:[".md"],map:IR}},buildImportPaths:Ep,detectionPaths:[Vr,Jr,Yr,We,hr,"opencode.jsonc"]};});function AR(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Be,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(Nn))continue;let o=basename(n.source,".md");e.push({path:`${Xr}/${o}.md`,content:n.body.trim()||""});}return e}function bR(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Zr}/${e.name}.md`,content:T(r,e.body.trim()||"")}})}function PR(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:aa,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function xR(t){return t.ignore.length===0?[]:[{path:la,content:t.ignore.join(`
|
|
119
|
-
`)}]}function TR(t){return Nt(t,yr)}function NR(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:js,content:stringify({customModes:e})}]}var DR=f(()=>{Et();v();Do();i(AR,"generateRules");i(bR,"generateCommands");i(PR,"generateMcp");i(xR,"generateIgnore");i(TR,"generateSkills");i(NR,"generateAgents");});var Lc,vR,od=f(()=>{v();Y();Do();Lc=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(t==="00-root.md")return null;let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${No}/${t}`,content:await M(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},s)}},"rooNonRootRuleMapper"),vR=i(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:s}=E(e(n));return {destPath:n,toPath:`${xl}/${t}`,content:await q(n,{hasDescription:true,description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},s)}},"rooCommandMapper");});async function iD(t,e,r){let n=join(t,xo),o;try{o=await readdir(n,{withFileTypes:!0});}catch{return}let s=o.filter(l=>l.isDirectory()&&l.name.startsWith("rules-")).map(l=>l.name),a=join(t,No);for(let l of s)e.push(...await tt({srcDir:join(n,l),destDir:a,extensions:[".md"],fromTool:Nn,normalize:r,mapEntry:i(async({srcPath:c,relativePath:m,content:p,normalizeTo:u})=>{let d=await Lc({absolutePath:c,relativePath:m,content:p,destDir:a,normalizeTo:u});return d?{...d,feature:"rules"}:null},"mapEntry")}));}async function $R(t,e={}){let r=e.scope??"project",n=[],o=await z(Nn,t,r);return n.push(...await et(Ac,t,r,{normalize:o})),await iD(t,n,o),await kt(t,yr,Nn,n,o),n}var MR=f(()=>{Ct();Et();Ne();qt();od();Do();id();i(iD,"importPerModeRules");i($R,"importFromRooCode");});function GR(t,e,r,n){return Q(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Nn}))}var jR=f(()=>{Vt();Do();i(GR,"lintRules");});function uD(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var mD,pD,dD,fD,gD,Ac,id=f(()=>{A();DR();Do();He();MR();od();jR();vt();mD={name:"roo-code",primaryRootInstructionPath:Be,generateRules:AR,generateCommands:bR,generateSkills:TR,generateMcp:PR,generateIgnore:xR,generateAgents:NR,importFrom:$R},pD={rootInstructionPath:Be,skillDir:".roo/skills",managedOutputs:{dirs:[".roo/rules",".roo/commands",".roo/skills"],files:[".roo/mcp.json",".rooignore",".roorules",js]},paths:{rulePath(t,e){return `${Xr}/${t}.md`},commandPath(t,e){return `${Zr}/${t}.md`},agentPath(t,e){return null}}};i(uD,"computeStatus");dD=i(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}),s=stringify({customModes:o}),a=await I(join(e,ca));return [{target:"roo-code",path:ca,content:s,currentContent:a??void 0,status:uD(a,s)}]},"generateRooGlobalExtras"),fD={rootInstructionPath:vn,skillDir:qr,managedOutputs:{dirs:[Dn,Fn,qr,Py],files:[vn,To,ma,ca]},rewriteGeneratedPath(t){return t===Be?vn:t===js?null:t.startsWith(`${Xr}/`)?t.replace(`${Xr}/`,`${Dn}/`):t.startsWith(`${Zr}/`)?t.replace(`${Zr}/`,`${Fn}/`):t.startsWith(`${yr}/`)?t.replace(`${yr}/`,`${qr}/`):t===aa?To:t===la?ma:t},mirrorGlobalPath(t,e){return mt(t,qr,e)},paths:{rulePath(t,e){return `${Dn}/${t}.md`},commandPath(t,e){return `${Fn}/${t}.md`},agentPath(t,e){return null}}},gD={rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},Ac={id:"roo-code",generators:mD,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:GR,project:pD,globalSupport:{capabilities:gD,detectionPaths:[Dn,Fn,qr,To,ma,vn,ca],layout:fD,scopeExtras:dD},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Be,ia],global:[vn,Be,ia]},canonicalDir:No,canonicalRootFilename:"_root.md",markAsRoot:true,frontmatterRemap:i(({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:[Xr],global:[Dn]},canonicalDir:No,extensions:[".md"],map:Lc}],commands:{feature:"commands",mode:"directory",source:{project:[Zr],global:[Fn]},canonicalDir:xl,extensions:[".md"],map:vR},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[aa],global:[To]},canonicalDir:".agentsmesh",canonicalFilename:xy},ignore:{feature:"ignore",mode:"flatFile",source:{project:[la],global:[ma]},canonicalDir:".agentsmesh",canonicalFilename:Ty}},buildImportPaths:wp,detectionPaths:[".roo/rules",".roo/commands",".roo/skills",".roo/mcp.json",".rooignore",".roorules",js]};});var kr,ad,Hn,UR,Qs,Er,ti,ei,KR,zn,Je,ri,ld,cd,md,pd,ud,dd,ni,oi,Sa,bc,Pc,xc,WR,Bt=f(()=>{kr="windsurf",ad=".windsurfrules",Hn=".windsurf/rules",UR=".windsurfignore",Qs=".codeiumignore",Er="AGENTS.md",ti=".windsurf/hooks.json",ei=".windsurf/mcp_config.example.json",KR=".windsurf/mcp_config.json",zn=".windsurf/workflows",Je=".windsurf/skills",ri=".agentsmesh/rules",ld=".agentsmesh/commands",cd=".agentsmesh/agents",md=".agentsmesh/skills",pd=".agentsmesh/ignore",ud=".agentsmesh/hooks.yaml",dd=".agentsmesh/mcp.json",ni=".codeium/windsurf/memories/global_rules.md",oi=".codeium/windsurf/skills",Sa=".codeium/windsurf/global_workflows",bc=".codeium/windsurf/hooks.json",Pc=".codeium/windsurf/mcp_config.json",xc=".codeium/.codeiumignore",WR=".agents/skills";});function yD(t){let e=basename(t,".md");return e==="_root"?"root":e}function ID(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 fd(t){let e=[],r=t.rules.find(n=>n.root);if(!r)return [];e.push({path:Er,content:r.body.trim()});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("windsurf"))continue;let o=yD(n.source),s=n.trigger||(n.globs.length>0?"glob":void 0),a={description:n.description||void 0,trigger:s,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:`${Hn}/${o}.md`,content:l});let c=ID(n.globs);c&&(c!==o&&e.push({path:`${Hn}/${c}.md`,content:l}),e.push({path:`${c}/AGENTS.md`,content:n.body.trim()||""}));}return e}var BR=f(()=>{v();Bt();i(yD,"ruleSlug");i(ID,"directoryScopedRuleDir");i(fd,"generateRules");});function gd(t){return !t.ignore||t.ignore.length===0?[]:[{path:Qs,content:t.ignore.join(`
|
|
120
|
-
`)}]}var
|
|
121
|
-
`)),n.push({fromTool:"windsurf",fromPath:p,toPath:pd,feature:"ignore"});}}return await tk(t,n,o),await rk(t,n,o),await sk(t,n),await ik(t,n),n}var Od=f(()=>{Ct();A();v();Y();Ne();hs();Bt();ek();nk();ak();i(Nc,"importFromWindsurf");});function lk(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:kr,message:"Windsurf needs a root rule to generate AGENTS.md. Add root: true to a rule."}));let s=[];return t.permissions&&(t.permissions.allow.length>0||t.permissions.deny.length>0)&&s.push("permissions"),s.length>0&&n.push({level:"warning",file:".agentsmesh",target:kr,message:`Windsurf cannot project these features yet: ${s.join(", ")}.`}),n}var ck=f(()=>{Bt();i(lk,"lintRules");});function mk(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 pk(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 uk=f(()=>{$t();i(mk,"lintCommands");i(pk,"lintMcp");});function bD(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 PD,xD,TD,ND,dk,fk=f(()=>{qR();ro();Bt();He();Od();ck();uk();vt();ms();ht();i(bD,"directoryScopedRuleDir");PD={name:"windsurf",primaryRootInstructionPath:Er,generateRules:fd,generateCommands:hd,generateAgents:yd,generateSkills:Sd,generateMcp:Id,generateHooks:_d,generateIgnore:gd,importFrom:Nc},xD={rootInstructionPath:Er,extraRuleOutputPaths(t){if(t.root)return [Er];let e=bD(t.globs);return e!==null?[`${e}/AGENTS.md`]:[]},skillDir:Je,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 `${Hn}/${t}.md`},commandPath(t,e){return `${zn}/${t}.md`},agentPath(t,e){return ae(e,"windsurf")?`.windsurf/skills/${Z(t)}/SKILL.md`:null}}},TD={rootInstructionPath:ni,skillDir:oi,managedOutputs:{dirs:[oi,Sa,WR],files:[ni,bc,Pc,xc]},rewriteGeneratedPath(t){return t===Er?ni:t.startsWith(`${Hn}/`)||/\/AGENTS\.md$/.test(t)?null:t.startsWith(`${Je}/`)?t.replace(`${Je}/`,`${oi}/`):t.startsWith(`${zn}/`)?t.replace(`${zn}/`,`${Sa}/`):t===ti?bc:t===ei?Pc:t===Qs?xc:t},mirrorGlobalPath(t,e){return mt(t,".codeium/windsurf/skills",e)},paths:{rulePath(t,e){return ni},commandPath(t,e){return `${Sa}/${t}.md`},agentPath(t,e){return ae(e,"windsurf")?`${oi}/${Z(t)}/SKILL.md`:null}}},ND={rules:"native",additionalRules:"partial",commands:be("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},dk={id:"windsurf",generators:PD,capabilities:{rules:"native",additionalRules:"native",commands:be("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:lk,lint:{commands:mk,mcp:pk},project:xD,globalSupport:{capabilities:ND,detectionPaths:[ni,oi,Sa,bc,Pc,xc],layout:TD},buildImportPaths:Lp,detectionPaths:[".windsurfrules",".windsurf"]};});var Wh={};QL(Wh,{BUILTIN_TARGETS:()=>xt,TARGET_IDS:()=>Ot,getBuiltinTargetDefinition:()=>Se,getEffectiveTargetSupportLevel:()=>Dc,getTargetCapabilities:()=>Wn,getTargetDetectionPaths:()=>kd,getTargetLayout:()=>_t,getTargetManagedOutputs:()=>Ed,getTargetPrimaryRootInstructionPath:()=>FD,getTargetSkillDir:()=>Oa,isBuiltinTargetId:()=>un,resolveTargetFeatureGenerator:()=>si,rewriteGeneratedOutputPath:()=>wd});function DD(){return Rd||(Zg(xt),Rd=new Map(xt.map(t=>[t.id,t]))),Rd}function Se(t){return DD().get(t)}function Wn(t,e="project"){let r=Se(t)??rt(t);if(!r)return;let n=e==="global"?r.globalSupport?.capabilities??r.capabilities:r.capabilities;return Yg(n)}function kd(t,e="project"){let r=Se(t)??rt(t);return r?e==="global"?r.globalSupport?.detectionPaths??[]:r.detectionPaths:[]}function _t(t,e="project"){let r=Se(t)??rt(t);if(r)return e==="global"?r.globalSupport?.layout:r.project}function FD(t,e="project"){return _t(t,e)?.rootInstructionPath}function Oa(t,e="project"){return _t(t,e)?.skillDir}function Ed(t,e="project"){return _t(t,e)?.managedOutputs}function wd(t,e,r="project"){let n=_t(t,r);return n?n.rewriteGeneratedPath?n.rewriteGeneratedPath(e):e:null}function gk(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?!cs(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?!ae(r,t.id,true,n):false}function vD(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?cs(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?ae(r,t.id,true,n):false}function Dc(t,e,r,n="project"){let o=Wn(t,n)?.[e]?.level??"none",s=Se(t)??rt(t);return o==="none"&&vD(s,e,r,n)?"embedded":o!=="embedded"?o:gk(s,e,r,n)?"none":o}function si(t,e,r,n="project"){let o=Se(t)??rt(t);if(!o?.generators||gk(o,e,r,n))return;let s=$D[e];return s===null?void 0:s(o.generators)}var xt,Rd,$D,it=f(()=>{ms();ro();wr();Tm();br();Hm();bp();$I();R_();Qp();iu();Cu();Uu();Wu();Hu();Zu();td();rd();id();fk();xt=[pl,Tl,vI,O_,Hl,ql,ac,hc,yc,_c,Rc,Ec,wc,Ac,dk];i(DD,"builtinTargetsMap");i(Se,"getBuiltinTargetDefinition");i(Wn,"getTargetCapabilities");i(kd,"getTargetDetectionPaths");i(_t,"getTargetLayout");i(FD,"getTargetPrimaryRootInstructionPath");i(Oa,"getTargetSkillDir");i(Ed,"getTargetManagedOutputs");i(wd,"rewriteGeneratedOutputPath");i(gk,"isFeatureSuppressedByConversion");i(vD,"isConversionUpgrading");i(Dc,"getEffectiveTargetSupportLevel");$D={rules:i(t=>t.generateRules,"rules"),additionalRules:null,commands:i(t=>t.generateCommands,"commands"),agents:i(t=>t.generateAgents,"agents"),skills:i(t=>t.generateSkills,"skills"),mcp:i(t=>t.generateMcp,"mcp"),permissions:i(t=>t.generatePermissions,"permissions"),hooks:i(t=>t.generateHooks,"hooks"),ignore:i(t=>t.generateIgnore,"ignore")};i(si,"resolveTargetFeatureGenerator");});function BD(t){return typeof t=="string"?t:t.level}function hk(t){return WD.includes(t)}function yk(t,e,r,n){for(let o of KD){let s=BD(e[o.feature]);if(s==="none")continue;let a=typeof t.generators[o.generator]=="function",l=hk(o.feature)&&typeof t.emitScopedSettings=="function";a||l||r.addIssue({code:"custom",path:[...n,o.feature],message:`Capability "${o.feature}" is "${s}" but generators.${o.generator}`+(hk(o.feature)?" or emitScopedSettings":"")+" is missing."});}}function Fc(t){return zD.parse(t)}var ln,Ik,MD,GD,_k,jD,UD,KD,WD,HD,zD,Ld=f(()=>{ln=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()})]),Ik=z$1.object({rules:ln,additionalRules:ln,commands:ln,agents:ln,skills:ln,mcp:ln,hooks:ln,ignore:ln,permissions:ln}),MD=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(),GD=z$1.object({rulePath:z$1.function(),commandPath:z$1.function(),agentPath:z$1.function()}),_k=z$1.object({paths:GD}).passthrough(),jD=z$1.object({capabilities:Ik,detectionPaths:z$1.array(z$1.string()),layout:_k,scopeExtras:z$1.function().optional()}).passthrough(),UD=["global","globalCapabilities","globalDetectionPaths","generateScopeExtras"],KD=[{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"}],WD=["mcp","hooks","ignore","permissions"];i(BD,"capabilityLevel");i(hk,"canUseScopedSettings");i(yk,"validateCapabilityImplementations");HD=z$1.object({id:z$1.string().regex(/^[a-z][a-z0-9-]*$/,"Target id must be lowercase with hyphens"),generators:MD,capabilities:Ik,emptyImportMessage:z$1.string(),lintRules:z$1.union([z$1.function(),z$1.null()]),project:_k,globalSupport:jD.optional(),buildImportPaths:z$1.function(),detectionPaths:z$1.array(z$1.string())}).passthrough(),zD=HD.superRefine((t,e)=>{for(let r of UD)r in t&&e.addIssue({code:"custom",path:[r],message:`Use globalSupport instead of legacy field "${r}".`});yk(t,t.capabilities,e,["capabilities"]),t.globalSupport!==void 0&&yk(t,t.globalSupport.capabilities,e,["globalSupport","capabilities"]);});i(Fc,"validateDescriptor");});function VD(){return Ad||(Ad=new Map(xt.map(t=>[t.id,t]))),Ad}function Ck(t){let e=Fc(t);Sk.set(e.id,e);}function rt(t){return Sk.get(t)??VD().get(t)}var Sk,Ad,wr=f(()=>{it();Ld();Sk=new Map;i(VD,"builtinDescriptors");i(Ck,"registerTargetDescriptor");i(rt,"getDescriptor");});async function Ok(t,e,r="project"){let n=new Map,o=rt(t);return o&&await o.buildImportPaths(n,e,r),n}var Rk=f(()=>{wr();i(Ok,"buildImportReferenceMap");});function XD(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 s=o.split("/")[0];s&&s.startsWith(".")&&s.length>1&&n.add(`${s}/`);}return n}function ZD(){let t=new Set([".agentsmesh/"]);for(let e of xt)for(let r of XD(e))t.add(r);return Array.from(t)}function qD(){let t=new Set([...ZD(),...bd.rootRelativePrefixes]),e=new Set([...YD,...bd.meshRootSegments]);return {protectedSchemes:[...JD,...bd.protectedSchemes],rootRelativePrefixes:Array.from(t),meshRootSegments:e}}function vc(){return Pd||(Pd=qD()),Pd}var JD,YD,bd,Pd,kk=f(()=>{it();JD=[/\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],YD=new Set(["skills","rules","commands","agents","packs"]),bd={protectedSchemes:[],rootRelativePrefixes:[],meshRootSegments:[]};i(XD,"topLevelDotfilePrefixes");i(ZD,"buildDefaultRootRelativePrefixes");i(qD,"rebuild");i(vc,"getLinkFormatRegistry");});function Ye(t){let e=ot(t);return vc().rootRelativePrefixes.some(r=>e.startsWith(r))}function tF(t){let e=ot(t).replace(/^\.\//,"");if(e.startsWith("../")||e.startsWith("/")||Le.test(e)||/^[a-zA-Z]:/.test(e)||Ye(e))return false;let r=e.split("/").filter(n=>n.length>0)[0];return r!==void 0&&vc().meshRootSegments.has(r)}function Ra(t,e,r){let n=H(e),o=G(e,e),s=G(e,r),a=ot(t);if(Le.test(t)){let l=G(e,t);return n===win32||l.startsWith(`${o}${n.sep}`)?[l]:[l]}if(n.isAbsolute(t)){let l=G(e,t);return l.startsWith(o)||existsSync(t)?[l]:[G(e,n.join(e,t))]}if(a.startsWith("./")||a.startsWith("../")){let l=G(e,n.join(n.dirname(s),a)),c=Hg(a,o);return c&&c!==l?[l,c]:[l]}if(Ye(a))return [G(e,n.join(o,a))];if(a.includes("/")){let l=G(e,n.join(o,".agentsmesh")),c=tF(a)?G(e,n.join(l,a)):null,m=G(e,n.join(o,a)),p=G(e,n.join(n.dirname(s),a));return c!==null?[c,m,p]:[m,p]}return eF.has(a)?[]:a.includes(".")?[G(e,n.join(n.dirname(s),a))]:[]}function ka(t,e){let r=[e];if(!Bg(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 Ak(t,e,r){let n=e>0?t.at(e-1):"",o=r<t.length?t.at(r):"";return n==="*"||o==="*"}function $c(t){let e=[];for(let r of vc().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(rF))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(nF))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(oF))e.push([r.index??0,(r.index??0)+r[0].length]);return e}var eF,rF,nF,oF,Lk,ii,Vn=f(()=>{Pt();kk();i(Ye,"isRootRelativePathToken");i(tF,"isMeshRootRelativePathToken");eF=new Set(["AGENTS.md","CLAUDE.md","GEMINI.md","codex.md",".windsurfrules",".cursorrules"]),rF=/^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm,nF=/<!-- agentsmesh:root-generation-contract:start -->[\s\S]*?<!-- agentsmesh:root-generation-contract:end -->/g,oF=/<!-- agentsmesh:embedded-rules:start -->[\s\S]*?<!-- agentsmesh:embedded-rules:end -->/g,Lk=/(?:\.\.[\\/]|\.\/|\.\\|\/[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,ii=/(?::(\d+)){1,2}$/;i(Ra,"resolveProjectPath");i(ka,"expandResolvedPaths");i(Ak,"isGlobAdjacent");i($c,"protectedRanges");});function sF(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 bk(t){return sF(t.tokenContext)}function xd(t,e){let r=H(t),n=G(t,t),o=G(t,e);if(o===n)return true;let s=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(s)}function Pk(t){let e=H(t);return G(t,e.join(t,".agentsmesh"))}function Xe(t,e){let r=H(t),n=Pk(t),o=G(t,e);if(o===n)return true;let s=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(s)}function xk(t,e,r){let n=H(t),o=Pk(t),s=G(t,e);if(!Xe(t,s))return null;let a=n.relative(o,s).replace(/\\/g,"/");return a.startsWith("..")||a.length===0?null:r&&!a.endsWith("/")?`${a}/`:a}function Td(t,e,r){let o=H(t).relative(G(t,t),G(t,e)).replace(/\\/g,"/");if(o.startsWith(".."))return null;let s=o.length>0?o:".";return r&&!s.endsWith("/")?`${s}/`:s}function ai(t,e,r){let n=Td(t,e,r);return n===null?null:{kind:"projectRoot",rest:n,text:n}}function Nd(t,e,r,n,o){let s=H(t),a=G(t,t),l=G(t,e),c=G(t,r);if(!xd(t,c))return ai(t,c,n)?.text??null;let m=G(t,s.dirname(l));if(!xd(t,m)&&m!==a)return ai(t,c,n)?.text??null;let p=s.relative(m,c).replace(/\\/g,"/");if(s.isAbsolute(p)||Le.test(p))return Td(t,c,n);let u=G(t,s.join(m,p));return xd(t,u)?(p===""||p==="."?p=".":o.explicitCurrentDirLinks===true&&m!==a&&!p.startsWith("../")&&!p.startsWith("./")&&(p=`./${p}`),n&&!p.endsWith("/")?`${p}/`:p):Td(t,c,n)}var Dd=f(()=>{Pt();i(sF,"isReadingContext");i(bk,"isReadingContextOptions");i(xd,"isUnderProjectRoot");i(Pk,"agentsMeshRoot");i(Xe,"isUnderAgentsMesh");i(xk,"toAgentsMeshRootRelative");i(Td,"toProjectRootRelative");i(ai,"toProjectRootReference");i(Nd,"formatLinkPathForDestinationLegacy");});function Tk(t,e,r,n,o={}){let s=o.scope??"project",a=G(t,r);if(bk(o)&&Xe(t,e)&&Xe(t,a)){let m=H(t),p=G(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 Nd(t,e,r,n,o);if(s==="global"&&!Xe(t,e))return ai(t,a,n)?.text??null;let l=(()=>{if(Xe(t,a))return a;let m=o.logicalMeshSourceAbsolute;return m&&Xe(t,G(t,m))?G(t,m):null})();if(!l)return ai(t,a,n)?.text??null;if(n||(o.pathIsDirectory?.(a)??false)){let m=xk(t,l,n);return m!==null?m:ai(t,l,n)?.text??null}return Nd(t,e,r,n,o)}var Nk=f(()=>{Vn();Pt();Dd();Dd();i(Tk,"formatLinkPathForDestination");});function Dk(t,e,r,n){let o=H(e),s=ot(t);if(!Ye(s))return null;let a=s.split("/").filter(m=>m.length>0);if(a.length<3)return null;let l=G(e,r),c=o.dirname(l);for(let m=1;m<=a.length-1;m++){let p=a.slice(m).join("/"),u=G(e,o.join(c,p));if(u!==l&&n(u))return u}return null}var Fk=f(()=>{Pt();Vn();i(Dk,"resolveByDestinationSuffixStrip");});function vk(t){let e=null,r=false,n=null,o=null,s=null;for(let c of Ra(t.candidate,t.projectRoot,t.sourceFile)){let m=null,p=null;for(let u of ka(t.projectRoot,c)){let d=G(t.projectRoot,u),g=G(t.projectRoot,t.translatePath(d)),h=t.pathExists(d),C=t.pathExists(g);if(C&&g!==d){e=g,n=d,r=true;break}(h||C)&&m===null&&(m=g,p=d),e===null&&(e=g);}if(!r&&m!==null&&o===null&&(o=m,s=p),r)break}if(!r){let c=Dk(t.candidate,t.projectRoot,t.destinationFile,t.pathExists);c!==null&&(e=c,r=true);}!r&&o!==null&&(e=o,s!==null&&(n=s),r=true);let a=ot(t.destinationFile),l=a.includes("/.agentsmesh/")||a.startsWith(".agentsmesh/");return !r&&e!==null&&ot(t.rawToken).startsWith(".agentsmesh/")&&l&&(r=true),{translatedPath:e,resolvedBeforeTranslate:n,matchedPath:r}}var $k=f(()=>{Pt();Vn();Fk();i(vk,"resolveLinkTarget");});function Mk(t,e,r){return e>=2&&t[e-2]==="~"&&t[e-1]==="/"?true:e>=1&&t[e-1]==="~"&&r.startsWith("/")}function Gk(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 jk(t){let e=ot(t);return e.startsWith("./")||e.startsWith("../")?true:e.startsWith("/")||Le.test(e)||Ye(e)?false:e.includes("/")}var Uk=f(()=>{Pt();Vn();i(Mk,"isTildeHomeRelativePathToken");i(Gk,"isMarkdownLinkDestinationToken");i(jk,"isRelativePathToken");});function iF(t,e,r){let n=e+r.length;if(t[n]!=="]"||t[n+1]!=="(")return false;let o=n+2,s="";for(;o<t.length;){let a=t[o];if(a===")"||a==="#"||a==="?"||a===" "||a===" "||a===`
|
|
122
|
-
`)break;
|
|
123
|
-
`,e-1)+1,o=t.slice(n,e);if(!/^\s*\[[^\]\n]+\]:\s*<?\s*$/.test(o))return false;let
|
|
124
|
-
`||s==="\r"||s===">"||s===" "||s===" "||s==='"'||s==="'"||s===":"||s==="#"||s==="?"}function Wk(t,e,r){let n=e>0?t[e-1]:"",o=r<t.length?t[r]:"";return n==="`"&&o==="`"?{role:"inline-code"}:Kk(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 Bk(t,e,r,n,o){if(e<0||r>t.length)return false;let{candidate:s}=ls(n),a=s.replace(ii,""),l=ot(a),c=e+a.length,m=t[e-1],p=t[r];return Kk(t,e,c)||m==="'"&&p==="'"||m==='"'&&p==='"'||m==="`"&&p==="`"||m==="<"&&p===">"?true:m==="["&&p==="]"?!(!o&&!Ye(l)&&iF(t,e,n)):m==="@"?true:m==="("?p===")"||p==="#"||p==="?"||p===" "||p===" ":o?Ye(l)?true:l.includes("/")||l.includes("\\")?l.startsWith("./")||l.startsWith("../")?true:(l.split(/[\\/]/).filter(Boolean).at(-1)??"").includes("."):false:false}var Hk=f(()=>{Pt();Vn();i(iF,"markdownBracketLabelDuplicatesDestination");i(Kk,"isMarkdownReferenceDefinitionDestination");i(Wk,"getTokenContext");i(Bk,"shouldRewritePathToken");});function Mc(t){let e=new Set,r=$c(t.content);return {content:t.content.replace(Lk,(o,s,a)=>{if(r.some(([St,Xt])=>s>=St&&s<Xt)||!Bk(a,s,s+o.length,o,t.rewriteBarePathTokens===true)||Mk(a,s,o)||Ak(a,s,s+o.length))return o;let{candidate:l,suffix:c}=ls(o);if(!l)return o;let m=ii.exec(l),p=m?l.slice(0,m.index):l,u=m?m[0]:"";if(!p)return o;let d=Wk(a,s,s+p.length);if(d.role!=="markdown-link-dest"&&Le.test(p))return o;let{translatedPath:g,resolvedBeforeTranslate:h,matchedPath:C}=vk({candidate:p,rawToken:l,projectRoot:t.projectRoot,sourceFile:t.sourceFile,destinationFile:t.destinationFile,translatePath:t.translatePath,pathExists:t.pathExists}),O=h;if(!C||!g)return g&&e.add(g),o;let _=ot(p),k=p.endsWith("/")||t.pathIsDirectory?.(g)===true;if(k&&!_.includes("/")&&!_.includes("\\"))return o;if(O===null){let St=ot(l);if(St.startsWith("agentsmesh/")&&(St=`.${St}`),St.startsWith(".agentsmesh/")||St.includes("/.agentsmesh/")){let Xt=H(t.projectRoot),za=G(t.projectRoot,t.projectRoot),se=St.replace(/^\.\//,"");O=G(t.projectRoot,Xt.join(za,se));}}let D=H(t.projectRoot);if(t.scope==="global"){let St=ot(l),Xt=St.startsWith(".agentsmesh/")||St.includes("/.agentsmesh/"),za=Ye(St)||jk(St),se=O!==null&&Xe(t.projectRoot,O),Hf=Xe(t.projectRoot,g);if(O===g&&!Hf&&!se&&!Xt){let zf=ot(D.relative(t.projectRoot,G(t.projectRoot,t.sourceFile))).split("/").filter(Boolean)[0]??"",qL=(O!==null?ot(D.relative(t.projectRoot,O)):"").split("/").filter(Boolean)[0]??"";if(zf.length>0&&zf===qL)return o}if(!za&&!Xt&&!se&&!Hf)return o}let b=G(t.projectRoot,t.destinationFile),P=G(t.projectRoot,g),J=ot(D.relative(t.projectRoot,b)),j=ot(D.relative(t.projectRoot,P)),W=J.split("/").filter(Boolean)[0]??"",nt=j.split("/").filter(Boolean)[0]??"",Yt=!ot(p).startsWith(".agentsmesh/")&&!k&&W.length>0&&W===nt&&W.startsWith(".")&&W!==".agentsmesh"||d.role==="markdown-link-dest"||Gk(a,s,p),pt=Tk(t.projectRoot,t.destinationFile,g,p.endsWith("/"),{explicitCurrentDirLinks:t.explicitCurrentDirLinks===true||Yt,scope:t.scope??"project",pathIsDirectory:t.pathIsDirectory,logicalMeshSourceAbsolute:k?null:O,forceRelative:Yt,tokenContext:d,originalToken:p});return pt?`${pt}${u}${c}`:o}),missing:[...e]}}var Fd=f(()=>{Pt();Vn();Nk();$k();Uk();Hk();i(Mc,"rewriteFileLinks");});function Vk(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 s=t.normalize(o);r.includes(s)||r.push(s);}}catch{}return r}async function z(t,e,r="project"){let n=H(e),o=new Map,s=Array.from(new Set([t,...Ot]));for(let c of s){let m=await Ok(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 Vk(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 Vk(n,m))l.add(n.normalize(p));}return (c,m,p)=>Mc({content:c,projectRoot:e,sourceFile:m,destinationFile:p,translatePath:i(u=>a.get(u)??u,"translatePath"),pathExists:i(u=>{let d=n.normalize(u);return a.has(u)||a.has(d)||existsSync(u)||l.has(d)},"pathExists"),explicitCurrentDirLinks:false,rewriteBarePathTokens:true,scope:r,pathIsDirectory:i(u=>{try{return statSync(u).isDirectory()}catch{return false}},"pathIsDirectory")}).content}var Ct=f(()=>{Pt();Rk();Fd();br();i(Vk,"pathVariants");i(z,"createImportReferenceNormalizer");});function Yk(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let s of n){if(!s||typeof s!="object")continue;let a=s,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(!Ze({...m,type:p}))continue;let u=p==="prompt"?Gt(m)||gt(m):gt(m)||Gt(m),d={matcher:l,type:p,command:u};typeof m.timeout=="number"&&(d.timeout=m.timeout),o.push(d);}}o.length>0&&(e[r]=o);}return e}async function Xk(t,e){let r=join(t,vr),n=await I(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 s=Yk(o);if(Object.keys(s).length===0)return false;let a=stringify(s),l=join(t,ao);return await R(dirname(l)),await S(l,a),e.push({fromTool:"claude-code",fromPath:r,toPath:ao,feature:"hooks"}),true}async function Zk(t,e){let r=e.some(m=>m.feature==="hooks"&&m.fromPath.replace(/\\/g,"/").endsWith(vr)),n=join(t,Gi),o=await I(n);if(!o)return;let s;try{s=JSON.parse(o);}catch{return}if(!e.some(m=>m.feature==="mcp")&&s.mcpServers&&typeof s.mcpServers=="object"){let m=s.mcpServers;await pe(t,Wi,m),e.push({fromTool:"claude-code",fromPath:n,toPath:Wi,feature:"mcp"});}let l=s.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"):[],d=Array.isArray(m.ask)?m.ask.filter(g=>typeof g=="string"):[];if(p.length>0||u.length>0||d.length>0){let g=stringify({allow:p,deny:u,ask:d}),h=join(t,qm);await R(dirname(h)),await S(h,g),e.push({fromTool:"claude-code",fromPath:n,toPath:qm,feature:"permissions"});}}let c=s.hooks;if(!r&&c&&typeof c=="object"&&!Array.isArray(c)){let m=Yk(c);if(Object.keys(m).length>0){let p=stringify(m),u=join(t,ao);await R(dirname(u)),await S(u,p),e.push({fromTool:"claude-code",fromPath:n,toPath:ao,feature:"hooks"});}}}var qk=f(()=>{we();A();io();$r();i(Yk,"claudeHooksToCanonical");i(Xk,"importClaudeHooksJson");i(Zk,"importSettings");});async function tE(t,e,r){let n=join(t,Mi),o=join(t,Zm),a=(await x(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 x(c);for(let d of u){let g=await I(d);if(g===null)continue;let h=relative(c,d),C=join(p,h);await R(dirname(C));let O=r(g,d,C),_=h==="SKILL.md"?E(O):null;await S(C,h==="SKILL.md"?await tr(C,_?.frontmatter??{},_?.body??""):O);let k=`${Zm}/${m}/${h}`;e.push({fromTool:"claude-code",fromPath:d,toPath:k,feature:"skills"});}}}var eE=f(()=>{A();v();Y();$r();i(tE,"importClaudeSkills");});async function Nl(t,e={}){let r=e.scope??"project",n=[],o=await z("claude-code",t,r);return n.push(...await et(Tl,t,r,{normalize:o})),await tE(t,n,o),await Xk(t,n),await Zk(t,n),n}var Pp=f(()=>{Ct();qt();qk();eE();bp();i(Nl,"importFromClaudeCode");});function Jf(t){let e=Object.keys(t);return {async route(r,n,o){let s=t[r];if(s){await s(n,o);return}throw new Error(`Unknown command "${r}". Available: ${e.join(", ")}`)},commands:i(()=>[...e],"commands")}}i(Jf,"createRouter");var ts={green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",reset:"\x1B[0m"};function tA(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}i(tA,"noColor");function yi(t,e){return tA()?e:`${t}${e}${ts.reset}`}i(yi,"c");function eA(t,e){let r=[...t].length;return t+" ".repeat(Math.max(0,e-r))}i(eA,"pad");var y={info(t){process.stdout.write(yi(ts.cyan,t)+`
|
|
125
|
-
`);},warn(t){process.stderr.write(yi(ts.yellow,"\u26A0 ")+t+`
|
|
126
|
-
`);},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
`)
|
|
130
|
-
`);
|
|
131
|
-
`)
|
|
132
|
-
`);}};var
|
|
133
|
-
`)}
|
|
125
|
+
${f}`:u,h={};p&&(h.description=p),typeof l.name=="string"&&l.name.length>0&&(h.name=l.name);let R=await Et(m,h,g),S=r(R,n,m);await C(m,S),e.push({feature:"agents",fromTool:Yt,fromPath:n,toPath:`${qo}/${c}.md`});}}async function cm(t,e={}){let r=e.scope??"project",n=[],o=await B(Yt,t,r);return n.push(...await q(mm,t,r,{normalize:o})),await gt(t,Ye,Yt,n,o),r==="project"&&(await kv(t,n,o),await Ev(t,n,o),await Lv(t,n,o),await gt(t,Jo,Yt,n,o)),n}var nf,of,sf=d(()=>{yt();ht();We();Wt();A();Z();v();rf();Qo();af();nf=`${to}/_root.md`,of="00-root.md";s(Ak,"pathExists");s(kv,"importLegacyRules");s(Ev,"importLegacyWorkflows");s(Lv,"importLegacyModes");s(cm,"importFromKiloCode");});function xk(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Yt}))}var bk=d(()=>{Nt();Qo();s(xk,"lintRules");});function Pk(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","kilo-code","kilo-code does not support user-defined lifecycle hooks; canonical hooks are not projected.")]:[]:[]}function Tk(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?[]:[$(".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 Dk=d(()=>{Lt();s(Pk,"lintHooks");s(Tk,"lintPermissions");});var wv,Av,xv,Nk,mm,af=d(()=>{Lk();Qo();ae();sf();rf();bk();Dk();At();wv={name:Yt,primaryRootInstructionPath:br,generateRules:Ck,generateCommands:Sk,generateAgents:Rk,generateSkills:Ek,generateMcp:Ok,generateIgnore:kk,importFrom:cm},Av={rootInstructionPath:br,skillDir:Ye,managedOutputs:{dirs:[gn,hn,yn,Ye],files:[br,Zn,si]},paths:{rulePath(t,e){return `${gn}/${t}.md`},commandPath(t,e){return `${hn}/${t}.md`},agentPath(t,e){return `${yn}/${t}.md`}}},xv={rootInstructionPath:qn,skillDir:Qn,managedOutputs:{dirs:[Yo,Xo,Zo,Qn,UI],files:[qn,li,uc]},rewriteGeneratedPath(t){return t===br?qn:t},mirrorGlobalPath(t,e){return ot(t,Qn,e)},paths:{rulePath(t,e){return `${Yo}/${t}.md`},commandPath(t,e){return `${Xo}/${t}.md`},agentPath(t,e){return `${Zo}/${t}.md`}}},Nk={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},mm={id:Yt,generators:wv,capabilities:Nk,emptyImportMessage:"No Kilo Code config found (AGENTS.md, .kilo/rules, .kilo/commands, .kilo/agents, .kilo/skills, .kilo/mcp.json, .kilocodeignore, .kilocode/, or .kilocodemodes).",lintRules:xk,lint:{hooks:Pk,permissions:Tk},project:Av,globalSupport:{capabilities:Nk,detectionPaths:[qn,Yo,Xo,Zo,Qn,li,uc],layout:xv},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[br],global:[qn]},canonicalDir:to,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[gn],global:[Yo]},canonicalDir:to,extensions:[".md"],map:am}],commands:{feature:"commands",mode:"directory",source:{project:[hn],global:[Xo]},canonicalDir:ci,extensions:[".md"],map:lm},agents:{feature:"agents",mode:"directory",source:{project:[yn],global:[Zo]},canonicalDir:qo,extensions:[".md"],map:wk},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Zn,Fa],global:[li]},canonicalDir:".agentsmesh",canonicalFilename:KI},ignore:{feature:"ignore",mode:"flatFile",source:{project:[si],global:[uc]},canonicalDir:".agentsmesh",canonicalFilename:WI}},buildImportPaths:Ou,detectionPaths:[gn,hn,yn,Ye,Zn,Vo,ii,Jo,Fa,pc,si,"kilo.jsonc","kilo.json"]};});function Fk(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function Tv(t){return t.type==="prompt"?t.prompt:t.command}function Dv(t,e){let r=vk[t];return t==="PreToolUse"||t==="PostToolUse"?{type:r,tools:[e||"*"]}:{type:r}}function Mk(t){let e=[];for(let[r,n]of Object.entries(t)){let o=r;if(!(o in vk)||!Array.isArray(n))continue;let i=1;for(let a of n){let l=Tv(a);if(!l)continue;let c={name:`${Fk(r)} ${i}`,version:"1",when:Dv(o,a.matcher),then:a.type==="prompt"?{type:"askAgent",prompt:l}:{type:"shellCommand",command:l}};e.push({name:`${Fk(r)}-${i}.kiro.hook`,content:JSON.stringify(c,null,2)}),i+=1;}}return e}function Nv(t){let e=Pv.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 Gk(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:Nv(r)}function $k(t){return stringify(t).trimEnd()}var vk,Pv,lf=d(()=>{vk={UserPromptSubmit:"promptSubmit",SubagentStop:"agentStop",PreToolUse:"preToolUse",PostToolUse:"postToolUse"},Pv=new Map([["promptSubmit","UserPromptSubmit"],["agentStop","SubagentStop"],["preToolUse","PreToolUse"],["postToolUse","PostToolUse"]]);s(Fk,"toKebab");s(Tv,"hookText");s(Dv,"toWhen");s(Mk,"generateKiroHooks");s(Nv,"toCanonicalEntry");s(Gk,"parseKiroHookFile");s($k,"serializeCanonicalHooks");});function vv(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 jk(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Xe,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(ce))continue;let o=basename(n.source,".md");e.push({path:`${Ze}/${o}.md`,content:N(vv(n),n.body.trim()||"")});}return e}function Uk(t){return t.commands.map(e=>({path:`${Xt}/${nt(e.name)}/SKILL.md`,content:gr(e)}))}function Kk(t){return _t(t,Xt)}function Wk(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:mi,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function Bk(t){return !t.hooks||Object.keys(t.hooks).length===0?[]:Mk(t.hooks).map(e=>({path:`${eo}/${e.name}`,content:e.content}))}function Hk(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=N(r,e.body.trim()||"");return {path:`${qe}/${e.name}.md`,content:n}})}function zk(t){return t.ignore.length===0?[]:[{path:pi,content:t.ignore.join(`
|
|
126
|
+
`)}]}var Vk=d(()=>{ht();Qt();v();lf();ui();s(vv,"steeringFrontmatter");s(jk,"generateRules");s(Uk,"generateCommands");s(Kk,"generateSkills");s(Wk,"generateMcp");s(Bk,"generateHooks");s(Hk,"generateAgents");s(zk,"generateIgnore");});function Gv(t){let e=typeof t.inclusion=="string"?t.inclusion:"",r={root:false,description:typeof t.description=="string"?t.description:void 0,globs:nn(t.fileMatchPattern)};return e==="manual"&&(r.trigger="manual"),e==="auto"&&(r.trigger="model_decision"),e==="fileMatch"&&(r.trigger="glob"),r}async function $v(t,e,r,n){let o=n==="global"?[Qe,Xe]:[Xe,Qe];for(let i of o){let a=join(t,i),l=await y(a);if(l===null)continue;let c=join(t,ku),{frontmatter:m,body:p}=k(r(l,a,c));await C(c,await G(c,{...m,root:true},p)),e.push({fromTool:ce,fromPath:a,toPath:ku,feature:"rules"});return}}async function jv(t,e,r){let n=join(t,Eu);e.push(...await it({srcDir:join(t,Ze),destDir:n,extensions:[".md"],fromTool:ce,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}=k(i(a));return {destPath:a,toPath:`${Eu}/${o}`,feature:"rules",content:await G(a,Gv(l),c)}},"mapEntry")}));}async function Uv(t,e){let r={};for(let o of await D(join(t,eo))){if(!o.endsWith(".kiro.hook"))continue;let i=Gk(await y(o)??"");i&&(r[i.event]??=[],r[i.event].push(i.entry));}if(Object.keys(r).length===0)return;let n=join(t,Lu);await O(join(t,".agentsmesh")),await C(n,$k(r)),e.push({fromTool:ce,fromPath:join(t,eo),toPath:Lu,feature:"hooks"});}async function pm(t,e={}){let r=e.scope??"project",n=[],o=await B(ce,t,r);return await $v(t,n,o,r),await jv(t,n,o),n.push(...await q(um,t,r,{normalize:o})),await gt(t,Xt,ce,n,o),r==="project"&&await Uv(t,n),n}var cf=d(()=>{yt();ht();We();Wt();Z();Ke();A();v();lf();ui();mf();s(Gv,"canonicalRuleMeta");s($v,"importRoot");s(jv,"importNonRootRules");s(Uv,"importHooks");s(pm,"importFromKiro");});function Jk(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:ce}))}var Yk=d(()=>{Nt();ui();s(Jk,"lintRules");});function Xk(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=>Vs(n,"kiro",e,{unsupportedBy:"Kiro hooks"}))}var Zk=d(()=>{Lt();s(Xk,"lintHooks");});var Kv,Wv,Bv,Hv,um,mf=d(()=>{Qt();Vk();ae();cf();Yk();Zk();At();ui();Kv={name:ce,primaryRootInstructionPath:Xe,generateRules:jk,generateCommands:Uk,generateAgents:Hk,generateSkills:Kk,generateMcp:Wk,generateHooks:Bk,generateIgnore:zk,importFrom:pm},Wv={rootInstructionPath:Xe,skillDir:Xt,managedOutputs:{dirs:[".kiro/hooks",".kiro/skills",".kiro/steering",".kiro/agents"],files:["AGENTS.md",".kiro/settings/mcp.json",".kiroignore"]},paths:{rulePath(t,e){return `${Ze}/${t}.md`},commandPath(t){return `${Xt}/${nt(t)}/SKILL.md`},agentPath(t,e){return `${qe}/${t}.md`}}},Bv={rootInstructionPath:Qe,skillDir:ro,managedOutputs:{dirs:[ts,ro,es,zI],files:[Qe,Ma,Ga]},rewriteGeneratedPath(t){return t===Xe?Qe:t.startsWith(`${Ze}/`)?t.replace(`${Ze}/`,`${ts}/`):t.startsWith(`${Xt}/`)?t.replace(`${Xt}/`,`${ro}/`):t.startsWith(`${qe}/`)?t.replace(`${qe}/`,`${es}/`):t===mi?Ma:t===pi?Ga:t.startsWith(`${eo}/`)?null:t},mirrorGlobalPath(t,e){return ot(t,".kiro/skills",e)},paths:{rulePath(t,e){return `${ts}/${t}.md`},commandPath(t){return `${Xt}/${nt(t)}/SKILL.md`},agentPath(t,e){return `${es}/${t}.md`}}},Hv={rules:"native",additionalRules:"native",commands:"none",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},um={id:ce,generators:Kv,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:Jk,lint:{hooks:Xk},project:Wv,globalSupport:{capabilities:Hv,detectionPaths:[ts,Qe,ro,es,Ma,Ga],layout:Bv},importer:{agents:{feature:"agents",mode:"directory",source:{project:[qe],global:[qe]},canonicalDir:VI,extensions:[".md"],preset:"agent"},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[mi],global:[Ma]},canonicalDir:".agentsmesh",canonicalFilename:JI},ignore:{feature:"ignore",mode:"flatFile",source:{project:[pi],global:[Ga]},canonicalDir:".agentsmesh",canonicalFilename:YI}},buildImportPaths:wu,detectionPaths:[Ze,Xt,qe,eo,mi,pi]};});function Qk(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:Pr,content:r.body.trim()?r.body:""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(tr))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?N(i,n.body.trim()||""):n.body.trim()||"";e.push({path:`${In}/${o}.md`,content:a});}return e}function tE(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${_n}/${e.name}.md`,content:N(r,e.body.trim()||"")}})}function eE(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:`${Cn}/${r}.md`,content:N(n,e.body.trim()||"")}})}function zv(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 rE(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]=zv(n);return [{path:Tr,content:JSON.stringify({mcp:e},null,2)}]}function nE(t){return _t(t,er)}var oE=d(()=>{ht();v();ss();s(Qk,"generateRules");s(tE,"generateCommands");s(eE,"generateAgents");s(zv,"toOpenCodeMcpServer");s(rE,"generateMcp");s(nE,"generateSkills");});function pf(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 Jv(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:pf(a.headers),env:pf(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:pf(a.environment),...typeof a.description=="string"?{description:a.description}:{}};}}return n}async function Yv(t,e,r){let o=join(t,e==="global"?so:Tr),i=await y(o);if(i===null)return;let a=Jv(i);Object.keys(a).length!==0&&(await Kt(t,Au,a),r.push({feature:"mcp",fromTool:tr,fromPath:o,toPath:Au}));}async function sE(t,e={}){let r=e.scope??"project",n=[],o=await B(tr,t,r);return n.push(...await q(dm,t,r,{normalize:o})),await gt(t,er,tr,n,o),await Yv(t,r,n),n}var iE=d(()=>{yt();ht();Wt();rn();A();ss();uf();s(pf,"toStringRecord");s(Jv,"parseOpenCodeMcp");s(Yv,"importMcp");s(sE,"importFromOpenCode");});var aE,lE,cE,mE=d(()=>{v();Z();ss();aE=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${$a}/${t}`,content:await G(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"opencodeNonRootRuleMapper"),lE=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${fc}/${t}`,content:await et(n,{hasDescription:Object.prototype.hasOwnProperty.call(o,"description"),description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"opencodeCommandMapper"),cE=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${gc}/${t}`,content:await Et(n,o,i)}},"opencodeAgentMapper");});function pE(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:tr}))}var uE=d(()=>{Nt();ss();s(pE,"lintRules");});function dE(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","opencode","opencode hooks are plugin-based (TypeScript/JavaScript); canonical config hooks are not projected.")]:[]:[]}function fE(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?[]:[$(".agentsmesh/permissions.yaml","opencode","opencode permissions live in opencode.json, which agentsmesh does not generate in v1; canonical permissions are not projected.")]}function gE(t){return t.ignore.length===0?[]:[$(".agentsmesh/ignore","opencode","opencode has no dedicated ignore file; canonical ignore patterns are not projected. Configure watcher.ignore in opencode.json manually.")]}var hE=d(()=>{Lt();s(dE,"lintHooks");s(fE,"lintPermissions");s(gE,"lintIgnore");});var Xv,Zv,qv,yE,dm,uf=d(()=>{oE();ss();ae();iE();mE();uE();hE();At();Xv={name:tr,primaryRootInstructionPath:Pr,generateRules:Qk,generateCommands:tE,generateAgents:eE,generateSkills:nE,generateMcp:rE,importFrom:sE},Zv={rootInstructionPath:Pr,skillDir:er,managedOutputs:{dirs:[In,_n,Cn,er],files:[Pr,Tr]},paths:{rulePath(t){return `${In}/${t}.md`},commandPath(t){return `${_n}/${t}.md`},agentPath(t){return `${Cn}/${t}.md`}}},qv={rootInstructionPath:no,skillDir:oo,managedOutputs:{dirs:[rs,ns,os,oo,ZI],files:[no,so]},rewriteGeneratedPath(t){return t===Pr?no:t===Tr?so:t},mirrorGlobalPath(t,e){return ot(t,oo,e)},paths:{rulePath(t){return `${rs}/${t}.md`},commandPath(t){return `${ns}/${t}.md`},agentPath(t){return `${os}/${t}.md`}}},yE={rules:"native",additionalRules:"native",commands:"native",agents:"native",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},dm={id:tr,generators:Xv,capabilities:yE,emptyImportMessage:"No OpenCode config found (AGENTS.md, .opencode/rules, .opencode/commands, .opencode/agents, .opencode/skills, or opencode.json).",lintRules:pE,lint:{hooks:dE,permissions:fE,ignore:gE},project:Zv,globalSupport:{capabilities:yE,detectionPaths:[no,rs,ns,os,oo,so],layout:qv},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[Pr],global:[no]},canonicalDir:$a,canonicalRootFilename:"_root.md",markAsRoot:true},{feature:"rules",mode:"directory",source:{project:[In],global:[rs]},canonicalDir:$a,extensions:[".md"],map:aE}],commands:{feature:"commands",mode:"directory",source:{project:[_n],global:[ns]},canonicalDir:fc,extensions:[".md"],map:lE},agents:{feature:"agents",mode:"directory",source:{project:[Cn],global:[os]},canonicalDir:gc,extensions:[".md"],map:cE}},buildImportPaths:xu,detectionPaths:[In,_n,Cn,er,Tr,"opencode.jsonc"]};});function _E(t){let e=[],r=t.rules.find(n=>n.root);r&&e.push({path:rr,content:r.body.trim()||""});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes(io))continue;let o=basename(n.source,".md");e.push({path:`${Sn}/${o}.md`,content:n.body.trim()||""});}return e}function CE(t){return t.commands.map(e=>{let r={};return e.description&&(r.description=e.description),{path:`${Rn}/${e.name}.md`,content:N(r,e.body.trim()||"")}})}function SE(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:Ua,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}function RE(t){return t.ignore.length===0?[]:[{path:Ka,content:t.ignore.join(`
|
|
127
|
+
`)}]}function OE(t){return _t(t,Dr)}function kE(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:fi,content:stringify({customModes:e})}]}var EE=d(()=>{ht();v();cs();s(_E,"generateRules");s(CE,"generateCommands");s(SE,"generateMcp");s(RE,"generateIgnore");s(OE,"generateSkills");s(kE,"generateAgents");});var fm,wE,ff=d(()=>{v();Z();cs();fm=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{if(t==="00-root.md")return null;let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${ls}/${t}`,content:await G(n,{root:false,description:typeof o.description=="string"?o.description:void 0,globs:Array.isArray(o.globs)?o.globs:void 0},i)}},"rooNonRootRuleMapper"),wE=s(async({relativePath:t,normalizeTo:e,destDir:r})=>{let n=join(r,t),{frontmatter:o,body:i}=k(e(n));return {destPath:n,toPath:`${yc}/${t}`,content:await et(n,{hasDescription:true,description:typeof o.description=="string"?o.description:void 0,hasAllowedTools:false,allowedTools:[]},i)}},"rooCommandMapper");});async function eM(t,e,r){let n=join(t,is),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,ls);for(let l of i)e.push(...await it({srcDir:join(n,l),destDir:a,extensions:[".md"],fromTool:io,normalize:r,mapEntry:s(async({srcPath:c,relativePath:m,content:p,normalizeTo:u})=>{let f=await fm({absolutePath:c,relativePath:m,content:p,destDir:a,normalizeTo:u});return f?{...f,feature:"rules"}:null},"mapEntry")}));}async function AE(t,e={}){let r=e.scope??"project",n=[],o=await B(io,t,r);return n.push(...await q(gm,t,r,{normalize:o})),await eM(t,n,o),await gt(t,Dr,io,n,o),n}var xE=d(()=>{yt();ht();We();Wt();ff();cs();hf();s(eM,"importPerModeRules");s(AE,"importFromRooCode");});function bE(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:io}))}var PE=d(()=>{Nt();cs();s(bE,"lintRules");});function aM(t,e){return t===null?"created":t!==e?"updated":"unchanged"}var sM,iM,lM,cM,mM,gm,hf=d(()=>{A();EE();cs();ae();xE();ff();PE();At();sM={name:"roo-code",primaryRootInstructionPath:rr,generateRules:_E,generateCommands:CE,generateSkills:OE,generateMcp:SE,generateIgnore:RE,generateAgents:kE,importFrom:AE},iM={rootInstructionPath:rr,skillDir:".roo/skills",managedOutputs:{dirs:[".roo/rules",".roo/commands",".roo/skills"],files:[".roo/mcp.json",".rooignore",".roorules",fi]},paths:{rulePath(t,e){return `${Sn}/${t}.md`},commandPath(t,e){return `${Rn}/${t}.md`},agentPath(t,e){return null}}};s(aM,"computeStatus");lM=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 y(join(e,Wa));return [{target:"roo-code",path:Wa,content:i,currentContent:a??void 0,status:aM(a,i)}]},"generateRooGlobalExtras"),cM={rootInstructionPath:co,skillDir:On,managedOutputs:{dirs:[ao,lo,On,QI],files:[co,as,Ba,Wa]},rewriteGeneratedPath(t){return t===rr?co:t===fi?null:t.startsWith(`${Sn}/`)?t.replace(`${Sn}/`,`${ao}/`):t.startsWith(`${Rn}/`)?t.replace(`${Rn}/`,`${lo}/`):t.startsWith(`${Dr}/`)?t.replace(`${Dr}/`,`${On}/`):t===Ua?as:t===Ka?Ba:t},mirrorGlobalPath(t,e){return ot(t,On,e)},paths:{rulePath(t,e){return `${ao}/${t}.md`},commandPath(t,e){return `${lo}/${t}.md`},agentPath(t,e){return null}}},mM={rules:"native",additionalRules:"native",commands:"native",agents:"partial",skills:"native",mcp:"native",hooks:"none",ignore:"native",permissions:"none"},gm={id:"roo-code",generators:sM,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:bE,project:iM,globalSupport:{capabilities:mM,detectionPaths:[ao,lo,On,as,Ba,co,Wa],layout:cM,scopeExtras:lM},importer:{rules:[{feature:"rules",mode:"singleFile",source:{project:[rr,ja],global:[co,rr,ja]},canonicalDir:ls,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:[Sn],global:[ao]},canonicalDir:ls,extensions:[".md"],map:fm}],commands:{feature:"commands",mode:"directory",source:{project:[Rn],global:[lo]},canonicalDir:yc,extensions:[".md"],map:wE},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[Ua],global:[as]},canonicalDir:".agentsmesh",canonicalFilename:t_},ignore:{feature:"ignore",mode:"flatFile",source:{project:[Ka],global:[Ba]},canonicalDir:".agentsmesh",canonicalFilename:e_}},buildImportPaths:bu,detectionPaths:[".roo/rules",".roo/commands",".roo/skills",".roo/mcp.json",".rooignore",".roorules",fi]};});function TE(t){let e=t.rules.find(i=>i.root),r=t.rules.filter(i=>i.root?false:i.targets.length===0||i.targets.includes(Nr)),n=e?.body.trim()??"",o=kt(n,r);return o?[{path:nr,content:o}]:[]}function DE(t){return _t(t,Bt)}function NE(t){return t.commands.map(e=>({path:`${Bt}/${nt(e.name)}/SKILL.md`,content:gr(e)}))}function FE(t){return t.agents.map(e=>({path:`${Bt}/${H(e.name)}/SKILL.md`,content:te(e)}))}function vE(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}]}var ME=d(()=>{ht();Ie();lt();Qt();gi();s(TE,"generateRules");s(DE,"generateSkills");s(NE,"generateCommands");s(FE,"generateAgents");s(vE,"generateMcp");});async function GE(t,e={}){let r=e.scope??"project",n=[],o=await B(Nr,t,r);return n.push(...await q(hm,t,r,{normalize:o})),await gt(t,r==="global"?ee:Bt,Nr,n,o),n}var $E=d(()=>{yt();ht();Wt();gi();yf();s(GE,"importFromWarp");});function jE(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:Nr}))}var UE=d(()=>{Nt();gi();s(jE,"lintRules");});function KE(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","warp","Warp has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function WE(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?[]:[$(".agentsmesh/permissions.yaml","warp","Warp permissions are UI-managed; canonical permissions are not projected.")]}function BE(t){return t.ignore.length===0?[]:[$(".agentsmesh/ignore","warp","Warp has no dedicated ignore file and relies on .gitignore; canonical ignore patterns are not projected.")]}var HE=d(()=>{Lt();s(KE,"lintHooks");s(WE,"lintPermissions");s(BE,"lintIgnore");});var pM,uM,dM,fM,gM,hm,yf=d(()=>{Qt();lt();ME();ae();$E();UE();HE();At();gi();pM={name:Nr,primaryRootInstructionPath:nr,generateRules:TE,generateCommands:NE,generateAgents:FE,generateSkills:DE,generateMcp:vE,importFrom:GE},uM={rootInstructionPath:nr,skillDir:Bt,managedOutputs:{dirs:[Bt],files:[nr,mo]},paths:{rulePath(t){return nr},commandPath(t){return `${Bt}/${nt(t)}/SKILL.md`},agentPath(t){return `${Bt}/${H(t)}/SKILL.md`}}},dM={rootInstructionPath:void 0,skillDir:ee,managedOutputs:{dirs:[ee],files:[]},rewriteGeneratedPath(t){return t.startsWith(`${Bt}/`)?t.replace(`${Bt}/`,`${ee}/`):t},mirrorGlobalPath(t,e){return ot(t,ee,e)},paths:{rulePath(){return ee},commandPath(t){return `${ee}/${nt(t)}/SKILL.md`},agentPath(t){return `${ee}/${H(t)}/SKILL.md`}}},fM={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"native",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},gM={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"native",mcp:"none",hooks:"none",ignore:"none",permissions:"none"},hm={id:Nr,generators:pM,capabilities:fM,emptyImportMessage:"No Warp config found (WARP.md, AGENTS.md, .warp/skills, or .mcp.json).",lintRules:jE,lint:{hooks:KE,permissions:WE,ignore:BE},supportsConversion:{commands:true,agents:true},project:uM,globalSupport:{capabilities:gM,detectionPaths:[ee],layout:dM},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[Pu,nr]},canonicalDir:n_,canonicalRootFilename:"_root.md",markAsRoot:true},mcp:{feature:"mcp",mode:"mcpJson",source:{project:[mo]},canonicalDir:".agentsmesh",canonicalFilename:"mcp.json"}},buildImportPaths:Tu,detectionPaths:[nr,Pu,mo]};});var Br,If,Co,zE,Ai,Hr,xi,bi,VE,So,ar,Pi,_f,Cf,Sf,Rf,Of,kf,Ti,Di,tl,ym,Im,_m,JE,Zt=d(()=>{Br="windsurf",If=".windsurfrules",Co=".windsurf/rules",zE=".windsurfignore",Ai=".codeiumignore",Hr="AGENTS.md",xi=".windsurf/hooks.json",bi=".windsurf/mcp_config.example.json",VE=".windsurf/mcp_config.json",So=".windsurf/workflows",ar=".windsurf/skills",Pi=".agentsmesh/rules",_f=".agentsmesh/commands",Cf=".agentsmesh/agents",Sf=".agentsmesh/skills",Rf=".agentsmesh/ignore",Of=".agentsmesh/hooks.yaml",kf=".agentsmesh/mcp.json",Ti=".codeium/windsurf/memories/global_rules.md",Di=".codeium/windsurf/skills",tl=".codeium/windsurf/global_workflows",ym=".codeium/windsurf/hooks.json",Im=".codeium/windsurf/mcp_config.json",_m=".codeium/.codeiumignore",JE=".agents/skills";});function yM(t){let e=basename(t,".md");return e==="_root"?"root":e}function IM(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 Ef(t){let e=[],r=t.rules.find(n=>n.root);if(!r)return [];e.push({path:Hr,content:r.body.trim()});for(let n of t.rules){if(n.root||n.targets.length>0&&!n.targets.includes("windsurf"))continue;let o=yM(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?N(a,n.body.trim()||""):n.body.trim()||"";e.push({path:`${Co}/${o}.md`,content:l});let c=IM(n.globs);c&&(c!==o&&e.push({path:`${Co}/${c}.md`,content:l}),e.push({path:`${c}/AGENTS.md`,content:n.body.trim()||""}));}return e}var YE=d(()=>{v();Zt();s(yM,"ruleSlug");s(IM,"directoryScopedRuleDir");s(Ef,"generateRules");});function Lf(t){return !t.ignore||t.ignore.length===0?[]:[{path:Ai,content:t.ignore.join(`
|
|
128
|
+
`)}]}var XE=d(()=>{Zt();s(Lf,"generateIgnore");});function wf(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?N(r,e.body.trim()||""):e.body.trim();return {path:`${So}/${e.name}.md`,content:n}})}var ZE=d(()=>{v();Zt();s(wf,"generateCommands");});function Af(t){return t.agents.map(e=>({path:`${ar}/${H(e.name)}/SKILL.md`,content:te(e)}))}var qE=d(()=>{lt();Zt();s(Af,"generateAgents");});function xf(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[{path:bi,content:JSON.stringify({mcpServers:t.mcp.mcpServers},null,2)}]}var QE=d(()=>{Zt();s(xf,"generateMcp");});function _M(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 CM(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=[];for(let i of n){if(!fr(i))continue;let a=Ot(i),l=zt(i),c=i.type==="prompt"?l||a:a||l;c&&o.push({command:c,show_output:true});}o.length>0&&(e[_M(r)]=o);}return e}function bf(t){if(!t.hooks||Object.keys(t.hooks).length===0)return [];let e=CM(t.hooks);return Object.keys(e).length===0?[]:[{path:xi,content:JSON.stringify({hooks:e},null,2)}]}var tL=d(()=>{Me();Zt();s(_M,"windsurfEventName");s(CM,"toWindsurfHooks");s(bf,"generateHooks");});function Pf(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?N(n,r.body.trim()||""):r.body.trim()||"";e.push({path:`${ar}/${r.name}/SKILL.md`,content:o});for(let i of r.supportingFiles)e.push({path:`${ar}/${r.name}/${i.relativePath}`,content:i.content});}return e}var eL=d(()=>{v();Zt();s(Pf,"generateSkills");});var rL=d(()=>{YE();XE();ZE();qE();QE();tL();eL();});var nL=d(()=>{rL();});function oL(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 sL(t,e,r){let n=join(t,So),i=(await D(n)).filter(l=>l.endsWith(".md")),a=join(t,_f);for(let l of i){let c=await y(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}=k(u),h=await et(p,{description:typeof f.description=="string"?f.description:"",hasDescription:Object.prototype.hasOwnProperty.call(f,"description"),allowedTools:(()=>{let R=oL(f.allowedTools);return R.length>0?R:oL(f["allowed-tools"])})(),hasAllowedTools:Object.prototype.hasOwnProperty.call(f,"allowedTools")||Object.prototype.hasOwnProperty.call(f,"allowed-tools")},g);await C(p,h),e.push({fromTool:Br,fromPath:l,toPath:`${_f}/${m}`,feature:"commands"});}}var iL=d(()=>{A();v();Z();Zt();s(oL,"toStringArray");s(sL,"importWorkflows");});async function aL(t,e,r,n=ar){let o=join(t,n),i=await po(o),a={projectRoot:t,sourceSkillsDir:n,destCanonicalSkillsDir:Sf,targetName:"windsurf",normalize:r,results:e};for(let[l,c]of i){let m=join(c,"SKILL.md"),p=await y(m);if(!p)continue;let u=k(p),f=hr(u.frontmatter,l);if(f){await _e(join(t,Sf,l));let g=join(t,Cf);await O(g);let h=join(g,`${f.name}.md`);await C(h,ye(f,r(u.body,m,h))),e.push({fromTool:"windsurf",fromPath:m,toPath:`${Cf}/${f.name}.md`,feature:"agents"});continue}await Gr(l,c,a);}}var lL=d(()=>{A();v();lt();Bs();yi();Zt();s(aL,"importSkills");});async function mL(t,e){let r=join(t,xi),n=await y(r);if(n)try{let o=JSON.parse(n);if(!o.hooks||typeof o.hooks!="object"||Array.isArray(o.hooks))return;let i=kM(o.hooks);if(Object.keys(i).length===0)return;let a=join(t,Of);await O(dirname(a)),await C(a,stringify(i)),e.push({fromTool:Br,fromPath:r,toPath:Of,feature:"hooks"});}catch{}}function OM(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 kM(t){let e={};for(let[r,n]of Object.entries(t)){if(!Array.isArray(n))continue;let o=OM(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 pL(t,e){let r=[bi,VE];for(let n of r){let o=join(t,n),i=await y(o);if(i)try{let a=JSON.parse(i);if(!a.mcpServers||typeof a.mcpServers!="object")continue;let l=join(t,kf);await O(dirname(l)),await C(l,JSON.stringify({mcpServers:a.mcpServers},null,2)),e.push({fromTool:Br,fromPath:o,toPath:kf,feature:"mcp"});return}catch{}}}var uL=d(()=>{A();Zt();s(mL,"importWindsurfHooks");s(OM,"canonicalHookEventName");s(kM,"windsurfHooksToCanonical");s(pL,"importWindsurfMcp");});async function Sm(t,e){let r=e?.scope??"project",n=[],o=await B(Br,t),i=await B("codex-cli",t),a=join(t,Pi),l=join(t,If),c=await y(l);if(c!==null){await O(a);let f=join(a,"_root.md"),g=o(c,l,f).trim(),h=await G(f,{root:true},g);await C(f,h),n.push({fromTool:"windsurf",fromPath:l,toPath:`${Pi}/_root.md`,feature:"rules"});}if(c===null){let f=join(t,Hr),g=await y(f);if(g!==null){await O(a);let h=join(a,"_root.md"),R=o(i(g,f,h),f,h).trim(),S=await G(h,{root:true},R);await C(h,S),n.push({fromTool:"windsurf",fromPath:f,toPath:`${Pi}/_root.md`,feature:"rules"});}}r!=="global"&&n.push(...await it({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(!Jl(h))return await _e(join(a,`${R}.md`)),null;let S=join(a,`${R}.md`);return {destPath:S,toPath:`${Pi}/${R}.md`,feature:"rules",content:await G(S,{root:false,globs:[`${h}/**`]},g(S))}},"mapEntry")}));let m=join(t,Co);n.push(...await it({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:S}=k(g(h)),I={...R};return typeof I.glob=="string"&&I.glob.trim()&&(I.globs=[I.glob],delete I.glob),{destPath:h,toPath:`${Pi}/${f}`,feature:"rules",content:await G(h,{...I,root:false},S)}},"mapEntry")}));let p=join(t,zE),u=await y(p);if((u===null||!u.trim())&&(p=join(t,Ai),u=await y(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,Rf);await C(h,g.join(`
|
|
129
|
+
`)),n.push({fromTool:"windsurf",fromPath:p,toPath:Rf,feature:"ignore"});}}return await sL(t,n,o),await aL(t,n,o),await mL(t,n),await pL(t,n),n}var Df=d(()=>{yt();A();v();Z();We();Bs();Zt();iL();lL();uL();s(Sm,"importFromWindsurf");});function dL(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:Br,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:Br,message:`Windsurf cannot project these features yet: ${i.join(", ")}.`}),n}var fL=d(()=>{Zt();s(dL,"lintRules");});function gL(t){return t.commands.filter(e=>e.description.length>0||e.allowedTools.length>0).map(e=>$(e.source,"windsurf","windsurf workflow files are plain Markdown; command description and allowed-tools metadata are not projected."))}function hL(t){return !t.mcp||Object.keys(t.mcp.mcpServers).length===0?[]:[$(".agentsmesh/mcp.json","windsurf","Windsurf MCP is partial; generated .windsurf/mcp_config.example.json is a reference artifact and may require manual setup.")]}var yL=d(()=>{Lt();s(gL,"lintCommands");s(hL,"lintMcp");});function xM(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 bM,PM,TM,DM,IL,_L=d(()=>{nL();To();Zt();ae();Df();fL();yL();At();$s();lt();s(xM,"directoryScopedRuleDir");bM={name:"windsurf",primaryRootInstructionPath:Hr,generateRules:Ef,generateCommands:wf,generateAgents:Af,generateSkills:Pf,generateMcp:xf,generateHooks:bf,generateIgnore:Lf,importFrom:Sm},PM={rootInstructionPath:Hr,extraRuleOutputPaths(t){if(t.root)return [Hr];let e=xM(t.globs);return e!==null?[`${e}/AGENTS.md`]:[]},skillDir:ar,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 `${Co}/${t}.md`},commandPath(t,e){return `${So}/${t}.md`},agentPath(t,e){return he(e,"windsurf")?`.windsurf/skills/${H(t)}/SKILL.md`:null}}},TM={rootInstructionPath:Ti,skillDir:Di,managedOutputs:{dirs:[Di,tl,JE],files:[Ti,ym,Im,_m]},rewriteGeneratedPath(t){return t===Hr?Ti:t.startsWith(`${Co}/`)||/\/AGENTS\.md$/.test(t)?null:t.startsWith(`${ar}/`)?t.replace(`${ar}/`,`${Di}/`):t.startsWith(`${So}/`)?t.replace(`${So}/`,`${tl}/`):t===xi?ym:t===bi?Im:t===Ai?_m:t},mirrorGlobalPath(t,e){return ot(t,".codeium/windsurf/skills",e)},paths:{rulePath(t,e){return Ti},commandPath(t,e){return `${tl}/${t}.md`},agentPath(t,e){return he(e,"windsurf")?`${Di}/${H(t)}/SKILL.md`:null}}},DM={rules:"native",additionalRules:"partial",commands:je("native","workflows"),agents:"embedded",skills:"native",mcp:"partial",hooks:"native",ignore:"native",permissions:"none"},IL={id:"windsurf",generators:bM,capabilities:{rules:"native",additionalRules:"native",commands:je("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:dL,lint:{commands:gL,mcp:hL},project:PM,globalSupport:{capabilities:DM,detectionPaths:[Ti,Di,tl,ym,Im,_m],layout:TM},buildImportPaths:Du,detectionPaths:[".windsurfrules",".windsurf"]};});function CL(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=kt(n,r);return o?[{path:or,content:o}]:[]}var SL=d(()=>{Ie();ms();s(CL,"generateRules");});async function OL(t,e,r){let n=await y(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 Kt(t,RL,l),r.push({fromTool:"zed",fromPath:e,toPath:RL,feature:"mcp"}));}var RL,kL=d(()=>{A();rn();ms();RL=".agentsmesh/mcp.json";s(OL,"importZedMcp");});async function EL(t,e={}){let r=e.scope??"project",n=[],o=await B("zed",t,r);return n.push(...await q(Rm,t,r,{normalize:o})),await OL(t,r==="global"?vr:Fr,n),n}var LL=d(()=>{yt();Wt();kL();ms();Nf();s(EL,"importFromZed");});function wL(t,e,r,n){return X(t,e,r,{checkGlobMatches:n?.scope!=="global"}).map(o=>({...o,target:"zed"}))}var AL=d(()=>{Nt();ms();s(wL,"lintRules");});function xL(t){return t.hooks?Object.values(t.hooks).some(r=>Array.isArray(r)&&r.length>0)?[$(".agentsmesh/hooks.yaml","zed","Zed has no lifecycle hook system; canonical hooks are not projected.")]:[]:[]}function bL(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?[]:[$(".agentsmesh/permissions.yaml","zed","Zed permissions are managed via agent.tool_permissions in settings.json; canonical permissions are not projected.")]}function PL(t){return t.ignore.length===0?[]:[$(".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 TL=d(()=>{Lt();s(xL,"lintHooks");s(bL,"lintPermissions");s(PL,"lintIgnore");});function jM(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 FM,vM,MM,GM,$M,Rm,Nf=d(()=>{SL();LL();AL();TL();At();ms();FM={name:"zed",primaryRootInstructionPath:or,generateRules:CL,importFrom:EL},vM={rootInstructionPath:or,managedOutputs:{dirs:[],files:[or,Fr]},paths:{rulePath(t){return or},commandPath(){return null},agentPath(){return null}}},MM={rootInstructionPath:void 0,managedOutputs:{dirs:[],files:[vr]},rewriteGeneratedPath(t){return t===Fr?vr:t},paths:{rulePath(){return vr},commandPath(){return null},agentPath(){return null}}},GM={rules:"native",additionalRules:"embedded",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"},$M={rules:"none",additionalRules:"none",commands:"none",agents:"none",skills:"none",mcp:"native",hooks:"none",ignore:"none",permissions:"none"};s(jM,"mergeZedSettings");Rm={id:"zed",generators:FM,capabilities:GM,emptyImportMessage:"No Zed config found (.rules or .zed/settings.json).",lintRules:wL,lint:{hooks:xL,permissions:bL,ignore:PL},project:vM,globalSupport:{capabilities:$M,detectionPaths:[vr],layout:MM},importer:{rules:{feature:"rules",mode:"singleFile",source:{project:[or],global:[]},canonicalDir:i_,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:Fr,content:JSON.stringify({context_servers:r},null,2)}]},mergeGeneratedOutputContent(t,e,r,n){return n===Fr||n===vr?jM(t,r):null},buildImportPaths:Nu,detectionPaths:[or,Fr]};});var mI={};lp(mI,{BUILTIN_TARGETS:()=>jt,TARGET_IDS:()=>ft,getBuiltinTargetDefinition:()=>Pe,getEffectiveTargetSupportLevel:()=>Om,getTargetCapabilities:()=>Io,getTargetDetectionPaths:()=>vf,getTargetLayout:()=>bt,getTargetManagedOutputs:()=>Mf,getTargetPrimaryRootInstructionPath:()=>KM,getTargetSkillDir:()=>rl,isBuiltinTargetId:()=>ve,resolveTargetFeatureGenerator:()=>Ni,rewriteGeneratedOutputPath:()=>Gf});function UM(){return Ff||(_y(jt),Ff=new Map(jt.map(t=>[t.id,t]))),Ff}function Pe(t){return UM().get(t)}function Io(t,e="project"){let r=Pe(t)??rt(t);if(!r)return;let n=e==="global"?r.globalSupport?.capabilities??r.capabilities:r.capabilities;return yy(n)}function vf(t,e="project"){let r=Pe(t)??rt(t);return r?e==="global"?r.globalSupport?.detectionPaths??[]:r.detectionPaths:[]}function bt(t,e="project"){let r=Pe(t)??rt(t);if(r)return e==="global"?r.globalSupport?.layout:r.project}function KM(t,e="project"){return bt(t,e)?.rootInstructionPath}function rl(t,e="project"){return bt(t,e)?.skillDir}function Mf(t,e="project"){return bt(t,e)?.managedOutputs}function Gf(t,e,r="project"){let n=bt(t,r);return n?n.rewriteGeneratedPath?n.rewriteGeneratedPath(e):e:null}function DL(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?!Gs(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?!he(r,t.id,true,n):false}function WM(t,e,r,n){return !t||!r?false:e==="commands"&&t.supportsConversion?.commands?Gs(r,t.id,true,n):e==="agents"&&t.supportsConversion?.agents?he(r,t.id,true,n):false}function Om(t,e,r,n="project"){let o=Io(t,n)?.[e]?.level??"none",i=Pe(t)??rt(t);return o==="none"&&WM(i,e,r,n)?"embedded":o!=="embedded"?o:DL(i,e,r,n)?"none":o}function Ni(t,e,r,n="project"){let o=Pe(t)??rt(t);if(!o?.generators||DL(o,e,r,n))return;let i=BM[e];return i===null?void 0:i(o.generators)}var jt,Ff,BM,mt=d(()=>{$s();To();lr();Fp();Xr();Vp();vu();Gu();AC();fS();ld();gd();bd();Xd();qd();tf();af();mf();uf();hf();yf();_L();Nf();jt=[Yl,Ic,_c,wC,dS,Tc,$c,Jc,nm,om,im,mm,um,dm,gm,hm,IL,Rm];s(UM,"builtinTargetsMap");s(Pe,"getBuiltinTargetDefinition");s(Io,"getTargetCapabilities");s(vf,"getTargetDetectionPaths");s(bt,"getTargetLayout");s(KM,"getTargetPrimaryRootInstructionPath");s(rl,"getTargetSkillDir");s(Mf,"getTargetManagedOutputs");s(Gf,"rewriteGeneratedOutputPath");s(DL,"isFeatureSuppressedByConversion");s(WM,"isConversionUpgrading");s(Om,"getEffectiveTargetSupportLevel");BM={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(Ni,"resolveTargetFeatureGenerator");});function ZM(t){return typeof t=="string"?t:t.level}function NL(t){return XM.includes(t)}function FL(t,e,r,n){for(let o of YM){let i=ZM(e[o.feature]);if(i==="none")continue;let a=typeof t.generators[o.generator]=="function",l=NL(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}`+(NL(o.feature)?" or emitScopedSettings":"")+" is missing."});}}function km(t){return QM.parse(t)}var Tn,vL,HM,zM,ML,VM,JM,YM,XM,qM,QM,$f=d(()=>{Tn=z.union([z.enum(["native","embedded","partial","none"]),z.object({level:z.enum(["native","embedded","partial","none"]),flavor:z.string().optional()})]),vL=z.object({rules:Tn,additionalRules:Tn,commands:Tn,agents:Tn,skills:Tn,mcp:Tn,hooks:Tn,ignore:Tn,permissions:Tn}),HM=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(),zM=z.object({rulePath:z.function(),commandPath:z.function(),agentPath:z.function()}),ML=z.object({paths:zM}).passthrough(),VM=z.object({capabilities:vL,detectionPaths:z.array(z.string()),layout:ML,scopeExtras:z.function().optional()}).passthrough(),JM=["global","globalCapabilities","globalDetectionPaths","generateScopeExtras"],YM=[{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"}],XM=["mcp","hooks","ignore","permissions"];s(ZM,"capabilityLevel");s(NL,"canUseScopedSettings");s(FL,"validateCapabilityImplementations");qM=z.object({id:z.string().regex(/^[a-z][a-z0-9-]*$/,"Target id must be lowercase with hyphens"),generators:HM,capabilities:vL,emptyImportMessage:z.string(),lintRules:z.union([z.function(),z.null()]),project:ML,globalSupport:VM.optional(),buildImportPaths:z.function(),detectionPaths:z.array(z.string())}).passthrough(),QM=qM.superRefine((t,e)=>{for(let r of JM)r in t&&e.addIssue({code:"custom",path:[r],message:`Use globalSupport instead of legacy field "${r}".`});FL(t,t.capabilities,e,["capabilities"]),t.globalSupport!==void 0&&FL(t,t.globalSupport.capabilities,e,["globalSupport","capabilities"]);});s(km,"validateDescriptor");});function tG(){return jf||(jf=new Map(jt.map(t=>[t.id,t]))),jf}function $L(t){let e=km(t);GL.set(e.id,e);}function rt(t){return GL.get(t)??tG().get(t)}var GL,jf,lr=d(()=>{mt();$f();GL=new Map;s(tG,"builtinDescriptors");s($L,"registerTargetDescriptor");s(rt,"getDescriptor");});async function jL(t,e,r="project"){let n=new Map,o=rt(t);return o&&await o.buildImportPaths(n,e,r),n}var UL=d(()=>{lr();s(jL,"buildImportReferenceMap");});function nG(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 oG(){let t=new Set([".agentsmesh/"]);for(let e of jt)for(let r of nG(e))t.add(r);return Array.from(t)}function sG(){let t=new Set([...oG(),...Uf.rootRelativePrefixes]),e=new Set([...rG,...Uf.meshRootSegments]);return {protectedSchemes:[...eG,...Uf.protectedSchemes],rootRelativePrefixes:Array.from(t),meshRootSegments:e}}function Em(){return Kf||(Kf=sG()),Kf}var eG,rG,Uf,Kf,KL=d(()=>{mt();eG=[/\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],rG=new Set(["skills","rules","commands","agents","packs"]),Uf={protectedSchemes:[],rootRelativePrefixes:[],meshRootSegments:[]};s(nG,"topLevelDotfilePrefixes");s(oG,"buildDefaultRootRelativePrefixes");s(sG,"rebuild");s(Em,"getLinkFormatRegistry");});function cr(t){let e=at(t);return Em().rootRelativePrefixes.some(r=>e.startsWith(r))}function aG(t){let e=at(t).replace(/^\.\//,"");if(e.startsWith("../")||e.startsWith("/")||Ge.test(e)||/^[a-zA-Z]:/.test(e)||cr(e))return false;let r=e.split("/").filter(n=>n.length>0)[0];return r!==void 0&&Em().meshRootSegments.has(r)}function nl(t,e,r){let n=V(e),o=j(e,e),i=j(e,r),a=at(t);if(Ge.test(t)){let l=j(e,t);return n===win32||l.startsWith(`${o}${n.sep}`)?[l]:[l]}if(n.isAbsolute(t)){let l=j(e,t);return l.startsWith(o)||existsSync(t)?[l]:[j(e,n.join(e,t))]}if(a.startsWith("./")||a.startsWith("../")){let l=j(e,n.join(n.dirname(i),a)),c=dy(a,o);return c&&c!==l?[l,c]:[l]}if(cr(a))return [j(e,n.join(o,a))];if(a.includes("/")){let l=j(e,n.join(o,".agentsmesh")),c=aG(a)?j(e,n.join(l,a)):null,m=j(e,n.join(o,a)),p=j(e,n.join(n.dirname(i),a));return c!==null?[c,m,p]:[m,p]}return lG.has(a)?[]:a.includes(".")?[j(e,n.join(n.dirname(i),a))]:[]}function ol(t,e){let r=[e];if(!uy(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 zL(t,e,r){let n=e>0?t.at(e-1):"",o=r<t.length?t.at(r):"";return n==="*"||o==="*"}function Lm(t){let e=[];for(let r of Em().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(cG))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(mG))e.push([r.index??0,(r.index??0)+r[0].length]);for(let r of t.matchAll(pG))e.push([r.index??0,(r.index??0)+r[0].length]);return e}var lG,cG,mG,pG,HL,Fi,Ro=d(()=>{$t();KL();s(cr,"isRootRelativePathToken");s(aG,"isMeshRootRelativePathToken");lG=new Set(["AGENTS.md","CLAUDE.md","GEMINI.md","codex.md",".windsurfrules",".cursorrules"]),cG=/^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm,mG=/<!-- agentsmesh:root-generation-contract:start -->[\s\S]*?<!-- agentsmesh:root-generation-contract:end -->/g,pG=/<!-- agentsmesh:embedded-rules:start -->[\s\S]*?<!-- agentsmesh:embedded-rules:end -->/g,HL=/(?:\.\.[\\/]|\.\/|\.\\|\/[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,Fi=/(?::(\d+)){1,2}$/;s(nl,"resolveProjectPath");s(ol,"expandResolvedPaths");s(zL,"isGlobAdjacent");s(Lm,"protectedRanges");});function uG(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 VL(t){return uG(t.tokenContext)}function Wf(t,e){let r=V(t),n=j(t,t),o=j(t,e);if(o===n)return true;let i=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(i)}function JL(t){let e=V(t);return j(t,e.join(t,".agentsmesh"))}function mr(t,e){let r=V(t),n=JL(t),o=j(t,e);if(o===n)return true;let i=n.endsWith(r.sep)?n:`${n}${r.sep}`;return o.startsWith(i)}function YL(t,e,r){let n=V(t),o=JL(t),i=j(t,e);if(!mr(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 Bf(t,e,r){let o=V(t).relative(j(t,t),j(t,e)).replace(/\\/g,"/");if(o.startsWith(".."))return null;let i=o.length>0?o:".";return r&&!i.endsWith("/")?`${i}/`:i}function vi(t,e,r){let n=Bf(t,e,r);return n===null?null:{kind:"projectRoot",rest:n,text:n}}function Hf(t,e,r,n,o){let i=V(t),a=j(t,t),l=j(t,e),c=j(t,r);if(!Wf(t,c))return vi(t,c,n)?.text??null;let m=j(t,i.dirname(l));if(!Wf(t,m)&&m!==a)return vi(t,c,n)?.text??null;let p=i.relative(m,c).replace(/\\/g,"/");if(i.isAbsolute(p)||Ge.test(p))return Bf(t,c,n);let u=j(t,i.join(m,p));return Wf(t,u)?(p===""||p==="."?p=".":o.explicitCurrentDirLinks===true&&m!==a&&!p.startsWith("../")&&!p.startsWith("./")&&(p=`./${p}`),n&&!p.endsWith("/")?`${p}/`:p):Bf(t,c,n)}var zf=d(()=>{$t();s(uG,"isReadingContext");s(VL,"isReadingContextOptions");s(Wf,"isUnderProjectRoot");s(JL,"agentsMeshRoot");s(mr,"isUnderAgentsMesh");s(YL,"toAgentsMeshRootRelative");s(Bf,"toProjectRootRelative");s(vi,"toProjectRootReference");s(Hf,"formatLinkPathForDestinationLegacy");});function XL(t,e,r,n,o={}){let i=o.scope??"project",a=j(t,r);if(VL(o)&&mr(t,e)&&mr(t,a)){let m=V(t),p=j(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 Hf(t,e,r,n,o);if(i==="global"&&!mr(t,e))return vi(t,a,n)?.text??null;let l=(()=>{if(mr(t,a))return a;let m=o.logicalMeshSourceAbsolute;return m&&mr(t,j(t,m))?j(t,m):null})();if(!l)return vi(t,a,n)?.text??null;if(n||(o.pathIsDirectory?.(a)??false)){let m=YL(t,l,n);return m!==null?m:vi(t,l,n)?.text??null}return Hf(t,e,r,n,o)}var ZL=d(()=>{Ro();$t();zf();zf();s(XL,"formatLinkPathForDestination");});function qL(t,e,r,n){let o=V(e),i=at(t);if(!cr(i))return null;let a=i.split("/").filter(m=>m.length>0);if(a.length<3)return null;let l=j(e,r),c=o.dirname(l);for(let m=1;m<=a.length-1;m++){let p=a.slice(m).join("/"),u=j(e,o.join(c,p));if(u!==l&&n(u))return u}return null}var QL=d(()=>{$t();Ro();s(qL,"resolveByDestinationSuffixStrip");});function tw(t){let e=null,r=false,n=null,o=null,i=null;for(let c of nl(t.candidate,t.projectRoot,t.sourceFile)){let m=null,p=null;for(let u of ol(t.projectRoot,c)){let f=j(t.projectRoot,u),g=j(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=qL(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=at(t.destinationFile),l=a.includes("/.agentsmesh/")||a.startsWith(".agentsmesh/");return !r&&e!==null&&at(t.rawToken).startsWith(".agentsmesh/")&&l&&(r=true),{translatedPath:e,resolvedBeforeTranslate:n,matchedPath:r}}var ew=d(()=>{$t();Ro();QL();s(tw,"resolveLinkTarget");});function rw(t,e,r){return e>=2&&t[e-2]==="~"&&t[e-1]==="/"?true:e>=1&&t[e-1]==="~"&&r.startsWith("/")}function nw(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 ow(t){let e=at(t);return e.startsWith("./")||e.startsWith("../")?true:e.startsWith("/")||Ge.test(e)||cr(e)?false:e.includes("/")}var sw=d(()=>{$t();Ro();s(rw,"isTildeHomeRelativePathToken");s(nw,"isMarkdownLinkDestinationToken");s(ow,"isRelativePathToken");});function dG(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===`
|
|
130
|
+
`)break;i+=a,o++;}return i===r}function iw(t,e,r){let n=t.lastIndexOf(`
|
|
131
|
+
`,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===`
|
|
132
|
+
`||i==="\r"||i===">"||i===" "||i===" "||i==='"'||i==="'"||i===":"||i==="#"||i==="?"}function aw(t,e,r){let n=e>0?t[e-1]:"",o=r<t.length?t[r]:"";return n==="`"&&o==="`"?{role:"inline-code"}:iw(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 lw(t,e,r,n,o){if(e<0||r>t.length)return false;let{candidate:i}=Ms(n),a=i.replace(Fi,""),l=at(a),c=e+a.length,m=t[e-1],p=t[r];return iw(t,e,c)||m==="'"&&p==="'"||m==='"'&&p==='"'||m==="`"&&p==="`"||m==="<"&&p===">"?true:m==="["&&p==="]"?!(!o&&!cr(l)&&dG(t,e,n)):m==="@"?true:m==="("?p===")"||p==="#"||p==="?"||p===" "||p===" ":o?cr(l)?true:l.includes("/")||l.includes("\\")?l.startsWith("./")||l.startsWith("../")?true:(l.split(/[\\/]/).filter(Boolean).at(-1)??"").includes("."):false:false}var cw=d(()=>{$t();Ro();s(dG,"markdownBracketLabelDuplicatesDestination");s(iw,"isMarkdownReferenceDefinitionDestination");s(aw,"getTokenContext");s(lw,"shouldRewritePathToken");});function wm(t){let e=new Set,r=Lm(t.content);return {content:t.content.replace(HL,(o,i,a)=>{if(r.some(([Rt,st])=>i>=Rt&&i<st)||!lw(a,i,i+o.length,o,t.rewriteBarePathTokens===true)||rw(a,i,o)||zL(a,i,i+o.length))return o;let{candidate:l,suffix:c}=Ms(o);if(!l)return o;let m=Fi.exec(l),p=m?l.slice(0,m.index):l,u=m?m[0]:"";if(!p)return o;let f=aw(a,i,i+p.length);if(f.role!=="markdown-link-dest"&&Ge.test(p))return o;let{translatedPath:g,resolvedBeforeTranslate:h,matchedPath:R}=tw({candidate:p,rawToken:l,projectRoot:t.projectRoot,sourceFile:t.sourceFile,destinationFile:t.destinationFile,translatePath:t.translatePath,pathExists:t.pathExists}),S=h;if(!R||!g)return g&&e.add(g),o;let I=at(p),E=p.endsWith("/")||t.pathIsDirectory?.(g)===true;if(E&&!I.includes("/")&&!I.includes("\\"))return o;if(S===null){let Rt=at(l);if(Rt.startsWith("agentsmesh/")&&(Rt=`.${Rt}`),Rt.startsWith(".agentsmesh/")||Rt.includes("/.agentsmesh/")){let st=V(t.projectRoot),Jr=j(t.projectRoot,t.projectRoot),Fe=Rt.replace(/^\.\//,"");S=j(t.projectRoot,st.join(Jr,Fe));}}let T=V(t.projectRoot);if(t.scope==="global"){let Rt=at(l),st=Rt.startsWith(".agentsmesh/")||Rt.includes("/.agentsmesh/"),Jr=cr(Rt)||ow(Rt),Fe=S!==null&&mr(t.projectRoot,S),vn=mr(t.projectRoot,g);if(S===g&&!vn&&!Fe&&!st){let mh=at(T.relative(t.projectRoot,j(t.projectRoot,t.sourceFile))).split("/").filter(Boolean)[0]??"",Kb=(S!==null?at(T.relative(t.projectRoot,S)):"").split("/").filter(Boolean)[0]??"";if(mh.length>0&&mh===Kb)return o}if(!Jr&&!st&&!Fe&&!vn)return o}let P=j(t.projectRoot,t.destinationFile),x=j(t.projectRoot,g),Y=at(T.relative(t.projectRoot,P)),K=at(T.relative(t.projectRoot,x)),z=Y.split("/").filter(Boolean)[0]??"",St=K.split("/").filter(Boolean)[0]??"",Pt=!at(p).startsWith(".agentsmesh/")&&!E&&z.length>0&&z===St&&z.startsWith(".")&&z!==".agentsmesh"||f.role==="markdown-link-dest"||nw(a,i,p),ur=XL(t.projectRoot,t.destinationFile,g,p.endsWith("/"),{explicitCurrentDirLinks:t.explicitCurrentDirLinks===true||Pt,scope:t.scope??"project",pathIsDirectory:t.pathIsDirectory,logicalMeshSourceAbsolute:E?null:S,forceRelative:Pt,tokenContext:f,originalToken:p});return ur?`${ur}${u}${c}`:o}),missing:[...e]}}var Vf=d(()=>{$t();Ro();ZL();ew();sw();cw();s(wm,"rewriteFileLinks");});function pw(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=V(e),o=new Map,i=Array.from(new Set([t,...ft]));for(let c of i){let m=await jL(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 pw(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 pw(n,m))l.add(n.normalize(p));}return (c,m,p)=>wm({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 yt=d(()=>{$t();UL();Vf();Xr();s(pw,"pathVariants");s(B,"createImportReferenceNormalizer");});function dw(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(!fr({...m,type:p}))continue;let u=p==="prompt"?zt(m)||Ot(m):Ot(m)||zt(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 fw(t,e){let r=join(t,an),n=await y(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=dw(o);if(Object.keys(i).length===0)return false;let a=stringify(i),l=join(t,Mo);return await O(dirname(l)),await C(l,a),e.push({fromTool:"claude-code",fromPath:r,toPath:Mo,feature:"hooks"}),true}async function gw(t,e){let r=e.some(m=>m.feature==="hooks"&&m.fromPath.replace(/\\/g,"/").endsWith(an)),n=join(t,_a),o=await y(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 Kt(t,Oa,m),e.push({fromTool:"claude-code",fromPath:n,toPath:Oa,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,ru);await O(dirname(h)),await C(h,g),e.push({fromTool:"claude-code",fromPath:n,toPath:ru,feature:"permissions"});}}let c=i.hooks;if(!r&&c&&typeof c=="object"&&!Array.isArray(c)){let m=dw(c);if(Object.keys(m).length>0){let p=stringify(m),u=join(t,Mo);await O(dirname(u)),await C(u,p),e.push({fromTool:"claude-code",fromPath:n,toPath:Mo,feature:"hooks"});}}}var hw=d(()=>{Me();A();rn();ln();s(dw,"claudeHooksToCanonical");s(fw,"importClaudeHooksJson");s(gw,"importSettings");});async function Iw(t,e,r){let n=join(t,Ia),o=join(t,eu),a=(await D(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 D(c);for(let f of u){let g=await y(f);if(g===null)continue;let h=relative(c,f),R=join(p,h);await O(dirname(R));let S=r(g,f,R),I=h==="SKILL.md"?k(S):null;await C(R,h==="SKILL.md"?await yr(R,I?.frontmatter??{},I?.body??""):S);let E=`${eu}/${m}/${h}`;e.push({fromTool:"claude-code",fromPath:f,toPath:E,feature:"skills"});}}}var _w=d(()=>{A();v();Z();ln();s(Iw,"importClaudeSkills");});async function Cc(t,e={}){let r=e.scope??"project",n=[],o=await B("claude-code",t,r);return n.push(...await q(_c,t,r,{normalize:o})),await Iw(t,n,o),await fw(t,n),await gw(t,n),n}var $u=d(()=>{yt();Wt();hw();_w();Gu();s(Cc,"importFromClaudeCode");});async function il(t,e){let r=yG[e];if(!r)throw new Error(`No importer registered for native target: ${e}`);return r(t)}var yG,Xf=d(()=>{$u();xd();fd();Yd();id();Df();Bu();ad();Qd();cf();sf();yG={"claude-code":Cc,cursor:Vc,copilot:Gc,"gemini-cli":rm,"codex-cli":xc,windsurf:Sm,cline:kc,continue:Pc,junie:sm,kiro:pm,"kilo-code":cm};s(il,"importNativeToCanonical");});async function Os(t){if(!await F(t))return false;if(await F(join(t,qf)))return true;try{let e=await readdir(t,{withFileTypes:!0});for(let r of e)if(!(!r.isDirectory()||r.name.startsWith("."))&&await F(join(t,r.name,qf)))return !0}catch{return false}return false}async function al(t){if(!await F(t))return [];if(await F(join(t,qf))){let e=await sy(t);return e?[e]:[]}return Fs(t)}var qf,xm=d(()=>{A();Ml();qf="SKILL.md";s(Os,"isSkillPackLayout");s(al,"loadSkillsAtExtendPath");});function SG(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}function RG(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 bm(t){if(!await F(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 OG(t){if(basename(t)==="rules")return Ao(t);let r=join(t,"rules");return await F(r)?Ao(r):[]}async function kG(t){if(basename(t)==="commands")return xo(t);let r=join(t,"commands");return await F(r)?xo(r):[]}async function EG(t){if(basename(t)==="agents")return Po(t);let r=join(t,"agents");return await F(r)?Po(r):[]}async function LG(t){if(await Os(t))return al(t);let e=join(t,"skills");return await Os(e)?al(e):[]}async function Pm(t){let e=join(t,".agentsmesh");if(await F(e))return Qr(t);let r=SG();if(r.rules=await OG(t),r.commands=await kG(t),r.agents=await EG(t),r.skills=await LG(t),RG(r))throw new Error(`No installable resources at ${t}. Expected .agentsmesh/, or rules/, commands/, agents/, or Anthropic-style skills (SKILL.md).`);return r}var Qf=d(()=>{A();Fl();oa();Nl();Dl();xm();s(SG,"emptyCanonical");s(RG,"isCanonicalSliceEmpty");s(bm,"normalizeSlicePath");s(OG,"parseRulesAt");s(kG,"parseCommandsAt");s(EG,"parseAgentsAt");s(LG,"loadSkillsForPartialSlice");s(Pm,"loadCanonicalSliceAtPath");});function wG(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function Cw(t){let e=t.resolvedPath;if(!t.path){let o=join(e,".agentsmesh");if(!await F(o)){if(await Os(e)){let a=await al(e);return {...wG(),skills:a}}let i=t.target??await Kl(e);if(!i)throw new Error(`Extend "${t.name}": No supported agent configuration found in ${e}.
|
|
133
|
+
Expected one of: .agentsmesh/, ${my.join(", ")}.`);_.info(`[agentsmesh] Extend "${t.name}": ${t.target?"specified":"detected"} ${i} format, importing to .agentsmesh/...`),await il(e,i);}return Qr(e)}let r=join(e,t.path);if(!await F(r))throw new Error(`Extend "${t.name}": path does not exist: ${r}`);if(t.target){let o=join(e,".agentsmesh");return await F(o)||(_.info(`[agentsmesh] Extend "${t.name}": path "${t.path}" with target "${t.target}" \u2014 importing at extend root, then loading canonical.`),await il(e,t.target)),Qr(e)}let{sliceRoot:n}=await bm(r);try{return await Pm(n)}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 Sw=d(()=>{Np();A();tt();oa();Xf();xm();Qf();s(wG,"emptyCanonical");s(Cw,"loadCanonicalForExtend");});function Tm(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)||_.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)||_.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)||_.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)||_.warn(`[agentsmesh] pick name "${c}" not found in rules from extend "${n}".`);}return o}var eg=d(()=>{tt();s(Tm,"applyExtendPick");});var bG,Mi,Dm=d(()=>{bG=["rules","commands","agents","skills"],Mi=z.enum(bG);});var PG,Rw,Ow=d(()=>{$n();Dm();PG=z.enum(["github","gitlab","git","local"]),Rw=z.object({name:z.string().min(1),source:z.string().min(1),version:z.string().optional(),source_kind:PG,installed_at:z.string(),updated_at:z.string(),features:z.array(Ps).min(1),pick:qi.optional(),target:fe.optional(),path:z.string().optional(),paths:z.array(z.string().min(1)).min(1).optional(),as:Mi.optional(),content_hash:z.string()});});function kw(t){let e=wo(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 DG(t,e){return e?t.length===e.length&&[...t].sort().every((r,n)=>r===[...e].sort()[n]):true}async function Nm(t){let e=join(t,"pack.yaml"),r=await y(e);if(r===null)return null;try{let n=parse(r);return Rw.parse(n)}catch{return null}}async function Lw(t,e,r){if(!await F(t))return null;let n=kw(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 Nm(a);if(l&&kw(l.source)===n&&l.target===r.target&&l.as===r.as&&DG(l.features,r.features))return {meta:l,packDir:a,name:l.name}}return null}async function Fm(t){if(!await F(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 Nm(o);i&&r.push({meta:i,packDir:o,name:i.name});}return r}var vm=d(()=>{A();Ow();ra();s(kw,"sourceIdentity");s(DG,"sameFeatures");s(Nm,"readPackMetadata");s(Lw,"findExistingPack");s(Fm,"listPacks");});function ww(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function NG(t){let[e,r,n,o,i,a,l,c]=await Promise.all([Ao(join(t,"rules")),xo(join(t,"commands")),Po(join(t,"agents")),Fs(join(t,"skills")),Gl(join(t,"mcp.json")),$l(join(t,"permissions.yaml")),jl(join(t,"hooks.yaml")),Ul(join(t,"ignore"))]);return {...ww(),rules:e,commands:r,agents:n,skills:o,mcp:i,permissions:a,hooks:l,ignore:c}}async function Aw(t){let e=join(t,"packs"),r=await Fm(e),n=ww();for(let{meta:o,packDir:i}of r){let a=await NG(i),l=ng(a,o.features),c=Tm(l,o.features,o.pick,o.name);n=vs(n,c);}return n}var xw=d(()=>{Dl();Nl();Fl();Ml();Lp();Ap();bp();Pp();Dp();Oo();eg();vm();s(ww,"emptyCanonical");s(NG,"loadPackCanonical");s(Aw,"loadPacksCanonical");});function ng(t,e){if(e.length===0)return bw();let r=new Set(e.flatMap(n=>vG[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 bw(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}async function De(t,e,r={},n=join(e,".agentsmesh")){let o=await Ns(t,e,{refreshCache:r.refreshRemoteCache===true}),i=bw();for(let c of o){let m=await Cw(c),p=ng(m,c.features),u=Tm(p,c.features,c.pick,c.name);i=vs(i,u);}let a=await Aw(n);i=vs(i,a);let l=await Qr(n);return i=vs(i,l),{canonical:i,resolvedExtends:o}}var vG,Oo=d(()=>{Tl();oa();Dp();Sw();eg();xw();vG={rules:["rules"],commands:["commands"],agents:["agents"],skills:["skills"],mcp:["mcp"],permissions:["permissions"],hooks:["hooks"],ignore:["ignore"]};s(ng,"filterCanonicalByFeatures");s(bw,"emptyCanonical");s(De,"loadCanonicalWithExtends");});async function P$(t,e){let{source:r}=t,n;if(r.startsWith("file:")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")){let i=r.startsWith("file:")?fileURLToPath(r):r,a=resolve(e,i);n=pathToFileURL(a).href;}else n=r;return await import(n)}function T$(t){return "descriptor"in t?[t.descriptor]:"descriptors"in t&&Array.isArray(t.descriptors)?t.descriptors:"default"in t?[t.default]:[]}async function Vm(t,e){let r;try{r=await P$(t,e);}catch(i){throw new Error(`Plugin '${t.source}' failed to import: ${i instanceof Error?i.message:String(i)}`,{cause:i})}let n=T$(r),o=[];for(let i of n)try{let a=km(i);$L(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 lA(t,e){let r=[];return await Promise.all(t.map(async n=>{try{let o=await Vm(n,e);r.push(o);}catch(o){_.warn(`Plugin '${n.source}' failed to load: ${o instanceof Error?o.message:String(o)}`);}})),r}var ug=d(()=>{$f();lr();tt();s(P$,"importPluginModule");s(T$,"extractDescriptors");s(Vm,"loadPlugin");s(lA,"loadAllPlugins");});async function re(t,e){t.plugins.length!==0&&await lA(t.plugins,e);}var ko=d(()=>{ug();s(re,"bootstrapPlugins");});function gg(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=ej(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]=Om(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]=Om(u,"additionalRules",t,r);n.push({feature:`additional rules (${m.length})`,count:m.length,support:p});}}}return n}function ej(t){if(!t)return 0;let e=0;for(let r of Object.values(t))Array.isArray(r)&&(e+=r.length);return e}var IA=d(()=>{mt();s(gg,"buildCompatibilityMatrix");s(ej,"countHooks");});function _A(t){return rj[t]??t}var rj,CA=d(()=>{rj={"claude-code":"Claude"};s(_A,"matrixColumnLabel");});function SA(t){return Object.fromEntries(nj.map(e=>[e,Object.fromEntries(ft.map(r=>{let o=Io(r,t)?.[e];return [r,o??{level:"none"}]}))]))}function oj(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}function sj(t,e){return oj()?e:`${t}${e}${dl.reset}`}function RA(t){let e=hg[t];return sj(ij[t],e)}var nj,hg,dl,ij,OA=d(()=>{Xr();mt();nj=["rules","additionalRules","commands","agents","skills","mcp","hooks","ignore","permissions"];s(SA,"buildSupportMatrix");SA("project"),SA("global"),hg={native:"\u2713",embedded:"\u25C6",partial:"\u25D0",none:"\u2013"},dl={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(oj,"noColor");s(sj,"colorize");ij={native:dl.green,embedded:dl.blue,partial:dl.yellow,none:dl.dim};s(RA,"coloredSymbol");});function yg(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((K,z)=>r?z:`${K}${z}${n.reset}`,"c"),i=s(K=>K.replace(/\u001b\[[0-9;]*m/g,"").length,"visibleLength"),a=s((K,z)=>{let St=i(K),It=Math.max(0,z-St);return K+" ".repeat(It)},"padWithColor"),l=Math.max(12,...e.map(K=>K.length)),c=e.map(K=>_A(K)),m=Math.max(8,l),p=Math.max(12,...t.map(K=>K.feature.length)),u=s(K=>o(n.dim,"\u250C"+K.map(z=>"\u2500".repeat(z)).join("\u252C")+"\u2510"),"border"),f=s(K=>o(n.dim,"\u251C"+K.map(z=>"\u2500".repeat(z)).join("\u253C")+"\u2524"),"sep"),g=s(K=>o(n.dim,"\u2514"+K.map(z=>"\u2500".repeat(z)).join("\u2534")+"\u2518"),"bottom"),h=[p,...e.map(()=>m)],R=u(h),S=[a(o(n.bold+n.cyan,"Feature"),p),...c.map(K=>a(o(n.bold+n.magenta,K),m))],I=o(n.dim,"\u2502")+S.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502"),E=f(h),T=t.map(K=>{let z=[a(o(n.cyan,K.feature),p)];for(let St of e){let It=K.support[St]??"none",pr=r?hg[It]:RA(It);z.push(a(` ${pr} `,m));}return o(n.dim,"\u2502")+z.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502")}),P=g(h),x=[R,I,E,...T,P];x.push("");let Y=[o(n.green,"\u2713")+" = native",o(n.blue,"\u25C6")+" = embedded",o(n.yellow,"\u25D0")+" = partial",o(n.dim,"\u2013")+" = not supported"];return x.push(o(n.bold,"Legend: ")+Y.join(" ")),x.join(`
|
|
134
|
+
`)}var kA=d(()=>{CA();OA();s(yg,"formatMatrix");});function _g(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?"":`
|
|
135
|
+
Per-file details:
|
|
136
|
+
`+e.join(`
|
|
137
|
+
`)+`
|
|
138
|
+
`}var EA=d(()=>{s(_g,"formatVerboseDetails");});var Cg=d(()=>{IA();kA();EA();});var Sg={};lp(Sg,{runMatrix:()=>fl});async function fl(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 ct(r,n);await re(a,r);let{canonical:c}=await De(a,l.configDir,{},l.canonicalDir),m=i??[...a.targets,...a.pluginTargets??[]],p=gg(a,c,n),u=_g(c);return {exitCode:0,data:{targets:m,features:p.map(f=>({name:f.feature,support:f.support}))},verboseDetails:u||void 0}}var gl=d(()=>{ge();Oo();Cg();ko();s(fl,"runMatrix");});var Rg={};lp(Rg,{renderMatrix:()=>hl});function hl(t,e){if(t.data.features.length===0){_.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=yg(r,t.data.targets);process.stdout.write(n),process.stdout.write(`
|
|
139
|
+
`),e?.verbose&&t.verboseDetails&&(process.stdout.write(t.verboseDetails),process.stdout.write(`
|
|
140
|
+
`));}var yl=d(()=>{tt();Cg();s(hl,"renderMatrix");});function uh(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(uh,"createRouter");tt();var fh=[{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)"}],gh=[{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)"}]}];function hh(t,e=18){return t.length===0?" (no command-specific flags)":t.map(r=>` ${r.name.padEnd(e)}${r.description}`).join(`
|
|
141
|
+
`)}s(hh,"formatFlags");function yh(){let t=gh.map(e=>`- ${e.name.padEnd(8)} ${e.description}
|
|
134
142
|
Usage: ${e.usage}
|
|
135
|
-
${
|
|
143
|
+
${hh(e.flags)}`).join(`
|
|
136
144
|
|
|
137
|
-
`);
|
|
145
|
+
`);_.info(`agentsmesh <command> [flags]
|
|
138
146
|
|
|
139
147
|
Global flags:
|
|
140
|
-
${
|
|
148
|
+
${hh(fh)}
|
|
141
149
|
|
|
142
150
|
Commands:
|
|
143
151
|
${t}
|
|
144
152
|
|
|
145
|
-
Tip: run "agentsmesh <command> --help" for this same command reference.`);}
|
|
146
|
-
`);}
|
|
147
|
-
`):y.error(t.message),process.exit(1);}i(rg,"handleError");A();_i();br();var lg=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],ie=z$1.enum(Ot),rs=z$1.enum(lg),Oi=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(),EA=z$1.object({name:z$1.string(),source:z$1.string(),version:z$1.string().optional(),target:ie.optional(),features:z$1.array(rs),path:z$1.string().optional(),pick:Oi.optional()}),wA=z$1.object({strategy:z$1.enum(["merge","lock","last-wins"]).default("merge"),lock_features:z$1.array(z$1.string()).default([])}),Ci=z$1.union([z$1.boolean(),z$1.object({project:z$1.boolean().optional(),global:z$1.boolean().optional()}).strict()]),LA=z$1.object({commands_to_skills:z$1.object({"codex-cli":Ci.optional()}).passthrough().optional(),agents_to_skills:z$1.object({"gemini-cli":Ci.optional(),cline:Ci.optional(),"codex-cli":Ci.optional(),windsurf:Ci.optional()}).passthrough().optional()}).strict().optional(),AA=z$1.object({id:z$1.string().regex(/^[a-z][a-z0-9-]*$/),source:z$1.string(),version:z$1.string().optional()}).strict(),ym=z$1.object({version:z$1.literal(1),targets:z$1.array(ie).default([...Ot]),features:z$1.array(rs).default([...lg]),extends:z$1.array(EA).default([]),overrides:z$1.record(z$1.string(),z$1.record(z$1.string(),z$1.unknown())).default({}),collaboration:wA.default({strategy:"merge",lock_features:[]}),conversions:LA,plugins:z$1.array(AA).default([]),pluginTargets:z$1.array(z$1.string().regex(/^[a-z][a-z0-9-]*$/)).default([])});var _m="agentsmesh.yaml",PA="agentsmesh.local.yaml";async function xA(t){let e=resolve(t);for(;;){let r=join(e,_m);if(await F(r))return r;let n=dirname(e);if(n===e)return null;e=n;}}i(xA,"findConfigPath");async function TA(t){let e=await I(t);if(e===null)throw new pn(t);let r=parse(e),n=ym.safeParse(r);if(!n.success){let o=n.error.issues.map(s=>s.message);throw new Va(t,o,{cause:n.error})}return n.data}i(TA,"loadConfig");function Im(t,e){let r={...t};for(let[n,o]of Object.entries(e)){if(o==null)continue;let s=r[n];typeof o=="object"&&!Array.isArray(o)&&o!==null&&typeof s=="object"&&s!==null&&!Array.isArray(s)?r[n]=Im(s,o):r[n]=o;}return r}i(Im,"deepMergeObjects");function NA(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=Im(r.overrides??{},e.overrides)),typeof e.conversions=="object"&&e.conversions!==null&&!Array.isArray(e.conversions)&&(r.conversions=Im(r.conversions??{},e.conversions)),Array.isArray(e.extends)&&e.extends.length>0&&(r.extends=[...t.extends??[],...e.extends]),r}i(NA,"mergeLocalConfig");async function Sm(t){let e=join(t,_m),r=await TA(e),n=join(t,PA),o=await I(n);if(o!==null){let s=parse(o);if(typeof s=="object"&&s!==null&&!Array.isArray(s)){let a=NA(r,s),l=ym.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}}i(Sm,"loadConfigFromExactDir");async function pg(t){let e=await xA(t);if(e===null)throw new pn(join(t,_m));return Sm(dirname(e))}i(pg,"loadConfigFromDir");_i();function Ri(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}}i(Ri,"resolveScopeContext");async function ut(t,e="project"){if(e==="project"){let{config:n,configDir:o}=await pg(t);return {config:n,context:{scope:e,rootBase:o,configDir:o,canonicalDir:join(o,".agentsmesh")}}}let r=Ri(t,e);try{let{config:n}=await Sm(r.configDir);return {config:n,context:r}}catch(n){throw n instanceof pn?new pn(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}}i(ut,"loadScopedConfig");A();A();var jA=promisify(execFile),ug="repo";async function Xa(t,e,r,n,o){let s="cloneUrl"in t?"gitlab":"git",a="cloneUrl"in t?`${t.namespace}/${t.project}`:t.url,l=t.ref??"HEAD",c=o(s,a,l),m=join(n,c),p=join(m,ug),u=`${m}.tmp`,d=join(u,ug);if(!r.refresh&&await dg(p))return km(p);try{return await rm$1(u,{recursive:!0,force:!0}),await mkdir(u,{recursive:!0}),await KA(UA(t),d),t.ref&&await WA(d,t.ref),await rm$1(m,{recursive:!0,force:!0}),await rename(u,m),km(p)}catch(g){if(await rm$1(u,{recursive:true,force:true}),r.allowOfflineFallback!==false&&await dg(p))return console.warn(`[agentsmesh] Remote fetch failed for ${e}; using cached version. Error: ${g instanceof Error?g.message:String(g)}`),km(p);throw g}}i(Xa,"fetchGitRemoteExtend");async function km(t){return {resolvedPath:t,version:await BA(t)}}i(km,"readCachedRepo");async function dg(t){return F(t)}i(dg,"hasCachedRepo");function UA(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}i(UA,"resolveCloneUrl");async function KA(t,e){await Em(["clone",t,e]);}i(KA,"cloneRepo");async function WA(t,e){await Em(["checkout",e],t);}i(WA,"checkoutRef");async function BA(t){return Em(["rev-parse","HEAD"],t)}i(BA,"getHeadSha");async function Em(t,e){let{stdout:r}=await jA("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return r.trim()}i(Em,"runGit");A();async function yg(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 s=await globalThis.fetch(n,{headers:o});if(!s.ok)throw new Error(`Failed to resolve latest release for ${t}/${e}: ${s.status} ${s.statusText}`);let a=await s.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}i(yg,"resolveLatestTag");async function Ig(t,e,r,n,o,s=false){let a=r.token??process.env.AGENTSMESH_GITHUB_TOKEN,l=r.refresh===true,c=t.tag;if(c==="latest")try{c=await yg(t.org,t.repo,a);}catch(_){if(!s)throw _;return YA(t,e,r,n,o,a)}let m=o("github",`${t.org}/${t.repo}`,c),p=join(n,m);if(!l&&await F(p)){let _=await wm(p);if(_)return {resolvedPath:join(p,_),version:c}}let u=`https://github.com/${t.org}/${t.repo}/tarball/${c}`,d={};a&&(d.Authorization=`Bearer ${a}`);let g;try{let _=await globalThis.fetch(u,{headers:d,redirect:"follow"});if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);g=await _.arrayBuffer();}catch(_){if(r.allowOfflineFallback!==false&&await F(p)){let D=await wm(p);if(D)return console.warn(`[agentsmesh] Network failed for ${e}; using cached version. Error: ${_ instanceof Error?_.message:String(_)}`),{resolvedPath:join(p,D),version:c}}throw _}await rm$1(p,{recursive:true,force:true}),await mkdir(p,{recursive:true});let h=join(p,"archive.tar.gz");await writeFile(h,new Uint8Array(g));try{await hg.extract({file:h,cwd:p,strict:!0,filter:i((_,k)=>!(JA(_)||k&&"type"in k&&(k.type==="Link"||k.type==="SymbolicLink")),"filter")});}finally{await rm$1(h,{force:true}).catch(()=>{});}let C=await wm(p);if(!C)throw new Error(`Extend "${e}": archive has no top-level directory. Expected a single top-level directory inside the archive.`);return {resolvedPath:join(p,C),version:c}}i(Ig,"fetchGithubRemoteExtend");async function wm(t){let r=(await readdir(t,{withFileTypes:true})).filter(n=>n.isDirectory()&&!n.name.startsWith("."));return r.length===1?r[0].name:null}i(wm,"findExtractTopDir");function gg(t,e,r){return r?`https://x-access-token:${encodeURIComponent(r)}@github.com/${t}/${e}.git`:`https://github.com/${t}/${e}.git`}i(gg,"buildGithubCloneUrl");function JA(t){let e=t.replace(/\\/g,"/");return e.startsWith("/")||e.split("/").includes("..")}i(JA,"isZipSlipPath");async function YA(t,e,r,n,o,s){let a=s?[gg(t.org,t.repo,s)]:[gg(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 Xa(m,e,r,n,o)}catch(p){l=p;}}throw l instanceof Error?l:new Error("Failed to clone GitHub default branch")}i(YA,"fetchGithubDefaultBranch");function _g(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 s=n.slice(0,o).trim(),a=n.slice(o+1).trim();return !s||!a?null:[s,a]}i(_g,"splitSourceRef");function Sg(t){let e=_g(t,"github:","latest");if(!e)return null;let[r,n]=e,o=r.indexOf("/");if(o<0)return null;let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();return !s||!a||!n?null:{org:s,repo:a,tag:n}}i(Sg,"parseGithubSource");function Cg(t){let e=_g(t,"gitlab:");if(!e)return null;let[r,n]=e,o=r.lastIndexOf("/");if(o<0)return null;let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();return !s||!a?null:{namespace:s,project:a,ref:n,cloneUrl:`https://gitlab.com/${s}/${a}.git`}}i(Cg,"parseGitlabSource");function Og(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 s;try{s=new URL(n);}catch{return null}return ["https:","http:","ssh:","file:"].includes(s.protocol)?{url:n,ref:o}:null}i(Og,"parseGitSource");function Xn(t){let e=Sg(t);if(e)return {kind:"github",...e};let r=Cg(t);if(r)return {kind:"gitlab",...r};let n=Og(t);return n?{kind:"git",...n}:null}i(Xn,"parseRemoteSource");function Lm(t){return Xn(t)!==null}i(Lm,"isSupportedRemoteSource");function QA(t){let e=Xn(t);return e?e.kind==="github"?ns("github",`${e.org}/${e.repo}`,e.tag):e.kind==="gitlab"?ns("gitlab",`${e.namespace}/${e.project}`,e.ref??"HEAD"):ns("git",e.url,e.ref??"HEAD"):null}i(QA,"cacheKeyFromSource");async function Eg(t,e){let r=QA(t);if(!r)return;let n=e??zt(),o=join(n,r);await rm$1(o,{recursive:true,force:true});}i(Eg,"cleanInstallCache");async function wg(t,e){let r=t??zt(),n=e??Number(process.env.AGENTSMESH_CACHE_MAX_AGE_DAYS??30)*864e5,o;try{o=await readdir(r);}catch{return}let s=Date.now();await Promise.all(o.map(async a=>{let l=join(r,a);try{let{mtimeMs:c}=await stat(l);s-c>n&&await rm$1(l,{recursive:!0,force:!0});}catch{}}));}i(wg,"sweepStaleCache");var Lg=80;function ns(t,e,r){let n=i(s=>s.replace(/[^a-zA-Z0-9_.-]/g,"_").replace(/^\.+/,"_"),"safe"),o;if(t==="github"){let[s,a]=e.split("/",2);s&&a?o=`${n(s)}--${n(a)}--${n(r)}`:o=`${n(t)}__${n(e)}__${n(r)}`;}else o=`${n(t)}__${n(e)}__${n(r)}`;if(o.length>Lg){let s=createHash("sha256").update(o).digest("hex").slice(0,16);o=`${o.slice(0,Lg-18)}--${s}`;}return o}i(ns,"buildCacheKey");function zt(){let t=process.env.AGENTSMESH_CACHE;return t||join(homedir(),".agentsmesh","cache")}i(zt,"getCacheDir");async function os(t,e,r={}){let n=Xn(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??zt();return wg(o).catch(()=>{}),n.kind==="github"?Ig(n,e,r,o,ns,!t.includes("@")):Xa(n,e,r,o,ns)}i(os,"fetchRemoteExtend");function ib(t){return t.startsWith("http://")||t.startsWith("https://")}i(ib,"isOtherRemoteSource");async function ss(t,e,r={}){if(t.extends.length===0)return [];if(r.refreshCache===true&&t.extends.some(o=>Lm(o.source))){let o=zt();await rm$1(o,{recursive:true,force:true}),await mkdir(o,{recursive:true});}let n=[];for(let o of t.extends){if(ib(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(Lm(o.source)){let a=await os(o.source,o.name,{cacheDir:zt(),refresh:r.refreshCache===true});n.push({name:o.name,resolvedPath:a.resolvedPath,features:[...o.features],target:o.target,version:a.version,path:o.path,pick:o.pick});continue}let s=resolve(e,o.source);if(!await F(s))throw new Error(`Extend "${o.name}": path does not exist: ${s}. Check extends.source in agentsmesh.yaml.`);n.push({name:o.name,resolvedPath:s,features:[...o.features],target:o.target,path:o.path,pick:o.pick});}return n}i(ss,"resolveExtendPaths");A();v();var cb=["always_on","model_decision","glob","manual"];function bg(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t?[t]:[]:[]}i(bg,"toStrArray");async function Zn(t){let r=(await x(t)).filter(o=>{if(!o.endsWith(".md"))return false;let s=basename(o,".md");return s==="_root"||!s.startsWith("_")}),n=[];for(let o of r){let s=await I(o);if(!s)continue;let{frontmatter:a,body:l}=E(s),m=basename(o,".md")==="_root",p=a.root===true,u=a.trigger,d=typeof u=="string"&&cb.includes(u)?u:void 0,g=a.codex_emit,h=g==="execution"?"execution":g==="advisory"?"advisory":void 0,O=a.codex_instruction==="override"?"override":void 0;n.push({source:o,root:m||p,targets:bg(a.targets),description:typeof a.description=="string"?a.description:"",globs:bg(a.globs),body:l,...d!==void 0&&{trigger:d},...h!==void 0&&{codexEmit:h},...O!==void 0&&{codexInstructionVariant:O}});}return n}i(Zn,"parseRules");A();v();function xg(t){return t===true||t==="true"||t===1||t==="1"}i(xg,"toBool");function Tg(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):[]}i(Tg,"toToolsArray");async function qn(t){let r=(await x(t)).filter(o=>o.endsWith(".md")&&!basename(o).startsWith("_")),n=[];for(let o of r){let s=await I(o);if(!s)continue;let{frontmatter:a,body:l}=E(s),c=basename(o,".md"),m=Tg(a.allowedTools),p=Tg(a["allowed-tools"]),u=m.length>0?m:p;n.push({source:o,name:c,description:typeof a.description=="string"?a.description:"",allowedTools:u,outputStyle:xg(a.outputStyle)||xg(a["output-style"]),body:l});}return n}i(qn,"parseCommands");A();v();function Qn(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):[]}i(Qn,"toStrArray");function Dg(t){return t===true||t==="true"||t===1||t==="1"}i(Dg,"toBool");function Fg(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}i(Fg,"toInt");function mb(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}i(mb,"toHooks");async function to(t){let r=(await x(t)).filter(o=>o.endsWith(".md")&&!basename(o).startsWith("_")),n=[];for(let o of r){let s=await I(o);if(!s)continue;let{frontmatter:a,body:l}=E(s),c=basename(o,".md"),m=Qn(a.tools),p=Qn(a.tools),u=m.length>0?m:p,d=Qn(a.disallowedTools),g=Qn(a["disallowed-tools"]),h=d.length>0?d:g,C=Qn(a.mcpServers),O=Qn(a["mcp-servers"]),_=C.length>0?C:O,k=Qn(a.skills),D=Fg(a.maxTurns),b=Fg(a["max-turns"]),P=D>0?D:b>0?b:0;n.push({source:o,name:c,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:P,mcpServers:_,hooks:mb(a.hooks),skills:k,memory:typeof a.memory=="string"?a.memory:"",outputStyle:Dg(a.outputStyle)||Dg(a["output-style"]),body:l});}return n}i(to,"parseAgents");A();v();async function db(t){return await I(t)??""}i(db,"readContent");var Za="SKILL.md",fb=[".git","node_modules"];function gb(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}i(gb,"sanitizeSkillName");async function vg(t){let e=await x(t),r=[];for(let n of e){let s=n.slice(t.length+1).replace(/\\/g,"/");if(s===Za||s.endsWith(`/${Za}`))continue;let a=s.split("/")[0];if(fb.some(c=>a===c)||s===".DS_Store"||s.endsWith("/.DS_Store"))continue;let l=await db(n);r.push({relativePath:s,absolutePath:n,content:l});}return r.sort((n,o)=>n.relativePath.localeCompare(o.relativePath))}i(vg,"listSupportingFiles");async function $g(t){let e=join(t,Za),r=await I(e);if(!r)return null;let{frontmatter:n,body:o}=E(r),s=await vg(t),a=typeof n.name=="string"?gb(n.name):"";return {source:e,name:a||basename(t),description:typeof n.description=="string"?n.description:"",body:o,supportingFiles:s}}i($g,"parseSkillDirectory");async function is(t){let e;try{e=await readdir(t,{withFileTypes:!0});}catch{return []}let r=[];for(let n of e){if(!n.isDirectory()||n.name.startsWith("_"))continue;let o=join(t,n.name),s=join(o,Za),a=await I(s);if(!a)continue;let{frontmatter:l,body:c}=E(a),m=await vg(o);r.push({source:s,name:n.name,description:typeof l.description=="string"?l.description:"",body:c,supportingFiles:m});}return r.sort((n,o)=>n.name.localeCompare(o.name))}i(is,"parseSkills");A();function Mg(t){return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]=="string"))}i(Mg,"parseStringMap");function hb(t){if(!t||typeof t!="object")return null;let e=t,r=typeof e.type=="string"?e.type:"stdio",n=Mg(e.env),o=typeof e.description=="string"?e.description:void 0,s=typeof e.url=="string"?e.url:"";if(s)return {...o!==void 0&&{description:o},type:r,url:s,headers:Mg(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}}i(hb,"parseServer");async function qa(t){let e=await I(t);if(!e)return null;let r;try{r=JSON.parse(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[s,a]of Object.entries(n)){let l=hb(a);l&&(o[s]=l);}return {mcpServers:o}}i(qa,"parseMcp");A();function bm(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}i(bm,"ensureStringArray");async function Qa(t){let e=await I(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=bm(n.allow),s=bm(n.deny),a=bm(n.ask);return {allow:o,deny:s,ask:a}}i(Qa,"parsePermissions");A();we();var _b=["command","prompt"];function Sb(t){if(!t||typeof t!="object")return null;let e=t,r=e.matcher;if(typeof r!="string")return null;let n=Pm(e);if(!n)return null;let o=typeof e.type=="string"&&_b.includes(e.type)?e.type:void 0,s=typeof e.timeout=="number"&&Number.isFinite(e.timeout)?e.timeout:void 0,a=Gt(e)||void 0;return {matcher:r,command:n,...s!==void 0&&{timeout:s},...o&&{type:o},...a&&{prompt:a}}}i(Sb,"toHookEntry");async function tl(t){let e=await I(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[s,a]of Object.entries(o)){if(!Array.isArray(a))continue;let l=[];for(let c of a){let m=Sb(c);m&&l.push(m);}l.length>0&&(n[s]=l);}return n}i(tl,"parseHooks");A();async function el(t){let e=await I(t);if(e===null||!e.trim())return [];let r=e.split(/\r?\n/),n=[];for(let o of r){let s=o.trim();s===""||s.startsWith("#")||n.push(s);}return n}i(el,"parseIgnore");A();async function eo(t){let e=join(t,".agentsmesh"),r=await F(e)?e:t,[n,o,s,a,l,c,m,p]=await Promise.all([Zn(join(r,"rules")),qn(join(r,"commands")),to(join(r,"agents")),is(join(r,"skills")),qa(join(r,"mcp.json")),Qa(join(r,"permissions.yaml")),tl(join(r,"hooks.yaml")),el(join(r,"ignore"))]);return {rules:n,commands:o,agents:s,skills:a,mcp:l,permissions:c,hooks:m,ignore:p}}i(eo,"loadCanonicalFiles");function jg(t){return basename(t.source,".md")}i(jg,"ruleSlug");function as(t,e){let r=new Map(t.rules.map(p=>[jg(p),p]));for(let p of e.rules)r.set(jg(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 s=new Map(t.skills.map(p=>[p.name,p]));for(let p of e.skills)s.set(p.name,p);let a=Ob(t.mcp,e.mcp),l=Rb(t.permissions,e.permissions),c=kb(t.hooks,e.hooks),m=Eb(t.ignore,e.ignore);return {rules:Array.from(r.values()),commands:Array.from(n.values()),agents:Array.from(o.values()),skills:Array.from(s.values()),mcp:a,permissions:l,hooks:c,ignore:m}}i(as,"mergeCanonicalFiles");function Ob(t,e){if(!t&&!e)return null;let r=t?.mcpServers??{},n=e?.mcpServers??{};return {mcpServers:{...r,...n}}}i(Ob,"mergeMcp");function Rb(t,e){if(!t&&!e)return null;let r=xm(t?.allow??[],e?.allow??[]),n=xm(t?.deny??[],e?.deny??[]),o=xm(t?.ask??[],e?.ask??[]);return {allow:r,deny:n,ask:o}}i(Rb,"mergePermissions");function xm(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}i(xm,"mergeUniqueStrings");function kb(t,e){if(!t&&!e)return null;let r={},n=new Set([...Object.keys(t??{}),...Object.keys(e??{})]);for(let o of n){let s=e?.[o],a=t?.[o];r[o]=s!==void 0&&s.length>0?s:a??[];}return r}i(kb,"mergeHooks");function Eb(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}i(Eb,"mergeIgnore");A();var Ug=[{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"]}];async function rl(t){let e=null,r=0;for(let n of Ug){let o=0;for(let s of n.paths)await F(join(t,s))&&o++;o>r&&(r=o,e=n.target);}return r>0?e:null}i(rl,"detectNativeFormat");var Kg=Ug.map(t=>t.paths[0]).filter(t=>t!==void 0);A();Pp();Su();su();ju();Zp();Od();Fp();qp();Bu();Qu();Xu();var mF={"claude-code":Nl,cursor:ic,copilot:Zl,"gemini-cli":gc,"codex-cli":Kl,windsurf:Nc,cline:$l,continue:Bl,junie:Ic,kiro:kc,"kilo-code":Oc};async function wa(t,e){let r=mF[e];if(!r)throw new Error(`No importer registered for native target: ${e}`);return r(t)}i(wa,"importNativeToCanonical");A();var Gd="SKILL.md";async function Vo(t){if(!await F(t))return false;if(await F(join(t,Gd)))return true;try{let e=await readdir(t,{withFileTypes:!0});for(let r of e)if(!(!r.isDirectory()||r.name.startsWith("."))&&await F(join(t,r.name,Gd)))return !0}catch{return false}return false}i(Vo,"isSkillPackLayout");async function La(t){if(!await F(t))return [];if(await F(join(t,Gd))){let e=await $g(t);return e?[e]:[]}return is(t)}i(La,"loadSkillsAtExtendPath");A();function fF(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}i(fF,"emptyCanonical");function gF(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}i(gF,"isCanonicalSliceEmpty");async function jc(t){if(!await F(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),s=basename(t).replace(/\.md$/i,"");if(n==="rules")return {sliceRoot:r,implicitPick:{rules:[s]}};if(n==="commands")return {sliceRoot:r,implicitPick:{commands:[s]}};if(n==="agents")return {sliceRoot:r,implicitPick:{agents:[s]}};throw new Error(`Single-file install only supports .md files under rules/, commands/, or agents/. Got: ${t}`)}i(jc,"normalizeSlicePath");async function hF(t){if(basename(t)==="rules")return Zn(t);let r=join(t,"rules");return await F(r)?Zn(r):[]}i(hF,"parseRulesAt");async function yF(t){if(basename(t)==="commands")return qn(t);let r=join(t,"commands");return await F(r)?qn(r):[]}i(yF,"parseCommandsAt");async function IF(t){if(basename(t)==="agents")return to(t);let r=join(t,"agents");return await F(r)?to(r):[]}i(IF,"parseAgentsAt");async function _F(t){if(await Vo(t))return La(t);let e=join(t,"skills");return await Vo(e)?La(e):[]}i(_F,"loadSkillsForPartialSlice");async function Uc(t){let e=join(t,".agentsmesh");if(await F(e))return eo(t);let r=fF();if(r.rules=await hF(t),r.commands=await yF(t),r.agents=await IF(t),r.skills=await _F(t),gF(r))throw new Error(`No installable resources at ${t}. Expected .agentsmesh/, or rules/, commands/, agents/, or Anthropic-style skills (SKILL.md).`);return r}i(Uc,"loadCanonicalSliceAtPath");function SF(){return {rules:[],commands:[],agents:[],skills:[],mcp:null,permissions:null,hooks:null,ignore:[]}}i(SF,"emptyCanonical");async function rE(t){let e=t.resolvedPath;if(!t.path){let o=join(e,".agentsmesh");if(!await F(o)){if(await Vo(e)){let a=await La(e);return {...SF(),skills:a}}let s=t.target??await rl(e);if(!s)throw new Error(`Extend "${t.name}": No supported agent configuration found in ${e}.
|
|
148
|
-
|
|
153
|
+
Tip: run "agentsmesh <command> --help" for this same command reference.`);}s(yh,"printHelp");var Jb=createRequire(import.meta.url),cp=dirname(fileURLToPath(import.meta.url)),Yb=cp.endsWith("dist")?join(cp,"..","package.json"):join(cp,"..","..","package.json"),_h=Jb(Yb);function wl(){return _h.version}s(wl,"getVersion");function Ch(){process.stdout.write(`agentsmesh v${_h.version}
|
|
154
|
+
`);}s(Ch,"printVersion");tt();function xs(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)+`
|
|
155
|
+
`);}s(xs,"emitJson");var dr=class extends Error{static{s(this,"CliUsageError");}constructor(e){super(e),this.name="CliUsageError";}};function Sh(t,e){let r=t instanceof dr?2:1;if(e?.json)return xs(e.command??"unknown",{success:false,error:t.message}),process.exit(r);e?.verbose&&t.stack?process.stderr.write(t.stack+`
|
|
156
|
+
`):_.error(t.message),process.exit(r);}s(Sh,"handleError");tt();function se(t,e,r,n){if(r.json===true){let o=e.exitCode===0;xs(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(se,"handleResult");ge();Oo();A();function ml(t){return createHash("sha256").update(t,"utf8").digest("hex")}s(ml,"hashContent");async function Mm(t){try{let e=await readFile(t,"utf8");return ml(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return null;throw e}}s(Mm,"hashFile");vm();var sg=".lock",KG=[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 WG(t){return t.startsWith("packs/")?false:KG.some(e=>e(t))}s(WG,"isCanonical");var BG={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 Gm(t){let e=join(t,sg),r=await y(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(Gm,"readLock");async function $m(t,e){let r=join(t,sg),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.
|
|
149
157
|
# Tracks the state of all config files for team conflict resolution.
|
|
150
158
|
|
|
151
|
-
`+stringify(n);await
|
|
152
|
-
`),a=Pa(s),l=a.startsWith("sha256:")?a:`sha256:${a}`;e[r.name]=`local:${l}`;}return e}i(Jo,"buildExtendChecksums");it();wr();function MF(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}i(MF,"addDirectoryMapping");function mE(t,e,r){let n=posix.dirname(e),o=posix.dirname(r);for(;n!==".agentsmesh/skills"&&n!==".";)MF(t,n,o),n=posix.dirname(n),o=posix.dirname(o);}i(mE,"addSkillDirectoryMappings");it();function pE(t,e,r="project"){let n=_t(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)}i(pE,"ruleTargetPath");function uE(t,e,r,n="project"){let o=_t(t,n);return o?o.paths.commandPath(e,r):null}i(uE,"commandTargetPath");function dE(t,e,r,n="project"){let o=_t(t,n);return o?o.paths.agentPath(e,r):null}i(dE,"agentTargetPath");Mt();It();Bt();it();function UF(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}i(UF,"addDirectoryMapping");function Na(t,e,r,n="project"){let o=new Map;for(let a of e.rules){let l=pE(t,a,n);l&&o.set(`.agentsmesh/rules/${basename(a.source)}`,l);}for(let a of e.commands){let l=uE(t,a.name,r,n);l&&o.set(`.agentsmesh/commands/${a.name}.md`,l);}for(let a of e.agents){let l=dE(t,a.name,r,n);l&&o.set(`.agentsmesh/agents/${a.name}.md`,l);}let s=Oa(t,n);if(!s)return o;for(let a of e.skills){UF(o,`.agentsmesh/skills/${a.name}`,`${s}/${a.name}`),o.set(`.agentsmesh/skills/${a.name}/SKILL.md`,`${s}/${a.name}/SKILL.md`);for(let l of a.supportingFiles){let c=l.relativePath.replace(/\\/g,"/"),m=`.agentsmesh/skills/${a.name}/${c}`,p=`${s}/${a.name}/${c}`;o.set(m,p),mE(o,m,p);}}return o}i(Na,"buildReferenceMap");br();var Jn="AGENTS.md";function KF(t){return t.target===Si&&t.path.endsWith(Jn)}i(KF,"isCodexAgents");function fE(t){return t.target==="windsurf"&&t.path.endsWith(Jn)}i(fE,"isWindsurfAgents");function gE(t){return t.target==="cline"&&t.path.endsWith(Jn)}i(gE,"isClineAgents");function Hd(t){return t.target==="cursor"&&t.path.endsWith(Jn)}i(Hd,"isCursorAgents");function zd(t){return t.target==="gemini-cli"&&t.path.endsWith(Jn)}i(zd,"isGeminiAgents");function WF(t){return t.target==="kiro"&&t.path.endsWith(Jn)}i(WF,"isKiroAgents");function BF(t){return t.target==="kilo-code"&&t.path.endsWith(Jn)}i(BF,"isKiloCodeAgents");function HF(t){return Hd(t)||zd(t)}i(HF,"isCompatibilityAgents");function Yc(t,e,r,n){let o=n.get(t);if(o)return o;let s=new Map;for(let[a,l]of Na(t,e,r))s.has(l)||s.set(l,a);return n.set(t,s),s}i(Yc,"reverseReferenceMap");function Xc(t,e){let r=[...e.entries()].sort(([o],[s])=>s.length-o.length),n=t;for(let[o,s]of r)n=n.split(o).join(s);return n}i(Xc,"normalizeContent");function zF(t,e,r,n,o){let s=Yc(t.target,r,n,o),a=Yc(e.target,r,n,o);return Xc(t.content,s)===Xc(e.content,a)}i(zF,"hasEquivalentCanonicalContent");function VF(t,e,r,n,o){let s=Yc(t.target,r,n,o),a=Yc(e.target,r,n,o),l=Xc(t.content,s).trim(),c=Xc(e.content,a).trim();return l.length>c.length&&l.includes(c)}i(VF,"hasCanonicalSupersetContent");function hE(t,e,r){let n=new Map;for(let a of t){if(!a.path.endsWith(Jn))continue;let l=n.get(a.path)??new Set;l.add(a.target),n.set(a.path,l);}let o=new Map;for(let a of t)KF(a)&&o.set(a.path,a);let s=new Map;return t.filter(a=>{if(Hd(a)){let c=n.get(a.path);if(c&&[...c].some(m=>m!=="cursor"))return false}if(zd(a)){let c=n.get(a.path);if(c&&[...c].some(m=>m!=="cursor"&&m!=="gemini-cli"))return false}if(!fE(a)&&!gE(a)&&!Hd(a)&&!zd(a)&&!WF(a)&&!BF(a))return true;let l=o.get(a.path);return l?HF(a)||fE(a)||gE(a)?false:!(zF(l,a,e,r,s)||VF(l,a,e,r,s)):true})}i(hE,"preferEquivalentCodexAgents");Pt();Fd();Pt();Pt();it();function IE(t,e,r,n){let o=n.normalize(e),s=n.normalize(r);t.set(o,s),t.set(`${o}/`,`${s}/`);}i(IE,"addPackAbsoluteDirMapping");function JF(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 s=posix.dirname(o);if(s===o)break;o=s;}}return [...e]}i(JF,"skillSupportingDirPrefixes");function _E(t,e,r,n,o){let s=Oa(e,o);if(!s)return;let a=H(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,s,c.name));IE(t,m,p,a),t.set(a.normalize(c.source),a.normalize(a.join(p,"SKILL.md")));for(let u of c.supportingFiles){let d=a.normalize(a.join(p,u.relativePath));t.set(a.normalize(u.absolutePath),d);}for(let u of JF(c.supportingFiles))IE(t,a.join(m,u),a.join(p,u),a);}}i(_E,"addPackSkillArtifactMappings");Pt();function YF(t){return `.agentsmesh/rules/${basename(t.source)}`}i(YF,"canonicalRulePath");function XF(t){return `.github/instructions/${basename(t.source,".md")}.instructions.md`}i(XF,"copilotInstructionsPath");function CE(t,e,r,n,o){if(t!=="copilot"||!n?.startsWith(".github/instructions/"))return;let s=H(r);for(let a of o.rules)a.root||a.globs.length===0||e.set(s.normalize(s.join(r,YF(a))),s.normalize(s.join(r,XF(a))));}i(CE,"applyCopilotInstructionArtifactRefs");it();function Zc(t){return t?(t.outputFamilies??[]).filter(e=>e.kind==="additional").flatMap(e=>[...e.explicitPaths??[]]):[]}i(Zc,"getAdditionalRootDecorationPaths");function OE(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"}i(OE,"resolveRewriteFamilyId");function Vd(t,e){e!==void 0&&e.length>0&&!t.includes(e)&&t.push(e);}i(Vd,"pushUnique");function RE(t,e,r,n){let o=[],s=r.get(`.agentsmesh/rules/${basename(e.source)}`);Vd(o,s);let a=_t(t,n);if(e.root)for(let l of Zc(a))Vd(o,l);for(let l of a?.extraRuleOutputPaths?.(e,{refs:r,scope:n})??[])Vd(o,l);return o}i(RE,"extraRuleOutputPaths");it();function kE(t,e,r,n,o,s){let a=_t(t,e);if(!a?.mirrorGlobalPath)return;let l=a.mirrorGlobalPath(r,s??[]),c=l===null?[]:Array.isArray(l)?l:[l];for(let m of c)m!==r&&o.set(m,n);}i(kE,"addSkillMirrorSourceEntry");function qF(t){return `.agentsmesh/commands/${t.name}.md`}i(qF,"canonicalCommandPath");function QF(t){return `.agentsmesh/agents/${t.name}.md`}i(QF,"canonicalAgentPath");function tv(t){return `.agentsmesh/skills/${t.name}/SKILL.md`}i(tv,"canonicalSkillPath");function EE(t,e,r,n,o,s){let a=s?.scope??"project",l=H(n),c=new Map([...Na(t,e,r,a)].map(([m,p])=>[l.normalize(l.join(n,m)),l.normalize(l.join(n,p))]));return CE(t,c,n,o,e),_E(c,t,e,n,a),c}i(EE,"buildArtifactPathMap");function wE(t,e,r,n="project",o){let s=Na(t,e,r,n),a=new Map;for(let l of e.rules)for(let c of RE(t,l,s,n))a.set(c,l.source);for(let l of e.commands){let c=s.get(qF(l));c&&a.set(c,l.source);}for(let l of e.agents){let c=s.get(QF(l));c&&a.set(c,l.source);}for(let l of e.skills){let c=s.get(tv(l));c&&(a.set(c,l.source),kE(t,n,c,l.source,a,o));for(let m of l.supportingFiles){let p=`.agentsmesh/skills/${l.name}/${m.relativePath.replace(/\\/g,"/")}`,u=s.get(p);u&&(a.set(u,m.absolutePath),kE(t,n,u,m.absolutePath,a,o));}}return a}i(wE,"buildOutputSourceMap");it();wr();Tm();function nv(t,e){if(!e)return null;for(let r of e){let n=rt(r);if(n?.sharedArtifacts){for(let[o,s]of Object.entries(n.sharedArtifacts))if(s==="owner"&&t.startsWith(o))return r}}return null}i(nv,"findSharedArtifactOwner");function LE(t,e,r){if(e==="global"){let n=nv(t.path,r);if(n)return n;let o=Xg(t.path);if(o)return o}return t.target}i(LE,"artifactMapTargetForResult");function ov(t,e){return `${t}\0${(e??[]).join(",")}`}i(ov,"sourceMapCacheKey");function Jd(t,e){let r=H(t),n=new Set;for(let o of e){let s=r.join(t,o.path);n.add(s);let a=r.dirname(s);for(;a.startsWith(t)&&!n.has(a)&&(n.add(a),a!==t);)a=r.dirname(a);}return n}i(Jd,"collectPlannedPaths");function sv(t,e,r){let n=_t(t.target,e),o=OE(n,t.path);if(o!=="default")return `${t.target}:${o}`;let s=LE(t,e,r);return s===t.target?t.target:`${t.target}~via~${s}`}i(sv,"artifactCacheKey");function AE(t,e,r,n,o="project",s){let a=Jd(n,t),l=new Map,c=new Map;return t.map(m=>{let p=ov(m.target,s),d=(c.get(p)??(()=>{let _=wE(m.target,e,r,o,s);return c.set(p,_),_})()).get(m.path);if(!d)return m;let g=LE(m,o,s),h=sv(m,o,s),C=l.get(h)??(()=>{let _=EE(g,e,r,n,m.path,{scope:o});return l.set(h,_),_})(),O=Mc({content:m.content,projectRoot:n,sourceFile:d,destinationFile:H(n).join(n,m.path),translatePath:i(_=>C.get(_)??_,"translatePath"),pathExists:i(_=>a.has(_)||existsSync(_),"pathExists"),explicitCurrentDirLinks:true,rewriteBarePathTokens:true,scope:o,pathIsDirectory:i(_=>{try{return statSync(_).isDirectory()}catch{return false}},"pathIsDirectory")});return O.content===m.content?m:{...m,content:O.content}})}i(AE,"rewriteGeneratedReferences");Pt();Vn();var av=/!?\[[^\]]*\]\(([^)]+)\)/g,lv=/^\s*\[[^\]\n]+\]:\s*(?:<([^>\n]*)>|(\S+))/gm;function cv(t){return t.endsWith(".md")||t.endsWith(".mdc")}i(cv,"isMarkdownLikeOutput");function mv(t,e){return e.some(([r,n])=>t>=r&&t<n)}i(mv,"isOffsetInRanges");function pv(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}i(pv,"parseMarkdownLinkDestination");function uv(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)}i(uv,"shouldSkipLocalValidation");function dv(t,e){if(e.has(t))return true;try{let r=statSync(t);return r.isFile()||r.isDirectory()}catch{return false}}i(dv,"pathExistsForGenerate");function fv(t,e,r){let o=pv(t).split("#")[0]??"",{candidate:s}=ls(o),a=s,l=ii.exec(a);l&&(a=a.slice(0,l.index));let c;try{c=decodeURIComponent(a);}catch{c=a;}if(uv(c))return [];let m=Ra(c,e,r);if(m.length===0){let u=H(e),d=G(e,r);m=[G(e,u.join(u.dirname(d),c)),G(e,u.join(e,c))];}let p=[];for(let u of m)for(let d of ka(e,u)){let g=G(e,d);p.includes(g)||p.push(g);}return p}i(fv,"resolveMarkdownLinkTargets");function gv(t,e){let r=Jd(e,t),n=[];for(let o of t){if(!cv(o.path))continue;let s=G(e,H(e).join(e,o.path)),a=$c(o.content),l=i((c,m)=>{if(mv(m,a))return;let p=fv(c,e,s);p.length!==0&&(p.some(u=>dv(u,r))||n.push({generatePath:o.path,target:o.target,rawLink:c.trim(),checkedPaths:p}));},"visitDestination");for(let c of o.content.matchAll(av)){let m=c[1];m!==void 0&&l(m,c.index??0);}for(let c of o.content.matchAll(lv)){let m=(c[1]??c[2]??"").trim();m&&l(m,c.index??0);}}return n}i(gv,"findBrokenMarkdownLinks");function bE(t,e){let r=gv(t,e);if(r.length===0)return;let n=r.map(o=>` ${o.generatePath} (${o.target}): "${o.rawLink}" \u2192 not found (tried: ${o.checkedPaths.join(", ")})`);throw new Error(`Generated markdown contains broken local links:
|
|
159
|
+
`+stringify(n);await C(r,o);}s($m,"writeLock");async function Nn(t){if(!await F(t))return {};let e=await D(t),r={};for(let n of e){let o=relative(t,n).replace(/\\/g,"/");if(o===sg||!WG(o))continue;let i=await Mm(n);i!==null&&(r[o]=i.startsWith("sha256:")?i:`sha256:${i}`);}return r}s(Nn,"buildChecksums");function jm(t,e,r){if(r.length===0)return [];let n=r.map(a=>BG[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(jm,"detectLockedFeatureViolations");async function Um(t){let e=await Fm(t),r={};for(let{meta:n}of e)r[n.name]=n.content_hash;return r}s(Um,"buildPackChecksums");async function Gi(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 Nn(n),i=Object.keys(o).sort().map(c=>`${c}:${o[c]}`).join(`
|
|
160
|
+
`),a=ml(i),l=a.startsWith("sha256:")?a:`sha256:${a}`;e[r.name]=`local:${l}`;}return e}s(Gi,"buildExtendChecksums");mt();lr();function HG(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(HG,"addDirectoryMapping");function Pw(t,e,r){let n=posix.dirname(e),o=posix.dirname(r);for(;n!==".agentsmesh/skills"&&n!==".";)HG(t,n,o),n=posix.dirname(n),o=posix.dirname(o);}s(Pw,"addSkillDirectoryMappings");mt();function Tw(t,e,r="project"){let n=bt(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(Tw,"ruleTargetPath");function Dw(t,e,r,n="project"){let o=bt(t,n);return o?o.paths.commandPath(e,r):null}s(Dw,"commandTargetPath");function Nw(t,e,r,n="project"){let o=bt(t,n);return o?o.paths.agentPath(e,r):null}s(Nw,"agentTargetPath");Ht();xt();Zt();mt();function JG(t,e,r){t.set(e,r),t.set(`${e}/`,`${r}/`);}s(JG,"addDirectoryMapping");function pl(t,e,r,n="project"){let o=new Map;for(let a of e.rules){let l=Tw(t,a,n);l&&o.set(`.agentsmesh/rules/${basename(a.source)}`,l);}for(let a of e.commands){let l=Dw(t,a.name,r,n);l&&o.set(`.agentsmesh/commands/${a.name}.md`,l);}for(let a of e.agents){let l=Nw(t,a.name,r,n);l&&o.set(`.agentsmesh/agents/${a.name}.md`,l);}let i=rl(t,n);if(!i)return o;for(let a of e.skills){JG(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),Pw(o,m,p);}}return o}s(pl,"buildReferenceMap");Xr();var Fn="AGENTS.md";function YG(t){return t.target===Xi&&t.path.endsWith(Fn)}s(YG,"isCodexAgents");function Fw(t){return t.target==="windsurf"&&t.path.endsWith(Fn)}s(Fw,"isWindsurfAgents");function vw(t){return t.target==="cline"&&t.path.endsWith(Fn)}s(vw,"isClineAgents");function ig(t){return t.target==="cursor"&&t.path.endsWith(Fn)}s(ig,"isCursorAgents");function ag(t){return t.target==="gemini-cli"&&t.path.endsWith(Fn)}s(ag,"isGeminiAgents");function XG(t){return t.target==="kiro"&&t.path.endsWith(Fn)}s(XG,"isKiroAgents");function ZG(t){return t.target==="kilo-code"&&t.path.endsWith(Fn)}s(ZG,"isKiloCodeAgents");function Mw(t){return t.target==="warp"&&t.path.endsWith(Fn)}s(Mw,"isWarpAgents");function qG(t){return ig(t)||ag(t)}s(qG,"isCompatibilityAgents");function Wm(t,e,r,n){let o=n.get(t);if(o)return o;let i=new Map;for(let[a,l]of pl(t,e,r))i.has(l)||i.set(l,a);return n.set(t,i),i}s(Wm,"reverseReferenceMap");function Bm(t,e){let r=[...e.entries()].sort(([o],[i])=>i.length-o.length),n=t;for(let[o,i]of r)n=n.split(o).join(i);return n}s(Bm,"normalizeContent");function QG(t,e,r,n,o){let i=Wm(t.target,r,n,o),a=Wm(e.target,r,n,o);return Bm(t.content,i)===Bm(e.content,a)}s(QG,"hasEquivalentCanonicalContent");function t$(t,e,r,n,o){let i=Wm(t.target,r,n,o),a=Wm(e.target,r,n,o),l=Bm(t.content,i).trim(),c=Bm(e.content,a).trim();return l.length>c.length&&l.includes(c)}s(t$,"hasCanonicalSupersetContent");function Gw(t,e,r){let n=new Map;for(let a of t){if(!a.path.endsWith(Fn))continue;let l=n.get(a.path)??new Set;l.add(a.target),n.set(a.path,l);}let o=new Map;for(let a of t)YG(a)&&o.set(a.path,a);let i=new Map;return t.filter(a=>{if(ig(a)){let c=n.get(a.path);if(c&&[...c].some(m=>m!=="cursor"))return false}if(ag(a)){let c=n.get(a.path);if(c&&[...c].some(m=>m!=="cursor"&&m!=="gemini-cli"))return false}if(!Fw(a)&&!vw(a)&&!ig(a)&&!ag(a)&&!XG(a)&&!ZG(a)&&!Mw(a))return true;let l=o.get(a.path);return l?qG(a)||Fw(a)||vw(a)||Mw(a)?false:!(QG(l,a,e,r,i)||t$(l,a,e,r,i)):true})}s(Gw,"preferEquivalentCodexAgents");$t();Vf();$t();$t();mt();function jw(t,e,r,n){let o=n.normalize(e),i=n.normalize(r);t.set(o,i),t.set(`${o}/`,`${i}/`);}s(jw,"addPackAbsoluteDirMapping");function e$(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(e$,"skillSupportingDirPrefixes");function Uw(t,e,r,n,o){let i=rl(e,o);if(!i)return;let a=V(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));jw(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 e$(c.supportingFiles))jw(t,a.join(m,u),a.join(p,u),a);}}s(Uw,"addPackSkillArtifactMappings");$t();function r$(t){return `.agentsmesh/rules/${basename(t.source)}`}s(r$,"canonicalRulePath");function n$(t){return `.github/instructions/${basename(t.source,".md")}.instructions.md`}s(n$,"copilotInstructionsPath");function Ww(t,e,r,n,o){if(t!=="copilot"||!n?.startsWith(".github/instructions/"))return;let i=V(r);for(let a of o.rules)a.root||a.globs.length===0||e.set(i.normalize(i.join(r,r$(a))),i.normalize(i.join(r,n$(a))));}s(Ww,"applyCopilotInstructionArtifactRefs");mt();function Hm(t){return t?(t.outputFamilies??[]).filter(e=>e.kind==="additional").flatMap(e=>[...e.explicitPaths??[]]):[]}s(Hm,"getAdditionalRootDecorationPaths");function Bw(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(Bw,"resolveRewriteFamilyId");function lg(t,e){e!==void 0&&e.length>0&&!t.includes(e)&&t.push(e);}s(lg,"pushUnique");function Hw(t,e,r,n){let o=[],i=r.get(`.agentsmesh/rules/${basename(e.source)}`);lg(o,i);let a=bt(t,n);if(e.root)for(let l of Hm(a))lg(o,l);for(let l of a?.extraRuleOutputPaths?.(e,{refs:r,scope:n})??[])lg(o,l);return o}s(Hw,"extraRuleOutputPaths");mt();function zw(t,e,r,n,o,i){let a=bt(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(zw,"addSkillMirrorSourceEntry");function s$(t){return `.agentsmesh/commands/${t.name}.md`}s(s$,"canonicalCommandPath");function i$(t){return `.agentsmesh/agents/${t.name}.md`}s(i$,"canonicalAgentPath");function a$(t){return `.agentsmesh/skills/${t.name}/SKILL.md`}s(a$,"canonicalSkillPath");function Vw(t,e,r,n,o,i){let a=i?.scope??"project",l=V(n),c=new Map([...pl(t,e,r,a)].map(([m,p])=>[l.normalize(l.join(n,m)),l.normalize(l.join(n,p))]));return Ww(t,c,n,o,e),Uw(c,t,e,n,a),c}s(Vw,"buildArtifactPathMap");function Jw(t,e,r,n="project",o){let i=pl(t,e,r,n),a=new Map;for(let l of e.rules)for(let c of Hw(t,l,i,n))a.set(c,l.source);for(let l of e.commands){let c=i.get(s$(l));c&&a.set(c,l.source);}for(let l of e.agents){let c=i.get(i$(l));c&&a.set(c,l.source);}for(let l of e.skills){let c=i.get(a$(l));c&&(a.set(c,l.source),zw(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),zw(t,n,u,m.absolutePath,a,o));}}return a}s(Jw,"buildOutputSourceMap");mt();lr();Fp();function m$(t,e){if(!e)return null;for(let r of e){let n=rt(r);if(n?.sharedArtifacts){for(let[o,i]of Object.entries(n.sharedArtifacts))if(i==="owner"&&t.startsWith(o))return r}}return null}s(m$,"findSharedArtifactOwner");function Yw(t,e,r){if(e==="global"){let n=m$(t.path,r);if(n)return n;let o=Iy(t.path);if(o)return o}return t.target}s(Yw,"artifactMapTargetForResult");function p$(t,e){return `${t}\0${(e??[]).join(",")}`}s(p$,"sourceMapCacheKey");function cg(t,e){let r=V(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(cg,"collectPlannedPaths");function u$(t,e,r){let n=bt(t.target,e),o=Bw(n,t.path);if(o!=="default")return `${t.target}:${o}`;let i=Yw(t,e,r);return i===t.target?t.target:`${t.target}~via~${i}`}s(u$,"artifactCacheKey");function Xw(t,e,r,n,o="project",i){let a=cg(n,t),l=new Map,c=new Map;return t.map(m=>{let p=p$(m.target,i),f=(c.get(p)??(()=>{let I=Jw(m.target,e,r,o,i);return c.set(p,I),I})()).get(m.path);if(!f)return m;let g=Yw(m,o,i),h=u$(m,o,i),R=l.get(h)??(()=>{let I=Vw(g,e,r,n,m.path,{scope:o});return l.set(h,I),I})(),S=wm({content:m.content,projectRoot:n,sourceFile:f,destinationFile:V(n).join(n,m.path),translatePath:s(I=>R.get(I)??I,"translatePath"),pathExists:s(I=>a.has(I)||existsSync(I),"pathExists"),explicitCurrentDirLinks:true,rewriteBarePathTokens:true,scope:o,pathIsDirectory:s(I=>{try{return statSync(I).isDirectory()}catch{return false}},"pathIsDirectory")});return S.content===m.content?m:{...m,content:S.content}})}s(Xw,"rewriteGeneratedReferences");$t();Ro();var f$=/!?\[[^\]]*\]\(([^)]+)\)/g,g$=/^\s*\[[^\]\n]+\]:\s*(?:<([^>\n]*)>|(\S+))/gm;function h$(t){return t.endsWith(".md")||t.endsWith(".mdc")}s(h$,"isMarkdownLikeOutput");function y$(t,e){return e.some(([r,n])=>t>=r&&t<n)}s(y$,"isOffsetInRanges");function I$(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(I$,"parseMarkdownLinkDestination");function _$(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(_$,"shouldSkipLocalValidation");function C$(t,e){if(e.has(t))return true;try{let r=statSync(t);return r.isFile()||r.isDirectory()}catch{return false}}s(C$,"pathExistsForGenerate");function S$(t,e,r){let o=I$(t).split("#")[0]??"",{candidate:i}=Ms(o),a=i,l=Fi.exec(a);l&&(a=a.slice(0,l.index));let c;try{c=decodeURIComponent(a);}catch{c=a;}if(_$(c))return [];let m=nl(c,e,r);if(m.length===0){let u=V(e),f=j(e,r);m=[j(e,u.join(u.dirname(f),c)),j(e,u.join(e,c))];}let p=[];for(let u of m)for(let f of ol(e,u)){let g=j(e,f);p.includes(g)||p.push(g);}return p}s(S$,"resolveMarkdownLinkTargets");function R$(t,e){let r=cg(e,t),n=[];for(let o of t){if(!h$(o.path))continue;let i=j(e,V(e).join(e,o.path)),a=Lm(o.content),l=s((c,m)=>{if(y$(m,a))return;let p=S$(c,e,i);p.length!==0&&(p.some(u=>C$(u,r))||n.push({generatePath:o.path,target:o.target,rawLink:c.trim(),checkedPaths:p}));},"visitDestination");for(let c of o.content.matchAll(f$)){let m=c[1];m!==void 0&&l(m,c.index??0);}for(let c of o.content.matchAll(g$)){let m=(c[1]??c[2]??"").trim();m&&l(m,c.index??0);}}return n}s(R$,"findBrokenMarkdownLinks");function Zw(t,e){let r=R$(t,e);if(r.length===0)return;let n=r.map(o=>` ${o.generatePath} (${o.target}): "${o.rawLink}" \u2192 not found (tried: ${o.checkedPaths.join(", ")})`);throw new Error(`Generated markdown contains broken local links:
|
|
153
161
|
${n.join(`
|
|
154
162
|
`)}
|
|
155
|
-
Fix canonical sources or generators so every local link targets an existing file or folder.`)}i(bE,"validateGeneratedMarkdownLinks");br();var xE="AGENTS.md";function PE(t){switch(t){case "created":return 3;case "updated":return 2;case "unchanged":return 1;case "skipped":return 0}}i(PE,"statusRank");function hv(t,e){return PE(e.status)<=PE(t.status)?t:{...t,status:e.status,currentContent:e.currentContent??t.currentContent}}i(hv,"mergeDuplicateMetadata");function qc(t){return t.trim()}i(qc,"trimmedContent");function yv(t,e){if(!t.path.endsWith(xE)||t.path!==e.path)return null;let r=qc(t.content),n=qc(e.content);if(!r||!n)return null;let o=r.includes(n),s=n.includes(r);return o===s?null:o?t:e}i(yv,"richerAgentsResult");function Iv(t,e){if(!t.path.endsWith(xE)||t.path!==e.path)return null;let r=t.target===Si?t:e.target===Si?e:null,n=r===t?e:t;return r&&qc(r.content).length>qc(n.content).length?r:null}i(Iv,"richerCodexAgentsResult");function TE(t){let e=[];for(let r of t){let n=e.findIndex(s=>s.path===r.path);if(n===-1){e.push(r);continue}let o=e[n];if(o.content!==r.content){let s=yv(o,r);if(s){e[n]=s;continue}let a=Iv(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]=hv(o,r);}return e}i(TE,"resolveOutputCollisions");function NE(t){let e=t.currentContent===void 0?"created":t.currentContent!==t.content?"updated":"unchanged";return t.status===e?t:{...t,status:e}}i(NE,"refreshResultStatus");A();it();wr();function FE(t,e){return t===null?"created":t!==e?"updated":"unchanged"}i(FE,"computeStatus");function _v(t,e,r){let n=wd(t,e,r);if(n!==null)return n;let o=rt(t);if(!o)return null;let s=r==="global"?o.globalSupport?.layout:o.project;return s?(n=s.rewriteGeneratedPath?s.rewriteGeneratedPath(e):e,n):null}i(_v,"resolveGeneratedOutputPath");async function Da(t,e,r,n,o,s){let a=_v(e,r.path,o);if(a===null)return null;let l=await I(join(n,a)),c=t.findIndex(u=>u.path===a&&u.target===e),m=c>=0?t[c]:void 0,p=s?.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:FE(l,p)}),a}i(Da,"emitGeneratedOutput");function Yd(t,e,r){return {capability:Wn(t,r)?.[e]??{level:"none"},scope:r}}i(Yd,"featureContext");async function Yo(t,e,r,n,o,s,a,l){if(o)for(let c of e){let m=l(c);if(!m)continue;let p=Yd(c,a,s);for(let u of m(r,p)){let d=await Da(t,c,u,n,s);if(d===null)continue;let g=_t(c,s);if(g?.mirrorGlobalPath){let h=g.mirrorGlobalPath(d,e),C=h===null?[]:Array.isArray(h)?h:[h];for(let O of C){let _=await I(join(n,O));t.push({target:c,path:O,content:u.content,currentContent:_??void 0,status:FE(_,u.content)});}}}}}i(Yo,"generateFeature");$m();it();function Sv(t){return t?.rootInstructionPath?[t.rootInstructionPath,...Zc(t)]:[]}i(Sv,"rootDecorationPaths");function vE(t,e,r="project"){return t.map(n=>{let o=_t(n.target,r);if(!o)return n;let s=Sv(o);if(s.length===0||!s.includes(n.path))return n;let l=n.path===o.rootInstructionPath&&o.renderPrimaryRootInstruction?o.renderPrimaryRootInstruction(e):n.content,c=sh(l);return c===n.content?n:{...n,content:c}})}i(vE,"decoratePrimaryRootInstructions");it();wr();Ku();function Xd(t,e,r,n,o){let a=(Se(t)??rt(t))?.mergeGeneratedOutputContent?.(e,r,n,o);if(a!=null)return a;let l=r?.content??e;return l!==null&&XC.includes(o)?qC(l,n):n}i(Xd,"mergeOutputContent");async function $E(t,e,r,n,o){for(let s of e){let a=si(s,"permissions",void 0,o)??rt(s)?.generators.generatePermissions;if(a)for(let l of a(r))await Da(t,s,l,n,o,{mergeContent:i((c,m,p,u)=>Xd(s,c,m,p,u),"mergeContent")});}}i($E,"generatePermissionsFeature");async function ME(t,e,r,n,o,s){for(let a of e){let l=si(a,"hooks",s,o)??rt(a)?.generators.generateHooks;if(!l)continue;let c=Yd(a,"hooks",o),m=[...l(r,c)],u=(Se(a)??rt(a))?.postProcessHookOutputs;u&&(m=[...await u(n,r,m)]);for(let d of m)await Da(t,a,d,n,o,{mergeContent:i((g,h,C,O)=>Xd(a,g,h,C,O),"mergeContent")});}}i(ME,"generateHooksFeature");async function GE(t,e,r,n,o){for(let s of e){let l=(Se(s)??rt(s))?.emitScopedSettings;if(!l)continue;let c=l(r,o);if(c.length!==0)for(let m of c)await Da(t,s,m,n,o,{mergeContent:i((p,u,d,g)=>Xd(s,p,u,d,g),"mergeContent")});}}i(GE,"generateScopedSettingsFeature");async function Qc(t){let{config:e,canonical:r,projectRoot:n,scope:o="project",targetFilter:s}=t,a=[...e.targets,...e.pluginTargets??[]],l=s?a.filter(P=>s.includes(P)):a;function c(P,J){return si(P,J,e,o)}i(c,"resolveGen");let m=e.features.includes("rules"),p=e.features.includes("commands"),u=e.features.includes("agents"),d=e.features.includes("skills"),g=e.features.includes("mcp"),h=e.features.includes("permissions"),C=e.features.includes("hooks"),O=e.features.includes("ignore"),_=[];await Yo(_,l,r,n,m,o,"rules",P=>c(P,"rules")),await Yo(_,l,r,n,p,o,"commands",P=>c(P,"commands")),await Yo(_,l,r,n,u,o,"agents",P=>c(P,"agents")),await Yo(_,l,r,n,d,o,"skills",P=>c(P,"skills")),await Yo(_,l,r,n,g,o,"mcp",P=>c(P,"mcp")),h&&await $E(_,l,r,n,o),C&&await ME(_,l,r,n,o,e),await Yo(_,l,r,n,O,o,"ignore",P=>c(P,"ignore"));let k=new Set(e.features);for(let P of l){let j=(Se(P)??rt(P))?.globalSupport?.scopeExtras;if(j){let W=await j(r,n,o,k);_.push(...W);}}(g||O||C||u||h)&&await GE(_,l,r,n,o);let D=vE(_,r,o),b=AE(D,r,e,n,o,l);return bE(b,n),TE(hE(b.map(NE),r,e))}i(Qc,"generate");A();it();async function jE(t,e=t){let r=await readdir(t,{withFileTypes:true}),n=[];for(let o of r){let s=join(t,o.name);if(o.isDirectory()){n.push(...await jE(s,e));continue}n.push(relative(e,s).replace(/\\/g,"/"));}return n}i(jE,"listFiles");async function kv(t,e,r){if(r.has(e))return;let n=join(t,e);await F(n)&&await rm$1(n,{recursive:true,force:true});}i(kv,"removeIfStale");async function UE(t){let e=new Set(t.expectedPaths),r=new Set,n=t.scope??"project";for(let o of t.targets){let s=Ed(o,n);if(s){for(let a of s.files)r.add(a);for(let a of s.dirs){let l=join(t.projectRoot,a);if(await F(l))for(let c of await jE(l))r.add(`${a}/${c}`.replace(/\/+/g,"/"));}}}for(let o of r)await kv(t.projectRoot,o,e);}i(UE,"cleanupStaleGeneratedOutputs");A();_i();var xv=6e4,Tv=30,Nv=200,Dv=2e3;async function qd(t,e={}){let r=e.retries??Tv,n=e.retryDelayMs??Nv,o=e.staleMs??xv;await mkdir(dirname(t),{recursive:true});let s=0;for(;;){let a=await Fv(t);if(a)return a;let l=await vv(t);if(l!=="young"&&$v(l,o)){await rm$1(t,{recursive:true,force:true}).catch(()=>{});continue}if(s>=r){let c=l==="young"?null:l;throw new Ja(t,Gv(c))}s++,await Uv(n);}}i(qd,"acquireProcessLock");async function Fv(t){try{await mkdir(t,{recursive:!1});}catch(s){if(s.code==="EEXIST")return null;throw s}let e=join(t,"holder.json"),r={pid:process.pid,started:Date.now(),hostname:HE()};await writeFile(e,JSON.stringify(r),"utf-8");let n=false,o=i(()=>{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$1(t,{recursive:true,force:true}).catch(()=>{}));}}i(Fv,"tryAcquire");async function vv(t){try{let e=await readFile(join(t,"holder.json"),"utf-8"),r=JSON.parse(e);return jv(r)?r:null}catch{try{let e=await stat(t);if(Date.now()-e.mtimeMs<Dv)return "young"}catch{}return null}}i(vv,"inspectLock");function $v(t,e){return !t||Date.now()-t.started>e?true:t.hostname&&t.hostname!==HE()?false:!Mv(t.pid)}i($v,"isStale");function Mv(t){if(!Number.isInteger(t)||t<=0)return false;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}i(Mv,"isProcessAlive");function Gv(t){return t?`${t.hostname?`${t.hostname}:`:""}pid ${t.pid} (running ${Date.now()-t.started}ms)`:"unknown (unreadable lock metadata)"}i(Gv,"describeHolder");function jv(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.pid=="number"&&typeof e.started=="number"}i(jv,"isLockMetadata");function HE(){return hostname()}i(HE,"getHostname");function Uv(t){return new Promise(e=>setTimeout(e,t))}i(Uv,"sleep");Ld();wr();async function Hv(t,e){let{source:r}=t,n;if(r.startsWith("file:")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")){let s=r.startsWith("file:")?fileURLToPath(r):r,a=resolve(e,s);n=pathToFileURL(a).href;}else n=r;return await import(n)}i(Hv,"importPluginModule");function zv(t){return "descriptor"in t?[t.descriptor]:"descriptors"in t&&Array.isArray(t.descriptors)?t.descriptors:"default"in t?[t.default]:[]}i(zv,"extractDescriptors");async function tm(t,e){let r;try{r=await Hv(t,e);}catch(s){throw new Error(`Plugin '${t.source}' failed to import: ${s instanceof Error?s.message:String(s)}`,{cause:s})}let n=zv(r),o=[];for(let s of n)try{let a=Fc(s);Ck(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}}i(tm,"loadPlugin");async function zE(t,e){let r=[];return await Promise.all(t.map(async n=>{try{let o=await tm(n,e);r.push(o);}catch(o){y.warn(`Plugin '${n.source}' failed to load: ${o instanceof Error?o.message:String(o)}`);}})),r}i(zE,"loadAllPlugins");async function Re(t,e){t.plugins.length!==0&&await zE(t.plugins,e);}i(Re,"bootstrapPlugins");it();function Qd(t,e,r="project"){let n=[],o=[...t.targets,...t.pluginTargets??[]];for(let s of t.features){let a,l;switch(s){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=Vv(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]=Dc(m,s,t,r);if(n.push({feature:a,count:l,support:c}),s==="rules"){let m=e.rules.filter(p=>!p.root);if(m.length>0){let p={};for(let u of o)p[u]=Dc(u,"additionalRules",t,r);n.push({feature:`additional rules (${m.length})`,count:m.length,support:p});}}}return n}i(Qd,"buildCompatibilityMatrix");function Vv(t){if(!t)return 0;let e=0;for(let r of Object.values(t))Array.isArray(r)&&(e+=r.length);return e}i(Vv,"countHooks");var Jv={"claude-code":"Claude"};function VE(t){return Jv[t]??t}i(VE,"matrixColumnLabel");br();it();var Yv=["rules","additionalRules","commands","agents","skills","mcp","hooks","ignore","permissions"];function JE(t){return Object.fromEntries(Yv.map(e=>[e,Object.fromEntries(Ot.map(r=>{let o=Wn(r,t)?.[e];return [r,o??{level:"none"}]}))]))}i(JE,"buildSupportMatrix");JE("project");JE("global");var tf={native:"\u2713",embedded:"\u25C6",partial:"\u25D0",none:"\u2013"},Fa={green:"\x1B[32m",blue:"\x1B[34m",yellow:"\x1B[33m",dim:"\x1B[2m",reset:"\x1B[0m"};function Xv(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""}i(Xv,"noColor");function Zv(t,e){return Xv()?e:`${t}${e}${Fa.reset}`}i(Zv,"colorize");var qv={native:Fa.green,embedded:Fa.blue,partial:Fa.yellow,none:Fa.dim};function YE(t){let e=tf[t];return Zv(qv[t],e)}i(YE,"coloredSymbol");function ef(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=i((j,W)=>r?W:`${j}${W}${n.reset}`,"c"),s=i(j=>j.replace(/\u001b\[[0-9;]*m/g,"").length,"visibleLength"),a=i((j,W)=>{let nt=s(j),ft=Math.max(0,W-nt);return j+" ".repeat(ft)},"padWithColor"),l=Math.max(12,...e.map(j=>j.length)),c=e.map(j=>VE(j)),m=Math.max(8,l),p=Math.max(12,...t.map(j=>j.feature.length)),u=i(j=>o(n.dim,"\u250C"+j.map(W=>"\u2500".repeat(W)).join("\u252C")+"\u2510"),"border"),d=i(j=>o(n.dim,"\u251C"+j.map(W=>"\u2500".repeat(W)).join("\u253C")+"\u2524"),"sep"),g=i(j=>o(n.dim,"\u2514"+j.map(W=>"\u2500".repeat(W)).join("\u2534")+"\u2518"),"bottom"),h=[p,...e.map(()=>m)],C=u(h),O=[a(o(n.bold+n.cyan,"Feature"),p),...c.map(j=>a(o(n.bold+n.magenta,j),m))],_=o(n.dim,"\u2502")+O.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502"),k=d(h),D=t.map(j=>{let W=[a(o(n.cyan,j.feature),p)];for(let nt of e){let ft=j.support[nt]??"none",st=r?tf[ft]:YE(ft);W.push(a(` ${st} `,m));}return o(n.dim,"\u2502")+W.join(o(n.dim,"\u2502"))+o(n.dim,"\u2502")}),b=g(h),P=[C,_,k,...D,b];P.push("");let J=[o(n.green,"\u2713")+" = native",o(n.blue,"\u25C6")+" = embedded",o(n.yellow,"\u25D0")+" = partial",o(n.dim,"\u2013")+" = not supported"];return P.push(o(n.bold,"Legend: ")+J.join(" ")),P.join(`
|
|
156
|
-
`)
|
|
157
|
-
Per-file details:
|
|
158
|
-
`+e.join(`
|
|
159
|
-
`)+`
|
|
160
|
-
`}i(nf,"formatVerboseDetails");async function Xo(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,s=typeof o=="string"&&o?o.split(",").map(d=>d.trim()).filter(Boolean):void 0,{config:a,context:l}=await ut(r,n);await Re(a,r);let{canonical:c}=await Oe(a,l.configDir,{},l.canonicalDir),m=s??[...a.targets,...a.pluginTargets??[]],p=Qd(a,c,n);if(p.length===0){y.info("No features enabled. Enable features in agentsmesh.yaml.");return}let u=ef(p,m);if(process.stdout.write(u),process.stdout.write(`
|
|
161
|
-
`),t.verbose===true){let d=nf(c);d&&(process.stdout.write(d),process.stdout.write(`
|
|
162
|
-
`));}}i(Xo,"runMatrix");function ZE(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}`)}i(ZE,"ensurePathInsideRoot");function of(t,e){return t==="global"?`~/${e}`:e}i(of,"formatDisplayPath");async function mi(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,s=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(b=>b.trim()).filter(Boolean):void 0,{config:u,context:d}=await ut(n,l);await Re(u,n);let g=u.collaboration?.lock_features??[];if(u.collaboration?.strategy==="lock"&&!a&&g.length>0){let b=await zc(d.canonicalDir);if(b!==null){let P=await mn(d.canonicalDir),J=Vc(b.checksums,P,g);if(J.length>0){y.error("Locked feature violation (strategy: lock). Modified files:");for(let j of J)y.error(` ${j}`);throw y.error("Run 'agentsmesh generate --force' to accept these changes."),new Error("Locked feature violation. Use --force to override.")}}}let{canonical:h,resolvedExtends:C}=await Oe(u,d.configDir,{refreshRemoteCache:c},d.canonicalDir),O=[...u.targets,...u.pluginTargets??[]];if(p){let b=p.filter(P=>!O.includes(P));if(b.length>0)throw new Error(`Unknown target(s) in --targets: ${b.join(", ")}. Available: ${O.join(", ")}`)}let _=p?O.filter(b=>p.includes(b)):O,k=await Qc({config:u,canonical:h,projectRoot:d.rootBase,scope:l,targetFilter:p});if(k.length===0){if(y.info("No files to generate (no root rule or rules feature disabled)."),o)return y.success("Generated files are in sync."),0;if(!s){let b=await qd(join(d.canonicalDir,".generate.lock"));try{let P=await mn(d.canonicalDir),J=C.length>0?await Jo(C):{},j=await Ta(join(d.canonicalDir,"packs")),W=process.env.USER??process.env.USERNAME??"unknown";await xa(d.canonicalDir,{generatedAt:new Date().toISOString(),generatedBy:W,libVersion:Ii(),checksums:P,extends:J,packs:j});try{await gm(zt(),join(d.configDir,".agentsmeshcache"));}catch(nt){y.warn(`Could not create .agentsmeshcache symlink: ${nt instanceof Error?nt.message:String(nt)}`);}}finally{await b();}}return r.printMatrix!==false&&await Xo(t,n),0}if(o){let b=k.filter(P=>P.status!=="unchanged");if(b.length===0)return y.success("Generated files are in sync."),0;for(let P of b)y.error(`[check] ${P.status} ${of(l,P.path)} (${P.target})`);return y.error("Generated files are out of sync. Run 'agentsmesh generate' to update them."),1}let D=s?null:await qd(join(d.canonicalDir,".generate.lock"));try{for(let b of k)if(s)y.info(`[dry-run] ${b.status} ${of(l,b.path)} (${b.target})`);else if(b.status==="created"||b.status==="updated"){let P=ZE(d.rootBase,b.path,b.target);await S(P,b.content),y.success(`${b.status} ${of(l,b.path)}`);}if(!s){let b=k.filter(st=>st.status==="created").length,P=k.filter(st=>st.status==="updated").length,J=k.filter(st=>st.status==="unchanged").length;await UE({projectRoot:d.rootBase,targets:_,expectedPaths:k.map(st=>st.path),scope:l}),b>0||P>0?y.info(`Generated: ${b} created, ${P} updated, ${J} unchanged`):y.info(`Nothing changed. (${J} unchanged)`);let j=await mn(d.canonicalDir),W=C.length>0?await Jo(C):{},nt=await Ta(join(d.canonicalDir,"packs")),ft=process.env.USER??process.env.USERNAME??"unknown";await xa(d.canonicalDir,{generatedAt:new Date().toISOString(),generatedBy:ft,libVersion:Ii(),checksums:j,extends:W,packs:nt});try{await gm(zt(),join(d.configDir,".agentsmeshcache"));}catch(st){y.warn(`Could not create .agentsmeshcache symlink: ${st instanceof Error?st.message:String(st)}`);}}}finally{D&&await D();}return r.printMatrix!==false&&await Xo(t,n),0}i(mi,"runGenerate");A();it();br();var t$=["codex-cli"];function qE(){return Ot.filter(t=>!t$.includes(t))}i(qE,"starterInitTargetIds");var e$=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],r$=qE();function em(t,e=r$){let r=(t.length>0?t:e).map(o=>` - ${o}`).join(`
|
|
163
|
-
`),n=e$.map(o=>` - ${o}`).join(`
|
|
163
|
+
Fix canonical sources or generators so every local link targets an existing file or folder.`)}s(Zw,"validateGeneratedMarkdownLinks");Xr();var Qw="AGENTS.md";function qw(t){switch(t){case "created":return 3;case "updated":return 2;case "unchanged":return 1;case "skipped":return 0}}s(qw,"statusRank");function O$(t,e){return qw(e.status)<=qw(t.status)?t:{...t,status:e.status,currentContent:e.currentContent??t.currentContent}}s(O$,"mergeDuplicateMetadata");function zm(t){return t.trim()}s(zm,"trimmedContent");function k$(t,e){if(!t.path.endsWith(Qw)||t.path!==e.path)return null;let r=zm(t.content),n=zm(e.content);if(!r||!n)return null;let o=r.includes(n),i=n.includes(r);return o===i?null:o?t:e}s(k$,"richerAgentsResult");function E$(t,e){if(!t.path.endsWith(Qw)||t.path!==e.path)return null;let r=t.target===Xi?t:e.target===Xi?e:null,n=r===t?e:t;if(!r)return null;let o=zm(r.content).length,i=zm(n.content).length;return o===i?null:o>i?r:n}s(E$,"richerCodexAgentsResult");function tA(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=k$(o,r);if(i){e[n]=i;continue}let a=E$(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]=O$(o,r);}return e}s(tA,"resolveOutputCollisions");function eA(t){let e=t.currentContent===void 0?"created":t.currentContent!==t.content?"updated":"unchanged";return t.status===e?t:{...t,status:e}}s(eA,"refreshResultStatus");A();mt();lr();function nA(t,e){return t===null?"created":t!==e?"updated":"unchanged"}s(nA,"computeStatus");function L$(t,e,r){let n=Gf(t,e,r);if(n!==null)return n;let o=rt(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(L$,"resolveGeneratedOutputPath");async function ul(t,e,r,n,o,i){let a=L$(e,r.path,o);if(a===null)return null;let l=await y(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:nA(l,p)}),a}s(ul,"emitGeneratedOutput");function mg(t,e,r){return {capability:Io(t,r)?.[e]??{level:"none"},scope:r}}s(mg,"featureContext");async function ks(t,e,r,n,o,i,a,l){if(o)for(let c of e){let m=l(c);if(!m)continue;let p=mg(c,a,i);for(let u of m(r,p)){let f=await ul(t,c,u,n,i);if(f===null)continue;let g=bt(c,i);if(g?.mirrorGlobalPath){let h=g.mirrorGlobalPath(f,e),R=h===null?[]:Array.isArray(h)?h:[h];for(let S of R){let I=await y(join(n,S));t.push({target:c,path:S,content:u.content,currentContent:I??void 0,status:nA(I,u.content)});}}}}}s(ks,"generateFeature");jp();mt();function w$(t){return t?.rootInstructionPath?[t.rootInstructionPath,...Hm(t)]:[]}s(w$,"rootDecorationPaths");function oA(t,e,r="project"){return t.map(n=>{let o=bt(n.target,r);if(!o)return n;let i=w$(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=wy(l);return c===n.content?n:{...n,content:c}})}s(oA,"decoratePrimaryRootInstructions");mt();lr();Zd();function pg(t,e,r,n,o){let a=(Pe(t)??rt(t))?.mergeGeneratedOutputContent?.(e,r,n,o);if(a!=null)return a;let l=r?.content??e;return l!==null&&UO.includes(o)?WO(l,n):n}s(pg,"mergeOutputContent");async function sA(t,e,r,n,o){for(let i of e){let a=Ni(i,"permissions",void 0,o)??rt(i)?.generators.generatePermissions;if(a)for(let l of a(r))await ul(t,i,l,n,o,{mergeContent:s((c,m,p,u)=>pg(i,c,m,p,u),"mergeContent")});}}s(sA,"generatePermissionsFeature");async function iA(t,e,r,n,o,i){for(let a of e){let l=Ni(a,"hooks",i,o)??rt(a)?.generators.generateHooks;if(!l)continue;let c=mg(a,"hooks",o),m=[...l(r,c)],u=(Pe(a)??rt(a))?.postProcessHookOutputs;u&&(m=[...await u(n,r,m)]);for(let f of m)await ul(t,a,f,n,o,{mergeContent:s((g,h,R,S)=>pg(a,g,h,R,S),"mergeContent")});}}s(iA,"generateHooksFeature");async function aA(t,e,r,n,o){for(let i of e){let l=(Pe(i)??rt(i))?.emitScopedSettings;if(!l)continue;let c=l(r,o);if(c.length!==0)for(let m of c)await ul(t,i,m,n,o,{mergeContent:s((p,u,f,g)=>pg(i,p,u,f,g),"mergeContent")});}}s(aA,"generateScopedSettingsFeature");async function $i(t){let{config:e,canonical:r,projectRoot:n,scope:o="project",targetFilter:i}=t,a=[...e.targets,...e.pluginTargets??[]],l=i?a.filter(x=>i.includes(x)):a;function c(x,Y){return Ni(x,Y,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"),S=e.features.includes("ignore"),I=[];await ks(I,l,r,n,m,o,"rules",x=>c(x,"rules")),await ks(I,l,r,n,p,o,"commands",x=>c(x,"commands")),await ks(I,l,r,n,u,o,"agents",x=>c(x,"agents")),await ks(I,l,r,n,f,o,"skills",x=>c(x,"skills")),await ks(I,l,r,n,g,o,"mcp",x=>c(x,"mcp")),h&&await sA(I,l,r,n,o),R&&await iA(I,l,r,n,o,e),await ks(I,l,r,n,S,o,"ignore",x=>c(x,"ignore"));let E=new Set(e.features);for(let x of l){let K=(Pe(x)??rt(x))?.globalSupport?.scopeExtras;if(K){let z=await K(r,n,o,E);I.push(...z);}}(g||S||R||u||h)&&await aA(I,l,r,n,o);let T=oA(I,r,o),P=Xw(T,r,e,n,o,l);return Zw(P,n),tA(Gw(P.map(eA),r,e))}s($i,"generate");ko();tt();A();Yi();var $$=6e4,j$=30,U$=200,K$=2e3;async function uA(t,e={}){let r=e.retries??j$,n=e.retryDelayMs??U$,o=e.staleMs??$$;await mkdir(dirname(t),{recursive:true});let i=0;for(;;){let a=await W$(t);if(a)return a;let l=await B$(t);if(l!=="young"&&H$(l,o)){await rm$1(t,{recursive:true,force:true}).catch(()=>{});continue}if(i>=r){let c=l==="young"?null:l;throw new xl(t,V$(c))}i++,await Y$(n);}}s(uA,"acquireProcessLock");async function W$(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:dA()};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$1(t,{recursive:true,force:true}).catch(()=>{}));}}s(W$,"tryAcquire");async function B$(t){try{let e=await readFile(join(t,"holder.json"),"utf-8"),r=JSON.parse(e);return J$(r)?r:null}catch{try{let e=await stat(t);if(Date.now()-e.mtimeMs<K$)return "young"}catch{}return null}}s(B$,"inspectLock");function H$(t,e){return !t||Date.now()-t.started>e?true:t.hostname&&t.hostname!==dA()?false:!z$(t.pid)}s(H$,"isStale");function z$(t){if(!Number.isInteger(t)||t<=0)return false;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}s(z$,"isProcessAlive");function V$(t){return t?`${t.hostname?`${t.hostname}:`:""}pid ${t.pid} (running ${Date.now()-t.started}ms)`:"unknown (unreadable lock metadata)"}s(V$,"describeHolder");function J$(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.pid=="number"&&typeof e.started=="number"}s(J$,"isLockMetadata");function dA(){return hostname()}s(dA,"getHostname");function Y$(t){return new Promise(e=>setTimeout(e,t))}s(Y$,"sleep");A();mt();async function fA(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 fA(i,e));continue}n.push(relative(e,i).replace(/\\/g,"/"));}return n}s(fA,"listFiles");async function Q$(t,e,r){if(r.has(e))return;let n=join(t,e);await F(n)&&await rm$1(n,{recursive:true,force:true});}s(Q$,"removeIfStale");async function gA(t){let e=new Set(t.expectedPaths),r=new Set,n=t.scope??"project";for(let o of t.targets){let i=Mf(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 F(l))for(let c of await fA(l))r.add(`${a}/${c}`.replace(/\/+/g,"/"));}}}for(let o of r)await Q$(t.projectRoot,o,e);}s(gA,"cleanupStaleGeneratedOutputs");function Jm(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(Jm,"ensurePathInsideRoot");na();A();tt();async function fg(t,e){let r=await Nn(t.canonicalDir),n=e.length>0?await Gi(e):{},o=await Um(join(t.canonicalDir,"packs")),i=process.env.USER??process.env.USERNAME??"unknown";await $m(t.canonicalDir,{generatedAt:new Date().toISOString(),generatedBy:i,libVersion:wl(),checksums:r,extends:n,packs:o});try{await Lh(ie(),join(t.configDir,".agentsmeshcache"));}catch(a){_.warn(`Could not create .agentsmeshcache symlink: ${a instanceof Error?a.message:String(a)}`);}}s(fg,"writeLockFile");async function LA(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:Ym([])}};if(n||await fg(o,i),c.printMatrix!==false){let{runMatrix:m}=await Promise.resolve().then(()=>(gl(),Sg)),{renderMatrix:p}=await Promise.resolve().then(()=>(yl(),Rg)),u=await m(a,l);p(u,{verbose:a.verbose===true});}return {exitCode:0,data:{scope:r,mode:e,files:[],summary:Ym([])}}}s(LA,"handleEmptyResults");function wA(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:Ym(r)}}}s(wA,"buildCheckResult");async function AA(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 uA(join(i.canonicalDir,".generate.lock"));try{if(!r){for(let h of e)if(h.status==="created"||h.status==="updated"){let R=Jm(i.rootBase,h.path,h.target);await C(R,h.content);}await gA({projectRoot:i.rootBase,targets:a,expectedPaths:e.map(h=>h.path),scope:n}),await fg(i,l);}}finally{u&&await u();}if(p.printMatrix!==false){let{runMatrix:h}=await Promise.resolve().then(()=>(gl(),Sg)),{renderMatrix:R}=await Promise.resolve().then(()=>(yl(),Rg)),S=await h(c,m);R(S,{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:Ym(f)}}}s(AA,"handleGenerateOrDryRun");function Ym(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(Ym,"buildSummary");async function ji(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(P=>P.trim()).filter(Boolean):void 0,u=o?"check":i?"dry-run":"generate",{config:f,context:g}=await ct(n,l);await re(f,n);let h=f.collaboration?.lock_features??[];if(f.collaboration?.strategy==="lock"&&!a&&h.length>0){let P=await Gm(g.canonicalDir);if(P!==null){let x=await Nn(g.canonicalDir),Y=jm(P.checksums,x,h);if(Y.length>0){_.error("Locked feature violation (strategy: lock). Modified files:");for(let K of Y)_.error(` ${K}`);throw _.error("Run 'agentsmesh generate --force' to accept these changes."),new Error("Locked feature violation. Use --force to override.")}}}let{canonical:R,resolvedExtends:S}=await De(f,g.configDir,{refreshRemoteCache:c},g.canonicalDir),I=[...f.targets,...f.pluginTargets??[]];if(p){let P=p.filter(x=>!I.includes(x));if(P.length>0)throw new Error(`Unknown target(s) in --targets: ${P.join(", ")}. Available: ${I.join(", ")}`)}let E=p?I.filter(P=>p.includes(P)):I,T=await $i({config:f,canonical:R,projectRoot:g.rootBase,scope:l,targetFilter:p});return T.length===0?LA({mode:u,scope:l,dryRun:i,context:g,resolvedExtends:S,flags:t,root:n,options:r}):o?wA(T,l):AA({results:T,dryRun:i,scope:l,mode:u,context:g,activeTargets:E,resolvedExtends:S,flags:t,root:n,options:r})}s(ji,"runGenerate");tt();function Og(t,e){return t==="global"?`~/${e}`:e}s(Og,"formatDisplayPath");function Ui(t){let{data:e}=t,{scope:r,mode:n,files:o}=e;if(o.length===0){_.info("No files to generate (no root rule or rules feature disabled)."),n==="check"&&_.success("Generated files are in sync.");return}if(n==="check"){let c=o.filter(m=>m.status!=="unchanged");if(c.length===0){_.success("Generated files are in sync.");return}for(let m of c)_.error(`[check] ${m.status} ${Og(r,m.path)} (${m.target})`);_.error("Generated files are out of sync. Run 'agentsmesh generate' to update them.");return}if(n==="dry-run"){for(let c of o)_.info(`[dry-run] ${c.status} ${Og(r,c.path)} (${c.target})`);return}for(let c of o)(c.status==="created"||c.status==="updated")&&_.success(`${c.status} ${Og(r,c.path)}`);let{created:i,updated:a,unchanged:l}=e.summary;i>0||a>0?_.info(`Generated: ${i} created, ${a} updated, ${l} unchanged`):_.info(`Nothing changed. (${l} unchanged)`);}s(Ui,"renderGenerate");A();mt();Xr();var lj=["codex-cli"];function xA(){return ft.filter(t=>!lj.includes(t))}s(xA,"starterInitTargetIds");var cj=["rules","commands","agents","skills","mcp","hooks","ignore","permissions"],mj=xA();function Xm(t,e=mj){let r=(t.length>0?t:e).map(o=>` - ${o}`).join(`
|
|
164
|
+
`),n=cj.map(o=>` - ${o}`).join(`
|
|
164
165
|
`);return `# yaml-language-server: $schema=https://unpkg.com/agentsmesh/schemas/agentsmesh.json
|
|
165
166
|
version: 1
|
|
166
167
|
targets:
|
|
167
168
|
${r}
|
|
168
169
|
features:
|
|
169
170
|
${n}
|
|
170
|
-
`}
|
|
171
|
+
`}s(Xm,"buildConfig");var Zm=`---
|
|
171
172
|
root: true
|
|
172
173
|
description: "Project rules"
|
|
173
174
|
---
|
|
@@ -176,7 +177,7 @@ description: "Project rules"
|
|
|
176
177
|
|
|
177
178
|
Add your project-wide instructions here.
|
|
178
179
|
This file is always included in AI tool context and synced to all configured tools.
|
|
179
|
-
`,
|
|
180
|
+
`,kg=`---
|
|
180
181
|
description: "Example contextual rule \u2014 rename and customize"
|
|
181
182
|
# targets: [claude-code, cursor] # limit to specific tools (optional)
|
|
182
183
|
# globs: ["src/**/*.ts"] # activate only for matching files (optional)
|
|
@@ -185,14 +186,14 @@ description: "Example contextual rule \u2014 rename and customize"
|
|
|
185
186
|
# Example Rule
|
|
186
187
|
|
|
187
188
|
Replace this with your coding standards, conventions, or domain-specific guidelines.
|
|
188
|
-
`,
|
|
189
|
+
`,Eg=`---
|
|
189
190
|
description: "Example command \u2014 rename and customize"
|
|
190
191
|
# allowed-tools: [Read, Grep, Glob, Bash]
|
|
191
192
|
---
|
|
192
193
|
|
|
193
194
|
Describe the task for this command here.
|
|
194
195
|
Commands are invoked on-demand (e.g. /example) with a focused tool set.
|
|
195
|
-
`,
|
|
196
|
+
`,Lg=`---
|
|
196
197
|
name: example-agent
|
|
197
198
|
description: "Example subagent \u2014 rename and customize"
|
|
198
199
|
# tools: [Read, Grep, Glob]
|
|
@@ -203,7 +204,7 @@ description: "Example subagent \u2014 rename and customize"
|
|
|
203
204
|
|
|
204
205
|
Describe this agent's role and instructions here.
|
|
205
206
|
Agents are specialized subagents with restricted tools and a specific purpose.
|
|
206
|
-
`,
|
|
207
|
+
`,wg=`---
|
|
207
208
|
name: example-skill
|
|
208
209
|
description: "Example skill \u2014 rename and customize"
|
|
209
210
|
---
|
|
@@ -212,7 +213,7 @@ description: "Example skill \u2014 rename and customize"
|
|
|
212
213
|
|
|
213
214
|
Describe the skill procedure here.
|
|
214
215
|
Skills are reusable multi-step procedures that commands and agents can reference.
|
|
215
|
-
`,
|
|
216
|
+
`,Ag=`{
|
|
216
217
|
"mcpServers": {
|
|
217
218
|
// "github": {
|
|
218
219
|
// "type": "stdio",
|
|
@@ -227,7 +228,7 @@ Skills are reusable multi-step procedures that commands and agents can reference
|
|
|
227
228
|
// }
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
`,
|
|
231
|
+
`,xg=`# Lifecycle hooks \u2014 run shell commands before/after AI tool use
|
|
231
232
|
# Events: PreToolUse, PostToolUse, SubagentStart, SubagentStop
|
|
232
233
|
# Matcher: tool name pattern (e.g. "Edit|Write", "Bash", "*")
|
|
233
234
|
#
|
|
@@ -240,7 +241,7 @@ Skills are reusable multi-step procedures that commands and agents can reference
|
|
|
240
241
|
# - matcher: Edit|Write
|
|
241
242
|
# type: command
|
|
242
243
|
# command: npm test --passWithNoTests
|
|
243
|
-
`,
|
|
244
|
+
`,bg=`# Tool permission allow/deny lists
|
|
244
245
|
#
|
|
245
246
|
# allow:
|
|
246
247
|
# - Bash(npm run:*)
|
|
@@ -256,14 +257,14 @@ Skills are reusable multi-step procedures that commands and agents can reference
|
|
|
256
257
|
allow: []
|
|
257
258
|
deny: []
|
|
258
259
|
ask: []
|
|
259
|
-
`,
|
|
260
|
+
`,Pg=`# Patterns ignored by all configured AI tools (gitignore syntax)
|
|
260
261
|
#
|
|
261
262
|
# node_modules/
|
|
262
263
|
# dist/
|
|
263
264
|
# .env*
|
|
264
265
|
# *.log
|
|
265
266
|
# coverage/
|
|
266
|
-
`,
|
|
267
|
+
`,bA=`# yaml-language-server: $schema=https://unpkg.com/agentsmesh/schemas/agentsmesh.json
|
|
267
268
|
# Personal overrides \u2014 NOT committed to git
|
|
268
269
|
# Uncomment and customize for your local setup:
|
|
269
270
|
|
|
@@ -282,25 +283,25 @@ ask: []
|
|
|
282
283
|
# overrides:
|
|
283
284
|
# claude-code:
|
|
284
285
|
# model: opus
|
|
285
|
-
`;A();
|
|
286
|
-
`).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"))),o=
|
|
286
|
+
`;A();mt();function PA(t){let e=[];for(let r of jt)for(let n of vf(r.id,t))e.push({target:r.id,path:n});return e}s(PA,"collectDetectionPaths");function TA(t){let e=new Map;for(let{target:r,path:n}of PA(t)){let o=e.get(r)??[];o.push(n),e.set(r,o);}return [...e.entries()].map(([r,n])=>({id:r,paths:n}))}s(TA,"toolIndicators");TA("project");async function DA(t,e="project"){let r=[];for(let{id:n,paths:o}of TA(e))for(let i of o){let a=join(t,i);if(await F(a)){r.push(n);break}}return [...new Set(r)]}s(DA,"detectExistingConfigs");A();tt();function Mt(t,e){return join(t,e)}s(Mt,"ab");async function Tg(t){return await F(t)?(await readdir(t,{withFileTypes:true})).filter(r=>r.isFile()&&r.name.endsWith(".md")).length:0}s(Tg,"countMdFiles");async function uj(t){let e=Mt(t,"skills");if(!await F(e))return false;let r=await readdir(e,{withFileTypes:true});for(let n of r)if(n.isDirectory()&&!n.name.startsWith("_")&&await F(join(e,n.name,"SKILL.md")))return true;return false}s(uj,"hasAnyImportedSkill");async function Dg(t){let e=Mt(t,"rules");await O(e),await C(join(e,"_root.md"),Zm),_.success("Created .agentsmesh/rules/_root.md"),await C(join(e,"_example.md"),kg),_.success("Created .agentsmesh/rules/_example.md");let r=Mt(t,"commands");await O(r),await C(join(r,"_example.md"),Eg),_.success("Created .agentsmesh/commands/_example.md");let n=Mt(t,"agents");await O(n),await C(join(n,"_example.md"),Lg),_.success("Created .agentsmesh/agents/_example.md");let o=Mt(t,join("skills","_example"));await O(o),await C(join(o,"SKILL.md"),wg),_.success("Created .agentsmesh/skills/_example/SKILL.md"),await C(Mt(t,"mcp.json"),Ag),_.success("Created .agentsmesh/mcp.json"),await C(Mt(t,"hooks.yaml"),xg),_.success("Created .agentsmesh/hooks.yaml"),await C(Mt(t,"permissions.yaml"),bg),_.success("Created .agentsmesh/permissions.yaml"),await C(Mt(t,"ignore"),Pg),_.success("Created .agentsmesh/ignore");}s(Dg,"writeScaffoldFull");async function FA(t){let e=Mt(t,"rules"),r=await Tg(e),n=join(e,"_root.md"),o=await F(n);await O(e),r===0?(await C(n,Zm),_.success("Created .agentsmesh/rules/_root.md"),await C(join(e,"_example.md"),kg),_.success("Created .agentsmesh/rules/_example.md")):o||(await C(n,Zm),_.success("Created .agentsmesh/rules/_root.md"));let i=Mt(t,"commands");await Tg(i)===0&&(await O(i),await C(join(i,"_example.md"),Eg),_.success("Created .agentsmesh/commands/_example.md"));let a=Mt(t,"agents");if(await Tg(a)===0&&(await O(a),await C(join(a,"_example.md"),Lg),_.success("Created .agentsmesh/agents/_example.md")),!await uj(t)){let u=Mt(t,join("skills","_example"));await O(u),await C(join(u,"SKILL.md"),wg),_.success("Created .agentsmesh/skills/_example/SKILL.md");}let l=Mt(t,"mcp.json");await F(l)||(await C(l,Ag),_.success("Created .agentsmesh/mcp.json"));let c=Mt(t,"hooks.yaml");await F(c)||(await C(c,xg),_.success("Created .agentsmesh/hooks.yaml"));let m=Mt(t,"permissions.yaml");await F(m)||(await C(m,bg),_.success("Created .agentsmesh/permissions.yaml"));let p=Mt(t,"ignore");await F(p)||(await C(p,Pg),_.success("Created .agentsmesh/ignore"));}s(FA,"writeScaffoldGapFill");ge();var Ng="agentsmesh.yaml",vA="agentsmesh.local.yaml",fj=["agentsmesh.local.yaml",".agentsmeshcache",".agentsmesh/.lock.tmp",".agentsmesh/packs/"],gj=Object.fromEntries(jt.map(t=>[t.id,(e,r)=>t.generators.importFrom(e,{scope:r})])),MA=jt.filter(t=>t.globalSupport!==void 0).map(t=>t.id);function hj(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(hj,"isCoveredByExisting");async function yj(t){let e=join(t,".gitignore"),r=await y(e)??"",n=new Set(r.split(`
|
|
287
|
+
`).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#"))),o=fj.filter(a=>!hj(a,n));if(o.length===0)return false;let i=r.endsWith(`
|
|
287
288
|
`)||r===""?"":`
|
|
288
|
-
`;await
|
|
289
|
+
`;return await C(e,r+i+o.join(`
|
|
289
290
|
`)+`
|
|
290
|
-
`);}i(c$,"appendToGitignore");async function aw(t,e={}){let r=e.global===true?"global":"project",n=Ri(t,r),o=join(n.configDir,va);if(await F(o))throw new Error(`Already initialized. ${va} exists. Remove it first to re-init.`);let s=await rw(n.rootBase,r),a=r==="global"?s.filter(m=>iw.includes(m)):s,l=r==="global"?iw:void 0;if(a.length>0)if(y.info(`Found existing configurations: ${a.join(", ")}`),e.yes){y.info("Auto-importing existing configurations (--yes)...");let m=0;for(let p of a){let u=a$[p];if(!u)continue;let d=await u(n.rootBase,r);for(let g of d){let h=relative(n.rootBase,g.fromPath).replaceAll("\\","/"),C=g.toPath.replaceAll("\\","/");y.success(` ${h} \u2192 ${C}`);}m+=d.length;}m>0&&y.info(`Imported ${m} file(s) from ${a.length} tool(s).`),await ow(n.canonicalDir),await S(o,em(a,l)),y.success(`Created ${va} (targets: ${a.join(", ")})`);}else y.info("Run 'agentsmesh init --yes' to auto-import, or 'agentsmesh import --from <tool>' manually."),await gf(n.canonicalDir),await S(o,em([],l)),y.success(`Created ${va}`);else await gf(n.canonicalDir),await S(o,em([],l)),y.success(`Created ${va}`);let c=join(n.configDir,sw);await S(c,QE),y.success(`Created ${sw}`),r==="project"&&(await c$(t),y.success("Updated .gitignore"));}i(aw,"runInit");it();var m$=Object.fromEntries(xt.map(t=>[t.id,{importFrom:t.generators.importFrom,emptyImportMessage:t.emptyImportMessage,lintRules:t.lintRules,lint:t.lint,capabilities:t.capabilities}]));function nm(t){let e=m$[t];if(!e)throw new Error(`Unknown target: ${t}`);return e}i(nm,"getTargetCatalogEntry");wr();function lw(t,e,r){for(let n of t){let o=relative(e,n.fromPath);y.success(`${o} \u2192 ${n.toPath}`);}y.info(`Imported ${t.length} file(s). Run 'agentsmesh generate${r==="global"?" --global":""}' to sync to other tools.`);}i(lw,"formatImportResults");async function cw(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(),s=t.global===true?"global":"project";if(un(o)){let p=Ri(r,s),u=nm(o),d=await u.importFrom(p.rootBase,{scope:s});if(d.length===0){y.info(u.emptyImportMessage);return}lw(d,p.rootBase,s);return}let a,l;try{({config:a,context:l}=await ut(r,s));}catch{throw new Error(`Unknown --from "${n}" and no agentsmesh.yaml found. Run 'agentsmesh init' to enable plugin targets, or use a builtin: ${Ot.join(", ")}.`)}await Re(a,r);let c=rt(o);if(!c)throw new Error(`Unknown --from "${n}". Supported: ${[...Ot,...a.pluginTargets??[]].join(", ")}.`);let m=await c.generators.importFrom(l.rootBase,{scope:s});if(m.length===0){y.info(c.emptyImportMessage);return}lw(m,l.rootBase,s);}i(cw,"runImport");function pw(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}}i(pw,"computeDiff");function uw(t){return `${t.new} files would be created, ${t.updated} updated, ${t.unchanged} unchanged, ${t.deleted} deleted`}i(uw,"formatDiffSummary");async function dw(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,s=typeof o=="string"&&o?o.split(",").map(d=>d.trim()).filter(Boolean):void 0,{config:a,context:l}=await ut(r,n);await Re(a,r);let{canonical:c}=await Oe(a,l.configDir,{},l.canonicalDir),m=await Qc({config:a,canonical:c,projectRoot:l.rootBase,scope:n,targetFilter:s});if(m.length===0){y.info("No files to generate (no root rule or rules feature disabled).");return}let{diffs:p,summary:u}=pw(m);for(let d of p)process.stdout.write(d.patch);y.info(uw(u));}i(dw,"runDiff");A();wr();ro();$t();var u$=[{canonicalKey:"permissions",capabilityKey:"permissions",featureFlag:"permissions",file:".agentsmesh/permissions.yaml",label:"permissions",hasContent:i(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:i(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:i(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:i(t=>t.commands.length>0,"hasContent")},{canonicalKey:"agents",capabilityKey:"agents",featureFlag:"agents",file:".agentsmesh/agents",label:"agents",hasContent:i(t=>t.agents.length>0,"hasContent")},{canonicalKey:"skills",capabilityKey:"skills",featureFlag:"skills",file:".agentsmesh/skills",label:"skills",hasContent:i(t=>t.skills.length>0,"hasContent")},{canonicalKey:"ignore",capabilityKey:"ignore",featureFlag:"ignore",file:".agentsmesh/ignore",label:"ignore patterns",hasContent:i(t=>t.ignore.length>0,"hasContent")}];function fw(t){let e=new Set(t.enabledFeatures),r=[];for(let n of u$)!e.has(n.featureFlag)||!n.hasContent(t.canonical)||Ae(t.capabilities[n.capabilityKey]).level!=="none"||r.push(B(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}i(fw,"lintSilentFeatureDrops");$t();var d$=/^(?:\s*(?:bash|sh|zsh|pwsh|powershell)\s+)?["']?(?<path>(?:\.{1,2}\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?:\s|$)/;function f$(t){let r=t.match(d$)?.groups?.path;return typeof r=="string"?r:null}i(f$,"extractScriptToken");function gw(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 s=f$(o.command);s&&r.push(B(".agentsmesh/hooks.yaml",t.target,`${t.target} hook command references script "${s}"; 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}i(gw,"lintHookScriptReferences");$t();function hw(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}i(hw,"lintRuleScopeInversion");var g$=["node_modules",".git","dist","coverage",".agentsmesh"];async function h$(t){return (await x(t)).filter(n=>{let o=relative(t,n);return !g$.some(s=>o.includes(`/${s}/`)||o.startsWith(`${s}/`))}).map(n=>relative(t,n))}i(h$,"getProjectFiles");async function Iw(t,e,r,n,o={}){let s=o.scope??"project",a=[...t.targets,...t.pluginTargets??[]],l=n?a.filter(O=>n.includes(O)):a,c=t.features.includes("rules"),m=t.features.includes("commands"),p=t.features.includes("mcp"),u=t.features.includes("permissions"),d=t.features.includes("hooks"),g=[],h=s==="global"?[]:await h$(r);for(let O of l){let _=rt(O),k=un(O)?nm(O):_;k?.capabilities&&g.push(...fw({target:O,capabilities:k.capabilities,canonical:e,enabledFeatures:t.features})),d&&g.push(...gw({target:O,canonical:e,hasScriptProjection:_?.postProcessHookOutputs!==void 0})),c&&g.push(...hw({target:O,canonical:e,preservesManualActivation:_?.preservesManualActivation===true})),c&&k?.lintRules&&g.push(...k.lintRules(e,r,h,{scope:s})),_?.generators.lint&&g.push(..._.generators.lint(e));let D={scope:s};m&&k?.lint?.commands&&g.push(...k.lint.commands(e,D)),p&&k?.lint?.mcp&&g.push(...k.lint.mcp(e,D)),u&&k?.lint?.permissions&&g.push(...k.lint.permissions(e,D)),d&&k?.lint?.hooks&&g.push(...k.lint.hooks(e,D));}let C=g.some(O=>O.level==="error");return {diagnostics:g,hasErrors:C}}i(Iw,"runLint");async function _w(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",o=t.targets,s=typeof o=="string"&&o?o.split(",").map(C=>C.trim()).filter(Boolean):void 0,{config:a,context:l}=await ut(r,n);await Re(a,r);let{canonical:c}=await Oe(a,l.configDir,{},l.canonicalDir),{diagnostics:m,hasErrors:p}=await Iw(a,c,l.configDir,s,{scope:n});if(m.length===0)return y.success("All checks passed."),0;let u=m.filter(C=>C.level==="error"),d=m.filter(C=>C.level==="warning");if(u.length>0)for(let C of u)y.error(`${C.file} (${C.target}): ${C.message}`);if(d.length>0)for(let C of d)y.warn(`${C.file} (${C.target}): ${C.message}`);let g=u.length,h=d.length;return y.info(`${g} error${g!==1?"s":""}, ${h} warning${h!==1?"s":""}`),p?1:0}i(_w,"runLintCmd");var _$=300;function S$(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}i(S$,"normalizeWatchPath");function C$(t,e,r){let n=S$(relative(t,e));return n===".lock"||n===".lock.tmp"||n===".generate.lock"||n.endsWith("/.lock")||n.endsWith("/.lock.tmp")||n.endsWith("/.generate.lock")||n.includes("/.generate.lock/")||n.startsWith(".generate.lock/")}i(C$,"shouldIgnoreWatchPath");function O$(t,e,r,n,o,s,a,l,c){return JSON.stringify({features:t,rulesCount:e,commandsCount:r,agentsCount:n,skillsCount:o,mcpServerCount:s,permissionsCount:a,hooksCount:l,ignoreCount:c})}i(O$,"featureFingerprint");async function Cw(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{context:o}=await ut(r,n),s=[o.canonicalDir,join(o.configDir,"agentsmesh.yaml"),join(o.configDir,"agentsmesh.local.yaml")],a=null,l=null,c=false,m=null,u=i(async()=>{if(c)return;a=null;let{config:C,context:O}=await ut(r,n),{canonical:_}=await Oe(C,O.configDir,{},O.canonicalDir),k=_.mcp?Object.keys(_.mcp.mcpServers).length:0,D=_.permissions?_.permissions.allow.length+_.permissions.deny.length:0,b=_.hooks?Object.values(_.hooks).reduce((W,nt)=>W+(Array.isArray(nt)?nt.length:0),0):0,P=_.ignore.length,J=O$(C.features,_.rules.length,_.commands.length,_.agents.length,_.skills.length,k,D,b,P),j=l!==null&&l!==J;l=J,!c&&(await mi(t,r,{printMatrix:false}),!c&&(j?await Xo(t,r):y.info("Regenerated.")));},"run"),d=i(()=>{let C=u().catch(O=>{if(!c){let _=O instanceof Error?O.message:String(O);y.error(_);}}).finally(()=>{m===C&&(m=null);});m=C;},"scheduleRun"),g=i(()=>{c||(a&&clearTimeout(a),a=setTimeout(d,_$));},"schedule"),h=I$.watch(s,{ignoreInitial:true,usePolling:process.platform==="win32"});return h.on("all",(C,O)=>{C$(o.canonicalDir,O)||g();}),await new Promise((C,O)=>{h.once("ready",C),h.once("error",O);}),y.info(n==="global"?"Watching ~/.agentsmesh/ and agentsmesh.yaml...":"Watching .agentsmesh/ and agentsmesh.yaml..."),m=u(),await m,m=null,{stop:i(async()=>{c=true,a&&(clearTimeout(a),a=null),await h.close(),m&&await m;},"stop")}}i(Cw,"runWatch");async function Ow(t){let{config:e,configDir:r,canonicalDir:n}=t,o=await zc(n);if(o===null)return {inSync:false,hasLock:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]};let s=await mn(n),a=await ss(e,r),l=a.length>0?await Jo(a):{},c=new Set(Object.keys(o.checksums)),m=new Set(Object.keys(s)),p=[],u=[],d=[];for(let _ of c){let k=s[_];k===void 0?d.push(_):k!==o.checksums[_]&&p.push(_);}for(let _ of m)c.has(_)||u.push(_);let g=new Set([...Object.keys(o.extends),...Object.keys(l)]),h=[];for(let _ of g)l[_]!==o.extends[_]&&h.push(_);let C=Vc(o.checksums,s,e.collaboration?.lock_features??[]);return {inSync:p.length===0&&u.length===0&&d.length===0&&h.length===0,hasLock:true,modified:p,added:u,removed:d,extendsModified:h,lockedViolations:C}}i(Ow,"checkLockSync");async function Rw(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:s}=await ut(r,n);await Re(o,r);let a=await Ow({config:o,configDir:s.configDir,canonicalDir:s.canonicalDir});if(!a.hasLock)return y.error("Not initialized for collaboration. Run 'agentsmesh generate' first."),1;if(a.inSync)return y.success("Lock file is in sync."),0;let l=new Set(a.lockedViolations);y.error("Conflict detected:");for(let c of a.extendsModified)y.error(` extend "${c}" was modified`);for(let c of a.modified){let m=l.has(c)?" [LOCKED]":"";y.error(` ${c} was modified${m}`);}for(let c of a.added){let m=l.has(c)?" [LOCKED]":"";y.error(` ${c} was added${m}`);}for(let c of a.removed){let m=l.has(c)?" [LOCKED]":"";y.error(` ${c} was removed${m}`);}return y.info("Run 'agentsmesh merge' to resolve, or 'agentsmesh generate --force' to accept current state."),1}i(Rw,"runCheck");A();var k$=".lock",E$="<<<<<<<";async function yf(t){let e=join(t,k$),r=await I(e);return r===null?false:r.includes(E$)}i(yf,"hasLockConflict");async function Ew(t,e,r){if(!await yf(t))throw new Error("No conflict to resolve.");let o=await mn(t),s=dirname(t),a=r?await ss(r,s):[],l=a.length>0?await Jo(a):{},c=await Ta(join(t,"packs")),m=process.env.USER??process.env.USERNAME??"unknown";await xa(t,{generatedAt:new Date().toISOString(),generatedBy:m,libVersion:e,checksums:o,extends:l,packs:c});}i(Ew,"resolveLockConflict");async function ww(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:s}=await ut(r,n),a=s.canonicalDir;if(!await yf(a)){y.info("No conflicts to resolve.");return}await Ew(a,Ii(),o),y.success("Lock file conflict resolved.");}i(ww,"runMerge");A();var A$=promisify(execFile);async function If(t){let{stdout:e}=await A$("git",t,{env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return e.trim()}i(If,"runGit");async function Lw(){try{return await If(["--version"]),!0}catch{return false}}i(Lw,"isGitAvailable");async function b$(t,e){let r=[e,`refs/heads/${e}`,`refs/tags/${e}`],n;for(let o of r)try{let a=(await If(["ls-remote",t,o])).split(`
|
|
291
|
-
`).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(
|
|
292
|
-
`).find(a=>a.trim().length>0);if(!o)throw new Error(`Could not resolve HEAD for ${e}`);let s=o.split(/\s+/)[0];if(!s||!/^[0-9a-f]{40}$/i.test(s))throw new Error(`Invalid ls-remote HEAD line for ${e}`);return s.toLowerCase()}return b$(e,r)}i(Aw,"resolveRemoteRefForInstall");async function bw(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 Aw(t.rawRef||"HEAD",e);if(t.kind==="github"){let l=`github:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await os(l,"install",{cacheDir:zt(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}if(t.kind==="gitlab"){let l=`gitlab:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await os(l,"install",{cacheDir:zt(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}let n=r,s=`git+${(t.gitPlusBase??e).split("#")[0]}#${n}`;return {resolvedPath:(await os(s,"install",{cacheDir:zt(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:s,version:r}}i(bw,"fetchInstallSource");async function Pw(t,e){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};try{let r=await bw(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}}i(Pw,"resolveInstallResolvedPath");function _f(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],s=r[1],a=r[n+1],l=r.slice(n+2).join("/");return !o||!s||!a?null:{org:o,repo:s,ref:a,path:l||""}}catch{return null}}i(_f,"parseGithubTreeUrl");function Sf(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],s=r[1],a=r[n+1],l=r.slice(n+2).join("/");return !o||!s||!a||!l?null:{org:o,repo:s,ref:a,path:l}}catch{return null}}i(Sf,"parseGithubBlobUrl");function Cf(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 s=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||!s?null:{namespace:m,project:c,ref:s,path:a||""}}catch{return null}}i(Cf,"parseGitlabTreeUrl");function Of(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 s=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||!s||!a?null:{namespace:m,project:c,ref:s,path:a}}catch{return null}}i(Of,"parseGitlabBlobUrl");var P$=new Set(["tree","blob","commit","releases","actions","issues","pulls","settings","wiki","discussions","security","projects","packages"]);function Rf(t){try{let e=new URL(t);if(e.hostname!=="github.com")return null;let r=e.pathname.split("/").filter(Boolean).map(s=>s.replace(/\.git$/i,""));if(r.length<2||r.length>2||P$.has(r[1]))return null;let n=r[0],o=r[1];return {org:n,repo:o}}catch{return null}}i(Rf,"parseGithubRepoUrl");function kf(t){try{let e=new URL(t);if(e.hostname!=="gitlab.com")return null;let r=e.pathname.split("/").filter(Boolean).map(s=>s.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}}i(kf,"parseGitlabRepoUrl");function Ef(t){let e=t.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/i);return e?{org:e[1],repo:e[2].replace(/\.git$/i,"")}:null}i(Ef,"parseGitSshGithub");function wf(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}}i(wf,"parseGitSshGitlab");A();var N$=/^[A-Za-z]:[\\/]/,D$=/^[A-Za-z]:\//;function xw(...t){return t.some(e=>e.includes("\\")||N$.test(e))?win32:posix}i(xw,"pathApiFor");function Ma(t){return t.replace(/\\/g,"/")}i(Ma,"toPosixPath");function $a(t){return Ma(t).replace(/^\/+|\/+$/g,"")}i($a,"normalizeInstallPathField");function om(t){let e=Ma(t);return e===""||e==="."||e==="./."?".":e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||D$.test(e)?e:`./${e}`}i(om,"normalizeLocalSourceForYaml");function Yn(t){return {...t,source:t.source_kind==="local"?om(t.source):t.source,...t.path!==void 0?{path:$a(t.path)}:{},...t.paths!==void 0?{paths:t.paths.map(e=>$a(e))}:{}}}i(Yn,"normalizePersistedInstallPaths");function Tw(t,e,r){let n=xw(t,e),o=n.normalize(t),s=n.normalize(e),a=$a(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),d=$a(u),g=Ma(n.relative(s,p))||".";return {kind:"local",rawRef:"",pathInRepo:a||d.replace(/\.md$/i,"").replace(/\/$/,""),localRoot:p,localSourceForYaml:om(g)}}let m=Ma(n.relative(s,o))||".";return {kind:"local",rawRef:"",pathInRepo:a,localRoot:o,localSourceForYaml:om(m)}}i(Tw,"localParsedFromAbsPath");async function Lf(t,e,r){let n=t.trim(),o=r?.trim().replace(/\\/g,"/")??"";if(n.startsWith("git+")){let c=n.lastIndexOf("#"),m=c<0?n:n.slice(0,c),p=c<0?"HEAD":n.slice(c+1),u=m.slice(4);return {kind:"git",rawRef:p,gitPlusBase:u,gitRemoteUrl:u,pathInRepo:o}}if(n.startsWith("https://")||n.startsWith("http://")){let c=_f(n)??Sf(n);if(c)return {kind:"github",rawRef:c.ref,org:c.org,repo:c.repo,gitRemoteUrl:`https://github.com/${c.org}/${c.repo}.git`,pathInRepo:o||c.path};let m=Rf(n);if(m)return {kind:"github",rawRef:"HEAD",org:m.org,repo:m.repo,gitRemoteUrl:`https://github.com/${m.org}/${m.repo}.git`,pathInRepo:o};let p=Cf(n)??Of(n);if(p)return {kind:"gitlab",rawRef:p.ref,org:p.namespace,repo:p.project,gitRemoteUrl:`https://gitlab.com/${p.namespace}/${p.project}.git`,pathInRepo:o||p.path};let u=kf(n);if(u)return {kind:"gitlab",rawRef:"HEAD",org:u.namespace,repo:u.project,gitRemoteUrl:`https://gitlab.com/${u.namespace}/${u.project}.git`,pathInRepo:o}}if(n.startsWith("git@github.com:")){let c=Ef(n);if(!c)throw new Error(`Invalid GitHub SSH URL: ${n}`);return {kind:"github",rawRef:"HEAD",org:c.org,repo:c.repo,gitRemoteUrl:`https://github.com/${c.org}/${c.repo}.git`,pathInRepo:o}}if(n.startsWith("git@gitlab.com:")){let c=wf(n);if(!c)throw new Error(`Invalid GitLab SSH URL: ${n}`);return {kind:"gitlab",rawRef:"HEAD",gitRemoteUrl:`https://gitlab.com/${c.namespace}/${c.project}.git`,pathInRepo:o}}if(n.startsWith("git@")){let c=n.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(!c)throw new Error(`Invalid SSH git URL: ${n}`);let m=c[1],p=c[2].replace(/\.git$/i,"");return {kind:"git",rawRef:"HEAD",gitRemoteUrl:`ssh://git@${m}/${p}.git`,pathInRepo:o}}let s=n.match(/^github:([^/]+)\/(.+?)@([^/@]+)$/);if(s){let c=s[1],m=s[2];return {kind:"github",rawRef:s[3],org:c,repo:m,gitRemoteUrl:`https://github.com/${c}/${m}.git`,pathInRepo:o}}let a=n.match(/^gitlab:(.+)\/([^/@]+)@([^/@]+)$/);if(a){let c=a[1],m=a[2];return {kind:"gitlab",rawRef:a[3],org:c,repo:m,gitRemoteUrl:`https://gitlab.com/${c}/${m}.git`,pathInRepo:o}}let l=resolve(e,n);if(!await F(l))throw new Error(`Path does not exist: ${l}`);return Tw(l,e,o)}i(Lf,"parseInstallSource");A();A();var Nw=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(rs).min(1),pick:Oi.optional(),target:ie.optional(),path:z$1.string().optional(),paths:z$1.array(z$1.string().min(1)).min(1).optional(),as:li.optional()}),G$=z$1.object({version:z$1.literal(1),installs:z$1.array(Nw).default([])});function j$(t,e){return t.length===e.length&&[...t].sort().every((r,n)=>r===[...e].sort()[n])}i(j$,"sameFeatures");function U$(t,e){return t.source===e.source&&t.target===e.target&&t.as===e.as&&j$(t.features,e.features)}i(U$,"sameInstallIdentity");function Dw(t){return join(t,"installs.yaml")}i(Dw,"manifestPath");async function Af(t){let e=await I(Dw(t));if(e===null)return [];try{return G$.parse(parse(e)).installs.map(r=>Yn(r))}catch{return []}}i(Af,"readInstallManifest");async function Fw(t,e){let r=Yn(e),o=(await Af(t)).filter(s=>s.name!==r.name&&!U$(s,r));o.push(r),await S(Dw(t),stringify({version:1,installs:o.sort((s,a)=>s.name.localeCompare(a.name))}));}i(Fw,"upsertInstallManifestEntry");function vw(t){return Yn(Nw.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}))}i(vw,"buildInstallManifestEntry");async function W$(t){let e=await Af(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 F(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.`);}i(W$,"syncInstalledPacks");async function $w(t){return t.sync?(await W$({canonicalDir:t.canonicalDir,reinstall:t.reinstall}),true):false}i($w,"maybeRunInstallSync");function Mw(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"?li.parse(t.as.trim()):void 0,nameOverride:typeof t.name=="string"?t.name.trim():""}}i(Mw,"readInstallFlags");function Zo(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}i(Zo,"featuresFromCanonical");async function sm(t){let{sliceRoot:e,implicitPick:r}=await jc(t),n=await Uc(e);return {canonical:n,features:Zo(n),implicitPick:r}}i(sm,"discoverFromContentRoot");function Gw(t){return t.description.trim()?{skill:t,ok:true}:{skill:t,ok:false,reason:"missing description in frontmatter"}}i(Gw,"validateSkill");function jw(t){return t.description.trim()?{rule:t,ok:true}:{rule:t,ok:false,reason:"missing description in frontmatter"}}i(jw,"validateRule");function Uw(t){return t.description.trim()?{command:t,ok:true}:{command:t,ok:false,reason:"missing description in frontmatter"}}i(Uw,"validateCommand");function Kw(t){return t.description.trim()?{agent:t,ok:true}:{agent:t,ok:false,reason:"missing description in frontmatter"}}i(Kw,"validateAgent");function Ee(t){return basename(t.source).replace(/\.md$/i,"")}i(Ee,"ruleSlug");function H$(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}i(H$,"featuresFromImplicitPick");function ui(t,e){let{implicitPick:r}=e,n=e.scopedFeatures??H$(r);if(!r&&!n)return t;let o=new Set(n??[]),s={...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);s={...s,skills:r.skills.length===0?[]:s.skills.filter(l=>a.has(l.name))};}else n&&!o.has("skills")&&(s={...s,skills:[]});if(r?.rules!==void 0){let a=new Set(r.rules);s={...s,rules:r.rules.length===0?[]:s.rules.filter(l=>a.has(Ee(l)))};}else n&&!o.has("rules")&&(s={...s,rules:[]});if(r?.commands!==void 0){let a=new Set(r.commands);s={...s,commands:r.commands.length===0?[]:s.commands.filter(l=>a.has(l.name))};}else n&&!o.has("commands")&&(s={...s,commands:[]});if(r?.agents!==void 0){let a=new Set(r.agents);s={...s,agents:r.agents.length===0?[]:s.agents.filter(l=>a.has(l.name))};}else n&&!o.has("agents")&&(s={...s,agents:[]});return s}i(ui,"narrowDiscoveredForInstallScope");A();A();v();var J$=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"]),Y$=new Set([".git",".github",".gitlab","node_modules",".vscode",".idea"]);async function im(t){let e=await I(t);if(!e)return "";let{frontmatter:r}=E(e);return typeof r.name!="string"?"":r.name.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}i(im,"readSkillFrontmatterName");async function Ww(t,e){await cp$1(t,e,{recursive:true,filter:i(r=>{let n=relative(t,r).replace(/\\/g,"/");if(n==="")return true;let o=n.split("/")[0];return !(Y$.has(o)||!n.includes("/")&&J$.has(n))},"filter")});}i(Ww,"cpFilteredSkill");async function tM(){let t=await mkdtemp(join(tmpdir(),"am-install-manual-")),e=join(t,"repo");return await R(join(e,".agentsmesh")),{discoveryRoot:e,cleanup:i(async()=>{await rm$1(t,{recursive:true,force:true});},"cleanup")}}i(tM,"createStageRoot");async function eM(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 R(e),await cp$1(t,join(e,basename(t)));return}let n=(await x(t)).filter(s=>s.toLowerCase().endsWith(".md"));if(n.length===0)throw new Error(`No .md files found under ${t} for manual install.`);let o=new Map;await R(e);for(let s of n){let a=basename(s),l=o.get(a);if(l)throw new Error(`Manual install found duplicate file name "${a}" under ${t} (${l} and ${s}).`);o.set(a,s),await cp$1(s,join(e,a));}}i(eM,"stageMarkdownCollection");async function Bw(t,e,r){if(r.length===0)return false;let n=new Set(r),o=new Map;for(let s of await x(t)){if(!s.endsWith("/SKILL.md")&&!s.endsWith("\\SKILL.md"))continue;let a=dirname(s),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 R(e);for(let s of r)await cp$1(o.get(s),join(e,s),{recursive:true});return true}i(Bw,"stagePreferredSkills");async function rM(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)),s=join(e,o);await R(s),await cp$1(dirname(t),s,{recursive:true});return}if(await Vo(t)){if((await stat(join(t,"SKILL.md")).catch(()=>null))?.isFile()){if(await Bw(t,e,r.preferredSkillNames??[]))return;let l=await im(join(t,"SKILL.md"))||basename(t),c=join(e,l);await R(e),await Ww(t,c);return}if(await Bw(t,e,r.preferredSkillNames??[]))return;await R(e);let o=await x(t),s=new Set;for(let a of o.filter(l=>l.endsWith("/SKILL.md")||l.endsWith("\\SKILL.md")))s.add(relative(t,dirname(a)).split(/[\\/]/)[0]);for(let a of s)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}.`)}i(rM,"stageSkills");async function Hw(t,e,r={}){let n=await tM();try{let o=join(n.discoveryRoot,".agentsmesh",e);return e==="skills"?await rM(t,o,r):await eM(t,o),n}catch(o){throw await n.cleanup(),o}}i(Hw,"stageManualInstallScope");async function zw(t,e,r,n){let o=await Hw(t,e,{preferredSkillNames:e==="skills"?n?.skills:void 0}),{canonical:s}=await sm(o.discoveryRoot),a=ui(s,{scopedFeatures:[e]});return {prep:{yamlTarget:r,scopedFeatures:[e],cleanup:o.cleanup},narrowed:a,discoveredFeatures:Zo(a)}}i(zw,"resolveManualDiscoveredForInstall");A();var nM=[{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 oM(t){return t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}i(oM,"norm");function lm(t){let e=oM(t),r=[...nM].sort((n,o)=>o.prefix.length-n.prefix.length);for(let{prefix:n,target:o}of r)if(e===n||e.startsWith(`${n}/`))return o}i(lm,"targetHintFromNativePath");function Pf(t,e){return lm(t)===e}i(Pf,"pathSupportsNativePick");function Vw(t,e){if(!t||!e)return;let r=lm(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.`)}i(Vw,"validateTargetMatchesPath");function Jw(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)>0}i(Jw,"extendPickHasArrays");A();A();It();async function Xw(t,e){let r=join(t,...ee.split("/")),n=join(t,...e.split("/")),o=await x(n),s=[];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&&s.push(m);}return [...new Set(s)].sort()}i(Xw,"inferGeminiCommandNamesFromFiles");It();de();A();async function qo(t){let e=await x(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()}i(qo,"skillNamesFromNativeSkillDir");A();Ie();async function Zw(t,e){let r=join(t,...e.split("/"));if(e.startsWith(Mn)){let n=await x(r),o=[...new Set(n.filter(s=>s.toLowerCase().endsWith(".prompt.md")).map(s=>basename(s,".prompt.md")))].sort();return o.length?{commands:o}:{}}if(e.startsWith(".github/copilot")&&!e.includes("copilot-instructions.md")){let n=await x(r),o=[...new Set(n.filter(s=>s.includes(".instructions.md")).map(s=>basename(s).replace(/\.instructions\.md$/i,"")))].sort();return o.length?{rules:o}:{}}if(e.startsWith(".github/instructions")){let n=await x(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 s=[...o].sort();return s.length?{rules:s}:{}}if(e.startsWith(".github/skills")){let n=await qo(r);return n.length?{skills:n}:{}}if(e.startsWith(".github/agents")){let n=await x(r),o=[...new Set(n.filter(s=>s.toLowerCase().endsWith(".agent.md")).map(s=>basename(s,".agent.md")))].sort();return o.length?{agents:o}:{}}return {}}i(Zw,"inferCopilotPickFromPath");async function oe(t,e){let r=await x(t),n=e.toLowerCase();return [...new Set(r.filter(o=>o.toLowerCase().endsWith(n)).map(o=>basename(o,e)))].sort()}i(oe,"mdNames");async function Qw(t,e,r){let n=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),o=join(t,...n.split("/"));if(r==="gemini-cli"){if(n===ee||n.startsWith(`${ee}/`)){let s=await Xw(t,n);return s.length?{commands:s}:{}}return {}}if(r==="claude-code"){if(n.startsWith(".claude/commands")){let s=await oe(o,".md");return s.length?{commands:s}:{}}if(n.startsWith(".claude/rules")){let s=await oe(o,".md");return s.length?{rules:s}:{}}if(n.startsWith(".claude/agents")){let s=await oe(o,".md");return s.length?{agents:s}:{}}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 s=await oe(o,".mdc");return s.length?{rules:s}:{}}if(n.startsWith(".cursor/commands")){let s=await oe(o,".md");return s.length?{commands:s}:{}}if(n.startsWith(".cursor/agents")){let s=await oe(o,".md");return s.length?{agents:s}:{}}if(n.startsWith(".cursor/skills")){let s=await qo(o);return s.length?{skills:s}:{}}return {}}if(r==="copilot")return Zw(t,n);if(r==="windsurf"&&n.startsWith(".windsurf/rules")){let s=await oe(o,".md");return s.length?{rules:s}:{}}if(r==="cline"){if(n.startsWith(wt)){let s=await qo(o);return s.length?{skills:s}:{}}if(n.startsWith(sr)){let s=await oe(o,".md");return s.length?{commands:s}:{}}return {}}if(r==="continue"){if(n.startsWith(".continue/rules")){let s=await oe(o,".md");return s.length?{rules:s}:{}}if(n.startsWith(".continue/prompts")){let s=await oe(o,".md");return s.length?{commands:s}:{}}if(n.startsWith(".continue/skills")){let s=await qo(o);return s.length?{skills:s}:{}}return {}}if(r==="junie"){if(n.startsWith(".junie/commands")){let s=await oe(o,".md");return s.length?{commands:s}:{}}if(n.startsWith(".junie/rules")){let s=await oe(o,".md");return s.length?{rules:s}:{}}if(n.startsWith(".junie/agents")){let s=await oe(o,".md");return s.length?{agents:s}:{}}if(n.startsWith(".junie/skills")){let s=await qo(o);return s.length?{skills:s}:{}}return {}}if(r==="codex-cli"&&n.startsWith(".codex")){let s=await x(o),a=[...new Set(s.filter(l=>l.toLowerCase().endsWith(".md")).map(l=>basename(l,".md")))].sort();return a.length?{rules:a}:{}}return {}}i(Qw,"inferImplicitPickFromNativePath");function tL(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)===0}i(tL,"isImplicitPickEmpty");function Ua(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}i(Ua,"normalizePath");function fM(t,e){let r=Ua(t),n=Ua(e);return r===n||r.startsWith(`${n}/`)||n.startsWith(`${r}/`)}i(fM,"overlapsPath");function cm(t,e){let r=t??[];return r.includes(e)||r.push(e),r}i(cm,"addUnique");async function gM(t){let e=await mkdtemp(join(tmpdir(),"am-install-native-")),r=join(e,"repo"),n=i(async()=>{await rm$1(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}}i(gM,"makeStageRoot");function hM(t,e){let r;for(let o of t){if(o.feature==="rules"&&o.toPath.startsWith(".agentsmesh/rules/")){r={...r,rules:cm(r?.rules,basename(o.toPath,".md"))};continue}if(o.feature==="commands"&&o.toPath.startsWith(".agentsmesh/commands/")){let s=Ua(relative(join(e,".agentsmesh","commands"),join(e,o.toPath)));r={...r,commands:cm(r?.commands,s.replace(/\.md$/i,"").split("/").filter(Boolean).join(":"))};continue}if(o.feature==="agents"&&o.toPath.startsWith(".agentsmesh/agents/")){r={...r,agents:cm(r?.agents,basename(o.toPath,".md"))};continue}if(o.feature==="skills"&&o.toPath.startsWith(".agentsmesh/skills/")){let a=Ua(relative(join(e,".agentsmesh","skills"),join(e,o.toPath))).split("/")[0];a&&(r={...r,skills:cm(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}i(hM,"buildPickFromResults");function yM(t,e,r,n){let o=join(e,...Ua(t).split("/")),s=r.filter(a=>fM(o,a.fromPath));if(s.length===0)throw new Error(`No installable native resources found under "${t}" for target "${n}".`);return {features:[...new Set(s.map(a=>a.feature))],pick:hM(s,e)}}i(yM,"scopeImportedResults");async function Tf(t,e){let{stageRoot:r,cleanup:n}=await gM(t);try{let o=await wa(r,e);return {stageRoot:r,results:o,cleanup:n}}catch(o){throw await n(),o}}i(Tf,"stageImportedNativeRepo");async function Nf(t,e,r){let n=await Tf(t,r);try{return {stageRoot:n.stageRoot,cleanup:n.cleanup,...yM(e,n.stageRoot,n.results,r)}}catch(o){throw await n.cleanup(),o}}i(Nf,"stageNativeInstallScope");async function oL(t,e,r,n){let o=n.explicitTarget?.trim();o&&ie.parse(o);let s=r.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");Vw(o,s);let a=join(t,".agentsmesh"),l=await F(a),c=s?lm(s):void 0,m=!l&&!o?await rl(t)??void 0:void 0;if(!o&&c&&m&&c!==m)throw new Error(`Install path suggests native layout "${c}" but auto-detect imported "${m}". Use --target ${c} for this path, or install from the repo root without a conflicting subtree path.`);let p=o??c??m,u=!!s&&!!p&&!s.startsWith(".agentsmesh");if(!l&&p){if(u){let k=await Nf(t,s,p);return {discoveryRoot:k.stageRoot,implicitPick:k.pick,scopedFeatures:k.features,yamlTarget:p,importHappened:true,cleanup:k.cleanup}}let _=await Tf(t,p);return {discoveryRoot:s?join(_.stageRoot,s):_.stageRoot,yamlTarget:p,importHappened:true,cleanup:_.cleanup}}let d;l?s?p&&Pf(s,p)?d=t:d=e:d=t:d=e;let g,h,C;if(u&&p){let _=await Nf(t,s,p);d=_.stageRoot,g=_.pick,h=_.features,C=_.cleanup;}else if(d===t&&s&&p&&Pf(s,p)&&(g=await Qw(t,s,p),tL(g)))throw new Error(`No installable native resources found under "${s}" for target "${p}".`);let O;return o?O=o:p&&(g&&Jw(g)||(h?.length??0)>0)&&(O=p),{discoveryRoot:d,implicitPick:g,scopedFeatures:h,yamlTarget:O,importHappened:C!==void 0,cleanup:C}}i(oL,"prepareInstallDiscovery");async function sL(t,e,r,n){let o=await oL(t,e,r,{explicitTarget:n}),{canonical:s,implicitPick:a}=await sm(o.discoveryRoot),l=a??o.implicitPick,c=ui(s,{implicitPick:l,scopedFeatures:o.scopedFeatures}),m=Zo(c);return {prep:o,discovered:s,implicitPick:l,narrowed:c,discoveredFeatures:m}}i(sL,"resolveDiscoveredForInstall");async function iL(t){return t.explicitAs?{implicitPick:void 0,...await zw(t.contentRoot,t.explicitAs,t.explicitTarget,t.replayPick)}:sL(t.resolvedPath,t.contentRoot,t.pathInRepo,t.explicitTarget)}i(iL,"resolveInstallDiscovery");function fi(t){return t==="."||t===""?void 0:t}i(fi,"trimDot");function _M(t,e){let r=basename(e).replace(/\.md$/i,"");return t==="agents"?{agents:[r]}:t==="commands"?{commands:[r]}:{rules:[r]}}i(_M,"markdownPick");async function lL(t){if(!t.as)return {pathInRepo:fi(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:fi(dirname(e)),pick:_M(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:fi(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 im(o);return {pathInRepo:fi(dirname(n)),pick:{skills:[a||basename(n)]}}}}catch{return {pathInRepo:fi(e)}}}}return {pathInRepo:fi(e)}}i(lL,"resolveManualInstallPersistence");async function Lr(t){return process.stdin.isTTY?new Promise(e=>{let r=cL.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}i(Lr,"confirm");function SM(t){return !!(t.skills.length||t.rules.length||t.commands.length||t.agents.length)}i(SM,"hasArrayResources");function mL(t){return SM(t)||t.mcp!==null||t.permissions!==null||t.hooks!==null||t.ignore.length>0}i(mL,"hasInstallableResources");async function pL(t,e,r,n){let o=t.skills.map(l=>Gw(l)),s=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 Lr(`Include invalid skill "${l.skill.name}" anyway? (${l.reason}). You can fix it later.`)&&s.push(l.skill);else e&&(s=o.map(l=>l.skill));return r&&(s=o.filter(l=>l.ok).map(l=>l.skill)),s}i(pL,"resolveSkillPool");async function uL(t,e,r,n){let o=t.rules.map(l=>jw(l)),s=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 Lr(`Include invalid rule "${Ee(l.rule)}" anyway? (${l.reason}). You can fix it later.`)&&s.push(l.rule);else e&&(s=o.map(l=>l.rule));return r&&(s=o.filter(l=>l.ok).map(l=>l.rule)),s}i(uL,"resolveRulePool");async function dL(t,e,r,n){let o=t.commands.map(l=>Uw(l)),s=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 Lr(`Include invalid command "${l.command.name}" anyway? (${l.reason}). You can fix it later.`)&&s.push(l.command);else e&&(s=o.map(l=>l.command));return r&&(s=o.filter(l=>l.ok).map(l=>l.command)),s}i(dL,"resolveCommandPool");async function fL(t,e,r,n){let o=t.agents.map(l=>Kw(l)),s=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 Lr(`Include invalid agent "${l.agent.name}" anyway? (${l.reason}). You can fix it later.`)&&s.push(l.agent);else e&&(s=o.map(l=>l.agent));return r&&(s=o.filter(l=>l.ok).map(l=>l.agent)),s}i(fL,"resolveAgentPool");async function gL(t,e){let r=e.skills.map(a=>a.name),n=e.rules.map(a=>Ee(a)),o=e.commands.map(a=>a.name),s=e.agents.map(a=>a.name);for(let a of e.skills)t.skills.some(l=>l.name===a.name)&&(await Lr(`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=Ee(a);t.rules.some(c=>Ee(c)===l)&&(await Lr(`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 Lr(`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 Lr(`Agent "${a.name}" already exists in merged config. Add extend anyway?`)||(s=s.filter(c=>c!==a.name)));return {skillNames:r,ruleSlugs:n,commandNames:o,agentNames:s}}i(gL,"resolveInstallConflicts");function hL(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)),s=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),s&&s.length>0&&(r.commands=s),a&&a.length>0&&(r.agents=a),Object.keys(r).length>0?r:void 0}i(hL,"pickForSelectedResources");function CM(t,e){let r=t.split("/").filter(Boolean);return r.length>0&&r[r.length-1]===e}i(CM,"pathEndsWithName");function mm(t,e,r){return r!==1||e.length!==1?false:CM(t,e[0])}i(mm,"inferSingleNamePick");function yL(t){let{pathInRepo:e,implicitPick:r,preConflictCounts:n,selected:o}=t,s={},a=o.skillNames.length>0&&(!!r?.skills?.length||o.skillNames.length<n.skills||mm(e,o.skillNames,n.skills)),l=o.ruleSlugs.length>0&&(!!r?.rules?.length||o.ruleSlugs.length<n.rules||mm(e,o.ruleSlugs,n.rules)),c=o.commandNames.length>0&&(!!r?.commands?.length||o.commandNames.length<n.commands||mm(e,o.commandNames,n.commands)),m=o.agentNames.length>0&&(!!r?.agents?.length||o.agentNames.length<n.agents||mm(e,o.agentNames,n.agents));return a&&(s.skills=[...o.skillNames]),l&&(s.rules=[...o.ruleSlugs]),c&&(s.commands=[...o.commandNames]),m&&(s.agents=[...o.agentNames]),Object.keys(s).length?s:void 0}i(yL,"buildInstallPick");function IL(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]}i(IL,"deriveInstallFeatures");function OM(t){return t.skillNames.length===0&&t.ruleSlugs.length===0&&t.commandNames.length===0&&t.agentNames.length===0}i(OM,"isEmptyInstallSelection");function _L(t){let{selected:e,discoveredFeatures:r,preConflict:n}=t,o=i(l=>r.includes(l),"had"),s=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(s)throw new Error(`No ${s} selected to install.`);let a=r.some(l=>["mcp","permissions","hooks","ignore"].includes(l));if(OM(e)&&!a)throw new Error("No resources selected to install.")}i(_L,"ensureInstallSelection");function SL(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.`)}i(SL,"assertExtendNameAvailable");function RM(t,e,r){if(r===void 0){if(!t)return;let o={...t};for(let s of ["skills","commands","rules","agents"])e.includes(s)&&delete o[s];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 s=r[o];if(s===void 0||s.length===0){delete n[o];continue}n[o]=[...new Set([...t?.[o]??[],...s])];}return Object.keys(n).length?n:void 0}i(RM,"mergePick");function CL(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 n=t[r],o=[...new Set([...n.features,...e.features])],s=RM(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:s,target:e.target??n.target}:a)}i(CL,"mergeExtendList");A();async function OL(t,e,r){let n=await I(t);if(n===null)throw new Error(`Missing config: ${t}`);let o=parse(n),s=CL(e.extends,r);o.extends=s;let a=stringify(o,{indent:2,lineWidth:0});await S(t,a.endsWith(`
|
|
291
|
+
`),true}s(yj,"appendToGitignore");async function GA(t,e={}){let r=e.global===true?"global":"project",n=ta(t,r),o=join(n.configDir,Ng);if(await F(o))throw new Error(`Already initialized. ${Ng} exists. Remove it first to re-init.`);let i=await DA(n.rootBase,r),a=r==="global"?i.filter(g=>MA.includes(g)):i,l=r==="global"?MA:void 0,c=[],m,p=0;if(a.length>0)if(e.yes){for(let g of a){let h=gj[g];if(!h)continue;let R=await h(n.rootBase,r);for(let S of R)c.push({from:relative(n.rootBase,S.fromPath).replaceAll("\\","/"),to:S.toPath.replaceAll("\\","/")});}p=a.length,await FA(n.canonicalDir),m="gap-fill",await C(o,Xm(a,l));}else await Dg(n.canonicalDir),m="full",await C(o,Xm([],l));else await Dg(n.canonicalDir),m="full",await C(o,Xm([],l));let u=join(n.configDir,vA);await C(u,bA);let f=false;return r==="project"&&(f=await yj(t)),{exitCode:0,data:{scope:r,configFile:Ng,localConfigFile:vA,detectedConfigs:a,imported:c,importedToolCount:p,scaffoldType:m,gitignoreUpdated:f}}}s(GA,"runInit");tt();function $A(t){let{data:e}=t;if(e.detectedConfigs.length>0&&_.info(`Found existing configurations: ${e.detectedConfigs.join(", ")}`),e.detectedConfigs.length>0&&e.imported.length===0&&_.info("Run 'agentsmesh init --yes' to auto-import, or 'agentsmesh import --from <tool>' manually."),e.imported.length>0){_.info("Auto-importing existing configurations (--yes)...");for(let n of e.imported)_.success(` ${n.from} \u2192 ${n.to}`);_.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(", ")})`:"";_.success(`Created ${e.configFile}${r}`),_.success(`Created ${e.localConfigFile}`),e.gitignoreUpdated&&_.success("Updated .gitignore");}s($A,"renderInit");ge();mt();var Ij=Object.fromEntries(jt.map(t=>[t.id,{importFrom:t.generators.importFrom,emptyImportMessage:t.emptyImportMessage,lintRules:t.lintRules,lint:t.lint,capabilities:t.capabilities}]));function qm(t){let e=Ij[t];if(!e)throw new Error(`Unknown target: ${t}`);return e}s(qm,"getTargetCatalogEntry");lr();ko();function jA(t,e){return t.map(r=>({from:relative(e,r.fromPath).replaceAll("\\","/"),to:r.toPath}))}s(jA,"mapResults");async function UA(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(ve(o)){let p=ta(r,i),f=await qm(o).importFrom(p.rootBase,{scope:i});return {exitCode:0,data:{scope:i,target:o,files:jA(f,p.rootBase)}}}let a,l;try{({config:a,context:l}=await ct(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 re(a,r);let c=rt(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 {exitCode:0,data:{scope:i,target:o,files:jA(m,l.rootBase)}}}s(UA,"runImport");ge();Oo();function WA(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(WA,"computeDiff");function BA(t){return `${t.new} files would be created, ${t.updated} updated, ${t.unchanged} unchanged, ${t.deleted} deleted`}s(BA,"formatDiffSummary");ko();async function HA(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 ct(r,n);await re(a,r);let{canonical:c}=await De(a,l.configDir,{},l.canonicalDir),m=await $i({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}=WA(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(HA,"runDiff");ge();Oo();A();lr();To();Lt();var Cj=[{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 zA(t){let e=new Set(t.enabledFeatures),r=[];for(let n of Cj)!e.has(n.featureFlag)||!n.hasContent(t.canonical)||$e(t.capabilities[n.capabilityKey]).level!=="none"||r.push($(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(zA,"lintSilentFeatureDrops");Lt();var Sj=/^(?:\s*(?:bash|sh|zsh|pwsh|powershell)\s+)?["']?(?<path>(?:\.{1,2}\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?:\s|$)/;function Rj(t){let r=t.match(Sj)?.groups?.path;return typeof r=="string"?r:null}s(Rj,"extractScriptToken");function VA(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=Rj(o.command);i&&r.push($(".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(VA,"lintHookScriptReferences");Lt();function JA(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($(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(JA,"lintRuleScopeInversion");var Oj=["node_modules",".git","dist","coverage",".agentsmesh"];async function kj(t){return (await D(t)).filter(n=>{let o=relative(t,n);return !Oj.some(i=>o.includes(`/${i}/`)||o.startsWith(`${i}/`))}).map(n=>relative(t,n))}s(kj,"getProjectFiles");async function XA(t,e,r,n,o={}){let i=o.scope??"project",a=[...t.targets,...t.pluginTargets??[]],l=n?a.filter(S=>n.includes(S)):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 kj(r);for(let S of l){let I=rt(S),E=ve(S)?qm(S):I;E?.capabilities&&g.push(...zA({target:S,capabilities:E.capabilities,canonical:e,enabledFeatures:t.features})),f&&g.push(...VA({target:S,canonical:e,hasScriptProjection:I?.postProcessHookOutputs!==void 0})),c&&g.push(...JA({target:S,canonical:e,preservesManualActivation:I?.preservesManualActivation===true})),c&&E?.lintRules&&g.push(...E.lintRules(e,r,h,{scope:i})),I?.generators.lint&&g.push(...I.generators.lint(e));let T={scope:i};m&&E?.lint?.commands&&g.push(...E.lint.commands(e,T)),p&&E?.lint?.mcp&&g.push(...E.lint.mcp(e,T)),u&&E?.lint?.permissions&&g.push(...E.lint.permissions(e,T)),f&&E?.lint?.hooks&&g.push(...E.lint.hooks(e,T));}let R=g.some(S=>S.level==="error");return {diagnostics:g,hasErrors:R}}s(XA,"runLint");ko();async function ZA(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 ct(r,n);await re(a,r);let{canonical:c}=await De(a,l.configDir,{},l.canonicalDir),{diagnostics:m,hasErrors:p}=await XA(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(ZA,"runLintCmd");tt();function qA(t){let{data:e}=t;if(e.diagnostics.length===0){_.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)_.error(`${a.file} (${a.target}): ${a.message}`);for(let a of n)_.warn(`${a.file} (${a.target}): ${a.message}`);let o=e.summary.errors,i=e.summary.warnings;_.info(`${o} error${o!==1?"s":""}, ${i} warning${i!==1?"s":""}`);}s(qA,"renderLint");tt();function QA(t){let{data:e}=t;if(!e.hasLock){_.error("Not initialized for collaboration. Run 'agentsmesh generate' first.");return}if(e.inSync){_.success("Lock file is in sync.");return}let r=new Set(e.lockedViolations);_.error("Conflict detected:");for(let n of e.extendsModified)_.error(` extend "${n}" was modified`);for(let n of e.modified){let o=r.has(n)?" [LOCKED]":"";_.error(` ${n} was modified${o}`);}for(let n of e.added){let o=r.has(n)?" [LOCKED]":"";_.error(` ${n} was added${o}`);}for(let n of e.removed){let o=r.has(n)?" [LOCKED]":"";_.error(` ${n} was removed${o}`);}_.info("Run 'agentsmesh merge' to resolve, or 'agentsmesh generate --force' to accept current state.");}s(QA,"renderCheck");tt();function tx(t){let{data:e}=t;if(e.files.length===0){_.info(`Nothing to import from ${e.target}.`);return}for(let n of e.files)_.success(`${n.from} \u2192 ${n.to}`);let r=e.scope==="global"?" --global":"";_.info(`Imported ${e.files.length} file(s). Run 'agentsmesh generate${r}' to sync to other tools.`);}s(tx,"renderImport");tt();function ex(t){let{summary:e}=t.data;if(e.created+e.updated+e.unchanged+e.deleted===0){_.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);_.info(BA({new:e.created,updated:e.updated,unchanged:e.unchanged,deleted:e.deleted}));}s(ex,"renderDiff");tt();function rx(t){if(!t.data.hadConflict){_.info("No conflicts to resolve.");return}_.success("Lock file conflict resolved.");}s(rx,"renderMerge");gl();yl();ge();Oo();gl();yl();tt();var wj=300;function Aj(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(Aj,"normalizeWatchPath");function xj(t,e,r){let n=Aj(relative(t,e));return n===".lock"||n===".lock.tmp"||n===".generate.lock"||n.endsWith("/.lock")||n.endsWith("/.lock.tmp")||n.endsWith("/.generate.lock")||n.includes("/.generate.lock/")||n.startsWith(".generate.lock/")}s(xj,"shouldIgnoreWatchPath");function bj(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(bj,"featureFingerprint");async function ox(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{context:o}=await ct(r,n),i=[o.canonicalDir,join(o.configDir,"agentsmesh.yaml"),join(o.configDir,"agentsmesh.local.yaml")],a=null,l=null,c=false,m=null,u=s(async()=>{if(c)return;a=null;let{config:R,context:S}=await ct(r,n),{canonical:I}=await De(R,S.configDir,{},S.canonicalDir),E=I.mcp?Object.keys(I.mcp.mcpServers).length:0,T=I.permissions?I.permissions.allow.length+I.permissions.deny.length:0,P=I.hooks?Object.values(I.hooks).reduce((St,It)=>St+(Array.isArray(It)?It.length:0),0):0,x=I.ignore.length,Y=bj(R.features,I.rules.length,I.commands.length,I.agents.length,I.skills.length,E,T,P,x),K=l!==null&&l!==Y;if(l=Y,c)return;let z=await ji(t,r,{printMatrix:false});if(Ui(z),!c)if(K){let St=await fl(t,r);hl(St,{verbose:t.verbose===true});}else _.info("Regenerated.");},"run"),f=s(()=>{let R=u().catch(S=>{if(!c){let I=S instanceof Error?S.message:String(S);_.error(I);}}).finally(()=>{m===R&&(m=null);});m=R;},"scheduleRun"),g=s(()=>{c||(a&&clearTimeout(a),a=setTimeout(f,wj));},"schedule"),h=Lj.watch(i,{ignoreInitial:true,usePolling:process.platform==="win32"});return h.on("all",(R,S)=>{xj(o.canonicalDir,S)||g();}),await new Promise((R,S)=>{h.once("ready",R),h.once("error",S);}),_.info(n==="global"?"Watching ~/.agentsmesh/ and agentsmesh.yaml...":"Watching .agentsmesh/ and agentsmesh.yaml..."),m=u(),await m,m=null,{stop:s(async()=>{c=true,a&&(clearTimeout(a),a=null),await h.close(),m&&await m;},"stop")}}s(ox,"runWatch");ge();Tl();async function sx(t){let{config:e,configDir:r,canonicalDir:n}=t,o=await Gm(n);if(o===null)return {inSync:false,hasLock:false,modified:[],added:[],removed:[],extendsModified:[],lockedViolations:[]};let i=await Nn(n),a=await Ns(e,r),l=a.length>0?await Gi(a):{},c=new Set(Object.keys(o.checksums)),m=new Set(Object.keys(i)),p=[],u=[],f=[];for(let I of c){let E=i[I];E===void 0?f.push(I):E!==o.checksums[I]&&p.push(I);}for(let I of m)c.has(I)||u.push(I);let g=new Set([...Object.keys(o.extends),...Object.keys(l)]),h=[];for(let I of g)l[I]!==o.extends[I]&&h.push(I);let R=jm(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(sx,"checkLockSync");ko();async function ix(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:i}=await ct(r,n);await re(o,r);let a=await sx({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(ix,"runCheck");ge();A();Tl();var Tj=".lock",Dj="<<<<<<<";async function vg(t){let e=join(t,Tj),r=await y(e);return r===null?false:r.includes(Dj)}s(vg,"hasLockConflict");async function lx(t,e,r){if(!await vg(t))throw new Error("No conflict to resolve.");let o=await Nn(t),i=dirname(t),a=r?await Ns(r,i):[],l=a.length>0?await Gi(a):{},c=await Um(join(t,"packs")),m=process.env.USER??process.env.USERNAME??"unknown";await $m(t,{generatedAt:new Date().toISOString(),generatedBy:m,libVersion:e,checksums:o,extends:l,packs:c});}s(lx,"resolveLockConflict");async function cx(t,e){let r=e??process.cwd(),n=t.global===true?"global":"project",{config:o,context:i}=await ct(r,n),a=i.canonicalDir;return await vg(a)?(await lx(a,wl(),o),{exitCode:0,data:{hadConflict:true,resolved:true}}):{exitCode:0,data:{hadConflict:false,resolved:false}}}s(cx,"runMerge");ge();A();na();var vj=promisify(execFile);async function Mg(t){let{stdout:e}=await vj("git",t,{env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return e.trim()}s(Mg,"runGit");async function mx(){try{return await Mg(["--version"]),!0}catch{return false}}s(mx,"isGitAvailable");async function Mj(t,e){let r=[e,`refs/heads/${e}`,`refs/tags/${e}`],n;for(let o of r)try{let a=(await Mg(["ls-remote",t,o])).split(`
|
|
292
|
+
`).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(Mj,"gitLsRemoteResolve");async function px(t,e){let r=t===""?"HEAD":t;if(/^[0-9a-f]{40}$/i.test(r))return r.toLowerCase();if(r==="HEAD"){let o=(await Mg(["ls-remote",e,"HEAD"])).split(`
|
|
293
|
+
`).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 Mj(e,r)}s(px,"resolveRemoteRefForInstall");async function ux(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 px(t.rawRef||"HEAD",e);if(t.kind==="github"){let l=`github:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Ds(l,"install",{cacheDir:ie(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}if(t.kind==="gitlab"){let l=`gitlab:${t.org}/${t.repo}@${r}`;return {resolvedPath:(await Ds(l,"install",{cacheDir:ie(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:l,version:r}}let n=r,i=`git+${(t.gitPlusBase??e).split("#")[0]}#${n}`;return {resolvedPath:(await Ds(i,"install",{cacheDir:ie(),refresh:false,allowOfflineFallback:false})).resolvedPath,sourceForYaml:i,version:r}}s(ux,"fetchInstallSource");async function dx(t,e){if(t.kind==="local")return {resolvedPath:t.localRoot,sourceForYaml:t.localSourceForYaml};try{let r=await ux(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(dx,"resolveInstallResolvedPath");function Gg(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(Gg,"parseGithubTreeUrl");function $g(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($g,"parseGithubBlobUrl");function jg(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(jg,"parseGitlabTreeUrl");function Ug(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(Ug,"parseGitlabBlobUrl");var Gj=new Set(["tree","blob","commit","releases","actions","issues","pulls","settings","wiki","discussions","security","projects","packages"]);function Kg(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||Gj.has(r[1]))return null;let n=r[0],o=r[1];return {org:n,repo:o}}catch{return null}}s(Kg,"parseGithubRepoUrl");function Wg(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(Wg,"parseGitlabRepoUrl");function Bg(t){let e=t.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/i);return e?{org:e[1],repo:e[2].replace(/\.git$/i,"")}:null}s(Bg,"parseGitSshGithub");function Hg(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(Hg,"parseGitSshGitlab");A();var Uj=/^[A-Za-z]:[\\/]/,Kj=/^[A-Za-z]:\//;function fx(...t){return t.some(e=>e.includes("\\")||Uj.test(e))?win32:posix}s(fx,"pathApiFor");function _l(t){return t.replace(/\\/g,"/")}s(_l,"toPosixPath");function Il(t){return _l(t).replace(/^\/+|\/+$/g,"")}s(Il,"normalizeInstallPathField");function Qm(t){let e=_l(t);return e===""||e==="."||e==="./."?".":e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||Kj.test(e)?e:`./${e}`}s(Qm,"normalizeLocalSourceForYaml");function Eo(t){return {...t,source:t.source_kind==="local"?Qm(t.source):t.source,...t.path!==void 0?{path:Il(t.path)}:{},...t.paths!==void 0?{paths:t.paths.map(e=>Il(e))}:{}}}s(Eo,"normalizePersistedInstallPaths");function gx(t,e,r){let n=fx(t,e),o=n.normalize(t),i=n.normalize(e),a=Il(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=Il(u),g=_l(n.relative(i,p))||".";return {kind:"local",rawRef:"",pathInRepo:a||f.replace(/\.md$/i,"").replace(/\/$/,""),localRoot:p,localSourceForYaml:Qm(g)}}let m=_l(n.relative(i,o))||".";return {kind:"local",rawRef:"",pathInRepo:a,localRoot:o,localSourceForYaml:Qm(m)}}s(gx,"localParsedFromAbsPath");async function zg(t,e,r){let n=t.trim(),o=r?.trim().replace(/\\/g,"/")??"";if(n.startsWith("git+")){let c=n.lastIndexOf("#"),m=c<0?n:n.slice(0,c),p=c<0?"HEAD":n.slice(c+1),u=m.slice(4);return {kind:"git",rawRef:p,gitPlusBase:u,gitRemoteUrl:u,pathInRepo:o}}if(n.startsWith("https://")||n.startsWith("http://")){let c=Gg(n)??$g(n);if(c)return {kind:"github",rawRef:c.ref,org:c.org,repo:c.repo,gitRemoteUrl:`https://github.com/${c.org}/${c.repo}.git`,pathInRepo:o||c.path};let m=Kg(n);if(m)return {kind:"github",rawRef:"HEAD",org:m.org,repo:m.repo,gitRemoteUrl:`https://github.com/${m.org}/${m.repo}.git`,pathInRepo:o};let p=jg(n)??Ug(n);if(p)return {kind:"gitlab",rawRef:p.ref,org:p.namespace,repo:p.project,gitRemoteUrl:`https://gitlab.com/${p.namespace}/${p.project}.git`,pathInRepo:o||p.path};let u=Wg(n);if(u)return {kind:"gitlab",rawRef:"HEAD",org:u.namespace,repo:u.project,gitRemoteUrl:`https://gitlab.com/${u.namespace}/${u.project}.git`,pathInRepo:o}}if(n.startsWith("git@github.com:")){let c=Bg(n);if(!c)throw new Error(`Invalid GitHub SSH URL: ${n}`);return {kind:"github",rawRef:"HEAD",org:c.org,repo:c.repo,gitRemoteUrl:`https://github.com/${c.org}/${c.repo}.git`,pathInRepo:o}}if(n.startsWith("git@gitlab.com:")){let c=Hg(n);if(!c)throw new Error(`Invalid GitLab SSH URL: ${n}`);return {kind:"gitlab",rawRef:"HEAD",gitRemoteUrl:`https://gitlab.com/${c.namespace}/${c.project}.git`,pathInRepo:o}}if(n.startsWith("git@")){let c=n.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(!c)throw new Error(`Invalid SSH git URL: ${n}`);let m=c[1],p=c[2].replace(/\.git$/i,"");return {kind:"git",rawRef:"HEAD",gitRemoteUrl:`ssh://git@${m}/${p}.git`,pathInRepo:o}}let i=n.match(/^github:([^/]+)\/(.+?)@([^/@]+)$/);if(i){let c=i[1],m=i[2];return {kind:"github",rawRef:i[3],org:c,repo:m,gitRemoteUrl:`https://github.com/${c}/${m}.git`,pathInRepo:o}}let a=n.match(/^gitlab:(.+)\/([^/@]+)@([^/@]+)$/);if(a){let c=a[1],m=a[2];return {kind:"gitlab",rawRef:a[3],org:c,repo:m,gitRemoteUrl:`https://gitlab.com/${c}/${m}.git`,pathInRepo:o}}let l=resolve(e,n);if(!await F(l))throw new Error(`Path does not exist: ${l}`);return gx(l,e,o)}s(zg,"parseInstallSource");A();tt();$n();A();Dm();var hx=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(Ps).min(1),pick:qi.optional(),target:fe.optional(),path:z.string().optional(),paths:z.array(z.string().min(1)).min(1).optional(),as:Mi.optional()}),Vj=z.object({version:z.literal(1),installs:z.array(hx).default([])});function Jj(t,e){return t.length===e.length&&[...t].sort().every((r,n)=>r===[...e].sort()[n])}s(Jj,"sameFeatures");function Yj(t,e){return t.source===e.source&&t.target===e.target&&t.as===e.as&&Jj(t.features,e.features)}s(Yj,"sameInstallIdentity");function yx(t){return join(t,"installs.yaml")}s(yx,"manifestPath");async function Vg(t){let e=await y(yx(t));if(e===null)return [];try{return Vj.parse(parse(e)).installs.map(r=>Eo(r))}catch{return []}}s(Vg,"readInstallManifest");async function Ix(t,e){let r=Eo(e),o=(await Vg(t)).filter(i=>i.name!==r.name&&!Yj(i,r));o.push(r),await C(yx(t),stringify({version:1,installs:o.sort((i,a)=>i.name.localeCompare(a.name))}));}s(Ix,"upsertInstallManifestEntry");function _x(t){return Eo(hx.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(_x,"buildInstallManifestEntry");async function Zj(t){let e=await Vg(t.canonicalDir);if(e.length===0){_.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 F(o)||r.push(n);}if(r.length===0){_.info("All recorded packs are already installed.");return}for(let n of r)await t.reinstall(n);_.success(`Reinstalled ${r.length} pack(s) from .agentsmesh/installs.yaml.`);}s(Zj,"syncInstalledPacks");async function Cx(t){return t.sync?(await Zj({canonicalDir:t.canonicalDir,reinstall:t.reinstall}),true):false}s(Cx,"maybeRunInstallSync");Dm();function Sx(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"?Mi.parse(t.as.trim()):void 0,nameOverride:typeof t.name=="string"?t.name.trim():""}}s(Sx,"readInstallFlags");Qf();function Es(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(Es,"featuresFromCanonical");async function tp(t){let{sliceRoot:e,implicitPick:r}=await bm(t),n=await Pm(e);return {canonical:n,features:Es(n),implicitPick:r}}s(tp,"discoverFromContentRoot");function Rx(t){return t.description.trim()?{skill:t,ok:true}:{skill:t,ok:false,reason:"missing description in frontmatter"}}s(Rx,"validateSkill");function Ox(t){return t.description.trim()?{rule:t,ok:true}:{rule:t,ok:false,reason:"missing description in frontmatter"}}s(Ox,"validateRule");function kx(t){return t.description.trim()?{command:t,ok:true}:{command:t,ok:false,reason:"missing description in frontmatter"}}s(kx,"validateCommand");function Ex(t){return t.description.trim()?{agent:t,ok:true}:{agent:t,ok:false,reason:"missing description in frontmatter"}}s(Ex,"validateAgent");function oe(t){return basename(t.source).replace(/\.md$/i,"")}s(oe,"ruleSlug");function Qj(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(Qj,"featuresFromImplicitPick");function Wi(t,e){let{implicitPick:r}=e,n=e.scopedFeatures??Qj(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(oe(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(Wi,"narrowDiscoveredForInstallScope");A();xm();A();v();var rU=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"]),nU=new Set([".git",".github",".gitlab","node_modules",".vscode",".idea"]);async function ep(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(ep,"readSkillFrontmatterName");async function Lx(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 !(nU.has(o)||!n.includes("/")&&rU.has(n))},"filter")});}s(Lx,"cpFilteredSkill");async function lU(){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$1(t,{recursive:true,force:true});},"cleanup")}}s(lU,"createStageRoot");async function cU(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 O(e),await cp$1(t,join(e,basename(t)));return}let n=(await D(t)).filter(i=>i.toLowerCase().endsWith(".md"));if(n.length===0)throw new Error(`No .md files found under ${t} for manual install.`);let o=new Map;await O(e);for(let i of n){let a=basename(i),l=o.get(a);if(l)throw new Error(`Manual install found duplicate file name "${a}" under ${t} (${l} and ${i}).`);o.set(a,i),await cp$1(i,join(e,a));}}s(cU,"stageMarkdownCollection");async function wx(t,e,r){if(r.length===0)return false;let n=new Set(r),o=new Map;for(let i of await D(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}s(wx,"stagePreferredSkills");async function mU(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 Os(t)){if((await stat(join(t,"SKILL.md")).catch(()=>null))?.isFile()){if(await wx(t,e,r.preferredSkillNames??[]))return;let l=await ep(join(t,"SKILL.md"))||basename(t),c=join(e,l);await O(e),await Lx(t,c);return}if(await wx(t,e,r.preferredSkillNames??[]))return;await O(e);let o=await D(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}.`)}s(mU,"stageSkills");async function Ax(t,e,r={}){let n=await lU();try{let o=join(n.discoveryRoot,".agentsmesh",e);return e==="skills"?await mU(t,o,r):await cU(t,o),n}catch(o){throw await n.cleanup(),o}}s(Ax,"stageManualInstallScope");async function xx(t,e,r,n){let o=await Ax(t,e,{preferredSkillNames:e==="skills"?n?.skills:void 0}),{canonical:i}=await tp(o.discoveryRoot),a=Wi(i,{scopedFeatures:[e]});return {prep:{yamlTarget:r,scopedFeatures:[e],cleanup:o.cleanup},narrowed:a,discoveredFeatures:Es(a)}}s(xx,"resolveManualDiscoveredForInstall");$n();Np();A();var pU=[{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 uU(t){return t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}s(uU,"norm");function np(t){let e=uU(t),r=[...pU].sort((n,o)=>o.prefix.length-n.prefix.length);for(let{prefix:n,target:o}of r)if(e===n||e.startsWith(`${n}/`))return o}s(np,"targetHintFromNativePath");function Yg(t,e){return np(t)===e}s(Yg,"pathSupportsNativePick");function bx(t,e){if(!t||!e)return;let r=np(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(bx,"validateTargetMatchesPath");function Px(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)>0}s(Px,"extendPickHasArrays");A();A();xt();async function Dx(t,e){let r=join(t,...me.split("/")),n=join(t,...e.split("/")),o=await D(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(Dx,"inferGeminiCommandNamesFromFiles");xt();ke();A();async function Ls(t){let e=await D(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(Ls,"skillNamesFromNativeSkillDir");A();xe();async function Nx(t,e){let r=join(t,...e.split("/"));if(e.startsWith(uo)){let n=await D(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 D(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 D(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 Ls(r);return n.length?{skills:n}:{}}if(e.startsWith(".github/agents")){let n=await D(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(Nx,"inferCopilotPickFromPath");async function de(t,e){let r=await D(t),n=e.toLowerCase();return [...new Set(r.filter(o=>o.toLowerCase().endsWith(n)).map(o=>basename(o,e)))].sort()}s(de,"mdNames");async function vx(t,e,r){let n=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),o=join(t,...n.split("/"));if(r==="gemini-cli"){if(n===me||n.startsWith(`${me}/`)){let i=await Dx(t,n);return i.length?{commands:i}:{}}return {}}if(r==="claude-code"){if(n.startsWith(".claude/commands")){let i=await de(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".claude/rules")){let i=await de(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".claude/agents")){let i=await de(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 de(o,".mdc");return i.length?{rules:i}:{}}if(n.startsWith(".cursor/commands")){let i=await de(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".cursor/agents")){let i=await de(o,".md");return i.length?{agents:i}:{}}if(n.startsWith(".cursor/skills")){let i=await Ls(o);return i.length?{skills:i}:{}}return {}}if(r==="copilot")return Nx(t,n);if(r==="windsurf"&&n.startsWith(".windsurf/rules")){let i=await de(o,".md");return i.length?{rules:i}:{}}if(r==="cline"){if(n.startsWith(Ft)){let i=await Ls(o);return i.length?{skills:i}:{}}if(n.startsWith(Sr)){let i=await de(o,".md");return i.length?{commands:i}:{}}return {}}if(r==="continue"){if(n.startsWith(".continue/rules")){let i=await de(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".continue/prompts")){let i=await de(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".continue/skills")){let i=await Ls(o);return i.length?{skills:i}:{}}return {}}if(r==="junie"){if(n.startsWith(".junie/commands")){let i=await de(o,".md");return i.length?{commands:i}:{}}if(n.startsWith(".junie/rules")){let i=await de(o,".md");return i.length?{rules:i}:{}}if(n.startsWith(".junie/agents")){let i=await de(o,".md");return i.length?{agents:i}:{}}if(n.startsWith(".junie/skills")){let i=await Ls(o);return i.length?{skills:i}:{}}return {}}if(r==="codex-cli"&&n.startsWith(".codex")){let i=await D(o),a=[...new Set(i.filter(l=>l.toLowerCase().endsWith(".md")).map(l=>basename(l,".md")))].sort();return a.length?{rules:a}:{}}return {}}s(vx,"inferImplicitPickFromNativePath");function Mx(t){return (t.commands?.length??0)+(t.rules?.length??0)+(t.skills?.length??0)+(t.agents?.length??0)===0}s(Mx,"isImplicitPickEmpty");Xf();function Rl(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}s(Rl,"normalizePath");function RU(t,e){let r=Rl(t),n=Rl(e);return r===n||r.startsWith(`${n}/`)||n.startsWith(`${r}/`)}s(RU,"overlapsPath");function op(t,e){let r=t??[];return r.includes(e)||r.push(e),r}s(op,"addUnique");async function OU(t){let e=await mkdtemp(join(tmpdir(),"am-install-native-")),r=join(e,"repo"),n=s(async()=>{await rm$1(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(OU,"makeStageRoot");function kU(t,e){let r;for(let o of t){if(o.feature==="rules"&&o.toPath.startsWith(".agentsmesh/rules/")){r={...r,rules:op(r?.rules,basename(o.toPath,".md"))};continue}if(o.feature==="commands"&&o.toPath.startsWith(".agentsmesh/commands/")){let i=Rl(relative(join(e,".agentsmesh","commands"),join(e,o.toPath)));r={...r,commands:op(r?.commands,i.replace(/\.md$/i,"").split("/").filter(Boolean).join(":"))};continue}if(o.feature==="agents"&&o.toPath.startsWith(".agentsmesh/agents/")){r={...r,agents:op(r?.agents,basename(o.toPath,".md"))};continue}if(o.feature==="skills"&&o.toPath.startsWith(".agentsmesh/skills/")){let a=Rl(relative(join(e,".agentsmesh","skills"),join(e,o.toPath))).split("/")[0];a&&(r={...r,skills:op(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(kU,"buildPickFromResults");function EU(t,e,r,n){let o=join(e,...Rl(t).split("/")),i=r.filter(a=>RU(o,a.fromPath));if(i.length===0)throw new Error(`No installable native resources found under "${t}" for target "${n}".`);return {features:[...new Set(i.map(a=>a.feature))],pick:kU(i,e)}}s(EU,"scopeImportedResults");async function Zg(t,e){let{stageRoot:r,cleanup:n}=await OU(t);try{let o=await il(r,e);return {stageRoot:r,results:o,cleanup:n}}catch(o){throw await n(),o}}s(Zg,"stageImportedNativeRepo");async function qg(t,e,r){let n=await Zg(t,r);try{return {stageRoot:n.stageRoot,cleanup:n.cleanup,...EU(e,n.stageRoot,n.results,r)}}catch(o){throw await n.cleanup(),o}}s(qg,"stageNativeInstallScope");async function Ux(t,e,r,n){let o=n.explicitTarget?.trim();o&&fe.parse(o);let i=r.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");bx(o,i);let a=join(t,".agentsmesh"),l=await F(a),c=i?np(i):void 0,m=!l&&!o?await Kl(t)??void 0:void 0;if(!o&&c&&m&&c!==m)throw new Error(`Install path suggests native layout "${c}" but auto-detect imported "${m}". Use --target ${c} for this path, or install from the repo root without a conflicting subtree path.`);let p=o??c??m,u=!!i&&!!p&&!i.startsWith(".agentsmesh");if(!l&&p){if(u){let E=await qg(t,i,p);return {discoveryRoot:E.stageRoot,implicitPick:E.pick,scopedFeatures:E.features,yamlTarget:p,importHappened:true,cleanup:E.cleanup}}let I=await Zg(t,p);return {discoveryRoot:i?join(I.stageRoot,i):I.stageRoot,yamlTarget:p,importHappened:true,cleanup:I.cleanup}}let f;l?i?p&&Yg(i,p)?f=t:f=e:f=t:f=e;let g,h,R;if(u&&p){let I=await qg(t,i,p);f=I.stageRoot,g=I.pick,h=I.features,R=I.cleanup;}else if(f===t&&i&&p&&Yg(i,p)&&(g=await vx(t,i,p),Mx(g)))throw new Error(`No installable native resources found under "${i}" for target "${p}".`);let S;return o?S=o:p&&(g&&Px(g)||(h?.length??0)>0)&&(S=p),{discoveryRoot:f,implicitPick:g,scopedFeatures:h,yamlTarget:S,importHappened:R!==void 0,cleanup:R}}s(Ux,"prepareInstallDiscovery");async function Kx(t,e,r,n){let o=await Ux(t,e,r,{explicitTarget:n}),{canonical:i,implicitPick:a}=await tp(o.discoveryRoot),l=a??o.implicitPick,c=Wi(i,{implicitPick:l,scopedFeatures:o.scopedFeatures}),m=Es(c);return {prep:o,discovered:i,implicitPick:l,narrowed:c,discoveredFeatures:m}}s(Kx,"resolveDiscoveredForInstall");async function Wx(t){return t.explicitAs?{implicitPick:void 0,...await xx(t.contentRoot,t.explicitAs,t.explicitTarget,t.replayPick)}:Kx(t.resolvedPath,t.contentRoot,t.pathInRepo,t.explicitTarget)}s(Wx,"resolveInstallDiscovery");function Hi(t){return t==="."||t===""?void 0:t}s(Hi,"trimDot");function wU(t,e){let r=basename(e).replace(/\.md$/i,"");return t==="agents"?{agents:[r]}:t==="commands"?{commands:[r]}:{rules:[r]}}s(wU,"markdownPick");async function Hx(t){if(!t.as)return {pathInRepo:Hi(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:Hi(dirname(e)),pick:wU(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:Hi(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 ep(o);return {pathInRepo:Hi(dirname(n)),pick:{skills:[a||basename(n)]}}}}catch{return {pathInRepo:Hi(e)}}}}return {pathInRepo:Hi(e)}}s(Hx,"resolveManualInstallPersistence");Oo();tt();async function Vr(t){return process.stdin.isTTY?new Promise(e=>{let r=zx.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(Vr,"confirm");function AU(t){return !!(t.skills.length||t.rules.length||t.commands.length||t.agents.length)}s(AU,"hasArrayResources");function Vx(t){return AU(t)||t.mcp!==null||t.permissions!==null||t.hooks!==null||t.ignore.length>0}s(Vx,"hasInstallableResources");async function Jx(t,e,r,n){let o=t.skills.map(l=>Rx(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 Vr(`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(Jx,"resolveSkillPool");async function Yx(t,e,r,n){let o=t.rules.map(l=>Ox(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 Vr(`Include invalid rule "${oe(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(Yx,"resolveRulePool");async function Xx(t,e,r,n){let o=t.commands.map(l=>kx(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 Vr(`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(Xx,"resolveCommandPool");async function Zx(t,e,r,n){let o=t.agents.map(l=>Ex(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 Vr(`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(Zx,"resolveAgentPool");async function qx(t,e){let r=e.skills.map(a=>a.name),n=e.rules.map(a=>oe(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 Vr(`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=oe(a);t.rules.some(c=>oe(c)===l)&&(await Vr(`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 Vr(`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 Vr(`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(qx,"resolveInstallConflicts");function Qx(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(Qx,"pickForSelectedResources");function xU(t,e){let r=t.split("/").filter(Boolean);return r.length>0&&r[r.length-1]===e}s(xU,"pathEndsWithName");function sp(t,e,r){return r!==1||e.length!==1?false:xU(t,e[0])}s(sp,"inferSingleNamePick");function tb(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||sp(e,o.skillNames,n.skills)),l=o.ruleSlugs.length>0&&(!!r?.rules?.length||o.ruleSlugs.length<n.rules||sp(e,o.ruleSlugs,n.rules)),c=o.commandNames.length>0&&(!!r?.commands?.length||o.commandNames.length<n.commands||sp(e,o.commandNames,n.commands)),m=o.agentNames.length>0&&(!!r?.agents?.length||o.agentNames.length<n.agents||sp(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(tb,"buildInstallPick");function eb(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(eb,"deriveInstallFeatures");function bU(t){return t.skillNames.length===0&&t.ruleSlugs.length===0&&t.commandNames.length===0&&t.agentNames.length===0}s(bU,"isEmptyInstallSelection");function rb(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(bU(e)&&!a)throw new Error("No resources selected to install.")}s(rb,"ensureInstallSelection");$n();function nb(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(nb,"assertExtendNameAvailable");function PU(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(PU,"mergePick");function ob(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 n=t[r],o=[...new Set([...n.features,...e.features])],i=PU(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}:a)}s(ob,"mergeExtendList");A();async function sb(t,e,r){let n=await y(t);if(n===null)throw new Error(`Missing config: ${t}`);let o=parse(n),i=ob(e.extends,r);o.extends=i;let a=stringify(o,{indent:2,lineWidth:0});await C(t,a.endsWith(`
|
|
293
294
|
`)?a:`${a}
|
|
294
|
-
`);}
|
|
295
|
-
${JSON.stringify(
|
|
296
|
-
`);return `sha256:${
|
|
297
|
-
`),t.permissions!==null&&await
|
|
295
|
+
`);}s(sb,"writeAgentsmeshWithNewExtend");tt();async function ib(t){let{configDir:e,config:r,entryArgs:n,dryRun:o}=t,i=FU(n);if(nb(r.extends,i),o){_.info(`[dry-run] Would add extend:
|
|
296
|
+
${JSON.stringify(i,null,2)}`);return}let a=join(e,"agentsmesh.yaml");await sb(a,r,i),_.success(`Wrote extends entry "${i.name}" to agentsmesh.yaml.`);}s(ib,"writeInstallAsExtend");function FU(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?fe.parse(t.yamlTarget):void 0}}s(FU,"toNewExtendEntry");A();A();var MU="pack.yaml";async function ip(t){let e=await D(t),r=[];for(let i of e.sort()){let a=relative(t,i).replace(/\\/g,"/");if(a===MU)continue;let l=await Mm(i);l!==null&&r.push(`${a}:${l}`);}let n=r.join(`
|
|
297
|
+
`);return `sha256:${ml(n)}`}s(ip,"hashPackContent");async function UU(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(UU,"writeRules");async function KU(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(KU,"writeCommands");async function WU(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(WU,"writeAgents");async function BU(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(BU,"writeSkills");async function HU(t,e){t.mcp!==null&&await C(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
|
|
298
|
+
`),t.permissions!==null&&await C(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await C(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await C(join(e,"ignore"),`${t.ignore.join(`
|
|
298
299
|
`)}
|
|
299
|
-
`);}
|
|
300
|
-
`),t.permissions!==null&&await
|
|
300
|
+
`);}s(HU,"writeSettings");function zU(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(zU,"validatePackName");async function lb(t,e,r,n){zU(e);let o=join(t,`${e}.tmp`),i=join(t,e);await F(o)&&await rm$1(o,{recursive:true,force:true}),await O(o),await UU(r,o),await KU(r,o),await WU(r,o),await BU(r,o),await HU(r,o);let a=await ip(o),l=Eo({...n,content_hash:a});return await C(join(o,"pack.yaml"),stringify(l)),await F(i)&&await rm$1(i,{recursive:true,force:true}),await mkdir(t,{recursive:true}),await rename(o,i),l}s(lb,"materializePack");vm();A();function nh(t,e){return [...new Set([...t,...e])]}s(nh,"union");function JU(t,e){if(t.path===void 0&&t.paths===void 0||e===void 0)return {path:void 0,paths:void 0};let n=nh(t.paths??(t.path?[t.path]:[]),[e]);return n.length===1?{path:n[0],paths:void 0}:{path:void 0,paths:n}}s(JU,"mergePathScope");function YU(t,e,r){let n={...t};for(let i of e)r&&r[i]!==void 0?n[i]=nh(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(YU,"mergePick");async function XU(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(XU,"mergeRules");async function ZU(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(ZU,"mergeCommands");async function qU(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(qU,"mergeAgents");async function QU(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(QU,"mergeSkills");async function t0(t,e){t.mcp!==null&&await C(join(e,"mcp.json"),`${JSON.stringify(t.mcp,null,2)}
|
|
301
|
+
`),t.permissions!==null&&await C(join(e,"permissions.yaml"),stringify(t.permissions)),t.hooks!==null&&await C(join(e,"hooks.yaml"),stringify(t.hooks)),t.ignore.length>0&&await C(join(e,"ignore"),`${t.ignore.join(`
|
|
301
302
|
`)}
|
|
302
|
-
`);}
|
|
303
|
-
`,o=parse(n)??{};if(o.plugins||(o.plugins=[]),o.plugins.some(a=>a.id===e.id))return;let
|
|
303
|
+
`);}s(t0,"mergeSettings");async function cb(t,e,r,n,o,i){await XU(r,t),await ZU(r,t),await qU(r,t),await QU(r,t),await t0(r,t);let a=nh(e.features,n),l=YU(e.pick,n,o),c=JU(e,i?.path),m=await ip(t),p=new Date().toISOString(),u=Eo({...e,source:i?.source??e.source,...i?.version!==void 0?{version:i.version}:e.version!==void 0?{version:e.version}:{},features:a,pick:l,...i?.target!==void 0?{target:i.target}:e.target!==void 0?{target:e.target}:{},...c,...i?.as!==void 0?{as:i.as}:e.as!==void 0?{as:e.as}:{},updated_at:p,content_hash:m});return await C(join(t,"pack.yaml"),stringify(u)),u}s(cb,"mergeIntoPack");kp();$n();tt();A();function r0(t){return t?{path:t,paths:void 0}:{path:void 0,paths:void 0}}s(r0,"pathScope");function n0(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(oe(a))),commands:t.commands.filter(a=>o.has(a.name)),agents:t.agents.filter(a=>i.has(a.name))}}s(n0,"applySelection");async function mb(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}=t,h=join(e,"packs"),R=n0(n,o),S=new Date().toISOString(),I=p!==void 0?fe.parse(p):void 0,E=await Lw(h,i,{target:I,as:f,features:c}),T=r,P=c,x=m,Y=u,K;if(E){let z=E.packDir,St=E.meta;if(g&&E.name!==r){let pr=join(h,r);if(await F(pr))throw new Error(`Auto-generated pack name "${r}" collides with an existing incompatible pack. Use --name to choose a different pack name.`);await rename(E.packDir,pr),z=pr,St={...E.meta,name:r};}let It=await cb(z,St,R,c,m,{source:i,...a!==void 0?{version:a}:{},...I!==void 0?{target:I}:{},...u?{path:u}:{},...f!==void 0?{as:f}:{}});T=It.name,P=It.features,x=It.pick,Y=It.path,K=It.paths,_.success(`Updated pack "${It.name}" in .agentsmesh/packs/.`);}else {if(await Nm(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 lb(h,r,R,{name:r,source:i,...a!==void 0&&{version:a},source_kind:l,installed_at:S,updated_at:S,features:c,...m!==void 0&&{pick:m},...I!==void 0&&{target:I},...r0(u),...f!==void 0&&{as:f}}),_.success(`Installed pack "${r}" to .agentsmesh/packs/.`);}await Ix(e,_x({name:T,source:i,version:a,sourceKind:l,features:P,pick:x,target:I,path:Y,paths:K,as:f})),l!=="local"&&await Vh(i);}s(mb,"installAsPack");function s0(t){return t.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}s(s0,"sanitize");function i0(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(i0,"gitUrlLastSegments");function pb(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=i0(t.gitRemoteUrl):n="extend";e.featureHint?n=`${n}-${e.featureHint}`:n=`${n}-pack`;let o=s0(n)||"extend";if(!r.has(o))return o;let i=2;for(;r.has(`${o}-${i}`);)i++;return `${o}-${i}`}s(pb,"suggestExtendName");function ub(t){let{config:e,parsed:r,entryFeatures:n,nameOverride:o}=t,i=new Set(e.extends.map(a=>a.name));return o||pb(r,{featureHint:n.length===1?n[0]:void 0},i)}s(ub,"selectInstallEntryName");function db(t,e,r){if(!r?.features&&!r?.pick)return {narrowed:t,discoveredFeatures:e};let n=Wi(t,{scopedFeatures:r.features,implicitPick:r.pick});return {narrowed:n,discoveredFeatures:Es(n)}}s(db,"applyReplayInstallScope");function fb(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(fb,"buildInstalledList");function gb(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=oe(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(gb,"buildSkippedList");async function hb(t){let{scope:e,force:r,dryRun:n,tty:o,useExtends:i,nameOverride:a,explicitAs:l,config:c,context:m,parsed:p,sourceForYaml:u,version:f,pathInRepo:g,persisted:h,replay:R,prep:S,implicitPick:I,narrowed:E,discoveredFeatures:T}=t,{narrowed:P,discoveredFeatures:x}=db(E,T,R);if(!Vx(P))throw new Error(I||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 Y=await Jx(P,r,n,o),K=await Yx(P,r,n,o),z=await Xx(P,r,n,o),St=await Zx(P,r,n,o),It={skills:Y.length,rules:K.length,commands:z.length,agents:St.length},{canonical:pr}=await De(c,m.configDir,{},m.canonicalDir),Pt=!r&&!n&&o?await qx(pr,{skills:Y,rules:K,commands:z,agents:St}):{skillNames:Y.map(Mn=>Mn.name),ruleSlugs:K.map(Mn=>oe(Mn)),commandNames:z.map(Mn=>Mn.name),agentNames:St.map(Mn=>Mn.name)};rb({selected:Pt,discoveredFeatures:x,preConflict:It});let ur=R?.features??eb(x,Pt);if(ur.length===0)throw new Error("No features left to install after selection.");let Rt=Qx(R?.pick,Pt)??h.pick??tb({pathInRepo:h.pathInRepo??g,implicitPick:I,preConflictCounts:It,selected:Pt}),st=ub({config:c,parsed:p,entryFeatures:ur,nameOverride:a}),Jr=fb(Pt,st),Fe=gb(Y,K,z,St,Pt);if(i){if(await ib({configDir:m.configDir,config:c,entryArgs:{name:st,source:u,version:f,features:ur,path:h.pathInRepo,pick:Rt,yamlTarget:S.yamlTarget},dryRun:n}),n)return {installed:Jr,skipped:Fe}}else {if(n)return _.info(`[dry-run] Would install pack "${st}" to ${e==="global"?"~/.agentsmesh/packs/.":".agentsmesh/packs/."}`),{installed:Jr,skipped:Fe};await mb({canonicalDir:m.canonicalDir,packName:st,narrowed:P,selected:Pt,sourceForYaml:u,version:f,sourceKind:p.kind,entryFeatures:ur,pick:Rt,yamlTarget:S.yamlTarget,pathInRepo:h.pathInRepo,manualAs:l,renameExistingPack:a===""});}let vn=await ji(e==="global"?{global:true}:{},m.rootBase);return Ui(vn),vn.exitCode!==0&&_.warn(`Generate failed after install. Fix the issue and run agentsmesh generate${e==="global"?" --global":""}.`),{installed:Jr,skipped:Fe}}s(hb,"executeRunInstallPoolsAndWrite");async function sh(t,e,r,n){let{sync:o,dryRun:i,force:a,useExtends:l,explicitPath:c,explicitTarget:m,explicitAs:p,nameOverride:u}=Sx(t),f=t.global===true?"global":"project",g=e[0]?.trim();if(o){let{context:Pt}=await ct(r,f),ur=[],Rt=[];if(await Cx({sync:o,canonicalDir:Pt.canonicalDir,reinstall:s(async st=>{let Jr=st.paths&&st.paths.length>0?st.paths:[st.path];for(let Fe of Jr){let vn=await sh({...a?{force:true}:{},...i?{"dry-run":true}:{},...f==="global"?{global:true}:{},name:st.name,...st.target?{target:st.target}:{},...Fe?{path:Fe}:{},...st.as?{as:st.as}:{}},[st.source],r,{features:st.features,pick:st.pick});ur.push(...vn.data.installed),Rt.push(...vn.data.skipped);}},"reinstall")}))return {exitCode:0,data:{source:"",mode:"sync",installed:ur,skipped:Rt,dryRun:i}}}if(!g)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:R,context:S}=await ct(r,f),I=await zg(g,S.configDir,c);if(I.kind!=="local"&&!await mx())throw new Error("git is required for remote installs. Please install git and try again.");let{resolvedPath:E,sourceForYaml:T,version:P}=await dx(I,g),x=I.pathInRepo.replace(/^\/+|\/+$/g,"");if(x){let Pt=normalize(x).replace(/\\/g,"/");if(Pt===".."||Pt.startsWith("../"))throw new Error(`Install --path "${I.pathInRepo}" escapes the source root. Path must stay within the source.`)}let Y=x?join(E,x):E;if(!await F(Y))throw new Error(`Install path does not exist: ${Y}`);let K=await Hx({as:p,contentRoot:Y,pathInRepo:x}),{prep:z,implicitPick:St,narrowed:It,discoveredFeatures:pr}=await Wx({resolvedPath:E,contentRoot:Y,pathInRepo:x,explicitTarget:m,explicitAs:p,replayPick:n?.pick});try{let Pt=await hb({scope:f,force:a,dryRun:i,tty:h,useExtends:l,nameOverride:u,explicitAs:p,config:R,context:S,parsed:I,sourceForYaml:T,version:P,pathInRepo:x,persisted:K,replay:n,prep:z,implicitPick:St,narrowed:It,discoveredFeatures:pr});return {exitCode:0,data:{source:g,mode:"install",installed:Pt.installed,skipped:Pt.skipped,dryRun:i}}}finally{z.cleanup&&await z.cleanup();}}s(sh,"runInstall");async function yb(t,e,r){return sh(t,e,r)}s(yb,"runInstall");tt();function Ib(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(", ");_.success(`Installed ${n}.`);}if(e.skipped.length>0)for(let r of e.skipped)_.warn(`Skipped ${r.kind} "${r.name}": ${r.reason}`);}}s(Ib,"renderInstall");ug();A();var lh="agentsmesh.yaml";async function ch(t){let e=join(t,lh),r=await y(e);return r===null?{}:parse(r)??{}}s(ch,"readScopedConfigRaw");async function Cb(t,e){let r=join(t,lh),n=await y(r)??`version: 1
|
|
304
|
+
`,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 C(r,stringify(o));}s(Cb,"writePluginEntry");async function Sb(t,e){let r=join(t,lh),n=await y(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 C(r,stringify(o)),a}s(Sb,"removePluginEntry");async function Rb(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 c0(t,e.slice(1),r);case "list":return m0(r);case "remove":return p0(e.slice(1),r);case "info":return u0(e.slice(1),r);default:return {exitCode:2,data:{subcommand:"list",plugins:[]},showHelp:true,error:`Unknown plugin subcommand: ${n}`}}}s(Rb,"runPlugin");async function c0(t,e,r){let n=e[0];if(!n)throw new dr("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)??d0(n);return await Cb(r,{id:a,source:n,version:o==="latest"?void 0:o}),{exitCode:0,data:{subcommand:"add",id:a,package:n,version:o}}}s(c0,"runPluginAdd");async function m0(t){let r=(await ch(t)).plugins??[],n=[];for(let o of r){let i="\u2717",a="";try{let l=await Vm(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(m0,"runPluginList");async function p0(t,e){let r=t[0];if(!r)throw new dr("Usage: agentsmesh plugin remove <id>");let n=await Sb(e,r);return {exitCode:0,data:{subcommand:"remove",id:r,found:n}}}s(p0,"runPluginRemove");async function u0(t,e){let r=t[0];if(!r)throw new dr("Usage: agentsmesh plugin info <id>");let o=((await ch(e)).plugins??[]).find(l=>l.id===r);if(!o)return {exitCode:1,data:{subcommand:"info",id:r,package:"",descriptors:[]}};let i;try{i=await Vm(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(u0,"runPluginInfo");function d0(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(d0,"derivePluginId");tt();function Ob(t){if(t.error&&_.error(t.error),t.showHelp){I0();return}let{data:e}=t;switch(e.subcommand){case "add":f0(e.id,e.package,e.version);break;case "list":g0(e.plugins);break;case "remove":h0(e.id,e.found);break;case "info":y0(e,t.exitCode);break}}s(Ob,"renderPlugin");function f0(t,e,r){_.success(`Plugin '${t}' added to agentsmesh.yaml`),_.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";_.info(`Next: npm install ${e}${n}`),_.info(`Then add '${t}' to pluginTargets in agentsmesh.yaml to enable it.`);}s(f0,"renderAdd");function g0(t){if(t.length===0){_.info("No plugins configured. Use: agentsmesh plugin add <source>");return}_.info("Configured plugins:");for(let e of t){let r=e.version!==void 0?`@${e.version}`:"",n=e.status??"",o=e.targets??"";_.info(` ${e.id} | ${e.package}${r} | ${n} | ${o}`);}}s(g0,"renderList");function h0(t,e){e?_.success(`Plugin '${t}' removed from agentsmesh.yaml`):_.warn(`Plugin '${t}' was not found in agentsmesh.yaml`);}s(h0,"renderRemove");function y0(t,e){if(e!==0&&t.package===""){_.error(`Plugin '${t.id}' not found in agentsmesh.yaml. Use: agentsmesh plugin add`);return}if(e!==0){_.error(`Failed to load plugin '${t.id}'`);return}_.info(`Plugin: ${t.id}`),_.info(`Source: ${t.package}${t.version!==void 0?`@${t.version}`:""}`),_.info(`Descriptors: ${t.descriptors.length}`);for(let r of t.descriptors)_.info(` - ${r.id}: ${r.description}`);}s(y0,"renderInfo");function I0(){_.info("Usage: agentsmesh plugin <subcommand> [args] [flags]"),_.info(""),_.info("Subcommands:"),_.info(" add <source> Register a plugin package in agentsmesh.yaml"),_.info(" list Show all configured plugins and load status"),_.info(" remove <id> Remove a plugin from agentsmesh.yaml"),_.info(" info <id> Show descriptor details for a configured plugin"),_.info(""),_.info("Flags (add):"),_.info(" --version <v> Pin plugin version"),_.info(" --id <id> Override derived plugin id"),_.info(""),_.info("Note: plugins load as trusted Node.js modules and run with full process privileges."),_.info(" Only install plugins from sources you trust.");}s(I0,"printPluginHelp");A();Xr();function Vi(t){return t.toUpperCase().replace(/-/g,"_")}s(Vi,"toPrefix");function zi(t){return t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}s(zi,"toPascal");function kb(t){let e=Vi(t.id);return `export const ${e}_TARGET = '${t.id}';
|
|
304
305
|
|
|
305
306
|
// Project-level paths
|
|
306
307
|
export const ${e}_DIR = '.${t.id}';
|
|
@@ -313,7 +314,7 @@ export const ${e}_GLOBAL_RULES_DIR = '~/.${t.id}/rules';
|
|
|
313
314
|
// Canonical paths
|
|
314
315
|
export const ${e}_CANONICAL_ROOT_RULE = '.agentsmesh/rules/_root.md';
|
|
315
316
|
export const ${e}_CANONICAL_RULES_DIR = '.agentsmesh/rules';
|
|
316
|
-
`}
|
|
317
|
+
`}s(kb,"TEMPLATE_CONSTANTS");function Eb(t){let e=Vi(t.id),r=zi(t.id);return `import type { TargetGenerators } from '../catalog/target.interface.js';
|
|
317
318
|
import type { TargetDescriptor, TargetLayout } from '../catalog/target-descriptor.js';
|
|
318
319
|
import { generateRules } from './generator.js';
|
|
319
320
|
import { importFrom${r} } from './importer.js';
|
|
@@ -410,21 +411,21 @@ export const descriptor = {
|
|
|
410
411
|
buildImportPaths: build${r}ImportPaths,
|
|
411
412
|
detectionPaths: [${e}_DIR],
|
|
412
413
|
} satisfies TargetDescriptor;
|
|
413
|
-
`}
|
|
414
|
+
`}s(Eb,"TEMPLATE_INDEX");function Lb(t){let e=Vi(t.id);return `import type { CanonicalFiles } from '../../core/types.js';
|
|
414
415
|
import { ${e}_TARGET, ${e}_DIR } from './constants.js';
|
|
415
416
|
|
|
416
|
-
export interface ${
|
|
417
|
+
export interface ${zi(t.id)}Output {
|
|
417
418
|
path: string;
|
|
418
419
|
content: string;
|
|
419
420
|
}
|
|
420
421
|
|
|
421
|
-
export function generateRules(_canonical: CanonicalFiles): ${
|
|
422
|
+
export function generateRules(_canonical: CanonicalFiles): ${zi(t.id)}Output[] {
|
|
422
423
|
// TODO(agentsmesh-scaffold): implement generateRules for ${t.displayName}
|
|
423
424
|
void ${e}_TARGET;
|
|
424
425
|
void ${e}_DIR;
|
|
425
426
|
return [];
|
|
426
427
|
}
|
|
427
|
-
`}
|
|
428
|
+
`}s(Lb,"TEMPLATE_GENERATOR");function wb(t){let e=zi(t.id),r=Vi(t.id);return `import type { ImportResult } from '../../core/types.js';
|
|
428
429
|
import type { TargetLayoutScope } from '../catalog/target-descriptor.js';
|
|
429
430
|
import { ${r}_TARGET } from './constants.js';
|
|
430
431
|
|
|
@@ -436,7 +437,7 @@ export async function importFrom${e}(
|
|
|
436
437
|
void ${r}_TARGET;
|
|
437
438
|
return [];
|
|
438
439
|
}
|
|
439
|
-
`}
|
|
440
|
+
`}s(wb,"TEMPLATE_IMPORTER");function Ab(t){let e=Vi(t.id);return `/** Lint rules for the ${t.id} target. */
|
|
440
441
|
import type { CanonicalFiles, LintDiagnostic } from '../../core/types.js';
|
|
441
442
|
import { validateRules } from '../../core/lint/validate-rules.js';
|
|
442
443
|
import { ${e}_TARGET } from './constants.js';
|
|
@@ -454,7 +455,7 @@ export function lintRules(
|
|
|
454
455
|
target: ${e}_TARGET,
|
|
455
456
|
}));
|
|
456
457
|
}
|
|
457
|
-
`}
|
|
458
|
+
`}s(Ab,"TEMPLATE_LINTER");function xb(t){return `/**
|
|
458
459
|
* ${t.displayName}-specific lint hooks.
|
|
459
460
|
*/
|
|
460
461
|
|
|
@@ -464,7 +465,7 @@ export function lintHooks(_canonical: CanonicalFiles): LintDiagnostic[] {
|
|
|
464
465
|
// TODO(agentsmesh-scaffold): implement target-specific hook validation for ${t.displayName}
|
|
465
466
|
return [];
|
|
466
467
|
}
|
|
467
|
-
`}
|
|
468
|
+
`}s(xb,"TEMPLATE_LINT_HOOKS");function bb(t){let e=zi(t.id),r=Vi(t.id);return `import type { TargetLayoutScope } from '../../../targets/catalog/target-descriptor.js';
|
|
468
469
|
import { ${r}_DIR } from '../../../targets/${t.id}/constants.js';
|
|
469
470
|
|
|
470
471
|
export async function build${e}ImportPaths(
|
|
@@ -476,7 +477,7 @@ export async function build${e}ImportPaths(
|
|
|
476
477
|
// Reference: src/core/reference/import-maps/kiro.ts for a full example
|
|
477
478
|
void ${r}_DIR;
|
|
478
479
|
}
|
|
479
|
-
`}
|
|
480
|
+
`}s(bb,"TEMPLATE_IMPORT_MAP");function Pb(t){return `import { describe, it, expect } from 'vitest';
|
|
480
481
|
import type { CanonicalFiles } from '../../../../src/core/types.js';
|
|
481
482
|
import { generateRules } from '../../../../src/targets/${t.id}/generator.js';
|
|
482
483
|
|
|
@@ -505,7 +506,7 @@ describe('generateRules (${t.id})', () => {
|
|
|
505
506
|
expect(result).toHaveLength(0);
|
|
506
507
|
});
|
|
507
508
|
});
|
|
508
|
-
`}
|
|
509
|
+
`}s(Pb,"TEMPLATE_GENERATOR_TEST");function Tb(t){let e=zi(t.id);return `import { describe, it, expect } from 'vitest';
|
|
509
510
|
import { importFrom${e} } from '../../../../src/targets/${t.id}/importer.js';
|
|
510
511
|
|
|
511
512
|
describe('importFrom${e} (${t.id})', () => {
|
|
@@ -519,7 +520,7 @@ describe('importFrom${e} (${t.id})', () => {
|
|
|
519
520
|
expect(result).toHaveLength(0);
|
|
520
521
|
});
|
|
521
522
|
});
|
|
522
|
-
`}
|
|
523
|
+
`}s(Tb,"TEMPLATE_IMPORTER_TEST");function Db(t){return `# ${t.displayName} Workspace
|
|
523
524
|
|
|
524
525
|
Follow the ${t.displayName} configuration files and keep changes small.
|
|
525
|
-
`}
|
|
526
|
+
`}s(Db,"TEMPLATE_FIXTURE_ROOT_MD");var C0=/^[a-z][a-z0-9-]*$/;async function Nb(t){let{id:e,projectRoot:r,force:n=false}=t,o=t.displayName??e,i={id:e,displayName:o};if(!C0.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:kb(i)},{rel:`src/targets/${e}/index.ts`,content:Eb(i)},{rel:`src/targets/${e}/generator.ts`,content:Lb(i)},{rel:`src/targets/${e}/importer.ts`,content:wb(i)},{rel:`src/targets/${e}/linter.ts`,content:Ab(i)},{rel:`src/targets/${e}/lint.ts`,content:xb(i)},{rel:`src/core/reference/import-maps/${e}.ts`,content:bb(i)},{rel:`tests/unit/targets/${e}/generator.test.ts`,content:Pb(i)},{rel:`tests/unit/targets/${e}/importer.test.ts`,content:Tb(i)},{rel:`tests/e2e/fixtures/${e}-project/AGENTS.md`,content:Db(i)}],l=[],c=[];for(let p of a){let u=join(r,p.rel);if(!n&&await F(u)){c.push(u);continue}await C(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(Nb,"writeTargetScaffold");async function vb(t,e,r){let n=e[0];return n===void 0||n===""?{exitCode:0,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true}:n==="scaffold"?S0(t,e.slice(1),r):{exitCode:2,data:{id:"",written:[],skipped:[],postSteps:[]},showHelp:true,error:`Unknown target subcommand: ${n}`}}s(vb,"runTarget");async function S0(t,e,r){let n=e[0];if(!n)throw new dr("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 Nb({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=>Fb(l,r)),skipped:a.skipped.map(l=>Fb(l,r)),postSteps:a.postSteps}}}s(S0,"runScaffold");function Fb(t,e){return (t.startsWith(e)?t.slice(e.length+1):t).replaceAll("\\","/")}s(Fb,"relativize");tt();function Mb(t){if(t.error&&_.error(t.error),t.showHelp){R0();return}let{data:e}=t;for(let r of e.written)_.success(`created ${r}`);for(let r of e.skipped)_.warn(`skipped ${r} (already exists \u2014 use --force to overwrite)`);if(e.written.length>0){_.info(""),_.info("Next steps:");for(let r of e.postSteps)_.info(` ${r}`);}}s(Mb,"renderTarget");function R0(){_.info("Usage: agentsmesh target <subcommand> [args] [flags]"),_.info(""),_.info("Subcommands:"),_.info(" scaffold <id> Generate a new target skeleton (files, tests, fixture)"),_.info(""),_.info("Flags (scaffold):"),_.info(" --name <displayName> Human-readable name (defaults to id)"),_.info(" --force Overwrite existing files");}s(R0,"printTargetHelp");lr();oa();A();ge();ko();$n();function b0(t,e){return t===".agentsmesh"?false:!!(t.startsWith(".")||!e)}s(b0,"shouldSymlink");function P0(t){let e=mkdtempSync(join(tmpdir(),"am-convert-")),r=readdirSync(t,{withFileTypes:true});for(let n of r){if(!b0(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(P0,"createTempProjectRoot");async function Gb(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=ve(l),p=ve(c);if(!m||!p)try{let{config:S}=await ct(r,"project");await re(S,r);}catch{let S=[];throw m||S.push(`--from "${i}"`),p||S.push(`--to "${a}"`),new Error(`Unknown ${S.join(" and ")}. Supported: ${ft.join(", ")}.`)}let u=rt(l);if(!u)throw new Error(`Unknown --from "${i}". Supported: ${ft.join(", ")}.`);if(!rt(c))throw new Error(`Unknown --to "${a}". Supported: ${ft.join(", ")}.`);let g=t["dry-run"]===true,h=g?"dry-run":"convert",R=P0(o);try{await u.generators.importFrom(R,{scope:n});let S=await Qr(R),I=Qi.parse({version:1,targets:p?[c]:[],pluginTargets:p?[]:[c]}),E=await $i({config:I,canonical:S,projectRoot:o,scope:n,targetFilter:[c]});if(!g){for(let x of E)if(x.status==="created"||x.status==="updated"){let Y=Jm(o,x.path,x.target);await C(Y,x.content);}}let T=E.filter(x=>x.status!=="skipped"),P=T.map(x=>({path:x.path,target:x.target,status:x.status}));return {exitCode:0,data:{from:l,to:c,mode:h,files:P,summary:{created:T.filter(x=>x.status==="created").length,updated:T.filter(x=>x.status==="updated").length,unchanged:T.filter(x=>x.status==="unchanged").length}}}}finally{rmSync(R,{recursive:true,force:true});}}s(Gb,"runConvert");tt();function $b(t){let{data:e}=t;if(e.files.length===0){_.info(`No files found to convert from ${e.from}.`);return}if(e.mode==="dry-run"){for(let i of e.files)_.info(`[dry-run] ${i.status} ${i.path} (${i.target})`);return}for(let i of e.files)(i.status==="created"||i.status==="updated")&&_.success(`${i.status} ${i.path}`);let{created:r,updated:n,unchanged:o}=e.summary;r>0||n>0?_.info(`Converted from ${e.from} \u2192 ${e.to}: ${r} created, ${n} updated, ${o} unchanged`):_.info(`Nothing changed. (${o} unchanged)`);}s($b,"renderConvert");var jb={generate:s(async(t,e)=>{let r=await ji(t,void 0,{printMatrix:t.json!==true});se("generate",r,t,()=>Ui(r));},"generate"),init:s(async(t,e)=>{let r=await GA(process.cwd(),{yes:t.yes===true,global:t.global===true});se("init",r,t,()=>$A(r));},"init"),import:s(async(t,e)=>{let r=await UA(t);se("import",r,t,()=>tx(r));},"import"),diff:s(async(t,e)=>{let r=await HA(t);se("diff",r,t,()=>ex(r));},"diff"),lint:s(async(t,e)=>{let r=await ZA(t);se("lint",r,t,()=>qA(r));},"lint"),check:s(async(t,e)=>{let r=await ix(t);se("check",r,t,()=>QA(r));},"check"),merge:s(async(t,e)=>{let r=await cx(t);se("merge",r,t,()=>rx(r));},"merge"),matrix:s(async(t,e)=>{let r=await fl(t);se("matrix",r,t,()=>hl(r,{verbose:t.verbose===true}));},"matrix"),watch:s(async(t,e)=>{if(t.json===true){xs("watch",{success:false,error:"--json is not supported with watch"}),process.exit(1);return}let r=await ox(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 yb(t,e,process.cwd());se("install",r,t,()=>Ib(r));},"install"),plugin:s(async(t,e)=>{let r=await Rb(t,e,process.cwd());se("plugin",r,t,()=>Ob(r));},"plugin"),target:s(async(t,e)=>{let r=await vb(t,e,process.cwd());se("target",r,t,()=>Mb(r));},"target"),convert:s(async(t,e)=>{let r=await Gb(t);se("convert",r,t,()=>$b(r));},"convert")};function N0(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(N0,"parseArgs");var F0=uh(jb);async function v0(t){let{command:e,flags:r,args:n}=t;if(e==="help"){yh();return}if(e==="version"){Ch();return}r.json===true&&dh(),await F0.route(e,r,n);}s(v0,"main");function M0(){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(M0,"isMainModule");if(M0()){let t=N0(process.argv.slice(2));v0(t).catch(e=>Sh(e instanceof Error?e:new Error(String(e)),{verbose:t.flags.verbose===true,json:t.flags.json===true,command:t.command}));}export{N0 as parseArgs};
|