@linxiraos/pi-utils 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +449 -0
- package/README.md +36 -0
- package/dist/types/abortable.d.ts +32 -0
- package/dist/types/acp/connection.d.ts +118 -0
- package/dist/types/acp/protocol.d.ts +526 -0
- package/dist/types/acp/schema.d.ts +41 -0
- package/dist/types/acp/stream.d.ts +8 -0
- package/dist/types/acp/transport.d.ts +81 -0
- package/dist/types/acp.d.ts +6 -0
- package/dist/types/async.d.ts +20 -0
- package/dist/types/binary.d.ts +17 -0
- package/dist/types/browsers.d.ts +68 -0
- package/dist/types/chalk.d.ts +125 -0
- package/dist/types/cli.d.ts +134 -0
- package/dist/types/color.d.ts +102 -0
- package/dist/types/dates.d.ts +7 -0
- package/dist/types/dirs.d.ts +282 -0
- package/dist/types/docx/converter.d.ts +46 -0
- package/dist/types/docx/xml.d.ts +26 -0
- package/dist/types/docx/zip.d.ts +6 -0
- package/dist/types/docx.d.ts +11 -0
- package/dist/types/dom/core.d.ts +431 -0
- package/dist/types/dom/parser.d.ts +7 -0
- package/dist/types/dom/selector.d.ts +5 -0
- package/dist/types/dom.d.ts +5 -0
- package/dist/types/env.d.ts +124 -0
- package/dist/types/fetch-retry.d.ts +96 -0
- package/dist/types/file-lock.d.ts +23 -0
- package/dist/types/format.d.ts +37 -0
- package/dist/types/frontmatter.d.ts +46 -0
- package/dist/types/fs-error.d.ts +31 -0
- package/dist/types/glob.d.ts +28 -0
- package/dist/types/headers.d.ts +34 -0
- package/dist/types/index.d.ts +39 -0
- package/dist/types/json-parse.d.ts +74 -0
- package/dist/types/json.d.ts +14 -0
- package/dist/types/logger/rotating-file.d.ts +18 -0
- package/dist/types/logger.d.ts +96 -0
- package/dist/types/loop-phase.d.ts +10 -0
- package/dist/types/lru.d.ts +46 -0
- package/dist/types/marked/core.d.ts +445 -0
- package/dist/types/marked.d.ts +2 -0
- package/dist/types/mermaid-ascii.d.ts +11 -0
- package/dist/types/mime.d.ts +29 -0
- package/dist/types/module-timer.d.ts +1 -0
- package/dist/types/path-tree.d.ts +76 -0
- package/dist/types/path.d.ts +2 -0
- package/dist/types/peek-file.d.ts +29 -0
- package/dist/types/postmortem.d.ts +104 -0
- package/dist/types/process-name.d.ts +7 -0
- package/dist/types/procmgr.d.ts +74 -0
- package/dist/types/prompt.d.ts +18 -0
- package/dist/types/ptree.d.ts +110 -0
- package/dist/types/readability/readability.d.ts +9 -0
- package/dist/types/readability/readerable.d.ts +10 -0
- package/dist/types/readability/types.d.ts +70 -0
- package/dist/types/readability.d.ts +4 -0
- package/dist/types/ring.d.ts +93 -0
- package/dist/types/runtime-install.d.ts +78 -0
- package/dist/types/sanitize-text.d.ts +29 -0
- package/dist/types/snowflake.d.ts +25 -0
- package/dist/types/stderr-guard.d.ts +22 -0
- package/dist/types/stream.d.ts +67 -0
- package/dist/types/tab-spacing.d.ts +24 -0
- package/dist/types/temp.d.ts +17 -0
- package/dist/types/template.d.ts +62 -0
- package/dist/types/timing-buffer.d.ts +22 -0
- package/dist/types/tls-fetch.d.ts +37 -0
- package/dist/types/turndown/gfm.d.ts +11 -0
- package/dist/types/turndown/html.d.ts +5 -0
- package/dist/types/turndown/service.d.ts +21 -0
- package/dist/types/turndown/types.d.ts +70 -0
- package/dist/types/turndown.d.ts +4 -0
- package/dist/types/type-guards.d.ts +5 -0
- package/dist/types/vendor/mermaid-ascii/ascii/ansi.d.ts +41 -0
- package/dist/types/vendor/mermaid-ascii/ascii/canvas.d.ts +89 -0
- package/dist/types/vendor/mermaid-ascii/ascii/class-diagram.d.ts +7 -0
- package/dist/types/vendor/mermaid-ascii/ascii/converter.d.ts +12 -0
- package/dist/types/vendor/mermaid-ascii/ascii/draw.d.ts +66 -0
- package/dist/types/vendor/mermaid-ascii/ascii/edge-bundling.d.ts +48 -0
- package/dist/types/vendor/mermaid-ascii/ascii/edge-routing.d.ts +43 -0
- package/dist/types/vendor/mermaid-ascii/ascii/er-diagram.d.ts +7 -0
- package/dist/types/vendor/mermaid-ascii/ascii/grid.d.ts +56 -0
- package/dist/types/vendor/mermaid-ascii/ascii/index.d.ts +65 -0
- package/dist/types/vendor/mermaid-ascii/ascii/multiline-utils.d.ts +27 -0
- package/dist/types/vendor/mermaid-ascii/ascii/pathfinder.d.ts +17 -0
- package/dist/types/vendor/mermaid-ascii/ascii/sequence.d.ts +7 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/circle.d.ts +11 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/corners.d.ts +34 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/diamond.d.ts +11 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/hexagon.d.ts +11 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/index.d.ts +26 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rectangle.d.ts +31 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rounded.d.ts +11 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/special.d.ts +59 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/stadium.d.ts +17 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/state.d.ts +30 -0
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/types.d.ts +55 -0
- package/dist/types/vendor/mermaid-ascii/ascii/types.d.ts +206 -0
- package/dist/types/vendor/mermaid-ascii/ascii/validate.d.ts +51 -0
- package/dist/types/vendor/mermaid-ascii/ascii/xychart.d.ts +2 -0
- package/dist/types/vendor/mermaid-ascii/class/parser.d.ts +6 -0
- package/dist/types/vendor/mermaid-ascii/class/types.d.ts +102 -0
- package/dist/types/vendor/mermaid-ascii/er/parser.d.ts +6 -0
- package/dist/types/vendor/mermaid-ascii/er/types.d.ts +76 -0
- package/dist/types/vendor/mermaid-ascii/index.d.ts +1 -0
- package/dist/types/vendor/mermaid-ascii/multiline-utils.d.ts +9 -0
- package/dist/types/vendor/mermaid-ascii/parser.d.ts +7 -0
- package/dist/types/vendor/mermaid-ascii/sequence/parser.d.ts +6 -0
- package/dist/types/vendor/mermaid-ascii/sequence/types.d.ts +130 -0
- package/dist/types/vendor/mermaid-ascii/text-metrics.d.ts +21 -0
- package/dist/types/vendor/mermaid-ascii/types.d.ts +114 -0
- package/dist/types/vendor/mermaid-ascii/xychart/colors.d.ts +25 -0
- package/dist/types/vendor/mermaid-ascii/xychart/parser.d.ts +6 -0
- package/dist/types/vendor/mermaid-ascii/xychart/types.d.ts +145 -0
- package/dist/types/version.d.ts +18 -0
- package/dist/types/vterm/buffer.d.ts +99 -0
- package/dist/types/vterm/terminal.d.ts +44 -0
- package/dist/types/vterm.d.ts +8 -0
- package/dist/types/which.d.ts +37 -0
- package/dist/types/worker-host.d.ts +51 -0
- package/dist/types/xml.d.ts +31 -0
- package/package.json +59 -0
- package/src/abortable.ts +109 -0
- package/src/acp/connection.ts +344 -0
- package/src/acp/protocol.ts +466 -0
- package/src/acp/schema.ts +160 -0
- package/src/acp/stream.ts +82 -0
- package/src/acp/transport.ts +213 -0
- package/src/acp.ts +6 -0
- package/src/async.ts +91 -0
- package/src/binary.ts +50 -0
- package/src/browsers.ts +501 -0
- package/src/chalk.ts +312 -0
- package/src/cli.ts +529 -0
- package/src/color.ts +302 -0
- package/src/dates.ts +194 -0
- package/src/dirs.ts +1026 -0
- package/src/docx/converter.ts +681 -0
- package/src/docx/xml.ts +166 -0
- package/src/docx/zip.ts +87 -0
- package/src/docx.ts +20 -0
- package/src/dom/core.ts +1254 -0
- package/src/dom/parser.ts +370 -0
- package/src/dom/selector.ts +290 -0
- package/src/dom.ts +33 -0
- package/src/env.ts +400 -0
- package/src/fetch-retry.ts +379 -0
- package/src/file-lock.ts +69 -0
- package/src/format.ts +113 -0
- package/src/frontmatter.ts +205 -0
- package/src/fs-error.ts +56 -0
- package/src/glob.ts +189 -0
- package/src/headers.ts +167 -0
- package/src/index.ts +59 -0
- package/src/json-parse.ts +821 -0
- package/src/json.ts +23 -0
- package/src/logger/rotating-file.ts +149 -0
- package/src/logger.ts +798 -0
- package/src/loop-phase.ts +49 -0
- package/src/lru.ts +185 -0
- package/src/marked/core.ts +1576 -0
- package/src/marked.ts +2 -0
- package/src/mermaid-ascii.ts +31 -0
- package/src/mime.ts +159 -0
- package/src/module-timer.ts +148 -0
- package/src/path-tree.ts +147 -0
- package/src/path.ts +28 -0
- package/src/peek-file.ts +188 -0
- package/src/postmortem.ts +433 -0
- package/src/process-name.ts +57 -0
- package/src/procmgr.ts +247 -0
- package/src/prompt.ts +545 -0
- package/src/ptree.ts +412 -0
- package/src/readability/readability.ts +533 -0
- package/src/readability/readerable.ts +51 -0
- package/src/readability/types.ts +72 -0
- package/src/readability.ts +11 -0
- package/src/ring.ts +169 -0
- package/src/runtime-install.ts +393 -0
- package/src/sanitize-text.ts +96 -0
- package/src/snowflake.ts +121 -0
- package/src/stderr-guard.ts +155 -0
- package/src/stream.ts +454 -0
- package/src/tab-spacing.ts +336 -0
- package/src/temp.ts +134 -0
- package/src/template.ts +586 -0
- package/src/timing-buffer.ts +47 -0
- package/src/tls-fetch.ts +178 -0
- package/src/turndown/gfm.ts +106 -0
- package/src/turndown/html.ts +257 -0
- package/src/turndown/service.ts +334 -0
- package/src/turndown/types.ts +81 -0
- package/src/turndown.ts +5 -0
- package/src/type-guards.ts +17 -0
- package/src/vendor/mermaid-ascii/NOTICE +33 -0
- package/src/vendor/mermaid-ascii/ascii/ansi.ts +409 -0
- package/src/vendor/mermaid-ascii/ascii/canvas.ts +476 -0
- package/src/vendor/mermaid-ascii/ascii/class-diagram.ts +699 -0
- package/src/vendor/mermaid-ascii/ascii/converter.ts +271 -0
- package/src/vendor/mermaid-ascii/ascii/draw.ts +1382 -0
- package/src/vendor/mermaid-ascii/ascii/edge-bundling.ts +328 -0
- package/src/vendor/mermaid-ascii/ascii/edge-routing.ts +297 -0
- package/src/vendor/mermaid-ascii/ascii/er-diagram.ts +441 -0
- package/src/vendor/mermaid-ascii/ascii/grid.ts +578 -0
- package/src/vendor/mermaid-ascii/ascii/index.ts +187 -0
- package/src/vendor/mermaid-ascii/ascii/multiline-utils.ts +78 -0
- package/src/vendor/mermaid-ascii/ascii/pathfinder.ts +277 -0
- package/src/vendor/mermaid-ascii/ascii/sequence.ts +460 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/circle.ts +27 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/corners.ts +127 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/diamond.ts +27 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/hexagon.ts +27 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/index.ts +101 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/rectangle.ts +175 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/rounded.ts +27 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/special.ts +296 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/stadium.ts +114 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/state.ts +192 -0
- package/src/vendor/mermaid-ascii/ascii/shapes/types.ts +73 -0
- package/src/vendor/mermaid-ascii/ascii/types.ts +273 -0
- package/src/vendor/mermaid-ascii/ascii/validate.ts +120 -0
- package/src/vendor/mermaid-ascii/ascii/xychart.ts +875 -0
- package/src/vendor/mermaid-ascii/class/parser.ts +290 -0
- package/src/vendor/mermaid-ascii/class/types.ts +121 -0
- package/src/vendor/mermaid-ascii/er/parser.ts +181 -0
- package/src/vendor/mermaid-ascii/er/types.ts +91 -0
- package/src/vendor/mermaid-ascii/index.ts +14 -0
- package/src/vendor/mermaid-ascii/multiline-utils.ts +30 -0
- package/src/vendor/mermaid-ascii/parser.ts +645 -0
- package/src/vendor/mermaid-ascii/sequence/parser.ts +207 -0
- package/src/vendor/mermaid-ascii/sequence/types.ts +146 -0
- package/src/vendor/mermaid-ascii/text-metrics.ts +71 -0
- package/src/vendor/mermaid-ascii/types.ts +164 -0
- package/src/vendor/mermaid-ascii/xychart/colors.ts +140 -0
- package/src/vendor/mermaid-ascii/xychart/parser.ts +115 -0
- package/src/vendor/mermaid-ascii/xychart/types.ts +150 -0
- package/src/version.ts +99 -0
- package/src/vterm/buffer.ts +218 -0
- package/src/vterm/terminal.ts +773 -0
- package/src/vterm.ts +8 -0
- package/src/which.ts +234 -0
- package/src/worker-host.ts +100 -0
- package/src/xml.ts +313 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify an in-memory byte header as binary (non-UTF-8-text).
|
|
3
|
+
*
|
|
4
|
+
* Binary when the header contains a NUL byte (true binary, plus UTF-16/UTF-32
|
|
5
|
+
* text whose ASCII range is NUL-padded) or when it is not valid UTF-8. The
|
|
6
|
+
* decode runs in streaming mode so a multibyte sequence truncated at the header
|
|
7
|
+
* boundary is tolerated, while any genuinely invalid byte still fails — matching
|
|
8
|
+
* the strict `fatal` decode the `local://`/`ssh://` read paths already use.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isProbablyBinaryHeader(header: Uint8Array): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sniff the first {@link BINARY_SNIFF_BYTES} of `filePath` and report whether it
|
|
13
|
+
* is binary (non-UTF-8-text). See {@link isProbablyBinaryHeader} for the rule.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isProbablyBinary(filePath: string, maxBytes?: number): Promise<boolean>;
|
|
16
|
+
/** Synchronous {@link isProbablyBinary}. */
|
|
17
|
+
export declare function isProbablyBinarySync(filePath: string, maxBytes?: number): boolean;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of @puppeteer/browsers' used surface. */
|
|
2
|
+
/** Supported browser products. */
|
|
3
|
+
export declare enum Browser {
|
|
4
|
+
CHROME = "chrome",
|
|
5
|
+
CHROMEHEADLESSSHELL = "chrome-headless-shell",
|
|
6
|
+
CHROMIUM = "chromium",
|
|
7
|
+
FIREFOX = "firefox",
|
|
8
|
+
CHROMEDRIVER = "chromedriver"
|
|
9
|
+
}
|
|
10
|
+
/** Browser download platform identifiers. */
|
|
11
|
+
export declare enum BrowserPlatform {
|
|
12
|
+
LINUX = "linux",
|
|
13
|
+
LINUX_ARM = "linux_arm",
|
|
14
|
+
MAC = "mac",
|
|
15
|
+
MAC_ARM = "mac_arm",
|
|
16
|
+
WIN32 = "win32",
|
|
17
|
+
WIN64 = "win64"
|
|
18
|
+
}
|
|
19
|
+
/** Chrome-for-Testing release channel tags accepted by {@link resolveBuildId}. */
|
|
20
|
+
export declare enum BrowserTag {
|
|
21
|
+
CANARY = "canary",
|
|
22
|
+
NIGHTLY = "nightly",
|
|
23
|
+
BETA = "beta",
|
|
24
|
+
DEV = "dev",
|
|
25
|
+
DEVEDITION = "devedition",
|
|
26
|
+
STABLE = "stable",
|
|
27
|
+
ESR = "esr",
|
|
28
|
+
LATEST = "latest"
|
|
29
|
+
}
|
|
30
|
+
/** Download progress reported while a browser archive is streamed to disk. */
|
|
31
|
+
export interface BrowserDownloadProgress {
|
|
32
|
+
downloadedBytes: number;
|
|
33
|
+
totalBytes: number;
|
|
34
|
+
}
|
|
35
|
+
/** Inputs used to locate an installed browser executable. */
|
|
36
|
+
export interface ComputeExecutablePathOptions {
|
|
37
|
+
browser: Browser;
|
|
38
|
+
buildId: string;
|
|
39
|
+
cacheDir: string;
|
|
40
|
+
platform?: BrowserPlatform;
|
|
41
|
+
}
|
|
42
|
+
/** Inputs used to download and install a browser. */
|
|
43
|
+
export interface InstallOptions extends ComputeExecutablePathOptions {
|
|
44
|
+
baseUrl?: string;
|
|
45
|
+
downloadProgressCallback?: (progress: BrowserDownloadProgress) => void;
|
|
46
|
+
}
|
|
47
|
+
/** Metadata for one browser installation found in a Puppeteer cache. */
|
|
48
|
+
export interface InstalledBrowser {
|
|
49
|
+
browser: Browser;
|
|
50
|
+
buildId: string;
|
|
51
|
+
platform: BrowserPlatform;
|
|
52
|
+
path: string;
|
|
53
|
+
executablePath: string;
|
|
54
|
+
}
|
|
55
|
+
/** Detect the current host's Puppeteer browser platform. */
|
|
56
|
+
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
|
|
57
|
+
/** Resolve a Chrome-for-Testing channel, milestone, or build prefix to a full build ID. */
|
|
58
|
+
export declare function resolveBuildId(browser: Browser, _platform: BrowserPlatform, tag: string | BrowserTag): Promise<string>;
|
|
59
|
+
/** Return the Chrome-for-Testing archive URL for a browser build. */
|
|
60
|
+
export declare function getDownloadUrl(browser: Browser, platform: BrowserPlatform, buildId: string, baseUrl?: string): URL;
|
|
61
|
+
/** Compute the executable path in Puppeteer's cache layout. */
|
|
62
|
+
export declare function computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
|
63
|
+
/** Scan a Puppeteer cache for browser installation directories. */
|
|
64
|
+
export declare function getInstalledBrowsers(options: {
|
|
65
|
+
cacheDir: string;
|
|
66
|
+
}): Promise<InstalledBrowser[]>;
|
|
67
|
+
/** Download and unpack Chrome into Puppeteer's existing cache layout. */
|
|
68
|
+
export declare function install(options: InstallOptions): Promise<InstalledBrowser>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of chalk's used surface. */
|
|
2
|
+
/** ANSI color capability level. */
|
|
3
|
+
export type ColorLevel = 0 | 1 | 2 | 3;
|
|
4
|
+
/** Details about a terminal's supported color depth. */
|
|
5
|
+
export interface ColorSupport {
|
|
6
|
+
/** Highest supported ANSI color level. */
|
|
7
|
+
level: ColorLevel;
|
|
8
|
+
/** Whether the terminal supports the basic 16 colors. */
|
|
9
|
+
hasBasic: boolean;
|
|
10
|
+
/** Whether the terminal supports the 256-color palette. */
|
|
11
|
+
has256: boolean;
|
|
12
|
+
/** Whether the terminal supports 24-bit color. */
|
|
13
|
+
has16m: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface ChalkOptions {
|
|
16
|
+
level?: ColorLevel;
|
|
17
|
+
}
|
|
18
|
+
/** A callable, chainable ANSI text formatter. */
|
|
19
|
+
export interface ChalkInstance {
|
|
20
|
+
(...text: unknown[]): string;
|
|
21
|
+
/** Active color capability level. */
|
|
22
|
+
level: ColorLevel;
|
|
23
|
+
/** Reset every active terminal style. */
|
|
24
|
+
readonly reset: ChalkInstance;
|
|
25
|
+
/** Render bold text. */
|
|
26
|
+
readonly bold: ChalkInstance;
|
|
27
|
+
/** Render faint text. */
|
|
28
|
+
readonly dim: ChalkInstance;
|
|
29
|
+
/** Render italic text. */
|
|
30
|
+
readonly italic: ChalkInstance;
|
|
31
|
+
/** Render underlined text. */
|
|
32
|
+
readonly underline: ChalkInstance;
|
|
33
|
+
/** Swap foreground and background colors. */
|
|
34
|
+
readonly inverse: ChalkInstance;
|
|
35
|
+
/** Render struck-through text. */
|
|
36
|
+
readonly strikethrough: ChalkInstance;
|
|
37
|
+
/** Render black text. */
|
|
38
|
+
readonly black: ChalkInstance;
|
|
39
|
+
/** Render red text. */
|
|
40
|
+
readonly red: ChalkInstance;
|
|
41
|
+
/** Render green text. */
|
|
42
|
+
readonly green: ChalkInstance;
|
|
43
|
+
/** Render yellow text. */
|
|
44
|
+
readonly yellow: ChalkInstance;
|
|
45
|
+
/** Render blue text. */
|
|
46
|
+
readonly blue: ChalkInstance;
|
|
47
|
+
/** Render magenta text. */
|
|
48
|
+
readonly magenta: ChalkInstance;
|
|
49
|
+
/** Render cyan text. */
|
|
50
|
+
readonly cyan: ChalkInstance;
|
|
51
|
+
/** Render white text. */
|
|
52
|
+
readonly white: ChalkInstance;
|
|
53
|
+
/** Render gray text. */
|
|
54
|
+
readonly gray: ChalkInstance;
|
|
55
|
+
/** Alias for gray text. */
|
|
56
|
+
readonly grey: ChalkInstance;
|
|
57
|
+
/** Render bright black text. */
|
|
58
|
+
readonly blackBright: ChalkInstance;
|
|
59
|
+
/** Render bright red text. */
|
|
60
|
+
readonly redBright: ChalkInstance;
|
|
61
|
+
/** Render bright green text. */
|
|
62
|
+
readonly greenBright: ChalkInstance;
|
|
63
|
+
/** Render bright yellow text. */
|
|
64
|
+
readonly yellowBright: ChalkInstance;
|
|
65
|
+
/** Render bright blue text. */
|
|
66
|
+
readonly blueBright: ChalkInstance;
|
|
67
|
+
/** Render bright magenta text. */
|
|
68
|
+
readonly magentaBright: ChalkInstance;
|
|
69
|
+
/** Render bright cyan text. */
|
|
70
|
+
readonly cyanBright: ChalkInstance;
|
|
71
|
+
/** Render bright white text. */
|
|
72
|
+
readonly whiteBright: ChalkInstance;
|
|
73
|
+
/** Render text on a black background. */
|
|
74
|
+
readonly bgBlack: ChalkInstance;
|
|
75
|
+
/** Render text on a red background. */
|
|
76
|
+
readonly bgRed: ChalkInstance;
|
|
77
|
+
/** Render text on a green background. */
|
|
78
|
+
readonly bgGreen: ChalkInstance;
|
|
79
|
+
/** Render text on a yellow background. */
|
|
80
|
+
readonly bgYellow: ChalkInstance;
|
|
81
|
+
/** Render text on a blue background. */
|
|
82
|
+
readonly bgBlue: ChalkInstance;
|
|
83
|
+
/** Render text on a magenta background. */
|
|
84
|
+
readonly bgMagenta: ChalkInstance;
|
|
85
|
+
/** Render text on a cyan background. */
|
|
86
|
+
readonly bgCyan: ChalkInstance;
|
|
87
|
+
/** Render text on a white background. */
|
|
88
|
+
readonly bgWhite: ChalkInstance;
|
|
89
|
+
/** Render text on a gray background. */
|
|
90
|
+
readonly bgGray: ChalkInstance;
|
|
91
|
+
/** Alias for a gray background. */
|
|
92
|
+
readonly bgGrey: ChalkInstance;
|
|
93
|
+
/** Render text on a bright black background. */
|
|
94
|
+
readonly bgBlackBright: ChalkInstance;
|
|
95
|
+
/** Render text on a bright red background. */
|
|
96
|
+
readonly bgRedBright: ChalkInstance;
|
|
97
|
+
/** Render text on a bright green background. */
|
|
98
|
+
readonly bgGreenBright: ChalkInstance;
|
|
99
|
+
/** Render text on a bright yellow background. */
|
|
100
|
+
readonly bgYellowBright: ChalkInstance;
|
|
101
|
+
/** Render text on a bright blue background. */
|
|
102
|
+
readonly bgBlueBright: ChalkInstance;
|
|
103
|
+
/** Render text on a bright magenta background. */
|
|
104
|
+
readonly bgMagentaBright: ChalkInstance;
|
|
105
|
+
/** Render text on a bright cyan background. */
|
|
106
|
+
readonly bgCyanBright: ChalkInstance;
|
|
107
|
+
/** Render text on a bright white background. */
|
|
108
|
+
readonly bgWhiteBright: ChalkInstance;
|
|
109
|
+
/** Render text with an arbitrary hexadecimal foreground color. */
|
|
110
|
+
hex(color: string): ChalkInstance;
|
|
111
|
+
}
|
|
112
|
+
/** Constructor for an independently configured chalk formatter. */
|
|
113
|
+
export interface ChalkConstructor {
|
|
114
|
+
new (options?: ChalkOptions): ChalkInstance;
|
|
115
|
+
}
|
|
116
|
+
/** Detect an ANSI color level from terminal environment and TTY state. */
|
|
117
|
+
export declare function detectColorLevel(environment: NodeJS.ProcessEnv, isTTY: boolean): ColorLevel;
|
|
118
|
+
/** Color support detected for standard output. */
|
|
119
|
+
export declare const supportsColor: false | ColorSupport;
|
|
120
|
+
/** Color support detected for standard error. */
|
|
121
|
+
export declare const supportsColorStderr: false | ColorSupport;
|
|
122
|
+
/** Construct an independently configured chalk formatter. */
|
|
123
|
+
export declare const Chalk: ChalkConstructor;
|
|
124
|
+
declare const chalk: ChalkInstance;
|
|
125
|
+
export default chalk;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A user-facing argument/flag validation failure. Thrown by {@link Command.parse}
|
|
3
|
+
* for missing/invalid positionals and flags. The top-level {@link run} handler
|
|
4
|
+
* prints its message plus the command usage line to stderr and exits 1, instead
|
|
5
|
+
* of letting it bubble to the process-level catch — which would dump a minified
|
|
6
|
+
* `dist/cli.js` code frame over a plain argument mistake (issue #5369).
|
|
7
|
+
*/
|
|
8
|
+
export declare class CliUsageError extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
export interface FlagDescriptor<K extends "string" | "boolean" | "integer" = "string" | "boolean" | "integer"> {
|
|
12
|
+
kind: K;
|
|
13
|
+
description?: string;
|
|
14
|
+
char?: string;
|
|
15
|
+
default?: unknown;
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
options?: readonly string[];
|
|
18
|
+
required?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ArgDescriptor {
|
|
21
|
+
kind: "string";
|
|
22
|
+
description?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
options?: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
interface FlagInput {
|
|
28
|
+
description?: string;
|
|
29
|
+
char?: string;
|
|
30
|
+
default?: unknown;
|
|
31
|
+
multiple?: boolean;
|
|
32
|
+
options?: readonly string[];
|
|
33
|
+
required?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ArgInput {
|
|
36
|
+
description?: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
multiple?: boolean;
|
|
39
|
+
options?: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
/** Builders that match the `Flags.*()` / `Args.*()` API from oclif. */
|
|
42
|
+
export declare const Flags: {
|
|
43
|
+
string<T extends FlagInput>(opts?: T): FlagDescriptor<"string"> & T;
|
|
44
|
+
boolean<T extends FlagInput>(opts?: T): FlagDescriptor<"boolean"> & T;
|
|
45
|
+
integer<T extends FlagInput & {
|
|
46
|
+
default?: number;
|
|
47
|
+
}>(opts?: T): FlagDescriptor<"integer"> & T;
|
|
48
|
+
};
|
|
49
|
+
export declare const Args: {
|
|
50
|
+
string<T extends ArgInput>(opts?: T): ArgDescriptor & T;
|
|
51
|
+
};
|
|
52
|
+
type FlagValue<D extends FlagDescriptor> = D["kind"] extends "boolean" ? D extends {
|
|
53
|
+
default: boolean;
|
|
54
|
+
} ? boolean : boolean | undefined : D["kind"] extends "integer" ? D extends {
|
|
55
|
+
default: number;
|
|
56
|
+
} ? number : number | undefined : D extends {
|
|
57
|
+
multiple: true;
|
|
58
|
+
} ? string[] | undefined : string | undefined;
|
|
59
|
+
type ArgValue<D extends ArgDescriptor> = D extends {
|
|
60
|
+
multiple: true;
|
|
61
|
+
} ? string[] | undefined : string | undefined;
|
|
62
|
+
type FlagValues<T extends Record<string, FlagDescriptor>> = {
|
|
63
|
+
[K in keyof T]: FlagValue<T[K]>;
|
|
64
|
+
};
|
|
65
|
+
type ArgValues<T extends Record<string, ArgDescriptor>> = {
|
|
66
|
+
[K in keyof T]: ArgValue<T[K]>;
|
|
67
|
+
};
|
|
68
|
+
export interface ParseOutput<F extends Record<string, FlagDescriptor> = Record<string, FlagDescriptor>, A extends Record<string, ArgDescriptor> = Record<string, ArgDescriptor>> {
|
|
69
|
+
flags: FlagValues<F>;
|
|
70
|
+
args: ArgValues<A>;
|
|
71
|
+
argv: string[];
|
|
72
|
+
}
|
|
73
|
+
export interface CommandMetadata {
|
|
74
|
+
description?: string;
|
|
75
|
+
hidden?: boolean;
|
|
76
|
+
flags?: Record<string, FlagDescriptor>;
|
|
77
|
+
args?: Record<string, ArgDescriptor>;
|
|
78
|
+
examples?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface CommandCtor extends CommandMetadata {
|
|
81
|
+
new (argv: string[], config: CliConfig): Command;
|
|
82
|
+
strict?: boolean;
|
|
83
|
+
aliases?: string[];
|
|
84
|
+
}
|
|
85
|
+
/** Configuration passed to every command instance and help renderers. */
|
|
86
|
+
export interface CliConfig<TCommand extends CommandMetadata = CommandCtor> {
|
|
87
|
+
bin: string;
|
|
88
|
+
version: string;
|
|
89
|
+
/** All registered commands keyed by their canonical name. */
|
|
90
|
+
commands: Map<string, TCommand>;
|
|
91
|
+
}
|
|
92
|
+
/** Minimal Command base matching the oclif surface we use. */
|
|
93
|
+
export declare abstract class Command {
|
|
94
|
+
argv: string[];
|
|
95
|
+
config: CliConfig;
|
|
96
|
+
constructor(argv: string[], config: CliConfig);
|
|
97
|
+
abstract run(): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Parse argv against the static `flags` and `args` declared on the
|
|
100
|
+
* concrete command class. Returns a typed `{ flags, args, argv }` object.
|
|
101
|
+
*/
|
|
102
|
+
parse<C extends CommandCtor>(_Cmd: C): Promise<ParseOutput<NonNullable<C["flags"]> extends Record<string, FlagDescriptor> ? NonNullable<C["flags"]> : Record<string, FlagDescriptor>, NonNullable<C["args"]> extends Record<string, ArgDescriptor> ? NonNullable<C["args"]> : Record<string, ArgDescriptor>>>;
|
|
103
|
+
}
|
|
104
|
+
/** Render full root help: header, default command details, subcommand list. */
|
|
105
|
+
export declare function renderRootHelp(config: CliConfig<CommandMetadata>): void;
|
|
106
|
+
/** Build the single USAGE line for a command (without the leading label). */
|
|
107
|
+
export declare function commandUsageLine(bin: string, id: string, Cmd: CommandCtor): string;
|
|
108
|
+
/** Render help for a single command. */
|
|
109
|
+
export declare function renderCommandHelp(bin: string, id: string, Cmd: CommandCtor): void;
|
|
110
|
+
/** A lazily-loaded command: canonical name, loader, and optional aliases. */
|
|
111
|
+
export interface CommandEntry {
|
|
112
|
+
name: string;
|
|
113
|
+
load: () => Promise<CommandCtor>;
|
|
114
|
+
help?: CommandMetadata;
|
|
115
|
+
aliases?: string[];
|
|
116
|
+
}
|
|
117
|
+
export interface RunOptions {
|
|
118
|
+
bin: string;
|
|
119
|
+
version: string;
|
|
120
|
+
argv: string[];
|
|
121
|
+
commands: CommandEntry[];
|
|
122
|
+
/** Custom help renderer with the fully loaded command constructors. */
|
|
123
|
+
help?: (config: CliConfig) => Promise<void> | void;
|
|
124
|
+
/** Lightweight help renderer backed by static command metadata. */
|
|
125
|
+
metadataHelp?: (config: CliConfig<CommandMetadata>) => Promise<void> | void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Main entry point — replaces `run()` from @oclif/core.
|
|
129
|
+
*
|
|
130
|
+
* Each command is explicitly registered with a lazy loader.
|
|
131
|
+
* No filesystem scanning, no plugin system, no package.json reading.
|
|
132
|
+
*/
|
|
133
|
+
export declare function run(opts: RunOptions): Promise<void>;
|
|
134
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color manipulation utilities for hex colors.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { hexToHsv, hsvToHex } from "@linxiraos/pi-utils";
|
|
7
|
+
*
|
|
8
|
+
* // Rotate the hue by 90°
|
|
9
|
+
* const hsv = hexToHsv("#4ade80");
|
|
10
|
+
* hsv.h = (hsv.h + 90) % 360;
|
|
11
|
+
* const newHex = hsvToHex(hsv);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export interface HSV {
|
|
15
|
+
/** Hue in degrees (0-360) */
|
|
16
|
+
h: number;
|
|
17
|
+
/** Saturation (0-1) */
|
|
18
|
+
s: number;
|
|
19
|
+
/** Value/brightness (0-1) */
|
|
20
|
+
v: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RGB {
|
|
23
|
+
/** Red (0-255) */
|
|
24
|
+
r: number;
|
|
25
|
+
/** Green (0-255) */
|
|
26
|
+
g: number;
|
|
27
|
+
/** Blue (0-255) */
|
|
28
|
+
b: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parse a hex color string to RGB.
|
|
32
|
+
* Supports #RGB, #RRGGBB formats.
|
|
33
|
+
*/
|
|
34
|
+
export declare function hexToRgb(hex: string): RGB;
|
|
35
|
+
/**
|
|
36
|
+
* Convert RGB to hex color string.
|
|
37
|
+
*/
|
|
38
|
+
export declare function rgbToHex(rgb: RGB): string;
|
|
39
|
+
/**
|
|
40
|
+
* Convert RGB to HSV.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rgbToHsv(rgb: RGB): HSV;
|
|
43
|
+
/**
|
|
44
|
+
* Convert HSV to RGB.
|
|
45
|
+
*/
|
|
46
|
+
export declare function hsvToRgb(hsv: HSV): RGB;
|
|
47
|
+
/**
|
|
48
|
+
* Convert hex color to HSV.
|
|
49
|
+
*/
|
|
50
|
+
export declare function hexToHsv(hex: string): HSV;
|
|
51
|
+
/**
|
|
52
|
+
* Convert HSV to hex color.
|
|
53
|
+
*/
|
|
54
|
+
export declare function hsvToHex(hsv: HSV): string;
|
|
55
|
+
/**
|
|
56
|
+
* Shift the hue of a hex color by a given number of degrees.
|
|
57
|
+
*/
|
|
58
|
+
export declare function shiftHue(hex: string, degrees: number): string;
|
|
59
|
+
export interface HSVAdjustment {
|
|
60
|
+
/** Hue shift in degrees (additive) */
|
|
61
|
+
h?: number;
|
|
62
|
+
/** Saturation multiplier */
|
|
63
|
+
s?: number;
|
|
64
|
+
/** Value/brightness multiplier */
|
|
65
|
+
v?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Adjust HSV components of a hex color.
|
|
69
|
+
*
|
|
70
|
+
* @param hex - Hex color string (#RGB or #RRGGBB)
|
|
71
|
+
* @param adj - Adjustments: h is additive degrees, s and v are multipliers
|
|
72
|
+
* @returns New hex color string
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* // Shift hue +60°, reduce saturation to 71%
|
|
77
|
+
* adjustHsv("#00ff88", { h: 60, s: 0.71 }) // "#4a9eff"
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function adjustHsv(hex: string, adj: HSVAdjustment): string;
|
|
81
|
+
/**
|
|
82
|
+
* Convert HSL (h: 0-360, s: 0-1, l: 0-1) to a CSS hex string.
|
|
83
|
+
*/
|
|
84
|
+
export declare function hslToHex(h: number, s: number, l: number): string;
|
|
85
|
+
/**
|
|
86
|
+
* Perceptual luma (gamma-encoded BT.709 weights over raw sRGB), normalized to 0..1.
|
|
87
|
+
*
|
|
88
|
+
* Accepts a hex string (`#rgb` / `#rrggbb`) or a 256-color palette index; returns
|
|
89
|
+
* `undefined` for var refs, empty strings, or anything unparseable.
|
|
90
|
+
*
|
|
91
|
+
* Cheap and good enough for a light/dark *classification* threshold. NOT suitable
|
|
92
|
+
* for contrast ratios — use {@link relativeLuminance} for those.
|
|
93
|
+
*/
|
|
94
|
+
export declare function colorLuma(value: string | number): number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* WCAG 2.x relative luminance (BT.709 weights over linearized sRGB), normalized to
|
|
97
|
+
* 0..1. This is the value the WCAG contrast-ratio formula expects.
|
|
98
|
+
*
|
|
99
|
+
* Accepts a hex string (`#rgb` / `#rrggbb`) or a 256-color palette index; returns
|
|
100
|
+
* `undefined` for var refs, empty strings, or anything unparseable.
|
|
101
|
+
*/
|
|
102
|
+
export declare function relativeLuminance(value: string | number): number | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Behavior-compatible reimplementation of date-fns's used surface. */
|
|
2
|
+
/** Format a date with the supported date-fns v4 tokens and quoted literals. */
|
|
3
|
+
export declare function format(value: Date | number, pattern: string): string;
|
|
4
|
+
/** Describe the distance from a date to now using date-fns's English thresholds. */
|
|
5
|
+
export declare function formatDistanceToNow(value: Date | number, options?: {
|
|
6
|
+
addSuffix?: boolean;
|
|
7
|
+
}): string;
|