# Contributing

Thanks for your interest! Bug reports, ideas, presets for other key layouts and pull requests are all welcome.
By taking part you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md).

## Before you start

- **First contribution?** Look for issues labelled
  [good first issue](https://github.com/chkalyvas/kvrocks-gui/labels/good%20first%20issue).
- **Bugs and ideas:** open an issue with the templates. For larger changes, open an issue first so we can agree
  on the approach before you spend time on it.
- **Security problems:** do not open an issue, see [SECURITY.md](SECURITY.md).
- **Where things are:** [`app/`](app) is the GUI (Vue 2 UI in `src/`, Node server in `server/`),
  [`demo/vulnerability-lookup/`](demo/vulnerability-lookup) is the demo. [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
  explains how a command travels from the UI to kvrocks and where to make a change. [ROADMAP.md](ROADMAP.md) lists planned work.

## Development setup

Requirements: Node 20+ (CI uses 22), Docker.

```powershell
cd demo/vulnerability-lookup; docker compose up -d kvrocks; docker compose --profile seed run --rm seed
```

```powershell
cd app; npm install; npm run dev
```

`npm run dev` serves a hot-reloading UI on http://localhost:9988 with the server on 8484. To use the demo preset
while developing, set `KVGUI_PRESETS_DIR` to `../demo/vulnerability-lookup/presets`.

## Checks

CI runs these on every pull request; please run them before pushing:

```powershell
cd app; npm run lint:check; npm run check:server; npm run build
```

```powershell
cd app; npm start   # in another terminal, then:
node test/rpc-smoke.mjs
```

`test/rpc-cluster.mjs` needs the demo cluster (`docker compose --profile cluster up -d` in the demo folder).
Both tests work on an empty database. Lint warnings come from the upstream code; new code should not add any.

## Pull requests

- One topic per pull request, with a short description of what and why. Link the issue it closes.
- Add or update tests in `app/test/` when you change the server or the RPC protocol.
- Update the README or `app/presets/README.md` when behaviour or configuration changes, and add a line under
  **Unreleased** in [CHANGELOG.md](CHANGELOG.md).
- Keep the security properties: read-only mode, the command allow-list and the same-origin check are enforced on
  the server, never only in the UI.
- Commit messages: a short summary line in the imperative ("Add …", "Fix …"), then details if needed.

## Presets

Presets for other well-known key layouts are a great first contribution: a JSON file with queries and key
descriptions, format in [`app/presets/README.md`](app/presets/README.md). Do not include real data.

## AI-assisted contributions

AI tools are fine to use. You are responsible for what you submit: review and test it, make sure you have the
right to contribute it under the MIT license, and mention significant AI assistance in the pull request.

## License

Contributions are accepted under the [MIT License](LICENSE) of this project.
