n8n/packages/@n8n/instance-ai/evaluations/binaryChecks/checks/has-nodes.ts
Benjamin Schroth c961849226
feat(ai-builder): Add sub-agent evaluation harness with binary checks (no-changelog) (#28289)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 07:50:46 +00:00

15 lines
354 B
TypeScript

import type { BinaryCheck } from '../types';
export const hasNodes: BinaryCheck = {
name: 'has_nodes',
description: 'Workflow contains at least one node',
kind: 'deterministic',
run(workflow) {
const count = (workflow.nodes ?? []).length;
return {
pass: count > 0,
...(count === 0 ? { comment: 'Workflow has no nodes' } : {}),
};
},
};