import type { EmittedModel } from '@substrat-run/contracts'; /** * `substrat model view` — the entity model as something a human can look at. * * It reads `model.json`, never the TypeScript. That file is the artifact of record (#697): * `lint:model --check` gates it, and `tools/model-diff.mts` says outright that everything * downstream should read it — which keeps this renderer correct across a change of * authoring notation, and keeps it honest about what actually shipped. * * The RENDERING lives in `@substrat-run/model-view` — the pure core this file wraps, shared * with the dashboard's Model tab (#1214) so both surfaces draw the same page from the same * artifact. What stays here is the filesystem half: resolving a directory to its * `model.json`, and where the rendered file lands. * * The output is ONE self-contained HTML file: inline CSS, inline SVG, no script, no CDN. * That is what makes it openable from a file path — a click in a chat pane, `open` on a * Mac, a browser tab — with no server and no network. A view that fetched a stylesheet * would render unstyled exactly where it is most wanted, on a laptop with no connectivity * or behind a proxy, so the no-external-reference property is asserted by the suite. * * It defaults to writing OUTSIDE the project (a temp directory), because a rendered view * is not a build output: dropping a generated `model.html` next to the source would put an * un-gated generated file in someone's repo, which is precisely what the three-marks rule * says not to do. `--out` places it deliberately. */ export { renderModelHtml, parseModel, type ModelViewSource } from '@substrat-run/model-view'; export interface ModelViewOptions { /** The `model.json` the view was rendered from, as displayed. */ readonly source: string; /** Where to write. Defaults to a temp path derived from the model's directory. */ readonly out?: string; } export interface ModelViewResult { /** Absolute path written. */ readonly file: string; /** How many entities the view covers — the one number worth printing. */ readonly entities: number; } /** * A directory or the file itself → the `model.json` to read. * * A directory is the common case (`substrat model view .` from inside a vertical), and the * artifact's location is a convention `tools/model-diff.mts` owns: the package root. */ export declare function resolveModelPath(target: string): string; /** Parse a `model.json` file, refusing anything that is not one rather than rendering an empty page. */ export declare function readModel(file: string): EmittedModel; /** * Default output path: a temp file named for the model's directory. * * Deliberately not beside `model.json`: a view written into the project would be an * un-gated generated file in someone's repo, and this one is a thing you look at, not a * thing you commit. Stable across runs, so a re-render replaces the tab you already have * open rather than leaving a trail of files behind. * * The directory's basename alone is not enough to be stable AND distinct — a monorepo with * `apps/a/api` and `apps/b/api` would have the second render silently replace the first * one's view — so the full resolved directory is hashed into the name. */ export declare function defaultOutPath(modelFile: string): Promise; /** Read, render, write. Returns the absolute path — the thing worth printing. */ export declare function writeModelView(target: string, opts?: { readonly out?: string; }): Promise; //# sourceMappingURL=model.d.ts.map