This document defines the crates-focused equivalent of opensrc for Flow vendoring.
Keep Cargo as resolver/build authority while adding very fast local search across:
- first-party code (
src,crates,scripts,docs,tests), - vendored crates (
lib/vendor/*), - source metadata (
lib/vendor-manifest/*.toml+vendor.lock.toml).
This gives AI and humans a fast map of "what code do we own right now?" without remote lookups.
Vendoring gives full control, but it increases local code volume. Without a fast index, trim/rewrite/sync loops become slower.
Typesense indexing solves that by keeping an always-queryable local code/search layer.
Start local Typesense (shared launcher in ~/code/infra/base):
f vendor-typesense-setup # one-time install in flox if needed
f vendor-typesense-up
f vendor-typesense-statusBuild index:
f vendor-code-indexSearch code chunks:
f vendor-code-search "Router"
f vendor-code-search "serde_json" --scope vendor --crate reqwest
f vendor-code-search "spawn" --scope firstparty --lang rsSearch source inventory:
f vendor-code-search-sources "ratatui"
f vendor-code-search-sources "github.com" --limit 50Inspect raw inventory:
f vendor-code-sourcesThe index script (scripts/vendor/typesense_code_index.py) writes:
.vendor/typesense/sources.json:- opensrc-style local source inventory for vendored + first-party scopes.
- Typesense
<prefix>_sourcescollection:- per source (crate/repo) metadata: name, version, materialized path, upstream, checksum.
- Typesense
<prefix>_chunkscollection:- chunked code text + path + scope + crate + symbols + line ranges.
Default prefix is flow_code, so the default collections are:
flow_code_sourcesflow_code_chunks
vendor.lock.toml is the canonical vendored crate set.
lib/vendor-manifest/*.toml is the per-crate provenance and sync state.
The index script reads both, so every inhouse/sync/hydrate cycle can be followed by:
f vendor-code-indexThis keeps search aligned with the exact pinned state currently compiled by Cargo.
- Sync or inhouse crates (
vendor-control.sh,scripts/vendor/sync-*). - Re-index (
f vendor-code-index). - Search for dead APIs/deps/macros and trim targets (
f vendor-code-search ...). - Validate (
cargo check, vendoring verify gates). - Commit source churn in
flow-vendor, pin updates inflow.
- The indexer is local-first and does not replace Cargo metadata.
- Use
--dry-runfor large experiments before writing collections. - Use
--max-filesfor quick smoke indexing in CI/debug runs.