Skip to content

Commit 4e060d4

Browse files
committed
docs: update document to curret state
1 parent ca38f01 commit 4e060d4

19 files changed

+527
-3005
lines changed

.amazonq/rules/dev-workflow.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
Before performing ANY coding task, **read `.dev/00-README.md`** for complete project context and workflow.
66

7+
## .dev Document Numbering
8+
9+
**Rule**: All .dev documents use sequential numbering to indicate creation order:
10+
11+
- `00-***.md`: Created at same point in time (current state)
12+
- `01-***.md`: Next development phase
13+
- `02-***.md`: Following phase
14+
- etc.
15+
16+
**Higher numbers = more recent/updated plans**
17+
18+
Always verify against actual codebase - higher numbered docs are more likely to be current.
19+
720
## Essential Commands
821

922
✅ Use `make` commands (defined in `.dev/00-README.md`)

.amazonq/rules/docker-git-testing.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,63 @@ make test
207207
1. `src/test_utils/git/mod.rs` - GitOperations trait and exports
208208
2. `src/test_utils/git/docker.rs` - DockerGit implementation (local development)
209209
3. `src/test_utils/git/native.rs` - NativeGit implementation (CI testing)
210-
4. `src/config.rs` - Environment detection via `ZERV_CI` variable
211-
5. `src/test_utils/mod.rs` - `should_use_native_git()` helper function
210+
4. `src/config.rs` - Centralized environment variable loading via `ZERV_TEST_NATIVE_GIT` and `ZERV_TEST_DOCKER`
211+
5. `src/test_utils/mod.rs` - `should_use_native_git()` and `should_run_docker_tests()` helper functions
212+
213+
## Environment Variable Matrix
214+
215+
| Scenario | `ZERV_TEST_NATIVE_GIT` | `ZERV_TEST_DOCKER` | Git Implementation | Docker Tests | Result |
216+
| ---------------- | ---------------------- | ------------------ | ------------------ | ------------ | ------------------ |
217+
| Local Easy | `false` | `false` | Docker Git | Skipped | Coverage with gaps |
218+
| Local Full | `false` | `true` | Docker Git | Run | Full coverage |
219+
| CI Linux | `true` | `true` | Native Git | Run | Platform coverage |
220+
| CI macOS/Windows | `true` | `false` | Native Git | Skipped | Platform coverage |
221+
222+
## Centralized Configuration
223+
224+
**All environment variable loading centralized in `src/config.rs`:**
225+
226+
```rust
227+
#[derive(Debug, Clone, Default)]
228+
pub struct ZervConfig {
229+
pub test_native_git: bool, // ZERV_TEST_NATIVE_GIT
230+
pub test_docker: bool, // ZERV_TEST_DOCKER
231+
}
232+
233+
impl ZervConfig {
234+
pub fn load() -> Result<Self, Box<dyn std::error::Error>> {
235+
let test_native_git = Self::parse_bool_env("ZERV_TEST_NATIVE_GIT")?;
236+
let test_docker = Self::parse_bool_env("ZERV_TEST_DOCKER")?;
237+
Ok(ZervConfig { test_native_git, test_docker })
238+
}
239+
240+
fn parse_bool_env(var_name: &str) -> Result<bool, Box<dyn std::error::Error>> {
241+
match env::var(var_name) {
242+
Ok(val) => Ok(val == "true" || val == "1"),
243+
Err(_) => Ok(false),
244+
}
245+
}
246+
}
247+
```
248+
249+
**Key Behavior Changes:**
250+
251+
- Docker tests **fail** with clear error messages when `ZERV_TEST_DOCKER=true` but Docker unavailable
252+
- Policy enforcement: If Docker is available, tests must be enabled
253+
- Proper test separation between Docker-dependent and Docker-independent tests
212254

213255
## Current Testing Verification
214256

