@longzai-intelligence-bun/cli 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -205,20 +205,20 @@ ${K.default.gray(Td+Cd.repeat(a+2)+Ed)}
205
205
  `):process.stdout.write(`${r} ${s}
206
206
  `),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}},Bd={red:e=>K.default.red(e),green:e=>K.default.green(e),yellow:e=>K.default.yellow(e),blue:e=>K.default.blue(e),cyan:e=>K.default.cyan(e),magenta:e=>K.default.magenta(e),gray:e=>K.default.gray(e),bold:e=>K.default.bold(e),dim:e=>K.default.dim(e)},Vd={async select(e,t){let n=await Fd({message:e,options:t.map(e=>({value:e.value,label:e.label,hint:e.hint}))});return td(n)&&(Ld(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async textInput(e,t){let n=await Nd({message:e,placeholder:t?.placeholder,defaultValue:t?.defaultValue});return td(n)&&(Ld(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async confirm(e,t){let n=await Pd({message:e,initialValue:t?.defaultValue??!1});return td(n)&&(Ld(`操作已取消`),process.exit(0)),typeof n==`boolean`?n:!!n},spinner(){let e=zd();return{start(t){e.start(t)},stop(t){e.stop(t)}}},note(e,t){Id(e,t)},log:{info(e){Rd.info(K.default.blue(e))},success(e){Rd.success(K.default.green(e))},warn(e){Rd.warn(K.default.yellow(e))},error(e){Rd.error(K.default.red(e))},step(e){Rd.step(e)}}};function Hd(e){return e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}function X(...e){process.stdout.write(`${Hd(e)}\n`)}function Z(...e){process.stderr.write(`${Hd(e)}\n`)}const Ud=/* @__PURE__ */ new Set([`build`,`coverage`,`dist`,`node_modules`,`out`]),Wd=/* @__PURE__ */ new Set([`ENAMETOOLONG`,`EACCES`,`EPERM`,`ENOENT`]),Gd=Fl([jl(el()),Nl({packages:jl(el())})]),Kd=e=>typeof e!=`object`||!e||!(`code`in e)?!1:typeof e.code==`string`,qd=e=>{let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);r===`*`?e[n+1]===`*`?(t+=`.*`,n+=1):t+=`[^/]+`:t+=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}$`)},Jd=e=>{let t={positives:[],negatives:[]};for(let n of e)n.startsWith(`!`)?t.negatives.push(qd(n.slice(1))):t.positives.push(qd(n));return t},Yd=e=>{let t=Gd.safeParse(e);if(t.success)return Array.isArray(t.data)?t.data:t.data.packages},Xd=(e,t)=>e.positives.some(e=>e.test(t))&&!e.negatives.some(e=>e.test(t)),Zd=(e,t)=>e.negatives.some(e=>e.test(t)),Qd=[`bun.lock`,`bun.lockb`],$d=Nl({name:el().optional(),workspaces:Gd.optional()}),ef=Nl({name:el().optional()}),tf=async e=>{try{let t=ef.safeParse(JSON.parse(await b(e,`utf-8`)));return t.success?t.data.name??null:null}catch{return null}},nf=async e=>{let t={packageDirs:[],lockDirs:[],rootHasLock:!1,scanSkips:[]},n=[{dir:e,depth:0}];for(;n.length>0;){let r=n.shift();if(r===void 0)break;let i;try{i=await x(r.dir,{withFileTypes:!0})}catch(n){if(!Kd(n)||!Wd.has(n.code))throw n;let i=r.depth===0?`.`:r.dir.slice(e.length+1);t.scanSkips.push({path:i,code:n.code});continue}let a=!1,o=!1;for(let e of i)e.isFile()&&Qd.includes(e.name)&&(a=!0),e.isFile()&&e.name===`package.json`&&(o=!0);r.depth===0?t.rootHasLock=a:(a&&t.lockDirs.push(r.dir.slice(e.length+1)),o&&t.packageDirs.push({relPath:r.dir.slice(e.length+1),name:await tf(l(r.dir,`package.json`))}));for(let e of i)e.isDirectory()&&(e.name.startsWith(`.`)||Ud.has(e.name)||r.depth>=5||n.push({dir:l(r.dir,e.name),depth:r.depth+1}))}return t},rf=async e=>{let t;try{t=JSON.parse(await b(l(e,`package.json`),`utf-8`))}catch{throw Error(`根 package.json 不存在或不可解析,请在仓库根执行本命令`)}let n=$d.safeParse(t);if(!n.success)throw Error(`根 package.json 不存在或不可解析,请在仓库根执行本命令`);let r=n.data,i=r.name??null,a=i===null?null:i.includes(`/`)?i.slice(0,i.lastIndexOf(`/`)):`@${i}`,o=Yd(r.workspaces);if(o===void 0)return{rootName:i,scope:a,hasWorkspaces:!1,memberCount:0,violations:[],notices:[],scanSkips:[],ok:!0};let s=Jd(o),c=await nf(e),u=[],d=[],f=new Map(c.packageDirs.map(e=>[e.relPath,e.name])),p=c.packageDirs.map(e=>e.relPath).filter(e=>Xd(s,e));c.rootHasLock||u.push({kind:`missing-root-lock`,path:``,message:`仓库根缺少 bun.lock,声明了 workspaces 的 monorepo 锁文件应只存在于根`});let m=/* @__PURE__ */ new Set;for(let e of c.lockDirs){if(Xd(s,e)){m.add(e),u.push({kind:`stray-member-lock`,path:e,message:`${e} 是 workspaces 成员却持有自己的 bun.lock,属游离锁文件`});continue}let t=f.get(e)??null;t===null?d.push({kind:`orphan-lock`,path:e,message:`${e} 存在锁文件但没有 package.json,请确认目录用途`}):Zd(s,e)?d.push({kind:`excluded-standalone`,path:e,message:`${e} 为负向 glob 显式排除的独立安装根,锁文件属合法形态`}):a!==null&&t.startsWith(`${a}/`)?(m.add(e),u.push({kind:`uncovered-same-scope`,path:e,message:`${e}(${t})与根包同作用域却未被 workspaces 覆盖,已按独立安装根长出游离锁`})):d.push({kind:`foreign-scope-lock`,path:e,message:`${e}(${t})不属于根作用域且持有独立锁文件,若为有意保留请以负向 glob 显式排除`})}for(let e of c.packageDirs)p.includes(e.relPath)||Zd(s,e.relPath)||m.has(e.relPath)||a!==null&&e.name!==null&&e.name.startsWith(`${a}/`)&&u.push({kind:`uncovered-same-scope`,path:e.relPath,message:`${e.relPath}(${e.name})与根包同作用域却未被 workspaces 覆盖,请补 glob 或以负向 glob 显式排除`});return{rootName:i,scope:a,hasWorkspaces:!0,memberCount:p.length,violations:u,notices:d,scanSkips:c.scanSkips,ok:u.length===0}},af=async()=>{let e=process.cwd();X(`正在扫描 ${e} 下的工作区布局...`);try{let t=await rf(e);if(!t.hasWorkspaces){X(`未声明 workspaces,非 bun workspaces monorepo,跳过锁文件校验`);return}if(t.scanSkips.length>0){Z(`\n${t.scanSkips.length} 项目录读取降级告警,结论基于其余可读目录:`);for(let e of t.scanSkips)Z(` ${e.path} 读取失败已跳过该子树,错误码 ${e.code}`)}if(X(`根包 ${t.rootName??`未命名`},workspaces 成员 ${t.memberCount} 个`),t.notices.length>0){X(`\n${t.notices.length} 项提示:`);for(let e of t.notices)X(` ${e.message}`)}if(!t.ok){X(`\n发现 ${t.violations.length} 项违规:`);for(let e of t.violations)X(` ${e.message}`);X(`
207
207
  修复指引: 删除成员目录的游离 bun.lock 后在仓库根执行 bun install;覆盖缺口补 workspaces glob,刻意独立的子项目以负向 glob 显式排除`),process.exit(1)}X(`单一锁文件不变量成立,无游离锁文件与覆盖缺口`)}catch(e){Z(`错误: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}},of=/* @__PURE__ */ new Set([`.bun`]),sf=/* @__PURE__ */ new Set([`ENOENT`,`ENOTDIR`]),cf=Nl({workspaces:Gd.optional()}),lf=async e=>{let t=[],n=[],r=[{dir:e,depth:0}];for(;r.length>0;){let i=r.shift();if(i===void 0)break;let a;try{a=await x(i.dir,{withFileTypes:!0})}catch(t){if(!Kd(t)||!Wd.has(t.code))throw t;n.push({path:i.dir.slice(e.length+1),code:t.code});continue}a.some(e=>e.isFile()&&e.name===`package.json`)&&t.push(i.dir.slice(e.length+1));for(let e of a)e.isDirectory()&&(e.name.startsWith(`.`)||Ud.has(e.name)||i.depth>=5||r.push({dir:l(i.dir,e.name),depth:i.depth+1}))}return{packageDirPaths:t,scanSkips:n}},uf=async(e,t)=>{let n=[],r=[],i=[e];for(;i.length>0;){let e=i.shift();if(e===void 0)break;let a;try{a=await x(e,{withFileTypes:!0})}catch(n){if(!Kd(n)||!Wd.has(n.code))throw n;r.push({path:e.slice(t.length+1),code:n.code});continue}for(let o of a){let a=l(e,o.name);if(!of.has(o.name)){if(o.isSymbolicLink())try{await C(a)}catch(e){if(Kd(e)&&sf.has(e.code)){n.push({path:a.slice(t.length+1),target:await S(a)});continue}r.push({path:a.slice(t.length+1),code:Kd(e)?e.code:`UNKNOWN`})}else o.isDirectory()&&i.push(a)}}}return{dangling:n,scanSkips:r}},df=async e=>{let t;try{t=JSON.parse(await b(l(e,`package.json`),`utf-8`))}catch{throw Error(`根 package.json 不存在或不可解析,请在仓库根执行本命令`)}let n=cf.safeParse(t);if(!n.success)throw Error(`根 package.json 不存在或不可解析,请在仓库根执行本命令`);let r=Yd(n.data.workspaces);if(r===void 0)return{hasWorkspaces:!1,memberCount:0,scannedNodeModulesRoots:0,dangling:[],scanSkips:[],ok:!0};let i=Jd(r),a=await lf(e),o=a.packageDirPaths.filter(e=>Xd(i,e)),s=[],c=[...a.scanSkips],u=0;for(let t of[``,...o]){let n=l(e,t,`node_modules`);try{if(!(await C(n)).isDirectory())continue}catch{continue}u+=1;let r=await uf(n,e);s.push(...r.dangling),c.push(...r.scanSkips)}return{hasWorkspaces:!0,memberCount:o.length,scannedNodeModulesRoots:u,dangling:s,scanSkips:c,ok:s.length===0}},ff=async(e,t)=>{let n={removed:[],kept:[]};for(let r of t){let t=l(e,r.path);try{if(!(await y(t)).isSymbolicLink()){n.kept.push(r.path);continue}await C(t),n.kept.push(r.path)}catch(e){if(!Kd(e)||!sf.has(e.code)){n.kept.push(r.path);continue}await w(t),n.removed.push(r.path)}}return n},pf=async()=>{let e=process.cwd();X(`正在扫描 ${e} 下的安装布局...`);try{let t=await df(e);if(!t.hasWorkspaces){X(`未声明 workspaces,非 bun workspaces monorepo,跳过悬挂链接检测`);return}if(t.scanSkips.length>0){Z(`\n${t.scanSkips.length} 项目录读取降级告警,结论基于其余可读目录:`);for(let e of t.scanSkips)Z(` ${e.path} 读取失败已跳过该子树,错误码 ${e.code}`)}if(X(`workspaces 成员 ${t.memberCount} 个,扫描 ${t.scannedNodeModulesRoots} 个 node_modules 树`),t.dangling.length>0){X(`\n发现 ${t.dangling.length} 根悬挂符号链接:`);for(let e of t.dangling)X(` ${e.path} 指向已不存在的 ${e.target}`);X(`
208
- 修复指引: 执行 lzi-bun-cli node-links fix 回收悬挂死链后重试,有效链接零触碰`),process.exit(Math.min(t.dangling.length,255))}X(`安装布局一致,未发现悬挂符号链接`)}catch(e){Z(`错误: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}},mf=async()=>{let e=process.cwd();X(`正在扫描 ${e} 下的悬挂符号链接...`);try{let t=await df(e);if(!t.hasWorkspaces){X(`未声明 workspaces,非 bun workspaces monorepo,跳过悬挂链接回收`);return}if(t.dangling.length===0){X(`未发现悬挂符号链接,无需回收,共巡查 ${t.scannedNodeModulesRoots} 个 node_modules 树`);return}X(`发现 ${t.dangling.length} 根悬挂符号链接,开始回收:`);for(let e of t.dangling)X(` ${e.path} 指向已不存在的 ${e.target}`);let n=await ff(e,t.dangling);for(let e of n.removed)X(`已回收 ${e}`);for(let e of n.kept)Z(`未能回收 ${e},链接状态已变化,请人工确认`);let r=await df(e);X(`回收完成,清除 ${n.removed.length} 根,剩余悬挂 ${r.dangling.length} 根,有效链接零触碰`),(r.dangling.length>0||n.kept.length>0)&&process.exit(1)}catch(e){Z(`错误: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}},Q=`https://registry.npmjs.org/`,hf=/* @__PURE__ */ new Map([[`longzai-intelligence`,Q],[`longzai-intelligence-agent-tools`,Q],[`longzai-intelligence-audit`,Q],[`longzai-intelligence-auth`,Q],[`longzai-intelligence-builder`,Q],[`longzai-intelligence-bun`,Q],[`longzai-intelligence-cache`,Q],[`longzai-intelligence-cli`,Q],[`longzai-intelligence-config`,Q],[`longzai-intelligence-dependencies`,Q],[`longzai-intelligence-design-system`,Q],[`longzai-intelligence-dev-tools`,Q],[`longzai-intelligence-electron`,Q],[`longzai-intelligence-error`,Q],[`longzai-intelligence-event-bus`,Q],[`longzai-intelligence-logger`,Q],[`longzai-intelligence-okr`,Q],[`longzai-intelligence-oxfmt`,Q],[`longzai-intelligence-oxlint`,Q],[`longzai-intelligence-plugin`,Q],[`longzai-intelligence-shared-config`,Q],[`longzai-intelligence-shared-kernel`,Q],[`longzai-intelligence-scripts`,Q],[`longzai-intelligence-standards`,Q],[`longzai-intelligence-transport`,Q],[`longzai-intelligence-typescript`,Q],[`longzai-intelligence-vscode`,Q],[`longzai-intelligence-zod`,Q],[`longzai-intelligence-prettier`,Q],[`longzai-intelligence-tsdown`,Q],[`longzai-intelligence-vitest`,Q],[`longzai-intelligence-academy`,Q],[`longzai-intelligence-accounting`,Q],[`longzai-intelligence-activity`,Q],[`longzai-intelligence-administration`,Q],[`longzai-intelligence-agent`,Q],[`longzai-intelligence-agent-collaboration`,Q],[`longzai-intelligence-agent-endless`,Q],[`longzai-intelligence-agent-migrator`,Q],[`longzai-intelligence-agent-prompts`,Q],[`longzai-intelligence-agent-relation`,Q],[`longzai-intelligence-agent-session`,Q],[`longzai-intelligence-agent-swarm`,Q],[`longzai-intelligence-agent-ui`,Q],[`longzai-intelligence-analytics`,Q],[`longzai-intelligence-api`,Q],[`longzai-intelligence-app-gallery`,Q],[`longzai-intelligence-app-store`,Q],[`longzai-intelligence-architecture`,Q],[`longzai-intelligence-architecture-expert`,Q],[`longzai-intelligence-arkts`,Q],[`longzai-intelligence-art`,Q],[`longzai-intelligence-artifact`,Q],[`longzai-intelligence-artifact-registry`,Q],[`longzai-intelligence-arxiv`,Q],[`longzai-intelligence-arxiv-data`,Q],[`longzai-intelligence-arxiv-markdown`,Q],[`longzai-intelligence-atomic`,Q],[`longzai-intelligence-attention`,Q],[`longzai-intelligence-audio`,Q],[`longzai-intelligence-audio-assistant`,Q],[`longzai-intelligence-augmented-reality`,Q],[`longzai-intelligence-auto-research`,Q],[`longzai-intelligence-automate`,Q],[`longzai-intelligence-benchmark`,Q],[`longzai-intelligence-bilibili`,Q],[`longzai-intelligence-bilibili-data`,Q],[`longzai-intelligence-bilibili-markdown`,Q],[`longzai-intelligence-billing`,Q],[`longzai-intelligence-blackboard`,Q],[`longzai-intelligence-blackboard-data`,Q],[`longzai-intelligence-blackboard-markdown`,Q],[`longzai-intelligence-bluetooth`,Q],[`longzai-intelligence-board`,Q],[`longzai-intelligence-bounty-registry`,Q],[`longzai-intelligence-brawl-stars`,Q],[`longzai-intelligence-broker`,Q],[`longzai-intelligence-business-plan`,Q],[`longzai-intelligence-calendar`,Q],[`longzai-intelligence-camera`,Q],[`longzai-intelligence-canvas`,Q],[`longzai-intelligence-capture`,Q],[`longzai-intelligence-change-maker`,Q],[`longzai-intelligence-changelog`,Q],[`longzai-intelligence-changeset`,Q],[`longzai-intelligence-chat`,Q],[`longzai-intelligence-chess`,Q],[`longzai-intelligence-circuit`,Q],[`longzai-intelligence-claude-code`,Q],[`longzai-intelligence-clipboard-share`,Q],[`longzai-intelligence-closed-loop`,Q],[`longzai-intelligence-closed-loop-data`,Q],[`longzai-intelligence-closed-loop-markdown`,Q],[`longzai-intelligence-cloud`,Q],[`longzai-intelligence-code`,Q],[`longzai-intelligence-code-agent`,Q],[`longzai-intelligence-code-reviewer`,Q],[`longzai-intelligence-codebase-research`,Q],[`longzai-intelligence-coding-expert`,Q],[`longzai-intelligence-collaboration`,Q],[`longzai-intelligence-collective`,Q],[`longzai-intelligence-commerce`,Q],[`longzai-intelligence-commit`,Q],[`longzai-intelligence-competition-registry`,Q],[`longzai-intelligence-composer`,Q],[`longzai-intelligence-concrete`,Q],[`longzai-intelligence-concrete-industry`,Q],[`longzai-intelligence-config-registry`,Q],[`longzai-intelligence-context`,Q],[`longzai-intelligence-contract`,Q],[`longzai-intelligence-contract-parity`,Q],[`longzai-intelligence-cookery`,Q],[`longzai-intelligence-country`,Q],[`longzai-intelligence-creativity`,Q],[`longzai-intelligence-cross-platform`,Q],[`longzai-intelligence-crossref`,Q],[`longzai-intelligence-crossref-markdown`,Q],[`longzai-intelligence-crypto`,Q],[`longzai-intelligence-customer-service`,Q],[`longzai-intelligence-cut`,Q],[`longzai-intelligence-dag`,Q],[`longzai-intelligence-dashboard`,Q],[`longzai-intelligence-data`,Q],[`longzai-intelligence-data-science`,Q],[`longzai-intelligence-database`,Q],[`longzai-intelligence-decenterlization`,Q],[`longzai-intelligence-decision`,Q],[`longzai-intelligence-deepseek`,Q],[`longzai-intelligence-deepseek-harness`,Q],[`longzai-intelligence-deepseek-harness-knowledge`,Q],[`longzai-intelligence-delta`,Q],[`longzai-intelligence-design`,Q],[`longzai-intelligence-design-lab`,Q],[`longzai-intelligence-device`,Q],[`longzai-intelligence-discipline`,Q],[`longzai-intelligence-discovery`,Q],[`longzai-intelligence-disk-space`,Q],[`longzai-intelligence-disk-space-data`,Q],[`longzai-intelligence-disk-space-markdown`,Q],[`longzai-intelligence-distill`,Q],[`longzai-intelligence-docs`,Q],[`longzai-intelligence-docs-registry`,Q],[`longzai-intelligence-document`,Q],[`longzai-intelligence-douyin`,Q],[`longzai-intelligence-douyin-data`,Q],[`longzai-intelligence-douyin-markdown`,Q],[`longzai-intelligence-drone`,Q],[`longzai-intelligence-edge`,Q],[`longzai-intelligence-electrobun`,Q],[`longzai-intelligence-elysia`,Q],[`longzai-intelligence-embodied`,Q],[`longzai-intelligence-empowerment`,Q],[`longzai-intelligence-engineering`,Q],[`longzai-intelligence-env`,Q],[`longzai-intelligence-env-registry`,Q],[`longzai-intelligence-equilibrium`,Q],[`longzai-intelligence-eslint`,Q],[`longzai-intelligence-event`,Q],[`longzai-intelligence-event-tracking`,Q],[`longzai-intelligence-evolution`,Q],[`longzai-intelligence-excel`,Q],[`longzai-intelligence-exchange-rate`,Q],[`longzai-intelligence-execution`,Q],[`longzai-intelligence-experience`,Q],[`longzai-intelligence-expert`,Q],[`longzai-intelligence-expert-thinking`,Q],[`longzai-intelligence-fde`,Q],[`longzai-intelligence-feature-flags`,Q],[`longzai-intelligence-features`,Q],[`longzai-intelligence-federation`,Q],[`longzai-intelligence-feed`,Q],[`longzai-intelligence-feishu`,Q],[`longzai-intelligence-file-processing`,Q],[`longzai-intelligence-fitness`,Q],[`longzai-intelligence-font`,Q],[`longzai-intelligence-game`,Q],[`longzai-intelligence-game-studio`,Q],[`longzai-intelligence-gantt`,Q],[`longzai-intelligence-gateway`,Q],[`longzai-intelligence-geo`,Q],[`longzai-intelligence-gesture`,Q],[`longzai-intelligence-git`,Q],[`longzai-intelligence-git-insight`,Q],[`longzai-intelligence-gitcode`,Q],[`longzai-intelligence-github-data`,Q],[`longzai-intelligence-github-markdown`,Q],[`longzai-intelligence-github-trending`,Q],[`longzai-intelligence-github-trending-data`,Q],[`longzai-intelligence-github-trending-markdown`,Q],[`longzai-intelligence-globals`,Q],[`longzai-intelligence-growth`,Q],[`longzai-intelligence-growth-registry`,Q],[`longzai-intelligence-handover`,Q],[`longzai-intelligence-hardware`,Q],[`longzai-intelligence-harness`,Q],[`longzai-intelligence-healthcare`,Q],[`longzai-intelligence-history`,Q],[`longzai-intelligence-horizon`,Q],[`longzai-intelligence-human-resource`,Q],[`longzai-intelligence-i18n`,Q],[`longzai-intelligence-idea`,Q],[`longzai-intelligence-identity`,Q],[`longzai-intelligence-ime`,Q],[`longzai-intelligence-impact-maker`,Q],[`longzai-intelligence-insight`,Q],[`longzai-intelligence-intellectual-property`,Q],[`longzai-intelligence-intent`,Q],[`longzai-intelligence-intentionomics`,Q],[`longzai-intelligence-interview`,Q],[`longzai-intelligence-issues`,Q],[`longzai-intelligence-jev`,Q],[`longzai-intelligence-jev-knowledge`,Q],[`longzai-intelligence-jev-system`,Q],[`longzai-intelligence-journal-of-finance-data`,Q],[`longzai-intelligence-journal-of-financial-and-quantitative-analysis-data`,Q],[`longzai-intelligence-journal-of-financial-economics-data`,Q],[`longzai-intelligence-key-management`,Q],[`longzai-intelligence-knowledge`,Q],[`longzai-intelligence-knowledge-graph`,Q],[`longzai-intelligence-knowledge-markdown`,Q],[`longzai-intelligence-kol`,Q],[`longzai-intelligence-kol-data`,Q],[`longzai-intelligence-kol-markdown`,Q],[`longzai-intelligence-kol-registry`,Q],[`longzai-intelligence-language-model`,Q],[`longzai-intelligence-law`,Q],[`longzai-intelligence-law-data`,Q],[`longzai-intelligence-law-markdown`,Q],[`longzai-intelligence-lean`,Q],[`longzai-intelligence-legal`,Q],[`longzai-intelligence-liquid-glass`,Q],[`longzai-intelligence-living-previewer`,Q],[`longzai-intelligence-loop`,Q],[`longzai-intelligence-machine-learning`,Q],[`longzai-intelligence-mail`,Q],[`longzai-intelligence-mandala`,Q],[`longzai-intelligence-map`,Q],[`longzai-intelligence-markdown`,Q],[`longzai-intelligence-marketing`,Q],[`longzai-intelligence-marketplace`,Q],[`longzai-intelligence-math`,Q],[`longzai-intelligence-mcn`,Q],[`longzai-intelligence-mcp`,Q],[`longzai-intelligence-media`,Q],[`longzai-intelligence-meditation`,Q],[`longzai-intelligence-memory`,Q],[`longzai-intelligence-mentor`,Q],[`longzai-intelligence-messaging`,Q],[`longzai-intelligence-mindset`,Q],[`longzai-intelligence-minimax-knowldege`,Q],[`longzai-intelligence-mission-control`,Q],[`longzai-intelligence-model-fusion`,Q],[`longzai-intelligence-model-gateway`,Q],[`longzai-intelligence-moment`,Q],[`longzai-intelligence-montage`,Q],[`longzai-intelligence-movie`,Q],[`longzai-intelligence-music-video`,Q],[`longzai-intelligence-music-video-data`,Q],[`longzai-intelligence-narrative-analyzer`,Q],[`longzai-intelligence-nation`,Q],[`longzai-intelligence-nginx`,Q],[`longzai-intelligence-notification`,Q],[`longzai-intelligence-npm`,Q],[`longzai-intelligence-npm-registry`,Q],[`longzai-intelligence-npm-registry-data`,Q],[`longzai-intelligence-observability`,Q],[`longzai-intelligence-office-industry`,Q],[`longzai-intelligence-okr-data`,Q],[`longzai-intelligence-okr-markdown`,Q],[`longzai-intelligence-older`,Q],[`longzai-intelligence-one`,Q],[`longzai-intelligence-one-digest`,Q],[`longzai-intelligence-one-digest-data`,Q],[`longzai-intelligence-one-digest-markdown`,Q],[`longzai-intelligence-one-digest-registry`,Q],[`longzai-intelligence-one-trae-works`,Q],[`longzai-intelligence-ontology`,Q],[`longzai-intelligence-open-pencil`,Q],[`longzai-intelligence-open-router`,Q],[`longzai-intelligence-open-router-data`,Q],[`longzai-intelligence-open-router-markdown`,Q],[`longzai-intelligence-opencode`,Q],[`longzai-intelligence-opportunity`,Q],[`longzai-intelligence-orchestry`,Q],[`longzai-intelligence-organization`,Q],[`longzai-intelligence-orm`,Q],[`longzai-intelligence-outfit`,Q],[`longzai-intelligence-outsourcing`,Q],[`longzai-intelligence-overseas`,Q],[`longzai-intelligence-pagination`,Q],[`longzai-intelligence-panel`,Q],[`longzai-intelligence-paper-reader`,Q],[`longzai-intelligence-parametric-industry`,Q],[`longzai-intelligence-partner`,Q],[`longzai-intelligence-pay`,Q],[`longzai-intelligence-payment`,Q],[`longzai-intelligence-permission`,Q],[`longzai-intelligence-personal-assistant`,Q],[`longzai-intelligence-pii`,Q],[`longzai-intelligence-pipeline`,Q],[`longzai-intelligence-policy-research`,Q],[`longzai-intelligence-portal`,Q],[`longzai-intelligence-previewer`,Q],[`longzai-intelligence-prezi`,Q],[`longzai-intelligence-prisma`,Q],[`longzai-intelligence-product-requirement`,Q],[`longzai-intelligence-product-research`,Q],[`longzai-intelligence-programming-language`,Q],[`longzai-intelligence-project`,Q],[`longzai-intelligence-project-data`,Q],[`longzai-intelligence-project-markdown`,Q],[`longzai-intelligence-project-portfolio`,Q],[`longzai-intelligence-project-registry`,Q],[`longzai-intelligence-promotion`,Q],[`longzai-intelligence-prospect`,Q],[`longzai-intelligence-psychoanalyst`,Q],[`longzai-intelligence-publication`,Q],[`longzai-intelligence-qcloud`,Q],[`longzai-intelligence-quant`,Q],[`longzai-intelligence-queue`,Q],[`longzai-intelligence-react-devtools`,Q],[`longzai-intelligence-react-native`,Q],[`longzai-intelligence-reading-shanhaijing`,Q],[`longzai-intelligence-readme`,Q],[`longzai-intelligence-reasoning`,Q],[`longzai-intelligence-records`,Q],[`longzai-intelligence-recruitment`,Q],[`longzai-intelligence-release`,Q],[`longzai-intelligence-release-markdown`,Q],[`longzai-intelligence-reliability`,Q],[`longzai-intelligence-remote-desktop`,Q],[`longzai-intelligence-remotion`,Q],[`longzai-intelligence-report`,Q],[`longzai-intelligence-repository`,Q],[`longzai-intelligence-repository-handover`,Q],[`longzai-intelligence-resilience`,Q],[`longzai-intelligence-reverse-engineering`,Q],[`longzai-intelligence-review-of-financial-studies-data`,Q],[`longzai-intelligence-reviewer`,Q],[`longzai-intelligence-risk`,Q],[`longzai-intelligence-roadmap`,Q],[`longzai-intelligence-roadmap-data`,Q],[`longzai-intelligence-roadmap-markdown`,Q],[`longzai-intelligence-router`,Q],[`longzai-intelligence-rss`,Q],[`longzai-intelligence-rss-markdown`,Q],[`longzai-intelligence-runtime`,Q],[`longzai-intelligence-sales`,Q],[`longzai-intelligence-scanner`,Q],[`longzai-intelligence-schedule-markdown`,Q],[`longzai-intelligence-schedule-registry`,Q],[`longzai-intelligence-scheduler`,Q],[`longzai-intelligence-schema`,Q],[`longzai-intelligence-scope`,Q],[`longzai-intelligence-scrape`,Q],[`longzai-intelligence-search`,Q],[`longzai-intelligence-security`,Q],[`longzai-intelligence-security-bounty-registry`,Q],[`longzai-intelligence-security-inventory`,Q],[`longzai-intelligence-serverless`,Q],[`longzai-intelligence-share`,Q],[`longzai-intelligence-short-video`,Q],[`longzai-intelligence-skill`,Q],[`longzai-intelligence-slider`,Q],[`longzai-intelligence-smart-transition`,Q],[`longzai-intelligence-sms`,Q],[`longzai-intelligence-software-factory`,Q],[`longzai-intelligence-soul`,Q],[`longzai-intelligence-specs`,Q],[`longzai-intelligence-spline`,Q],[`longzai-intelligence-sports`,Q],[`longzai-intelligence-ssl`,Q],[`longzai-intelligence-startup`,Q],[`longzai-intelligence-storage`,Q],[`longzai-intelligence-strategy`,Q],[`longzai-intelligence-strategy-consulting`,Q],[`longzai-intelligence-supply-chain`,Q],[`longzai-intelligence-support`,Q],[`longzai-intelligence-survey`,Q],[`longzai-intelligence-talk`,Q],[`longzai-intelligence-taro`,Q],[`longzai-intelligence-task`,Q],[`longzai-intelligence-task-data`,Q],[`longzai-intelligence-task-markdown`,Q],[`longzai-intelligence-telemetry`,Q],[`longzai-intelligence-templates`,Q],[`longzai-intelligence-tenant`,Q],[`longzai-intelligence-testing`,Q],[`longzai-intelligence-thinking`,Q],[`longzai-intelligence-token-exchange`,Q],[`longzai-intelligence-token-finance`,Q],[`longzai-intelligence-token-handover`,Q],[`longzai-intelligence-topology`,Q],[`longzai-intelligence-tracking-nation`,Q],[`longzai-intelligence-tracking-qbitai`,Q],[`longzai-intelligence-tracking-terrytao`,Q],[`longzai-intelligence-tracking-xiao-lin`,Q],[`longzai-intelligence-tracking-yu-bo`,Q],[`longzai-intelligence-trader`,Q],[`longzai-intelligence-trae`,Q],[`longzai-intelligence-training-data`,Q],[`longzai-intelligence-translator`,Q],[`longzai-intelligence-travel`,Q],[`longzai-intelligence-trending`,Q],[`longzai-intelligence-tsdoc`,Q],[`longzai-intelligence-tsgo`,Q],[`longzai-intelligence-twitter`,Q],[`longzai-intelligence-twitter-data`,Q],[`longzai-intelligence-twitter-markdown`,Q],[`longzai-intelligence-typeorm`,Q],[`longzai-intelligence-usecase`,Q],[`longzai-intelligence-user-experience`,Q],[`longzai-intelligence-user-research`,Q],[`longzai-intelligence-userscript`,Q],[`longzai-intelligence-utils`,Q],[`longzai-intelligence-value-chain`,Q],[`longzai-intelligence-vector-search`,Q],[`longzai-intelligence-vendor`,Q],[`longzai-intelligence-venture-capital`,Q],[`longzai-intelligence-version`,Q],[`longzai-intelligence-video-generation`,Q],[`longzai-intelligence-video-player`,Q],[`longzai-intelligence-voice`,Q],[`longzai-intelligence-voice-recorder`,Q],[`longzai-intelligence-vscode-developer`,Q],[`longzai-intelligence-vuln`,Q],[`longzai-intelligence-vuln-data`,Q],[`longzai-intelligence-vuln-markdown`,Q],[`longzai-intelligence-vuln-registry`,Q],[`longzai-intelligence-warehouse`,Q],[`longzai-intelligence-wealth`,Q],[`longzai-intelligence-web3`,Q],[`longzai-intelligence-webhook`,Q],[`longzai-intelligence-websocket`,Q],[`longzai-intelligence-wechat`,Q],[`longzai-intelligence-wechat-miniprogram`,Q],[`longzai-intelligence-wechat-pay`,Q],[`longzai-intelligence-wifi`,Q],[`longzai-intelligence-wiki`,Q],[`longzai-intelligence-word`,Q],[`longzai-intelligence-work`,Q],[`longzai-intelligence-worker`,Q],[`longzai-intelligence-workflow`,Q],[`longzai-intelligence-workflow-data`,Q],[`longzai-intelligence-workflow-markdown`,Q],[`longzai-intelligence-workflow-registry`,Q],[`longzai-intelligence-workspace`,Q],[`longzai-intelligence-writer`,Q],[`longzai-intelligence-xiaohongshu`,Q],[`longzai-intelligence-xiaohongshu-data`,Q],[`longzai-intelligence-xiaohongshu-markdown`,Q],[`longzai-intelligence-youtube`,Q],[`longzai-intelligence-youtube-data`,Q],[`longzai-intelligence-youtube-markdown`,Q],[`longzai-intelligence-zcode`,Q],[`longzai-intelligence-zcode-security`,Q],[`longzai-intelligence-zed-delta-knowledge`,Q],[`longzai-intelligence-zhihu`,Q],[`longzai-intelligence-zhihu-data`,Q],[`longzai-intelligence-zhihu-markdown`,Q]]),gf=`LZI_GLOBALS_ROOT`,_f=`lzi-bun-install.config.ts`,vf=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;var yf=class extends Error{details;constructor(e,t=`install.extraScopes`){super(`${t} 校验失败:\n${e.map(e=>`- ${e}`).join(`
209
- `)}`),this.name=`InstallScopesError`,this.details=e}};function bf(e){if(typeof e!=`string`)return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function xf(e,t,n,r){let i=e instanceof Map?Object.fromEntries(e):{...e},a=[],o={};for(let[n,i]of Object.entries(t??{})){let t=n.replace(/^@+/,``);t.length===0||!vf.test(t)?a.push(`\`${n}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,@ 前缀可省略)`):bf(i)?o[t]!==void 0&&o[t]!==i?a.push(`\`${t}\` 在 extraScopes 内重复声明且安装源不一致`):(e instanceof Map?e.has(t):Object.hasOwn(e,t))?a.push(`\`${t}\` 与预定义 scope 冲突(预定义不可覆盖,如需调整请在 ${r} 维护)`):o[t]=i:a.push(`\`${n}\` 的安装源 \`${String(i)}\` 不是合法的 http/https URL`)}let s=/* @__PURE__ */ new Set;for(let e of n??[]){let t=e.replace(/^@+/,``);t.length===0||!vf.test(t)?a.push(`\`${e}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,@ 前缀可省略)`):o[t]===void 0?s.add(t):a.push(`\`${t}\` 同时出现在 extraScopes 与 privateScopes(追加公网安装源与私有轨声明矛盾)`)}if(a.length>0)throw new yf(a);for(let[e,t]of Object.entries(o))i[e]=t;for(let e of s)delete i[e];return i}function Sf(e,t,n,r){let i=xf(e,t,n,`globals 仓 lzi-bun-install.config.ts`),a=r?.replace(/^@+/,``),o=new Set((n??[]).map(e=>e.replace(/^@+/,``)));return a!==void 0&&vf.test(a)&&!Object.hasOwn(i,a)&&!o.has(a)&&(i[a]=`https://registry.npmjs.org/`),i}function Cf(e){let t=[];if(typeof e!=`object`||!e)throw new yf([`default export 必须是对象({ scopes: { ... } })`],`globals 预设 lzi-bun-install.config.ts`);let n=typeof e==`object`&&e&&`scopes`in e?e.scopes:void 0;if(typeof n!=`object`||!n||Array.isArray(n))throw new yf([`scopes 必须是 scope → registry 的对象映射`],`globals 预设 lzi-bun-install.config.ts`);let r={};for(let[e,i]of Object.entries(n))vf.test(e)?typeof i!=`string`||!bf(i)?t.push(`\`${e}\` 的安装源 \`${String(i)}\` 不是合法的 http/https URL`):r[e]=i:t.push(`\`${e}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,不含 @ 前缀)`);if(t.length>0)throw new yf(t,`globals 预设 lzi-bun-install.config.ts`);if(Object.keys(r).length===0)throw new yf([`scopes 清单为空(真源不允许空清单)`],`globals 预设 lzi-bun-install.config.ts`);return r}var wf=class extends Error{configPath;constructor(e,t,n){super(e,n),this.name=`SharedConfigError`,this.configPath=t}},Tf=class extends wf{searchFrom;constructor(e){super(`未在 ${e} 找到配置文件`,e),this.name=`SharedConfigNotFoundError`,this.searchFrom=e}},Ef=class extends wf{issues;constructor(e,t){super(`配置校验失败,共 ${e.length} 个问题`,t),this.name=`SharedConfigValidationError`,this.issues=e}};function Df(e,t,n,r){let i=e;if(r.schema!==void 0){let e=r.schema.safeParse(i);if(!e.success)throw new Ef(e.error.issues,t);i=e.data}return r.transform!==void 0&&(i=r.transform(i,n)),i}function Of(e){return e instanceof Error&&e.message.length>0?`,底层原因为 ${e.name}: ${e.message}`:``}var kf=class extends wf{cause;constructor(e,t){super(`加载配置文件 ${e} 失败${Of(t)}`,e,{cause:t}),this.name=`SharedConfigLoadError`,this.cause=t}};function Af(e){return typeof e==`object`&&!!e}function jf(e){return typeof e==`object`&&!!e}async function Mf(e,t={}){let r=d(e);if(!n(r))throw new Tf(r);let i;try{let e=await import(r);i=Af(e)?e.default:void 0}catch(e){throw new kf(r,e)}if(i===void 0)throw new kf(r,TypeError(`配置文件缺少默认导出`));if(!jf(i))throw new kf(r,TypeError(`配置文件的默认导出必须是对象`));return{config:Df(i,r,c(r),t),configFilePath:r}}function Nf(e=process.cwd()){let t=d(e);for(;;){let e=l(t,`lzi.config.ts`);if(n(e))return e;let r=c(t);if(r===t)return null;t=r}}async function Pf(e={}){let t=e.cwd??process.cwd(),n=Nf(t);if(n===null)throw new Tf(t);let r=d(n,`..`),{config:i}=await Mf(n);return{config:i,configPath:r,configFilePath:n}}function Ff(e){return typeof e==`object`&&!!e}async function If(e){let t;try{t=await x(e)}catch(t){throw new kf(e,t)}let n=t.filter(e=>e.endsWith(`.config.ts`)).sort();if(n.length===0)throw new kf(e,Error(`配置目录内没有 .config.ts 分片文件`));let r={};for(let t of n){let n=await Mf(l(e,t));r={...r,...n.config}}let i=r;if(!Ff(i))throw new kf(e,Error(`配置目录合并结果不是对象形态`));return i}function Lf(e,t=process.cwd()){let n=Array.isArray(e)?e:[e],r=d(t);for(;;){for(let e of n){let t=l(r,e);if(Rf(t))return t}let e=c(r);if(e===r)return null;r=e}}function Rf(e){try{return o(e).isDirectory()}catch{return!1}}function zf(e,t=process.cwd()){let r=Array.isArray(e)?e:[e],i=d(t);for(;;){for(let e of r){let t=l(i,e);if(n(t))return t}let e=c(i);if(e===i)return null;i=e}}function Bf(e){return typeof e==`object`&&!!e}function Vf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Hf(e={}){let t=e.cwd??d(process.cwd());if(e.explicitPath!==void 0){let t=await Mf(e.explicitPath,{schema:e.schema,transform:e.transform});return{success:!0,config:t.config,source:`explicit`,configFilePath:t.configFilePath}}if(e.standaloneFile!==void 0){let n=zf(e.standaloneFile,t);if(n!==null){let{config:t}=await Mf(n);return{success:!0,config:Df(t,n,c(n),e),source:`standalone`,configFilePath:n}}}if(e.standaloneDir!==void 0){let n=Lf(e.standaloneDir,t);if(n!==null)return{success:!0,config:Df(await If(n),n,n,e),source:`standalone`,configFilePath:n}}if(e.unifiedField!==void 0){let n,r;try{let{config:i,configFilePath:a}=await Pf({cwd:t}),o=i;n=Vf(o)?o[e.unifiedField]:void 0,r=a}catch(e){if(!(e instanceof Tf))throw e}if(r!==void 0&&n!==void 0&&Bf(n))return{success:!0,config:Df(n,r,c(r),e),source:`unified`,configFilePath:r}}return{success:!1,configFilePath:null}}const Uf=[`packages/*`,`apps/*`];function Wf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gf(e){if(Array.isArray(e))return e.every(e=>typeof e==`string`)?e:void 0;if(Wf(e)){let t=e.packages;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return{packages:t}}}function Kf(e){let t=d(e,`package.json`);if(!n(t))throw new Tf(e);let r;try{let e=JSON.parse(i(t,`utf8`));r=Wf(e)?Gf(e.workspaces):void 0}catch(e){throw new kf(t,e)}let a=Array.isArray(r)?r:r?.packages;return a&&a.length>0?a:Uf}async function qf(e,t={}){let r=Kf(e),a=/* @__PURE__ */ new Set,o=[];for(let s of r){let r=new Bun.Glob(`${s}/package.json`);for await(let s of r.scan({cwd:e,absolute:!0,onlyFiles:!0})){let e=d(s,`..`);if(a.has(e))continue;let r;try{let e=JSON.parse(i(s,`utf8`));r=typeof e==`object`&&e?e:void 0}catch{continue}r!==void 0&&typeof r.name==`string`&&r.name.length!==0&&(t.configFileName!==void 0&&!n(d(e,t.configFileName))||(a.add(e),o.push({name:r.name,dir:e})))}}return o}var Jf=class extends Error{bunfigPath;reason;constructor(e,t){super(`${e} 校验失败:${t};请运行 bun run bun-config:generate 后重试`),this.name=`BunfigDriftError`,this.bunfigPath=e,this.reason=t}},Yf=class extends Error{bunfigPath;constructor(e){super(`${e} 已存在且非 lzi-bun-cli 生成(缺少 @lzi-bun-cli 自动生成,请勿编辑 标记),如需 lzi-bun-cli 接管,请删除该文件或手动合并后重试`),this.name=`BunfigProtectedError`,this.bunfigPath=e}};function Xf(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Zf(e,t){let n=e.map(e=>Xf(e)),r=`[${n.join(`, `)}]`;return`${t} = `.length+r.length<=100?r:`[\n${n.map(e=>` ${e},`).join(`
210
- `)}\n]`}function Qf(e){let t=[`registry = ${Xf(e.registry)}`],n=ep(`linker`,e.linker);n&&t.push(n);let r=ep(`globalStore`,e.globalStore);r&&t.push(r);let i=Object.entries(e.scopes).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${Xf(`@${e}`)} = ${Xf(t)}`),a=[`[install]\n${t.join(`
208
+ 修复指引: 执行 lzi-bun-cli node-links fix 回收悬挂死链后重试,有效链接零触碰`),process.exit(Math.min(t.dangling.length,255))}X(`安装布局一致,未发现悬挂符号链接`)}catch(e){Z(`错误: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}},mf=async()=>{let e=process.cwd();X(`正在扫描 ${e} 下的悬挂符号链接...`);try{let t=await df(e);if(!t.hasWorkspaces){X(`未声明 workspaces,非 bun workspaces monorepo,跳过悬挂链接回收`);return}if(t.dangling.length===0){X(`未发现悬挂符号链接,无需回收,共巡查 ${t.scannedNodeModulesRoots} 个 node_modules 树`);return}X(`发现 ${t.dangling.length} 根悬挂符号链接,开始回收:`);for(let e of t.dangling)X(` ${e.path} 指向已不存在的 ${e.target}`);let n=await ff(e,t.dangling);for(let e of n.removed)X(`已回收 ${e}`);for(let e of n.kept)Z(`未能回收 ${e},链接状态已变化,请人工确认`);let r=await df(e);X(`回收完成,清除 ${n.removed.length} 根,剩余悬挂 ${r.dangling.length} 根,有效链接零触碰`),(r.dangling.length>0||n.kept.length>0)&&process.exit(1)}catch(e){Z(`错误: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}};function hf(e,t=`./src/__tests__/bootstrap.ts`){let n=[t,...(e?.test?.preload??[]).filter(e=>e!==t)];return{...e,test:{...e?.test,preload:n}}}const Q=`https://registry.npmjs.org/`,gf=/* @__PURE__ */ new Map([[`longzai-intelligence`,Q],[`longzai-intelligence-agent-tools`,Q],[`longzai-intelligence-audit`,Q],[`longzai-intelligence-auth`,Q],[`longzai-intelligence-builder`,Q],[`longzai-intelligence-bun`,Q],[`longzai-intelligence-cache`,Q],[`longzai-intelligence-cli`,Q],[`longzai-intelligence-config`,Q],[`longzai-intelligence-dependencies`,Q],[`longzai-intelligence-design-system`,Q],[`longzai-intelligence-dev-tools`,Q],[`longzai-intelligence-electron`,Q],[`longzai-intelligence-error`,Q],[`longzai-intelligence-event-bus`,Q],[`longzai-intelligence-logger`,Q],[`longzai-intelligence-okr`,Q],[`longzai-intelligence-oxfmt`,Q],[`longzai-intelligence-oxlint`,Q],[`longzai-intelligence-plugin`,Q],[`longzai-intelligence-shared-config`,Q],[`longzai-intelligence-shared-kernel`,Q],[`longzai-intelligence-scripts`,Q],[`longzai-intelligence-standards`,Q],[`longzai-intelligence-transport`,Q],[`longzai-intelligence-typescript`,Q],[`longzai-intelligence-vscode`,Q],[`longzai-intelligence-zod`,Q],[`longzai-intelligence-prettier`,Q],[`longzai-intelligence-tsdown`,Q],[`longzai-intelligence-vitest`,Q],[`longzai-intelligence-academy`,Q],[`longzai-intelligence-accounting`,Q],[`longzai-intelligence-activity`,Q],[`longzai-intelligence-administration`,Q],[`longzai-intelligence-agent`,Q],[`longzai-intelligence-agent-broadcast`,Q],[`longzai-intelligence-agent-collaboration`,Q],[`longzai-intelligence-agent-endless`,Q],[`longzai-intelligence-agent-migrator`,Q],[`longzai-intelligence-agent-monitor`,Q],[`longzai-intelligence-agent-prompts`,Q],[`longzai-intelligence-agent-relation`,Q],[`longzai-intelligence-agent-session`,Q],[`longzai-intelligence-agent-swarm`,Q],[`longzai-intelligence-agent-tasks`,Q],[`longzai-intelligence-agent-tasks-data`,Q],[`longzai-intelligence-agent-ui`,Q],[`longzai-intelligence-analytics`,Q],[`longzai-intelligence-api`,Q],[`longzai-intelligence-app-gallery`,Q],[`longzai-intelligence-app-store`,Q],[`longzai-intelligence-architecture`,Q],[`longzai-intelligence-architecture-expert`,Q],[`longzai-intelligence-arkts`,Q],[`longzai-intelligence-art`,Q],[`longzai-intelligence-artifact`,Q],[`longzai-intelligence-artifact-registry`,Q],[`longzai-intelligence-arxiv`,Q],[`longzai-intelligence-arxiv-data`,Q],[`longzai-intelligence-arxiv-markdown`,Q],[`longzai-intelligence-atomic`,Q],[`longzai-intelligence-attention`,Q],[`longzai-intelligence-audio`,Q],[`longzai-intelligence-audio-assistant`,Q],[`longzai-intelligence-augmented-reality`,Q],[`longzai-intelligence-auto-research`,Q],[`longzai-intelligence-automate`,Q],[`longzai-intelligence-benchmark`,Q],[`longzai-intelligence-bilibili`,Q],[`longzai-intelligence-bilibili-data`,Q],[`longzai-intelligence-bilibili-markdown`,Q],[`longzai-intelligence-billing`,Q],[`longzai-intelligence-blackboard`,Q],[`longzai-intelligence-blackboard-data`,Q],[`longzai-intelligence-blackboard-markdown`,Q],[`longzai-intelligence-bluetooth`,Q],[`longzai-intelligence-board`,Q],[`longzai-intelligence-bootstrap`,Q],[`longzai-intelligence-bootstrap-registry`,Q],[`longzai-intelligence-bounty-registry`,Q],[`longzai-intelligence-brawl-stars`,Q],[`longzai-intelligence-broker`,Q],[`longzai-intelligence-bt`,Q],[`longzai-intelligence-business-plan`,Q],[`longzai-intelligence-calendar`,Q],[`longzai-intelligence-camera`,Q],[`longzai-intelligence-canvas`,Q],[`longzai-intelligence-capture`,Q],[`longzai-intelligence-change-maker`,Q],[`longzai-intelligence-changelog`,Q],[`longzai-intelligence-changeset`,Q],[`longzai-intelligence-chat`,Q],[`longzai-intelligence-chess`,Q],[`longzai-intelligence-circuit`,Q],[`longzai-intelligence-claude-code`,Q],[`longzai-intelligence-claude-knowledge`,Q],[`longzai-intelligence-clipboard-share`,Q],[`longzai-intelligence-closed-loop`,Q],[`longzai-intelligence-closed-loop-data`,Q],[`longzai-intelligence-closed-loop-markdown`,Q],[`longzai-intelligence-cloud`,Q],[`longzai-intelligence-code`,Q],[`longzai-intelligence-code-agent`,Q],[`longzai-intelligence-code-reviewer`,Q],[`longzai-intelligence-codebase-research`,Q],[`longzai-intelligence-coding-expert`,Q],[`longzai-intelligence-collaboration`,Q],[`longzai-intelligence-collective`,Q],[`longzai-intelligence-commerce`,Q],[`longzai-intelligence-commit`,Q],[`longzai-intelligence-competition-registry`,Q],[`longzai-intelligence-composer`,Q],[`longzai-intelligence-concrete`,Q],[`longzai-intelligence-concrete-industry`,Q],[`longzai-intelligence-config-registry`,Q],[`longzai-intelligence-context`,Q],[`longzai-intelligence-contract`,Q],[`longzai-intelligence-contract-parity`,Q],[`longzai-intelligence-cookery`,Q],[`longzai-intelligence-country`,Q],[`longzai-intelligence-creativity`,Q],[`longzai-intelligence-cross-platform`,Q],[`longzai-intelligence-crossref`,Q],[`longzai-intelligence-crossref-markdown`,Q],[`longzai-intelligence-crypto`,Q],[`longzai-intelligence-customer-service`,Q],[`longzai-intelligence-cut`,Q],[`longzai-intelligence-dag`,Q],[`longzai-intelligence-dashboard`,Q],[`longzai-intelligence-data`,Q],[`longzai-intelligence-data-science`,Q],[`longzai-intelligence-database`,Q],[`longzai-intelligence-decenterlization`,Q],[`longzai-intelligence-decision`,Q],[`longzai-intelligence-deepseek`,Q],[`longzai-intelligence-deepseek-harness`,Q],[`longzai-intelligence-deepseek-harness-knowledge`,Q],[`longzai-intelligence-delta`,Q],[`longzai-intelligence-deploy`,Q],[`longzai-intelligence-design`,Q],[`longzai-intelligence-design-lab`,Q],[`longzai-intelligence-design-registry`,Q],[`longzai-intelligence-design-trending`,Q],[`longzai-intelligence-device`,Q],[`longzai-intelligence-dimensions`,Q],[`longzai-intelligence-discipline`,Q],[`longzai-intelligence-discovery`,Q],[`longzai-intelligence-disk-space`,Q],[`longzai-intelligence-disk-space-data`,Q],[`longzai-intelligence-disk-space-markdown`,Q],[`longzai-intelligence-distill`,Q],[`longzai-intelligence-docs`,Q],[`longzai-intelligence-docs-registry`,Q],[`longzai-intelligence-document`,Q],[`longzai-intelligence-douyin`,Q],[`longzai-intelligence-douyin-data`,Q],[`longzai-intelligence-douyin-markdown`,Q],[`longzai-intelligence-drone`,Q],[`longzai-intelligence-edge`,Q],[`longzai-intelligence-electrobun`,Q],[`longzai-intelligence-elysia`,Q],[`longzai-intelligence-embodied`,Q],[`longzai-intelligence-empowerment`,Q],[`longzai-intelligence-engineering`,Q],[`longzai-intelligence-env`,Q],[`longzai-intelligence-env-registry`,Q],[`longzai-intelligence-equilibrium`,Q],[`longzai-intelligence-eslint`,Q],[`longzai-intelligence-event`,Q],[`longzai-intelligence-event-tracking`,Q],[`longzai-intelligence-evolution`,Q],[`longzai-intelligence-excel`,Q],[`longzai-intelligence-exchange-rate`,Q],[`longzai-intelligence-execution`,Q],[`longzai-intelligence-experience`,Q],[`longzai-intelligence-expert`,Q],[`longzai-intelligence-expert-thinking`,Q],[`longzai-intelligence-fde`,Q],[`longzai-intelligence-feature-flags`,Q],[`longzai-intelligence-features`,Q],[`longzai-intelligence-federation`,Q],[`longzai-intelligence-feed`,Q],[`longzai-intelligence-feishu`,Q],[`longzai-intelligence-fields-medal-knowledge`,Q],[`longzai-intelligence-file-processing`,Q],[`longzai-intelligence-findings`,Q],[`longzai-intelligence-fitness`,Q],[`longzai-intelligence-font`,Q],[`longzai-intelligence-game`,Q],[`longzai-intelligence-game-studio`,Q],[`longzai-intelligence-gantt`,Q],[`longzai-intelligence-gateway`,Q],[`longzai-intelligence-geo`,Q],[`longzai-intelligence-gesture`,Q],[`longzai-intelligence-git`,Q],[`longzai-intelligence-git-commit`,Q],[`longzai-intelligence-git-insight`,Q],[`longzai-intelligence-git-reviewer`,Q],[`longzai-intelligence-git-swarm`,Q],[`longzai-intelligence-git-swarm-registry`,Q],[`longzai-intelligence-gitcode`,Q],[`longzai-intelligence-github-data`,Q],[`longzai-intelligence-github-markdown`,Q],[`longzai-intelligence-github-trending`,Q],[`longzai-intelligence-github-trending-data`,Q],[`longzai-intelligence-github-trending-markdown`,Q],[`longzai-intelligence-globals`,Q],[`longzai-intelligence-growth`,Q],[`longzai-intelligence-growth-registry`,Q],[`longzai-intelligence-handover`,Q],[`longzai-intelligence-hardware`,Q],[`longzai-intelligence-harness`,Q],[`longzai-intelligence-healthcare`,Q],[`longzai-intelligence-history`,Q],[`longzai-intelligence-horizon`,Q],[`longzai-intelligence-human-resource`,Q],[`longzai-intelligence-i18n`,Q],[`longzai-intelligence-idea`,Q],[`longzai-intelligence-identity`,Q],[`longzai-intelligence-ime`,Q],[`longzai-intelligence-impact-maker`,Q],[`longzai-intelligence-inbox`,Q],[`longzai-intelligence-inbox-registry`,Q],[`longzai-intelligence-input-data`,Q],[`longzai-intelligence-input-markdown`,Q],[`longzai-intelligence-insight`,Q],[`longzai-intelligence-intellectual-property`,Q],[`longzai-intelligence-intent`,Q],[`longzai-intelligence-intentionomics`,Q],[`longzai-intelligence-interview`,Q],[`longzai-intelligence-issues`,Q],[`longzai-intelligence-jev`,Q],[`longzai-intelligence-jev-knowledge`,Q],[`longzai-intelligence-jev-system`,Q],[`longzai-intelligence-journal-of-finance-data`,Q],[`longzai-intelligence-journal-of-financial-and-quantitative-analysis-data`,Q],[`longzai-intelligence-journal-of-financial-economics-data`,Q],[`longzai-intelligence-journals`,Q],[`longzai-intelligence-journals-2026-10`,Q],[`longzai-intelligence-journals-markdown`,Q],[`longzai-intelligence-journals-registry`,Q],[`longzai-intelligence-key-management`,Q],[`longzai-intelligence-knowledge`,Q],[`longzai-intelligence-knowledge-graph`,Q],[`longzai-intelligence-knowledge-markdown`,Q],[`longzai-intelligence-kol`,Q],[`longzai-intelligence-kol-data`,Q],[`longzai-intelligence-kol-markdown`,Q],[`longzai-intelligence-kol-registry`,Q],[`longzai-intelligence-language-model`,Q],[`longzai-intelligence-law`,Q],[`longzai-intelligence-law-data`,Q],[`longzai-intelligence-law-markdown`,Q],[`longzai-intelligence-lean`,Q],[`longzai-intelligence-ledger`,Q],[`longzai-intelligence-legal`,Q],[`longzai-intelligence-liquid-glass`,Q],[`longzai-intelligence-living-previewer`,Q],[`longzai-intelligence-loop`,Q],[`longzai-intelligence-machine-learning`,Q],[`longzai-intelligence-mail`,Q],[`longzai-intelligence-mandala`,Q],[`longzai-intelligence-map`,Q],[`longzai-intelligence-markdown`,Q],[`longzai-intelligence-marketing`,Q],[`longzai-intelligence-marketplace`,Q],[`longzai-intelligence-math`,Q],[`longzai-intelligence-mcn`,Q],[`longzai-intelligence-mcp`,Q],[`longzai-intelligence-mechanisms`,Q],[`longzai-intelligence-mechanisms-registry`,Q],[`longzai-intelligence-media`,Q],[`longzai-intelligence-meditation`,Q],[`longzai-intelligence-meeting-notes`,Q],[`longzai-intelligence-memory`,Q],[`longzai-intelligence-mentor`,Q],[`longzai-intelligence-messaging`,Q],[`longzai-intelligence-mindset`,Q],[`longzai-intelligence-minimax-knowldege`,Q],[`longzai-intelligence-mission-control`,Q],[`longzai-intelligence-model-fusion`,Q],[`longzai-intelligence-model-gateway`,Q],[`longzai-intelligence-moment`,Q],[`longzai-intelligence-montage`,Q],[`longzai-intelligence-movie`,Q],[`longzai-intelligence-music-video`,Q],[`longzai-intelligence-music-video-data`,Q],[`longzai-intelligence-narrative-analyzer`,Q],[`longzai-intelligence-nation`,Q],[`longzai-intelligence-nginx`,Q],[`longzai-intelligence-nginx-cli`,Q],[`longzai-intelligence-nobel-prize-knowledge`,Q],[`longzai-intelligence-notification`,Q],[`longzai-intelligence-npm`,Q],[`longzai-intelligence-npm-registry`,Q],[`longzai-intelligence-npm-registry-data`,Q],[`longzai-intelligence-observability`,Q],[`longzai-intelligence-office-industry`,Q],[`longzai-intelligence-okr-data`,Q],[`longzai-intelligence-okr-markdown`,Q],[`longzai-intelligence-older`,Q],[`longzai-intelligence-one`,Q],[`longzai-intelligence-one-digest`,Q],[`longzai-intelligence-one-digest-data`,Q],[`longzai-intelligence-one-digest-markdown`,Q],[`longzai-intelligence-one-digest-registry`,Q],[`longzai-intelligence-one-trae-works`,Q],[`longzai-intelligence-ontology`,Q],[`longzai-intelligence-open-pencil`,Q],[`longzai-intelligence-open-router`,Q],[`longzai-intelligence-open-router-data`,Q],[`longzai-intelligence-open-router-markdown`,Q],[`longzai-intelligence-opencode`,Q],[`longzai-intelligence-opencode-knowledge`,Q],[`longzai-intelligence-opportunity`,Q],[`longzai-intelligence-orchestry`,Q],[`longzai-intelligence-organization`,Q],[`longzai-intelligence-orm`,Q],[`longzai-intelligence-outfit`,Q],[`longzai-intelligence-outsourcing`,Q],[`longzai-intelligence-overseas`,Q],[`longzai-intelligence-pagination`,Q],[`longzai-intelligence-panel`,Q],[`longzai-intelligence-paper-reader`,Q],[`longzai-intelligence-parametric-industry`,Q],[`longzai-intelligence-partner`,Q],[`longzai-intelligence-pay`,Q],[`longzai-intelligence-payment`,Q],[`longzai-intelligence-permission`,Q],[`longzai-intelligence-personal-assistant`,Q],[`longzai-intelligence-philosophy`,Q],[`longzai-intelligence-philosophy-markdown`,Q],[`longzai-intelligence-philosophy-ontology`,Q],[`longzai-intelligence-pi-knowledge`,Q],[`longzai-intelligence-pii`,Q],[`longzai-intelligence-pipeline`,Q],[`longzai-intelligence-pitfalls`,Q],[`longzai-intelligence-plugin-registry`,Q],[`longzai-intelligence-pm2`,Q],[`longzai-intelligence-policy-research`,Q],[`longzai-intelligence-port`,Q],[`longzai-intelligence-portal`,Q],[`longzai-intelligence-previewer`,Q],[`longzai-intelligence-prezi`,Q],[`longzai-intelligence-prisma`,Q],[`longzai-intelligence-process-monitor`,Q],[`longzai-intelligence-product-requirement`,Q],[`longzai-intelligence-product-research`,Q],[`longzai-intelligence-programming-language`,Q],[`longzai-intelligence-project`,Q],[`longzai-intelligence-project-data`,Q],[`longzai-intelligence-project-markdown`,Q],[`longzai-intelligence-project-portfolio`,Q],[`longzai-intelligence-project-registry`,Q],[`longzai-intelligence-promotion`,Q],[`longzai-intelligence-proposals`,Q],[`longzai-intelligence-prospect`,Q],[`longzai-intelligence-psychoanalyst`,Q],[`longzai-intelligence-publication`,Q],[`longzai-intelligence-qcloud`,Q],[`longzai-intelligence-quant`,Q],[`longzai-intelligence-queue`,Q],[`longzai-intelligence-quick-notes`,Q],[`longzai-intelligence-react-devtools`,Q],[`longzai-intelligence-react-native`,Q],[`longzai-intelligence-reader`,Q],[`longzai-intelligence-reading-distinction`,Q],[`longzai-intelligence-reading-shanhaijing`,Q],[`longzai-intelligence-readme`,Q],[`longzai-intelligence-reasoning`,Q],[`longzai-intelligence-records`,Q],[`longzai-intelligence-recruitment`,Q],[`longzai-intelligence-reflections`,Q],[`longzai-intelligence-release`,Q],[`longzai-intelligence-release-markdown`,Q],[`longzai-intelligence-reliability`,Q],[`longzai-intelligence-remote-desktop`,Q],[`longzai-intelligence-remote-machine`,Q],[`longzai-intelligence-remote-machine-registry`,Q],[`longzai-intelligence-remotion`,Q],[`longzai-intelligence-report`,Q],[`longzai-intelligence-repository`,Q],[`longzai-intelligence-repository-handover`,Q],[`longzai-intelligence-research-report`,Q],[`longzai-intelligence-research-report-data`,Q],[`longzai-intelligence-research-report-markdown`,Q],[`longzai-intelligence-research-report-registry`,Q],[`longzai-intelligence-resilience`,Q],[`longzai-intelligence-reverse-engineering`,Q],[`longzai-intelligence-review-of-financial-studies-data`,Q],[`longzai-intelligence-reviewer`,Q],[`longzai-intelligence-risk`,Q],[`longzai-intelligence-roadmap`,Q],[`longzai-intelligence-roadmap-data`,Q],[`longzai-intelligence-roadmap-markdown`,Q],[`longzai-intelligence-router`,Q],[`longzai-intelligence-rss`,Q],[`longzai-intelligence-rss-markdown`,Q],[`longzai-intelligence-runtime`,Q],[`longzai-intelligence-runtime-registry`,Q],[`longzai-intelligence-sales`,Q],[`longzai-intelligence-scanner`,Q],[`longzai-intelligence-schedule-markdown`,Q],[`longzai-intelligence-schedule-registry`,Q],[`longzai-intelligence-scheduler`,Q],[`longzai-intelligence-schema`,Q],[`longzai-intelligence-scope`,Q],[`longzai-intelligence-scrape`,Q],[`longzai-intelligence-screenshots`,Q],[`longzai-intelligence-scripts-registry`,Q],[`longzai-intelligence-search`,Q],[`longzai-intelligence-security`,Q],[`longzai-intelligence-security-bounty-registry`,Q],[`longzai-intelligence-security-inventory`,Q],[`longzai-intelligence-serverless`,Q],[`longzai-intelligence-share`,Q],[`longzai-intelligence-sheet`,Q],[`longzai-intelligence-short-video`,Q],[`longzai-intelligence-skill`,Q],[`longzai-intelligence-slider`,Q],[`longzai-intelligence-smart-transition`,Q],[`longzai-intelligence-sms`,Q],[`longzai-intelligence-software-factory`,Q],[`longzai-intelligence-soul`,Q],[`longzai-intelligence-specs`,Q],[`longzai-intelligence-spline`,Q],[`longzai-intelligence-sports`,Q],[`longzai-intelligence-ssl`,Q],[`longzai-intelligence-startup`,Q],[`longzai-intelligence-state-machine`,Q],[`longzai-intelligence-storage`,Q],[`longzai-intelligence-strategy`,Q],[`longzai-intelligence-strategy-consulting`,Q],[`longzai-intelligence-strategy-consulting-data`,Q],[`longzai-intelligence-strategy-consulting-markdown`,Q],[`longzai-intelligence-supply-chain`,Q],[`longzai-intelligence-support`,Q],[`longzai-intelligence-survey`,Q],[`longzai-intelligence-system`,Q],[`longzai-intelligence-system-data`,Q],[`longzai-intelligence-system-markdown`,Q],[`longzai-intelligence-system-registry`,Q],[`longzai-intelligence-talk`,Q],[`longzai-intelligence-taro`,Q],[`longzai-intelligence-task`,Q],[`longzai-intelligence-task-data`,Q],[`longzai-intelligence-task-markdown`,Q],[`longzai-intelligence-telemetry`,Q],[`longzai-intelligence-templates`,Q],[`longzai-intelligence-tenant`,Q],[`longzai-intelligence-terminal`,Q],[`longzai-intelligence-testing`,Q],[`longzai-intelligence-thinking`,Q],[`longzai-intelligence-token-exchange`,Q],[`longzai-intelligence-token-finance`,Q],[`longzai-intelligence-token-handover`,Q],[`longzai-intelligence-toolchain`,Q],[`longzai-intelligence-topology`,Q],[`longzai-intelligence-tracking-bennett-brassard`,Q],[`longzai-intelligence-tracking-deng-yu`,Q],[`longzai-intelligence-tracking-hong-wang`,Q],[`longzai-intelligence-tracking-jacob-tsimerman`,Q],[`longzai-intelligence-tracking-john-clarke`,Q],[`longzai-intelligence-tracking-john-martinis`,Q],[`longzai-intelligence-tracking-john-pardon`,Q],[`longzai-intelligence-tracking-michel-devoret`,Q],[`longzai-intelligence-tracking-nation`,Q],[`longzai-intelligence-tracking-qbitai`,Q],[`longzai-intelligence-tracking-terrytao`,Q],[`longzai-intelligence-tracking-xiao-lin`,Q],[`longzai-intelligence-tracking-yu-bo`,Q],[`longzai-intelligence-trader`,Q],[`longzai-intelligence-trae`,Q],[`longzai-intelligence-training-data`,Q],[`longzai-intelligence-translator`,Q],[`longzai-intelligence-travel`,Q],[`longzai-intelligence-trending`,Q],[`longzai-intelligence-tsconfig`,Q],[`longzai-intelligence-tsdoc`,Q],[`longzai-intelligence-tsgo`,Q],[`longzai-intelligence-turbo`,Q],[`longzai-intelligence-turing-award-knowledge`,Q],[`longzai-intelligence-twitter`,Q],[`longzai-intelligence-twitter-data`,Q],[`longzai-intelligence-twitter-markdown`,Q],[`longzai-intelligence-typeorm`,Q],[`longzai-intelligence-usecase`,Q],[`longzai-intelligence-user-experience`,Q],[`longzai-intelligence-user-research`,Q],[`longzai-intelligence-userscript`,Q],[`longzai-intelligence-utils`,Q],[`longzai-intelligence-value-chain`,Q],[`longzai-intelligence-vector-search`,Q],[`longzai-intelligence-vendor`,Q],[`longzai-intelligence-venture-capital`,Q],[`longzai-intelligence-version`,Q],[`longzai-intelligence-video-generation`,Q],[`longzai-intelligence-video-player`,Q],[`longzai-intelligence-vite`,Q],[`longzai-intelligence-voice`,Q],[`longzai-intelligence-voice-recorder`,Q],[`longzai-intelligence-vscode-developer`,Q],[`longzai-intelligence-vuln`,Q],[`longzai-intelligence-vuln-data`,Q],[`longzai-intelligence-vuln-markdown`,Q],[`longzai-intelligence-vuln-registry`,Q],[`longzai-intelligence-warehouse`,Q],[`longzai-intelligence-wealth`,Q],[`longzai-intelligence-web3`,Q],[`longzai-intelligence-webhook`,Q],[`longzai-intelligence-websocket`,Q],[`longzai-intelligence-wechat`,Q],[`longzai-intelligence-wechat-miniprogram`,Q],[`longzai-intelligence-wechat-pay`,Q],[`longzai-intelligence-wifi`,Q],[`longzai-intelligence-wiki`,Q],[`longzai-intelligence-word`,Q],[`longzai-intelligence-work`,Q],[`longzai-intelligence-worker`,Q],[`longzai-intelligence-workflow`,Q],[`longzai-intelligence-workflow-data`,Q],[`longzai-intelligence-workflow-markdown`,Q],[`longzai-intelligence-workflow-registry`,Q],[`longzai-intelligence-workspace`,Q],[`longzai-intelligence-writer`,Q],[`longzai-intelligence-xiaohongshu`,Q],[`longzai-intelligence-xiaohongshu-data`,Q],[`longzai-intelligence-xiaohongshu-markdown`,Q],[`longzai-intelligence-youtube`,Q],[`longzai-intelligence-youtube-data`,Q],[`longzai-intelligence-youtube-markdown`,Q],[`longzai-intelligence-zcode`,Q],[`longzai-intelligence-zcode-cleaner`,Q],[`longzai-intelligence-zcode-commit`,Q],[`longzai-intelligence-zcode-knowledge`,Q],[`longzai-intelligence-zcode-remote`,Q],[`longzai-intelligence-zcode-security`,Q],[`longzai-intelligence-zed-delta-knowledge`,Q],[`longzai-intelligence-zhihu`,Q],[`longzai-intelligence-zhihu-data`,Q],[`longzai-intelligence-zhihu-markdown`,Q]]),_f=`LZI_GLOBALS_ROOT`,vf=`lzi-bun-install.config.ts`,yf=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;var bf=class extends Error{details;constructor(e,t=`install.extraScopes`){super(`${t} 校验失败:\n${e.map(e=>`- ${e}`).join(`
209
+ `)}`),this.name=`InstallScopesError`,this.details=e}};function xf(e){if(typeof e!=`string`)return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Sf(e,t,n,r){let i=e instanceof Map?Object.fromEntries(e):{...e},a=[],o={};for(let[n,i]of Object.entries(t??{})){let t=n.replace(/^@+/,``);t.length===0||!yf.test(t)?a.push(`\`${n}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,@ 前缀可省略)`):xf(i)?o[t]!==void 0&&o[t]!==i?a.push(`\`${t}\` 在 extraScopes 内重复声明且安装源不一致`):(e instanceof Map?e.has(t):Object.hasOwn(e,t))?a.push(`\`${t}\` 与预定义 scope 冲突(预定义不可覆盖,如需调整请在 ${r} 维护)`):o[t]=i:a.push(`\`${n}\` 的安装源 \`${String(i)}\` 不是合法的 http/https URL`)}let s=/* @__PURE__ */ new Set;for(let e of n??[]){let t=e.replace(/^@+/,``);t.length===0||!yf.test(t)?a.push(`\`${e}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,@ 前缀可省略)`):o[t]===void 0?s.add(t):a.push(`\`${t}\` 同时出现在 extraScopes 与 privateScopes(追加公网安装源与私有轨声明矛盾)`)}if(a.length>0)throw new bf(a);for(let[e,t]of Object.entries(o))i[e]=t;for(let e of s)delete i[e];return i}function Cf(e,t,n,r){let i=Sf(e,t,n,`globals 仓 lzi-bun-install.config.ts`),a=r?.replace(/^@+/,``),o=new Set((n??[]).map(e=>e.replace(/^@+/,``)));return a!==void 0&&yf.test(a)&&!Object.hasOwn(i,a)&&!o.has(a)&&(i[a]=`https://registry.npmjs.org/`),i}function wf(e){let t=[];if(typeof e!=`object`||!e)throw new bf([`default export 必须是对象({ scopes: { ... } })`],`globals 预设 lzi-bun-install.config.ts`);let n=typeof e==`object`&&e&&`scopes`in e?e.scopes:void 0;if(typeof n!=`object`||!n||Array.isArray(n))throw new bf([`scopes 必须是 scope → registry 的对象映射`],`globals 预设 lzi-bun-install.config.ts`);let r={};for(let[e,i]of Object.entries(n))yf.test(e)?typeof i!=`string`||!xf(i)?t.push(`\`${e}\` 的安装源 \`${String(i)}\` 不是合法的 http/https URL`):r[e]=i:t.push(`\`${e}\` 不是合法 scope 名(仅允许字母/数字开头,后接字母/数字与 . _ -,不含 @ 前缀)`);if(t.length>0)throw new bf(t,`globals 预设 lzi-bun-install.config.ts`);if(Object.keys(r).length===0)throw new bf([`scopes 清单为空(真源不允许空清单)`],`globals 预设 lzi-bun-install.config.ts`);return r}var Tf=class extends Error{configPath;constructor(e,t,n){super(e,n),this.name=`SharedConfigError`,this.configPath=t}},Ef=class extends Tf{searchFrom;constructor(e){super(`未在 ${e} 找到配置文件`,e),this.name=`SharedConfigNotFoundError`,this.searchFrom=e}},Df=class extends Tf{issues;constructor(e,t){super(`配置校验失败,共 ${e.length} 个问题`,t),this.name=`SharedConfigValidationError`,this.issues=e}};function Of(e,t,n,r){let i=e;if(r.schema!==void 0){let e=r.schema.safeParse(i);if(!e.success)throw new Df(e.error.issues,t);i=e.data}return r.transform!==void 0&&(i=r.transform(i,n)),i}function kf(e){return e instanceof Error&&e.message.length>0?`,底层原因为 ${e.name}: ${e.message}`:``}var Af=class extends Tf{cause;constructor(e,t){super(`加载配置文件 ${e} 失败${kf(t)}`,e,{cause:t}),this.name=`SharedConfigLoadError`,this.cause=t}};function jf(e){return typeof e==`object`&&!!e}function Mf(e){return typeof e==`object`&&!!e}async function Nf(e,t={}){let r=d(e);if(!n(r))throw new Ef(r);let i;try{let e=await import(r);i=jf(e)?e.default:void 0}catch(e){throw new Af(r,e)}if(i===void 0)throw new Af(r,TypeError(`配置文件缺少默认导出`));if(!Mf(i))throw new Af(r,TypeError(`配置文件的默认导出必须是对象`));return{config:Of(i,r,c(r),t),configFilePath:r}}function Pf(e=process.cwd()){let t=d(e);for(;;){let e=l(t,`lzi.config.ts`);if(n(e))return e;let r=c(t);if(r===t)return null;t=r}}async function Ff(e={}){let t=e.cwd??process.cwd(),n=Pf(t);if(n===null)throw new Ef(t);let r=d(n,`..`),{config:i}=await Nf(n);return{config:i,configPath:r,configFilePath:n}}function If(e){return typeof e==`object`&&!!e}async function Lf(e){let t;try{t=await x(e)}catch(t){throw new Af(e,t)}let n=t.filter(e=>e.endsWith(`.config.ts`)).sort();if(n.length===0)throw new Af(e,Error(`配置目录内没有 .config.ts 分片文件`));let r={};for(let t of n){let n=await Nf(l(e,t));r={...r,...n.config}}let i=r;if(!If(i))throw new Af(e,Error(`配置目录合并结果不是对象形态`));return i}function Rf(e,t=process.cwd()){let n=Array.isArray(e)?e:[e],r=d(t);for(;;){for(let e of n){let t=l(r,e);if(zf(t))return t}let e=c(r);if(e===r)return null;r=e}}function zf(e){try{return o(e).isDirectory()}catch{return!1}}function Bf(e,t=process.cwd()){let r=Array.isArray(e)?e:[e],i=d(t);for(;;){for(let e of r){let t=l(i,e);if(n(t))return t}let e=c(i);if(e===i)return null;i=e}}function Vf(e){return typeof e==`object`&&!!e}function Hf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Uf(e={}){let t=e.cwd??d(process.cwd());if(e.explicitPath!==void 0){let t=await Nf(e.explicitPath,{schema:e.schema,transform:e.transform});return{success:!0,config:t.config,source:`explicit`,configFilePath:t.configFilePath}}if(e.standaloneFile!==void 0){let n=Bf(e.standaloneFile,t);if(n!==null){let{config:t}=await Nf(n);return{success:!0,config:Of(t,n,c(n),e),source:`standalone`,configFilePath:n}}}if(e.standaloneDir!==void 0){let n=Rf(e.standaloneDir,t);if(n!==null)return{success:!0,config:Of(await Lf(n),n,n,e),source:`standalone`,configFilePath:n}}if(e.unifiedField!==void 0){let n,r;try{let{config:i,configFilePath:a}=await Ff({cwd:t}),o=i;n=Hf(o)?o[e.unifiedField]:void 0,r=a}catch(e){if(!(e instanceof Ef))throw e}if(r!==void 0&&n!==void 0&&Vf(n))return{success:!0,config:Of(n,r,c(r),e),source:`unified`,configFilePath:r}}return{success:!1,configFilePath:null}}const Wf=[`packages/*`,`apps/*`];function Gf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kf(e){if(Array.isArray(e))return e.every(e=>typeof e==`string`)?e:void 0;if(Gf(e)){let t=e.packages;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return{packages:t}}}function qf(e){let t=d(e,`package.json`);if(!n(t))throw new Ef(e);let r;try{let e=JSON.parse(i(t,`utf8`));r=Gf(e)?Kf(e.workspaces):void 0}catch(e){throw new Af(t,e)}let a=Array.isArray(r)?r:r?.packages;return a&&a.length>0?a:Wf}async function Jf(e,t={}){let r=qf(e),a=/* @__PURE__ */ new Set,o=[];for(let s of r){let r=new Bun.Glob(`${s}/package.json`);for await(let s of r.scan({cwd:e,absolute:!0,onlyFiles:!0})){let e=d(s,`..`);if(a.has(e))continue;let r;try{let e=JSON.parse(i(s,`utf8`));r=typeof e==`object`&&e?e:void 0}catch{continue}r!==void 0&&typeof r.name==`string`&&r.name.length!==0&&(t.configFileName!==void 0&&!n(d(e,t.configFileName))||(a.add(e),o.push({name:r.name,dir:e})))}}return o}var Yf=class extends Error{bunfigPath;reason;constructor(e,t){super(`${e} 校验失败:${t};请运行 bun run bun-config:generate 后重试`),this.name=`BunfigDriftError`,this.bunfigPath=e,this.reason=t}},Xf=class extends Error{bunfigPath;constructor(e){super(`${e} 已存在且非 lzi-bun-cli 生成(缺少 @lzi-bun-cli 自动生成,请勿编辑 标记),如需 lzi-bun-cli 接管,请删除该文件或手动合并后重试`),this.name=`BunfigProtectedError`,this.bunfigPath=e}};function Zf(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Qf(e,t){let n=e.map(e=>Zf(e)),r=`[${n.join(`, `)}]`;return`${t} = `.length+r.length<=100?r:`[\n${n.map(e=>` ${e},`).join(`
210
+ `)}\n]`}function $f(e){let t=[`registry = ${Zf(e.registry)}`],n=tp(`linker`,e.linker);n&&t.push(n);let r=tp(`globalStore`,e.globalStore);r&&t.push(r);let i=Object.entries(e.scopes).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${Zf(`@${e}`)} = ${Zf(t)}`),a=[`[install]\n${t.join(`
211
211
  `)}`];return i.length>0&&a.push(`[install.scopes]\n${i.join(`
212
212
  `)}`),a.join(`
213
213
 
214
- `)}function $f(e,t,n){return{registry:`https://mirrors.cloud.tencent.com/npm/`,scopes:Sf(t,e?.extraScopes,e?.privateScopes,n),linker:e?.linker,globalStore:e?.globalStore}}function ep(e,t){if(t!==void 0){if(typeof t==`boolean`||typeof t==`number`)return`${e} = ${t}`;if(typeof t==`string`)return`${e} = ${Xf(t)}`;if(Array.isArray(t))return t.length===0?void 0:`${e} = ${Zf(t,e)}`}}function tp(e){let t=[];e.install&&t.push(Qf(e.install));let n=e.test,r=[],i=ep(`preload`,n.preload);i&&r.push(i);let a=ep(`coverage`,n.coverage);a&&r.push(a);let o=ep(`coverageSkipTestFiles`,n.coverageSkipTestFiles);o&&r.push(o);let s=ep(`coverageReporter`,n.coverageReporter);s&&r.push(s);let c=ep(`coverageDir`,n.coverageDir);c&&r.push(c);let l=ep(`coveragePathIgnorePatterns`,n.coveragePathIgnorePatterns);l&&r.push(l);let u=ep(`coverageIgnoreSourcemaps`,n.coverageIgnoreSourcemaps);u&&r.push(u);let d=ep(`timeout`,n.timeout);return d&&r.push(d),r.length>0&&t.push(`[test]\n${r.join(`
214
+ `)}function ep(e,t,n){return{registry:`https://mirrors.cloud.tencent.com/npm/`,scopes:Cf(t,e?.extraScopes,e?.privateScopes,n),linker:e?.linker,globalStore:e?.globalStore}}function tp(e,t){if(t!==void 0){if(typeof t==`boolean`||typeof t==`number`)return`${e} = ${t}`;if(typeof t==`string`)return`${e} = ${Zf(t)}`;if(Array.isArray(t))return t.length===0?void 0:`${e} = ${Qf(t,e)}`}}function np(e){let t=[];e.install&&t.push($f(e.install));let n=e.test,r=[],i=tp(`preload`,n.preload);i&&r.push(i);let a=tp(`coverage`,n.coverage);a&&r.push(a);let o=tp(`coverageSkipTestFiles`,n.coverageSkipTestFiles);o&&r.push(o);let s=tp(`coverageReporter`,n.coverageReporter);s&&r.push(s);let c=tp(`coverageDir`,n.coverageDir);c&&r.push(c);let l=tp(`coveragePathIgnorePatterns`,n.coveragePathIgnorePatterns);l&&r.push(l);let u=tp(`coverageIgnoreSourcemaps`,n.coverageIgnoreSourcemaps);u&&r.push(u);let d=tp(`timeout`,n.timeout);return d&&r.push(d),r.length>0&&t.push(`[test]\n${r.join(`
215
215
  `)}`),`# @lzi-bun-cli 自动生成,请勿编辑\n${t.join(`
216
216
 
217
- `)}\n`}function np(e,t={}){let n=t.isRoot===!0,r=e?.test,i=r?r.coverage!==void 0||r.coverageThreshold!==void 0||r.coveragePathIgnorePatterns!==void 0||r.coverageReporter!==void 0||r.coverageSkipTestFiles!==void 0||r.coverageDir!==void 0||r.preload!==void 0||r.timeout!==void 0:!1;if(!n&&!i)return null;let a={test:r??{}};if(n){if(t.installScopesPreset===void 0)throw Error(`root bunfig 生成需要 globals 仓 install scopes 预设(LZI_GLOBALS_ROOT 定位 longzai-intelligence-globals → lzi-bun-install.config.ts),调用方应先解析并加载`);a.install=$f(t.repoInstall,t.installScopesPreset,t.selfScope)}return{content:tp(a),shouldWrite:!0}}function rp(e){let t=0,n=0,r=0,i=0;for(let a of e.split(`
218
- `)){let e=a.trimEnd();e.startsWith(`LF:`)?t+=Number.parseInt(e.slice(3),10)||0:e.startsWith(`LH:`)?n+=Number.parseInt(e.slice(3),10)||0:e.startsWith(`FNF:`)?r+=Number.parseInt(e.slice(4),10)||0:e.startsWith(`FNH:`)&&(i+=Number.parseInt(e.slice(4),10)||0)}return{linesFound:t,linesHit:n,functionsFound:r,functionsHit:i}}function ip(e){return typeof e==`number`?{lines:e,functions:e,statements:e}:{...e}}function ap(e,t){if(!(t<=0))return e/t}function op(e,t){let n=ip(t),r=ap(e.linesHit,e.linesFound),i=ap(e.functionsHit,e.functionsFound),a=[];return n.lines!==void 0&&a.push({dimension:`lines`,actual:r,required:n.lines}),n.functions!==void 0&&a.push({dimension:`functions`,actual:i,required:n.functions}),n.statements!==void 0&&a.push({dimension:`statements`,actual:r,required:n.statements}),{passed:a.every(e=>e.actual===void 0||e.actual>=e.required),results:a}}function sp(e){return`${(e*100).toFixed(2)}%`}function cp(e){return e.results.map(e=>{let t=e.actual===void 0?`无数据`:sp(e.actual),n=e.actual===void 0||e.actual>=e.required?`通过`:`未达标`;return`${e.dimension} 覆盖率 ${t},阈值 ${sp(e.required)},${n}`})}var lp=class extends Error{details;constructor(e,t){let n=t.flatMap(e=>e.details.map(t=>`${up(e.kind)}:${t}`));super(`${e} 的测试配置违反分层规则:\n${n.map(e=>` - ${e}`).join(`
219
- `)}`),this.name=`TypeOnlyViolationError`,this.details=n}};function up(e){return e===`exempt-runtime`?`包内代码与声明预设不符`:e===`zero-tests-undeclared`?`包内没有测试,也没有声明允许零测试的预设`:`声明的预设与目录分层不符`}const dp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),fp=e=>Array.isArray(e)||typeof e==`object`&&!!e&&`packages`in e,pp=e=>{let t=l(e,`package.json`);if(!n(t))return`missing-package-json`;let r;try{r=JSON.parse(i(t,`utf8`))}catch{return`not-root`}return dp(r)&&fp(r.workspaces)?`root`:`not-root`},mp=e=>pp(e)===`root`,hp=(e,t)=>{let n=l(e,`package.json`);try{let e=JSON.parse(i(n,`utf8`));if(dp(e)){let t=e.name;if(typeof t==`string`&&t!==``)return t}}catch{}return t},gp=e=>{let t=e.indexOf(`/`);if(!(!e.startsWith(`@`)||t<=1))return e.slice(1,t)},_p={server:`server`,web:`web`,desktop:`desktop`,cli:`cli`,mcp:`mcp`,"desktop-host":`desktop-host`,docs:`docs`,mobile:`mobile`,miniprogram:`miniprogram`},vp={core:`package`,shared:`package`,sdk:`package`},yp=[`contract`,`main`,`implementation`,`infrastructure`,`api`,`ui`];function bp(e){if(e===``)return`root`;let t=e.split(`/`),n=t[0],r=t[1],i=t[2];return n===`domains`?t.length<3||i===void 0?`non-fixed`:yp.find(e=>e===i)??`non-fixed`:n===`apps`?t.length===3&&r===`capabilities`?`capability`:t.length===2&&r!==void 0?_p[r]??`non-fixed`:`non-fixed`:n===`packages`&&t.length===2&&r!==void 0?vp[r]??`non-fixed`:`non-fixed`}const xp=`.lzi/baselines/lzi-bun.typeonly.json`,Sp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Cp=[`exempt-runtime`,`zero-tests-undeclared`,`preset-layer-mismatch`],wp=e=>typeof e==`string`&&Cp.some(t=>t===e);function Tp(e){return`${e.path}|${e.kind}`}function Ep(e){let t=l(e,xp);if(!n(t))return/* @__PURE__ */ new Set;try{let e=JSON.parse(i(t,`utf8`));if(!Sp(e)||!Array.isArray(e.entries))return/* @__PURE__ */ new Set;let n=/* @__PURE__ */ new Set;for(let t of e.entries)Sp(t)&&typeof t.path==`string`&&wp(t.kind)&&n.add(`${t.path}|${t.kind}`);return n}catch{return/* @__PURE__ */ new Set}}function Dp(e,t,n){return e.has(`${t}|${n}`)}function Op(e,t){let n=[...t].sort((e,t)=>Tp(e)<Tp(t)?-1:+(Tp(e)>Tp(t))),i=l(e,xp);r(c(i),{recursive:!0}),s(i,`${JSON.stringify({version:1,entries:n},null,2)}\n`,`utf8`)}function kp(e,t){return[...Ep(e)].filter(e=>!t.has(e))}function Ap(e){let t=e.indexOf(`|`),n=Cp.find(n=>n===e.slice(t+1));return{path:e.slice(0,t),kind:n??`preset-layer-mismatch`}}const jp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Mp=e=>jp(e)&&typeof e.type==`string`;function Np(e){return Mp(e)?e:void 0}function Pp(e){if(Array.isArray(e))return e.every(Mp)?e:void 0}function $(e,t){return Np(e[t])}function Fp(e){if(e!==void 0&&e.type===`Identifier`)return typeof e.name==`string`?e.name:void 0}function Ip(e){return e.type.endsWith(`Literal`)?e.type!==`TemplateLiteral`||e.expressions!==void 0&&Pp(e.expressions)?.length===0:!1}function Lp(e){if(Ip(e)||Rp(e))return!0;if(e.type===`TSAsExpression`||e.type===`TSSatisfiesExpression`){let t=$(e,`expression`);return t!==void 0&&Lp(t)}if(e.type===`UnaryExpression`){let t=$(e,`argument`);return t!==void 0&&Ip(t)}if(e.type===`BinaryExpression`){let t=$(e,`left`),n=$(e,`right`);return t!==void 0&&n!==void 0&&Ip(t)&&Ip(n)}return!1}function Rp(e){if(e.type===`ObjectExpression`){let t=Pp(e.properties);return t!==void 0&&t.every(e=>{if(e.type===`Property`){if(e.computed===!0)return!1;let t=$(e,`value`);return t!==void 0&&Lp(t)}if(e.type===`SpreadElement`){let t=$(e,`argument`);return t!==void 0&&Rp(t)}return!1})}if(e.type===`ArrayExpression`){let t=e.elements;return Array.isArray(t)?t.every(e=>{if(e==null)return!0;let t=Np(e);return t!==void 0&&Lp(t)}):!1}return!1}function zp(e){let t=Fp($(e,`superClass`));if(t===void 0||t!==`Error`&&!t.endsWith(`Error`))return!1;let n=$(e,`body`);if(n===void 0)return!1;let r=Pp(n.body);return r!==void 0&&r.every(e=>{if(e.type===`MethodDefinition`)return e.kind===`constructor`;if(e.type===`PropertyDefinition`){let t=$(e,`value`);return t===void 0||Lp(t)}return!1})}function Bp(e){let t=$(e,`body`);if(t===void 0)return!1;if(t.type!==`BlockStatement`)return!0;let n=Pp(t.body);if(n===void 0||n.length!==1)return!1;let r=n[0];return r!==void 0&&r.type===`ReturnStatement`}function Vp(e){return e?`tsx`:`ts`}function Hp(e,t){let n=$(e,`callee`);if(n===void 0)return!1;if(Fp(n)===`Symbol`)return!0;if(n.type===`MemberExpression`){let e=Fp($(n,`object`));return e!==void 0&&t.zodBindings.has(e)}return!1}function Up(e,t){if(e.type===`TSAsExpression`||e.type===`TSSatisfiesExpression`){let n=$(e,`expression`);if(n!==void 0)return Up(n,t)}if(e.type===`TSInstantiationExpression`){let n=$(e,`expression`);if(n!==void 0)return Up(n,t)}return e.type===`CallExpression`?Hp(e,t)?`declarative`:`runtime`:e.type===`ArrowFunctionExpression`?t.isTsx?`runtime`:Bp(e)?`thin`:`runtime`:e.type===`Identifier`||Lp(e)?`declarative`:`runtime`}function Wp(e,t){switch(e.type){case`TSTypeAliasDeclaration`:case`TSInterfaceDeclaration`:case`TSModuleDeclaration`:case`TSDeclareFunction`:return`type`;case`TSEnumDeclaration`:return`declarative`;case`ClassDeclaration`:return zp(e)?`declarative`:`runtime`;case`FunctionDeclaration`:return t.isTsx?`runtime`:Bp(e)?`thin`:`runtime`;case`VariableDeclaration`:{let n=Pp(e.declarations);if(n===void 0)return`runtime`;let r=`type`;for(let e of n){let n=$(e,`init`),i=n===void 0?`declarative`:Up(n,t);if(i===`runtime`)return`runtime`;i!==`type`&&(r=i)}return r}default:return`runtime`}}function Gp(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`ImportDeclaration`){Kp(t,n,r);continue}let e=$(t,`declaration`);t.type===`ExportNamedDeclaration`&&e!==void 0?qp(i,e):qp(i,t)}return{zodBindings:n,importBindings:r,localDeclarations:i,isTsx:t}}function Kp(e,t,n){let r=$(e,`source`),i=r!==void 0&&typeof r.value==`string`?r.value:void 0,a=Pp(e.specifiers);if(a!==void 0)for(let e of a){let r=Fp($(e,`local`));r!==void 0&&(n.add(r),i===`zod`&&(e.type===`ImportNamespaceSpecifier`&&t.add(r),e.type===`ImportSpecifier`&&Fp($(e,`imported`))===`z`&&t.add(r)))}}function qp(e,t){if(t.type===`FunctionDeclaration`||t.type===`ClassDeclaration`){let n=Fp($(t,`id`));n!==void 0&&e.set(n,t)}else if(t.type===`VariableDeclaration`){let n=Pp(t.declarations);if(n===void 0)return;for(let t of n){let n=Fp($(t,`id`));n!==void 0&&e.set(n,t)}}}function Jp(e){if(e.type===`VariableDeclaration`){let t=Pp(e.declarations),n=t===void 0?void 0:t[0];return(n===void 0?void 0:Fp($(n,`id`)))??`anonymous`}return Fp($(e,`id`))??`anonymous`}function Yp(e,t){let n=Fp($(e,`local`));if(n===void 0)return;let r=Fp($(e,`exported`))??n,i=t.localDeclarations.get(n);if(i!==void 0){let e=$(i,`init`);return{name:r,form:e===void 0?Wp(i,t):Up(e,t)}}if(t.importBindings.has(n))return{name:r,form:`reexport`}}function Xp(e,t){return e.type===`FunctionDeclaration`||e.type===`ClassDeclaration`||e.type===`VariableDeclaration`?Wp(e,t):Up(e,t)}const Zp=/* @__PURE__ */ new Set([`__tests__`,`__mocks__`,`__fixtures__`]),Qp=[`.test.`,`.spec.`,`.d.ts`];function $p(e){return Qp.some(t=>e.includes(t))}function em(e){let t=l(e,`src`);if(!n(t))return[];let r=[],i=(e,t)=>{for(let n of a(e,{withFileTypes:!0})){if(Zp.has(n.name))continue;let a=t===``?n.name:`${t}/${n.name}`;n.isDirectory()?i(l(e,n.name),a):n.isFile()&&(n.name.endsWith(`.ts`)||n.name.endsWith(`.tsx`))&&r.push(`src/${a}`)}};return i(t,``),r}function tm(e,t){let n=Pp(T(e,{sourceType:`module`,lang:Vp(t)}).body)??[],r=Gp(n,t),i=/* @__PURE__ */ new Map,a=(e,t)=>{let n=i.get(e);n===void 0?i.set(e,[t]):n.push(t)};for(let e of n)if(e.type===`ExportAllDeclaration`)a(`reexport`,`*`);else if(e.type===`ExportNamedDeclaration`){if($(e,`source`)!==void 0){a(`reexport`,`named-from`);continue}let t=$(e,`declaration`);if(t!==void 0){a(Wp(t,r),Jp(t));continue}let n=Pp(e.specifiers);if(n===void 0)continue;for(let e of n){let t=Yp(e,r);t!==void 0&&a(t.form,t.name)}}else if(e.type===`ExportDefaultDeclaration`){let t=$(e,`declaration`);if(t===void 0){a(`runtime`,`default`);continue}a(Xp(t,r),`default`)}return i}function nm(e){let t=em(e).filter(e=>!$p(e)),n=[],r=!1,a=!1;for(let o of t){let t;try{t=i(l(e,o),`utf8`)}catch{continue}let s;try{s=tm(t,o.endsWith(`.tsx`))}catch{n.push({file:o,name:`parse-error`,reason:`文件解析失败,无法确认内容,按包含运行时逻辑处理`});continue}let c=s.get(`runtime`);if(c!==void 0)for(let e of c)n.push({file:o,name:e,reason:`这个导出包含运行时逻辑`});s.has(`declarative`)&&(r=!0),(s.has(`thin`)||s.has(`reexport`))&&(a=!0)}return n.length>0?{verdict:`runtime`,runtimeExports:n}:r?{verdict:`declarative`,runtimeExports:[]}:a?{verdict:`facade`,runtimeExports:[]}:{verdict:`pure-type`,runtimeExports:[]}}function rm(e){let t=e;for(;;){if(pp(t)===`root`)return t;let n=c(t);if(n===t)return e;t=n}}const im=/* @__PURE__ */ new Set([`contract`,`main`,`type-only`]),am=/* @__PURE__ */ new Set([`contract`,`main`,`docs`,`type-only`,`root`]),om=[`src/**/*.test.ts`,`src/**/*.test.tsx`,`__tests__/**/*.test.ts`],sm=/* @__PURE__ */ new Set([`root`,`contract`,`main`,`docs`,`domain`,`implementation`,`infrastructure`,`api`,`ui`,`capability`,`mcp`,`desktop-host`,`mobile`,`miniprogram`,`package`,`server`,`web`,`desktop`,`cli`]),cm={root:`@longzai-intelligence-bun/presets/root`,contract:`@longzai-intelligence-bun/presets/contract`,main:`@longzai-intelligence-bun/presets/main`,docs:`@longzai-intelligence-bun/presets/docs`,domain:`@longzai-intelligence-bun/presets/domain`,implementation:`@longzai-intelligence-bun/presets/implementation`,infrastructure:`@longzai-intelligence-bun/presets/infrastructure`,api:`@longzai-intelligence-bun/presets/api`,ui:`@longzai-intelligence-bun/presets/ui`,capability:`@longzai-intelligence-bun/presets/capability`,mcp:`@longzai-intelligence-bun/presets/mcp`,"desktop-host":`@longzai-intelligence-bun/presets/desktop-host`,mobile:`@longzai-intelligence-bun/presets/mobile`,miniprogram:`@longzai-intelligence-bun/presets/miniprogram`,package:`@longzai-intelligence-bun/presets/package`,server:`@longzai-intelligence-bun/presets/server`,web:`@longzai-intelligence-bun/presets/web`,desktop:`@longzai-intelligence-bun/presets/desktop`,cli:`@longzai-intelligence-bun/presets/cli`};async function lm(e){let t=e.config?.preset??`custom`,n=e.config?.preset!==void 0,r=bp(u(e.repoRoot,e.packageDir)),i=[];if(sm.has(t)&&t!==r&&i.push({kind:`preset-layer-mismatch`,details:[dm(t,r)]}),im.has(t)){let n=nm(e.packageDir);n.verdict===`runtime`&&i.push({kind:`exempt-runtime`,details:[`该包声明为 ${t},这个预设只允许纯类型与声明式内容,但扫描发现 ${n.runtimeExports.length} 处包含运行时逻辑的导出`,...n.runtimeExports.slice(0,5).map(e=>`${e.file} 的 ${e.name},${e.reason}`)]})}return await pm(e.config,e.packageDir)===0&&!am.has(t)&&i.push({kind:`zero-tests-undeclared`,details:[um(t,n,r)]}),i}function um(e,t,n){return t?e===`custom`?`该包的 lzi-bun.config.ts 未走预设子路径,包内没有任何测试文件。custom 不在允许零测试的预设之列,允许零测试的预设为 contract、main、docs、type-only 与 root。请补充测试,或改用上述预设子路径之一,改用后命令会扫描包内容,确认内容符合该预设的要求`:`该包声明为 ${e},包内没有任何测试文件。${e} 预设要求包内必须有测试,允许零测试的预设为 contract、main、docs、type-only 与 root。请补充测试`:n===`non-fixed`?`lzi-bun.config.ts 已加载,但结果里没有预设标记。常见原因是配置仍用旧具名工厂,或依赖停留在旧版本。本包目录没有固定分层,请改用 @longzai-intelligence-bun/presets/type-only 子路径的 defineConfig 声明,并保证包内只有类型与声明式内容`:`lzi-bun.config.ts 已加载,但结果里没有预设标记。常见原因是配置仍用旧具名工厂,或依赖停留在旧版本。本包的目录分层是 ${n},请改用 ${cm[n]} 子路径的 defineConfig 声明配置`}function dm(e,t){return t===`non-fixed`?`本包目录没有固定分层,声明的预设是 ${e}。固定分层预设只能用于对应的目录分层,custom 与 type-only 不受目录分层约束。请改用 @longzai-intelligence-bun/presets/type-only 子路径的 defineConfig 声明,并保证包内只有类型与声明式内容`:`本包的目录分层是 ${t},声明的预设却是 ${e}。固定分层预设必须与目录分层一致,custom 与 type-only 不受目录分层约束。请改用 ${cm[t]} 子路径的 defineConfig 声明配置`}async function fm(e){let t=await lm(e);if(t.length===0)return;let n=u(e.repoRoot,e.packageDir),r=Ep(e.repoRoot),i=t.filter(e=>!Dp(r,n,e.kind));if(i.length!==0){if(e.strict)throw new lp(e.subject,i);for(let t of i)for(let n of t.details)Z(`警告: ${e.subject} ${n}`)}}async function pm(e,t){let n=e?.test?.include??om;if(n.length===om.length&&n.every((e,t)=>e===om[t]))return mm(t);let r=/* @__PURE__ */ new Set;for(let e of n){let n=new Bun.Glob(e);for await(let e of n.scan({cwd:t,onlyFiles:!0}))r.add(e)}return r.size}function mm(e){let t=l(e,`src`);if(!n(t))return 0;let r=0,i=e=>{for(let t of a(e,{withFileTypes:!0}))t.isDirectory()?i(l(e,t.name)):(t.isFile()&&t.name.endsWith(`.test.ts`)||t.isFile()&&t.name.endsWith(`.test.tsx`))&&(r+=1)};return i(t),r}const hm=async(e=process.cwd())=>{let t=await Hf({cwd:e,standaloneFile:`lzi-bun.config.ts`,unifiedField:`bun`});return t.success?t.config:(X(`提示: 未找到配置文件 lzi-bun.config.ts,使用默认配置`),{})};var gm=class extends Error{constructor(e){super(e),this.name=`GlobalsUnresolvedError`}};const _m=e=>`已配置的 globals 定位未能命中(longzai-intelligence-globals),已尝试:\n ${e.join(`
220
- `)}\n请修正 ${gf} / --globals 的路径,或移除该配置以回落包内预设(LZI_SCOPES)`,vm=e=>{try{return o(e).isDirectory()}catch{return!1}},ym=(e={})=>{let t=process.env[gf],n=[...t!==void 0&&t!==``?[{source:`env`,path:d(t)}]:[],...e.explicitPath===void 0?[]:[{source:`explicit`,path:d(e.explicitPath)}]],r=[];for(let e of n)if(r.push(`${e.source}: ${e.path}`),vm(e.path))return{ok:!0,resolution:{globalsRoot:e.path,source:e.source}};return{ok:!1,failure:{attempted:r}}},bm=RegExp(`^${gf}=.*$`,`m`),xm=`${gf}=/absolute/path/to/longzai-intelligence-globals`,Sm=(e,t)=>{let r=l(e,`.env`),a=`${gf}=${t}`;if(n(r)){let e=i(r,`utf8`);if(bm.test(e)){let t=e.replace(bm,a);t!==e&&s(r,t,`utf8`)}else{let t=e.endsWith(`
217
+ `)}\n`}function rp(e,t={}){let n=t.isRoot===!0,r=e?.test,i=r?r.coverage!==void 0||r.coverageThreshold!==void 0||r.coveragePathIgnorePatterns!==void 0||r.coverageReporter!==void 0||r.coverageSkipTestFiles!==void 0||r.coverageDir!==void 0||r.preload!==void 0||r.timeout!==void 0:!1;if(!n&&!i)return null;let a={test:r??{}};if(n){if(t.installScopesPreset===void 0)throw Error(`root bunfig 生成需要 globals 仓 install scopes 预设(LZI_GLOBALS_ROOT 定位 longzai-intelligence-globals → lzi-bun-install.config.ts),调用方应先解析并加载`);a.install=ep(t.repoInstall,t.installScopesPreset,t.selfScope)}return{content:np(a),shouldWrite:!0}}const ip=(e,t)=>n(l(t,`src/__tests__/bootstrap.ts`))?hf(e):e;function ap(e){let t=0,n=0,r=0,i=0;for(let a of e.split(`
218
+ `)){let e=a.trimEnd();e.startsWith(`LF:`)?t+=Number.parseInt(e.slice(3),10)||0:e.startsWith(`LH:`)?n+=Number.parseInt(e.slice(3),10)||0:e.startsWith(`FNF:`)?r+=Number.parseInt(e.slice(4),10)||0:e.startsWith(`FNH:`)&&(i+=Number.parseInt(e.slice(4),10)||0)}return{linesFound:t,linesHit:n,functionsFound:r,functionsHit:i}}function op(e){return typeof e==`number`?{lines:e,functions:e,statements:e}:{...e}}function sp(e,t){if(!(t<=0))return e/t}function cp(e,t){let n=op(t),r=sp(e.linesHit,e.linesFound),i=sp(e.functionsHit,e.functionsFound),a=[];return n.lines!==void 0&&a.push({dimension:`lines`,actual:r,required:n.lines}),n.functions!==void 0&&a.push({dimension:`functions`,actual:i,required:n.functions}),n.statements!==void 0&&a.push({dimension:`statements`,actual:r,required:n.statements}),{passed:a.every(e=>e.actual===void 0||e.actual>=e.required),results:a}}function lp(e){return`${(e*100).toFixed(2)}%`}function up(e){return e.results.map(e=>{let t=e.actual===void 0?`无数据`:lp(e.actual),n=e.actual===void 0||e.actual>=e.required?`通过`:`未达标`;return`${e.dimension} 覆盖率 ${t},阈值 ${lp(e.required)},${n}`})}var dp=class extends Error{details;constructor(e,t){let n=t.flatMap(e=>e.details.map(t=>`${fp(e.kind)}:${t}`));super(`${e} 的测试配置违反分层规则:\n${n.map(e=>` - ${e}`).join(`
219
+ `)}`),this.name=`TypeOnlyViolationError`,this.details=n}};function fp(e){return e===`exempt-runtime`?`包内代码与声明预设不符`:e===`zero-tests-undeclared`?`包内没有测试,也没有声明允许零测试的预设`:`声明的预设与目录分层不符`}const pp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),mp=e=>Array.isArray(e)||typeof e==`object`&&!!e&&`packages`in e,hp=e=>{let t=l(e,`package.json`);if(!n(t))return`missing-package-json`;let r;try{r=JSON.parse(i(t,`utf8`))}catch{return`not-root`}return pp(r)&&mp(r.workspaces)?`root`:`not-root`},gp=e=>hp(e)===`root`,_p=(e,t)=>{let n=l(e,`package.json`);try{let e=JSON.parse(i(n,`utf8`));if(pp(e)){let t=e.name;if(typeof t==`string`&&t!==``)return t}}catch{}return t},vp=e=>{let t=e.indexOf(`/`);if(!(!e.startsWith(`@`)||t<=1))return e.slice(1,t)},yp={server:`server`,web:`web`,desktop:`desktop`,cli:`cli`,mcp:`mcp`,"desktop-host":`desktop-host`,docs:`docs`,mobile:`mobile`,miniprogram:`miniprogram`},bp={core:`package`,shared:`package`,sdk:`package`},xp=[`contract`,`main`,`implementation`,`infrastructure`,`api`,`ui`];function Sp(e){if(e===``)return`root`;let t=e.split(`/`),n=t[0],r=t[1],i=t[2];return n===`domains`?t.length<3||i===void 0?`non-fixed`:xp.find(e=>e===i)??`non-fixed`:n===`apps`?t.length===3&&r===`capabilities`?`capability`:t.length===2&&r!==void 0?yp[r]??`non-fixed`:`non-fixed`:n===`packages`&&t.length===2&&r!==void 0?bp[r]??`non-fixed`:`non-fixed`}const Cp=`.lzi/baselines/lzi-bun.typeonly.json`,wp=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Tp=[`exempt-runtime`,`zero-tests-undeclared`,`preset-layer-mismatch`],Ep=e=>typeof e==`string`&&Tp.some(t=>t===e);function Dp(e){return`${e.path}|${e.kind}`}function Op(e){let t=l(e,Cp);if(!n(t))return/* @__PURE__ */ new Set;try{let e=JSON.parse(i(t,`utf8`));if(!wp(e)||!Array.isArray(e.entries))return/* @__PURE__ */ new Set;let n=/* @__PURE__ */ new Set;for(let t of e.entries)wp(t)&&typeof t.path==`string`&&Ep(t.kind)&&n.add(`${t.path}|${t.kind}`);return n}catch{return/* @__PURE__ */ new Set}}function kp(e,t,n){return e.has(`${t}|${n}`)}function Ap(e,t){let n=[...t].sort((e,t)=>Dp(e)<Dp(t)?-1:+(Dp(e)>Dp(t))),i=l(e,Cp);r(c(i),{recursive:!0}),s(i,`${JSON.stringify({version:1,entries:n},null,2)}\n`,`utf8`)}function jp(e,t){return[...Op(e)].filter(e=>!t.has(e))}function Mp(e){let t=e.indexOf(`|`),n=Tp.find(n=>n===e.slice(t+1));return{path:e.slice(0,t),kind:n??`preset-layer-mismatch`}}const Np=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Pp=e=>Np(e)&&typeof e.type==`string`;function Fp(e){return Pp(e)?e:void 0}function Ip(e){if(Array.isArray(e))return e.every(Pp)?e:void 0}function $(e,t){return Fp(e[t])}function Lp(e){if(e!==void 0&&e.type===`Identifier`)return typeof e.name==`string`?e.name:void 0}function Rp(e){return e.type.endsWith(`Literal`)?e.type!==`TemplateLiteral`||e.expressions!==void 0&&Ip(e.expressions)?.length===0:!1}function zp(e){if(Rp(e)||Bp(e))return!0;if(e.type===`TSAsExpression`||e.type===`TSSatisfiesExpression`){let t=$(e,`expression`);return t!==void 0&&zp(t)}if(e.type===`UnaryExpression`){let t=$(e,`argument`);return t!==void 0&&Rp(t)}if(e.type===`BinaryExpression`){let t=$(e,`left`),n=$(e,`right`);return t!==void 0&&n!==void 0&&Rp(t)&&Rp(n)}return!1}function Bp(e){if(e.type===`ObjectExpression`){let t=Ip(e.properties);return t!==void 0&&t.every(e=>{if(e.type===`Property`){if(e.computed===!0)return!1;let t=$(e,`value`);return t!==void 0&&zp(t)}if(e.type===`SpreadElement`){let t=$(e,`argument`);return t!==void 0&&Bp(t)}return!1})}if(e.type===`ArrayExpression`){let t=e.elements;return Array.isArray(t)?t.every(e=>{if(e==null)return!0;let t=Fp(e);return t!==void 0&&zp(t)}):!1}return!1}function Vp(e){let t=Lp($(e,`superClass`));if(t===void 0||t!==`Error`&&!t.endsWith(`Error`))return!1;let n=$(e,`body`);if(n===void 0)return!1;let r=Ip(n.body);return r!==void 0&&r.every(e=>{if(e.type===`MethodDefinition`)return e.kind===`constructor`;if(e.type===`PropertyDefinition`){let t=$(e,`value`);return t===void 0||zp(t)}return!1})}function Hp(e){let t=$(e,`body`);if(t===void 0)return!1;if(t.type!==`BlockStatement`)return!0;let n=Ip(t.body);if(n===void 0||n.length!==1)return!1;let r=n[0];return r!==void 0&&r.type===`ReturnStatement`}function Up(e){return e?`tsx`:`ts`}function Wp(e,t){let n=$(e,`callee`);if(n===void 0)return!1;if(Lp(n)===`Symbol`)return!0;if(n.type===`MemberExpression`){let e=Lp($(n,`object`));return e!==void 0&&t.zodBindings.has(e)}return!1}function Gp(e,t){if(e.type===`TSAsExpression`||e.type===`TSSatisfiesExpression`){let n=$(e,`expression`);if(n!==void 0)return Gp(n,t)}if(e.type===`TSInstantiationExpression`){let n=$(e,`expression`);if(n!==void 0)return Gp(n,t)}return e.type===`CallExpression`?Wp(e,t)?`declarative`:`runtime`:e.type===`ArrowFunctionExpression`?t.isTsx?`runtime`:Hp(e)?`thin`:`runtime`:e.type===`Identifier`||zp(e)?`declarative`:`runtime`}function Kp(e,t){switch(e.type){case`TSTypeAliasDeclaration`:case`TSInterfaceDeclaration`:case`TSModuleDeclaration`:case`TSDeclareFunction`:return`type`;case`TSEnumDeclaration`:return`declarative`;case`ClassDeclaration`:return Vp(e)?`declarative`:`runtime`;case`FunctionDeclaration`:return t.isTsx?`runtime`:Hp(e)?`thin`:`runtime`;case`VariableDeclaration`:{let n=Ip(e.declarations);if(n===void 0)return`runtime`;let r=`type`;for(let e of n){let n=$(e,`init`),i=n===void 0?`declarative`:Gp(n,t);if(i===`runtime`)return`runtime`;i!==`type`&&(r=i)}return r}default:return`runtime`}}function qp(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`ImportDeclaration`){Jp(t,n,r);continue}let e=$(t,`declaration`);t.type===`ExportNamedDeclaration`&&e!==void 0?Yp(i,e):Yp(i,t)}return{zodBindings:n,importBindings:r,localDeclarations:i,isTsx:t}}function Jp(e,t,n){let r=$(e,`source`),i=r!==void 0&&typeof r.value==`string`?r.value:void 0,a=Ip(e.specifiers);if(a!==void 0)for(let e of a){let r=Lp($(e,`local`));r!==void 0&&(n.add(r),i===`zod`&&(e.type===`ImportNamespaceSpecifier`&&t.add(r),e.type===`ImportSpecifier`&&Lp($(e,`imported`))===`z`&&t.add(r)))}}function Yp(e,t){if(t.type===`FunctionDeclaration`||t.type===`ClassDeclaration`){let n=Lp($(t,`id`));n!==void 0&&e.set(n,t)}else if(t.type===`VariableDeclaration`){let n=Ip(t.declarations);if(n===void 0)return;for(let t of n){let n=Lp($(t,`id`));n!==void 0&&e.set(n,t)}}}function Xp(e){if(e.type===`VariableDeclaration`){let t=Ip(e.declarations),n=t===void 0?void 0:t[0];return(n===void 0?void 0:Lp($(n,`id`)))??`anonymous`}return Lp($(e,`id`))??`anonymous`}function Zp(e,t){let n=Lp($(e,`local`));if(n===void 0)return;let r=Lp($(e,`exported`))??n,i=t.localDeclarations.get(n);if(i!==void 0){let e=$(i,`init`);return{name:r,form:e===void 0?Kp(i,t):Gp(e,t)}}if(t.importBindings.has(n))return{name:r,form:`reexport`}}function Qp(e,t){return e.type===`FunctionDeclaration`||e.type===`ClassDeclaration`||e.type===`VariableDeclaration`?Kp(e,t):Gp(e,t)}const $p=/* @__PURE__ */ new Set([`__tests__`,`__mocks__`,`__fixtures__`]),em=[`.test.`,`.spec.`,`.d.ts`];function tm(e){return em.some(t=>e.includes(t))}function nm(e){let t=l(e,`src`);if(!n(t))return[];let r=[],i=(e,t)=>{for(let n of a(e,{withFileTypes:!0})){if($p.has(n.name))continue;let a=t===``?n.name:`${t}/${n.name}`;n.isDirectory()?i(l(e,n.name),a):n.isFile()&&(n.name.endsWith(`.ts`)||n.name.endsWith(`.tsx`))&&r.push(`src/${a}`)}};return i(t,``),r}function rm(e,t){let n=Ip(T(e,{sourceType:`module`,lang:Up(t)}).body)??[],r=qp(n,t),i=/* @__PURE__ */ new Map,a=(e,t)=>{let n=i.get(e);n===void 0?i.set(e,[t]):n.push(t)};for(let e of n)if(e.type===`ExportAllDeclaration`)a(`reexport`,`*`);else if(e.type===`ExportNamedDeclaration`){if($(e,`source`)!==void 0){a(`reexport`,`named-from`);continue}let t=$(e,`declaration`);if(t!==void 0){a(Kp(t,r),Xp(t));continue}let n=Ip(e.specifiers);if(n===void 0)continue;for(let e of n){let t=Zp(e,r);t!==void 0&&a(t.form,t.name)}}else if(e.type===`ExportDefaultDeclaration`){let t=$(e,`declaration`);if(t===void 0){a(`runtime`,`default`);continue}a(Qp(t,r),`default`)}return i}function im(e){let t=nm(e).filter(e=>!tm(e)),n=[],r=!1,a=!1;for(let o of t){let t;try{t=i(l(e,o),`utf8`)}catch{continue}let s;try{s=rm(t,o.endsWith(`.tsx`))}catch{n.push({file:o,name:`parse-error`,reason:`文件解析失败,无法确认内容,按包含运行时逻辑处理`});continue}let c=s.get(`runtime`);if(c!==void 0)for(let e of c)n.push({file:o,name:e,reason:`这个导出包含运行时逻辑`});s.has(`declarative`)&&(r=!0),(s.has(`thin`)||s.has(`reexport`))&&(a=!0)}return n.length>0?{verdict:`runtime`,runtimeExports:n}:r?{verdict:`declarative`,runtimeExports:[]}:a?{verdict:`facade`,runtimeExports:[]}:{verdict:`pure-type`,runtimeExports:[]}}function am(e){let t=e;for(;;){if(hp(t)===`root`)return t;let n=c(t);if(n===t)return e;t=n}}const om=/* @__PURE__ */ new Set([`contract`,`main`,`type-only`]),sm=/* @__PURE__ */ new Set([`contract`,`main`,`docs`,`type-only`,`root`]),cm=[`src/**/*.test.ts`,`src/**/*.test.tsx`,`__tests__/**/*.test.ts`],lm=/* @__PURE__ */ new Set([`root`,`contract`,`main`,`docs`,`domain`,`implementation`,`infrastructure`,`api`,`ui`,`capability`,`mcp`,`desktop-host`,`mobile`,`miniprogram`,`package`,`server`,`web`,`desktop`,`cli`]),um={root:`@longzai-intelligence-bun/presets/root`,contract:`@longzai-intelligence-bun/presets/contract`,main:`@longzai-intelligence-bun/presets/main`,docs:`@longzai-intelligence-bun/presets/docs`,domain:`@longzai-intelligence-bun/presets/domain`,implementation:`@longzai-intelligence-bun/presets/implementation`,infrastructure:`@longzai-intelligence-bun/presets/infrastructure`,api:`@longzai-intelligence-bun/presets/api`,ui:`@longzai-intelligence-bun/presets/ui`,capability:`@longzai-intelligence-bun/presets/capability`,mcp:`@longzai-intelligence-bun/presets/mcp`,"desktop-host":`@longzai-intelligence-bun/presets/desktop-host`,mobile:`@longzai-intelligence-bun/presets/mobile`,miniprogram:`@longzai-intelligence-bun/presets/miniprogram`,package:`@longzai-intelligence-bun/presets/package`,server:`@longzai-intelligence-bun/presets/server`,web:`@longzai-intelligence-bun/presets/web`,desktop:`@longzai-intelligence-bun/presets/desktop`,cli:`@longzai-intelligence-bun/presets/cli`};async function dm(e){let t=e.config?.preset??`custom`,n=e.config?.preset!==void 0,r=Sp(u(e.repoRoot,e.packageDir)),i=[];if(lm.has(t)&&t!==r&&i.push({kind:`preset-layer-mismatch`,details:[pm(t,r)]}),om.has(t)){let n=im(e.packageDir);n.verdict===`runtime`&&i.push({kind:`exempt-runtime`,details:[`该包声明为 ${t},这个预设只允许纯类型与声明式内容,但扫描发现 ${n.runtimeExports.length} 处包含运行时逻辑的导出`,...n.runtimeExports.slice(0,5).map(e=>`${e.file} 的 ${e.name},${e.reason}`)]})}return await hm(e.config,e.packageDir)===0&&!sm.has(t)&&i.push({kind:`zero-tests-undeclared`,details:[fm(t,n,r)]}),i}function fm(e,t,n){return t?e===`custom`?`该包的 lzi-bun.config.ts 未走预设子路径,包内没有任何测试文件。custom 不在允许零测试的预设之列,允许零测试的预设为 contract、main、docs、type-only 与 root。请补充测试,或改用上述预设子路径之一,改用后命令会扫描包内容,确认内容符合该预设的要求`:`该包声明为 ${e},包内没有任何测试文件。${e} 预设要求包内必须有测试,允许零测试的预设为 contract、main、docs、type-only 与 root。请补充测试`:n===`non-fixed`?`lzi-bun.config.ts 已加载,但结果里没有预设标记。常见原因是配置仍用旧具名工厂,或依赖停留在旧版本。本包目录没有固定分层,请改用 @longzai-intelligence-bun/presets/type-only 子路径的 defineConfig 声明,并保证包内只有类型与声明式内容`:`lzi-bun.config.ts 已加载,但结果里没有预设标记。常见原因是配置仍用旧具名工厂,或依赖停留在旧版本。本包的目录分层是 ${n},请改用 ${um[n]} 子路径的 defineConfig 声明配置`}function pm(e,t){return t===`non-fixed`?`本包目录没有固定分层,声明的预设是 ${e}。固定分层预设只能用于对应的目录分层,custom 与 type-only 不受目录分层约束。请改用 @longzai-intelligence-bun/presets/type-only 子路径的 defineConfig 声明,并保证包内只有类型与声明式内容`:`本包的目录分层是 ${t},声明的预设却是 ${e}。固定分层预设必须与目录分层一致,custom 与 type-only 不受目录分层约束。请改用 ${um[t]} 子路径的 defineConfig 声明配置`}async function mm(e){let t=await dm(e);if(t.length===0)return;let n=u(e.repoRoot,e.packageDir),r=Op(e.repoRoot),i=t.filter(e=>!kp(r,n,e.kind));if(i.length!==0){if(e.strict)throw new dp(e.subject,i);for(let t of i)for(let n of t.details)Z(`警告: ${e.subject} ${n}`)}}async function hm(e,t){let n=e?.test?.include??cm;if(n.length===cm.length&&n.every((e,t)=>e===cm[t]))return gm(t);let r=/* @__PURE__ */ new Set;for(let e of n){let n=new Bun.Glob(e);for await(let e of n.scan({cwd:t,onlyFiles:!0}))r.add(e)}return r.size}function gm(e){let t=l(e,`src`);if(!n(t))return 0;let r=0,i=e=>{for(let t of a(e,{withFileTypes:!0}))t.isDirectory()?i(l(e,t.name)):(t.isFile()&&t.name.endsWith(`.test.ts`)||t.isFile()&&t.name.endsWith(`.test.tsx`))&&(r+=1)};return i(t),r}const _m=async(e=process.cwd())=>{let t=await Uf({cwd:e,standaloneFile:`lzi-bun.config.ts`,unifiedField:`bun`});return t.success?t.config:(X(`提示: 未找到配置文件 lzi-bun.config.ts,使用默认配置`),{})};var vm=class extends Error{constructor(e){super(e),this.name=`GlobalsUnresolvedError`}};const ym=e=>`已配置的 globals 定位未能命中(longzai-intelligence-globals),已尝试:\n ${e.join(`
220
+ `)}\n请修正 ${_f} / --globals 的路径,或移除该配置以回落包内预设(LZI_SCOPES)`,bm=e=>{try{return o(e).isDirectory()}catch{return!1}},xm=(e={})=>{let t=process.env[_f],n=[...t!==void 0&&t!==``?[{source:`env`,path:d(t)}]:[],...e.explicitPath===void 0?[]:[{source:`explicit`,path:d(e.explicitPath)}]],r=[];for(let e of n)if(r.push(`${e.source}: ${e.path}`),bm(e.path))return{ok:!0,resolution:{globalsRoot:e.path,source:e.source}};return{ok:!1,failure:{attempted:r}}},Sm=RegExp(`^${_f}=.*$`,`m`),Cm=`${_f}=/absolute/path/to/longzai-intelligence-globals`,wm=(e,t)=>{let r=l(e,`.env`),a=`${_f}=${t}`;if(n(r)){let e=i(r,`utf8`);if(Sm.test(e)){let t=e.replace(Sm,a);t!==e&&s(r,t,`utf8`)}else{let t=e.endsWith(`
221
221
  `)||e.length===0?e:`${e}\n`;s(r,`${t}${a}\n`,`utf8`)}}else s(r,`${a}\n`,`utf8`);let o=l(e,`.env.example`);if(n(o)){let e=i(o,`utf8`);if(!e.includes(`LZI_GLOBALS_ROOT=`)){let t=e.endsWith(`
222
- `)||e.length===0?e:`${e}\n`;s(o,`${t}${xm}\n`,`utf8`)}}else s(o,`${xm}\n`,`utf8`)},Cm=async e=>Cf((await Mf(l(e,_f))).config),wm=async(e={})=>{let t=ym({explicitPath:e.explicitPath});if(t.ok)return{presetScopes:await Cm(t.resolution.globalsRoot),source:`globals`};if(t.failure.attempted.length===0)return{presetScopes:Object.fromEntries(hf),source:`preset`};throw new gm(_m(t.failure.attempted))},Tm=/* @__PURE__ */ new Set([`extraScopes`,`privateScopes`,`linker`,`globalStore`]);function Em(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`lzi-bun-install.config.ts 默认导出须为对象`);for(let t of Object.keys(e))if(!Tm.has(t))throw Error(`lzi-bun-install.config.ts 含不可声明键 ${t},可声明键为 extraScopes、privateScopes、linker、globalStore`);let t=typeof e==`object`&&e&&`extraScopes`in e?e.extraScopes:void 0,n=typeof e==`object`&&e&&`privateScopes`in e?e.privateScopes:void 0,r=typeof e==`object`&&e&&`linker`in e?e.linker:void 0,i=typeof e==`object`&&e&&`globalStore`in e?e.globalStore:void 0;if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`lzi-bun-install.config.ts 的 extraScopes 须为 scope 到安装源 URL 的对象`);for(let[e,n]of Object.entries(t))if(typeof e!=`string`||typeof n!=`string`)throw Error(`lzi-bun-install.config.ts 的 extraScopes 键值均须为字符串`)}if(n!==void 0&&(!Array.isArray(n)||n.some(e=>typeof e!=`string`)))throw Error(`lzi-bun-install.config.ts 的 privateScopes 须为 scope 字符串数组`);if(r!==void 0&&r!==`isolated`&&r!==`hoisted`)throw Error(`lzi-bun-install.config.ts 的 linker 仅可为 isolated 或 hoisted`);if(i!==void 0&&typeof i!=`boolean`)throw Error(`lzi-bun-install.config.ts 的 globalStore 须为布尔值`);let a={};return t!==void 0&&(a.extraScopes=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,String(t)]))),Array.isArray(n)&&(a.privateScopes=n.map(e=>String(e))),(r===`isolated`||r===`hoisted`)&&(a.linker=r),typeof i==`boolean`&&(a.globalStore=i),a}const Dm=async e=>{let t=l(e,_f);if(n(t))return Em((await Mf(t)).config)},Om=[`src/**/*.test.ts`,`src/**/*.test.tsx`,`__tests__/**/*.test.ts`];function km(e){let t=[`bun`,`test`];return e.watch===!0&&t.push(`--watch`),e.coverage===!0&&t.push(`--coverage`),e.extra&&e.extra.length>0&&t.push(...e.extra),t}async function Am(e,t=process.cwd()){let n=/* @__PURE__ */ new Set;for(let r of e){let e=new Bun.Glob(r);for await(let r of e.scan({cwd:t,onlyFiles:!0}))n.add(r)}return n.size}const jm=(e,t,n)=>{let r=e.split(`
222
+ `)||e.length===0?e:`${e}\n`;s(o,`${t}${Cm}\n`,`utf8`)}}else s(o,`${Cm}\n`,`utf8`)},Tm=async e=>wf((await Nf(l(e,vf))).config),Em=async(e={})=>{let t=xm({explicitPath:e.explicitPath});if(t.ok)return{presetScopes:await Tm(t.resolution.globalsRoot),source:`globals`};if(t.failure.attempted.length===0)return{presetScopes:Object.fromEntries(gf),source:`preset`};throw new vm(ym(t.failure.attempted))},Dm=/* @__PURE__ */ new Set([`extraScopes`,`privateScopes`,`linker`,`globalStore`]);function Om(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`lzi-bun-install.config.ts 默认导出须为对象`);for(let t of Object.keys(e))if(!Dm.has(t))throw Error(`lzi-bun-install.config.ts 含不可声明键 ${t},可声明键为 extraScopes、privateScopes、linker、globalStore`);let t=typeof e==`object`&&e&&`extraScopes`in e?e.extraScopes:void 0,n=typeof e==`object`&&e&&`privateScopes`in e?e.privateScopes:void 0,r=typeof e==`object`&&e&&`linker`in e?e.linker:void 0,i=typeof e==`object`&&e&&`globalStore`in e?e.globalStore:void 0;if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`lzi-bun-install.config.ts 的 extraScopes 须为 scope 到安装源 URL 的对象`);for(let[e,n]of Object.entries(t))if(typeof e!=`string`||typeof n!=`string`)throw Error(`lzi-bun-install.config.ts 的 extraScopes 键值均须为字符串`)}if(n!==void 0&&(!Array.isArray(n)||n.some(e=>typeof e!=`string`)))throw Error(`lzi-bun-install.config.ts 的 privateScopes 须为 scope 字符串数组`);if(r!==void 0&&r!==`isolated`&&r!==`hoisted`)throw Error(`lzi-bun-install.config.ts 的 linker 仅可为 isolated 或 hoisted`);if(i!==void 0&&typeof i!=`boolean`)throw Error(`lzi-bun-install.config.ts 的 globalStore 须为布尔值`);let a={};return t!==void 0&&(a.extraScopes=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,String(t)]))),Array.isArray(n)&&(a.privateScopes=n.map(e=>String(e))),(r===`isolated`||r===`hoisted`)&&(a.linker=r),typeof i==`boolean`&&(a.globalStore=i),a}const km=async e=>{let t=l(e,vf);if(n(t))return Om((await Nf(t)).config)},Am=[`src/**/*.test.ts`,`src/**/*.test.tsx`,`__tests__/**/*.test.ts`];function jm(e){let t=[`bun`,`test`];return e.watch===!0&&t.push(`--watch`),e.coverage===!0&&t.push(`--coverage`),e.extra&&e.extra.length>0&&t.push(...e.extra),t}async function Mm(e,t=process.cwd()){let n=/* @__PURE__ */ new Set;for(let r of e){let e=new Bun.Glob(r);for await(let r of e.scan({cwd:t,onlyFiles:!0}))n.add(r)}return n.size}const Nm=(e,t,n)=>{let r=e.split(`
223
223
  `),i=t.split(`
224
- `),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=`第 ${a+1} 行不一致(磁盘 \`${r[a]??`<缺行>`}\` ≠ 预期 \`${i[a]??`<缺行>`}\`)`,s=n===void 0?void 0:`"@${n}" = `;return s!==void 0&&t.includes(s)&&!e.includes(s)?`${o},且本仓 scope @${n} 行在磁盘文件中缺位——bun publish 的 scope 映射优先级会使公网轨发布回退默认镜像源并以 missing authentication 失败(issue 0008)`:o},Mm=async(e,t={})=>{let r=t.dir??process.cwd(),a=l(r,`bunfig.toml`),o=mp(r),c,u;o&&(c=(await wm({explicitPath:t.globalsPath})).presetScopes,u=await Dm(r));let d=o?gp(hp(r,``)):void 0,f=np(e,{isRoot:o,installScopesPreset:c,selfScope:d,repoInstall:u});if(!f?.shouldWrite){if(t.dryRun&&X(`(无 coverage 配置,不会生成 bunfig.toml)`),t.check===!0&&n(a))throw new Jf(a,`该包无 coverage 配置,生成器判定不应存在 bunfig.toml(多余文件),请删除该文件`);return{status:`skipped`,bunfigPath:a}}if(t.dryRun)return X(`[dry-run] 将写入 ${a}:`),X(f.content),{status:`generated`,bunfigPath:a};if(t.check===!0){if(!n(a))throw new Jf(a,d===void 0?`bunfig.toml 不存在(生成器预期应存在)`:`bunfig.toml 不存在,本仓 scope @${d} 未注入 [install.scopes]——bun publish 的 scope 映射优先级会使公网轨发布回退默认镜像源并以 missing authentication 失败(issue 0008)`);let e=i(a,`utf8`);if(!e.includes(`@lzi-bun-cli 自动生成,请勿编辑`))throw new Jf(a,`bunfig.toml 为手写文件(无生成标记),不受 lzi-bun-cli 管理;如需接管请确认内容后删除该文件重新生成`);if(e!==f.content)throw new Jf(a,jm(e,f.content,d));return X(`校验通过 ${a}(与生成器预期一致)`),{status:`checked`,bunfigPath:a}}if(n(a)&&!i(a,`utf8`).includes(`@lzi-bun-cli 自动生成,请勿编辑`))throw new Yf(a);return s(a,f.content,`utf8`),X(`已生成 ${a}(lzi-bun-cli 接管覆盖率配置)`),{status:`generated`,bunfigPath:a}},Nm=e=>{let t=e?.test;if(t===void 0)return;let r=t.coverageThreshold;if(r===void 0)return;let a=l(process.cwd(),t.coverageDir??`coverage`,`lcov.info`);if(!n(a)){X(`未找到覆盖率报告 ${a},跳过全局阈值判定`);return}let o=op(rp(i(a,`utf8`)),r);if(o.passed)for(let e of cp(o))X(e);else{Z(`错误: 覆盖率全局汇总低于阈值`);for(let e of cp(o))Z(e);process.exit(1)}},Pm=async e=>{let t=await hm();await fm({config:t,packageDir:process.cwd(),repoRoot:rm(process.cwd()),strict:!1,subject:hp(process.cwd(),process.cwd())});let n=t.test?.passWithNoTests??!0;await Am(t.test?.include??Om)===0&&(n&&(X(`无测试文件,跳过(type-only / facade 包,passWithNoTests)`),process.exit(0)),Z(`错误: 未找到测试文件,且 test.passWithNoTests 为 false`),Z(`(如该包确为 type-only / facade 包,请在 lzi-dev.config.ts 设置 test.passWithNoTests: true)`),process.exit(1));try{await Mm(t)}catch(e){throw(e instanceof Yf||e instanceof yf||e instanceof gm)&&(Z(`错误: ${e.message}`),process.exit(1)),e}let r=km(e),i=await Bun.spawn(r,{cwd:process.cwd(),stdout:`inherit`,stderr:`inherit`}).exited;i!==0&&process.exit(i),Nm(t)},Fm=async(e,t,n)=>{let r=await hm();try{await fm({config:r,packageDir:process.cwd(),repoRoot:rm(process.cwd()),strict:!0,subject:hp(process.cwd(),process.cwd())}),await Mm(r,{dryRun:e,globalsPath:t,check:n})}catch(e){throw(e instanceof Yf||e instanceof Jf||e instanceof yf||e instanceof gm||e instanceof lp)&&(Z(`错误: ${e.message}`),process.exit(1)),e}},Im=e=>{let t=pp(e);t===`missing-package-json`&&(Z(`错误: 当前目录 ${e} 无 package.json,--recursive 须在 monorepo root 执行`),process.exit(1)),t!==`root`&&(Z(`错误: ${e} 的 package.json 未声明 workspaces 字段,--recursive 须在 monorepo root 执行`),process.exit(1))},Lm=async(e,t,n)=>{let r=process.cwd();Im(r);let i=await qf(r,{configFileName:`lzi-bun.config.ts`}),a=[{name:hp(r,r.split(`/`).pop()??`root`),dir:r}];a.push(...i.map(e=>({name:e.name,dir:e.dir})));let o=n===!0?`校验`:e?`预览`:`生成`;X(`发现 ${a.length} 个目标(root 1 + 子包 ${i.length}),开始${o}...`);let s=[];for(let i of a){X(`▶ ${i.name}`);try{let a=await hm(i.dir);await fm({config:a,packageDir:i.dir,repoRoot:r,strict:!0,subject:i.name});let{status:o}=await Mm(a,{dryRun:e,check:n,dir:i.dir,globalsPath:t});s.push({name:i.name,dir:i.dir,status:o})}catch(e){s.push({name:i.name,dir:i.dir,status:`failed`,reason:e instanceof Error?e.message:String(e)})}}let c=s.filter(e=>e.status===`generated`),l=s.filter(e=>e.status===`checked`),u=s.filter(e=>e.status===`skipped`),d=s.filter(e=>e.status===`failed`);if(X(``),X(`汇总:${c.length} 生成 / ${l.length} 一致 / ${u.length} 跳过 / ${d.length} 失败`),d.length>0){Z(``),Z(`失败子包:`);for(let e of d)Z(` - ${e.name}:${e.reason}`);process.exitCode=1}},Rm=async e=>{let t=e.dryRun===!0,n=e.check===!0;if(t&&n&&(Z(`错误: --dry-run 与 --check 互斥(预览与校验是两种只读形态,请二选一)`),process.exit(1)),e.globalsPath!==void 0){let t=ym({explicitPath:e.globalsPath});t.ok||(Z(`错误: ${_m(t.failure.attempted)}`),process.exit(1));let{globalsRoot:n,source:r}=t.resolution;Sm(process.cwd(),n),X(`已定位 globals 仓(${r})并固化到 .env:${n}`)}e.recursive===!0?await Lm(t,e.globalsPath,n):await Fm(t,e.globalsPath,n)},zm=/* @__PURE__ */ new Set([`contract`,`main`,`type-only`]);async function Bm(e,t){let n=u(t,e),r=hp(e,n||`root`),i=bp(n),a=null,o=`custom`,s;try{a=await hm(e),o=a?.preset??`custom`,s=await lm({config:a,packageDir:e,repoRoot:t,strict:!1,subject:r})}catch{o=`load-error`,s=[{kind:`preset-layer-mismatch`,details:[`lzi-bun.config.ts 加载失败,无法确认声明的预设。请检查文件内的导入与语法,常见原因是配置仍用旧具名工厂,或预设子路径版本尚未发布`]}]}let c=zm.has(o)?nm(e).verdict:`not-scanned`;return{name:r,path:n,layer:i,preset:o,verdict:c,tests:await pm(a,e),violations:s}}async function Vm(e){let t=process.cwd();e.recursive===!0&&pp(t)!==`root`&&(Z(`错误:--recursive 须在含 workspaces 字段的 workspace 根执行`),process.exit(1));let n=[t];if(e.recursive===!0){let e=await qf(t,{configFileName:`lzi-bun.config.ts`});n.push(...e.map(e=>e.dir))}let r=Ep(t),i=[];for(let e of n)i.push(await Bm(e,t));if(e.json===!0)X(JSON.stringify({rows:i},null,2));else{X(`审计 ${i.length} 个目标`);for(let e of i){let t=e.violations.filter(t=>!Dp(r,e.path,t.kind)),n=t.length>0?` 违规 ${t.length} 项`:e.violations.length>0?` 基线内`:` 合规`;X(` ${e.path||`根目录`} 分层 ${e.layer} 预设 ${e.preset} 判定 ${e.verdict} 测试 ${e.tests}${n}`);for(let e of t)for(let t of e.details.slice(0,3))Z(` - ${t}`)}}if(e.initBaseline===!0){let e=/* @__PURE__ */ new Set;for(let t of i)for(let n of t.violations)e.add(`${t.path}|${n.kind}`);Op(t,[...e].map(Ap)),X(`已落盘基线 ${e.size} 条至 .lzi/baselines/lzi-bun.typeonly.json`)}else if(e.pruneBaseline===!0){let e=/* @__PURE__ */ new Set;for(let t of i)for(let n of t.violations)e.add(`${t.path}|${n.kind}`);let n=kp(t,e);n.length>0?(Op(t,[...r].filter(e=>!n.includes(e)).map(Ap)),X(`已从基线移除 ${n.length} 条已修复条目`)):X(`基线无已修复条目可移除`)}else if(e.check===!0){let e=i.reduce((e,t)=>e+t.violations.filter(e=>!Dp(r,t.path,e.kind)).length,0);e>0&&(Z(`错误:${e} 项违规不在基线内,基线只减不增,请先治理违规再重试`),process.exitCode=1)}}function Hm(e){Um(e),qm(e),Km(e),Wm(e),Gm(e)}function Um(e){Su(e,{name:`test`,description:`运行 bun 测试(替代三件套,零测试包默认放行)`,options:[{flags:`--watch`,description:`监听模式(对应 test:watch)`},{flags:`--coverage`,description:`覆盖率(对应 test:coverage)`}],schema:Nl({watch:Tl().optional(),coverage:Tl().optional()}),action:async(e,t)=>{await Pm({watch:e.watch===!0,coverage:e.coverage===!0,extra:t})}})}function Wm(e){Su(e,{name:`lockfile check`,description:`校验单一 bun.lock 不变量与 workspaces 覆盖缺口`,schema:Nl({}),action:async()=>{await af()}})}function Gm(e){Su(e,{name:`node-links check`,description:`检测 node_modules 悬挂符号链接,命中即非零退出`,schema:Nl({}),action:async()=>{await pf()}}),Su(e,{name:`node-links fix`,description:`回收 node_modules 悬挂死链,删除前复验,有效链接零触碰`,schema:Nl({}),action:async()=>{await mf()}})}function Km(e){Su(e,{name:`typeonly audit`,description:`检查各包的目录分层、预设声明与包内容是否符合规则,并管理违规基线`,options:[{flags:`-r, --recursive`,description:`递归审计 workspace 内全部含 lzi-bun.config.ts 的包`},{flags:`--check`,description:`校验模式,实际违规须为基线子集,否则非零退出`},{flags:`--json`,description:`以 JSON 形态输出审计行`},{flags:`--init-baseline`,description:`落盘当前全量违规为基线祖父条款`},{flags:`--prune-baseline`,description:`移除基线中已修复的条目,只减不增`}],schema:Nl({recursive:Tl().optional(),check:Tl().optional(),json:Tl().optional(),initBaseline:Tl().optional(),pruneBaseline:Tl().optional()}),action:async e=>{await Vm({recursive:e.recursive===!0,check:e.check===!0,json:e.json===!0,initBaseline:e.initBaseline===!0,pruneBaseline:e.pruneBaseline===!0})}})}function qm(e){Su(e,{name:`config generate`,description:`生成 bunfig.toml(不执行测试,支持 --dry-run 预览、--check 校验、-r 批量、--globals 定位)`,options:[{flags:`--dry-run`,description:`仅预览将写入的内容,不写盘`},{flags:`--check`,description:`仅校验磁盘 bunfig.toml 与生成器预期是否一致(漂移即报错退出,不写盘)`},{flags:`-r, --recursive`,description:`递归处理 monorepo 下含 lzi-bun.config.ts 的子包`},{flags:`--globals <path>`,description:`一次性 bootstrap 定位 globals 仓(命中后固化 .env,此后零参数)`}],schema:Nl({dryRun:Tl().optional(),check:Tl().optional(),recursive:Tl().optional(),globals:el().optional()}),action:async e=>{await Rm({dryRun:e.dryRun===!0,check:e.check===!0,recursive:e.recursive===!0,globalsPath:e.globals})}})}const Jm=vu({name:`lzi-bun-cli`,description:`Longzai Intelligence bun 工具集`,interaction:Vd,color:Bd});Hm(Jm);async function Ym(){await Jm.parseAsync(process.argv)}Ym().catch(e=>{process.stderr.write(`错误: ${e instanceof Error?e.message:String(e)}\n`),process.exit(1)});export{};
224
+ `),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=`第 ${a+1} 行不一致(磁盘 \`${r[a]??`<缺行>`}\` ≠ 预期 \`${i[a]??`<缺行>`}\`)`,s=n===void 0?void 0:`"@${n}" = `;return s!==void 0&&t.includes(s)&&!e.includes(s)?`${o},且本仓 scope @${n} 行在磁盘文件中缺位——bun publish 的 scope 映射优先级会使公网轨发布回退默认镜像源并以 missing authentication 失败(issue 0008)`:o},Pm=async(e,t={})=>{let r=t.dir??process.cwd(),a=l(r,`bunfig.toml`),o=gp(r),c,u;o&&(c=(await Em({explicitPath:t.globalsPath})).presetScopes,u=await km(r));let d=o?vp(_p(r,``)):void 0,f=rp(ip(e,r),{isRoot:o,installScopesPreset:c,selfScope:d,repoInstall:u});if(!f?.shouldWrite){if(t.dryRun&&X(`(无 coverage 配置,不会生成 bunfig.toml)`),t.check===!0&&n(a))throw new Yf(a,`该包无 coverage 配置,生成器判定不应存在 bunfig.toml(多余文件),请删除该文件`);return{status:`skipped`,bunfigPath:a}}if(t.dryRun)return X(`[dry-run] 将写入 ${a}:`),X(f.content),{status:`generated`,bunfigPath:a};if(t.check===!0){if(!n(a))throw new Yf(a,d===void 0?`bunfig.toml 不存在(生成器预期应存在)`:`bunfig.toml 不存在,本仓 scope @${d} 未注入 [install.scopes]——bun publish 的 scope 映射优先级会使公网轨发布回退默认镜像源并以 missing authentication 失败(issue 0008)`);let e=i(a,`utf8`);if(!e.includes(`@lzi-bun-cli 自动生成,请勿编辑`))throw new Yf(a,`bunfig.toml 为手写文件(无生成标记),不受 lzi-bun-cli 管理;如需接管请确认内容后删除该文件重新生成`);if(e!==f.content)throw new Yf(a,Nm(e,f.content,d));return X(`校验通过 ${a}(与生成器预期一致)`),{status:`checked`,bunfigPath:a}}if(n(a)&&!i(a,`utf8`).includes(`@lzi-bun-cli 自动生成,请勿编辑`))throw new Xf(a);return s(a,f.content,`utf8`),X(`已生成 ${a}(lzi-bun-cli 接管覆盖率配置)`),{status:`generated`,bunfigPath:a}},Fm=e=>{let t=e?.test;if(t===void 0)return;let r=t.coverageThreshold;if(r===void 0)return;let a=l(process.cwd(),t.coverageDir??`coverage`,`lcov.info`);if(!n(a)){X(`未找到覆盖率报告 ${a},跳过全局阈值判定`);return}let o=cp(ap(i(a,`utf8`)),r);if(o.passed)for(let e of up(o))X(e);else{Z(`错误: 覆盖率全局汇总低于阈值`);for(let e of up(o))Z(e);process.exit(1)}},Im=async e=>{let t=await _m();await mm({config:t,packageDir:process.cwd(),repoRoot:am(process.cwd()),strict:!1,subject:_p(process.cwd(),process.cwd())});let n=t.test?.passWithNoTests??!0;await Mm(t.test?.include??Am)===0&&(n&&(X(`无测试文件,跳过(type-only / facade 包,passWithNoTests)`),process.exit(0)),Z(`错误: 未找到测试文件,且 test.passWithNoTests 为 false`),Z(`(如该包确为 type-only / facade 包,请在 lzi-dev.config.ts 设置 test.passWithNoTests: true)`),process.exit(1));try{await Pm(t)}catch(e){throw(e instanceof Xf||e instanceof bf||e instanceof vm)&&(Z(`错误: ${e.message}`),process.exit(1)),e}let r=jm(e),i=await Bun.spawn(r,{cwd:process.cwd(),stdout:`inherit`,stderr:`inherit`}).exited;i!==0&&process.exit(i),Fm(t)},Lm=async(e,t,n)=>{let r=await _m();try{await mm({config:r,packageDir:process.cwd(),repoRoot:am(process.cwd()),strict:!0,subject:_p(process.cwd(),process.cwd())}),await Pm(r,{dryRun:e,globalsPath:t,check:n})}catch(e){throw(e instanceof Xf||e instanceof Yf||e instanceof bf||e instanceof vm||e instanceof dp)&&(Z(`错误: ${e.message}`),process.exit(1)),e}},Rm=e=>{let t=hp(e);t===`missing-package-json`&&(Z(`错误: 当前目录 ${e} 无 package.json,--recursive 须在 monorepo root 执行`),process.exit(1)),t!==`root`&&(Z(`错误: ${e} 的 package.json 未声明 workspaces 字段,--recursive 须在 monorepo root 执行`),process.exit(1))},zm=async(e,t,n)=>{let r=process.cwd();Rm(r);let i=await Jf(r,{configFileName:`lzi-bun.config.ts`}),a=[{name:_p(r,r.split(`/`).pop()??`root`),dir:r}];a.push(...i.map(e=>({name:e.name,dir:e.dir})));let o=n===!0?`校验`:e?`预览`:`生成`;X(`发现 ${a.length} 个目标(root 1 + 子包 ${i.length}),开始${o}...`);let s=[];for(let i of a){X(`▶ ${i.name}`);try{let a=await _m(i.dir);await mm({config:a,packageDir:i.dir,repoRoot:r,strict:!0,subject:i.name});let{status:o}=await Pm(a,{dryRun:e,check:n,dir:i.dir,globalsPath:t});s.push({name:i.name,dir:i.dir,status:o})}catch(e){s.push({name:i.name,dir:i.dir,status:`failed`,reason:e instanceof Error?e.message:String(e)})}}let c=s.filter(e=>e.status===`generated`),l=s.filter(e=>e.status===`checked`),u=s.filter(e=>e.status===`skipped`),d=s.filter(e=>e.status===`failed`);if(X(``),X(`汇总:${c.length} 生成 / ${l.length} 一致 / ${u.length} 跳过 / ${d.length} 失败`),d.length>0){Z(``),Z(`失败子包:`);for(let e of d)Z(` - ${e.name}:${e.reason}`);process.exitCode=1}},Bm=async e=>{let t=e.dryRun===!0,n=e.check===!0;if(t&&n&&(Z(`错误: --dry-run 与 --check 互斥(预览与校验是两种只读形态,请二选一)`),process.exit(1)),e.globalsPath!==void 0){let t=xm({explicitPath:e.globalsPath});t.ok||(Z(`错误: ${ym(t.failure.attempted)}`),process.exit(1));let{globalsRoot:n,source:r}=t.resolution;wm(process.cwd(),n),X(`已定位 globals 仓(${r})并固化到 .env:${n}`)}e.recursive===!0?await zm(t,e.globalsPath,n):await Lm(t,e.globalsPath,n)},Vm=/* @__PURE__ */ new Set([`contract`,`main`,`type-only`]);async function Hm(e,t){let n=u(t,e),r=_p(e,n||`root`),i=Sp(n),a=null,o=`custom`,s;try{a=await _m(e),o=a?.preset??`custom`,s=await dm({config:a,packageDir:e,repoRoot:t,strict:!1,subject:r})}catch{o=`load-error`,s=[{kind:`preset-layer-mismatch`,details:[`lzi-bun.config.ts 加载失败,无法确认声明的预设。请检查文件内的导入与语法,常见原因是配置仍用旧具名工厂,或预设子路径版本尚未发布`]}]}let c=Vm.has(o)?im(e).verdict:`not-scanned`;return{name:r,path:n,layer:i,preset:o,verdict:c,tests:await hm(a,e),violations:s}}async function Um(e){let t=process.cwd();e.recursive===!0&&hp(t)!==`root`&&(Z(`错误:--recursive 须在含 workspaces 字段的 workspace 根执行`),process.exit(1));let n=[t];if(e.recursive===!0){let e=await Jf(t,{configFileName:`lzi-bun.config.ts`});n.push(...e.map(e=>e.dir))}let r=Op(t),i=[];for(let e of n)i.push(await Hm(e,t));if(e.json===!0)X(JSON.stringify({rows:i},null,2));else{X(`审计 ${i.length} 个目标`);for(let e of i){let t=e.violations.filter(t=>!kp(r,e.path,t.kind)),n=t.length>0?` 违规 ${t.length} 项`:e.violations.length>0?` 基线内`:` 合规`;X(` ${e.path||`根目录`} 分层 ${e.layer} 预设 ${e.preset} 判定 ${e.verdict} 测试 ${e.tests}${n}`);for(let e of t)for(let t of e.details.slice(0,3))Z(` - ${t}`)}}if(e.initBaseline===!0){let e=/* @__PURE__ */ new Set;for(let t of i)for(let n of t.violations)e.add(`${t.path}|${n.kind}`);Ap(t,[...e].map(Mp)),X(`已落盘基线 ${e.size} 条至 .lzi/baselines/lzi-bun.typeonly.json`)}else if(e.pruneBaseline===!0){let e=/* @__PURE__ */ new Set;for(let t of i)for(let n of t.violations)e.add(`${t.path}|${n.kind}`);let n=jp(t,e);n.length>0?(Ap(t,[...r].filter(e=>!n.includes(e)).map(Mp)),X(`已从基线移除 ${n.length} 条已修复条目`)):X(`基线无已修复条目可移除`)}else if(e.check===!0){let e=i.reduce((e,t)=>e+t.violations.filter(e=>!kp(r,t.path,e.kind)).length,0);e>0&&(Z(`错误:${e} 项违规不在基线内,基线只减不增,请先治理违规再重试`),process.exitCode=1)}}function Wm(e){Gm(e),Ym(e),Jm(e),Km(e),qm(e)}function Gm(e){Su(e,{name:`test`,description:`运行 bun 测试(替代三件套,零测试包默认放行)`,options:[{flags:`--watch`,description:`监听模式(对应 test:watch)`},{flags:`--coverage`,description:`覆盖率(对应 test:coverage)`}],schema:Nl({watch:Tl().optional(),coverage:Tl().optional()}),action:async(e,t)=>{await Im({watch:e.watch===!0,coverage:e.coverage===!0,extra:t})}})}function Km(e){Su(e,{name:`lockfile check`,description:`校验单一 bun.lock 不变量与 workspaces 覆盖缺口`,schema:Nl({}),action:async()=>{await af()}})}function qm(e){Su(e,{name:`node-links check`,description:`检测 node_modules 悬挂符号链接,命中即非零退出`,schema:Nl({}),action:async()=>{await pf()}}),Su(e,{name:`node-links fix`,description:`回收 node_modules 悬挂死链,删除前复验,有效链接零触碰`,schema:Nl({}),action:async()=>{await mf()}})}function Jm(e){Su(e,{name:`typeonly audit`,description:`检查各包的目录分层、预设声明与包内容是否符合规则,并管理违规基线`,options:[{flags:`-r, --recursive`,description:`递归审计 workspace 内全部含 lzi-bun.config.ts 的包`},{flags:`--check`,description:`校验模式,实际违规须为基线子集,否则非零退出`},{flags:`--json`,description:`以 JSON 形态输出审计行`},{flags:`--init-baseline`,description:`落盘当前全量违规为基线祖父条款`},{flags:`--prune-baseline`,description:`移除基线中已修复的条目,只减不增`}],schema:Nl({recursive:Tl().optional(),check:Tl().optional(),json:Tl().optional(),initBaseline:Tl().optional(),pruneBaseline:Tl().optional()}),action:async e=>{await Um({recursive:e.recursive===!0,check:e.check===!0,json:e.json===!0,initBaseline:e.initBaseline===!0,pruneBaseline:e.pruneBaseline===!0})}})}function Ym(e){Su(e,{name:`config generate`,description:`生成 bunfig.toml(不执行测试,支持 --dry-run 预览、--check 校验、-r 批量、--globals 定位)`,options:[{flags:`--dry-run`,description:`仅预览将写入的内容,不写盘`},{flags:`--check`,description:`仅校验磁盘 bunfig.toml 与生成器预期是否一致(漂移即报错退出,不写盘)`},{flags:`-r, --recursive`,description:`递归处理 monorepo 下含 lzi-bun.config.ts 的子包`},{flags:`--globals <path>`,description:`一次性 bootstrap 定位 globals 仓(命中后固化 .env,此后零参数)`}],schema:Nl({dryRun:Tl().optional(),check:Tl().optional(),recursive:Tl().optional(),globals:el().optional()}),action:async e=>{await Bm({dryRun:e.dryRun===!0,check:e.check===!0,recursive:e.recursive===!0,globalsPath:e.globals})}})}const Xm=vu({name:`lzi-bun-cli`,description:`Longzai Intelligence bun 工具集`,interaction:Vd,color:Bd});Wm(Xm);async function Zm(){await Xm.parseAsync(process.argv)}Zm().catch(e=>{process.stderr.write(`错误: ${e instanceof Error?e.message:String(e)}\n`),process.exit(1)});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-bun/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Longzai Intelligence Bun 工具集 CLI",
5
5
  "keywords": [
6
6
  "bun",
@@ -40,7 +40,7 @@
40
40
  "test:coverage": "bun test --coverage"
41
41
  },
42
42
  "dependencies": {
43
- "@longzai-intelligence-bun/config": "0.1.0",
43
+ "@longzai-intelligence-bun/config": "0.1.1",
44
44
  "@longzai-intelligence-cli/core": "^0.0.10",
45
45
  "@longzai-intelligence-cli/standard": "^0.0.10",
46
46
  "@longzai-intelligence-logger/node": "^0.1.8",