{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://devrunbook.local/schemas/playbook.schema.json", "title": "DevRunbook Playbook Package Manifest", "type": "object", "additionalProperties": false, "required": ["apiVersion", "kind", "metadata", "package", "spec", "quality"], "properties": { "apiVersion": {"const": "devrunbook.io/v1alpha1"}, "kind": {"const": "Playbook"}, "metadata": { "type": "object", "additionalProperties": false, "required": ["id", "slug", "version", "title", "summary", "category", "tags", "lifecycle", "riskTier", "authors"], "properties": { "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)+$", "maxLength": 120}, "slug": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$", "maxLength": 100}, "version": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"}, "title": {"type": "string", "minLength": 3, "maxLength": 120}, "summary": {"type": "string", "minLength": 20, "maxLength": 320}, "category": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"}, "tags": {"type": "array", "minItems": 1, "maxItems": 20, "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z0-9+#.]+(?:-[a-z0-9+#.]+)*$"}}, "lifecycle": {"enum": ["draft", "reviewed", "validated", "battle-tested", "deprecated"]}, "riskTier": {"enum": ["low", "moderate", "high", "critical"]}, "authors": { "type": "array", "minItems": 1, "maxItems": 10, "items": { "type": "object", "additionalProperties": false, "required": ["name"], "properties": { "name": {"type": "string", "minLength": 1, "maxLength": 120}, "url": {"type": "string", "format": "uri"} } } }, "license": {"type": "string", "maxLength": 80}, "replacement": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"} } }, "package": { "type": "object", "additionalProperties": false, "required": ["files"], "properties": { "files": { "type": "array", "minItems": 3, "maxItems": 200, "items": {"$ref": "#/$defs/packageFile"} } } }, "spec": { "type": "object", "additionalProperties": false, "required": ["type", "intent", "modes", "defaultMode", "autonomy", "inputs", "compatibility", "guardrails", "workflow", "validation", "completion", "failurePolicy", "reporting", "template", "exports"], "properties": { "type": {"enum": ["quick", "guided", "run-pack"]}, "intent": { "type": "object", "additionalProperties": false, "required": ["problem", "outcome", "whenToUse", "whenNotToUse"], "properties": { "problem": {"type": "string", "minLength": 20, "maxLength": 1000}, "outcome": {"type": "string", "minLength": 20, "maxLength": 1000}, "whenToUse": {"type": "array", "minItems": 1, "maxItems": 12, "items": {"type": "string", "minLength": 5, "maxLength": 300}}, "whenNotToUse": {"type": "array", "minItems": 1, "maxItems": 12, "items": {"type": "string", "minLength": 5, "maxLength": 300}} } }, "modes": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/$defs/workMode"}}, "defaultMode": {"$ref": "#/$defs/workMode"}, "autonomy": { "type": "object", "additionalProperties": false, "required": ["min", "max", "default"], "properties": { "min": {"$ref": "#/$defs/autonomyLevel"}, "max": {"$ref": "#/$defs/autonomyLevel"}, "default": {"$ref": "#/$defs/autonomyLevel"} } }, "inputs": { "type": "array", "maxItems": 40, "items": {"$ref": "#/$defs/input"} }, "compatibility": { "type": "object", "additionalProperties": false, "required": ["repositoryRequired", "languages", "frameworks", "packageManagers", "databases", "deploymentTypes", "requiredProfileCapabilities", "incompatibleConditions"], "properties": { "repositoryRequired": {"type": "boolean"}, "languages": {"$ref": "#/$defs/stringSet"}, "frameworks": {"$ref": "#/$defs/stringSet"}, "packageManagers": {"$ref": "#/$defs/stringSet"}, "databases": {"$ref": "#/$defs/stringSet"}, "deploymentTypes": {"$ref": "#/$defs/stringSet"}, "requiredProfileCapabilities": {"type": "array", "uniqueItems": true, "maxItems": 30, "items": {"$ref": "#/$defs/profileCapability"}}, "incompatibleConditions": {"type": "array", "maxItems": 20, "items": {"$ref": "#/$defs/condition"}} } }, "guardrails": {"type": "array", "minItems": 1, "maxItems": 40, "items": {"$ref": "#/$defs/guardrail"}}, "workflow": {"type": "array", "minItems": 1, "maxItems": 40, "items": {"$ref": "#/$defs/workflowStep"}}, "validation": { "type": "object", "additionalProperties": false, "required": ["commandRoles", "checks"], "properties": { "commandRoles": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/commandRole"}}, "checks": {"type": "array", "minItems": 1, "maxItems": 40, "items": {"$ref": "#/$defs/check"}} } }, "completion": { "type": "object", "additionalProperties": false, "required": ["criteria"], "properties": { "criteria": {"type": "array", "minItems": 1, "maxItems": 30, "items": {"type": "string", "minLength": 8, "maxLength": 500}} } }, "failurePolicy": { "type": "object", "additionalProperties": false, "required": ["onValidationFailure", "onAmbiguity", "onMissingContext", "onOutOfScopeCause", "onExternalDependencyUnavailable", "onUnableToReproduce"], "properties": { "onValidationFailure": {"type": "string", "minLength": 20, "maxLength": 1000}, "onAmbiguity": {"type": "string", "minLength": 20, "maxLength": 1000}, "onMissingContext": {"type": "string", "minLength": 20, "maxLength": 1000}, "onOutOfScopeCause": {"type": "string", "minLength": 20, "maxLength": 1000}, "onExternalDependencyUnavailable": {"type": "string", "minLength": 20, "maxLength": 1000}, "onUnableToReproduce": {"type": "string", "minLength": 20, "maxLength": 1000} } }, "reporting": { "type": "object", "additionalProperties": false, "required": ["sections"], "properties": { "sections": {"type": "array", "minItems": 1, "maxItems": 20, "items": {"$ref": "#/$defs/reportSection"}} } }, "template": { "type": "object", "additionalProperties": false, "required": ["main", "partials"], "properties": { "main": {"$ref": "#/$defs/packagePath"}, "partials": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/packagePath"}} } }, "exports": { "type": "object", "additionalProperties": false, "required": ["prompt", "markdown", "runPack", "agentsSuggestion"], "properties": { "prompt": {"type": "boolean"}, "markdown": {"type": "boolean"}, "runPack": {"type": "boolean"}, "agentsSuggestion": {"type": "boolean"} } } } }, "quality": { "type": "object", "additionalProperties": false, "required": ["reviewStatus", "testedStacks", "knownLimitations", "evaluationCaseIds"], "properties": { "reviewStatus": {"enum": ["unreviewed", "editorial-reviewed", "technical-reviewed", "evaluation-backed"]}, "testedStacks": {"$ref": "#/$defs/stringSet"}, "knownLimitations": {"type": "array", "maxItems": 20, "items": {"type": "string", "minLength": 5, "maxLength": 500}}, "evaluationCaseIds": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"}} } } }, "$defs": { "workMode": {"enum": ["inspect", "plan", "guided", "execute", "recovery"]}, "autonomyLevel": {"enum": ["observe", "diagnose", "plan", "implement", "verify", "repair"]}, "commandRole": {"enum": ["install", "format", "format-check", "lint", "typecheck", "unit-test", "integration-test", "end-to-end-test", "build", "dev-start", "smoke-test", "migration-status", "migration-apply", "security-scan", "dependency-audit"]}, "profileCapability": {"enum": ["install-command", "format-command", "lint-command", "typecheck-command", "test-command", "unit-test-command", "integration-test-command", "end-to-end-test-command", "build-command", "dev-start-command", "smoke-test-command", "migration-command", "security-scan-command", "dependency-audit-command", "default-branch", "protected-paths"]}, "stringSet": {"type": "array", "uniqueItems": true, "maxItems": 50, "items": {"type": "string", "minLength": 1, "maxLength": 80}}, "packagePath": {"type": "string", "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[A-Za-z0-9._/-]+$", "maxLength": 500}, "packageFile": { "type": "object", "additionalProperties": false, "required": ["path", "role", "digest", "exportByDefault"], "properties": { "path": {"$ref": "#/$defs/packagePath"}, "role": {"enum": ["template", "partial", "documentation", "changelog", "example", "evaluation", "resource", "run-pack-resource"]}, "digest": {"type": "boolean"}, "exportByDefault": {"type": "boolean"} } }, "condition": { "oneOf": [ { "type": "object", "additionalProperties": false, "required": ["fact"], "properties": { "fact": { "type": "object", "additionalProperties": false, "required": ["path", "operator"], "properties": { "path": {"type": "string", "pattern": "^(inputs|repository|composition|platform)(?:\\.[A-Za-z][A-Za-z0-9_-]*)+$", "maxLength": 240}, "operator": {"enum": ["exists", "truthy", "falsy", "eq", "neq", "in", "not-in", "contains", "gt", "gte", "lt", "lte"]}, "value": {} } } } }, {"type": "object", "additionalProperties": false, "required": ["all"], "properties": {"all": {"type": "array", "minItems": 1, "maxItems": 20, "items": {"$ref": "#/$defs/condition"}}}}, {"type": "object", "additionalProperties": false, "required": ["any"], "properties": {"any": {"type": "array", "minItems": 1, "maxItems": 20, "items": {"$ref": "#/$defs/condition"}}}}, {"type": "object", "additionalProperties": false, "required": ["not"], "properties": {"not": {"$ref": "#/$defs/condition"}}} ] }, "input": { "type": "object", "additionalProperties": false, "required": ["key", "label", "description", "type", "required", "sensitive", "includeInOutput"], "properties": { "key": {"type": "string", "pattern": "^[a-z][A-Za-z0-9]*$", "maxLength": 80}, "label": {"type": "string", "minLength": 2, "maxLength": 120}, "description": {"type": "string", "minLength": 10, "maxLength": 500}, "type": {"enum": ["string", "multiline", "boolean", "integer", "enum", "multiselect", "path", "command", "string-list", "key-value-list"]}, "required": {"type": "boolean"}, "sensitive": {"type": "boolean"}, "includeInOutput": {"type": "boolean"}, "default": {}, "options": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "maxLength": 120}}, "minLength": {"type": "integer", "minimum": 0}, "maxLength": {"type": "integer", "minimum": 1}, "minimum": {"type": "integer"}, "maximum": {"type": "integer"}, "visibleWhen": {"$ref": "#/$defs/condition"} } }, "guardrail": { "type": "object", "additionalProperties": false, "required": ["id", "severity", "text"], "properties": { "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"}, "severity": {"enum": ["info", "warning", "blocking"]}, "text": {"type": "string", "minLength": 10, "maxLength": 1000}, "rationale": {"type": "string", "maxLength": 500}, "when": {"$ref": "#/$defs/condition"} } }, "workflowStep": { "type": "object", "additionalProperties": false, "required": ["id", "title", "instruction", "required"], "properties": { "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"}, "title": {"type": "string", "minLength": 3, "maxLength": 120}, "instruction": {"type": "string", "minLength": 20, "maxLength": 2000}, "required": {"type": "boolean"}, "when": {"$ref": "#/$defs/condition"} } }, "check": { "type": "object", "additionalProperties": false, "required": ["id", "type", "description", "blocking", "evidence"], "properties": { "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"}, "type": {"enum": ["command", "manual", "artifact", "assertion"]}, "description": {"type": "string", "minLength": 10, "maxLength": 1000}, "blocking": {"type": "boolean"}, "evidence": {"type": "string", "minLength": 5, "maxLength": 500}, "when": {"$ref": "#/$defs/condition"} } }, "reportSection": { "type": "object", "additionalProperties": false, "required": ["id", "title", "required", "description"], "properties": { "id": {"type": "string", "pattern": "^[a-z][a-z0-9-]*$"}, "title": {"type": "string", "minLength": 2, "maxLength": 120}, "required": {"type": "boolean"}, "description": {"type": "string", "minLength": 10, "maxLength": 500} } } } }