Skip to content

Commit 84a3115

Browse files
Passage refactor (#8)
* Add work base from /init + initial prompt * extract display and list utilities to lib * extract file utils, prompt and validation * update cache * extract recipients functions * extract retry operations * make verbose a boolean, not a ref * extract comment input functions * extract secret helpers * extract helpers for recipients * composable checks pt1 * cleanup * make lib DRYer * add missing tests * lwt refactor pt1 * lwt refactor pt2 * abstract and share editor tools * update editor error messages * refactor shell control to use devkit+bos * general form cleanup * always use bos to run commands * remove serena mcp files * make compiler happy in gh CI * update completions * don't use List.is_empty in secret.ml * remove List.is_empty usages * fix cmdliner version declaration * quote filenames in age commands * cleanup after PR review * update cmdliner dep version * lib: move helpers to util module
1 parent 93805be commit 84a3115

38 files changed

Lines changed: 1572 additions & 1319 deletions

CLAUDE.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Passage is a command-line tool for storing and managing access to shared secrets using age encryption. It supports multiple recipients, group management, and template substitution.
8+
9+
## Essential Commands
10+
11+
### Development Workflow
12+
- `make build` - Build the project (uses `dune build`)
13+
- `make test` - Run all tests (uses `dune runtest`)
14+
- `make fmt` - Format code with OCamlformat (uses `dune fmt --auto-promote`)
15+
- `make promote` - Run tests and promote expected outputs
16+
- `make clean` - Clean build artifacts
17+
18+
### Testing
19+
- Tests use cram-style testing in `.t` files
20+
- Run single test: `dune runtest tests/command_name.t`
21+
- Test the compiled binary: `./_build/default/bin/main.exe <command>`
22+
- Test fixtures in `tests/fixtures/` with sample keys and secrets
23+
- Use `make promote` when test outputs need updating
24+
25+
### Dependencies
26+
- Requires `age` encryption tool: `apt install age`
27+
- Install OCaml dependencies: `opam install . --deps-only --with-dev-setup`
28+
29+
## Code Architecture
30+
31+
### Structure
32+
- **bin/main.ml**: Main CLI entry point with all commands organized as modules (Create, Edit, Get, etc.)
33+
- **lib/**: Core library modules:
34+
- `storage.ml`: Secret storage, encryption/decryption, recipient management
35+
- `config.ml`: Configuration and environment variables
36+
- `secret.ml`: Secret data structures and parsing
37+
- `template.ml` + related files: Template substitution system with `{{{secret_name}}}` syntax
38+
- `age.ml`: Age encryption wrapper
39+
40+
### Key Patterns
41+
- CLI commands are modules in main.ml using cmdliner for argument parsing
42+
- Library modules provide core functionality, main binary orchestrates CLI calls
43+
- Storage abstraction handles all filesystem operations
44+
- Template system supports both single-line and multi-line secrets with comments
45+
46+
### Code Style
47+
- OCamlformat 0.26.2 with 120-character line length.
48+
- 2-space indentation, snake_case for functions/variables
49+
- Error handling via Result types or descriptive exceptions
50+
- Module names in PascalCase (e.g., `Secret_name`, `Edit_cmd`)
51+
52+
## Task Completion
53+
54+
When completing tasks:
55+
1. Run `make fmt` to format code
56+
2. Run `make build` to ensure compilation
57+
3. Run `make test` to verify tests pass
58+
59+
The project requires age encryption tool and follows established CLI command patterns in main.ml.

bin/dune

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
(name main)
33
(public_name passage)
44
(package passage)
5-
(libraries cmdliner devkit lwt.unix passage qrc re2 unix)
6-
(preprocess
7-
(pps lwt_ppx)))
5+
(libraries cmdliner devkit passage qrc re2 unix))

0 commit comments

Comments
 (0)