@@ -19,38 +19,62 @@ IoT/smart home Flutter project static analysis CLI plugin. NOT an observability
1919| ---------| ---------|
2020| ` dart run melos bootstrap ` | Install workspace dependencies |
2121| ` dart run melos run analyze ` | dart analyze on all packages |
22- | ` dart run melos run test:cli ` | CLI tests only |
23- | ` dart run flutterguard scan -p <path> ` | Run scan on a project |
22+ | ` dart run melos run test:cli ` | CLI tests only (26 tests) |
23+ | ` flutterguard scan [<path>] ` | Run scan on a project (path defaults to current dir) |
24+ | ` flutterguard scan <path> --format json --fail-on high ` | JSON output with CI gate |
25+ | ` dart compile exe ... -o flutterguard ` | Compile native binary |
26+
27+ ## CI & Automation
28+ - ` .github/workflows/flutterguard.yml ` — CI with ubuntu/macos/windows matrix
29+ - ` scripts/compile.sh ` / ` scripts/compile.ps1 ` — cross-platform native binary compilation
30+ - ` scripts/scan_ci.sh ` / ` scripts/scan_ci.ps1 ` — local CI gate scripts
2431
2532## CLI Entry Point
2633` packages/flutterguard_cli/bin/flutterguard.dart `
2734
28- Wired rules (5): LargeUnitsRule, LifecycleResourceRule, LayerViolationRule, ModuleViolationRule, CircularDependencyRule
35+ Supports positional path: ` flutterguard scan ./my_project ` (no ` -p ` required). Project auto-discovery walks up from CWD to find ` flutterguard.yaml ` , ` pubspec.yaml ` , or ` lib/ ` .
36+
37+ Wired rules (11 rule classes, 13 rule IDs):
38+ - Standards: LargeUnitsRule (3 IDs), MissingConstConstructorRule, PubspecSecurityRule
39+ - Performance: LifecycleResourceRule
40+ - Architecture: LayerViolationRule, ModuleViolationRule, CircularDependencyRule
41+ - IoT: DeviceLifecycleRule, MqttConnectionRule, BleScanningRule, IotSecurityRule
2942
3043## Source Layout
3144```
3245packages/flutterguard_cli/lib/src/
33- config_loader.dart # YAML → ScanConfig (incl architecture.layers/modules )
46+ config_loader.dart # YAML → ScanConfig typedefs (11 rule configs + architecture)
3447 file_collector.dart # Glob file discovery
48+ project_resolver.dart # Project auto-discovery (walk-up flutterguard.yaml / pubspec.yaml / lib/)
3549 static_issue.dart # StaticIssue + RiskLevel + IssueDomain + Priority
36- report_generator.dart # Table + JSON output + score
50+ report_generator.dart # Table + JSON output + score, --no-color support
3751 domain.dart # IssueDomain enum (architecture/performance/standards)
3852 priority.dart # Priority enum (p0/p1/p2)
53+ path_utils.dart # Cross-platform path/glob helpers (p.Context abstraction)
54+ import_utils.dart # Dart import resolution against collected files
55+ source_utils.dart # Analyzer offset → line number conversion
3956 rules/
40- large_units.dart # large_file, large_class, large_build_method
41- lifecycle_resource.dart # lifecycle_resource_not_disposed
42- layer_violation.dart # layer_violation (architecture layer breaches)
43- module_violation.dart # module_violation (cross-module breaches)
44- circular_dependency.dart # circular_dependency (file-level cycles)
57+ large_units.dart # large_file, large_class, large_build_method
58+ lifecycle_resource.dart # lifecycle_resource_not_disposed
59+ layer_violation.dart # layer_violation (architecture layer breaches)
60+ module_violation.dart # module_violation (cross-module breaches)
61+ circular_dependency.dart # circular_dependency (file-level cycles)
62+ missing_const_constructor.dart # missing_const_constructor
63+ iot_security.dart # iot_security (hardcoded secrets, cleartext MQTT/HTTP, insecure BLE)
64+ device_lifecycle.dart # device_lifecycle (init/teardown pair checks)
65+ mqtt_connection.dart # mqtt_connection (MQTT connect/disconnect, broker URLs)
66+ ble_scanning.dart # ble_scanning (BLE startScan/stopScan, timeout)
67+ pubspec_security.dart # pubspec_security (unbounded deps, deprecated packages)
4568```
4669
4770## Spec
4871Single source of truth: ` docs/FLUTTERGUARD_SPEC.md ` — read before implementing any feature.
4972
5073## Maintenance Rules
51- 1 . New rule: spec entry → config typedef → rule class → fixture → test → wire into bin/flutterguard .dart
74+ 1 . New rule: spec entry → config typedef → rule class → fixture → test → wire into scanner .dart
52752 . Always run ` melos run analyze ` + ` melos run test:cli ` before committing
53763 . Do NOT modify archived packages (core/dio/flutter) — they are frozen references
54774 . Do NOT add Flutter widgets, web/cloud infra, or SaaS SDKs
55785 . Output format defaults to ` table ` . JSON available via ` --format=json `
56796 . Architecture rules require explicit ` architecture.layers ` / ` architecture.modules ` in flutterguard.yaml
80+ 7 . CLI supports positional path (` flutterguard scan ./project ` ) and ` --no-color ` flag
0 commit comments