59 lines
2.5 KiB
Markdown
59 lines
2.5 KiB
Markdown
# pad_scanner CLAUDE.md
|
|
|
|
## Branch Strategy
|
|
|
|
- The main branch is `master`, always kept in a releasable state
|
|
- All new feature development must be done on a `dev` branch, created from `master`
|
|
- After verification, merge `dev` back into `master`
|
|
|
|
## Pre-Commit Checks
|
|
|
|
Before committing Flutter app changes, run these checks:
|
|
|
|
```bash
|
|
dart format --set-exit-if-changed .
|
|
flutter analyze
|
|
flutter test
|
|
```
|
|
|
|
If `flutter test` fails with a localhost WebSocket/proxy error, follow the proxy cleanup steps in the Flutter Test Rules section below and run it again.
|
|
|
|
### Handling Check Failures
|
|
|
|
- If a check fails because of the current change, fix the issue before committing.
|
|
- If `flutter analyze` reports any issue in files changed by the current task, fix it before committing.
|
|
- If `flutter analyze` reports only unrelated pre-existing issues, do not fix them in the current commit. Report the file, line, and lint/error name, then handle them in a separate cleanup commit or task.
|
|
- If a check fails because of unrelated pre-existing issues, do not include unrelated fixes in the same commit. Report the failing command and the existing issues, then handle them in a separate cleanup commit or task.
|
|
- If formatting fails, format only files changed by the current task. Do not run a broad formatting cleanup unless that is the explicit task.
|
|
- Treat `flutter test` failures as blocking unless the failure is clearly caused by the proxy issue described below and passes after rerunning with proxy variables cleared.
|
|
- When committing or reporting completion, mention which checks were run and whether any remaining failures are unrelated pre-existing issues.
|
|
|
|
## App Installation Rules
|
|
|
|
**Always use `adb install -r` to install the app. Never use `flutter install`.**
|
|
|
|
`flutter install` uninstalls the old version first, which wipes app configuration (API URL, sound file paths, etc.). `adb install -r` performs an in-place upgrade that preserves all app data.
|
|
|
|
### Installation Steps
|
|
|
|
```bash
|
|
# 1. Build
|
|
flutter build apk --release
|
|
|
|
# 2. Install (in-place upgrade, preserves config)
|
|
adb install -r build/app/outputs/flutter-apk/app-release.apk
|
|
```
|
|
|
|
## Flutter Test Rules
|
|
|
|
Before running `flutter test`, temporarily remove proxy environment variables for the current shell. The Flutter tester uses a localhost WebSocket, and proxy settings can break that connection with `Invalid WebSocket upgrade request`.
|
|
|
|
### PowerShell
|
|
|
|
```powershell
|
|
$env:HTTP_PROXY=''
|
|
$env:HTTPS_PROXY=''
|
|
$env:NO_PROXY='localhost,127.0.0.1,::1'
|
|
flutter test
|
|
```
|