sensemaking 0.25.0 → 0.26.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.
Files changed (316) hide show
  1. package/README.md +14 -10
  2. package/dist/cjs/cli/index.d.cts +1 -1
  3. package/dist/cjs/cli/index.d.ts +1 -1
  4. package/dist/cjs/cli/index.js +1 -1
  5. package/dist/cjs/cli/index.js.map +1 -1
  6. package/dist/cjs/cli/path.js +5 -29
  7. package/dist/cjs/cli/path.js.map +1 -1
  8. package/dist/cjs/cli/related.js +4 -3
  9. package/dist/cjs/cli/related.js.map +1 -1
  10. package/dist/cjs/commands/index.d.cts +6 -3
  11. package/dist/cjs/commands/index.d.ts +6 -3
  12. package/dist/cjs/commands/index.js +4 -0
  13. package/dist/cjs/commands/index.js.map +1 -1
  14. package/dist/cjs/commands/map.d.cts +14 -5
  15. package/dist/cjs/commands/map.d.ts +14 -5
  16. package/dist/cjs/commands/map.js +42 -35
  17. package/dist/cjs/commands/map.js.map +1 -1
  18. package/dist/cjs/commands/path.d.cts +14 -0
  19. package/dist/cjs/commands/path.d.ts +14 -0
  20. package/dist/cjs/commands/path.js +209 -0
  21. package/dist/cjs/commands/path.js.map +1 -0
  22. package/dist/cjs/commands/peek.d.cts +16 -1
  23. package/dist/cjs/commands/peek.d.ts +16 -1
  24. package/dist/cjs/commands/peek.js +71 -33
  25. package/dist/cjs/commands/peek.js.map +1 -1
  26. package/dist/cjs/commands/related.d.cts +16 -3
  27. package/dist/cjs/commands/related.d.ts +16 -3
  28. package/dist/cjs/commands/related.js +131 -98
  29. package/dist/cjs/commands/related.js.map +1 -1
  30. package/dist/cjs/commands/scope.d.cts +1 -0
  31. package/dist/cjs/commands/scope.d.ts +1 -0
  32. package/dist/cjs/commands/scope.js +149 -0
  33. package/dist/cjs/commands/scope.js.map +1 -1
  34. package/dist/cjs/commands/search.d.cts +26 -3
  35. package/dist/cjs/commands/search.d.ts +26 -3
  36. package/dist/cjs/commands/search.js +211 -71
  37. package/dist/cjs/commands/search.js.map +1 -1
  38. package/dist/cjs/commands/signals.d.cts +4 -3
  39. package/dist/cjs/commands/signals.d.ts +4 -3
  40. package/dist/cjs/commands/signals.js +13 -4
  41. package/dist/cjs/commands/signals.js.map +1 -1
  42. package/dist/cjs/commands/snapshot.d.cts +3 -0
  43. package/dist/cjs/commands/snapshot.d.ts +3 -0
  44. package/dist/cjs/commands/snapshot.js +180 -0
  45. package/dist/cjs/commands/snapshot.js.map +1 -0
  46. package/dist/cjs/embed/cohere.js +41 -16
  47. package/dist/cjs/embed/cohere.js.map +1 -1
  48. package/dist/cjs/embed/endpoint.d.cts +2 -0
  49. package/dist/cjs/embed/endpoint.d.ts +2 -0
  50. package/dist/cjs/embed/endpoint.js +30 -0
  51. package/dist/cjs/embed/endpoint.js.map +1 -0
  52. package/dist/cjs/embed/handoff.d.cts +7 -2
  53. package/dist/cjs/embed/handoff.d.ts +7 -2
  54. package/dist/cjs/embed/handoff.js +10 -0
  55. package/dist/cjs/embed/handoff.js.map +1 -1
  56. package/dist/cjs/embed/http.d.cts +18 -1
  57. package/dist/cjs/embed/http.d.ts +18 -1
  58. package/dist/cjs/embed/http.js +239 -40
  59. package/dist/cjs/embed/http.js.map +1 -1
  60. package/dist/cjs/embed/openai.js +39 -17
  61. package/dist/cjs/embed/openai.js.map +1 -1
  62. package/dist/cjs/embed/query.d.cts +9 -3
  63. package/dist/cjs/embed/query.d.ts +9 -3
  64. package/dist/cjs/embed/query.js +257 -90
  65. package/dist/cjs/embed/query.js.map +1 -1
  66. package/dist/cjs/embed/registry.d.cts +2 -2
  67. package/dist/cjs/embed/registry.d.ts +2 -2
  68. package/dist/cjs/embed/registry.js +36 -4
  69. package/dist/cjs/embed/registry.js.map +1 -1
  70. package/dist/cjs/embed/static.js +6 -2
  71. package/dist/cjs/embed/static.js.map +1 -1
  72. package/dist/cjs/embed/store.js +42 -77
  73. package/dist/cjs/embed/store.js.map +1 -1
  74. package/dist/cjs/embed/types.d.cts +5 -2
  75. package/dist/cjs/embed/types.d.ts +5 -2
  76. package/dist/cjs/embed/types.js.map +1 -1
  77. package/dist/cjs/features/embed.js +290 -43
  78. package/dist/cjs/features/embed.js.map +1 -1
  79. package/dist/cjs/graph/traverse.d.cts +2 -2
  80. package/dist/cjs/graph/traverse.d.ts +2 -2
  81. package/dist/cjs/graph/traverse.js +15 -5
  82. package/dist/cjs/graph/traverse.js.map +1 -1
  83. package/dist/cjs/index.d.cts +2 -2
  84. package/dist/cjs/index.d.ts +2 -2
  85. package/dist/cjs/index.js +6 -0
  86. package/dist/cjs/index.js.map +1 -1
  87. package/dist/cjs/output/output.d.cts +4 -36
  88. package/dist/cjs/output/output.d.ts +4 -36
  89. package/dist/cjs/output/output.js +1 -2
  90. package/dist/cjs/output/output.js.map +1 -1
  91. package/dist/cjs/scan/pool.d.cts +2 -1
  92. package/dist/cjs/scan/pool.d.ts +2 -1
  93. package/dist/cjs/scan/pool.js +116 -27
  94. package/dist/cjs/scan/pool.js.map +1 -1
  95. package/dist/cjs/scan/reparse.d.cts +1 -0
  96. package/dist/cjs/scan/reparse.d.ts +1 -0
  97. package/dist/cjs/scan/reparse.js +75 -21
  98. package/dist/cjs/scan/reparse.js.map +1 -1
  99. package/dist/cjs/store/builder.d.cts +11 -21
  100. package/dist/cjs/store/builder.d.ts +11 -21
  101. package/dist/cjs/store/builder.js +1077 -438
  102. package/dist/cjs/store/builder.js.map +1 -1
  103. package/dist/cjs/store/duckdb/connection.js +16 -2
  104. package/dist/cjs/store/duckdb/connection.js.map +1 -1
  105. package/dist/cjs/store/duckdb/open.d.cts +1 -1
  106. package/dist/cjs/store/duckdb/open.d.ts +1 -1
  107. package/dist/cjs/store/duckdb/open.js +73 -65
  108. package/dist/cjs/store/duckdb/open.js.map +1 -1
  109. package/dist/cjs/store/duckdb/reconcile.js +533 -15
  110. package/dist/cjs/store/duckdb/reconcile.js.map +1 -1
  111. package/dist/cjs/store/embed-scope.js +19 -9
  112. package/dist/cjs/store/embed-scope.js.map +1 -1
  113. package/dist/cjs/store/index.d.cts +6 -0
  114. package/dist/cjs/store/index.d.ts +6 -0
  115. package/dist/cjs/store/index.js +8 -4
  116. package/dist/cjs/store/index.js.map +1 -1
  117. package/dist/cjs/store/open.d.cts +6 -1
  118. package/dist/cjs/store/open.d.ts +6 -1
  119. package/dist/cjs/store/open.js +230 -307
  120. package/dist/cjs/store/open.js.map +1 -1
  121. package/dist/cjs/store/readiness.d.cts +5 -0
  122. package/dist/cjs/store/readiness.d.ts +5 -0
  123. package/dist/cjs/store/readiness.js +39 -0
  124. package/dist/cjs/store/readiness.js.map +1 -0
  125. package/dist/cjs/store/reconcile.d.cts +26 -1
  126. package/dist/cjs/store/reconcile.d.ts +26 -1
  127. package/dist/cjs/store/reconcile.js +670 -576
  128. package/dist/cjs/store/reconcile.js.map +1 -1
  129. package/dist/cjs/store/signature.d.cts +1 -0
  130. package/dist/cjs/store/signature.d.ts +1 -0
  131. package/dist/cjs/store/signature.js +9 -0
  132. package/dist/cjs/store/signature.js.map +1 -1
  133. package/dist/cjs/store/sqlite/open.d.cts +1 -1
  134. package/dist/cjs/store/sqlite/open.d.ts +1 -1
  135. package/dist/cjs/store/sqlite/open.js +84 -90
  136. package/dist/cjs/store/sqlite/open.js.map +1 -1
  137. package/dist/cjs/store/sqlite/reconcile.js.map +1 -1
  138. package/dist/cjs/store/sqlite/store.js +63 -60
  139. package/dist/cjs/store/sqlite/store.js.map +1 -1
  140. package/dist/cjs/store/sqlite/vectors.d.cts +2 -2
  141. package/dist/cjs/store/sqlite/vectors.d.ts +2 -2
  142. package/dist/cjs/store/sqlite/vectors.js +8 -4
  143. package/dist/cjs/store/sqlite/vectors.js.map +1 -1
  144. package/dist/cjs/store/stages.js.map +1 -1
  145. package/dist/cjs/store/turso/connection.d.cts +1 -0
  146. package/dist/cjs/store/turso/connection.d.ts +1 -0
  147. package/dist/cjs/store/turso/connection.js +319 -94
  148. package/dist/cjs/store/turso/connection.js.map +1 -1
  149. package/dist/cjs/store/turso/open.d.cts +1 -1
  150. package/dist/cjs/store/turso/open.d.ts +1 -1
  151. package/dist/cjs/store/turso/open.js +70 -74
  152. package/dist/cjs/store/turso/open.js.map +1 -1
  153. package/dist/cjs/store/turso/store.js +25 -23
  154. package/dist/cjs/store/turso/store.js.map +1 -1
  155. package/dist/cjs/store/turso/vectors.d.cts +2 -2
  156. package/dist/cjs/store/turso/vectors.d.ts +2 -2
  157. package/dist/cjs/store/turso/vectors.js +26 -16
  158. package/dist/cjs/store/turso/vectors.js.map +1 -1
  159. package/dist/cjs/store/types.d.cts +4 -1
  160. package/dist/cjs/store/types.d.ts +4 -1
  161. package/dist/cjs/store/types.js.map +1 -1
  162. package/dist/cjs/store/vectors.d.cts +14 -1
  163. package/dist/cjs/store/vectors.d.ts +14 -1
  164. package/dist/cjs/store/vectors.js +61 -0
  165. package/dist/cjs/store/vectors.js.map +1 -1
  166. package/dist/cjs/watch.d.cts +6 -0
  167. package/dist/cjs/watch.d.ts +6 -0
  168. package/dist/cjs/watch.js +42 -10
  169. package/dist/cjs/watch.js.map +1 -1
  170. package/dist/cjs/workers/parse.d.cts +4 -3
  171. package/dist/cjs/workers/parse.d.ts +4 -3
  172. package/dist/cjs/workers/parse.js +19 -17
  173. package/dist/cjs/workers/parse.js.map +1 -1
  174. package/dist/esm/cli/index.d.ts +1 -1
  175. package/dist/esm/cli/index.js +1 -1
  176. package/dist/esm/cli/index.js.map +1 -1
  177. package/dist/esm/cli/path.js +4 -10
  178. package/dist/esm/cli/path.js.map +1 -1
  179. package/dist/esm/cli/related.js +5 -3
  180. package/dist/esm/cli/related.js.map +1 -1
  181. package/dist/esm/commands/index.d.ts +6 -3
  182. package/dist/esm/commands/index.js +1 -0
  183. package/dist/esm/commands/index.js.map +1 -1
  184. package/dist/esm/commands/map.d.ts +14 -5
  185. package/dist/esm/commands/map.js +2 -0
  186. package/dist/esm/commands/map.js.map +1 -1
  187. package/dist/esm/commands/path.d.ts +14 -0
  188. package/dist/esm/commands/path.js +33 -0
  189. package/dist/esm/commands/path.js.map +1 -0
  190. package/dist/esm/commands/peek.d.ts +16 -1
  191. package/dist/esm/commands/peek.js +35 -9
  192. package/dist/esm/commands/peek.js.map +1 -1
  193. package/dist/esm/commands/related.d.ts +16 -3
  194. package/dist/esm/commands/related.js +45 -28
  195. package/dist/esm/commands/related.js.map +1 -1
  196. package/dist/esm/commands/scope.d.ts +1 -0
  197. package/dist/esm/commands/scope.js +58 -0
  198. package/dist/esm/commands/scope.js.map +1 -1
  199. package/dist/esm/commands/search.d.ts +26 -3
  200. package/dist/esm/commands/search.js +85 -18
  201. package/dist/esm/commands/search.js.map +1 -1
  202. package/dist/esm/commands/signals.d.ts +4 -3
  203. package/dist/esm/commands/signals.js +11 -4
  204. package/dist/esm/commands/signals.js.map +1 -1
  205. package/dist/esm/commands/snapshot.d.ts +3 -0
  206. package/dist/esm/commands/snapshot.js +25 -0
  207. package/dist/esm/commands/snapshot.js.map +1 -0
  208. package/dist/esm/embed/cohere.js +35 -10
  209. package/dist/esm/embed/cohere.js.map +1 -1
  210. package/dist/esm/embed/endpoint.d.ts +2 -0
  211. package/dist/esm/embed/endpoint.js +11 -0
  212. package/dist/esm/embed/endpoint.js.map +1 -0
  213. package/dist/esm/embed/handoff.d.ts +7 -2
  214. package/dist/esm/embed/handoff.js +7 -0
  215. package/dist/esm/embed/handoff.js.map +1 -1
  216. package/dist/esm/embed/http.d.ts +18 -1
  217. package/dist/esm/embed/http.js +137 -17
  218. package/dist/esm/embed/http.js.map +1 -1
  219. package/dist/esm/embed/openai.js +34 -12
  220. package/dist/esm/embed/openai.js.map +1 -1
  221. package/dist/esm/embed/query.d.ts +9 -3
  222. package/dist/esm/embed/query.js +98 -26
  223. package/dist/esm/embed/query.js.map +1 -1
  224. package/dist/esm/embed/registry.d.ts +2 -2
  225. package/dist/esm/embed/registry.js +34 -5
  226. package/dist/esm/embed/registry.js.map +1 -1
  227. package/dist/esm/embed/static.js +10 -2
  228. package/dist/esm/embed/static.js.map +1 -1
  229. package/dist/esm/embed/store.js +30 -21
  230. package/dist/esm/embed/store.js.map +1 -1
  231. package/dist/esm/embed/types.d.ts +5 -2
  232. package/dist/esm/embed/types.js.map +1 -1
  233. package/dist/esm/features/embed.js +82 -21
  234. package/dist/esm/features/embed.js.map +1 -1
  235. package/dist/esm/graph/traverse.d.ts +2 -2
  236. package/dist/esm/graph/traverse.js +4 -2
  237. package/dist/esm/graph/traverse.js.map +1 -1
  238. package/dist/esm/index.d.ts +2 -2
  239. package/dist/esm/index.js +1 -1
  240. package/dist/esm/index.js.map +1 -1
  241. package/dist/esm/output/output.d.ts +4 -36
  242. package/dist/esm/output/output.js +1 -2
  243. package/dist/esm/output/output.js.map +1 -1
  244. package/dist/esm/scan/pool.d.ts +2 -1
  245. package/dist/esm/scan/pool.js +80 -23
  246. package/dist/esm/scan/pool.js.map +1 -1
  247. package/dist/esm/scan/reparse.d.ts +1 -0
  248. package/dist/esm/scan/reparse.js +40 -12
  249. package/dist/esm/scan/reparse.js.map +1 -1
  250. package/dist/esm/store/builder.d.ts +11 -21
  251. package/dist/esm/store/builder.js +337 -133
  252. package/dist/esm/store/builder.js.map +1 -1
  253. package/dist/esm/store/duckdb/connection.js +9 -1
  254. package/dist/esm/store/duckdb/connection.js.map +1 -1
  255. package/dist/esm/store/duckdb/open.d.ts +1 -1
  256. package/dist/esm/store/duckdb/open.js +13 -9
  257. package/dist/esm/store/duckdb/open.js.map +1 -1
  258. package/dist/esm/store/duckdb/reconcile.js +145 -10
  259. package/dist/esm/store/duckdb/reconcile.js.map +1 -1
  260. package/dist/esm/store/embed-scope.js +16 -6
  261. package/dist/esm/store/embed-scope.js.map +1 -1
  262. package/dist/esm/store/index.d.ts +6 -0
  263. package/dist/esm/store/index.js +10 -4
  264. package/dist/esm/store/index.js.map +1 -1
  265. package/dist/esm/store/open.d.ts +6 -1
  266. package/dist/esm/store/open.js +77 -87
  267. package/dist/esm/store/open.js.map +1 -1
  268. package/dist/esm/store/readiness.d.ts +5 -0
  269. package/dist/esm/store/readiness.js +11 -0
  270. package/dist/esm/store/readiness.js.map +1 -0
  271. package/dist/esm/store/reconcile.d.ts +26 -1
  272. package/dist/esm/store/reconcile.js +142 -120
  273. package/dist/esm/store/reconcile.js.map +1 -1
  274. package/dist/esm/store/signature.d.ts +1 -0
  275. package/dist/esm/store/signature.js +8 -0
  276. package/dist/esm/store/signature.js.map +1 -1
  277. package/dist/esm/store/sqlite/open.d.ts +1 -1
  278. package/dist/esm/store/sqlite/open.js +12 -12
  279. package/dist/esm/store/sqlite/open.js.map +1 -1
  280. package/dist/esm/store/sqlite/reconcile.js +2 -2
  281. package/dist/esm/store/sqlite/reconcile.js.map +1 -1
  282. package/dist/esm/store/sqlite/store.js +21 -18
  283. package/dist/esm/store/sqlite/store.js.map +1 -1
  284. package/dist/esm/store/sqlite/vectors.d.ts +2 -2
  285. package/dist/esm/store/sqlite/vectors.js +7 -5
  286. package/dist/esm/store/sqlite/vectors.js.map +1 -1
  287. package/dist/esm/store/stages.js.map +1 -1
  288. package/dist/esm/store/turso/connection.d.ts +1 -0
  289. package/dist/esm/store/turso/connection.js +97 -28
  290. package/dist/esm/store/turso/connection.js.map +1 -1
  291. package/dist/esm/store/turso/open.d.ts +1 -1
  292. package/dist/esm/store/turso/open.js +9 -8
  293. package/dist/esm/store/turso/open.js.map +1 -1
  294. package/dist/esm/store/turso/store.js +16 -14
  295. package/dist/esm/store/turso/store.js.map +1 -1
  296. package/dist/esm/store/turso/vectors.d.ts +2 -2
  297. package/dist/esm/store/turso/vectors.js +27 -17
  298. package/dist/esm/store/turso/vectors.js.map +1 -1
  299. package/dist/esm/store/types.d.ts +4 -1
  300. package/dist/esm/store/types.js.map +1 -1
  301. package/dist/esm/store/vectors.d.ts +14 -1
  302. package/dist/esm/store/vectors.js +55 -0
  303. package/dist/esm/store/vectors.js.map +1 -1
  304. package/dist/esm/watch.d.ts +6 -0
  305. package/dist/esm/watch.js +40 -14
  306. package/dist/esm/watch.js.map +1 -1
  307. package/dist/esm/workers/parse.d.ts +4 -3
  308. package/dist/esm/workers/parse.js +19 -17
  309. package/dist/esm/workers/parse.js.map +1 -1
  310. package/package.json +1 -1
  311. package/skills/sense/SKILL.md +4 -2
  312. package/skills/sense/references/stores/duckdb.md +1 -1
  313. package/skills/sense-setup/SKILL.md +2 -2
  314. package/skills/sense-setup/references/embeddings.md +1 -1
  315. package/skills/sense-setup/references/store-benchmarks.md +5 -5
  316. package/skills/sense-setup/references/stores/duckdb.md +1 -1
