process-graph 1.0.5 → 1.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.
Files changed (58) hide show
  1. package/README.md +85 -17
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +92 -0
  4. package/dist/cli.d.ts +512 -0
  5. package/dist/cli.js +3 -0
  6. package/dist/control-aDk9560d.js +294 -0
  7. package/dist/detail-panel-B1ZmMuJT.js +341 -0
  8. package/dist/dist-BpCBmnMl.js +582 -0
  9. package/dist/dist-HLlW8vgT.js +1388 -0
  10. package/dist/dist-IjrgWhHQ.js +3 -0
  11. package/dist/errors-BZe5WzCn.js +19 -0
  12. package/dist/exit-codes-0ultCqdS.js +23 -0
  13. package/dist/graphql-C1j5wQFz.d.ts +631 -0
  14. package/dist/index-CCfe0csl.d.ts +353 -0
  15. package/dist/index-CmZOswkx.d.ts +512 -0
  16. package/dist/index-CoA6vXqe.d.ts +404 -0
  17. package/dist/index-CptUHq6F.d.ts +58 -0
  18. package/dist/index-CrM5qWUA.d.ts +110 -0
  19. package/dist/index-DhbvDgK4.d.ts +1582 -0
  20. package/dist/index-DricKcyl.d.ts +421 -0
  21. package/dist/index.d.ts +111 -4
  22. package/dist/index.js +929 -5
  23. package/dist/layout-CCM-KBdp.js +307 -0
  24. package/dist/layout.d.ts +8 -0
  25. package/dist/layout.js +2 -0
  26. package/dist/node-AchI1T-K.js +40 -0
  27. package/dist/open-CyRXJ4bt.js +29 -0
  28. package/dist/parse-CuipC_2K.js +41 -0
  29. package/dist/queries-CCexJAE2.js +2202 -0
  30. package/dist/react-flow/style.css +658 -0
  31. package/dist/react-flow.d.ts +173 -0
  32. package/dist/react-flow.js +450 -0
  33. package/dist/react.d.ts +2 -0
  34. package/dist/react.js +107 -0
  35. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  36. package/dist/router-D4gtTlXm.js +188 -0
  37. package/dist/schema-CVnS6HiX.js +234 -0
  38. package/dist/selection-BW_xXWOy.js +314 -0
  39. package/dist/source/github/node.d.ts +16 -0
  40. package/dist/source/github/node.js +2 -0
  41. package/dist/source/github.d.ts +49 -0
  42. package/dist/source/github.js +201 -0
  43. package/dist/source-DRDpEA8Q.js +1316 -0
  44. package/dist/status-Bm1CGu9C.js +11 -0
  45. package/dist/store/node.d.ts +24 -0
  46. package/dist/store/node.js +2 -0
  47. package/dist/store/wasm/worker.d.ts +16 -0
  48. package/dist/store/wasm/worker.js +98 -0
  49. package/dist/store/wasm.d.ts +9 -0
  50. package/dist/store/wasm.js +11 -0
  51. package/dist/store-BcR70CaO.js +1287 -0
  52. package/dist/store.d.ts +1328 -0
  53. package/dist/store.js +238 -0
  54. package/dist/ui/style.css +351 -0
  55. package/dist/ui.d.ts +235 -0
  56. package/dist/ui.js +2 -0
  57. package/dist/validate-DF3mQZww.js +125 -0
  58. package/package.json +148 -13
