|
1 | 1 | # Contributing to LLMSession |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to **LLMSession**! This project is a monorepo containing both the Python and Node.js implementations. We welcome contributions to either (or both) parts of the library. |
| 3 | +Thank you for your interest in contributing to **LLMSession**! We welcome all contributions including bug fixes, new features, documentation improvements, and more. |
4 | 4 |
|
5 | | -## 1. Project Structure |
| 5 | +## Project Structure |
6 | 6 |
|
7 | | -* **`python/`**: Contains the Python source code and packaging config. |
8 | | -* **`node/`**: Contains the TypeScript source code and NPM config. |
| 7 | +* **`src/`**: Contains the Python source code |
| 8 | +* **`verify_flow.py`**: Verification script for testing |
| 9 | +* **`verify_aistudio.py`**: Additional verification script |
| 10 | +* **`.github/workflows/`**: CI/CD workflows for automated publishing |
| 11 | +* **`pyproject.toml`**: Package configuration and dependencies |
9 | 12 |
|
10 | | -Please ensure you are working in the correct subdirectory for your changes. |
| 13 | +## Development Setup |
11 | 14 |
|
12 | | -## 2. Python Development |
| 15 | +### 1. Fork and Clone |
13 | 16 |
|
14 | | -### Setup |
15 | | -1. Navigate to the python directory: `cd python` |
16 | | -2. Create a virtual environment (optional but recommended): |
| 17 | +1. Fork the repository on GitHub |
| 18 | +2. Clone your fork locally: |
| 19 | + ```bash |
| 20 | + git clone https://github.com/YOUR_USERNAME/llm_session.git |
| 21 | + cd llm_session |
| 22 | + ``` |
| 23 | + |
| 24 | +### 2. Set Up Development Environment |
| 25 | + |
| 26 | +1. Create a virtual environment (recommended): |
17 | 27 | ```bash |
18 | 28 | python -m venv venv |
19 | 29 | source venv/bin/activate # Linux/Mac |
20 | 30 | # or |
21 | 31 | .\venv\Scripts\activate # Windows |
22 | 32 | ``` |
23 | | -3. Install the package in **Editable Mode**: |
| 33 | + |
| 34 | +2. Install the package in **Editable Mode**: |
24 | 35 | ```bash |
25 | 36 | pip install -e . |
26 | 37 | ``` |
27 | 38 | *This allows you to modify code in `src/` and test it immediately without reinstalling.* |
28 | 39 |
|
29 | | -### Testing |
30 | | -We use a manual verification script to test the full flow (Browser launch -> Auth -> Prompt). |
| 40 | +3. Install build tools (optional, for testing builds): |
| 41 | + ```bash |
| 42 | + pip install build |
| 43 | + ``` |
| 44 | + |
| 45 | +### 3. Testing Your Changes |
| 46 | + |
| 47 | +We use manual verification scripts to test the full flow (Browser launch → Auth → Prompt). |
| 48 | + |
31 | 49 | ```bash |
32 | 50 | python verify_flow.py |
33 | 51 | ``` |
34 | | -*Tip: You can modify `verify_flow.py` to use `headless=False` to watch the bot work.* |
35 | 52 |
|
36 | | -## 3. Node.js Development |
| 53 | +*Tip: You can modify `verify_flow.py` to use `headless=False` to watch the bot work in real-time.* |
| 54 | + |
| 55 | +### 4. Building Locally |
| 56 | + |
| 57 | +To test the build process locally before pushing: |
| 58 | + |
| 59 | +```bash |
| 60 | +python -m build |
| 61 | +``` |
| 62 | + |
| 63 | +This will create distribution files in the `dist/` directory. |
| 64 | + |
| 65 | +## Safety Warning (Credentials) |
37 | 66 |
|
38 | | -### Setup |
39 | | -1. Navigate to the node directory: `cd node` |
40 | | -2. Install dependencies: |
| 67 | +To test changes, you will likely need to put real credentials into `verify_flow.py`. |
| 68 | + |
| 69 | +> [!CAUTION] |
| 70 | +> **NEVER commit files containing your real passwords.** |
| 71 | +> If you modify the verification scripts with real credentials, please revert those changes before pushing, or ensure they are ignored by git. |
| 72 | + |
| 73 | +## Pull Request Process |
| 74 | + |
| 75 | +1. **Fork & Clone**: Fork the repo and clone it locally (see above) |
| 76 | +2. **Branch**: Create a feature branch from `main`: |
41 | 77 | ```bash |
42 | | - npm install |
| 78 | + git checkout -b feature/your-feature-name |
43 | 79 | ``` |
44 | | - |
45 | | -### Building |
46 | | -Since this is a TypeScript project, you must compile the code. |
47 | | -* **One-off build**: |
| 80 | +3. **Code**: Implement your changes |
| 81 | + * Adhere to **PEP 8** style guidelines |
| 82 | + * Add docstrings to new functions and classes |
| 83 | + * Keep code clean and well-commented |
| 84 | +4. **Test**: Run the verification scripts to ensure everything works: |
48 | 85 | ```bash |
49 | | - npm run build |
| 86 | + python verify_flow.py |
50 | 87 | ``` |
51 | | -* **Watch mode (Recommended for Dev)**: |
| 88 | +5. **Commit**: Use clear, descriptive commit messages: |
52 | 89 | ```bash |
53 | | - npx tsc -w |
| 90 | + git commit -m "Add feature: description of what you added" |
54 | 91 | ``` |
55 | | - *Keep this running in a separate terminal to auto-compile changes.* |
| 92 | +6. **Push**: Push to your fork: |
| 93 | + ```bash |
| 94 | + git push origin feature/your-feature-name |
| 95 | + ``` |
| 96 | +7. **Open PR**: Open a Pull Request against the `main` branch on GitHub |
56 | 97 |
|
57 | | -### Testing |
58 | | -To run the verification flow using `ts-node` (skips build step) or the compiled dist: |
59 | | -```bash |
60 | | -# Run directly from TypeScript source |
61 | | -npx ts-node verify_flow.ts |
62 | | -``` |
| 98 | +## Code Style Guidelines |
63 | 99 |
|
64 | | -## 4. Safety Warning (Credentials) |
| 100 | +* Follow **PEP 8** conventions for Python code |
| 101 | +* Use meaningful variable and function names |
| 102 | +* Add comments for complex logic |
| 103 | +* Keep functions focused and single-purpose |
| 104 | +* Add type hints where appropriate |
65 | 105 |
|
66 | | -To test changes, you will likely need to put real credentials into `verify_flow.py` or `verify_flow.ts`. |
| 106 | +## Types of Contributions |
67 | 107 |
|
68 | | -> [!CAUTION] |
69 | | -> **NEVER commit files containing your real passwords.** |
70 | | -> If you modify the verification scripts with real credentials, please revert those changes before pushing, or ensure they are ignored. |
| 108 | +### Bug Fixes |
| 109 | + |
| 110 | +If you're fixing a bug: |
| 111 | +1. Describe the bug in your PR |
| 112 | +2. Explain how your fix resolves it |
| 113 | +3. Test thoroughly before submitting |
| 114 | +
|
| 115 | +### New Features |
| 116 | +
|
| 117 | +If you're adding a new feature: |
| 118 | +1. Open an issue first to discuss the feature |
| 119 | +2. Wait for maintainer feedback before implementing |
| 120 | +3. Update documentation (README.md) if needed |
| 121 | +4. Add examples showing how to use the feature |
| 122 | + |
| 123 | +### Documentation |
71 | 124 |
|
72 | | -## 5. Pull Request Process |
| 125 | +Documentation improvements are always welcome: |
| 126 | +* Fix typos or unclear explanations |
| 127 | +* Add more examples |
| 128 | +* Improve API documentation |
| 129 | +* Update outdated information |
73 | 130 |
|
74 | | -1. **Fork & Clone**: Fork the repo and clone it locally. |
75 | | -2. **Branch**: Create a feature branch (`git checkout -b feature/amazing-feature`). |
76 | | -3. **Code**: Implement your changes. |
77 | | - * **Python**: Adhere to PEP 8. |
78 | | - * **Node**: Adhere to standard ESLint/Prettier conventions. |
79 | | -4. **Verify**: Run the verification scripts in both languages if your change affects shared logic (like selectors). |
80 | | -5. **Commit**: Use descriptive commit messages. |
81 | | -6. **Push & PR**: Push to your fork and open a Pull Request against `main`. |
| 131 | +### Updating Selectors |
82 | 132 |
|
83 | | -## 6. Adding New Selectors |
| 133 | +If you're fixing broken selectors because ChatGPT updated their UI: |
| 134 | +1. Update `src/llm_session/providers/chatgpt.py` |
| 135 | +2. Test thoroughly with the verification script |
| 136 | +3. Document which elements changed in your PR description |
84 | 137 |
|
85 | | -If you are fixing a broken selector because ChatGPT updated their UI: |
86 | | -1. Update `python/src/llm_session/providers/chatgpt.py` |
87 | | -2. Update `node/src/providers/ChatGPT.ts` |
88 | | -3. **Please update both** if possible to keep the libraries in sync. |
| 138 | +## Automated Publishing (For Maintainers) |
| 139 | +
|
| 140 | +This project uses **GitHub Actions** for automated publishing to PyPI: |
| 141 | +
|
| 142 | +* **Push to `main`**: Automatically publishes to TestPyPI for testing |
| 143 | +* **Push a version tag** (e.g., `v0.1.4`): Automatically publishes to PyPI |
| 144 | +
|
| 145 | +### Creating a Release (Maintainers Only) |
| 146 | +
|
| 147 | +1. Update version in `pyproject.toml`: |
| 148 | + ```toml |
| 149 | + version = "0.1.4" |
| 150 | + ``` |
| 151 | +
|
| 152 | +2. Commit and push: |
| 153 | + ```bash |
| 154 | + git add pyproject.toml |
| 155 | + git commit -m "Release version 0.1.4" |
| 156 | + git push origin main |
| 157 | + ``` |
| 158 | +
|
| 159 | +3. Create and push a tag: |
| 160 | + ```bash |
| 161 | + git tag v0.1.4 |
| 162 | + git push origin v0.1.4 |
| 163 | + ``` |
| 164 | +
|
| 165 | +4. The GitHub Actions workflow will automatically build and publish to PyPI |
| 166 | +
|
| 167 | +## Getting Help |
| 168 | +
|
| 169 | +If you need help with contributing: |
| 170 | +* Open a [GitHub Discussion](https://github.com/star-173/llm_session/discussions) |
| 171 | +* Check existing [Issues](https://github.com/star-173/llm_session/issues) |
| 172 | +* Reach out to maintainers in your PR |
| 173 | +
|
| 174 | +## Code of Conduct |
| 175 | +
|
| 176 | +* Be respectful and constructive |
| 177 | +* Welcome newcomers and help them learn |
| 178 | +* Focus on what is best for the community |
| 179 | +* Show empathy towards other community members |
89 | 180 |
|
90 | 181 | ## License |
91 | 182 |
|
92 | | -By contributing, you agree that your contributions will be licensed under the MIT License. |
| 183 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 184 | +
|
| 185 | +--- |
| 186 | +
|
| 187 | +Thank you for contributing to LLMSession! 🎉 |
0 commit comments