Skip to content

Commit 6090bbc

Browse files
committed
feat(quality): import structural improvements from sibling projects
- analysis_options.yaml: expand from 1 to 28 lint rules in 3 categories (error prevention, code quality, consistency) - dart fix --apply: auto-fix 219 issues across 82 files (directives_ordering, sort_constructors_first, prefer_const_constructors, etc.) - check_analyze_budget.sh: rewrite with error-first detection and GH Actions annotations (errors fail immediately regardless of budget) - Makefile: add TTY-aware output suppression for non-interactive mode (CI/agents) - .gitignore: add keystore, build artifact, and env file patterns - SECURITY.md: add responsible disclosure policy - CODEBASE.md: update quality baseline (~83 issues, 28 rules, TTY-aware Makefile)
1 parent 3f3480f commit 6090bbc

88 files changed

Lines changed: 1330 additions & 966 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,18 @@ app.*.map.json
4747
/android/app/debug
4848
/android/app/profile
4949
/android/app/release
50-
ref2
50+
51+
# Keystore and Secrets
52+
*.jks
53+
*.keystore
54+
key.properties
55+
android/key.properties
56+
.env
57+
.env.*
58+
59+
# Build artifacts
60+
*.apk
61+
*.aab
62+
*.exe
63+
*.dmg
64+
*.ipa

