Skip to content

v1.0.218

Choose a tag to compare

@github-actions github-actions released this 01 Jun 02:46
· 19 commits to main since this release

✨ New: AI-friendly browser CLI (selector / wait / assert / lifecycle)

Reframes cockpit browser from a snapshot+ref toolkit into a selector-first E2E surface designed for an AI to drive end-to-end. Three things that used to bite: refs going stale on every re-render, silent failures when CDP key/click events get ignored by React's synthetic event flow, and verbose evaluate(fetch(...)) wrappers just to read the backend.

# Find and interact (no snapshot needed; refs go stale on re-render)
cock browser <id> click --text "Sign in"
cock browser <id> click --selector 'button[type="submit"]'
cock browser <id> fill --selector 'input[name="email"]' --value "user@example.com"
cock browser <id> submit --form-selector 'form#login'

# act → wait → assert (atomic E2E)
cock browser <id> wait --network-idle --quiet-ms 500
cock browser <id> assert --selector '[role="status"]' --text "Saved"
cock browser <id> assert --fetch /api/items --jsonpath '$.count' --equals 5

# Probe the backend (page auth inherited)
cock browser <id> fetch /api/users/me --json '$.email'

# Test isolation
cock browser <id> reset --cookies --storage --reload
cock browser <id> set --type cookie --name token --value abc123 --path /

# Bridge state without entering the page (answers even while the page is busy)
cock browser <id> health
cock browser <id> status   # url + title + last console error + top buttons

What's behind the changes:

  • Selector-first interaction. click --text / --selector and fill --selector work after any re-render. Refs still work but now carry a snapshot epoch (e5#v3); using a stale one returns a clear error pointing at the selector form.
  • Wait / assert atomics. wait --network-idle, --selector --state visible|hidden|attached|detached, --dom-stable, and the CLI-side --extension-ready (polls the cheap server-side health so it survives a busy page). assert --selector, --network --method --url --status, and --fetch --jsonpath {--equals|--contains|--not-contains} compose with selector-based acts to give one-step act + assert instead of three-step act + sleep + evaluate.
  • Backend probing. fetch <url> shortcuts the most common evaluate(fetch(...).then(r=>r.json())) pattern. Inherits the page's auth session; supports --method, --body, and a --json <jsonpath> extractor (subset of JSONPath: $, .key, [N], [*]).
  • Lifecycle helpers. reset --cookies --storage --cache --reload for atomic test isolation; set --type cookie|local-storage|session-storage (there's now a write side, not just read); status for a one-line "where am I" — URL + title + last console error + last failed request + top visible buttons.
  • Silent-failure detection for click / key / submit. After CDP returns "success", the CLI quietly diffs page state. If the URL didn't change, the DOM didn't mutate, and no network fired within the verify window, it writes a warning to stderr with concrete recovery commands. Window is 1 s by default; --verify-ms to tune, --skip-verify to bypass for known no-op clicks.
  • Better timeouts and stale-ref errors. Every error now carries an actionable next step. Timeout after 15000ms becomes Timeout (action "X"). Bridge state: ws=open pending=2 lastSuccess=12s ago. Diagnose: cockpit browser <id> health …. Element ref "e5" not found becomes Element ref "e5" is stale (current snapshot v=3). Re-run snapshot, or use click --text / --selector.

Full action surface: https://opencockpit.dev/en/docs/reference/cli/#cockpit-browser (Chinese version under /zh/).

✨ New: version-update pill in Settings

When a newer cockpit is published to npm, the Settings row in the project sidebar shows a small pill — click it for a popover with Copy cockpit update (paste-ready upgrade command) and View changelog. The check is a client-side npm-registry probe (3 s timeout, silent on failure), so it doesn't block startup or leak telemetry.

When the sidebar is collapsed, the gear icon picks up a red dot — the only update signal that fits in icon-only mode.

Help also moves into the same row as a secondary ? action that takes you to the docs in your current locale.

🐛 Fix: Code Map indexes newly created files

Creating a file (Write tool, git pull, branch switch, new file in editor) used to leave the Code Map panel stuck at "0 blocks · No functions detected." until you rebuilt the index manually. syncDirtyIndex only iterated existing keys, and refreshFocalFile early-returned for unknown paths.

Now the first focal query on an unknown file dispatches to a new addFocalFile helper (five guards: project-fileset membership via git ls-files, registered grammar, MAX_FILES soft cap, parse-success, fileset add). The analytics cache is also invalidated so risk / related / context routes pick up the new node on the next query. When the fallback path runs, the response carries notIndexed: true so the UI can render a "not in project graph" hint with a rebuild button instead of the generic empty state.

🌐 Site: docs IA rewrite at opencockpit.dev

The docs site got a structural rewrite into five sections — Get Started / Agent / Explorer / Console / Reference. Tech Plan Reviews moved under Explorer; Chrome extension moved under Console. All ~30 doc pages were fact-checked against the actual product code, MDX was converted to MD, and the sidebar now persists scroll position across navigation by being hoisted into the docs layout. scroll-padding-top: 4rem keeps anchor-linked titles from tucking under the sticky nav.

📚 Docs: long-form local docs retired in favour of opencockpit.dev

The long-form docs that used to live in the repo are gone — they were drifting behind the website:

The website's CLI reference is the new single source of truth for the browser CLI — rewritten end-to-end to match this release's surface, including a new "When NOT to use this CLI" section that mirrors the in-CLI help (LLM-agent E2E, long-streaming pages, multi-tab OAuth flows).