@truenine/memory-sync-cli 2026.10406.121 → 2026.10408.12323

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.
@@ -420,7 +420,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
420
420
  `))}let s=a?.globs??[],l=a?.scope??`project`,u=a?.seriName,d=n.replaceAll(`\\`,`/`),f=d.includes(`/`)?d.split(`/`)[0]??``:``,p=d.split(`/`).pop()??d,m={type:zN.Rule,content:e,length:e.length,filePathKind:VN.Relative,dir:{pathKind:VN.Relative,path:`${n}.mdx`,basePath:c,getDirectoryName:()=>p,getAbsolutePath:()=>o},prefix:f,ruleName:p,globs:s,scope:l,markdownContents:[]};return a!=null&&Object.assign(m,{yamlFrontMatter:a}),u!=null&&Object.assign(m,{seriName:u}),m}});for(let e of u)n.warn(hm({code:`RULE_PROMPT_READ_FAILED`,title:`Failed to read rule prompt`,operation:e.phase===`scan`?`scan`:`read`,targetKind:`rule prompt`,path:e.path,error:e.error,details:{phase:e.phase}}));if(u.length>0)throw Error(u.map(e=>e.error.message).join(`
421
421
  `));return{rules:l.map(e=>e.dist?.prompt).filter(e=>e!=null)}}},$L=class extends N_{constructor(){super(`AIAgentIgnoreInputCapability`)}collect(e){let{workspaceDir:t,aindexDir:n}=this.resolveBasePaths(e.userConfigOptions),r=[];for(let i of AL){let a=BL(n,i,{command:e.runtimeCommand,workspaceDir:t});if(!e.fs.existsSync(a)){this.log.debug({action:`collect`,message:`Ignore file not found`,path:a});continue}let o=e.fs.readFileSync(a,`utf8`);if(o.length===0){this.log.debug({action:`collect`,message:`Ignore file is empty`,path:a});continue}r.push({fileName:i,content:o,sourcePath:a}),this.log.debug({action:`collect`,message:`Loaded ignore file`,path:a,fileName:i})}return r.length===0?{}:{aiAgentIgnoreConfigFiles:r}}},eR=class extends N_{constructor(){super(`SubAgentInputCapability`)}createSubAgentPrompt(e,t,n,r,i,a,o,s){let{fs:c,logger:l,path:u}=a,{agentPrefix:d,agentName:f,canonicalName:p}=cF(n),m=u.join(i,`${n}.mdx`),h=`${n}.mdx`,g=c.existsSync(u.join(r,`${n}.src.mdx`))?u.join(r,`${n}.src.mdx`):m,_=o==null?void 0:(()=>{let e={...o},t=e.name;return typeof t==`string`&&t.trim().length>0&&s?.has(g)!==!0&&(s?.add(g),l.warn(gm({code:`SUBAGENT_NAME_IGNORED`,title:`Sub-agent authored name is ignored`,reason:J(`tnmsc ignores the authored sub-agent name "${t}" in favor of the derived path name "${p}".`),configPath:g,exactFix:J("Remove the `name` field from the sub-agent front matter or exported metadata.",`Rename the sub-agent directory or file if you need a different sub-agent name.`),details:{authoredName:t,derivedName:p,logicalName:n}}))),delete e.name,e})(),v={type:zN.SubAgent,content:e,length:e.length,filePathKind:VN.Relative,dir:{pathKind:VN.Relative,path:h,basePath:i,getDirectoryName:()=>h.replace(/\.mdx$/,``),getAbsolutePath:()=>m},...d!=null&&{agentPrefix:d},agentName:f,canonicalName:p};if(_==null)return v;let y=FF(_,m);if(!y.valid)throw Error(y.errors.join(`
422
422
  `));return Object.assign(v,{yamlFrontMatter:_}),_.seriName!=null&&Object.assign(v,{seriName:_.seriName}),v}async collect(e){let{userConfigOptions:t,logger:n,path:r,fs:i,globalScope:a}=e,o=this.resolveBasePaths(t),s=this.resolveAindexPath(t.aindex.subAgents.src,o.aindexDir),c=this.resolveAindexPath(t.aindex.subAgents.dist,o.aindexDir);n.debug(`SubAgentInputCapability collecting`,{srcDir:s,distDir:c,aindexDir:o.aindexDir});let l=yI(i,r,n,a),u=new Set,{prompts:d,errors:f}=await l.readFlatFiles(s,c,{kind:zN.SubAgent,localeExtensions:iI,hydrateSourceContents:!1,isDirectoryStructure:!1,createPrompt:(t,n,r,i)=>this.createSubAgentPrompt(t,n,r,s,c,e,i,u)});n.debug(`SubAgentInputCapability read complete`,{subAgentCount:d.length,errorCount:f.length});for(let e of f)n.warn(hm({code:`SUBAGENT_PROMPT_READ_FAILED`,title:`Failed to read sub-agent prompt`,operation:e.phase===`scan`?`scan`:`read`,targetKind:`sub-agent prompt`,path:e.path,error:e.error,details:{phase:e.phase}}));if(f.length>0)throw Error(f.map(e=>e.error.message).join(`
