Skip to content

Commit 2f841ae

Browse files
docs: update README and CONTRIBUTING to reflect hk and mise workflow
- Add mise as recommended task runner and tool manager - Document hk git hooks for automated code quality checks - Update development setup instructions to use mise install - Add comprehensive tool workflow documentation - Update testing instructions to use mise/hk commands - Modernize pre-submission checklist to reflect automated hooks - Add quick reference for available mise tasks and hk hooks - Maintain backward compatibility with manual setup instructions
1 parent 0c0f6bb commit 2f841ae

File tree

2 files changed

+230
-45
lines changed

2 files changed

+230
-45
lines changed

CONTRIBUTING.md

Lines changed: 123 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,39 +62,127 @@ cd submod
6262
git remote add upstream https://github.com/originaluser/submod.git
6363
```
6464

65-
### 2. Install Dependencies
65+
### 2. Install Mise and Dependencies
6666

6767
```bash
68-
# Using Mise (recommended for consistent environment)
68+
# Install mise (if you haven't already)
69+
curl https://mise.run | sh
70+
71+
# Install all development tools and dependencies
6972
mise install
7073

71-
# Or install Rust manually
72-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
74+
# This automatically installs:
75+
# - Rust 1.87+
76+
# - hk (git hooks)
77+
# - cargo tools (nextest, audit, deny, watch)
78+
# - prettier, typos, and other linters
7379
```
7480

7581
### 3. Verify Setup
7682

7783
```bash
7884
# Build the project
79-
cargo build
85+
mise run build
8086

8187
# Run tests to ensure everything works
82-
cargo test
88+
mise run test
8389

