Skip to content

Commit 63a02b3

Browse files
crrowclaude
andcommitted
feat(web): add mdbook docs with rara theme
- Add 7 user-facing documentation sections - Create custom mdbook theme matching landing page - Style code blocks as terminal windows with dot bar - Apply rara palette to mdbook light theme variables - Add "get started" CTA linking to docs - Add outline button style for github link - Configure vite dev middleware for mdbook output Users clicking "Get Started" on the landing page now reach branded documentation that visually matches the site. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f1042e6 commit 63a02b3

39 files changed

+4250
-0
lines changed

web/docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

web/docs/book.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[book]
2+
title = "cli-template"
3+
authors = ["rararulab"]
4+
language = "en"
5+
src = "src"
6+
7+
[output.html]
8+
additional-css = ["theme/rara.css"]
9+
default-theme = "light"
10+
preferred-dark-theme = "light"
11+
git-repository-url = "https://github.com/rararulab/cli-template"

web/docs/src/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# cli-template
2+
3+
A batteries-included Rust CLI template with structured errors, config management, CI/CD pipelines, and automated releases.
4+
5+
## What You Get
6+
7+
- **Clap** argument parsing with derive macros
8+
- **snafu** structured error handling
9+
- **tokio** async runtime
10+
- **tracing** observability
11+
- **TOML** config system with CLI get/set commands
12+
- **reqwest** HTTP client singletons
13+
- **GitHub Actions** CI/CD (lint, test, release)
14+
- **cargo-dist** cross-platform binary builds
15+
- **npx** distribution — users run your CLI without Rust installed
16+
- **Agent-friendly** output: JSON stdout, logs stderr
17+
18+
## Quick Start
19+
20+
```bash
21+
cargo generate rararulab/cli-template
22+
cd my-awesome-cli
23+
cargo run -- --help
24+
```
25+
26+
See [Getting Started](getting-started.md) for the full walkthrough.

web/docs/src/SUMMARY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Summary
2+
3+
[Introduction](README.md)
4+
5+
---
6+
7+
- [Getting Started](getting-started.md)
8+
- [Project Structure](guide/project-structure.md)
9+
- [Adding Commands](guide/adding-commands.md)
10+
- [Error Handling](guide/error-handling.md)
11+
- [Configuration](guide/configuration.md)
12+
- [CI/CD & Release](cicd-release.md)
13+
- [npx Distribution](npx-distribution.md)

web/docs/src/cicd-release.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# CI/CD & Release
2+
3+
## Included Workflows
4+
5+
| Workflow | File | Trigger | Purpose |
6+
|---|---|---|---|
7+
| CI | `ci.yml` | PRs | cargo check, test, clippy |
8+
| Lint | `lint.yml` | PRs | cargo fmt check |
9+
| Build | `build-binaries.yml` | Release | Cross-platform binary builds via cargo-dist |
10+
| npm Publish | `publish-npm.yml` | Release | Publish platform packages to npm |
11+
| Pages | `pages.yml` | Push to main | Deploy `web/` to GitHub Pages |
12+
13+
## Conventional Commits
14+
15+
All commits should follow the format:
16+
17+
```
18+
type(scope): description (#N)
19+
```
20+
21+
Accepted types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `ci`, `perf`.
22+
23+
Examples:
24+
25+
```
26+
feat(download): add retry logic (#42)
27+
fix(config): handle missing file gracefully (#51)
28+
chore(deps): bump serde to 1.0.200
29+
```
30+
31+
## Release Flow
32+
33+
1. Merge your PR into `main`.
34+
2. **release-plz** automatically opens a release PR that bumps the version and updates the changelog.
35+
3. Merge the release PR.
36+
4. **cargo-dist** builds binaries for all platforms and creates a GitHub release.
37+
5. **publish-npm.yml** publishes the npm wrapper packages.
38+
39+
No manual version bumping or tagging required.
40+
41+
## justfile
42+
43+
Run the full pre-commit suite locally:
44+
45+
```bash
46+
just pre-commit
47+
```
48+
49+
This runs, in order: `fmt --check`, `clippy`, `doc`, and `test`.

web/docs/src/getting-started.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Getting Started
2+
3+
## Prerequisites
4+
5+
Install the Rust toolchain and `cargo-generate`:
6+
7+
```bash
8+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
9+
cargo install cargo-generate
10+
```
11+
12+
## Create a Project
13+
14+
```bash
15+
cargo generate rararulab/cli-template
16+
```
17+
18+
You'll be prompted for three values:
19+
20+
| Placeholder | Format | Example | Used For |
21+
|------------------|------------|------------------|-----------------------------------|
22+
| `project-name` | kebab-case | `my-awesome-cli` | Binary name, directory, npm pkg |
23+
| `crate_name` | snake_case | *(auto-derived)* | Rust module name |
24+
| `github-org` || `myorg` | Repo URLs, CI badges |
25+
26+
> `crate_name` is derived automatically from `project-name` — you rarely need to change it.
27+
28+
## First Run
29+
30+
```bash
31+
cd my-awesome-cli
32+
cargo check
33+
cargo test
34+
cargo run -- --help
35+
cargo run -- hello world
36+
```
37+
38+
The `hello` command is a working example wired end-to-end. Use it as a reference when adding your own commands.
39+
40+
## What to Customize
41+
42+
Once you've verified the template builds, update these files:
43+
44+
- **`CLAUDE.md`** — add a description of your project for AI-assisted development
45+
- **`Cargo.toml`** — set `description`, `repository`, and `homepage`
46+
- **`src/cli/mod.rs`** — replace the example `Hello` command with your own
47+
- **`src/app_config.rs`** — replace `ExampleConfig` with your app's config fields
48+
- **`README.md`** — rewrite for your project
49+
50+
## Clean Up Example Code
51+
52+
Once your first real command is in place, remove the scaffolding:
53+
54+
1. Delete the `Hello` variant from the `Command` enum in `src/cli/mod.rs`
55+
2. Delete its match arm in `main.rs`
56+
3. Replace `ExampleConfig` in `src/app_config.rs` with your own config struct
57+
58+
> Don't delete the example code until you have a real command working. It serves as a reference for the patterns used throughout the template.
59+
60+
## Verify
61+
62+
```bash
63+
cargo check && cargo test && cargo clippy
64+
```
65+
66+
All three should pass cleanly before your first commit.
67+
68+
## Next Steps
69+
70+
- [Project Structure](guide/project-structure.md) — understand the module layout and conventions

0 commit comments

Comments
 (0)