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 the managed reload/restart/world-reopen gate:
- Prepare either a Paper 1.21.4 stable template at
~/mc-test-serveror a Paper 26.2 template at~/mc-test-server-26.2. Each needspaper.jar, offlinelibraries/,versions/, and exactly one TestHarness plugin jar. - Do not place a reusable world in either template. The gate creates a disposable air-only void world, bootstraps deterministic rules, and verifies its
y=63floor. - Ensure TestHarness port
25561is free; the gate owns server startup and restart. - Run the stable gate with
MC_P9_TEMPLATE_DIR=~/mc-test-server npm run test:mc-lifecycle:live. - Run the 26.2 gate with
MC_P9_VERSION_CHANNEL=paper-26.2 MC_P9_TEMPLATE_DIR=~/mc-test-server-26.2 npm run test:mc-lifecycle:live.
npm run test:mc-lifecycle is the offline-safe form: unavailable prerequisites produce an explicit [SKIP] report rather than live-proof claims. Static npm run validate-mc remains a separate evidence label.
See Testing Guide, the Paper 1.21.4 evidence, and the Paper 26.2 evidence 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.