84-
# Run the comprehensive test suite
85-
./scripts/run-tests.sh
90+
# Run the full CI suite
91+
mise run ci
92+
93+
# Verify git hooks are installed
94+
hk --version
95+
```
96+
97+
### 4. Development Workflow
98+
99+
With mise and hk installed, you have access to streamlined development commands:
100+
101+
```bash
102+
# Development tasks
103+
mise run build # Build the project
104+
mise run test # Run tests
105+
mise run lint # Run clippy
106+
mise run ci # Full CI pipeline
107+
108+
# Git hooks (run automatically on commit)
109+
hk pre-commit # Run pre-commit checks manually
110+
hk fix # Auto-fix issues where possible
111+
hk check # Run all linters
86112
```
87113

88-
### 4. Install Development Tools
114+
### 5. Manual Setup (Alternative)
115+
116+
If you prefer not to use mise:
89117

90118
```bash
91-
# Install useful development tools
119+
# Install Rust manually
120+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
121+
122+
# Install development tools manually
92123
cargo install cargo-watch # Watch for changes
93124
cargo install cargo-audit # Security auditing
94125
cargo install cargo-deny # Dependency checking
95126
cargo install cargo-nextest # Better test runner
127+
128+
# Build and test
129+
cargo build
130+
cargo test
131+
./scripts/run-tests.sh
132+
```
133+
134+
## 🔧 Development Tools Overview
135+
136+
This project uses modern development tools to streamline the contribution process:
137+
138+
### Mise - Task Runner & Tool Manager
139+
140+
[Mise](https://mise.jdx.dev/) manages our development environment and provides consistent task execution:
141+
142+
```bash
143+
# Available tasks
144+
mise run build # Build the project (alias: mise run b)
145+
mise run test # Run the test suite
146+
mise run lint # Run clippy linting
147+
mise run ci # Full CI pipeline (build + lint + test)
148+
mise run clean # Clean build artifacts
149+
mise run release # Cut a new release (maintainers only)
150+
```
151+
152+
### hk - Git Hooks Manager
153+
154+
[hk](https://github.com/jdx/hk) provides automated git hooks for code quality:
155+
156+
```bash
157+
# Hook commands
158+
hk pre-commit # Run pre-commit checks
159+
hk pre-push # Run pre-push checks
160+
hk check # Run all linters
161+
hk fix # Auto-fix issues where possible
162+
hk test # Run tests only
163+
hk ci # Run CI checks
96164
```
97165

166+
### Automated Quality Checks
167+
168+
The pre-commit hooks automatically run these tools on every commit:
169+
170+
- **cargo fmt** - Formats Rust code
171+
- **cargo clippy** - Lints Rust code for common issues
172+
- **cargo test** - Runs the test suite (with nextest for parallel execution)
173+
- **typos** - Checks for spelling errors in code and documentation
174+
- **prettier** - Formats TOML, YAML, and other configuration files
175+
- **cargo deny** - Audits dependencies for security vulnerabilities and license compliance
176+
- **pkl** - Validates pkl configuration files
177+
178+
### Tool Integration
179+
180+
Both tools work together seamlessly:
181+
- **mise** handles tool installation and version management
182+
- **hk** uses the tools installed by mise for git hooks
183+
- Both can run the same underlying commands (e.g., `mise run test` and `hk test`)
184+
- CI uses the same tools for consistency between local and remote environments
185+
98186
## 🔄 Making Changes
99187

100188
### 1. Create a Branch
@@ -168,17 +256,22 @@ My philosophy on testing is to "test what matters." Tests focus on integration a
168256
### Running All Tests
169257

170258
```bash
171-
# Quick test run
172-
cargo test
173-
174-
# Comprehensive test suite with reporting
175-
./scripts/run-tests.sh --verbose
176-
177-
# Include performance tests
178-
./scripts/run-tests.sh --performance
179-
180-
# Filter specific tests
181-
./scripts/run-tests.sh --filter sparse_checkout
259+
# Using mise (recommended)
260+
mise run test # Quick test run
261+
mise run ci # Full CI suite (build + lint + test)
262+
263+
# Using hk
264+
hk test # Run tests only
265+
hk ci # Run CI checks
266+
hk check # Run all linters and checks
267+
268+
# Using cargo directly
269+
cargo test # Quick test run
270+
271+
# Using the test script
272+
./scripts/run-tests.sh --verbose # Comprehensive test suite with reporting
273+
./scripts/run-tests.sh --performance # Include performance tests
274+
./scripts/run-tests.sh --filter sparse_checkout # Filter specific tests
182275
```
183276

184277
### Writing Tests
@@ -235,13 +328,19 @@ fn test_submod_init_command() {
235328
Before submitting your PR, ensure:
236329

237330
- [ ] **Code compiles** without warnings
238-
- [ ] **All tests pass** (`./scripts/run-tests.sh`)
239-
- [ ] **Code is formatted** (`cargo fmt`)
240-
- [ ] **Lints pass** (`cargo clippy`)
331+
- [ ] **All tests pass** (`mise run ci` or `hk ci`)
332+
- [ ] **Pre-commit hooks pass** (automatically run on commit, or manually with `hk pre-commit`)
241333
- [ ] **Documentation is updated** if needed
242334
- [ ] **CHANGELOG is updated** for user-facing changes
243335
- [ ] **Commit messages follow conventions**
244336

337+
**Note**: If you're using the recommended mise/hk setup, many checks are automated:
338+
- **Code formatting** (`cargo fmt`) - Auto-fixed by pre-commit hooks
339+
- **Linting** (`cargo clippy`) - Checked by pre-commit hooks
340+
- **Spell checking** (`typos`) - Checked and auto-fixed by pre-commit hooks
341+
- **TOML/YAML formatting** (`prettier`) - Auto-fixed by pre-commit hooks
342+
- **Security auditing** (`cargo deny`) - Checked by pre-commit hooks
343+
245344
### 2. Submitting the PR
246345
247346
```bash

README.md

