Skip to content

Commit 71f43b6

Browse files
committed
simplified
1 parent c76d9b6 commit 71f43b6

12 files changed

Lines changed: 318 additions & 424 deletions

File tree

.github/skills/bloom-automation/SKILL.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Use the real embedded WebView2 inside Bloom.exe as the automation target. Determ
2121
## Default Assumptions
2222
- Current repo root is derived automatically by the checked-in helper.
2323
- Bloom project path is `src/BloomExe/BloomExe.csproj`.
24-
- The helper launch script chooses an explicit port block by default instead of relying on Bloom's standard search. It allocates HTTP bases from `18089`, `18099`, `18109`, ... and uses `http`, `http+1`, and `http+2`, with CDP on `http+2`.
24+
- Fresh automation launches start Bloom with `--automation`, letting Bloom choose its own standard HTTP port block while still bypassing the normal single-instance token.
25+
- In automation mode Bloom writes a machine-readable `BLOOM_AUTOMATION_READY {...}` line to the console as soon as it knows its HTTP, CDP, and process IDs.
2526
- Running Bloom reports its actual HTTP and CDP ports through `http://localhost:<port>/bloom/api/common/instanceInfo`.
26-
- Bloom's embedded WebView2 uses the reserved `http+2` port for CDP when Bloom's HTTP port is known.
2727

2828
## Commands
2929

@@ -51,7 +51,7 @@ Important:
5151
node "$repo_root/.github/skills/bloom-automation/bloomProcessStatus.mjs"
5252
node "$repo_root/.github/skills/bloom-automation/bloomProcessStatus.mjs" --json
5353
node "$repo_root/.github/skills/bloom-automation/bloomProcessStatus.mjs" --running-bloom --json
54-
node "$repo_root/.github/skills/bloom-automation/bloomProcessStatus.mjs" --http-port 18089 --json
54+
node "$repo_root/.github/skills/bloom-automation/bloomProcessStatus.mjs" --http-port <httpPort> --json
5555
```
5656

5757
Reports Bloom.exe processes, detected repo roots, attributable `dotnet watch` parents, ambiguous watchers, and whether the workspace API and CDP endpoint are reachable.
@@ -63,7 +63,7 @@ Use `--http-port <port>` when you launched Bloom through `watchBloomExe.mjs` and
6363
```bash
6464
node "$repo_root/.github/skills/bloom-automation/killBloomProcess.mjs"
6565
node "$repo_root/.github/skills/bloom-automation/killBloomProcess.mjs" --only-mismatched
66-
node "$repo_root/.github/skills/bloom-automation/killBloomProcess.mjs" --http-port 18089
66+
node "$repo_root/.github/skills/bloom-automation/killBloomProcess.mjs" --http-port <httpPort>
6767
node "$repo_root/.github/skills/bloom-automation/killBloomProcess.mjs" --pid 12345 --watch-pid 12340
6868
```
6969

@@ -76,27 +76,26 @@ Important: if Bloom was started with `dotnet watch run`, killing only `Bloom.exe
7676

7777
```bash
7878
node "$repo_root/scripts/watchBloomExe.mjs"
79-
node "$repo_root/scripts/watchBloomExe.mjs" --http-port 18089
8079
```
8180

82-
These helpers always launch through `dotnet watch run`, compute the repo root, acquire a lock on a non-overlapping port block, pass an explicit `--http-port` argument to Bloom, derive CDP from `http+2`, and print the `dotnet` PID immediately plus the Bloom PID once `common/instanceInfo` becomes reachable.
81+
These helpers always launch through `dotnet watch run`, compute the repo root, pass `--automation` to Bloom, and print the `dotnet` PID immediately. Bloom then emits `BLOOM_AUTOMATION_READY {...}` once it has chosen ports, and the helper prints a `Bloom ready. HTTP ..., CDP ..., Bloom PID ...` summary line based on that startup record.
8382
`watchBloomExe.mjs` is intentionally long-lived: for normal launches it keeps running under `dotnet watch run` until the launch session ends. If Bloom reports ready and then dies shortly afterward, the helper reports that as a failed launch instead of silently succeeding.
8483

8584
Agent workflow for `watchBloomExe.mjs`:
8685
- Start it in a background terminal.
87-
- Do not wait for the command to finish. A successful launch is the `Bloom ready. HTTP ..., websocket ..., CDP ..., Bloom PID ...` line, not process exit.
86+
- Do not wait for the command to finish. A successful launch is the latest `Bloom ready. HTTP ..., CDP ..., Bloom PID ...` line, not process exit.
8887
- If the helper later reports that the Bloom PID exited shortly after reporting ready, treat that as a failed launch and do not target that HTTP port.
8988
- After starting it, read or poll that background terminal's output until the `Bloom ready.` line appears, then use the reported HTTP port as the identity of the new instance.
9089
- After you have the HTTP port, continue with `bloomProcessStatus.mjs --http-port <port> --json`, `webview2Targets.mjs --http-port <port> --json --wait`, or `switchWorkspaceTab.mjs --http-port <port> --tab ...`.
91-
- Keep the background terminal open for the lifetime of that Bloom instance. The helper may outlive the `dotnet` process because it continues tracking the actual Bloom PID and holding the port lease.
90+
- Keep the background terminal open for the lifetime of that Bloom instance. If `dotnet watch` restarts Bloom, target the most recent `Bloom ready.` line because Bloom may choose a different HTTP port on the restart.
9291

