From b9d63ab381d8b5a0268fda848a764674a0a6bc68 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Wed, 23 Jul 2025 16:26:40 -0400 Subject: [PATCH] chore: Claude agentic setup --- AGENTS.md | 36 --------------------------------- CLAUDE.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 36 deletions(-) delete mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 25b7a58..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,36 +0,0 @@ -# AGENTS.md - -## Build Commands -- Build all crates: `cargo build` -- Build specific crate: `cargo build -p ` (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 ` (e.g., `cargo test test_dependencies_updated_when_nodes_added`) -- Run tests in specific crate: `cargo test -p ` -- 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 for nullable values, not unwrap() - -### Error Handling -- Use Result 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 \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8e92aad --- /dev/null +++ b/CLAUDE.md @@ -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/` +- Reserved references include `/ref/all/` (user's root) and `/ref/user/` (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 for nullable values, not unwrap() + +### Error Handling +- Use Result 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