dart-decimate 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/manifest.rs CHANGED
@@ -147,14 +147,14 @@ fn analysis_commands() -> Value {
147
147
  "kind": "combined",
148
148
  "description": "Run all enabled graph, symbol, dependency, duplicate, health, flag, and security checks.",
149
149
  "schema": SCHEMA_VERSION,
150
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--boundary", "--boundary-coverage", "--boundary-call", "--policy-pack", "--policy-violations", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports", "--include-entry-exports", "--private-type-leaks", "--unused-files", "--unused-exports", "--unused-types", "--unused-deps", "--unlisted-deps", "--private-src-imports", "--duplicate-exports", "--circular-deps", "--re-export-cycles", "--boundary-violations", "--unused-enum-members", "--unused-class-members", "--unresolved-imports", "--stale-suppressions", "--unused-dependency-overrides", "--misconfigured-dependency-overrides"]
150
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--boundary", "--boundary-coverage", "--boundary-call", "--policy-pack", "--policy-violations", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports", "--include-entry-exports", "--private-type-leaks", "--unused-files", "--unused-exports", "--unused-types", "--unused-deps", "--unlisted-deps", "--private-src-imports", "--duplicate-exports", "--circular-deps", "--re-export-cycles", "--boundary-violations", "--unused-enum-members", "--unused-class-members", "--unresolved-imports", "--stale-suppressions", "--unused-dependency-overrides", "--misconfigured-dependency-overrides"]
151
151
  },
152
152
  {
153
153
  "name": "audit",
154
154
  "kind": "audit",
155
155
  "description": "Run changed-code graph checks scoped from a Git base ref.",
156
156
  "schema": SCHEMA_VERSION,
157
- "flags": ["--root", "--brief", "--base", "--gate", "--dead-code-baseline", "--health-baseline", "--dupes-baseline", "--max-decisions", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--boundary", "--boundary-coverage", "--boundary-call", "--policy-pack", "--policy-violations", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports", "--include-entry-exports", "--private-type-leaks"]
157
+ "flags": ["--root", "--brief", "--base", "--gate", "--dead-code-baseline", "--health-baseline", "--dupes-baseline", "--max-decisions", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--boundary", "--boundary-coverage", "--boundary-call", "--policy-pack", "--policy-violations", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports", "--include-entry-exports", "--private-type-leaks"]
158
158
  },