package/dist/cli.d.ts ADDED
@@ -0,0 +1,512 @@
1
+ import { F as Status, _ as StatusRule, k as Facts, m as IncomingBasis, p as ArtefactBasis } from "./index-CCfe0csl.js";
2
+ import { E as Participant, F as OverlayStatus, G as IdSpace, K as OpenIds, S as EventDef, a as Overlay, b as ArtefactDef, g as Model, k as Transition, x as Element } from "./index-CmZOswkx.js";
3
+ import { C as Gap, n as GraphqlFetch, t as GitHubTokenPort, v as GraphSourceClient } from "./graphql-C1j5wQFz.js";
4
+ import { Q as GraphStoreClient } from "./index-DhbvDgK4.js";
5
+ import "./index-CptUHq6F.js";
6
+ import { A as Flowchart, E as Swimlane, M as Handoff, g as SequenceDiagram, x as StateMachine } from "./index-CoA6vXqe.js";
7
+ //#region ../graph-cli/dist/exit-codes.d.ts
8
+ /**
9
+ * The exit status of every command, by meaning. A script tells the outcomes apart without reading the output: a model with problems is not a failure to run, and neither is an element that does not exist.
10
+ *
11
+ * - `success`: the command did what it was asked, and for `validate` and `cycles`, found nothing wrong.
12
+ * - `failure`: anything not listed below, such as a store that cannot be opened.
13
+ * - `usage`: the command line is wrong: an unknown command or option, a missing argument, a value outside its choices.
14
+ * - `notFound`: the model, an element or another identifier named on the command line does not exist.
15
+ * - `invalidModel`: the model has problems: `validate` found issues, `cycles` found an illegal cycle, a reasoning command met an illegal cycle, or the store rejected a change that would leave the model invalid.
16
+ * - `sourceFailure`: a source refused the sync: bad credentials, a rate limit or a scope it does not accept.
17
+ * - `missingPeers`: the `process-graph` bin could not start because optional peer dependencies the command line needs are not installed beside it.
18
+ */
19
+ export declare const exitCodes: {
20
+ readonly success: 0;
21
+ readonly failure: 1;
22
+ readonly usage: 2;
23
+ readonly notFound: 3;
24
+ readonly invalidModel: 4;
25
+ readonly sourceFailure: 5;
26
+ readonly missingPeers: 6;
27
+ };
28
+ /** One of the exit statuses in `exitCodes`. */
29
+ type ExitCode = (typeof exitCodes)[keyof typeof exitCodes];
30
+ //#endregion
31
+ //#region ../graph-cli/dist/ports.d.ts
32
+ /** A store opened for one command, and how to release it. */
33
+ interface OpenedStore {
34
+ /** The store, over whatever transport the opener chose. */
35
+ readonly client: GraphStoreClient;
36
+ /** Releases the store. Called once, after the command, whether it succeeded or not. */
37
+ readonly close: () => void | Promise<void>;
38
+ /** Lines the command line writes to standard error before the command runs, such as permissions it narrowed on the store's files; empty when there is nothing to say. */
39
+ readonly warnings: readonly string[];
40
+ }
41
+ /**
42
+ * Everything the command line touches outside itself. Commands read and write only through these, so the whole command surface runs in a test, or inside another program such as Switchboard, with no process, file system or network of its own. `nodePorts` supplies them for a real process.
43
+ */
44
+ interface CliPorts {
45
+ /** Writes text to standard output, exactly as given. */
46
+ readonly stdout: (text: string) => void;
47
+ /** Writes text to standard error, exactly as given. */
48
+ readonly stderr: (text: string) => void;
49
+ /** Opens the store kept at a data path. */
50
+ readonly openStore: (path: string) => OpenedStore | Promise<OpenedStore>;
51
+ /** The data path used when `--data` is not given. */
52
+ readonly defaultDataPath: string;
53
+ /**
54
+ * The source that serves scopes with an identifier prefix, such as `github` for `github:owner/repo`, or `undefined` when no source has that prefix.
55
+ * @param prefix - The part of a scope identifier before its first colon.
56
+ */
57
+ readonly source: (prefix: string) => GraphSourceClient | undefined;
58
+ /**
59
+ * Reads a text file, for `validate <file>`.
60
+ * @param path - The file to read.
61
+ * @param signal - Aborts the read.
62
+ */
63
+ readonly readFile: (path: string, signal: AbortSignal | undefined) => Promise<string>;
64
+ /** The facts that decision conditions read, and which input artefacts are provided. */
65
+ readonly facts: Facts;
66
+ /** Aborts every store and source call a command makes. */
67
+ readonly signal: AbortSignal | undefined;
68
+ }
69
+ //#endregion
70
+ //#region ../graph-cli/dist/program.d.ts
71
+ /** How the program presents itself. */
72
+ interface ProgramIdentity {
73
+ /** The command name shown in help and usage, such as `process-graph`, or `sb graph` when embedded. */
74
+ readonly name: string;
75
+ /** The version `--version` prints. */
76
+ readonly version: string;
77
+ }
78
+ /** The model a command works on when `--model` is not given. */
79
+ export declare const defaultModelId = "default";
80
+ /**
81
+ * Runs the command line with the given arguments, writing only through the ports, and resolves with the exit status. It never exits the process or reads its arguments itself, so a test or a host program such as Switchboard runs it as a function.
82
+ * @param args - The arguments after the program name, such as `["ready", "--json"]`.
83
+ * @param ports - Output, store, sources, facts and the abort signal.
84
+ * @param identity - The name and version the program presents.
85
+ * @returns The exit status, one of `exitCodes`.
86
+ */
87
+ export declare const runCli: (args: readonly string[], ports: CliPorts, identity: ProgramIdentity) => Promise<ExitCode>;
88
+ //#endregion
89
+ //#region ../graph-cli/dist/errors.d.ts
90
+ /** A failure the command line reports with its own exit status and message, and nothing else. */
91
+ export declare class CliError extends Error {
92
+ /** The exit status the failure maps to. */
93
+ readonly exitCode: ExitCode;
94
+ /**
95
+ * @param exitCode - The exit status to report.
96
+ * @param message - What went wrong, as one line for standard error.
97
+ * @param options - The underlying error, kept as the cause.
98
+ */
99
+ constructor(exitCode: ExitCode, message: string, options?: ErrorOptions);
100
+ }
101
+ /** The exit status and message an error is reported with. */
102
+ interface Failure {
103
+ readonly exitCode: ExitCode;
104
+ readonly message: string;
105
+ }
106
+ /**
107
+ * Classifies anything a command threw into its exit status and the message for standard error. A commander usage error has already printed its own message, so it is reported with an empty one.
108
+ * @param error - What was thrown.
109
+ * @returns The exit status and message.
110
+ */
111
+ export declare const failureOf: (error: unknown) => Failure;
112
+ //#endregion
113
+ //#region ../graph-cli/dist/node.d.ts
114
+ /** Where a Node process finds its ports. Each is injectable, and each defaults to the real thing. */
115
+ interface NodePortsOptions {
116
+ /** The environment, for the data path and the GitHub token; `process.env` when absent. */
117
+ readonly env?: Readonly<Record<string, string | undefined>>;
118
+ /** The home directory the default data path falls back on; the user's when absent. */
119
+ readonly home?: string;
120
+ /** Supplies GitHub tokens; `GITHUB_TOKEN` or the GitHub CLI's token (`githubTokenFromEnvironment`) when absent. */
121
+ readonly token?: GitHubTokenPort;
122
+ /** How requests reach GitHub; the global `fetch` when absent. */
123
+ readonly fetch?: GraphqlFetch;
124
+ /** The clock, in milliseconds since the epoch, for a rate limit's retry time; `Date.now` when absent. */
125
+ readonly now?: () => number;
126
+ /** The facts decision conditions read and which input artefacts are provided; nothing is known when absent. */
127
+ readonly facts?: Facts;
128
+ /** Aborts every store and source call. */
129
+ readonly signal?: AbortSignal;
130
+ /** Standard output; the process's when absent. */
131
+ readonly stdout?: (text: string) => void;
132
+ /** Standard error; the process's when absent. */
133
+ readonly stderr?: (text: string) => void;
134
+ /** The platform, which decides whether file modes are set; the process's when absent. */
135
+ readonly platform?: NodeJS.Platform;
136
+ }
137
+ /**
138
+ * The data file used when `--data` is not given: `PROCESS_GRAPH_DATA` when it is set and not empty, otherwise `process-graph/graph.sqlite3` under the XDG data directory (`XDG_DATA_HOME`, or `.local/share` in the home directory).
139
+ * @param env - The environment.
140
+ * @param home - The home directory.
141
+ * @returns The path.
142
+ */
143
+ export declare const defaultDataPath: (env: Readonly<Record<string, string | undefined>>, home: string) => string;
144
+ /**
145
+ * The version in a package manifest, which `--version` prints. Each bin passes its own manifest, so the entry point reports its own version rather than this package's.
146
+ * @param manifest - The manifest's location, such as `new URL("../package.json", import.meta.url)` from a module in `dist/`.
147
+ * @returns The version.
148
+ * @throws Error when the manifest has no string `version`.
149
+ */
150
+ export declare const packageVersion: (manifest: URL) => string;
151
+ /**
152
+ * The ports for a Node process: the SQLite store over `node:sqlite` (creating the data file's directory when needed), the GitHub issues source for `github:` scopes, the file system and the process's streams.
153
+ * @param options - Replacements for any of the defaults.
154
+ * @returns The ports.
155
+ */
156
+ export declare const nodePorts: (options?: NodePortsOptions) => CliPorts;
157
+ /**
158
+ * Runs the command line as the current process: its arguments, its streams and the real ports, with an interrupt aborting whatever the command is waiting on. It resolves with the exit status rather than exiting, so the bin sets `process.exitCode` and pending output is flushed.
159
+ * @param identity - The name and version the program presents.
160
+ * @returns The exit status.
161
+ */
162
+ export declare const runProcess: (identity: ProgramIdentity) => Promise<ExitCode>;
163
+ //#endregion
164
+ //#region ../graph-cli/dist/session.d.ts
165
+ /** What every operation works against: one model in one store, the facts its conditions read, and the signal that aborts its calls. */
166
+ interface GraphSession {
167
+ readonly store: GraphStoreClient;
168
+ /** The name the model is filed under in the store. */
169
+ readonly modelId: string;
170
+ readonly facts: Facts;
171
+ readonly signal: AbortSignal | undefined;
172
+ }
173
+ /** A stored model and its run state, as an operation reads them. */
174
+ interface StoredRun {
175
+ readonly revision: number;
176
+ readonly model: Model<OpenIds>;
177
+ readonly overlay: Overlay<OpenIds>;
178
+ }
179
+ /** An element as commands report it: its identifier and its human label. */
180
+ interface ElementSummary {
181
+ readonly id: string;
182
+ readonly label: string;
183
+ }
184
+ /**
185
+ * Reads the session's model and run state, if the store has the model.
186
+ * @param session - The store and model.
187
+ * @returns The stored run, or `undefined` when the store has no such model.
188
+ */
189
+ export declare const findRun: (session: GraphSession) => Promise<StoredRun | undefined>;
190
+ /**
191
+ * Loads the session's model and run state.
192
+ * @param session - The store and model.
193
+ * @returns The stored run.
194
+ * @throws CliError with `notFound` when the store has no such model.
195
+ */
196
+ export declare const loadRun: (session: GraphSession) => Promise<StoredRun>;
197
+ //#endregion
198
+ //#region ../graph-cli/dist/queries.d.ts
199
+ /** An element with its derived status. */
200
+ interface ElementStatus extends ElementSummary {
201
+ readonly status: Status;
202
+ }
203
+ /** Every element that can be worked on now. */
204
+ interface ReadyResult {
205
+ readonly elements: readonly ElementSummary[];
206
+ }
207
+ /** What an element is waiting on. */
208
+ interface BlockedResult {
209
+ readonly element: ElementStatus;
210
+ /** The open work to finish first: the ends of the element's blocked-by chain, in model order. */
211
+ readonly blockedBy: readonly ElementSummary[];
212
+ }
213
+ /** What finishing, delaying or dropping an element affects. */
214
+ interface ImpactResult {
215
+ readonly element: ElementStatus;
216
+ /** The live elements that transitively depend on it, in model order. */
217
+ readonly impacted: readonly ElementSummary[];
218
+ }
219
+ /** The longest chain of work still ahead. */
220
+ interface PathResult {
221
+ /** The chain in dependency order. */
222
+ readonly path: readonly ElementSummary[];
223
+ /** Its length in elements, each counting one step. */
224
+ readonly weight: number;
225
+ }
226
+ /** The cycles no decision closes. */
227
+ interface CyclesResult {
228
+ /** Each cycle as a closed path: each element needs the next, and the first is repeated at the end. */
229
+ readonly cycles: readonly (readonly string[])[];
230
+ }
231
+ /** The transitions between elements with different actors. */
232
+ interface HandoffsResult {
233
+ readonly handoffs: readonly Handoff<OpenIds>[];
234
+ }
235
+ /** One element of a blocked-by chain, with its label and status. */
236
+ interface WhyLink extends ElementStatus {
237
+ /** The unfinished needs it still waits on, in model order. */
238
+ readonly waitingOn: readonly string[];
239
+ }
240
+ /** Why an element has its status. */
241
+ interface WhyResult {
242
+ readonly element: ElementStatus;
243
+ /** The rule of the status derivation that decided it. */
244
+ readonly rule: StatusRule;
245
+ /** Its incoming transitions other than loop edges, each with its branch, its source's status and whether it is cut. */
246
+ readonly transitions: readonly IncomingBasis<OpenIds>[];
247
+ /** The artefacts it consumes, each with whether it is provided and its producers' statuses. */
248
+ readonly artefacts: readonly ArtefactBasis<OpenIds>[];
249
+ /** The element, then every unfinished need reached from it, in model order. */
250
+ readonly chain: readonly WhyLink[];
251
+ }
252
+ /**
253
+ * The elements that are ready: not done, with every live need done.
254
+ * @param session - The store, model and facts.
255
+ */
256
+ export declare const ready: (session: GraphSession) => Promise<ReadyResult>;
257
+ /**
258
+ * What an element is waiting on.
259
+ * @param session - The store, model and facts.
260
+ * @param id - The element asked about.
261
+ */
262
+ export declare const blocked: (session: GraphSession, id: string) => Promise<BlockedResult>;
263
+ /**
264
+ * What depends on an element.
265
+ * @param session - The store, model and facts.
266
+ * @param id - The element asked about.
267
+ */
268
+ export declare const impactOf: (session: GraphSession, id: string) => Promise<ImpactResult>;
269
+ /**
270
+ * The critical path: the longest chain through the work still ahead.
271
+ * @param session - The store, model and facts.
272
+ */
273
+ export declare const path: (session: GraphSession) => Promise<PathResult>;
274
+ /**
275
+ * The cycles of the model that no decision closes, which make every status undefined.
276
+ * @param session - The store and model.
277
+ */
278
+ export declare const cycles: (session: GraphSession) => Promise<CyclesResult>;
279
+ /**
280
+ * The hand-offs: transitions from one actor's work to another's.
281
+ * @param session - The store and model.
282
+ */
283
+ export declare const handoffsOf: (session: GraphSession) => Promise<HandoffsResult>;
284
+ /**
285
+ * Why an element has its status, and the chain of unfinished work behind it.
286
+ * @param session - The store, model and facts.
287
+ * @param id - The element asked about.
288
+ */
289
+ export declare const why: (session: GraphSession, id: string) => Promise<WhyResult>;
290
+ //#endregion
291
+ //#region ../graph-cli/dist/show.d.ts
292
+ /** The views `show` draws, as named on the command line. */
293
+ export declare const viewNames: readonly ["flowchart", "swimlane", "state", "sequence"];
294
+ /** One of the views `show` draws. */
295
+ type ViewName = (typeof viewNames)[number];
296
+ /** The formats `show` writes. */
297
+ export declare const formatNames: readonly ["json", "mermaid", "dot"];
298
+ /** One of the formats `show` writes. */
299
+ type FormatName = (typeof formatNames)[number];
300
+ /** What to draw. */
301
+ interface ShowRequest {
302
+ readonly view: ViewName;
303
+ readonly format: FormatName;
304
+ /** The entity a state machine follows; the model's declared state machine projection when absent. */
305
+ readonly subject?: string;
306
+ /** The transitions a sequence diagram follows, in order; the model's declared sequence projection when absent. */
307
+ readonly scenario?: readonly string[];
308
+ }
309
+ /** A projected view, tagged by which it is. */
310
+ type ProjectedView = {
311
+ readonly view: "flowchart";
312
+ readonly projection: Flowchart<OpenIds>;
313
+ } | {
314
+ readonly view: "swimlane";
315
+ readonly projection: Swimlane<OpenIds>;
316
+ } | {
317
+ readonly view: "state";
318
+ readonly projection: StateMachine<OpenIds>;
319
+ } | {
320
+ readonly view: "sequence";
321
+ readonly projection: SequenceDiagram<OpenIds>;
322
+ };
323
+ /** A drawn view: the projection, and its text in the requested format (the projection as JSON for `json`). */
324
+ type ShowResult = ProjectedView & {
325
+ readonly format: FormatName;
326
+ readonly text: string;
327
+ };
328
+ /**
329
+ * Projects a model into a view.
330
+ * @param model - The model.
331
+ * @param request - The view, and the subject or scenario it needs.
332
+ * @returns The projection, tagged by view.
333
+ * @throws CliError with `usage` when a state machine or sequence diagram has nothing to follow, or the subject is not an entity, and with `notFound` when the subject or a scenario transition does not exist.
334
+ */
335
+ export declare const project: (model: Model<OpenIds>, request: Pick<ShowRequest, "view" | "subject" | "scenario">) => ProjectedView;
336
+ /**
337
+ * Writes a projected view as Mermaid or DOT source.
338
+ * @param model - The model, for participant labels.
339
+ * @param projected - The view.
340
+ * @param format - `mermaid` or `dot`.
341
+ * @returns The diagram source.
342
+ */
343
+ export declare const emit: (model: Model<OpenIds>, projected: ProjectedView, format: Exclude<FormatName, "json">) => string;
344
+ /**
345
+ * Draws the session's model as a view in a format.
346
+ * @param session - The store and model.
347
+ * @param request - The view, format, and the subject or scenario the view needs.
348
+ */
349
+ export declare const show: (session: GraphSession, request: ShowRequest) => Promise<ShowResult>;
350
+ //#endregion
351
+ //#region ../graph-cli/dist/edit.d.ts
352
+ /** A record to add to the model, by the part of the model it belongs to. */
353
+ type Addition = {
354
+ readonly kind: "participant";
355
+ readonly record: Participant<string>;
356
+ } | {
357
+ readonly kind: "element";
358
+ readonly record: Element<string, OpenIds>;
359
+ } | {
360
+ readonly kind: "event";
361
+ readonly record: EventDef<string>;
362
+ } | {
363
+ readonly kind: "artefact";
364
+ readonly record: ArtefactDef<string>;
365
+ } | {
366
+ readonly kind: "transition";
367
+ readonly record: Transition<string, OpenIds>;
368
+ };
369
+ /** A change the store accepted. */
370
+ interface Written {
371
+ /** The revision the change took. */
372
+ readonly revision: number;
373
+ }
374
+ /**
375
+ * Adds a record to the session's model, creating the model when the store has none. The store checks the result, so a duplicate identifier or a reference to something undeclared is rejected and nothing changes.
376
+ *
377
+ * The model is read and then saved whole, so a write made by another process between the two is overwritten.
378
+ * @param session - The store and model.
379
+ * @param addition - The record to add.
380
+ * @returns The revision the save took.
381
+ */
382
+ export declare const add: (session: GraphSession, addition: Addition) => Promise<Written>;
383
+ /** The run state an element was given. */
384
+ interface SetResult extends Written {
385
+ readonly element: string;
386
+ readonly state: OverlayStatus;
387
+ }
388
+ /**
389
+ * Sets an element's run state, leaving every other element's as it is.
390
+ * @param session - The store and model.
391
+ * @param id - The element.
392
+ * @param state - `done`, `open` or `unknown`.
393
+ * @returns The element, its new state and the revision the change took.
394
+ * @throws CliError with `notFound` when the model or the element does not exist.
395
+ */
396
+ export declare const setState: (session: GraphSession, id: string, state: OverlayStatus) => Promise<SetResult>;
397
+ //#endregion
398
+ //#region ../graph-cli/dist/validate.d.ts
399
+ /** One problem with a model. */
400
+ interface ValidationIssue {
401
+ /** What kind of problem: a `validate` issue code, `illegal-cycle`, or `schema` for a document whose shape is wrong. */
402
+ readonly code: string;
403
+ readonly message: string;
404
+ /** Where in a document the problem is, as a JSON pointer, for a shape problem. */
405
+ readonly pointer?: string;
406
+ }
407
+ /** Whether a model is valid, and every problem found. */
408
+ interface ValidateResult {
409
+ /** True exactly when `issues` is empty. */
410
+ readonly valid: boolean;
411
+ readonly issues: readonly ValidationIssue[];
412
+ }
413
+ /**
414
+ * Checks the session's stored model and run state: the structural rules of `validate`, run state naming elements the model lacks, and cycles no decision closes.
415
+ * @param session - The store and model.
416
+ */
417
+ export declare const validateStored: (session: GraphSession) => Promise<ValidateResult>;
418
+ /**
419
+ * Checks a model document, such as a file of JSON: its shape against the model schema (each problem located by JSON pointer), then the structural rules of `validate`, then cycles no decision closes. Text that is not JSON is one `schema` issue at the document itself.
420
+ * @param text - The document.
421
+ */
422
+ export declare const validateDocument: (text: string) => ValidateResult;
423
+ //#endregion
424
+ //#region ../graph-cli/dist/sync.d.ts
425
+ /** Finds the source that serves scopes with an identifier prefix, such as `github`. */
426
+ type SourceLookup = (prefix: string) => GraphSourceClient | undefined;
427
+ /** What to sync. */
428
+ interface SyncRequest {
429
+ /** Source-qualified scope identifiers, such as `github:owner` or `github:owner/repo`, read in order. */
430
+ readonly scopes: readonly string[];
431
+ /** A cursor from an interrupted sync: the first source's sync continues after it. */
432
+ readonly after?: string;
433
+ }
434
+ /** What a sync wrote. */
435
+ interface SyncResult {
436
+ readonly modelId: string;
437
+ /** The revision the write took. */
438
+ readonly revision: number;
439
+ /** The participants, activities and transitions written, each identifier counted once. */
440
+ readonly participants: number;
441
+ readonly activities: number;
442
+ readonly transitions: number;
443
+ /** The parts of the scope the sources could not read, in the order they were met. */
444
+ readonly gaps: readonly Gap[];
445
+ }
446
+ /**
447
+ * Reads every page of the scopes from their sources and merges them into the session's model in one write, creating the model when the store has none. Records already in the model are replaced by identifier and the rest are kept, so syncing again refreshes what changed.
448
+ *
449
+ * When a source fails part way, the pages read before the failure are still written, and the error says how to resume: the failing source's scopes with `--after` and the cursor of its last page read.
450
+ * @param session - The store and model.
451
+ * @param sources - The source for each identifier prefix.
452
+ * @param request - The scopes, and a cursor to resume after.
453
+ * @returns What was written, and the gaps the sources reported.
454
+ * @throws CliError with `usage` for a scope with no source prefix, a prefix no source serves, or `after` with scopes of more than one source; and with the source's failure, the resume command added, when a source refuses the sync.
455
+ */
456
+ export declare const sync: (session: GraphSession, sources: SourceLookup, request: SyncRequest) => Promise<SyncResult>;
457
+ //#endregion
458
+ //#region ../graph-cli/dist/emit/mermaid.d.ts
459
+ /**
460
+ * A flowchart as a Mermaid `flowchart`, top to bottom. Nodes are declared in the view's order, then edges, each with its guard as the edge label.
461
+ * @param view - The projected flowchart.
462
+ * @returns Mermaid source, ending with a line break.
463
+ */
464
+ export declare const flowchartToMermaid: <I extends IdSpace>(view: Flowchart<I>) => string;
465
+ /**
466
+ * A swimlane as a Mermaid `flowchart`, left to right, with one subgraph per lane in the view's lane order (an empty lane is an empty subgraph, so it stays visible) and nodes with no actor outside every lane. Hand-offs, the edges that change lane, are drawn thick.
467
+ * @param view - The projected swimlane.
468
+ * @returns Mermaid source, ending with a line break.
469
+ */
470
+ export declare const swimlaneToMermaid: <I extends IdSpace>(view: Swimlane<I>) => string;
471
+ /**
472
+ * A state machine as a Mermaid `stateDiagram-v2`. Initial and final pseudo-states are Mermaid's `[*]`; every other state is declared with its label. Each transition carries its event, guard and effect.
473
+ * @param view - The projected state machine.
474
+ * @returns Mermaid source, ending with a line break.
475
+ */
476
+ export declare const stateMachineToMermaid: <I extends IdSpace>(view: StateMachine<I>) => string;
477
+ /**
478
+ * A sequence diagram as a Mermaid `sequenceDiagram`. Lifelines are declared in order of first appearance, labelled through `participantLabel`; messages follow in scenario order, wrapped in the fragments the projection drew (`alt` operands separated by `else`, `par` operands by `and`), each operand headed by its guard.
479
+ * @param view - The projected sequence diagram.
480
+ * @param participantLabel - The label of a lifeline's participant.
481
+ * @returns Mermaid source, ending with a line break.
482
+ */
483
+ export declare const sequenceToMermaid: <I extends IdSpace>(view: SequenceDiagram<I>, participantLabel: (participant: I["actor"]) => string) => string;
484
+ //#endregion
485
+ //#region ../graph-cli/dist/emit/dot.d.ts
486
+ /**
487
+ * A flowchart as a Graphviz `digraph`, top to bottom. Nodes are named by their model identifiers, so the DOT source reads back to the model directly.
488
+ * @param view - The projected flowchart.
489
+ * @returns DOT source, ending with a line break.
490
+ */
491
+ export declare const flowchartToDot: <I extends IdSpace>(view: Flowchart<I>) => string;
492
+ /**
493
+ * A swimlane as a Graphviz `digraph`, left to right, with one `cluster` subgraph per lane in the view's lane order and nodes with no actor outside every lane. An empty lane holds one invisible point so Graphviz still draws it. Hand-offs, the edges that change lane, are drawn bold.
494
+ * @param view - The projected swimlane.
495
+ * @returns DOT source, ending with a line break.
496
+ */
497
+ export declare const swimlaneToDot: <I extends IdSpace>(view: Swimlane<I>) => string;
498
+ /**
499
+ * A state machine as a Graphviz `digraph`, left to right. Each transition is labelled with its event, guard and effect.
500
+ * @param view - The projected state machine.
501
+ * @returns DOT source, ending with a line break.
502
+ */
503
+ export declare const stateMachineToDot: <I extends IdSpace>(view: StateMachine<I>) => string;
504
+ /**
505
+ * A sequence diagram as a Graphviz `digraph`. DOT has no sequence notation, so the diagram is drawn as a grid: a column per lifeline, headed by its participant's label, with one row per message in scenario order. Each message is an arrow across its row, numbered by its step and prefixed with the fragments around it (operator and guard, outermost first), since DOT cannot draw a box around arrows.
506
+ * @param view - The projected sequence diagram.
507
+ * @param participantLabel - The label of a lifeline's participant.
508
+ * @returns DOT source, ending with a line break.
509
+ */
510
+ export declare const sequenceToDot: <I extends IdSpace>(view: SequenceDiagram<I>, participantLabel: (participant: I["actor"]) => string) => string;
511
+ //#endregion
512
+ export type { Addition, BlockedResult, CliPorts, CyclesResult, ElementStatus, ElementSummary, ExitCode, Failure, FormatName, GraphSession, HandoffsResult, ImpactResult, NodePortsOptions, OpenedStore, PathResult, ProgramIdentity, ProjectedView, ReadyResult, SetResult, ShowRequest, ShowResult, SourceLookup, StoredRun, SyncRequest, SyncResult, ValidateResult, ValidationIssue, ViewName, WhyLink, WhyResult, Written };
package/dist/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ import { t as exitCodes } from "./exit-codes-0ultCqdS.js";
2
+ import { A as add, C as blocked, D as path, E as impactOf, F as failureOf, M as findRun, N as loadRun, O as ready, P as CliError, S as swimlaneToMermaid, T as handoffsOf, _ as stateMachineToDot, a as defaultModelId, b as sequenceToMermaid, c as validateStored, d as formatNames, f as project, g as sequenceToDot, h as flowchartToDot, i as runProcess, j as setState, k as why, l as sync, m as viewNames, n as nodePorts, o as runCli, p as show, r as packageVersion, s as validateDocument, t as defaultDataPath, u as emit, v as swimlaneToDot, w as cycles, x as stateMachineToMermaid, y as flowchartToMermaid } from "./dist-HLlW8vgT.js";
3
+ export { CliError, add, blocked, cycles, defaultDataPath, defaultModelId, emit, exitCodes, failureOf, findRun, flowchartToDot, flowchartToMermaid, formatNames, handoffsOf, impactOf, loadRun, nodePorts, packageVersion, path, project, ready, runCli, runProcess, sequenceToDot, sequenceToMermaid, setState, show, stateMachineToDot, stateMachineToMermaid, swimlaneToDot, swimlaneToMermaid, sync, validateDocument, validateStored, viewNames, why };