Skip to content
Closed
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
9 changes: 6 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ Use idiomatic `clap` derive API patterns. Push validation into clap wherever pos
| `FILE` | | positional | Input binary (use `-` for stdin) |
| `--json` | `-j` | bool | Conflicts with `--yara` |
| `--yara` | | bool | Conflicts with `--json` |
| `--only-tags` | | `Vec<Tag>` | Repeatable, `value_parser = Tag::from_str` |
| `--no-tags` | | `Vec<Tag>` | Repeatable, runtime overlap check with `--only-tags` |
| `--only-tags` | | `Vec<Tag>` | Repeatable, `value_enum` (Tag derives `ValueEnum`) |
| `--no-tags` | | `Vec<Tag>` | Repeatable, runtime overlap check against the resolved include set (`--only-tags` plus the convenience flags) |
| `--imports` | | bool | Shorthand for `--only-tags import`; conflicts with `--only-tags`/`--raw`, compatible with `--no-tags` unless the excluded tag is in the include set |
| `--exports` | | bool | Shorthand for `--only-tags export`; conflicts with `--only-tags`/`--raw`, compatible with `--no-tags` unless the excluded tag is in the include set |
| `--symbols` | | bool | Shorthand for `--only-tags demangled` (DemangledSymbol only); conflicts with `--only-tags`/`--raw`, compatible with `--no-tags` unless the excluded tag is in the include set |
| `--min-len` | `-m` | `Option<usize>` | Custom parser enforces >= 1 |
| `--top` | `-t` | `Option<usize>` | Custom parser enforces >= 1 |
| `--enc` | | `Option<CliEncoding>` | utf8, utf16, utf16le, utf16be filter by stored encoding; `ascii` is content-based (matches pure-ASCII text that is not UTF-16, since extraction labels ASCII content as UTF-8) |
| `--raw` | | bool | Conflicts with `--only-tags`, `--no-tags`, `--top`, `--debug`, `--yara` |
| `--raw` | | bool | Conflicts with `--only-tags`, `--no-tags`, `--top`, `--debug`, `--yara`, `--imports`, `--exports`, `--symbols` |
| `--summary` | | bool | Conflicts with `--json`, `--yara`; runtime TTY check |
| `--debug` | | bool | Conflicts with `--raw` |

Expand Down
4 changes: 2 additions & 2 deletions GOTCHAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Changing default values in `ExtractionConfig::default()` requires updating asser
## CLI

- `clap::value_parser!(usize).range(..)` does not exist -- use a custom `fn(s: &str) -> Result<usize, String>` value parser for range-constrained `usize` args
- `Tag::from_str` in `value_parser` requires `use std::str::FromStr` in scope (clap resolves it as an associated fn, not a trait method)
- `--only-tags`/`--no-tags` use `value_enum` (Tag derives `clap::ValueEnum`); clap owns parsing and the help "possible values" list. `Tag`'s `FromStr` delegates to `ValueEnum` and its `Display` renders the canonical CLI name -- all sourced from the `#[value(name = ...)]` attributes, so add or change a tag name in one place
- CLI flag changes in `main.rs` require updating `tests/integration_cli.rs` (uses `Command` with flag names)
- `Tag::from_str` accepts lowercase (`"url"`) but serde serializes PascalCase (`"Url"`) for variants without `#[serde(rename)]` -- tests comparing JSON output must use case-insensitive comparison or the serialized form
- `--raw` mode performs extraction only and then early-exits: ranking, normalization, and pipeline-level classification are skipped. `tags` are cleared, `score` is forced to 0, and `display_score` is set to `Some(0)`. `assert_cmd` tests run piped (non-TTY); use `format_table_with_mode(&strings, &metadata, true)` to test TTY table rendering
Expand All @@ -32,7 +32,7 @@ Changing default values in `ExtractionConfig::default()` requires updating asser
- Short flags: `-j` (json), `-m` (min-len), `-t` (top). Do not add short flags for infrequent flags (--enc, --yara, --raw, --summary, --debug)
- `NO_COLOR` env var disables progress spinner. The spinner is also hidden when stderr is not a TTY
- `--enc ascii` is a CONTENT filter (`EncodingFilter::AsciiContent`), not a stored-encoding match. Extraction labels ASCII content as `Encoding::Utf8` (ASCII is a UTF-8 subset), so no row is ever `Encoding::Ascii`; `--enc ascii` matches rows whose `text.is_ascii()` and whose encoding is not UTF-16. `--enc utf8`/`--enc utf16*` still match the stored encoding. JSON output no longer emits `"encoding":"Ascii"` for narrow strings -- it emits `"Utf8"`
- Clap derive attributes (`long_help`, `about`, etc.) require string literals -- `const` values and `concat!` with consts do not work. The `cli_help_lists_all_canonical_tags` test in `integration_cli.rs` verifies help text stays in sync with `Tag::from_str()`
- Clap derive attributes (`long_help`, `about`, etc.) require string literals -- `const` values and `concat!` with consts do not work. The `cli_help_lists_all_canonical_tags` test in `integration_cli.rs` verifies the `ValueEnum`-generated "possible values" list in help contains every canonical tag name

## Dependencies

Expand Down
Loading
Loading