Summary
The psychological-operations x_app setup flow spawns Chromium with the auth extension (psychological-operations-chromium-extension-auth/) loaded and lands the operator on https://console.x.com/. The operator then has to traverse the X Developer Console — create a Project, create an App, set User Authentication Settings, copy three credentials from two different pages — and finally paste those credentials into the extension popup. Today the only guidance is (a) seven lines of stderr text printed by the CLI before the browser opens, and (b) hint strings inside the popup form. The operator has to mentally map between those and whatever screen they're currently looking at.
This issue: the auth extension should inject visual guidance — arrows and color coding — directly onto the relevant console.x.com pages, so the operator is told exactly where to click and what to copy at each step, on the page where it matters.
Motivation
The current text-based guidance has two failure modes:
- The OAuth-1.0a / OAuth-2.0 collision. Two of the three credentials (Client ID, Client Secret) come from "User authentication settings" (OAuth 2.0). The third (Bearer Token) comes from "Keys and Tokens". That page also exposes Consumer Key / Secret Key (OAuth 1.0a) which look identical and are not what we want. The extension popup has a hint string saying "NOT the Consumer Key" but the operator only sees that hint after they've already navigated away from the page and opened the popup. Wrong credentials silently break
psyops oauth <name> later with confusing failures.
- Required configuration that's easy to skip. The OAuth 2.0 callback URI must be registered as
http://127.0.0.1/callback (host only, no port) and the app must be set to "Web App" with "Read and write" permissions. Forgetting any of these blocks every per-psyop OAuth handshake. None of these settings are visible in the popup, so the operator has no feedback that they missed a step until much later.
Visual guidance on the page itself fixes both: the extension highlights the correct field, the operator can't pick the wrong one, and required-configuration screens get explicit "do this here" annotations.
Current flow (what the operator does today)
From psychological-operations-cli/src/x_app/setup.rs:55-66 and the auth extension popup at psychological-operations-chromium-extension-auth/popup.html:
- Sign into the X account that owns the dev app.
- On
console.x.com: create a Project + App. Provision credits.
- On the App's "User authentication settings": set type = Web App, permissions = Read and write, register
http://127.0.0.1/callback as a Callback URI.
- Copy the OAuth 2.0 Client ID and Client Secret (visible only at app-creation time, then accessible via the regenerate flow).
- On the App's "Keys and Tokens" page: copy the Bearer Token (NOT Consumer Key, NOT Secret Key — those are OAuth 1.0a).
- Click the auth extension's toolbar icon, paste the three values into the popup, click Save.
background.js relays to the native host, which writes ~/.psychological-operations/x_app.json.
Proposed enhancement
Add a content-script-driven UI overlay layer to the auth extension that runs on console.x.com. The overlay knows the current step and renders:
- Arrows anchored to the DOM element the operator should interact with next (a sidebar entry, a button, a credential field). Use SVG arrows positioned by
getBoundingClientRect() so they reflow with the page; reposition on window.resize and on a MutationObserver for SPA-route changes.
- Color coding by step:
- green — "click this / copy this / do this now"
- red — "do NOT use this" (the OAuth-1.0a Consumer Key and Secret Key on the Keys and Tokens page get a red translucent overlay with the label "OAuth 1.0a — not used")
- blue — informational ("this is the page you want", "this credential goes into Field X of the popup")
- A small floating step tracker in the corner showing
Step N of 6: <current step name> plus a "next" button so the operator can advance manually if the heuristic for auto-advancing misfires.
- Field-to-popup labels on the credential pages: when the operator hovers a value they need to copy, a tooltip shows which popup field it belongs in (
-> Client ID / -> Client Secret / -> Bearer Token).
The popup retains its current form; the overlay is purely additive guidance on the dev console.
Technical approach
- Add
content_scripts to psychological-operations-chromium-extension-auth/manifest.json matching https://console.x.com/*. The auth extension currently has host_permissions for the dev console but no content scripts (per its README: "No content_scripts (no DOM walker; the popup form is the only surface)") — that statement is what changes. While we're in the manifest, drop the now-stale https://developer.x.com/* host-permission since the flow lands on and stays within console.x.com.
- New file
overlay.js (content script) + overlay.css. Detects the current page via URL pattern, looks up DOM anchors with selectors that target the dev console's stable structural elements (data-attributes preferred over class hashes, since X churns class names).
- Step state is per-tab, kept in
chrome.storage.session. The popup reads the state to color its own form fields green when the matching credential is the current expected paste target.
- Step transitions: most steps auto-advance on the operator clicking the highlighted element (capture the click via the same content script). Manual "next" button as a fallback for edge cases (page-load failures, redesigns).
- Selector resilience: every selector goes through a
findAnchor(strategies[]) helper that tries multiple patterns in order — data-testid, then ARIA labels, then text content, then class-name match. If all strategies miss, the overlay logs a warning and silently downgrades to "show step text only, no arrow". X's dev console does redesign occasionally; the overlay should never block the operator if its selectors break.
- Keep the overlay localized to the auth extension. The scrape extension (
psychological-operations-chromium-extension-scrape/) is a separate ID and only runs on x.com — no overlap.
Acceptance criteria
Files
psychological-operations-chromium-extension-auth/manifest.json — add content_scripts block; drop the https://developer.x.com/* host-permission.
psychological-operations-chromium-extension-auth/overlay.js (new) — overlay renderer + step machine.
psychological-operations-chromium-extension-auth/overlay.css (new) — arrow / color / banner styles.
psychological-operations-chromium-extension-auth/popup.js — read shared step state from chrome.storage.session to highlight the currently expected field.
psychological-operations-chromium-extension-auth/README.md — update the "no content scripts" note; drop the developer.x.com reference.
psychological-operations-cli/src/x_app/setup.rs:50-66 — once the overlay carries the guidance, the CLI's seven-line stderr block can be trimmed to a one-line "follow the in-page arrows" message.
Out of scope
- Auto-filling the popup form by scraping the credentials off the page — those values are sometimes obscured behind copy buttons / regenerate flows, and the X dev console layout shifts. Manual paste with strong visual guidance is more robust than fragile auto-fill.
- Localization of the overlay text — English only for v1.
- Detecting a partially-completed app (existing Project, missing user-auth settings, etc.). v1 assumes clean-slate setup; resumable mid-flow detection is a follow-up.
Summary
The
psychological-operations x_app setupflow spawns Chromium with the auth extension (psychological-operations-chromium-extension-auth/) loaded and lands the operator onhttps://console.x.com/. The operator then has to traverse the X Developer Console — create a Project, create an App, set User Authentication Settings, copy three credentials from two different pages — and finally paste those credentials into the extension popup. Today the only guidance is (a) seven lines of stderr text printed by the CLI before the browser opens, and (b) hint strings inside the popup form. The operator has to mentally map between those and whatever screen they're currently looking at.This issue: the auth extension should inject visual guidance — arrows and color coding — directly onto the relevant
console.x.compages, so the operator is told exactly where to click and what to copy at each step, on the page where it matters.Motivation
The current text-based guidance has two failure modes:
psyops oauth <name>later with confusing failures.http://127.0.0.1/callback(host only, no port) and the app must be set to "Web App" with "Read and write" permissions. Forgetting any of these blocks every per-psyop OAuth handshake. None of these settings are visible in the popup, so the operator has no feedback that they missed a step until much later.Visual guidance on the page itself fixes both: the extension highlights the correct field, the operator can't pick the wrong one, and required-configuration screens get explicit "do this here" annotations.
Current flow (what the operator does today)
From
psychological-operations-cli/src/x_app/setup.rs:55-66and the auth extension popup atpsychological-operations-chromium-extension-auth/popup.html:console.x.com: create a Project + App. Provision credits.http://127.0.0.1/callbackas a Callback URI.background.jsrelays to the native host, which writes~/.psychological-operations/x_app.json.Proposed enhancement
Add a content-script-driven UI overlay layer to the auth extension that runs on
console.x.com. The overlay knows the current step and renders:getBoundingClientRect()so they reflow with the page; reposition onwindow.resizeand on aMutationObserverfor SPA-route changes.Step N of 6: <current step name>plus a "next" button so the operator can advance manually if the heuristic for auto-advancing misfires.-> Client ID/-> Client Secret/-> Bearer Token).The popup retains its current form; the overlay is purely additive guidance on the dev console.
Technical approach
content_scriptstopsychological-operations-chromium-extension-auth/manifest.jsonmatchinghttps://console.x.com/*. The auth extension currently hashost_permissionsfor the dev console but no content scripts (per its README: "Nocontent_scripts(no DOM walker; the popup form is the only surface)") — that statement is what changes. While we're in the manifest, drop the now-stalehttps://developer.x.com/*host-permission since the flow lands on and stays withinconsole.x.com.overlay.js(content script) +overlay.css. Detects the current page via URL pattern, looks up DOM anchors with selectors that target the dev console's stable structural elements (data-attributes preferred over class hashes, since X churns class names).chrome.storage.session. The popup reads the state to color its own form fields green when the matching credential is the current expected paste target.findAnchor(strategies[])helper that tries multiple patterns in order —data-testid, then ARIA labels, then text content, then class-name match. If all strategies miss, the overlay logs a warning and silently downgrades to "show step text only, no arrow". X's dev console does redesign occasionally; the overlay should never block the operator if its selectors break.psychological-operations-chromium-extension-scrape/) is a separate ID and only runs onx.com— no overlap.Acceptance criteria
psychological-operations x_app setup, the operator sees an arrow + step-1 banner pointing at "Create Project" onconsole.x.comwithout reading any CLI output.-> Client ID/-> Client Secret.-> Bearer Token.http://127.0.0.1/callback(host only, no port) and that permissions must be Read and write.Files
psychological-operations-chromium-extension-auth/manifest.json— addcontent_scriptsblock; drop thehttps://developer.x.com/*host-permission.psychological-operations-chromium-extension-auth/overlay.js(new) — overlay renderer + step machine.psychological-operations-chromium-extension-auth/overlay.css(new) — arrow / color / banner styles.psychological-operations-chromium-extension-auth/popup.js— read shared step state fromchrome.storage.sessionto highlight the currently expected field.psychological-operations-chromium-extension-auth/README.md— update the "no content scripts" note; drop thedeveloper.x.comreference.psychological-operations-cli/src/x_app/setup.rs:50-66— once the overlay carries the guidance, the CLI's seven-line stderr block can be trimmed to a one-line "follow the in-page arrows" message.Out of scope