$ show Stoobly/stoobly-agent
Stoobly Agent is a monolithic Python application that acts as a man-in-the-middle HTTP(S) proxy for recording, mocking, replaying, and testing API interactions. Built on mitmproxy, it provides a comprehensive CLI (Click-based) for managing requests, scenarios, settings, and snapshots, as well as a scaffold system that generates full Docker Compose or local development workflows. The application supports four proxy modes (record, mock, test, develop) with configurable policies, rewrite rules, and lifecycle hooks that allow custom Python callbacks at various interception stages. It persists state to a local SQLite database via an ORM with migrations, and optionally integrates with a remote Stoobly cloud service for project and scenario management. The codebase exhibits a solid architecture with adapter patterns for converting between different HTTP representations (mitmproxy, Python requests, raw, ORM, Stoobly API), factory patterns for resource creation, and builder patterns for Docker Compose generation. However, it suffers from some technical drift (deprecated mitmproxy API usage, many lazy imports, global singletons) and the test suite includes flaky end-to-end tests that depend on external services. Overall, it is a well-crafted tool for API development and testing, with several reusable components, particularly the HTTP adapter system.
The LLM identified 1 files worth highlighting for reuse:
The adapter system provides a clean, extensible set of factories and adapters for converting between different HTTP request/response representations: mitmproxy flows, Python requests objects, raw HTTP strings, ORM model instances, and Stoobly API resources. Each adapter implements a consistent interface, and factories (e.g., `PythonRequestAdapterFactory`, `MitmproxyRequestAdapterFactory`) allow callers to instantiate the appropriate adapter without tight coupling. This component is self-contained (depends only on standard library and simple internal data classes) and could be extracted into a standalone library for any project that needs to convert between multiple HTTP formats. It demonstrates non-obvious skill in designing a type-safe, extensible conversion layer.