Skip to content

Commit ad9440d

Browse files
mgeislergribozavr
andauthored
Add a GEMINI.md file with instructions for the CLI (#2895)
I’ve been playing with the `gemini` CLI tool recently (https://google-gemini.github.io/gemini-cli/) and learned that it will read instructions from it’s own kind of README. So I asked it to generate one and use it as a basis for this file. I took the liberty to expand the style guide a little at the same time to incorporate that instructions I gave Gemini while generating the [many language fixing PRs][1]. [1]: https://github.com/google/comprehensive-rust/pulls?q=author%3Amgeisler+%22improve+language%22 --------- Co-authored-by: Dmitri Gribenko <[email protected]>
1 parent 085b534 commit ad9440d

File tree

2 files changed

+106
-11
lines changed

2 files changed

+106
-11
lines changed

GEMINI.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Project Overview
2+
3+
This repository contains the source code for Comprehensive Rust, a family of
4+
courses on Rust developed by Google, starting with Rust foundations, and
5+
including deep dives into specialized topics like Android, Chromium, bare-metal
6+
development, and concurrency. The project is a Rust workspace that leverages
7+
`mdbook` to generate a course website.
8+
9+
## Key Technologies
10+
11+
- **Rust:** The primary programming language for the course subject, custom
12+
tools, and examples.
13+
- **mdbook:** A command-line tool to create books from Markdown files, used for
14+
generating the course website.
15+
- **Custom mdbook Preprocessors:** `mdbook-course` and `mdbook-exerciser` are
16+
Rust binaries that extend `mdbook`'s functionality, for example, to extract
17+
exercise starter code.
18+
- **`cargo xtask`:** A custom binary within the workspace used for project
19+
automation, simplifying common development tasks.
20+
21+
# Building and Running
22+
23+
The project uses `cargo xtask` for project-specific automation, like builds,
24+
tests, and managing translations.
25+
26+
## Setup
27+
28+
1. **Install Rust:** Follow the instructions on
29+
[https://rustup.rs/](https://rustup.rs/).
30+
2. **Clone Repository:**
31+
```bash
32+
git clone https://github.com/google/comprehensive-rust/
33+
cd comprehensive-rust
34+
```
35+
3. **Install Project Tools:**
36+
```bash
37+
cargo xtask install-tools
38+
```
39+
40+
## Commands
41+
42+
All commands are run using `cargo xtask`. Run `cargo xtask --help` for a full
43+
list of options.
44+
45+
- **Serve the Course Locally:** Starts a web server to view the course content.
46+
```bash
47+
cargo xtask serve [--language <ISO_639_language_code>] [--output <output_directory>]
48+
```
49+
(e.g., `cargo xtask serve -l da` for the Danish translation)
50+
51+
- **Build the Course:** Creates a static version of the course in the `book/`
52+
directory.
53+
```bash
54+
cargo xtask build [--language <ISO_639_language_code>] [--output <output_directory>]
55+
```
56+
57+
- **Run Rust Snippet Tests:** Tests all Rust code snippets included in the
58+
course material.
59+
```bash
60+
cargo xtask rust-tests
61+
```
62+
63+
- **Run Web Driver Tests:** Executes web driver tests located in the `tests/`
64+
directory.
65+
```bash
66+
cargo xtask web-tests [--dir <book_html_directory>]
67+
```
68+
69+
# Development Conventions
70+
71+
- **Project Automation:** `cargo xtask` is the primary interface for common
72+
development tasks.
73+
- **Course Content:** Markdown files in the `src/` directory, structured
74+
according to `src/SUMMARY.md`.
75+
- **Code Formatting:** `dprint fmt` is used to format all source files according
76+
to `rustfmt.toml` and `dprint.json`.
77+
- **Contributions:** Refer to `CONTRIBUTING.md` for guidelines on contributing
78+
to the project.
79+
- **Style:** Refer to `STYLE.md` for style guidelines.

STYLE.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ notes (see below).
2828

2929
### Rust Code
3030

31-
When showing Rust code, please use the same spacing as `rustfmt`: `3 * x`
31+
When showing Rust code inline, please use the same spacing as `rustfmt`: `3 * x`
3232
instead of `3*x`. However, feel free to remove newlines when it can make the
33-
code more compact and easier to understand, e.g., you can use
33+
code more compact and easier to understand, e.g., you can define a struct on one
34+
line if it is not the focus of your example:
3435

3536
<!-- dprint-ignore-start -->
3637

@@ -40,25 +41,40 @@ struct Person { name: String }
4041

4142
<!-- dprint-ignore-end -->
4243

43-
if the `Person` struct is not important for your example. Please use this
44-
sparingly: enclose the code block in `<!-- dprint-ignore-start -->` and
45-
`<!-- dprint-ignore-end -->` to suppress warnings about the formatting.
44+
Enclose the code block in `<!-- dprint-ignore-start -->` and
45+
`<!-- dprint-ignore-end -->` to suppress the automatic formatting. Please use
46+
this sparingly.
47+
48+
### Language and Tone
49+
50+
The courses are written in American English, so write "initialize", not
51+
"initialise".
52+
53+
Use an informal, friendly, and concise tone. Remember that the courses are meant
54+
to be taught by an experienced programmer to other experienced programmers. We
55+
expect familiarity with programming, typically in a statically typed language
56+
like Java or C++. We don't explain common concepts known from that family of
57+
languages, but we cannot assume familiarity with things like functional
58+
programming.
4659

4760
## Speaker Notes
4861

4962
We have extended `mdbook` with support for speaker notes: content added between
5063
`<details> ... </details>` tags is rendered in a special box that can be
5164
collapsed or removed entirely from the slide.
5265

66+
- Unlike the main content, the speaker notes don't have to fit on a single
67+
slide.
68+
5369
- The speaker notes should expand on the topic of the slide. Use them to provide
5470
interesting background information for both the instructor and for students
5571
who look at the material outside of a class. Remember that many more people
5672
will read the course by themselves, so make the notes complete and useful even
5773
when there is no Rust expert around.
5874

59-
- Avoid using speaker notes as a script for the instructor. When teaching the
60-
course, instructors will only have time to glance at the notes so it is not
61-
useful to include full paragraphs which the instructor should read out loud.
75+
- Speaker notes are not a script for the instructor. When teaching the course,
76+
instructors only have a short time to glance at the notes. Don't include full
77+
paragraphs for the instructor to read out loud.
6278

6379
### More to Explore
6480

@@ -100,6 +116,6 @@ When translating the course, please take the following into account:
100116
and `**strong emphasis**` like in the original.
101117

102118
- If you find mistakes or things that sound awkward in the original English
103-
text, please submit PRs to fix them! Fixing typos in the translation is great,
104-
but we want everybody to benefit from the fixes and that is why we need the
105-
fix to be made in the English text too.
119+
text, please submit PRs to fix them in the English text! Fixing typos in the
120+
translation is great, but we want everybody to benefit from the fixes and that
121+
is why we need the fix to be made in the English text too.

0 commit comments

Comments
 (0)