Astro is a foundation for custom AI software agents fork of Cline, as a foundation that can have specialized functionalities and capabilities applicable to different domains and industries. It includes Cline's general functionality, with additional customizations and features.
npm run build- Production build using ESBuild with dual targetsnpm run build:standalone- Standalone server build for non-VSCode environmentsnpm run build:watch- Watch mode for development with auto-rebuildnpm run build:proto- Generate TypeScript from Protocol Buffer definitionsnpm run dev:extension- Development mode with watch and hot reloadnpm run dev:webview- Start Vite dev server with HMR for React frontend
npm test- Run full test suite (unit + integration + e2e)npm run test:unit- Jest unit tests with coveragenpm run test:integration- Service integration testsnpm run test:e2e- Playwright end-to-end tests in VSCodenpm run lint- Biome linting (replaces ESLint)npm run format- Biome code formatting (replaces Prettier)npm run typecheck- TypeScript strict type checking
npm run package- Create.vsixextension packagenpm run package:standalone- Package standalone server distributionnpm run vscode:prepublish- Pre-publish build hook
Astro builds upon the architecture and patterns established in Cline, with modifications to support its specialized agent functionalities. Key adaptations include agent-specific branding and configuration settings:
- Custom configuration file:
src/shared/Configuration.ts - Custom package configuration:
package.json
- gRPC-First Communication: All UI-backend communication uses Protocol Buffers over gRPC streaming
- Multi-Instance Pattern: Supports simultaneous sidebar and tab webview instances with shared state
- Host Abstraction Layer: Platform-agnostic core with VSCode-specific host implementations
- Event-Driven State: Real-time state synchronization via gRPC streaming subscriptions
- Command-Query Separation: UI dispatches commands, subscribes to state changes
- Service Registry Pattern: Centralized dependency injection with lifecycle management
- Biome Toolchain: Single tool for linting, formatting, and import sorting
- TypeScript Strict: All strict mode flags enabled, no implicit any
- Path Aliases: Extensive use of
@core,@services,@shared,@utilsimports - No console.log: Use Logger service for all output
- Async-First: Promise-based APIs with proper error handling
- No Comments Unless Required: Self-documenting code preferred
- Co-located Tests:
.test.tsfiles alongside source or in__tests__/directories - gRPC Service Testing: Mock service implementations for unit tests
- Extension Context Testing: Tests require VSCode extension environment simulation
- Cross-Platform Testing: Windows/Mac/Linux compatibility matrix
- Performance Testing: gRPC request/response recording and playback
controller/- gRPC service implementations organized by domainaccount/- Authentication and user management endpointsbrowser/- Chrome DevTools Protocol browser automationcheckpoints/- File diff and restore capabilitiescommands/- VSCode command integrations (add, fix, explain, improve)dictation/- Audio recording and transcription servicesmcp/- Model Context Protocol server managementmodels/- AI provider model discovery and configurationtask/- Task lifecycle management and historystate/- Global application state managementweb/- Web content fetching and Open Graph data
webview/- WebView provider abstractions with multi-instance supportassistant-message/- AI conversation message processing and streamingworkspace/- Workspace context and file system operations
vscode/- VSCode extension host implementationhostbridge/- gRPC client for host services- Command utils, diff providers, webview providers
external/- External host capabilities for standalone modehost-provider/- Host abstraction factory pattern
auth/- Authentication flows (OAuth, API keys, cloud accounts)telemetry/- PostHog analytics with privacy controlslogging/- Centralized logging with multiple output channelstest/- Testing utilities and mock implementationsdictation/- Audio recording service with cleanuperror/- Error reporting and crash analyticsfeature-flags/- Runtime feature toggle managementposthog/- Analytics client with batching and retry
checkpoints/- File diff tracking and restoration systemgit/- Git operations and AI-powered commit generationclaude-code/- Anthropic Claude API integration- MCP servers, browser automation, external tools
cline/- Main service definitionsui.proto- UI state management and webview communicationtask.proto- Task execution and lifecyclemodels.proto- AI provider model managementmcp.proto- Model Context Protocol server managementaccount.proto- User authentication and organization managementbrowser.proto- Browser automation capabilitiesdictation.proto- Audio recording and transcription
host/- Host bridge service definitionsworkspace.proto- File system and workspace operationsdiff.proto- File diffing and merge operationsenv.proto- Environment and system informationwindow.proto- UI notifications and dialogstesting.proto- Test execution and debugging
- React 18 with TypeScript and Tailwind CSS
- Vite build system with HMR and hot reload
- gRPC-Web client for real-time backend communication
- VSCode Webview Toolkit components for native look-and-feel
- Dual Target Architecture:
- Extension bundle:
dist/extension.js(VSCode-specific) - Standalone bundle:
dist-standalone/cline-core.js(platform-agnostic)
- Extension bundle:
- Advanced Path Resolution: Custom alias resolver plugin for
@imports - Tree Shaking: Production minification with development source maps
- External Dependencies: VSCode API, gRPC reflection, better-sqlite3 excluded
- Asset Pipeline: Automatic WASM file copying for tree-sitter language parsers
- Environment Injection: Build-time variable replacement for API keys
- Multi-Target Generation:
- Generic TypeScript interfaces for shared types
- gRPC-JS service implementations for server-side
- nice-grpc promise-based clients for frontend
- Binary descriptor sets for runtime reflection
- Cross-Platform Compatibility: Windows/Mac/Linux protoc handling
- Apple Silicon Support: Automatic Rosetta 2 compatibility checking
- Generated Code Organization: Separate output directories by target type
- Hot Module Replacement: Vite dev server with React Fast Refresh
- Extension Hot Reload: File watcher triggers VSCode window reload
- gRPC Request Recording: Automated test fixture generation
- Problem Matcher Integration: ESBuild errors formatted for VSCode
CLINE_ENVIRONMENT- Runtime environment (development/staging/production)TELEMETRY_SERVICE_API_KEY- PostHog analytics service keyERROR_SERVICE_API_KEY- Error reporting service credentials
- Cloud APIs: Anthropic Claude, OpenAI GPT, OpenRouter, Groq, Baseten
- Local Models: Ollama, LM Studio, VSCode Language Models API
- Enterprise: SAP AI Core, Hugging Face Inference, Vercel AI Gateway
- Custom: Requesty proxy, OpenAI-compatible endpoints
- Browser Automation: Chrome DevTools Protocol for web scraping and interaction
- MCP (Model Context Protocol): Extensible tool and resource server ecosystem
- Git Integration: Native git operations with AI-powered commit message generation
- Authentication: Firebase Auth for cloud accounts, OAuth for providers
- Analytics: PostHog for feature flags, usage tracking, and A/B testing
- File Parsing: Tree-sitter WASM parsers for syntax analysis across 15+ languages
- Content Security Policy: Strict CSP with nonce-based script execution
- Resource Isolation: Extension-scoped asset access only
- External Domain Allowlist: Limited to AI providers and analytics endpoints
- Script Injection Prevention: No unsafe-inline, eval restrictions
- VSCode Secure Storage: API keys encrypted at rest in OS keychain
- OAuth Token Management: Secure refresh token handling with automatic cleanup
- Workspace Scoping: File access limited to opened workspace boundaries
- Telemetry Privacy: User-controlled data collection with granular opt-out
- Shared Authentication: Account state synchronized across all webview instances
- Instance Isolation: Task state isolated per webview instance
- Cross-Window Communication: gRPC streaming for real-time state updates
- Node.js 18+ with npm 8+
- VSCode with extension development support
- Protocol Buffers: Auto-installed via grpc-tools package
- Platform-Specific: Rosetta 2 required for macOS Apple Silicon
- Optional: Chrome/Chromium for browser automation features
npm install- Install dependencies and prepare workspacenpm run build:proto- Generate TypeScript from Protocol Buffer definitionsnpm run build- Initial build of both extension and standalone targets- F5 in VSCode - Launch Extension Development Host with debugger attached
npm run dev:webview- Start frontend development server with HMR
- Unit Tests:
npm run test:unit- Fast feedback for service logic - Integration Tests:
npm run test:integration- Full service stack testing - E2E Tests:
npm run test:e2e- VSCode extension behavior validation - Continuous Testing:
npm run test:watch- Auto-run tests on file changes
- Streaming-First: All UI state updates use bidirectional gRPC streams
- Service Discovery: Generated service clients auto-discover endpoints
- Error Handling: gRPC status codes mapped to user-friendly error messages
- Connection Lifecycle: Automatic reconnection with exponential backoff
- Instance Tracking: Static registry maintains active webview references
- State Isolation: Each instance has independent task and conversation state
- Focus Management: Last active instance tracking for command routing
- Cleanup: Proper disposal prevents memory leaks on webview destruction
- Path Resolution: Custom workspace resolver handles cross-platform paths
- Security Boundaries: All file operations scoped to workspace directories
- Change Detection: File watcher integration for real-time updates
- Permission Handling: User prompts for file modifications outside workspace
- External Modules: better-sqlite3, grpc packages cannot be bundled by ESBuild
- WASM Assets: Tree-sitter parsers copied as separate files to output directory
- Platform Binaries: ripgrep binary discovered from VSCode installation
- Runtime Loading: Dynamic imports for platform-specific functionality
- Chrome Discovery: Automatic detection of Chrome/Chromium installation paths
- Debug Mode: Programmatic Chrome launch with remote debugging enabled
- Connection Management: Chrome DevTools Protocol WebSocket connection handling
- Error Recovery: Graceful fallback when browser automation unavailable
- Lazy Loading: Development tools and testing utilities loaded on demand
- Stream Cleanup: Proper disposal of gRPC streams prevents resource leaks
- WebView Context:
retainContextWhenHiddenprevents expensive re-initialization - Tree Shaking: ESBuild eliminates unused code paths in production builds
- Extension Context: Tests require VSCode extension API simulation
- gRPC Mocking: Service implementations need proper stream lifecycle mocking
- Async Cleanup: Streaming operations require explicit cleanup in test teardown
- Platform Testing: Separate test execution for Windows/Mac/Linux file system differences
