From 4d1bbab36855f09ef283a8e139ff36d254f1c5bd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:11:32 +0000 Subject: [PATCH 1/4] =?UTF-8?q?ci(ootb):=20=E5=9C=A8=20build=20=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E3=80=81check-ootb=20=E4=B9=8B=E5=89=8D=E5=A1=AB?= =?UTF-8?q?=E5=85=85=20configs/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configs/ 被 gitignore,CI 里从未存在,导致 check-ootb.js 第一项 "必备仓库文件齐全" 恒定失败(缺 db_config.json / bds_updater.json / qq_config.json)。新增一步从 configs-default/ 复制默认配置进 configs/,与 AGENTS.md 中记录的本地开发环境搭建方式保持一致。 Co-authored-by: Shiroha --- .github/workflows/ootb.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ootb.yml b/.github/workflows/ootb.yml index c6ac97d..4c76879 100644 --- a/.github/workflows/ootb.yml +++ b/.github/workflows/ootb.yml @@ -27,6 +27,15 @@ jobs: shell: pwsh run: npm run build --workspaces --if-present + - name: Populate configs/ from configs-default/ + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path configs | Out-Null + Get-ChildItem -Path configs-default -Filter *.json | ForEach-Object { + $dest = Join-Path configs $_.Name + if (-not (Test-Path $dest)) { Copy-Item $_.FullName $dest } + } + - name: Run check-ootb shell: pwsh run: node tools/check-ootb.js From 25b1f731e43ea8ff6d1f34e96c97d8295b6702b6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:11:55 +0000 Subject: [PATCH 2/4] =?UTF-8?q?fix(tools):=20check-catalog.js=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20ESM=20import=20=E8=AF=AD=E6=B3=95=E4=BD=86=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E4=B8=BA=20CJS=EF=BC=8C=E5=AF=BC=E8=87=B4=20SyntaxErr?= =?UTF-8?q?or?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根目录 package.json 未声明 "type": "module",check-catalog.js 却用了 import 语法,node 按 CJS 解析时报 "Cannot use import statement outside a module"。改为与 tools/ 目录下其它脚本一致的 require() 写法。 顺带修正 package.json#scripts.check-catalog 中的绝对路径笔误 (/tools/... -> tools/...)。 Co-authored-by: Shiroha --- package.json | 2 +- tools/check-catalog.js | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f3d3e81..8f57faf 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "module-core:typecheck": "npm run sdk:typecheck", "module-core:test": "echo \"no sdk tests yet\"", "module-core:verify": "npm run sdk:verify", - "check-catalog": "node /tools/check-catalog.js", + "check-catalog": "node tools/check-catalog.js", "lint": "eslint . --ext .ts,.tsx", "bundle": "node build-sea.mjs", "sea": "node --build-sea sea-config.json" diff --git a/tools/check-catalog.js b/tools/check-catalog.js index 26a3f4a..c40ef52 100644 --- a/tools/check-catalog.js +++ b/tools/check-catalog.js @@ -11,12 +11,10 @@ * - entry.init 仅在 sapi 类型可选 * - 不允许循环依赖(拓扑排序检测) */ -import { accessSync, constants, readFileSync } from "node:fs"; -import { resolve, join, dirname } from "node:path"; -import { fileURLToPath } from 'node:url'; -import path from "node:path"; +const { accessSync, constants, readFileSync } = require("node:fs"); +const { resolve, join } = require("node:path"); -const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const ROOT = resolve(__dirname, ".."); const CATALOG = join(ROOT, "modules", "catalog.json"); const SERVICES_CATALOG = join(ROOT, "services", "catalog.json"); /* SAPI modules no longer register through a single static entry.ts — From 89e9cebcceb7e30a7d36f68ffc2d201d436a52b1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:12:00 +0000 Subject: [PATCH 3/4] =?UTF-8?q?fix(tools):=20check-ootb.js=20/=20sim-new-u?= =?UTF-8?q?ser.js=20=E5=90=AF=E5=8A=A8=20db-server=20=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 两处都 spawn 了 db-server/index.js,但该文件不存在——真正的产物入口是 db-server/dist/index.js(由 npm run build 生成)。导致 CI 中 "db-server 启动 + 模块接口" 和 "sim-new-user 全流程通过" 两项自检 必然失败/超时。 Co-authored-by: Shiroha --- tools/check-ootb.js | 2 +- tools/sim-new-user.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/check-ootb.js b/tools/check-ootb.js index 970b038..240bb13 100644 --- a/tools/check-ootb.js +++ b/tools/check-ootb.js @@ -106,7 +106,7 @@ function fileContains(p, needle) { { let dbProc = null; try { - dbProc = spawn(process.execPath, [path.join(ROOT, "db-server", "index.js")], { + dbProc = spawn(process.execPath, [path.join(ROOT, "db-server", "dist", "index.js")], { cwd: ROOT, env: { ...process.env }, stdio: ["ignore", "pipe", "pipe"], diff --git a/tools/sim-new-user.js b/tools/sim-new-user.js index 18990b9..8206073 100644 --- a/tools/sim-new-user.js +++ b/tools/sim-new-user.js @@ -30,7 +30,7 @@ let dbProc = null; function startDb(simDir) { const env = { ...process.env, SFMC_ROOT: simDir, DB_PORT: String(DB_PORT) }; - dbProc = spawn(process.execPath, [path.join(ROOT, "db-server", "index.js")], { + dbProc = spawn(process.execPath, [path.join(ROOT, "db-server", "dist", "index.js")], { cwd: ROOT, env, stdio: ["ignore", "pipe", "pipe"], From 31afa599217c7b77adae50c0ae5112fcbaddd321 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:12:06 +0000 Subject: [PATCH 4/4] =?UTF-8?q?fix(config):=20configs-default/db=5Fconfig.?= =?UTF-8?q?json=20=E4=B8=AD=20modulesDir=20=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modulesDir 是相对 PROJECT_ROOT(仓库根)解析的(见 db-server/src/env.ts), 但默认值写成了 "../modules",解析后指向仓库外的 /modules,导致模块 API 返回空列表。sfmc 向导 (wizard.ts) 和用户文档写的都是 "modules", 这里改成一致的值。 Co-authored-by: Shiroha --- configs-default/db_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs-default/db_config.json b/configs-default/db_config.json index 0dff98e..c1380db 100644 --- a/configs-default/db_config.json +++ b/configs-default/db_config.json @@ -3,5 +3,5 @@ "db_port": 3001, "http_auth": "", "dbDir": "./data/sfmc_data.db", - "modulesDir": "../modules" + "modulesDir": "modules" }