You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/mobile-apps/skills/create-mobile-app/SKILL.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1899,7 +1899,7 @@ After `tsc` passes, offer a static HTML preview. The dev server starts next (Ste
1899
1899
**Print before starting:**
1900
1900
> "→ [Step 12/13] Launching Metro so you can scan the QR; logs will be written under .powernative/."
1901
1901
1902
-
This skill launches the template's normal `npm run dev` command so:
1902
+
This skill runs the schema/typecheck gates explicitly, then launches `npx expo start`. Manual `npm run dev` remains the template's normal entry point and produces the same project-local log because logging is configured in `metro.config.js`.
1903
1903
1904
1904
1. The native Metro URL is printed by Expo — the user can scan it immediately.
1905
1905
2. Hot-reload works on file edits — no restart needed for screen tweaks.
@@ -1921,15 +1921,15 @@ npm run generate-schemas # refresh schema map for any data sources added sinc
1921
1921
npx tsc --noEmit # final gate — dev server starts only from a clean TypeScript state
1922
1922
```
1923
1923
1924
-
Run the schema regen and final `tsc` synchronously and check both exits. If either fails, do not launch Metro. Capture the full output once, batch-fix by root cause, rerun the final gate, and continue only when clean. Then start the dev server:
1924
+
Run the schema regen and final `tsc` synchronously and check both exits. If either fails, do not launch Metro. Capture the full output once, batch-fix by root cause, rerun the final gate, and continue only when clean. Then start the dev server without rerunning the `predev` schema hook:
1925
1925
1926
1926
```bash
1927
-
npm run dev
1927
+
npx expo start
1928
1928
```
1929
1929
1930
1930
This is a long-running dev server. In hosts that support background terminals, run it as a background/async terminal only for process lifetime; do not persist or depend on the terminal ID. `/debug-app` discovers logs from `.powernative/metro-logs/`, not from terminal output.
1931
1931
1932
-
The orchestrator already ran `npm run generate-schemas` for the final gate; `predev` remains a safety net for manual starts.
1932
+
The orchestrator already ran `npm run generate-schemas` for the final gate; `predev` remains a safety net for manual `npm run dev` starts.
1933
1933
1934
1934
Read the initial terminal output and locate the generated `.powernative` log directly:
Copy file name to clipboardExpand all lines: plugins/mobile-apps/skills/debug-app/SKILL.md
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,8 @@ Branch as follows:
83
83
| Log exists and PID still owns the logged port | Treat as live. Capture `port`, `pid`, `logPath`, and continue. |
84
84
| Log exists, PID is gone, and another process owns the logged port | Do NOT diagnose from this log. Tell the user which PID holds the port and ask them to restart `npm run dev`. |
85
85
| Log exists but PID/port contradict each other | The device may be talking to the wrong server. Ask the user to stop stale Metro processes and rerun `npm run dev`. |
86
-
| No log exists | Tell the user Metro is not running or has not emitted `.powernative` logs. Ask them to run `npm run dev`, open the native app, then rerun `/debug-app`. |
86
+
| No log exists and `metro.config.js` does not directly import `@microsoft/power-apps-native-host/metro-logger`, or `package.json` does not require `@microsoft/power-apps-native-host``^0.2.26` or newer | This project predates project-local Metro logging. Stop and report both missing contract pieces. Do not enter a restart loop or edit customer-owned config from `/debug-app`; the user must adopt the current template's Metro config and host dependency first. |
87
+
| No log exists and the Metro config/dependency contract is current | Tell the user Metro is not running or has not emitted `.powernative` logs. Ask them to run `npm run dev`, open the native app, then rerun `/debug-app`. |
87
88
88
89
The port check prevents stale-log diagnosis: a log file can outlive its Metro process, so only the socket probe reveals that the log stopped belonging to the app under test.
89
90
@@ -114,13 +115,29 @@ If `fixes.md` is empty, write a session header:
114
115
115
116
### 0.2 Verify Metro bundled and the app is running
116
117
117
-
Read the latest sanitized log window:
118
+
Read a bounded baseline window and return a real byte cursor:
Parse `output`, `port`, and `nextCursor`. Scan `output`:
140
+
Parse `output`, `cursor`, `nextCursor`, and `truncated`; use the `pid`, `port`, and `logPath` resolved in Phase 0.0. Scan `output`:
124
141
125
142
- Most recent error-class line is `SyntaxError`, `Unable to resolve module`, `transform failed`, or `error: Bundling failed` → bundle is broken. Treat as a Step B "Import / Bundle" critical error and route through Step D immediately. Do NOT enter the steady-state loop until the bundle is healthy.
126
143
- Output contains `Bundling complete` / `iOS Bundled` / `Android Bundled` with no later error-class line → Metro is healthy. Proceed.
- Output is empty despite `status.running: true` → Metro has not emitted enough state yet. Tell the user to wait for the native URL, then re-run `/debug-app`; do not guess readiness.
131
148
149
+
If `truncated: true`, the baseline covers only the latest 256 KiB. Record that older history was omitted; do not claim the full session history was inspected.
150
+
132
151
Before initializing the cursor, pass **all** classifiable entries in this initial
133
152
window through Step B, including JS runtime errors, React warnings, network/API
134
153
failures, native errors, and host diagnostics. Do not advance past a prior error
@@ -183,17 +202,19 @@ Write `.claude/debug-app/metro-cursor.json` using structured JSON:
Set `cursor` to `nextCursor` from Phase 0.2. On later invocations:
213
+
Set `logPath`, `pid`, and `port` from Phase 0.0, and set `cursor` to `nextCursor` from Phase 0.2. On later invocations:
193
214
194
-
- Same `port`and `running: true` → reuse the saved cursor so old errors are not processed again.
195
-
- Different `port` → a new Metro session is in play. Discard the old cursor and initialize from the latest log window.
196
-
-`tail.rotationLost: true`(the saved cursor is past end-of-file, which can only happen when the log rotated) → accept the returned reset cursor and record the rotation in `fixes.md`.
215
+
- Same `logPath`, `pid`, and `port`, with the process still owning the port → reuse the saved cursor so old errors are not processed again.
216
+
- Different `logPath`, `pid`, or `port` → a new Metro session is in play. Discard the old cursor and initialize from the latest log window.
217
+
-`rotationLost: true`from Step A → accept the returned reset cursor and record the file shrink/replacement in `fixes.md`.
197
218
198
219
---
199
220
@@ -341,7 +362,7 @@ Repeat until **3 consecutive clean cycles**, OR the user types `stop`, OR the es
341
362
342
363
### Step A — Collect logs
343
364
344
-
Read `.claude/debug-app/metro-cursor.json`, confirm its `logPath` still points at the latest live `.powernative` log, then read newly appended bytes:
365
+
Read `.claude/debug-app/metro-cursor.json`, rediscover the latest live `.powernative` log using Phase 0.0, and confirm the saved `logPath`, `pid`, and `port` still match. If any differ, return to Phase 0.2 and initialize a new baseline. Otherwise read newly appended bytes:
Use only the returned `output` for this cycle. Immediately persist `nextCursor` and the current `port` to `metro-cursor.json`, even when `output` is empty or contains an error; this prevents duplicate processing after interruption and handles log rotation safely.
389
+
Use only the returned `output` for this cycle. Immediately persist the current `logPath`, `pid`, `port`, `nextCursor`, and a new `updatedAt` to `metro-cursor.json`, even when `output` is empty or contains an error; this prevents duplicate processing after interruption and handles file replacement safely.
369
390
370
391
Count a clean cycle only after observing a full 5-second interval with empty or non-error new output. If the log file changes, the PID/port check becomes contradictory, or the cursor resets because the file shrank/rotated, never count that cycle as clean.
0 commit comments