sensemaking 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -7
- package/dist/cjs/cli.js +5 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands/find.js +173 -10
- package/dist/cjs/commands/find.js.map +1 -1
- package/dist/cjs/commands/map.js +1 -1
- package/dist/cjs/commands/map.js.map +1 -1
- package/dist/cjs/commands/peek.js +1 -1
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/shared.d.cts +1 -1
- package/dist/cjs/commands/shared.d.ts +1 -1
- package/dist/cjs/commands/shared.js +166 -8
- package/dist/cjs/commands/shared.js.map +1 -1
- package/dist/cjs/commands/status.js +10 -1
- package/dist/cjs/commands/status.js.map +1 -1
- package/dist/cjs/commands/types.d.cts +1 -0
- package/dist/cjs/commands/types.d.ts +1 -0
- package/dist/cjs/config.d.cts +26 -2
- package/dist/cjs/config.d.ts +26 -2
- package/dist/cjs/config.js +171 -10
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/db.js +46 -16
- package/dist/cjs/db.js.map +1 -1
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/features/embed.d.cts +14 -0
- package/dist/cjs/features/embed.d.ts +14 -0
- package/dist/cjs/features/embed.js +840 -0
- package/dist/cjs/features/embed.js.map +1 -0
- package/dist/cjs/features/index.js +3 -1
- package/dist/cjs/features/index.js.map +1 -1
- package/dist/cjs/features/types.d.cts +4 -1
- package/dist/cjs/features/types.d.ts +4 -1
- package/dist/cjs/index.d.cts +3 -10
- package/dist/cjs/index.d.ts +3 -10
- package/dist/cjs/index.js +2 -52
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/output.d.cts +5 -0
- package/dist/cjs/output.d.ts +5 -0
- package/dist/cjs/output.js +14 -1
- package/dist/cjs/output.js.map +1 -1
- package/dist/cjs/scan.js +9 -8
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/verbs.d.cts +8 -2
- package/dist/cjs/verbs.d.ts +8 -2
- package/dist/cjs/verbs.js +263 -76
- package/dist/cjs/verbs.js.map +1 -1
- package/dist/esm/cli.js +5 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands/find.js +5 -4
- package/dist/esm/commands/find.js.map +1 -1
- package/dist/esm/commands/map.js +1 -3
- package/dist/esm/commands/map.js.map +1 -1
- package/dist/esm/commands/peek.js +1 -1
- package/dist/esm/commands/peek.js.map +1 -1
- package/dist/esm/commands/shared.d.ts +1 -1
- package/dist/esm/commands/shared.js +2 -2
- package/dist/esm/commands/shared.js.map +1 -1
- package/dist/esm/commands/status.js +8 -1
- package/dist/esm/commands/status.js.map +1 -1
- package/dist/esm/commands/types.d.ts +1 -0
- package/dist/esm/commands/types.js.map +1 -1
- package/dist/esm/config.d.ts +26 -2
- package/dist/esm/config.js +88 -10
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/db.js +19 -10
- package/dist/esm/db.js.map +1 -1
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/features/embed.d.ts +14 -0
- package/dist/esm/features/embed.js +290 -0
- package/dist/esm/features/embed.js.map +1 -0
- package/dist/esm/features/index.js +3 -1
- package/dist/esm/features/index.js.map +1 -1
- package/dist/esm/features/types.d.ts +4 -1
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/index.d.ts +3 -10
- package/dist/esm/index.js +4 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/output.d.ts +5 -0
- package/dist/esm/output.js +11 -1
- package/dist/esm/output.js.map +1 -1
- package/dist/esm/scan.js +9 -8
- package/dist/esm/scan.js.map +1 -1
- package/dist/esm/verbs.d.ts +8 -2
- package/dist/esm/verbs.js +51 -13
- package/dist/esm/verbs.js.map +1 -1
- package/package.json +2 -1
- package/schema.json +17 -1
- package/skills/sense/EXAMPLES.md +16 -0
- package/skills/sense/SKILL.md +41 -19
- package/skills/sense-setup/SKILL.md +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/features/embed.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport type { DatabaseSync } from 'node:sqlite';\nimport type { Config, ResolvedConfig } from '../config.ts';\nimport { embedConfig } from '../config.ts';\nimport { SenseError } from '../errors.ts';\nimport { parseFile } from '../scan.ts';\nimport type { Feature } from './types.ts';\n\n// embeddings(path, chunk, start_line, end_line, scale, vector): heading-based chunks,\n// int8 vectors with a per-vector dequantization scale, vector NULL = not yet embedded.\n// Reconcile stores dirty rows inside its transaction; embedding tops up on the next\n// semantic query (embedPending), so staleness costs recall, never correctness.\n\n// Storage lever fixed by the bake-off (BENCHMARKING.md): int8 at 256 dims is\n// quality-free vs f32-512 when fused. Queries stay f32 at the same dims.\nconst STORE_DIMS = 256;\nconst BATCH = 64;\n\nexport interface EmbedProvider {\n id: string; // model identity; participates in the cache key, change -> re-embed\n dims: number;\n embed(texts: string[]): Promise<Float32Array[]>;\n}\n\ninterface Chunk {\n startLine: number;\n endLine: number;\n text: string;\n}\n\n// Deterministic chunker used at reconcile (line ranges stored) and at embed time (text\n// re-derived from the file -- chunk text is never stored). Heading-delimited with the\n// preamble kept; whole file when no headings. The title/summary prefix mirrors the\n// bm25 column weighting.\nfunction chunksOf(raw: string, search?: { title: string; summary: string }): Chunk[] {\n const lines = raw.split('\\n');\n const starts: number[] = [];\n let inFence = false;\n for (let i = 0; i < lines.length; i++) {\n if (/^(```|~~~)/.test(lines[i])) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && /^#{1,6} +/.test(lines[i])) starts.push(i + 1);\n }\n const bounds = starts.length === 0 ? [1] : starts[0] > 1 ? [1, ...starts] : starts;\n const prefix = [search?.title, search?.summary].filter(Boolean).join('\\n');\n const chunks: Chunk[] = [];\n bounds.forEach((start, i) => {\n const end = i + 1 < bounds.length ? bounds[i + 1] - 1 : lines.length;\n const text = lines\n .slice(start - 1, end)\n .join('\\n')\n .trim();\n if (text.length > 0) chunks.push({ startLine: start, endLine: end, text: prefix ? `${prefix}\\n${text}` : text });\n });\n return chunks;\n}\n\nexport const embed: Feature = {\n name: 'embed',\n schema(db) {\n db.exec(`CREATE TABLE IF NOT EXISTS embeddings (\"path\" TEXT, chunk INTEGER, start_line INTEGER, end_line INTEGER, scale REAL, vector BLOB, PRIMARY KEY (\"path\", chunk))`);\n },\n extract(raw, _body, search) {\n return chunksOf(raw, search);\n },\n remove(db, path) {\n db.prepare('DELETE FROM embeddings WHERE \"path\" = ?').run(path);\n },\n store(db, path, extracted) {\n const insert = db.prepare('INSERT INTO embeddings (\"path\", chunk, start_line, end_line, scale, vector) VALUES (?, ?, ?, ?, NULL, NULL)');\n (extracted as Chunk[]).forEach((c, idx) => insert.run(path, idx, c.startLine, c.endLine));\n },\n};\n\n// --- static type: Model2Vec safetensors + pure-JS tokenizer, model cached in ~/.cache ---\n// Encode convention from model2vec/model.py: no special tokens, drop unk ids, mean-pool,\n// L2-normalize.\n\nfunction fetchToFile(url: string, dest: string): Promise<void> {\n return fetch(url).then(async (res) => {\n if (!res.ok) throw new SenseError('EMBED_MODEL', `model download failed: ${url} -> HTTP ${res.status}`);\n writeFileSync(`${dest}.part`, Buffer.from(await res.arrayBuffer()));\n renameSync(`${dest}.part`, dest);\n });\n}\n\nasync function staticProvider(model: string): Promise<EmbedProvider> {\n let dir = model;\n if (!existsSync(join(dir, 'model.safetensors'))) {\n dir = join(homedir(), '.cache', 'sensemaking', 'models', model.replace(/\\//g, '--'));\n mkdirSync(dir, { recursive: true });\n for (const file of ['model.safetensors', 'tokenizer.json']) {\n if (!existsSync(join(dir, file))) {\n console.error(`fetching ${model}/${file} into ${dir} (once; delete to refetch)`);\n await fetchToFile(`https://huggingface.co/${model}/resolve/main/${file}`, join(dir, file));\n }\n }\n }\n\n const raw = readFileSync(join(dir, 'model.safetensors'));\n const headerLen = Number(raw.readBigUInt64LE(0));\n const header = JSON.parse(raw.subarray(8, 8 + headerLen).toString('utf8')) as Record<string, { dtype: string; shape: number[]; data_offsets: number[] }>;\n const entry = Object.entries(header).find(([k]) => k !== '__metadata__');\n if (!entry || entry[1].dtype !== 'F32') throw new SenseError('EMBED_MODEL', `${model}: expected an F32 safetensors matrix`);\n const spec = entry[1];\n const dims = spec.shape[1];\n const dataStart = raw.byteOffset + 8 + headerLen + spec.data_offsets[0];\n const matrix = dataStart % 4 === 0 ? new Float32Array(raw.buffer, dataStart, spec.shape[0] * dims) : new Float32Array(raw.buffer.slice(dataStart, dataStart + spec.shape[0] * dims * 4));\n\n const tokenizerJson = JSON.parse(readFileSync(join(dir, 'tokenizer.json'), 'utf8'));\n // Lazy import: the tokenizer loads only on the semantic path, never at CLI startup.\n const { Tokenizer } = await import('@huggingface/tokenizers');\n const tok = new Tokenizer(tokenizerJson, {});\n const unkId = tokenizerJson.model?.vocab?.[tokenizerJson.model?.unk_token] ?? -1;\n\n function one(text: string): Float32Array {\n const ids = (tok.encode(text, { add_special_tokens: false }).ids as number[]).filter((id) => id !== unkId);\n const v = new Float32Array(dims);\n if (ids.length === 0) return v;\n for (const id of ids) {\n const off = id * dims;\n for (let d = 0; d < dims; d++) v[d] += matrix[off + d];\n }\n let norm = 0;\n for (let d = 0; d < dims; d++) {\n v[d] /= ids.length;\n norm += v[d] * v[d];\n }\n norm = Math.sqrt(norm) + 1e-32;\n for (let d = 0; d < dims; d++) v[d] /= norm;\n return v;\n }\n\n return { id: `static:${model}`, dims, embed: async (texts) => texts.map(one) };\n}\n\n// --- api type: one POST against any OpenAI-compatible /embeddings endpoint ---\n\nasync function apiProvider(model: string, url: string | undefined, keyEnv: string | undefined): Promise<EmbedProvider> {\n if (!url) throw new SenseError('EMBED_MODEL', 'features.embed.type \"api\" requires a url');\n const base = url.replace(/\\/+$/, '');\n const headers: Record<string, string> = { 'content-type': 'application/json' };\n const key = keyEnv ? process.env[keyEnv] : undefined;\n if (key) headers.authorization = `Bearer ${key}`;\n\n async function post(texts: string[]): Promise<Float32Array[]> {\n const res = await fetch(`${base}/embeddings`, { method: 'POST', headers, body: JSON.stringify({ model, input: texts }) });\n if (!res.ok) throw new SenseError('EMBED_MODEL', `${base}/embeddings -> HTTP ${res.status}`);\n const body = (await res.json()) as { data: Array<{ embedding: number[] }> };\n return body.data.map((d) => Float32Array.from(d.embedding));\n }\n\n const dims = (await post(['dimension probe']))[0].length;\n return { id: `api:${base}:${model}`, dims, embed: post };\n}\n\nconst providers = new Map<string, Promise<EmbedProvider>>();\n\nfunction getProvider(cfg: Config): Promise<EmbedProvider> {\n const e = embedConfig(cfg);\n if (!e) throw new SenseError('EMBED_DISABLED', 'semantic expansion needs features.embed in sense.config.json (e.g. \"features\": { \"embed\": true })');\n const sig = `${e.type}:${e.model}:${e.url ?? ''}`;\n let p = providers.get(sig);\n if (!p) {\n p = e.type === 'api' ? apiProvider(e.model, e.url, e.key) : staticProvider(e.model);\n providers.set(sig, p);\n }\n return p;\n}\n\n// Slice + re-normalize (Matryoshka); optionally round through int8 storage.\nfunction toStore(full: Float32Array, dims: number, int8: boolean): { v: Float32Array; scale: number } {\n const v = new Float32Array(dims);\n let norm = 0;\n for (let d = 0; d < dims; d++) norm += full[d] * full[d];\n norm = Math.sqrt(norm) + 1e-32;\n for (let d = 0; d < dims; d++) v[d] = full[d] / norm;\n if (!int8) return { v, scale: 1 };\n let max = 0;\n for (let d = 0; d < dims; d++) max = Math.max(max, Math.abs(v[d]));\n return { v, scale: max / 127 || 1 };\n}\n\n// Embed rows whose vector is NULL, re-deriving chunk text from the files through the\n// same parse + chunker that stored the rows.\nexport async function embedPending(db: DatabaseSync, cfg: Config, baseDir: string): Promise<void> {\n const provider = await getProvider(cfg); // throws EMBED_DISABLED before touching the table\n const dirty = db.prepare('SELECT \"path\", chunk FROM embeddings WHERE vector IS NULL ORDER BY \"path\", chunk').all() as Array<{ path: string; chunk: number }>;\n if (dirty.length === 0) return;\n const storeDims = Math.min(STORE_DIMS, provider.dims);\n\n const byPath = new Map<string, number[]>();\n for (const row of dirty) {\n const list = byPath.get(row.path) ?? [];\n list.push(row.chunk);\n byPath.set(row.path, list);\n }\n\n const jobs: Array<{ path: string; chunk: number; text: string }> = [];\n for (const [path, chunkIdxs] of byPath) {\n let chunks: Chunk[];\n try {\n chunks = parseFile({ relPath: path, absPath: join(baseDir, path), mtimeMs: 0, size: 0 }, [embed]).doc.extracted.embed as Chunk[];\n } catch {\n continue; // vanished since reconcile; the next reconcile removes its rows\n }\n for (const idx of chunkIdxs) if (chunks[idx]) jobs.push({ path, chunk: idx, text: chunks[idx].text });\n }\n\n const update = db.prepare('UPDATE embeddings SET scale = ?, vector = ? WHERE \"path\" = ? AND chunk = ?');\n for (let i = 0; i < jobs.length; i += BATCH) {\n const batch = jobs.slice(i, i + BATCH);\n const vectors = await provider.embed(batch.map((j) => j.text));\n db.exec('BEGIN');\n try {\n batch.forEach((job, j) => {\n const { v, scale } = toStore(vectors[j], storeDims, true);\n const q = new Int8Array(storeDims);\n for (let d = 0; d < storeDims; d++) q[d] = Math.round(v[d] / scale);\n update.run(scale, Buffer.from(q.buffer), job.path, job.chunk);\n });\n db.exec('COMMIT');\n } catch (err) {\n db.exec('ROLLBACK');\n throw err;\n }\n }\n}\n\n// Top candidates by cosine for a semantic find: best chunk per file, its line range\n// riding along. FTS5 operators in the terms are lexical syntax, not meaning -- stripped\n// before embedding.\nexport async function semanticCandidates(db: DatabaseSync, cfg: Config, terms: string, fetch: number): Promise<Array<{ path: string; lines: string }>> {\n const baseDir = (cfg as Partial<ResolvedConfig>).baseDir;\n if (!baseDir) throw new SenseError('EMBED_MODEL', 'semantic expansion needs a config with baseDir (use loadConfig/open)');\n await embedPending(db, cfg, baseDir);\n\n const provider = await getProvider(cfg);\n const storeDims = Math.min(STORE_DIMS, provider.dims);\n const text = (terms.match(/[\\p{L}\\p{N}]+/gu) ?? []).filter((t) => !['AND', 'OR', 'NOT', 'NEAR'].includes(t)).join(' ');\n const { v: qv } = toStore((await provider.embed([text]))[0], storeDims, false);\n\n const rows = db.prepare('SELECT \"path\", start_line, end_line, scale, vector FROM embeddings WHERE vector IS NOT NULL').all() as Array<{\n path: string;\n start_line: number;\n end_line: number;\n scale: number;\n vector: Uint8Array;\n }>;\n\n const best = new Map<string, { score: number; lines: string }>();\n for (const row of rows) {\n const q = new Int8Array(row.vector.buffer, row.vector.byteOffset, Math.min(storeDims, row.vector.byteLength));\n let dot = 0;\n for (let d = 0; d < q.length; d++) dot += q[d] * qv[d];\n const score = dot * row.scale;\n const existing = best.get(row.path);\n if (!existing || score > existing.score) best.set(row.path, { score, lines: `L${row.start_line}-${row.end_line}` });\n }\n return [...best.entries()]\n .sort((a, b) => b[1].score - a[1].score)\n .slice(0, fetch)\n .map(([path, b]) => ({ path, lines: b.lines }));\n}\n"],"names":["embed","embedPending","semanticCandidates","STORE_DIMS","BATCH","chunksOf","raw","search","lines","split","starts","inFence","i","length","test","push","bounds","prefix","title","summary","filter","Boolean","join","chunks","forEach","start","end","text","slice","trim","startLine","endLine","name","schema","db","exec","extract","_body","remove","path","prepare","run","store","extracted","insert","c","idx","fetchToFile","url","dest","fetch","then","res","ok","SenseError","status","Buffer","from","arrayBuffer","writeFileSync","renameSync","staticProvider","model","tokenizerJson","dir","file","headerLen","header","entry","spec","dims","dataStart","matrix","Tokenizer","tok","unkId","one","ids","encode","add_special_tokens","id","v","Float32Array","off","d","norm","Math","sqrt","existsSync","homedir","replace","mkdirSync","recursive","console","error","readFileSync","Number","readBigUInt64LE","JSON","parse","subarray","toString","Object","entries","find","k","dtype","shape","byteOffset","data_offsets","buffer","vocab","unk_token","texts","map","apiProvider","keyEnv","base","headers","key","post","body","method","stringify","input","json","data","embedding","process","env","undefined","authorization","providers","Map","getProvider","cfg","e","embedConfig","sig","type","p","get","set","toStore","full","int8","scale","max","abs","baseDir","provider","dirty","storeDims","byPath","row","list","jobs","chunkIdxs","update","batch","vectors","j","job","q","Int8Array","round","chunk","err","all","min","parseFile","relPath","absPath","mtimeMs","size","doc","terms","qv","rows","best","dot","score","existing","match","t","includes","vector","byteLength","start_line","end_line","sort","a","b"],"mappings":";;;;;;;;;;;QA6DaA;eAAAA;;QAgISC;eAAAA;;QA+CAC;eAAAA;;;sBA5OyD;sBACvD;wBACH;wBAGO;wBACD;sBACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1B,sFAAsF;AACtF,uFAAuF;AACvF,oFAAoF;AACpF,+EAA+E;AAE/E,6EAA6E;AAC7E,yEAAyE;AACzE,IAAMC,aAAa;AACnB,IAAMC,QAAQ;AAcd,uFAAuF;AACvF,sFAAsF;AACtF,mFAAmF;AACnF,yBAAyB;AACzB,SAASC,SAASC,GAAW,EAAEC,MAA2C;IACxE,IAAMC,QAAQF,IAAIG,KAAK,CAAC;IACxB,IAAMC,SAAmB,EAAE;IAC3B,IAAIC,UAAU;IACd,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,MAAM,EAAED,IAAK;QACrC,IAAI,aAAaE,IAAI,CAACN,KAAK,CAACI,EAAE,GAAG;YAC/BD,UAAU,CAACA;YACX;QACF;QACA,IAAI,CAACA,WAAW,YAAYG,IAAI,CAACN,KAAK,CAACI,EAAE,GAAGF,OAAOK,IAAI,CAACH,IAAI;IAC9D;IACA,IAAMI,SAASN,OAAOG,MAAM,KAAK,IAAI;QAAC;KAAE,GAAGH,MAAM,CAAC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ImC,QAAQ;4BAAG;wBACnH;;wBAPK;wBAAA;;;iCAAA,6BAAA;gCAAA;;;gCAAA;sCAAA;;;;oBAQL;;wBAAQ,qBAAGV,KAAK5E,OAAO,IACpBuF,IAAI,CAAC,SAACC,GAAGC;mCAAMA,CAAC,CAAC,EAAE,CAACX,KAAK,GAAGU,CAAC,CAAC,EAAE,CAACV,KAAK;2BACtCzJ,KAAK,CAAC,GAAGsB,QACTgE,GAAG,CAAC;qEAAE3E,kBAAMyJ;mCAAQ;gCAAEzJ,MAAAA;gCAAM/B,OAAOwL,EAAExL,KAAK;4BAAC;;;;;IAChD"}
|
|
@@ -20,13 +20,15 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
var _configts = require("../config.js");
|
|
23
|
+
var _embedts = require("./embed.js");
|
|
23
24
|
var _linksts = require("./links.js");
|
|
24
25
|
var _rankts = require("./rank.js");
|
|
25
26
|
var _sectionsts = require("./sections.js");
|
|
26
27
|
var FEATURES = [
|
|
27
28
|
_linksts.links,
|
|
28
29
|
_sectionsts.sections,
|
|
29
|
-
_rankts.rank
|
|
30
|
+
_rankts.rank,
|
|
31
|
+
_embedts.embed
|
|
30
32
|
];
|
|
31
33
|
function activeFeatures(cfg) {
|
|
32
34
|
return FEATURES.filter(function(feature) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/features/index.ts"],"sourcesContent":["import type { Config } from '../config.ts';\nimport { featureEnabled } from '../config.ts';\nimport { links } from './links.ts';\nimport { rank } from './rank.ts';\nimport { sections } from './sections.ts';\nimport type { Feature } from './types.ts';\n\n// Registry order matters: rank reads the links table in afterReconcile.\nexport const FEATURES: Feature[] = [links, sections, rank];\n\nexport function activeFeatures(cfg: Config): Feature[] {\n return FEATURES.filter((feature) => featureEnabled(cfg, feature.name));\n}\n\nexport { linkEdges } from './links.ts';\nexport type { Section } from './sections.ts';\nexport type { Feature } from './types.ts';\n"],"names":["FEATURES","activeFeatures","linkEdges","links","sections","rank","cfg","filter","feature","featureEnabled","name"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/features/index.ts"],"sourcesContent":["import type { Config } from '../config.ts';\nimport { featureEnabled } from '../config.ts';\nimport { embed } from './embed.ts';\nimport { links } from './links.ts';\nimport { rank } from './rank.ts';\nimport { sections } from './sections.ts';\nimport type { Feature } from './types.ts';\n\n// Registry order matters: rank reads the links table in afterReconcile.\nexport const FEATURES: Feature[] = [links, sections, rank, embed];\n\nexport function activeFeatures(cfg: Config): Feature[] {\n return FEATURES.filter((feature) => featureEnabled(cfg, feature.name));\n}\n\nexport { linkEdges } from './links.ts';\nexport type { Section } from './sections.ts';\nexport type { Feature } from './types.ts';\n"],"names":["FEATURES","activeFeatures","linkEdges","links","sections","rank","embed","cfg","filter","feature","featureEnabled","name"],"mappings":";;;;;;;;;;;QASaA;eAAAA;;QAEGC;eAAAA;;QAIPC;eAAAA,kBAAS;;;wBAda;uBACT;uBACA;sBACD;0BACI;AAIlB,IAAMF,WAAsB;IAACG,cAAK;IAAEC,oBAAQ;IAAEC,YAAI;IAAEC,cAAK;CAAC;AAE1D,SAASL,eAAeM,GAAW;IACxC,OAAOP,SAASQ,MAAM,CAAC,SAACC;eAAYC,IAAAA,wBAAc,EAACH,KAAKE,QAAQE,IAAI;;AACtE"}
|
|
@@ -4,7 +4,10 @@ import type { FileStat } from '../scan.js';
|
|
|
4
4
|
export interface Feature {
|
|
5
5
|
name: FeatureName;
|
|
6
6
|
schema(db: DatabaseSync): void;
|
|
7
|
-
extract?(raw: string, body: string
|
|
7
|
+
extract?(raw: string, body: string, search?: {
|
|
8
|
+
title: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
}): unknown;
|
|
8
11
|
remove?(db: DatabaseSync, path: string): void;
|
|
9
12
|
store?(db: DatabaseSync, path: string, extracted: unknown): void;
|
|
10
13
|
afterReconcile?(db: DatabaseSync, files: FileStat[]): void;
|
|
@@ -4,7 +4,10 @@ import type { FileStat } from '../scan.js';
|
|
|
4
4
|
export interface Feature {
|
|
5
5
|
name: FeatureName;
|
|
6
6
|
schema(db: DatabaseSync): void;
|
|
7
|
-
extract?(raw: string, body: string
|
|
7
|
+
extract?(raw: string, body: string, search?: {
|
|
8
|
+
title: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
}): unknown;
|
|
8
11
|
remove?(db: DatabaseSync, path: string): void;
|
|
9
12
|
store?(db: DatabaseSync, path: string, extracted: unknown): void;
|
|
10
13
|
afterReconcile?(db: DatabaseSync, files: FileStat[]): void;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
export type { Config, FeatureName, ResolvedConfig } from './config.js';
|
|
2
|
-
export { CONFIG_FILENAME,
|
|
1
|
+
export type { Config, EmbedConfig, FeatureName, ResolvedConfig } from './config.js';
|
|
2
|
+
export { CONFIG_FILENAME, initConfig, loadConfig, migrateConfig, STATE_DIR, SUPPORTED_CONFIG_VERSION } from './config.js';
|
|
3
3
|
export type { OpenResult } from './db.js';
|
|
4
|
-
export {
|
|
4
|
+
export { open, rebuild } from './db.js';
|
|
5
5
|
export type { SenseErrorCode } from './errors.js';
|
|
6
6
|
export { SenseError } from './errors.js';
|
|
7
|
-
export { activeFeatures, FEATURES, linkEdges } from './features/index.js';
|
|
8
|
-
export type { Section } from './features/sections.js';
|
|
9
|
-
export type { Feature } from './features/types.js';
|
|
10
|
-
export type { Edge } from './graph.js';
|
|
11
|
-
export { pagerank, personalizedRank } from './graph.js';
|
|
12
7
|
export type { Row } from './output.js';
|
|
13
8
|
export { printRows } from './output.js';
|
|
14
|
-
export type { FileStat, ParsedDoc } from './scan.js';
|
|
15
|
-
export { listFiles, parseFile } from './scan.js';
|
|
16
9
|
export type { FindOptions, Peek, TreeMap } from './verbs.js';
|
|
17
10
|
export { find, mapTree, peek } from './verbs.js';
|
|
18
11
|
export type { WatchEvent, WatchOptions } from './watch.js';
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
export type { Config, FeatureName, ResolvedConfig } from './config.js';
|
|
2
|
-
export { CONFIG_FILENAME,
|
|
1
|
+
export type { Config, EmbedConfig, FeatureName, ResolvedConfig } from './config.js';
|
|
2
|
+
export { CONFIG_FILENAME, initConfig, loadConfig, migrateConfig, STATE_DIR, SUPPORTED_CONFIG_VERSION } from './config.js';
|
|
3
3
|
export type { OpenResult } from './db.js';
|
|
4
|
-
export {
|
|
4
|
+
export { open, rebuild } from './db.js';
|
|
5
5
|
export type { SenseErrorCode } from './errors.js';
|
|
6
6
|
export { SenseError } from './errors.js';
|
|
7
|
-
export { activeFeatures, FEATURES, linkEdges } from './features/index.js';
|
|
8
|
-
export type { Section } from './features/sections.js';
|
|
9
|
-
export type { Feature } from './features/types.js';
|
|
10
|
-
export type { Edge } from './graph.js';
|
|
11
|
-
export { pagerank, personalizedRank } from './graph.js';
|
|
12
7
|
export type { Row } from './output.js';
|
|
13
8
|
export { printRows } from './output.js';
|
|
14
|
-
export type { FileStat, ParsedDoc } from './scan.js';
|
|
15
|
-
export { listFiles, parseFile } from './scan.js';
|
|
16
9
|
export type { FindOptions, Peek, TreeMap } from './verbs.js';
|
|
17
10
|
export { find, mapTree, peek } from './verbs.js';
|
|
18
11
|
export type { WatchEvent, WatchOptions } from './watch.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// Public library API.
|
|
1
|
+
// Public library API. Deliberately small: every export is a stability promise;
|
|
2
|
+
// internals (feature registry, graph, scan, meta) stay module-private.
|
|
2
3
|
"use strict";
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
@@ -13,15 +14,6 @@ _export(exports, {
|
|
|
13
14
|
get CONFIG_FILENAME () {
|
|
14
15
|
return _configts.CONFIG_FILENAME;
|
|
15
16
|
},
|
|
16
|
-
get DB_FILENAME () {
|
|
17
|
-
return _dbts.DB_FILENAME;
|
|
18
|
-
},
|
|
19
|
-
get FEATURES () {
|
|
20
|
-
return _indexts.FEATURES;
|
|
21
|
-
},
|
|
22
|
-
get FEATURE_NAMES () {
|
|
23
|
-
return _configts.FEATURE_NAMES;
|
|
24
|
-
},
|
|
25
17
|
get STATE_DIR () {
|
|
26
18
|
return _configts.STATE_DIR;
|
|
27
19
|
},
|
|
@@ -31,36 +23,12 @@ _export(exports, {
|
|
|
31
23
|
get SenseError () {
|
|
32
24
|
return _errorsts.SenseError;
|
|
33
25
|
},
|
|
34
|
-
get activeFeatures () {
|
|
35
|
-
return _indexts.activeFeatures;
|
|
36
|
-
},
|
|
37
|
-
get docCount () {
|
|
38
|
-
return _dbts.docCount;
|
|
39
|
-
},
|
|
40
|
-
get enabledFeatures () {
|
|
41
|
-
return _configts.enabledFeatures;
|
|
42
|
-
},
|
|
43
|
-
get featureEnabled () {
|
|
44
|
-
return _configts.featureEnabled;
|
|
45
|
-
},
|
|
46
26
|
get find () {
|
|
47
27
|
return _verbsts.find;
|
|
48
28
|
},
|
|
49
|
-
get findConfigPath () {
|
|
50
|
-
return _configts.findConfigPath;
|
|
51
|
-
},
|
|
52
|
-
get getMeta () {
|
|
53
|
-
return _dbts.getMeta;
|
|
54
|
-
},
|
|
55
29
|
get initConfig () {
|
|
56
30
|
return _configts.initConfig;
|
|
57
31
|
},
|
|
58
|
-
get linkEdges () {
|
|
59
|
-
return _indexts.linkEdges;
|
|
60
|
-
},
|
|
61
|
-
get listFiles () {
|
|
62
|
-
return _scants.listFiles;
|
|
63
|
-
},
|
|
64
32
|
get loadConfig () {
|
|
65
33
|
return _configts.loadConfig;
|
|
66
34
|
},
|
|
@@ -73,41 +41,23 @@ _export(exports, {
|
|
|
73
41
|
get open () {
|
|
74
42
|
return _dbts.open;
|
|
75
43
|
},
|
|
76
|
-
get pagerank () {
|
|
77
|
-
return _graphts.pagerank;
|
|
78
|
-
},
|
|
79
|
-
get parseFile () {
|
|
80
|
-
return _scants.parseFile;
|
|
81
|
-
},
|
|
82
44
|
get peek () {
|
|
83
45
|
return _verbsts.peek;
|
|
84
46
|
},
|
|
85
|
-
get personalizedRank () {
|
|
86
|
-
return _graphts.personalizedRank;
|
|
87
|
-
},
|
|
88
47
|
get printRows () {
|
|
89
48
|
return _outputts.printRows;
|
|
90
49
|
},
|
|
91
50
|
get rebuild () {
|
|
92
51
|
return _dbts.rebuild;
|
|
93
52
|
},
|
|
94
|
-
get reconcile () {
|
|
95
|
-
return _dbts.reconcile;
|
|
96
|
-
},
|
|
97
53
|
get runWatch () {
|
|
98
54
|
return _watchts.runWatch;
|
|
99
|
-
},
|
|
100
|
-
get setMeta () {
|
|
101
|
-
return _dbts.setMeta;
|
|
102
55
|
}
|
|
103
56
|
});
|
|
104
57
|
var _configts = require("./config.js");
|
|
105
58
|
var _dbts = require("./db.js");
|
|
106
59
|
var _errorsts = require("./errors.js");
|
|
107
|
-
var _indexts = require("./features/index.js");
|
|
108
|
-
var _graphts = require("./graph.js");
|
|
109
60
|
var _outputts = require("./output.js");
|
|
110
|
-
var _scants = require("./scan.js");
|
|
111
61
|
var _verbsts = require("./verbs.js");
|
|
112
62
|
var _watchts = require("./watch.js");
|
|
113
63
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/index.ts"],"sourcesContent":["// Public library API.\n\nexport type { Config, FeatureName, ResolvedConfig } from './config.ts';\nexport { CONFIG_FILENAME,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/index.ts"],"sourcesContent":["// Public library API. Deliberately small: every export is a stability promise;\n// internals (feature registry, graph, scan, meta) stay module-private.\n\nexport type { Config, EmbedConfig, FeatureName, ResolvedConfig } from './config.ts';\nexport { CONFIG_FILENAME, initConfig, loadConfig, migrateConfig, STATE_DIR, SUPPORTED_CONFIG_VERSION } from './config.ts';\n\nexport type { OpenResult } from './db.ts';\nexport { open, rebuild } from './db.ts';\n\nexport type { SenseErrorCode } from './errors.ts';\nexport { SenseError } from './errors.ts';\n\nexport type { Row } from './output.ts';\nexport { printRows } from './output.ts';\n\nexport type { FindOptions, Peek, TreeMap } from './verbs.ts';\nexport { find, mapTree, peek } from './verbs.ts';\n\nexport type { WatchEvent, WatchOptions } from './watch.ts';\nexport { runWatch } from './watch.ts';\n"],"names":["CONFIG_FILENAME","STATE_DIR","SUPPORTED_CONFIG_VERSION","SenseError","find","initConfig","loadConfig","mapTree","migrateConfig","open","peek","printRows","rebuild","runWatch"],"mappings":"AAAA,+EAA+E;AAC/E,uEAAuE;;;;;;;;;;;;QAG9DA;eAAAA,yBAAe;;QAAyCC;eAAAA,mBAAS;;QAAEC;eAAAA,kCAAwB;;QAM3FC;eAAAA,oBAAU;;QAMVC;eAAAA,aAAI;;QAZaC;eAAAA,oBAAU;;QAAEC;eAAAA,oBAAU;;QAYjCC;eAAAA,gBAAO;;QAZ4BC;eAAAA,uBAAa;;QAGtDC;eAAAA,UAAI;;QASWC;eAAAA,aAAI;;QAHnBC;eAAAA,mBAAS;;QANHC;eAAAA,aAAO;;QAYbC;eAAAA,iBAAQ;;;wBAf2F;oBAG9E;wBAGH;wBAGD;uBAGU;uBAGX"}
|
package/dist/cjs/output.d.cts
CHANGED
|
@@ -7,6 +7,10 @@ export declare function renderMap(result: {
|
|
|
7
7
|
};
|
|
8
8
|
fields: Row[];
|
|
9
9
|
fieldsTotal: number;
|
|
10
|
+
features: {
|
|
11
|
+
on: string[];
|
|
12
|
+
off: string[];
|
|
13
|
+
};
|
|
10
14
|
hubs: Row[];
|
|
11
15
|
recent: Row[];
|
|
12
16
|
}): string;
|
|
@@ -21,4 +25,5 @@ export declare function renderPeek(result: {
|
|
|
21
25
|
outboundTotal: number;
|
|
22
26
|
backlinksTotal: number;
|
|
23
27
|
unresolvedTotal: number;
|
|
28
|
+
off: string[];
|
|
24
29
|
}): string;
|
package/dist/cjs/output.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export declare function renderMap(result: {
|
|
|
7
7
|
};
|
|
8
8
|
fields: Row[];
|
|
9
9
|
fieldsTotal: number;
|
|
10
|
+
features: {
|
|
11
|
+
on: string[];
|
|
12
|
+
off: string[];
|
|
13
|
+
};
|
|
10
14
|
hubs: Row[];
|
|
11
15
|
recent: Row[];
|
|
12
16
|
}): string;
|
|
@@ -21,4 +25,5 @@ export declare function renderPeek(result: {
|
|
|
21
25
|
outboundTotal: number;
|
|
22
26
|
backlinksTotal: number;
|
|
23
27
|
unresolvedTotal: number;
|
|
28
|
+
off: string[];
|
|
24
29
|
}): string;
|
package/dist/cjs/output.js
CHANGED
|
@@ -120,13 +120,22 @@ function render(rows, format) {
|
|
|
120
120
|
}).join(' ')
|
|
121
121
|
].concat(_to_consumable_array(cells.map(formatRow))).join('\n');
|
|
122
122
|
}
|
|
123
|
+
// Text renderers for the layer verbs; cli.ts prints what these return.
|
|
124
|
+
function featuresLine(features) {
|
|
125
|
+
var off = features.off.length > 0 ? " \xb7 off: ".concat(features.off.map(function(name) {
|
|
126
|
+
return "".concat(name, " (features.").concat(name, ")");
|
|
127
|
+
}).join(', ')) : '';
|
|
128
|
+
return "features: ".concat(features.on.join(', ')).concat(off);
|
|
129
|
+
}
|
|
123
130
|
function renderMap(result) {
|
|
124
131
|
var parts = [
|
|
125
|
-
"docs: ".concat(result.docs.count, " (").concat(Math.round(result.docs.bytes / 1024), " KB)
|
|
132
|
+
"docs: ".concat(result.docs.count, " (").concat(Math.round(result.docs.bytes / 1024), " KB)"),
|
|
133
|
+
"".concat(featuresLine(result.features), "\n"),
|
|
126
134
|
render(result.fields, 'table')
|
|
127
135
|
];
|
|
128
136
|
if (result.fieldsTotal > result.fields.length) parts.push("(+".concat(result.fieldsTotal - result.fields.length, " more fields)"));
|
|
129
137
|
if (result.hubs.length > 0) parts.push('\nhubs (by link rank):', render(result.hubs, 'table'));
|
|
138
|
+
else if (result.features.off.includes('rank')) parts.push('\nhubs: off (features.rank)');
|
|
130
139
|
parts.push('\nrecent:', render(result.recent, 'table'));
|
|
131
140
|
return parts.join('\n');
|
|
132
141
|
}
|
|
@@ -176,6 +185,10 @@ function renderPeek(result) {
|
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
187
|
}
|
|
188
|
+
} else if (result.off.includes('sections')) lines.push('', 'sections: off (features.sections)');
|
|
189
|
+
if (result.off.includes('links')) {
|
|
190
|
+
lines.push('', 'links: off (features.links)');
|
|
191
|
+
return lines.join('\n');
|
|
179
192
|
}
|
|
180
193
|
var linkLine = function linkLine(label, shown, total) {
|
|
181
194
|
if (total > 0) lines.push("".concat(label, " (").concat(total, "): ").concat(shown.join(', ')).concat(total > shown.length ? ", +".concat(total - shown.length, " more") : ''));
|
package/dist/cjs/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/output.ts"],"sourcesContent":["// rows -> table (default) | json\n\nexport type Row = Record<string, unknown>;\n\n// Warned about on stderr (keeps --format json stdout machine-readable), never truncated.\nconst OVERSIZE_BYTES = 50_000;\n\n// Flatten embedded newlines so they can't break table column alignment; JSON output is left alone.\nfunction cell(value: unknown): string {\n return String(value ?? '').replace(/\\s*\\n\\s*/g, ' ');\n}\n\nexport function printRows(rows: Row[], format: 'table' | 'json'): void {\n const rendered = render(rows, format);\n console.log(rendered);\n if (rendered.length > OVERSIZE_BYTES) {\n console.warn(`warning: result is ${Math.round(rendered.length / 1000)} KB across ${rows.length} row(s); consider a LIMIT, fewer columns, or snippet() instead of whole values`);\n }\n}\n\nfunction render(rows: Row[], format: 'table' | 'json'): string {\n if (format === 'json') return JSON.stringify(rows, null, 2);\n if (rows.length === 0) return '(0 rows)';\n\n const columns = Object.keys(rows[0]);\n const cells = rows.map((row) => columns.map((col) => cell(row[col])));\n const widths = columns.map((col, i) => Math.max(col.length, ...cells.map((row) => row[i].length)));\n\n const formatRow = (values: string[]) => values.map((value, i) => value.padEnd(widths[i])).join(' ');\n\n return [formatRow(columns), widths.map((w) => '-'.repeat(w)).join(' '), ...cells.map(formatRow)].join('\\n');\n}\n\n// Text renderers for the layer verbs; cli.ts prints what these return.\n\nexport function renderMap(result: { docs: { count: number; bytes: number }; fields: Row[]; fieldsTotal: number; hubs: Row[]; recent: Row[] }): string {\n const parts = [`docs: ${result.docs.count} (${Math.round(result.docs.bytes / 1024)} KB)\\n`, render(result.fields, 'table')];\n if (result.fieldsTotal > result.fields.length) parts.push(`(+${result.fieldsTotal - result.fields.length} more fields)`);\n if (result.hubs.length > 0) parts.push('\\nhubs (by link rank):', render(result.hubs, 'table'));\n parts.push('\\nrecent:', render(result.recent, 'table'));\n return parts.join('\\n');\n}\n\nexport function renderPeek(result: { path: string; tokens: number; frontmatter: Row; sections: Row[]; outbound: string[]; backlinks: string[]; unresolved: string[]; outboundTotal: number; backlinksTotal: number; unresolvedTotal: number }): string {\n const lines = [`${result.path} (~${result.tokens} tokens)`];\n for (const [key, value] of Object.entries(result.frontmatter)) lines.push(` ${key}: ${value}`);\n if (result.sections.length > 0) {\n lines.push('', 'sections:');\n for (const s of result.sections) lines.push(` ${'#'.repeat(s.level as number)} ${s.heading} [L${s.start_line}-${s.end_line}, ~${s.tokens}t]`);\n }\n const linkLine = (label: string, shown: string[], total: number) => {\n if (total > 0) lines.push(`${label} (${total}): ${shown.join(', ')}${total > shown.length ? `, +${total - shown.length} more` : ''}`);\n };\n if (result.outboundTotal + result.unresolvedTotal + result.backlinksTotal > 0) lines.push('');\n linkLine('links out', result.outbound, result.outboundTotal);\n linkLine('unresolved', result.unresolved, result.unresolvedTotal);\n linkLine('backlinks', result.backlinks, result.backlinksTotal);\n return lines.join('\\n');\n}\n"],"names":["printRows","renderMap","renderPeek","OVERSIZE_BYTES","cell","value","String","replace","rows","format","rendered","render","console","log","length","warn","Math","round","JSON","stringify","columns","Object","keys","cells","map","row","col","widths","i","max","formatRow","values","padEnd","join","w","repeat","result","parts","docs","count","bytes","fields","fieldsTotal","push","hubs","recent","lines","path","tokens","entries","frontmatter","key","sections","s","level","heading","start_line","end_line","linkLine","label","shown","total","outboundTotal","unresolvedTotal","backlinksTotal","outbound","unresolved","backlinks"],"mappings":"AAAA,iCAAiC;;;;;;;;;;;;QAYjBA;eAAAA;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/output.ts"],"sourcesContent":["// rows -> table (default) | json\n\nexport type Row = Record<string, unknown>;\n\n// Warned about on stderr (keeps --format json stdout machine-readable), never truncated.\nconst OVERSIZE_BYTES = 50_000;\n\n// Flatten embedded newlines so they can't break table column alignment; JSON output is left alone.\nfunction cell(value: unknown): string {\n return String(value ?? '').replace(/\\s*\\n\\s*/g, ' ');\n}\n\nexport function printRows(rows: Row[], format: 'table' | 'json'): void {\n const rendered = render(rows, format);\n console.log(rendered);\n if (rendered.length > OVERSIZE_BYTES) {\n console.warn(`warning: result is ${Math.round(rendered.length / 1000)} KB across ${rows.length} row(s); consider a LIMIT, fewer columns, or snippet() instead of whole values`);\n }\n}\n\nfunction render(rows: Row[], format: 'table' | 'json'): string {\n if (format === 'json') return JSON.stringify(rows, null, 2);\n if (rows.length === 0) return '(0 rows)';\n\n const columns = Object.keys(rows[0]);\n const cells = rows.map((row) => columns.map((col) => cell(row[col])));\n const widths = columns.map((col, i) => Math.max(col.length, ...cells.map((row) => row[i].length)));\n\n const formatRow = (values: string[]) => values.map((value, i) => value.padEnd(widths[i])).join(' ');\n\n return [formatRow(columns), widths.map((w) => '-'.repeat(w)).join(' '), ...cells.map(formatRow)].join('\\n');\n}\n\n// Text renderers for the layer verbs; cli.ts prints what these return.\n\nfunction featuresLine(features: { on: string[]; off: string[] }): string {\n const off = features.off.length > 0 ? ` · off: ${features.off.map((name) => `${name} (features.${name})`).join(', ')}` : '';\n return `features: ${features.on.join(', ')}${off}`;\n}\n\nexport function renderMap(result: { docs: { count: number; bytes: number }; fields: Row[]; fieldsTotal: number; features: { on: string[]; off: string[] }; hubs: Row[]; recent: Row[] }): string {\n const parts = [`docs: ${result.docs.count} (${Math.round(result.docs.bytes / 1024)} KB)`, `${featuresLine(result.features)}\\n`, render(result.fields, 'table')];\n if (result.fieldsTotal > result.fields.length) parts.push(`(+${result.fieldsTotal - result.fields.length} more fields)`);\n if (result.hubs.length > 0) parts.push('\\nhubs (by link rank):', render(result.hubs, 'table'));\n else if (result.features.off.includes('rank')) parts.push('\\nhubs: off (features.rank)');\n parts.push('\\nrecent:', render(result.recent, 'table'));\n return parts.join('\\n');\n}\n\nexport function renderPeek(result: { path: string; tokens: number; frontmatter: Row; sections: Row[]; outbound: string[]; backlinks: string[]; unresolved: string[]; outboundTotal: number; backlinksTotal: number; unresolvedTotal: number; off: string[] }): string {\n const lines = [`${result.path} (~${result.tokens} tokens)`];\n for (const [key, value] of Object.entries(result.frontmatter)) lines.push(` ${key}: ${value}`);\n if (result.sections.length > 0) {\n lines.push('', 'sections:');\n for (const s of result.sections) lines.push(` ${'#'.repeat(s.level as number)} ${s.heading} [L${s.start_line}-${s.end_line}, ~${s.tokens}t]`);\n } else if (result.off.includes('sections')) lines.push('', 'sections: off (features.sections)');\n if (result.off.includes('links')) {\n lines.push('', 'links: off (features.links)');\n return lines.join('\\n');\n }\n const linkLine = (label: string, shown: string[], total: number) => {\n if (total > 0) lines.push(`${label} (${total}): ${shown.join(', ')}${total > shown.length ? `, +${total - shown.length} more` : ''}`);\n };\n if (result.outboundTotal + result.unresolvedTotal + result.backlinksTotal > 0) lines.push('');\n linkLine('links out', result.outbound, result.outboundTotal);\n linkLine('unresolved', result.unresolved, result.unresolvedTotal);\n linkLine('backlinks', result.backlinks, result.backlinksTotal);\n return lines.join('\\n');\n}\n"],"names":["printRows","renderMap","renderPeek","OVERSIZE_BYTES","cell","value","String","replace","rows","format","rendered","render","console","log","length","warn","Math","round","JSON","stringify","columns","Object","keys","cells","map","row","col","widths","i","max","formatRow","values","padEnd","join","w","repeat","featuresLine","features","off","name","on","result","parts","docs","count","bytes","fields","fieldsTotal","push","hubs","includes","recent","lines","path","tokens","entries","frontmatter","key","sections","s","level","heading","start_line","end_line","linkLine","label","shown","total","outboundTotal","unresolvedTotal","backlinksTotal","outbound","unresolved","backlinks"],"mappings":"AAAA,iCAAiC;;;;;;;;;;;;QAYjBA;eAAAA;;QA4BAC;eAAAA;;QASAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7ChB,yFAAyF;AACzF,IAAMC,iBAAiB;AAEvB,mGAAmG;AACnG,SAASC,KAAKC,KAAc;IAC1B,OAAOC,OAAOD,kBAAAA,mBAAAA,QAAS,IAAIE,OAAO,CAAC,aAAa;AAClD;AAEO,SAASP,UAAUQ,IAAW,EAAEC,MAAwB;IAC7D,IAAMC,WAAWC,OAAOH,MAAMC;IAC9BG,QAAQC,GAAG,CAACH;IACZ,IAAIA,SAASI,MAAM,GAAGX,gBAAgB;QACpCS,QAAQG,IAAI,CAAC,AAAC,sBAAqEP,OAAhDQ,KAAKC,KAAK,CAACP,SAASI,MAAM,GAAG,OAAM,eAAyB,OAAZN,KAAKM,MAAM,EAAC;IACjG;AACF;AAEA,SAASH,OAAOH,IAAW,EAAEC,MAAwB;QAMZO;IALvC,IAAIP,WAAW,QAAQ,OAAOS,KAAKC,SAAS,CAACX,MAAM,MAAM;IACzD,IAAIA,KAAKM,MAAM,KAAK,GAAG,OAAO;IAE9B,IAAMM,UAAUC,OAAOC,IAAI,CAACd,IAAI,CAAC,EAAE;IACnC,IAAMe,QAAQf,KAAKgB,GAAG,CAAC,SAACC;eAAQL,QAAQI,GAAG,CAAC,SAACE;mBAAQtB,KAAKqB,GAAG,CAACC,IAAI;;;IA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AAA,8BAAA;oBAAA;;;oBAAA;0BAAA;;;;IACP,OAAO,IAAIb,OAAOH,GAAG,CAACY,QAAQ,CAAC,aAAaE,MAAMJ,IAAI,CAAC,IAAI;IAC3D,IAAIP,OAAOH,GAAG,CAACY,QAAQ,CAAC,UAAU;QAChCE,MAAMJ,IAAI,CAAC,IAAI;QACf,OAAOI,MAAMnB,IAAI,CAAC;IACpB;IACA,IAAM+B,WAAW,kBAACC,OAAeC,OAAiBC;QAChD,IAAIA,QAAQ,GAAGf,MAAMJ,IAAI,CAAC,AAAC,GAAYmB,OAAVF,OAAM,MAAeC,OAAXC,OAAM,OAAwBA,OAAnBD,MAAMjC,IAAI,CAAC,OAAsE,OAA9DkC,QAAQD,MAAMpD,MAAM,GAAG,AAAC,MAA0B,OAArBqD,QAAQD,MAAMpD,MAAM,EAAC,WAAS;IAClI;IACA,IAAI2B,OAAO2B,aAAa,GAAG3B,OAAO4B,eAAe,GAAG5B,OAAO6B,cAAc,GAAG,GAAGlB,MAAMJ,IAAI,CAAC;IAC1FgB,SAAS,aAAavB,OAAO8B,QAAQ,EAAE9B,OAAO2B,aAAa;IAC3DJ,SAAS,cAAcvB,OAAO+B,UAAU,EAAE/B,OAAO4B,eAAe;IAChEL,SAAS,aAAavB,OAAOgC,SAAS,EAAEhC,OAAO6B,cAAc;IAC7D,OAAOlB,MAAMnB,IAAI,CAAC;AACpB"}
|
package/dist/cjs/scan.js
CHANGED
|
@@ -144,26 +144,27 @@ function parseFile(file) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
+
// title/summary are plain YAML strings -- whitespace-collapse only;
|
|
148
|
+
// the prose gets the full markdown strip.
|
|
149
|
+
var search = {
|
|
150
|
+
title: normalizeText(data.title),
|
|
151
|
+
summary: normalizeText(data.summary),
|
|
152
|
+
text: stripText(content)
|
|
153
|
+
};
|
|
147
154
|
return {
|
|
148
155
|
doc: {
|
|
149
156
|
relPath: file.relPath,
|
|
150
157
|
mtimeMs: file.mtimeMs,
|
|
151
158
|
size: file.size,
|
|
152
159
|
data: mapped,
|
|
153
|
-
search:
|
|
154
|
-
// title/summary are plain YAML strings -- whitespace-collapse only;
|
|
155
|
-
// the prose gets the full markdown strip.
|
|
156
|
-
title: normalizeText(data.title),
|
|
157
|
-
summary: normalizeText(data.summary),
|
|
158
|
-
text: stripText(content)
|
|
159
|
-
},
|
|
160
|
+
search: search,
|
|
160
161
|
extracted: Object.fromEntries(extractors.filter(function(f) {
|
|
161
162
|
return f.extract;
|
|
162
163
|
}).map(function(f) {
|
|
163
164
|
var _f_extract;
|
|
164
165
|
return [
|
|
165
166
|
f.name,
|
|
166
|
-
(_f_extract = f.extract) === null || _f_extract === void 0 ? void 0 : _f_extract.call(f, raw, content)
|
|
167
|
+
(_f_extract = f.extract) === null || _f_extract === void 0 ? void 0 : _f_extract.call(f, raw, content, search)
|
|
167
168
|
];
|
|
168
169
|
}))
|
|
169
170
|
},
|
package/dist/cjs/scan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/scan.ts"],"sourcesContent":["import { readFileSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport fastGlob from 'fast-glob';\nimport removeMarkdown from 'remove-markdown';\nimport { parseDocument } from 'yaml';\nimport type { Config } from './config.ts';\nimport type { Feature } from './features/types.ts';\n\n// Filesystem -> rows. Pure data in, data + warnings out; db.ts does the SQL.\n\n// Reserved: colliding with these would clash with the `frontmatter` table's own columns or the other tables (`content`, `links`, `sections`).\nconst RESERVED_COLUMNS = new Set(['path', '_mtime', '_size', '_rank', 'content', 'links', 'sections']);\n\nfunction normalizeText(value: unknown): string {\n if (value === null || value === undefined) return '';\n return String(value).replace(/\\s+/g, ' ').trim();\n}\n\n// Markdown is stripped at index time so snippets read as clean prose (also improves matching, e.g. `**bold**` indexes as `bold`).\n// remove-markdown doesn't cover Obsidian wikilinks or table scaffolding, so those are handled first/after.\nfunction stripText(value: string): string {\n const withoutWikilinks = value.replace(/\\[\\[([^\\]|]+)\\|([^\\]]+)\\]\\]/g, '$2').replace(/\\[\\[([^\\]]+)\\]\\]/g, '$1');\n const withoutMarkdown = removeMarkdown(withoutWikilinks);\n const withoutTables = withoutMarkdown.replace(/^\\s*\\|?[-\\s|:]+\\|\\s*$/gm, '').replace(/\\|/g, ' ');\n return normalizeText(withoutTables);\n}\n\nexport interface FileStat {\n relPath: string;\n absPath: string;\n mtimeMs: number;\n size: number;\n}\n\nexport function listFiles(cfg: Config, baseDir: string): FileStat[] {\n const relPaths = fastGlob.sync(cfg.scan.include, { cwd: baseDir }).sort();\n return relPaths.map((relPath) => {\n const absPath = join(baseDir, relPath);\n const st = statSync(absPath);\n return { relPath, absPath, mtimeMs: st.mtimeMs, size: st.size };\n });\n}\n\nexport interface ParsedDoc {\n relPath: string;\n mtimeMs: number;\n size: number;\n data: Record<string, string | number | null>;\n // title/summary are duplicated from frontmatter so bm25() can weight them above the body text.\n search: { title: string; summary: string; text: string };\n // Per-feature extraction results, keyed by feature name; features store them at reconcile.\n extracted: Record<string, unknown>;\n}\n\nfunction mapValue(value: unknown): string | number | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'boolean') return value ? 1 : 0;\n if (typeof value === 'string' || typeof value === 'number') return value;\n return JSON.stringify(value);\n}\n\n// The delimiter split is all this package used gray-matter for.\nfunction splitFrontmatter(raw: string): { fm: string | null; body: string } {\n const open = raw.match(/^---\\r?\\n/);\n if (!open) return { fm: null, body: raw };\n const rest = raw.slice(open[0].length);\n const close = rest.match(/^---\\r?(\\n|$)/m);\n if (!close || close.index === undefined) return { fm: null, body: raw };\n return { fm: rest.slice(0, close.index), body: rest.slice(close.index + close[0].length) };\n}\n\n// Lenient by design: parseDocument collects syntax errors as data and still yields values,\n// so Obsidian-style frontmatter (e.g. an alias starting with @) survives with a warning.\nfunction parseFrontmatter(relPath: string, fm: string, warnings: string[]): Record<string, unknown> {\n const doc = parseDocument(fm);\n if (doc.errors.length > 0) {\n warnings.push(`warning: ${relPath} frontmatter has ${doc.errors.length} syntax error(s) (${doc.errors[0].message.split('\\n')[0]}); parsed leniently`);\n }\n let data: unknown;\n try {\n data = doc.toJS();\n } catch (err) {\n warnings.push(`warning: ${relPath} has unparseable frontmatter (${(err as Error).message.split('\\n')[0]}); indexing without it`);\n return {};\n }\n if (data === null || data === undefined) return {};\n if (typeof data !== 'object' || Array.isArray(data)) {\n warnings.push(`warning: ${relPath} frontmatter is not a key-value mapping; ignoring it`);\n return {};\n }\n return data as Record<string, unknown>;\n}\n\nexport function parseFile(file: FileStat, extractors: Feature[] = []): { doc: ParsedDoc; warnings: string[] } {\n const raw = readFileSync(file.absPath, 'utf8');\n const warnings: string[] = [];\n\n const { fm, body: content } = splitFrontmatter(raw);\n const data = fm === null ? {} : parseFrontmatter(file.relPath, fm, warnings);\n const mapped: Record<string, string | number | null> = {};\n\n for (const key of Object.keys(data)) {\n if (RESERVED_COLUMNS.has(key)) {\n warnings.push(`warning: ${file.relPath} has a frontmatter key named \"${key}\", which is reserved; ignoring it`);\n continue;\n }\n mapped[key] = mapValue(data[key]);\n }\n\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/scan.ts"],"sourcesContent":["import { readFileSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport fastGlob from 'fast-glob';\nimport removeMarkdown from 'remove-markdown';\nimport { parseDocument } from 'yaml';\nimport type { Config } from './config.ts';\nimport type { Feature } from './features/types.ts';\n\n// Filesystem -> rows. Pure data in, data + warnings out; db.ts does the SQL.\n\n// Reserved: colliding with these would clash with the `frontmatter` table's own columns or the other tables (`content`, `links`, `sections`).\nconst RESERVED_COLUMNS = new Set(['path', '_mtime', '_size', '_rank', 'content', 'links', 'sections']);\n\nfunction normalizeText(value: unknown): string {\n if (value === null || value === undefined) return '';\n return String(value).replace(/\\s+/g, ' ').trim();\n}\n\n// Markdown is stripped at index time so snippets read as clean prose (also improves matching, e.g. `**bold**` indexes as `bold`).\n// remove-markdown doesn't cover Obsidian wikilinks or table scaffolding, so those are handled first/after.\nfunction stripText(value: string): string {\n const withoutWikilinks = value.replace(/\\[\\[([^\\]|]+)\\|([^\\]]+)\\]\\]/g, '$2').replace(/\\[\\[([^\\]]+)\\]\\]/g, '$1');\n const withoutMarkdown = removeMarkdown(withoutWikilinks);\n const withoutTables = withoutMarkdown.replace(/^\\s*\\|?[-\\s|:]+\\|\\s*$/gm, '').replace(/\\|/g, ' ');\n return normalizeText(withoutTables);\n}\n\nexport interface FileStat {\n relPath: string;\n absPath: string;\n mtimeMs: number;\n size: number;\n}\n\nexport function listFiles(cfg: Config, baseDir: string): FileStat[] {\n const relPaths = fastGlob.sync(cfg.scan.include, { cwd: baseDir }).sort();\n return relPaths.map((relPath) => {\n const absPath = join(baseDir, relPath);\n const st = statSync(absPath);\n return { relPath, absPath, mtimeMs: st.mtimeMs, size: st.size };\n });\n}\n\nexport interface ParsedDoc {\n relPath: string;\n mtimeMs: number;\n size: number;\n data: Record<string, string | number | null>;\n // title/summary are duplicated from frontmatter so bm25() can weight them above the body text.\n search: { title: string; summary: string; text: string };\n // Per-feature extraction results, keyed by feature name; features store them at reconcile.\n extracted: Record<string, unknown>;\n}\n\nfunction mapValue(value: unknown): string | number | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'boolean') return value ? 1 : 0;\n if (typeof value === 'string' || typeof value === 'number') return value;\n return JSON.stringify(value);\n}\n\n// The delimiter split is all this package used gray-matter for.\nfunction splitFrontmatter(raw: string): { fm: string | null; body: string } {\n const open = raw.match(/^---\\r?\\n/);\n if (!open) return { fm: null, body: raw };\n const rest = raw.slice(open[0].length);\n const close = rest.match(/^---\\r?(\\n|$)/m);\n if (!close || close.index === undefined) return { fm: null, body: raw };\n return { fm: rest.slice(0, close.index), body: rest.slice(close.index + close[0].length) };\n}\n\n// Lenient by design: parseDocument collects syntax errors as data and still yields values,\n// so Obsidian-style frontmatter (e.g. an alias starting with @) survives with a warning.\nfunction parseFrontmatter(relPath: string, fm: string, warnings: string[]): Record<string, unknown> {\n const doc = parseDocument(fm);\n if (doc.errors.length > 0) {\n warnings.push(`warning: ${relPath} frontmatter has ${doc.errors.length} syntax error(s) (${doc.errors[0].message.split('\\n')[0]}); parsed leniently`);\n }\n let data: unknown;\n try {\n data = doc.toJS();\n } catch (err) {\n warnings.push(`warning: ${relPath} has unparseable frontmatter (${(err as Error).message.split('\\n')[0]}); indexing without it`);\n return {};\n }\n if (data === null || data === undefined) return {};\n if (typeof data !== 'object' || Array.isArray(data)) {\n warnings.push(`warning: ${relPath} frontmatter is not a key-value mapping; ignoring it`);\n return {};\n }\n return data as Record<string, unknown>;\n}\n\nexport function parseFile(file: FileStat, extractors: Feature[] = []): { doc: ParsedDoc; warnings: string[] } {\n const raw = readFileSync(file.absPath, 'utf8');\n const warnings: string[] = [];\n\n const { fm, body: content } = splitFrontmatter(raw);\n const data = fm === null ? {} : parseFrontmatter(file.relPath, fm, warnings);\n const mapped: Record<string, string | number | null> = {};\n\n for (const key of Object.keys(data)) {\n if (RESERVED_COLUMNS.has(key)) {\n warnings.push(`warning: ${file.relPath} has a frontmatter key named \"${key}\", which is reserved; ignoring it`);\n continue;\n }\n mapped[key] = mapValue(data[key]);\n }\n\n // title/summary are plain YAML strings -- whitespace-collapse only;\n // the prose gets the full markdown strip.\n const search = { title: normalizeText(data.title), summary: normalizeText(data.summary), text: stripText(content) };\n\n return {\n doc: {\n relPath: file.relPath,\n mtimeMs: file.mtimeMs,\n size: file.size,\n data: mapped,\n search,\n extracted: Object.fromEntries(extractors.filter((f) => f.extract).map((f) => [f.name, f.extract?.(raw, content, search)])),\n },\n warnings,\n };\n}\n"],"names":["listFiles","parseFile","RESERVED_COLUMNS","Set","normalizeText","value","undefined","String","replace","trim","stripText","withoutWikilinks","withoutMarkdown","removeMarkdown","withoutTables","cfg","baseDir","relPaths","fastGlob","sync","scan","include","cwd","sort","map","relPath","absPath","join","st","statSync","mtimeMs","size","mapValue","JSON","stringify","splitFrontmatter","raw","open","match","fm","body","rest","slice","length","close","index","parseFrontmatter","warnings","doc","parseDocument","errors","push","message","split","data","toJS","err","Array","isArray","file","extractors","readFileSync","content","mapped","Object","keys","key","has","search","title","summary","text","extracted","fromEntries","filter","f","extract","name"],"mappings":";;;;;;;;;;;QAkCgBA;eAAAA;;QA2DAC;eAAAA;;;sBA7FuB;wBAClB;+DACA;qEACM;oBACG;;;;;;;;;;AAI9B,6EAA6E;AAE7E,8IAA8I;AAC9I,IAAMC,mBAAmB,IAAIC,IAAI;IAAC;IAAQ;IAAU;IAAS;IAAS;IAAW;IAAS;CAAW;AAErG,SAASC,cAAcC,KAAc;IACnC,IAAIA,UAAU,QAAQA,UAAUC,WAAW,OAAO;IAClD,OAAOC,OAAOF,OAAOG,OAAO,CAAC,QAAQ,KAAKC,IAAI;AAChD;AAEA,kIAAkI;AAClI,2GAA2G;AAC3G,SAASC,UAAUL,KAAa;IAC9B,IAAMM,mBAAmBN,MAAMG,OAAO,CAAC,gCAAgC,MAAMA,OAAO,CAAC,qBAAqB;IAC1G,IAAMI,kBAAkBC,IAAAA,uBAAc,EAACF;IACvC,IAAMG,gBAAgBF,gBAAgBJ,OAAO,CAAC,2BAA2B,IAAIA,OAAO,CAAC,OAAO;IAC5F,OAAOJ,cAAcU;AACvB;AASO,SAASd,UAAUe,GAAW,EAAEC,OAAe;IACpD,IAAMC,WAAWC,iBAAQ,CAACC,IAAI,CAACJ,IAAIK,IAAI,CAACC,OAAO,EAAE;QAAEC,KAAKN;IAAQ,GAAGO,IAAI;IACvE,OAAON,SAASO,GAAG,CAAC,SAACC;QACnB,IAAMC,UAAUC,IAAAA,cAAI,EAACX,SAASS;QAC9B,IAAMG,KAAKC,IAAAA,gBAAQ,EAACH;QACpB,OAAO;YAAED,SAAAA;YAASC,SAAAA;YAASI,SAASF,GAAGE,OAAO;YAAEC,MAAMH,GAAGG,IAAI;QAAC;IAChE;AACF;AAaA,SAASC,SAA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7D,UAAUoD;IAAS;IAElH,OAAO;QACLd,KAAK;YACHvB,SAASkC,KAAKlC,OAAO;YACrBK,SAAS6B,KAAK7B,OAAO;YACrBC,MAAM4B,KAAK5B,IAAI;YACfuB,MAAMS;YACNK,QAAAA;YACAI,WAAWR,OAAOS,WAAW,CAACb,WAAWc,MAAM,CAAC,SAACC;uBAAMA,EAAEC,OAAO;eAAEpD,GAAG,CAAC,SAACmD;oBAAeA;uBAAT;oBAACA,EAAEE,IAAI;qBAAEF,aAAAA,EAAEC,OAAO,cAATD,iCAAAA,gBAAAA,GAAYvC,KAAK0B,SAASM;iBAAQ;;QAC1H;QACArB,UAAAA;IACF;AACF"}
|
package/dist/cjs/verbs.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import type { Config } from './config.js';
|
|
2
|
+
import type { Config, FeatureName } from './config.js';
|
|
3
3
|
import type { Row } from './output.js';
|
|
4
4
|
export interface FindOptions {
|
|
5
5
|
k?: number;
|
|
6
6
|
where?: string;
|
|
7
|
+
semantic?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare function find(db: DatabaseSync, cfg: Config, terms: string, opts?: FindOptions): Row[]
|
|
9
|
+
export declare function find(db: DatabaseSync, cfg: Config, terms: string, opts?: FindOptions): Promise<Row[]>;
|
|
9
10
|
export interface TreeMap {
|
|
10
11
|
docs: {
|
|
11
12
|
count: number;
|
|
@@ -13,6 +14,10 @@ export interface TreeMap {
|
|
|
13
14
|
};
|
|
14
15
|
fields: Row[];
|
|
15
16
|
fieldsTotal: number;
|
|
17
|
+
features: {
|
|
18
|
+
on: FeatureName[];
|
|
19
|
+
off: FeatureName[];
|
|
20
|
+
};
|
|
16
21
|
hubs: Row[];
|
|
17
22
|
recent: Row[];
|
|
18
23
|
}
|
|
@@ -28,5 +33,6 @@ export interface Peek {
|
|
|
28
33
|
outboundTotal: number;
|
|
29
34
|
backlinksTotal: number;
|
|
30
35
|
unresolvedTotal: number;
|
|
36
|
+
off: FeatureName[];
|
|
31
37
|
}
|
|
32
38
|
export declare function peek(db: DatabaseSync, cfg: Config, pathArg: string): Peek;
|
package/dist/cjs/verbs.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import type { Config } from './config.js';
|
|
2
|
+
import type { Config, FeatureName } from './config.js';
|
|
3
3
|
import type { Row } from './output.js';
|
|
4
4
|
export interface FindOptions {
|
|
5
5
|
k?: number;
|
|
6
6
|
where?: string;
|
|
7
|
+
semantic?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare function find(db: DatabaseSync, cfg: Config, terms: string, opts?: FindOptions): Row[]
|
|
9
|
+
export declare function find(db: DatabaseSync, cfg: Config, terms: string, opts?: FindOptions): Promise<Row[]>;
|
|
9
10
|
export interface TreeMap {
|
|
10
11
|
docs: {
|
|
11
12
|
count: number;
|
|
@@ -13,6 +14,10 @@ export interface TreeMap {
|
|
|
13
14
|
};
|
|
14
15
|
fields: Row[];
|
|
15
16
|
fieldsTotal: number;
|
|
17
|
+
features: {
|
|
18
|
+
on: FeatureName[];
|
|
19
|
+
off: FeatureName[];
|
|
20
|
+
};
|
|
16
21
|
hubs: Row[];
|
|
17
22
|
recent: Row[];
|
|
18
23
|
}
|
|
@@ -28,5 +33,6 @@ export interface Peek {
|
|
|
28
33
|
outboundTotal: number;
|
|
29
34
|
backlinksTotal: number;
|
|
30
35
|
unresolvedTotal: number;
|
|
36
|
+
off: FeatureName[];
|
|
31
37
|
}
|
|
32
38
|
export declare function peek(db: DatabaseSync, cfg: Config, pathArg: string): Peek;
|