{"_id":"@build0.ai/workflow-validator","_rev":"4-fc8e7c48e29b09a053e1bd110f35de53","name":"@build0.ai/workflow-validator","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@build0.ai/workflow-validator","version":"1.0.0","keywords":["workflow","validator","json","schema","build0"],"author":"","license":"MIT","_id":"@build0.ai/workflow-validator@1.0.0","maintainers":[{"name":"phil_build0","email":"phil@build0.ai"}],"bin":{"validate-workflow":"dist/index.js"},"dist":{"shasum":"4930458f145bb01419fdf07445a43535810fb6c5","tarball":"https://registry.npmjs.org/@build0.ai/workflow-validator/-/workflow-validator-1.0.0.tgz","fileCount":18,"integrity":"sha512-qwkzvqZmQ4UJ5mbr6HMjRoAqwjJdV2Pj2q7fOT6vGIivsgkZZvXEkxHo/5xef7FsmJ5wF5u5gSNt42w5dCXu+g==","signatures":[{"sig":"MEQCIDl25IHXVXjtBpzvdJ7F4DcUv1xIlt9uxfmTHwoD3j7dAiAHpn7q8BxqN1IoPtcsFTER5+1A7QBBc/6rRZd0XJjQVg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41093},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./schemas":{"types":"./dist/workflow-schemas.d.ts","import":"./dist/workflow-schemas.js"}},"gitHead":"5755ef93eb2e3cce5e3c9a3ed4f0adbe67ca3fcf","scripts":{"build":"tsc","validate":"tsx src/index.ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"phil_build0","email":"phil@build0.ai"},"_npmVersion":"10.9.2","description":"Validate workflow.json files for Build0 agents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.24.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^22.10.5"},"_npmOperationalInternal":{"tmp":"tmp/workflow-validator_1.0.0_1768635931047_0.3013285496509239","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@build0.ai/workflow-validator","version":"1.0.1","keywords":["workflow","validator","json","schema","build0"],"author":"","license":"MIT","_id":"@build0.ai/workflow-validator@1.0.1","maintainers":[{"name":"phil_build0","email":"phil@build0.ai"}],"bin":{"validate-workflow":"dist/cli.js"},"dist":{"shasum":"45df2105bd70fe2a3a7f02b219c3b4818812c75c","tarball":"https://registry.npmjs.org/@build0.ai/workflow-validator/-/workflow-validator-1.0.1.tgz","fileCount":22,"integrity":"sha512-h6RslGYy0NfzltVAiqMXfBHhRtauVC6O6I+I5qVLvHG6x6rtSIWEQKEhO6XuICGhP4Jeg9hSRoT9FUgtHG1/fQ==","signatures":[{"sig":"MEUCIQCa4S+s6c0j2X+CKNYVOlCKcazthwpFKEOUzCHrBQ79SwIgCK/0elIdhzDbNze4Ft7TRUXB1sn8S4jD9ExxiNnpQFo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41471},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./schemas":{"types":"./dist/workflow-schemas.d.ts","import":"./dist/workflow-schemas.js"}},"gitHead":"f183913bc54fe0dcf4f8db9a9caeeff7fb10d821","scripts":{"build":"tsc","validate":"tsx src/cli.ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"phil_build0","email":"phil@build0.ai"},"_npmVersion":"10.9.2","description":"Validate workflow.json files for Build0 agents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.24.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^22.10.5"},"_npmOperationalInternal":{"tmp":"tmp/workflow-validator_1.0.1_1768636732680_0.24893542657824996","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@build0.ai/workflow-validator","version":"1.1.0","keywords":["workflow","validator","json","schema","build0"],"author":"","license":"MIT","_id":"@build0.ai/workflow-validator@1.1.0","maintainers":[{"name":"phil_build0","email":"phil@build0.ai"}],"bin":{"validate-workflow":"dist/cli.js"},"dist":{"shasum":"047735b158e3c50376eeb4d5c39b342d23fe175d","tarball":"https://registry.npmjs.org/@build0.ai/workflow-validator/-/workflow-validator-1.1.0.tgz","fileCount":22,"integrity":"sha512-3n12GfjrX33MO30K/N/LW6EBpkWB5Un92OCOQbl/V7ng6y2v2eBPoizDLDhOGlF7MfguypK1OGSZE4RhT5D8yQ==","signatures":[{"sig":"MEUCIQDcMyoEpOdhQg0IeehgnQsr+AEVO21FfGWk7kQJy85DlgIgdRCmQyoaAdqwmt2S8LXEMkveAx1jb4u0Nzy3ldgSQ3Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49385},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./schemas":{"types":"./dist/workflow-schemas.d.ts","import":"./dist/workflow-schemas.js"}},"gitHead":"f183913bc54fe0dcf4f8db9a9caeeff7fb10d821","scripts":{"build":"tsc","validate":"tsx src/cli.ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"phil_build0","email":"phil@build0.ai"},"_npmVersion":"10.9.2","description":"Validate workflow.json files for Build0 agents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.24.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^22.10.5"},"_npmOperationalInternal":{"tmp":"tmp/workflow-validator_1.1.0_1769143049774_0.6888338506642806","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@build0.ai/workflow-validator","version":"1.2.0","description":"Validate workflow.json files for Build0 agents","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"validate-workflow":"dist/cli.js"},"exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./schemas":{"import":"./dist/workflow-schemas.js","types":"./dist/workflow-schemas.d.ts"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build","validate":"tsx src/cli.ts"},"keywords":["workflow","validator","json","schema","build0"],"author":"","license":"MIT","dependencies":{"ajv":"^8.17.1","ajv-formats":"^3.0.1","zod":"^3.24.1"},"devDependencies":{"@types/node":"^22.10.5","tsx":"^4.19.2","typescript":"^5.7.2"},"_id":"@build0.ai/workflow-validator@1.2.0","gitHead":"f0b7265adf0d0989bd7c983915922b8d84ac1b60","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-OEA4A+EsLOH+p3/zvT8Io57V8BK/A/Ec09Qti7dcsyzJFOsrlAEhMzWLlWsaM0iT6IBl3++KAnDGiyxlYImjmw==","shasum":"76a7981d04ab8d6f65fb8febb3a856491662c4d6","tarball":"https://registry.npmjs.org/@build0.ai/workflow-validator/-/workflow-validator-1.2.0.tgz","fileCount":22,"unpackedSize":56232,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAXiXaxxvtl+OZvEVnrOzHftjy3aHB1AXP8Ba9iJpex2AiBUAPp9bPXDzsmR0mcKEg4L9/JdJq2UzbWpwpJx/YSRew=="}]},"_npmUser":{"name":"phil_build0","email":"phil@build0.ai"},"directories":{},"maintainers":[{"name":"phil_build0","email":"phil@build0.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/workflow-validator_1.2.0_1769510318740_0.016357266927120584"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-17T07:45:30.940Z","modified":"2026-01-27T10:38:39.009Z","1.0.0":"2026-01-17T07:45:31.191Z","1.0.1":"2026-01-17T07:58:52.828Z","1.1.0":"2026-01-23T04:37:29.937Z","1.2.0":"2026-01-27T10:38:38.911Z"},"license":"MIT","keywords":["workflow","validator","json","schema","build0"],"description":"Validate workflow.json files for Build0 agents","maintainers":[{"name":"phil_build0","email":"phil@build0.ai"}],"readme":"# workflow-validator\n\nValidate workflow.json files for Build0 agents without executing them.\n\n## Installation\n\n```bash\nnpm install -g workflow-validator\n```\n\nOr use directly with npx:\n\n```bash\nnpx workflow-validator workflow.json\n```\n\n## Usage\n\n### CLI\n\n```bash\n# Validate a workflow file\nvalidate-workflow workflow.json\n\n# Or with npx\nnpx workflow-validator workflow.json\n```\n\nExit codes:\n- `0` - Workflow is valid\n- `1` - Workflow is invalid or file not found\n\n### Programmatic Usage\n\n```typescript\nimport { validateWorkflowFile, WorkflowSchema } from 'workflow-validator';\n\n// Validate a file\nconst result = validateWorkflowFile('./workflow.json');\nif (result.valid) {\n  console.log('Valid workflow:', result.workflow);\n} else {\n  console.error('Errors:', result.errors);\n}\n\n// Or use the Zod schema directly\nimport { WorkflowSchema } from 'workflow-validator/schemas';\n\nconst workflow = WorkflowSchema.parse(jsonData);\n```\n\n## Validation Rules\n\n### Schema Validation (Zod)\n1. Required top-level fields: `name`, `version`, `steps`\n2. Steps array must be non-empty\n3. Each step must have `id`, `type`, `name`\n4. Step type must be `\"command\"` or `\"sleep\"`\n5. Command steps require `command` field\n6. Sleep steps require positive `duration` field\n\n### Semantic Validation\n7. All step IDs must be unique\n8. `onErrorGoto` must reference an existing step ID\n9. If `onErrorGoto` is present, `onError` must be `\"goto\"`\n10. Step references in templates (`steps['id'].output`) must reference earlier steps\n11. Template braces `{{ }}` must be balanced\n\n### Optional References\n\nReferences using optional chaining (`steps['id']?.output`) are treated as optional and are allowed to:\n- Reference steps defined later in the workflow (forward references)\n- Reference steps that may not exist\n\nThis supports loop patterns where the first iteration uses one step's output and subsequent iterations use another's.\n\n## Workflow Structure\n\n```json\n{\n  \"name\": \"My Workflow\",\n  \"version\": \"1.0\",\n  \"steps\": [\n    {\n      \"id\": \"step-1\",\n      \"type\": \"command\",\n      \"name\": \"Run command\",\n      \"command\": \"echo hello\",\n      \"env\": {\n        \"VAR\": \"{{ input.value }}\"\n      },\n      \"retries\": 2,\n      \"retryDelay\": 1000,\n      \"onError\": \"goto\",\n      \"onErrorGoto\": \"error-handler\",\n      \"if\": \"{{ condition }}\"\n    },\n    {\n      \"id\": \"step-2\",\n      \"type\": \"sleep\",\n      \"name\": \"Wait\",\n      \"duration\": 5000\n    }\n  ]\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}