Skip to content

Commit c130245

Browse files
ryanbas21claude
andcommitted
docs: update READMEs with accurate setup instructions and troubleshooting
- VS Code README: complete rewrite with step-by-step setup, browser launch commands for Chromium/Chrome/Edge/macOS, mock OIDC server instructions, troubleshooting section, and handleMessage pipeline documentation - Root README: fix VS Code quick start to use --extensionDevelopmentPath instead of F5, add --user-data-dir note for separate browser instance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5b78ac6 commit c130245

2 files changed

Lines changed: 129 additions & 36 deletions

File tree

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ pnpm install
4040
pnpm build
4141
```
4242

43-
Open the `packages/vscode-extension` folder in VS Code and press F5 to launch. Then:
43+
Launch VS Code with the extension loaded:
4444

45-
1. Launch Chrome with `--remote-debugging-port=9222`
46-
2. Run **"OIDC DevTools: Start Capture"** from the command palette
45+
```bash
46+
code --extensionDevelopmentPath=packages/vscode-extension
47+
```
48+
49+
Then launch a Chromium-based browser with remote debugging enabled (**must be a separate instance** — use `--user-data-dir` to avoid conflicts with your normal browser):
50+
51+
```bash
52+
chromium --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test
53+
```
54+
55+
In the VS Code window, run `Ctrl+Shift+P`**"OIDC DevTools: Start Capture"** → enter `9222`. Auth-related events will appear in the Timeline as you browse.
4756

48-
See the [VS Code extension README](packages/vscode-extension) for details.
57+
See the [VS Code extension README](packages/vscode-extension) for detailed setup, troubleshooting, and the mock OIDC server for testing.
4958

5059
### Browser compatibility
5160

packages/vscode-extension/README.md

Lines changed: 116 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,118 @@
11
# OIDC DevTools — VS Code Extension
22

3-
VS Code extension for live OIDC/OAuth2 debugging. Connects to Chrome via the Chrome DevTools Protocol (CDP) to capture and analyze authentication flows without leaving your editor.
3+
VS Code extension for live OIDC/OAuth2 debugging. Connects to Chrome/Chromium via the Chrome DevTools Protocol (CDP) to capture and analyze authentication flows without leaving your editor.
44

55
## Features
66

77
- **Live network capture** — captures auth-related traffic via CDP (`Network` domain)
8-
- **SDK event injection** — captures `devtools-bridge` events via `Page.addScriptToEvaluateOnNewDocument` + `Runtime.bindingCalled`
8+
- **OIDC annotation pipeline** — same annotation engine as the browser extension (phase detection, DPoP, PAR, well-known discovery)
9+
- **SDK event injection** — captures `devtools-bridge` events via CDP script injection — no browser extension needed
910
- **Timeline TreeView** — native VS Code tree with status icons, OIDC phase badges, and durations
10-
- **Flow WebView** — the same Elm UI as the browser extension, with VS Code theme integration
11+
- **Flow WebView** — the same Elm UI as the browser extension, adapted to VS Code's color theme
12+
- **Diagnosis engine** — automated issue detection (CORS, missing PKCE, expired tokens, etc.)
1113
- **Status bar** — connection state and live event count
1214
- **Export** — JSON (with redaction) or Markdown (with diagnosis) opened as a new document
13-
- **Debug configuration**`oidc-devtools` type for `launch.json`
1415

1516
## Quick start
1617

17-
### Option 1: Command palette
18+
### Prerequisites
1819

19-
1. Launch Chrome with remote debugging:
20-
```bash
21-
google-chrome --remote-debugging-port=9222
22-
```
23-
2. In VS Code, run **"OIDC DevTools: Start Capture"** from the command palette
24-
3. Enter the debug port (default: 9222)
25-
4. Browse your app — auth-related events appear in the Timeline
20+
- Node.js 20+, pnpm 10+
21+
- A Chromium-based browser (Chrome, Chromium, Edge, Brave, Arc)
2622

27-
### Option 2: Launch configuration
23+
### 1. Build the extension
2824

29-
Add to `.vscode/launch.json`:
25+
From the **repository root**:
3026

31-
```json
32-
{
33-
"type": "oidc-devtools",
34-
"request": "launch",
35-
"name": "Debug OIDC Flow",
36-
"url": "http://localhost:3000",
37-
"port": 9222
38-
}
27+
```bash
28+
pnpm install
29+
pnpm build
30+
```
31+
32+
This builds all packages including the shared `devtools-core` and `devtools-ui` that the VS Code extension depends on.
33+
34+
### 2. Launch the extension
35+
36+
```bash
37+
code --extensionDevelopmentPath=/path/to/wolfcola-devtools/packages/vscode-extension
38+
```
39+
40+
This opens a VS Code window with the extension loaded. You should see the **OIDC DevTools** icon in the Activity Bar (left sidebar).
41+
42+
### 3. Launch your browser with remote debugging
43+
44+
**Important:** This must be a separate browser instance. If your normal browser is already running, the debug port flag gets silently ignored. Use `--user-data-dir` to force a new instance.
45+
46+
```bash
47+
# Chromium (Arch Linux, etc.)
48+
chromium --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test
49+
50+
# Google Chrome
51+
google-chrome --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test
52+
53+
# Microsoft Edge
54+
microsoft-edge --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test
55+
56+
# macOS Chrome
57+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test
58+
```
59+
60+
Verify CDP is working:
61+
62+
```bash
63+
curl http://localhost:9222/json
64+
```
65+
66+
You should see JSON listing page targets.
67+
68+
### 4. Connect and capture
69+
70+
1. In the VS Code extension window: `Ctrl+Shift+P`**"OIDC DevTools: Start Capture"**
71+
2. Enter `9222` when prompted for the port
72+
3. The status bar should show **"Connected"**
73+
4. Navigate your browser to a page with OIDC/OAuth traffic
74+
5. Auth-related events appear in the Timeline TreeView
75+
6. Click an event to open the Flow WebView with full details
76+
77+
### Quick test with the mock OIDC server
78+
79+
The repo includes a mock OIDC server for testing:
80+
81+
```bash
82+
# Terminal 1: start the mock server
83+
cd e2e && npx tsx mock-oidc-server/start.ts
84+
85+
# Terminal 2: launch browser
86+
chromium --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/oidc-devtools-test http://localhost:3000/test-app
3987
```
4088

