Skip to content

Latest commit

Β 

History

History
403 lines (320 loc) Β· 10.8 KB

File metadata and controls

403 lines (320 loc) Β· 10.8 KB

Contributing to SnapRun

Thank you for your interest in contributing to SnapRun! This document provides guidelines and information for contributors to help make the process smooth and effective.

🌟 Ways to Contribute

πŸ› Report Bugs

  • Use GitHub Issues to report bugs
  • Search existing issues before creating new ones
  • Provide detailed reproduction steps
  • Include system information and SnapRun version

πŸ’‘ Suggest Features

  • Use GitHub Discussions for feature ideas
  • Explain the use case and benefits
  • Consider implementation complexity
  • Gather community feedback

πŸ“ Improve Documentation

  • Fix typos and clarify instructions
  • Add examples and tutorials
  • Update API documentation
  • Create user guides and walkthroughs

πŸ”§ Submit Code

  • Bug fixes and improvements
  • New Rhai functions and APIs
  • UI enhancements
  • Performance optimizations

🎯 Create Scripts

  • Example scripts for common tasks
  • Educational scripts for learning Rhai
  • Template scripts for different use cases
  • Advanced automation examples

πŸš€ Getting Started

Prerequisites

Required Tools:

Optional Tools:

Setting Up Development Environment

  1. Fork and Clone

    git clone https://github.com/yourusername/winscript.git
    cd winscript
  2. Install Dependencies

    # Frontend dependencies
    pnpm install
    
    # Rust dependencies (automatically handled by Cargo)
    cd src-tauri
    cargo check
  3. Run Development Server

    # From project root
    pnpm tauri dev
  4. Verify Installation

    • Application should open with hot-reload enabled
    • Changes to frontend code should reflect immediately
    • Changes to Rust code require restart

Project Structure

SnapRun/
β”œβ”€β”€ src/                    # React/TypeScript frontend
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   β”œβ”€β”€ services/          # Frontend services
β”‚   └── ThemedComponents/  # UI component library
β”œβ”€β”€ src-tauri/             # Rust backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ lib.rs         # Main application logic
β”‚   β”‚   β”œβ”€β”€ script_manager.rs # Script handling
β”‚   β”‚   β”œβ”€β”€ fs_kit.rs      # File system operations
β”‚   β”‚   β”œβ”€β”€ process_kit.rs # Process management
β”‚   β”‚   └── rhai_engine.rs # Rhai integration
β”‚   └── Cargo.toml         # Rust dependencies
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ installer/             # Installer resources
└── scripts/               # Built-in example scripts

πŸ“‹ Contribution Guidelines

Code Style

Rust Code:

  • Follow Rust style guidelines
  • Use rustfmt for formatting: cargo fmt
  • Use clippy for linting: cargo clippy
  • Write descriptive variable and function names
  • Add documentation comments for public functions
/// Reads file content and returns it as a string
/// 
/// # Arguments
/// * `file_path` - Path to the file to read
/// 
/// # Returns
/// * `Result<String, String>` - File content or error message
fn read_file_content(file_path: &str) -> Result<String, String> {
    // Implementation
}

TypeScript/React Code:

  • Use TypeScript for type safety
  • Follow React best practices
  • Use functional components with hooks
  • Use meaningful component and variable names
  • Add JSDoc comments for complex functions
/**
 * Hook for managing keyboard shortcuts
 * @param shortcuts - Object mapping keys to callback functions
 */
export const useKeyboardShortcuts = (
    shortcuts: Record<string, () => void>
) => {
    // Implementation
};

General Guidelines:

  • Keep functions small and focused
  • Use descriptive commit messages
  • Include tests when appropriate
  • Update documentation for API changes

Commit Messages

Use clear, descriptive commit messages:

feat: add new file encryption function to Rhai API
fix: resolve system tray icon not updating on Windows 11
docs: update API reference for process management functions
refactor: simplify script loading logic in script_manager
test: add unit tests for file system operations

Format: type: description

Types:

  • feat: New features
  • fix: Bug fixes
  • docs: Documentation changes
  • style: Formatting changes
  • refactor: Code restructuring
  • test: Adding/updating tests
  • chore: Build process or tooling changes

