Skip to content

Commit 3081fc9

Browse files
committed
docs: enhance AGENTS.md and related documentation for clarity and structure
- Updated AGENTS.md to provide clearer guidance for AI coding assistants, including rules of engagement, file priority order, and critical restrictions. - Revised project overview to emphasize Gold Digger as a production-ready Rust CLI tool for MySQL/MariaDB queries, detailing its architecture and command examples. - Improved formatting and consistency across various documentation files, ensuring better usability and understanding for contributors. These updates aim to enhance the documentation's clarity and provide a more structured approach to development practices within the Gold Digger project.
1 parent d05422e commit 3081fc9

17 files changed

Lines changed: 236 additions & 104 deletions

File tree

.cursor/rules/rust-best-practices.mdc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description:
33
globs:
44
alwaysApply: true
55
---
6+
67
# Rust Best Practices for gold_digger
78

89
## Project Structure
@@ -71,7 +72,7 @@ just security # cargo audit (advisory)
7172

7273
Required for all public functions using `///`:
7374

74-
```rust
75+
````rust
7576
/// Converts MySQL rows to string vectors for output formatting.
7677
///
7778
/// # Arguments
@@ -89,7 +90,7 @@ Required for all public functions using `///`:
8990
pub fn rows_to_strings(rows: Vec<mysql::Row>) -> anyhow::Result<Vec<Vec<String>>> {
9091
// Implementation
9192
}
92-
```
93+
````
9394

9495
## Code Style
9596

@@ -108,6 +109,7 @@ pub fn rows_to_strings(rows: Vec<mysql::Row>) -> anyhow::Result<Vec<Vec<String>>
108109

109110
- Pin dependency versions in [`Cargo.toml`](mdc:Cargo.toml) and use minimal required features for each crate
110111
- Use optional dependencies and features for extensibility (e.g., additional MySQL types, output formats)
112+
- Use context7 website or MCP tool to get current documentation for APIs and crates
111113

112114
## Testing Guidelines
113115

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ cargo test
224224
- [ ] Use conventional commit format
225225
- [ ] Suggest small, focused diffs for single-maintainer workflow
226226
- [ ] Use `gh` CLI for GitHub interactions
227+
- [ ] Use context7 website or MCP tool to get current documentation for APIs and crates
227228
- [ ] Link to WARP.md/AGENTS.md for comprehensive context
228229

229230
## References

.kiro/specs/integration-testing-enhancement/tasks.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
- Add support for generating certificates using LibreSSL on macOS and Linux
8585
- _Requirements: 1.1, 1.2, 1.3, 1.5, 9.3_
8686

87-
- [x] 1.3 Create TLS certificate management and test database schema system
87+
- [ ] 1.3 Create TLS certificate management and test database schema system
8888

8989
- ✓ Basic TLS certificate handling exists in `tests/tls_integration.rs` (need to move to fixtures)
9090
- Create `tests/fixtures/tls/` directory with test SSL certificates for TLS-enabled containers
@@ -96,15 +96,15 @@
9696
- Add database-specific compatibility handling for MySQL vs MariaDB differences
9797
- _Requirements: 1.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 9.3_
9898

99-
- [ ] 1.3.1 Set up TLS certificate fixtures and management
99+
- [x] 1.3.1 Set up TLS certificate fixtures and management
100100

101101
- Create `tests/fixtures/tls/` directory structure
102102
- Move existing TLS certificate constants from `tests/tls_integration.rs` to fixture files
103103
- Generate self-signed CA certificate and server certificates for testing
104104
- Create certificate loading utilities for container configuration
105105
- Add certificate validation helpers for TLS connection tests
106106

107-
- [ ] 1.3.1.1 Replace certificate generation logic with rcgen crate
107+
- [x] 1.3.1.1 Replace certificate generation logic with rcgen crate
108108

109109
- Add `rcgen` crate to dev-dependencies in `Cargo.toml` for X.509 certificate generation
110110
- Replace existing hardcoded certificate constants with `rcgen::generate_simple_self_signed()`
@@ -116,6 +116,16 @@
116116
- Ensure generated certificates are compatible with MySQL/MariaDB TLS requirements
117117
- _Requirements: 1.2, 1.3, 9.3_
118118

119+
- [ ] 1.3.1.2 Replace libc disk space check with sysinfo crate
120+
121+
- Replace unsafe `libc::statvfs()` calls in `tests/integration/containers.rs::check_disk_space()`
122+
with `sysinfo` crate
123+
- Remove platform-specific conditionals and manual `df` command parsing fallback
124+
- Add `sysinfo = "0.36"` to `[dev-dependencies]` and remove `libc = "0.2"`
125+
- Use `sysinfo::System::new_all()` with `refresh_disks()` for cross-platform disk space checking
126+
- Look for `/tmp` mount point first, fallback to first available disk
127+
- _Requirements: 1.2, 1.3, 9.3_
128+
119129
- [ ] 1.3.2 Create comprehensive test database schema
120130

121131
- Write `tests/fixtures/schema.sql` with all MySQL/MariaDB data types

.kiro/steering/project/core-concepts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ just security # cargo audit (advisory)
126126
- **Clippy warnings**: Zero tolerance (`-D warnings`)
127127
- **Error handling**: Use `anyhow` for applications, `thiserror` for libraries
128128
- **Documentation**: Doc comments (`///`) required for all public functions
129+
- Use context7 website or MCP tool to get current documentation for APIs and crates
129130

130131
### Testing Requirements
131132

