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 <steipete@gmail.com>
This commit is contained in:
VectorPeak
2026-07-12 17:26:04 -07:00
committed by GitHub
co-authored by chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Peter Steinberger
parent 491e1f6f6d
commit b4d3a038a2
5 changed files with 22 additions and 3 deletions
+1 -1
View File
@@ -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",
+3 -1
View File
@@ -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<number
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
const entrypointPath = process.argv[1];
if (entrypointPath && import.meta.url === pathToFileURL(entrypointPath).href) {
const exitCode = await main(process.argv.slice(2));
if (exitCode !== 0) {
process.exit(exitCode);
+6
View File
@@ -174,4 +174,10 @@ describe("package scripts", () => {
"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",
);
});
});
@@ -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,
[
+12
View File
@@ -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");