Skip to content

Commit e965d4e

Browse files
committed
add claude and updated mise.toml
1 parent 70e4fbd commit e965d4e

File tree

3 files changed

+108
-16
lines changed

3 files changed

+108
-16
lines changed

CLAUDE.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
`submod` is a Rust CLI tool for managing git submodules with advanced sparse checkout support. It uses `gitoxide` and `git2` libraries for high-performance git operations, with fallbacks to CLI git commands when needed.
8+
9+
## Development Commands
10+
11+
### Building and Testing
12+
13+
- `cargo build` - Build the project
14+
- `cargo test` - Run unit tests
15+
- `./scripts/run-tests.sh` - Run comprehensive integration test suite
16+
- `./scripts/run-tests.sh --verbose` - Run tests with detailed output
17+
- `./scripts/run-tests.sh --performance` - Include performance tests
18+
- `./scripts/run-tests.sh --filter <pattern>` - Run specific test modules
19+
20+
### Linting and Formatting
21+
22+
- `cargo fmt` - Format code
23+
- `cargo clippy` - Run linter
24+
- `hk run check` - Run pre-commit checks via hk tool
25+
- `hk run fix` - Run auto-fixable linters
26+
27+
### Mise Tasks (if using mise)
28+
29+
- `mise run build` or `mise run b` - Build the CLI
30+
- `mise run test` - Run automated tests
31+
- `mise run lint` - Lint with clippy
32+
- `mise run ci` - Run CI tasks (build, lint, test)
33+
34+
### Testing Philosophy
35+
36+
The project follows integration-first testing. Focus on testing complete workflows and outputs rather than implementation details. Tests are run serially (`RUST_TEST_THREADS=1`) to avoid git submodule race conditions.
37+
38+
## Architecture
39+
40+
### Core Modules
41+
42+
- `src/main.rs` - CLI entry point, parses commands and dispatches to manager
43+
- `src/commands.rs` - Command-line argument definitions using clap
44+
- `src/config.rs` - TOML configuration parsing and submodule config management
45+
- `src/gitoxide_manager.rs` - Core submodule operations using gitoxide/git2
46+
- `src/lib.rs` - Library exports (not a stable API)
47+
48+
### Configuration System
49+
50+
- Uses TOML configuration files (default: `submod.toml`)
51+
- Supports global defaults with per-submodule overrides
52+
- Handles sparse checkout paths, git options, and submodule settings
53+
54+
### Git Operations Strategy
55+
56+
1. **Primary**: gitoxide library for performance
57+
2. **Fallback**: git2 library (optional feature `git2-support`)
58+
3. **Final fallback**: CLI git commands
59+
60+
### Key Design Patterns
61+
62+
- Error handling with `anyhow` for application errors, `thiserror` for library errors
63+
- Comprehensive documentation for all public APIs
64+
- Strict linting configuration with pedantic clippy settings
65+
- Integration tests over unit tests
66+
67+
## Configuration Files
68+
69+
### Key Files to Know
70+
71+
- `Cargo.toml` - Project configuration with strict linting rules
72+
- `hk.pkl` - Git hooks configuration (pre-commit, linting)
73+
- `mise.toml` - Development environment and task definitions
74+
- `sample_config/submod.toml` - Example configuration
75+
- `scripts/run-tests.sh` - Comprehensive test runner
76+
77+
### Test Structure
78+
79+
- `tests/integration_tests.rs` - Core functionality tests
80+
- `tests/config_tests.rs` - Configuration parsing tests
81+
- `tests/sparse_checkout_tests.rs` - Sparse checkout functionality
82+
- `tests/error_handling_tests.rs` - Error conditions and edge cases
83+
- `tests/performance_tests.rs` - Performance and stress tests
84+
85+
## Working with the Codebase
86+
87+
### Before Making Changes
88+
89+
1. Run `./scripts/run-tests.sh` to ensure tests pass
90+
2. Check code formatting with `cargo fmt --check`
91+
3. Run linter with `cargo clippy`
92+
93+
### When Adding Features
94+
95+
- Add integration tests to appropriate test modules
96+
- Update configuration parsing if new config options are added
97+
- Follow existing error handling patterns
98+
- Document public APIs thoroughly
99+
100+
### Code Quality Standards
101+
102+
- Unsafe code is forbidden (`unsafe_code = "forbid"`)
103+
- All warnings treated seriously with comprehensive clippy configuration
104+
- Focus on clear, descriptive naming and comprehensive error messages

custom_modes.json

Whitespace-only changes.

mise.toml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,13 @@ alias = 'b' # `mise run b`
3636
[tasks.test]
3737
description = 'Run automated tests'
3838
# multiple commands are run in series
39-
run = [
40-
'cargo test',
41-
]
42-
dir = "{{cwd}}" # run in user's cwd, default is the project's base directory
39+
run = "hk run test"
40+
alias = 't' # `mise run t`
4341

4442
[tasks.lint]
45-
description = 'Lint with clippy'
46-
env = { RUST_BACKTRACE = '1' } # env vars for the script
47-
# you can specify a multiline script instead of individual commands
48-
run = """
49-
#!/usr/bin/env bash
50-
cargo clippy
51-
"""
43+
description = 'Full linting of the codebase'
44+
run = "hk run check"
5245

5346
[tasks.ci] # only dependencies to be run
5447
description = 'Run CI tasks'
5548
depends = ['build', 'lint', 'test']
56-
57-
[tasks.release]
58-
confirm = 'Are you sure you want to cut a new release?'
59-
description = 'Cut a new release'
60-
file = 'scripts/release.sh' # execute an external script

0 commit comments

Comments
 (0)