Skip to content

refactor: cargo workspace with core library + CLI crates - #3

Merged
jalexspringer merged 3 commits into
mainfrom
feat/workspace-wasm
Feb 17, 2026
Merged

jalexspringer merged 3 commits into
mainfrom
feat/workspace-wasm

Conversation

@jalexspringer

Copy link
Copy Markdown
Contributor

Summary

  • Refactors single-crate binary into a two-crate Cargo workspace: policycheck-core (pure parsing library, 4 deps, publishable) and policycheck (CLI + HTTP server, deployed to Fly)
  • Splits monolithic analyzer.rs into modular check modules under crates/core/src/checks/ (robots, RSL, Content Signals, TDM, AI bots)
  • Fixes AI bot wildcard bug: User-agent: * with Disallow: / now correctly reports all 26 bots as blocked (was reporting all as allowed)

What changed

Before After
Single crate, 7 modules in src/ Workspace: crates/core/ + crates/cli/
All deps in one Cargo.toml Core has 4 deps (no I/O); CLI owns reqwest, axum, comfy-table, csv
analyzer.rs (948 lines, does everything) Modular checks: robots.rs, rsl.rs, tdm.rs, content_signals.rs, ai_bots.rs
Server types in core AnalyzeRequest/AnalyzeResponse moved to CLI
Output formatting in core output.rs moved to CLI
Dockerfile copies src/ Dockerfile copies crates/, builds -p policycheck

Bug fix

User-agent: * with Disallow: / was not detected as blocking AI bots. The is_mentioned check looked for each bot name in the user-agent list but didn't treat * as a wildcard matching all bots. Now fixed with has_wildcard check + test.

Test plan

  • cargo test --workspace — 53 tests pass (35 core + 17 CLI + 1 doctest)
  • cargo clippy --workspace --all-targets — 0 warnings
  • cargo doc --workspace --no-deps — 0 warnings
  • fly deploy — Dockerfile updated, verify on staging
  • Verify POST /analyze returns same response shape as before

🤖 Generated with Claude Code

jalexspringer and others added 3 commits February 17, 2026 15:03
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>
@jalexspringer
jalexspringer merged commit 46a3883 into main Feb 17, 2026
12 checks passed
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.

1 participant