refactor: compute base config schema at runtime

This commit is contained in:
Peter Steinberger
2026-05-05 19:55:32 +01:00
parent 7dc6007aee
commit 55d1cf87d7
9 changed files with 36 additions and 29535 deletions

View File

@@ -1,7 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { GENERATED_BASE_CONFIG_SCHEMA } from "../../../src/config/schema.base.generated.js";
import { computeBaseConfigSchemaResponse } from "../../../src/config/schema-base.js";
export type ConfigHonorInventoryRow = {
key: string;
@@ -35,10 +35,13 @@ export type ConfigHonorAuditResult = {
};
const REPO_ROOT = fileURLToPath(new URL("../../../", import.meta.url));
const BASE_CONFIG_SCHEMA = computeBaseConfigSchemaResponse({
generatedAt: "2026-05-05T00:00:00.000Z",
});
function hasSchemaPath(schemaPath: string): boolean {
const segments = schemaPath.split(".");
let current: unknown = GENERATED_BASE_CONFIG_SCHEMA.schema;
let current: unknown = BASE_CONFIG_SCHEMA.schema;
for (const segment of segments) {
if (!current || typeof current !== "object") {
return false;
@@ -64,7 +67,7 @@ export function listSchemaLeafKeysForPrefixes(prefixes: string[]): string[] {
const keys = new Set<string>();
for (const prefix of prefixes) {
const segments = prefix.split(".");
let current: unknown = GENERATED_BASE_CONFIG_SCHEMA.schema;
let current: unknown = BASE_CONFIG_SCHEMA.schema;
for (const segment of segments) {
if (!current || typeof current !== "object") {
current = null;

View File

@@ -719,7 +719,6 @@ describe("scripts/changed-lanes", () => {
"apps/macos/Sources/OpenClaw/Resources/Info.plist",
"docs/.generated/config-baseline.sha256",
"package.json",
"src/config/schema.base.generated.ts",
]);
const plan = createChangedCheckPlan(result, { staged: true });