1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Default, Deserialize, JsonSchema)]
pub struct AnalyzeParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file (.fallowrc.json or fallow.toml).
pub config: Option<String>,
/// Only analyze production code (excludes tests, stories, dev files).
pub production: Option<bool>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Issue types to include. When set, only these types are reported.
/// Valid values: unused-files, unused-exports, unused-types, unused-deps,
/// unused-enum-members, unused-class-members, unresolved-imports,
/// unlisted-deps, duplicate-exports, circular-deps, boundary-violations.
pub issue_types: Option<Vec<String>>,
#[schemars(
description = "Set to true to check only boundary violations. Convenience alias for issue_types: [\"boundary-violations\"]"
)]
pub boundary_violations: Option<bool>,
/// Compare results against a saved baseline file. Only new issues (not in the baseline) are reported.
pub baseline: Option<String>,
/// Save current results as a baseline file for future comparisons.
pub save_baseline: Option<String>,
/// Fail if issue counts regressed compared to the regression baseline.
pub fail_on_regression: Option<bool>,
/// Regression tolerance. Accepts a percentage ("2%") or absolute count ("5").
pub tolerance: Option<String>,
/// Path to a regression baseline file to compare against.
pub regression_baseline: Option<String>,
/// Save current results as a regression baseline file for future comparisons.
pub save_regression_baseline: Option<String>,
/// Group results by owner (from CODEOWNERS) or directory. Values: "owner", "directory".
pub group_by: Option<String>,
/// Only report issues in the specified file(s). Useful for lint-staged pre-commit hooks.
/// Dependency-level issues are suppressed in file mode.
pub file: Option<Vec<String>>,
/// Report unused exports in entry files instead of auto-marking them as used.
/// Catches typos in framework exports (e.g., `meatdata` instead of `metadata`).
pub include_entry_exports: Option<bool>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}
#[derive(Deserialize, JsonSchema)]
pub struct CheckChangedParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Git ref to compare against (e.g., "main", "HEAD~5", a commit SHA).
/// Only files changed since this ref are reported.
pub since: String,
/// Path to fallow config file.
pub config: Option<String>,
/// Only analyze production code.
pub production: Option<bool>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Compare results against a saved baseline file. Only new issues (not in the baseline) are reported.
pub baseline: Option<String>,
/// Save current results as a baseline file for future comparisons.
pub save_baseline: Option<String>,
/// Fail if issue counts regressed compared to the regression baseline.
pub fail_on_regression: Option<bool>,
/// Regression tolerance. Accepts a percentage ("2%") or absolute count ("5").
pub tolerance: Option<String>,
/// Path to a regression baseline file to compare against.
pub regression_baseline: Option<String>,
/// Save current results as a regression baseline file for future comparisons.
pub save_regression_baseline: Option<String>,
/// Report unused exports in entry files instead of auto-marking them as used.
pub include_entry_exports: Option<bool>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct FindDupesParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file (.fallowrc.json or fallow.toml).
pub config: Option<String>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Detection mode: "strict" (exact tokens), "mild" (normalized identifiers),
/// "weak" (structural only), or "semantic" (type-aware). Defaults to "mild".
pub mode: Option<String>,
/// Minimum token count for a clone to be reported. Default: 50.
pub min_tokens: Option<u32>,
/// Minimum line count for a clone to be reported. Default: 5.
pub min_lines: Option<u32>,
/// Fail if duplication percentage exceeds this value. 0 = no limit.
pub threshold: Option<f64>,
/// Skip file-local duplicates, only report cross-file clones.
pub skip_local: Option<bool>,
/// Enable cross-language detection (strip TS type annotations for TS<->JS matching).
pub cross_language: Option<bool>,
/// Show only the N largest clone groups.
pub top: Option<usize>,
/// Compare results against a saved baseline file. Only new issues (not in the baseline) are reported.
pub baseline: Option<String>,
/// Save current results as a baseline file for future comparisons.
pub save_baseline: Option<String>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
#[schemars(
description = "Only report issues in files changed since this git ref (branch, tag, or commit SHA)"
)]
pub changed_since: Option<String>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct FixParams {
/// Root directory of the project. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file.
pub config: Option<String>,
/// Only analyze production code (excludes tests, stories, dev files).
pub production: Option<bool>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct ProjectInfoParams {
/// Root directory of the project. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file.
pub config: Option<String>,
#[schemars(description = "Show detected entry points")]
pub entry_points: Option<bool>,
#[schemars(description = "Show all discovered source files")]
pub files: Option<bool>,
#[schemars(description = "Show active framework plugins")]
pub plugins: Option<bool>,
#[schemars(description = "Show architecture boundary zones, rules, and per-zone file counts")]
pub boundaries: Option<bool>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct HealthParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file (.fallowrc.json or fallow.toml).
pub config: Option<String>,
/// Maximum cyclomatic complexity threshold. Functions exceeding this are reported.
pub max_cyclomatic: Option<u16>,
/// Maximum cognitive complexity threshold. Functions exceeding this are reported.
pub max_cognitive: Option<u16>,
/// Number of top results to return, sorted by complexity.
pub top: Option<usize>,
/// Sort order for results (e.g., "cyclomatic", "cognitive").
pub sort: Option<String>,
/// Git ref to compare against. Only files changed since this ref are analyzed.
pub changed_since: Option<String>,
/// Show only complexity findings. By default all sections are shown; use this to select only complexity.
pub complexity: Option<bool>,
/// Show only per-file health scores (fan-in, fan-out, dead code ratio, maintainability index).
pub file_scores: Option<bool>,
/// Show only hotspots: files that are both complex and frequently changing.
pub hotspots: Option<bool>,
/// Show only refactoring targets: ranked recommendations based on complexity, coupling, churn, and dead code.
pub targets: Option<bool>,
/// Show static test coverage gaps: runtime files and exports with no test dependency path.
pub coverage_gaps: Option<bool>,
/// Show only the project health score (0–100) with letter grade (A/B/C/D/F).
/// Forces full pipeline for maximum accuracy.
pub score: Option<bool>,
/// Fail if the health score is below this threshold (0–100). Implies --score.
pub min_score: Option<f64>,
/// Git history window for hotspot analysis. Accepts durations (6m, 90d, 1y) or ISO dates.
pub since: Option<String>,
/// Minimum commits for a file to appear in hotspot ranking.
pub min_commits: Option<u32>,
/// Scope output to a single workspace package.
pub workspace: Option<String>,
/// Only analyze production code (excludes tests, stories, dev files).
pub production: Option<bool>,
/// Save a vital signs snapshot. Provide a file path, or omit value for default (`.fallow/snapshots/{timestamp}.json`).
pub save_snapshot: Option<String>,
/// Compare results against a saved baseline file. Only new issues (not in the baseline) are reported.
pub baseline: Option<String>,
/// Save current results as a baseline file for future comparisons.
pub save_baseline: Option<String>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
/// Compare current metrics against the most recent saved snapshot and show per-metric deltas.
/// Implies --score. Reads from `.fallow/snapshots/`.
pub trend: Option<bool>,
/// Analysis effort level. Controls the depth of analysis: "low" (fast, surface-level),
/// "medium" (balanced, default), "high" (thorough, includes all heuristics).
pub effort: Option<String>,
/// Include a natural-language summary of findings alongside the structured JSON output.
pub summary: Option<bool>,
/// Path to Istanbul-format coverage data (coverage-final.json) for accurate per-function CRAP scores.
/// Accepts a file path or a directory containing coverage-final.json.
pub coverage: Option<String>,
/// Rebase file paths in coverage data by stripping this prefix and prepending the project root.
/// Use when coverage was generated in a different environment (CI runner, Docker).
pub coverage_root: Option<String>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct AuditParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file (.fallowrc.json or fallow.toml).
pub config: Option<String>,
/// Git ref to compare against (e.g., "main", "HEAD~5").
/// Auto-detects the default branch if not specified.
pub base: Option<String>,
/// Only analyze production code (excludes tests, stories, dev files).
pub production: Option<bool>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}
/// Parameters for `list_boundaries`.
#[derive(Debug, Default, serde::Deserialize, schemars::JsonSchema)]
pub struct ListBoundariesParams {
#[schemars(description = "Project root directory (defaults to current working directory)")]
pub root: Option<String>,
#[schemars(description = "Path to a fallow config file")]
pub config: Option<String>,
#[schemars(description = "Disable the incremental parse cache")]
pub no_cache: Option<bool>,
#[schemars(description = "Number of threads for file parsing (defaults to CPU core count)")]
pub threads: Option<usize>,
}
#[derive(Default, Deserialize, JsonSchema)]
pub struct FeatureFlagsParams {
/// Root directory of the project to analyze. Defaults to current working directory.
pub root: Option<String>,
/// Path to fallow config file (.fallowrc.json or fallow.toml).
pub config: Option<String>,
/// Only analyze production code (excludes tests, stories, dev files).
pub production: Option<bool>,
/// Scope analysis to a specific workspace package name.
pub workspace: Option<String>,
/// Filter by flag type: "environment_variable", "sdk_call", or "config_object".
#[expect(
dead_code,
reason = "exposed via JSON Schema for agent discovery; CLI filter pending"
)]
pub flag_type: Option<String>,
/// Filter by detection confidence: "high", "medium", or "low".
#[expect(
dead_code,
reason = "exposed via JSON Schema for agent discovery; CLI filter pending"
)]
pub confidence: Option<String>,
/// Disable the incremental parse cache. Forces a full re-parse of all files.
pub no_cache: Option<bool>,
/// Number of parser threads. Defaults to available CPU cores.
pub threads: Option<usize>,
}