Skip to content

Building from Source

Set up a development environment for Dial Code.


Prerequisites

Node.js

Requires Node.js 20 or higher:

node --version
# v20.x.x or higher

Install via nvm:

nvm install 20
nvm use 20

Git

git --version

Clone and Install

# Clone the repository
git clone https://github.com/neul-labs/dial-coder.git
cd dial-coder

# Install dependencies
npm install

Build

Full Build

npm run build

Builds all packages:

  • packages/cli
  • packages/core
  • packages/vscode-ide-companion

Build Specific Package

npm run build --workspace=packages/cli
npm run build --workspace=packages/core

Run from Source

Development Mode

npm start

With Debug Output

DEBUG=1 npm start

Debug with Chrome DevTools

npm run debug

Then open chrome://inspect in Chrome.


Testing

Unit Tests

npm run test

Watch Mode

npm run test -- --watch

Specific Package

npm run test --workspace=packages/cli

Integration Tests

npm run test:e2e

Requires API keys in environment.


Code Quality

Linting

npm run lint        # Check for issues
npm run lint:fix    # Auto-fix issues

Formatting

npm run format      # Format all files

Type Checking

npm run typecheck

All Checks (Preflight)

npm run preflight

Run this before submitting PRs.


Development Scripts

Script Description
npm start Run from source
npm run build Build all packages
npm run test Run unit tests
npm run test:e2e Run integration tests
npm run lint Check linting
npm run lint:fix Fix lint issues
npm run format Format code
npm run typecheck Check types
npm run preflight Run all checks
npm run debug Run with debugger

Project Structure

dial-coder/
├── packages/
│   ├── cli/           # Terminal interface
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── core/          # Backend engine
│   │   ├── src/
│   │   ├── package.json
│   │   └── tsconfig.json
│   └── ...
├── package.json       # Root package
├── tsconfig.json      # Root TS config
└── eslint.config.js   # ESLint config

Workspace Commands

This is a monorepo using npm workspaces.

Run in All Packages

npm run build --workspaces
npm run test --workspaces

Run in Specific Package

npm run test --workspace=packages/core

IDE Setup

VS Code

Recommended extensions:

  • ESLint
  • Prettier
  • TypeScript

Settings:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}

WebStorm / IntelliJ

  • Enable ESLint integration
  • Enable Prettier integration
  • Configure Node.js interpreter

Common Issues

"Module not found"

Run build first:

npm run build

Type Errors

Ensure all packages are built:

npm run build
npm run typecheck

Permission Errors

On Linux/macOS:

sudo npm install -g .
# Or configure npm prefix
npm config set prefix ~/.npm-global

Environment Variables

For development:

export DEBUG=1              # Enable debug output
export DEV=true             # Development mode
export VERBOSE=true         # Verbose test output

Next Steps