9392
### Discover the CDP target
9493

9594
```bash
9695
node "$repo_root/.github/skills/bloom-automation/webview2Targets.mjs"
9796
node "$repo_root/.github/skills/bloom-automation/webview2Targets.mjs" --json --wait
9897
node "$repo_root/.github/skills/bloom-automation/webview2Targets.mjs" --running-bloom --json --wait
99-
node "$repo_root/.github/skills/bloom-automation/webview2Targets.mjs" --http-port 18089 --json --wait
98+
node "$repo_root/.github/skills/bloom-automation/webview2Targets.mjs" --http-port <httpPort> --json --wait
10099
```
101100

102101
Use `--wait` after startup so the command blocks until the embedded browser target is available.
@@ -105,7 +104,7 @@ Use `--wait` after startup so the command blocks until the embedded browser targ
105104

106105
```bash
107106
node "$repo_root/.github/skills/bloom-automation/switchWorkspaceTab.mjs" --running-bloom --tab edit --json
108-
node "$repo_root/.github/skills/bloom-automation/switchWorkspaceTab.mjs" --http-port 18089 --tab publish --json
107+
node "$repo_root/.github/skills/bloom-automation/switchWorkspaceTab.mjs" --http-port <httpPort> --tab publish --json
109108
```
110109

111110
This helper attaches to the reported WebView2 target over CDP, clicks the real top bar tab, waits for `workspace/tabs` to report it active, and prints the resulting state.
@@ -143,7 +142,7 @@ Notes:
143142
3. Copy the printed HTTP and CDP ports. If you need the exact PID later, run `node .github/skills/bloom-automation/bloomProcessStatus.mjs --http-port <httpPort> --json`.
144143
4. If you instead want to reuse a current-worktree instance that Bloom found by itself, only then use repo-root matching and `--only-mismatched` cleanup.
145144
5. Run `node .github/skills/bloom-automation/webview2Targets.mjs --http-port <httpPort> --json --wait` to discover the live WebView2 target for that exact instance when you need debugging detail.
146-
6. Use `node .github/skills/bloom-automation/switchWorkspaceTab.mjs --http-port <httpPort> --tab <collection|edit|publish>` for top bar interactions, or attach another confirmed client to the reported `cdpOrigin` if you need lower-level inspection.
145+
6. Use `node .github/skills/bloom-automation/switchWorkspaceTab.mjs --http-port <httpPort> --tab <collection|edit|publish>` for top bar interactions, or attach another confirmed client to `http://localhost:<cdpPort>` if you need lower-level inspection.
147146
7. Manipulate the UI by clicking or typing in the attached browser context. Do not use Bloom API endpoints to simulate the user action itself.
148147
8. Use browser-native inspection for DOM, console, and network.
149148
9. If the task is test-related, run the exe-backed Playwright suite with `BLOOM_HTTP_PORT=<httpPort> yarn playwright test --config playwright.bloom-exe.config.ts`.
@@ -155,7 +154,7 @@ Use this when the user says to reuse the already-running Bloom.
155154
2. If no running Bloom instance is reported, tell the user there is no running Bloom to reuse.
156155
3. If one is reported, do not kill or restart it because of worktree mismatch.
157156
4. Use `node .github/skills/bloom-automation/switchWorkspaceTab.mjs --running-bloom --tab <collection|edit|publish>` for top bar actions, or `node .github/skills/bloom-automation/webview2Targets.mjs --running-bloom --json --wait` when you need CDP target detail.
158-
5. Attach to the reported instance and work only against the ports it reported about itself.
157+
5. Attach to the reported instance and work only against the `httpPort` and `cdpPort` it reported about itself.
159158

160159
## Rules
161160

@@ -174,7 +173,7 @@ Use this when the user says to reuse the already-running Bloom.
174173
- Start it from the current worktree.
175174
- Use `node scripts/watchBloomExe.mjs` for fresh automation-owned launches.
176175
- Treat the printed HTTP port as the identity of that instance. Use `bloomProcessStatus.mjs --http-port <port>`, `webview2Targets.mjs --http-port <port>`, and `killBloomProcess.mjs --http-port <port>` to target it precisely.
177-
- Never wait for `watchBloomExe.mjs` to exit as a readiness signal. It is a long-lived launcher. Wait for the `Bloom ready.` line in the background terminal output instead, and treat a later `Bloom PID ... exited shortly after reporting ready` message as a failed launch.
176+
- Never wait for `watchBloomExe.mjs` to exit as a readiness signal. It is a long-lived launcher. Wait for the latest `Bloom ready.` line in the background terminal output instead, and treat a later `Bloom PID ... exited shortly after reporting ready` message as a failed launch.
178177

