Skip to content

Please consider adding a library build - #185

Closed
vizanto wants to merge 2 commits into
thehoff:developfrom
vizanto:develop
Closed

vizanto wants to merge 2 commits into
thehoff:developfrom
vizanto:develop

Conversation

@vizanto

@vizanto vizanto commented Jun 1, 2026

Copy link
Copy Markdown

I wanted to use rtk in my Rust based harness and found your fork doing even more 😄

Please consider exporting a library so I don't have to maintain this fork of fork 🙏

vizanto added 2 commits May 31, 2026 22:58
The library crate exposed src/core through src/lib.rs, but core::toml_filter references crate::hooks::trust and hook modules reference crate::discover helpers. Those modules existed only in the binary crate root, so `cargo test --lib --tests output_summary` failed before Jcode could depend on the library API.

Add discover and hooks as private library modules. This keeps the intended public API unchanged while making the exposed core module compile.
noogalabs pushed a commit to noogalabs/contextcrawler that referenced this pull request Jun 4, 2026
rtk lint was always returning exit code 0 regardless of the underlying
linter's exit status, causing false-green CI behavior when lint should fail.

Uses !output.status.success() pattern consistent with all other RTK modules,
which correctly handles both non-zero exit codes and signal termination.

Fixes thehoff#185

Co-authored-by: Claude Opus 4.6 <[email protected]>
@thehoff

thehoff commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Looking into it now

@thehoff

thehoff commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Having a good look now, keen to do this but I am also breaking the tool often to keep moving forward both security and caching value so I want to make sure I can keep my Dev speed up but give a suitably stable api

@thehoff

thehoff commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Keen to have a look at your harness too!

thehoff added a commit that referenced this pull request Jun 7, 2026
… pivot

Tag the current develop as the fork's first own release (contextcrawler-v0.2.0),
bundling the 2026-06-06 fix batch + the first external community contribution
(library build, PR #185 by Danny Wilson). This is the baseline we branch the
"CLI consumes the library" pivot from.

Bumps Cargo 0.1.10 -> 0.2.0 (fork's own version line; upstream rtk v0.x tags are
unrelated, hence the fork-namespaced tag). CHANGELOG [0.2.0] documents:
- SECURITY: rtk-ai#2286 never-auto-allow + the live-path Ask fix.
- FIXED: tsc/mypy/next lying-success filters.
- PERF: grep/find 40->67%, rtk-ai#2289 decorator strip.
- ADDED: library MVP (output_summary + lib.rs), with the dead-code caveat that
  the bin does not yet consume the lib (next-release work).

council-reviewed (metadata-only, approved). No source changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thehoff added a commit that referenced this pull request Jun 7, 2026
Expose a small, documented public API so downstream Rust tools can embed the
filters/summariser without spawning the CLI (PR #185 use-case).

- src/api.rs: filter_output(name, raw) (named filter, panic-safe, raw on unknown),
  auto_filter_output(raw) (content auto-detect), available_filters() (discovery).
  Wraps the existing pipe machinery; resolve_filter/auto_detect_filter/apply_filter
  narrowed to pub(crate). Exit-blind, mirroring `contextcrawler pipe`.
- lib.rs: crate-level rustdoc + a no_run usage doctest + an EXPERIMENTAL / not
  semver-guaranteed banner; pub use of the api fns.
- core hidden from the curated docs (#[doc(hidden)] pub mod core) while keeping
  its ~24 internal doctests compiling.

cargo doc renders the curated surface (run, summarize_command_output,
CommandOutputSummaryOptions, no_bloat, filter_output, auto_filter_output,
available_filters) without core. Dead-code still 0. 3050 tests pass (7 pre-existing
hooks::integrity /tmp env; the lone pre-existing TimedExecution doctest is
unrelated). council-reviewed (codex + mmax): panic-safe, visibility scoped, ship.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thehoff added a commit that referenced this pull request Jun 7, 2026
Proper lib + bin: the binary is a thin shim over contextcrawler run(), so the
CLI dogfoods the library. Curated experimental embedder API: filter_output,
auto_filter_output, available_filters, summarize_command_output, no_bloat,
plus crate rustdoc. Internals private; core doc-hidden. Dead-code 473 to 0.
Completes PR #185. No CLI behaviour change. See CHANGELOG 0.4.0. 3050 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@thehoff

thehoff commented Jun 7, 2026

Copy link
Copy Markdown
Owner

The library pivot you asked for has shipped in 0.4.0.

ContextCrawler is now a proper lib + bin: the binary is a thin shim over the
library, so the CLI dogfoods the exact code path you would embed. Your
output_summary extraction is carried in and credited; the full bin-consumes-lib
refactor went a bit further than the thin lib.rs in this PR, so the diff here is
superseded by that work, but it is the reason it happened.

Public API (experimental, not yet semver-guaranteed):

  • summarize_command_output(output, CommandOutputSummaryOptions)
  • filter_output(name, raw) / auto_filter_output(raw) / available_filters()
  • no_bloat(baseline, filtered)

Embed via a git dependency (no crates.io yet: that waits for a stable 1.0 API):

contextcrawler = { git = "https://github.com/thehoff/contextcrawler", tag = "contextcrawler-v0.4.0" }

Docs: docs/guide/library.md + docs/guide/architecture.md.

Leaving this open rather than closing it: keen to hear if the surface covers your
harness's use case, or if you need more of the internals exposed. Thanks for the
nudge that turned the fork into an actual library.

@vizanto

vizanto commented Jun 7, 2026

Copy link
Copy Markdown
Author

Thank you! Really appreciate it

@thehoff thehoff closed this Jun 10, 2026
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