Add CLI command development guide to CONTRIBUTING.md

This commit is contained in:
Claude 2026-01-17 22:38:26 +00:00
parent 0fe9fa6543
commit e414cf266a
No known key found for this signature in database

View file

@ -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