Thanks for your interest in contributing to RedScript! 🎮
- Node.js 18+
- npm or pnpm
git clone https://github.com/bkmashiro/redscript.git
cd redscript
npm install
npm run build
npm testredscript/
├── src/
│ ├── parser/ # Lexer & Parser (grammar → AST)
│ ├── lowering/ # AST → mcfunction code generation
│ ├── cli.ts # CLI entry point
│ ├── stdlib/ # Standard library (.mcrs files)
│ ├── examples/ # Example datapacks
│ └── __tests__/ # Jest tests
├── redscript-vscode/ # VSCode extension
└── docs/ # Documentation
npm run build # Compile TypeScript
npm run watch # Watch modenpm test # Run all tests
npm test -- --watch # Watch mode
npm test -- -t "foreach" # Run specific test- TypeScript with strict mode
- No semicolons (handled by prettier)
- 2-space indentation
- Add to
BUILTINSmap insrc/lowering/index.ts:
my_builtin: ([arg1, arg2]) => `my command ${arg1} ${arg2}`,-
For complex builtins (returning values), add special handling in
lowerCall(). -
Add tests in
src/__tests__/:
it('compiles my_builtin', () => {
const source = `fn test() { my_builtin("a", "b"); }`
const files = compile(source)
expect(getFunction(files, 'test')).toContain('my command a b')
})- Add documentation in docs.
- Update grammar in
src/parser/(lexer + parser) - Add AST types if needed
- Update lowering in
src/lowering/ - Add comprehensive tests
- Update VSCode extension syntax highlighting
Add utility functions to src/stdlib/:
// src/stdlib/my_utils.mcrs
/// Useful helper function
fn my_helper(target: selector) {
// implementation
}
- Fork the repo
- Create a feature branch:
git checkout -b feat/my-feature - Make changes with tests
- Run
npm run build && npm test - Commit with clear message:
feat: add X/fix: resolve Y - Push and open PR
feat:New featurefix:Bug fixdocs:Documentationtest:Testsrefactor:Code refactoringchore:Maintenance
For integration testing with a real Minecraft server:
- Set up Paper 1.21.4 server with testharness plugin
- Run:
npm run test:mc
See Testing Guide for details.
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Join discussions in GitHub Discussions
By contributing, you agree that your contributions will be licensed under the MIT License.