This is a production-style prototype for the Microcks VS Code extension. It validates the architectural feasibility of using the microcks-cli as the sole bridge between the editor and the Microcks ecosystem.
Key Architectural Decisions
CLI-Only Integration: The extension never calls the Microcks API directly. This ensures that any improvements made to the CLI (authentication, container management, environment handling) are automatically inherited by the extension.
Structured JSON Flow: The extension expects the CLI to provide machine-readable outputs (using the --format json flag), which are parsed into TypeScript models.
Native Diagnostics: Test failures are mapped directly to VS Code's DiagnosticCollection, surfacing errors in the "Problems" panel and inline in the editor.
Asynchronous Execution: All CLI calls are handled via child_process.exec inside CLIRunner, providing a non-blocking UI experience with progress indicators.
Workflow
Import: Right-click an OpenAPI spec in the explorer and select Microcks: Import Current API Spec. This executes microcks import <file>.
Dry Run: Select Microcks: Run Dry Run Test. This triggers an ephemeral Microcks container via the CLI, runs contract tests, and returns a JSON report.
Analyze: If tests fail, the "Problems" panel will populate with the specific operations that failed, and the "Microcks Output" channel will show the raw execution logs.
Project Structure
src/cli/: Logic for executing and parsing CLI commands.
src/diagnostics/: Mapping test results to editor diagnostics.
src/models/: TypeScript interfaces for CLI and internal state.
src/providers/: Sidebar TreeView implementation.
src/extension.ts: Main entry point and command registration.
Requirements
microcks-cli installed and available in the system PATH (or configured in extension settings).
Docker (required for --dry-run functionality in the CLI).