179178
### Reuse the running Bloom when the user asks for it
180179
- Run `node .github/skills/bloom-automation/bloomProcessStatus.mjs --running-bloom --json`.
@@ -186,18 +185,18 @@ Use this when the user says to reuse the already-running Bloom.
186185
- Show the CDP target from `node .github/skills/bloom-automation/webview2Targets.mjs --json --wait`.
187186
- Attach with Playwright.
188187
- Demonstrate reading `body.className`, the top-bar iframe, console messages, and the `workspace/selectTab` request.
189-
- For multi-instance work, prefer `webview2Targets.mjs --http-port <port> --json --wait` and the matching `cdpOrigin` it reports.
188+
- For multi-instance work, prefer `webview2Targets.mjs --http-port <port> --json --wait` and the matching `cdpPort` it reports.
190189

191190
### Verified two-instance smoke path
192-
- Launch one instance on `--http-port 18089`.
193-
- Launch a second instance on `--http-port 18099`.
194-
- Target the first instance with `switchWorkspaceTab.mjs --http-port 18089 --tab edit`.
195-
- Target the second instance with `switchWorkspaceTab.mjs --http-port 18099 --tab publish`.
196-
- Use explicit ports throughout; do not mix `--running-bloom` with this workflow.
191+
- Launch one instance with `node scripts/watchBloomExe.mjs` and record the HTTP port from its `Bloom ready.` line.
192+
- Launch a second instance with `node scripts/watchBloomExe.mjs` and record the HTTP port from its `Bloom ready.` line.
193+
- Target the first instance with `switchWorkspaceTab.mjs --http-port <firstPort> --tab edit`.
194+
- Target the second instance with `switchWorkspaceTab.mjs --http-port <secondPort> --tab publish`.
195+
- Use the reported ports throughout; do not mix `--running-bloom` with this workflow.
197196

198197
## Confirmed Path
199198

200-
- `playwright` Node library via the `cdpOrigin` reported by `common/instanceInfo` or `webview2Targets.mjs`
199+
- `playwright` Node library via `http://localhost:<cdpPort>` using the `cdpPort` reported by `common/instanceInfo` or `webview2Targets.mjs`
201200
- `@playwright/test` runner via the exe-backed suite in `src/BloomBrowserUI/react_components/component-tester`
202201

203202
Not confirmed here:
@@ -216,8 +215,7 @@ These tests attach to the real Bloom.exe target over CDP and verify tab switchin
216215
## Notes
217216
- Prefer the Node helpers over PowerShell. The Node scripts use `wmic`, `taskkill`, and `dotnet` directly because the PowerShell path proved too brittle.
218217
- Prefer the checked-in Node helper commands over raw Windows shell commands. Subagents should normally run `node .github/skills/bloom-automation/bloomProcessStatus.mjs --json`, `node .github/skills/bloom-automation/killBloomProcess.mjs --only-mismatched`, `node scripts/watchBloomExe.mjs`, `node .github/skills/bloom-automation/webview2Targets.mjs --json --wait`, and `node .github/skills/bloom-automation/switchWorkspaceTab.mjs --running-bloom --tab edit`, not ad hoc `wmic` commands.
219-
- `watchBloomExe.mjs` keeps a lightweight lease file for the chosen HTTP block while it is running so concurrent agents do not both choose the same automation ports.
220-
- For agent-driven launches, the background terminal is part of the control plane. Leave it running and poll its output for `Bloom ready.` instead of waiting for command completion. The helper may keep running after `dotnet` exits because it is tracking the actual Bloom process.
218+
- For agent-driven launches, the background terminal is part of the control plane. Leave it running and poll its output for the latest `Bloom ready.` line instead of waiting for command completion.
221219
- Exact-target cleanup is intentionally strict: `killBloomProcess.mjs --http-port <port>` should only kill the instance that actually reports that HTTP port, and should fail without killing anything if that target cannot be resolved.
222220
- When reporting work, include the helper commands you used so reviewers can confirm the workflow stayed on the supported path.
223221
- Wrong-worktree detection is authoritative when a real `Bloom.exe` child exists or when `dotnet watch` was started with an absolute `--project` path.
@@ -228,7 +226,7 @@ These tests attach to the real Bloom.exe target over CDP and verify tab switchin
228226
- Bloom's status is known: not running, running from current worktree, or running from different worktree.
229227
- Any mismatched Bloom instance has been stopped before running the current worktree, unless you intentionally started a separate explicit-port instance.
230228
- The chosen HTTP port returns `common/instanceInfo`, including the exact Bloom PID and CDP port.
231-
- The reported CDP endpoint responds at `<cdpOrigin>/json/version`.
229+
- The reported CDP endpoint responds at `http://localhost:<cdpPort>/json/version`.
232230
- `node .github/skills/bloom-automation/webview2Targets.mjs --http-port <httpPort> --json --wait` returns a real Bloom target.
233231
- The automation client can read DOM state and interact with the embedded top bar.
234232
- If tests were requested, the exe-backed Playwright suite passes.

0 commit comments

Comments
 (0)