This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
OpenAPI Toolkit is a VS Code extension for editing, validating, linting, and previewing OpenAPI specification documents. It uses ApiDOM for parsing and analysis, and implements the Language Server Protocol (LSP) for rich editor features.
# Always switch to the correct Node.js version before installing
nvm use
# Install dependencies
npm ci
# Development build (compiles TypeScript, copies assets)
npm run build:dev
# Development build with watch mode
npm run build:dev:watch
# Production build (bundles with webpack for both Node and browser)
npm run build:prod
# Type checking only
npm run typescript:check-types
# Lint all workspaces
npm run lint
# Lint and fix
npm run lint:fix
# Run all tests (server unit tests + e2e tests)
npm run test
# Run only server tests
npm --workspace=server run test
# Package extension as VSIX
npm run vscode:packageThis is a monorepo with two npm workspaces:
VS Code extension and LSP client. Has separate entry points for:
- Node:
client/src/node/speclynxClientMain.ts- desktop VS Code - Browser:
client/src/browser/speclynxClientMain.ts- web-based VS Code (vscode.dev)
Key modules:
speclynxClient.ts- Language client initialization and configurationcommandManager.ts- VS Code command registrationcommands/- Command implementations (preview, dereference, pick rules files)preview/- SwaggerUI preview webview panellanguageFeatures/languageDetection/- OpenAPI document detection
LSP server providing language features. Has separate entry points for:
- Node:
server/src/node/speclynxServerMain.ts - Browser:
server/src/browser/speclynxServerMain.ts
Key modules:
speclynxServer/index.ts- Main server with validation, completion, hoverspeclynxServer/apidom/- ApiDOM integration and file resolutionspectral/spectralLinter.ts- Spectral ruleset integration
@speclynx/apidom-*packages - Core parsing and reference handling (published on npm)@stoplight/spectral-*- Spectral linting integrationvscode-languageserver/vscode-languageclient- LSP implementation
- Server unit tests:
server/src/test/- Run withnpm --workspace=server run test - E2E tests:
client/src/test/- Run viascripts/e2e.sh, tests the full extension in VS Code
- Run
npm run build:devafter any TypeScript changes - Use "Launch Node Client" or "Launch Browser Client" from VS Code's Run and Debug
- Use "Attach to Server" launch config to debug the language server
Settings are prefixed with speclynx.openapi.validation.*:
- JSON Schema validation
- Semantic validation with custom rules file
- Spectral linting with custom ruleset file