@monoes/monodesign 1.2.23 → 1.2.25

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.
package/README.md CHANGED
@@ -101,7 +101,7 @@ Source: [`cli/engine/registry/antipatterns.mjs`](packages/@monoes/monodesign/cli
101
101
  |---|---|---|
102
102
  | `regex` | Source text / CSS-in-JS scan | none |
103
103
  | `static-html` | HTMLparser2 static DOM parse | none |
104
- | `browser` | Puppeteer live-page scan | `puppeteer` (optional) |
104
+ | `browser` | Live-page scan | `@monoes/monobrowse` (optional) with an installed Chrome, Chromium or Edge, else a `puppeteer` you install yourself |
105
105
  | `visual` | Visual contrast analysis | `@monoes/monobrowse` (optional) |
106
106
 
107
107
  ### Auto-Fix
@@ -198,7 +198,7 @@ Search order: `DESIGN.md` → `.agents/context/DESIGN.md` → `docs/DESIGN.md`.
198
198
  ```
199
199
 
200
200
  **Dependencies:** `css-select`, `css-tree`, `domutils`, `fflate`, `htmlparser2`, `marked`
201
- **Optional:** `@monoes/monobrowse` (browser detection), `puppeteer` (live URL scanning)
201
+ **Optional:** `@monoes/monobrowse` (browser detection and live URL scanning). `puppeteer` is no longer a dependency; install it yourself only for URL scans on a machine with no Chrome, Chromium or Edge. Through `monomind design detect`, monomind downloads a Chrome on first use instead.
202
202
 
203
203
  ---
204
204
 
@@ -175,6 +175,31 @@ function createMonobrowsePage(mb, client, sessionId, targetId, port) {
175
175
  };
176
176
  }
177
177
 
178
+ // monobrowse's "the CDP endpoint never opened in time" errors: port 0 waits for
179
+ // DevToolsActivePort, a forced port for the listener itself. Other launch
180
+ // failures (no Chrome, spawn refused, Chrome exited, port squatted) would only
181
+ // fail the same way again.
182
+ const CDP_PORT_TIMEOUT_RE = /did not report a CDP port in .* within \d+ms|failed to start on port \d+ within \d+ms/;
183
+
184
+ // Chrome's first launch on a cold Windows CI runner can take longer than the
185
+ // whole launch timeout to open its CDP port (#583), while every launch after it
186
+ // in the same job is quick. So a timeout gets one more attempt. monobrowse has
187
+ // already killed the timed-out Chrome; its profile dir is dropped and the retry
188
+ // gets a new one, because a leftover Chrome process could still hold the old
189
+ // dir's singleton lock and the retry would hand off to it and exit.
190
+ async function launchWithColdStartRetry(launch, config) {
191
+ for (let attempt = 1; ; attempt++) {
192
+ const userDataDir = mkdtempSync(join(tmpdir(), 'monodesign-cdp-'));
193
+ try {
194
+ const port = await launch({ ...config, userDataDir });
195
+ return { port, userDataDir };
196
+ } catch (error) {
197
+ removeProfileDir(userDataDir);
198
+ if (attempt >= 2 || !CDP_PORT_TIMEOUT_RE.test(error?.message ?? '')) throw error;
199
+ }
200
+ }
201
+ }
202
+
178
203
  async function launchMonobrowseBrowser(options = {}) {
179
204
  const mb = await import('@monoes/monobrowse');
180
205
  const headless = options.headless ?? true;
@@ -210,8 +235,10 @@ async function launchMonobrowseBrowser(options = {}) {
210
235
  // where this bites: its singleton lock survives the previous Chrome being
211
236
  // force-killed, and outlives the port being released. A unique dir removes
212
237
  // the sharing entirely rather than racing the lock's cleanup.
213
- const userDataDir = mkdtempSync(join(tmpdir(), 'monodesign-cdp-'));
214
- const launchedPort = await mb.launchBrowser({ port, headless, args: launchArgs, launchTimeoutMs, userDataDir });
238
+ const { port: launchedPort, userDataDir } = await launchWithColdStartRetry(
239
+ mb.launchBrowser,
240
+ { port, headless, args: launchArgs, launchTimeoutMs },
241
+ );
215
242
  // Control connection (to the initial about:blank tab) — used for lifecycle
216
243
  // commands; detection pages get their own dedicated connections.
217
244
  const control = await mb.connectToTarget(launchedPort);
@@ -334,6 +361,7 @@ export {
334
361
  launchDetectionBrowser,
335
362
  launchMonobrowseBrowser,
336
363
  launchPuppeteerBrowser,
364
+ launchWithColdStartRetry,
337
365
  normalizeBrowserHandle,
338
366
  wrapPuppeteerBrowser,
339
367
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monodesign",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "description": "Frontend design intelligence for AI agents — design tokens, antipattern detection, and the monodesign skill",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,8 +44,10 @@
44
44
  "marked": "^18.0.0"
45
45
  },
46
46
  "optionalDependencies": {
47
- "puppeteer": "^25.1.0",
48
- "@monoes/monobrowse": "1.0.28"
47
+ "@monoes/monobrowse": "1.0.30"
48
+ },
49
+ "devDependencies": {
50
+ "puppeteer": "^25.1.0"
49
51
  },
50
52
  "scripts": {
51
53
  "prebuild": "node ../../../scripts/build-fs.mjs clean dist tsconfig.tsbuildinfo",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: monodesign
3
- description: "Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, research users, build a component system, generate design images, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, reusable design systems, tokens, brand identity, visual storytelling, UX research, usability testing, image generation prompts, and inclusive representation. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks."
3
+ description: "Design, redesign, critique, audit or polish a frontend UI: landing pages, dashboards, components, forms; make it bolder or quieter; type, color, motion, a11y, design systems. Not for non-UI."
4
4
  version: 2.0.0
5
5
  argument-hint: "[{{command_hint}}] [target]"
6
6
  user-invocable: true