@revenexx/cli 0.1.1 → 0.2.1
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/README.md +61 -18
- package/dist/cli.d.ts.map +1 -1
- package/dist/{bundle-win-arm64.mjs → cli.mjs} +46045 -14679
- package/dist/index.cjs +6 -2
- package/dist/index.js +6 -2
- package/dist/lib/command-picker.d.ts +4 -2
- package/dist/lib/command-picker.d.ts.map +1 -1
- package/dist/lib/commands/repl.d.ts.map +1 -1
- package/dist/lib/commands/services/apps.d.ts.map +1 -1
- package/dist/lib/commands/services/avatars.d.ts.map +1 -1
- package/dist/lib/commands/services/carts.d.ts.map +1 -1
- package/dist/lib/commands/services/channels.d.ts.map +1 -1
- package/dist/lib/commands/services/customers.d.ts.map +1 -1
- package/dist/lib/commands/services/forms.d.ts.map +1 -1
- package/dist/lib/commands/services/inventories.d.ts.map +1 -1
- package/dist/lib/commands/services/io.d.ts +3 -0
- package/dist/lib/commands/services/io.d.ts.map +1 -0
- package/dist/lib/commands/services/locale.d.ts.map +1 -1
- package/dist/lib/commands/services/markets.d.ts.map +1 -1
- package/dist/lib/commands/services/messaging.d.ts.map +1 -1
- package/dist/lib/commands/services/orderlists.d.ts.map +1 -1
- package/dist/lib/commands/services/orders.d.ts.map +1 -1
- package/dist/lib/commands/services/pages.d.ts.map +1 -1
- package/dist/lib/commands/services/payments.d.ts.map +1 -1
- package/dist/lib/commands/services/prices.d.ts.map +1 -1
- package/dist/lib/commands/services/products.d.ts.map +1 -1
- package/dist/lib/commands/services/search.d.ts.map +1 -1
- package/dist/lib/commands/services/settings.d.ts.map +1 -1
- package/dist/lib/commands/services/shipping.d.ts.map +1 -1
- package/dist/lib/commands/services/sites.d.ts.map +1 -1
- package/dist/lib/commands/services/storage.d.ts.map +1 -1
- package/dist/lib/commands/services/tokens.d.ts.map +1 -1
- package/dist/lib/commands/status.d.ts.map +1 -1
- package/dist/lib/commands/tui.d.ts +8 -0
- package/dist/lib/commands/tui.d.ts.map +1 -0
- package/dist/lib/commands/update.d.ts +32 -0
- package/dist/lib/commands/update.d.ts.map +1 -1
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +3 -1
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/interactive.d.ts +46 -0
- package/dist/lib/interactive.d.ts.map +1 -1
- package/dist/lib/parser.d.ts +7 -0
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/project-config.d.ts +15 -0
- package/dist/lib/project-config.d.ts.map +1 -1
- package/dist/lib/tui/app.d.ts +17 -0
- package/dist/lib/tui/app.d.ts.map +1 -0
- package/dist/lib/tui/clipboard.d.ts +2 -0
- package/dist/lib/tui/clipboard.d.ts.map +1 -0
- package/dist/lib/tui/command-tree.d.ts +89 -0
- package/dist/lib/tui/command-tree.d.ts.map +1 -0
- package/dist/lib/tui/confirm.d.ts +6 -0
- package/dist/lib/tui/confirm.d.ts.map +1 -0
- package/dist/lib/tui/context.d.ts +16 -0
- package/dist/lib/tui/context.d.ts.map +1 -0
- package/dist/lib/tui/eggs.d.ts +22 -0
- package/dist/lib/tui/eggs.d.ts.map +1 -0
- package/dist/lib/tui/executor.d.ts +24 -0
- package/dist/lib/tui/executor.d.ts.map +1 -0
- package/dist/lib/tui/form.d.ts +43 -0
- package/dist/lib/tui/form.d.ts.map +1 -0
- package/dist/lib/tui/json-editor.d.ts +29 -0
- package/dist/lib/tui/json-editor.d.ts.map +1 -0
- package/dist/lib/tui/panel.d.ts +61 -0
- package/dist/lib/tui/panel.d.ts.map +1 -0
- package/dist/lib/tui/resource-picker.d.ts +15 -0
- package/dist/lib/tui/resource-picker.d.ts.map +1 -0
- package/dist/lib/tui/results.d.ts +90 -0
- package/dist/lib/tui/results.d.ts.map +1 -0
- package/dist/lib/tui/terminal.d.ts +5 -0
- package/dist/lib/tui/terminal.d.ts.map +1 -0
- package/dist/lib/tui/theme.d.ts +120 -0
- package/dist/lib/tui/theme.d.ts.map +1 -0
- package/dist/tests/executor.test.d.ts +2 -0
- package/dist/tests/executor.test.d.ts.map +1 -0
- package/dist/tests/setup.d.ts +2 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/theme.test.d.ts +2 -0
- package/dist/tests/theme.test.d.ts.map +1 -0
- package/dist/tests/tui.test.d.ts +2 -0
- package/dist/tests/tui.test.d.ts.map +1 -0
- package/dist/tests/update.test.d.ts +2 -0
- package/dist/tests/update.test.d.ts.map +1 -0
- package/dist/vitest.config.d.ts.map +1 -1
- package/package.json +14 -9
- package/dist/cli.cjs +0 -124680
- package/dist/lib/commands/services/greetings.d.ts +0 -3
- package/dist/lib/commands/services/greetings.d.ts.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure command-tree helpers for the TUI browser and palette. The tree is
|
|
3
|
+
* captured from the live commander program (lib/commands/tui.ts), so plugins
|
|
4
|
+
* and generated services are all included without a second registry.
|
|
5
|
+
*/
|
|
6
|
+
import type { PromptSpec } from "../interactive.js";
|
|
7
|
+
export type CommandLeaf = {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
/** Display name for the browser (e.g. the resource behind a list command:
|
|
11
|
+
* `asset-families-list` → `asset-families`). Execution, search and the
|
|
12
|
+
* one-shot line always use the real `name`. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Registered PromptSpecs (see registerPromptSpecs) — the form's source. */
|
|
15
|
+
specs?: PromptSpec[];
|
|
16
|
+
/** DELETE-backed command; the TUI gates execution behind a confirm modal. */
|
|
17
|
+
destructive?: boolean;
|
|
18
|
+
/** Lower-case HTTP method — safe reads auto-run once params are picked. */
|
|
19
|
+
method?: string;
|
|
20
|
+
/** Kept in the tree (so a list's u/d can resolve it) but not shown when
|
|
21
|
+
* browsing: a get/update/delete whose actions are reached from its list. */
|
|
22
|
+
hidden?: boolean;
|
|
23
|
+
/** TUI-only synthetic action — open an in-app panel instead of running a
|
|
24
|
+
* command (settings → themes opens the theme picker). */
|
|
25
|
+
tuiAction?: "theme-picker";
|
|
26
|
+
/** Real invocation path when the nav path differs from the command path:
|
|
27
|
+
* the settings subtree relocates `alias`, so its actions browse under
|
|
28
|
+
* `settings › alias` but still run as `alias set|list|remove`. */
|
|
29
|
+
runPath?: string[];
|
|
30
|
+
/** Drill-in children. Services are two-level and leave this unset; the
|
|
31
|
+
* relocated alias nests (alias → set/list/remove). */
|
|
32
|
+
subcommands?: CommandLeaf[];
|
|
33
|
+
/** Grouped under this named root nav section instead of folders/commands
|
|
34
|
+
* (TUI preferences: the themes action + the relocated alias command). */
|
|
35
|
+
group?: string;
|
|
36
|
+
};
|
|
37
|
+
export type CommandNode = CommandLeaf & {
|
|
38
|
+
/** Empty for standalone commands (login, status, …). */
|
|
39
|
+
subcommands: CommandLeaf[];
|
|
40
|
+
};
|
|
41
|
+
export type PaletteEntry = {
|
|
42
|
+
/** Full invocation path, e.g. "products list-products". */
|
|
43
|
+
path: string;
|
|
44
|
+
description: string;
|
|
45
|
+
/** Invocation tokens, e.g. ["products", "list-products"]. */
|
|
46
|
+
parts: string[];
|
|
47
|
+
/** The runnable command itself (specs, destructive flag). */
|
|
48
|
+
leaf: CommandLeaf;
|
|
49
|
+
/** Prettier row text for the search list (resource-labelled path). The
|
|
50
|
+
* query always matches against `path`, so real names keep working. */
|
|
51
|
+
display?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Every runnable invocation plus the service groups themselves. A service
|
|
54
|
+
* whose own records have a list (bare `list`/`index`) merges with it: the
|
|
55
|
+
* group's search row IS that list — picking it runs the records and lands
|
|
56
|
+
* inside the folder. Groups without one just drill in. */
|
|
57
|
+
export declare const flattenTree: (nodes: CommandNode[]) => PaletteEntry[];
|
|
58
|
+
/**
|
|
59
|
+
* The resource a list command browses: `asset-families-list`,
|
|
60
|
+
* `list-deployments` and rails-style `asset-index` → their resource, the
|
|
61
|
+
* bare `list`/`index` → "" (the service's own records). Undefined when the
|
|
62
|
+
* command isn't a list at all.
|
|
63
|
+
*/
|
|
64
|
+
export declare const listResource: (name: string) => string | undefined;
|
|
65
|
+
/** CRUD verbs whose commands fold into their list (⏎ view · c/u/d). */
|
|
66
|
+
export declare const CRUD_VERBS: readonly ["create", "get", "update", "delete"];
|
|
67
|
+
/**
|
|
68
|
+
* Candidate command names for a CRUD verb belonging to a list command:
|
|
69
|
+
* `list` → `create`; `asset-families-list` → `asset-families-create`;
|
|
70
|
+
* `asset-index` → `asset-create` / `asset-store`;
|
|
71
|
+
* `list-deployments` → `create-deployment` / `create-deployments`.
|
|
72
|
+
*/
|
|
73
|
+
export declare const crudCandidates: (listName: string, verb: string) => string[];
|
|
74
|
+
/**
|
|
75
|
+
* The list command a CRUD command folds into, when the service has it:
|
|
76
|
+
* `get-deployment` → `list-deployments`, `categories-get` →
|
|
77
|
+
* `categories-list`, `asset-show` → `asset-index`, bare `create` → `list`.
|
|
78
|
+
* Null when the name isn't a CRUD form or no matching list exists.
|
|
79
|
+
*/
|
|
80
|
+
export declare const owningList: (name: string, listNames: ReadonlySet<string>) => string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Multi-token, alias-aware matching: the query splits on whitespace and every
|
|
83
|
+
* token must match the path in order (case-insensitive substring, each token
|
|
84
|
+
* also counting through its built-in alias). `pro get` therefore matches
|
|
85
|
+
* `products get-product`, and so does `p g`. Entries whose first token
|
|
86
|
+
* matches at the start of the path rank first, like guided mode's picker.
|
|
87
|
+
*/
|
|
88
|
+
export declare const filterEntries: (entries: PaletteEntry[], query: string) => PaletteEntry[];
|
|
89
|
+
//# sourceMappingURL=command-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-tree.d.ts","sourceRoot":"","sources":["../../../lib/tui/command-tree.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG;IAC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AG,MAAM,EAcrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,WAAW,WAAW,CAAC,MAAM,CAAC,KAC7B,MAAM,GAAG,IA4BX,CAAC;AAaF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,YAAY,EAAE,EACvB,OAAO,MAAM,KACZ,YAAY,EAoDd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../lib/tui/confirm.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,GAAI,uCAI1B;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,gCA8CA,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CommandNode } from "./command-tree.js";
|
|
2
|
+
export type TuiContext = {
|
|
3
|
+
version: string;
|
|
4
|
+
/** Signed-in identity, or null when no key/JWT is stored. */
|
|
5
|
+
user: string | null;
|
|
6
|
+
/** Active tenant, or "" when none is scoped. */
|
|
7
|
+
tenant: string;
|
|
8
|
+
/** Hostname of the endpoint the session would hit. */
|
|
9
|
+
host: string;
|
|
10
|
+
/** True when DX-111's sensitivity rules flag this endpoint/tenant. */
|
|
11
|
+
production: boolean;
|
|
12
|
+
/** Command tree for the browser pane / palette. */
|
|
13
|
+
commands: CommandNode[];
|
|
14
|
+
};
|
|
15
|
+
export declare const buildTuiContext: (commands: CommandNode[]) => TuiContext;
|
|
16
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../lib/tui/context.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,WAAW,EAAE,KAAG,UA6BzD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Egg = {
|
|
2
|
+
/** Filter queries that trigger the egg (normalised: trimmed, lower-cased,
|
|
3
|
+
* inner whitespace collapsed). */
|
|
4
|
+
keys: string[];
|
|
5
|
+
title: string;
|
|
6
|
+
/** Optional theatre before the payload: a spinner or a filling bar. */
|
|
7
|
+
animate?: "spinner" | "bar";
|
|
8
|
+
/** Lines shown immediately (and during the animation). */
|
|
9
|
+
busy: string[];
|
|
10
|
+
/** Lines shown once the animation finishes (ignored when not animated). */
|
|
11
|
+
done?: string[];
|
|
12
|
+
};
|
|
13
|
+
/** The egg matching a filter query exactly, if any. */
|
|
14
|
+
export declare const matchEgg: (query: string) => Egg | undefined;
|
|
15
|
+
/** Renders an egg in place of the detail pane. Owns its own animation timers,
|
|
16
|
+
* which restart whenever the matched egg changes and are cleared on unmount
|
|
17
|
+
* (backspacing the query, opening a command, leaving the filter). */
|
|
18
|
+
export declare const EggPanel: ({ egg, width }: {
|
|
19
|
+
egg: Egg;
|
|
20
|
+
width: number;
|
|
21
|
+
}) => import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=eggs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eggs.d.ts","sourceRoot":"","sources":["../../../lib/tui/eggs.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,GAAG,GAAG;IAChB;sCACkC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,OAAO,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;IAC5B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAuLF,uDAAuD;AACvD,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,KAAG,GAAG,GAAG,SAI9C,CAAC;AAEF;;qEAEqE;AACrE,eAAO,MAAM,QAAQ,GAAI,gBAAgB;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,gCA6DnE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export type ExecutionResult = {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
/** Exit code the command would have returned (4=auth, 5=not-found, …). */
|
|
5
|
+
exitCode: number;
|
|
6
|
+
/** Wall-clock run time, for the mockup's `· 182 ms` request line. */
|
|
7
|
+
durationMs: number;
|
|
8
|
+
/** Parsed stdout payload when it was valid JSON. */
|
|
9
|
+
data: unknown;
|
|
10
|
+
/** Parsed `{ error: { message, code, type, requestId } }` from stderr. */
|
|
11
|
+
error: {
|
|
12
|
+
message: string;
|
|
13
|
+
code?: number | string;
|
|
14
|
+
type?: string;
|
|
15
|
+
} | null;
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
};
|
|
19
|
+
export type TuiRunner = (tokens: string[], options?: {
|
|
20
|
+
force?: boolean;
|
|
21
|
+
}) => Promise<ExecutionResult>;
|
|
22
|
+
/** Bind a runner to the live program so the TUI can execute command tokens. */
|
|
23
|
+
export declare const createRunner: (program: Command) => TuiRunner;
|
|
24
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../lib/tui/executor.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,IAAI,EAAE,OAAO,CAAC;IACd,0EAA0E;IAC1E,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CACtB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,KAC1B,OAAO,CAAC,eAAe,CAAC,CAAC;AAyB9B,+EAA+E;AAC/E,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,SAsG/C,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type PromptSpec, type ResourceRecord } from "../interactive.js";
|
|
2
|
+
export type FormValues = Record<string, string>;
|
|
3
|
+
export declare const buildArgv: (path: string[], specs: PromptSpec[], values: FormValues) => string[];
|
|
4
|
+
export declare const validateField: (spec: PromptSpec, raw: string | undefined) => string | null;
|
|
5
|
+
/**
|
|
6
|
+
* The one-shot command line this form would run, shell-quoted for display,
|
|
7
|
+
* e.g. `revenexx products create --name 'Blue Bike' --price 100`. Secret
|
|
8
|
+
* values are masked — this string is rendered on screen, never executed
|
|
9
|
+
* (execution goes through buildArgv).
|
|
10
|
+
*/
|
|
11
|
+
export declare const buildCommandLine: (path: string[], specs: PromptSpec[], values: FormValues) => string;
|
|
12
|
+
/** Positional arguments first (declared order, so the argv stays valid), then
|
|
13
|
+
* required options, then optional ones. */
|
|
14
|
+
export declare const orderSpecs: (specs: PromptSpec[]) => PromptSpec[];
|
|
15
|
+
/** The parameter sidebar: fields, focused-spec info, live command preview. */
|
|
16
|
+
export declare const Form: ({ path, specs, values, onChange, onSubmit, onClose, active, autoPick, runOnComplete, width, onPickerToggle, loadResourceRecords, }: {
|
|
17
|
+
path: string[];
|
|
18
|
+
specs: PromptSpec[];
|
|
19
|
+
/** Total panel width — the title sits in the top border. */
|
|
20
|
+
width: number;
|
|
21
|
+
/** Lifted so the parent can re-run / page without losing entered values. */
|
|
22
|
+
values: FormValues;
|
|
23
|
+
onChange: (values: FormValues) => void;
|
|
24
|
+
/** Called with the values to run when they didn't come from state yet
|
|
25
|
+
* (auto-run after a pick); parameterless on a plain submit. */
|
|
26
|
+
onSubmit: (values?: FormValues) => void;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
/** Keyboard focus — the form sits beside the results as a sidebar and only
|
|
29
|
+
* one of the two panes listens at a time. */
|
|
30
|
+
active?: boolean;
|
|
31
|
+
/** Open the first required resource field's picker immediately — search →
|
|
32
|
+
* pick → run without an intermediate form stop. */
|
|
33
|
+
autoPick?: boolean;
|
|
34
|
+
/** Submit as soon as a pick completes every field's validation (safe reads
|
|
35
|
+
* and modal-gated deletes). */
|
|
36
|
+
runOnComplete?: boolean;
|
|
37
|
+
/** The resource picker needs the full screen width; the parent hides the
|
|
38
|
+
* results pane while it is open. */
|
|
39
|
+
onPickerToggle?: (open: boolean) => void;
|
|
40
|
+
/** Injectable for tests; defaults to the shared list-endpoint fetch. */
|
|
41
|
+
loadResourceRecords?: (spec: PromptSpec, query?: string) => Promise<ResourceRecord[]>;
|
|
42
|
+
}) => import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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C,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,CACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAChC,gCAsYA,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface Row {
|
|
2
|
+
/** Stable identity so React keys survive reordering/inserts. */
|
|
3
|
+
id: number;
|
|
4
|
+
/** Object member name; unused (index shown instead) in array scopes. */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Raw JSON source for the value: a scalar (`"blue"`, `42`) or a nested
|
|
7
|
+
* container source (`{"a":1}`, `[1,2]`) drilled into on demand. */
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
/** Parse a JSON string into editable rows. A well-formed object seeds one row
|
|
11
|
+
* per key (value shown as its JSON source); anything else starts empty. */
|
|
12
|
+
export declare const parseEntries: (initial: string) => Row[];
|
|
13
|
+
/** A one-line summary when the source is a JSON container, else null (leaf). */
|
|
14
|
+
export declare const containerSummary: (source: string) => string | null;
|
|
15
|
+
/** null when every row is valid; otherwise a one-line reason for the footer. */
|
|
16
|
+
export declare const validateEntries: (rows: Row[]) => string | null;
|
|
17
|
+
/** Serialise a scope to compact JSON: object → `{…}`, array → `[…]`. */
|
|
18
|
+
export declare const serializeEntries: (rows: Row[]) => string;
|
|
19
|
+
export declare const JsonObjectEditor: ({ name, description, initial, onSave, onCancel, }: {
|
|
20
|
+
/** Spec parameter name, e.g. `data`. */
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Current field value — a JSON string, or "" for a fresh body. */
|
|
24
|
+
initial: string;
|
|
25
|
+
onSave: (value: string) => void;
|
|
26
|
+
onCancel: () => void;
|
|
27
|
+
}) => import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=json-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../../lib/tui/json-editor.tsx"],"names":[],"mappings":"AAuBA,UAAU,GAAG;IACX,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ;uEACmE;IACnE,KAAK,EAAE,MAAM,CAAC;CACf;AAqBD;2EAC2E;AAC3E,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,GAAG,EAcjD,CAAC;AAYF,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAgB1D,CAAC;AAIF,gFAAgF;AAChF,eAAO,MAAM,eAAe,GAAI,MAAM,GAAG,EAAE,KAAG,MAAM,GAAG,IActD,CAAC;AAcF,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAAI,MAAM,GAAG,EAAE,KAAG,MAM9C,CAAC;AAyDF,eAAO,MAAM,gBAAgB,GAAI,mDAM9B;IACD,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,gCAmTA,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bordered pane whose title sits in the top border and whose footer sits in
|
|
3
|
+
* the bottom border — the DX-118 concept-mockup look. Ink has no native
|
|
4
|
+
* border-title support, so the top and bottom border rows are drawn by hand
|
|
5
|
+
* (with the corners) and Ink draws only the left/right sides of the content
|
|
6
|
+
* box between them. That means the panel needs an explicit `width` so the
|
|
7
|
+
* hand-drawn corners line up with Ink's side borders.
|
|
8
|
+
*/
|
|
9
|
+
import type { ReactNode } from "react";
|
|
10
|
+
/** One border segment: either drawn in the theme gradient (the frame edges) or
|
|
11
|
+
* a fixed colour (the embedded title/footer text). */
|
|
12
|
+
export type BorderSeg = {
|
|
13
|
+
text: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
dim?: boolean;
|
|
17
|
+
gradient?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Render a full-width row of segments: `gradient` segments fade each cell
|
|
20
|
+
* through the theme's gradient (by absolute column, so it's continuous across
|
|
21
|
+
* the whole width), other segments keep their fixed colour. Adjacent same-style
|
|
22
|
+
* cells coalesce into one <Text> to keep the node count down; colour-off
|
|
23
|
+
* terminals just render the characters. Exported so other rules (e.g. the nav's
|
|
24
|
+
* section headers) can share the same gradient. */
|
|
25
|
+
export declare const borderRow: (segments: BorderSeg[], width: number) => ReactNode;
|
|
26
|
+
export declare const Panel: ({ title, titleColor, footer, footerColor, focused, width, grow, flush, children, }: {
|
|
27
|
+
/** Rendered into the top border. */
|
|
28
|
+
title?: string;
|
|
29
|
+
/** Colour for the title text (defaults to the theme accent; focus adds bold). */
|
|
30
|
+
titleColor?: string;
|
|
31
|
+
/** Right-aligned into the bottom border. */
|
|
32
|
+
footer?: string;
|
|
33
|
+
/** Colour for the footer text (defaults to dim). */
|
|
34
|
+
footerColor?: string;
|
|
35
|
+
focused?: boolean;
|
|
36
|
+
/** Total outer width in cells — corners align to Ink's side borders. */
|
|
37
|
+
width: number;
|
|
38
|
+
/** Fill the remaining main-axis space of the parent (e.g. a column sidebar).
|
|
39
|
+
* Panes laid out in a row already stretch to full height via align; this is
|
|
40
|
+
* for panels stacked in a column that should still reach full height. */
|
|
41
|
+
grow?: boolean;
|
|
42
|
+
/** Drop the inner horizontal padding so children reach the side borders —
|
|
43
|
+
* needed for a gapless background fill. */
|
|
44
|
+
flush?: boolean;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}) => import("react").JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* A one-row "pill" button matching the concept: `primary` is brand purple,
|
|
49
|
+
* `danger` is red, `default` is a muted grey.
|
|
50
|
+
*
|
|
51
|
+
* `focused` makes the pill focus-aware for keyboard navigation: the focused
|
|
52
|
+
* button is a filled pill with a `»` marker; an unfocused one is a dim ghost.
|
|
53
|
+
* Omit `focused` for a static, always-filled pill (e.g. the confirm modal,
|
|
54
|
+
* whose keys `y`/`n` drive it directly).
|
|
55
|
+
*/
|
|
56
|
+
export declare const Button: ({ label, variant, focused, }: {
|
|
57
|
+
label: string;
|
|
58
|
+
variant?: "default" | "primary" | "danger";
|
|
59
|
+
focused?: boolean;
|
|
60
|
+
}) => import("react").JSX.Element;
|
|
61
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../../lib/tui/panel.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;sDACsD;AACtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;mDAKmD;AACnD,eAAO,MAAM,SAAS,GAAI,UAAU,SAAS,EAAE,EAAE,OAAO,MAAM,KAAG,SA+BhE,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,oFAUnB;IACD,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd;;6EAEyE;IACzE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;+CAC2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB,gCA0GA,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,GAAI,8BAIpB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,gCAsBA,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResourceRecord } from "../interactive.js";
|
|
2
|
+
export declare const ResourcePicker: ({ name, description, searchable, width, load, onPick, onCancel, }: {
|
|
3
|
+
/** Spec parameter name, e.g. `product_id`. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Spec description, shown like the one-shot prompt's message line. */
|
|
6
|
+
description?: string;
|
|
7
|
+
/** True when the list endpoint accepts a `search` query parameter. */
|
|
8
|
+
searchable: boolean;
|
|
9
|
+
/** Pane width — the table budgets its columns against it. */
|
|
10
|
+
width: number;
|
|
11
|
+
load: (query: string) => Promise<ResourceRecord[]>;
|
|
12
|
+
onPick: (value: string) => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
}) => import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=resource-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-picker.d.ts","sourceRoot":"","sources":["../../../lib/tui/resource-picker.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASxD,eAAO,MAAM,cAAc,GAAI,mEAQ5B;IACD,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACnD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,gCAqJA,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ExecutionResult } from "./executor.js";
|
|
2
|
+
/** Renderings the `o` key cycles through, mirroring `-o/--output`. */
|
|
3
|
+
declare const OUTPUT_FORMATS: readonly ["table", "json", "jsonl", "csv"];
|
|
4
|
+
export type OutputFormat = (typeof OUTPUT_FORMATS)[number];
|
|
5
|
+
/** The serialized text for one data value in a non-table format — the same
|
|
6
|
+
* bytes the one-shot `-o json|jsonl|csv` renderers emit. */
|
|
7
|
+
export declare const formatData: (data: unknown, format: Exclude<OutputFormat, "table">) => string;
|
|
8
|
+
/** The serialized text for a non-table format — same bytes the one-shot
|
|
9
|
+
* `-o json|jsonl|csv` renderers emit. */
|
|
10
|
+
export declare const formatResult: (result: ExecutionResult, format: Exclude<OutputFormat, "table">) => string;
|
|
11
|
+
export type RunState = {
|
|
12
|
+
status: "running";
|
|
13
|
+
commandLine: string;
|
|
14
|
+
} | {
|
|
15
|
+
status: "done";
|
|
16
|
+
commandLine: string;
|
|
17
|
+
result: ExecutionResult;
|
|
18
|
+
};
|
|
19
|
+
/** Render a row for display: ISO timestamps become human-readable dates. Only
|
|
20
|
+
* the on-screen copy changes — the raw payload behind `c`/`-o json` is
|
|
21
|
+
* untouched. */
|
|
22
|
+
export declare const humanizeRow: (row: Record<string, unknown>) => Record<string, unknown>;
|
|
23
|
+
/** All columns, identifier/name-ish ones first, then the remaining scalars,
|
|
24
|
+
* with object-valued columns (rendered as JSON previews) last. */
|
|
25
|
+
export declare const tableColumns: (rows: Record<string, unknown>[]) => string[];
|
|
26
|
+
/** The gateway's list-envelope pagination block, when present. */
|
|
27
|
+
export type PageInfo = {
|
|
28
|
+
limit?: number;
|
|
29
|
+
offset?: number;
|
|
30
|
+
total?: number;
|
|
31
|
+
returned?: number;
|
|
32
|
+
hasMore?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export declare const parsePageInfo: (data: unknown) => PageInfo | null;
|
|
35
|
+
export type TableLayout = {
|
|
36
|
+
columns: string[];
|
|
37
|
+
widths: number[];
|
|
38
|
+
/** Columns scrolled off to the left (the first column stays pinned). */
|
|
39
|
+
hiddenLeft: string[];
|
|
40
|
+
/** Columns that did not fit on the right. */
|
|
41
|
+
hidden: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Fit columns to the width budget the way the one-shot human table does:
|
|
45
|
+
* natural (content) widths capped at CELL_CAP, keep leading columns while
|
|
46
|
+
* they fit, and report what is hidden on either side. `offset` scrolls the
|
|
47
|
+
* window horizontally — the first (identifier) column stays pinned so rows
|
|
48
|
+
* remain recognizable. The marker column costs 2, each column a 1-wide gap.
|
|
49
|
+
*/
|
|
50
|
+
export declare const fitColumns: (rows: Record<string, unknown>[], budget: number, offset?: number) => TableLayout;
|
|
51
|
+
export declare const Table: ({ rows, cursor, detail, layout, maxRows, budget, }: {
|
|
52
|
+
rows: Record<string, unknown>[];
|
|
53
|
+
cursor: number;
|
|
54
|
+
detail: boolean;
|
|
55
|
+
layout: TableLayout;
|
|
56
|
+
maxRows: number;
|
|
57
|
+
/** Table content width — the selected row fills it so its highlight is a
|
|
58
|
+
* solid edge-to-edge bar (no blanks between/after columns). */
|
|
59
|
+
budget: number;
|
|
60
|
+
}) => import("react").JSX.Element;
|
|
61
|
+
export declare const Results: ({ state, title, width, canPage, canEdit, active, canUpdate, canDelete, canCreate, onPage, onEdit, onCreate, onUpdate, onDelete, onClose, }: {
|
|
62
|
+
state: RunState;
|
|
63
|
+
/** Command path shown in the panel's top border. */
|
|
64
|
+
title: string;
|
|
65
|
+
/** Total panel width — the table budgets its columns against it. */
|
|
66
|
+
width: number;
|
|
67
|
+
/** Whether the executed command supports limit/offset paging. */
|
|
68
|
+
canPage: boolean;
|
|
69
|
+
/** Whether the command has parameters `e` can focus the sidebar for. */
|
|
70
|
+
canEdit: boolean;
|
|
71
|
+
/** Keyboard focus — the parameter sidebar may own the keys instead. */
|
|
72
|
+
active?: boolean;
|
|
73
|
+
/** Whether this resource has an update command `u` can jump to. */
|
|
74
|
+
canUpdate?: boolean;
|
|
75
|
+
/** Whether this resource has a delete command `d` can jump to. */
|
|
76
|
+
canDelete?: boolean;
|
|
77
|
+
/** Whether this resource has a create command `c` can jump to. */
|
|
78
|
+
canCreate?: boolean;
|
|
79
|
+
onPage: (direction: 1 | -1) => void;
|
|
80
|
+
onEdit: () => void;
|
|
81
|
+
/** Open the sibling create form (row-independent). */
|
|
82
|
+
onCreate?: () => void;
|
|
83
|
+
/** Jump to the update form for the current record (raw, un-humanized). */
|
|
84
|
+
onUpdate?: (record: Record<string, unknown>) => void;
|
|
85
|
+
/** Jump to the (confirm-gated) delete for the current record. */
|
|
86
|
+
onDelete?: (record: Record<string, unknown>) => void;
|
|
87
|
+
onClose: () => void;
|
|
88
|
+
}) => import("react").JSX.Element;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../lib/tui/results.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,sEAAsE;AACtE,QAAA,MAAM,cAAc,4CAA6C,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;4DAC4D;AAC5D,eAAO,MAAM,UAAU,GACrB,MAAM,OAAO,EACb,QAAQ,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,KACrC,M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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../lib/tui/terminal.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,QAAO;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAejE,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** The token set every theme defines. Only *accents* commit to the palette;
|
|
2
|
+
* body text stays terminal-native, so themes really only need these. */
|
|
3
|
+
export interface Theme {
|
|
4
|
+
/** Registry key, e.g. "revenexx". */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Structural tint — the gradient wordmark's mid stop. */
|
|
7
|
+
brand: string;
|
|
8
|
+
/** The chrome accent: every border, keys, selection markers, focused
|
|
9
|
+
* titles, the `/` palette prompt. Tuned to read on `surface`. */
|
|
10
|
+
accent: string;
|
|
11
|
+
/** Enabled / true / created — functional green. */
|
|
12
|
+
success: string;
|
|
13
|
+
/** PRODUCTION banner and highlighted values. */
|
|
14
|
+
warn: string;
|
|
15
|
+
/** Destructive actions and errors — functional red. */
|
|
16
|
+
danger: string;
|
|
17
|
+
/** Selected-row / focused-button bar background + its text. */
|
|
18
|
+
selectionBg: string;
|
|
19
|
+
selectionFg: string;
|
|
20
|
+
/** Secondary (default) button pill. */
|
|
21
|
+
muted: string;
|
|
22
|
+
/** Whole-pane fill + the OSC-11 terminal background. */
|
|
23
|
+
surface: string;
|
|
24
|
+
/** Text that reads on `surface`. */
|
|
25
|
+
onSurface: string;
|
|
26
|
+
/** Wordmark gradient stops (left → right), as [r,g,b]. */
|
|
27
|
+
gradient: readonly (readonly [number, number, number])[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The built-in palettes. `revenexx` is the brand default; the rest are
|
|
31
|
+
* popular, recognisable terminal themes so the UI can match a user's setup.
|
|
32
|
+
* Accents are chosen to read on each theme's `surface`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const THEMES: Record<string, Theme>;
|
|
35
|
+
/** All theme keys, in registry order (revenexx first). */
|
|
36
|
+
export declare const THEME_NAMES: string[];
|
|
37
|
+
export declare const DEFAULT_THEME = "revenexx";
|
|
38
|
+
export declare const isTheme: (name: string | undefined) => name is string;
|
|
39
|
+
/**
|
|
40
|
+
* The *active* palette. It's a single mutable object (not `as const`) that
|
|
41
|
+
* every component reads as `theme.accent` etc. `applyTheme` mutates it in
|
|
42
|
+
* place with Object.assign, so all existing references stay valid and simply
|
|
43
|
+
* render the new colours on the next React render — no context plumbing.
|
|
44
|
+
*/
|
|
45
|
+
export declare const theme: Theme;
|
|
46
|
+
/** Switch the active palette. Unknown names fall back to the default. */
|
|
47
|
+
export declare const applyTheme: (name: string | undefined) => void;
|
|
48
|
+
/**
|
|
49
|
+
* OSC sequences that set the terminal's default *background* (OSC 11) AND
|
|
50
|
+
* *foreground* (OSC 10) to the active theme. Both are needed: body text is
|
|
51
|
+
* terminal-native (it renders in the terminal's default fg), so setting only
|
|
52
|
+
* the background — as an earlier version did — leaves light-on-light and dark
|
|
53
|
+
* text unreadable on light themes. Honoured by terminals like Ghostty and
|
|
54
|
+
* iTerm2; silently ignored elsewhere (where the theme's accents still apply
|
|
55
|
+
* but the canvas stays terminal-native). No leading '#', as OSC expects.
|
|
56
|
+
*/
|
|
57
|
+
export declare const themeTerminalColors: () => string;
|
|
58
|
+
/** Reset the terminal's default foreground (OSC 110) and background (OSC 111)
|
|
59
|
+
* to its own configured colours — used on exit. */
|
|
60
|
+
export declare const THEME_TERMINAL_RESET = "\u001B]110\u0007\u001B]111\u0007";
|
|
61
|
+
/**
|
|
62
|
+
* Per-character hex colours interpolating the brand gradient across `length`
|
|
63
|
+
* cells. Rendering each glyph in its own <Text> lets chalk downgrade/strip the
|
|
64
|
+
* colour per the terminal — the characters themselves are unaffected, so the
|
|
65
|
+
* wordmark stays a contiguous substring when colour is off.
|
|
66
|
+
*/
|
|
67
|
+
export declare const gradientColors: (length: number) => string[];
|
|
68
|
+
/** Mix a `#rrggbb` colour toward white by `amount` (0..1). Used by the konami
|
|
69
|
+
* shimmer to brighten the sweep head without leaving the brand hues. */
|
|
70
|
+
export declare const brighten: (color: string, amount: number) => string;
|
|
71
|
+
/** Reduced-motion opt-out: honour a dedicated env var plus the common
|
|
72
|
+
* "keep it plain" signals. When set, spinners freeze to a static glyph and the
|
|
73
|
+
* shimmer/egg animations don't run — kinder to vestibular sensitivity and to
|
|
74
|
+
* screen readers (a spinner re-rendering every 80ms is re-announced). */
|
|
75
|
+
export declare const MOTION_DISABLED: boolean;
|
|
76
|
+
/** Sweeping shimmer phase for the wordmark easter egg (konami code): a comet
|
|
77
|
+
* head that travels across the glyphs then pauses, advancing only while
|
|
78
|
+
* `active`. Returns 0 when off (or motion-disabled), so the wordmark renders
|
|
79
|
+
* its plain gradient. */
|
|
80
|
+
export declare const useShimmer: (active: boolean, intervalMs?: number) => number;
|
|
81
|
+
/** Braille spinner used for in-flight requests. */
|
|
82
|
+
export declare const SPINNER_FRAMES: string[];
|
|
83
|
+
/** The current spinner glyph, advancing while `active`. Shared so the status
|
|
84
|
+
* bar and the results pane animate in lock-step. Freezes to a static `…` when
|
|
85
|
+
* motion is disabled. */
|
|
86
|
+
export declare const useSpinner: (active?: boolean, intervalMs?: number) => string;
|
|
87
|
+
/** Live diagnostics for the hidden `debug` mode: render rate, average paint
|
|
88
|
+
* interval and process memory, sampled once a second. Counts every render of
|
|
89
|
+
* the component that calls it — the App, so it sees the whole tree. The TUI has
|
|
90
|
+
* no frame loop (it repaints on state change), so `fps` reads ~0 at rest and
|
|
91
|
+
* jumps while the spinner/shimmer timers run; `frameMs` is the mean gap between
|
|
92
|
+
* those paints within the last second. Adds exactly one render/sec of its own
|
|
93
|
+
* while active; runs no timer and returns zeroes when off. Not motion-gated:
|
|
94
|
+
* these are readouts, not animation. */
|
|
95
|
+
export type DebugStats = {
|
|
96
|
+
/** Renders in the last second (see note above: not a fixed frame loop). */
|
|
97
|
+
fps: number;
|
|
98
|
+
/** Mean ms between paints over the last second (0 when idle). */
|
|
99
|
+
frameMs: number;
|
|
100
|
+
/** Resident set size in MB. */
|
|
101
|
+
rssMb: number;
|
|
102
|
+
};
|
|
103
|
+
export declare const useDebugStats: (active: boolean) => DebugStats;
|
|
104
|
+
/** A leading status dot marking a *runnable* command, coloured by its HTTP
|
|
105
|
+
* verb: reads purple (accent), writes amber, deletes red. Service groups are containers,
|
|
106
|
+
* not commands — they get no dot (empty glyph → a plain indent), keeping the
|
|
107
|
+
* root service list clean. The dot sits in a fixed 2-cell column in the navbar,
|
|
108
|
+
* so its render width doesn't disturb the gapless background fill. */
|
|
109
|
+
export declare const commandGlyph: (method: string | undefined, isGroup: boolean) => {
|
|
110
|
+
glyph: string;
|
|
111
|
+
color?: string;
|
|
112
|
+
dim?: boolean;
|
|
113
|
+
};
|
|
114
|
+
/** Filled/empty cell counts for a `[████░░░░]` progress bar of `width` cells at
|
|
115
|
+
* `ratio` (clamped to 0..1). */
|
|
116
|
+
export declare const progressBar: (ratio: number, width: number) => {
|
|
117
|
+
filled: number;
|
|
118
|
+
empty: number;
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../lib/tui/theme.ts"],"names":[],"mappings":"AAoBA;wEACwE;AACxE,MAAM,WAAW,KAAK;IACpB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd;qEACiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,uCAA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AC;AAEF;;;;;;;wCAOwC;AACxC,MAAM,MAAM,UAAU,GAAG;IACvB,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,OAAO,KAAG,UA4C/C,CAAC;AAEF;;;;sEAIsE;AACtE,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,GAAG,SAAS,EAC1B,SAAS,OAAO,KACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAchD,CAAC;AAEF;gCACgC;AAChC,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,OAAO,MAAM,KACZ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAKjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../tests/executor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../tests/setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.test.d.ts","sourceRoot":"","sources":["../../tests/theme.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.test.d.ts","sourceRoot":"","sources":["../../tests/tui.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.test.d.ts","sourceRoot":"","sources":["../../tests/update.test.ts"],"names":[],"mappings":""}
|