Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

1.3 KB
Raw Blame
import { run } from "@drizzle-team/brocli";
import type { Command } from "@drizzle-team/brocli";

import { harnessRoot, normalizeHarnessEnvironmentArgs } from "./commands/harness";

const harnessCommandNames = new Set(["harness", "local-harness"]);

function isHarnessInvocation(argv: string[]): boolean {
  const command = argv[2];
  return command !== undefined && harnessCommandNames.has(command);
}

async function main(): Promise<void> {
  const harnessInvocation = isHarnessInvocation(process.argv);
  let commands: Command[];

  if (harnessInvocation) {
    commands = [harnessRoot];
  } else {
    const [{ fixUsernames }, { integrationsRoot }, { recreateAdmin }, { resetPassword }, { usersRoot }] =
      await Promise.all([
        import("./commands/fix-usernames"),
        import("./commands/integrations"),
        import("./commands/recreate-admin"),
        import("./commands/reset-password"),
        import("./commands/users"),
      ]);
    commands = [usersRoot, integrationsRoot, resetPassword, fixUsernames, recreateAdmin, harnessRoot];
  }

  let argSource = process.argv;
  if (harnessInvocation) {
    argSource = normalizeHarnessEnvironmentArgs(process.argv);
  }

  await run(commands, {
    argSource,
    name: "homarr-cli",
    version: "1.0.0",
  });
}

void main();