|
| 1 | +# Contributing To `diffnav` |
| 2 | + |
| 3 | +Thank you for investing your time in contributing to our project! |
| 4 | + |
| 5 | +In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR. |
| 6 | + |
| 7 | +## The Critical Rule |
| 8 | + |
| 9 | +- The most important rule: you must understand your code. If you can't explain what your changes do and how they interact with the greater system without the aid of AI tools, do not contribute to this project. |
| 10 | +- The second most important rule: when you submit a PR you must be willing to address comments and maintain this code. Dot not submit drive-by PRs that solve your own issue without the willingness to iterate on it. Keep these in your own fork. |
| 11 | +- Using AI to write code is fine. You can gain understanding by interrogating an agent with access to the codebase until you grasp all edge cases and effects of your changes. What's not fine is submitting agent-generated slop without that understanding. Be sure to read the [AI Usage Policy](AI_POLICY.md). |
| 12 | + |
| 13 | +## AI Usage |
| 14 | + |
| 15 | +The project has strict rules for AI usage. Please see the [AI Usage Policy](AI_POLICY.md). This is very important. |
| 16 | + |
| 17 | +## Quick Guide |
| 18 | + |
| 19 | +### I Have an Idea for a Feature |
| 20 | + |
| 21 | +Like bug reports, first search through both issues and discussions and try to find if your feature has already been requested. Otherwise, open a discussion in the ["Feature Requests, Ideas"](https://github.com/dlvhdr/diffnav/issues/new?template=feature_request.md) category. |
| 22 | + |
| 23 | +### I've Implemented a Feature |
| 24 | + |
| 25 | +- If there is an issue for the feature, open a pull request straight away. |
| 26 | +- If there is no issue, open a discussion and link to your branch. |
| 27 | +- If you want to live dangerously, open a pull request and hope for the best. |
| 28 | + |
| 29 | +### I Have a Question Which Is Neither a Bug Report nor a Feature Request |
| 30 | + |
| 31 | +Open a [Q&A discussion](https://github.com/dlvhdr/diffnav/discussions/categories/q-a), or join our [Discord Server](https://discord.gg/SXNXp9NctV) and ask away in the #help forum channel. |
| 32 | + |
| 33 | +## Working on the Code |
| 34 | + |
| 35 | +### Installing Required Tooling |
| 36 | + |
| 37 | +Our project uses [Devbox](https://github.com/jetpack-io/devbox) to manage its development environment. |
| 38 | + |
| 39 | +Using Devbox will get your dev environment up and running easily and make sure we're all using the same tools with the same versions. |
| 40 | + |
| 41 | +- Clone this repo |
| 42 | + |
| 43 | +```sh |
| 44 | +git clone git@github.com:dlvhdr/diffnav.git && cd diffnav |
| 45 | +``` |
| 46 | + |
| 47 | +- Install `devbox` |
| 48 | + |
| 49 | +```sh |
| 50 | +curl -fsSL https://get.jetpack.io/devbox | bash |
| 51 | +``` |
| 52 | + |
| 53 | +- Start the `devbox` shell and run the setup (will take awhile on first time) |
| 54 | + |
| 55 | +```sh |
| 56 | +devbox shell |
| 57 | +``` |
| 58 | + |
| 59 | +_This will create a shell where all required tools are installed._ |
| 60 | + |
| 61 | +- _(Optional)_ Set up `direnv` so `devbox shell` runs automatically |
| 62 | + - [direnv](https://www.jetify.com/devbox/docs/ide_configuration/direnv/) is a tool that allows setting unique environment variables per directory in your filesystem. |
| 63 | + - Install `direnv` with: `brew install direnv` |
| 64 | + - Add the following line at the end of the `~/.bashrc` file: `eval "$(direnv hook bash)"` |
| 65 | + - See [direnv's installation instructions](https://direnv.net/docs/hook.html) for other shells. |
| 66 | + - Enable `direnv` by running `direnv allow` |
| 67 | +- _(Optional)_ Install the VSCode Extension |
| 68 | + - Follow [this guide](https://www.jetify.com/devbox/docs/ide_configuration/vscode/) to set up VSCode to automatically run `devbox shell`. |
| 69 | + |
| 70 | +#### Troubleshooting |
| 71 | + |
| 72 | +- delete the `.devbox` directory at the project's root |
| 73 | + |
| 74 | +### Navigating the Codebase |
| 75 | + |
| 76 | +To navigate our codebase with confidence, familiarize yourself with: |
| 77 | + |
| 78 | +- [Bubbletea](https://github.com/charmbracelet/bubbletea) - the TUI framework we're using |
| 79 | +- [The Elm architecture](https://guide.elm-lang.org/architecture/) |
| 80 | +- [charmbracelet/glow](https://github.com/charmbracelet/glow) - for parsing and presenting Markdown |
| 81 | + |
| 82 | +### Debugging |
| 83 | + |
| 84 | +- Write to the log by using Charm's `log` package |
| 85 | +- Tail the log by running `task logs` |
| 86 | +- Run `diffnav` in debug mode with `task debug` in another terminal window / pane |
| 87 | + |
| 88 | +```go |
| 89 | +import "charm.land/log/v2" |
| 90 | + |
| 91 | +// more code... |
| 92 | + |
| 93 | +log.Debug("some message", "someVariable", someVariable) |
| 94 | +``` |
0 commit comments