Thank you for your interest in contributing to Script! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Issue Guidelines
By participating in this project, you agree to abide by our Code of Conduct:
- Be respectful and inclusive
- Welcome newcomers and help them get started
- Focus on constructive criticism
- Accept feedback gracefully
- Prioritize the project's best interests
- Check existing issues - Look for issues labeled
good first issueorhelp wanted - Read the documentation - Familiarize yourself with:
- README.md - Project overview
- CLAUDE.md - Development guide
- kb/active/KNOWN_ISSUES.md - Current bugs and limitations
- Rust 1.70+ (install via rustup)
- Git
- A code editor (VS Code with rust-analyzer recommended)
# Clone the repository
git clone https://github.com/moikapy/script.git
cd script
# Build the project
cargo build
# Run tests
cargo test
# Run the REPL
cargo run
# Build with all features
cargo build --all-featurescargo bench-
Check Issues for:
good first issue- Great for newcomershelp wanted- Community help neededbug- Bug fixesenhancement- New features
-
Review the kb/active/ directory for ongoing work
-
Current priorities (as of v0.5.0-alpha):
- Improving error messages
- REPL enhancements
- MCP integration
- Performance optimizations
- Comment on the issue to claim it
- Ask questions if anything is unclear
- Discuss the approach for larger changes
- Check for related work to avoid conflicts
# Fork the repository on GitHub, then:
git clone https://github.com/YOUR_USERNAME/script.git
cd script
git remote add upstream https://github.com/moikapy/script.git
# Create a feature branch
git checkout -b feature/your-feature-name- Write clean, idiomatic Rust code
- Add tests for new functionality
- Update documentation as needed
- Follow the coding standards below
# Format your code
cargo fmt
# Run clippy
cargo clippy --all-targets --all-features -- -D warnings
# Run tests
cargo test
# Run tests with MCP features
cargo test --features mcp
# Check documentation
cargo doc --no-deps --all-featuresUse conventional commit messages:
feat: add new array methods to stdlib
fix: resolve memory leak in closure capture
docs: update REPL usage guide
test: add tests for pattern matching edge cases
refactor: simplify type inference algorithm
perf: optimize lexer tokenization
- Push to your fork
- Create a pull request to
mainbranch - Fill out the PR template
- Wait for review and address feedback
- Follow standard Rust naming conventions
- Use
cargo fmtfor formatting - Address all
cargo clippywarnings - Prefer clarity over cleverness
// Good: Clear module organization
pub mod lexer {
mod scanner;
mod token;
pub use scanner::Scanner;
pub use token::{Token, TokenKind};
}
// Good: Clear error handling
fn parse_expression(&mut self) -> Result<Expr, ParseError> {
// implementation
}/// Parses a Script source file into an AST.
///
/// # Arguments
///
/// * `source` - The source code to parse
///
/// # Returns
///
/// Returns `Ok(Program)` on success, or `Err(ParseError)` on failure.
///
/// # Examples
///
/// ```
/// use script::parser::parse;
///
/// let ast = parse("let x = 42").unwrap();
/// ```
pub fn parse(source: &str) -> Result<Program, ParseError> {
// implementation
}- Unit tests go in the same file as the code
- Integration tests go in
tests/ - Use descriptive test names
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_lexer_handles_unicode() {
let input = "let 世界 = \"hello\"";
let tokens = tokenize(input);
assert_eq!(tokens[1].lexeme, "世界");
}
#[test]
#[should_panic(expected = "index out of bounds")]
fn test_array_bounds_checking() {
let arr = vec![1, 2, 3];
let _ = arr[10]; // Should panic
}
}- Aim for >80% coverage for new code
- Test edge cases and error conditions
- Include both positive and negative tests
- Document all public APIs
- Include examples in doc comments
- Explain complex algorithms
- Update relevant KB files
When making significant changes:
- Update relevant files in
kb/ - Move completed issues from
kb/active/tokb/completed/ - Update
kb/status/OVERALL_STATUS.mdif needed
Include:
- Script version
- Operating system
- Minimal reproduction code
- Expected vs actual behavior
- Error messages/stack traces
Include:
- Use case description
- Proposed syntax/API
- Examples of usage
- Impact on existing features
## Bug: Closure capture of mutable variables fails
### Version
Script v0.5.0-alpha
### Description
When capturing mutable variables in closures, the compiler panics.
### Reproduction
```script
let mut x = 10
let inc = || { x += 1 } // Compiler panic here
inc()Should capture x by reference and allow mutation.
Compiler panic: "cannot capture mutable variable"
- OS: Ubuntu 22.04
- Rust: 1.75.0
## Need Help?
- Check the [documentation](docs/)
- Ask in [GitHub Discussions](https://github.com/moikapy/script/discussions)
- Review similar PRs/issues
- Tag `@moikapy` for guidance
## Recognition
Contributors are recognized in:
- The project README
- Release notes
- Annual contributor spotlight
Thank you for helping make Script better! 🚀