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