Skip to content

Latest commit

 

History

History
208 lines (152 loc) · 4.82 KB

File metadata and controls

208 lines (152 loc) · 4.82 KB

SCRIPTS.md - Claudeware Build Commands & Scripts Guide

This document lists all available build commands, npm scripts, and shell scripts in the Claudeware repository.

NPM Scripts

All npm scripts can be run with npm run <script-name>:

Core Build & Development

Command Description Usage
build Compile TypeScript to JavaScript npm run build
dev Run in development mode with auto-reload npm run dev
typecheck Type-check TypeScript without emitting npm run typecheck
lint Run ESLint on TypeScript files npm run lint

Testing

Command Description Usage
test Run all unit tests npm test
test:watch Run tests in watch mode npm run test:watch
test:coverage Run tests with coverage report npm run test:coverage
test:integration Run integration tests only npm run test:integration
test:manual Run manual quick test npm run test:manual

Utilities

Command Description Usage
benchmark Run performance benchmarks npm run benchmark
link Link package globally for testing npm run link
unlink Remove global link npm run unlink

Shell Scripts

Executable shell scripts in the repository:

test-wrapper.sh

Basic testing script for Claudeware functionality.

./test-wrapper.sh

What it does:

  1. Tests help command
  2. Tests version command
  3. Tests wrapper mechanics with echo
  4. Runs manual quick test

run-unit-tests.sh

Runs unit tests with formatted output showing test results.

./run-unit-tests.sh

What it does:

  • Checks for TypeScript test files
  • Runs specific test suites (JSON Parser, Event Bus, Plugin Loader)
  • Shows comprehensive test summary with pass/fail statistics

simple-test.js

JavaScript test script demonstrating wrapper concepts.

./simple-test.js

What it does:

  • Tests component functionality
  • Demonstrates SDK integration
  • Shows zero-latency stream passthrough concept

Build Sequence

For a complete build from source:

# 1. Install dependencies
npm install

# 2. Build TypeScript files
npm run build

# 3. Run tests to verify
npm test

# 4. Link globally (optional)
npm run link

Development Workflow

Quick Development Cycle

# Terminal 1: Run in dev mode with auto-reload
npm run dev

# Terminal 2: Run tests in watch mode
npm run test:watch

Before Committing

# 1. Type check
npm run typecheck

# 2. Lint
npm run lint

# 3. Run all tests
npm test

# 4. Build
npm run build

Environment Variables

Key environment variables used by scripts:

Variable Description Default
CLAUDE_WRAPPER_TEST_MODE Enable test mode false
CLAUDE_WRAPPER_LOG_LEVEL Logging level info
CLAUDE_WRAPPER_PLUGINS_DIR Plugin directory ~/.claude-code/plugins
CLAUDE_WRAPPER_DB_PATH Database path ~/.claude-code/queries.db

Common Commands

First Time Setup

git clone https://github.com/instantlyeasy/claudeware.git
cd claudeware
npm install
npm run build

One-Click Build (Recommended)

# Run the complete build script
./build-local.sh

This script handles everything: dependencies, TypeScript compilation, testing, and global linking.

Run Tests

# All tests
npm test

# Specific component
npm test -- --testNamePattern="JsonStreamParser"

# With coverage
npm run test:coverage

Local Development

# Build and link for testing
npm run build && npm run link

# Test the wrapper
claudeware --version
claudeware "What is 2+2?"

# Unlink when done
npm run unlink

Debug Mode

# Enable debug logging
export CLAUDE_WRAPPER_LOG_LEVEL=debug

# Run with test mode
CLAUDE_WRAPPER_TEST_MODE=true node src/cli.js echo "test"

Script Locations

  • NPM scripts: Defined in /package.json
  • Shell scripts: Located in root directory
  • Test scripts: In /test/manual/ directory
  • TypeScript source: In /src/ directory
  • Built JavaScript: In /dist/ directory (after build)

Notes

  • The project uses TypeScript but has JavaScript entry points (cli.js, wrapper.js, sdk.js)
  • Always run npm run build after making TypeScript changes
  • Some tests may show timer warnings with Jest - these are test framework issues, not production issues
  • The wrapper is designed to work without Claude Code installed (using test mode)
  • See KNOWN-ISSUES.md for documented issues and workarounds

Test Results

Expected test results:

  • Total Tests: 182
  • Passing: 173 (95%)
  • Failing: 9 (timer-related Jest issues only)

The failing tests are all in batch-queue.test.ts and are due to Jest's fake timer limitations. The component works correctly in production.