mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
The codebase already had 663 BOT_* env-var refs from a partial migration
(BOT_CONFIG_PATH, BOT_SHELL, BOT_GATEWAY_BIND, …). Finish the rename:
every remaining OPENCLAW_ prefix becomes BOT_, unifying the env-var
surface on a single brand-neutral prefix.
3493 occurrences across 684 files (src/, test/, extensions/, apps/*/,
docs/, scripts/, infra configs). Clean break — no backwards-compat
reads. Users with existing OPENCLAW_* exports need to rename those.
Out of scope (separate change):
- the ai.openclaw.android.* Java package (partial migration to
ai.hanzo.bot.android.* already in place; finishing it requires
moving files + AndroidManifest + applicationId + signing)
- __openclaw__/ HTTP path prefix served by the gateway
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
|
export function getA2uiPaths(env = process.env) {
|
|
const srcDir = env.BOT_A2UI_SRC_DIR ?? path.join(repoRoot, "src", "canvas-host", "a2ui");
|
|
const outDir = env.BOT_A2UI_OUT_DIR ?? path.join(repoRoot, "dist", "canvas-host", "a2ui");
|
|
return { srcDir, outDir };
|
|
}
|
|
|
|
export async function copyA2uiAssets({ srcDir, outDir }: { srcDir: string; outDir: string }) {
|
|
const skipMissing = process.env.BOT_A2UI_SKIP_MISSING === "1";
|
|
try {
|
|
await fs.stat(path.join(srcDir, "index.html"));
|
|
await fs.stat(path.join(srcDir, "a2ui.bundle.js"));
|
|
} catch (err) {
|
|
const message = 'Missing A2UI bundle assets. Run "pnpm canvas:a2ui:bundle" and retry.';
|
|
if (skipMissing) {
|
|
console.warn(`${message} Skipping copy (BOT_A2UI_SKIP_MISSING=1).`);
|
|
return;
|
|
}
|
|
throw new Error(message, { cause: err });
|
|
}
|
|
await fs.mkdir(path.dirname(outDir), { recursive: true });
|
|
await fs.cp(srcDir, outDir, { recursive: true });
|
|
}
|
|
|
|
async function main() {
|
|
const { srcDir, outDir } = getA2uiPaths();
|
|
await copyA2uiAssets({ srcDir, outDir });
|
|
}
|
|
|
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
main().catch((err) => {
|
|
console.error(String(err));
|
|
process.exit(1);
|
|
});
|
|
}
|