Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Pages

on:
push:
branches: [main]
paths:
- website/**
- docs/**
- AGENTS.md
- README.md
- Cargo.toml
- clippy.toml
- rustfmt.toml
- deny.toml
- rust-toolchain.toml
- .github/workflows/pages.yml
pull_request:
paths:
- website/**
- docs/**
- AGENTS.md
- README.md
- Cargo.toml
- clippy.toml
- rustfmt.toml
- deny.toml
- rust-toolchain.toml
- .github/workflows/pages.yml
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write
Comment thread
DaniAkash marked this conversation as resolved.
Resolved

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
name: Build website
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# Full history: page dates and sitemap <lastmod> come from git log.
fetch-depth: 0
- uses: withastro/action@v6
with:
path: website

deploy:
name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

Drop-in configuration that makes [Google's Rust style guide](https://google.github.io/styleguide/rustguide.html) enforceable: **rustfmt, clippy and cargo-deny** for the mechanical rules, **`AGENTS.md`** for coding agents, and a **human review guide** for everything that needs judgment.

**Website: <https://daniakash.github.io/Google-Rust-Style-Guide/>**, with a [five-minute quick start](https://daniakash.github.io/Google-Rust-Style-Guide/quick-start/), every doc, and [`llms.txt`](https://daniakash.github.io/Google-Rust-Style-Guide/llms.txt) for coding agents.

> This is an unofficial community project. It is not affiliated with, endorsed by, or maintained by Google. The style guide itself belongs to Google and is published under CC-BY 3.0; see [NOTICE](NOTICE).

## Why
Expand Down Expand Up @@ -43,7 +45,7 @@ cargo clippy --workspace --all-targets -- -D warnings
cargo deny check bans
```

Single crates, CI wiring, existing codebases and application crates are covered in [docs/adopting.md](docs/adopting.md).
Single crates, CI wiring, existing codebases and application crates are covered in [docs/adopting.md](docs/adopting.md). The [website quick start](https://daniakash.github.io/Google-Rust-Style-Guide/quick-start/) has copyable commands for each case and a one-prompt setup for coding agents.

## What's inside

Expand All @@ -58,6 +60,7 @@ Single crates, CI wiring, existing codebases and application crates are covered
| [`docs/`](docs/README.md) | How it works, coverage, why, why not, human review guide, adoption |
| [`example/`](example/src) | A small library that follows the guide and passes every lint, including recorded exceptions |
| [`fixtures/`](fixtures) + [`scripts/`](scripts) | Deliberate violations that CI uses to prove every lint still fires |
| [`website/`](website) | The Astro + Starlight site, built from the files above and deployed to GitHub Pages |

## Exceptions are written down, not hidden

Expand Down
5 changes: 5 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
.astro/
node_modules/
src/content/docs/repo/
public/files/
99 changes: 99 additions & 0 deletions website/astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import sitemap from '@astrojs/sitemap';
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';
import mermaid from 'astro-mermaid';
import starlightLinksValidator from 'starlight-links-validator';
import starlightLlmsTxt from 'starlight-llms-txt';
import starlightPageActions from 'starlight-page-actions';
import { lastModifiedBySlug, syncRepoContent } from './integrations/sync-repo-content';
import { BASE, FILES_URL, GUIDE_URL, REPO_URL, SITE } from './site.config';

export default defineConfig({
site: SITE,
base: BASE,
trailingSlash: 'always',
integrations: [
syncRepoContent(),
mermaid({ autoTheme: true }),
starlight({
title: 'Google Rust Style Guide Kit',
description:
"Unofficial kit that enforces Google's Rust style guide with rustfmt, clippy, cargo-deny, AGENTS.md for coding agents, and a human review guide. Adopt it in 5 minutes.",
logo: { src: './src/assets/logo.svg' },
social: [{ icon: 'github', label: 'GitHub', href: REPO_URL }],
lastUpdated: true,
components: { Footer: './src/components/Footer.astro' },
routeMiddleware: './src/route-middleware.ts',
customCss: ['./src/styles/theme.css'],
plugins: [
starlightLinksValidator({
exclude: [`${BASE}/files/**`, `${BASE}/og/**`, `${BASE}/**/*.md`, `${BASE}/llms*.txt`, `${BASE}/_llms-txt/**`],
}),
// No baseUrl: with it, this plugin writes its own llms.txt over starlight-llms-txt's.
starlightPageActions({
prompt: 'Read {url} and help me apply the Google Rust Style Guide kit to my Rust project.',
actions: { chatgpt: true, claude: true, perplexity: true, cursor: true, markdown: true },
}),
starlightLlmsTxt({
projectName: 'Google Rust Style Guide Kit (unofficial)',
description:
"Drop-in rustfmt, clippy and cargo-deny configuration plus AGENTS.md that enforces Google's Rust style guide. 32 of 62 in-scope rules are tool-enforced; the rest are covered by agent instructions and a human review guide.",
details: [
`Not affiliated with Google. The guide itself: ${GUIDE_URL}`,
`Adopt: download rustfmt.toml, clippy.toml, deny.toml, rust-toolchain.toml and AGENTS.md from ${FILES_URL}/, append ${FILES_URL}/crate-lints.toml (single crate) or ${FILES_URL}/workspace-lints.toml (workspace root, then \`[lints] workspace = true\` in each member) to Cargo.toml, then run \`cargo +nightly fmt\`, \`cargo clippy --workspace --all-targets -- -D warnings\` and \`cargo deny check bans\`. Never edit the lint configuration to silence a warning; fix the code or add \`#[expect(lint, reason = "...")]\` where the guide allows an exception.`,
].join('\n\n'),
promote: ['index*', 'quick-start', 'adopting', 'coverage', 'agents-md'],
demote: ['why-not', 'config/**'],
customSets: [
{
label: 'For coding agents',
paths: ['quick-start', 'agents-md', 'adopting', 'config/**'],
description: 'Everything a coding agent needs to apply the kit to a repository.',
},
{
label: 'For reviewers',
paths: ['human-review', 'coverage', 'why-not'],
description: 'What the tools enforce and what a human reviewer must judge.',
},
],
optionalLinks: [
{ label: 'Google Rust Style Guide (original)', url: GUIDE_URL },
{ label: 'Source repository', url: REPO_URL },
],
}),
],
sidebar: [
{
label: 'Start',
items: [{ slug: 'quick-start' }, { slug: 'adopting' }, { slug: 'faq' }],
},
{
label: 'Concepts',
items: [{ slug: 'how-it-works' }, { slug: 'why' }, { slug: 'why-not' }],
},
{
label: 'Reference',
items: [
{ slug: 'coverage' },
{ slug: 'agents-md' },
{ slug: 'config/cargo-lints' },
{ slug: 'config/clippy-toml' },
{ slug: 'config/rustfmt-toml' },
{ slug: 'config/deny-toml' },
],
},
{
label: 'Review',
items: [{ slug: 'human-review' }],
},
],
}),
// Replaces Starlight's built-in sitemap so <lastmod> can come from git.
sitemap({
serialize(item) {
const lastmod = lastModifiedBySlug(item.url);
return lastmod ? { ...item, lastmod } : item;
},
}),
],
});
Loading
Loading