Forráskód Böngészése

Add jj and AI notes to contribution tools (#6841)

Giving both of these their own sections under optional tools because I'm
mainly doing this to share example configs.

Assisted-by: Google Antigravity with Gemini

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Jon Ross-Perkins 1 hónapja
szülő
commit
2327b62b5f
1 módosított fájl, 68 hozzáadás és 0 törlés
  1. 68 0
      docs/project/contribution_tools.md

+ 68 - 0
docs/project/contribution_tools.md

@@ -22,6 +22,8 @@ contributions.
     -   [Main tools](#main-tools)
         -   [Running pre-commit](#running-pre-commit)
     -   [Optional tools](#optional-tools)
+        -   [Jujutsu (`jj`)](#jujutsu-jj)
+        -   [AI assistants](#ai-assistants)
     -   [Manually building Clang and LLVM (not recommended)](#manually-building-clang-and-llvm-not-recommended)
 -   [Troubleshooting build issues](#troubleshooting-build-issues)
     -   [`bazel clean`](#bazel-clean)
@@ -230,18 +232,84 @@ considering if they fit your workflow.
         [GDB]((/toolchain/docs/debugging.md#debugging-with-gdb)
 -   [clangd](https://clangd.llvm.org/installation): An LSP server implementation
     for C/C++.
+
     -   To ensure that `clangd` reports accurate diagnostics. It needs a
         generated file called `compile_commands.json`. This can be generated by
         invoking the command below:
+
         ```
         ./scripts/create_compdb.py
         ```
+
         -   **NOTE**: This assumes you have `python` 3 installed on your system.
+
 -   [`uv`](https://docs.astral.sh/uv/): A fast Python package manager.
     -   Notably, `uv` supports automatic management of even complex Python
         dependencies for scripts: https://docs.astral.sh/uv/guides/scripts/
     -   Installation: https://docs.astral.sh/uv/getting-started/installation/
 
+#### Jujutsu (`jj`)
+
+[Jujutsu](https://github.com/jj-vcs/jj) is a Git-compatible version control
+system that can be used instead of or alongside Git. See the
+[documentation for using Jujutsu with GitHub](https://jj-vcs.github.io/jj/latest/github/)
+for more information.
+
+If you use `jj`, you may find the following configuration snippets (added to
+`~/.config/jj/config.toml`) helpful for your workflow:
+
+```toml
+[aliases]
+# Clean up untracked or abandoned commits.
+abandon-untagged = ["abandon", "all() & ~ancestors(@ | bookmarks() | remote_bookmarks())"]
+
+[ui]
+# Use Git-style conflict markers, which VS Code can provide merge support for.
+conflict-marker-style = "git"
+
+[ui.diff]
+# Produce Git-compatible diff format.
+format = "git"
+
+[remotes.origin]
+# Automatically track all remote bookmarks.
+auto-track-bookmarks = "*"
+
+[templates]
+# Automatically add a trailer to commits to indicate that they were AI-assisted.
+commit_trailers = '''
+"Assisted-by: My AI Tool"'''
+```
+
+#### AI assistants
+
+When using AI assistants and reviewing terminal commands, some commands which
+may be helpful and reasonably safe to allowlist (assuming prefix-based
+allowlisting) are:
+
+```
+# Carbon development commands.
+bazelisk build
+bazelisk test
+bazelisk run //toolchain/testing:file_test --
+clang-format
+pre-commit run
+./toolchain/autoupdate_testdata.py
+
+# Shell commands. Note that these allow reading arbitrary files on your local
+# file system.
+cat
+grep
+head
+ls
+
+# VCS commands.
+git diff
+git log
+git show
+git status
+```
+
 ### Manually building Clang and LLVM (not recommended)
 
 We primarily test against [apt.llvm.org](https://apt.llvm.org) and Homebrew