style: apply lint fixes
This commit is contained in:
@@ -33,10 +33,7 @@ export function formatCliBannerLine(
|
||||
return `${title} ${version} (${commitLabel}) — ${tagline}`;
|
||||
}
|
||||
|
||||
export function emitCliBanner(
|
||||
version: string,
|
||||
options: BannerOptions = {},
|
||||
) {
|
||||
export function emitCliBanner(version: string, options: BannerOptions = {}) {
|
||||
if (bannerEmitted) return;
|
||||
const argv = options.argv ?? process.argv;
|
||||
if (!process.stdout.isTTY) return;
|
||||
|
||||
@@ -3,12 +3,12 @@ import fs from "node:fs/promises";
|
||||
import type { Command } from "commander";
|
||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { withProgress } from "./progress.js";
|
||||
import { writeBase64ToFile } from "./nodes-camera.js";
|
||||
import {
|
||||
canvasSnapshotTempPath,
|
||||
parseCanvasSnapshotPayload,
|
||||
} from "./nodes-canvas.js";
|
||||
import { withProgress } from "./progress.js";
|
||||
|
||||
type CanvasOpts = {
|
||||
url?: string;
|
||||
|
||||
@@ -160,8 +160,7 @@ function printCronList(jobs: CronJob[], runtime = defaultRuntime) {
|
||||
const targetLabel = pad(job.sessionTarget, CRON_TARGET_PAD);
|
||||
|
||||
const coloredStatus = (() => {
|
||||
if (statusRaw === "ok")
|
||||
return colorize(rich, theme.success, statusLabel);
|
||||
if (statusRaw === "ok") return colorize(rich, theme.success, statusLabel);
|
||||
if (statusRaw === "error")
|
||||
return colorize(rich, theme.error, statusLabel);
|
||||
if (statusRaw === "running")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Command } from "commander";
|
||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { withProgress } from "./progress.js";
|
||||
import {
|
||||
type CameraFacing,
|
||||
cameraTempPath,
|
||||
@@ -20,6 +19,7 @@ import {
|
||||
writeScreenRecordToFile,
|
||||
} from "./nodes-screen.js";
|
||||
import { parseDurationMs } from "./parse-duration.js";
|
||||
import { withProgress } from "./progress.js";
|
||||
|
||||
type NodesRpcOpts = {
|
||||
url?: string;
|
||||
|
||||
@@ -26,8 +26,10 @@ import { danger, setVerbose } from "../globals.js";
|
||||
import { autoMigrateLegacyState } from "../infra/state-migrations.js";
|
||||
import { loginWeb, logoutWeb } from "../provider-web.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { isRich, theme } from "../terminal/theme.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
||||
import { emitCliBanner, formatCliBannerLine } from "./banner.js";
|
||||
import { registerBrowserCli } from "./browser-cli.js";
|
||||
import { registerCanvasCli } from "./canvas-cli.js";
|
||||
import { hasExplicitOptions } from "./command-options.js";
|
||||
@@ -45,8 +47,6 @@ import { forceFreePort } from "./ports.js";
|
||||
import { registerProvidersCli } from "./providers-cli.js";
|
||||
import { registerTelegramCli } from "./telegram-cli.js";
|
||||
import { registerTuiCli } from "./tui-cli.js";
|
||||
import { emitCliBanner, formatCliBannerLine } from "./banner.js";
|
||||
import { isRich, theme } from "../terminal/theme.js";
|
||||
|
||||
export { forceFreePort };
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { spinner } from "@clack/prompts";
|
||||
import {
|
||||
createOscProgressController,
|
||||
supportsOscProgress,
|
||||
} from "osc-progress";
|
||||
import { createOscProgressController, supportsOscProgress } from "osc-progress";
|
||||
|
||||
import { theme } from "../terminal/theme.js";
|
||||
|
||||
@@ -44,11 +41,12 @@ export function createCliProgress(options: ProgressOptions): ProgressReporter {
|
||||
typeof options.delayMs === "number" ? options.delayMs : DEFAULT_DELAY_MS;
|
||||
const canOsc = supportsOscProgress(process.env, stream.isTTY);
|
||||
const allowSpinner =
|
||||
!canOsc && (options.fallback === undefined || options.fallback === "spinner");
|
||||
!canOsc &&
|
||||
(options.fallback === undefined || options.fallback === "spinner");
|
||||
|
||||
let started = false;
|
||||
let label = options.label;
|
||||
let total = options.total ?? null;
|
||||
const total = options.total ?? null;
|
||||
let completed = 0;
|
||||
let percent = 0;
|
||||
let indeterminate =
|
||||
@@ -103,8 +101,7 @@ export function createCliProgress(options: ProgressOptions): ProgressReporter {
|
||||
const tick = (delta = 1) => {
|
||||
if (!total) return;
|
||||
completed = Math.min(total, completed + delta);
|
||||
const nextPercent =
|
||||
total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
const nextPercent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
setPercent(nextPercent);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ export interface TaglineOptions {
|
||||
export function activeTaglines(options: TaglineOptions = {}): string[] {
|
||||
if (TAGLINES.length === 0) return [DEFAULT_TAGLINE];
|
||||
const today = options.now ? options.now() : new Date();
|
||||
const filtered = TAGLINES.filter((tagline) => isTaglineActive(tagline, today));
|
||||
const filtered = TAGLINES.filter((tagline) =>
|
||||
isTaglineActive(tagline, today),
|
||||
);
|
||||
return filtered.length > 0 ? filtered : TAGLINES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user