Skip to content

Latest commit

 

History

History
158 lines (123 loc) · 4.2 KB

File metadata and controls

158 lines (123 loc) · 4.2 KB

Contributing to LazyGravity

First off, thank you for considering contributing to LazyGravity! It's people like you that make LazyGravity such a great tool.

Development Setup

Prerequisites

  • Node.js: Version 18.x or higher
  • npm: Version 8.x or higher
  • Antigravity: Installed and running on your local machine

Cloning the Repository

git clone https://github.com/tokyoweb3/LazyGravity.git
cd LazyGravity

Installation

npm install

Configuration

  1. Copy the example environment file:
    cp .env.example .env
  2. Edit .env and fill in your Discord bot token, guild ID, and authorized user IDs.

Running the Bot

  • Development mode (with auto-reload):
    npm run dev
  • From source:
    npm run start
  • Build and run:
    npm run build
    npm run start:built

Project Structure

src/
  index.ts           # Entry point
  bin/               # CLI commands (setup, doctor, start, open)
  bot/               # Discord.js client config, event listeners
  commands/          # Slash commands and message parsing
  handlers/          # Message and reaction handlers
  services/          # Antigravity integration, task queue management
  utils/             # Security, logger, config utilities
  database/          # SQLite local DB management
tests/
docs/

Code Style Guidelines

TypeScript

  • We use TypeScript for all source code. Ensure your code passes type checking:
    npm run build # This triggers tsc
  • Use descriptive names for variables, functions, and classes.
  • Prefer interface over type for object definitions where possible.

Immutability Patterns

  • Prefer const over let.
  • Avoid mutating objects and arrays directly; use the spread operator (...) or other non-mutating methods.
  • For state management (e.g., in services), use patterns that ensure predictability and easy debugging.

Code Comments

  • Write code comments in English.
  • Only add comments where the logic isn't self-evident.

Commit Message Format

We follow the Conventional Commits specification. Each commit message should follow this format:

<type>: <description>

Allowed Types:

  • feat: A new feature
  • fix: A bug fix
  • refactor: A code change that neither fixes a bug nor adds a feature
  • docs: Documentation only changes
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries
  • perf: A code change that improves performance
  • ci: Changes to our CI configuration files and scripts

Examples

feat: add support for custom message templates
fix: prevent duplicate CDP connections on rapid reconnect
docs: update README with new CLI commands
refactor: extract color constants from doctor command

PR Process and Review Expectations

  1. Fork the repository and create a feature branch from main.
  2. Self-Review: Before submitting, ensure your code follows the style guidelines and passes tests.
  3. Write tests for new functionality (aim for 80%+ coverage).
  4. Run the test suite and build before submitting:
    npm test
    npm run build
  5. Template: Use the provided Pull Request template.
  6. Atomic Commits: Keep your commits focused on a single change.
  7. Review: At least one maintainer will review your PR. Address any feedback promptly.
  8. Merging: Once approved and all checks pass, your code will be merged into the main branch.

How to Run Tests

Ensure all tests pass before submitting a PR.

Unit Tests

npm run test:unit

Integration Tests

Note: Integration tests may require a configured environment.

npm run test:integration

Watch Mode

npm run test:watch

Reporting Issues

Please use the provided Issue Templates for bugs and feature requests.

GitHub Discussions

For general questions or ideas, please visit our Discussions page.

License

By contributing, you agree that your contributions will be licensed under the MIT License.