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