두 번째 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>
54 lines
1.8 KiB
Rust
54 lines
1.8 KiB
Rust
//! Real-Ollama integration tests, gated behind `#[ignore]`.
|
|
//!
|
|
//! Run with:
|
|
//!
|
|
//! ```bash
|
|
//! ollama serve & # if not already running
|
|
//! ollama pull qwen2.5:7b-instruct
|
|
//! cargo test -p kb-llm-local -- --ignored
|
|
//! ```
|
|
//!
|
|
//! These hit `http://127.0.0.1:11434` directly and require an actual model
|
|
//! pulled locally. CI runs default (non-ignored) tests only.
|
|
|
|
use kebab_config::Config;
|
|
use kebab_core::{GenerateRequest, TokenChunk};
|
|
use kebab_llm_local::{LanguageModel, OllamaLanguageModel};
|
|
|
|
#[test]
|
|
#[ignore = "requires a local Ollama daemon + pulled model"]
|
|
fn real_ollama_streams_non_empty_response() {
|
|
// Use whatever model the workspace defaults select. Override via the
|
|
// KEBAB_MODELS_LLM_MODEL env var if you want a different one for this run
|
|
// (e.g. `KEBAB_MODELS_LLM_MODEL=qwen2.5:7b-instruct cargo test ... -- --ignored`).
|
|
let cfg = Config::load(None).expect("config should load");
|
|
let llm = OllamaLanguageModel::new(&cfg).unwrap();
|
|
|
|
let req = GenerateRequest {
|
|
system: "You are a terse assistant.".to_string(),
|
|
user: "Say only the word 'ok'.".to_string(),
|
|
stop: vec![],
|
|
max_tokens: 8,
|
|
temperature: 0.0,
|
|
seed: Some(0),
|
|
};
|
|
|
|
let stream = llm.generate_stream(req).expect("stream should start");
|
|
let chunks: Vec<TokenChunk> = stream
|
|
.collect::<Result<Vec<_>, _>>()
|
|
.expect("stream should not error");
|
|
|
|
let text: String = chunks
|
|
.iter()
|
|
.filter_map(|c| match c {
|
|
TokenChunk::Token(t) => Some(t.as_str()),
|
|
_ => None,
|
|
})
|
|
.collect();
|
|
assert!(!text.is_empty(), "expected non-empty completion");
|
|
assert!(
|
|
matches!(chunks.last(), Some(TokenChunk::Done { .. })),
|
|
"stream must end with Done"
|
|
);
|
|
}
|