Roo-Code/schemas/roomodes.json
Roo Code 3fd2ca47c8 refactor: dynamically generate roomodes JSON schema from Zod types
Replace the hand-crafted schemas/roomodes.json with one generated from
the Zod schemas in packages/types/src/mode.ts using zod-to-json-schema.
This ensures the schema stays in sync when TypeScript types change.

- Add zod-to-json-schema dev dependency to packages/types
- Create packages/types/scripts/generate-roomodes-schema.ts
- Add generate:schema npm script to packages/types
- Add drift-detection test in packages/types to catch schema/type mismatches
- Update existing AJV validation tests with documentation comment
2026-03-02 15:31:19 +00:00

96 lines
2.1 KiB
JSON

{
"type": "object",
"properties": {
"customModes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {
"type": "string",
"pattern": "^[a-zA-Z0-9-]+$"
},
"name": {
"type": "string",
"minLength": 1
},
"roleDefinition": {
"type": "string",
"minLength": 1
},
"whenToUse": {
"type": "string"
},
"description": {
"type": "string"
},
"customInstructions": {
"type": "string"
},
"source": {
"type": "string",
"enum": ["global", "project"]
},
"groups": {
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": ["read", "edit", "command", "mcp", "modes", "browser"]
},
{
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "string",
"enum": ["read", "edit", "command", "mcp", "modes", "browser"]
},
{
"type": "object",
"properties": {
"fileRegex": {
"type": "string"
},
"description": {
"type": "string"
}
},
"additionalProperties": false
}
]
}
]
}
},
"rulesFiles": {
"type": "array",
"items": {
"type": "object",
"properties": {
"relativePath": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": ["relativePath"],
"additionalProperties": false
}
}
},
"required": ["slug", "name", "roleDefinition", "groups"],
"additionalProperties": false
}
}
},
"required": ["customModes"],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/RooCodeInc/Roo-Code/blob/main/schemas/roomodes.json",
"title": "Roo Code Custom Modes",
"description": "Schema for .roomodes configuration files used by Roo Code to define custom modes."
}