Rebrand from OpenClaw to Ironclaw across 16 files: Web app (apps/web): - layout.tsx: update metadata title to "Ironclaw" and description to "AI CRM with an agent that connects to your apps and does the work for you" - page.tsx: change landing page heading from "OpenClaw Dench" to "Ironclaw" - agent-runner.ts: rename stderr log prefix to [ironclaw stderr] - package.json: rename package from "openclaw-web" to "ironclaw-web" Package identity (root): - package.json: rename package from "openclaw-ai-sdk" to "ironclaw", update description to reflect CRM/workspace focus, change bin entry from "openclaw-ai-sdk" to "ironclaw" - openclaw.mjs: update error message to reference "ironclaw" - src/version.ts: change CORE_PACKAGE_NAME to "ironclaw" CLI and TUI: - command-format.ts: extend CLI prefix regex to accept both "ironclaw" and "openclaw" for backward compatibility - register.agent.ts: update example identity name to "Ironclaw" with 🔩 emoji (replacing 🦞) - tui.ts: rename TUI header from "openclaw tui" to "ironclaw tui" Onboarding and configuration wizards: - configure.wizard.ts: rename engine selection prompts and wizard intro headers to "Ironclaw" - onboarding.ts: rename onboarding intro and security warning text - onboarding.finalize.ts: rename all dashboard/control-UI messages and Brave Search setup instructions to reference "Ironclaw" Security audit: - audit.ts: rename state-dir permission warning details to "Ironclaw" - audit-extra.ts: rename plugin remediation text to "Ironclaw" Telegram: - bot-message-context.ts: rename access-denied message to "Ironclaw"
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import { createRequire } from "node:module";
|
|
|
|
declare const __OPENCLAW_VERSION__: string | undefined;
|
|
const CORE_PACKAGE_NAME = "ironclaw";
|
|
|
|
const PACKAGE_JSON_CANDIDATES = [
|
|
"../package.json",
|
|
"../../package.json",
|
|
"../../../package.json",
|
|
"./package.json",
|
|
] as const;
|
|
|
|
const BUILD_INFO_CANDIDATES = [
|
|
"../build-info.json",
|
|
"../../build-info.json",
|
|
"./build-info.json",
|
|
] as const;
|
|
|
|
function readVersionFromJsonCandidates(
|
|
moduleUrl: string,
|
|
candidates: readonly string[],
|
|
opts: { requirePackageName?: boolean } = {},
|
|
): string | null {
|
|
try {
|
|
const require = createRequire(moduleUrl);
|
|
for (const candidate of candidates) {
|
|
try {
|
|
const parsed = require(candidate) as { name?: string; version?: string };
|
|
const version = parsed.version?.trim();
|
|
if (!version) {
|
|
continue;
|
|
}
|
|
if (opts.requirePackageName && parsed.name !== CORE_PACKAGE_NAME) {
|
|
continue;
|
|
}
|
|
return version;
|
|
} catch {
|
|
// ignore missing or unreadable candidate
|
|
}
|
|
}
|
|
return null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function readVersionFromPackageJsonForModuleUrl(moduleUrl: string): string | null {
|
|
return readVersionFromJsonCandidates(moduleUrl, PACKAGE_JSON_CANDIDATES, {
|
|
requirePackageName: true,
|
|
});
|
|
}
|
|
|
|
export function readVersionFromBuildInfoForModuleUrl(moduleUrl: string): string | null {
|
|
return readVersionFromJsonCandidates(moduleUrl, BUILD_INFO_CANDIDATES);
|
|
}
|
|
|
|
export function resolveVersionFromModuleUrl(moduleUrl: string): string | null {
|
|
return (
|
|
readVersionFromPackageJsonForModuleUrl(moduleUrl) ||
|
|
readVersionFromBuildInfoForModuleUrl(moduleUrl)
|
|
);
|
|
}
|
|
|
|
// Single source of truth for the current OpenClaw version.
|
|
// - Embedded/bundled builds: injected define or env var.
|
|
// - Dev/npm builds: package.json.
|
|
export const VERSION =
|
|
(typeof __OPENCLAW_VERSION__ === "string" && __OPENCLAW_VERSION__) ||
|
|
process.env.OPENCLAW_BUNDLED_VERSION ||
|
|
resolveVersionFromModuleUrl(import.meta.url) ||
|
|
"0.0.0";
|