Skip to content
API reference

lantern

Import
import * as api from "@fungi.computer/lantern";
Kind Export Description
class Cli Own terminal presentation; callers retain commands, credentials and state.
type alias CliOptions
type alias SearchChoice Already ordered choices; the caller owns group membership and labels.
type alias SearchOptions

Own terminal presentation; callers retain commands, credentials and state.

Signature
new Cli(options): Cli;
Parameter Type
options CliOptions

Cli

Signature
readonly interactive: boolean;
Signature
welcome(message): void;
Parameter Type
message string

void

Signature
select<Value>(options): Promise<symbol | Value>;
Type Parameter
Value
Parameter Type
options SelectOptions<Value>

Promise<symbol | Value>

Signature
text(options): Promise<string | symbol>;
Parameter Type
options TextOptions

Promise<string | symbol>

Signature
search(options): Promise<string | symbol>;
Parameter Type
options SearchOptions

Promise<string | symbol>

Signature
password(options): Promise<string | symbol>;
Parameter Type
options PasswordOptions

Promise<string | symbol>

Signature
confirm(options): Promise<boolean | symbol>;
Parameter Type
options ConfirmOptions

Promise<boolean | symbol>

Signature
info(message): void;
Parameter Type
message string

void

Signature
url(url): void;

Show a URL inside the prompt frame as one unbroken line. info() and step() add a status symbol; this keeps only the frame’s “│” bar before the URL and never inserts a line break, so the terminal soft-wraps it and a selection from its first character copies the whole URL.

Parameter Type
url string

void

Signature
link(label, url): string;

An OSC 8 hyperlink around a short label, for terminals that render it. Falls back to the plain label when output is non-interactive, piped, or NO_COLOR/dumb — the same signal info() already uses to decide whether to use clack’s styling at all.

Parameter Type
label string
url string

string

Signature
step(message): void;
Parameter Type
message string

void

Signature
outro(message): void;
Parameter Type
message string

void

Signature
cancel(message): void;
Parameter Type
message string

void

Signature
task<T>(message, work): Promise<T>;

Stop animation on both success and failure, without exposing error payloads.

Type Parameter
T
Parameter Type
message string
work (update) => Promise<T>

Promise<T>

Signature
checklist(): (label, ok, detail) => void;

Shared doctor checklist; the caller owns what constitutes a pass.

(label, ok, detail) => void

CliOptionstype alias

Section titled “CliOptions”
Signature
type CliOptions = object;
Signature
brand: CliBrand;
Signature
optional input?: Readable;
Signature
optional output?: Writable;
Signature
optional interactive?: boolean;
Signature
optional columns?: number;

SearchChoicetype alias

Section titled “SearchChoice”
Signature
type SearchChoice = Readonly<{
value: string;
label: string;
description?: string;
group?: string;
}>;

Already ordered choices; the caller owns group membership and labels.


SearchOptionstype alias

Section titled “SearchOptions”
Signature
type SearchOptions = Readonly<{
message: string;
choices: readonly SearchChoice[];
collapsedGroup?: string;
signal?: AbortSignal;
}>;

Re-exports renderBanner