Hookcode Preview Highlight (Gemini)
Overview
This skill ships request scripts and protocol notes for the full preview highlight flow:
- check preview status
- start previews
- install preview dependencies when needed
- send highlight commands
- stop previews after debugging
It also documents selector matcher rules, tooltip bubble payloads, and targetUrl auto-navigation behavior.
Capabilities
- Query preview status to discover instance names and availability before highlighting.
- Start preview instances or install dependencies when the dev server is missing.
- Send highlight commands with selector, mode, color, padding, and scroll options.
- Send optional bubble tooltips alongside highlights.
- Support selector matchers like
text:,attr:,data:,aria:,role:, andtestid:. - Auto-navigate previews when
targetUrlis supplied. - Verify bridge readiness through
subscriberscounts and bridge error responses. - Stop previews after debugging to free ports and resources.
Quick Start
- Copy
.env.exampleto.envinside.gemini/skills/hookcode-preview-highlight/. - Set
HOOKCODE_API_BASE_URL,HOOKCODE_PAT, andHOOKCODE_TASK_GROUP_ID. - Fetch preview status:
node .gemini/skills/hookcode-preview-highlight/scripts/preview_status.mjs \
--task-group <taskGroupId>
- Send a basic highlight:
node .gemini/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker"
- Send a highlight with bubble tooltip:
node .gemini/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker" \
--target-url "/add" \
--bubble-text "Update this headline" \
--bubble-placement right \
--bubble-theme dark
Environment Variables
Set these in .env or override them via CLI flags:
| Variable | Purpose |
|---|---|
HOOKCODE_API_BASE_URL |
Base URL of the HookCode backend |
HOOKCODE_PAT |
PAT token for API authentication |
HOOKCODE_TASK_GROUP_ID |
Default task group id |
HOOKCODE_PREVIEW_INSTANCE |
Default preview instance name for highlight requests |
Operations
Preview status
node .gemini/skills/hookcode-preview-highlight/scripts/preview_status.mjs \
--task-group <taskGroupId>
Start preview
node .gemini/skills/hookcode-preview-highlight/scripts/preview_start.mjs \
--task-group <taskGroupId>
Install dependencies
node .gemini/skills/hookcode-preview-highlight/scripts/preview_dependencies_install.mjs \
--task-group <taskGroupId>
Send highlight command
node .gemini/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker"
Key parameters:
selectorrequired; supports CSS selectors plus matcher rules liketext:Saveorattr:data-testid=ctatargetUrloptional; supports route matching patterns like:id,*,**, hash/query wildcards, and||alternativespadding,color,mode, andscrollIntoViewcontrol the highlight appearance- bubble options include
text,placement,align,offset,maxWidth,theme,background,textColor,borderColor,radius, andarrow
Stop preview
node .gemini/skills/hookcode-preview-highlight/scripts/preview_stop.mjs \
--task-group <taskGroupId>
Selector Matchers
When CSS selectors are not enough, use matcher rules such as:
text:Loginattr:data-testid=submitdata:testid=cta-mainaria:label=Searchrole:buttontestid:cta-main
Target URL Matching
If a highlight command includes targetUrl, the preview can auto-navigate before highlighting.
Supported matching rules include:
:paramfor a single path segment*for wildcard within a segment**for wildcard across segments- query and hash wildcards
||to provide alternatives
If navigation does not happen, check whether the preview toolbar auto-navigation lock is enabled.
Bridge Requirements
- The preview app must include the preview bridge script.
- The bridge must answer the
hookcode:preview:pinghandshake. - A response with
subscribers: 0usually means the preview UI is not listening or the bridge is missing.
Troubleshooting
preview_not_running: start the preview first or verify the instance name.selector_requiredorselector_not_found: verify the element exists in the preview DOM.bubble_text_required: bubble payload was provided without valid text.fetch failed: verifyHOOKCODE_API_BASE_URLand local network access.subscribers: 0: preview UI is not connected or the bridge is not installed.
References
references/highlight-protocol.mdscripts/preview_status.mjsscripts/preview_start.mjsscripts/preview_dependencies_install.mjsscripts/preview_highlight.mjsscripts/preview_stop.mjs
Converted and distributed by TomeVault — claim your Tome and manage your conversions.