CODEBASE.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ codewalk/
7979
├── install.ps1 # Windows installer script
8080
├── uninstall.sh # Unix uninstaller script
8181
├── uninstall.ps1 # Windows uninstaller script
82+
├── SECURITY.md # Security policy and responsible disclosure
8283
└── Makefile # Build automation and packaging gates
8384
```
8485

@@ -90,7 +91,7 @@ codewalk/
9091
| `.g.dart` (generated) | 4 | JSON serialization models |
9192
| `.dart` (tests) | 27 | Test files (unit, widget, integration, support) |
9293
| `.dart` (total) | 142 | Repository files excluding build artifacts |
93-
| `.md` (markdown) | 20 | Docs + roadmap + release artifacts |
94+
| `.md` (markdown) | 21 | Docs + roadmap + release artifacts + SECURITY.md |
9495
| `.sh` (scripts) | 2 | Unix installer/uninstaller scripts |
9596
| `.ps1` (scripts) | 2 | Windows PowerShell installer/uninstaller scripts |
9697

@@ -338,14 +339,12 @@ Deferred/optional after parity wave:
338339

339340
### flutter analyze
340341

341-
- **Total issues: 91**
342+
- **Total issues: ~83** (28 lint rules active)
342343
- Errors: 0
343344
- Warnings: 1 (`unnecessary_non_null_assertion`)
344-
- Info: 90 (mostly `unnecessary_underscores` in test parameter naming)
345-
- **Top issue categories:**
346-
- `unnecessary_underscores` (majority): test parameter naming conventions
347-
- `unnecessary_non_null_assertion` (1): test assertion cleanup opportunity
348-
- **CI Budget:** 186 issues maximum (enforced via `tool/ci/check_analyze_budget.sh`)
345+
- Info: ~82 (mostly `unnecessary_underscores` in test parameter naming, plus a few `unawaited_futures` and `cancel_subscriptions` false positives)
346+
- **Lint rules:** 28 rules in 3 categories (error prevention, code quality, consistency) beyond `flutter_lints` defaults
347+
- **CI Budget:** 186 issues maximum (enforced via `tool/ci/check_analyze_budget.sh` with separate error-first detection)
349348

350349
### flutter test
351350

@@ -398,7 +397,8 @@ Deferred/optional after parity wave:
398397
### Quality Gates
399398

400399
**Static Analysis (check_analyze_budget.sh):**
401-
- Maximum 186 issues allowed
400+
- Fails immediately on any `error •` lines regardless of budget (with `::error::` GitHub Actions annotations)
401+
- Maximum 186 info/warning issues allowed
402402
- Parses `flutter analyze` output
403403
- Fails build if budget exceeded
404404

@@ -414,7 +414,7 @@ Deferred/optional after parity wave:
414414

415415
### Makefile Automation
416416

417-
213-line Makefile with 15 targets:
417+
Makefile with 15 targets and TTY-aware output suppression (verbose output redirected to log in non-interactive mode, shown on failure only):
418418

419419
| Target | Description |
420420
|--------|-------------|
@@ -723,17 +723,18 @@ lcov_branch_coverage=0 # Disable branch coverage, focus on line coverage
723723

724724
| File | Purpose |
725725
|------|---------|
726-
| `analysis_options.yaml` | Flutter/Dart linter configuration |
726+
| `analysis_options.yaml` | Flutter/Dart linter configuration (28 rules in 3 categories) |
727727
| `dart_test.yaml` | Test tags (requires_server, hardware) |
728728
| `.lcovrc` | LCOV coverage options (branch coverage disabled) |
729729
| `codecov.yml` | Codecov integration (35% project, 30% patch) |
730730
| `pubspec.yaml` | Dependency and version management |
731-
| `Makefile` | Build automation (15 targets, 213 lines) |
731+
| `Makefile` | Build automation (15 targets, TTY-aware output suppression) |
732732
| `.github/workflows/ci.yml` | CI/CD pipeline (5 jobs) |
733733
| `.github/workflows/release.yml` | GitHub Release automation (5 jobs: Linux/Windows/macOS/Android builds + release creation) |
734734
| `CONTRIBUTING.md` | Contribution guidelines and standards |
735735
| `QA.feat016.release-readiness.md` | Feature 016 QA matrix, platform smoke, and defect triage |
736736
| `RELEASE_NOTES.md` | Release signoff checklist and known limitations |
737+
| `SECURITY.md` | Security policy and responsible disclosure guidelines |
737738

738739
## Recent Changes Since Previous Baseline
739740

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ ANALYZE_LOG = /tmp/flutter_analyze.log
66
TDL_CHANNEL = VerselesBot
77
TDL_TARGET = 6
88

9+
# TTY detection: suppress verbose output in non-interactive mode (CI/agents)
10+
ifneq ($(shell test -t 1 && echo yes),yes)
11+
LOG = /tmp/codewalk-make.log
12+
QUIET = > $(LOG) 2>&1 || (cat $(LOG) && exit 1)
13+
else ifdef VERBOSE
14+
QUIET =
15+
else
16+
QUIET =
17+
endif
18+
919
help:
1020
@echo "CodeWalk Make Targets"
1121
@echo ""
@@ -25,10 +35,10 @@ help:
2535
@echo " make clean Clean and restore dependencies"
2636

2737
deps:
28-
flutter pub get
38+
flutter pub get $(QUIET)
2939

3040
gen:
31-
dart run build_runner build --delete-conflicting-outputs
41+
dart run build_runner build --delete-conflicting-outputs $(QUIET)
3242

3343
icons:
3444
@if [ ! -f "assets/images/original.png" ]; then \
@@ -124,14 +134,14 @@ icons-check:
124134
@echo "Icon checks passed."
125135

126136
analyze:
127-
flutter analyze --no-fatal-infos --no-fatal-warnings 2>&1 | tee $(ANALYZE_LOG)
137+
flutter analyze --no-fatal-infos --no-fatal-warnings 2>&1 | tee $(ANALYZE_LOG) $(QUIET)
128138
bash tool/ci/check_analyze_budget.sh $(ANALYZE_LOG) 186
129139

130140
test:
131-
flutter test
141+
flutter test $(QUIET)
132142

133143
coverage:
134-
flutter test --coverage
144+
flutter test --coverage $(QUIET)
135145
bash tool/ci/check_coverage.sh coverage/lcov.info 35
136146

137147
smoke:
@@ -159,7 +169,7 @@ desktop:
159169
fi
160170

161171
android:
162-
flutter build apk --release --target-platform android-arm64
172+
flutter build apk --release --target-platform android-arm64 $(QUIET)
163173
@if [ -f "$(APK_DIR)/app-release.apk" ]; then \
164174
mv -f "$(APK_DIR)/app-release.apk" "$(APK_PATH)"; \
165175
echo "APK ready: $(APK_PATH)"; \

SECURITY.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.x.x | :white_check_mark: |
8+
| < 1.0 | :x: |
9+
10+
## Reporting a Vulnerability
11+
12+
We take security seriously. If you discover a security vulnerability in CodeWalk, please report it responsibly.
13+
14+
### How to Report
15+
16+
**DO NOT** open a public GitHub issue for security vulnerabilities.
17+
18+
Instead, please report security issues by emailing:
19+
20+
**security@verseles.com**
21+
22+
Or use GitHub's private vulnerability reporting:
23+
24+
1. Go to the [Security tab](https://github.com/verseles/codewalk/security) of the repository
25+
2. Click "Report a vulnerability"
26+
3. Fill out the form with details
27+
28+
### What to Include
29+
30+
- **Description**: A clear description of the vulnerability
31+
- **Impact**: What an attacker could accomplish by exploiting it
32+
- **Steps to Reproduce**: Detailed steps to reproduce the issue
33+
- **Affected Versions**: Which versions are affected
34+
- **Possible Fix**: If you have suggestions for how to fix the issue
35+
- **Your Contact**: How we can reach you for follow-up questions
36+
37+
### Response Timeline
38+
39+
- **Acknowledgment**: We will acknowledge receipt of your report within **48 hours**
40+
- **Initial Assessment**: We will provide an initial assessment within **7 days**
41+
- **Resolution**: We aim to resolve critical vulnerabilities within **30 days**
42+
- **Disclosure**: We will coordinate disclosure timing with you
43+
44+
### What to Expect
45+
46+
1. **Confirmation**: We'll confirm we received your report
47+
2. **Communication**: We'll keep you updated on our progress
48+
3. **Credit**: With your permission, we'll credit you in the security advisory
49+
4. **No Legal Action**: We will not pursue legal action against researchers who follow responsible disclosure
50+
51+
## Security Considerations
52+
53+
### Server Connection
54+
55+
CodeWalk connects to OpenCode-compatible servers over HTTP/SSE. Users should:
56+
57+
- **Use trusted servers only**: The app sends prompts and receives code over the connection
58+
- **Prefer HTTPS**: When connecting to remote servers, always use HTTPS endpoints
59+
- **Avoid public networks**: Server credentials transit the connection
60+
61+
### Local Storage
62+
63+
- Server URLs and connection settings are stored in `SharedPreferences` (platform default)
64+
- No API keys or tokens are stored by the app itself (authentication is server-side)
65+
- Session data and chat history remain on the server
66+
67+
## Contact
68+
69+
For security concerns: **security@verseles.com**
70+
71+
For general questions: [GitHub Discussions](https://github.com/verseles/codewalk/discussions)
72+
73+
For bug reports: [GitHub Issues](https://github.com/verseles/codewalk/issues)

analysis_options.yaml

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# This file configures the analyzer, which statically analyzes Dart code to
2-
# check for errors, warnings, and lints.
3-
#
4-
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5-
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6-
# invoked from the command line by running `flutter analyze`.
7-
8-
# The following line activates a set of recommended lints for Flutter apps,
9-
# packages, and plugins designed to encourage good coding practices.
101
include: package:flutter_lints/flutter.yaml
112

123
analyzer:
@@ -15,18 +6,37 @@ analyzer:
156
- "**/generated_plugin_registrant.dart"
167

178
linter:
18-
# The lint rules applied to this project can be customized in the
19-
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
20-
# included above or to enable additional rules. A list of all available lints
21-
# and their documentation is published at https://dart.dev/lints.
22-
#
23-
# Instead of disabling a lint rule for the entire project in the
24-
# section below, it can also be suppressed for a single line of code
25-
# or a specific dart file by using the `// ignore: name_of_lint` and
26-
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
27-
# producing the lint.
289
rules:
29-
avoid_print: true
10+
# Error prevention
11+
- avoid_print
12+
- avoid_slow_async_io
13+
- cancel_subscriptions
14+
- close_sinks
15+
- unawaited_futures
16+
- use_build_context_synchronously
17+
- await_only_futures
18+
- avoid_returning_null_for_future
19+
- control_flow_in_finally
20+
- throw_in_finally
21+
22+
# Code quality
23+
- always_declare_return_types
24+
- prefer_single_quotes
25+
- prefer_const_constructors
26+
- prefer_const_declarations
27+
- prefer_const_literals_to_create_immutables
28+
- prefer_final_locals
29+
- prefer_final_in_for_each
30+
- prefer_final_fields
31+
- sort_constructors_first
32+
- sort_child_properties_last
3033

