refactor: cargo workspace with core library + CLI crates - #3
Merged
Merged
Conversation
Refactor single-crate binary into a two-crate workspace: - crates/core/ (policycheck-core): Pure parsing library with no I/O deps. Modular checks under checks/ for robots.txt, RSL, Content Signals, TDM, and AI bot analysis. Publishable to crates.io. - crates/cli/ (policycheck): CLI binary + HTTP server. Owns network fetching, output formatting, and server types. Deployed to Fly. Also fixes: - AI bot wildcard bug: User-agent: * now correctly blocks all bots - Dockerfile updated for workspace layout - Core library trimmed to 4 deps (texting_robots, serde, serde_json, url) - Server types (AnalyzeRequest/Response) moved from core to CLI - Output formatting (table/csv/json) moved from core to CLI - 53 tests pass (35 core + 17 CLI + 1 doctest) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reflect the two-crate workspace layout (policycheck-core + policycheck CLI), update build/test commands, mark TDM and Content Signals as complete, and add library usage example to README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
policycheck-core(pure parsing library, 4 deps, publishable) andpolicycheck(CLI + HTTP server, deployed to Fly)analyzer.rsinto modular check modules undercrates/core/src/checks/(robots, RSL, Content Signals, TDM, AI bots)User-agent: *withDisallow: /now correctly reports all 26 bots as blocked (was reporting all as allowed)What changed
src/crates/core/+crates/cli/analyzer.rs(948 lines, does everything)robots.rs,rsl.rs,tdm.rs,content_signals.rs,ai_bots.rsAnalyzeRequest/AnalyzeResponsemoved to CLIoutput.rsmoved to CLIsrc/crates/, builds-p policycheckBug fix
User-agent: *withDisallow: /was not detected as blocking AI bots. Theis_mentionedcheck looked for each bot name in the user-agent list but didn't treat*as a wildcard matching all bots. Now fixed withhas_wildcardcheck + test.Test plan
cargo test --workspace— 53 tests pass (35 core + 17 CLI + 1 doctest)cargo clippy --workspace --all-targets— 0 warningscargo doc --workspace --no-deps— 0 warningsfly deploy— Dockerfile updated, verify on stagingPOST /analyzereturns same response shape as before🤖 Generated with Claude Code