Compare commits
2 Commits
c0c43ddf20
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 88f1fdc3d0 | |||
| 460bb460bb |
@@ -0,0 +1,49 @@
|
|||||||
|
# Agent instructions
|
||||||
|
## Git Commit Style
|
||||||
|
- Make small, focused commits while working
|
||||||
|
- Commit changes incrementally to make history easier to follow
|
||||||
|
- Write clear, concise commit messages describing what changed
|
||||||
|
- Ask permission before commiting or merging to main branch
|
||||||
|
- When applicable, write tests before implementation
|
||||||
|
|
||||||
|
# Developer Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Unit tests (fast, no database required)
|
||||||
|
cargo test --lib
|
||||||
|
|
||||||
|
# Integration tests (requires test DB - run setup first)
|
||||||
|
cargo run -- db setup --env test
|
||||||
|
cargo test --tests
|
||||||
|
|
||||||
|
# Single test file
|
||||||
|
cargo test --test config_test
|
||||||
|
|
||||||
|
# CLI commands
|
||||||
|
cargo run -- db setup --env <dev|test|prod>
|
||||||
|
cargo run -- db reset --env <dev|test|prod>
|
||||||
|
cargo run -- import <csv-file> --env <dev|test|prod>
|
||||||
|
cargo run -- generate <csv-file> <output-dir>
|
||||||
|
```
|
||||||
|
|
||||||
|
# Config Loading
|
||||||
|
|
||||||
|
- Files: `config.toml` → `config.<env>.toml` → `config.example.toml` (fallback)
|
||||||
|
- Gitignored: `config.toml`, `config.dev.toml`, `config.test.toml`, `config.prod.toml`
|
||||||
|
- DB names: `rusty_petroleum_dev`, `rusty_petroleum_test`, `rusty_petroleum_prod`
|
||||||
|
|
||||||
|
# Architecture
|
||||||
|
|
||||||
|
- Binary: `src/main.rs`, Library: `src/lib.rs`
|
||||||
|
- Test entry: `tests/common/test_db.rs` creates fresh DB per test via `cargo test --test`
|
||||||
|
- Run lib tests first to verify logic without DB dependency
|
||||||
|
|
||||||
|
# Issue Management
|
||||||
|
|
||||||
|
- Use Gitea REST API to close issues:
|
||||||
|
```bash
|
||||||
|
curl -X PATCH https://gitea.rowanbrook.net/api/v1/repos/jakob/rusty-petroleum/issues/{issue_number} \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||||
|
-d '{"state": "closed"}'
|
||||||
|
```
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# Issue Management
|
|
||||||
- Use Gitea REST API to close issues when fixing them:
|
|
||||||
```bash
|
|
||||||
curl -X PATCH https://gitea.rowanbrook.net/api/v1/repos/jakob/rusty-petroleum/issues/{issue_number} \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
||||||
-d '{"state": "closed"}'
|
|
||||||
```
|
|
||||||
- Or suggest closing issues on Gitea web UI when automatic closing via API is not configured
|
|
||||||
|
|
||||||
@@ -263,6 +263,9 @@ fn parse_env_flag(args: &[String]) -> (Env, usize) {
|
|||||||
/// command without affecting positional argument parsing.
|
/// command without affecting positional argument parsing.
|
||||||
fn remove_env_flags(args: &[String]) -> Vec<String> {
|
fn remove_env_flags(args: &[String]) -> Vec<String> {
|
||||||
let (_, env_idx) = parse_env_flag(args);
|
let (_, env_idx) = parse_env_flag(args);
|
||||||
|
if env_idx == 0 {
|
||||||
|
return args.to_vec();
|
||||||
|
}
|
||||||
let mut result = Vec::with_capacity(args.len());
|
let mut result = Vec::with_capacity(args.len());
|
||||||
|
|
||||||
for (i, arg) in args.iter().enumerate() {
|
for (i, arg) in args.iter().enumerate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user