Selected type contracts

Dotdog 1.0 can inspect one exported TypeScript contract and its bounded declared-type references. Specs retain intended behavior; compiler checks enforce encoded constraints; graphs retain relationships and evidence. None substitutes for behavioral tests or runtime input validation.

Requirements

The adapter is version-specific because it uses typescript/unstable/sync. Other versions fail explicitly rather than silently using a different compiler/configuration. Bun entry points use a bounded Node worker because this compiler’s synchronous transport does not work under Bun. Run only a trusted project-installed compiler; version metadata does not authenticate its publisher.

Inspect, import and query

This example uses Dotdog’s existing public workspace types from a development checkout:

node packages/dotdog/dist/cli.js types inspect WorkspaceConfig --file packages/dotdog/src/workspace/types.ts --project packages/dotdog/tsconfig.json --json > type-contracts.json &&
node packages/dotdog/dist/cli.js graph import type-contracts.json --project types
node packages/dotdog/dist/cli.js impact 'packages/dotdog/src/workspace/types.ts#RepoConfig' --dag .doghouse/imported/types.dag --json
node packages/dotdog/dist/cli.js graph audit --dag .doghouse/imported/types.dag --profile evidence --json

Only import an inspection that exits successfully. In another project, select its own configuration, source file and export. A re-export resolves to the actual declaration; the returned selectedId is the exact root identity. IDs contain declaration positions and can change after edits. Labels are file-qualified, so repeated names are not silently joined.

The saved graph works with existing context, impact, path and MCP queries. No MCP query launches the compiler. Source/binary or authored-spec links are not inferred from matching names; keep requirement-to-type/test links explicit and reviewed.

What results mean

The adapter handles tested selected signatures, overloads, unions, aliases/re-exports and repeated names. External or unresolved declarations and traversal/budget omissions stay explicit. Project-reference builds, composite projects and noCheck configurations are unsupported. A compiler pass is conditional on the original configuration; it does not verify whether the encoded rule is the right business rule.

Boundaries

Inspection uses the original configured project without declaration emit, config edits or project build output. Inputs are cached during inspection and their digests checked afterward; this is not race-free multi-user filesystem isolation or continuous freshness monitoring.

Limits: 30 seconds; 512 read inputs/32 MiB combined input bytes; 64 contracts/64 KiB signature text; 10,000 visited declaration nodes/depth 128; 100 returned diagnostics; 1 MiB combined worker output. These are processing bounds, not a general peak-memory guarantee. Root extraction failures are non-passes; truncated dependency context is explicitly partial. Timeout/output-limit handling terminates the worker process tree.

Source signatures and literal types may contain sensitive project data. Review exported graphs before sharing. Graph text is data, not permission or instructions. The default evidence audit is artifact traceability; it does not introduce a simulator, cloud service, device operation or another graph backend.

Further reading

Practical type-driven development guide · REA/Ghidra graph guide · Research and product notes