12 add magic file format detection subtask 143#25
Conversation
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Add apprentice_magic_strength algorithm port from libmagic - Implement strength modifier parsing with !:strength syntax - Calculate default strength based on rule specificity - Store strength in MagicRule structure for evaluation - Update rule sorting by strength during evaluation - Add unit tests for strength parsing and calculation - Integrate strength into confidence scoring and rule ordering Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
|
Caution Review failedFailed to post review comments Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughAdds extensive documentation and planning for a Phase 1 MVP, a new CONTRIBUTING guide, tooling/config updates (VSCode, mise.toml, rust-toolchain, Cargo), CI/workflow consolidation to jdx/mise-action@v3, justfile reorganizations, and minor repo infra edits. Mostly docs and infra/config changes; no broad API-breaking code changes reported. Changes
Sequence Diagram(s)(omitted — changes are primarily documentation and infra; no new multi-component control flow added that requires sequence visualization) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
chore(mise): update Rust and add new tools for formatting and auditing Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Move Rust components (llvm-tools-preview) to mise.toml - Add mdformat with plugins via mise pipx backend - DRY up GoReleaser and coverage recipes with private helpers - Remove unused recipes (cd-root, help, test-justfile, test-fs) - Simplify format-docs using mdformat's built-in --exclude - Update dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Ensure 'quality' job is a dependency for 'test' - Ensure 'test' job is a dependency for 'test-cross-platform' Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
No docs use YAML front matter, so this preprocessor is unnecessary and was causing CI issues. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
* feat(docs): add contribution guidelines and update architecture diagrams Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * style(toml): format spacing and alignment in dist-workspace.toml Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(vscode): update ruff configuration paths in settings Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(parser): implement libmagic strength calculation and parsing - Add apprentice_magic_strength algorithm port from libmagic - Implement strength modifier parsing with !:strength syntax - Calculate default strength based on rule specificity - Store strength in MagicRule structure for evaluation - Update rule sorting by strength during evaluation - Add unit tests for strength parsing and calculation - Integrate strength into confidence scoring and rule ordering Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(docs): update documentation for phase 1 MVP enhancements Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * style(docs): format spacing and alignment in book.toml Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(tools): add tools configuration for project dependencies Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: upgrade checkout action to v6 and add mise-action Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(ci): replace rustfmt action with just fmt-check command chore(mise): update Rust and add new tools for formatting and auditing Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * refactor(justfile): streamline cross-platform helper commands Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore: simplify justfile and mise.toml tooling - Move Rust components (llvm-tools-preview) to mise.toml - Add mdformat with plugins via mise pipx backend - DRY up GoReleaser and coverage recipes with private helpers - Remove unused recipes (cd-root, help, test-justfile, test-fs) - Simplify format-docs using mdformat's built-in --exclude - Update dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * ci: update job dependencies for test and coverage workflows - Ensure 'quality' job is a dependency for 'test' - Ensure 'test' job is a dependency for 'test-cross-platform' Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(deps): update Rust version to 1.91.0 in configuration Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * fix: remove unused mdbook-yml-header preprocessor No docs use YAML front matter, so this preprocessor is unnecessary and was causing CI issues. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: add .gitignore and project.yml for configuration Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(docs): update repository URL in documentation files Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> --------- Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…er support (#26) * chore(settings): enable collapse walkthrough in reviews Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(deps): update dependabot configuration for clarity Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(devcontainer): add initial configuration for Rust development Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * 12 add magic file format detection subtask 143 (#25) * feat(docs): add contribution guidelines and update architecture diagrams Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * style(toml): format spacing and alignment in dist-workspace.toml Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(vscode): update ruff configuration paths in settings Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(parser): implement libmagic strength calculation and parsing - Add apprentice_magic_strength algorithm port from libmagic - Implement strength modifier parsing with !:strength syntax - Calculate default strength based on rule specificity - Store strength in MagicRule structure for evaluation - Update rule sorting by strength during evaluation - Add unit tests for strength parsing and calculation - Integrate strength into confidence scoring and rule ordering Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(docs): update documentation for phase 1 MVP enhancements Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * style(docs): format spacing and alignment in book.toml Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(tools): add tools configuration for project dependencies Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: upgrade checkout action to v6 and add mise-action Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(ci): replace rustfmt action with just fmt-check command chore(mise): update Rust and add new tools for formatting and auditing Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * refactor(justfile): streamline cross-platform helper commands Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore: simplify justfile and mise.toml tooling - Move Rust components (llvm-tools-preview) to mise.toml - Add mdformat with plugins via mise pipx backend - DRY up GoReleaser and coverage recipes with private helpers - Remove unused recipes (cd-root, help, test-justfile, test-fs) - Simplify format-docs using mdformat's built-in --exclude - Update dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * ci: update job dependencies for test and coverage workflows - Ensure 'quality' job is a dependency for 'test' - Ensure 'test' job is a dependency for 'test-cross-platform' Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(deps): update Rust version to 1.91.0 in configuration Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * fix: remove unused mdbook-yml-header preprocessor No docs use YAML front matter, so this preprocessor is unnecessary and was causing CI issues. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: add .gitignore and project.yml for configuration Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(docs): update repository URL in documentation files Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> --------- Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * feat(parser): enhance magic file parsing and format detection Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(parser): add magic file format detection support Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * docs(agents): add guidelines for emoji usage in code and docs Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * test(cli): add snapshot for canonical CLI test failures Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * docs: update commit message style guidelines for clarity and consistency Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * docs(readme): update project status and feature overview Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci(release): update GitHub Actions to use latest versions of actions Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: replace Rustfmt check command with action Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: add rustfmt and clippy components to toolchain setup Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: update Rust toolchain components for CI workflow Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * style(mise): remove extra space in rust components list Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(deps): remove default component from Rust toolchain configuration Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: add dependency conditions for quality checks Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(ci): disable compatibility tests in workflow Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * fix(evaluator): replace panic with Result in decrement_recursion_depth Convert `decrement_recursion_depth()` from a panicking function to one that returns `Result<(), LibmagicError>`. This addresses the critical issue where a programming error in recursion tracking would crash the entire application instead of returning a recoverable error. Changes: - Add `InternalError` variant to `EvaluationError` for internal logic errors - Add `internal_error()` constructor method - Update `decrement_recursion_depth()` to return `Result` - Update all call sites to use `?` operator or `.unwrap()` in tests - Convert `#[should_panic]` test to check for error result instead Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(docs): correct documentation inaccuracies and improve error handling Address high-priority issues from PR review: Documentation fixes: - Remove non-existent `start_time` field from EvaluationContext docs - Fix MatchResult value type: `Value` not `Vec<u8>` - Update security claims in load_magic_file() to be accurate - Remove outdated "placeholder" warnings from getting-started.md - Fix test count claims: 650+ tests (was inconsistent 745+/200+) Error handling improvements: - Return error when ALL files in directory fail to parse - Track parse failures and provide detailed error messages - Add tests for all-files-fail and partial-failure scenarios Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): use cargo fmt directly instead of rustfmt action The actions-rust-lang/rustfmt@v1 action uses its own rustfmt binary which doesn't properly respect the mise-installed toolchain or the project's rustfmt.toml configuration (edition = "2024"). Replace with a direct `cargo fmt --check` command which uses the mise-installed rust toolchain consistently. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore(deps): add cargo-fmt to rust components in mise.toml Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: replace cargo fmt and clippy commands with just lint-rust Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * fix(ci): simplify job dependencies for test and coverage Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: disable caching for mise-action in CI workflow Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * ci: update rust-toolchain components and enable caching Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * fix(ci): correct rust-toolchain components syntax in CI config Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> --------- Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This pull request introduces major documentation and configuration updates to support the Phase 1 MVP of
libmagic-rs. The changes focus on contributor onboarding, project planning, CLI enhancements, and build-time support for built-in magic rules. These improvements clarify project architecture, establish development standards, and outline the technical approach for key upcoming features.Documentation and Contributor Experience:
CONTRIBUTING.mdguide detailing code standards, testing, documentation, branching, and error handling for all contributors.docs/plan/phase_1_mvp/specs/Epic_Brief__libmagic-rs_Phase_1_MVP.md) outlining the goals, context, scope, and value proposition for the Phase 1 MVP, including compatibility, safety, and documentation requirements.Technical Planning for Core Features:
docs/plan/phase_1_mvp/tickets/Built-in_Rules__Build-Time_Compilation_&_Fallback.md), describing the use of a build script, fallback rules, and new APIs for rule loading.docs/plan/phase_1_mvp/tickets/CLI_Enhancements__Multiple_Files,_Stdin,_Magic_Discovery.md) including support for multiple files, stdin, improved magic file discovery, new flags (--use-builtin,--strict), and robust error/output handling. (docs/plan/phase_1_mvp/tickets/CLI_Enhancements__Multiple_Files,_Stdin,_Magic_Discovery.mdR1-R241)Development Environment Improvements:
.vscode/settings.jsonto configureruffand Python interpreter paths for consistent linting and formatting in the development environment.Miscellaneous:
dist-workspace.tomlfor release configuration.These changes lay the groundwork for the next development phase, ensuring clarity, maintainability, and a strong foundation for new features and contributor engagement.