# types/document.output.types.ts

> 87 lines of code and 18 definitions.

Tree: GovLab Docs
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/docs#file-docs-types-document-output-types-ts
Source text: https://banes-lab.com/source/docs/types/document.output.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/docs/types.md), after [types/diagram.types.ts](https://banes-lab.com/source/docs/types/diagram.types.ts.md) and before [types/document.types.ts](https://banes-lab.com/source/docs/types/document.types.ts.md).

## Definitions

- `Spec` (interface_declaration, line 6, exported)
- `SharedOutputs` (interface_declaration, line 18, exported)
- `OutputTarget` (interface_declaration, line 24, exported)
- `WorkspaceMap` (interface_declaration, line 29, exported)
- `IndexTargets` (interface_declaration, line 33, exported)
- `DocModule` (interface_declaration, line 38, exported)
- `ModuleOutput` (interface_declaration, line 45, exported)
- `ModuleSelection` (interface_declaration, line 50, exported)
- `CheckOptions` (interface_declaration, line 55, exported)
- `DocChecksDeps` (interface_declaration, line 59, exported)
- `SpecEngine` (type_alias_declaration, line 68, exported)
- `SpecOutputsDeps` (interface_declaration, line 70, exported)
- `WorkspaceMapDeps` (interface_declaration, line 77, exported)
- `HealOutcome` (type_alias_declaration, line 85, exported)
- `HealState` (interface_declaration, line 87, exported)
- `HealResult` (interface_declaration, line 92, exported)
- `GovernanceEngine` (type_alias_declaration, line 97, exported)
- `ReadmeContext` (interface_declaration, line 102, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/docs/folder-docs-types.md)

## Source

```typescript
import type { Manifest, ModuleDocs } from "#types/readme.types";
import type { Charts } from "#types/figure.types";
import type { DocumentDecl } from "#types/document.types";
import type { ManifestModule } from "#types/manifest.types";

export interface Spec {
    driftCode: string;
    gate?: (content: string) => Promise<{ findings: { line: number; message: string }[] }>;
    gateCode?: string;
    harden?: boolean;
    label: string;
    mkdir?: boolean;
    normalize: (text: string) => string;
    path: string;
    produce: (onDisk: string) => Promise<string> | string;
}

export interface SharedOutputs {
    charts: Charts | null;
    hasCharts: boolean;
    isAggregate: boolean;
}

export interface OutputTarget {
    path: string;
    rel: string;
}

export interface WorkspaceMap extends OutputTarget {
    content: string;
}

export interface IndexTargets {
    json: OutputTarget;
    markdown: OutputTarget;
}

export interface DocModule {
    dir: string;
    label: string;
    manifest: Manifest;
    relPath: string;
}

export interface ModuleOutput {
    shared: SharedOutputs;
    specs: Spec[];
}

export interface ModuleSelection {
    only: ReadonlySet<string> | null;
    workspaceMapOnly: boolean;
}

export interface CheckOptions extends ModuleSelection {
    fix: boolean;
}

export interface DocChecksDeps {
    workspaceMapTarget: () => Promise<WorkspaceMap | null>;
    discoverAll: () => ManifestModule[];
    engine: ModuleDocs;
    generatedPrefix: string;
    moduleOutputs: (module: DocModule) => Promise<ModuleOutput>;
    writeSpec: (spec: Spec, content: string) => void;
}

export type SpecEngine = Pick<ModuleDocs, "declaredDocLocation" | "generateReadme" | "renderDeclaredDoc">;

export interface SpecOutputsDeps {
    discoverAll: () => ManifestModule[];
    engine: SpecEngine;
    formatMarkdown: (markdown: string) => Promise<string>;
    root: string;
}

export interface WorkspaceMapDeps {
    declaredDocLocation: (doc: DocumentDecl) => string;
    discoverAll: () => ManifestModule[];
    formatMarkdown: (markdown: string) => Promise<string>;
    renderDeclaredDoc: (doc: DocumentDecl) => string;
    root: string;
}

export type HealOutcome = "drift" | "healed" | "rewritten";

export interface HealState {
    prior: string;
    remaining: number;
}

export interface HealResult {
    content: string;
    outcome: HealOutcome;
}

export type GovernanceEngine = Pick<
    ModuleDocs,
    "governConcepts" | "governDeclaredDocs" | "governManifest" | "governPrinciples"
>;

export interface ReadmeContext {
    generatedPrefix: string;
    onDiskReadme: string;
}
```
