Skip to main content

Engineering quality gate

Pull requests pile up, reviewers are busy, and the tests that would have caught the regression were never written. A quality gate in CI gives every pull request a first review, a set of unit tests and a clean commit message before a human looks at it, and hands the failing branches to a coding agent that fixes them until the tests pass.

Code commits passing through a review gate Pull requestdiff + changed filesreview_codescore and issuesgenerate_unit_testsCodingAgentfixes failing testson the branchHuman reviewreport + green testsa different model family reviews the code than the one that wrote it

1. Review every pull request

review_code returns a structured report you can post as a comment or fail the check on. Use a different provider than your team's coding assistant to get an independent opinion.

const { Gen } = require('intellinode');
const { execSync } = require('child_process');

const diff = execSync('git diff origin/main...HEAD').toString();

const review = await Gen.review_code(diff, process.env.ANTHROPIC_API_KEY, 'anthropic', { language: 'typescript' });
// { summary, score, issues: [{ severity, title, description, suggestion }] }

const blocking = review.issues.filter((issue) => issue.severity === 'high');
if (blocking.length) {
console.log(`Blocking issues:\n${blocking.map((issue) => `- ${issue.title}: ${issue.suggestion}`).join('\n')}`);
process.exitCode = 1;
}

2. Generate the missing tests

For every new source file without a test, generate one in the framework the repository uses and run it in the same job.

const fs = require('fs');
const path = require('path');

const changed = execSync('git diff --name-only origin/main...HEAD').toString().split('\n').filter((file) => /^src\/.*\.js$/.test(file));

for (const file of changed) {
const testFile = path.join('test', path.basename(file).replace(/\.js$/, '.test.js'));
if (fs.existsSync(testFile)) continue;

const code = fs.readFileSync(file, 'utf8');
const tests = await Gen.generate_unit_tests(code, process.env.OPENAI_API_KEY, 'openai', {
framework: 'jest',
modulePath: path.relative('test', file).replace(/\.js$/, ''),
});
fs.writeFileSync(testFile, tests);
}

execSync('npx jest --ci', { stdio: 'inherit' });

3. Let the coding agent fix the failing branch

When the tests fail, the coding agent edits the branch until they pass and reports what it changed. Every file access stays inside the checkout, and the run stops at maxIterations.

const { CodingAgent } = require('intellinode');

const agent = new CodingAgent({
apiKey: process.env.ANTHROPIC_API_KEY,
provider: 'anthropic',
model: 'claude-sonnet-5',
workspace: process.cwd(),
maxIterations: 15,
onAction: ({ iteration, tool, args }) => console.log(`#${iteration} ${tool}`, tool === 'write_file' ? args.path : ''),
});

const result = await agent.run('The unit tests fail on this branch. Find the cause and fix it without changing the tests.', {
testCommand: 'npx jest --ci',
});

if (result.success) {
const message = await Gen.generate_commit_message(execSync('git diff').toString(), process.env.OPENAI_API_KEY);
execSync(`git commit -am ${JSON.stringify(message)}`);
console.log(result.summary);
} else {
console.log('Needs a human:', result.summary);
}

4. Release notes from the merged changes

const log = execSync('git log --oneline v2.4.0..HEAD').toString();
const notes = await Gen.generate_release_notes(log, process.env.OPENAI_API_KEY, 'openai', { version: '2.5.0' });
fs.writeFileSync('CHANGELOG.next.md', notes);

5. The same tools inside every developer's assistant

Add the intellinode MCP server to the team's Claude Code, Cursor or VS Code setup and the review, test generation and fix tools are one prompt away, on any provider the company has keys for:

claude mcp add intellinode -e ANTHROPIC_API_KEY=sk-ant-... -e OPENAI_API_KEY=sk-... -- npx -y intellinode mcp

See the MCP server page for the tool list.

Why it helps

  • Every pull request gets a review and tests before a reviewer spends time on it.
  • Failing branches come back green with a summary of the fix, ready for the human decision.
  • The review runs on a different model family than the code generator, which catches more.