Skip to content

Commit 082cfed

Browse files
committed
Update AGENTS.md to reflect current project state
1 parent df6822c commit 082cfed

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ A secret is a newline-delimited paragraph within a vault.
2727

2828
## Repository Structure
2929

30-
- `main.go`: Application entry point.
31-
- `cmd/`: CLI command definitions (using Cobra).
30+
- `main.go`: Application entry point. Handles signal-safe cleanup of temporary files.
31+
- `cmd/`: CLI command definitions (using Cobra).
32+
- Uses option structs for flag management to isolate state.
3233
- `cmd.go`: Root command and core subcommands (`add`, `edit`, `search`).
3334
- `vaultcmd/`: Subcommands for vault management (`create`, `delete`, `list`, etc.).
3435
- `internal/`: Private application code.
35-
- `config/`: Configuration handling (environment variables).
36+
- `config/`: Configuration handling (environment variables). Functions return errors instead of using global state or exiting.
3637
- `crypto/`: Encryption and decryption logic.
3738
- `fs/`: Filesystem utilities (includes `CopyFile` for backups).
3839
- `prompt/`: Interactive CLI prompts (uses `golang.org/x/term` for passwords).
@@ -55,13 +56,14 @@ go test ./...
5556
Unit tests are located in `*_test.go` files within their respective packages.
5657

5758
### CI/CD
58-
- **GitHub Actions (`test.yml`)**: Automatically runs tests and `golangci-lint` on every push and PR to the `main` branch across Linux and macOS.
59+
- **GitHub Actions (`test.yml`)**: Automatically runs tests and `golangci-lint` (v2) on every push and PR to the `main` branch across Linux and macOS. Uses `golangci-lint-action`.
5960
- **Release Automation (`release.yml`)**: Uses **GoReleaser** to build and publish binaries when a `v*` tag is pushed.
6061

6162
## Tips for Agents
6263

64+
- **Error Handling:** All `internal` packages should return errors to the caller. Avoid `log.Fatal` or `os.Exit` inside libraries.
6365
- **Encryption during Tests:** When writing tests that involve encryption, you'll need a password. Ensure salts are at least 32 characters long.
64-
- **Temporary Files:** `mrs` creates a temporary directory for decrypted files during editing. This is cleaned up by `main.go` using a `defer` call to `fs.RemoveTempDir()`.
66+
- **Temporary Files:** `mrs` creates a temporary directory for decrypted files during editing. This is cleaned up by `main.go` using a signal-aware cleanup routine.
6567
- **Search Logic:** Search is performed on the first line of each secret by default. The `--full` flag enables searching the entire secret content.
6668
- **Modern Go:** Avoid `io/ioutil`. Use `os` or `io` instead.
6769
- **Term handling:** Use `golang.org/x/term` for terminal-related operations.

0 commit comments

Comments
 (0)