Lines 538-611javascript
538 const norm = url.replace(/\/+$/, "");
539 const items = listPlatforms().filter((i) => i.baseUrl === norm);
540 const out = outputOptions(cmd2);
541 if (out.json || out.compact) printJson(items, out);
542 else process.stdout.write(`${renderSessions(items)}
545 cmd.command("export").description("Export the active session's tokens (for a headless host)").action((_opts, cmd2) => {
546 printJson(exportCreds(), outputOptions(cmd2));
548 cmd.command("change-password [url]").description("Change your account password (bkn-safe self-service; no browser)").option("-a, --account <name>", "account / login name (the login column, e.g. admin)").option("--old-password <pwd>", "current password").option("--new-password <pwd>", "new password").action(async (url,
549 const g = cmd2.optsWithGlobals();
550 const ctx = resolveContext({
551 baseUrl: url ?? g.baseUrl,
554 businessDomain: g.bizDomain,
557 const account = opts.account ?? await promptLine("Account: ");
558 const oldPassword = opts.oldPassword ?? await promptLine("Current password: ", true);
559 let newPassword = opts.newPassword;
561 newPassword = await promptLine("New password: ", true);
562 const confirm = await promptLine("Confirm new password: ", true);
563 if (newPassword !== confirm) throw new Error("New passwords do not match.");
567 await changePasswordSafe(ctx, account, oldPassword, newPassword),
571 if (e instanceof HttpError && e.status === 401) {
572 throw new InputError("Wrong account or current password.");
574 if (e instanceof HttpError && e.status === 400) {
575 throw new InputError("New password must differ from the current one.");
581function authCommand() {
582 const cmd = new Command("auth").description("Login, session, and token management");
583 registerAuthLeaves(cmd);
584 return group(cmd, "AUTHENTICATION & CONFIG");
587// src/commands/admin.ts
588var int = (v) => Number.parseInt(v, 10);
589var DEFAULT_RESET_PASSWORD = "openbkn";
590async function importLicenseFile(cmd, file, receipt) {
591 const text = readFileSync2(file, "utf8");
592 const res = await clientFrom(cmd).admin.licenseImport(text, { receipt });
593 printJson(res, outputOptions(cmd));
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/cli.jsView on unpkg · L591 594 if ("stored" in res && res.stored) process.exitCode = 1;
596function adminCommand() {
597 const admin = new Command2("admin").description("Operator CLI: org, user, role, models, audit");
598 registerAuthLeaves(admin.command("auth").description("Operator authentication"));
599 const org = admin.command("org").description("Departments and org structure");
600 org.command("list").description("List departments").option("--role <r>", "role qualifier", "super_admin").option("--name <s>", "filter by name").option("--limit <n>", "page size", int, 100).option("--offset <n>"
602 await clientFrom(cmd).admin.orgList({
611 org.command("get <id>").description("Get one department").action(async (id, _opts, cmd) => {