# Contributing Guide

Panduan ini untuk menjaga workflow tim tetap rapi, cepat direview, dan aman untuk di-merge.

## Branching Strategy

Branch utama:

- `main`: branch stabil, siap rilis.
- `dev/*`: branch utama untuk pengembangan fitur, bugfix, dan refactor.

Aturan:

1. Jangan commit langsung ke `main`.
2. Buat branch dari target branch terbaru.
3. Satu branch untuk satu tujuan perubahan.
4. Sync rutin dengan target branch agar konflik kecil.

## Commit Message Convention

Gunakan format Conventional Commits:

```text
<type>(<scope>): <short summary>
```

`type` yang dipakai:

- `feat`: fitur baru
- `fix`: perbaikan bug
- `refactor`: ubah struktur tanpa ubah behavior
- `test`: tambah/ubah test
- `docs`: dokumentasi
- `chore`: maintenance non-fitur
- `ci`: perubahan pipeline/automation

Contoh:

```text
feat(auth): add remember-me login flow
fix(news): prevent duplicate query on pagination
test(auth): cover failed login throttle scenario
ci(actions): add laravel inertia ci workflow
docs(contributing): add branch and commit guidelines
```

Checklist commit:

1. Subject ringkas (disarankan <= 72 karakter).
2. Pakai kata kerja imperative: `add`, `fix`, `update`.
3. Satu commit untuk satu konteks perubahan.
4. Hindari pesan generik seperti `update` atau `wip`.

## Pull Request Flow

1. Push branch kerja ke remote.
2. Buat PR ke branch target (`dev/*` atau `main`).
3. Isi deskripsi PR:
   - tujuan perubahan
   - cakupan file/module
   - cara test
   - dampak/risiko
4. Pastikan CI lulus seluruhnya.
5. Merge setelah review disetujui.

## Quality Gate Sebelum Push

Minimal jalankan:

```bash
composer test
npm run build
```

Opsional tapi direkomendasikan:

```bash
./vendor/bin/pint
```

## CI Workflow Reference

Workflow CI ada di:

- `.github/workflows/laravel-inertia-ci.yml`

Trigger saat ini:

1. `push` ke semua branch
2. `pull_request` ke `main` dan `dev/**`