215257
```bash
216258
# Local test (uses DockerGit for isolation)
217-
make test
259+
make test_easy # Docker tests skipped
260+
make test # Docker tests enabled
218261

219262
# Test validation works
220263
cargo test test_docker_validation --lib
221264

222-
# Check specific git tests (Docker tests only run on Linux)
223-
cargo test git --include-ignored
265+
# Check specific git tests
266+
cargo test git
224267

225268
# Verify multi-platform CI passes
226269
git push # Check GitHub Actions on Linux, macOS, Windows
@@ -237,7 +280,7 @@ git push # Check GitHub Actions on Linux, macOS, Windows
237280
**Local Safety Maintained**:
238281

239282
-**Docker Isolation**: Protects personal git config during local development
240-
-**Environment Detection**: Automatic switching via `ZERV_CI=true`
283+
-**Environment Detection**: Automatic switching via `ZERV_TEST_NATIVE_GIT=true`
241284
-**Consistent API**: Same `GitOperations` trait for both implementations
242285

243286
## Architecture Evolution

.amazonq/rules/testing-standards.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
**CI Environment:**
1414

1515
- Use `NativeGit` for real platform testing (Windows/macOS/Linux)
16-
- Enabled automatically via `ZERV_CI=true` environment variable
16+
- Enabled automatically via `ZERV_TEST_NATIVE_GIT=true` environment variable
1717
- Tests actual platform-specific Git behavior, paths, line endings
1818

1919
**Implementation Pattern:**
@@ -31,6 +31,41 @@ fn get_git_impl() -> Box<dyn GitOperations> {
3131
}
3232
```
3333

34+
## Docker Test Control
35+
36+
**MANDATORY: Use `should_run_docker_tests()` for all Docker-dependent tests**
37+
38+
**Environment Variables:**
39+
40+
- `ZERV_TEST_DOCKER=true`: Enable Docker tests (requires Docker to be available)
41+
- `ZERV_TEST_DOCKER=false`: Skip Docker tests (default)
42+
43+
**Policy Enforcement:**
44+
45+
- If Docker is available on system, Docker tests MUST be enabled
46+
- Only skip Docker tests when Docker is genuinely unavailable
47+
- Tests will fail if `ZERV_TEST_DOCKER=true` but Docker is not available
48+
49+
**Implementation Pattern:**
50+
51+
```rust
52+
use crate::test_utils::should_run_docker_tests;
53+
54+
#[test]
55+
fn test_docker_functionality() {
56+
if !should_run_docker_tests() {
57+
return; // Skip when Docker tests are disabled
58+
}
59+
// Docker-dependent test code
60+
}
61+
```
62+
63+
**Make Commands:**
64+
65+
- `make test_easy`: Docker Git + Docker tests skipped (fast, coverage gaps)
66+
- `make test`: Docker Git + Docker tests enabled (full coverage)
67+
- CI: Native Git + Docker tests on Linux only
68+
3469
## Race Condition Prevention
3570

3671
**Atomic Operations Required:**

.dev/00-README.md

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,40 @@
1-
# .dev/
1+
# Zerv Development Guide
22

3-
Development documentation for zerv - Dynamic Versioning CLI
3+
## Quick Start
44

5-
## Project Status
5+
1. **Check current state**: Read `00-current-state.md`
6+
2. **Key files**: Reference `00-key-files.md`
7+
3. **Run tests**: `make test_easy` (quick) or `make test` (full)
8+
4. **Check rules**: `.amazonq/rules/` for coding standards
69

7-
**Current State**: Version parsing system implemented
8-
**Next Step**: Building Git VCS integration
9-
**Target**: Alpha release with Git support
10+
## Current Priority
1011

11-
## What's Implemented
12+
**CLI Implementation** - Core functionality exists, need CLI interface.
1213

13-
**Core Version System**
14+
## Architecture Overview
1415

15-
- Universal `Zerv` format with component-based structure
16-
- PEP440 version parsing, display, and conversion
17-
- SemVer version parsing, display, and conversion
18-
- Comprehensive test coverage (91.40%)
19-
20-
**Development Infrastructure**
21-
22-
- Docker-based testing for Git integration
23-
- Fast local tests without external dependencies
24-
- Makefile workflow with linting and formatting
25-
26-
## Development Workflow
16+
```
17+
CLI → VCS Detection → Tag Parsing → Format Output
18+
```
2719

28-
```bash
29-
# Fast development cycle (no Docker required)
30-
make lint # Format and check code
31-
make run # Test CLI binary
20+
**Key Components:**
3221

33-
# Full validation (includes Docker tests)
34-
make test # Run all tests including Docker integration
35-
make setup_dev # Install development dependencies
36-
```
22+
- **VCS Layer**: Extract git metadata (`src/vcs/`)
23+
- **Version System**: Parse/convert formats (`src/version/`)
24+
- **Pipeline**: Transform data (`src/pipeline/`)
25+
- **CLI**: User interface (`src/cli/` - needs work)
3726

