@bitcobblers/wod-wiki-tools 0.0.0-stage → 0.36.2134
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/bin/wod.cjs +3543 -0
- package/dist/bin/wod.cjs.map +1 -0
- package/dist/bin/wod.d.cts +1 -0
- package/dist/bin/wod.d.ts +1 -0
- package/dist/bin/wod.mjs +27 -0
- package/dist/bin/wod.mjs.map +1 -0
- package/dist/chunk-32FASQP5.mjs +123 -0
- package/dist/chunk-32FASQP5.mjs.map +1 -0
- package/dist/chunk-6L5ZDZJ7.mjs +15 -0
- package/dist/chunk-6L5ZDZJ7.mjs.map +1 -0
- package/dist/chunk-B3QJYJVI.mjs +2061 -0
- package/dist/chunk-B3QJYJVI.mjs.map +1 -0
- package/dist/chunk-EUQWEX6Z.mjs +253 -0
- package/dist/chunk-EUQWEX6Z.mjs.map +1 -0
- package/dist/chunk-K3GZZFAC.mjs +300 -0
- package/dist/chunk-K3GZZFAC.mjs.map +1 -0
- package/dist/compiler-KT6P3AC6.mjs +730 -0
- package/dist/compiler-KT6P3AC6.mjs.map +1 -0
- package/dist/index.cjs +3548 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server/app.cjs +299 -0
- package/dist/server/app.cjs.map +1 -0
- package/dist/server/app.d.cts +24 -0
- package/dist/server/app.d.ts +24 -0
- package/dist/server/app.mjs +9 -0
- package/dist/server/app.mjs.map +1 -0
- package/dist/server-3TJZDKQC.mjs +11 -0
- package/dist/server-3TJZDKQC.mjs.map +1 -0
- package/dist/web/playground/ai-skills/parse.md +656 -0
- package/dist/web/playground/assets/main-Bhn9NHgQ.css +2 -0
- package/dist/web/playground/assets/main-Bj_mxNMk.js +212 -0
- package/dist/web/playground/assets/rolldown-runtime-C0FnF6B9.js +1 -0
- package/dist/web/playground/assets/statementBuilderFlow-DXlHS86r.js +2 -0
- package/dist/web/playground/assets/vendor-BlJqgFME.js +201 -0
- package/dist/web/playground/assets/vendor-codemirror-BtJgoBjf.js +40 -0
- package/dist/web/playground/fonts/Inter-Regular.woff2 +0 -0
- package/dist/web/playground/fonts/Inter-SemiBold.woff2 +0 -0
- package/dist/web/playground/images/hero/editing.png +0 -0
- package/dist/web/playground/images/hero/journal.png +0 -0
- package/dist/web/playground/images/hero/results.png +0 -0
- package/dist/web/playground/images/hero/timer.png +0 -0
- package/dist/web/playground/images/wod-wiki-logo-dark.png +0 -0
- package/dist/web/playground/images/wod-wiki-logo-light.png +0 -0
- package/dist/web/playground/index.html +60 -0
- package/dist/web/playground/seed/core/chunks/canvas.054cd7db.json +1 -0
- package/dist/web/playground/seed/core/chunks/template.e5e0e82d.json +1 -0
- package/dist/web/playground/seed/core/manifest.json +24 -0
- package/dist/web/playground/seed/core/report.html +43 -0
- package/dist/web/server/ai-skills/parse.md +656 -0
- package/dist/web/server/assets/main-Bhn9NHgQ.css +2 -0
- package/dist/web/server/assets/main-CfAVkURA.js +211 -0
- package/dist/web/server/assets/rolldown-runtime-C0FnF6B9.js +1 -0
- package/dist/web/server/assets/statementBuilderFlow-CXugzTXB.js +2 -0
- package/dist/web/server/assets/vendor-BlJqgFME.js +201 -0
- package/dist/web/server/assets/vendor-codemirror-BtJgoBjf.js +40 -0
- package/dist/web/server/fonts/Inter-Regular.woff2 +0 -0
- package/dist/web/server/fonts/Inter-SemiBold.woff2 +0 -0
- package/dist/web/server/images/hero/editing.png +0 -0
- package/dist/web/server/images/hero/journal.png +0 -0
- package/dist/web/server/images/hero/results.png +0 -0
- package/dist/web/server/images/hero/timer.png +0 -0
- package/dist/web/server/images/wod-wiki-logo-dark.png +0 -0
- package/dist/web/server/images/wod-wiki-logo-light.png +0 -0
- package/dist/web/server/index.html +60 -0
- package/dist/web/server/seed/core/chunks/canvas.054cd7db.json +1 -0
- package/dist/web/server/seed/core/chunks/template.e5e0e82d.json +1 -0
- package/dist/web/server/seed/core/manifest.json +24 -0
- package/dist/web/server/seed/core/report.html +43 -0
- package/package.json +46 -4
- package/README.md +0 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { WodWikiIRFile, StatementNode, ExecutionLog, LanguagePack } from '@bitcobblers/wod-wiki-engine';
|
|
2
|
+
import { INowProvider, IEffort } from '@bitcobblers/wod-wiki-lang';
|
|
3
|
+
import { QueryServiceStores, QueryResult, RowsQueryResult, FindQueryResult, PipelineResult } from '@bitcobblers/wod-wiki-wql';
|
|
4
|
+
import { EventRecord, AnalyticsDataPoint, Session, Note, BlockIndexRow, BlockRevision } from '@bitcobblers/wod-wiki-core';
|
|
5
|
+
import { IStorage } from '@bitcobblers/wod-wiki-storage';
|
|
6
|
+
import { Database } from '@bitcobblers/wod-wiki-storage/sql';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Headless Parse Command Runner
|
|
10
|
+
*
|
|
11
|
+
* Parses Whiteboard Script source text and emits a versioned IR parse-tree envelope.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare class ParseSyntaxError extends Error {
|
|
15
|
+
readonly errors: Array<{
|
|
16
|
+
message: string;
|
|
17
|
+
line?: number;
|
|
18
|
+
}>;
|
|
19
|
+
constructor(errors: Array<{
|
|
20
|
+
message: string;
|
|
21
|
+
line?: number;
|
|
22
|
+
}>, message?: string);
|
|
23
|
+
}
|
|
24
|
+
interface ParseOptions {
|
|
25
|
+
sport?: string;
|
|
26
|
+
sourceLabel?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parses Whiteboard Script source directly into a StatementNode IR envelope.
|
|
30
|
+
*/
|
|
31
|
+
declare function runParse(source: string, options?: ParseOptions): WodWikiIRFile<StatementNode>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Headless Execution Command Runner
|
|
35
|
+
*
|
|
36
|
+
* Executes Whiteboard Script through JIT compiler and runtime state machine,
|
|
37
|
+
* emitting a versioned execution-log IR envelope.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
interface RunOptions {
|
|
41
|
+
sport?: string;
|
|
42
|
+
dialect?: 'time' | 'log';
|
|
43
|
+
blockId?: string;
|
|
44
|
+
blockVersion?: number;
|
|
45
|
+
startTime?: number;
|
|
46
|
+
maxIterations?: number;
|
|
47
|
+
now?: INowProvider;
|
|
48
|
+
sourceLabel?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Runs a workout script to completion using headless state machine and Node clock.
|
|
52
|
+
*/
|
|
53
|
+
declare function runExecution(source: string, options?: RunOptions): Promise<WodWikiIRFile<ExecutionLog>>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Headless WQL Query Command Runner
|
|
57
|
+
*
|
|
58
|
+
* Evaluates WQL queries against in-memory stores sourced from --corpus,
|
|
59
|
+
* --stdin-log, or --stdin-facts, and emits a versioned IR envelope.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
declare class WqlSyntaxError extends Error {
|
|
63
|
+
readonly query: string;
|
|
64
|
+
readonly syntaxError: string;
|
|
65
|
+
constructor(query: string, syntaxError: string);
|
|
66
|
+
}
|
|
67
|
+
interface QueryCliOptions {
|
|
68
|
+
corpusPath?: string;
|
|
69
|
+
stdinLog?: string;
|
|
70
|
+
stdinFacts?: string;
|
|
71
|
+
preferredUnit?: string;
|
|
72
|
+
sourceLabel?: string;
|
|
73
|
+
/** Pre-built store bundle (e.g. sqlite-backed). When set, the corpus/stdin
|
|
74
|
+
* dataset options are ignored. */
|
|
75
|
+
stores?: QueryServiceStores;
|
|
76
|
+
}
|
|
77
|
+
interface LoadedData {
|
|
78
|
+
eventRecords: EventRecord[];
|
|
79
|
+
facts: AnalyticsDataPoint[];
|
|
80
|
+
results: Session[];
|
|
81
|
+
notes: Note[];
|
|
82
|
+
blocks: BlockIndexRow[];
|
|
83
|
+
revisions: BlockRevision[];
|
|
84
|
+
efforts: IEffort[];
|
|
85
|
+
noteTags: Record<string, string[]>;
|
|
86
|
+
}
|
|
87
|
+
declare function loadQueryData(options: QueryCliOptions): LoadedData;
|
|
88
|
+
/**
|
|
89
|
+
* Runs a WQL query against the provided in-memory dataset and returns a versioned IR envelope.
|
|
90
|
+
*/
|
|
91
|
+
declare function runQueryCli(wqlString: string, options?: QueryCliOptions): Promise<WodWikiIRFile<QueryResult | RowsQueryResult | FindQueryResult | PipelineResult>>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Dynamic Language Pack Loader
|
|
95
|
+
*
|
|
96
|
+
* Dynamically loads and registers Language Packs passed via `--pack <module-spec>`.
|
|
97
|
+
* Throws PackLoadError on failure, enabling exit code 3 handling.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
declare class PackLoadError extends Error {
|
|
101
|
+
readonly spec: string;
|
|
102
|
+
readonly originalError: unknown;
|
|
103
|
+
constructor(spec: string, originalError: unknown);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Dynamically imports a Language Pack module and registers it.
|
|
107
|
+
*
|
|
108
|
+
* @param moduleSpec - Relative or absolute path, or package name.
|
|
109
|
+
*/
|
|
110
|
+
declare function loadLanguagePack(moduleSpec: string): Promise<LanguagePack>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* CLI Output Formatters (JSON, ASCII Table, CSV)
|
|
114
|
+
*
|
|
115
|
+
* Implements presentation formatting for parse-tree, execution-log,
|
|
116
|
+
* and WQL query results across json, table, and csv formats.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
type OutputFormat = 'json' | 'table' | 'csv';
|
|
120
|
+
/**
|
|
121
|
+
* Format StatementNode parse tree
|
|
122
|
+
*/
|
|
123
|
+
declare function formatParseOutput(ir: WodWikiIRFile<StatementNode>, format: OutputFormat, pretty?: boolean): string;
|
|
124
|
+
/**
|
|
125
|
+
* Format ExecutionLog runtime output
|
|
126
|
+
*/
|
|
127
|
+
declare function formatExecutionOutput(ir: WodWikiIRFile<ExecutionLog>, format: OutputFormat, pretty?: boolean): string;
|
|
128
|
+
/**
|
|
129
|
+
* Format QueryResult / RowsQueryResult / FindQueryResult / PipelineResult
|
|
130
|
+
*/
|
|
131
|
+
declare function formatQueryOutput(ir: WodWikiIRFile<QueryResult | RowsQueryResult | FindQueryResult | PipelineResult>, format: OutputFormat, pretty?: boolean): string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Unified `wod` CLI Runner
|
|
135
|
+
*
|
|
136
|
+
* Implements CLI command routing, argument parsing, pipe handling,
|
|
137
|
+
* and exit code conventions per wayfinder #962 and issue #967.
|
|
138
|
+
*
|
|
139
|
+
* Exit Codes:
|
|
140
|
+
* 0 - OK / Success (including empty query results)
|
|
141
|
+
* 1 - Runtime error (file missing, bad arguments, execution error)
|
|
142
|
+
* 2 - Parse / Syntax error (invalid Whiteboard Script or malformed WQL)
|
|
143
|
+
* 3 - Pack load error (failed to import or register --pack)
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
interface CliParsedArgs {
|
|
147
|
+
subcommand?: 'parse' | 'run' | 'query' | 'download' | 'import' | 'build' | 'seed' | 'reset' | 'init' | 'server' | 'serve' | 'playground' | 'help' | 'version';
|
|
148
|
+
target?: string;
|
|
149
|
+
/** Second positional: the id (download) or file (import) after the kind. */
|
|
150
|
+
target2?: string;
|
|
151
|
+
corpus?: string;
|
|
152
|
+
stdinLog?: boolean;
|
|
153
|
+
stdinFacts?: boolean;
|
|
154
|
+
format: OutputFormat;
|
|
155
|
+
output?: string;
|
|
156
|
+
packs: string[];
|
|
157
|
+
sport?: string;
|
|
158
|
+
unit?: string;
|
|
159
|
+
help?: boolean;
|
|
160
|
+
version?: boolean;
|
|
161
|
+
/** SQLite database path (--db). Defaults to WOD_WIKI_DB or ./wodwiki.db. */
|
|
162
|
+
db?: string;
|
|
163
|
+
/** Backend driver override (--db-driver): sqlite | postgres | turso. */
|
|
164
|
+
dbDriver?: string;
|
|
165
|
+
/** PostgreSQL connection URL (--database-url) or component flags below. */
|
|
166
|
+
databaseUrl?: string;
|
|
167
|
+
postgresHost?: string;
|
|
168
|
+
postgresPort?: string;
|
|
169
|
+
postgresUser?: string;
|
|
170
|
+
postgresPassword?: string;
|
|
171
|
+
postgresDatabase?: string;
|
|
172
|
+
postgresSsl?: string;
|
|
173
|
+
/** Turso/libSQL target (--turso-url) plus its auth token. */
|
|
174
|
+
tursoUrl?: string;
|
|
175
|
+
tursoAuthToken?: string;
|
|
176
|
+
/** Explicit environment file (--env-file); a missing file is an error. */
|
|
177
|
+
envFile?: string;
|
|
178
|
+
/** Hosting bind address/port and prebuilt frontend directory (server/playground). */
|
|
179
|
+
host?: string;
|
|
180
|
+
port?: string;
|
|
181
|
+
dist?: string;
|
|
182
|
+
/** IR debug output: undefined = off, '' = default file name, otherwise the file name. */
|
|
183
|
+
debug?: string;
|
|
184
|
+
/** Extra seed source directories for `wod seed` (repeatable). */
|
|
185
|
+
sources: string[];
|
|
186
|
+
/** `wod build`: scaffold markdown stubs for newly discovered efforts. */
|
|
187
|
+
scaffold?: boolean;
|
|
188
|
+
/** `wod build`: extra template markdown file compiled as the `template` chunk. */
|
|
189
|
+
template?: string;
|
|
190
|
+
/** `wod build`: content repo root (alias for the positional directory). */
|
|
191
|
+
dir?: string;
|
|
192
|
+
}
|
|
193
|
+
declare function parseCliArgs(args: string[]): CliParsedArgs;
|
|
194
|
+
declare function readStdin(): Promise<string>;
|
|
195
|
+
/**
|
|
196
|
+
* Main CLI entry point. Returns numeric exit code.
|
|
197
|
+
*/
|
|
198
|
+
declare function cliMain(argv?: string[], io?: {
|
|
199
|
+
stdout?: (text: string) => void;
|
|
200
|
+
stderr?: (text: string) => void;
|
|
201
|
+
readStdinFn?: () => Promise<string>;
|
|
202
|
+
}): Promise<number>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Database configuration for the `wod` CLI (and the dev server): explicit
|
|
206
|
+
* per-property flags → process env → .env file (native node:util.parseEnv,
|
|
207
|
+
* non-mutating).
|
|
208
|
+
*
|
|
209
|
+
* Precedence: flags beat env beats .env. `--db` selects local SQLite even
|
|
210
|
+
* when env configures a remote backend; explicit `--db-driver` /
|
|
211
|
+
* `--postgres-*` / `--turso-*` flags select that backend. Conflicting
|
|
212
|
+
* explicit selectors and ambiguous env backends are rejected. Labels and
|
|
213
|
+
* error messages never contain credentials.
|
|
214
|
+
*/
|
|
215
|
+
/** Optional per-property flag bag — every property unset unless given. */
|
|
216
|
+
interface CliDatabaseOptions {
|
|
217
|
+
/** --db: explicit SQLite file. Selects sqlite even when env has a remote backend. */
|
|
218
|
+
db?: string;
|
|
219
|
+
/** --db-driver: sqlite | postgres | turso. */
|
|
220
|
+
dbDriver?: string;
|
|
221
|
+
/** --database-url: driver-scoped URL (mirrors DATABASE_URL). */
|
|
222
|
+
databaseUrl?: string;
|
|
223
|
+
postgresHost?: string;
|
|
224
|
+
postgresPort?: string;
|
|
225
|
+
postgresUser?: string;
|
|
226
|
+
postgresPassword?: string;
|
|
227
|
+
postgresDatabase?: string;
|
|
228
|
+
/** --postgres-ssl <mode>: true/false or disable | prefer | require | verify-ca | verify-full. */
|
|
229
|
+
postgresSsl?: string | boolean;
|
|
230
|
+
tursoUrl?: string;
|
|
231
|
+
tursoAuthToken?: string;
|
|
232
|
+
/** --env-file: explicit file is mandatory — a missing file is an error. */
|
|
233
|
+
envFile?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Discriminated backend selection. `label` is credential-free and safe to
|
|
236
|
+
* print on every variant. sqlite is pure-local (absolute `path`); every
|
|
237
|
+
* remote libsql target normalizes to turso. */
|
|
238
|
+
type PostgresSslMode = 'disable' | 'prefer' | 'require' | 'verify-ca' | 'verify-full';
|
|
239
|
+
type CliDatabaseConfig = {
|
|
240
|
+
kind: 'sqlite';
|
|
241
|
+
label: string;
|
|
242
|
+
path: string;
|
|
243
|
+
} | {
|
|
244
|
+
kind: 'postgres';
|
|
245
|
+
label: string;
|
|
246
|
+
url: string;
|
|
247
|
+
host: string;
|
|
248
|
+
port: number;
|
|
249
|
+
database: string;
|
|
250
|
+
user?: string;
|
|
251
|
+
password?: string;
|
|
252
|
+
ssl: PostgresSslMode;
|
|
253
|
+
} | {
|
|
254
|
+
kind: 'turso';
|
|
255
|
+
label: string;
|
|
256
|
+
url: string;
|
|
257
|
+
authToken?: string;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Load a NON-MUTATING env object from the dotenv tier ONLY: an explicit
|
|
261
|
+
* --env-file is mandatory when given (missing file → error); otherwise
|
|
262
|
+
* `.env` in the working directory, falling back to the nearest ancestor
|
|
263
|
+
* (workspace root) `.env`. Callers merge over process.env themselves
|
|
264
|
+
* ({ ...loadCliEnvironment(file), ...process.env }); process.env is never
|
|
265
|
+
* written.
|
|
266
|
+
*/
|
|
267
|
+
declare function loadCliEnvironment(envFile?: string): Record<string, string | undefined>;
|
|
268
|
+
/**
|
|
269
|
+
* Resolve the effective database configuration: flags > env > .env. Pass
|
|
270
|
+
* `env` to supply an already-merged tier (nothing is re-read); without it
|
|
271
|
+
* the .env tier (loadCliEnvironment) sits under the true process tier.
|
|
272
|
+
* Kind-pinning flags (--db, --db-driver, --turso-url/--turso-auth-token,
|
|
273
|
+
* --postgres-*) override even a malformed env driver; conflicting pins and
|
|
274
|
+
* ambiguous env backends are rejected. Never echoes credentials.
|
|
275
|
+
*/
|
|
276
|
+
declare function resolveDatabaseConfig(options?: CliDatabaseOptions, env?: Record<string, string | undefined>): CliDatabaseConfig;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Local SQLite seam for the `wod` CLI.
|
|
280
|
+
*
|
|
281
|
+
* Opens a libsql `file:` database, initializes the shared storage schema
|
|
282
|
+
* (KV store tables + domain projections), and adapts the rows into the WQL
|
|
283
|
+
* store interfaces — the same shape the playground builds over IndexedDB.
|
|
284
|
+
*
|
|
285
|
+
* Everything heavy is loaded lazily (`@libsql/client`,
|
|
286
|
+
* `@bitcobblers/wod-wiki-storage/sql`, node `fs`/`crypto`) so browser
|
|
287
|
+
* bundles that import the engine index never pull native drivers; the
|
|
288
|
+
* dynamic specifiers stay external in the CLI bundle.
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
interface CliDb {
|
|
292
|
+
db: Database;
|
|
293
|
+
storage: IStorage;
|
|
294
|
+
/** Absolute path of the underlying .sqlite file — or the sanitized display
|
|
295
|
+
* label (URL without credentials) for remote backends. */
|
|
296
|
+
path: string;
|
|
297
|
+
close(): Promise<void>;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Open the CLI database: a legacy local sqlite path (internal callers,
|
|
301
|
+
* created/initialized as before) or a resolved backend config from ./config.
|
|
302
|
+
*
|
|
303
|
+
* opts.initialize (default true): run the schema + projection
|
|
304
|
+
* initialization. false → verify the schema/projection guards only: a
|
|
305
|
+
* missing local sqlite file is NOT created and yields an actionable
|
|
306
|
+
* `wod init` error; remote targets are only probed, never created.
|
|
307
|
+
*
|
|
308
|
+
* opts.create (explicit init requests only, postgres): when the configured
|
|
309
|
+
* PostgreSQL database is missing, openDatabase creates it through the admin
|
|
310
|
+
* "postgres" database before initializing. Turso has no management API —
|
|
311
|
+
* its hosted target must already exist.
|
|
312
|
+
*/
|
|
313
|
+
declare function openCliDb(target?: string | CliDatabaseConfig, opts?: {
|
|
314
|
+
initialize?: boolean;
|
|
315
|
+
create?: boolean;
|
|
316
|
+
}): Promise<CliDb>;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* server.ts — `wod server` (alias `serve`) / `wod playground` (Bun-only front
|
|
320
|
+
* door).
|
|
321
|
+
*
|
|
322
|
+
* Serves the packaged engine stack: the shared fetch handler shipped in this
|
|
323
|
+
* package (the same code the Docker image serves) plus the frontend build
|
|
324
|
+
* packaged under the engine's dist/web/ — no repository checkout, no runtime
|
|
325
|
+
* build.
|
|
326
|
+
*
|
|
327
|
+
* server probes the configured database first (never creates schema —
|
|
328
|
+
* that's `wod init`), then serves API + SPA.
|
|
329
|
+
* playground serves the browser-storage SPA build and never opens a database
|
|
330
|
+
* (every /api request answers 404).
|
|
331
|
+
*
|
|
332
|
+
* Retains the event loop until SIGINT/SIGTERM; shutdown drains in-flight
|
|
333
|
+
* requests before closing the database.
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
type WriteOut = (text: string) => void;
|
|
337
|
+
type CliServerMode = 'server' | 'playground';
|
|
338
|
+
interface CliServerOptions {
|
|
339
|
+
/** Resolved database configuration. REQUIRED for 'server'; ignored — never
|
|
340
|
+
* opened or validated — for 'playground'. */
|
|
341
|
+
database?: CliDatabaseConfig;
|
|
342
|
+
host?: string;
|
|
343
|
+
port?: string;
|
|
344
|
+
/** Explicit dist directory (flag or PLAYGROUND_DIST); must already exist. */
|
|
345
|
+
dist?: string;
|
|
346
|
+
/** Merged CLI environment (process env + .env). */
|
|
347
|
+
env: Record<string, string | undefined>;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Start the shared server for `wod server` / `wod playground`. Throws on any
|
|
351
|
+
* startup failure; on success it never returns until SIGINT/SIGTERM (drain,
|
|
352
|
+
* close database, exit 0).
|
|
353
|
+
*/
|
|
354
|
+
declare function runCliServer(mode: CliServerMode, options: CliServerOptions, writeOut: WriteOut): Promise<void>;
|
|
355
|
+
|
|
356
|
+
export { type CliDatabaseConfig, type CliDb, type CliParsedArgs, type CliServerMode, type CliServerOptions, type OutputFormat, PackLoadError, type ParseOptions, ParseSyntaxError, type QueryCliOptions, type RunOptions, WqlSyntaxError, cliMain, formatExecutionOutput, formatParseOutput, formatQueryOutput, loadCliEnvironment, loadLanguagePack, loadQueryData, openCliDb, parseCliArgs, readStdin, resolveDatabaseConfig, runCliServer, runExecution, runParse, runQueryCli };
|