diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md new file mode 100644 index 000000000000..d873590d6cb0 --- /dev/null +++ b/.claude/CLAUDE.md @@ -0,0 +1,47 @@ +Rust +==== + +After changing Rust code (`*.rs`) first format the code using `cargo fmt`. + +Then check the code for linting errors using: + +``` +cargo clippy --all-features --workspace --all-targets -- \ + -D warnings \ + -D clippy::all \ + -D clippy::mem_forget \ + -C debug-assertions=off \ + -A clippy::uninlined_format_args +``` + +Fix any linting errors before continuing with building and testing. + + +Building +-------- + +Rust code is built using both `cargo build` and Bazel. + +After changing a package under `rs/$PACKAGE` run `bazel build //rs/$PACKAGE`. + + +Changing crate dependencies +--------------------------- + +If crate dependencies need to be changed or added: + +1. First modify the `Cargo.toml` local to the package. +2. If a crate is used by multiple packages add it to the workspace `Cargo.toml` in the root of the repo and reference it in the `Cargo.toml` local to the package using `{ workspace = true }`. +3. Add the crate to `bazel/rust.MODULE.bazel`. +4. Run a `cargo check` such that the `Cargo.lock` files get updated. +5. Run `bin/bazel-pin.sh --force` to sync `Cargo.lock` with `Cargo.Bazel.json.lock`. + + +Testing +======= + +After code can be built it needs to be tested. + +After changing a package under `rs/$PACKAGE` run `bazel test //rs/$PACKAGE`. + +Tests under `rs/tests` which are defined using the `system_test` bazel macro are end-to-end tests which are called system-tests. These tests are comprehensive but also slow and harder to debug. So run them last or wait for GitHub Actions to run them on your Pull Request. \ No newline at end of file diff --git a/.claude/README.md b/.claude/README.md new file mode 100644 index 000000000000..da7750f78bf0 --- /dev/null +++ b/.claude/README.md @@ -0,0 +1,23 @@ +Claude Code +=========== + +You can you use Claude Code either from the: + +* [Claude Code VS Code Extension](https://code.claude.com/docs/en/vs-code). + +* CLI using the [`claude`](https://code.claude.com/docs/en/cli-reference) command which will be installed in the dev container later. + +Login +----- + +Ask #help-it to generate an Anthropic API key for you. Then: + +* Select `2. Anthropic Console account ยท API usage billing`. + +* Open the OAuth link in your browser. + +* Choose the `DFINITY` organization. + +* Authorize Claude Code to connect to your Anthropic organization DFINITY + +* Press Enter to continue \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5b678b9d919e..0099c5197faf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -35,6 +35,8 @@ go.sum @dfinity/idx # [DevEnv] .vscode/ @dfinity/idx +.claude/ @dfinity/idx + # [Publishing-Artifacts] /publish/ @dfinity/idx diff --git a/.gitignore b/.gitignore index f26b7f335de8..b8cb3afd87d6 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,6 @@ test_tmpdir/** # Bare metal deployment secrets files zh2-dll01.csv + +# Claude Code settings +.claude/settings.local.json \ No newline at end of file