38-
## Architecture
27+
## Testing Strategy
3928

40-
```
41-
src/version/
42-
├── zerv/ # Universal version format
43-
├── pep440/ # PEP440 implementation
44-
├── semver/ # SemVer implementation
45-
└── mod.rs # Public API
46-
```
29+
- **Local**: Docker Git for isolation
30+
- **CI**: Native Git for platform testing
31+
- **237 tests** with multi-platform coverage
4732

48-
## Files
33+
## Environment Variables
4934

50-
- `current-state.md` - Detailed implementation status
51-
- `new-cli-design.md` - Pipeline CLI architecture design
52-
- `roadmap.md` - Development roadmap to alpha release
53-
- `archived-insights.md` - Valuable concepts from old documentation
54-
- `.cache/` - Archived old documentation (preserved for reference)
35+
- `ZERV_TEST_NATIVE_GIT=true` - Use native Git (CI only)
36+
- `ZERV_TEST_DOCKER=true` - Enable Docker tests (Linux only)
5537

56-
## Next Phase
38+
## Next Steps
5739

58-
Git VCS integration + pipeline CLI (`zerv version` with `zerv-default` schema)
40+
Focus on `src/cli/app.rs` implementation to wire existing components together.

.dev/00-architecture-insights.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Architecture Insights - Key Decisions
2+
3+
## Universal Version Format (Zerv)
4+
5+
- **Component-based format system** with variable references
6+
- **Separation of format template from data values**
7+
- **Support for timestamp patterns** (YYYY, MM, DD, YYYYMMDD)
8+
- **Extensible custom variables** via HashMap
9+
- **Status**: ✅ Fully implemented in `src/version/zerv/`
10+
11+
## State-Based Versioning Tiers
12+
13+
**Three-tier system based on repository state:**
14+
15+
- **Tier 1** (Tagged, clean): `major.minor.patch`
16+
- **Tier 2** (Distance, clean): `major.minor.patch.post<distance>+branch.<commit>`
17+
- **Tier 3** (Dirty): `major.minor.patch.dev<timestamp>+branch.<commit>`
18+
19+
## Multi-Format Support Strategy
20+
21+
- **PEP440** for Python ecosystem (`1.2.3.post7.dev0+g29045e8`)
22+
- **SemVer** for JavaScript/Node (`1.2.3-post.7+g29045e8`)
23+
- **Template-based** custom formats
24+
- **Status**: ✅ PEP440 and SemVer implemented
25+
26+
## Error Handling Strategy
27+
28+
- **Library layer**: Specific error types (`ZervError`)
29+
- **CLI layer**: User-friendly messages
30+
- **Use `io::Error::other()` instead of `io::Error::new(io::ErrorKind::Other, ...)`**
31+
- **Status**: ✅ Pattern established
32+
33+
## Testing Strategy
34+
35+
- **Local**: Docker Git for isolation
36+
- **CI**: Native Git for platform testing
37+
- **Atomic operations** using single Docker commands
38+
- **Status**: ✅ Successfully implemented
39+
40+
## Performance Targets
41+
42+
- **Parse 1000+ versions in <100ms**
43+
- **Minimal VCS command calls**
44+
- **Compiled regex patterns for speed**
45+
- **Zero-copy string operations where possible**
46+
47+
## Configuration System Design (Future)
48+
49+
```toml
50+
# Custom schemas: Different data structure + standard format output
51+
[schemas]
52+
calver-schema = '(core: [VarTimestamp("YYYY"), VarTimestamp("MM"), VarField("patch")], ...)'
53+
54+
# Custom templates: Default schema + custom output format
55+
[templates]
56+
my-format = "v{{ major }}.{{ minor }}.{{ patch }}-{{ commit }}"
57+
```
58+
59+
## Complementary Tool Strategy
60+
61+
- **semantic-release**: Official release decisions and tagging
62+
- **zerv**: Continuous version identification for builds
63+
- **Perfect complementary workflow** for modern CI/CD

0 commit comments

Comments
 (0)