Skip to content

Commit f9c8483

Browse files
Feature/upgrade deps (#151)
* Upgrade Dependencies * Upgraded svelte * Add project-specific Claude agent configuration and AGENTS.md Add coding standards, architecture docs, and agent configurations tailored for the Exceptionless.JavaScript TypeScript SDK monorepo. Clean up settings.local.json to remove stale paths from another project. * Migrate ESLint to flat config (eslint.config.mjs) Replace legacy .eslintrc.js and .eslintignore with ESLint flat config. - Use typescript-eslint v8 with projectService for type-aware linting - Add eslint-plugin-jest for test file rules - Remove unused Live Server extension recommendation - Removed the need for eslint-plugin-import and other legacy plugins * Fix lint errors from ESLint flat config migration - Remove unused catch binding variables (BrowserGlobalHandlerPlugin) - Replace short-circuit expressions with if statements (Configuration, DefaultEventQueue) - Fix duplicate test titles in Utils.test.ts (toBoolean) - Fix React error boundary componentDidCatch to use void instead of async Upgrade root and library package dependencies Root: - eslint 10.x, @eslint/js 10.x, typescript-eslint 8.x (flat config) - eslint-config-prettier 10.x, eslint-plugin-jest 29.x - typescript 5.9.x, prettier 3.8.x, rimraf 6.x - Replace npm-run-all (unmaintained) with npm-run-all2 8.x - Remove legacy ESLint plugins (import, jsdoc, eslint-comments, eslint-plugin) Library packages (core, browser, node, react): - Jest 30.x, @jest/globals 30.x, jest-environment-jsdom 30.x - ts-jest 29.4.x (supports Jest 30) - @types/react 19.2.x, @types/react-dom 19.2.x Upgrade example app dependencies - Express 5.x (from 4.x) - React 19.2.x, react-dom 19.2.x - Vite 6.3+ (all apps) - Vue 3.5.30, @vue/compiler-sfc 3.5.30 - Svelte 5.55.x, svelte-check 4.4.x, @sveltejs/vite-plugin-svelte 6.x - @vitejs/plugin-react 4.7.x - @testing-library/jest-dom 6.9.x, @testing-library/react 16.3.x - Fix Prettier formatting in example files Regenerate package-lock.json Clean lockfile regeneration after all dependency upgrades. Migrate from tseslint.config() to defineConfig() tseslint.config() is deprecated in favor of ESLint core's defineConfig() from eslint/config (available since ESLint v9.22.0). Use extends property for shared config arrays instead of spreading. Remove jQuery dependency from browser example Replace $.ajax call with native fetch() API. jQuery was only used for the AJAX demo button. This removes the last jQuery dependency and eliminates the need to track jQuery major version updates. Upgrade esbuild to 0.27, update dep specifiers - Upgrade esbuild from ^0.25.0 to ^0.27.0 across all library packages - Update @eslint/js specifier to ^10.0.1 - Update typescript-eslint specifier to ^8.57.2 - Fix vue package watch script syntax error (& &&) Upgrade remaining example dependencies - @vitejs/plugin-vue 5.x → 6.x (supports vite 5-8) - @sveltejs/adapter-auto 4.x → 7.x (peer: @sveltejs/kit ^2) - vitest 3.x → 4.x (supports vite 6-8) Regenerate package-lock.json agent-brower skill reverted changes Upgrade TypeScript to 6.0 - TypeScript ^6.0.2 in root and svelte-kit package.json - Change moduleResolution from Node to Bundler (deprecated in TS 6) - Add types: [angular] to angularjs tsconfig for Bundler compat - Configure ts-jest with ignoreDeprecations: 6.0 (ts-jest forces module: commonjs which triggers TS 6 node10 deprecation warning) Format agent-browser skill files with Prettier Regenerate package-lock.json for TypeScript 6 Fix unused catch variables with trace logging - Remove caughtErrors: none ESLint rule override - Add trace logging in BrowserGlobalHandlerPlugin catch blocks for rejection detail and error property access failures * Adopt #/ subpath imports (TS 6 feature) - Add package.json imports field with source/default conditions to all library packages (core, browser, node, react) - Convert all relative imports in src/ and test/ files to #/ paths - Add paths mapping in each package's tsconfig.json for tsc resolution - Add --conditions=source to esbuild commands for source bundling - Replace jest-ts-webcompat-resolver with custom jest-resolver.cjs that supports package.json imports field per-package resolution and .js → .ts extension mapping * Update CI and runtime configuration - Add .npmrc with legacy-peer-deps=true (TS 6 peer dep workaround) - Update GitHub Actions matrix: Node 22 + 24 (drop Node 20) - Use --legacy-peer-deps in CI npm install step - Bump node engine to >=22 (Node 22 LTS) - Replace ts-jest ignoreDeprecations with diagnostics: false (tsc handles type checking, ts-jest only transpiles) * Update CI configuration and harden Jest resolver - Upgrade GitHub Action versions (checkout v6, setup-node v6, cache v5) - Add .NET 8 SDK to CI for MinVer versioning support - Define explicit GHA permissions (contents: read, packages: write) - Add path traversal validation to jest-resolver.cjs to ensure imports remain within the package root * Potential fix for code scanning alert no. 6: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6898ae6 commit f9c8483

File tree

100 files changed

+11383
-30036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+11383
-30036
lines changed

.agents/skills/agent-browser/SKILL.md

Lines changed: 690 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
# Authentication Patterns
2+
3+
Login flows, session persistence, OAuth, 2FA, and authenticated browsing.
4+
5+
**Related**: [session-management.md](session-management.md) for state persistence details, [SKILL.md](../SKILL.md) for quick start.
6+
7+
## Contents
8+
9+
- [Import Auth from Your Browser](#import-auth-from-your-browser)
10+
- [Persistent Profiles](#persistent-profiles)
11+
- [Session Persistence](#session-persistence)
12+
- [Basic Login Flow](#basic-login-flow)
13+
- [Saving Authentication State](#saving-authentication-state)
14+
- [Restoring Authentication](#restoring-authentication)
15+
- [OAuth / SSO Flows](#oauth--sso-flows)
16+
- [Two-Factor Authentication](#two-factor-authentication)
17+
- [HTTP Basic Auth](#http-basic-auth)
18+
- [Cookie-Based Auth](#cookie-based-auth)
19+
- [Token Refresh Handling](#token-refresh-handling)
20+
- [Security Best Practices](#security-best-practices)
21+
22+
## Import Auth from Your Browser
23+
24+
The fastest way to authenticate is to reuse cookies from a Chrome session you are already logged into.
25+
26+
**Step 1: Start Chrome with remote debugging**
27+
28+
```bash
29+
# macOS
30+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222
31+
32+
# Linux
33+
google-chrome --remote-debugging-port=9222
34+
35+
# Windows
36+
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
37+
```
38+
39+
Log in to your target site(s) in this Chrome window as you normally would.
40+
41+
> **Security note:** `--remote-debugging-port` exposes full browser control on localhost. Any local process can connect and read cookies, execute JS, etc. Only use on trusted machines and close Chrome when done.
42+
43+
**Step 2: Grab the auth state**
44+
45+
```bash
46+
# Auto-discover the running Chrome and save its cookies + localStorage
47+
agent-browser --auto-connect state save ./my-auth.json
48+
```
49+
50+
**Step 3: Reuse in automation**
51+
52+
```bash
53+
# Load auth at launch
54+
agent-browser --state ./my-auth.json open https://app.example.com/dashboard
55+
56+
# Or load into an existing session
57+
agent-browser state load ./my-auth.json
58+
agent-browser open https://app.example.com/dashboard
59+
```
60+
61+
This works for any site, including those with complex OAuth flows, SSO, or 2FA -- as long as Chrome already has valid session cookies.
62+
63+
> **Security note:** State files contain session tokens in plaintext. Add them to `.gitignore`, delete when no longer needed, and set `AGENT_BROWSER_ENCRYPTION_KEY` for encryption at rest. See [Security Best Practices](#security-best-practices).
64+
65+
**Tip:** Combine with `--session-name` so the imported auth auto-persists across restarts:
66+
67+
```bash
68+
agent-browser --session-name myapp state load ./my-auth.json
69+
# From now on, state is auto-saved/restored for "myapp"
70+
```
71+
72+
## Persistent Profiles
73+
74+
Use `--profile` to point agent-browser at a Chrome user data directory. This persists everything (cookies, IndexedDB, service workers, cache) across browser restarts without explicit save/load:
75+
76+
```bash
77+
# First run: login once
78+
agent-browser --profile ~/.myapp-profile open https://app.example.com/login
79+
# ... complete login flow ...
80+
81+
# All subsequent runs: already authenticated
82+
agent-browser --profile ~/.myapp-profile open https://app.example.com/dashboard
83+
```
84+
85+
Use different paths for different projects or test users:
86+
87+
```bash
88+
agent-browser --profile ~/.profiles/admin open https://app.example.com
89+
agent-browser --profile ~/.profiles/viewer open https://app.example.com
90+
```
91+
92+
Or set via environment variable:
93+
94+
```bash
95+
export AGENT_BROWSER_PROFILE=~/.myapp-profile
96+
agent-browser open https://app.example.com/dashboard
97+
```
98+
99+
## Session Persistence
100+
101+
Use `--session-name` to auto-save and restore cookies + localStorage by name, without managing files:
102+
103+
```bash
104+
# Auto-saves state on close, auto-restores on next launch
105+
agent-browser --session-name twitter open https://twitter.com
106+
# ... login flow ...
107+
agent-browser close # state saved to ~/.agent-browser/sessions/
108+
109+
# Next time: state is automatically restored
110+
agent-browser --session-name twitter open https://twitter.com
111+
```
112+
113+
Encrypt state at rest:
114+
115+
```bash
116+
export AGENT_BROWSER_ENCRYPTION_KEY=$(openssl rand -hex 32)
117+
agent-browser --session-name secure open https://app.example.com
118+
```
119+
120+
## Basic Login Flow
121+
122+
```bash
123+
# Navigate to login page
124+
agent-browser open https://app.example.com/login
125+
agent-browser wait --load networkidle
126+
127+
# Get form elements
128+
agent-browser snapshot -i
129+
# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Sign In"
130+
131+
# Fill credentials
132+
agent-browser fill @e1 "user@example.com"
133+
agent-browser fill @e2 "password123"
134+
135+
# Submit
136+
agent-browser click @e3
137+
agent-browser wait --load networkidle
138+
139+
# Verify login succeeded
140+
agent-browser get url # Should be dashboard, not login
141+
```
142+
143+
## Saving Authentication State
144+
145+
After logging in, save state for reuse:
146+
147+
```bash
148+
# Login first (see above)
149+
agent-browser open https://app.example.com/login
150+
agent-browser snapshot -i
151+
agent-browser fill @e1 "user@example.com"
152+
agent-browser fill @e2 "password123"
153+
agent-browser click @e3
154+
agent-browser wait --url "**/dashboard"
155+
156+
# Save authenticated state
157+
agent-browser state save ./auth-state.json
158+
```
159+
160+
## Restoring Authentication
161+
162+
Skip login by loading saved state:
163+
164+
```bash
165+
# Load saved auth state
166+
agent-browser state load ./auth-state.json
167+
168+
# Navigate directly to protected page
169+
agent-browser open https://app.example.com/dashboard
170+
171+
# Verify authenticated
172+
agent-browser snapshot -i
173+
```
174+
175+
## OAuth / SSO Flows
176+
177+
For OAuth redirects:
178+
179+
```bash
180+
# Start OAuth flow
181+
agent-browser open https://app.example.com/auth/google
182+
183+
# Handle redirects automatically
184+
agent-browser wait --url "**/accounts.google.com**"
185+
agent-browser snapshot -i
186+
187+
# Fill Google credentials
188+
agent-browser fill @e1 "user@gmail.com"
189+
agent-browser click @e2 # Next button
190+
agent-browser wait 2000
191+
agent-browser snapshot -i
192+
agent-browser fill @e3 "password"
193+
agent-browser click @e4 # Sign in
194+
195+
# Wait for redirect back
196+
agent-browser wait --url "**/app.example.com**"
197+
agent-browser state save ./oauth-state.json
198+
```
199+
200+
## Two-Factor Authentication
201+
202+
Handle 2FA with manual intervention:
203+
204+
```bash
205+
# Login with credentials
206+
agent-browser open https://app.example.com/login --headed # Show browser
207+
agent-browser snapshot -i
208+
agent-browser fill @e1 "user@example.com"
209+
agent-browser fill @e2 "password123"
210+
agent-browser click @e3
211+
212+
# Wait for user to complete 2FA manually
213+
echo "Complete 2FA in the browser window..."
214+
agent-browser wait --url "**/dashboard" --timeout 120000
215+
216+
# Save state after 2FA
217+
agent-browser state save ./2fa-state.json
218+
```
219+
220+
## HTTP Basic Auth
221+
222+
For sites using HTTP Basic Authentication:
223+
224+
```bash
225+
# Set credentials before navigation
226+
agent-browser set credentials username password
227+
228+
# Navigate to protected resource
229+
agent-browser open https://protected.example.com/api
230+
```
231+
232+
## Cookie-Based Auth
233+
234+
Manually set authentication cookies:
235+
236+
```bash
237+
# Set auth cookie
238+
agent-browser cookies set session_token "abc123xyz"
239+
240+
# Navigate to protected page
241+
agent-browser open https://app.example.com/dashboard
242+
```
243+
244+
## Token Refresh Handling
245+
246+
For sessions with expiring tokens:
247+
248+
```bash
249+
#!/bin/bash
250+
# Wrapper that handles token refresh
251+
252+
STATE_FILE="./auth-state.json"
253+
254+
# Try loading existing state
255+
if [[ -f "$STATE_FILE" ]]; then
256+
agent-browser state load "$STATE_FILE"
257+
agent-browser open https://app.example.com/dashboard
258+
259+
# Check if session is still valid
260+
URL=$(agent-browser get url)
261+
if [[ "$URL" == *"/login"* ]]; then
262+
echo "Session expired, re-authenticating..."
263+
# Perform fresh login
264+
agent-browser snapshot -i
265+
agent-browser fill @e1 "$USERNAME"
266+
agent-browser fill @e2 "$PASSWORD"
267+
agent-browser click @e3
268+
agent-browser wait --url "**/dashboard"
269+
agent-browser state save "$STATE_FILE"
270+
fi
271+
else
272+
# First-time login
273+
agent-browser open https://app.example.com/login
274+
# ... login flow ...
275+
fi
276+
```
277+
278+
## Security Best Practices
279+
280+
1. **Never commit state files** - They contain session tokens
281+
282+
```bash
283+
echo "*.auth-state.json" >> .gitignore
284+
```
285+
286+
2. **Use environment variables for credentials**
287+
288+
```bash
289+
agent-browser fill @e1 "$APP_USERNAME"
290+
agent-browser fill @e2 "$APP_PASSWORD"
291+
```
292+
293+
3. **Clean up after automation**
294+
295+
```bash
296+
agent-browser cookies clear
297+
rm -f ./auth-state.json
298+
```
299+
300+
4. **Use short-lived sessions for CI/CD**
301+
```bash
302+
# Don't persist state in CI
303+
agent-browser open https://app.example.com/login
304+
# ... login and perform actions ...
305+
agent-browser close # Session ends, nothing persisted
306+
```

0 commit comments

Comments
 (0)