vault-hier/CLAUDE.md
Harald Hoyer c3902ff0f1 docs: add development guidelines in CLAUDE.md
- Introduce coding standards, testing commands, and tool usage.
- Outline architecture notes, style, and logging conventions.
- Provide guidance on modular design and authentication protocols.
2025-03-20 15:10:10 +01:00

1.2 KiB

Vault-Hier Development Guidelines

Build & Test Commands

  • Build & run: cargo build && cargo run
  • Run tests: cargo test (or cargo test -- --nocapture for verbose output)
  • Run single test: cargo test test_name -- --nocapture
  • Docker test: ./test_docker.sh (includes vault initialization)
  • Local test: ./test_local.sh (sets up local vault)
  • Lint: cargo clippy -- -D warnings
  • Format: cargo fmt --all

Code Style Guidelines

  • Formatting: Follow rustfmt conventions (run cargo fmt before committing)
  • Imports: Group by crate (stdlib → external → internal)
  • Error Handling: Use anyhow with descriptive messages; propagate with ? or thiserror for actionable errors
  • Naming: Snake case for functions/variables, CamelCase for types
  • Async: Use Tokio for async runtime with structured task management
  • Logging: Use tracing macros for structured logging (info!, debug!, error!, warn!, trace!)
  • Documentation: Document public APIs with doc comments (///)

Architecture Notes

  • Modular design with separate services (document, vault, API)
  • Hierarchical signing with department validation
  • JWT-based authentication using Vault transit backend