2026-01-14 01:08:15 +00:00
|
|
|
import type { Command } from "commander";
|
2026-02-01 10:03:47 +09:00
|
|
|
import { setVerbose } from "../../globals.js";
|
|
|
|
|
import { isTruthyEnvValue } from "../../infra/env.js";
|
2026-01-18 23:28:09 +00:00
|
|
|
import { defaultRuntime } from "../../runtime.js";
|
2026-01-21 03:46:11 +00:00
|
|
|
import { getCommandPath, getVerboseFlag, hasHelpOrVersion } from "../argv.js";
|
2026-02-01 10:03:47 +09:00
|
|
|
import { emitCliBanner } from "../banner.js";
|
2026-01-27 11:27:41 +00:00
|
|
|
import { resolveCliName } from "../cli-name.js";
|
2026-02-01 10:03:47 +09:00
|
|
|
import { ensurePluginRegistryLoaded } from "../plugin-registry.js";
|
|
|
|
|
import { ensureConfigReady } from "./config-guard.js";
|
2026-01-14 01:08:15 +00:00
|
|
|
|
2026-01-16 01:33:20 +00:00
|
|
|
function setProcessTitleForCommand(actionCommand: Command) {
|
|
|
|
|
let current: Command = actionCommand;
|
|
|
|
|
while (current.parent && current.parent.parent) {
|
|
|
|
|
current = current.parent;
|
|
|
|
|
}
|
|
|
|
|
const name = current.name();
|
2026-01-27 11:27:41 +00:00
|
|
|
const cliName = resolveCliName();
|
2026-01-31 16:19:20 +09:00
|
|
|
if (!name || name === cliName) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-27 11:27:41 +00:00
|
|
|
process.title = `${cliName}-${name}`;
|
2026-01-16 01:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-20 16:41:15 -05:00
|
|
|
// Commands that need channel plugins loaded
|
|
|
|
|
const PLUGIN_REQUIRED_COMMANDS = new Set(["message", "channels", "directory"]);
|
|
|
|
|
|
2026-01-14 14:31:43 +00:00
|
|
|
export function registerPreActionHooks(program: Command, programVersion: string) {
|
2026-01-14 01:08:15 +00:00
|
|
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
2026-01-16 01:33:20 +00:00
|
|
|
setProcessTitleForCommand(actionCommand);
|
2026-01-18 23:28:09 +00:00
|
|
|
const argv = process.argv;
|
2026-01-31 16:19:20 +09:00
|
|
|
if (hasHelpOrVersion(argv)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-21 07:36:39 +00:00
|
|
|
const commandPath = getCommandPath(argv, 2);
|
|
|
|
|
const hideBanner =
|
Ironclaw rebrand: new identity, animated CLI banner, and iron palette
Rebrand the project from the OpenClaw/Lobster identity to Ironclaw with
a new iron-metallic visual language across CLI and web UI.
## CLI identity
- Rename default CLI name from `openclaw` to `ironclaw` (keep `openclaw`
in KNOWN_CLI_NAMES and regex for backward compat)
- Set process.title to `ironclaw`; update all `[openclaw]` log prefixes
to `[ironclaw]`
- Add `IRONCLAW_*` env var checks (IRONCLAW_HIDE_BANNER,
IRONCLAW_NO_RESPAWN, IRONCLAW_NODE_OPTIONS_READY,
IRONCLAW_TAGLINE_INDEX) with fallback to legacy `OPENCLAW_*` variants
## Animated ASCII banner
- Replace the old lobster block-art with a figlet "ANSI Shadow" font
IRONCLAW ASCII wordmark
- Add `gradient-string` dependency for terminal gradient rendering
- Implement iron shimmer animation: a bright highlight sweeps across the
ASCII art (~2.5 s at 12 fps, 3 full gradient cycles) using a rotating
iron-to-silver color array
- Make `emitCliBanner` async to support the animation; update all call
sites (preaction hook, route, run-main) to await it
- Move banner emission earlier in `runCli()` so it appears for all
invocations (bare command, subcommands, help) with the existing
bannerEmitted guard preventing double-emission
## Iron palette and theme
- Rename LOBSTER_PALETTE → IRON_PALETTE in `src/terminal/palette.ts`
with new cool-steel color tokens (steel grey accent, bright silver
highlight, dark iron dim, steel bl info)
- Re-export LOBSTER_PALETTE as backward-compatible alias
- Update `src/terminal/theme.ts` to import and use IRON_PALETTE
## Tagline cleanup
- Remove lobster-themed, Apple-specific, and platform-joke taglines
- Fix smart-quote and em-dash formatting across remaining taglines
- Add "Holiday taglines" comment grouping for date-gated entries
## Web UI
- Add `framer-motion`, `fuse.js`, and `next-themes` to web app deps
- Add custom font files: Bookerly (regular/bold/italic), SpaceGrotesk
(light/regular/medium/semibold/bold), FoundationTitlesHand
- Update chat panel labels: "OpenClaw Chat" → "Ironclaw Chat",
"Message OpenClaw..." → "Message Ironclaw..."
- Update sidebar header: "OpenClaw Dench" → "Ironclaw"
- CSS formatting cleanup: expand single-lins, add consistent
blank lines between selector blocks, normalize child combinator
spacing (li > ul → li>ul)
2026-02-11 23:26:05 -08:00
|
|
|
isTruthyEnvValue(process.env.IRONCLAW_HIDE_BANNER) ||
|
2026-01-30 03:15:10 +01:00
|
|
|
isTruthyEnvValue(process.env.OPENCLAW_HIDE_BANNER) ||
|
2026-01-21 07:36:39 +00:00
|
|
|
commandPath[0] === "update" ||
|
2026-01-31 04:44:46 +00:00
|
|
|
commandPath[0] === "completion" ||
|
2026-01-21 07:36:39 +00:00
|
|
|
(commandPath[0] === "plugins" && commandPath[1] === "update");
|
|
|
|
|
if (!hideBanner) {
|
Ironclaw rebrand: new identity, animated CLI banner, and iron palette
Rebrand the project from the OpenClaw/Lobster identity to Ironclaw with
a new iron-metallic visual language across CLI and web UI.
## CLI identity
- Rename default CLI name from `openclaw` to `ironclaw` (keep `openclaw`
in KNOWN_CLI_NAMES and regex for backward compat)
- Set process.title to `ironclaw`; update all `[openclaw]` log prefixes
to `[ironclaw]`
- Add `IRONCLAW_*` env var checks (IRONCLAW_HIDE_BANNER,
IRONCLAW_NO_RESPAWN, IRONCLAW_NODE_OPTIONS_READY,
IRONCLAW_TAGLINE_INDEX) with fallback to legacy `OPENCLAW_*` variants
## Animated ASCII banner
- Replace the old lobster block-art with a figlet "ANSI Shadow" font
IRONCLAW ASCII wordmark
- Add `gradient-string` dependency for terminal gradient rendering
- Implement iron shimmer animation: a bright highlight sweeps across the
ASCII art (~2.5 s at 12 fps, 3 full gradient cycles) using a rotating
iron-to-silver color array
- Make `emitCliBanner` async to support the animation; update all call
sites (preaction hook, route, run-main) to await it
- Move banner emission earlier in `runCli()` so it appears for all
invocations (bare command, subcommands, help) with the existing
bannerEmitted guard preventing double-emission
## Iron palette and theme
- Rename LOBSTER_PALETTE → IRON_PALETTE in `src/terminal/palette.ts`
with new cool-steel color tokens (steel grey accent, bright silver
highlight, dark iron dim, steel bl info)
- Re-export LOBSTER_PALETTE as backward-compatible alias
- Update `src/terminal/theme.ts` to import and use IRON_PALETTE
## Tagline cleanup
- Remove lobster-themed, Apple-specific, and platform-joke taglines
- Fix smart-quote and em-dash formatting across remaining taglines
- Add "Holiday taglines" comment grouping for date-gated entries
## Web UI
- Add `framer-motion`, `fuse.js`, and `next-themes` to web app deps
- Add custom font files: Bookerly (regular/bold/italic), SpaceGrotesk
(light/regular/medium/semibold/bold), FoundationTitlesHand
- Update chat panel labels: "OpenClaw Chat" → "Ironclaw Chat",
"Message OpenClaw..." → "Message Ironclaw..."
- Update sidebar header: "OpenClaw Dench" → "Ironclaw"
- CSS formatting cleanup: expand single-lins, add consistent
blank lines between selector blocks, normalize child combinator
spacing (li > ul → li>ul)
2026-02-11 23:26:05 -08:00
|
|
|
await emitCliBanner(programVersion);
|
2026-01-21 07:36:39 +00:00
|
|
|
}
|
2026-01-21 03:46:11 +00:00
|
|
|
const verbose = getVerboseFlag(argv, { includeDebug: true });
|
|
|
|
|
setVerbose(verbose);
|
|
|
|
|
if (!verbose) {
|
|
|
|
|
process.env.NODE_NO_WARNINGS ??= "1";
|
|
|
|
|
}
|
2026-01-31 16:19:20 +09:00
|
|
|
if (commandPath[0] === "doctor" || commandPath[0] === "completion") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-19 03:38:51 +00:00
|
|
|
await ensureConfigReady({ runtime: defaultRuntime, commandPath });
|
2026-01-20 16:41:15 -05:00
|
|
|
// Load plugins for commands that need channel access
|
|
|
|
|
if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) {
|
|
|
|
|
ensurePluginRegistryLoaded();
|
|
|
|
|
}
|
2026-01-14 01:08:15 +00:00
|
|
|
});
|
|
|
|
|
}
|