get_development_rules
Retrieve universal development rules and best practices for Modus Web Components to ensure consistent code quality and adherence to design system guidelines.
Instructions
Get universal development rules and best practices for Modus Web Components.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:733-757 (handler)The handler function that executes the get_development_rules tool logic. It looks up a setup guide with setupType === 'universal' or filename containing 'universal' in the loaded setup array, and returns its content as a text response. Returns an error message if not found.
private async getDevelopmentRules(): Promise<any> { const universalGuide = this.setup.find( (s) => s.setupType === "universal" || s.filename.includes("universal") ); if (!universalGuide) { return { content: [ { type: "text", text: "Universal development rules not found. Please run: node download-docs.js", }, ], }; } return { content: [ { type: "text", text: universalGuide.content, }, ], }; } - src/index.ts:285-293 (registration)Registration of the tool 'get_development_rules' in the ListToolsRequestSchema handler. Defines the tool name, description ('Get universal development rules and best practices for Modus Web Components.'), and its input schema (empty object - no parameters).
{ name: "get_development_rules", description: "Get universal development rules and best practices for Modus Web Components.", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:335-336 (registration)Route handler in the CallToolRequestSchema that dispatches to getDevelopmentRules() when the tool name matches 'get_development_rules'.
case "get_development_rules": return await this.getDevelopmentRules(); - src/index.ts:135-160 (helper)The loadSetup() method that loads setup guide files from the setup directory. It reads .md files and maps filenames to types - specifically, files with 'universal_rules' in the name get type 'universal', which is what getDevelopmentRules() looks up.
private loadSetup(): void { if (!existsSync(this.setupPath)) { console.error(`Setup directory not found at: ${this.setupPath}`); console.error("Please run: node download-docs.js"); return; } const files = readdirSync(this.setupPath).filter((f) => f.endsWith(".md")); for (const file of files) { const content = readFileSync(join(this.setupPath, file), "utf-8"); let setupType = file.replace(".md", "").replace("setup_", ""); // Map filenames to more user-friendly types if (setupType === "universal_rules") setupType = "universal"; if (setupType === "theme_usage") setupType = "theme"; this.setup.push({ filename: file, setupType, content, }); } console.error(`Loaded ${this.setup.length} setup guide files`); } - src/index.ts:29-33 (schema)The SetupDoc interface that defines the shape of setup guide objects used by getDevelopmentRules(). It has filename, setupType, and content fields.
interface SetupDoc { filename: string; setupType: string; content: string; }