Reference

SDK

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.

Install

bun add @gmickel/gno

Basic usage

import { 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()

Client APIs

Inline config

You 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",
    },
  },
})

Lifecycle

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.