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/// Inline health threshold override comments.
62pub mod inline_threshold;
63/// Shared issue-type contract metadata used by CLI, LSP, MCP, and suppression
64/// helpers.
65pub mod issue_meta;
66/// Levenshtein distance and closest-match policy for typo suggestions.
67pub mod levenshtein;
68/// Machine-readable manifest of the fallow MCP server's tools, shared by
69/// `fallow schema` and the telemetry tool-name allowlist; kept in sync with
70/// the live tool router by a drift test in `crates/mcp`.
71pub mod mcp_manifest;
72/// JSON-output augmentation types: `IssueAction` enum + variants.
73/// Schema-side counterpart of the augmentations the JSON layer adds to each
74/// dead-code finding. The structs are always compiled (typed dead-code
75/// wrappers in [`output_dead_code`] consume them at runtime); the
76/// `schemars::JsonSchema` derive is gated per-struct on the `schema`
77/// feature.
78pub mod output;
79/// Typed envelope wrappers for the simple 1:1 dead-code findings
80/// (`UnusedFile`, `PrivateTypeLeak`, `UnresolvedImport`, `CircularDependency`,
81/// `BoundaryViolation`). Each wrapper flattens the bare finding via
82/// `#[serde(flatten)]` and creates a typed `actions` array at construction.
83/// The `introduced` field defaults to `None`. The audit pass inserts it into the
84/// JSON output. Each wrapper derives `schemars::JsonSchema` only with `schema`.
85pub mod output_dead_code;
86/// Shared output-format selector used by CLI, config, output, and API layers.
87pub mod output_format;
88/// Per-action types attached to health findings, hotspots, refactoring
89/// targets, and coverage-gap entries. Separated from the generic
90/// `IssueAction` tree in the `output` module so the health-specific
91/// variants live in a dedicated module. The structs are always compiled
92/// (the JSON emission layer constructs them through typed wrappers such as
93/// [`output_health::UntestedFileAction`]); the `schemars::JsonSchema`
94/// derive is gated per-struct on the `schema` feature.
95pub mod output_health;
96/// Refuse cache writes through a symlink that leaves the project.
97pub mod path_guard;
98/// Cross-platform path classification helpers.
99pub mod path_util;
100/// The `--performance` span tree and the process-level clock.
101pub mod pipeline_spans;
102/// Analysis result types: unused files, exports, dependencies, and members.
103pub mod results;
104/// The `Next:` step of a `client-server-leak` candidate, shared by the CLI
105/// and the LSP hover.
106pub mod security_next_step;
107/// Security sink names shared by the extractor and the sink catalogue.
108pub mod security_sinks;
109/// The line-free input of the stable id of a security finding.
110pub mod security_stable_id;
111/// Shared TypeScript semantic identity, provenance, API surface, impact, and
112/// public-signature coupling contracts.
113pub mod semantic;
114/// Custom serde serializers for cross-platform path output.
115pub mod serde_path;
116/// Transient source-extraction contracts for provider-backed similar-code analysis.
117pub mod similar_code;
118/// Shared source-file freshness metadata used by cache invalidation.
119pub mod source_fingerprint;
120/// Values with the cause of their value: the input layer, the scope, and the
121/// flag, variable, config key or default that gave the value.
122pub mod sourced;
123/// Inline suppression comment types and issue kind definitions.
124pub mod suppress;
125/// Agent task-to-command matrix rows shared by `fallow schema`, the
126/// `init --agents` template, the agent hook block, root `--help`, and the
127/// `fallow://task-matrix` MCP resource. Data only; the CLI owns rendering.
128pub mod task_matrix;
129/// Trace output contracts shared by core, engine, CLI, API, and MCP.
130pub mod trace;
131/// Symbol-level trace-chain output contracts.
132pub mod trace_chain;
133/// Stack-trace frame resolution output contracts (`fallow trace-error`).
134pub mod trace_error;
135/// Per-specifier dependency usage contracts (`fallow trace --dependency`).
136pub mod trace_usage;
137/// Workspace and source-discovery diagnostic data types
138/// (`WorkspaceDiagnostic`, `WorkspaceDiagnosticKind`). Re-exported by
139/// `fallow-config` for back-compat; embedded directly by `fallow-output` so
140/// `workspace_diagnostics[]` keeps its typed JSON schema. The
141/// `schemars::JsonSchema` derive is gated on the `schema` feature.
142pub mod workspace;
143
144/// The `tracing` target of a warning that repeats a fact the JSON envelope
145/// carries, or that describes the quality of the analysis inputs.
146///
147/// `--quiet`, `--ci` and `FALLOW_QUIET` hide this target on stderr. An explicit
148/// `RUST_LOG` shows it again. Config-load warnings, such as an unknown rule
149/// key, do not use this target, so they stay visible in a quiet run.
150pub const ANALYSIS_DIAGNOSTIC_LOG_TARGET: &str = "fallow::analysis_diagnostic";
151
152/// Optional architecture shared-state facts and inventory.
153pub mod shared_state;