2026-05-09 16:05:17 -05:00
|
|
|
# CLAUDE.md
|
|
|
|
|
|
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
|
|
|
|
|
|
## Project
|
|
|
|
|
|
|
|
|
|
`drawer` is a Rust project (edition 2024). Entry point is `src/main.rs`.
|
|
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
|
|
- `tar` — reading and writing tarballs in memory
|
|
|
|
|
- `flate2` — gzip compression, paired with `tar`
|
|
|
|
|
- `age` — encryption/decryption using SSH keys (RSA or Ed25519) loaded from disk
|
|
|
|
|
- `clap` — command line argument parsing (derive API), used for subcommands and flags
|
2026-05-11 20:04:46 -05:00
|
|
|
- `ssh-key` — generating new Ed25519 SSH keys
|
|
|
|
|
- `rand` — `OsRng` entropy source for key generation
|
2026-05-09 16:05:17 -05:00
|
|
|
|
|
|
|
|
`drawer` is a command line tool for managing projects.
|
|
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
A drawer is a single directory with related files for a project. Drawer files always end
|
|
|
|
|
in the `.drawer` extension, like `foo.drawer`. To create a drawer file from a directory,
|
|
|
|
|
the contents are tarred, gzip-compressed, and encrypted in memory before being written to disk.
|
|
|
|
|
To open a drawer file, it is decrypted and the tarball is expanded into a directory.
|
2026-05-09 16:05:17 -05:00
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
The `drawer` tool has three subcommands. `open` and `close` require a key (an SSH private key),
|
|
|
|
|
the path to which can be given by either the `$DRAWER_KEY` environment variable or `-i`.
|
2026-05-09 16:05:17 -05:00
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
### open
|
2026-05-09 16:05:17 -05:00
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
Decrypt and expand a drawer file into a directory. Takes a drawer file (required) and a target
|
|
|
|
|
path (optional, defaults to a directory named after the drawer file stem). Prints a message when
|
|
|
|
|
the target path is inferred. Fails if the target exists and is non-empty, unless `-f` is passed.
|
2026-05-09 16:05:17 -05:00
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
### close
|
2026-05-09 16:05:17 -05:00
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
Compress and encrypt a directory into a drawer file. Takes a drawer file (required) and a source
|
|
|
|
|
directory (optional, defaults to the directory named after the drawer file stem). Prints a message
|
|
|
|
|
when the source path is inferred. Fails if the drawer file would be written inside the source directory.
|
|
|
|
|
|
|
|
|
|
### key
|
|
|
|
|
|
|
|
|
|
Generate a new Ed25519 SSH key and write it to a file. Takes a filename (required). Fails if the
|
|
|
|
|
file already exists or the parent directory does not exist.
|
2026-05-09 16:05:17 -05:00
|
|
|
|
|
|
|
|
### Examples:
|
|
|
|
|
|
2026-05-11 20:04:46 -05:00
|
|
|
- `drawer close -i ~/.keys/mykey ~/Documents/blah.drawer ~/Documents/blah` — create `~/Documents/blah.drawer` from `~/Documents/blah`
|
|
|
|
|
- `drawer close -i ~/.keys/mykey ~/Documents/blah.drawer` — same, inferring source directory from drawer name
|
|
|
|
|
- `drawer open ~/Documents/blah.drawer` — open into `./blah` using `$DRAWER_KEY`
|
|
|
|
|
- `drawer key ~/.keys/mykey` — generate a new SSH key at `~/.keys/mykey`
|
2026-05-09 16:05:17 -05:00
|
|
|
|
|
|
|
|
## Implementation plan
|
|
|
|
|
|
|
|
|
|
The implementation of this project will happen in several phases. Claude will do the primary coding for each phase, then
|
|
|
|
|
the user (me) will review the code, write tests, and possibly make changes, before proceeding with the next phase.
|
|
|
|
|
|
|
|
|
|
At to time should Claude delete or modify any tests whatsoever.
|
|
|
|
|
|
2026-05-10 18:55:21 -05:00
|
|
|
The implementation plans for each phase are in markdown files under the `plans/` directory. Claude should read these but
|
|
|
|
|
should not modify them.
|
2026-05-10 18:27:55 -05:00
|
|
|
|
2026-05-09 16:05:17 -05:00
|
|
|
## Commands
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cargo build # compile
|
|
|
|
|
cargo run # build and run
|
|
|
|
|
cargo test # run all tests
|
|
|
|
|
cargo test <name> # run a single test by name
|
|
|
|
|
cargo clippy # lint
|
|
|
|
|
cargo fmt # format
|
|
|
|
|
```
|