@tbox.cn/app-cli 0.9.7 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @tbox.cn/app-cli
2
2
 
3
- tbox-app CLI(公开生成应用面):starter / create / new / skills / schema / module add|remove|list|sync|diff|doctor|inspect|update / provider / theme / miniapp-container(纯函数核心 + commander 薄壳)。
3
+ tbox-app CLI(公开生成应用面):starter / create / new / skills / schema / check / module add|remove|list|sync|diff|doctor|inspect|update / provider / theme / miniapp-container(纯函数核心 + commander 薄壳)。
4
4
 
5
- 仓内开发命令(dev / new repo 形态 / module pack|publish / start|stop / eval)由私有包 @tbox.cn/app-cli-dev(bin:`tbox-app-dev`)承载——归属判据:公开命令集 ≡ 生成应用 AGENTS.md 契约表(2026-10-14 cli-dev 拆分,见 Agent Note `.agents/notes/implemented/architecture/2026-10-14-cli-dev-split.md`)。
5
+ 仓内开发命令(dev / new repo 形态 / module pack|publish / start|stop / eval)由私有包 @tbox.cn/app-cli-dev(bin:`tbox-app-dev`)承载——归属判据:公开命令面服务生成应用;完整发现入口为 --help 与 skills list(2026-10-14 cli-dev 拆分,见 Agent Note `.agents/notes/implemented/architecture/2026-10-14-cli-dev-split.md`)。
6
6
 
7
7
  ## 安装
8
8
 
@@ -25,6 +25,10 @@ npx --yes @tbox.cn/app-cli module doctor
25
25
  npx --yes @tbox.cn/app-cli schema config/integrations.json # 配置形状(record/strict/最小示例)
26
26
  npx --yes @tbox.cn/app-cli skills get integration # 流程知识(随 CLI 发布,无需安装)
27
27
  npx --yes @tbox.cn/app-cli module inspect # 能力/绑定矩阵(--json)
28
+ npx --yes @tbox.cn/app-cli module inspect --all # 批量能力地图与定向阅读入口
29
+ npx --yes @tbox.cn/app-cli schema config/chat.json --json # 应用 SDK 的配置契约
30
+ npx --yes @tbox.cn/app-cli check run test --filter <pkg> # 一次执行并保存退出码与完整诊断
31
+ npx --yes @tbox.cn/app-cli check show last --match FAIL # 读取已保存诊断,不重新执行
28
32
  ```
29
33
 
30
34
  命令详见 `npx --yes @tbox.cn/app-cli --help`(全局安装后亦可 `tbox-app --help`)。
@@ -48,3 +52,15 @@ npx --yes @tbox.cn/app-cli skills get verify # 三级回路与
48
52
  ```
49
53
 
50
54
  `skill add` 已退役(内容不再落地到 `.agents/skills`)。命令参数见各子命令 `--help`。
