diff --git a/scripts/prepare-git-hooks.mjs b/scripts/prepare-git-hooks.mjs index d00bd6b14646..84ba741384f9 100644 --- a/scripts/prepare-git-hooks.mjs +++ b/scripts/prepare-git-hooks.mjs @@ -55,8 +55,16 @@ export function configurePrepareGitHooks(params = {}) { if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) { if (existsSync(join(DEFAULT_PACKAGE_ROOT, "src/state/openclaw-state-schema.sql"))) { - const { ensureKyselyTypes } = await import("./generate-kysely-types.mts"); - await ensureKyselyTypes(DEFAULT_PACKAGE_ROOT); + // Source preparation uses the generator CLI; packaged installs have no schemas. + const generated = spawnSync(process.execPath, [join(scriptDir, "generate-kysely-types.mts")], { + stdio: "inherit", + }); + if (generated.error) { + throw generated.error; + } + if (generated.status !== 0) { + process.exit(generated.status ?? 1); + } } configurePrepareGitHooks(); } diff --git a/scripts/profile-tsgo.mts b/scripts/profile-tsgo.mts index 91d393efff0c..8c90a5c4ae35 100644 --- a/scripts/profile-tsgo.mts +++ b/scripts/profile-tsgo.mts @@ -6,6 +6,7 @@ import { spawnSync } from "node:child_process"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import { ensureKyselyTypes } from "./generate-kysely-types.mts"; import { applyLocalTsgoPolicy, resolveRepoToolBinPath } from "./lib/local-check-runtime.mts"; import { createManagedCommandInvocation } from "./lib/managed-child-process.mts"; import { resolveRepoRoot } from "./lib/repo-root.mjs"; @@ -419,6 +420,7 @@ function profileGraph(name: GraphName, options: ProfileOptions) { async function main(argv: string[]): Promise { const { options, selectedGraphs } = parseArgs(argv); + await ensureKyselyTypes(repoRoot); ensureDirs(options.outDir); const report: ProfileReport = { generatedAt: new Date().toISOString(),