Skip to content

Commit 96fbe8a

Browse files
copyleftdevclaude
andauthored
docs: add comprehensive onboarding documentation (#71)
- Rewrite README with quick start, CLI reference, deployment guides - Add CONTRIBUTING.md with code standards and workflow - Add Dockerfile for containerized deployment - Add docker-compose.yml for local development Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8f3c1d4 commit 96fbe8a

4 files changed

Lines changed: 406 additions & 42 deletions

File tree

CONTRIBUTING.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributing to zgrok
2+
3+
## Development Setup
4+
5+
```bash
6+
git clone https://github.com/copyleftdev/zgrok.git
7+
cd zgrok
8+
cargo build
9+
cargo test
10+
```
11+
12+
## Code Standards
13+
14+
### No Tutorial Comments
15+
16+
Comments explaining what code does are prohibited. Code must be self-documenting.
17+
18+
```rust
19+
// BAD
20+
let count = 0; // Initialize counter to zero
21+
22+
// BAD
23+
// Loop through items and process each one
24+
for item in items { process(item); }
25+
26+
// GOOD - no comment needed
27+
let active_connections = 0;
28+
for connection in connections { connection.process(); }
29+
30+
// GOOD - explains why, not what
31+
// Subtract 1 because stream IDs are 1-indexed in the protocol
32+
let index = stream_id - 1;
33+
```
34+
35+
**Allowed comments:**
36+
- `TODO`, `FIXME`
37+
- `SAFETY:` for unsafe blocks
38+
- Doc comments (`///`) for public APIs
39+
- Non-obvious "why" explanations
40+
41+
### Error Handling
42+
43+
- Use `thiserror` for library errors
44+
- Use `anyhow` for binary errors
45+
- No `.unwrap()` in library code
46+
- Propagate errors with `?`
47+
48+
### Async
49+
50+
- Tokio runtime
51+
- Prefer `async fn` over manual `Future` implementations
52+
- Use `tokio::select!` for concurrent operations
53+
54+
### Imports
55+
56+
Group in order:
57+
1. `std`
58+
2. External crates
59+
3. Workspace crates
60+
4. `crate::`
61+
5. `super::`, `self::`
62+
63+
## Branch Workflow
64+
65+
```bash
66+
# 1. Start from main
67+
git checkout main && git pull
68+
69+
# 2. Create feature branch
70+
git checkout -b feat/short-description
71+
72+
# 3. Make changes, then verify
73+
cargo test && cargo clippy -- -D warnings && cargo fmt --check
74+
75+
# 4. Commit
76+
git add -A && git commit -m "feat(component): description"
77+
78+
# 5. Push and create PR
79+
git push -u origin feat/short-description
80+
gh pr create --fill
81+
82+
# 6. Merge after review
83+
gh pr merge --squash --delete-branch
84+
85+
# 7. Return to main
86+
git checkout main && git pull
87+
```
88+
89+
## Commit Messages
90+
91+
Format: `type(scope): description`
92+
93+
Types:
94+
- `feat` - New feature
95+
- `fix` - Bug fix
96+
- `refactor` - Code change that neither fixes a bug nor adds a feature
97+
- `docs` - Documentation only
98+
- `test` - Adding or fixing tests
99+
- `chore` - Maintenance tasks
100+
101+
Examples:
102+
```
103+
feat(agent): add TCP tunnel support
104+
fix(edge): handle connection timeout gracefully
105+
refactor(protocol): simplify frame encoding
106+
```
107+
108+
## Testing
109+
110+
```bash
111+
# All tests
112+
cargo test
113+
114+
# Single crate
115+
cargo test -p zgrok-protocol
116+
117+
# Single test
118+
cargo test test_name
119+
120+
# With output
121+
cargo test -- --nocapture
122+
```
123+
124+
Write tests alongside code in `#[cfg(test)]` modules.
125+
126+
## Pull Request Checklist
127+
128+
- [ ] Tests pass: `cargo test`
129+
- [ ] No warnings: `cargo clippy -- -D warnings`
130+
- [ ] Formatted: `cargo fmt --check`
131+
- [ ] No tutorial comments
132+
- [ ] Commit message follows convention

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM rust:1.75-bookworm as builder
2+
3+
WORKDIR /app
4+
COPY Cargo.toml Cargo.lock ./
5+
COPY crates ./crates
6+
7+
RUN cargo build --release
8+
9+
FROM debian:bookworm-slim
10+
11+
RUN apt-get update && \
12+
apt-get install -y --no-install-recommends ca-certificates && \
13+
rm -rf /var/lib/apt/lists/*
14+
15+
COPY --from=builder /app/target/release/zgrok /usr/local/bin/
16+
COPY --from=builder /app/target/release/zgrok-edge /usr/local/bin/
17+
18+
EXPOSE 443 80
19+
20+
ENTRYPOINT ["zgrok-edge"]

0 commit comments

Comments
 (0)