Skip to content

Commit 8d33538

Browse files
authored
Merge pull request #147 from stephenleo/docs/contribution-guide
docs: add contribution guide and BMAD workflow
2 parents 1e5940e + 22164e8 commit 8d33538

6 files changed

Lines changed: 139 additions & 17 deletions

File tree

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
name: Claude Code Review
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, ready_for_review, reopened]
6-
# Optional: Only run on specific file changes
7-
# paths:
8-
# - "src/**/*.ts"
9-
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
4+
workflow_dispatch:
5+
inputs:
6+
pr_number:
7+
description: 'Pull request number to review'
8+
required: true
9+
type: number
1210

1311
jobs:
1412
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
2113
runs-on: ubuntu-latest
2214
permissions:
2315
contents: read
@@ -38,7 +30,6 @@ jobs:
3830
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3931
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
4032
plugins: 'code-review@claude-code-plugins'
41-
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }} --comment'
33+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ inputs.pr_number }} --comment'
4234
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4335
# or https://code.claude.com/docs/en/cli-reference for available options
44-

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- stdout owned by `main.rs` only; all module diagnostics via `tracing::*` macros; no `eprintln!` anywhere
1313
- Exception: CLI-action subcommands (e.g. `uninstall`, `explain`) may use `println!` directly — the stdout rule applies to the rendering pipeline only
1414
- All config structs: `#[derive(Debug, Deserialize, Default)]`, all fields `pub Option<T>`
15+
- Never add `deny_unknown_fields` to any struct — omitted intentionally on both `Context` and config structs so future Claude Code versions can add fields without breaking deserialization
1516