55
+
56
+ ## 可编辑卡片资源
57
+
58
+ `home list` 列出资源,`home inspect <id>` 读取用法与数据示例,`home add <ids...>` 将选中源码及依赖闭包复制到 `apps/client/src/components/home/`,并声明所需运行依赖。默认资源包为 `@tbox.cn/app-card-assets@0.1.0`,可通过 `--source` 使用本地目录、tgz 或 registry 包,通过 `--registry` 覆盖下载源。
59
+
60
+ 相同文件重复执行跳过,不同文件报冲突并保留应用修改;不提供强制覆盖,不自动注册 home 槽。复制后运行 pnpm install,读取复制目录中的 shared/home-integration.md 组合与接线;已有商圈首页先确认替换方案。资源包只供开发期使用,不加入应用运行依赖。
61
+
62
+ ```sh
63
+ npx --yes @tbox.cn/app-cli home list
64
+ npx --yes @tbox.cn/app-cli home inspect BlockIntro
65
+ npx --yes @tbox.cn/app-cli home add BlockIntro BlockServiceIconList BlockQuestionList
66
+ ```
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import{e as Y,f as H,g as Z,h as X,i as q,j as Q,k as tt}from"./chunk-UOUZPGPV.js";import{existsSync as bt}from"fs";import kt from"path";var vt=[{path:"apps/server/src/modules.ts",kind:"server-modules"},{path:"apps/client/src/modules.ts",kind:"client-modules"}];function pe(e){let t=vt.filter(r=>!bt(kt.join(e,r.path))).map(r=>r.path);if(t.length>0)throw new Error(`本应用无模块装配面(${t.join("、")} 缺席)——该模板不支持模块系统,不能安装模块或 Provider`)}function wt(e){return e.split(/[^A-Za-z0-9]+/).filter(Boolean).map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function A(e,t){return wt(t)}function ce(e,t){return I[e].contributes(t)}function S(e){return e.replace(/^@[^/]+\//,"").replace(/\/(server|client)$/,"").replace(/\/$/,"")}var I={"server-modules":{mapMarker:"register",importExport:"serverModule",importSuffix:"server",entryPattern:/^\s*([A-Za-z_$][\w$]*),\s*$/,header:"const modules = [",footer:"];",contributes:e=>e.hasServerEntry},"client-modules":{mapMarker:"register",importExport:"clientModule",importSuffix:"client",entryPattern:/^\s*([A-Za-z_$][\w$]*),\s*$/,header:"const modules = [",footer:"];",contributes:e=>e.hasClientEntry}},L=/^import\s*\{\s*([\w$]+)\s+as\s+([\w$]+)\s*\}\s*from\s*['"]([^'"]+)['"];\s*$/,z=/^\]\s*(?:as\s+const)?;\s*$/;function F(e,t){let r=`// @tbox:${t}-begin`,s=`// @tbox:${t}-end`,n=e.indexOf(r);if(n===-1)return null;let i=e.indexOf(s,n);if(i===-1)return null;let o=n+r.length;return{block:e.slice(o,i),start:o,end:i}}function _(e,t,r){return e.slice(0,t.start)+r+e.slice(t.end)}function le(e,t){let r=I[t],s=[],n=[],i=[],o=F(e,"imports");if(o)for(let p of o.block.split(/\r?\n/)){let m=p.match(L);m?s.push(S(m[3])):p.trim()&&n.push(`imports: ${p.trim()}`)}else i.push("imports");let u=F(e,r.mapMarker);if(u){let p=u.block.split(/\r?\n/),m=p.findIndex(d=>d.trim().startsWith(r.header)),f=[...p].reverse().findIndex(d=>z.test(d.trim())),x=f===-1?-1:p.length-1-f;if(m===-1||x<=m)i.push(r.mapMarker);else for(let d of p.slice(m+1,x))!d.match(r.entryPattern)&&d.trim()&&n.push(`${r.mapMarker}: ${d.trim()}`)}else i.push(r.mapMarker);let c=new Map;if(o)for(let p of o.block.split(/\r?\n/)){let m=p.match(L);m&&c.set(m[2],S(m[3]))}let l=[];if(u){let p=u.block.split(/\r?\n/),m=p.findIndex(d=>d.trim().startsWith(r.header)),f=[...p].reverse().findIndex(d=>z.test(d.trim())),x=f===-1?-1:p.length-1-f;if(m!==-1&&x>m)for(let d of p.slice(m+1,x)){let y=d.match(r.entryPattern);if(y){let k=c.get(y[1]);k&&l.push(k)}}}return{moduleIds:[...new Set([...s,...l])],nonStandardLines:n,broken:i}}function ue(e,t,r,s=!1){let n=I[t],i=[],o=r.filter(n.contributes),u=new Map(o.map(a=>[A(t,a.id),a])),c=e,l=!1,p=F(c,"imports");if(!p)return i.push(`[${t}] imports 锚区缺失/破坏,跳过`),{content:c,changed:l,warnings:i,moduleIds:[]};let m=p.block.split(/\r?\n/),f=[];for(let a of m){let g=a.match(L);if(!g){if(a.trim()==="")continue;s||i.push(`[${t}] imports 锚区非标行保留: ${a.trim()}`),s||f.push(a);continue}let b=g[2],yt=g[3],E=u.get(b);E&&S(E.pkg)===S(yt)?f.push(a):(E&&f.push(et(t,b,E.pkg)),l=!0)}for(let a of o){let g=A(t,a.id);f.some(b=>b.includes(`as ${g} } from`))||(f.push(et(t,g,a.pkg)),l=!0)}let x=C(f.join(`
3
+ `));x!==p.block&&(c=_(c,p,x),l=!0);let d=F(c,n.mapMarker);if(!d)return i.push(`[${t}] ${n.mapMarker} 锚区缺失/破坏,跳过`),{content:c,changed:l,warnings:i,moduleIds:[]};let y=d.block.split(/\r?\n/),k=y.findIndex(a=>a.trim().startsWith(n.header)),J=[...y].reverse().findIndex(a=>z.test(a.trim())),$=J===-1?-1:y.length-1-J;if(k===-1||$<=k){if(s){let a=C([n.header,...o.map(g=>N(t,A(t,g.id))),n.footer].join(`
4
+ `));return a!==d.block&&(c=_(c,d,a),l=!0),{content:c,changed:l,warnings:i,moduleIds:o.map(g=>g.id)}}return i.push(`[${t}] ${n.mapMarker} 锚区结构不符合预期,降级为告警不覆盖`),{content:c,changed:l,warnings:i,moduleIds:[]}}let gt=y.slice(0,k),ft=y.slice($+1),ht=y.slice(k+1,$),w=[];for(let a of ht){let g=a.match(n.entryPattern);if(!g){if(a.trim()==="")continue;s||i.push(`[${t}] ${n.mapMarker} 锚区非标行保留: ${a.trim()}`),s||w.push(a);continue}let b=g[1];u.has(b)?w.push(N(t,b)):l=!0}for(let a of o){let g=A(t,a.id);w.some(b=>b.includes(g))||(w.push(N(t,g)),l=!0)}let xt=y[$],G=C([...gt,n.header,...w,xt,...ft].join(`
5
+ `));return G!==d.block&&(c=_(c,d,G),l=!0),{content:c,changed:l,warnings:i,moduleIds:o.map(a=>a.id)}}function C(e){let t=e.split(/\r?\n/);for(;t.length>0&&t[0].trim()==="";)t.shift();for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();return`
6
+ `+t.join(`
7
+ `)+`
8
+ `}function et(e,t,r){let s=I[e];return`import { ${s.importExport} as ${t} } from '${r}/${s.importSuffix}';`}function N(e,t){return` ${t},`}import{existsSync as Mt,readFileSync as $t}from"fs";import O from"path";var Et=["dependencies","optionalDependencies","peerDependencies","devDependencies"],At=/^\s+["']?([^"':#\s]+)["']?\s*:\s*(.+?)\s*(?:#.*)?$/;function St(e){let t=new Map,r=!1;for(let s of e.split(`
9
+ `)){let n=s.replace(/\r$/,"");if(/^\S/.test(n)){r=/^catalog\s*:/.test(n);continue}if(!r)continue;let i=n.match(At);i&&t.set(i[1],i[2].replace(/^['"]|['"]$/g,""))}return t}function Ft(e){let t=O.resolve(e);for(;;){let r=O.join(t,"pnpm-workspace.yaml");if(Mt(r)){let n=St($t(r,"utf8"));return n.size>0?n:void 0}let s=O.dirname(t);if(s===t)return;t=s}}function It(e){let t=new Map;for(let r of Et){let s=e[r];if(!(!s||typeof s!="object"||Array.isArray(s)))for(let[n,i]of Object.entries(s))i==="catalog:"&&t.set(n,r)}return t}function Rt(e,t){if(!t)return[];let r=[];for(let[s,n]of It(e))t.has(s)||r.push({key:s,field:n});return r}function rt(e,t,r){let s=Rt(e,Ft(t));if(s.length>0){let n=s.map(({key:i,field:o})=>`${o}["${i}"]`).join("、");throw new Error(`${r}: 依赖引用了应用 catalog 不存在的键(${n})——删除该引用或在 pnpm-workspace.yaml catalog 补键`)}}import{existsSync as Dt}from"fs";import nt from"path";var jt=/^@tbox\.cn\/app-/,Pt=/^@tbox\.cn\/app-(?:(?:agent-)?sdk|toolkit|contracts(?:-|$))/,Tt=new Set(["@tbox.cn/app-contracts-mall"]);function ye(e){return Pt.test(e)}function be(e){return Tt.has(e)}var _t=new Set(["@tbox.cn/app-agent-ui-kit"]);function ke(e){let t=[],r=s=>{let n=e[s];return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:null};for(let s of _t){if(["dependencies","optionalDependencies","devDependencies"].some(o=>s in(r(o)??{}))){t.push({pkg:s,state:"hard-dep"});continue}if(!(s in(r("peerDependencies")??{})))continue;let n=(r("peerDependenciesMeta")??{})[s];if(n===void 0){t.push({pkg:s,state:"peer-no-meta"});continue}n!==null&&typeof n=="object"&&!Array.isArray(n)&&n.optional===!0||t.push({pkg:s,state:"peer-not-optional"})}return t}function ve(e,t){if(!jt.test(t))return null;let r=t.replace(/^@tbox\.cn\/app-/,""),s=nt.join(e,r);return Dt(nt.join(s,"tbox.module.json"))?s:null}import{existsSync as Ct,readFileSync as Nt,realpathSync as Lt}from"fs";import st from"path";var Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,zt=/^@tbox\.cn\/app-theme-([a-z0-9-]+)$/,Ot=/^[ \t]*import\s+['"](@tbox\.cn\/app-theme-[a-z0-9-]+)\/index\.css['"];?[ \t]*$/gm,Vt=/^[ \t]*import\s+['"](@tbox\.cn\/app-theme-[a-z0-9-]+)\/brand\.js['"];?[ \t]*$/gm,Wt=/^[ \t]*import\s*\{\s*applyTheme\s*\}\s*from\s*['"](?:@app\/agent-ui-kit|@tbox\.cn\/app-agent-ui-kit)\/theme['"];?[ \t]*$/m,Bt=/^[ \t]*applyTheme\(\s*['"]([^'"]+)['"]\s*\);?[ \t]*$/gm,Kt=/^[ \t]*import\s+['"]@tbox\.cn\/app-theme-[a-z0-9-]+\/index\.css['"];?[ \t]*$/m,it=["src/platform/bootstrap.ts","src/platform/bootstrap.tsx","src/main.tsx","src/App.tsx","src/app.tsx"];function ot(e){let t=[...e.matchAll(Ot)];if(t.length===0)throw new Error("无主题接线点(apps/client/src/platform/bootstrap.ts 等接线入口无主题 css import)——support/h5 模板或未接线形态不适用 --theme / theme use");if(t.length>1||new Set(t.map(u=>u[1])).size>1)throw new Error(`主题接线不唯一(${t.map(u=>u[1]).join(", ")})——换主题 = 替换语义,请先手工归一到单主题`);let r=t[0][1],s=zt.exec(r);if(!s)throw new Error(`主题包名越界:${r}(须 ^@tbox.cn/app-theme-<id>$)`);let n=s[1],i=[...e.matchAll(Vt)];if(i.length>1||i[0]&&i[0][1]!==r)throw new Error("brand.js 接线与主题包不一致(替换语义要求单主题三行自洽)");let o=[...e.matchAll(Bt)];if(o.length!==1)throw new Error(`applyTheme 调用不唯一(${o.length} 处)——接线三行须恰一处`);if(o[0][1]!==n)throw new Error(`applyTheme('${o[0][1]}') 与接线包后缀 '${n}' 不一致——请先修正接线三行`);if(!Wt.test(e))throw new Error("缺 applyTheme import 行(@app/agent-ui-kit/theme 或 @tbox.cn/app-agent-ui-kit/theme)——接线三行不完整");return{factoryPkg:r,factoryId:n,hasBrandJs:i.length===1}}function Ae(e){let t=[],r=new Set;for(let s of it){let n=st.join(e,s);if(!Ct(n))continue;let i;try{i=Lt(n)}catch{continue}if(r.has(i))continue;r.add(i);let o=Nt(n,"utf8");if(Kt.test(o))try{t.push({file:n,src:o,wiring:ot(o)})}catch(u){throw new Error(`apps/client/${s}: ${u.message}`)}}if(t.length===0)throw new Error(`无主题接线点(apps/client/${it.join("、")} 均无主题 css import)——support/h5 模板或未接线形态不适用 --theme / theme use`);if(t.length>1)throw new Error(`主题接线不唯一(${t.map(s=>st.relative(e,s.file)).join("、")})——换主题 = 替换语义,请先手工归一到单入口`);return t[0]}function Se(e,t){ot(e);let r=/^[ \t]*import\s+['"]@tbox\.cn\/app-theme-[a-z0-9-]+\/brand\.js['"];?[ \t]*$/m.test(e),s=[];for(let n of e.split(`
10
+ `)){let i=n.trim(),o=n.slice(0,n.length-n.trimStart().length);if(/^import\s+['"]@tbox\.cn\/app-theme-[a-z0-9-]+\/index\.css['"];?$/.test(i)){s.push(`${o}import '${t.pkg}/index.css';`),t.hasBrandJs&&!r&&s.push(`${o}import '${t.pkg}/brand.js';`);continue}if(/^import\s+['"]@tbox\.cn\/app-theme-[a-z0-9-]+\/brand\.js['"];?$/.test(i)){t.hasBrandJs&&s.push(`${o}import '${t.pkg}/brand.js';`);continue}if(/^applyTheme\(/.test(i)){s.push(`${o}applyTheme('${t.id}');`);continue}s.push(n)}return s.join(`
11
+ `)}import{existsSync as D,readFileSync as lt,mkdtempSync as ut,rmSync as mt}from"fs";import{execFileSync as Jt}from"child_process";import{tmpdir as j}from"os";import{readFile as Gt,readdir as Yt,stat as Ce}from"fs/promises";import h from"path";import{execFileSync as R}from"child_process";import at from"path";var M=null;function V(e){if(e?.startsWith("@tbox.cn/"))try{let r=R("pnpm",["config","get","@tbox.cn:registry"],{encoding:"utf8"}).trim().split(/\r?\n/).pop()??"";if(r)return r}catch{}if(M)return M;try{M=R("pnpm",["config","get","registry"],{encoding:"utf8"}).trim().split(/\r?\n/).pop()??"https://registry.npmjs.org/"}catch{M="https://registry.npmjs.org/"}return M}function pt(e){return/^@[^/]+\/[^@/]+(@.+)?$/.test(e)}function Ut(e){return e.replace(/@[^/]+$/,"")}function ct(e,t,r){let s=r??V(Ut(e)),n=["view",e,"dist.tarball"];r&&n.push("--registry",r);let o=R("pnpm",n,{encoding:"utf8"}).trim().split(/\r?\n/).pop()??"";if(!o)throw new Error(`registry 拉取失败:${e} 无 dist.tarball(registry=${s})`);let u=o.split("/").pop()??`${e.replace(/^@/,"").replace(/\//g,"-").split("@")[0]}.tgz`,c=at.join(at.resolve(t),u);return R("curl",["-fsSL","-o",c,o],{stdio:"ignore"}),c}var Ht=new Set(["node_modules","dist","dist-ssr",".git",".tbox"]);async function dt(e,t,r){let s=await Yt(e,{withFileTypes:!0});for(let n of s){let i=h.join(e,n.name),o=h.relative(t,i).split(h.sep).join("/");if(n.isDirectory()){if(Ht.has(n.name))continue;await dt(i,t,r)}else n.isFile()&&r.push(o)}}var P=class{constructor(t){this.dir=t;this.name=h.basename(h.resolve(t))}dir;name;getDir(){return this.dir}async listFiles(){let t=[];return await dt(this.dir,this.dir,t),t.sort()}async readFile(t){return Gt(h.join(this.dir,t),"utf8")}static isUsable(t){return D(h.join(t,"package.json"))}resolveVersion(){return Zt(this.dir).version}};function Zt(e){let t;try{t=lt(h.join(e,"package.json"),"utf8")}catch{return{version:"0.0.0"}}try{let r=JSON.parse(t);return{name:r?.name,version:r?.version??"0.0.0"}}catch{return{version:"0.0.0"}}}var W=class{constructor(t,r){this.spec=t;this.registry=r;this.name=t,this.packDir=ut(h.join(j(),"tbox-reg-"))}spec;registry;name;inner=null;packDir;resolvedName="";resolvedVersion="";resolve(){if(this.inner)return this.inner;let t=this.spec.replace(/@[^/]+$/,""),r=this.registry??V(t);console.log(`📦 从 registry 拉取 ${this.spec}(${r})`);let s=ct(this.spec,this.packDir,this.registry);this.inner=new T(s);let n,i="";try{let o=JSON.parse(lt(h.join(this.inner.getDir(),"package.json"),"utf8"));n=o.name,i=o.version??""}catch{}return this.resolvedName=n??this.spec,this.resolvedVersion=i,console.log(` → ${this.resolvedName}@${this.resolvedVersion}`),this.inner}listFiles(){return Promise.resolve(this.resolve()).then(t=>t.listFiles())}readFile(t){return Promise.resolve(this.resolve()).then(r=>r.readFile(t))}resolveVersion(){return this.resolve(),this.resolvedVersion}getDir(){return this.resolve().getDir()}get resolvedPackage(){return{name:this.resolvedName,version:this.resolvedVersion}}dispose(){this.inner&&this.inner.dispose();try{this.packDir.startsWith(j())&&mt(this.packDir,{recursive:!0,force:!0})}catch{}}};function ze(e,t){if(e.endsWith(".tgz")&&D(e)){let r=new T(e);return{sourceDir:r.getDir(),source:r}}if(!D(e)&&pt(e)){let r=new W(e,t);return{sourceDir:r.getDir(),source:r}}return{sourceDir:e,source:new P(e)}}var T=class{name;inner;tmpRoot;constructor(t){let r=h.resolve(t);this.name=h.basename(r,".tgz"),this.tmpRoot=ut(h.join(j(),"tbox-tgz-")),Jt("tar",["-xzf",r,"-C",this.tmpRoot],{stdio:"ignore"});let s=h.join(this.tmpRoot,"package");this.inner=new P(D(s)?s:this.tmpRoot)}getDir(){return this.inner.getDir()}listFiles(){return this.inner.listFiles()}readFile(t){return this.inner.readFile(t)}resolveVersion(){return this.inner.resolveVersion()}dispose(){try{this.tmpRoot.startsWith(j())&&mt(this.tmpRoot,{recursive:!0,force:!0})}catch{}}};function Ue(e){return H(e)}async function Je(e,t){Y(e,t)}function Ge(e,t){return Z(e,t)}function Ye(e,t){return X(e,t)}function He(e,t){return q(e,t)}function Ze(e,t,r){return Q(e,t,r)}function Xe(e,t){tt(e,t)}import{existsSync as B,readFileSync as Xt}from"fs";import K from"path";function er(e){if(B(K.join(e,".tbox","app.json")))return{kind:"app",appDir:e};let t=K.join(e,"pnpm-workspace.yaml");if(B(t)&&B(K.join(e,"modules"))){let r=Xt(t,"utf8");if(/modules\/\*/.test(r))return{kind:"repo",repoRoot:e}}throw new Error("当前目录既非 tbox 应用(缺 .tbox/app.json)也非 tbox-app 仓库根(workspace 缺 modules/*)——cd 到应用目录或仓库根后重试")}import{existsSync as U,readdirSync as qt,readFileSync as Qt}from"fs";import{mkdir as te,readFile as ee,writeFile as re}from"fs/promises";import v from"path";import{fileURLToPath as ne}from"url";var se=v.dirname(ne(import.meta.url)),ie=new Set(["scaffold.json"]);function pr(e){return v.join(se,"..","scaffold",e)}async function cr(e,t,r,s){if(!U(e))throw new Error(`骨架资产缺失: ${e}(发布态 files 白名单须含 scaffold)`);if(U(t)&&!s)throw new Error(`目标目录已存在: ${t}(加 --force 覆盖)`);let n=v.join(e,"package.json");if(U(n)){let u=JSON.parse(Qt(n,"utf8"));rt(u,t,`scaffold ${v.basename(e)}`)}let i=[],o=async(u,c)=>{for(let l of qt(u,{withFileTypes:!0})){let p=v.join(u,l.name),m=c?`${c}/${l.name}`:l.name;if(l.isDirectory()){await o(p,m);continue}if(ie.has(l.name))continue;let f=v.join(t,m);await te(v.dirname(f),{recursive:!0});let x=await ee(p,"utf8");await re(f,x.replaceAll("__ID__",r.id).replaceAll("__PKG__",r.pkg),"utf8"),i.push(m)}};return await o(e,""),i}export{vt as a,pe as b,ce as c,le as d,ue as e,Et as f,St as g,Ft as h,Rt as i,ye as j,be as k,ke as l,ve as m,Ee as n,zt as o,it as p,ot as q,Ae as r,Se as s,pt as t,P as u,Zt as v,W as w,ze as x,T as y,Ue as z,Je as A,Ge as B,Ye as C,He as D,Ze as E,Xe as F,er as G,pr as H,cr as I};
package/dist/core.d.ts CHANGED
@@ -70,12 +70,6 @@ declare function embeddedPackageDepIssues(manifest: Record<string, unknown>): Em
70
70
  */
71
71
  declare function findInRepoModuleDir(modulesDir: string, pkgName: string): string | null;
72
72
 
73
- /**
74
- * 主题接线词汇与手术(dev --theme 与 theme use 双消费单源——plans/theme-assembly-axis)。
75
- *
76
- * 探测/手术均 **import 语句锚定**(^import 行):main.tsx 注释区含主题字样不得误报。
77
- * 架构定律 A 同构:变换在生成期/命令期完成,运行时消费方(vite-override shim)零逻辑纯重映射。
78
- */
79
73
  interface ThemeWiring {
80
74
  /** 出厂接线包名(如 @tbox.cn/app-theme-tbox) */
81
75
  factoryPkg: string;
@@ -86,10 +80,17 @@ interface ThemeWiring {
86
80
  }
87
81
  /** 主题 id 词法(与 manifest isValidModuleId 同语义——themes/<id> 拼接逃逸免疫) */
88
82
  declare const THEME_ID_RE: RegExp;
89
- /** 接线探测(main.tsx 源文本 → 出厂接线形态)。
90
- * 前置闸:单 css 行 / 单 applyTheme 调用 / 实参与包名后缀一致 / applyTheme import 在场。
91
- * 失配 throw(文案含下一步引导)——调用方零触碰。 */
92
- declare function probeThemeWiring(mainSrc: string): ThemeWiring;
83
+ interface LocatedThemeWiring {
84
+ /** 接线文件绝对路径(手术写回对象) */
85
+ file: string;
86
+ /** 文件源文本(手术/写回基准) */
87
+ src: string;
88
+ wiring: ThemeWiring;
89
+ }
90
+ /** 定位接线入口(候选序;首个完整接线文件即真源)。
91
+ * 多文件同时接线 → throw(替换语义要求单入口);候选在场但接线不完整 → throw 该文件具体失配。
92
+ * 相对路径文案恒以 `apps/client/` 为基准(无关 cwd)。 */
93
+ declare function locateThemeWiring(clientDir: string): LocatedThemeWiring;
93
94
 
94
95
  /**
95
96
  * Source 抽象(003 D11 / 004 D8):create 与 add 共用的模块/模板来源。
@@ -152,4 +153,4 @@ declare function expandScaffoldAsset(assetDir: string, targetDir: string, tokens
152
153
  pkg: string;
153
154
  }, force: boolean): Promise<string[]>;
154
155
 
155
- export { type AssemblyKind, type DeclaredModule, type DoctorIssue, type EmbeddedDepState, THEME_ID_RE, TarballSource, assertValidModuleId, cliScaffoldAsset, detectContext, embeddedPackageDepIssues, expandScaffoldAsset, findInRepoModuleDir, probeThemeWiring, resolveWorkspaceCatalog, syncAssemblyFile };
156
+ export { type AssemblyKind, type DeclaredModule, type DoctorIssue, type EmbeddedDepState, THEME_ID_RE, TarballSource, assertValidModuleId, cliScaffoldAsset, detectContext, embeddedPackageDepIssues, expandScaffoldAsset, findInRepoModuleDir, locateThemeWiring, resolveWorkspaceCatalog, syncAssemblyFile };
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{D as f,E as a,F as x,G as c,e,h as o,l as r,m as t,n as p,p as s,w as d}from"./chunk-E6DFGTST.js";import{b as m,d as l}from"./chunk-UOUZPGPV.js";import"./chunk-IBFYJ3GA.js";export{p as THEME_ID_RE,d as TarballSource,f as assertValidModuleId,x as cliScaffoldAsset,a as detectContext,r as embeddedPackageDepIssues,c as expandScaffoldAsset,t as findInRepoModuleDir,m as parseModuleDescriptor,s as probeThemeWiring,o as resolveWorkspaceCatalog,e as syncAssemblyFile,l as writeAtomic};
2
+ import{F as a,G as f,H as c,I as x,e,h as o,l as r,m as t,n as p,r as s,y as d}from"./chunk-XQYDQKAD.js";import{b as l,d as m}from"./chunk-UOUZPGPV.js";import"./chunk-IBFYJ3GA.js";export{p as THEME_ID_RE,d as TarballSource,a as assertValidModuleId,c as cliScaffoldAsset,f as detectContext,r as embeddedPackageDepIssues,x as expandScaffoldAsset,t as findInRepoModuleDir,s as locateThemeWiring,l as parseModuleDescriptor,o as resolveWorkspaceCatalog,e as syncAssemblyFile,m as writeAtomic};