159
159
  {
160
160
  "name": "review",
@@ -175,42 +175,42 @@ fn analysis_commands() -> Value {
175
175
  "kind": "dead-code",
176
176
  "description": "Find unreachable Dart files and conservative symbol-level dead code.",
177
177
  "schema": SCHEMA_VERSION,
178
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--include-entry-exports", "--private-type-leaks", "--unused-files", "--unused-exports", "--unused-types", "--unused-deps", "--unlisted-deps", "--private-src-imports", "--duplicate-exports", "--unused-enum-members", "--unused-class-members", "--unresolved-imports", "--stale-suppressions", "--unused-dependency-overrides", "--misconfigured-dependency-overrides"]
178
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--include-entry-exports", "--private-type-leaks", "--unused-files", "--unused-exports", "--unused-types", "--unused-deps", "--unlisted-deps", "--private-src-imports", "--duplicate-exports", "--unused-enum-members", "--unused-class-members", "--unresolved-imports", "--stale-suppressions", "--unused-dependency-overrides", "--misconfigured-dependency-overrides"]
179
179
  },
180
180
  {
181
181
  "name": "cycles",
182
182
  "kind": "cycles",
183
183
  "description": "Find import/export/part/augment dependency cycles.",
184
184
  "schema": SCHEMA_VERSION,
185
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline"]
185
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline"]
186
186
  },
187
187
  {
188
188
  "name": "dupes",
189
189
  "kind": "dupes",
190
190
  "description": "Find duplicated Dart code blocks.",
191
191
  "schema": SCHEMA_VERSION,
192
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports"]
192
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--mode", "--min-tokens", "--min-lines", "--min-occurrences", "--top", "--threshold", "--cross-language", "--skip-local", "--ignore-imports", "--no-ignore-imports"]
193
193
  },
194
194
  {
195
195
  "name": "health",
196
196
  "kind": "health",
197
197
  "description": "Find complex functions, coverage gaps, hotspots, and refactoring targets.",
198
198
  "schema": SCHEMA_VERSION,
199
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--top"]
199
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--max-cyclomatic", "--max-cognitive", "--complexity-breakdown", "--coverage", "--coverage-gaps", "--max-crap", "--runtime-coverage", "--min-invocations-hot", "--min-observation-volume", "--low-traffic-threshold", "--file-scores", "--hotspots", "--targets", "--ownership", "--min-score", "--top"]
200
200
  },
201
201
  {
202
202
  "name": "flags",
203
203
  "kind": "flags",
204
204
  "description": "Inventory Dart and Flutter feature flag patterns.",
205
205
  "schema": SCHEMA_VERSION,
206
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--top"]
206
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--top"]
207
207
  },
208
208
  {
209
209
  "name": "security",
210
210
  "kind": "security",
211
211
  "description": "Surface local deterministic security review candidates.",
212
212
  "schema": SCHEMA_VERSION,
213
- "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--top", "--surface", "--sarif-file", "--ci", "--fail-on-issues", "--summary", "--gate", "--diff-file", "--diff-stdin", "--changed-since"]
213
+ "flags": ["--root", "--format", "--open", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--regression-baseline", "--save-regression-baseline", "--fail-on-regression", "--tolerance", "--baseline", "--save-baseline", "--top", "--surface", "--sarif-file", "--ci", "--fail-on-issues", "--summary", "--gate", "--diff-file", "--diff-stdin", "--changed-since", "--compare"]
214
214
  },
215
215
  {
216
216
  "name": "impact",
@@ -338,7 +338,7 @@ fn project_support_commands() -> Vec<Value> {
338
338
  "kind": "fix",
339
339
  "description": "Plan or apply safe auto-fixes.",
340
340
  "schema": FIX_SCHEMA_VERSION,
341
- "flags": ["--root", "--format", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--action", "--dry-run", "--apply", "--yes", "--confirm"]
341
+ "flags": ["--root", "--format", "--config", "--entry", "--dart-platform", "--production", "--no-production", "--file", "--workspace", "--changed-workspaces", "--changed-since", "--compare", "--action", "--dry-run", "--apply", "--yes", "--confirm"]
342
342
  }),
343
343
  ]
344
344
  }
@@ -16,6 +16,7 @@ const REPORT_SCOPE_KEYS: &[&str] = &[
16
16
  "workspace",
17
17
  "changed_workspaces",
18
18
  "changed_since",
19
+ "compare",
19
20
  "production",
20
21
  ];
