sensemaking 0.10.0 → 0.11.1

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 (96) hide show
  1. package/README.md +6 -7
  2. package/dist/cjs/cli/index.d.cts +1 -3
  3. package/dist/cjs/cli/index.d.ts +1 -3
  4. package/dist/cjs/cli/index.js +1 -13
  5. package/dist/cjs/cli/index.js.map +1 -1
  6. package/dist/cjs/cli/named.js +3 -1
  7. package/dist/cjs/cli/named.js.map +1 -1
  8. package/dist/cjs/cli/shared.d.cts +1 -1
  9. package/dist/cjs/cli/shared.d.ts +1 -1
  10. package/dist/cjs/cli/shared.js +21 -1
  11. package/dist/cjs/cli/shared.js.map +1 -1
  12. package/dist/cjs/cli/sql.js +30 -2
  13. package/dist/cjs/cli/sql.js.map +1 -1
  14. package/dist/cjs/cli/status.d.cts +1 -0
  15. package/dist/cjs/cli/status.d.ts +1 -0
  16. package/dist/cjs/cli/status.js +76 -13
  17. package/dist/cjs/cli/status.js.map +1 -1
  18. package/dist/cjs/commands.d.cts +2 -1
  19. package/dist/cjs/commands.d.ts +2 -1
  20. package/dist/cjs/commands.js +32 -12
  21. package/dist/cjs/commands.js.map +1 -1
  22. package/dist/cjs/db.d.cts +2 -2
  23. package/dist/cjs/db.d.ts +2 -2
  24. package/dist/cjs/db.js +11 -12
  25. package/dist/cjs/db.js.map +1 -1
  26. package/dist/cjs/errors.d.cts +1 -1
  27. package/dist/cjs/errors.d.ts +1 -1
  28. package/dist/cjs/errors.js.map +1 -1
  29. package/dist/cjs/features/embed.d.cts +1 -0
  30. package/dist/cjs/features/embed.d.ts +1 -0
  31. package/dist/cjs/features/embed.js +31 -9
  32. package/dist/cjs/features/embed.js.map +1 -1
  33. package/dist/cjs/index.d.cts +1 -1
  34. package/dist/cjs/index.d.ts +1 -1
  35. package/dist/cjs/index.js +3 -3
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/output.d.cts +3 -0
  38. package/dist/cjs/output.d.ts +3 -0
  39. package/dist/cjs/output.js +6 -1
  40. package/dist/cjs/output.js.map +1 -1
  41. package/dist/cjs/scan.d.cts +1 -0
  42. package/dist/cjs/scan.d.ts +1 -0
  43. package/dist/cjs/scan.js +83 -12
  44. package/dist/cjs/scan.js.map +1 -1
  45. package/dist/esm/cli/index.d.ts +1 -3
  46. package/dist/esm/cli/index.js +1 -5
  47. package/dist/esm/cli/index.js.map +1 -1
  48. package/dist/esm/cli/named.js +3 -1
  49. package/dist/esm/cli/named.js.map +1 -1
  50. package/dist/esm/cli/shared.d.ts +1 -1
  51. package/dist/esm/cli/shared.js +21 -1
  52. package/dist/esm/cli/shared.js.map +1 -1
  53. package/dist/esm/cli/sql.js +5 -2
  54. package/dist/esm/cli/sql.js.map +1 -1
  55. package/dist/esm/cli/status.d.ts +1 -0
  56. package/dist/esm/cli/status.js +70 -13
  57. package/dist/esm/cli/status.js.map +1 -1
  58. package/dist/esm/commands.d.ts +2 -1
  59. package/dist/esm/commands.js +30 -10
  60. package/dist/esm/commands.js.map +1 -1
  61. package/dist/esm/db.d.ts +2 -2
  62. package/dist/esm/db.js +12 -10
  63. package/dist/esm/db.js.map +1 -1
  64. package/dist/esm/errors.d.ts +1 -1
  65. package/dist/esm/errors.js.map +1 -1
  66. package/dist/esm/features/embed.d.ts +1 -0
  67. package/dist/esm/features/embed.js +29 -9
  68. package/dist/esm/features/embed.js.map +1 -1
  69. package/dist/esm/index.d.ts +1 -1
  70. package/dist/esm/index.js +1 -1
  71. package/dist/esm/index.js.map +1 -1
  72. package/dist/esm/output.d.ts +3 -0
  73. package/dist/esm/output.js +6 -1
  74. package/dist/esm/output.js.map +1 -1
  75. package/dist/esm/scan.d.ts +1 -0
  76. package/dist/esm/scan.js +82 -13
  77. package/dist/esm/scan.js.map +1 -1
  78. package/package.json +1 -1
  79. package/schema.json +1 -1
  80. package/skills/sense/SKILL.md +26 -10
  81. package/skills/sense-setup/EXAMPLES.md +1 -1
  82. package/skills/sense-setup/SKILL.md +2 -2
  83. package/dist/cjs/cli/check.d.cts +0 -3
  84. package/dist/cjs/cli/check.d.ts +0 -3
  85. package/dist/cjs/cli/check.js +0 -392
  86. package/dist/cjs/cli/check.js.map +0 -1
  87. package/dist/cjs/cli/rebuild.d.cts +0 -3
  88. package/dist/cjs/cli/rebuild.d.ts +0 -3
  89. package/dist/cjs/cli/rebuild.js +0 -50
  90. package/dist/cjs/cli/rebuild.js.map +0 -1
  91. package/dist/esm/cli/check.d.ts +0 -3
  92. package/dist/esm/cli/check.js +0 -88
  93. package/dist/esm/cli/check.js.map +0 -1
  94. package/dist/esm/cli/rebuild.d.ts +0 -3
  95. package/dist/esm/cli/rebuild.js +0 -13
  96. package/dist/esm/cli/rebuild.js.map +0 -1
