$ show scriptscat/scriptcat
ScriptCat is a sophisticated browser extension for managing userscripts with advanced AI agent capabilities. It features a multi-context architecture (content scripts, service worker, offscreen documents, popup/options UI) built with React, TypeScript, and modern web extension APIs. The extension provides userscript installation, execution, synchronization, network rule management, and an integrated AI chat interface with tool execution capabilities. Its architecture demonstrates strong separation of concerns and implements several reusable patterns for cross-context communication, storage abstraction, and caching.
The LLM identified 5 files worth highlighting for reuse:
A robust cross-context messaging system enabling communication between content scripts, service workers, offscreen documents, and popup/options pages. Implements message queues with middleware support, custom event-based DOM messaging, and extension message wrapping. Handles connection lifecycle, message routing, and provides both low-level and high-level messaging abstractions.
A pluggable filesystem abstraction providing a unified interface for various cloud storage providers (WebDAV, Google Drive, Dropbox, OneDrive, Baidu, S3) and local ZIP files. Each provider implements a consistent interface with read/write operations, path handling, and error normalization. Uses factory pattern for dynamic provider selection based on configuration.
A transactional cache implementation with TTL-like behavior, batch operations, and automatic cleanup. Supports cache invalidation strategies and provides clean API for get/set/batch operations. Includes transaction support for atomic operations and demonstrates sophisticated cache management patterns.
A well-designed abstraction over the Origin Private File System providing file operations (read, write, list, delete, readAttachment) with proper error handling and path normalization. Demonstrates safe OPFS usage in browser extension context, handling asynchronous operations and providing clean API for agent systems needing persistent file storage.
A sophisticated domain pattern matching system for network rules handling wildcard domains, IP addresses, and complex matching logic. Includes proper validation, error handling, and test coverage. Solves the common problem of implementing flexible yet secure URL matching for content filtering or network request modification.