21
22
  const LIST_SCOPE_KEYS: &[&str] = &[
@@ -163,7 +164,7 @@ fn extend_analyze_allowed(allowed: &mut Vec<&'static str>) {
163
164
  }
164
165
 
165
166
  fn extend_check_changed_allowed(allowed: &mut Vec<&'static str>) {
166
- allowed.extend(["since", "changed_since"]);
167
+ allowed.extend(["since", "changed_since", "compare"]);
167
168
  allowed.extend(BASELINE_KEYS);
168
169
  allowed.extend(["dart_platform", "production"]);
169
170
  }
@@ -295,6 +296,7 @@ fn analyze_args(cli: &mut Vec<String>, args: &Map<String, Value>) -> Result<(),
295
296
  fn check_changed_args(cli: &mut Vec<String>, args: &Map<String, Value>) -> Result<(), String> {
296
297
  let since = string_arg(args, "since")?
297
298
  .or(string_arg(args, "changed_since")?)
299
+ .or(string_arg(args, "compare")?)
298
300
  .ok_or_else(|| "check_changed requires since".to_owned())?;
299
301
  cli.extend(["--changed-since".to_owned(), since]);
300
302
  push_baseline_args(cli, args)?;
@@ -603,6 +605,7 @@ fn push_report_scope_args(cli: &mut Vec<String>, args: &Map<String, Value>) -> R
603
605
  push_string_flags(cli, args, "workspace", "--workspace")?;
604
606
  push_string_flag(cli, args, "changed_workspaces", "--changed-workspaces")?;
605
607
  push_string_flag(cli, args, "changed_since", "--changed-since")?;
608
+ push_string_flag(cli, args, "compare", "--compare")?;
606
609
  push_bool_mode(cli, args, "production", "--production", "--no-production")?;
607
610
  Ok(())
608
611
  }
package/src/mcp/tools.rs CHANGED
@@ -52,6 +52,7 @@ fn analyze_tool() -> Value {
52
52
  ("workspace", "array"),
53
53
  ("changed_workspaces", "string"),
54
54
  ("changed_since", "string"),
55
+ ("compare", "string"),
55
56
  ("baseline", "string"),
56
57
  ("regression_baseline", "string"),
57
58
  ("fail_on_regression", "boolean"),
@@ -105,6 +106,7 @@ fn check_changed_tool() -> Value {
105
106
  ("config", "string"),
106
107
  ("since", "string"),
107
108
  ("changed_since", "string"),
109
+ ("compare", "string"),
108
110
  ("baseline", "string"),
109
111
  ("regression_baseline", "string"),
110
112
  ("fail_on_regression", "boolean"),
@@ -294,6 +296,7 @@ fn dupes_tool() -> Value {
294
296
  ("workspace", "array"),
295
297
  ("changed_workspaces", "string"),
296
298
  ("changed_since", "string"),
299
+ ("compare", "string"),
297
300
  ("baseline", "string"),
298
301
  ("regression_baseline", "string"),
299
302
  ("fail_on_regression", "boolean"),
@@ -332,6 +335,7 @@ fn health_tool() -> Value {
332
335
  ("workspace", "array"),
333
336
  ("changed_workspaces", "string"),
334
337
  ("changed_since", "string"),
338
+ ("compare", "string"),
335
339
  ("baseline", "string"),
336
340
  ("regression_baseline", "string"),
337
341
  ("fail_on_regression", "boolean"),
@@ -390,6 +394,7 @@ fn security_tool() -> Value {
390
394
  ("workspace", "array"),
391
395
  ("changed_workspaces", "string"),
392
396
  ("changed_since", "string"),
397
+ ("compare", "string"),
393
398
  ("baseline", "string"),
394
399
  ("regression_baseline", "string"),
395
400
  ("fail_on_regression", "boolean"),
@@ -439,6 +444,7 @@ fn feature_flags_tool() -> Value {
439
444
  ("changed_workspaces", "string"),
440
445
  ("top", "integer"),
441
446
  ("changed_since", "string"),
447
+ ("compare", "string"),
442
448
  ("baseline", "string"),
443
449
  ("regression_baseline", "string"),
444
450
  ("fail_on_regression", "boolean"),
@@ -475,6 +481,7 @@ fn fix_preview_tool() -> Value {
475
481
  ("workspace", "array"),
476
482
  ("changed_workspaces", "string"),
477
483
  ("changed_since", "string"),
484
+ ("compare", "string"),
478
485
  ("production", "boolean"),
479
486
  ("action", "array"),
480
487
  ("no_create_config", "boolean"),
@@ -498,6 +505,7 @@ fn fix_apply_tool() -> Value {
498
505
  ("workspace", "array"),
499
506
  ("changed_workspaces", "string"),
500
507
  ("changed_since", "string"),
508
+ ("compare", "string"),
501
509
  ("production", "boolean"),
502
510
  ("action", "array"),
503
511
  ("no_create_config", "boolean"),
@@ -526,6 +534,7 @@ fn audit_tool() -> Value {
526
534
  ("workspace", "array"),
527
535
  ("changed_workspaces", "string"),
528
536
  ("changed_since", "string"),
537
+ ("compare", "string"),
529
538
  ("include_entry_exports", "boolean"),
530
539
  ("private_type_leaks", "boolean"),
531
540
  ("boundary", "array"),
@@ -88,5 +88,16 @@ pub(super) fn next_steps(root: &Path, results: &AnalysisResults) -> Vec<NextStep
88
88
  }
89
89
  }
90
90
 
91
+ if results.security.as_ref().is_some_and(|report| {
92
+ report.total_occurrences > report.candidates.len() && !report.candidates.is_empty()
93
+ }) {
94
+ steps.push(NextStep {
95
+ id: "review-security-surface".to_owned(),
96
+ command: "dart-decimate security . --format json --surface".to_owned(),
97
+ reason: "List all security candidate occurrences behind representative findings"
98
+ .to_owned(),
99
+ });
100
+ }
101
+
91
102
  steps
92
103
  }
@@ -333,6 +333,7 @@ fn trace_steps(
333
333
  const fn cwe_ids(category: SecurityCategory) -> &'static [&'static str] {
334
334
  match category {
335
335
  SecurityCategory::HardcodedSecret => &["CWE-798"],
336
+ SecurityCategory::FirebaseApiKey => &["CWE-200"],
336
337
  SecurityCategory::InsecureTransport => &["CWE-319"],
337
338
  SecurityCategory::TlsBypass => &["CWE-295"],
338
339
  SecurityCategory::WebViewRisk => &["CWE-749"],
@@ -345,6 +346,7 @@ const fn cwe_ids(category: SecurityCategory) -> &'static [&'static str] {
345
346
  const fn source_label(category: SecurityCategory) -> &'static str {
346
347
  match category {
347
348
  SecurityCategory::HardcodedSecret => "source-code-literal",
349
+ SecurityCategory::FirebaseApiKey => "firebase-options-api-key",
348
350
  SecurityCategory::InsecureTransport => "http-url-literal",
349
351
  SecurityCategory::TlsBypass => "tls-callback-or-context",
350
352
  SecurityCategory::WebViewRisk => "webview-configuration",
@@ -357,6 +359,7 @@ const fn source_label(category: SecurityCategory) -> &'static str {
357
359
  const fn boundary_label(category: SecurityCategory) -> &'static str {
358
360
  match category {
359
361
  SecurityCategory::HardcodedSecret => "source-control",
362
+ SecurityCategory::FirebaseApiKey => "firebase-client-config",
360
363
  SecurityCategory::InsecureTransport => "network-transport",
361
364
  SecurityCategory::TlsBypass => "tls-validation",
362
365
  SecurityCategory::WebViewRisk => "embedded-webview",
@@ -368,7 +371,7 @@ const fn boundary_label(category: SecurityCategory) -> &'static str {
368
371
 
369
372
  const fn trace_role(category: SecurityCategory) -> &'static str {
370
373
  match category {
371
- SecurityCategory::HardcodedSecret => "source",
374
+ SecurityCategory::HardcodedSecret | SecurityCategory::FirebaseApiKey => "source",
372
375
  SecurityCategory::TlsBypass | SecurityCategory::WebViewRisk => "boundary",
373
376
  SecurityCategory::InsecureTransport
374
377
  | SecurityCategory::ProcessExecution
@@ -380,6 +383,7 @@ const fn trace_role(category: SecurityCategory) -> &'static str {
380
383
  const fn category_name(category: SecurityCategory) -> &'static str {
381
384
  match category {
382
385
  SecurityCategory::HardcodedSecret => "hardcoded secret",
386
+ SecurityCategory::FirebaseApiKey => "Firebase API key",
383
387
  SecurityCategory::InsecureTransport => "insecure transport",
384
388
  SecurityCategory::TlsBypass => "TLS bypass",
385
389
  SecurityCategory::WebViewRisk => "WebView risk",
@@ -168,6 +168,13 @@ pub struct JsonReport {
168
168
  pub next_steps: Vec<NextStep>,
169
169
  }
170
170
 
171
+ impl JsonReport {
172
+ pub(crate) fn has_hidden_security_candidate_occurrences(&self) -> bool {
173
+ !self.security_candidates.is_empty()
174
+ && self.summary.security_candidate_occurrences > self.security_candidates.len()
175
+ }
176
+ }
177
+
171
178
  /// Report summary.
172
179
  #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
173
180
  pub struct ReportSummary {
@@ -358,6 +358,7 @@ fn security_category_schema() -> Value {
358
358
  "type": "string",
359
359
  "enum": [
360
360
  "hardcoded-secret",
361
+ "firebase-api-key",
361
362
  "insecure-transport",
362
363
  "tls-bypass",
363
364
  "web-view-risk",