Skip to main content

fallow_types/
lib.rs

1//! Shared types for fallow codebase intelligence.
2//!
3//! This crate contains type definitions used across multiple fallow crates
4//! (core, CLI, LSP). It has no analysis logic, only data structures.
5
6#![warn(missing_docs)]
7#![cfg_attr(
8    test,
9    allow(
10        clippy::unwrap_used,
11        clippy::expect_used,
12        reason = "tests use unwrap and expect to keep fixture setup concise"
13    )
14)]
15
16/// Atomic cache-file replacement, shared by the extraction cache and the graph
17/// cache so concurrent fallow processes never interleave a write.
18pub mod atomic_file;
19/// Typed audit cache-key inputs.
20pub mod audit_cache;
21/// Why a persisted cache was refused, shared by the extraction cache, the
22/// graph cache, the perf table, and `fallow doctor`.
23pub mod cache_rejection;
24/// Shared churn output contracts.
25pub mod churn;
26/// Cross-surface strings for the cloud runtime-coverage path, shared by the
27/// CLI's cloud `coverage` commands and the MCP cloud tools.
28pub mod cloud;
29/// One row per analysis subcommand: its JSON kinds and the surfaces that must
30/// know about it. Drift tests across the workspace read this table.
31pub mod command_surfaces;
32/// File discovery types: discovered files, file IDs, and entry points.
33pub mod discover;
34/// Shared duplicate-code output contracts.
35pub mod duplicates;
36/// JSON-output envelope and utility types: `SchemaVersion`, `ToolVersion`,
37/// `ElapsedMs`, `AuditIntroduced`, plus the shared `Meta`, `BaselineDeltas`,
38/// `BaselineMatch`, `RegressionResult`, `EntryPoints`, and `CheckSummary`
39/// shapes referenced by every per-command envelope. The structs are always
40/// compiled (the JSON emission layer constructs them at runtime); the
41/// `schemars::JsonSchema` derive is gated per-struct on the `schema` feature.
42pub mod envelope;
43/// Where a fact sits on each JSON envelope shape, shared by the surfaces that
44/// read a saved envelope back rather than holding the run's typed state.
45pub mod envelope_sites;
46/// Module extraction types: exports, imports, re-exports, and member info.
47pub mod extract;
48pub mod flag_retirement;
49/// Guard output contracts for pre-edit architecture-rule lookup.
50pub mod guard;
51/// Stable finding identity: the shared FNV-1a 64 hash and dead-code
52/// `finding_id` values.
53pub mod identity;
54/// Shared issue-type contract metadata used by CLI, LSP, MCP, and suppression
55/// helpers.
56pub mod issue_meta;
57/// Levenshtein distance and closest-match policy for typo suggestions.
58pub mod levenshtein;
59/// Machine-readable manifest of the fallow MCP server's tools, shared by
60/// `fallow schema` and the telemetry tool-name allowlist; kept in sync with
61/// the live tool router by a drift test in `crates/mcp`.
62pub mod mcp_manifest;
63/// JSON-output augmentation types: `IssueAction` enum + variants.
64/// Schema-side counterpart of the augmentations the JSON layer adds to each
65/// dead-code finding. The structs are always compiled (typed dead-code
66/// wrappers in [`output_dead_code`] consume them at runtime); the
67/// `schemars::JsonSchema` derive is gated per-struct on the `schema`
68/// feature.
69pub mod output;
70/// Typed envelope wrappers for the simple 1:1 dead-code findings
71/// (`UnusedFile`, `PrivateTypeLeak`, `UnresolvedImport`, `CircularDependency`,
72/// `BoundaryViolation`). Each wrapper flattens the bare finding via
73/// `#[serde(flatten)]` and carries a typed `actions` array populated at
74/// construction time, replacing the per-finding post-pass injection that
75/// previously grafted `actions[]` and `introduced` onto the schema. The
76/// `introduced` field is set by the audit pass via JSON map insertion and
77/// is `None` when serialized directly from Rust. The `schemars::JsonSchema`
78/// derive is gated per-struct on the `schema` feature.
79pub mod output_dead_code;
80/// Shared output-format selector used by CLI, config, output, and API layers.
81pub mod output_format;
82/// Per-action types attached to health findings, hotspots, refactoring
83/// targets, and coverage-gap entries. Separated from the generic
84/// `IssueAction` tree in the `output` module so the health-specific
85/// variants live in a dedicated module. The structs are always compiled
86/// (the JSON emission layer constructs them through typed wrappers such as
87/// [`output_health::UntestedFileAction`]); the `schemars::JsonSchema`
88/// derive is gated per-struct on the `schema` feature.
89pub mod output_health;
90/// Cross-platform path classification helpers.
91pub mod path_util;
92/// The `--performance` span tree and the process-level clock.
93pub mod pipeline_spans;
94/// Analysis result types: unused files, exports, dependencies, and members.
95pub mod results;
96/// Shared TypeScript semantic identity, provenance, API surface, impact, and
97/// public-signature coupling contracts.
98pub mod semantic;
99/// Custom serde serializers for cross-platform path output.
100pub mod serde_path;
101/// Transient source-extraction contracts for provider-backed similar-code analysis.
102pub mod similar_code;
103/// Shared source-file freshness metadata used by cache invalidation.
104pub mod source_fingerprint;
105/// Inline suppression comment types and issue kind definitions.
106pub mod suppress;
107/// Agent task-to-command matrix rows shared by `fallow schema`, the
108/// `init --agents` template, the agent hook block, root `--help`, and the
109/// `fallow://task-matrix` MCP resource. Data only; the CLI owns rendering.
110pub mod task_matrix;
111/// Trace output contracts shared by core, engine, CLI, API, and MCP.
112pub mod trace;
113/// Symbol-level trace-chain output contracts.
114pub mod trace_chain;
115/// Stack-trace frame resolution output contracts (`fallow trace-error`).
116pub mod trace_error;
117/// Per-specifier dependency usage contracts (`fallow trace --dependency`).
118pub mod trace_usage;
119/// Workspace and source-discovery diagnostic data types
120/// (`WorkspaceDiagnostic`, `WorkspaceDiagnosticKind`). Re-exported by
121/// `fallow-config` for back-compat; embedded directly by `fallow-output` so
122/// `workspace_diagnostics[]` keeps its typed JSON schema. The
123/// `schemars::JsonSchema` derive is gated on the `schema` feature.
124pub mod workspace;