Lines changed: 107 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,95 @@ submod sync
239239
240240
- Rust 1.87 or later
241241
- Git
242+
- [Mise](https://mise.jdx.dev/) (recommended) - for tool management and task running
242243
243-
### Building from Source
244+
### Quick Setup with Mise (Recommended)
244245
245246
```bash
246247
# Clone the repository
247248
git clone https://github.com/bashandbone/submod.git
248249
cd submod
249250
251+
# Install mise if you haven't already
252+
curl https://mise.run | sh
253+
254+
# Install all development tools and dependencies
255+
mise install
256+
257+
# Build the project
258+
mise run build
259+
# or: mise run b (alias)
260+
261+
# Run tests
262+
mise run test
263+
264+
# Run the full CI suite (build + lint + test)
265+
mise run ci
266+
```
267+
268+
### Available Mise Tasks
269+
270+
```bash
271+
# Build the project
272+
mise run build # or: mise run b
273+
274+
# Run tests
275+
mise run test
276+
277+
# Lint with clippy
278+
mise run lint
279+
280+
# Run full CI pipeline
281+
mise run ci
282+
283+
# Clean build artifacts
284+
mise run clean
285+
286+
# Cut a new release (maintainers only)
287+
mise run release
288+
```
289+
290+
### Git Hooks with hk
291+
292+
This project uses [hk](https://github.com/jdx/hk) for automated git hooks that ensure code quality:
293+
294+
```bash
295+
# Install git hooks (done automatically with mise install)
296+
hk install
297+
298+
# Run pre-commit checks manually
299+
hk pre-commit
300+
301+
# Run all linters and checks
302+
hk check
303+
304+
# Auto-fix issues where possible
305+
hk fix
306+
307+
# Run CI checks locally
308+
hk ci
309+
```
310+
311+
The pre-commit hooks automatically run:
312+
- **cargo fmt** - Code formatting
313+
- **cargo clippy** - Linting
314+
- **cargo test** - Test suite
315+
- **typos** - Spell checking
316+
- **prettier** - TOML/YAML formatting
317+
- **cargo deny** - Security and license auditing
318+
319+
### Manual Setup (Alternative)
320+
321+
If you prefer not to use mise:
322+
323+
```bash
324+
# Clone the repository
325+
git clone https://github.com/bashandbone/submod.git
326+
cd submod
327+
328+
# Install Rust if needed
329+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
330+
250331
# Build the project
251332
cargo build
252333
@@ -260,20 +341,22 @@ cargo test
260341
### Running Tests
261342
262343
```bash
263-
# Run all tests
264-
cargo test
265-
266-
# Run integration tests only
267-
cargo test --test integration_tests
268-
269-
# Run with the test script for better reporting
270-
./scripts/run-tests.sh
271-
272-
# Run performance tests
273-
./scripts/run-tests.sh --performance
274-
275-
# Filter specific tests
276-
./scripts/run-tests.sh --filter sparse_checkout
344+
# Using mise (recommended)
345+
mise run test # Run all tests
346+
mise run ci # Run full CI suite
347+
348+
# Using hk
349+
hk test # Run tests only
350+
hk ci # Run CI checks
351+
352+
# Using cargo directly
353+
cargo test # Run all tests
354+
cargo test --test integration_tests # Integration tests only
355+
356+
# Using the test script
357+
./scripts/run-tests.sh --verbose # Comprehensive reporting
358+
./scripts/run-tests.sh --performance # Include performance tests
359+
./scripts/run-tests.sh --filter sparse_checkout # Filter tests
277360
```
278361
279362
### Project Structure
@@ -299,19 +382,22 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
299382
300383
1. **Fork the repository**
301384
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
302-
3. **Make your changes** and add tests if applicable (test anything that has a result)
303-
4. **Run the test suite**: `./scripts/run-tests.sh`
304-
5. **Commit your changes**: `git commit -m 'Add amazing feature'`
305-
6. **Push to your branch**: `git push origin feature/amazing-feature`
306-
7. **Open a Pull Request**
385+
3. **Set up development environment**: `mise install` (installs all tools and git hooks)
386+
4. **Make your changes** and add tests if applicable
387+
5. **Run the test suite**: `mise run ci` (or `hk ci`)
388+
6. **Commit your changes**: `git commit -m 'Add amazing feature'` (hooks run automatically)
389+
7. **Push to your branch**: `git push origin feature/amazing-feature`
390+
8. **Open a Pull Request**
307391
308392
### Development Guidelines
309393
310394
- Follow Rust best practices and idioms
311395
- Add tests for new functionality. I'm not big on unit tests, but integration tests are essential.
312396
- Update documentation for user-facing changes
313397
- Use conventional commit messages
314-
- Ensure all tests pass before submitting PR
398+
- Run `mise run ci` or `hk ci` before submitting PR
399+
- Pre-commit hooks will automatically format code and run basic checks
400+
- All automated checks must pass before PR can be merged
315401
316402
## 🔍 Troubleshooting
317403

0 commit comments

Comments
 (0)