From daaeb9f128f41e7166ad59f4adba4ec11854553d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:17:50 +0000 Subject: [PATCH 1/5] fix(tools): convert check-catalog.js to CommonJS to fix CI SyntaxError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node 22.5 (used by ootb.yml CI) does not auto-detect ESM syntax in plain .js files without "type": "module" — this made check-ootb.js crash with 'Cannot use import statement outside a module' every run. Convert to require()/__dirname to match the CommonJS convention used by every other tools/*.js script. Co-authored-by: Shiroha --- tools/check-catalog.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 dc43c1cdb673f21e9a5e0e84a8a6e6e9d2cf8c8f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:17:56 +0000 Subject: [PATCH 2/5] fix(tools): point db-server spawn at dist/index.js, not the missing db-server/index.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check-ootb.js, sim-new-user.js and test-db-api.js all spawned a non-existent db-server/index.js (the real built entry is db-server/dist/index.js). This made the 'db-server 启动 + 模块接口' and 'sim-new-user 全流程通过' checks fail every CI run with 'db-server 不可达' / timeout. Co-authored-by: Shiroha --- tools/check-ootb.js | 2 +- tools/sim-new-user.js | 2 +- tools/test-db-api.js | 4 ++-- 3 files changed, 4 insertions(+), 4 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"], diff --git a/tools/test-db-api.js b/tools/test-db-api.js index b82892d..cee487a 100644 --- a/tools/test-db-api.js +++ b/tools/test-db-api.js @@ -62,11 +62,11 @@ async function main() { copy(path.join(ROOT, 'modules', 'module-lock.json'), path.join(workspace, 'modules', 'module-lock.json')); fs.mkdirSync(path.join(workspace, 'data'), { recursive: true }); fs.mkdirSync(path.join(workspace, 'configs'), { recursive: true }); - fs.writeFileSync(path.join(workspace, 'configs', 'db_config.json'), JSON.stringify({ db_port: PORT, dbDir: './data/sfmc_data.db', modulesDir: '../modules' }) + '\n'); + fs.writeFileSync(path.join(workspace, 'configs', 'db_config.json'), JSON.stringify({ db_port: PORT, dbDir: './data/sfmc_data.db', modulesDir: 'modules' }) + '\n'); copy(path.join(ROOT, 'configs', 'qq_config.json'), path.join(workspace, 'configs', 'qq_config.json')); copy(path.join(ROOT, 'configs', 'settings.json'), path.join(workspace, 'configs', 'settings.json')); - const child = spawn(process.execPath, [path.join(ROOT, 'db-server', 'index.js')], { + const child = spawn(process.execPath, [path.join(ROOT, 'db-server', 'dist', 'index.js')], { cwd: ROOT, env: { ...process.env, SFMC_ROOT: workspace, SFMC_DB_PATH: dbPath, SFMC_MODULES_DIR: path.join(workspace, 'modules'), DB_PORT: String(PORT) }, stdio: ['ignore', 'pipe', 'pipe'], From ac97a743ecd5323590cc872ea000c1c1a5aafb15 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:18:02 +0000 Subject: [PATCH 3/5] fix(configs): correct default modulesDir to resolve inside repo root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configs-default/db_config.json shipped modulesDir: "../modules", which db-server/src/env.ts resolves relative to PROJECT_ROOT (the repo root itself) — landing one directory *above* the repo, outside it, where no catalog.json exists. Use "modules" so it resolves to /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" } From 74a370d683168e003e055132c5b94e45db3b6d0a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:18:08 +0000 Subject: [PATCH 4/5] ci(ootb): seed configs/ from configs-default/ before check-ootb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configs/ is gitignored, so a fresh CI checkout never had configs/db_config.json, bds_updater.json, qq_config.json — failing the '必备仓库文件齐全' check every run. Copy the defaults in before running check-ootb, mirroring the documented local setup steps. 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..71a4844 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: Seed 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 52abf274d719451f8cf362e44fa9d73e8ebcfb54 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 21 Jul 2026 17:18:18 +0000 Subject: [PATCH 5/5] chore: gitignore qq-bridge/dist and sfmc/dist build output Every other workspace's dist/ is gitignored; these two were missing, so a local > @sfmc/sdk@0.1.0 build > node build.mjs [sdk] emitting .d.ts via tsc... @sfmc/sdk build done: 13 subpaths > db-server@1.0.0 build > tsc -p tsconfig.json > qq-bridge@1.0.0 build > tsc -p tsconfig.json > bds-tools@1.1.0 build > tsc -p tsconfig.json > sfmc-cil@0.1.0 build > tsc -p tsconfig.json > @sfmc/remote-controller@0.1.0 build > tsc -p tsconfig.json leaves them as untracked/ stageable artifacts. Co-authored-by: Shiroha --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8337848..f949c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ bds-tools/dist/ db-server/dist/ panel/dist/ +qq-bridge/dist/ +sfmc/dist/ modules/sdk/@sfmc-sdk/dist/ modules/sdk/@sfmc-sdk/node_modules/ shared/**/dist/