n8n/packages/@n8n/instance-ai/evaluations/binaryChecks/checks/has-nodes.ts
José Braulio González Valido 700b32237f
feat(ai-builder): Surface WHAT-dimension binary checks per built workflow (no-changelog) (#30932)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 12:18:52 +01:00

16 lines
379 B
TypeScript

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