# Contributing to Pine Script Transpiler Thank you for your interest in contributing to the Pine Script Transpiler! This document provides guidelines and instructions for contributing. ## Table of Contents - [Code of Conduct](#code-of-conduct) - [Getting Started](#getting-started) - [Development Setup](#development-setup) - [How to Contribute](#how-to-contribute) - [Coding Standards](#coding-standards) - [Commit Guidelines](#commit-guidelines) - [Pull Request Process](#pull-request-process) ## Code of Conduct This project adheres to a Code of Conduct that all contributors are expected to follow. Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before contributing. ## Getting Started ### Prerequisites - Node.js 18+ - Bun 1.3+ - Git ### Development Setup 1. **Fork and clone the repository** ```bash git clone https://github.com/YOUR_USERNAME/pine-transpiler.git cd pine-transpiler ``` 2. **Install dependencies** (`prepare` builds `dist/` automatically) ```bash bun install ``` 3. **Verify the build locally** ```bash bun run typecheck # tsc --noEmit bun run lint # biome check src bun run test # unit + integration suite bun run corpus # real-world Pine corpus pass rate bun run build # produces the published dist/ ``` 4. **Enforce the coverage gate** (CI runs this — 95% line + 95% function aggregate) ```bash bun run test:coverage ``` ## How to Contribute ### Reporting Bugs Before creating a bug report, please check existing issues to avoid duplicates. When creating a bug report, include: - Clear, descriptive title - Pine Script code that reproduces the issue - Expected behavior vs actual behavior - Error messages (if any) - Your environment (Node version, OS, etc.) ### Suggesting Features Feature suggestions are welcome! Please: - Use a clear, descriptive title - Provide detailed description of the proposed feature - Explain the use case and benefits - Consider including example Pine Script code ### Contributing Code 1. **Find or create an issue** - Discuss your changes before starting work 2. **Create a branch** - Use a descriptive name (e.g., `fix/rsi-calculation`, `feat/add-stochastic`) 3. **Make your changes** - Follow our coding standards 4. **Test your changes** - Ensure everything works correctly 5. **Submit a pull request** - Reference the related issue ## Coding Standards ### TypeScript - Use TypeScript for all code - Maintain strict type safety - Avoid `any` types when possible - Export types for public APIs ### Code Style We use [Biome](https://biomejs.dev/) for code formatting and linting: ```bash # Check code style bun run lint # Auto-fix issues bun run lint:fix ``` ### File Organization ``` src/ ├── types/ # Type definitions ├── parser/ # Pine Script parsing logic ├── mappings/ # Function mapping tables ├── generator/ # JavaScript code generation └── index.ts # Main API exports ``` ### Naming Conventions - **Files**: kebab-case (e.g., `expression-transpiler.ts`) - **Functions**: camelCase (e.g., `transpileToPineJS`) - **Types/Interfaces**: PascalCase (e.g., `TranspileToPineJSResult`) - **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RECURSION_DEPTH`) ## Commit Guidelines We follow [Conventional Commits](https://www.conventionalcommits.org/): ``` ():