Files
kebab/crates/kebab-store-vector/src/lib.rs
altair823 f1a448d6dc refactor(rename): kb → kebab — binary, env vars, XDG paths, file renames
두 번째 commit. 사용자 facing surface (CLI binary, env vars, XDG paths)
+ 코드 안 single-letter token (`KB_`, `kb.sqlite`, `/kb/`, tracing
target) 일괄 rename. 그리고 3 개 file rename:

- 디자인 doc `2026-04-27-kb-final-form-design.md` →
  `2026-04-27-kebab-final-form-design.md`
- 최초 보고서 `kb_local_rust_report.md` → `kebab_local_rust_report.md`
- workspace ignore `.kbignore` → `.kebabignore`

## 변경

- `crates/kebab-cli/Cargo.toml`: `[[bin]] name = "kb"` → `"kebab"`.
- `crates/kebab-cli/src/main.rs`: `#[command(name = "kb", …)]` →
  `name = "kebab"`.
- 모든 `KB_*` env var (코드 + doc + 테스트) → `KEBAB_*`. apply_env
  prefix 매칭 + 30+ 개 setting 키 모두.
- XDG paths: `~/.config/kb` / `~/.local/share/kb` / `~/.cache/kb` /
  `~/.local/state/kb` → `~/.config/kebab` 등. config defaults +
  expand_path tests + paths.rs 의 hardcode 모두.
- SQLite filename: `kb.sqlite` → `kebab.sqlite` (`SQLITE_FILE` const
  + 테스트 hardcode 모두).
- tracing target: `target: "kb-*"` → `"kebab-*"` (10+ 곳).
- snapshot fixture: `.kbignore` → `.kebabignore` (`fixtures/source-fs/
  tree-1.snapshot.json` 갱신).

## 검증

- `cargo test --workspace -j 1` clean (linker OOM 회피 위해 직렬).
- `cargo clippy --workspace --all-targets -- -D warnings` clean.

다음 commit 에서 docs sweep.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 04:01:35 +00:00

32 lines
1.5 KiB
Rust

//! `kb-store-vector` — LanceDB-backed [`kebab_core::VectorStore`] for kb.
//!
//! Stores per-model Lance tables under `config.storage.vector_dir/`
//! (`chunk_embeddings_<model>_<dim>.lance/`). `upsert` runs the
//! SQLite-first / Lance-second two-phase write described in design
//! §5.6: phase 1 stages `embedding_records` rows at `status='pending'`,
//! phase 2 issues a Lance `MergeInsert` keyed on `chunk_id`, phase 3
//! flips the rows to `status='committed'`. `search` joins against
//! `embedding_records WHERE status='committed'` so partial-write Lance
//! rows never surface to callers; if the process crashes between phase
//! 2 and phase 3 (or phase 2 itself fails), the next `upsert` call
//! retries the still-pending rows idempotently because Lance MergeInsert
//! dedupes on `chunk_id`.
//!
//! Sync / async bridge: `VectorStore` is a sync trait (§7.2) and
//! LanceDB's Rust API is async-only. We own a private current-thread
//! `tokio::runtime::Runtime` and `block_on` per trait method. The
//! tradeoff is documented inline; multi-thread runtime would let two
//! upserts run concurrently but kb-app's job scheduler already
//! serializes vector ops, and current-thread saves the two worker
//! threads a multi-thread runtime spawns by default.
//!
//! See `docs/superpowers/specs/2026-04-27-kebab-final-form-design.md`
//! §5.6 (embedding_records DDL), §6.3 (lancedb table naming),
//! §7.2 (VectorStore), §9 (versioning).
mod arrow_batch;
mod paths;
mod store;
pub use store::LanceVectorStore;