89+
Then connect from VS Code and click **"Start OIDC Flow"** in the browser. You'll see discovery, token, and userinfo events captured in the Timeline.
90+
91+
## Troubleshooting
92+
93+
### "Failed to connect"
94+
95+
- Verify the browser is running with `--remote-debugging-port=9222`
96+
- Verify with `curl http://localhost:9222/json` — you should see JSON output
97+
- If your normal browser is already running, the debug port is silently ignored. Use `--user-data-dir=/tmp/oidc-devtools-test` to force a separate instance.
98+
99+
### Commands not appearing in the palette
100+
101+
- Make sure you launched VS Code with `--extensionDevelopmentPath=...` pointing to the `packages/vscode-extension` directory
102+
- The extension must be built first (`pnpm build` from the repo root)
103+
104+
### No events appearing
105+
106+
- The extension only captures auth-related requests (URLs matching `/authorize`, `/token`, `/userinfo`, `/.well-known/openid-configuration`, etc.)
107+
- Non-auth traffic (static assets, API calls) is filtered out
108+
- Check that the browser has an open tab with `http://` or `https://` URL (DevTools pages and `chrome://` URLs are filtered)
109+
41110
## Commands
42111

43112
| Command | Description |
44113
|---------|-------------|
45-
| OIDC DevTools: Start Capture | Connect to Chrome and begin capturing |
46-
| OIDC DevTools: Stop Capture | Disconnect from Chrome |
114+
| OIDC DevTools: Start Capture | Connect to browser and begin capturing |
115+
| OIDC DevTools: Stop Capture | Disconnect |
47116
| OIDC DevTools: Clear Events | Clear the timeline |
48117
| OIDC DevTools: Export Flow | Export as JSON or Markdown |
49118

@@ -54,32 +123,47 @@ VS Code Extension Host
54123
├── CDP Client (WebSocket → Chrome)
55124
│ ├── Network.requestWillBeSent / responseReceived / loadingFinished
56125
│ └── Runtime.bindingCalled ← injected SDK capture script
126+
├── handleMessage pipeline (from @wolfcola/devtools-core)
127+
│ ├── buildNetworkEvent → isAuthRelated filter
128+
│ ├── enrichWithOidcSemantics (annotateOidc + detectDpop + detectPar)
129+
│ ├── parseWellKnownResponse → OIDC config discovery
130+
│ └── EventStore (in-memory)
57131
├── TreeView Provider (Timeline)
58132
├── WebView Panel (Elm UI — Flow + Learn views)
59133
└── Status Bar (connection state + event count)
60134
```
61135

62-
The extension connects to Chrome's debug WebSocket, subscribes to the `Network` domain for HTTP traffic, and injects a small script to capture SDK events. Captured events flow through the same annotation pipeline and diagnosis engine as the browser extension (`@wolfcola/devtools-core`). The Elm UI (`@wolfcola/devtools-ui`) renders in a WebView with VS Code theme colors mapped to the panel's CSS variables.
136+
The extension runs the exact same `handleMessage` pipeline as the browser extension's service worker. Events flow through the same annotation engine, OIDC discovery, and diagnosis rules. The only difference is the transport: CDP WebSocket instead of `chrome.devtools.network`.
63137

64138
## Requirements
65139

66-
- Chromium-based browser (Chrome, Edge, Brave, Arc)
140+
- Chromium-based browser (Chrome, Chromium, Edge, Brave, Arc)
67141
- Browser must be launched with `--remote-debugging-port`
68-
69-
Firefox and Safari are not supported (CDP is Chromium-only).
142+
- Firefox and Safari are not supported (CDP is Chromium-only)
70143

71144
## Build
72145

146+
From the repo root:
147+
73148
```bash
74-
pnpm build
149+
pnpm install
150+
pnpm build # builds all packages including dependencies
75151
```
76152

77-
Outputs `dist/extension.js` (CJS, for VS Code extension host) and `dist/webview/` (Elm JS, CSS, adapter).
153+
Or just the VS Code extension (after dependencies are built):
78154

79-
## Testing
155+
```bash
156+
cd packages/vscode-extension && pnpm build
157+
```
158+
159+
## Development
80160

81161
```bash
82-
pnpm test # unit tests (vitest)
162+
# Watch mode (rebuilds on file changes)
163+
cd packages/vscode-extension && pnpm watch
164+
165+
# Run tests
166+
pnpm test
83167
```
84168

85169
## License

0 commit comments

Comments
 (0)