Reference
Import GNO directly into a Bun or TypeScript app with createGnoClient.
The SDK lets you embed GNO in any Bun or TypeScript application without shelling out to the CLI or running a local server. Full programmatic control over retrieval, indexing, and lifecycle.
bun add @gmickel/gnoimport { createGnoClient } from "@gmickel/gno"
const gno = await createGnoClient({
collections: {
notes: { path: "~/notes" },
},
})
const results = await gno.search("authentication")
for (const hit of results) {
console.log(hit.uri, hit.score)
}
await gno.close()gno.search(query, opts?) — BM25 keyword searchgno.vsearch(query, opts?) — vector similaritygno.query(query, opts?) — hybrid with rerankinggno.ask(question, opts?) — cited answersgno.get(id) — fetch a document by idgno.links(id) / gno.backlinks(id) / gno.similar(id)gno.index() — trigger a full indexgno.update() — incremental re-scangno.close() — release file handles and DB connectionsYou can skip the YAML file entirely and define your collections in code:
const gno = await createGnoClient({
models: { preset: "balanced" },
collections: {
code: {
path: "~/work/app",
pattern: "**/*.{ts,md}",
exclude: ["node_modules", "dist"],
},
notes: {
path: "~/Documents/notes",
},
},
})Always call await gno.close() when your process is shutting down. The SDK holds file handles and a SQLite connection that need to flush cleanly.