mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
refactor: compute base config schema at runtime
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user