MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / Yk

Function Yk

package/cli.js:4725–4725  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

4723
4724Validation errors: ${A}`)}catch(z){if(z instanceof Error&&z.message.includes("invalid manifest file"))throw z;let Y=d6(z);throw N(`Plugin ${K} has a corrupt manifest file at ${q}. Parse error: ${Y}`,{level:"error"}),Error(`Plugin ${K} has a corrupt manifest file at ${q}.
4725
4726JSON parse error: ${Y}`)}}async function J0K(q,K){if(!await u5(q))throw Error(`Hooks file not found at ${q} for plugin ${K}. If the manifest declares hooks, the file must exist.`);let _=await d18(q,{encoding:"utf-8"}),z=r8(_);return ZA8().parse(z).hooks}async function z56(q,K,_,z,Y,$,A,O){let w=await Promise.all(q.map(async(H)=>{let J=__(K,H);return{relPath:H,fullPath:J,exists:await u5(J)}})),j=[];for(let{relPath:H,fullPath:J,exists:M}of w)if(M)j.push(J);else N(`${$} path ${H} ${A} not found at ${J} for ${_}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${J} for ${_}`)),O.push({type:"path-not-found",source:z,plugin:_,path:J,component:Y});return j}async function G0K(q,K,_,z,Y=!0){let $=[],A=__(q,".claude-plugin","plugin.json"),O=await EB8(A,z,K),w={name:O.name,manifest:O,path:q,source:K,repository:K,enabled:_},[j,H,J,M]=await Promise.all([!O.commands?u5(__(q,"commands")):!1,!O.agents?u5(__(q,"agents")):!1,!O.skills?u5(__(q,"skills")):!1,!O.outputStyles?u5(__(q,"output-styles")):!1]),X=__(q,"commands");if(j)w.commandsPath=X;if(O.commands){let v=Object.values(O.commands)[0];if(typeof O.commands==="object"&&!Array.isArray(O.commands)&&v&&typeof v==="object"&&(("source"in v)||("content"in v))){let V={},E=[],S=Object.entries(O.commands),R=await Promise.all(S.map(async([x,I])=>{if(!I||typeof I!=="object")return{commandName:x,metadata:I,kind:"skip"};if(I.source){let B=__(q,I.source);return{commandName:x,metadata:I,kind:"source",fullPath:B,exists:await u5(B)}}if(I.content)return{commandName:x,metadata:I,kind:"content"};return{commandName:x,metadata:I,kind:"skip"}}));for(let x of R){if(x.kind==="skip")continue;if(x.kind==="content"){V[x.commandName]=x.metadata;continue}if(x.exists)E.push(x.fullPath),V[x.commandName]=x.metadata;else N(`Command ${x.commandName} path ${x.metadata.source} specified in manifest but not found at ${x.fullPath} for ${O.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${x.fullPath} for ${O.name}`)),$.push({type:"path-not-found",source:K,plugin:O.name,path:x.fullPath,component:"commands"})}if(E.length>0)w.commandsPaths=E;if(Object.keys(V).length>0)w.commandsMetadata=V}else{let V=Array.isArray(O.commands)?O.commands:[O.commands],E=await Promise.all(V.map(async(R)=>{if(typeof R!=="string")return{cmdPath:R,kind:"invalid"};let x=__(q,R);return{cmdPath:R,kind:"path",fullPath:x,exists:await u5(x)}})),S=[];for(let R of E){if(R.kind==="invalid"){N(`Unexpected command format in manifest for ${O.name}`,{level:"error"});continue}if(R.exists)S.push(R.fullPath);else N(`Command path ${R.cmdPath} specified in manifest but not found at ${R.fullPath} for ${O.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${R.fullPath} for ${O.name}`)),$.push({type:"path-not-found",source:K,plugin:O.name,path:R.fullPath,component:"commands"})}if(S.length>0)w.commandsPaths=S}}let P=__(q,"agents");if(H)w.agentsPath=P;if(O.agents){let v=Array.isArray(O.agents)?O.agents:[O.agents],V=await z56(v,q,O.name,K,"agents","Agent","specified in manifest but",$);if(V.length>0)w.agentsPaths=V}let W=__(q,"skills");if(J)w.skillsPath=W;if(O.skills){let v=Array.isArray(O.skills)?O.skills:[O.skills],V=await z56(v,q,O.name,K,"skills","Skill","specified in manifest but",$);if(V.length>0)w.skillsPaths=V}let D=__(q,"output-styles");if(M)w.outputStylesPath=D;if(O.outputStyles){let v=Array.isArray(O.outputStyles)?O.outputStyles:[O.outputStyles],V=await z56(v,q,O.name,K,"output-styles","Output style","specified in manifest but",$);if(V.length>0)w.outputStylesPaths=V}let f,G=new Set,Z=__(q,"hooks","hooks.json");if(await u5(Z))try{f=await J0K(Z,O.name);try{G.add(await NB8(Z))}catch{G.add(Z)}N(`Loaded hooks from standard location for plugin ${O.name}: ${Z}`)}catch(v){let V=d6(v);N(`Failed to load hooks for ${O.name}: ${V}`,{level:"error"}),H6(x1(v)),$.push({type:"hook-load-failed",source:K,plugin:O.name,hookPath:Z,reason:V})}if(O.hooks){let v=Array.isArray(O.hooks)?O.hooks:[O.hooks];for(let V of v)if(typeof V==="string"){let E=__(q,V);if(!await u5(E)){N(`Hooks file ${V} specified in manifest but not found at ${E} for ${O.name}`,{level:"error"}),H6(Error(`Plugin component file not found: ${E} for ${O.name}`)),$.push({type:"path-not-found",source:K,plugin:O.name,path:E,component:"hooks"});continue}let S;try{S=await NB8(E)}catch{S=E}if(G.has(S)){if(N(`Skipping duplicate hooks file for plugin ${O.name}: ${V} (resolves to already-loaded file: ${S})`),Y){let R=`Duplicate hooks file detected: ${V} resolves to already-loaded file ${S}. The standard hooks/hooks.json is loaded automatically, so manifest.hooks should only reference additional hook files.`;H6(Error(R)),$.push({type:"hook-load-failed",source:K,plugin:O.name,hookPath:E,reason:R})}continue}try{let R=await J0K(E,O.name);try{f=X0K(f,R),G.add(S),N(`Loaded and merged hooks from manifest for plugin ${O.name}: ${V}`)}catch(x){let I=d6(x);N(`Failed to merge hooks from ${V} for ${O.name}: ${I}`,{level:"error"}),H6(x1(x)),$.push({type:"hook-load-failed",source:K,plugin:O.name,hookPath:E,reason:`Failed to merge: ${I}`})}}catch(R){let x=d6(R);N(`Failed to load hooks from ${V} for ${O.name}: ${x}`,{level:"error"}),H6(x1(R)),$.push({type:"hook-load-failed",source:K,plugin:O.name,hookPath:E,reason:x})}}else if(typeof V==="object")f=X0K(f,V)}if(f)w.hooksConfig=f;let T=await ZYY(q,O);if(T)w.settings=T;return{plugin:w,errors:$}}function M0K(q){let K=fYY().safeParse(q);if(!K.success)return;let _=K.data;if(Object.keys(_).length===0)return;return _}async function ZYY(q,K){let _=__(q,"settings.json");try{let z=await d18(_,{encoding:"utf-8"}),Y=r8(z);if(yYY(Y)){let $=M0K(Y);if($)return N(`Loaded settings from settings.json for plugin ${K.name}`),$}}catch(z){if(!e3(z))N(`Failed to parse settings.json for plugin ${K.name}: ${z}`,{level:"warn"})}if(K.settings){let z=M0K(K.settings);if(z)return N(`Loaded settings from manifest for plugin ${K.name}`),z}return}function X0K(q,K){if(!q)return K;let _={...q};for(let[z,Y]of Object.entries(K))if(!_[z])_[z]=Y;else _[z]=[..._[z]||[],...Y];return _}async function T0K({cacheOnly:q}){let K=Z7(),_={...uA6(),...K.enabledPlugins||{}},z=[],Y=[],$=Object.entries(_).filter(([P,W])=>{if(!AD6().safeParse(P).success||W===void 0)return!1;let{marketplace:f}=Z4(P);return f!==Tn6}),A=await eK6(),O=aK6(),w=C17(),j=O!==null||w!==null&&w.length>0,H=new Set($.map(([P])=>Z4(P).marketplace).filter((P)=>!!P)),J=new Map;await Promise.all([...H].map(async(P)=>{J.set(P,await m18(P))}));let M=g18(),X=await Promise.allSettled($.map(async([P,W])=>{let{name:D,marketplace:f}=Z4(P),G=A[f];if(!G&&j)return Y.push({type:"marketplace-blocked-by-policy",source:P,plugin:D,marketplace:f,blockedByBlocklist:O===null,allowedSources:(O??[]).map((V)=>yH6(V))}),null;if(G&&!NH6(G.source)){let V=S18(G.source),E=aK6()||[];return Y.push({type:"marketplace-blocked-by-policy",source:P,plugin:D,marketplace:f,blockedByBlocklist:V,allowedSources:V?[]:E.map((S)=>yH6(S))}),null}let Z=null,T=J.get(f);if(T&&G){let V=T.plugins.find((E)=>E.name===D);if(V)Z={entry:V,marketplaceInstallLocation:G.installLocation}}else Z=await B17(P);if(!Z)return Y.push({type:"plugin-not-found",source:P,pluginId:D,marketplace:f}),null;let v=M.plugins[P]?.[0];return q?GYY(Z.entry,Z.marketplaceInstallLocation,P,W===!0,Y,v?.installPath):TYY(Z.entry,Z.marketplaceInstallLocation,P,W===!0,Y,v?.version)}));for(let[P,W]of X.entries())if(W.status==="fulfilled"&&W.value)z.push(W.value);else if(W.status==="rejected"){let D=x1(W.reason);H6(D);let f=$[P][0];Y.push({type:"generic-error",source:f,plugin:f.split("@")[0],error:D.message})}return{plugins:z,errors:Y}}async function GYY(q,K,_,z,Y,$){let A;if(typeof q.source==="string"){let O;try{O=(await W0K(K)).isDirectory()?K:__(K,"..")}catch{return Y.push({type:"plugin-cache-miss",source:_,plugin:q.name,installPath:K}),null}A=__(O,q.source)}else{if(!$||!await u5($))return Y.push({type:"plugin-cache-miss",source:_,plugin:q.name,installPath:$??"(not recorded)"}),null;A=$}if(Sb()&&A.endsWith(".zip")){let O=await E17(),w=__(O,_.replace(/[^a-zA-Z0-9@\-_]/g,"-"));try{await L17(A,w),A=w}catch(j){return N(`Failed to extract plugin ZIP ${A}: ${j}`,{level:"error"}),Y.push({type:"plugin-cache-miss",source:_,plugin:q.name,installPath:A}),null}}return v0K(q,_,z,Y,A)}async function TYY(q,K,_,z,Y,$){N(`Loading plugin ${q.name} from source: ${g6(q.source)}`);let A;if(typeof q.source==="string"){let O=(await W0K(K)).isDirectory()?K:__(K,".."),w=__(O,q.source);if(!await u5(w)){let j=Error(`Plugin path not found: ${w}`);return N(`Plugin path not found: ${w}`,{level:"error"}),H6(j),Y.push({type:"generic-error",source:_,error:`Plugin directory not found at path: ${w}. Check that the marketplace entry has the correct path.`}),null}try{let j=__(w,".claude-plugin","plugin.json"),H;try{H=await EB8(j,q.name,q.source)}catch{}let J=await Fa(_,q.source,H,O,q.version);A=await yB8(w,_,J,q,O),N(`Resolved local plugin ${q.name} to versioned cache: ${A}`)}catch(j){let H=d6(j);N(`Failed to copy plugin ${q.name} to versioned cache: ${H}. Using marketplace path.`,{level:"warn"}),A=w}}else try{let O=await Fa(_,q.source,void 0,void 0,$??q.version,"sha"in q.source?q.source.sha:void 0),w=Pp(_,O),j=Ph6(_,O);if(Sb()&&await u5(j))N(`Using versioned cached plugin ZIP ${q.name} from ${j}`),A=j;else if(await u5(w))N(`Using versioned cached plugin ${q.name} from ${w}`),A=w;else{let H=await D0K(_,O)??(O==="unknown"?await jYY(_):null);if(H)A=H,N(`Using seed cache for external plugin ${q.name} at ${H}`);else{let J=await Q18(q.source,{manifest:{name:q.name}}),M=O!=="unknown"?O:await Fa(_,q.source,J.manifest,J.path,$??q.version,J.gitCommitSha);if(A=await yB8(J.path,_,M,q,void 0),J.path!==A)await RH6(J.path,{recursive:!0,force:!0})}}}catch(O){let w=d6(O);return N(`Failed to cache plugin ${q.name}: ${w}`,{level:"error"}),H6(x1(O)),Y.push({type:"generic-error",source:_,error:`Failed to download/cache plugin ${q.name}: ${w}`}),null}if(Sb()&&A.endsWith(".zip")){let O=await E17(),w=__(O,_.replace(/[^a-zA-Z0-9@\-_]/g,"-"));try{await L17(A,w),N(`Extracted plugin ZIP to session dir: ${w}`),A=w}catch(j){throw N(`Failed to extract plugin ZIP ${A}, deleting corrupt file: ${j}`),await RH6(A,{force:!0}).catch(()=>{}),j}}return v0K(q,_,z,Y,A)}async function v0K(q,K,_,z,Y){let $=[],A=__(Y,".claude-plugin","plugin.json"),O=await u5(A),{plugin:w,errors:j}=await G0K(Y,K,_,q.name,q.strict??!0);if($.push(...j),typeof q.source==="object"&&"sha"in q.source&&q.source.sha)w.sha=q.source.sha;if(!O){if(w.manifest={...q,id:void 0,source:void 0,strict:void 0},w.name=w.manifest.name,q.commands){let H=Object.values(q.commands)[0];if(typeof q.commands==="object"&&!Array.isArray(q.commands)&&H&&typeof H==="object"&&(("source"in H)||("content"in H))){let J={},M=[],X=Object.entries(q.commands),P=await Promise.all(X.map(async([W,D])=>{if(!D||typeof D!=="object"||!D.source)return{commandName:W,metadata:D,skip:!0};let f=__(Y,D.source);return{commandName:W,metadata:D,skip:!1,fullPath:f,exists:await u5(f)}}));for(let W of P){if(W.skip)continue;if(W.exists)M.push(W.fullPath),J[W.commandName]=W.metadata;else N(`Command ${W.commandName} path ${W.metadata.source} from marketplace entry not found at ${W.fullPath} for ${q.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${W.fullPath} for ${q.name}`)),$.push({type:"path-not-found",source:K,plugin:q.name,path:W.fullPath,component:"commands"})}if(M.length>0)w.commandsPaths=M,w.commandsMetadata=J}else{let J=Array.isArray(q.commands)?q.commands:[q.commands],M=await Promise.all(J.map(async(P)=>{if(typeof P!=="string")return{cmdPath:P,kind:"invalid"};let W=__(Y,P);return{cmdPath:P,kind:"path",fullPath:W,exists:await u5(W)}})),X=[];for(let P of M){if(P.kind==="invalid"){N(`Unexpected command format in marketplace entry for ${q.name}`,{level:"error"});continue}if(P.exists)X.push(P.fullPath);else N(`Command path ${P.cmdPath} from marketplace entry not found at ${P.fullPath} for ${q.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${P.fullPath} for ${q.name}`)),$.push({type:"path-not-found",source:K,plugin:q.name,path:P.fullPath,component:"commands"})}if(X.length>0)w.commandsPaths=X}}if(q.agents){let H=Array.isArray(q.agents)?q.agents:[q.agents],J=await z56(H,Y,q.name,K,"agents","Agent","from marketplace entry",$);if(J.length>0)w.agentsPaths=J}if(q.skills){N(`Processing ${Array.isArray(q.skills)?q.skills.length:1} skill paths for plugin ${q.name}`);let H=Array.isArray(q.skills)?q.skills:[q.skills],J=await Promise.all(H.map(async(X)=>{let P=__(Y,X);return{skillPath:X,fullPath:P,exists:await u5(P)}})),M=[];for(let{skillPath:X,fullPath:P,exists:W}of J)if(N(`Checking skill path: ${X} -> ${P} (exists: ${W})`),W)M.push(P);else N(`Skill path ${X} from marketplace entry not found at ${P} for ${q.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${P} for ${q.name}`)),$.push({type:"path-not-found",source:K,plugin:q.name,path:P,component:"skills"});if(N(`Found ${M.length} valid skill paths for plugin ${q.name}, setting skillsPaths`),M.length>0)w.skillsPaths=M}else N(`Plugin ${q.name} has no entry.skills defined`);if(q.outputStyles){let H=Array.isArray(q.outputStyles)?q.outputStyles:[q.outputStyles],J=await z56(H,Y,q.name,K,"output-styles","Output style","from marketplace entry",$);if(J.length>0)w.outputStylesPaths=J}if(q.hooks)w.hooksConfig=q.hooks}else if(!q.strict&&O&&(q.commands||q.agents||q.skills||q.hooks||q.outputStyles)){let H=Error(`Plugin ${q.name} has both plugin.json and marketplace manifest entries for commands/agents/skills/hooks/outputStyles. This is a conflict.`);return N(`Plugin ${q.name} has both plugin.json and marketplace manifest entries for commands/agents/skills/hooks/outputStyles. This is a conflict.`,{level:"error"}),H6(H),z.push({type:"generic-error",source:K,error:`Plugin ${q.name} has conflicting manifests: both plugin.json and marketplace entry specify components. Set strict: true in marketplace entry or remove component specs from one location.`}),null}else if(O){if(q.commands){let H=Object.values(q.commands)[0];if(typeof q.commands==="object"&&!Array.isArray(q.commands)&&H&&typeof H==="object"&&(("source"in H)||("content"in H))){let J={...w.commandsMetadata||{}},M=[],X=Object.entries(q.commands),P=await Promise.all(X.map(async([W,D])=>{if(!D||typeof D!=="object"||!D.source)return{commandName:W,metadata:D,skip:!0};let f=__(Y,D.source);return{commandName:W,metadata:D,skip:!1,fullPath:f,exists:await u5(f)}}));for(let W of P){if(W.skip)continue;if(W.exists)M.push(W.fullPath),J[W.commandName]=W.metadata;else N(`Command ${W.commandName} path ${W.metadata.source} from marketplace entry not found at ${W.fullPath} for ${q.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${W.fullPath} for ${q.name}`)),$.push({type:"path-not-found",source:K,plugin:q.name,path:W.fullPath,component:"commands"})}if(M.length>0)w.commandsPaths=[...w.commandsPaths||[],...M],w.commandsMetadata=J}else{let J=Array.isArray(q.commands)?q.commands:[q.commands],M=await Promise.all(J.map(async(P)=>{if(typeof P!=="string")return{cmdPath:P,kind:"invalid"};let W=__(Y,P);return{cmdPath:P,kind:"path",fullPath:W,exists:await u5(W)}})),X=[];for(let P of M){if(P.kind==="invalid"){N(`Unexpected command format in marketplace entry for ${q.name}`,{level:"error"});continue}if(P.exists)X.push(P.fullPath);else N(`Command path ${P.cmdPath} from marketplace entry not found at ${P.fullPath} for ${q.name}`,{level:"warn"}),H6(Error(`Plugin component file not found: ${P.fullPath} for ${q.name}`)),$.push({type:"path-not-found",source:K,plugin:q.name,path:P.fullPath,component:"commands"})}if(X.length>0)w.commandsPaths=[...w.commandsPaths||[],...X]}}if(q.agents){let H=Array.isArray(q.agents)?q.agents:[q.agents],J=await z56(H,Y,q.name,K,"agents","Agent","from marketplace entry",$);if(J.length>0)w.agentsPaths=[...w.agentsPaths||[],...J]}if(q.skills){let H=Array.isArray(q.skills)?q.skills:[q.skills],J=await z56(H,Y,q.name,K,"skills","Skill","from marketplace entry",$);if(J.length>0)w.skillsPaths=[...w.skillsPaths||[],...J]}if(q.outputStyles){let H=Array.isArray(q.outputStyles)?q.outputStyles:[q.outputStyles],J=await z56(H,Y,q.name,K,"output-styles","Output style","from marketplace entry",$);if(J.length>0)w.outputStylesPaths=[...w.outputStylesPaths||[],...J]}if(q.hooks)w.hooksConfig={...w.hooksConfig||{},...q.hooks}}return z.push(...$),w}async function vYY(q){if(q.length===0)return{plugins:[],errors:[]};let K=[],_=[];for(let[z,Y]of q.entries())try{let $=wYY(Y);if(!await u5($)){N(`Plugin path does not exist: ${$}, skipping`,{level:"warn"}),_.push({type:"path-not-found",source:`inline[${z}]`,path:$,component:"commands"});continue}let A=OYY($),{plugin:O,errors:w}=await G0K($,`${A}@inline`,!0,A);O.source=`${O.name}@inline`,O.repository=`${O.name}@inline`,K.push(O),_.push(...w),N(`Loaded inline plugin from path: ${O.name}`)}catch($){let A=d6($);N(`Failed to load session plugin from ${Y}: ${A}`,{level:"warn"}),_.push({type:"generic-error",source:`inline[${z}]`,error:`Failed to load plugin: ${A}`})}if(K.length>0)N(`Loaded ${K.length} session-only plugins from --plugin-dir`);return{plugins:K,errors:_}}function kYY(q){let K=[],_=q.managedNames,z=q.session.filter((A)=>{if(_?.has(A.name))return N(`Plugin "${A.name}" from --plugin-dir is blocked by managed settings`,{level:"warn"}),K.push({type:"generic-error",source:A.source,plugin:A.name,error:`--plugin-dir copy of "${A.name}" ignored: plugin is locked by managed settings`}),!1;return!0}),Y=new Set(z.map((A)=>A.name)),$=q.marketplace.filter((A)=>{if(Y.has(A.name))return N(`Plugin "${A.name}" from --plugin-dir overrides installed version`),!1;return!0});return{plugins:[...z,...$,...q.builtin],errors:K}}async function k0K(q){let K=ep(),[_,z]=await Promise.all([q(),K.length>0?vYY(K):Promise.resolve({plugins:[],errors:[]})]),Y=Nh1(),{plugins:$,errors:A}=kYY({session:z.plugins,marketplace:_.plugins,builtin:[...Y.enabled,...Y.disabled],managedNames:wR()}),O=[..._.errors,...z.errors,...A],{demoted:w,errors:j}=fK4($);for(let J of $)if(w.has(J.source))J.enabled=!1;O.push(...j);let H=$.filter((J)=>J.enabled);return N(`Found ${$.length} plugins (${H.length} enabled, ${$.length-H.length} disabled)`),NYY(H),{enabled:H,disabled:$.filter((J)=>!J.enabled),errors:O}}function Yk(q){if(q)N(`clearPluginCache: invalidating loadAllPlugins cache (${q})`);if(LM.cache?.clear?.(),ZJ.cache?.clear?.(),i58()!==void 0)DW();Gj7()}function VYY(q){let K;for(let _ of q){if(!_.settings)continue;if(!K)K={};for(let[z,Y]of Object.entries(_.settings)){if(z in K)N(`Plugin "${_.name}" overrides setting "${z}" (previously set by another plugin)`);K[z]=Y}}return K}function NYY(q){let K=VYY(q);if(Zj7(K),K&&Object.keys(K).length>0)DW(),N(`Cached plugin settings with keys: ${Object.keys(K).join(", ")}`)}function yYY(q){return typeof q==="object"&&q!==null&&!Array.isArray(q)}var fYY,LM,ZJ;var bj=y(()=>{F4();v8();vn6();_8();m8();y8();XK();bK();e7();E5();E8();U1();Zc();vh();l8();UG8();QG8();kn6();dG8();pX();F18();qd();Nw();aV();hP();_56();kB8();BZ();Oh6();fYY=B6(()=>EW().pick({agent:!0}).strip());LM=_1(async()=>{let q=await k0K(()=>T0K({cacheOnly:!1}));return ZJ.cache?.set(void 0,Promise.resolve(q)),q}),ZJ=_1(async()=>{if(i6(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL))return LM();return k0K(()=>T0K({cacheOnly:!0}))})});import{basename as EYY}from"path";async function V0K(q,K,_){let z=[];return await Vk6(q,async(Y)=>{let $=await N0K(Y,K,_);if($)z.push($)},{logLabel:"output-styles"}),z}async function N0K(q,K,_){let z=X8();if(Cc(z,q,_))return null;try{let Y=await z.readFile(q,{encoding:"utf-8"}),{frontmatter:$,content:A}=kH(Y,q),O=EYY(q,".md"),w=$.name||O,j=`${K}:${w}`,H=Lu($.description,j)??z76(A,`Output style from ${K} plugin`),J=$["force-for-plugin"],M=J===!0||J==="true"?!0:J===!1||J==="false"?!1:void 0;return{name:j,description:H,prompt:A.trim(),source:"plugin",forceForPlugin:M}}catch(Y){return N(`Failed to load output style from ${q}: ${Y}`,{level:"error"}),null}}function S17(){K77.cache?.clear?.()}var K77;var WB8=y(()=>{F4();_8();rV();e7();ri();bj();wk8();K77=_1(async()=>{let{enabled:q,errors:K}=await ZJ(),_=[];if(K.length>0)N(`Plugin loading errors: ${K.map((z)=>$M(z)).join(", ")}`);for(let z of q){let Y=new Set;if(z.outputStylesPath)try{let $=await V0K(z.outputStylesPath,z.name,Y);if(_.push(...$),$.length>0)N(`Loaded ${$.length} output styles from plugin ${z.name} default directory`)}catch($){N(`Failed to load output styles from plugin ${z.name} default directory: ${$}`,{level:"error"})}if(z.outputStylesPaths)for(let $ of z.outputStylesPaths)try{let O=await X8().stat($);if(O.isDirectory()){let w=await V0K($,z.name,Y);if(_.push(...w),w.length>0)N(`Loaded ${w.length} output styles from plugin ${z.name} custom path: ${$}`)}else if(O.isFile()&&$.endsWith(".md")){let w=await N0K($,z.name,Y);if(w)_.push(w),N(`Loaded output style from plugin ${z.name} custom file: ${$}`)}}catch(A){N(`Failed to load output styles from plugin ${z.name} custom path ${$}: ${A}`,{level:"error"})}}return N(`Total plugin output styles loaded: ${_.length}`),_})});import{basename as LYY}from"path";var y0K;var E0K=y(()=>{F4();_8();rV();E8();ri();WB8();y0K=_1(async(q)=>{try{return(await ii("output-styles",q)).map(({filePath:z,frontmatter:Y,content:$,source:A})=>{try{let w=LYY(z).replace(/\.md$/,""),j=Y.name||w,H=Lu(Y.description,w)??z76($,`Custom ${w} output style`),J=Y["keep-coding-instructions"],M=J===!0||J==="true"?!0:J===!1||J==="false"?!1:void 0;if(Y["force-for-plugin"]!==void 0)N(`Output style "${j}" has force-for-plugin set, but this option only applies to plugin output styles. Ignoring.`,{level:"warn"});return{name:j,description:H,prompt:$.trim(),source:A,keepCodingInstructions:M}}catch(O){return H6(O),null}}).filter((z)=>z!==null)}catch(K){return H6(K),[]}})});function pfK(){Dh6.cache?.clear?.()}async function R0K(){let q=await Dh6(Z8()),K=Object.values(q).filter(($)=>$!==null&&$.source==="plugin"&&$.forceForPlugin===!0),_=K[0];if(_){if(K.length>1)N(`Multiple plugins have forced output styles: ${K.map(($)=>$.name).join(", ")}. Using: ${_.name}`,{level:"warn"});return N(`Using forced plugin output style: ${_.name}`),_}let Y=Z7()?.outputStyle||iv;return q[Y]??null}var L0K,iv="default",Hw6,Dh6;var TU=y(()=>{bq();F4();E0K();I7();_8();WB8();U1();L0K=`
4727## Insights
4728In order to encourage learning, before and after writing code, always provide brief educational explanations about implementation choices using (with backticks):

Callers 6

xQzFunction · 0.85
VzYFunction · 0.85
IsKFunction · 0.85
msKFunction · 0.85
F75Function · 0.85
fsYFunction · 0.85

Calls 5

NFunction · 0.85
i58Function · 0.85
DWFunction · 0.85
Gj7Function · 0.85
clearMethod · 0.45

Tested by

no test coverage detected