mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-22 01:42:18 +01:00
Make wake-alarm text-free (textgate-rework) — res…
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Todo: 364208fc
This commit is contained in:
parent
6c248e712e
commit
28327d322a
38
keep.md
Normal file
38
keep.md
Normal file
@ -0,0 +1,38 @@
|
||||
# Text-free keep list
|
||||
|
||||
Every `textgate scan` hit that stays on purpose. `scripts/check_textgate_keep.sh`
|
||||
runs the scan and fails on any hit no row below covers. Rework rationale and the
|
||||
per-screen decisions: `~/data/wake-alarm_notext/keep.md` (2026-11-10 rework).
|
||||
|
||||
## Scan exceptions
|
||||
|
||||
First cell: a file, or a directory ending in `/`. Second cell: the exact text,
|
||||
or `*` for any text. The checker parses only this table.
|
||||
|
||||
| Path | Text | Reason |
|
||||
|---|---|---|
|
||||
| `docs/explanations/` | * | Generated by the `explain-diff` skill (`docs/explanations/index.html`). Explanation pages for the repo, not app UI; a text-free explanation defeats its purpose. |
|
||||
|
||||
## Kept but not flagged by the scan
|
||||
|
||||
Rows copied from the rework's keep list. The scan does not report these today;
|
||||
they are listed so the next rework does not delete them.
|
||||
|
||||
### OS-level labels: the app name only
|
||||
|
||||
| Where | Text | Reason |
|
||||
|---|---|---|
|
||||
| `phone_app/lib/ui/app_name.dart` `kAppName` | `WakeAlarm` | `MaterialApp.title`: the task-switcher name, a proper noun |
|
||||
| `phone_app/android/app/src/main/AndroidManifest.xml` | `android:label="WakeAlarm"` | launcher label, a proper noun |
|
||||
| `phone_app/android/app/src/main/kotlin/com/kuhy/wake_alarm_sync/AppName.kt` `APP_NAME` | `WakeAlarm` | name of the ring and session notification channels |
|
||||
|
||||
### Content: data the program only displays
|
||||
|
||||
| Where | Content | Reason |
|
||||
|---|---|---|
|
||||
| `room_proof_screen.dart`, `session_tags_screen.dart` | registered NFC tag ids | authored identifiers read off the tag |
|
||||
| `ring_challenge.dart` `challenge.display` | digits, operators, sequences, the reversed word | the thing you must read to dismiss; always visible |
|
||||
| `home_location_screen.dart` | captured SSID, BSSIDs, coordinates | read from the radio |
|
||||
| all screens | clock times, numeral dates, counts, kg, `N/M` | numbers |
|
||||
| `escape_dialog.dart` | the excuse text kuhy types | typed value |
|
||||
| `alarm_publisher.dart` two `publish()` failure strings | spoken labels, two distinct cue kinds | CLAUDE.md: keep both messages |
|
||||
@ -105,7 +105,7 @@ class AlarmService : Service() {
|
||||
// IMPORTANCE_HIGH is required for a full-screen intent to be honoured.
|
||||
val channel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"WakeAlarm",
|
||||
APP_NAME,
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
).apply {
|
||||
// The service owns sound and vibration, so the channel must not add
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.kuhy.wake_alarm_sync
|
||||
|
||||
/**
|
||||
* The app's only visible word, used as every notification channel's name.
|
||||
*
|
||||
* Matches `android:label` in AndroidManifest.xml and Dart's `kAppName`, so the
|
||||
* notification settings name the app the way the launcher does.
|
||||
*/
|
||||
const val APP_NAME = "WakeAlarm"
|
||||
@ -50,7 +50,7 @@ object SessionNotice {
|
||||
.apply()
|
||||
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
manager.createNotificationChannel(
|
||||
NotificationChannel(CHANNEL_ID, "WakeAlarm", NotificationManager.IMPORTANCE_LOW),
|
||||
NotificationChannel(CHANNEL_ID, APP_NAME, NotificationManager.IMPORTANCE_LOW),
|
||||
)
|
||||
manager.notify(NOTIFICATION_ID, build(context, label, deadlineMillis))
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:wake_alarm_sync/services/alarm_policy.dart';
|
||||
import 'package:wake_alarm_sync/services/alarm_scheduler.dart';
|
||||
import 'package:wake_alarm_sync/services/day_pool_refresh.dart';
|
||||
import 'package:wake_alarm_sync/services/headless_ring_start.dart';
|
||||
import 'package:wake_alarm_sync/ui/app_name.dart';
|
||||
import 'package:wake_alarm_sync/ui/theme.dart';
|
||||
|
||||
/// Route the Kotlin `AlarmActivity` hands to the engine as its initial
|
||||
@ -63,7 +64,7 @@ class WakeAlarmSyncApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Wake Alarm Sync',
|
||||
title: kAppName,
|
||||
theme: buildAppTheme(),
|
||||
navigatorKey: navigatorKey,
|
||||
// AlarmActivity sets its initial route to kRingRoute, so the ring screen
|
||||
|
||||
6
phone_app/lib/ui/app_name.dart
Normal file
6
phone_app/lib/ui/app_name.dart
Normal file
@ -0,0 +1,6 @@
|
||||
/// The app's only visible word: the proper noun the OS task switcher shows.
|
||||
///
|
||||
/// Matches `android:label` in AndroidManifest.xml and the Kotlin `APP_NAME`
|
||||
/// (notification channels), so the launcher, the task switcher and the
|
||||
/// notification settings all name the app the same way.
|
||||
const String kAppName = 'WakeAlarm';
|
||||
65
scripts/check_textgate_keep.sh
Executable file
65
scripts/check_textgate_keep.sh
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ============================================================================
|
||||
# Fail if `textgate scan` reports any text item not covered by keep.md.
|
||||
#
|
||||
# textgate has no path exclusion and its config is a gate control, so the
|
||||
# repo's deliberate exceptions live in keep.md instead. This script reads the
|
||||
# "## Scan exceptions" table there (first cell: a backticked file, or a
|
||||
# directory ending in "/"; second cell: the backticked exact text, or * for
|
||||
# any text) and prints every scan hit no row covers.
|
||||
#
|
||||
# Not wired into pre-commit or CI: adding it there is a gate change.
|
||||
#
|
||||
# Usage: scripts/check_textgate_keep.sh (from anywhere in the repo)
|
||||
# Exit: 0 all hits kept, 1 unmatched hits, 2 missing tool or keep file.
|
||||
# Needs: textgate, jq.
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
readonly REPO_ROOT
|
||||
readonly KEEP_FILE="$REPO_ROOT/keep.md"
|
||||
readonly SECTION="## Scan exceptions"
|
||||
|
||||
die() {
|
||||
echo "Error: $*" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
# Print the exception rows of keep.md as "path<TAB>text" (empty text = any).
|
||||
keep_rows() {
|
||||
awk -v section="$SECTION" '/^## /{on = ($0 == section)} on && /^\| `/' "$KEEP_FILE" |
|
||||
sed -E 's/^\| `([^`]+)` \| (`([^`]*)`|\*) \|.*$/\1\t\3/'
|
||||
}
|
||||
|
||||
main() {
|
||||
command -v textgate >/dev/null || die "textgate not found on PATH"
|
||||
command -v jq >/dev/null || die "jq not found on PATH"
|
||||
[[ -f "$KEEP_FILE" ]] || die "keep list not found at $KEEP_FILE"
|
||||
|
||||
local rows scan unmatched
|
||||
rows="$(keep_rows | jq -R -s 'split("\n") | map(select(length > 0) | split("\t") | {path: .[0], text: (.[1] // "")})')"
|
||||
# textgate exits 1 whenever it lists any item, so the exit code alone
|
||||
# cannot tell hits from a crash: require 0/1 and a JSON array.
|
||||
local rc=0
|
||||
scan="$(cd "$REPO_ROOT" && textgate scan --json)" || rc=$?
|
||||
((rc <= 1)) || die "textgate scan failed (exit $rc)"
|
||||
jq -e 'type == "array"' <<<"$scan" >/dev/null || die "textgate scan did not print a JSON array"
|
||||
unmatched="$(jq -r --argjson rows "$rows" '
|
||||
def covered($hit): any($rows[] as $r
|
||||
| (if ($r.path | endswith("/")) then ($hit.file | startswith($r.path)) else $hit.file == $r.path end)
|
||||
and ($r.text == "" or $r.text == $hit.text); .);
|
||||
.[] | select(covered(.) | not) | "\(.file):\(.line) \(.text | tojson)"
|
||||
' <<<"$scan")"
|
||||
|
||||
if [[ -n "$unmatched" ]]; then
|
||||
echo "$unmatched"
|
||||
echo "textgate keep: $(wc -l <<<"$unmatched") hit(s) not in keep.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "textgate keep: all $(jq length <<<"$scan") hit(s) covered by keep.md"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Loading…
Reference in New Issue
Block a user