.mdformat.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ exclude = [
99
"docs/src/SUMMARY.md",
1010
"docs/src/usage/output-formats.md",
1111
"rust_migration/index.md",
12+
"target/**",
13+
"megalinter-reports/**",
1214
]
1315
validate = true
1416
number = true

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ COPYING*
6868
# Autogenerated files
6969
.github/workflows/release.yml
7070
**/*.wxs
71+
**/*.mdc

AGENTS.md

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,67 @@
11
# AGENTS.md
22

3-
This file provides guidance for AI assistants working with the Gold Digger codebase.
3+
This file provides guidance for AI coding assistants working with the Gold Digger Rust codebase.
4+
5+
## Rules of Engagement for AI Assistants
6+
7+
### File Priority Order
8+
9+
Always consult these files in order when working with this codebase:
10+
11+
1. **AGENTS.md** (this file) - Primary AI assistant guidance
12+
2. **GEMINI.md** - Gemini-specific overrides (if present)
13+
3. **.cursor/rules/**/\*.mdc\*\* - Cursor-specific rules (if present)
14+
15+
### Critical Restrictions
16+
17+
- **NEVER** commit code, switch branches, or alter git settings without explicit maintainer
18+
permission
19+
- **NEVER** log raw `DATABASE_URL`, connection strings, or credentials
20+
- **NEVER** use direct MySQL row indexing: `row[index]` or `mysql::from_value::<String>()`
21+
- **ALWAYS** ask clarifying questions before making risky changes
22+
- **ALWAYS** run `just check` and validate changes before proposing them
23+
24+
### Change Proposals
25+
26+
- Present changes as unified diffs, not direct file modifications
27+
- Include test updates when adding features
28+
- Run `just ci-full` locally when feasible to validate changes
29+
- Use context7 website or MCP tool to get current documentation for APIs and crates
30+
31+
### Review Process
32+
33+
- This project prefers **CodeRabbit.ai** for code review
34+
- Do **NOT** enable GitHub Copilot auto-review in pull requests
35+
- Maintainer: **UncleSp1d3r** (single-maintainer workflow)
436

537
## Project Overview
638

7-
Gold Digger is a Rust-based MySQL/MariaDB query tool that outputs results in CSV, JSON, or TSV
8-
formats. It's designed for headless operation via environment variables, making it ideal for
9-
database automation workflows.
39+
Gold Digger is a production-ready Rust CLI tool for MySQL/MariaDB database queries with structured
40+
output (CSV, JSON, TSV). It features comprehensive CLI interface, rustls-only TLS, and safe data
41+
type handling.
42+
43+
**Current Architecture (v0.2.6):**
44+
45+
- CLI-first with environment variable fallbacks using `clap`
46+
- Rustls-only TLS implementation (no OpenSSL dependencies)
47+
- Safe MySQL value conversion with NULL handling
48+
- Structured exit codes and error handling
49+
- Modular output format system
50+
51+
**Command Examples:**
1052

11-
**Key Characteristics:**
53+
```bash
54+
# CLI interface (preferred)
55+
gold_digger --db-url "mysql://user:pass@host:3306/db" \
56+
--query "SELECT id, name FROM users" \
57+
--output results.json --pretty
1258

13-
- CLI-first (uses Clap) with environment variable overrides
14-
- Outputs to structured formats based on file extension
15-
- Fully materialized result sets (no streaming)
16-
- Single-maintainer project by UncleSp1d3r
17-
- Under active development toward v1.0
59+
# Environment variables (legacy support)
60+
DATABASE_URL="mysql://user:pass@host:3306/db" \
61+
DATABASE_QUERY="SELECT * FROM table" \
62+
OUTPUT_FILE="/tmp/data.csv" \
63+
cargo run --release
64+
```
1865

1966
## 🚨 Critical Safety Rules
2067

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ url = "2.5.7"
4848
rustls = { version = "0.23.31", features = ["ring"] }
4949
rustls-native-certs = "0.8.1"
5050
rustls-pemfile = "2.2.0"
51+
regex = "1.11.1"
5152

5253

5354
[dev-dependencies]
@@ -56,10 +57,10 @@ tempfile = "3.21.0"
5657
assert_cmd = "2.0.17"
5758
insta = "1.43.1"
5859
temp-env = "0.3.6"
59-
regex = "1.11.1"
60+
regex = "1.11.2"
6061
rustls = { version = "0.23.31", features = ["ring"] }
6162
serde_json = "1.0.143"
62-
rcgen = "0.13.1"
63+
rcgen = "0.14.3"
6364
time = { version = "0.3", features = ["macros"] }
6465

6566
[target.'cfg(unix)'.dev-dependencies]

GEMINI.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ println!("Connecting to database...");
162162

163163
```toml
164164
default = ["json", "csv", "additional_mysql_types", "verbose"]
165-
json = [] # JSON output format
166-
csv = [] # CSV output format
167-
additional_mysql_types = [...] # BigDecimal, Decimal, etc.
168-
verbose = [] # Conditional logging
165+
json = [] # JSON output format
166+
csv = [] # CSV output format
167+
additional_mysql_types = [
168+
"mysql_common?/bigdecimal",
169+
] # BigDecimal, Decimal, etc.
170+
verbose = [] # Conditional logging
169171
```
170172

171173
**TLS Implementation Notes:**
@@ -224,6 +226,7 @@ cargo run --release
224226
3. **Target small, reviewable changes** for single-maintainer workflow
225227
4. **Consider streaming implications** for future compatibility
226228
5. **Maintain offline-first principles** - no external service calls
229+
6. **Use context7 website or MCP tool** to get current documentation for APIs and crates
227230

228231
### Testing Recommendations
229232

0 commit comments

Comments
 (0)