wize-dev-kit 0.1.4 → 0.2.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +78 -1
  2. package/README.md +64 -0
  3. package/package.json +1 -1
  4. package/src/app-overlay/playbooks/apple-hig.md +112 -0
  5. package/src/app-overlay/playbooks/detox-maestro.md +179 -0
  6. package/src/app-overlay/playbooks/device-matrix.md +121 -0
  7. package/src/app-overlay/playbooks/material-design-3.md +135 -0
  8. package/src/app-overlay/playbooks/mobile-perf-budgets.md +145 -0
  9. package/src/app-overlay/playbooks/permissions-ux.md +147 -0
  10. package/src/app-overlay/playbooks/touch-targets-and-gestures.md +127 -0
  11. package/src/app-overlay/stack-catalog.md +178 -0
  12. package/src/method-skills/1-analysis/wize-document-project/workflow.md +147 -20
  13. package/src/method-skills/1-analysis/wize-prfaq/workflow.md +150 -11
  14. package/src/method-skills/1-analysis/wize-product-brief/workflow.md +90 -19
  15. package/src/method-skills/1-analysis/wize-research/workflow.md +101 -9
  16. package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +80 -16
  17. package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +132 -23
  18. package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +132 -28
  19. package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +91 -15
  20. package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +106 -12
  21. package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +101 -11
  22. package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +197 -29
  23. package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +127 -12
  24. package/src/method-skills/3-solutioning/wize-design-system/workflow.md +182 -22
  25. package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +142 -16
  26. package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +127 -21
  27. package/src/method-skills/4-implementation/wize-code-review/workflow.md +105 -10
  28. package/src/method-skills/4-implementation/wize-create-story/workflow.md +131 -10
  29. package/src/method-skills/4-implementation/wize-dev-story/workflow.md +115 -17
  30. package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +109 -18
  31. package/src/method-skills/4-implementation/wize-retrospective/workflow.md +112 -10
  32. package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +85 -10
  33. package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +96 -11
  34. package/src/tea-skills/wize-tea-design/workflow.md +104 -13
  35. package/src/tea-skills/wize-tea-gate/workflow.md +108 -25
  36. package/src/tea-skills/wize-tea-nfr/workflow.md +104 -14
  37. package/src/tea-skills/wize-tea-review/workflow.md +107 -13
  38. package/src/tea-skills/wize-tea-risk/workflow.md +99 -10
  39. package/src/tea-skills/wize-tea-trace/workflow.md +83 -12
  40. package/src/web-overlay/playbooks/playwright-vitest.md +211 -0
  41. package/src/web-overlay/playbooks/responsive-breakpoints.md +104 -0
  42. package/src/web-overlay/playbooks/semantic-html.md +114 -0
  43. package/src/web-overlay/playbooks/wcag-aa.md +97 -0
  44. package/src/web-overlay/playbooks/web-perf-budgets.md +140 -0
  45. package/src/web-overlay/stack-catalog.md +208 -0
  46. package/tools/installer/commands/agent.js +197 -0
  47. package/tools/installer/commands/sync.js +45 -0
  48. package/tools/installer/commands/update.js +172 -0
  49. package/tools/installer/wize-cli.js +24 -8