1617
## Project Structure
1718
- Adding a native module: create `src/modules/{name}.rs` + update `src/modules/mod.rs` only (2 files max)

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributing to CShip
2+
3+
Thank you for contributing! This guide explains how to get your changes ready to pass CI.
4+
5+
## Prerequisites
6+
7+
- [Rust toolchain](https://rustup.rs) (stable)
8+
9+
## Running checks before submitting a PR
10+
11+
CI enforces four checks. Run them locally before pushing:
12+
13+
```sh
14+
# 1. Format — CI runs `cargo fmt --check`; fix formatting first
15+
cargo fmt
16+
17+
# 2. Lint — all Clippy warnings are treated as errors
18+
cargo clippy -- -D warnings
19+
20+
# 3. Tests
21+
cargo test
22+
23+
# 4. Release build
24+
cargo build --release
25+
```
26+
27+
If any of these fail locally, they will fail in CI. Fix them before opening a PR.
28+
29+
## Adding a new module
30+
31+
### BMAD (Recommended)
32+
33+
This project is built with [BMAD](https://github.com/bmad-code-org/BMAD-METHOD).
34+
35+
1. Install BMAD in this repo. `npx bmad-method install`
36+
2. Run `/bmad-quick-dev` with a GitHub issue URL or a description of your change — it guides you from intent through spec, implementation, and review.
37+
38+
### Manual (Not recommended)
39+
40+
See the non-negotiable code patterns in `CLAUDE.md`.
41+
42+
- Create `src/modules/{name}.rs` and update `src/modules/mod.rs`. If the module needs config fields, also add a struct to `src/config.rs`.
43+
- Module signature: `pub fn render(ctx: &Context, cfg: &CshipConfig) -> Option<String>`
44+
- All config structs go in `src/config.rs` with `#[derive(Debug, Deserialize, Default)]` and `pub Option<T>` fields.
45+
- Absent data → explicit `match` + `tracing::warn!` + `None`. Disabled flag → silent `None`. (Exception: `context_bar` renders an empty bar with `tracing::debug!` when context data is absent — this is intentional UX.)
46+
47+
## Updating documentation
48+
49+
Most documentation lives in `docs/`; `CONTRIBUTING.md` at the repo root mirrors `docs/contributing.md` (see the last bullet). Update the relevant files alongside your code change:
50+
51+
- **New module or config field** — add the config option to `docs/configuration.md`. If the module has non-obvious UX, add a `docs/faq.md` entry too.
52+
- **Removed module or config field** — delete or mark deprecated the corresponding entry in `docs/configuration.md`.
53+
- **Behaviour change** — update any affected section in `docs/configuration.md` or `docs/faq.md`.
54+
- **New showcase or example** — add the `cship.toml` config block to `docs/showcase.md` and place any screenshot or GIF in `docs/examples/`.
55+
- **This guide**`CONTRIBUTING.md` (repo root) and `docs/contributing.md` are kept in sync manually; if you edit either for any reason, update the other to match.
56+
57+
## Opening a PR
58+
59+
1. Make sure all four checks above pass.
60+
2. Describe what your change does and why in the PR description.
61+
3. Reference any related issues with `Closes #<issue-number>`.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ critical_style = "bold red"
248248

249249
Every style value is a `fg:#rrggbb` hex colour — no named colours anywhere. Amber warns, coral criticals.
250250

251-
`<img src="./docs/examples/06.png" alt="Material Hex cship statusline example" width="600">
251+
<img src="./docs/examples/06.png" alt="Material Hex cship statusline example" width="600">
252252

253253
<details>
254254
<summary>View config</summary>
@@ -477,6 +477,14 @@ If you found this project useful, please give us a star ⭐ on [GitHub](https://
477477

478478
If you find bugs or have suggestions, open an issue or submit a pull request. Contributions are very welcome!
479479

480+
Before submitting a PR, run the following to match what CI checks:
481+
482+
```sh
483+
cargo fmt && cargo clippy -- -D warnings && cargo test && cargo build --release
484+
```
485+
486+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
487+
480488
## 💡 Inspiration
481489
- Inspired by [starship](https://starship.rs), built with Rust and the [Claude Code status line API](https://code.claude.com/docs/en/statusline).
482490

docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default defineConfig({
2121
{ text: 'Passthrough', link: '/passthrough' },
2222
{ text: 'Showcase', link: '/showcase' },
2323
{ text: 'FAQ', link: '/faq' },
24+
{ text: 'Contributing', link: '/contributing' },
2425
{
2526
text: 'GitHub',
2627
link: 'https://github.com/stephenleo/cship',
@@ -46,6 +47,7 @@ export default defineConfig({
4647
items: [
4748
{ text: 'Showcase', link: '/showcase' },
4849
{ text: 'FAQ', link: '/faq' },
50+
{ text: 'Contributing', link: '/contributing' },
4951
],
5052
},
5153
],

docs/contributing.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing
2+
3+
Thank you for contributing to CShip!
4+
5+
## Prerequisites
6+
7+
- [Rust toolchain](https://rustup.rs) (stable)
8+
9+
## Checks to run before submitting a PR
10+
11+
CI enforces four checks on every pull request. Run them locally before pushing to avoid failing builds:
12+
13+
```sh
14+
# 1. Format — CI runs `cargo fmt --check`; fix formatting first
15+
cargo fmt
16+
17+
# 2. Lint — all Clippy warnings are treated as errors
18+
cargo clippy -- -D warnings
19+
20+
# 3. Tests
21+
cargo test
22+
23+
# 4. Release build
24+
cargo build --release
25+
```
26+
27+
If any of these fail locally, they will fail in CI. Fix them before opening a PR.
28+
29+
## Adding a new module
30+
31+
### BMAD (Recommended)
32+
33+
This project is built with [BMAD](https://github.com/bmad-code-org/BMAD-METHOD).
34+
35+
1. Install BMAD in this repo. `npx bmad-method install`
36+
2. Run `/bmad-quick-dev` with a GitHub issue URL or a description of your change — it guides you from intent through spec, implementation, and review.
37+
38+
### Manual (Not recommended)
39+
40+
- Create `src/modules/{name}.rs` and update `src/modules/mod.rs`. If the module needs config fields, also add a struct to `src/config.rs`.
41+
- Module signature must be exactly: `pub fn render(ctx: &Context, cfg: &CshipConfig) -> Option<String>`
42+
- All config structs go in `src/config.rs` with `#[derive(Debug, Deserialize, Default)]` and `pub Option<T>` fields.
43+
- Absent data → explicit `match` + `tracing::warn!` + `None`. Disabled flag → silent `None`. (Exception: `context_bar` renders an empty bar with `tracing::debug!` when context data is absent — this is intentional UX.)
44+
45+
## Updating documentation
46+
47+
Most documentation lives in `docs/`; `CONTRIBUTING.md` at the repo root mirrors `docs/contributing.md` (see the last bullet). Update the relevant files alongside your code change:
48+
49+
- **New module or config field** — add the config option to `docs/configuration.md`. If the module has non-obvious UX, add a `docs/faq.md` entry too.
50+
- **Removed module or config field** — delete or mark deprecated the corresponding entry in `docs/configuration.md`.
51+
- **Behaviour change** — update any affected section in `docs/configuration.md` or `docs/faq.md`.
52+
- **New showcase or example** — add the `cship.toml` config block to `docs/showcase.md` and place any screenshot or GIF in `docs/examples/`.
53+
- **This guide**`CONTRIBUTING.md` (repo root) and `docs/contributing.md` are kept in sync manually; if you edit either for any reason, update the other to match.
54+
55+
## Opening a PR
56+
57+
1. Make sure all four checks above pass.
58+
2. Describe what your change does and why in the PR description.
59+
3. Reference any related issues with `Closes #<issue-number>`.

0 commit comments

Comments
 (0)