|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing to the Neo4j Aura CLI, [issues](https://github.com/neo4j/aura-cli/issues) and [pull requests](https://github.com/neo4j/aura-cli/pulls) are welcome. |
| 4 | + |
| 5 | +If you want to contribute code, make sure to [sign the CLA](https://neo4j.com/developer/contributing-code/#sign-cla). |
| 6 | + |
| 7 | +## Development |
| 8 | + |
| 9 | +### Testing |
| 10 | + |
| 11 | +The full suite of tests can be run using the following command: |
| 12 | + |
| 13 | +```bash |
| 14 | +go test ./... |
| 15 | +``` |
| 16 | + |
| 17 | +### Local running |
| 18 | + |
| 19 | +The CLI can be run locally without building by running the following command: |
| 20 | + |
| 21 | +```bash |
| 22 | +go run neo4j-cli/main.go aura-cli |
| 23 | +``` |
| 24 | + |
| 25 | +### Pull requests |
| 26 | + |
| 27 | +As well as your code changes, pull requests need a changelog entry. These are added using the tool [`changie`](https://changie.dev/). You will need to install this using the following command: |
| 28 | + |
| 29 | +```bash |
| 30 | +go install github.com/miniscruff/changie@latest |
| 31 | +``` |
| 32 | + |
| 33 | +With this installed, the following command will guide through the process of adding a changelog entry: |
| 34 | + |
| 35 | +```bash |
| 36 | +changie new |
| 37 | +``` |
| 38 | + |
| 39 | +Simply commit the file that this command produces and you're done! |
| 40 | + |
| 41 | +### Building |
| 42 | + |
| 43 | +Builds for releases are handled in GitHub Actions. If you want to create local builds, there are a couple of approaches. |
| 44 | + |
| 45 | +To create a simply binary using `go` directly, you can execute the following command: |
| 46 | + |
| 47 | +```bash |
| 48 | +go build -o bin/ ./... |
| 49 | +``` |
| 50 | + |
| 51 | +If you want to build binaries for all varieties of platforms, you can do so with the following command: |
| 52 | + |
| 53 | +```bash |
| 54 | +GORELEASER_CURRENT_TAG=dev goreleaser release --snapshot --clean |
| 55 | +``` |
| 56 | + |
| 57 | +In the above command, `GORELEASER_CURRENT_TAG` can be substituted for any version of your choosing. |
| 58 | + |
| 59 | +## CLI Guidelines |
| 60 | + |
| 61 | +The Aura CLI aims to provide a consistent and reliable experience to the end user. Any change made to the CLI must comform to the following guidelines: |
| 62 | + |
| 63 | +- All commandds must be singular |
| 64 | + - ✅ `aura-cli instance` |
| 65 | + - ❌ `aura-cli instances` |
| 66 | +- Output should support the following options: |
| 67 | + - `json`: Provides the raw JSON output of the API, formatted to be human-readable. |
| 68 | + - `table`: Provides a subset of the output, formatted to be human readable on a table. Try to keep the table output below 120 characters to avoid overflowing the screen. |
| 69 | +- Flags, if set, take precedence over global configuration or default values |
| 70 | + |
| 71 | +> These guidelines are based on https://clig.dev |
| 72 | +
|
| 73 | +### Structure |
| 74 | + |
| 75 | +Aura CLI is divided in top level commands, for example: |
| 76 | + |
| 77 | +- `instance` |
| 78 | +- `config` |
| 79 | + |
| 80 | +Each of these commands handle a certain resource of the API and have several subcommands for the actions, for example: |
| 81 | + |
| 82 | +- `instance list` |
| 83 | +- `instance get` |
| 84 | + |
| 85 | +Nested subcommands are also allowed, for example: |
| 86 | + |
| 87 | +- `instance snapshot list` |
| 88 | + |
| 89 | +### Common subcommands |
| 90 | + |
| 91 | +Most commands targetting API resources contain some of the following subcommands as actions: |
| 92 | + |
| 93 | +- `get` |
| 94 | +- `list` |
| 95 | +- `delete` |
| 96 | +- `create` |
| 97 | + |
| 98 | +Commands may also have some extra, specific commands, such as `instance pause`. |
| 99 | + |
| 100 | +For asynchronous operations (i.e. operations that trigger a job that won't be finished in the same request), the flag `--await` can be used to wait until the operation has been completed, generally polling for the status. If this flag is not set, all operations must finish when the request has been completed, even if a job is pending. |
| 101 | + |
| 102 | +## Resources |
| 103 | + |
| 104 | +- [CLI Usage Guide](./docs/usageGuide/A%20Guide%20To%20The%20New%20Aura%20CLI.md). |
| 105 | +- [Neo4j Aura API](https://neo4j.com/docs/aura/platform/api/specification/) |
| 106 | +- https://clig.dev |
0 commit comments