|
| 1 | +# ToolHive developer guide <!-- omit in toc --> |
| 2 | + |
| 3 | +The ToolHive development documentation provides guidelines and resources for |
| 4 | +developers working on the ToolHive project. It includes information on setting |
| 5 | +up the development environment, contributing to the codebase, and understanding |
| 6 | +the architecture of the project. |
| 7 | + |
| 8 | +For user-facing documentation, please refer to the |
| 9 | +[ToolHive docs website](https://docs.stacklok.com/toolhive/). |
| 10 | + |
| 11 | +## Contents <!-- omit in toc --> |
| 12 | + |
| 13 | +- [Getting started](#getting-started) |
| 14 | + - [Prerequisites](#prerequisites) |
| 15 | + - [Building ToolHive](#building-toolhive) |
| 16 | + - [Running tests](#running-tests) |
| 17 | + - [Other development tasks](#other-development-tasks) |
| 18 | +- [Contributing](#contributing) |
| 19 | + |
| 20 | +Explore the contents of this directory to find more detailed information on |
| 21 | +specific topics related to ToolHive development including architectural details |
| 22 | +and [design proposals](./proposals). |
| 23 | + |
| 24 | +For information on the ToolHive Operator, see the |
| 25 | +[ToolHive Operator README](../cmd/thv-operator/README.md) and |
| 26 | +[DESIGN doc](../cmd/thv-operator/DESIGN.md). |
| 27 | + |
| 28 | +## Getting started |
| 29 | + |
| 30 | +ToolHive is developed in Go. To get started with development, you need to |
| 31 | +install Go and set up your development environment. |
| 32 | + |
| 33 | +### Prerequisites |
| 34 | + |
| 35 | +- **Go**: ToolHive requires Go 1.24. You can download and install Go from the |
| 36 | + [official Go website](https://go.dev/doc/install). |
| 37 | + |
| 38 | +- **Task** (Recommended): Install the [Task](https://taskfile.dev/) tool to run |
| 39 | + automated development tasks. You can install it using Homebrew on macOS: |
| 40 | + |
| 41 | + ```bash |
| 42 | + brew install go-task |
| 43 | + ``` |
| 44 | + |
| 45 | +### Building ToolHive |
| 46 | + |
| 47 | +To build the ToolHive CLI (`thv`), follow these steps: |
| 48 | + |
| 49 | +1. **Clone the repository**: Clone the ToolHive repository to your local machine |
| 50 | + using Git: |
| 51 | + |
| 52 | + ```bash |
| 53 | + git clone https://github.com/stacklok/toolhive.git |
| 54 | + cd toolhive |
| 55 | + ``` |
| 56 | + |
| 57 | +2. **Build the project**: Use the `task` command to build the binary: |
| 58 | + |
| 59 | + ```bash |
| 60 | + task build |
| 61 | + ``` |
| 62 | + |
| 63 | +3. **Run ToolHive**: The build task creates the `thv` binary in the `./bin/` |
| 64 | + directory. You can run it directly from there: |
| 65 | + |
| 66 | + ```bash |
| 67 | + ./bin/thv |
| 68 | + ``` |
| 69 | + |
| 70 | +4. Optionally, install the `thv` binary in your `GOPATH/bin` directory: |
| 71 | + |
| 72 | + ```bash |
| 73 | + task install |
| 74 | + ``` |
| 75 | + |
| 76 | +### Running tests |
| 77 | + |
| 78 | +To run the linting and unit tests for ToolHive, run: |
| 79 | + |
| 80 | +```bash |
| 81 | +task lint |
| 82 | +task test |
| 83 | +``` |
| 84 | + |
| 85 | +ToolHive also includes comprehensive end-to-end tests that can be run using: |
| 86 | + |
| 87 | +```bash |
| 88 | +task test-e2e |
| 89 | +``` |
| 90 | + |
| 91 | +### Other development tasks |
| 92 | + |
| 93 | +To see a list of all available development tasks, run: |
| 94 | + |
| 95 | +```bash |
| 96 | +task --list |
| 97 | +``` |
| 98 | + |
| 99 | +## Contributing |
| 100 | + |
| 101 | +We welcome contributions to ToolHive! If you want to contribute, please review |
| 102 | +the [contributing guide](./CONTRIBUTING.md). |
| 103 | + |
| 104 | +Contributions to the user-facing documentation are also welcome. If you have |
| 105 | +suggestions or improvements, please open an issue or submit a pull request in |
| 106 | +the [docs-website repository](https://github.com/stacklok/docs-website). |
0 commit comments