@@ -1,392 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _commandsts = require("../commands.js");
12
- var _dbts = require("../db.js");
13
- var _outputts = require("../output.js");
14
- var _indexts = require("./index.js");
15
- var _sharedts = require("./shared.js");
16
- function _array_like_to_array(arr, len) {
17
- if (len == null || len > arr.length) len = arr.length;
18
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
19
- return arr2;
20
- }
21
- function _array_with_holes(arr) {
22
- if (Array.isArray(arr)) return arr;
23
- }
24
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
25
- try {
26
- var info = gen[key](arg);
27
- var value = info.value;
28
- } catch (error) {
29
- reject(error);
30
- return;
31
- }
32
- if (info.done) {
33
- resolve(value);
34
- } else {
35
- Promise.resolve(value).then(_next, _throw);
36
- }
37
- }
38
- function _async_to_generator(fn) {
39
- return function() {
40
- var self = this, args = arguments;
41
- return new Promise(function(resolve, reject) {
42
- var gen = fn.apply(self, args);
43
- function _next(value) {
44
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
45
- }
46
- function _throw(err) {
47
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
48
- }
49
- _next(undefined);
50
- });
51
- };
52
- }
53
- function _define_property(obj, key, value) {
54
- if (key in obj) {
55
- Object.defineProperty(obj, key, {
56
- value: value,
57
- enumerable: true,
58
- configurable: true,
59
- writable: true
60
- });
61
- } else {
62
- obj[key] = value;
63
- }
64
- return obj;
65
- }
66
- function _iterable_to_array_limit(arr, i) {
67
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
68
- if (_i == null) return;
69
- var _arr = [];
70
- var _n = true;
71
- var _d = false;
72
- var _s, _e;
73
- try {
74
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
75
- _arr.push(_s.value);
76
- if (i && _arr.length === i) break;
77
- }
78
- } catch (err) {
79
- _d = true;
80
- _e = err;
81
- } finally{
82
- try {
83
- if (!_n && _i["return"] != null) _i["return"]();
84
- } finally{
85
- if (_d) throw _e;
86
- }
87
- }
88
- return _arr;
89
- }
90
- function _non_iterable_rest() {
91
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
92
- }
93
- function _object_spread(target) {
94
- for(var i = 1; i < arguments.length; i++){
95
- var source = arguments[i] != null ? arguments[i] : {};
96
- var ownKeys = Object.keys(source);
97
- if (typeof Object.getOwnPropertySymbols === "function") {
98
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
99
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
100
- }));
101
- }
102
- ownKeys.forEach(function(key) {
103
- _define_property(target, key, source[key]);
104
- });
105
- }
106
- return target;
107
- }
108
- function _sliced_to_array(arr, i) {
109
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
110
- }
111
- function _type_of(obj) {
112
- "@swc/helpers - typeof";
113
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
114
- }
115
- function _unsupported_iterable_to_array(o, minLen) {
116
- if (!o) return;
117
- if (typeof o === "string") return _array_like_to_array(o, minLen);
118
- var n = Object.prototype.toString.call(o).slice(8, -1);
119
- if (n === "Object" && o.constructor) n = o.constructor.name;
120
- if (n === "Map" || n === "Set") return Array.from(n);
121
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
122
- }
123
- function _ts_generator(thisArg, body) {
124
- var f, y, t, _ = {
125
- label: 0,
126
- sent: function() {
127
- if (t[0] & 1) throw t[1];
128
- return t[1];
129
- },
130
- trys: [],
131
- ops: []
132
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
133
- return d(g, "next", {
134
- value: verb(0)
135
- }), d(g, "throw", {
136
- value: verb(1)
137
- }), d(g, "return", {
138
- value: verb(2)
139
- }), typeof Symbol === "function" && d(g, Symbol.iterator, {
140
- value: function() {
141
- return this;
142
- }
143
- }), g;
144
- function verb(n) {
145
- return function(v) {
146
- return step([
147
- n,
148
- v
149
- ]);
150
- };
151
- }
152
- function step(op) {
153
- if (f) throw new TypeError("Generator is already executing.");
154
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
155
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
156
- if (y = 0, t) op = [
157
- op[0] & 2,
158
- t.value
159
- ];
160
- switch(op[0]){
161
- case 0:
162
- case 1:
163
- t = op;
164
- break;
165
- case 4:
166
- _.label++;
167
- return {
168
- value: op[1],
169
- done: false
170
- };
171
- case 5:
172
- _.label++;
173
- y = op[1];
174
- op = [
175
- 0
176
- ];
177
- continue;
178
- case 7:
179
- op = _.ops.pop();
180
- _.trys.pop();
181
- continue;
182
- default:
183
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
184
- _ = 0;
185
- continue;
186
- }
187
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
188
- _.label = op[1];
189
- break;
190
- }
191
- if (op[0] === 6 && _.label < t[1]) {
192
- _.label = t[1];
193
- t = op;
194
- break;
195
- }
196
- if (t && _.label < t[2]) {
197
- _.label = t[2];
198
- _.ops.push(op);
199
- break;
200
- }
201
- if (t[2]) _.ops.pop();
202
- _.trys.pop();
203
- continue;
204
- }
205
- op = body.call(thisArg, _);
206
- } catch (e) {
207
- op = [
208
- 6,
209
- e
210
- ];
211
- y = 0;
212
- } finally{
213
- f = t = 0;
214
- }
215
- if (op[0] & 5) throw op[1];
216
- return {
217
- value: op[0] ? op[1] : void 0,
218
- done: true
219
- };
220
- }
221
- }
222
- // A broken query and an empty one look identical, so prepare each to catch syntax and column
223
- // errors. Parameterised ones are not run (inventing arguments would report a bogus count);
224
- // searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.
225
- var check = function check(ctx) {
226
- return _async_to_generator(function() {
227
- var _cfg_queries, values, format, cfg, _open, db, warnings, rows, failed, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, entry, _sql_match, count, err, sql, params, statement, count1, err1;
228
- return _ts_generator(this, function(_state) {
229
- switch(_state.label){
230
- case 0:
231
- values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.check), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
232
- format = (0, _sharedts.formatOf)(values);
233
- cfg = ctx.resolveConfig(values.config);
234
- _open = (0, _dbts.open)(cfg), db = _open.db, warnings = _open.warnings;
235
- (0, _sharedts.printWarnings)(warnings);
236
- rows = [];
237
- failed = 0;
238
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
239
- _state.label = 1;
240
- case 1:
241
- _state.trys.push([
242
- 1,
243
- 10,
244
- 11,
245
- 12
246
- ]);
247
- _iterator = Object.entries((_cfg_queries = cfg.queries) !== null && _cfg_queries !== void 0 ? _cfg_queries : {})[Symbol.iterator]();
248
- _state.label = 2;
249
- case 2:
250
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
251
- 3,
252
- 9
253
- ];
254
- _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], entry = _step_value[1];
255
- if (!((typeof entry === "undefined" ? "undefined" : _type_of(entry)) === 'object' && entry !== null && 'search' in entry)) return [
256
- 3,
257
- 7
258
- ];
259
- _state.label = 3;
260
- case 3:
261
- _state.trys.push([
262
- 3,
263
- 5,
264
- ,
265
- 6
266
- ]);
267
- return [
268
- 4,
269
- (0, _commandsts.search)(db, cfg, entry.search, {
270
- k: 1,
271
- where: entry.where,
272
- preset: entry.preset,
273
- include: entry.include,
274
- exclude: entry.exclude,
275
- probe: true
276
- })
277
- ];
278
- case 4:
279
- count = _state.sent().length;
280
- rows.push({
281
- query: name,
282
- params: '—',
283
- rows: '—',
284
- status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : 'ok (probe run with k=1)'
285
- });
286
- return [
287
- 3,
288
- 6
289
- ];
290
- case 5:
291
- err = _state.sent();
292
- failed++;
293
- rows.push({
294
- query: name,
295
- params: '—',
296
- rows: '—',
297
- status: "FAILED: ".concat(err.message)
298
- });
299
- return [
300
- 3,
301
- 6
302
- ];
303
- case 6:
304
- return [
305
- 3,
306
- 8
307
- ];
308
- case 7:
309
- sql = entry.sql;
310
- params = ((_sql_match = sql.match(/\?/g)) !== null && _sql_match !== void 0 ? _sql_match : []).length;
311
- try {
312
- statement = db.prepare(sql);
313
- if (params > 0) {
314
- rows.push({
315
- query: name,
316
- params: params,
317
- rows: '—',
318
- status: 'ok (not run: needs parameters)'
319
- });
320
- return [
321
- 3,
322
- 8
323
- ];
324
- }
325
- count1 = statement.all().length;
326
- rows.push({
327
- query: name,
328
- params: params,
329
- rows: count1,
330
- status: count1 === 0 ? 'ok, but returns 0 rows' : 'ok'
331
- });
332
- } catch (err) {
333
- failed++;
334
- rows.push({
335
- query: name,
336
- params: params,
337
- rows: '—',
338
- status: "FAILED: ".concat(err.message)
339
- });
340
- }
341
- _state.label = 8;
342
- case 8:
343
- _iteratorNormalCompletion = true;
344
- return [
345
- 3,
346
- 2
347
- ];
348
- case 9:
349
- return [
350
- 3,
351
- 12
352
- ];
353
- case 10:
354
- err1 = _state.sent();
355
- _didIteratorError = true;
356
- _iteratorError = err1;
357
- return [
358
- 3,
359
- 12
360
- ];
361
- case 11:
362
- try {
363
- if (!_iteratorNormalCompletion && _iterator.return != null) {
364
- _iterator.return();
365
- }
366
- } finally{
367
- if (_didIteratorError) {
368
- throw _iteratorError;
369
- }
370
- }
371
- return [
372
- 7
373
- ];
374
- case 12:
375
- db.close();
376
- if (rows.length === 0) {
377
- console.log('no saved queries in config');
378
- return [
379
- 2
380
- ];
381
- }
382
- (0, _outputts.printRows)(rows, format);
383
- if (failed > 0) process.exit(1);
384
- return [
385
- 2
386
- ];
387
- }
388
- });
389
- })();
390
- };
391
- var _default = check;
392
- /* 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; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/check.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A broken query and an empty one look identical, so prepare each to catch syntax and column\n// errors. Parameterised ones are not run (inventing arguments would report a bogus count);\n// searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.\nconst check: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.check}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n\n const rows: Row[] = [];\n let failed = 0;\n for (const [name, entry] of Object.entries(cfg.queries ?? {})) {\n if (typeof entry === 'object' && entry !== null && 'search' in entry) {\n try {\n const count = (await search(db, cfg, entry.search, { k: 1, where: entry.where, preset: entry.preset, include: entry.include, exclude: entry.exclude, probe: true })).length;\n rows.push({ query: name, params: '—', rows: '—', status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : 'ok (probe run with k=1)' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params: '—', rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n continue;\n }\n const sql = entry.sql;\n const params = (sql.match(/\\?/g) ?? []).length;\n try {\n const statement = db.prepare(sql);\n if (params > 0) {\n rows.push({ query: name, params, rows: '—', status: 'ok (not run: needs parameters)' });\n continue;\n }\n const count = (statement.all() as unknown[]).length;\n rows.push({ query: name, params, rows: count, status: count === 0 ? 'ok, but returns 0 rows' : 'ok' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params, rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n }\n\n db.close();\n if (rows.length === 0) {\n console.log('no saved queries in config');\n return;\n }\n printRows(rows, format);\n if (failed > 0) process.exit(1);\n};\nexport default check;\n"],"names":["check","ctx","cfg","values","format","open","db","warnings","rows","failed","name","entry","sql","count","err","params","statement","parse","argv","USAGE","FORMAT","CONFIG","formatOf","resolveConfig","config","printWarnings","Object","entries","queries","search","k","where","preset","include","exclude","probe","length","push","query","status","message","match","prepare","all","close","console","log","printRows","process","exit"],"mappings":";;;;+BAuDA;;;eAAA;;;0BAvDuB;oBACF;wBAEK;uBACJ;wBACyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC;wBACZ;;;oBACF;oBACAC,IAAAA,mBAAS,EAACvC,MAAMJ;oBAChB,IAAIK,SAAS,GAAGuC,QAAQC,IAAI,CAAC;;;;;;IAC/B;;IACA,WAAejD"}
@@ -1,3 +0,0 @@
1
- import type { Command } from './types.js';
2
- declare const rebuildCmd: Command;
3
- export default rebuildCmd;
@@ -1,3 +0,0 @@
1
- import type { Command } from './types.js';
2
- declare const rebuildCmd: Command;
3
- export default rebuildCmd;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _dbts = require("../db.js");
12
- var _indexts = require("./index.js");
13
- var _sharedts = require("./shared.js");
14
- function _define_property(obj, key, value) {
15
- if (key in obj) {
16
- Object.defineProperty(obj, key, {
17
- value: value,
18
- enumerable: true,
19
- configurable: true,
20
- writable: true
21
- });
22
- } else {
23
- obj[key] = value;
24
- }
25
- return obj;
26
- }
27
- function _object_spread(target) {
28
- for(var i = 1; i < arguments.length; i++){
29
- var source = arguments[i] != null ? arguments[i] : {};
30
- var ownKeys = Object.keys(source);
31
- if (typeof Object.getOwnPropertySymbols === "function") {
32
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
33
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
34
- }));
35
- }
36
- ownKeys.forEach(function(key) {
37
- _define_property(target, key, source[key]);
38
- });
39
- }
40
- return target;
41
- }
42
- var rebuildCmd = function rebuildCmd(ctx) {
43
- var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.rebuild), _object_spread({}, _sharedts.CONFIG)).values;
44
- var result = (0, _dbts.rebuild)(ctx.resolveConfig(values.config));
45
- (0, _sharedts.printWarnings)(result.warnings);
46
- console.log("rebuilt: ".concat((0, _dbts.docCount)(result.db), " docs"));
47
- result.db.close();
48
- };
49
- var _default = rebuildCmd;
50
- /* 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; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/rebuild.ts"],"sourcesContent":["import { docCount, rebuild } from '../db.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst rebuildCmd: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.rebuild}`, { ...CONFIG });\n const result = rebuild(ctx.resolveConfig(values.config as string | undefined));\n printWarnings(result.warnings);\n console.log(`rebuilt: ${docCount(result.db)} docs`);\n result.db.close();\n};\nexport default rebuildCmd;\n"],"names":["rebuildCmd","ctx","values","parse","argv","USAGE","name","rebuild","CONFIG","result","resolveConfig","config","printWarnings","warnings","console","log","docCount","db","close"],"mappings":";;;;+BAYA;;;eAAA;;;oBAZkC;uBACZ;wBACuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG7C,IAAMA,aAAsB,oBAACC;IAC3B,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAiB,OAAdD,cAAK,CAACE,OAAO,GAAI,mBAAKC,gBAAM,GAA7EN;IACR,IAAMO,SAASF,IAAAA,aAAO,EAACN,IAAIS,aAAa,CAACR,OAAOS,MAAM;IACtDC,IAAAA,uBAAa,EAACH,OAAOI,QAAQ;IAC7BC,QAAQC,GAAG,CAAC,AAAC,YAA+B,OAApBC,IAAAA,cAAQ,EAACP,OAAOQ,EAAE,GAAE;IAC5CR,OAAOQ,EAAE,CAACC,KAAK;AACjB;IACA,WAAelB"}
@@ -1,3 +0,0 @@
1
- import type { Command } from './types.js';
2
- declare const check: Command;
3
- export default check;
@@ -1,88 +0,0 @@
1
- import { search } from '../commands.js';
2
- import { open } from '../db.js';
3
- import { printRows } from '../output.js';
4
- import { USAGE } from './index.js';
5
- import { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.js';
6
- // A broken query and an empty one look identical, so prepare each to catch syntax and column
7
- // errors. Parameterised ones are not run (inventing arguments would report a bogus count);
8
- // searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.
9
- const check = async (ctx)=>{
10
- var _cfg_queries;
11
- const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.check}`, {
12
- ...FORMAT,
13
- ...CONFIG
14
- });
15
- const format = formatOf(values);
16
- const cfg = ctx.resolveConfig(values.config);
17
- const { db, warnings } = open(cfg);
18
- printWarnings(warnings);
19
- const rows = [];
20
- let failed = 0;
21
- for (const [name, entry] of Object.entries((_cfg_queries = cfg.queries) !== null && _cfg_queries !== void 0 ? _cfg_queries : {})){
22
- var _sql_match;
23
- if (typeof entry === 'object' && entry !== null && 'search' in entry) {
24
- try {
25
- const count = (await search(db, cfg, entry.search, {
26
- k: 1,
27
- where: entry.where,
28
- preset: entry.preset,
29
- include: entry.include,
30
- exclude: entry.exclude,
31
- probe: true
32
- })).length;
33
- rows.push({
34
- query: name,
35
- params: '—',
36
- rows: '—',
37
- status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : 'ok (probe run with k=1)'
38
- });
39
- } catch (err) {
40
- failed++;
41
- rows.push({
42
- query: name,
43
- params: '—',
44
- rows: '—',
45
- status: `FAILED: ${err.message}`
46
- });
47
- }
48
- continue;
49
- }
50
- const sql = entry.sql;
51
- const params = ((_sql_match = sql.match(/\?/g)) !== null && _sql_match !== void 0 ? _sql_match : []).length;
52
- try {
53
- const statement = db.prepare(sql);
54
- if (params > 0) {
55
- rows.push({
56
- query: name,
57
- params,
58
- rows: '—',
59
- status: 'ok (not run: needs parameters)'
60
- });
61
- continue;
62
- }
63
- const count = statement.all().length;
64
- rows.push({
65
- query: name,
66
- params,
67
- rows: count,
68
- status: count === 0 ? 'ok, but returns 0 rows' : 'ok'
69
- });
70
- } catch (err) {
71
- failed++;
72
- rows.push({
73
- query: name,
74
- params,
75
- rows: '—',
76
- status: `FAILED: ${err.message}`
77
- });
78
- }
79
- }
80
- db.close();
81
- if (rows.length === 0) {
82
- console.log('no saved queries in config');
83
- return;
84
- }
85
- printRows(rows, format);
86
- if (failed > 0) process.exit(1);
87
- };
88
- export default check;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/check.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A broken query and an empty one look identical, so prepare each to catch syntax and column\n// errors. Parameterised ones are not run (inventing arguments would report a bogus count);\n// searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.\nconst check: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.check}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n\n const rows: Row[] = [];\n let failed = 0;\n for (const [name, entry] of Object.entries(cfg.queries ?? {})) {\n if (typeof entry === 'object' && entry !== null && 'search' in entry) {\n try {\n const count = (await search(db, cfg, entry.search, { k: 1, where: entry.where, preset: entry.preset, include: entry.include, exclude: entry.exclude, probe: true })).length;\n rows.push({ query: name, params: '—', rows: '—', status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : 'ok (probe run with k=1)' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params: '—', rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n continue;\n }\n const sql = entry.sql;\n const params = (sql.match(/\\?/g) ?? []).length;\n try {\n const statement = db.prepare(sql);\n if (params > 0) {\n rows.push({ query: name, params, rows: '—', status: 'ok (not run: needs parameters)' });\n continue;\n }\n const count = (statement.all() as unknown[]).length;\n rows.push({ query: name, params, rows: count, status: count === 0 ? 'ok, but returns 0 rows' : 'ok' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params, rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n }\n\n db.close();\n if (rows.length === 0) {\n console.log('no saved queries in config');\n return;\n }\n printRows(rows, format);\n if (failed > 0) process.exit(1);\n};\nexport default check;\n"],"names":["search","open","printRows","USAGE","CONFIG","FORMAT","formatOf","parse","printWarnings","check","ctx","cfg","values","argv","name","format","resolveConfig","config","db","warnings","rows","failed","entry","Object","entries","queries","sql","count","k","where","preset","include","exclude","probe","length","push","query","params","status","err","message","match","statement","prepare","all","close","console","log","process","exit"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AACxC,SAASC,IAAI,QAAQ,WAAW;AAEhC,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,QAAQ,cAAc;AAG7E,6FAA6F;AAC7F,2FAA2F;AAC3F,8FAA8F;AAC9F,MAAMC,QAAiB,OAAOC;QASeC;IAR3C,MAAM,EAAEC,MAAM,EAAE,GAAGL,MAAMG,IAAIG,IAAI,EAAE,CAAC,OAAO,EAAEH,IAAII,IAAI,CAAC,CAAC,EAAEX,MAAMM,KAAK,EAAE,EAAE;QAAE,GAAGJ,MAAM;QAAE,GAAGD,MAAM;IAAC;IAC/F,MAAMW,SAAST,SAASM;IACxB,MAAMD,MAAMD,IAAIM,aAAa,CAACJ,OAAOK,MAAM;IAC3C,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGlB,KAAKU;IAC9BH,cAAcW;IAEd,MAAMC,OAAc,EAAE;IACtB,IAAIC,SAAS;IACb,KAAK,MAAM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2BAA2B;YAAK;QACtG,EAAE,OAAOY,KAAK;YACZlB;YACAD,KAAKe,IAAI,CAAC;gBAAEC,OAAOtB;gBAAMuB;gBAAQjB,MAAM;gBAAKkB,QAAQ,CAAC,QAAQ,EAAE,AAACC,IAAcC,OAAO,EAAE;YAAC;QAC1F;IACF;IAEAtB,GAAG2B,KAAK;IACR,IAAIzB,KAAKc,MAAM,KAAK,GAAG;QACrBY,QAAQC,GAAG,CAAC;QACZ;IACF;IACA7C,UAAUkB,MAAML;IAChB,IAAIM,SAAS,GAAG2B,QAAQC,IAAI,CAAC;AAC/B;AACA,eAAexC,MAAM"}
@@ -1,3 +0,0 @@
1
- import type { Command } from './types.js';
2
- declare const rebuildCmd: Command;
3
- export default rebuildCmd;
@@ -1,13 +0,0 @@
1
- import { docCount, rebuild } from '../db.js';
2
- import { USAGE } from './index.js';
3
- import { CONFIG, parse, printWarnings } from './shared.js';
4
- const rebuildCmd = (ctx)=>{
5
- const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.rebuild}`, {
6
- ...CONFIG
7
- });
8
- const result = rebuild(ctx.resolveConfig(values.config));
9
- printWarnings(result.warnings);
10
- console.log(`rebuilt: ${docCount(result.db)} docs`);
11
- result.db.close();
12
- };
13
- export default rebuildCmd;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/rebuild.ts"],"sourcesContent":["import { docCount, rebuild } from '../db.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst rebuildCmd: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.rebuild}`, { ...CONFIG });\n const result = rebuild(ctx.resolveConfig(values.config as string | undefined));\n printWarnings(result.warnings);\n console.log(`rebuilt: ${docCount(result.db)} docs`);\n result.db.close();\n};\nexport default rebuildCmd;\n"],"names":["docCount","rebuild","USAGE","CONFIG","parse","printWarnings","rebuildCmd","ctx","values","argv","name","result","resolveConfig","config","warnings","console","log","db","close"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAC7C,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,MAAM,EAAEC,KAAK,EAAEC,aAAa,QAAQ,cAAc;AAG3D,MAAMC,aAAsB,CAACC;IAC3B,MAAM,EAAEC,MAAM,EAAE,GAAGJ,MAAMG,IAAIE,IAAI,EAAE,CAAC,OAAO,EAAEF,IAAIG,IAAI,CAAC,CAAC,EAAER,MAAMD,OAAO,EAAE,EAAE;QAAE,GAAGE,MAAM;IAAC;IACtF,MAAMQ,SAASV,QAAQM,IAAIK,aAAa,CAACJ,OAAOK,MAAM;IACtDR,cAAcM,OAAOG,QAAQ;IAC7BC,QAAQC,GAAG,CAAC,CAAC,SAAS,EAAEhB,SAASW,OAAOM,EAAE,EAAE,KAAK,CAAC;IAClDN,OAAOM,EAAE,CAACC,KAAK;AACjB;AACA,eAAeZ,WAAW"}