Pull Request Process

  1. Create Feature Branch

    git checkout -b feature/your-feature-name
  2. Make Changes

    • Implement your changes
    • Test thoroughly
    • Update documentation
  3. Test Your Changes

    # Run development version
    pnpm tauri dev
    
    # Build and test
    pnpm tauri build
    
    # Run any tests
    cargo test
  4. Create Pull Request

    • Push your branch to your fork
    • Create PR against main branch
    • Fill out PR template completely
    • Link related issues
  5. PR Review Process

    • Maintainers will review your code
    • Address feedback and requested changes
    • Keep PR updated with main branch
    • PR will be merged when approved

Testing

Manual Testing:

  • Test on Windows 10 and 11 if possible
  • Verify system tray functionality
  • Test global shortcuts
  • Validate script execution
  • Check UI responsiveness

Automated Testing:

# Rust tests
cd src-tauri
cargo test

# Frontend tests (if available)
pnpm test

Testing Checklist:

  • Feature works as expected
  • No regression in existing functionality
  • UI is responsive and accessible
  • System tray and shortcuts work
  • Scripts execute correctly
  • Build process completes successfully

πŸ”§ Development Tasks

Adding New Rhai Functions

  1. Define Function in Rust

    // In appropriate kit file (fs_kit.rs, process_kit.rs, etc.)
    pub fn my_new_function(param: String) -> Result<String, Box<EvalAltResult>> {
        // Implementation
        Ok("result".to_string())
    }
  2. Register Function in Rhai Engine

    // In rhai_engine.rs
    engine.register_fn("my_function", my_new_function);
  3. Update Documentation

  4. Create Example Script

    // In scripts/built_in_scripts/
    let result = my_function("test input");
    print("Result: " + result);
    

Improving UI Components

  1. Create/Modify Component

    // In src/components/
    export const MyComponent: React.FC<Props> = ({ prop1, prop2 }) => {
        return (
            <div className="themed-component">
                {/* Component content */}
            </div>
        );
    };
  2. Update Styles

    /* In appropriate CSS file */
    .themed-component {
        background: var(--glass-background);
        border: 1px solid var(--glass-border);
        border-radius: 8px;
    }
  3. Test Responsiveness

    • Test different window sizes
    • Verify glass effects work
    • Check dark theme compatibility

Building Installers

Development Build:

pnpm tauri build

Production Release:

# Build all installer types
pnpm run release:full

Individual Installers:

# MSI installer
pnpm run build:msi

# NSIS installer  
pnpm run build:nsis

# Inno Setup installer
pnpm run build:inno

πŸ“š Resources

Documentation

Tools

Community

πŸ›‘οΈ Code of Conduct

Our Standards

Positive behavior includes:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints
  • Gracefully accepting constructive criticism
  • Focusing on what's best for the community
  • Showing empathy towards other community members

Unacceptable behavior includes:

  • Harassment, discrimination, or offensive comments
  • Public or private harassment
  • Publishing private information without permission
  • Other conduct inappropriate in a professional setting

Enforcement

Report inappropriate behavior to the project maintainers. All complaints will be reviewed and investigated promptly and fairly.

Project maintainers who don't follow the Code of Conduct may face temporary or permanent consequences.

πŸ† Recognition

Contributors are recognized in several ways:

Contributors File

All contributors are listed in CONTRIBUTORS.md with their contributions.

Release Notes

Significant contributions are highlighted in release notes and changelogs.

Special Recognition

  • First-time contributors get special welcome
  • Regular contributors may be invited as collaborators
  • Outstanding contributions are featured in project updates

❓ Getting Help

For Contributors

  • Read this guide thoroughly
  • Check existing issues and PRs
  • Ask questions in GitHub Discussions
  • Reach out to maintainers for guidance

For Users

πŸ“„ License

By contributing to SnapRun, you agree that your contributions will be licensed under the same MIT License that covers the project.


Thank you for contributing to SnapRun! Your efforts help make Windows automation more accessible and powerful for everyone. πŸš€