diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ceb5ada..178c320 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -230,6 +230,51 @@ src/ ``` 3. Update README.md keyboard shortcuts table +### Adding a New CLI Command + +The interactive terminal supports custom CLI commands for Roblox development. + +1. Edit `src/lib/cli-commands.ts` +2. Add your command to the `commands` object: + ```typescript + mycommand: { + name: 'mycommand', + description: 'Description of what it does', + usage: 'mycommand [args]', + aliases: ['mc', 'mycmd'], // Optional + execute: async (args, context) => { + // Access current code, files, etc. from context + // context.currentCode + // context.currentFile + // context.files + // context.setCode() + // context.addLog() + + // Perform your command logic + + return { + success: true, + output: 'Command output', + type: 'info', // or 'log', 'warn', 'error' + }; + }, + } + ``` + +#### Available Context: +- `context.currentCode` - Current editor code +- `context.currentFile` - Active file name +- `context.files` - File tree array +- `context.setCode(code)` - Update editor code +- `context.addLog(message, type)` - Add terminal log + +#### Command Features: +- Command aliases for shortcuts +- Argument parsing (args array) +- Context-aware execution +- Error handling with toast notifications +- Special `__CLEAR__` output to clear terminal + ## Performance Guidelines - Use React.lazy() for code splitting