package/README.md CHANGED
@@ -66,11 +66,11 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
66
66
  | command | does |
67
67
  |---|---|
68
68
  | `build [--force]` | incrementally update the derived index and prepare every configured search capability; `--force` recreates only `.sense/` |
69
- | `map` | doc count, frontmatter field coverage, top hubs by link rank, recent changes; hub/recent limits use bytewise path order on ties |
69
+ | `map [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"]` | doc count, frontmatter field coverage, top hubs by link rank, recent changes; hub/recent limits use bytewise path order on ties |
70
70
  | `search "<text>" [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n]` | words + links + vectors, one fused ranked list; `via` labels each row's evidence. `--k` bounds notes returned, `--snippet-char-limit` (default 80) each passage, `--snippet-count-limit` (default 1) passages per note |
71
- | `peek <path> [--preset name] [--where "<sql>"]` | frontmatter + heading outline (`[L143-162, ~380t]`) + links both ways (first 20 per list, each with its total) |
72
- | `path <a> <b> [--max-depth n] [--preset name] [--where "<sql>"]` | shortest link chain between two notes, or none within the bound |
73
- | `related <note> [--k n] [--preset name] [--where "<sql>"]` | notes similar in meaning that `<note>` does not yet link to; reads vectors, so semantic-search cost |
71
+ | `peek <path> [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"]` | frontmatter + heading outline (`[L143-162, ~380t]`) + links both ways (first 20 per list, each with its total) |
72
+ | `path <a> <b> [--max-depth n] [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"]` | shortest link chain between two notes, or none within the bound |
73
+ | `related <note> [--k n] [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"]` | notes similar in meaning that `<note>` does not yet link to; reads vectors, so semantic-search cost |
74
74
  | `sql "<statement>" [params...] [--preset name]` | ad-hoc SQL over all the tables; `?` binds positional args. Index-wide by default; `--preset` binds the preset's paths as a `scope` table the statement joins |
