Skip to content

Commit 8b3b056

Browse files
committed
Migrate to AGENTS.md
1 parent 989f690 commit 8b3b056

4 files changed

Lines changed: 33 additions & 37 deletions

File tree

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
^\.cache$
66
^\.github$
77
^\.claude$
8-
^CLAUDE.md$
8+
^\.posit$
9+
^AGENTS.md$
910
^am-build$
1011
^am-install$
1112
^README\.Rmd$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.Ruserdata
55
.cache
66
.claude
7+
.posit
78
.DS_Store
89
*.gz
910
automerge.Rcheck/

CLAUDE.md renamed to AGENTS.md

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,29 @@
1-
# CLAUDE.md
1+
# AGENTS.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
Guidance for AI coding agents working **on** the automerge package. automerge provides R bindings to the Automerge Conflict-free Replicated Data Type (CRDT) library via its C FFI, enabling automatic merging of concurrent changes across distributed systems without conflicts. Zero R package dependencies (only base R).
44

5-
## Project Overview
5+
Claude Code users: add `.claude/CLAUDE.md` containing `@../AGENTS.md` to import this file (`.claude/` is gitignored).
66

7-
This is an R package (`automerge`) that provides bindings to the Automerge Conflict-free Replicated Data Type (CRDT) library via its C FFI. The package enables automatic merging of concurrent changes across distributed systems without conflicts.
7+
## Architecture
88

9-
**Key Architecture:**
10-
- R package with C bindings to Rust-based automerge-c library
9+
- R package with C bindings to the Rust-based automerge-c library
1110
- R layer provides idiomatic S3 methods (`$`, `[[`, `length`, `names`, `as.list`)
12-
- C layer wraps automerge-c API with memory-safe external pointer management
13-
- Zero R package dependencies (only base R)
11+
- C layer wraps the automerge-c API with memory-safe external pointer management
1412

15-
## Build Commands
13+
## Commands
1614

17-
```bash
18-
# Install package (triggers configure + build)
19-
R CMD INSTALL .
15+
```r
16+
devtools::load_all() # load package for development
17+
devtools::test() # run all tests
18+
testthat::test_file("tests/testthat/test-document.R") # run a single test file
19+
devtools::document() # roxygen2 -> man/, NAMESPACE
20+
```
2021

21-
# Build package tarball
22+
```bash
23+
R CMD INSTALL . # install package (triggers configure + build)
2224
R CMD build .
23-
24-
# Check package
2525
R CMD check automerge_*.tar.gz
26-
27-
# Clean build artifacts
28-
./cleanup
29-
```
30-
31-
## Development Workflow
32-
33-
```r
34-
# Load package for development
35-
devtools::load_all()
36-
37-
# Run all tests
38-
devtools::test()
39-
40-
# Run a single test file
41-
testthat::test_file("tests/testthat/test-document.R")
42-
43-
# Build documentation
44-
devtools::document()
26+
./cleanup # clean build artifacts
4527
```
4628

4729
## Build System
@@ -57,9 +39,10 @@ The package uses a two-phase build approach:
5739
- Uses CMake with `-DUTF32_INDEXING=ON`
5840
- Requires Rust >= 1.85.0 and CMake >= 3.25
5941

60-
## Code Structure
42+
## Codebase Shape
6143

6244
### R Layer (`R/`)
45+
6346
- `document.R`: Document lifecycle (create, save, load, fork, merge, commit, rollback, clone)
6447
- `objects.R`: Object operations (put, get, delete, insert) and type constructors
6548
- `methods.R`: S3 methods for `am_doc`, `am_object`, and subtypes
@@ -71,6 +54,7 @@ The package uses a two-phase build approach:
7154
All R functions are thin `.Call()` wrappers (e.g., `am_put <- function(doc, obj, key, value) invisible(.Call(C_am_put, doc, obj, key, value))`). All logic lives in C.
7255

7356
### C Layer (`src/`)
57+
7458
- `automerge.h`: Data structures, function declarations, CHECK_RESULT macro
7559
- `document.c`: Document lifecycle operations
7660
- `objects.c`: Map/list/text operations and R↔Automerge type conversion
@@ -81,6 +65,10 @@ All R functions are thin `.Call()` wrappers (e.g., `am_put <- function(doc, obj,
8165
- `errors.c`: Error handling with file/line context
8266
- `init.c`: R package registration (83 C functions)
8367

68+
## Formatter
69+
70+
Air, configured in `air.toml` (default settings).
71+
8472
## Code Style
8573

8674
- Comments should be sparse and address the "why", not the "what"
@@ -115,3 +103,9 @@ Text positions use Unicode code points, not bytes. The emoji "😀" counts as 1
115103
- `CHECK_RESULT(result, expected_type)` macro validates AMresult* status and value type
116104
- Automatically frees AMresult* on error before calling `Rf_error()` — caller must not use the result after CHECK_RESULT
117105
- Includes file/line context for debugging (`__FILE__`, `__LINE__`)
106+
107+
## Packaging Notes
108+
109+
- roxygen2 with markdown; `NAMESPACE` is generated — never hand-edit.
110+
- Version is `major.minor.patch.dev` (current dev tag `.9000`).
111+
- `AGENTS.md`, `.claude/`, and `.posit/` are in `.Rbuildignore` and don't ship to CRAN.

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ VignetteBuilder:
3535
Config/build/compilation-database: true
3636
Config/Needs/website: tidyverse/tidytemplate
3737
Config/roxygen2/markdown: TRUE
38-
Config/roxygen2/version: 8.0.0
38+
Config/roxygen2/version: 8.1.0
3939
Config/testthat/edition: 3
4040
Encoding: UTF-8
4141
SystemRequirements: 'automerge-c', or Cargo (Rust's package manager) and

0 commit comments

Comments
 (0)