Date: 2026-08-08 14:38 Summary: Adopted structural tool isolation: catalog/i18n shards, merge pipeline, generated registry, isolation lint, and tool-creation rules.
[question] 采用结构层
[try to solve]
Landed “structural layer” isolation: each tool’s editable source of truth is sharded by slug; merge outputs are script-generated; new tools no longer hand-edit src/index.ts or other tools’ files.
Editable source of truth
src/site/tool-catalog.d/{slug}.json(includespage.module/page.export/page.style)src/site/i18n/tools/{slug}/{lang}.tssrc/site/i18n/core/{lang}.ts(site-wide; do not touch for single-tool work)src/pages/{camel}Page.ts
Generated — do not hand-edit
src/site/tool-catalog.jsonsrc/site/i18n/{lang}.tssrc/site/toolPageRegistry.generated.tsscripts/site/i18n-tools.generated.mjs
Scripts and npm
npm run split:tools— one-time split from old monolith (do not re-run daily without a prior merge)npm run merge:tools— merge shards; hooked intobuild:site;--no-buildstart:devalso merges firstTOOL_SLUG={slug} npm run lint:tool-isolation— path allowlist; cross-tool edits needCROSS_TOOL_UPDATE=1
Registration
src/index.tsloopsTOOL_PAGE_RENDERERSintoregisterToolPage(32 tools).
Rules
.cursor/rules/tool-creation.mdcupdated to the shard workflow and ship checklist.
Verification
lint:seoOK; local/zh/tools/flip-image,/tools/image-exif,/zh/tools/images-to-gif,/zh/tools/image-compressall 200.
[actions]
- Added
scripts/tool-modules/{lib,split-once,merge-all}.mjs,scripts/check-tool-isolation.mjs - Created
src/site/tool-catalog.d/*,src/site/i18n/core/*,src/site/i18n/tools/** - Regenerated catalog / locale / registry /
i18n-tools.generated.mjs - Updated
package.json,src/index.ts,scripts/site/i18n.mjs,ops/dev/start-dev.mjs,.cursor/rules/tool-creation.mdc