Compare commits

..

2 Commits

Author SHA1 Message Date
jakob 88f1fdc3d0 Move agent settings to opencode dir 2026-04-10 15:00:53 +02:00
jakob 460bb460bb Fix: CLI generate command works with single invocation
The remove_env_flags function was incorrectly returning index 0 when no --env
flag was present, causing it to mistakenly skip the first argument
(program name) and shift all arguments incorrectly.

This required users to specify 'generate' twice to make the CLI work.

Fix by checking if --env was actually found (env_idx > 0) before removing
any arguments from the list.
2026-04-10 14:05:46 +02:00
3 changed files with 52 additions and 10 deletions
+49
View File
@@ -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"}'
```
-10
View File
@@ -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
+3
View File
@@ -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() {