# Chatwoot Development Guidelines ## Build / Test / Lint - **Setup**: `bundle install && pnpm install` - **Run Dev**: `pnpm dev` or `overmind start -f ./Procfile.dev` - **Seed Local Test Data**: `bundle exec rails db:seed` (quickly populates minimal data for standard feature verification) - **Seed Search Test Data**: `bundle exec rails search:setup_test_data` (bulk fixture generation for search/performance/manual load scenarios) - **Seed Account Sample Data (richer test data)**: `Seeders::AccountSeeder` is available as an internal utility and is exposed through Super Admin `Accounts#seed`, but can be used directly in dev workflows too: - UI path: Super Admin → Accounts → Seed (enqueues `Internal::SeedAccountJob`). - CLI path: `bundle exec rails runner "Internal::SeedAccountJob.perform_now(Account.find())"` (or call `Seeders::AccountSeeder.new(account: Account.find()).perform!` directly). - **Lint JS/Vue**: `pnpm eslint` / `pnpm eslint:fix` - **Lint Ruby**: `bundle exec rubocop -a` - **Test JS**: `pnpm test` or `pnpm test:watch` - **Test Ruby**: `bundle exec rspec spec/path/to/file_spec.rb` - **Single Test**: `bundle exec rspec spec/path/to/file_spec.rb:LINE_NUMBER` - **Run Project**: `overmind start -f Procfile.dev` - **Ruby Version**: Manage Ruby via `rbenv` and install the version listed in `.ruby-version` (e.g., `rbenv install $(cat .ruby-version)`) - **rbenv setup**: Before running any `bundle` or `rspec` commands, init rbenv in your shell (`eval "$(rbenv init -)"`) so the correct Ruby/Bundler versions are used - Always prefer `bundle exec` for Ruby CLI tasks (rspec, rake, rubocop, etc.) ## Code Style - **Ruby**: Follow RuboCop rules (150 character max line length) - **Vue/JS**: Use ESLint (Airbnb base + Vue 3 recommended) - **Vue Components**: Use PascalCase - **Events**: Use camelCase - **I18n**: No bare strings in templates; use i18n - **Error Handling**: Use custom exceptions (`lib/custom_exceptions/`) - **Models**: Validate presence/uniqueness, add proper indexes - **Type Safety**: Use PropTypes in Vue, strong params in Rails - **Naming**: Use clear, descriptive names with consistent casing - **Vue API**: Always use Composition API with `