Skip to content

Commit 847bbe4

Browse files
committed
init Whiteout
0 parents  commit 847bbe4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+7227
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
1. Initialize whiteout with '...'
15+
2. Add decoration '....'
16+
3. Run command '....'
17+
4. See error
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Actual behavior**
23+
What actually happened instead.
24+
25+
**Code example**
26+
```javascript
27+
// Your code with decorations
28+
const apiKey = "secret"; // @whiteout: "safe"
29+
```
30+
31+
**Environment:**
32+
- OS: [e.g. macOS 14.0]
33+
- Rust version: [e.g. 1.75.0]
34+
- Git version: [e.g. 2.43.0]
35+
- Whiteout version: [e.g. 0.1.0]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
39+
40+
**Logs**
41+
If applicable, add debug logs (run with `RUST_LOG=debug`).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Example usage**
19+
```bash
20+
# How you'd like to use this feature
21+
whiteout new-command --option value
22+
```
23+
24+
**Additional context**
25+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target/
2+
**/*.rs.bk
3+
*.pdb
4+
.whiteout/
5+
test/
6+
.claude/

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial release of Whiteout
12+
- Three decoration styles: inline, block, and partial replacements
13+
- Git filter integration (clean/smudge)
14+
- Local storage system with optional encryption
15+
- CLI commands for initialization, marking, and status
16+
- Language-agnostic support for any text file
17+
- Comprehensive test suite with 39 tests
18+
- Support for branch-specific configurations
19+
- Safety feature: `@whiteout-partial` decorator required for partial replacements
20+
21+
### Security
22+
- Secrets never enter Git history
23+
- Local storage with AES-256-GCM encryption option
24+
- Automatic `.gitignore` creation for storage files
25+
- Pre-commit hook support for additional validation
26+
27+
## [0.1.0] - 2024-01-15
28+
29+
### Added
30+
- Core transformation engine with Rust implementation
31+
- Git clean and smudge filter support
32+
- Basic CLI with init, clean, smudge commands
33+
- Support for inline decorations (`@whiteout:`)
34+
- Support for block decorations (`@whiteout-start`/`@whiteout-end`)
35+
- Support for partial replacements (`[[local||committed]]`)
36+
- Local TOML-based storage system
37+
- Configuration file support (`.whiteout/config.toml`)
38+
- Automatic Git configuration during initialization
39+
40+
### Changed
41+
- Partial replacements now require explicit `@whiteout-partial` decorator for safety
42+
43+
### Fixed
44+
- Block decoration preservation in commits
45+
- Line number shifting in smudge filter
46+
- Concurrent access in tests
47+
- Partial replacement pattern restoration
48+
49+
### Security
50+
- Added protection against accidental pattern matching
51+
- Implemented explicit decoration requirement for partial replacements
52+
53+
## Links
54+
- [Compare v0.1.0...HEAD](https://github.com/yourusername/whiteout/compare/v0.1.0...HEAD)
55+
- [v0.1.0](https://github.com/yourusername/whiteout/releases/tag/v0.1.0)

CLAUDE.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
Whiteout is a Rust-based Git filter tool that prevents secrets and local-only code from being committed while maintaining them in the working directory. It uses decoration syntax to mark code sections as local-only.
8+
9+
## Development Commands
10+
11+
### Build & Run
12+
```bash
13+
# Build the project
14+
cargo build
15+
16+
# Build optimized release version
17+
cargo build --release
18+
19+
# Run the CLI tool
20+
cargo run -- <command>
21+
22+
# Install to system (requires sudo)
23+
./install.sh
24+
```
25+
26+
### Testing
27+
```bash
28+
# Run all tests
29+
cargo test
30+
31+
# Run specific test
32+
cargo test <test_name>
33+
34+
# Run integration tests
35+
cargo test --test integration_test
36+
37+
# Run Git integration test script
38+
bash tests/git_integration_test.sh
39+
40+
# Run with verbose output
41+
cargo test -- --nocapture
42+
```
43+
44+
### Development Tools
45+
```bash
46+
# Format code
47+
cargo fmt
48+
49+
# Check for linting issues
50+
cargo clippy
51+
52+
# Generate documentation
53+
cargo doc --open
54+
55+
# Check for compilation errors without building
56+
cargo check
57+
```
58+
59+
## Architecture
60+
61+
### Core Components
62+
63+
1. **Parser Module** (`src/parser/`)
64+
- `inline.rs`: Handles inline decorations (`// @whiteout: replacement`)
65+
- `block.rs`: Handles block decorations (`@whiteout-start`/`@whiteout-end`)
66+
- `partial.rs`: Handles partial replacements (`[[local||committed]]`)
67+
68+
2. **Transform Module** (`src/transform/`)
69+
- `clean.rs`: Git clean filter - strips local values before commit
70+
- `smudge.rs`: Git smudge filter - restores local values after checkout
71+
72+
3. **Storage Module** (`src/storage/`)
73+
- `local.rs`: Manages `.whiteout/local.toml` for storing local values
74+
- `crypto.rs`: Optional encryption for sensitive local values
75+
76+
4. **Config Module** (`src/config/`)
77+
- Manages project-level whiteout configuration
78+
79+
### Git Filter Integration
80+
81+
The tool integrates with Git through clean/smudge filters:
82+
- **Clean**: `Working Directory → Repository` (removes secrets)
83+
- **Smudge**: `Repository → Working Directory` (restores secrets)
84+
85+
Configuration requires:
86+
```bash
87+
git config filter.whiteout.clean 'whiteout clean'
88+
git config filter.whiteout.smudge 'whiteout smudge'
89+
git config filter.whiteout.required true
90+
```
91+
92+
And `.gitattributes`:
93+
```
94+
* filter=whiteout
95+
```
96+
97+
### Decoration Patterns
98+
99+
1. **Inline**: `value // @whiteout: replacement`
100+
2. **Block**: Between `@whiteout-start` and `@whiteout-end` comments
101+
3. **Partial**: `[[local_value||committed_value]]` within strings
102+
103+
## Key Implementation Details
104+
105+
- Local values stored in `.whiteout/local.toml` (gitignored)
106+
- Branch-specific storage supported via Git branch detection
107+
- Language-agnostic parsing based on comment patterns
108+
- Preserves exact formatting and indentation during transformation
109+
- Atomic file operations to prevent data loss
110+
111+
## Testing Approach
112+
113+
- Unit tests for each parser type
114+
- Integration tests for complete transformation pipeline
115+
- Shell script for real Git workflow testing
116+
- Test fixtures in `tests/` directory

0 commit comments

Comments
 (0)