$ show DanielXMoore/Civet
Civet is a full-featured compiler and language server for a CoffeeScript-like language that transpiles to TypeScript/JavaScript. It provides a CLI, bundler plugins (Vite, Webpack, esbuild, Rollup, etc.), Babel plugin, ESLint plugin, ESM loader, and browser script runner. The core compiler implements advanced features like pattern matching, pipe operators, JSX enhancements, and compile-time evaluation. The language server (LSP) delivers IDE features including diagnostics, completions, go-to-definition, hover, and rename across VS Code, Sublime Text, Zed, and Monaco. The repository is structured as a monorepo with the compiler in `source/`, a standalone LSP server in `lsp/server/`, editor extensions, tree-sitter grammars, and a documentation site at civet.dev. Notable architecture includes a PEG grammar parser (Hera), source map composition utilities, an in-memory TypeScript service host, and a worker pool for parallel compilation. The test suite enforces 100% coverage gates, ensuring high reliability. Civet demonstrates strong engineering practices: self-hosting compiler, comprehensive golden tests, CI/CD pipelines, and a modular plugin system for bundlers. While complexity arises from supporting many editor integrations and bundler adapters, the core compiler and LSP are cleanly separated. The project is actively maintained with frequent releases and community contributions.
The LLM identified 5 files worth highlighting for reuse:
Implements VLQ encode/decode, SourceMap composition (composeUpstream, composeDownstream, composeLines), inline-map remapping, and base64 data URLs. This module is self-contained (no imports from internal Civet modules) and can be extracted as a generic source-map utility for any transpiler or build tool.
Provides a test harness for LSP servers by spawning the LSP server as a subprocess, parsing JSON-RPC frames over stdio, and exposing a clean asynchronous API (request, notify, waitFor, waitForNotification). This is reusable for testing any Language Server that communicates via stdio, not just Civet's LSP.
Implements a generic worker pool using Node.js worker threads. Exports createWorkerPool that manages a queue of jobs, handles source-map restoration from worker messages, and provides thread management. It is decoupled from Civet's internals and can be reused for parallelizing any CPU-bound task.
Provides createMemoryCache and createDiskCache with stable stringify for keys, mtime-based touch for LRU-like behavior, and fallback read/noop functions. This pure utility module has no dependencies on Civet types and can be extracted for any project needing simple caching.
Contains reusable test helpers: captureProcess (captures stdout/stderr/exit code), waitFor (polls for a condition), argsParse/argsOptions (assert parsed CLI options), and makeCivetTempFile. These are framework-independent and can be adapted to test any CLI tool that produces output and exits.