@@ -0,0 +1,135 @@
1
+ ---
2
+ playbook: material-design-3
3
+ owner: wize-agent-ux-designer # Mantis
4
+ applies_when: app-overlay active (Android)
5
+ status: ready
6
+ ---
7
+
8
+ # Material Design 3 (Material You) — Mantis Playbook
9
+
10
+ M3 is a design system that adapts to the user, not the other way around. Tokens drive everything.
11
+
12
+ ## 1. The four pillars
13
+
14
+ 1. **Personal** — colors derive from user wallpaper (Material You).
15
+ 2. **Adaptive** — same UI, different layouts on phone / foldable / tablet / desktop.
16
+ 3. **Expressive** — bigger type, richer motion, branded but readable.
17
+ 4. **Inclusive** — built-in accessibility floor: contrast tiers, large touch targets, dynamic type.
18
+
19
+ ## 2. Tokens (the only acceptable way to ship styles)
20
+
21
+ ### Color roles
22
+
23
+ | Role | Use for |
24
+ |---|---|
25
+ | `primary` | Brand primary action color, FABs, prominent buttons. |
26
+ | `onPrimary` | Foreground on `primary`. |
27
+ | `primaryContainer` | Tonal surfaces using primary hue. |
28
+ | `onPrimaryContainer` | Foreground on `primaryContainer`. |
29
+ | `secondary` / `tertiary` | Lower-emphasis accents. |
30
+ | `surface` / `surfaceVariant` | Cards, sheets, containers. |
31
+ | `surfaceContainer*` (M3) | New tiers: low, mid, high, highest. Use for elevation-by-color. |
32
+ | `error` / `onError` | Error states. |
33
+ | `outline` / `outlineVariant` | Borders, dividers. |
34
+
35
+ Never use raw hex. Always tokens. Color is regenerated from the user's seed (dynamic) — hex won't recolor.
36
+
37
+ ### Type scale (M3)
38
+
39
+ | Token | Use |
40
+ |---|---|
41
+ | `displayLarge` / `Medium` / `Small` | Hero text, rarely. |
42
+ | `headlineLarge` / `Medium` / `Small` | Page-level titles. |
43
+ | `titleLarge` / `Medium` / `Small` | Section, dialog titles. |
44
+ | `bodyLarge` / `Medium` / `Small` | Body content. |
45
+ | `labelLarge` / `Medium` / `Small` | Buttons, chips, captions. |
46
+
47
+ ### Shape
48
+
49
+ `shape.small` (4dp) / `medium` (12dp) / `large` (16dp) / `extraLarge` (28dp). Cards: medium. Bottom sheets: large. FAB: extraLarge.
50
+
51
+ ### Elevation by color (M3 change)
52
+
53
+ M3 prefers tonal elevation (surface color tier) over shadow. Use `surfaceContainerLow` → `surfaceContainerHighest` to express depth. Drop shadows are still allowed but secondary.
54
+
55
+ ## 3. Components (a starter set)
56
+
57
+ | Component | Default | Notes |
58
+ |---|---|---|
59
+ | Top app bar | Small (default) | Center-aligned, medium, large variants for hero pages. |
60
+ | Navigation bar (bottom) | 3–5 destinations | Phones default. |
61
+ | Navigation rail | tablets / foldable open | Side rail for medium widths. |
62
+ | Navigation drawer | tablets / desktops | Persistent sidebar pattern. |
63
+ | FAB | Primary action | 1 per screen max. |
64
+ | Extended FAB | Action + label | When the action is non-obvious. |
65
+ | Cards | Filled / Outlined / Elevated | Pick one variant per surface family. |
66
+ | Chips | Assist / Filter / Input / Suggestion | Match the use-case verb. |
67
+ | Buttons | Elevated / Filled / Tonal / Outlined / Text | Pick by hierarchy, not aesthetics. |
68
+ | Bottom sheet | Modal (standalone) / Standard (inline) | Standard is the new big M3 pattern. |
69
+
70
+ ## 4. Adaptive layouts
71
+
72
+ Material breakpoints:
73
+
74
+ | Window class | Width | Layout |
75
+ |---|---|---|
76
+ | Compact | < 600dp | Bottom nav, single pane. |
77
+ | Medium | 600–839dp | Nav rail, list-detail with detail-on-tap. |
78
+ | Expanded | 840–1199dp | Nav rail/drawer, two-pane list-detail. |
79
+ | Large | 1200dp+ | Persistent drawer, multi-pane. |
80
+
81
+ Mantis designs **at minimum compact + expanded**. Tony picks the technique (foldable awareness, window-size-class) for the chosen stack.
82
+
83
+ ## 5. Motion
84
+
85
+ | Motion | Duration | Easing |
86
+ |---|---|---|
87
+ | Standard | 300ms | `motion.easingStandard` |
88
+ | Emphasized | 500ms | `motion.easingEmphasized` |
89
+ | Decelerate | 250ms | for incoming |
90
+ | Accelerate | 200ms | for outgoing |
91
+
92
+ Reduced motion: replace transforms with fades. Test with system "Remove animations" enabled.
93
+
94
+ ## 6. Navigation idioms
95
+
96
+ - System Back is canonical. Don't reimplement back arrows that conflict with the gesture.
97
+ - Predictive back (Android 14+) needs `OnBackInvokedCallback` to preview the destination.
98
+ - Avoid hamburger menus on phones — use bottom nav.
99
+
100
+ ## 7. Accessibility floor
101
+
102
+ - Touch targets: **48×48 dp minimum** (HIG-equivalent rule).
103
+ - Talkback labels on every actionable element.
104
+ - `contentDescription` for icons-without-text.
105
+ - Dynamic type via `sp` (never `dp` for text). Support 130% font scale.
106
+ - Contrast follows WCAG AA tokens; M3 tooling validates contrast pairs by default.
107
+
108
+ ## 8. Theming with Material You
109
+
110
+ If the project allows wallpaper-derived theming:
111
+
112
+ ```kotlin
113
+ // Compose
114
+ val dynamicColors = if (Build.VERSION.SDK_INT >= 31)
115
+ dynamicColorScheme(LocalContext.current) else darkColorScheme()
116
+ MaterialTheme(colorScheme = dynamicColors) { /* ... */ }
117
+ ```
118
+
119
+ For brand-locked apps, ship a fixed seed but stay in tokens; this preserves accessibility-tier behavior.
120
+
121
+ ## 9. Don'ts
122
+
123
+ - Hex colors in components.
124
+ - Ignoring tonal elevation in favor of shadow.
125
+ - Bottom nav with > 5 items (use scrollable tabs instead).
126
+ - One FAB per app bar action (rate-limit to one FAB).
127
+ - Dialogs for non-blocking confirmations (use snackbar with undo).
128
+
129
+ ## 10. Cross-platform note
130
+
131
+ If iOS is shipped too: do not port Material to iOS, and vice versa. The Mantis design system separates **brand tokens** (shared) from **platform tokens** (per-OS). See `apple-hig.md`.
132
+
133
+ ## 11. Hand-off
134
+
135
+ Mantis annotates screens with Material component names and tokens (`md.sys.color.primary`, `md.sys.typescale.titleLarge`). Tony picks Compose / View system / cross-platform (Flutter, RN). Shuri implements against the component+token contract.
@@ -0,0 +1,145 @@
1
+ ---
2
+ playbook: mobile-perf-budgets
3
+ owner: wize-agent-test-architect # Hawkeye (with Tony for platform tuning)
4
+ applies_when: app-overlay active
5
+ status: ready
6
+ ---
7
+
8
+ # Mobile Performance Budgets — Hawkeye Playbook
9
+
10
+ Mobile users measure your app in milliseconds and megabytes. Budgets are how you protect both.
11
+
12
+ ## 1. The numbers that matter
13
+
14
+ | Metric | Good | Needs work | Poor |
15
+ |---|---|---|---|
16
+ | **Cold start** (launch → first frame) | < 1.5s | 1.5–2.5s | > 2.5s |
17
+ | **Warm start** | < 0.8s | 0.8–1.5s | > 1.5s |
18
+ | **Time to interactive** (TTI) | < 2.0s | 2.0–3.5s | > 3.5s |
19
+ | **Frame rate** (sustained) | 60 fps stable | drops < 5/sec | drops > 5/sec |
20
+ | **Jank** (frames > 16ms) | < 0.5% | 0.5–2% | > 2% |
21
+ | **App size** (download) | < 50 MB | 50–150 MB | > 150 MB |
22
+ | **App size** (installed) | < 200 MB | 200–500 MB | > 500 MB |
23
+ | **Memory** (steady-state) | < 150 MB | 150–300 MB | > 300 MB |
24
+ | **Battery drain** (per hour, foreground) | < 5% | 5–10% | > 10% |
25
+
26
+ Targets for **mid-range phones, not your flagship**. Hawkeye runs benchmarks on the device matrix (see `device-matrix.md`).
27
+
28
+ ## 2. App size budget
29
+
30
+ ### Per-platform ceiling
31
+
32
+ - iOS App Store: 200 MB OTA download cellular ceiling. Plan for **< 150 MB** to leave headroom.
33
+ - Google Play: 150 MB APK ceiling; use App Bundle splits. Plan for **< 30 MB** initial download.
34
+
35
+ ### Where size goes
36
+
37
+ Audit on every release:
38
+
39
+ | Slice | Tool |
40
+ |---|---|
41
+ | RN / Expo JS bundle | `metro-visualizer`, `react-native-bundle-visualizer` |
42
+ | Native deps | Xcode Linker map / Android Studio APK Analyzer |
43
+ | Assets (images, fonts, video) | Compare to design tokens — anything unused? |
44
+ | Third-party SDKs | Each SDK > 1 MB needs a written justification |
45
+
46
+ ### Reductions that work
47
+
48
+ 1. **Vector over bitmap** wherever the design allows (PDF for iOS asset catalog, VectorDrawable for Android).
49
+ 2. **WebP/AVIF over PNG** for bitmaps.
50
+ 3. **Subset fonts**; ship one weight, derive others via OS faux-bold when acceptable.
51
+ 4. **Tree-shake JS bundle** (Hermes, ProGuard/R8). Verify with the visualizer.
52
+ 5. **App Thinning** (iOS) and **App Bundle splits** (Android) so each user downloads only their architecture/density.
53
+ 6. **On-demand resources** (iOS) / **Play Asset Delivery** (Android) for content not needed at launch.
54
+
55
+ ## 3. Cold start
56
+
57
+ Cold start is dominated by:
58
+
59
+ 1. **Process launch** — Apple/Google control, but linking and dyld matter (fewer, smaller binaries help).
60
+ 2. **Framework init** — every SDK initialized in `application(_:didFinishLaunching)` adds to it. Defer non-essential to first-screen-rendered.
61
+ 3. **First view render** — keep the launch screen → first interactive screen path empty of heavy work.
62
+
63
+ ### Patterns
64
+
65
+ - Lazy-init analytics, crash reporting, ad SDKs, A/B testing — after first frame.
66
+ - Pre-render the first screen's skeleton; populate from cache; refresh in background.
67
+ - For RN/Expo: enable **Hermes** + **bundleAssetName splitting**.
68
+ - For Android: keep Application.onCreate empty; init via lifecycle observer.
69
+
70
+ ### Measurement
71
+
72
+ | Platform | Tool |
73
+ |---|---|
74
+ | iOS | Xcode Instruments → "App Launch", Time Profiler |
75
+ | Android | Macrobenchmark library (Jetpack) for ColdStartup. `adb shell am start -W` for rough numbers. |
76
+ | RN | `Performance.now()` markers + Flipper Perf plugin. |
77
+
78
+ ## 4. Frame rate & jank
79
+
80
+ 60 fps = 16.67ms/frame. 120 fps target on ProMotion / 90 Hz Androids = 8.33ms.
81
+
82
+ ### Common culprits
83
+
84
+ - **Layout thrashing** — measuring layout inside scroll/animation handlers.
85
+ - **Image decoding on main thread** — decode async, cache decoded.
86
+ - **Synchronous bridge calls (RN)** — batch updates, use native modules.
87
+ - **Heavy `onLayout` / `LaunchedEffect` on each render**.
88
+ - **Re-rendering large lists** — use `FlatList` with `keyExtractor` + `getItemLayout`, or `LazyColumn`.
89
+
90
+ ### Measurement
91
+
92
+ - iOS: Instruments → Core Animation → FPS.
93
+ - Android: GPU profiling overlay + Macrobenchmark FrameTimingMetric.
94
+ - RN: Flipper Perf, `react-native-performance`.
95
+
96
+ ## 5. Memory
97
+
98
+ - Aim for steady-state **< 150 MB** on mid-range.
99
+ - Audit images caches; cap at `min(50 MB, 100 thumbnails)`.
100
+ - Release video / audio assets on pause.
101
+ - Watch out for retain cycles (iOS) and Activity / Fragment leaks (Android) — use LeakCanary / Xcode memory graph.
102
+
103
+ ## 6. Battery
104
+
105
+ - Don't poll. Use OS push (silent push), BLE listeners (low-power), location updates with low frequency.
106
+ - Background tasks: respect the OS budget (BGTaskScheduler / WorkManager).
107
+ - Avoid wake-locks; trade off freshness for energy.
108
+
109
+ ## 7. Network
110
+
111
+ - HTTP/2 minimum; HTTP/3 where supported.
112
+ - gzip / brotli on responses.
113
+ - Aggressive cache headers; SWR (stale-while-revalidate) pattern for read-heavy data.
114
+ - Image CDN with on-the-fly format/quality negotiation.
115
+ - Don't fan out 30 small requests; batch with GraphQL or a dedicated endpoint.
116
+
117
+ ## 8. Build-time enforcement
118
+
119
+ | Check | Tool |
120
+ |---|---|
121
+ | Bundle size growth > 5% per release | `danger-js` rule on the bundle visualizer output. |
122
+ | Cold start regression > 10% | Macrobenchmark in CI; fail PR on threshold. |
123
+ | Frame timing | Compose Compiler metrics for Android; Hermes profiler for RN. |
124
+
125
+ ## 9. Field measurement
126
+
127
+ - iOS: `MetricKit` for power, hangs, scroll latency.
128
+ - Android: Firebase Performance + Macrobenchmark.
129
+ - Cross-platform: Sentry Performance, NewRelic Mobile.
130
+
131
+ Look at **p75** and **p90** in field data. The user is the 75th percentile, not the 50th.
132
+
133
+ ## 10. Hawkeye's gate inputs
134
+
135
+ For each epic NFR review (`tea/nfr/{epic}.md`):
136
+
137
+ - Cold start (mid-range device).
138
+ - Bundle size delta vs last release.
139
+ - Steady-state memory.
140
+ - Critical-flow frame rate (one E2E run with FPS capture).
141
+ - Battery (instrumented test with consistent workload).
142
+
143
+ ## 11. Hand-off
144
+
145
+ Fury sets the targets in `nfr-principles.md`. Tony picks the stack respecting the targets. Mantis designs without animation excess. Shuri implements. Hawkeye verifies on each release; regressions hit Concerns/Fail at the gate.
@@ -0,0 +1,147 @@
1
+ ---
2
+ playbook: permissions-ux
3
+ owner: wize-agent-ux-designer # Mantis (paired with Pepper on copy)
4
+ applies_when: app-overlay active
5
+ status: ready
6
+ ---
7
+
8
+ # Permissions UX — Mantis Playbook
9
+
10
+ The system dialog you can't customize. Everything *around* it is yours. Use it well — denied permissions are usually a UX failure, not a privacy choice.
11
+
12
+ ## 1. The four states for every permission
13
+
14
+ 1. **Not determined** — system never asked.
15
+ 2. **Granted** — you can use the feature.
16
+ 3. **Denied** — user said no; system won't re-prompt; only Settings can flip.
17
+ 4. **Restricted / Limited** — partial access (iOS photos limited library; Android approximate location).
18
+
19
+ Design **all four** for every permission your app uses.
20
+
21
+ ## 2. The "pre-flight" pattern
22
+
23
+ Never trigger the system prompt as the first thing the user sees. Always:
24
+
25
+ 1. **In-context trigger.** The user tries a feature that needs the permission.
26
+ 2. **Mantis pre-flight UI.** A custom screen/sheet explains *why*, *what*, *what happens if no*.
27
+ 3. **System prompt.** User decides.
28
+ 4. **Outcome path.** Granted → feature works. Denied → degraded mode; offer Settings deep-link.
29
+
30
+ ```
31
+ [user taps "Add photo"]
32
+
33
+ ┌────────────────────────────────────┐
34
+ │ Why we need your photos │
35
+ │ To attach an image to your post. │
36
+ │ We never upload without confirm. │
37
+ │ │
38
+ │ [ Not now ] [ Continue ] │
39
+ └────────────────────────────────────┘
40
+ ↓ Continue
41
+ [system prompt — uneditable]
42
+
43
+ Granted → flow continues
44
+ Denied → fallback UI + "Open Settings"
45
+ ```
46
+
47
+ ## 3. Per-permission guidance
48
+
49
+ ### Camera & microphone
50
+
51
+ - Ask only when the user starts a recording/capture action.
52
+ - Pre-flight explains what's recorded, stored, and uploaded.
53
+ - If denied: show a permanent banner with "Open Settings" inside the feature; don't auto-re-prompt.
54
+
55
+ ### Photo library
56
+
57
+ - iOS 14+: **Limited Library is the default**. Embrace it — show a "Manage" button to add more later.
58
+ - Android 13+: granular media access (images / video / audio).
59
+ - Don't ask for full library if you only need one picker — use `PHPickerViewController` / `Photo Picker` which need **no permission** at all.
60
+
61
+ ### Location
62
+
63
+ - Pre-flight has a *map screenshot* showing the precision and the purpose ("nearby restaurants" vs "your route").
64
+ - Android 12+: approximate location is the default. Justify precise.
65
+ - Background location: **only** if the feature truly needs it (delivery, fitness route). Otherwise foreground-only.
66
+
67
+ ### Notifications
68
+
69
+ - Don't ask at launch. Ask the first time a notification would actually be useful.
70
+ - Pre-flight: list the categories you'll use (mention, reminder, marketing). Tie each to a setting in-app.
71
+ - Provide per-category opt-in inside the app — match to OS notification channels (Android) / authorization options (iOS).
72
+
73
+ ### Contacts / Calendar / Reminders
74
+
75
+ - High-friction permission; only when essential.
76
+ - If you just need a single contact, use the system picker — **no permission required**.
77
+
78
+ ### Bluetooth / Local Network
79
+
80
+ - iOS: bluetooth-LE for peripherals only; Local Network for Bonjour discovery — both prompt.
81
+ - Pre-flight should explain it's for nearby devices, not internet access.
82
+
83
+ ### Health / Motion (iOS)
84
+
85
+ - HealthKit asks per data type. Group requests by user-task, not by data field.
86
+ - Motion: pre-flight explains it's used for step-count or activity recognition only.
87
+
88
+ ### Tracking (App Tracking Transparency, iOS)
89
+
90
+ - The system prompt is required if you track across other apps/sites.
91
+ - Apple disallows incentivizing the choice; respect it.
92
+
93
+ ## 4. Copy template (Pepper helps phrase)
94
+
95
+ Pre-flight title: **"Why we need [permission]"**.
96
+ One-line value statement.
97
+ One-line "what we will not do" (privacy promise).
98
+ Two buttons: **Not now** (no permission requested) and **Continue** (triggers system prompt).
99
+
100
+ Avoid: "Allow Camera Access" (system already says that).
101
+
102
+ ## 5. Denied state UI
103
+
104
+ Never silently fail. Show:
105
+ - The state badge ("Camera access off").
106
+ - A one-line reason.
107
+ - A direct **"Open Settings"** button.
108
+
109
+ ```swift
110
+ // iOS
111
+ if let url = URL(string: UIApplication.openSettingsURLString) {
112
+ UIApplication.shared.open(url)
113
+ }
114
+ ```
115
+
116
+ ```kotlin
117
+ // Android
118
+ startActivity(Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", packageName, null)))
119
+ ```
120
+
121
+ ## 6. Settings mirror inside the app
122
+
123
+ Every permission you request has a corresponding row in **Settings → Permissions** inside the app. Mirrors the OS state, with the same Open Settings deep-link. This is the user's escape hatch.
124
+
125
+ ## 7. Background work
126
+
127
+ Some Android/iOS background permissions (location, background refresh, BLE in background) require user education and energy disclosure. Pre-flight mentions battery cost explicitly.
128
+
129
+ ## 8. Don'ts
130
+
131
+ - Multiple prompts on first launch ("camera, mic, location, notifications" in a row). Cardinal sin.
132
+ - Re-asking immediately after denial — many OSes block; users get frustrated.
133
+ - Using "we can't function without this" as the reason — design for the denied state.
134
+ - Pre-flight that already says "tap Allow" — the system dialog handles that. Just convince them *why*.
135
+ - Modal blocking UI when the user denies. The feature degrades; the app doesn't.
136
+
137
+ ## 9. Audit list
138
+
139
+ For every release, Hawkeye verifies in `tea-design.md`:
140
+ - Every permission has a pre-flight UI.
141
+ - Every permission has a denied-state UI.
142
+ - Every permission has a Settings deep-link.
143
+ - App functions (degraded) without each non-essential permission.
144
+
145
+ ## 10. Hand-off
146
+
147
+ Mantis owns flow + copy strings. Pepper polishes copy. Tony picks the entitlement / manifest. Shuri implements; Hawkeye walks the four states (not-asked / granted / denied / limited) per permission.
@@ -0,0 +1,127 @@
1
+ ---
2
+ playbook: touch-targets-and-gestures
3
+ owner: wize-agent-ux-designer # Mantis
4
+ applies_when: app-overlay active
5
+ status: ready
6
+ ---
7
+
8
+ # Touch Targets & Gestures — Mantis Playbook
9
+
10
+ The thumb is the cursor. Design every screen around how it actually reaches the controls.
11
+
12
+ ## 1. Minimum touch target sizes
13
+
14
+ | Platform | Minimum | Recommended primary |
15
+ |---|---|---|
16
+ | **iOS** (HIG) | 44×44 pt | 48×48+ pt for primary CTAs |
17
+ | **Android** (Material) | 48×48 dp | 56×56 dp for FABs |
18
+ | **Web** (WCAG 2.5.8) | 24×24 CSS px | 44×44 CSS px for primary |
19
+
20
+ If a visible glyph must be smaller (icon-only toolbar), expand the **hit area** via padding or `hitSlop` — the visual icon stays small but the touch is large.
21
+
22
+ ```swift
23
+ // SwiftUI hit area
24
+ Button { /* */ } label: { Image(systemName: "star") }
25
+ .contentShape(Rectangle())
26
+ .frame(minWidth: 44, minHeight: 44)
27
+ ```
28
+
29
+ ```kotlin
30
+ // Compose
31
+ Modifier.minimumInteractiveComponentSize() // ≥ 48dp
32
+ ```
33
+
34
+ ```jsx
35
+ // React Native
36
+ <Pressable hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>...</Pressable>
37
+ ```
38
+
39
+ ## 2. Spacing between adjacent targets
40
+
41
+ - **≥ 8 dp/pt** between adjacent interactive elements.
42
+ - Bottom row of nav must clear the home indicator (iOS) / gesture region (Android).
43
+
44
+ ## 3. Thumb reach zones (one-handed use)
45
+
46
+ Three zones, on a 6.1" phone:
47
+
48
+ | Zone | Region | Use for |
49
+ |---|---|---|
50
+ | **Easy** | Bottom 1/3 | Primary actions, nav. |
51
+ | **OK** | Middle 1/3 | Secondary, content tap. |
52
+ | **Hard** | Top 1/3 | Status, branding, low-frequency. |
53
+
54
+ Put destructive or rarely-used controls in the **Hard** zone. Put the primary CTA in **Easy**.
55
+
56
+ ## 4. Standard gestures (use the system's vocabulary)
57
+
58
+ | Gesture | Reserved meaning |
59
+ |---|---|
60
+ | **Tap** | Default action. |
61
+ | **Long press** | Reveal secondary actions / context menu. Optional path — never the only one. |
62
+ | **Swipe left/right on row** | Quick actions (archive, delete). |
63
+ | **Swipe down on modal** | Dismiss. |
64
+ | **Pull down on list** | Refresh. |
65
+ | **Pinch** | Zoom (content). |
66
+ | **Two-finger drag** | Multi-select (mac/iPad). |
67
+ | **Edge swipe (iOS)** | Back navigation. |
68
+ | **System back gesture (Android)** | Back; **don't** intercept lightly. |
69
+
70
+ ## 5. Custom gestures — pick wisely
71
+
72
+ If you must invent a gesture:
73
+
74
+ 1. **Don't make it the only path.** Pair with a visible tap affordance.
75
+ 2. **Onboard once.** Show the gesture on first launch; never again.
76
+ 3. **Make it cancellable.** Mid-gesture the user must be able to abort.
77
+ 4. **Don't fight system gestures.** Edge swipes on iOS = back; you'll lose.
78
+ 5. **Test with system Voice Control** (iOS) / Switch Access (Android) — discoverable to users who can't gesture.
79
+
80
+ ## 6. Multi-touch caveats
81
+
82
+ - iOS: `MultipleTouchEnabled = true` per view; default is single.
83
+ - Android: track pointer IDs on every event; don't assume one finger.
84
+ - Two-finger gestures (pinch, rotate) need an alternative for users with motor limitations — usually a button.
85
+
86
+ ## 7. Drag-and-drop
87
+
88
+ | Platform | Native |
89
+ |---|---|
90
+ | iOS | `UIDragInteraction` / SwiftUI `.draggable + .dropDestination` |
91
+ | Android | `View.startDragAndDrop` / Compose `dragGestures` |
92
+ | React Native | community lib (e.g., `react-native-draggable-flatlist`) |
93
+
94
+ Drag-and-drop must:
95
+ - Show a visible drag preview.
96
+ - Highlight valid drop targets.
97
+ - Support keyboard equivalent (or selection + "Move to…") for accessibility (WCAG 2.5.7).
98
+
99
+ ## 8. Haptics
100
+
101
+ | Use | Pattern |
102
+ |---|---|
103
+ | Successful confirmation | Light impact (.light / `VibrationEffect.EFFECT_TICK`) |
104
+ | Failure / invalid | Notification error / double tick |
105
+ | Long-press triggered | Selection change |
106
+ | Pull-to-refresh release | Light impact |
107
+
108
+ Haptics are noise without a system event behind them. Don't trigger them on every tap.
109
+
110
+ ## 9. Reduce Motion / Reduce Transparency
111
+
112
+ Reduce gesture-driven motion: replace swipe-to-reveal animations with simple cross-fades. Detect with:
113
+
114
+ - iOS: `UIAccessibility.isReduceMotionEnabled`
115
+ - Android: `Settings.Global.TRANSITION_ANIMATION_SCALE`
116
+
117
+ ## 10. Don'ts
118
+
119
+ - Targets smaller than the platform minimum, even if "the icon is small".
120
+ - Hover-only affordances (no hover on touch).
121
+ - Gestures that conflict with system gestures (edge swipes, pull-from-top).
122
+ - Long-press-only access to a critical feature.
123
+ - "Discover this gesture by trial" — onboarding it costs less than the support tickets.
124
+
125
+ ## 11. Hand-off
126
+
127
+ Mantis annotates every interactive element with: `hit area`, `gesture`, `haptic`, `state on disabled`. Shuri implements; Hawkeye verifies hit-area sizes in `tea-design.md` using device-pixel measurements.