-
-
Notifications
You must be signed in to change notification settings - Fork 19
Make the bloom-automation scripts safe to ask for help (BL-16799) #8290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,29 @@ const { chromium } = createRequire(path.join(componentTester, "package.json"))( | |
| ); | ||
|
|
||
| const args = process.argv.slice(2); | ||
|
|
||
| const usage = `Drive the "Edit with AI…" image editor of a running Bloom over CDP. | ||
|
|
||
| node driveAiImageEditor.mjs [options] [command] | ||
|
|
||
| frames List every frame of the Edit tab (the default command). | ||
| images Report the images of the current page. | ||
| credits Report each book image's credits, read from the file metadata. | ||
| dummy-edit Open the editor, edit with the Local Dummy model, and commit. | ||
|
|
||
| --help, -h Print this and exit. | ||
| --http-port <port> The Bloom whose server answers on this port (default: 8092). | ||
| --cdp-port <port> The debugging port to attach to (default: --http-port plus 2). | ||
| --match <text> Part of the src of the image to edit (default: ai-image). | ||
| --shot <path> Where to write the screenshot of a dummy-edit run.`; | ||
|
|
||
| // The usage counts wherever the request sits, and this script attaches to a running Bloom, so | ||
| // answer it before anything reaches that Bloom. | ||
| if (args.some((arg) => arg === "--help" || arg === "-h")) { | ||
| console.log(usage); | ||
| process.exit(0); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Devin] Bug: Help requires installed Playwright Without Playwright installed, ( |
||
| } | ||
|
|
||
| const opt = (name, def) => { | ||
| const i = args.indexOf(name); | ||
| return i >= 0 && args[i + 1] ? args[i + 1] : def; | ||
|
|
@@ -44,8 +67,16 @@ const valueFlags = new Set(["--http-port", "--cdp-port", "--match", "--shot"]); | |
| const positional = []; | ||
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i].startsWith("--")) { | ||
| if (valueFlags.has(args[i])) i++; // skip its value | ||
| continue; | ||
| if (valueFlags.has(args[i])) { | ||
| i++; // skip its value | ||
| continue; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Devin] Bug: Malformed options still commit edits
( |
||
| } | ||
| // A typo must not be ignored: this script attaches to a running Bloom and does things | ||
| // to the book being edited, so an option it does not know stops the run. | ||
| console.error(`Unknown option ${args[i]}. | ||
|
|
||
| ${usage}`); | ||
| process.exit(2); | ||
| } | ||
| positional.push(args[i]); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Devin] Investigate: Process IDs allow numeric rounding
Values above
Number.MAX_SAFE_INTEGERpass validation but round before reachingtaskkill. Bound process IDs to the platform range or safe integers.(
.github/skills/bloom-automation/bloomProcessCommon.mjs:57)