75
75
  | `<name> [params...]` | run a query saved in the config; `--list` names them |
76
76
  | `init` | write a starter `sense.config.json` |
@@ -78,15 +78,19 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
78
78
  | `download` | prefetch the embedding model named in the config; build, watch, or a default CLI vector query fetches it when needed otherwise |
79
79
  | `watch` | keep the index warm in the background (optional; see [watch coordination](https://github.com/kmalakoff/sensemaking/blob/master/DESIGN.md#watch-coordination)) |
80
80
 
81
+ Scope flags select from indexed notes; presets are not a security boundary. `peek` rejects an exact path outside the selected scope before trying a basename, resolves a basename only within that scope, and limits resolved outbound links and backlinks to it; unresolved targets remain as written. `path` resolves both endpoints across the indexed tree and applies scope to intermediate notes. `related` resolves its seed across the indexed tree and applies scope to result candidates.
82
+
81
83
  Query commands use the config's `"build": true` default to update the index first and prepare only what that operation needs. Core map, peek, path and SQL work do not prepare vectors. Set `"build": false` for a manual-build or watch workflow, or add `--no-build` for one query. These read the last completed generation without scanning source files or repairing missing readiness; they fail with a `sense build` instruction when the requested capability is not ready. This disables Sense index maintenance, not database access or arbitrary SQL.
82
84
 
83
- The completed generation stores the exact decoded source used for indexed snippets. A no-build query reads those stored sources and checks readiness for the capabilities it requests; it does not hydrate from newer live files. A default query incrementally scans the configured tree for the capabilities it needs; vector preparation is limited to its eligible scope. `sense build` prepares every configured capability, and `sense watch` keeps them prepared as changes arrive.
85
+ The completed generation stores the exact decoded source used for indexed snippets. A no-build query reads those stored sources and checks readiness for the capabilities it requests; it does not hydrate from newer live files. Public `search`, `mapTree`, `peek`, `findPath`, and `relatedNotes` calls assemble each result inside one committed database snapshot. Search completes provider and model preparation before its final snapshot and rejects an incomplete generation or one built for different feature settings instead of mixing generations. A default query incrementally scans the configured tree for the capabilities it needs; vector preparation is limited to its eligible scope. `sense build` prepares every configured capability, and `sense watch` keeps them prepared as changes arrive.
86
+
87
+ Explicit `sense build` and `sense watch` prepare the index regardless of the config's `build` default. Watch builds before reporting ready, then processes edits; with SQLite, a no-build query can read the previous generation while an edit is being processed. DuckDB permits concurrent cross-process no-build readers only while every handle is observational and read-only; a build or watcher opens the cache read-write and excludes every other process. Turso no-build queries still require a query-capable, exclusive handle. Native contenders wait within a bounded lock budget, then raise `STORE_BUSY`, as described under Store choice. Library callers choose preparation separately at `open`: `open(config)` prepares every configured capability, and `open(config, { build: false })` opens existing compatible state. A build-enabled open repairs incomplete feature state and replaces an incompatible derived cache format; a no-build open reports the required build without rebuilding or repairing the Sense index. The config's `build` setting controls CLI queries only. `build(config, { force: true })` recreates only the derived index. Public `search`, `mapTree`, `peek`, `findPath`, and `relatedNotes` calls on one retained `Store` serialize with one another. Await those calls before running raw SQL, starting a transaction, or closing the handle.
84
88
 
85
- Explicit `sense build` and `sense watch` prepare the index regardless of the config's `build` default. Watch builds before reporting ready, then processes edits; a no-build query can read the previous generation while an edit is being processed. Library callers choose preparation separately at `open`: `open(config)` prepares every configured capability, and `open(config, { build: false })` opens existing compatible state. The config's `build` setting controls CLI queries only. `build(config, { force: true })` recreates only the derived index. Public `search`, `mapTree`, and `peek` calls on one retained `Store` serialize with one another. Await those calls before running raw SQL, starting a transaction, or closing the handle.
89
+ The root `search(store, config, terms, { signal })`, `open(config, { signal })`, and `build(config, { signal })` APIs accept an `AbortSignal`. Cancellation stops supported provider I/O and is checked between phases; synchronous native SQL or CPU work and resource cleanup finish before the promise settles. Cancellation checks preserve `signal.reason`, but a cleanup failure can surface instead or be combined with it in an `AggregateError`.
86
90
 
87
91
  `search` runs one text through every engine its scope has: FTS5 word match (BM25-ranked, bare words AND-join, operators are yours on `sqlite`; on `duckdb` and `turso` the FTS5 operators are a named error, see Config), a personalized-PageRank walk over the link graph, and vector similarity, fused into one list. `via` labels each row's evidence (`match`, `link`, `vector`, combinations). Within the vector signal, candidates rank by the true cosine against the best-matching canonical chunk before `similarity` is rounded to three decimals for display; a zero-direction vector has similarity `0`, exact cosine ties use bytewise path order, and equal-scoring chunks choose the earliest authored chunk. The public search list ranks the combined word, link, and vector candidates by fused reciprocal-rank score. `lines` points at the section that earned the row (a direct read range). A `vector`-only row means the search words don't appear in that note; it showed up because the model judged it semantically related. `--preset` picks a named settings bundle from the config, `--where` filters on frontmatter. `--format json` on any reporting command returns structured output, and `--format csv` writes the row-returning commands one row per line, for redirecting a large result to a file instead of into context; `--version` and `--help` do what they say.
88
92
 
89
- Search rows carry `snippets: string[]`. Each passage is generated around the matched words, marked with `«»`, and limited to 80 characters by default. `--snippet-count-limit` returns more non-overlapping passages from a note, in document order. Link- and vector-only rows have `snippets: []`.
93
+ Search rows carry `snippets: string[]`. Each passage is generated around the matched words, marked with `«»`, and normally limited to 80 characters by default. A whole matched word is preserved, so a passage can exceed that limit when the word is longer. `--snippet-count-limit` returns more non-overlapping passages from a note, in document order. Link- and vector-only rows have `snippets: []`.
90
94
 
91
95
  Lexical words are case- and accent-insensitive. SQLite and DuckDB use their native English stem tokenizers; Turso's native Tantivy index has no stem tokenizer in the supported release, so it applies the shared Porter normalization to a derived field before native indexing. In every store, `run`, `running`, and `runs` match the same authored notes, while authored bytes are never rewritten. Quoted phrases require adjacent words, with punctuation treated as a separator, and punctuation-only input returns no lexical rows. SQLite's native caret and `NEAR(...)` expressions over unspaced text use original FTS5 tokens rather than sidecar substring semantics; use an ordinary quoted search when substring findability matters, at the cost of positional filtering.
92
96
 
@@ -126,11 +130,11 @@ Bare commands use the `default` preset; `--preset` names another; flags override
126
130
 
127
131
  ### Store choice
128
132
 
129
- Choose `sqlite` for the smallest setup, full FTS5 query syntax, and concurrent Sense commands. Choose `duckdb` when the cache should participate in DuckDB analytical work over large datasets or in local/cloud workflows. Choose `turso` for its embedded Rust engine and Tantivy text index. The DuckDB and Turso adapters are experimental, install their native package on first use, and currently serialize Sense commands that open the same cache.
133
+ Choose `sqlite` for the smallest setup, full FTS5 query syntax, and concurrent Sense commands. Choose `duckdb` when the cache should participate in DuckDB analytical work over large datasets or in local/cloud workflows. Choose `turso` for its embedded Rust engine and Tantivy text index. The DuckDB and Turso adapters are experimental and install their native package on first use.
130
134
 
131
- The commands and table names are shared. Raw SQL still follows the selected engine's dialect, and advanced FTS5 operators only work on `sqlite`. DuckDB and Turso hold their cache file for the life of a native handle, so Sense commands opening the same cache wait for the current command or watcher cycle to close; this is an adapter limitation, not a reader/writer coexistence guarantee.
135
+ The commands and table names are shared. Raw SQL still follows the selected engine's dialect, and advanced FTS5 operators only work on `sqlite`. Separate DuckDB processes may coexist only when every handle is observational and read-only. A DuckDB build-enabled open or watcher is read-write and excludes all other processes. Turso's observational path remains query-capable, so any Turso handle excludes other processes. Sense waits within a bounded lock budget for exclusive native access, then raises `STORE_BUSY`; neither adapter promises writer/reader coexistence. Public commands on one retained `Store` serialize separately, as described above.
132
136
 
133
- Vectors need a model. Naming a Hugging Face id in `embed.model` is consent to fetch it when `sense build`, `sense watch`, or a default CLI vector query first prepares vectors, with progress on stderr, into `~/.sense/models` (huggingface_hub's cache layout, one snapshot directory per resolved revision, shared by every tree, 124 MB, never in the package). `sense download` prefetches the same model ahead of time; it is idempotent and prints the resolved revision. `embed.model` is a Hugging Face id, or a path to a directory holding `model.safetensors` and `tokenizer.json`, which nothing fetches for you. A preset that asks for vectors when a local model path is missing those files is an error naming the fix, rather than a quieter result that would make the same search answer differently before and after; a preset whose `signals` exclude `vectors` never asks, so it is unaffected. An optional top-level `"embed": { "model", "provider", "url", "key" }` block points at any Model2Vec model, local path, or OpenAI-compatible endpoint (Ollama, LM Studio, hosted). Explicit builds and watch prepare all configured vectors. A default CLI vector query prepares only its eligible scope; `--no-build` requires that scope to be ready and never prepares it. Unrelated pending documents do not block either path.
137
+ Vectors need a model. Naming a Hugging Face id in `embed.model` is consent to fetch it when `sense build`, `sense watch`, or a default CLI vector query first prepares vectors, with progress on stderr, into `~/.sense/models` (huggingface_hub's cache layout, one snapshot directory per resolved revision, shared by every tree, 124 MB, never in the package). `sense download` prefetches the same model ahead of time; it is idempotent and prints the resolved revision. `embed.model` is a Hugging Face id, or a path to a directory holding `model.safetensors` and `tokenizer.json`, which nothing fetches for you. A preset that asks for vectors when a local model path is missing those files is an error naming the fix, rather than a quieter result that would make the same search answer differently before and after; a preset whose `signals` exclude `vectors` never asks, so it is unaffected. An optional top-level `"embed": { "model", "provider", "url", "key" }` block points at any Model2Vec model, local path, or OpenAI-compatible endpoint (Ollama, LM Studio, hosted). Changing the provider, model, or effective endpoint invalidates stale vectors; changing chunk size rebuilds the affected embedding rows. Explicit builds and watch prepare all configured vectors. A default CLI vector query prepares only its eligible scope; `--no-build` requires that scope to be ready and never prepares it. Unrelated pending documents do not block either path.
134
138
 
135
139
  Sense adds `has(field, value)` for array membership or string containment and `basename(path)` for path queries on every store. SQLite and DuckDB also provide `segment(terms)` for hand-written matching over text without word spaces. A frontmatter syntax error records `_parse_error` and leaves that file's discovered fields empty; the file's content still enters the index.
136
140
 
@@ -7,7 +7,7 @@ export declare const USAGE: {
7
7
  readonly download: "download [--config path]";
8
8
  readonly sql: "sql \"<statement>\" [params...] [--preset name] [--no-build] [--format table|json|csv] [--config path]";
9
9
  readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n] [--no-build] [--format table|json|csv] [--config path]";
10
- readonly map: "map [--no-build] [--format table|json] [--config path]";
10
+ readonly map: "map [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]";
11
11
  readonly peek: "peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]";
12
12
  readonly path: "path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--no-build] [--format table|json] [--config path]";
13
13
  readonly related: "related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--no-build] [--format table|json|csv] [--config path]";
@@ -7,7 +7,7 @@ export declare const USAGE: {
7
7
  readonly download: "download [--config path]";
8
8
  readonly sql: "sql \"<statement>\" [params...] [--preset name] [--no-build] [--format table|json|csv] [--config path]";
9
9
  readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n] [--no-build] [--format table|json|csv] [--config path]";
10
- readonly map: "map [--no-build] [--format table|json] [--config path]";
10
+ readonly map: "map [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]";
11
11
  readonly peek: "peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]";
12
12
  readonly path: "path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--no-build] [--format table|json] [--config path]";
13
13
  readonly related: "related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--no-build] [--format table|json|csv] [--config path]";
@@ -54,7 +54,7 @@ var USAGE = {
54
54
  download: 'download [--config path]',
55
55
  sql: 'sql "<statement>" [params...] [--preset name] [--no-build] [--format table|json|csv] [--config path]',
56
56
  search: 'search "<terms>" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n] [--no-build] [--format table|json|csv] [--config path]',
57
- map: 'map [--no-build] [--format table|json] [--config path]',
57
+ map: 'map [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--no-build] [--format table|json] [--config path]',
58
58
  peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--no-build] [--format table|json] [--config path]',
59
59
  path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--max-depth n] [--no-build] [--format table|json] [--config path]',
60
60
  related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--k n] [--no-build] [--format table|json|csv] [--config path]'
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/index.ts"],"sourcesContent":["import type { Command } from './types.ts';\n\n// Each command's usage line, minus the leading \"usage: <name> \": shared by cli.ts's\n// usage() and the command's own parse() error/--help output so there is one copy, not two.\nexport const USAGE = {\n init: 'init [--model id-or-path] [--provider static|openai|cohere] [--url url]',\n build: 'build [--force] [--config path]',\n watch: 'watch [--force] [--config path]',\n status: 'status [--format table|json] [--config path]',\n download: 'download [--config path]',\n sql: 'sql \"<statement>\" [params...] [--preset name] [--no-build] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n] [--no-build] [--format table|json|csv] [--config path]',\n map: 'map [--no-build] [--format table|json] [--config path]',\n peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]',\n path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--no-build] [--format table|json] [--config path]',\n related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--no-build] [--format table|json|csv] [--config path]',\n} as const;\n\n// Lazy registry: a command's imports load only when it runs, so a heavy dependency in one\n// command never taxes the others (or --version/--help). These names are reserved from saved queries.\nexport const COMMANDS: Record<string, () => Promise<{ default: Command }>> = {\n init: () => import('./init.ts'),\n build: () => import('./build.ts'),\n watch: () => import('./watch.ts'),\n status: () => import('./status.ts'),\n download: () => import('./download.ts'),\n sql: () => import('./sql.ts'),\n search: () => import('./search.ts'),\n map: () => import('./map.ts'),\n peek: () => import('./peek.ts'),\n path: () => import('./path.ts'),\n related: () => import('./related.ts'),\n};\n\nexport type { Command, Ctx } from './types.ts';\n"],"names":["COMMANDS","USAGE","init","build","watch","status","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAoBaA;eAAAA;;QAhBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAIO,IAAMZ,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,UAAU,SAAVA;eAAgB;2DAAA,QAAO;;;IACvBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,SAAS,SAATA;eAAe;2DAAA,QAAO;;;AACxB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/index.ts"],"sourcesContent":["import type { Command } from './types.ts';\n\n// Each command's usage line, minus the leading \"usage: <name> \": shared by cli.ts's\n// usage() and the command's own parse() error/--help output so there is one copy, not two.\nexport const USAGE = {\n init: 'init [--model id-or-path] [--provider static|openai|cohere] [--url url]',\n build: 'build [--force] [--config path]',\n watch: 'watch [--force] [--config path]',\n status: 'status [--format table|json] [--config path]',\n download: 'download [--config path]',\n sql: 'sql \"<statement>\" [params...] [--preset name] [--no-build] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--snippet-char-limit n] [--snippet-count-limit n] [--no-build] [--format table|json|csv] [--config path]',\n map: 'map [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]',\n peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--no-build] [--format table|json] [--config path]',\n path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--no-build] [--format table|json] [--config path]',\n related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--no-build] [--format table|json|csv] [--config path]',\n} as const;\n\n// Lazy registry: a command's imports load only when it runs, so a heavy dependency in one\n// command never taxes the others (or --version/--help). These names are reserved from saved queries.\nexport const COMMANDS: Record<string, () => Promise<{ default: Command }>> = {\n init: () => import('./init.ts'),\n build: () => import('./build.ts'),\n watch: () => import('./watch.ts'),\n status: () => import('./status.ts'),\n download: () => import('./download.ts'),\n sql: () => import('./sql.ts'),\n search: () => import('./search.ts'),\n map: () => import('./map.ts'),\n peek: () => import('./peek.ts'),\n path: () => import('./path.ts'),\n related: () => import('./related.ts'),\n};\n\nexport type { Command, Ctx } from './types.ts';\n"],"names":["COMMANDS","USAGE","init","build","watch","status","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAoBaA;eAAAA;;QAhBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAIO,IAAMZ,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,UAAU,SAAVA;eAAgB;2DAAA,QAAO;;;IACvBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,SAAS,SAATA;eAAe;2DAAA,QAAO;;;AACxB"}
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _peekts = require("../commands/peek.js");
12
- var _scopets = require("../commands/scope.js");
13
- var _traversets = require("../graph/traverse.js");
11
+ var _pathts = require("../commands/path.js");
14
12
  var _outputts = require("../output/output.js");
15
13
  var _indexts = require("./index.js");
16
14
  var _sharedts = require("./shared.js");
@@ -259,39 +257,17 @@ var pathCmd = function pathCmd(ctx) {
259
257
  ])
260
258
  }, function(store, cfg) {
261
259
  return _async_to_generator(function() {
262
- var paths, from, to, allowed, hops, rows;
260
+ var hops, rows;
263
261
  return _ts_generator(this, function(_state) {
264
262
  switch(_state.label){
265
263
  case 0:
266
264
  return [
267
265
  4,
268
- store.prepare('SELECT "path" FROM frontmatter')
266
+ (0, _pathts.findPath)(store, cfg, a, b, _object_spread_props(_object_spread({}, (0, _sharedts.scopeOf)(values)), {
267
+ maxDepth: maxDepth
268
+ }))
269
269
  ];
270
270
  case 1:
271
- return [
272
- 4,
273
- _state.sent().all()
274
- ];
275
- case 2:
276
- paths = _state.sent().map(function(r) {
277
- return r.path;
278
- });
279
- from = (0, _peekts.resolveNote)(paths, a);
280
- to = (0, _peekts.resolveNote)(paths, b);
281
- return [
282
- 4,
283
- (0, _scopets.scopedPaths)(store, cfg, (0, _sharedts.scopeOf)(values))
284
- ];
285
- case 3:
286
- allowed = _state.sent();
287
- return [
288
- 4,
289
- (0, _traversets.findPath)(store, from, to, {
290
- maxDepth: maxDepth,
291
- allowed: allowed
292
- })
293
- ];
294
- case 4:
295
271
  hops = _state.sent();
296
272
  if (format === 'json') {
297
273
  console.log(JSON.stringify(hops));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { resolveNote } from '../commands/peek.ts';\nimport { scopedPaths } from '../commands/scope.ts';\nimport { findPath } from '../graph/traverse.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/output.ts';\nimport type { BuildRequirement } from '../store/open.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, NO_BUILD, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// --max-depth must be a positive integer, mirroring shared.ts's parseK.\nfunction parseMaxDepth(depth: string | undefined, usageError: (message: string) => never): number | undefined {\n if (depth === undefined) return undefined;\n const parsed = Number(depth);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--max-depth expects a positive integer, got \"${depth}\"`);\n return parsed;\n}\n\nconst pathCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.path}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...NO_BUILD, ...FORMAT, ...CONFIG, 'max-depth': { type: 'string' } });\n const [a, b] = positionals;\n if (!a || !b) ctx.usageError(usage);\n const maxDepth = parseMaxDepth(values['max-depth'] as string | undefined, ctx.usageError);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, { noBuild: values['no-build'] === true, requirements: new Set<BuildRequirement>(['core']) }, async (store, cfg) => {\n const paths = ((await (await store.prepare('SELECT \"path\" FROM frontmatter')).all()) as Array<{ path: string }>).map((r) => r.path);\n const from = resolveNote(paths, a);\n const to = resolveNote(paths, b);\n const allowed = await scopedPaths(store, cfg, scopeOf(values));\n const hops = await findPath(store, from, to, { maxDepth, allowed });\n\n if (format === 'json') {\n console.log(JSON.stringify(hops));\n return;\n }\n if (hops === null) {\n console.log(maxDepth ? `no path within ${maxDepth} hops` : 'no path');\n return;\n }\n const rows: Row[] = hops.map((p, step) => ({ step, path: p }));\n printRows(rows, format);\n });\n};\nexport default pathCmd;\n"],"names":["parseMaxDepth","depth","usageError","undefined","parsed","Number","isInteger","pathCmd","ctx","usage","USAGE","name","path","parse","argv","SCOPE","NO_BUILD","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","noBuild","requirements","Set","store","cfg","paths","from","to","allowed","hops","rows","prepare","all","map","r","resolveNote","scopedPaths","scopeOf","findPath","console","log","JSON","stringify","p","step","printRows"],"mappings":";;;;+BA4CA;;;eAAA;;;sBA5C4B;uBACA;0BACH;wBAEC;uBAEJ;wBAC4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlF,wEAAwE;AACxE,SAASA,cAAcC,KAAyB,EAAEC,UAAsC;IACtF,IAAID,UAAUE,WAAW,OAAOA;IAChC,IAAMC,SAASC,OAAOJ;IACtB,IAAI,CAACI,OAAOC,SAAS,CAACF,WAAWA,UAAU,GAAGF,WAAW,AAAC,gDAAqD,OAAND,OAAM;IAC/G,OAAOG;AACT;AAEA,IAAMG,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,cAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,kBAAQ,EAAKC,gBAAM,EAAKC,gBAAM;QAAE,aAAa;YAAEC,MAAM;QAAS;SAA5HC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAeA,gCAAAA,iBAARC,IAAQD,iBAALE,IAAKF;IACf,IAAI,CAACC,KAAK,CAACC,GAAGf,IAAIN,UAAU,CAACO;IAC7B,IAAMe,WAAWxB,cAAcoB,MAAM,CAAC,YAAY,EAAwBZ,IAAIN,UAAU;IACxF,IAAMuB,SAASC,IAAAA,kBAAQ,EAACN;IACxB,OAAOO,IAAAA,gBAAM,EAACnB,KAAKY,OAAOQ,MAAM,EAAwB;QAAEC,SAAST,MAAM,CAAC,WAAW,KAAK;QAAMU,cAAc,IAAIC,IAAsB;YAAC;SAAO;IAAE,GAAG,SAAOC,OAAOC;;gBAC3JC,OACAC,MACAC,IACAC,SACAC,MAUAC;;;;wBAdiB;;4BAAMP,MAAMQ,OAAO,CAAC;;;wBAA3B;;4BAAO,cAAuDC,GAAG;;;wBAA3EP,QAAQ,AAAE,cAAiGQ,GAAG,CAAC,SAACC;mCAAMA,EAAE/B,IAAI;;wBAC5HuB,OAAOS,IAAAA,mBAAW,EAACV,OAAOZ;wBAC1Bc,KAAKQ,IAAAA,mBAAW,EAACV,OAAOX;wBACd;;4BAAMsB,IAAAA,oBAAW,EAACb,OAAOC,KAAKa,IAAAA,iBAAO,EAAC1B;;;wBAAhDiB,UAAU;wBACH;;4BAAMU,IAAAA,oBAAQ,EAACf,OAAOG,MAAMC,IAAI;gCAAEZ,UAAAA;gCAAUa,SAAAA;4BAAQ;;;wBAA3DC,OAAO;wBAEb,IAAIb,WAAW,QAAQ;4BACrBuB,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACb;4BAC3B;;;wBACF;wBACA,IAAIA,SAAS,MAAM;4BACjBU,QAAQC,GAAG,CAACzB,WAAW,AAAC,kBAA0B,OAATA,UAAS,WAAS;4BAC3D;;;wBACF;wBACMe,OAAcD,KAAKI,GAAG,CAAC,SAACU,GAAGC;mCAAU;gCAAEA,MAAAA;gCAAMzC,MAAMwC;4BAAE;;wBAC3DE,IAAAA,mBAAS,EAACf,MAAMd;;;;;;QAClB;;AACF;IACA,WAAelB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { findPath } from '../commands/path.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/output.ts';\nimport type { BuildRequirement } from '../store/open.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, NO_BUILD, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// --max-depth must be a positive integer, mirroring shared.ts's parseK.\nfunction parseMaxDepth(depth: string | undefined, usageError: (message: string) => never): number | undefined {\n if (depth === undefined) return undefined;\n const parsed = Number(depth);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--max-depth expects a positive integer, got \"${depth}\"`);\n return parsed;\n}\n\nconst pathCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.path}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...NO_BUILD, ...FORMAT, ...CONFIG, 'max-depth': { type: 'string' } });\n const [a, b] = positionals;\n if (!a || !b) ctx.usageError(usage);\n const maxDepth = parseMaxDepth(values['max-depth'] as string | undefined, ctx.usageError);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, { noBuild: values['no-build'] === true, requirements: new Set<BuildRequirement>(['core']) }, async (store, cfg) => {\n const hops = await findPath(store, cfg, a, b, { ...scopeOf(values), maxDepth });\n\n if (format === 'json') {\n console.log(JSON.stringify(hops));\n return;\n }\n if (hops === null) {\n console.log(maxDepth ? `no path within ${maxDepth} hops` : 'no path');\n return;\n }\n const rows: Row[] = hops.map((p, step) => ({ step, path: p }));\n printRows(rows, format);\n });\n};\nexport default pathCmd;\n"],"names":["parseMaxDepth","depth","usageError","undefined","parsed","Number","isInteger","pathCmd","ctx","usage","USAGE","name","path","parse","argv","SCOPE","NO_BUILD","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","noBuild","requirements","Set","store","cfg","hops","rows","findPath","scopeOf","console","log","JSON","stringify","map","p","step","printRows"],"mappings":";;;;+BAsCA;;;eAAA;;;sBAtCyB;wBAEC;uBAEJ;wBAC4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlF,wEAAwE;AACxE,SAASA,cAAcC,KAAyB,EAAEC,UAAsC;IACtF,IAAID,UAAUE,WAAW,OAAOA;IAChC,IAAMC,SAASC,OAAOJ;IACtB,IAAI,CAACI,OAAOC,SAAS,CAACF,WAAWA,UAAU,GAAGF,WAAW,AAAC,gDAAqD,OAAND,OAAM;IAC/G,OAAOG;AACT;AAEA,IAAMG,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,cAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,kBAAQ,EAAKC,gBAAM,EAAKC,gBAAM;QAAE,aAAa;YAAEC,MAAM;QAAS;SAA5HC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAeA,gCAAAA,iBAARC,IAAQD,iBAALE,IAAKF;IACf,IAAI,CAACC,KAAK,CAACC,GAAGf,IAAIN,UAAU,CAACO;IAC7B,IAAMe,WAAWxB,cAAcoB,MAAM,CAAC,YAAY,EAAwBZ,IAAIN,UAAU;IACxF,IAAMuB,SAASC,IAAAA,kBAAQ,EAACN;IACxB,OAAOO,IAAAA,gBAAM,EAACnB,KAAKY,OAAOQ,MAAM,EAAwB;QAAEC,SAAST,MAAM,CAAC,WAAW,KAAK;QAAMU,cAAc,IAAIC,IAAsB;YAAC;SAAO;IAAE,GAAG,SAAOC,OAAOC;;gBAC3JC,MAUAC;;;;wBAVO;;4BAAMC,IAAAA,gBAAQ,EAACJ,OAAOC,KAAKX,GAAGC,GAAG,wCAAKc,IAAAA,iBAAO,EAACjB;gCAASI,UAAAA;;;;wBAA9DU,OAAO;wBAEb,IAAIT,WAAW,QAAQ;4BACrBa,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACP;4BAC3B;;;wBACF;wBACA,IAAIA,SAAS,MAAM;4BACjBI,QAAQC,GAAG,CAACf,WAAW,AAAC,kBAA0B,OAATA,UAAS,WAAS;4BAC3D;;;wBACF;wBACMW,OAAcD,KAAKQ,GAAG,CAAC,SAACC,GAAGC;mCAAU;gCAAEA,MAAAA;gCAAMhC,MAAM+B;4BAAE;;wBAC3DE,IAAAA,mBAAS,EAACV,MAAMV;;;;;;QAClB;;AACF;IACA,WAAelB"}
@@ -249,7 +249,6 @@ function _unsupported_iterable_to_array(o, minLen) {
249
249
  if (n === "Map" || n === "Set") return Array.from(n);
250
250
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
251
251
  }
252
- var RELATED_DEFAULT_K = 5;
253
252
  var relatedCmd = function relatedCmd(ctx) {
254
253
  var _parseK;
255
254
  var usage = "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.related);
@@ -260,7 +259,7 @@ var relatedCmd = function relatedCmd(ctx) {
260
259
  })), values = _parse.values, positionals = _parse.positionals;
261
260
  var _positionals = _sliced_to_array(positionals, 1), pathArg = _positionals[0];
262
261
  if (!pathArg) ctx.usageError(usage);
263
- var k = (_parseK = (0, _sharedts.parseK)(values.k, ctx.usageError)) !== null && _parseK !== void 0 ? _parseK : RELATED_DEFAULT_K;
262
+ var k = (_parseK = (0, _sharedts.parseK)(values.k, ctx.usageError)) !== null && _parseK !== void 0 ? _parseK : _relatedts.RELATED_DEFAULT_K;
264
263
  var format = (0, _sharedts.rowFormatOf)(values);
265
264
  var noBuild = values['no-build'] === true;
266
265
  return (0, _sharedts.withDb)(ctx, values.config, {
@@ -303,7 +302,9 @@ var relatedCmd = function relatedCmd(ctx) {
303
302
  case 4:
304
303
  return [
305
304
  4,
306
- (0, _relatedts.relatedNotes)(store, cfg, pathArg, overrides, k)
305
+ (0, _relatedts.relatedNotes)(store, cfg, pathArg, _object_spread_props(_object_spread({}, overrides), {
306
+ k: k
307
+ }))
307
308
  ];
308
309
  case 5:
309
310
  _outputts.printRows.apply(void 0, [
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { relatedNotes, resolveRelatedSeed } from '../commands/related.ts';\nimport { scopedPaths } from '../commands/scope.ts';\nimport { resolveSearch } from '../config/index.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/output.ts';\nimport { type BuildRequirement, prepareDocumentEmbeddings } from '../store/open.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, NO_BUILD, parse, parseK, rowFormatOf, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst RELATED_DEFAULT_K = 5;\n\nconst relatedCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.related}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...NO_BUILD, ...FORMAT, ...CONFIG, k: { type: 'string' } });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? RELATED_DEFAULT_K;\n const format = rowFormatOf(values);\n const noBuild = values['no-build'] === true;\n return withDb(ctx, values.config as string | undefined, { noBuild, requirements: new Set<BuildRequirement>(['core']) }, async (store, cfg, build) => {\n const overrides = scopeOf(values);\n if (build && resolveSearch(cfg, overrides).signals.vectors !== undefined) {\n const path = await resolveRelatedSeed(store, pathArg);\n const allowed = await scopedPaths(store, cfg, overrides);\n await prepareDocumentEmbeddings(store, cfg, new Set([...allowed, path]));\n }\n printRows((await relatedNotes(store, cfg, pathArg, overrides, k)) as Row[], format);\n });\n};\nexport default relatedCmd;\n"],"names":["RELATED_DEFAULT_K","relatedCmd","ctx","parseK","usage","USAGE","name","related","parse","argv","SCOPE","NO_BUILD","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","rowFormatOf","noBuild","withDb","config","requirements","Set","store","cfg","build","overrides","path","allowed","scopeOf","resolveSearch","signals","vectors","undefined","resolveRelatedSeed","scopedPaths","prepareDocumentEmbeddings","relatedNotes","printRows"],"mappings":";;;;+BA8BA;;;eAAA;;;yBA9BiD;uBACrB;uBACE;wBAEJ;sBACuC;wBAC3C;wBACuE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG7F,IAAMA,oBAAoB;AAE1B,IAAMC,aAAsB,oBAACC;QAKjBC;IAJV,IAAMC,QAAQ,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAiB,OAAdD,eAAK,CAACE,OAAO;IACjD,IAAgCC,SAAAA,IAAAA,eAAK,EAACN,IAAIO,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,kBAAQ,EAAKC,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAAlHC,SAAwBR,OAAxBQ,QAAQC,cAAgBT,OAAhBS;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAAShB,IAAIiB,UAAU,CAACf;IAC7B,IAAMU,KAAIX,UAAAA,IAAAA,gBAAM,EAACa,OAAOF,CAAC,EAAwBZ,IAAIiB,UAAU,eAArDhB,qBAAAA,UAA0DH;IACpE,IAAMoB,SAASC,IAAAA,qBAAW,EAACL;IAC3B,IAAMM,UAAUN,MAAM,CAAC,WAAW,KAAK;IACvC,OAAOO,IAAAA,gBAAM,EAACrB,KAAKc,OAAOQ,MAAM,EAAwB;QAAEF,SAAAA;QAASG,cAAc,IAAIC,IAAsB;YAAC;SAAO;IAAE,GAAG,SAAOC,OAAOC,KAAKC;;gBACnIC,WAEEC,MACAC;;;;wBAHFF,YAAYG,IAAAA,iBAAO,EAACjB;6BACtBa,CAAAA,SAASK,IAAAA,sBAAa,EAACN,KAAKE,WAAWK,OAAO,CAACC,OAAO,KAAKC,SAAQ,GAAnER;;;;wBACW;;4BAAMS,IAAAA,6BAAkB,EAACX,OAAOT;;;wBAAvCa,OAAO;wBACG;;4BAAMQ,IAAAA,oBAAW,EAACZ,OAAOC,KAAKE;;;wBAAxCE,UAAU;wBAChB;;4BAAMQ,IAAAA,iCAAyB,EAACb,OAAOC,KAAK,IAAIF,IAAI,AAAC,qBAAGM;gCAASD;;;;wBAAjE;;;wBAES;;4BAAMU,IAAAA,uBAAY,EAACd,OAAOC,KAAKV,SAASY,WAAWhB;;;wBAA9D4B,mBAAS;4BAAE;4BAAiEtB;;;;;;;QAC9E;;AACF;IACA,WAAenB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { RELATED_DEFAULT_K, relatedNotes, resolveRelatedSeed } from '../commands/related.ts';\nimport { scopedPaths } from '../commands/scope.ts';\nimport { resolveSearch } from '../config/index.ts';\nimport { printRows } from '../output/output.ts';\nimport { type BuildRequirement, prepareDocumentEmbeddings } from '../store/open.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, NO_BUILD, parse, parseK, rowFormatOf, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst relatedCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.related}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...NO_BUILD, ...FORMAT, ...CONFIG, k: { type: 'string' } });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? RELATED_DEFAULT_K;\n const format = rowFormatOf(values);\n const noBuild = values['no-build'] === true;\n return withDb(ctx, values.config as string | undefined, { noBuild, requirements: new Set<BuildRequirement>(['core']) }, async (store, cfg, build) => {\n const overrides = scopeOf(values);\n if (build && resolveSearch(cfg, overrides).signals.vectors !== undefined) {\n const path = await resolveRelatedSeed(store, pathArg);\n const allowed = await scopedPaths(store, cfg, overrides);\n await prepareDocumentEmbeddings(store, cfg, new Set([...allowed, path]));\n }\n printRows(await relatedNotes(store, cfg, pathArg, { ...overrides, k }), format);\n });\n};\nexport default relatedCmd;\n"],"names":["relatedCmd","ctx","parseK","usage","USAGE","name","related","parse","argv","SCOPE","NO_BUILD","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","RELATED_DEFAULT_K","format","rowFormatOf","noBuild","withDb","config","requirements","Set","store","cfg","build","overrides","path","allowed","scopeOf","resolveSearch","signals","vectors","undefined","resolveRelatedSeed","scopedPaths","prepareDocumentEmbeddings","relatedNotes","printRows"],"mappings":";;;;+BA2BA;;;eAAA;;;yBA3BoE;uBACxC;uBACE;wBACJ;sBACuC;wBAC3C;wBACuE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG7F,IAAMA,aAAsB,oBAACC;QAKjBC;IAJV,IAAMC,QAAQ,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAiB,OAAdD,eAAK,CAACE,OAAO;IACjD,IAAgCC,SAAAA,IAAAA,eAAK,EAACN,IAAIO,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,kBAAQ,EAAKC,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAAlHC,SAAwBR,OAAxBQ,QAAQC,cAAgBT,OAAhBS;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAAShB,IAAIiB,UAAU,CAACf;IAC7B,IAAMU,KAAIX,UAAAA,IAAAA,gBAAM,EAACa,OAAOF,CAAC,EAAwBZ,IAAIiB,UAAU,eAArDhB,qBAAAA,UAA0DiB,4BAAiB;IACrF,IAAMC,SAASC,IAAAA,qBAAW,EAACN;IAC3B,IAAMO,UAAUP,MAAM,CAAC,WAAW,KAAK;IACvC,OAAOQ,IAAAA,gBAAM,EAACtB,KAAKc,OAAOS,MAAM,EAAwB;QAAEF,SAAAA;QAASG,cAAc,IAAIC,IAAsB;YAAC;SAAO;IAAE,GAAG,SAAOC,OAAOC,KAAKC;;gBACnIC,WAEEC,MACAC;;;;wBAHFF,YAAYG,IAAAA,iBAAO,EAAClB;6BACtBc,CAAAA,SAASK,IAAAA,sBAAa,EAACN,KAAKE,WAAWK,OAAO,CAACC,OAAO,KAAKC,SAAQ,GAAnER;;;;wBACW;;4BAAMS,IAAAA,6BAAkB,EAACX,OAAOV;;;wBAAvCc,OAAO;wBACG;;4BAAMQ,IAAAA,oBAAW,EAACZ,OAAOC,KAAKE;;;wBAAxCE,UAAU;wBAChB;;4BAAMQ,IAAAA,iCAAyB,EAACb,OAAOC,KAAK,IAAIF,IAAI,AAAC,qBAAGM;gCAASD;;;;wBAAjE;;;wBAEQ;;4BAAMU,IAAAA,uBAAY,EAACd,OAAOC,KAAKX,SAAS,wCAAKa;gCAAWjB,GAAAA;;;;wBAAlE6B,mBAAS;4BAAC;4BAA8DtB;;;;;;;QAC1E;;AACF;IACA,WAAepB"}
@@ -1,10 +1,13 @@
1
- export type { TreeMap } from './map.js';
1
+ export type { TreeMap, TreeMapField, TreeMapHub, TreeMapRecent } from './map.js';
2
2
  export { mapTree } from './map.js';
3
- export type { Peek } from './peek.js';
3
+ export type { PathOptions } from './path.js';
4
+ export { findPath } from './path.js';
5
+ export type { Peek, PeekSection } from './peek.js';
4
6
  export { peek, resolveNote } from './peek.js';
7
+ export type { RelatedOptions, RelatedResult } from './related.js';
5
8
  export { relatedNotes } from './related.js';
6
9
  export { scopedPaths } from './scope.js';
7
- export type { SearchOptions } from './search.js';
10
+ export type { SearchOptions, SearchResult, SearchResultVia } from './search.js';
8
11
  export { search } from './search.js';
9
12
  export type { PresetCoverage } from './status.js';
10
13
  export { presetCoverage } from './status.js';
@@ -1,10 +1,13 @@
1
- export type { TreeMap } from './map.js';
1
+ export type { TreeMap, TreeMapField, TreeMapHub, TreeMapRecent } from './map.js';
2
2
  export { mapTree } from './map.js';
3
- export type { Peek } from './peek.js';
3
+ export type { PathOptions } from './path.js';
4
+ export { findPath } from './path.js';
5
+ export type { Peek, PeekSection } from './peek.js';
4
6
  export { peek, resolveNote } from './peek.js';
7
+ export type { RelatedOptions, RelatedResult } from './related.js';
5
8
  export { relatedNotes } from './related.js';
6
9
  export { scopedPaths } from './scope.js';
7
- export type { SearchOptions } from './search.js';
10
+ export type { SearchOptions, SearchResult, SearchResultVia } from './search.js';
8
11
  export { search } from './search.js';
9
12
  export type { PresetCoverage } from './status.js';
10
13
  export { presetCoverage } from './status.js';
@@ -11,6 +11,9 @@ function _export(target, all) {
11
11
  });
12
12
  }
13
13
  _export(exports, {
14
+ get findPath () {
15
+ return _pathts.findPath;
16
+ },
14
17
  get mapTree () {
15
18
  return _mapts.mapTree;
16
19
  },
@@ -34,6 +37,7 @@ _export(exports, {
34
37
  }
35
38
  });
36
39
  var _mapts = require("./map.js");
40
+ var _pathts = require("./path.js");
37
41
  var _peekts = require("./peek.js");
38
42
  var _relatedts = require("./related.js");
39
43
  var _scopets = require("./scope.js");
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/index.ts"],"sourcesContent":["// The three commands: mapTree (orient), search (locate), peek (structure).\n// Each returns data; cli.ts renders. All of them degrade when a feature is off.\n\nexport type { TreeMap } from './map.ts';\nexport { mapTree } from './map.ts';\nexport type { Peek } from './peek.ts';\nexport { peek, resolveNote } from './peek.ts';\nexport { relatedNotes } from './related.ts';\nexport { scopedPaths } from './scope.ts';\nexport type { SearchOptions } from './search.ts';\nexport { search } from './search.ts';\nexport type { PresetCoverage } from './status.ts';\nexport { presetCoverage } from './status.ts';\n"],"names":["mapTree","peek","presetCoverage","relatedNotes","resolveNote","scopedPaths","search"],"mappings":"AAAA,2EAA2E;AAC3E,gFAAgF;;;;;;;;;;;;QAGvEA;eAAAA,cAAO;;QAEPC;eAAAA,YAAI;;QAMJC;eAAAA,wBAAc;;QALdC;eAAAA,uBAAY;;QADNC;eAAAA,mBAAW;;QAEjBC;eAAAA,oBAAW;;QAEXC;eAAAA,gBAAM;;;qBANS;sBAEU;yBACL;uBACD;wBAEL;wBAEQ"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/commands/index.ts"],"sourcesContent":["// The three commands: mapTree (orient), search (locate), peek (structure).\n// Each returns data; cli.ts renders. All of them degrade when a feature is off.\n\nexport type { TreeMap, TreeMapField, TreeMapHub, TreeMapRecent } from './map.ts';\nexport { mapTree } from './map.ts';\nexport type { PathOptions } from './path.ts';\nexport { findPath } from './path.ts';\nexport type { Peek, PeekSection } from './peek.ts';\nexport { peek, resolveNote } from './peek.ts';\nexport type { RelatedOptions, RelatedResult } from './related.ts';\nexport { relatedNotes } from './related.ts';\nexport { scopedPaths } from './scope.ts';\nexport type { SearchOptions, SearchResult, SearchResultVia } from './search.ts';\nexport { search } from './search.ts';\nexport type { PresetCoverage } from './status.ts';\nexport { presetCoverage } from './status.ts';\n"],"names":["findPath","mapTree","peek","presetCoverage","relatedNotes","resolveNote","scopedPaths","search"],"mappings":"AAAA,2EAA2E;AAC3E,gFAAgF;;;;;;;;;;;;QAKvEA;eAAAA,gBAAQ;;QAFRC;eAAAA,cAAO;;QAIPC;eAAAA,YAAI;;QAOJC;eAAAA,wBAAc;;QALdC;eAAAA,uBAAY;;QAFNC;eAAAA,mBAAW;;QAGjBC;eAAAA,oBAAW;;QAEXC;eAAAA,gBAAM;;;qBATS;sBAEC;sBAES;yBAEL;uBACD;wBAEL;wBAEQ"}
@@ -1,21 +1,30 @@
1
1
  import type { FeatureName, ResolvedConfig, SearchOverrides } from '../config/index.js';
2
- import type { Row } from '../output/output.js';
3
- import type { Store } from '../store/types.js';
2
+ import type { FieldStat, Store } from '../store/types.js';
4
3
  import type { PresetCoverage } from './status.js';
5
4
  export interface TreeMap {
6
5
  docs: {
7
6
  count: number;
8
7
  bytes: number;
9
8
  };
10
- fields: Row[];
9
+ fields: TreeMapField[];
11
10
  fieldsTotal: number;
12
11
  features: {
13
12
  on: FeatureName[];
14
13
  off: FeatureName[];
15
14
  };
16
15
  presets: PresetCoverage[];
17
- hubs: Row[];
18
- recent: Row[];
16
+ hubs: TreeMapHub[];
17
+ recent: TreeMapRecent[];
19
18
  recentCaveat: string | null;
20
19
  }
20
+ export type TreeMapField = FieldStat;
21
+ export type TreeMapHub = {
22
+ path: string;
23
+ rank: number;
24
+ title: string;
25
+ };
26
+ export type TreeMapRecent = {
27
+ path: string;
28
+ modified: string;
29
+ };
21
30
  export declare function mapTree(store: Store, cfg: ResolvedConfig, overrides?: SearchOverrides): Promise<TreeMap>;
@@ -1,21 +1,30 @@
1
1
  import type { FeatureName, ResolvedConfig, SearchOverrides } from '../config/index.js';
2
- import type { Row } from '../output/output.js';
3
- import type { Store } from '../store/types.js';
2
+ import type { FieldStat, Store } from '../store/types.js';
4
3
  import type { PresetCoverage } from './status.js';
5
4
  export interface TreeMap {
6
5
  docs: {
7
6
  count: number;
8
7
  bytes: number;
9
8
  };
10
- fields: Row[];
9
+ fields: TreeMapField[];
11
10
  fieldsTotal: number;
12
11
  features: {
13
12
  on: FeatureName[];
14
13
  off: FeatureName[];
15
14
  };
16
15
  presets: PresetCoverage[];
17
- hubs: Row[];
18
- recent: Row[];
16
+ hubs: TreeMapHub[];
17
+ recent: TreeMapRecent[];
19
18
  recentCaveat: string | null;
20
19
  }
20
+ export type TreeMapField = FieldStat;
21
+ export type TreeMapHub = {
22
+ path: string;
23
+ rank: number;
24
+ title: string;
25
+ };
26
+ export type TreeMapRecent = {
27
+ path: string;
28
+ modified: string;
29
+ };
21
30
  export declare function mapTree(store: Store, cfg: ResolvedConfig, overrides?: SearchOverrides): Promise<TreeMap>;
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "mapTree", {
11
11
  var _indexts = require("../config/index.js");
12
12
  var _serialqueryts = require("../lib/serial-query.js");
13
13
  var _scopets = require("./scope.js");
14
+ var _snapshotts = require("./snapshot.js");
14
15
  var _statusts = require("./status.js");
15
16
  function _array_like_to_array(arr, len) {
16
17
  if (len == null || len > arr.length) len = arr.length;
@@ -194,6 +195,12 @@ function mapIndexed(store, cfg, overrides) {
194
195
  return _ts_generator(this, function(_state) {
195
196
  switch(_state.label){
196
197
  case 0:
198
+ return [
199
+ 4,
200
+ (0, _snapshotts.assertQuerySnapshot)(store, cfg)
201
+ ];
202
+ case 1:
203
+ _state.sent();
197
204
  _tmp = [
198
205
  store
199
206
  ];
@@ -201,14 +208,14 @@ function mapIndexed(store, cfg, overrides) {
201
208
  4,
202
209
  (0, _scopets.scopedPaths)(store, cfg, overrides)
203
210
  ];
204
- case 1:
211
+ case 2:
205
212
  return [
206
213
  4,
207
214
  _scopets.setupMapScope.apply(void 0, _tmp.concat([
208
215
  _state.sent()
209
216
  ]))
210
217
  ];
211
- case 2:
218
+ case 3:
212
219
  _state.sent();
213
220
  scopeWhere = 'WHERE "path" IN (SELECT "path" FROM _map_scope)';
214
221
  scopeAnd = 'AND f."path" IN (SELECT "path" FROM _map_scope)';
@@ -216,18 +223,18 @@ function mapIndexed(store, cfg, overrides) {
216
223
  4,
217
224
  store.prepare('SELECT COUNT(*) AS count, COALESCE(SUM("_size"), 0) AS bytes FROM frontmatter '.concat(scopeWhere))
218
225
  ];
219
- case 3:
226
+ case 4:
220
227
  return [
221
228
  4,
222
229
  _state.sent().get()
223
230
  ];
224
- case 4:
231
+ case 5:
225
232
  docs = _state.sent();
226
233
  return [
227
234
  4,
228
235
  store.docs.columns()
229
236
  ];
230
- case 5:
237
+ case 6:
231
238
  columns = _state.sent().filter(function(name) {
232
239
  return !_scopets.INTERNAL_COLUMNS.has(name);
233
240
  });
@@ -235,20 +242,20 @@ function mapIndexed(store, cfg, overrides) {
235
242
  // every distinct type observed across the scope is reported, not just the first.
236
243
  allFields = [];
237
244
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
238
- _state.label = 6;
239
- case 6:
245
+ _state.label = 7;
246
+ case 7:
240
247
  _state.trys.push([
241
- 6,
242
- 11,
248
+ 7,
243
249
  12,
244
- 13
250
+ 13,
251
+ 14
245
252
  ]);
246
253
  _iterator = chunk(columns, MAP_COLUMN_CHUNK)[Symbol.iterator]();
247
- _state.label = 7;
248
- case 7:
254
+ _state.label = 8;
255
+ case 8:
249
256
  if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
250
257
  3,
251
- 10
258
+ 11
252
259
  ];
253
260
  group = _step.value;
254
261
  _1 = (_ = (_allFields = allFields).push).apply;
@@ -259,33 +266,33 @@ function mapIndexed(store, cfg, overrides) {
259
266
  4,
260
267
  store.docs.fieldStats(group, scopeWhere)
261
268
  ];
262
- case 8:
269
+ case 9:
263
270
  _1.apply(_, _tmp1.concat([
264
271
  _to_consumable_array.apply(void 0, [
265
272
  _state.sent()
266
273
  ])
267
274
  ]));
268
- _state.label = 9;
269
- case 9:
275
+ _state.label = 10;
276
+ case 10:
270
277
  _iteratorNormalCompletion = true;
271
278
  return [
272
279
  3,
273
- 7
280
+ 8
274
281
  ];
275
- case 10:
282
+ case 11:
276
283
  return [
277
284
  3,
278
- 13
285
+ 14
279
286
  ];
280
- case 11:
287
+ case 12:
281
288
  err = _state.sent();
282
289
  _didIteratorError = true;
283
290
  _iteratorError = err;
284
291
  return [
285
292
  3,
286
- 13
293
+ 14
287
294
  ];
288
- case 12:
295
+ case 13:
289
296
  try {
290
297
  if (!_iteratorNormalCompletion && _iterator.return != null) {
291
298
  _iterator.return();
@@ -298,45 +305,45 @@ function mapIndexed(store, cfg, overrides) {
298
305
  return [
299
306
  7
300
307
  ];
301
- case 13:
308
+ case 14:
302
309
  allFields.sort(function(a, b) {
303
310
  return b.coverage - a.coverage;
304
311
  });
305
312
  fields = allFields.slice(0, 20);
306
313
  if (!(0, _indexts.featureEnabled)(cfg, 'rank')) return [
307
314
  3,
308
- 16
315
+ 17
309
316
  ];
310
317
  return [
311
318
  4,
312
319
  store.prepare('SELECT f."path" AS path, round(f."_rank" * 100, 2) AS rank, content.title FROM frontmatter f JOIN content ON content.path = f."path" WHERE f."_rank" IS NOT NULL '.concat(scopeAnd, ' ORDER BY f."_rank" DESC, f."path" ASC LIMIT 8'))
313
320
  ];
314
- case 14:
321
+ case 15:
315
322
  return [
316
323
  4,
317
324
  _state.sent().all()
318
325
  ];
319
- case 15:
326
+ case 16:
320
327
  _tmp2 = _state.sent();
321
328
  return [
322
329
  3,
323
- 17
330
+ 18
324
331
  ];
325
- case 16:
326
- _tmp2 = [];
327
- _state.label = 17;
328
332
  case 17:
333
+ _tmp2 = [];
334
+ _state.label = 18;
335
+ case 18:
329
336
  hubs = _tmp2;
330
337
  return [
331
338
  4,
332
339
  store.prepare('SELECT "path", "_mtime" AS mtime FROM frontmatter '.concat(scopeWhere, ' ORDER BY "_mtime" DESC, "path" ASC LIMIT 5'))
333
340
  ];
334
- case 18:
341
+ case 19:
335
342
  return [
336
343
  4,
337
344
  _state.sent().all()
338
345
  ];
339
- case 19:
346
+ case 20:
340
347
  recent = _state.sent().map(function(r) {
341
348
  return {
342
349
  path: r.path,
@@ -347,12 +354,12 @@ function mapIndexed(store, cfg, overrides) {
347
354
  4,
348
355
  store.prepare("SELECT COUNT(*) AS n FROM frontmatter ".concat(scopeWhere, ' GROUP BY CAST("_mtime" / 1000 AS INTEGER) ORDER BY n DESC LIMIT 1'))
349
356
  ];
350
- case 20:
357
+ case 21:
351
358
  return [
352
359
  4,
353
360
  _state.sent().get()
354
361
  ];
355
- case 21:
362
+ case 22:
356
363
  topSecond = _state.sent();
357
364
  recentCaveat = topSecond && docs.count > 1 && topSecond.n > docs.count / 2 ? "".concat(topSecond.n, " of ").concat(docs.count, " files share one modified second, so recency likely reflects a checkout or copy, not edit history") : null;
358
365
  _tmp3 = {
@@ -365,7 +372,7 @@ function mapIndexed(store, cfg, overrides) {
365
372
  4,
366
373
  (0, _statusts.presetCoverage)(store, cfg)
367
374
  ];
368
- case 22:
375
+ case 23:
369
376
  return [
370
377
  2,
371
378
  (_tmp3.presets = _state.sent(), _tmp3.hubs = hubs, _tmp3.recent = recent, _tmp3.recentCaveat = recentCaveat, _tmp3)