A lightweight TypeScript HTTP server that acts as a shim for image-builder-cli. Built with Bun and Hono, it provides a Unix socket-based API with automatic OpenAPI type generation from the image-builder-crc repo.
- Bun >= 1.0.0
- Node.js >= 18 (for TypeScript compilation)
npm install -g bun
- Clone the repository:
git clone <repository-url>
cd decomposer
- Install dependencies:
bun install
- Generate OpenAPI types:
bun generate
Start the development server with hot reload:
bun dev
You can specify a custom store path:
STORE_PATH=/custom/path/to/store bun start
Or pass it as a command-line argument:
bun start --store /custom/path/to/store
Or in a .env file:
STORE_PATH=/custom/path/to/store
See the list of supported endpoints and how to make requests from your terminal.
The server listens on a Unix socket at /run/decomposer-httpd.sock
with permissions set to 775
for multi-user access.
The project includes tools to automatically generate TypeScript types from OpenAPI specifications:
-
Filter OpenAPI spec:
bun api:filter
This downloads the latest OpenAPI spec from image-builder-crc and filters it to include only relevant endpoints.
-
Generate TypeScript types:
bun api:generate
This generates TypeScript interfaces and Zod schemas from the filtered OpenAPI spec.
-
Run both steps:
bun generate
Some of the endpoint documentation and example requests are generated. If you have added
new endpoints, ensure you add some TSDocs
with the endpoint description. If the module
is new, you might have to add it to tools/docs/markdown.ts
.
- **Generate **:
bun docs
- Linting:
bun lint
- Formatting:
bun format
- Format Check:
bun format:check
- Testing:
bun test
- Type Check:
bun check
- Circular Dependency Check:
bun circular
- Fork the repository
- Create a feature branch
- Make your changes
- Run the test suite:
bun test
- Ensure code quality:
bun lint && bun format:check
- Submit a pull request
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- image-builder-cli - The command line tool used to build the images
- image-builder-crc - The upstream image builder service