423
- `));let p=[];for(let e of d){let t=e.dist;if(t?.prompt==null)continue;let{prompt:n,rawMdx:r}=t;p.push(r==null?n:{...n,rawMdxContent:r})}return n.debug(`SubAgentInputCapability flattened subAgents`,{count:p.length}),{subAgents:p}}},tR=class extends N_{constructor(){super(`VSCodeConfigInputCapability`)}collect(e){let{userConfigOptions:t,fs:n}=e,{workspaceDir:r,aindexDir:i}=this.resolveBasePaths(t),a=[`.vscode/settings.json`,`.vscode/extensions.json`],o=[];for(let t of a){let a=VL(HN.VSCode,t,i,n,{command:e.runtimeCommand,workspaceDir:r});a!=null&&o.push(a)}return{vscodeConfigFiles:o}}},nR=class extends N_{constructor(){super(`WorkspaceInputCapability`)}collect(e){let{userConfigOptions:t}=e,{workspaceDir:n,aindexDir:r}=this.resolveBasePaths(t);return{workspace:{directory:{pathKind:VN.Absolute,path:n,getDirectoryName:()=>i.basename(n)},projects:[]},aindexDir:r}}},rR=class extends N_{constructor(){super(`ZedConfigInputCapability`)}collect(e){let{userConfigOptions:t,fs:n}=e,{workspaceDir:r,aindexDir:i}=this.resolveBasePaths(t),a=[],o=VL(HN.Zed,`.zed/settings.json`,i,n,{command:e.runtimeCommand,workspaceDir:r});return o!=null&&a.push(o),{zedConfigFiles:a}}};const iR={workspace:{strategy:`mergeProjects`,getter:e=>e.workspace},vscodeConfigFiles:{strategy:`concat`,getter:e=>e.vscodeConfigFiles},zedConfigFiles:{strategy:`concat`,getter:e=>e.zedConfigFiles},jetbrainsConfigFiles:{strategy:`concat`,getter:e=>e.jetbrainsConfigFiles},editorConfigFiles:{strategy:`concat`,getter:e=>e.editorConfigFiles},commands:{strategy:`concat`,getter:e=>e.commands},subAgents:{strategy:`concat`,getter:e=>e.subAgents},skills:{strategy:`concat`,getter:e=>e.skills},rules:{strategy:`concat`,getter:e=>e.rules},aiAgentIgnoreConfigFiles:{strategy:`concat`,getter:e=>e.aiAgentIgnoreConfigFiles},readmePrompts:{strategy:`concat`,getter:e=>e.readmePrompts},globalMemory:{strategy:`override`,getter:e=>e.globalMemory},aindexDir:{strategy:`override`,getter:e=>e.aindexDir},globalGitIgnore:{strategy:`override`,getter:e=>e.globalGitIgnore},shadowGitExclude:{strategy:`override`,getter:e=>e.shadowGitExclude}};function aR(e,t){return t==null?e??[]:e==null?t:[...e,...t]}function oR(e){return e.isWorkspaceRootProject===!0?`workspace-root:${e.name??``}`:`${e.promptSeries??`workspace`}:${e.name??``}`}function sR(e,t){let n=new Map;for(let t of e.projects)n.set(oR(t),t);for(let e of t.projects)n.set(oR(e),e);return{directory:t.directory??e.directory,projects:[...n.values()]}}function cR(e,t){return t==null?e:e==null?t:sR(e,t)}function lR(e,t,n){switch(n){case`concat`:return aR(e,t);case`override`:return t??e;case`mergeProjects`:return cR(e,t);default:return t??e}}function uR(e,t){let n={};for(let[r,i]of Object.entries(iR)){let a=lR(i.getter(e),i.getter(t),i.strategy);a!=null&&(n[r]=a)}return n}function dR(e,t,n){let r=e.dependsOn??[];if(r.length===0)return{};let i=new Set,a={};for(let e of r){if(i.has(e))continue;i.add(e);let r=t.get(e);r!=null&&(a=n(a,r))}return a}function fR(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.at(-1);if(e==null)return[...n];let t=a.indexOf(e);return a.slice(t)}i.clear(),a.length=0}return[...n]}function pR(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new YF(n.name,r)}let n=new Map;for(let t of e)n.set(t.name,t);let r=new Map;for(let t of e)r.set(t.name,0);let i=new Map;for(let t of e)i.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let n of e){r.set(t.name,(r.get(t.name)??0)+1);let e=i.get(n)??[];e.push(t.name),i.set(n,e)}}let a=[];for(let t of e)r.get(t.name)===0&&a.push(t.name);let o=[],s=new Map;for(let t=0;t<e.length;t++){let n=e[t];n!=null&&s.set(n.name,t)}for(;a.length>0;){let e=a.shift();if(e==null)continue;let t=n.get(e);if(t==null)continue;o.push(t);let c=(i.get(e)??[]).sort((e,t)=>(s.get(e)??-1)-(s.get(t)??-1));for(let e of c){let t=(r.get(e)??0)-1;r.set(e,t),t===0&&a.push(e)}}if(o.length===e.length)return o;throw new XF(fR(e,r))}function mR(){return[new KI,new GI,new II]}function hR(){return[new nR,new mL,new tR,new rR,new KL,new HL,new pL,new hL,new eR,new QL,new GL,new YL,new ZL,new WL,new UL,new $L]}async function gR(e){let{runtimeCommand:t,userConfigOptions:r,userConfig:a,capabilities:o,includeBuiltinEffects:s=!0}=e,c=nh(`InputRuntime`,r.logLevel),l={logger:c,userConfigOptions:r,fs:n,path:i,glob:xg.default},u=pR([...s?mR():[],...o??hR()]),d=new UP({userConfig:a,userConfigOptions:r}).collect(),f=new GP;f.setGlobalScope(d),c.debug(`global scope collected`,{osInfo:{platform:d.os.platform,arch:d.os.arch,shellKind:d.os.shellKind},hasProfile:Object.keys(d.profile).length>0,hasCodeStyles:Object.keys(d.codeStyles).length>0,hasTool:Object.keys(d.tool).length>0});let p=new Map,m={};for(let e of u){let n=dR(e,p,uR),r={...l,dependencyContext:n,...t==null?{}:{runtimeCommand:t},globalScope:d,scopeRegistry:f},i=e;i.executeEffects!=null&&await i.executeEffects(r,!1);let a=await e.collect(r);p.set(e.name,a),m=uR(m,a);let o=e;if(o.getRegisteredScopes!=null){let t=o.getRegisteredScopes();for(let{namespace:n,values:r}of t)f.register(n,r,WP.PluginRegistered),c.debug(`input capability scope registered`,{capability:e.name,namespace:n,keys:Object.keys(r)})}}return m}const _R={version:`0.0.0`,logLevel:`info`,aindex:dP(),frontMatter:{blankLineAfter:!0},codeStyles:VP(),windows:{},plugins:{}};function vR(e,n){return typeof e==`string`&&e.trim().length>0?e:i.resolve(n??t.cwd())}function yR(e){return{...e.version==null?{}:{version:e.version},...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.frontMatter==null?{}:{frontMatter:e.frontMatter},...e.codeStyles==null?{}:{codeStyles:e.codeStyles},...e.windows==null?{}:{windows:e.windows},...e.plugins==null?{}:{plugins:e.plugins},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function bR(e,...t){let n={..._R},r=t.reduce((e,t)=>xR(e,t),n);return{...r,workspaceDir:vR(r.workspaceDir,e)}}function xR(e,t){let n=t.codeStyles,r=t.frontMatter,i=t.plugins,a=t.windows;return{...e,...t,aindex:fP(e.aindex,t.aindex),codeStyles:SR(e.codeStyles,n),frontMatter:CR(e.frontMatter,r),plugins:wR(e.plugins,i),windows:TR(e.windows,a)}}function SR(e,t){return HP(e,t)}function CR(e,t){return t==null?e:{...e,...t}}function wR(e,t){return t==null?e??{}:e==null?t:{...e,...t}}function TR(e,t){if(t==null)return e??{};if(e==null)return t;let n=e.wsl2,r=t.wsl2;return{...e,...t,...n!=null||r!=null?{wsl2:{...n,...r}}:{}}}function ER(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e||`cwd`in e||`executionCwd`in e||`runtimeCommand`in e}function DR(e,t){let n=e;return n.includes(QF.WORKSPACE)&&(n=n.replace(QF.WORKSPACE,t)),i.normalize(t_(n))}function OR(e){let t=DR(e.workspaceDir,``),n=i.join(t,e.aindex.dir);return LF({workspace:{directory:{pathKind:VN.Absolute,path:t,getDirectoryName:()=>i.basename(t)},projects:[]},aindexDir:n})}function kR(e){return e===`plugins`}async function AR(e={}){let n,r,a,o,s,c,l;ER(e)?({pluginOptions:o={},outputPlugins:s=[],cwd:r,executionCwd:a,configLoaderOptions:c,runtimeCommand:l}={pluginOptions:e.pluginOptions,outputPlugins:e.outputPlugins,cwd:e.cwd,executionCwd:e.executionCwd,configLoaderOptions:e.configLoaderOptions,runtimeCommand:e.runtimeCommand},n=e.loadUserConfig??!0):(o=e,s=[],n=!0,c=void 0,l=void 0);let u={},d=!1,f=[],p;if(n)try{let e=jI(c).load(r);d=e.found,f=e.sources,e.found&&(u=yR(e.config),p=e.config)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to load user config: ${t}`)}let m=i.resolve(a??r??t.cwd()),h=bR(m,u,o),{logLevel:g}=h,_=nh(`defineConfig`,g);return d?_.info(`user config loaded`,{sources:f}):_.info(`no user config found, using defaults/programmatic options`,{workspaceDir:h.workspaceDir,aindexDir:h.aindex.dir,logLevel:h.logLevel}),{mergedOptions:h,outputPlugins:s,executionCwd:m,...p!=null&&{userConfigFile:p},...l!=null&&{runtimeCommand:l},userConfigFound:d,userConfigSources:f}}async function jR(e={}){let{mergedOptions:t,outputPlugins:n,userConfigFile:r,runtimeCommand:i,executionCwd:a}=await AR(e),o=nh(`defineConfig`,t.logLevel);if(kR(i)){let e=OR(t);return{context:e,outputPlugins:n,userConfigOptions:t,executionPlan:wF(e,a)}}let s=await gR({userConfigOptions:t,includeBuiltinEffects:!0,...i==null?{}:{runtimeCommand:i},...r==null?{}:{userConfig:r}});if(s.workspace==null)throw Error(`Workspace not initialized by any plugin`);let c=LF({workspace:s.workspace,...s.vscodeConfigFiles!=null&&{vscodeConfigFiles:s.vscodeConfigFiles},...s.zedConfigFiles!=null&&{zedConfigFiles:s.zedConfigFiles},...s.jetbrainsConfigFiles!=null&&{jetbrainsConfigFiles:s.jetbrainsConfigFiles},...s.editorConfigFiles!=null&&{editorConfigFiles:s.editorConfigFiles},...s.commands!=null&&{commands:s.commands},...s.subAgents!=null&&{subAgents:s.subAgents},...s.skills!=null&&{skills:s.skills},...s.rules!=null&&{rules:s.rules},...s.globalMemory!=null&&{globalMemory:s.globalMemory},...s.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:s.aiAgentIgnoreConfigFiles},...s.aindexDir!=null&&{aindexDir:s.aindexDir},...s.readmePrompts!=null&&{readmePrompts:s.readmePrompts},...s.globalGitIgnore!=null&&{globalGitIgnore:s.globalGitIgnore},...s.shadowGitExclude!=null&&{shadowGitExclude:s.shadowGitExclude}});return s.aindexDir!=null&&Cm(s.aindexDir,o),{context:c,outputPlugins:n,userConfigOptions:t,executionPlan:wF(c,a)}}const MR=[`IntelliJIdea`,`WebStorm`,`RustRover`,`PyCharm`,`PyCharmCE`,`PhpStorm`,`GoLand`,`CLion`,`DataGrip`,`RubyMine`,`Rider`,`DataSpell`,`Aqua`];function NR(e){return MR.some(t=>e.startsWith(t))}function PR(e){let t=i.join(UI(),`JetBrains`);try{return n.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()&&NR(e.name)).map(e=>i.join(t,e.name,`aia`,`codex`))}catch(n){return e.debug(hm({code:`JETBRAINS_CODEX_DIRECTORY_SCAN_SKIPPED`,title:`JetBrains Codex directories are unavailable`,operation:`scan`,targetKind:`JetBrains IDE directory`,path:t,error:n})),[]}}function FR(e){return{jetbrainsCodexDirs:PR(e)}}const IR=`AGENTS.md`;var LR=class extends ZF{constructor(){super(`AgentsOutputPlugin`,{outputFileName:IR,treatWorkspaceRootProjectAsProject:!0,capabilities:{prompt:{scopes:[`project`],singleScope:!1}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:[...t.delete??[],...this.buildProjectPromptCleanupTargets(e,IR)]}}async declareOutputFiles(e){let t=[],n=this.getProjectPromptOutputProjects(e);if(!new Set(this.selectPromptScopes(e,[`project`])).has(`project`))return t;for(let[r,i]of n.entries()){let n=this.resolveProjectRootDir(e,i);if(i.rootMemoryPrompt!=null&&n!=null&&t.push({path:this.resolvePath(n,IR),scope:`project`,source:{type:`projectRootMemory`,projectIndex:r}}),i.childMemoryPrompts!=null)for(let[e,n]of i.childMemoryPrompts.entries())t.push({path:this.resolveFullPath(n.dir),scope:`project`,source:{type:`projectChildMemory`,projectIndex:r,childIndex:e}})}return t}async convertContent(e,t){let n=this.getProjectPromptOutputProjects(t),r=e.source,i=r.projectIndex??-1;if(i<0||i>=n.length)throw Error(`Invalid project index in declaration for ${this.name}`);let a=n[i];if(a==null)throw Error(`Project not found for declaration in ${this.name}`);if(r.type===`projectRootMemory`){if(a.rootMemoryPrompt==null)throw Error(`Root memory prompt missing for project index ${i}`);return a.rootMemoryPrompt.content}if(r.type===`projectChildMemory`){let e=r.childIndex??-1,t=a.childMemoryPrompts?.[e];if(t==null)throw Error(`Child memory prompt missing for project ${i}, child ${e}`);return t.content}throw Error(`Unsupported declaration source for ${this.name}`)}};const RR=`CLAUDE.md`;var zR=class extends ZF{constructor(){super(`ClaudeCodeCLIOutputPlugin`,{globalConfigDir:`.claude`,outputFileName:RR,treatWorkspaceRootProjectAsProject:!0,toolPreset:`claudeCode`,commands:{subDir:`commands`,transformFrontMatter:(e,t)=>t.sourceFrontMatter??{}},subagents:{subDir:`agents`,sourceScopes:[`project`],includePrefix:!0,linkSymbol:`-`,ext:`.md`},skills:{subDir:`skills`},rules:{transformFrontMatter:e=>({paths:e.globs.map(Qp)})},cleanup:{delete:{project:{files:[`.claude/settings.json`,`.claude/settings.local.json`],dirs:[`.claude/rules`,`.claude/commands`,`.claude/agents`,`.claude/skills`]},global:{files:[`.claude/CLAUDE.md`],dirs:[`.claude/rules`,`.claude/commands`,`.claude/agents`,`.claude/skills`]}}},wslMirrors:[`~/.claude/settings.json`,`~/.claude/config.json`],capabilities:{prompt:{scopes:[`project`,`global`],singleScope:!1},rules:{scopes:[`project`,`global`],singleScope:!1},commands:{scopes:[`project`,`global`],singleScope:!0},subagents:{scopes:[`project`],singleScope:!0},skills:{scopes:[`project`,`global`],singleScope:!0}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:[...t.delete??[],...this.buildProjectPromptCleanupTargets(e,RR)]}}};const BR=oI.CURSOR,VR=eI.MCP_CONFIG,HR=tI.COMMANDS,UR=tI.RULES,WR=eI.CURSOR_GLOBAL_RULE,GR=tI.CURSOR_SKILLS,KR=`skills`,qR=cI.CURSOR;var JR=class extends ZF{constructor(){super(`CursorOutputPlugin`,{globalConfigDir:BR,outputFileName:``,treatWorkspaceRootProjectAsProject:!0,dependsOn:[$F.AgentsOutput],indexignore:sI.CURSOR,commands:{subDir:HR,transformFrontMatter:(e,t)=>t.sourceFrontMatter??{}},skills:{subDir:GR},rules:{subDir:UR,prefix:`rule`,sourceScopes:[`project`,`global`]},cleanup:{delete:{project:{files:[`.cursor/mcp.json`],dirs:[`.cursor/commands`,`.cursor/rules`],globs:[`.cursor/skills/*`,`.cursor/skills-cursor/*`]},global:{files:[`.cursor/mcp.json`],dirs:[`.cursor/commands`,`.cursor/rules`],globs:[`.cursor/skills-cursor/*`]}},protect:{global:{dirs:Array.from(qR,e=>`.cursor/skills-cursor/${e}`)}},excludeScanGlobs:Array.from(qR,e=>`.cursor/skills-cursor/${e}/**`)},capabilities:{prompt:{scopes:[`global`],singleScope:!1},rules:{scopes:[`project`,`global`],singleScope:!1},commands:{scopes:[`project`,`global`],singleScope:!0},skills:{scopes:[`project`,`global`],singleScope:!0},mcp:{scopes:[`project`,`global`],singleScope:!0}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:(t.delete??[]).map(e=>e.kind!==`glob`||!e.path.replaceAll(`\\`,`/`).endsWith(`/.cursor/${GR}/*`)?e:{...e,excludeBasenames:[...qR]})}}async declareOutputFiles(e){let t=[],{globalMemory:n,commands:r,skills:a,rules:o,aiAgentIgnoreConfigFiles:s}=e.collectedOutputContext,c=this.getGlobalConfigDir(),l=this.resolvePromptSourceProjectConfig(e),u=this.getConcreteProjects(e),d=this.getProjectPromptOutputProjects(e),f=this.getTransformOptionsFromContext(e,{includeSeriesPrefix:!0}),p=new Set(this.selectPromptScopes(e,[`global`])),m=new Set(o==null?[]:this.selectRuleScopes(e,o)),h=a==null?{items:[]}:this.selectSingleScopeItems(a,this.skillsConfig.sourceScopes,e=>this.resolveSkillSourceScope(e),this.getTopicScopeOverride(e,`skills`)),g=a==null?{items:[]}:this.selectSingleScopeItems(a,this.skillsConfig.sourceScopes,e=>this.resolveSkillSourceScope(e),this.getTopicScopeOverride(e,`mcp`)??this.getTopicScopeOverride(e,`skills`)),_=r==null?{items:[]}:this.selectSingleScopeItems(r,this.commandsConfig.sourceScopes,e=>this.resolveCommandSourceScope(e),this.getTopicScopeOverride(e,`commands`)),v=(e,n,r)=>{let i=n===`global`?GR:KR,a=r.filter(e=>!this.isPreservedSkill(this.getSkillName(e)));this.appendSkillDeclarations(t,e,n,a,{skillSubDir:i,buildSkillMainSource:e=>({kind:`skill`,skill:e}),buildSkillReferenceSource:e=>({kind:`skillChildDoc`,content:e.content})})},y=(e,n,r)=>{let i=n===`global`?GR:KR;this.appendSkillMcpDeclarations(t,e,n,r,{skillSubDir:i,fileName:VR})},b=(e,n,r)=>{if(r.length===0)return;let a=bI(r,this.log);a.size!==0&&t.push({path:i.join(e,VR),scope:n,source:{kind:`mcpConfig`,mcpServers:xI(a,SI)}})};if(h.selectedScope===`project`||g.selectedScope===`project`)for(let t of this.getProjectOutputProjects(e)){let n=this.resolveProjectConfigDir(e,t);if(n!=null&&(h.selectedScope===`project`&&v(n,`project`,QN(h.items,t.projectConfig,`skills`)),g.selectedScope===`project`)){let e=QN(g.items,t.projectConfig,`skills`);y(n,`project`,e),b(n,`project`,e)}}if((h.selectedScope===`global`||g.selectedScope===`global`)&&(h.selectedScope===`global`&&v(c,`global`,QN(h.items,l,`skills`)),g.selectedScope===`global`)){let e=QN(g.items,l,`skills`);y(c,`global`,e),b(c,`global`,e)}if(_.selectedScope===`project`)for(let n of this.getProjectOutputProjects(e)){let r=this.resolveProjectConfigDir(e,n);if(r==null)continue;let i=QN(_.items,n.projectConfig,`commands`);this.appendCommandDeclarations(t,r,`project`,i,f)}if(_.selectedScope===`global`){let e=QN(_.items,l,`commands`);this.appendCommandDeclarations(t,c,`global`,e,f)}if(o!=null&&o.length>0){let n=o.filter(e=>this.normalizeSourceScope(this.normalizeRuleScope(e))===`global`);if(m.has(`global`))for(let e of n)t.push({path:i.join(c,UR,this.buildRuleFileName(e)),scope:`global`,source:{kind:`ruleMdc`,rule:e}});if(m.has(`project`))for(let n of this.getProjectOutputProjects(e)){let r=this.resolveProjectConfigDir(e,n);if(r==null)continue;let a=nP(QN(o.filter(e=>this.normalizeSourceScope(this.normalizeRuleScope(e))===`project`),n.projectConfig,`rules`),n.projectConfig);for(let e of a)t.push({path:i.join(r,UR,this.buildRuleFileName(e)),scope:`project`,source:{kind:`ruleMdc`,rule:e}})}}if(n!=null&&p.has(`global`)){let r=this.buildGlobalRuleContent(n.content,e);for(let n of d){let a=this.resolveProjectConfigDir(e,n);a!=null&&t.push({path:i.join(a,UR,WR),scope:`project`,source:{kind:`globalRuleContent`,content:r}})}}let x=this.getIgnoreOutputPath(),S=this.indexignore==null?void 0:s?.find(e=>e.fileName===this.indexignore);if(x!=null&&S!=null)for(let e of u){let n=e.dirFromWorkspacePath;n==null||e.isPromptSourceProject===!0||t.push({path:i.join(n.basePath,n.path,x),scope:`project`,source:{kind:`ignoreFile`,content:S.content}})}return t}async convertContent(e,t){let n=e.source;switch(n.kind){case`command`:return this.buildCommandContent(n.command,t);case`mcpConfig`:return JSON.stringify({mcpServers:n.mcpServers},null,2);case`skill`:{let e=this.buildSkillFrontMatter(n.skill);return this.buildMarkdownContent(n.skill.content,e,t)}case`skillMcpConfig`:return n.rawContent;case`skillChildDoc`:case`globalRuleContent`:case`ignoreFile`:return n.content;case`skillResource`:return n.encoding===`base64`?f.from(n.content,`base64`):n.content;case`ruleMdc`:return this.buildRuleMdcContent(n.rule,t);default:throw Error(`Unsupported declaration source for ${this.name}`)}}buildGlobalRuleContent(e,t){return this.buildMarkdownContent(e,{description:`Global prompt (synced)`,alwaysApply:!0},t)}isPreservedSkill(e){return qR.has(e)}buildRuleMdcContent(e,t){let n={alwaysApply:!1,globs:e.globs.length>0?e.globs.join(`, `):``};return this.buildMarkdownContent(e.content,n,t).split(`
423
+ `));let p=[];for(let e of d){let t=e.dist;if(t?.prompt==null)continue;let{prompt:n,rawMdx:r}=t;p.push(r==null?n:{...n,rawMdxContent:r})}return n.debug(`SubAgentInputCapability flattened subAgents`,{count:p.length}),{subAgents:p}}},tR=class extends N_{constructor(){super(`VSCodeConfigInputCapability`)}collect(e){let{userConfigOptions:t,fs:n}=e,{workspaceDir:r,aindexDir:i}=this.resolveBasePaths(t),a=[`.vscode/settings.json`,`.vscode/extensions.json`],o=[];for(let t of a){let a=VL(HN.VSCode,t,i,n,{command:e.runtimeCommand,workspaceDir:r});a!=null&&o.push(a)}return{vscodeConfigFiles:o}}},nR=class extends N_{constructor(){super(`WorkspaceInputCapability`)}collect(e){let{userConfigOptions:t}=e,{workspaceDir:n,aindexDir:r}=this.resolveBasePaths(t);return{workspace:{directory:{pathKind:VN.Absolute,path:n,getDirectoryName:()=>i.basename(n)},projects:[]},aindexDir:r}}},rR=class extends N_{constructor(){super(`ZedConfigInputCapability`)}collect(e){let{userConfigOptions:t,fs:n}=e,{workspaceDir:r,aindexDir:i}=this.resolveBasePaths(t),a=[],o=VL(HN.Zed,`.zed/settings.json`,i,n,{command:e.runtimeCommand,workspaceDir:r});return o!=null&&a.push(o),{zedConfigFiles:a}}};const iR={workspace:{strategy:`mergeProjects`,getter:e=>e.workspace},vscodeConfigFiles:{strategy:`concat`,getter:e=>e.vscodeConfigFiles},zedConfigFiles:{strategy:`concat`,getter:e=>e.zedConfigFiles},jetbrainsConfigFiles:{strategy:`concat`,getter:e=>e.jetbrainsConfigFiles},editorConfigFiles:{strategy:`concat`,getter:e=>e.editorConfigFiles},commands:{strategy:`concat`,getter:e=>e.commands},subAgents:{strategy:`concat`,getter:e=>e.subAgents},skills:{strategy:`concat`,getter:e=>e.skills},rules:{strategy:`concat`,getter:e=>e.rules},aiAgentIgnoreConfigFiles:{strategy:`concat`,getter:e=>e.aiAgentIgnoreConfigFiles},readmePrompts:{strategy:`concat`,getter:e=>e.readmePrompts},globalMemory:{strategy:`override`,getter:e=>e.globalMemory},aindexDir:{strategy:`override`,getter:e=>e.aindexDir},globalGitIgnore:{strategy:`override`,getter:e=>e.globalGitIgnore},shadowGitExclude:{strategy:`override`,getter:e=>e.shadowGitExclude}};function aR(e,t){return t==null?e??[]:e==null?t:[...e,...t]}function oR(e){return e.isWorkspaceRootProject===!0?`workspace-root:${e.name??``}`:`${e.promptSeries??`workspace`}:${e.name??``}`}function sR(e,t){let n=new Map;for(let t of e.projects)n.set(oR(t),t);for(let e of t.projects)n.set(oR(e),e);return{directory:t.directory??e.directory,projects:[...n.values()]}}function cR(e,t){return t==null?e:e==null?t:sR(e,t)}function lR(e,t,n){switch(n){case`concat`:return aR(e,t);case`override`:return t??e;case`mergeProjects`:return cR(e,t);default:return t??e}}function uR(e,t){let n={};for(let[r,i]of Object.entries(iR)){let a=lR(i.getter(e),i.getter(t),i.strategy);a!=null&&(n[r]=a)}return n}function dR(e,t,n){let r=e.dependsOn??[];if(r.length===0)return{};let i=new Set,a={};for(let e of r){if(i.has(e))continue;i.add(e);let r=t.get(e);r!=null&&(a=n(a,r))}return a}function fR(e,t){let n=new Set;for(let[e,r]of t)r>0&&n.add(e);let r=new Map;for(let t of e)if(n.has(t.name)){let e=(t.dependsOn??[]).filter(e=>n.has(e));r.set(t.name,e)}let i=new Set,a=[],o=e=>{if(a.includes(e))return a.push(e),!0;if(i.has(e))return!1;i.add(e),a.push(e);for(let t of r.get(e)??[])if(o(t))return!0;return a.pop(),!1};for(let e of n){if(o(e)){let e=a.at(-1);if(e==null)return[...n];let t=a.indexOf(e);return a.slice(t)}i.clear(),a.length=0}return[...n]}function pR(e){let t=new Set(e.map(e=>e.name));for(let n of e){let e=n.dependsOn??[];for(let r of e)if(!t.has(r))throw new YF(n.name,r)}let n=new Map;for(let t of e)n.set(t.name,t);let r=new Map;for(let t of e)r.set(t.name,0);let i=new Map;for(let t of e)i.set(t.name,[]);for(let t of e){let e=t.dependsOn??[];for(let n of e){r.set(t.name,(r.get(t.name)??0)+1);let e=i.get(n)??[];e.push(t.name),i.set(n,e)}}let a=[];for(let t of e)r.get(t.name)===0&&a.push(t.name);let o=[],s=new Map;for(let t=0;t<e.length;t++){let n=e[t];n!=null&&s.set(n.name,t)}for(;a.length>0;){let e=a.shift();if(e==null)continue;let t=n.get(e);if(t==null)continue;o.push(t);let c=(i.get(e)??[]).sort((e,t)=>(s.get(e)??-1)-(s.get(t)??-1));for(let e of c){let t=(r.get(e)??0)-1;r.set(e,t),t===0&&a.push(e)}}if(o.length===e.length)return o;throw new XF(fR(e,r))}function mR(){return[new KI,new GI,new II]}function hR(){return[new nR,new mL,new tR,new rR,new KL,new HL,new pL,new hL,new eR,new QL,new GL,new YL,new ZL,new WL,new UL,new $L]}async function gR(e){let{runtimeCommand:t,userConfigOptions:r,userConfig:a,capabilities:o,includeBuiltinEffects:s=!0}=e,c=nh(`InputRuntime`,r.logLevel),l={logger:c,userConfigOptions:r,fs:n,path:i,glob:xg.default},u=pR([...s?mR():[],...o??hR()]),d=new UP({userConfig:a,userConfigOptions:r}).collect(),f=new GP;f.setGlobalScope(d),c.debug(`global scope collected`,{osInfo:{platform:d.os.platform,arch:d.os.arch,shellKind:d.os.shellKind},hasProfile:Object.keys(d.profile).length>0,hasCodeStyles:Object.keys(d.codeStyles).length>0,hasTool:Object.keys(d.tool).length>0});let p=new Map,m={};for(let e of u){let n=dR(e,p,uR),r={...l,dependencyContext:n,...t==null?{}:{runtimeCommand:t},globalScope:d,scopeRegistry:f},i=e;i.executeEffects!=null&&await i.executeEffects(r,!1);let a=await e.collect(r);p.set(e.name,a),m=uR(m,a);let o=e;if(o.getRegisteredScopes!=null){let t=o.getRegisteredScopes();for(let{namespace:n,values:r}of t)f.register(n,r,WP.PluginRegistered),c.debug(`input capability scope registered`,{capability:e.name,namespace:n,keys:Object.keys(r)})}}return m}const _R={version:`0.0.0`,logLevel:`info`,aindex:dP(),frontMatter:{blankLineAfter:!0},codeStyles:VP(),windows:{},plugins:{}};function vR(e,n){return typeof e==`string`&&e.trim().length>0?e:i.resolve(n??t.cwd())}function yR(e){return{...e.version==null?{}:{version:e.version},...e.workspaceDir==null?{}:{workspaceDir:e.workspaceDir},...e.frontMatter==null?{}:{frontMatter:e.frontMatter},...e.codeStyles==null?{}:{codeStyles:e.codeStyles},...e.windows==null?{}:{windows:e.windows},...e.plugins==null?{}:{plugins:e.plugins},...e.logLevel==null?{}:{logLevel:e.logLevel}}}function bR(e,...t){let n={..._R},r=t.reduce((e,t)=>xR(e,t),n);return{...r,workspaceDir:vR(r.workspaceDir,e)}}function xR(e,t){let n=t.codeStyles,r=t.frontMatter,i=t.plugins,a=t.windows;return{...e,...t,aindex:fP(e.aindex,t.aindex),codeStyles:SR(e.codeStyles,n),frontMatter:CR(e.frontMatter,r),plugins:wR(e.plugins,i),windows:TR(e.windows,a)}}function SR(e,t){return HP(e,t)}function CR(e,t){return t==null?e:{...e,...t}}function wR(e,t){return t==null?e??{}:e==null?t:{...e,...t}}function TR(e,t){if(t==null)return e??{};if(e==null)return t;let n=e.wsl2,r=t.wsl2;return{...e,...t,...n!=null||r!=null?{wsl2:{...n,...r}}:{}}}function ER(e){return`pluginOptions`in e||`configLoaderOptions`in e||`loadUserConfig`in e||`cwd`in e||`executionCwd`in e||`runtimeCommand`in e}function DR(e,t){let n=e;return n.includes(QF.WORKSPACE)&&(n=n.replace(QF.WORKSPACE,t)),i.normalize(t_(n))}function OR(e){let t=DR(e.workspaceDir,``),n=i.join(t,e.aindex.dir);return LF({workspace:{directory:{pathKind:VN.Absolute,path:t,getDirectoryName:()=>i.basename(t)},projects:[]},aindexDir:n})}function kR(e){return e===`plugins`}async function AR(e={}){let n,r,a,o,s,c,l;ER(e)?({pluginOptions:o={},outputPlugins:s=[],cwd:r,executionCwd:a,configLoaderOptions:c,runtimeCommand:l}={pluginOptions:e.pluginOptions,outputPlugins:e.outputPlugins,cwd:e.cwd,executionCwd:e.executionCwd,configLoaderOptions:e.configLoaderOptions,runtimeCommand:e.runtimeCommand},n=e.loadUserConfig??!0):(o=e,s=[],n=!0,c=void 0,l=void 0);let u={},d=!1,f=[],p;if(n)try{let e=jI(c).load(r);d=e.found,f=e.sources,e.found&&(u=yR(e.config),p=e.config)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to load user config: ${t}`)}let m=i.resolve(a??r??t.cwd()),h=bR(m,u,o),{logLevel:g}=h,_=nh(`defineConfig`,g);return d?_.info(`user config loaded`,{sources:f}):_.info(`no user config found, using defaults/programmatic options`,{workspaceDir:h.workspaceDir,aindexDir:h.aindex.dir,logLevel:h.logLevel}),{mergedOptions:h,outputPlugins:s,executionCwd:m,...p!=null&&{userConfigFile:p},...l!=null&&{runtimeCommand:l},userConfigFound:d,userConfigSources:f}}async function jR(e={}){let{mergedOptions:t,outputPlugins:n,userConfigFile:r,runtimeCommand:i,executionCwd:a}=await AR(e),o=nh(`defineConfig`,t.logLevel);if(kR(i)){let e=OR(t);return{context:e,outputPlugins:n,userConfigOptions:t,executionPlan:wF(e,a)}}let s=await gR({userConfigOptions:t,includeBuiltinEffects:!0,...i==null?{}:{runtimeCommand:i},...r==null?{}:{userConfig:r}});if(s.workspace==null)throw Error(`Workspace not initialized by any plugin`);let c=LF({workspace:s.workspace,...s.vscodeConfigFiles!=null&&{vscodeConfigFiles:s.vscodeConfigFiles},...s.zedConfigFiles!=null&&{zedConfigFiles:s.zedConfigFiles},...s.jetbrainsConfigFiles!=null&&{jetbrainsConfigFiles:s.jetbrainsConfigFiles},...s.editorConfigFiles!=null&&{editorConfigFiles:s.editorConfigFiles},...s.commands!=null&&{commands:s.commands},...s.subAgents!=null&&{subAgents:s.subAgents},...s.skills!=null&&{skills:s.skills},...s.rules!=null&&{rules:s.rules},...s.globalMemory!=null&&{globalMemory:s.globalMemory},...s.aiAgentIgnoreConfigFiles!=null&&{aiAgentIgnoreConfigFiles:s.aiAgentIgnoreConfigFiles},...s.aindexDir!=null&&{aindexDir:s.aindexDir},...s.readmePrompts!=null&&{readmePrompts:s.readmePrompts},...s.globalGitIgnore!=null&&{globalGitIgnore:s.globalGitIgnore},...s.shadowGitExclude!=null&&{shadowGitExclude:s.shadowGitExclude}});return s.aindexDir!=null&&Cm(s.aindexDir,o),{context:c,outputPlugins:n,userConfigOptions:t,executionPlan:wF(c,a)}}const MR=[`IntelliJIdea`,`WebStorm`,`RustRover`,`PyCharm`,`PyCharmCE`,`PhpStorm`,`GoLand`,`CLion`,`DataGrip`,`RubyMine`,`Rider`,`DataSpell`,`Aqua`];function NR(e){return MR.some(t=>e.startsWith(t))}function PR(e){let t=i.join(UI(),`JetBrains`);try{return n.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()&&NR(e.name)).map(e=>i.join(t,e.name,`aia`,`codex`))}catch(n){return e.debug(hm({code:`JETBRAINS_CODEX_DIRECTORY_SCAN_SKIPPED`,title:`JetBrains Codex directories are unavailable`,operation:`scan`,targetKind:`JetBrains IDE directory`,path:t,error:n})),[]}}function FR(e){return{jetbrainsCodexDirs:PR(e)}}const IR=`AGENTS.md`;var LR=class extends ZF{constructor(){super(`AgentsOutputPlugin`,{outputFileName:IR,treatWorkspaceRootProjectAsProject:!0,capabilities:{prompt:{scopes:[`project`],singleScope:!1}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:[...t.delete??[],...this.buildProjectPromptCleanupTargets(e,IR)]}}async declareOutputFiles(e){let t=[],n=this.getProjectPromptOutputProjects(e);if(!new Set(this.selectPromptScopes(e,[`project`])).has(`project`))return t;for(let[r,i]of n.entries()){let n=this.resolveProjectRootDir(e,i);if(i.rootMemoryPrompt!=null&&n!=null&&t.push({path:this.resolvePath(n,IR),scope:`project`,source:{type:`projectRootMemory`,projectIndex:r}}),i.childMemoryPrompts!=null)for(let[e,n]of i.childMemoryPrompts.entries())t.push({path:this.resolveFullPath(n.dir),scope:`project`,source:{type:`projectChildMemory`,projectIndex:r,childIndex:e}})}return t}async convertContent(e,t){let n=this.getProjectPromptOutputProjects(t),r=e.source,i=r.projectIndex??-1;if(i<0||i>=n.length)throw Error(`Invalid project index in declaration for ${this.name}`);let a=n[i];if(a==null)throw Error(`Project not found for declaration in ${this.name}`);if(r.type===`projectRootMemory`){if(a.rootMemoryPrompt==null)throw Error(`Root memory prompt missing for project index ${i}`);return a.rootMemoryPrompt.content}if(r.type===`projectChildMemory`){let e=r.childIndex??-1,t=a.childMemoryPrompts?.[e];if(t==null)throw Error(`Child memory prompt missing for project ${i}, child ${e}`);return t.content}throw Error(`Unsupported declaration source for ${this.name}`)}};const RR=`CLAUDE.md`;var zR=class extends ZF{constructor(){super(`ClaudeCodeCLIOutputPlugin`,{globalConfigDir:`.claude`,outputFileName:RR,treatWorkspaceRootProjectAsProject:!0,toolPreset:`claudeCode`,commands:{subDir:`commands`,transformFrontMatter:(e,t)=>t.sourceFrontMatter??{}},subagents:{subDir:`agents`,sourceScopes:[`project`],includePrefix:!0,linkSymbol:`-`,ext:`.md`,transformFrontMatter:(e,t)=>({name:e.canonicalName,description:Qp(t.sourceFrontMatter?.description??``),memory:`project`})},skills:{subDir:`skills`},rules:{transformFrontMatter:e=>({paths:e.globs.map(Qp)})},cleanup:{delete:{project:{files:[`.claude/settings.json`,`.claude/settings.local.json`],dirs:[`.claude/rules`,`.claude/commands`,`.claude/agents`,`.claude/skills`]},global:{files:[`.claude/CLAUDE.md`],dirs:[`.claude/rules`,`.claude/commands`,`.claude/agents`,`.claude/skills`]}}},wslMirrors:[`~/.claude/settings.json`,`~/.claude/config.json`],capabilities:{prompt:{scopes:[`project`,`global`],singleScope:!1},rules:{scopes:[`project`,`global`],singleScope:!1},commands:{scopes:[`project`,`global`],singleScope:!0},subagents:{scopes:[`project`],singleScope:!0},skills:{scopes:[`project`,`global`],singleScope:!0}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:[...t.delete??[],...this.buildProjectPromptCleanupTargets(e,RR)]}}};const BR=oI.CURSOR,VR=eI.MCP_CONFIG,HR=tI.COMMANDS,UR=tI.RULES,WR=eI.CURSOR_GLOBAL_RULE,GR=tI.CURSOR_SKILLS,KR=`skills`,qR=cI.CURSOR;var JR=class extends ZF{constructor(){super(`CursorOutputPlugin`,{globalConfigDir:BR,outputFileName:``,treatWorkspaceRootProjectAsProject:!0,dependsOn:[$F.AgentsOutput],indexignore:sI.CURSOR,commands:{subDir:HR,transformFrontMatter:(e,t)=>t.sourceFrontMatter??{}},skills:{subDir:GR},rules:{subDir:UR,prefix:`rule`,sourceScopes:[`project`,`global`]},cleanup:{delete:{project:{files:[`.cursor/mcp.json`],dirs:[`.cursor/commands`,`.cursor/rules`],globs:[`.cursor/skills/*`,`.cursor/skills-cursor/*`]},global:{files:[`.cursor/mcp.json`],dirs:[`.cursor/commands`,`.cursor/rules`],globs:[`.cursor/skills-cursor/*`]}},protect:{global:{dirs:Array.from(qR,e=>`.cursor/skills-cursor/${e}`)}},excludeScanGlobs:Array.from(qR,e=>`.cursor/skills-cursor/${e}/**`)},capabilities:{prompt:{scopes:[`global`],singleScope:!1},rules:{scopes:[`project`,`global`],singleScope:!1},commands:{scopes:[`project`,`global`],singleScope:!0},skills:{scopes:[`project`,`global`],singleScope:!0},mcp:{scopes:[`project`,`global`],singleScope:!0}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:(t.delete??[]).map(e=>e.kind!==`glob`||!e.path.replaceAll(`\\`,`/`).endsWith(`/.cursor/${GR}/*`)?e:{...e,excludeBasenames:[...qR]})}}async declareOutputFiles(e){let t=[],{globalMemory:n,commands:r,skills:a,rules:o,aiAgentIgnoreConfigFiles:s}=e.collectedOutputContext,c=this.getGlobalConfigDir(),l=this.resolvePromptSourceProjectConfig(e),u=this.getConcreteProjects(e),d=this.getProjectPromptOutputProjects(e),f=this.getTransformOptionsFromContext(e,{includeSeriesPrefix:!0}),p=new Set(this.selectPromptScopes(e,[`global`])),m=new Set(o==null?[]:this.selectRuleScopes(e,o)),h=a==null?{items:[]}:this.selectSingleScopeItems(a,this.skillsConfig.sourceScopes,e=>this.resolveSkillSourceScope(e),this.getTopicScopeOverride(e,`skills`)),g=a==null?{items:[]}:this.selectSingleScopeItems(a,this.skillsConfig.sourceScopes,e=>this.resolveSkillSourceScope(e),this.getTopicScopeOverride(e,`mcp`)??this.getTopicScopeOverride(e,`skills`)),_=r==null?{items:[]}:this.selectSingleScopeItems(r,this.commandsConfig.sourceScopes,e=>this.resolveCommandSourceScope(e),this.getTopicScopeOverride(e,`commands`)),v=(e,n,r)=>{let i=n===`global`?GR:KR,a=r.filter(e=>!this.isPreservedSkill(this.getSkillName(e)));this.appendSkillDeclarations(t,e,n,a,{skillSubDir:i,buildSkillMainSource:e=>({kind:`skill`,skill:e}),buildSkillReferenceSource:e=>({kind:`skillChildDoc`,content:e.content})})},y=(e,n,r)=>{let i=n===`global`?GR:KR;this.appendSkillMcpDeclarations(t,e,n,r,{skillSubDir:i,fileName:VR})},b=(e,n,r)=>{if(r.length===0)return;let a=bI(r,this.log);a.size!==0&&t.push({path:i.join(e,VR),scope:n,source:{kind:`mcpConfig`,mcpServers:xI(a,SI)}})};if(h.selectedScope===`project`||g.selectedScope===`project`)for(let t of this.getProjectOutputProjects(e)){let n=this.resolveProjectConfigDir(e,t);if(n!=null&&(h.selectedScope===`project`&&v(n,`project`,QN(h.items,t.projectConfig,`skills`)),g.selectedScope===`project`)){let e=QN(g.items,t.projectConfig,`skills`);y(n,`project`,e),b(n,`project`,e)}}if((h.selectedScope===`global`||g.selectedScope===`global`)&&(h.selectedScope===`global`&&v(c,`global`,QN(h.items,l,`skills`)),g.selectedScope===`global`)){let e=QN(g.items,l,`skills`);y(c,`global`,e),b(c,`global`,e)}if(_.selectedScope===`project`)for(let n of this.getProjectOutputProjects(e)){let r=this.resolveProjectConfigDir(e,n);if(r==null)continue;let i=QN(_.items,n.projectConfig,`commands`);this.appendCommandDeclarations(t,r,`project`,i,f)}if(_.selectedScope===`global`){let e=QN(_.items,l,`commands`);this.appendCommandDeclarations(t,c,`global`,e,f)}if(o!=null&&o.length>0){let n=o.filter(e=>this.normalizeSourceScope(this.normalizeRuleScope(e))===`global`);if(m.has(`global`))for(let e of n)t.push({path:i.join(c,UR,this.buildRuleFileName(e)),scope:`global`,source:{kind:`ruleMdc`,rule:e}});if(m.has(`project`))for(let n of this.getProjectOutputProjects(e)){let r=this.resolveProjectConfigDir(e,n);if(r==null)continue;let a=nP(QN(o.filter(e=>this.normalizeSourceScope(this.normalizeRuleScope(e))===`project`),n.projectConfig,`rules`),n.projectConfig);for(let e of a)t.push({path:i.join(r,UR,this.buildRuleFileName(e)),scope:`project`,source:{kind:`ruleMdc`,rule:e}})}}if(n!=null&&p.has(`global`)){let r=this.buildGlobalRuleContent(n.content,e);for(let n of d){let a=this.resolveProjectConfigDir(e,n);a!=null&&t.push({path:i.join(a,UR,WR),scope:`project`,source:{kind:`globalRuleContent`,content:r}})}}let x=this.getIgnoreOutputPath(),S=this.indexignore==null?void 0:s?.find(e=>e.fileName===this.indexignore);if(x!=null&&S!=null)for(let e of u){let n=e.dirFromWorkspacePath;n==null||e.isPromptSourceProject===!0||t.push({path:i.join(n.basePath,n.path,x),scope:`project`,source:{kind:`ignoreFile`,content:S.content}})}return t}async convertContent(e,t){let n=e.source;switch(n.kind){case`command`:return this.buildCommandContent(n.command,t);case`mcpConfig`:return JSON.stringify({mcpServers:n.mcpServers},null,2);case`skill`:{let e=this.buildSkillFrontMatter(n.skill);return this.buildMarkdownContent(n.skill.content,e,t)}case`skillMcpConfig`:return n.rawContent;case`skillChildDoc`:case`globalRuleContent`:case`ignoreFile`:return n.content;case`skillResource`:return n.encoding===`base64`?f.from(n.content,`base64`):n.content;case`ruleMdc`:return this.buildRuleMdcContent(n.rule,t);default:throw Error(`Unsupported declaration source for ${this.name}`)}}buildGlobalRuleContent(e,t){return this.buildMarkdownContent(e,{description:`Global prompt (synced)`,alwaysApply:!0},t)}isPreservedSkill(e){return qR.has(e)}buildRuleMdcContent(e,t){let n={alwaysApply:!1,globs:e.globs.length>0?e.globs.join(`, `):``};return this.buildMarkdownContent(e.content,n,t).split(`
424
424
  `).map(e=>{let t=/^(\s*globs:\s*)(['"])(.*)\2\s*$/.exec(e);if(t==null)return e;let n=t[1]??`globs: `,r=t[3]??``;return r.trim().length===0?e:`${n}${r}`}).join(`
425
425
  `)}};const YR=`AGENTS.md`;var XR=class extends ZF{constructor(){super(`DroidCLIOutputPlugin`,{globalConfigDir:`.factory`,outputFileName:YR,treatWorkspaceRootProjectAsProject:!0,commands:{transformFrontMatter:(e,t)=>t.sourceFrontMatter??{}},skills:{},cleanup:{delete:{project:{files:[YR],dirs:[`.factory/commands`,`.factory/skills`]},global:{files:[`.factory/AGENTS.md`],dirs:[`.factory/commands`,`.factory/skills`]}}},capabilities:{prompt:{scopes:[`project`,`global`],singleScope:!1},commands:{scopes:[`project`,`global`],singleScope:!0},skills:{scopes:[`project`,`global`],singleScope:!0}}})}buildSkillMainContent(e,t){let n=e.yamlFrontMatter==null?void 0:{name:this.getSkillName(e),description:e.yamlFrontMatter.description};return this.buildMarkdownContent(e.content,n,t)}};const ZR=`GEMINI.md`;var QR=class extends ZF{constructor(){super(`GeminiCLIOutputPlugin`,{globalConfigDir:`.gemini`,outputFileName:ZR,treatWorkspaceRootProjectAsProject:!0,cleanup:{delete:{global:{files:[`.gemini/GEMINI.md`]}}},capabilities:{prompt:{scopes:[`project`,`global`],singleScope:!1}}})}async declareCleanupPaths(e){let t=await super.declareCleanupPaths(e);return{...t,delete:[...t.delete??[],...this.buildProjectPromptCleanupTargets(e,ZR)]}}},$R=class extends ZF{constructor(){super(`GitExcludeOutputPlugin`,{capabilities:{}})}async declareOutputFiles(e){let t=[],{globalGitIgnore:n,shadowGitExclude:r}=e.collectedOutputContext,i=this.buildManagedContent(n,r);if(i.length===0)return t;let a=this.normalizeContent(i);for(let n of this.collectManagedExcludePaths(e))t.push({path:n,scope:`project`,source:{content:a}});return t}async declareCleanupPaths(e){let t=this.collectManagedExcludePaths(e).map(e=>({path:e,kind:`file`,scope:`project`,label:`delete.project`}));return t.length===0?{}:{delete:t}}async convertContent(e,t){let n=e.source;if(n.content==null)throw Error(`Unsupported declaration source for ${this.name}`);return n.content}buildManagedContent(e,t){let n=[];if(e!=null&&e.trim().length>0){let t=this.sanitizeContent(e);t.length>0&&n.push(t)}if(t!=null&&t.trim().length>0){let e=this.sanitizeContent(t);e.length>0&&n.push(e)}return n.length===0?``:n.join(`
426
426
  `)}sanitizeContent(e){return e.split(/\r?\n/).filter(e=>{let t=e.trim();return t.length===0?!0:!(t.startsWith(`#`)&&!t.startsWith(`\\#`))}).join(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@truenine/memory-sync-cli",
3
3
  "type": "module",
4
- "version": "2026.10406.121",
4
+ "version": "2026.10408.12323",
5
5
  "description": "TrueNine Memory Synchronization CLI shell",
6
6
  "author": "TrueNine",
7
7
  "license": "AGPL-3.0-only",
@@ -55,12 +55,12 @@
55
55
  "json5": "^2.2.3",
56
56
  "yaml": "^2.8.3",
57
57
  "zod": "^4.3.6",
58
- "@truenine/memory-sync-cli-darwin-arm64": "2026.10406.121",
59
- "@truenine/memory-sync-cli-darwin-x64": "2026.10406.121",
60
- "@truenine/memory-sync-cli-linux-arm64-gnu": "2026.10406.121",
61
- "@truenine/memory-sync-cli-linux-x64-gnu": "2026.10406.121",
62
- "@truenine/memory-sync-cli-win32-x64-msvc": "2026.10406.121",
63
- "@truenine/script-runtime": "2026.10406.121"
58
+ "@truenine/memory-sync-cli-darwin-arm64": "2026.10408.12323",
59
+ "@truenine/memory-sync-cli-linux-arm64-gnu": "2026.10408.12323",
60
+ "@truenine/memory-sync-cli-linux-x64-gnu": "2026.10408.12323",
61
+ "@truenine/memory-sync-cli-darwin-x64": "2026.10408.12323",
62
+ "@truenine/script-runtime": "2026.10408.12323",
63
+ "@truenine/memory-sync-cli-win32-x64-msvc": "2026.10408.12323"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@truenine/eslint10-config": "^2026.10402.10314",
@@ -72,7 +72,7 @@
72
72
  "tsx": "^4.21.0",
73
73
  "typescript": "6.0.2",
74
74
  "vitest": "^4.1.2",
75
- "@truenine/memory-sync-sdk": "2026.10406.121"
75
+ "@truenine/memory-sync-sdk": "2026.10408.12323"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "run-s build:sdk build:shell sync:sdk-assets",