See the README.md for more information about the project architecture and how it works.
This project uses pnpm for package management. Always use pnpm commands instead of npm or yarn.
Always run lint after modifying any .ts, .tsx, or .js files in popup-app/:
cd popup-app && pnpm run checkThis runs Biome to lint and format the code.
Check for build errors without a full build:
xcodebuild -scheme devtools -destination 'generic/platform=iOS' build 2>&1 | grep -E "(error:|warning:)"Using generic/platform=iOS skips simulator-specific compilation and is faster than specifying a device.
Shared/- Swift code shared between host app and extension (Settings, SwiftData models)devtools/- SwiftUI host appdevtools Extension/- Safari extensionpopup-app/- Vite + React + TypeScript popup UI sourcetest-app/- Test web app for development
# Build all web files (popup, content script, inject script)
cd popup-app && pnpm run build
# Lint and format
cd popup-app && pnpm run check
# Run test app
cd test-app && pnpm devShared/Settings.swift- Shared settings via App Group UserDefaultsShared/DebugLog.swift- SwiftData model for console logsShared/NetworkLog.swift- SwiftData model for network requestsdevtools/DevToolsApp.swift- SwiftUI app entry point with SwiftData containerdevtools/ContentView.swift- Main TabView (Setup, Console, Network, Settings)devtools/DebugView.swift- Console log viewer with filteringdevtools/NetworkView.swift- Network request viewer with detail sheetdevtools/SettingsView.swift- App settings (limits, retention, clear data)devtools Extension/SafariWebExtensionHandler.swift- Handles native messages, stores logs
popup-app/src/inject.ts- Runs in page context, intercepts console/networkpopup-app/src/content.ts- Content script, bridges page and extensionpopup-app/src/App.tsx- Main popup UI componentdevtools Extension/Resources/background.js- Message broker, sends to native handlerdevtools Extension/Resources/manifest.json- Extension manifest
The host app and extension share data via App Group: group.co.za.stephancill.devtools
- Settings are stored in
UserDefaults(suiteName:) - Logs are stored in SwiftData at the App Group container
This project requires iOS 17+ for SwiftData support.
The Xcode project has a build phase that automatically runs pnpm build before compiling the iOS app.