- Move generated OpenAPI bundles out of dist/ into committed specs/ (specs/openapi.json, specs/openapi.raw.json); source YAML tree moves openapi/ -> specs/openapi/; schemas/workflow-schema.json joins as specs/workflow-schema.json - Update all generators/consumers: bundle-openapi, generate-raw-openapi, check-version-sync, bump-version, export-workflow-schema, packaging/embedded-openapi - Rewrite stale .env.example with current HOSE_* environment variables - Archive stale repo-local enterprise configs (superseded by ~/.config/hose-use/enterprises) out of the repo; root enterprises/ keeps only the tracked example.json plus an explanatory README - Add missing directory READMEs: approval/contact/message/task/events domains, cli/, http/, packaging/ - Fix stale domain doc links in README.domains.md and docs/modules/platform.md
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
#!/usr/bin/env bun
|
|
import { readFileSync, existsSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
const root = join(import.meta.dirname, "..");
|
|
const packageVersion = (JSON.parse(readFileSync(join(root, "package.json"), "utf8")) as { version: string }).version;
|
|
const expected: Array<[string, string | undefined]> = [
|
|
["package.json", packageVersion],
|
|
[".zcode-plugin/plugin.json", readJsonVersion(".zcode-plugin/plugin.json")],
|
|
["specs/openapi/openapi.yaml", readFileSync(join(root, "specs/openapi/openapi.yaml"), "utf8").match(/^\s+version:\s+([^\s]+)\s*$/m)?.[1]],
|
|
["specs/openapi.json", readJsonVersion("specs/openapi.json", ["info", "version"])],
|
|
];
|
|
|
|
const mismatches = expected.filter(([, value]) => value !== packageVersion);
|
|
if (mismatches.length) {
|
|
console.error(`Version drift detected; expected ${packageVersion}:`);
|
|
for (const [file, value] of mismatches) console.error(` ${file}: ${value ?? "missing"}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(`Version synchronized: ${packageVersion}`);
|
|
|
|
function readJsonVersion(file: string, path: string[] = ["version"]): string | undefined {
|
|
const fullPath = join(root, file);
|
|
if (!existsSync(fullPath)) return undefined;
|
|
let value: unknown = JSON.parse(readFileSync(fullPath, "utf8"));
|
|
for (const key of path) {
|
|
if (!value || typeof value !== "object") return undefined;
|
|
value = (value as Record<string, unknown>)[key];
|
|
}
|
|
return typeof value === "string" ? value : undefined;
|
|
}
|