@gajae-gateway/cli 0.1.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/dist/list.d.ts +55 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/main.d.ts +50 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +792 -0
- package/dist/services.d.ts +40 -0
- package/dist/services.d.ts.map +1 -0
- package/package.json +50 -0
- package/src/list.ts +187 -0
- package/src/main.ts +576 -0
- package/src/services.ts +224 -0
package/dist/list.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { MonitorRecord } from "@gajae-gateway/protocol";
|
|
2
|
+
import { originKey } from "@gajae-gateway/protocol";
|
|
3
|
+
export interface Column<T> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** Raw value used verbatim by `--json` projection. */
|
|
6
|
+
readonly value: (row: T, index: number) => unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ListOptions {
|
|
9
|
+
readonly json: boolean;
|
|
10
|
+
readonly fields?: readonly string[];
|
|
11
|
+
readonly limit?: number;
|
|
12
|
+
readonly offset: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function columnNames<T>(columns: readonly Column<T>[]): string[];
|
|
15
|
+
export declare function parseListOptions<T>(args: readonly string[], columns: readonly Column<T>[]): ListOptions;
|
|
16
|
+
export declare function selectColumns<T>(columns: readonly Column<T>[], fields?: readonly string[]): Column<T>[];
|
|
17
|
+
/** Rows survive paging with their original index so `index` columns stay stable. */
|
|
18
|
+
export declare function pageRows<T>(rows: readonly T[], options: ListOptions): Array<{
|
|
19
|
+
row: T;
|
|
20
|
+
index: number;
|
|
21
|
+
}>;
|
|
22
|
+
/** `lastActivityAt` reads as `LAST_ACTIVITY_AT`, not as an unreadable letter run. */
|
|
23
|
+
export declare function headerLabel(name: string): string;
|
|
24
|
+
export declare function formatCell(value: unknown): string;
|
|
25
|
+
export declare function renderTable<T>(columns: readonly Column<T>[], entries: ReadonlyArray<{
|
|
26
|
+
row: T;
|
|
27
|
+
index: number;
|
|
28
|
+
}>): string[];
|
|
29
|
+
export declare function projectRows<T>(columns: readonly Column<T>[], entries: ReadonlyArray<{
|
|
30
|
+
row: T;
|
|
31
|
+
index: number;
|
|
32
|
+
}>): Array<Record<string, unknown>>;
|
|
33
|
+
export declare const MONITOR_COLUMNS: readonly Column<MonitorRecord>[];
|
|
34
|
+
export interface SessionListRow {
|
|
35
|
+
readonly origin: Parameters<typeof originKey>[0];
|
|
36
|
+
readonly epoch: number;
|
|
37
|
+
readonly createdAt: string;
|
|
38
|
+
readonly lastActivityAt: string | null;
|
|
39
|
+
readonly bootstrap: {
|
|
40
|
+
readonly pending: boolean;
|
|
41
|
+
readonly byteCount: number;
|
|
42
|
+
readonly truncated: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const SESSION_COLUMNS: readonly Column<SessionListRow>[];
|
|
46
|
+
/**
|
|
47
|
+
* Shared `list` output path: table by default, envelope-preserving JSON under
|
|
48
|
+
* `--json`. `envelopeKey` is the array field of the gateway result so the
|
|
49
|
+
* machine shape is identical to the pre-table output.
|
|
50
|
+
*/
|
|
51
|
+
export declare function renderList<T>(columns: readonly Column<T>[], rows: readonly T[], options: ListOptions, envelope: {
|
|
52
|
+
readonly key: string;
|
|
53
|
+
readonly result: unknown;
|
|
54
|
+
}): string[];
|
|
55
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAmBpD,MAAM,WAAW,MAAM,CAAC,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,C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50 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import type { OpsCycleResult } from "@gajae-gateway/protocol";
|
|
3
|
+
import { type InstallServicesOptions } from "./services";
|
|
4
|
+
export declare function socketPath(home?: string | undefined): string;
|
|
5
|
+
/**
|
|
6
|
+
* Every dispatchable top-level subcommand. An empty argv used to fall through
|
|
7
|
+
* the switch into the shared catch, which only *sets* an exit code — a probe
|
|
8
|
+
* with no arguments has to terminate before `main` opens a gateway socket,
|
|
9
|
+
* never after, so the list is checked up front.
|
|
10
|
+
*/
|
|
11
|
+
export declare const COMMANDS: readonly ["status", "shutdown", "chat", "daemon", "sessions", "ops", "memory", "monitors", "work", "services"];
|
|
12
|
+
export declare const CLI_USAGE = "usage: gajaeway [--socket PATH] status|shutdown|chat|daemon run|sessions list [--json] [--fields a,b,c] [--limit N] [--offset N]|sessions inspect <originKey-or-index>|memory audit|memory search <query>|monitors ...|work run|start <name> [--cwd DIR] [--resume] [--model ID|--preset NAME] [--notify originKey (start only)] <text>|work status <name>|work steer <name> <text>|work retire <name>|work jobs|ops backup <path>|ops cycle [--json]|ops integrity|ops restore <backupPath>|services install|repair --bin-dir DIR [--launch-agents-dir DIR] (work run waits for a response; caller timeout does not end the attempt)";
|
|
13
|
+
/** Usage errors exit 2, as `gajaeway-gateway` does; 1 stays a runtime failure. */
|
|
14
|
+
export declare const USAGE_EXIT_CODE = 2;
|
|
15
|
+
/** The usage text when `command` cannot be dispatched, undefined when it can. */
|
|
16
|
+
export declare function usageFor(command: string | undefined): string | undefined;
|
|
17
|
+
export declare function parseArgs(args: string[]): {
|
|
18
|
+
command?: string;
|
|
19
|
+
rest: string[];
|
|
20
|
+
socket: string;
|
|
21
|
+
};
|
|
22
|
+
export interface MainOptions {
|
|
23
|
+
readonly services?: Pick<InstallServicesOptions, "loginPathRunner" | "writeFile">;
|
|
24
|
+
}
|
|
25
|
+
export type ServicesAction = "install" | "repair";
|
|
26
|
+
export interface ParsedServicesArgs {
|
|
27
|
+
readonly action: ServicesAction;
|
|
28
|
+
readonly binDir: string;
|
|
29
|
+
readonly launchAgentsDir?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function parseServicesArgs(args: readonly string[]): ParsedServicesArgs;
|
|
32
|
+
/**
|
|
33
|
+
* Operator runtime-cycle view (`gajaeway ops cycle`).
|
|
34
|
+
*
|
|
35
|
+
* Rendering contract:
|
|
36
|
+
* - The aggregate phase line always prints.
|
|
37
|
+
* - Any gate prints under `gates:` and forces exit code 1 — a gated cycle is
|
|
38
|
+
* never reported as healthy, so scripting cannot mistake it for idle.
|
|
39
|
+
* - `--json` emits the typed OpsCycleResult verbatim; the exit-code contract
|
|
40
|
+
* is identical.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderCycle(cycle: OpsCycleResult): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Exit-code contract for `gajaeway ops cycle`: 0 only when the projection is
|
|
45
|
+
* healthy. Extracted so the automation-facing contract is pinned by tests.
|
|
46
|
+
*/
|
|
47
|
+
export declare function cycleExitCode(cycle: OpsCycleResult): number;
|
|
48
|
+
export declare function restoreDatabase(socket: string, backupPath: string): Promise<void>;
|
|
49
|
+
export declare function main(args?: string[], options?: MainOptions): Promise<void>;
|
|
50
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAEX,cAAc,EASd,MAAM,yBAAyB,CAAC;AAYjC,OAAO,EAAE,KAAK,sBAAsB,EAAiC,MAAM,YAAY,CAAC;AAExF,wBAAgB,UAAU,CAAC,IAAI,qBAA4B,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,gHAWX,CAAC;AAEX,eAAO,MAAM,SAAS,0mBACklB,CAAC;AAEzmB,kFAAkF;AAClF,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,iFAAiF;AACjF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