Development Setup
This page explains how to develop the ContextWeaver source project locally.
Requirements
- Node.js >= 20
- pnpm
- Available Embedding and Rerank APIs
The source project uses TypeScript ESM, tsup for bundling, and vitest for tests.
Install dependencies
bash
cd ~/mcp/ContextWeaver
pnpm installBuild
bash
pnpm buildThe build entrypoint is src/index.ts, and output goes to dist/.
Watch development
bash
pnpm devThis runs tsup in watch mode and is useful when iterating on CLI behavior.
Run the CLI locally
After building, run:
bash
node dist/index.js --help
node dist/index.js init
node dist/index.js index /path/to/project
node dist/index.js search --information-request "..."You can also use the globally installed package commands:
bash
contextweaver --help
cw --helpConfiguration file
Run:
bash
contextweaver initIt creates:
text
~/.contextweaver/.envConfiguration loading is implemented in src/config.ts. MCP mode keeps stderr noise low so protocol output is not polluted.
Logs
Log files are stored at:
text
~/.contextweaver/logs/app.YYYY-MM-DD.logEnable debug logging:
bash
LOG_LEVEL=debug contextweaver search --information-request "..."Common commands
| Command | Purpose |
|---|---|
pnpm build | Compile TypeScript |
pnpm dev | Watch-mode build |
pnpm lint | Run Biome checks |
pnpm fmt | Apply Biome fixes |
pnpm typecheck | TypeScript type check |
pnpm test | Run vitest |
Development guidance
- Run
pnpm testfirst to confirm the baseline is stable - For search changes, add tests under
tests/search/* - For index consistency changes, add tests under
tests/indexer/*ortests/db/* - For real LanceDB behavior, add tests under
tests/integration/*ortests/vectorStore/*