31-
# Additional information about this file can be found at
32-
# https://dart.dev/guides/language/analysis-options
34+
# Consistency
35+
- directives_ordering
36+
- prefer_relative_imports
37+
- omit_local_variable_types
38+
- use_super_parameters
39+
- unnecessary_late
40+
- unnecessary_lambdas
41+
- unnecessary_raw_strings
42+
- unnecessary_statements

lib/core/di/injection_container.dart

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,55 @@
1-
import 'package:get_it/get_it.dart';
21
import 'dart:convert';
2+
3+
import 'package:get_it/get_it.dart';
34
import 'package:shared_preferences/shared_preferences.dart';
4-
import '../network/dio_client.dart';
55

6-
import '../../data/datasources/app_remote_datasource.dart';
76
import '../../data/datasources/app_local_datasource.dart';
7+
import '../../data/datasources/app_remote_datasource.dart';
8+
import '../../data/datasources/chat_remote_datasource.dart';
9+
import '../../data/datasources/project_remote_datasource.dart';
810
import '../../data/repositories/app_repository_impl.dart';
11+
import '../../data/repositories/chat_repository_impl.dart';
12+
import '../../data/repositories/project_repository_impl.dart';
913
import '../../domain/repositories/app_repository.dart';
10-
import '../../domain/usecases/get_app_info.dart';
11-
import '../../domain/usecases/check_connection.dart';
12-
import '../../domain/usecases/update_server_config.dart';
14+
import '../../domain/repositories/chat_repository.dart';
15+
import '../../domain/repositories/project_repository.dart';
1316
import '../../domain/usecases/abort_chat_session.dart';
14-
import '../../domain/usecases/summarize_chat_session.dart';
15-
import '../../domain/usecases/send_chat_message.dart';
16-
import '../../domain/usecases/get_chat_sessions.dart';
17+
import '../../domain/usecases/check_connection.dart';
1718
import '../../domain/usecases/create_chat_session.dart';
18-
import '../../domain/usecases/get_chat_messages.dart';
19-
import '../../domain/usecases/get_chat_message.dart';
20-
import '../../domain/usecases/get_agents.dart';
21-
import '../../domain/usecases/get_providers.dart';
2219
import '../../domain/usecases/delete_chat_session.dart';
2320
import '../../domain/usecases/fork_chat_session.dart';
21+
import '../../domain/usecases/get_agents.dart';
22+
import '../../domain/usecases/get_app_info.dart';
23+
import '../../domain/usecases/get_chat_message.dart';
24+
import '../../domain/usecases/get_chat_messages.dart';
25+
import '../../domain/usecases/get_chat_sessions.dart';
26+
import '../../domain/usecases/get_providers.dart';
2427
import '../../domain/usecases/get_session_children.dart';
2528
import '../../domain/usecases/get_session_diff.dart';
2629
import '../../domain/usecases/get_session_status.dart';
2730
import '../../domain/usecases/get_session_todo.dart';
28-
import '../../domain/usecases/watch_chat_events.dart';
29-
import '../../domain/usecases/watch_global_chat_events.dart';
3031
import '../../domain/usecases/list_pending_permissions.dart';
31-
import '../../domain/usecases/reply_permission.dart';
3232
import '../../domain/usecases/list_pending_questions.dart';
33-
import '../../domain/usecases/reply_question.dart';
3433
import '../../domain/usecases/reject_question.dart';
34+
import '../../domain/usecases/reply_permission.dart';
35+
import '../../domain/usecases/reply_question.dart';
36+
import '../../domain/usecases/send_chat_message.dart';
3537
import '../../domain/usecases/share_chat_session.dart';
38+
import '../../domain/usecases/summarize_chat_session.dart';
3639
import '../../domain/usecases/unshare_chat_session.dart';
3740
import '../../domain/usecases/update_chat_session.dart';
38-
import '../../data/datasources/chat_remote_datasource.dart';
39-
import '../../data/repositories/chat_repository_impl.dart';
40-
import '../../domain/repositories/chat_repository.dart';
41-
import '../../data/datasources/project_remote_datasource.dart';
42-
import '../../data/repositories/project_repository_impl.dart';
43-
import '../../domain/repositories/project_repository.dart';
41+
import '../../domain/usecases/update_server_config.dart';
42+
import '../../domain/usecases/watch_chat_events.dart';
43+
import '../../domain/usecases/watch_global_chat_events.dart';
4444
import '../../presentation/providers/app_provider.dart';
4545
import '../../presentation/providers/chat_provider.dart';
4646
import '../../presentation/providers/project_provider.dart';
4747
import '../../presentation/providers/settings_provider.dart';
48-
import '../../presentation/services/event_feedback_dispatcher.dart';
4948
import '../../presentation/services/chat_title_generator.dart';
49+
import '../../presentation/services/event_feedback_dispatcher.dart';
5050
import '../../presentation/services/notification_service.dart';
5151
import '../../presentation/services/sound_service.dart';
52+
import '../network/dio_client.dart';
5253

5354
final sl = GetIt.instance;
5455

@@ -59,7 +60,7 @@ Future<void> init() async {
5960
sl.registerLazySingleton(() => sharedPreferences);
6061

6162
// Network
62-
sl.registerLazySingleton(() => DioClient());
63+
sl.registerLazySingleton(DioClient.new);
6364

6465
// Data sources
6566
sl.registerLazySingleton<AppRemoteDataSource>(
@@ -78,9 +79,9 @@ Future<void> init() async {
7879
() => ProjectRemoteDataSourceImpl(dio: sl<DioClient>().dio),
7980
);
8081

81-
sl.registerLazySingleton(() => NotificationService());
82-
sl.registerLazySingleton(() => SoundService());
83-
sl.registerLazySingleton<ChatTitleGenerator>(() => ChatAtTitleGenerator());
82+
sl.registerLazySingleton(NotificationService.new);
83+
sl.registerLazySingleton(SoundService.new);
84+
sl.registerLazySingleton<ChatTitleGenerator>(ChatAtTitleGenerator.new);
8485

8586
// Repositories
8687
sl.registerLazySingleton<AppRepository>(

0 commit comments

Comments
 (0)