chore: Claude agentic setup

This commit is contained in:
Jeremy Wall 2025-07-23 16:26:40 -04:00
parent bca2601451
commit b9d63ab381
2 changed files with 60 additions and 36 deletions

View File

@ -1,36 +0,0 @@
# AGENTS.md
## Build Commands
- Build all crates: `cargo build`
- Build specific crate: `cargo build -p <crate-name>` (e.g., `cargo build -p offline-web-storage`)
- Build with optimizations: `cargo build --release`
## Test Commands
- Run all tests: `cargo test`
- Run specific test: `cargo test <test_name>` (e.g., `cargo test test_dependencies_updated_when_nodes_added`)
- Run tests in specific crate: `cargo test -p <crate-name>`
- Run tests with output: `cargo test -- --nocapture`
## Code Style Guidelines
### Formatting & Imports
- Group imports by std, external crates, and internal modules
- Sort imports alphabetically within groups
- Use block imports with curly braces for multi-imports
### Types & Naming
- Use snake_case for functions, variables, and modules
- Use PascalCase for types and structs
- Prefix trait implementations with the trait name
- Use Option<T> for nullable values, not unwrap()
### Error Handling
- Use Result<T, E> with custom error types
- Implement thiserror::Error for error enums
- Propagate errors with ? operator
- Use descriptive error messages
### Documentation
- Document public APIs with /// comments
- Include examples in documentation for complex functions
- Explain parameter and return types in function docs

60
CLAUDE.md Normal file
View File

@ -0,0 +1,60 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Architecture Overview
This is an offline-first web application framework built in Rust with dual native/WASM compilation support. The architecture consists of:
### Core Crates
- **offline-web-model**: Content-addressable graph data structures with `Reference` types that form a DAG (Directed Acyclic Graph). References contain object IDs, content addresses, names, and dependents. The graph automatically recalculates IDs when content changes to maintain content addressability.
- **offline-web-storage**: Storage abstraction layer with `ReferenceStore` trait. Includes SQLite implementation for native builds and IndexedDB for WASM. Uses feature flags to conditionally compile storage backends.
- **exp1** & **exp2**: Experimental server implementations demonstrating the framework
### Data Model
The framework uses a content-addressable system where:
- All resources form a merkle tree structure
- Resource reference paths are rooted at `/ref/` prefix
- Content-addressable paths are rooted at `/object/<content-hash>`
- Reserved references include `/ref/all/<username>` (user's root) and `/ref/user/<username>` (user info)
## Build Commands
- Build all crates for both native and wasm: `make build`
- Build crates for native: `make native`
- Build crates for wasm: `make wasm`
- Build individual crates: `make model-native`, `make storage-native`, `make model-wasm`, `make storage-wasm`
## Testing
- Unit tests: `cargo test` (for native features)
- Model tests: `cargo test -p offline-web-model --features native`
- Storage integration tests: `cargo test -p offline-web-storage --features native`
- WASM builds require `--target=wasm32-unknown-unknown` and `--features wasm`
## Feature Flags
Both core crates use conditional compilation:
- `native`: Enables SQLite, tokio, full native functionality
- `wasm`: Enables WASM-specific dependencies (getrandom/wasm_js, uuid/js, wasm-bindgen)
## Code Style Guidelines
### Formatting & Imports
- Group imports by std, external crates, and internal modules
- Sort imports alphabetically within groups
- Use block imports with curly braces for multi-imports
### Types & Naming
- Use snake_case for functions, variables, and modules
- Use PascalCase for types and structs
- Prefix trait implementations with the trait name
- Use Option<T> for nullable values, not unwrap()
### Error Handling
- Use Result<T, E> with custom error types
- Implement thiserror::Error for error enums
- Propagate errors with ? operator
- Use descriptive error messages
### Documentation
- Document public APIs with /// comments
- Include examples in documentation for complex functions
- Explain parameter and return types in function docs