Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit cfc8a55

Browse files
committed
feat: add correct JSON schema for .roomodes configuration files
Adds schemas/roomodes.json that accurately reflects the actual .roomodes format as defined in packages/types/src/mode.ts. The schema supports: - All CustomMode properties including optional description and source - Tuple-style group entries like ["edit", { fileRegex, description }] - All five tool groups: read, edit, command, mcp, modes Also adds comprehensive tests validating the schema against valid and invalid configurations. Closes #11790
1 parent 1930531 commit cfc8a55

4 files changed

Lines changed: 430 additions & 1 deletion

File tree

pnpm-lock.yaml

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schemas/roomodes.json

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/RooCodeInc/Roo-Code/blob/main/schemas/roomodes.json",
4+
"title": "Roo Code Custom Modes",
5+
"description": "Schema for .roomodes configuration files used by Roo Code to define custom modes.",
6+
"type": "object",
7+
"required": ["customModes"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"customModes": {
11+
"type": "array",
12+
"description": "List of custom mode definitions.",
13+
"items": {
14+
"$ref": "#/definitions/CustomMode"
15+
}
16+
}
17+
},
18+
"definitions": {
19+
"ToolGroup": {
20+
"type": "string",
21+
"enum": ["read", "edit", "command", "mcp", "modes"],
22+
"description": "A tool group name that grants the mode access to a set of tools."
23+
},
24+
"GroupOptions": {
25+
"type": "object",
26+
"description": "Options that restrict a tool group's file access.",
27+
"properties": {
28+
"fileRegex": {
29+
"type": "string",
30+
"description": "A regular expression pattern to restrict which files the tool group can access."
31+
},
32+
"description": {
33+
"type": "string",
34+
"description": "A human-readable description of the file restriction."
35+
}
36+
},
37+
"additionalProperties": false
38+
},
39+
"GroupEntryTuple": {
40+
"type": "array",
41+
"description": "A tuple of [toolGroupName, options] for tool groups with file restrictions.",
42+
"items": [{ "$ref": "#/definitions/ToolGroup" }, { "$ref": "#/definitions/GroupOptions" }],
43+
"additionalItems": false,
44+
"minItems": 2,
45+
"maxItems": 2
46+
},
47+
"GroupEntry": {
48+
"description": "A tool group permission entry. Either a simple tool group name string, or a [toolGroupName, options] tuple for groups with file restrictions.",
49+
"oneOf": [{ "$ref": "#/definitions/ToolGroup" }, { "$ref": "#/definitions/GroupEntryTuple" }]
50+
},
51+
"CustomMode": {
52+
"type": "object",
53+
"description": "A custom mode definition.",
54+
"required": ["slug", "name", "roleDefinition", "groups"],
55+
"additionalProperties": false,
56+
"properties": {
57+
"slug": {
58+
"type": "string",
59+
"pattern": "^[a-zA-Z0-9-]+$",
60+
"description": "A unique identifier for the mode, containing only letters, numbers, and dashes."
61+
},
62+
"name": {
63+
"type": "string",
64+
"minLength": 1,
65+
"description": "The display name of the mode."
66+
},
67+
"roleDefinition": {
68+
"type": "string",
69+
"minLength": 1,
70+
"description": "The system prompt that defines the mode's role and behavior."
71+
},
72+
"whenToUse": {
73+
"type": "string",
74+
"description": "A description of when this mode should be used, shown in the mode selection UI."
75+
},
76+
"description": {
77+
"type": "string",
78+
"description": "A short description of the mode."
79+
},
80+
"customInstructions": {
81+
"type": "string",
82+
"description": "Additional instructions appended to the system prompt."
83+
},
84+
"groups": {
85+
"type": "array",
86+
"description": "The tool groups this mode has access to.",
87+
"items": {
88+
"$ref": "#/definitions/GroupEntry"
89+
}
90+
},
91+
"source": {
92+
"type": "string",
93+
"enum": ["global", "project"],
94+
"description": "Where this mode was defined. Automatically set by Roo Code."
95+
}
96+
}
97+
}
98+
}
99+
}

src/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@
567567
"@vscode/test-electron": "^2.5.2",
568568
"@vscode/vsce": "3.3.2",
569569
"ai": "^6.0.75",
570+
"ajv": "^8.18.0",
570571
"esbuild-wasm": "^0.25.0",
571572
"execa": "^9.5.2",
572573
"glob": "^11.1.0",

0 commit comments

Comments
 (0)