From b4d3a038a2213c251514cd9f77c4d35af52bd575 Mon Sep 17 00:00:00 2001 From: VectorPeak Date: Mon, 13 Jul 2026 08:26:04 +0800 Subject: [PATCH] fix: run ts-topology entrypoint on Windows (#105397) * fix: run ts-topology entrypoint on Windows Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> * refactor: tighten ts-topology entrypoint guard --------- Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Peter Steinberger --- package.json | 2 +- scripts/ts-topology.ts | 4 +++- test/package-scripts.test.ts | 6 ++++++ .../openclaw-cross-os-release-workflow.test.ts | 1 - test/scripts/ts-topology.test.ts | 12 ++++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6850713c4fe..a8a887a7d23 100644 --- a/package.json +++ b/package.json @@ -1959,7 +1959,7 @@ "test:unit:fast:audit": "node scripts/test-unit-fast-audit.mjs", "test:voicecall:closedloop": "node scripts/test-voicecall-closedloop.mjs", "test:watch": "node scripts/test-projects.mjs --watch", - "test:windows:ci": "node scripts/test-projects.mjs src/shared/runtime-import.test.ts src/process/exec.windows.test.ts src/process/windows-command.test.ts src/infra/backup-create.windows.test.ts src/infra/windows-install-roots.test.ts src/node-host/invoke-system-run-allowlist.test.ts src/daemon/schtasks.startup-fallback.test.ts extensions/lobster/src/lobster-runner.test.ts test/scripts/format-generated-module.test.ts test/scripts/npm-runner.test.ts test/scripts/openclaw-cross-os-release-workflow.test.ts test/scripts/pnpm-runner.test.ts test/scripts/run-with-env.test.ts test/scripts/ui.test.ts test/scripts/vitest-process-group.test.ts", + "test:windows:ci": "node scripts/test-projects.mjs src/shared/runtime-import.test.ts src/process/exec.windows.test.ts src/process/windows-command.test.ts src/infra/backup-create.windows.test.ts src/infra/windows-install-roots.test.ts src/node-host/invoke-system-run-allowlist.test.ts src/daemon/schtasks.startup-fallback.test.ts extensions/lobster/src/lobster-runner.test.ts test/scripts/format-generated-module.test.ts test/scripts/npm-runner.test.ts test/scripts/openclaw-cross-os-release-workflow.test.ts test/scripts/pnpm-runner.test.ts test/scripts/run-with-env.test.ts test/scripts/ts-topology.test.ts test/scripts/ui.test.ts test/scripts/vitest-process-group.test.ts", "tool-display:check": "node --import tsx scripts/tool-display.ts --check", "tool-display:write": "node --import tsx scripts/tool-display.ts --write", "ts-topology": "node --import tsx scripts/ts-topology.ts", diff --git a/scripts/ts-topology.ts b/scripts/ts-topology.ts index 47968ec2fc1..6e1beea4512 100644 --- a/scripts/ts-topology.ts +++ b/scripts/ts-topology.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node // Ts Topology script supports OpenClaw repository automation. import path from "node:path"; +import { pathToFileURL } from "node:url"; import { expectDefined } from "../packages/normalization-core/src/expect.js"; import { formatErrorMessage } from "../src/infra/errors.ts"; import { parsePositiveInt } from "./lib/numeric-options.mjs"; @@ -167,7 +168,8 @@ export async function main(argv: string[], io: IoLike = process): Promise { "test/scripts/run-with-env.test.ts", ); }); + + it("runs ts-topology entrypoint coverage in Windows CI", () => { + expect(readPackageJson().scripts["test:windows:ci"]).toContain( + "test/scripts/ts-topology.test.ts", + ); + }); }); diff --git a/test/scripts/openclaw-cross-os-release-workflow.test.ts b/test/scripts/openclaw-cross-os-release-workflow.test.ts index b5f52b92c19..b0e1fd78fac 100644 --- a/test/scripts/openclaw-cross-os-release-workflow.test.ts +++ b/test/scripts/openclaw-cross-os-release-workflow.test.ts @@ -349,7 +349,6 @@ describe("cross-OS release checks workflow", () => { expect(packageJson.scripts["test:windows:ci"]).toContain( "test/scripts/openclaw-cross-os-release-workflow.test.ts", ); - const result = spawnSync( BASH_BIN, [ diff --git a/test/scripts/ts-topology.test.ts b/test/scripts/ts-topology.test.ts index f219d7f34ee..e3694b3e65f 100644 --- a/test/scripts/ts-topology.test.ts +++ b/test/scripts/ts-topology.test.ts @@ -1,4 +1,5 @@ // Ts Topology tests cover ts topology script behavior. +import { spawnSync } from "node:child_process"; import path from "node:path"; import { describe, expect, it } from "vitest"; import { analyzeTopology, filterRecordsForReport } from "../../scripts/lib/ts-topology/analyze.js"; @@ -46,6 +47,17 @@ function requireRecordByExport(exportName: string) { } describe("ts-topology", () => { + it("runs the CLI entrypoint when invoked from a filesystem path", () => { + const scriptPath = path.resolve("scripts/ts-topology.ts"); + const result = spawnSync(process.execPath, ["--import", "tsx", scriptPath, "--help"], { + encoding: "utf8", + }); + + expect(result.status).toBe(1); + expect(result.stdout).toBe(""); + expect(result.stderr).toContain("Usage: ts-topology"); + }); + it("collapses canonical symbols exported by multiple public subpaths", () => { const sharedThing = requireRecordByExport("sharedThing");