Skip to content

issue #1 initial commit. added clap detection and added tests#2

Open
alex-eli-white wants to merge 1 commit intodmriding:mainfrom
alex-eli-white:clap-names-1
Open

issue #1 initial commit. added clap detection and added tests#2
alex-eli-white wants to merge 1 commit intodmriding:mainfrom
alex-eli-white:clap-names-1

Conversation

@alex-eli-white
Copy link
Copy Markdown

PR fixes an issue where obfuscation breaks clap-based CLIs by renaming
identifiers that are part of the public interface.

What changes:

  • Detects clap derives: Parser, Subcommand, Args, ValueEnum
  • Preserves:
    • struct field names (CLI flags)
    • enum variant names (subcommands / value enums)
    • doc comments (used for --help output)
    • Integrates preservation into:
    • rename pass (blocklist)
    • strip pass (skip doc removal for clap-derived items)

Added test coverage using a clap-based fixture to verify:

  • roundtrip correctness
  • CLI surface remains intact after obfuscation

@alex-eli-white
Copy link
Copy Markdown
Author

Happy to rebase with signed commits if needed, lemme know.

@dmriding
Copy link
Copy Markdown
Owner

dmriding commented Apr 6, 2026

@alex-eli-white
Hey Alex, thanks for the contribution: the core feature logic looks solid and follows the issue spec well. A few things before we merge:

Blockers:

Unused import: use rand_chacha::rand_core::block; in src/passes/rename.rs is unused and will cause a compiler warning. Please remove it.

Rebase with signed commits: please rebase onto latest main and sign your commits. I just pushed rust-toolchain.toml and rustfmt.toml which pin the toolchain to 1.91.1 and rustfmt to edition 2024. After rebasing, run cargo fmt, this should eliminate the formatting drift and your diff should only contain your actual feature changes.

Suggestions:

Minor style: //build list of clap cli crate reserved names is missing a space after //.

Test coverage: the clap_preserves_interface test checks that names survive obfuscation, but doesn't verify the roundtrip (decrypt back to original). Consider adding that. Also, the semantic rename path got the clap integration but only the heuristic path is tested.

Overall the feature itself is clean and well-scoped, just needs these cleanups. Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants