DEV Community

Agentfield247
Agentfield247

Posted on

Fixing a Critical CLI Crash: How a One‑Line Import Bug Broke Every Bazable Command

Summer Bug Smash: Clear the Lineup 🐛🛹

This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry.

Project Overview

Bazable is a Git-native API contract management CLI that scans your codebase, builds an API contract automatically, and enforces it across your team with cloud sync, mock servers, and backend code generation. It supports JavaScript, TypeScript, HTML, and presets for Python, PHP, Go, Ruby.

Bug Fix or Performance Improvement

After adding the Language Server Protocol (bazable lsp) feature, every command in Bazable crashed on startup with:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './node.js' is not defined by "exports"
Enter fullscreen mode Exit fullscreen mode

This meant users could not run even bazable --version because the broken LSP import was loaded when the CLI booted. The fix was to change the import from vscode-languageserver/node.js to vscode-languageserver/node. This one-line correction restored full CLI functionality and made the LSP server start correctly.

Code

GitHub logo Agentfield247 / bazable

Git‑native API contract management CLI. Bazable reads your codebase (frontend, backend, or both), builds an API contract automatically, and enforces it across your team with cloud sync, mock servers, and backend code generation.

Bazable Logo

Bazable

Git‑native API contract management CLI.
Bazable reads your codebase (frontend, backend, or both), builds an API contract automatically, and enforces it across your team with cloud sync, mock servers, and backend code generation.


Why Bazable?

  • Extract APIs automatically from any language (JS/TS/HTML + presets for Python, PHP, Go, Ruby)
  • Catch breaking changes before they reach production – dead URLs, payload type mismatches, over‑fetching
  • No manual configuration – Bazable auto‑detects your API wrappers (like fetchLedgerAPI, apiClient) and even follows variable assignments
  • Cloud sync with device‑code auth – push from backend, sync to frontend, no passwords needed
  • Mock server, TypeScript types, and backend scaffolding – generate an entire Express/Hono API from your contract
  • AI‑powered – explain endpoints, propose schema changes, accept them, and generate forms with a single command. MCP server included for AI coding agents.
  • Full documentation: https://bazable.mintlify.app

Quick Start

npm install -g bazable-api
cd your-project-folder
bazable init
Enter fullscreen mode Exit fullscreen mode

My Improvements

The bug was subtle: in ES modules, you cannot import a CommonJS subpath using a .js extension when the package's exports field doesn't define it. By removing the extension and using the documented node subpath, the CLI started without errors. I also added --stdio to the LSP command so the server works in manual test mode when an editor doesn't supply connection arguments. These improvements were published in Bazable v1.2.0 and immediately resolved the crash for all users.

Top comments (0)