Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cursor/commands/simplicity_review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Follow the steps in the .github/prompt/simplicity-review.prompt.md file to review the code for simplicity.
36 changes: 36 additions & 0 deletions .github/prompt/simplicity-review.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
CODE SIMPLIFICATION REVIEW

Start by examining the uncommitted changes in the current codebase.

ANALYSIS STEPS:

1. Identify what files have been modified or added
2. Review the actual code changes
3. Apply simplification principles below
4. Refactor directly, then show what you changed

SIMPLIFICATION PRINCIPLES:

Complexity Reduction:

- Remove abstraction layers that don't provide clear value
- Replace complex patterns with straightforward implementations
- Use language idioms over custom abstractions
- If a simple function/lambda works, use it—don't create classes

Test Proportionality:

- Keep only tests for critical functionality and real edge cases
- Delete tests for trivial operations, framework behavior, or hypothetical scenarios
- For small projects: aim for \<10 meaningful tests per feature
- Test code should be shorter than implementation

Idiomatic Code:

- Use conventional patterns for the language
- Prioritize readability and maintainability
- Apply the principle of least surprise

Ask yourself: "What's the simplest version that actually works reliably?"

Make the refactoring changes, then summarize what you simplified and why. Always finish by running `just ci-check` and ensuring that all checks and tests remain green.
13 changes: 13 additions & 0 deletions .kiro/hooks/code-review-refactor.kiro.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"enabled": true,
"name": "Code Simplicity Checker",
"description": "When the agent finishes its work, automatically trigger a comprehensive code review to eliminate unnecessary complexity, refactor for simplicity, reduce test bloat, and verify idiomatic style before finalizing any code changes",
"version": "1",
"when": {
"type": "agentStop"
},
"then": {
"type": "askAgent",
"prompt": "CODE SIMPLIFICATION REVIEW\n\nStart by examining the uncommitted changes in the current codebase.\n\nANALYSIS STEPS:\n1. Identify what files have been modified or added\n2. Review the actual code changes\n3. Apply simplification principles below\n4. Refactor directly, then show what you changed\n\nSIMPLIFICATION PRINCIPLES:\n\nComplexity Reduction:\n- Remove abstraction layers that don't provide clear value\n- Replace complex patterns with straightforward implementations\n- Use language idioms over custom abstractions\n- If a simple function/lambda works, use it—don't create classes\n\nTest Proportionality:\n- Keep only tests for critical functionality and real edge cases\n- Delete tests for trivial operations, framework behavior, or hypothetical scenarios\n- For small projects: aim for <10 meaningful tests per feature\n- Test code should be shorter than implementation\n\nIdiomatic Code:\n- Use conventional patterns for the language\n- Prioritize readability and maintainability\n- Apply the principle of least surprise\n\nAsk yourself: \"What's the simplest version that actually works reliably?\"\n\nMake the refactoring changes, then summarize what you simplified and why. Always finish by running `just ci-check` and ensuring that all checks and tests remain green."
}
}
84 changes: 84 additions & 0 deletions .kiro/steering/rust/cargo-toml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
inclusion: fileMatch
fileMatchPattern: [Cargo.toml]
---

# Cargo.toml Standards for Stringy

## Package Configuration

- Use **Rust 2024 Edition** (MSRV: 1.91+) as specified in the package
- Single crate structure (not a workspace)
- Enforce lint policy via `[lints.rust]` configuration
- Forbid unsafe code globally
- Deny all warnings to preserve code quality

Example `Cargo.toml` structure:

```toml
[package]
name = "stringy"
version = "0.1.0"
edition = "2024"
authors = ["UncleSp1d3r <unclesp1d3r@evilbitlabs.io>"]
description = "A smarter alternative to the strings command that leverages format-specific knowledge"
license = "Apache-2.0"
repository = "https://github.com/EvilBit-Labs/StringyMcStringFace"
homepage = "http://evilbitlabs.io/StringyMcStringFace/"
keywords = ["binary", "strings", "analysis", "reverse-engineering", "malware"]
categories = ["command-line-utilities", "development-tools"]

[lib]
name = "stringy"
path = "src/lib.rs"

[[bin]]
name = "stringy"
path = "src/main.rs"

[lints.rust]
unsafe_code = "forbid"
warnings = "deny"
```

## Dependencies

- **Core dependencies**:

- `clap = { version = "4.5", features = ["derive"] }` - CLI argument parsing
- `goblin = "0.10"` - Binary format parsing (ELF, PE, Mach-O)
- `serde = { version = "1.0", features = ["derive"] }` - Serialization
- `serde_json = "1.0"` - JSON output
- `thiserror = "2.0"` - Structured error types

- **Dev dependencies**:

- `criterion = "0.7"` - Benchmarking
- `insta = "1.0"` - Snapshot testing
- `tempfile = "3.8"` - Temporary file handling in tests

## Build Profiles

- Use `[profile.dist]` for distribution builds with LTO:

```toml
[profile.dist]
inherits = "release"
lto = "thin"
```

## Benchmarks

- Define benchmarks in `[[bench]]` sections:

```toml
[[bench]]
name = "elf"
harness = false
```

## Package Metadata

- Include proper license (Apache-2.0)
- Provide clear description for binary analysis tool
- Include relevant keywords for discoverability
80 changes: 80 additions & 0 deletions .kiro/steering/rust/configuration-management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
inclusion: fileMatch
fileMatchPattern: ['**/config*.rs', '**/*config*.rs']
---

# Configuration Management Standards for Stringy

## Configuration Architecture

Stringy uses **CLI arguments only** for configuration via `clap`:

- **Command-line flags** (only source of configuration)
- **No configuration files** - all options specified via CLI
- **No environment variables** - use CLI flags instead
- **No hierarchical configuration** - simple argument parsing

## CLI Configuration

Define CLI arguments using `clap` with derive macros:

```rust
use clap::Parser;
use std::path::PathBuf;

#[derive(Parser)]
#[command(name = "stringy")]
#[command(about = "Extract meaningful strings from binary files")]
struct Cli {
/// Input binary file to analyze
#[arg(value_name = "FILE")]
input: PathBuf,

/// Minimum string length
#[arg(short, long, default_value_t = 4)]
min_len: usize,

/// Output format (json, text, yara)
#[arg(short, long, default_value = "text")]
format: String,

/// Only extract strings matching specific tags
#[arg(long)]
only: Option<Vec<String>>,
}
```

## Configuration Validation

Validate CLI arguments:

```rust
impl Cli {
pub fn validate(&self) -> Result<(), StringyError> {
if self.min_len < 1 {
return Err(StringyError::ConfigError(
"Minimum string length must be at least 1".to_string(),
));
}

let valid_formats = ["json", "text", "yara"];
if !valid_formats.contains(&self.format.as_str()) {
return Err(StringyError::ConfigError(format!(
"Invalid output format: {}. Must be one of: {:?}",
self.format, valid_formats
)));
}

Ok(())
}
}
```

## No File-Based Configuration

Stringy intentionally does not support configuration files to keep it simple and portable:

- All configuration comes from CLI arguments
- No need to manage config file locations
- Works the same way across all environments
- Easier to use in scripts and pipelines
Loading
Loading