Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,35 @@ jobs:
git push origin main
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

# Publish the `code-search-please` library crate to crates.io via Trusted
# Publishing (OIDC) — no CARGO_REGISTRY_TOKEN. Gated on the CRATES_IO_PUBLISH
# repo variable so it stays dormant until the one-time bootstrap is done:
# (1) claim the name with a manual `cargo publish` (crates.io TP can't be
# configured on a crate that doesn't exist yet), (2) add a GitHub Actions
# trusted publisher on crates.io (repo pleaseai/code-search, workflow
# release-please.yml), (3) set the repo variable CRATES_IO_PUBLISH=true.
# The CLI crate (code-search-please-cli) is a follow-up — it needs
# intra-workspace dependency-version management before it can publish.
publish-crate:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created && vars.CRATES_IO_PUBLISH == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout the released tag
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ needs.release-please.outputs.tag_name }}
persist-credentials: false

- name: Authenticate to crates.io (Trusted Publishing)
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
id: auth

- name: Publish code-search-please
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: cargo publish -p code-search-please --locked
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ authors = ["csp maintainers"]
# Planned dependency menu (ADR-0003 crate mapping). Member crates opt in
# phase by phase with `<dep>.workspace = true`; listing here does not fetch.
[workspace.dependencies]
csp = { path = "crates/csp" }
# Published as `code-search-please`; the `csp` key keeps `use csp::...` working
# in member crates (the lib name stays `csp` via crates/csp `[lib]`).
csp = { path = "crates/csp", package = "code-search-please" }
model2vec-rs = "0.2" # Phase 3 — dense embeddings (official MinishLab port)
tree-sitter = "0.26" # Phase 2 — AST chunking
ignore = "0.4" # Phase 3 — .gitignore / .cspignore file walking
Expand Down
14 changes: 13 additions & 1 deletion crates/csp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Published to crates.io as `code-search-please` because the short name `csp`
# is already taken by an unrelated crate. The library name stays `csp` (see
# `[lib]`), so downstream code still writes `use csp::...` — matching the README
# example and the `@pleaseai/csp` npm package.
[package]
name = "csp"
name = "code-search-please"
description = "Hybrid code search for agents — core library (Rust rewrite of MinishLab/semble)."
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
authors.workspace = true
homepage = "https://github.com/pleaseai/code-search"
documentation = "https://docs.rs/code-search-please"
readme = "README.md"
keywords = ["code-search", "search", "embeddings", "bm25", "agents"]
categories = ["development-tools", "text-processing"]

[lib]
name = "csp"

[dependencies]
# Populated per the ADR-0003 migration phases.
Expand Down
38 changes: 38 additions & 0 deletions crates/csp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# code-search-please (`csp`)

Hybrid code search for agents — the core Rust library behind [`@pleaseai/csp`](https://github.com/pleaseai/code-search). A Rust rewrite of [MinishLab/semble](https://github.com/MinishLab/semble).

> Published to crates.io as **`code-search-please`** (the short name `csp` was taken). The library name is `csp`, so you still write `use csp::...`.

## Install

```toml
[dependencies]
code-search-please = "0.1"
```

## Usage

```rust
use std::path::Path;
use csp::indexing::index::{CspIndex, LoadOptions, QueryOptions};

// Index a local directory and search it
let index = CspIndex::from_path(Path::new("./my-project"), &LoadOptions::default())?;
let results = index.search("save model to disk", &QueryOptions { top_k: Some(3), ..Default::default() });

for r in &results {
println!("{}:{}-{}", r.chunk.file_path, r.chunk.start_line, r.chunk.end_line);
}
# Ok::<(), String>(())
Comment on lines +17 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

[MEDIUM] README의 사용 예제가 컴파일되지 않습니다.

문제점: ? 연산자는 Result를 반환하는 함수 내에서만 사용할 수 있습니다. 현재 코드 조각은 함수로 감싸여 있지 않아 cargo test --doc 실행 시 컴파일 오류가 발생합니다.

근거: Rust 문서 테스트는 유효하고 컴파일 가능한 코드 예제를 제공해야 합니다. 이는 라이브러리 사용자가 예제를 복사하여 붙여넣고 바로 사용할 수 있도록 보장합니다.

제안: rustdoc이 테스트할 수 있도록 예제 코드를 숨겨진 main 함수로 감싸는 것을 제안합니다. 이렇게 하면 문서의 가독성을 해치지 않으면서 코드의 정확성을 보장할 수 있습니다. 또한, 예제를 실행하기 위해 필요한 설정(예: 디렉토리 생성)에 대한 주석을 추가하는 것이 좋습니다.

Suggested change
use std::path::Path;
use csp::indexing::index::{CspIndex, LoadOptions, QueryOptions};
// Index a local directory and search it
let index = CspIndex::from_path(Path::new("./my-project"), &LoadOptions::default())?;
let results = index.search("save model to disk", &QueryOptions { top_k: Some(3), ..Default::default() });
for r in &results {
println!("{}:{}-{}", r.chunk.file_path, r.chunk.start_line, r.chunk.end_line);
}
# Ok::<(), String>(())
# fn main() -> Result<(), String> {
use std::path::Path;
use csp::indexing::index::{CspIndex, LoadOptions, QueryOptions};
// Index a local directory and search it
// To make this example runnable, create a dummy directory first: `mkdir my-project`
let index = CspIndex::from_path(Path::new("./my-project"), &LoadOptions::default())?;
let results = index.search("save model to disk", &QueryOptions { top_k: Some(3), ..Default::default() });
for r in &results {
println!("{}:{}-{}", r.chunk.file_path, r.chunk.start_line, r.chunk.end_line);
}
# Ok(())
# }

```

Hybrid scoring combines Model2Vec dense embeddings with BM25, fused via Reciprocal Rank Fusion. Chunking is tree-sitter AST-based with a line-based fallback.

## CLI / MCP

The `csp` binary (CLI + MCP server) ships via npm (`bunx @pleaseai/csp`) and Homebrew. See the [repository README](https://github.com/pleaseai/code-search) for the full surface.

## License

MIT. This is a derivative work of [MinishLab/semble](https://github.com/MinishLab/semble); see the repository for credits and citation.
Loading