ecode-reviewer
v1.0.9
Published
Local pre-push AI code reviewer for JavaScript and TypeScript diffs.
Maintainers
Readme
eCode Reviewer
Package-style pre-push AI code reviewer for JavaScript and TypeScript diffs.
The best setup is to install the reviewer as a dev dependency and keep only project-specific config/rules in each repo. That way your team does not copy the tool source into every project.
Recommended Project Setup
In a project that should use the reviewer:
npm install --save-dev ecode-reviewerAdd scripts:
{
"scripts": {
"review": "ecode-reviewer review",
"setup-hooks": "ecode-reviewer setup-hooks"
}
}Add a project config at reviewer.config.json:
{
"llm": {
"provider": "ollama",
"endpoint": "http://localhost:11434/api/generate",
"model": "qwen2.5-coder:14b",
"timeout_ms": 30000,
"runtime": "ollama"
},
"review": {
"style_guide_paths": ["./style-guide", "./tools/style-guide.md"],
"token_budget": 6000,
"block_on": ["ERROR"],
"base_ref": "origin/main",
"ignore_patterns": ["*.min.js", "package-lock.json", "*.generated.ts"],
"rule_files": []
}
}LLM Providers
The default provider is local Ollama:
{
"llm": {
"provider": "ollama",
"endpoint": "http://localhost:11434/api/generate",
"model": "qwen2.5-coder:14b",
"timeout_ms": 30000
}
}OpenAI:
{
"llm": {
"provider": "openai",
"endpoint": "https://api.openai.com/v1/chat/completions",
"model": "gpt-4.1-mini",
"api_key_env": "OPENAI_API_KEY",
"timeout_ms": 50000
}
}OpenAI-compatible APIs such as vLLM, Groq, OpenRouter, or LM Studio:
{
"llm": {
"provider": "openai-compatible",
"endpoint": "https://your-provider.example/v1/chat/completions",
"model": "your-model-name",
"api_key_env": "ECODE_REVIEWER_API_KEY",
"timeout_ms": 50000
}
}Anthropic:
{
"llm": {
"provider": "anthropic",
"endpoint": "https://api.anthropic.com/v1/messages",
"model": "claude-3-5-sonnet-latest",
"api_key_env": "ANTHROPIC_API_KEY",
"timeout_ms": 50000
}
}API keys are read from environment variables only. Do not put secrets directly in reviewer.config.json.
Then each developer runs this once after cloning:
npm run setup-hooksAfter that, the reviewer runs automatically on:
git pushFor emergency pushes, Git’s normal bypass still works:
git push --no-verifyLocal Package Testing
Before publishing, you can test this package from another project using a local file dependency:
npm install --save-dev /Users/sam/Desktop/eCode-rvThen use the same scripts:
{
"scripts": {
"review": "ecode-reviewer review",
"setup-hooks": "ecode-reviewer setup-hooks"
}
}Config Discovery
The CLI looks for config in this order:
reviewer.config.jsoncode-reviewer.config.jsontools/reviewer.config.json
You can also pass a config explicitly:
ecode-reviewer review --config ./config/reviewer.jsonUse quiet mode to hide the loading indicator:
ecode-reviewer review --quietstyle_guide_paths can point to markdown files or folders of markdown files. Style-guide files are loaded fresh on every push.
The reviewer also applies a built-in baseline for Security, SOLID, DRY, TypeScript safety, error handling, and test coverage. Project rules are added on top of that baseline.
Behavior
- Blocks the push when the model returns an
ERROR. - Allows the push when there are warnings only.
- Fails open when the LLM server is down, times out, or returns malformed JSON.
- Reviews only JavaScript and TypeScript diffs.
