sensemaking 0.15.3 → 0.15.4

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 (66) hide show
  1. package/dist/cjs/cli/download.js +3 -8
  2. package/dist/cjs/cli/download.js.map +1 -1
  3. package/dist/cjs/cli/index.js +8 -19
  4. package/dist/cjs/cli/index.js.map +1 -1
  5. package/dist/cjs/cli/map.js +1 -3
  6. package/dist/cjs/cli/map.js.map +1 -1
  7. package/dist/cjs/cli/named.js +3 -8
  8. package/dist/cjs/cli/named.js.map +1 -1
  9. package/dist/cjs/cli/path.js +4 -7
  10. package/dist/cjs/cli/path.js.map +1 -1
  11. package/dist/cjs/cli/peek.js +2 -4
  12. package/dist/cjs/cli/peek.js.map +1 -1
  13. package/dist/cjs/cli/related.js +14 -20
  14. package/dist/cjs/cli/related.js.map +1 -1
  15. package/dist/cjs/cli/search.js +12 -17
  16. package/dist/cjs/cli/search.js.map +1 -1
  17. package/dist/cjs/cli/shared.js +17 -21
  18. package/dist/cjs/cli/shared.js.map +1 -1
  19. package/dist/cjs/cli/sql.js +7 -8
  20. package/dist/cjs/cli/sql.js.map +1 -1
  21. package/dist/cjs/cli/status.js +1 -3
  22. package/dist/cjs/cli/status.js.map +1 -1
  23. package/dist/cjs/cli/watch.js +3 -8
  24. package/dist/cjs/cli/watch.js.map +1 -1
  25. package/dist/cjs/cli.js +22 -34
  26. package/dist/cjs/cli.js.map +1 -1
  27. package/dist/cjs/column-hint.js +4 -2
  28. package/dist/cjs/column-hint.js.map +1 -1
  29. package/dist/cjs/commands/peek.js +5 -3
  30. package/dist/cjs/commands/peek.js.map +1 -1
  31. package/dist/cjs/commands/related.js +14 -15
  32. package/dist/cjs/commands/related.js.map +1 -1
  33. package/dist/cjs/commands/scope.js +4 -2
  34. package/dist/cjs/commands/scope.js.map +1 -1
  35. package/dist/cjs/commands/search.js +15 -16
  36. package/dist/cjs/commands/search.js.map +1 -1
  37. package/dist/cjs/config/access.js +4 -2
  38. package/dist/cjs/config/access.js.map +1 -1
  39. package/dist/cjs/config/load.js +4 -7
  40. package/dist/cjs/config/load.js.map +1 -1
  41. package/dist/cjs/config/validate.js +1 -1
  42. package/dist/cjs/db/open.js +4 -2
  43. package/dist/cjs/db/open.js.map +1 -1
  44. package/dist/cjs/db/reconcile.js +5 -3
  45. package/dist/cjs/db/reconcile.js.map +1 -1
  46. package/dist/cjs/errors.js +15 -24
  47. package/dist/cjs/errors.js.map +1 -1
  48. package/dist/cjs/features/embed.js +39 -45
  49. package/dist/cjs/features/embed.js.map +1 -1
  50. package/dist/cjs/features/links.js +4 -2
  51. package/dist/cjs/features/links.js.map +1 -1
  52. package/dist/cjs/features/rank.js +1 -1
  53. package/dist/cjs/features/tags.js +4 -2
  54. package/dist/cjs/features/tags.js.map +1 -1
  55. package/dist/cjs/fences.js.map +1 -1
  56. package/dist/cjs/graph.js +5 -3
  57. package/dist/cjs/graph.js.map +1 -1
  58. package/dist/cjs/output.js +6 -6
  59. package/dist/cjs/scan.js +5 -3
  60. package/dist/cjs/scan.js.map +1 -1
  61. package/dist/cjs/traverse.js +4 -2
  62. package/dist/cjs/traverse.js.map +1 -1
  63. package/dist/cjs/watch.js +2 -5
  64. package/dist/cjs/watch.js.map +1 -1
  65. package/dist/esm/fences.js.map +1 -1
  66. package/package.json +1 -1
@@ -21,11 +21,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21
21
  reject(error);
22
22
  return;
23
23
  }
24
- if (info.done) {
25
- resolve(value);
26
- } else {
27
- Promise.resolve(value).then(_next, _throw);
28
- }
24
+ if (info.done) resolve(value);
25
+ else Promise.resolve(value).then(_next, _throw);
29
26
  }
30
27
  function _async_to_generator(fn) {
31
28
  return function() {
@@ -50,9 +47,7 @@ function _define_property(obj, key, value) {
50
47
  configurable: true,
51
48
  writable: true
52
49
  });
53
- } else {
54
- obj[key] = value;
55
- }
50
+ } else obj[key] = value;
56
51
  return obj;
57
52
  }
58
53
  function _object_spread(target) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/download.ts"],"sourcesContent":["import { embedConfig } from '../config/index.ts';\nimport { SenseError } from '../errors.ts';\nimport { downloadModel, modelDir, modelPresent } from '../features/embed.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// The one command that fetches weights. Nothing else touches the network for them, so a\n// query that reads like a query never spends minutes pulling 124 MB. Asks nothing, so there\n// is no prompt for CI to bypass; running it twice is a no-op.\nconst download: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.download}`, { ...CONFIG });\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const e = embedConfig(cfg);\n if (!e) throw new SenseError('EMBED_DISABLED', 'no preset asks for vectors, so there is no model to download');\n\n if (e.type === 'api') {\n console.log(`embed type is \"api\" (${e.url}), so there is nothing to download; ${ctx.name} search reaches it over the network`);\n return;\n }\n if (modelPresent(cfg)) {\n console.log(`${e.model} is already available in ${modelDir(e.model)}`);\n return;\n }\n const dir = await downloadModel(e.model, (file, into) => console.error(`fetching ${e.model}/${file} into ${into}`));\n console.log(`downloaded ${e.model} into ${dir}`);\n};\nexport default download;\n"],"names":["download","ctx","values","cfg","e","dir","parse","argv","USAGE","name","CONFIG","resolveConfig","config","embedConfig","SenseError","type","console","log","url","modelPresent","modelDir","model","downloadModel","file","into","error"],"mappings":";;;;+BA2BA;;;eAAA;;;uBA3B4B;wBACD;uBAC2B;wBAChC;wBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,wFAAwF;AACxF,4FAA4F;AAC5F,8DAA8D;AAC9D,IAAMA,WAAoB,kBAAOC;;YACvBC,QACFC,KACAC,GAWAC;;;;oBAbEH,SAAWI,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAE,AAAC,UAAqBC,OAAZP,IAAIQ,IAAI,EAAC,KAAkB,OAAfD,eAAK,CAACR,QAAQ,GAAI,mBAAKU,gBAAM,GAA9ER;oBACFC,MAAMF,IAAIU,aAAa,CAACT,OAAOU,MAAM;oBACrCR,IAAIS,IAAAA,oBAAW,EAACV;oBACtB,IAAI,CAACC,GAAG,MAAM,IAAIU,oBAAU,CAAC,kBAAkB;oBAE/C,IAAIV,EAAEW,IAAI,KAAK,OAAO;wBACpBC,QAAQC,GAAG,CAAC,AAAC,wBAAmEhB,OAA5CG,EAAEc,GAAG,EAAC,wCAA+C,OAATjB,IAAIQ,IAAI,EAAC;wBACzF;;;oBACF;oBACA,IAAIU,IAAAA,qBAAY,EAAChB,MAAM;wBACrBa,QAAQC,GAAG,CAAC,AAAC,GAAqCG,OAAnChB,EAAEiB,KAAK,EAAC,6BAA6C,OAAlBD,IAAAA,iBAAQ,EAAChB,EAAEiB,KAAK;wBAClE;;;oBACF;oBACY;;wBAAMC,IAAAA,sBAAa,EAAClB,EAAEiB,KAAK,EAAE,SAACE,MAAMC;mCAASR,QAAQS,KAAK,CAAC,AAAC,YAAsBF,OAAXnB,EAAEiB,KAAK,EAAC,KAAgBG,OAAbD,MAAK,UAAa,OAALC;;;;oBAArGnB,MAAM;oBACZW,QAAQC,GAAG,CAAC,AAAC,cAA6BZ,OAAhBD,EAAEiB,KAAK,EAAC,UAAY,OAAJhB;;;;;;IAC5C;;IACA,WAAeL"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/download.ts"],"sourcesContent":["import { embedConfig } from '../config/index.ts';\nimport { SenseError } from '../errors.ts';\nimport { downloadModel, modelDir, modelPresent } from '../features/embed.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// The one command that fetches weights. Nothing else touches the network for them, so a\n// query that reads like a query never spends minutes pulling 124 MB. Asks nothing, so there\n// is no prompt for CI to bypass; running it twice is a no-op.\nconst download: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.download}`, { ...CONFIG });\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const e = embedConfig(cfg);\n if (!e) throw new SenseError('EMBED_DISABLED', 'no preset asks for vectors, so there is no model to download');\n\n if (e.type === 'api') {\n console.log(`embed type is \"api\" (${e.url}), so there is nothing to download; ${ctx.name} search reaches it over the network`);\n return;\n }\n if (modelPresent(cfg)) {\n console.log(`${e.model} is already available in ${modelDir(e.model)}`);\n return;\n }\n const dir = await downloadModel(e.model, (file, into) => console.error(`fetching ${e.model}/${file} into ${into}`));\n console.log(`downloaded ${e.model} into ${dir}`);\n};\nexport default download;\n"],"names":["download","ctx","values","cfg","e","dir","parse","argv","USAGE","name","CONFIG","resolveConfig","config","embedConfig","SenseError","type","console","log","url","modelPresent","modelDir","model","downloadModel","file","into","error"],"mappings":";;;;+BA2BA;;;eAAA;;;uBA3B4B;wBACD;uBAC2B;wBAChC;wBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,wFAAwF;AACxF,4FAA4F;AAC5F,8DAA8D;AAC9D,IAAMA,WAAoB,kBAAOC;;YACvBC,QACFC,KACAC,GAWAC;;;;oBAbEH,SAAWI,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAE,AAAC,UAAqBC,OAAZP,IAAIQ,IAAI,EAAC,KAAkB,OAAfD,eAAK,CAACR,QAAQ,GAAI,mBAAKU,gBAAM,GAA9ER;oBACFC,MAAMF,IAAIU,aAAa,CAACT,OAAOU,MAAM;oBACrCR,IAAIS,IAAAA,oBAAW,EAACV;oBACtB,IAAI,CAACC,GAAG,MAAM,IAAIU,oBAAU,CAAC,kBAAkB;oBAE/C,IAAIV,EAAEW,IAAI,KAAK,OAAO;wBACpBC,QAAQC,GAAG,CAAC,AAAC,wBAAmEhB,OAA5CG,EAAEc,GAAG,EAAC,wCAA+C,OAATjB,IAAIQ,IAAI,EAAC;wBACzF;;;oBACF;oBACA,IAAIU,IAAAA,qBAAY,EAAChB,MAAM;wBACrBa,QAAQC,GAAG,CAAC,AAAC,GAAqCG,OAAnChB,EAAEiB,KAAK,EAAC,6BAA6C,OAAlBD,IAAAA,iBAAQ,EAAChB,EAAEiB,KAAK;wBAClE;;;oBACF;oBACY;;wBAAMC,IAAAA,sBAAa,EAAClB,EAAEiB,KAAK,EAAE,SAACE,MAAMC;mCAASR,QAAQS,KAAK,CAAC,AAAC,YAAsBF,OAAXnB,EAAEiB,KAAK,EAAC,KAAgBG,OAAbD,MAAK,UAAa,OAALC;;;;oBAArGnB,MAAM;oBACZW,QAAQC,GAAG,CAAC,AAAC,cAA6BZ,OAAhBD,EAAEiB,KAAK,EAAC,UAAY,OAAJhB;;;;;;IAC5C;;IACA,WAAeL"}
@@ -25,18 +25,12 @@ function _getRequireWildcardCache(nodeInterop) {
25
25
  })(nodeInterop);
26
26
  }
27
27
  function _interop_require_wildcard(obj, nodeInterop) {
28
- if (!nodeInterop && obj && obj.__esModule) {
29
- return obj;
30
- }
31
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
32
- return {
33
- default: obj
34
- };
35
- }
28
+ if (!nodeInterop && obj && obj.__esModule) return obj;
29
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
30
+ default: obj
31
+ };
36
32
  var cache = _getRequireWildcardCache(nodeInterop);
37
- if (cache && cache.has(obj)) {
38
- return cache.get(obj);
39
- }
33
+ if (cache && cache.has(obj)) return cache.get(obj);
40
34
  var newObj = {
41
35
  __proto__: null
42
36
  };
@@ -44,17 +38,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
44
38
  for(var key in obj){
45
39
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
46
40
  var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
47
- if (desc && (desc.get || desc.set)) {
48
- Object.defineProperty(newObj, key, desc);
49
- } else {
50
- newObj[key] = obj[key];
51
- }
41
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
42
+ else newObj[key] = obj[key];
52
43
  }
53
44
  }
54
45
  newObj.default = obj;
55
- if (cache) {
56
- cache.set(obj, newObj);
57
- }
46
+ if (cache) cache.set(obj, newObj);
58
47
  return newObj;
59
48
  }
60
49
  var USAGE = {
@@ -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// top-level usage() and the command's own parse() error/--help output, so there is one\n// copy of each line, not two that can drift.\nexport const USAGE = {\n init: 'init',\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] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json|csv] [--config path]',\n map: 'map [--format table|json] [--config path]',\n peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--format table|json] [--config path]',\n path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--format table|json] [--config path]',\n related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--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: a saved\n// entry in config can never shadow them.\nexport const COMMANDS: Record<string, () => Promise<{ default: Command }>> = {\n init: () => import('./init.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","watch","status","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAqBaA;eAAAA;;QAhBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAKO,IAAMX,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,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// top-level usage() and the command's own parse() error/--help output, so there is one\n// copy of each line, not two that can drift.\nexport const USAGE = {\n init: 'init',\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] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json|csv] [--config path]',\n map: 'map [--format table|json] [--config path]',\n peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--format table|json] [--config path]',\n path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--format table|json] [--config path]',\n related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--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: a saved\n// entry in config can never shadow them.\nexport const COMMANDS: Record<string, () => Promise<{ default: Command }>> = {\n init: () => import('./init.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","watch","status","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAqBaA;eAAAA;;QAhBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAKO,IAAMX,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,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"}
@@ -20,9 +20,7 @@ function _define_property(obj, key, value) {
20
20
  configurable: true,
21
21
  writable: true
22
22
  });
23
- } else {
24
- obj[key] = value;
25
- }
23
+ } else obj[key] = value;
26
24
  return obj;
27
25
  }
28
26
  function _object_spread(target) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/map.ts"],"sourcesContent":["import { mapTree } from '../commands/index.ts';\nimport { renderMap } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst map: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.map}`, { ...SCOPE, ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const result = mapTree(db, cfg, scopeOf(values));\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderMap(result));\n });\n};\nexport default map;\n"],"names":["map","ctx","values","parse","argv","USAGE","name","SCOPE","FORMAT","CONFIG","format","formatOf","withDb","config","db","cfg","result","mapTree","scopeOf","console","log","JSON","stringify","renderMap"],"mappings":";;;;+BAcA;;;eAAA;;;uBAdwB;wBACE;wBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,MAAe,aAACC;IACpB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAa,OAAVD,eAAK,CAACL,GAAG,GAAI,mBAAKO,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,GAA9FP;IACR,IAAMQ,SAASC,IAAAA,kBAAQ,EAACT;IACxB,OAAOU,IAAAA,gBAAM,EAACX,KAAKC,OAAOW,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASC,IAAAA,gBAAO,EAACH,IAAIC,KAAKG,IAAAA,iBAAO,EAAChB;QACxCiB,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACN,QAAQ,MAAM,KAAKO,IAAAA,mBAAS,EAACP;IAC9E;AACF;IACA,WAAehB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/map.ts"],"sourcesContent":["import { mapTree } from '../commands/index.ts';\nimport { renderMap } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst map: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.map}`, { ...SCOPE, ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const result = mapTree(db, cfg, scopeOf(values));\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderMap(result));\n });\n};\nexport default map;\n"],"names":["map","ctx","values","parse","argv","USAGE","name","SCOPE","FORMAT","CONFIG","format","formatOf","withDb","config","db","cfg","result","mapTree","scopeOf","console","log","JSON","stringify","renderMap"],"mappings":";;;;+BAcA;;;eAAA;;;uBAdwB;wBACE;wBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,MAAe,aAACC;IACpB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAa,OAAVD,eAAK,CAACL,GAAG,GAAI,mBAAKO,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,GAA9FP;IACR,IAAMQ,SAASC,IAAAA,kBAAQ,EAACT;IACxB,OAAOU,IAAAA,gBAAM,EAACX,KAAKC,OAAOW,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASC,IAAAA,gBAAO,EAACH,IAAIC,KAAKG,IAAAA,iBAAO,EAAChB;QACxCiB,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACN,QAAQ,MAAM,KAAKO,IAAAA,mBAAS,EAACP;IAC9E;AACF;IACA,WAAehB"}
@@ -21,11 +21,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
21
21
  reject(error);
22
22
  return;
23
23
  }
24
- if (info.done) {
25
- resolve(value);
26
- } else {
27
- Promise.resolve(value).then(_next, _throw);
28
- }
24
+ if (info.done) resolve(value);
25
+ else Promise.resolve(value).then(_next, _throw);
29
26
  }
30
27
  function _async_to_generator(fn) {
31
28
  return function() {
@@ -50,9 +47,7 @@ function _define_property(obj, key, value) {
50
47
  configurable: true,
51
48
  writable: true
52
49
  });
53
- } else {
54
- obj[key] = value;
55
- }
50
+ } else obj[key] = value;
56
51
  return obj;
57
52
  }
58
53
  function _object_spread(target) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, runSql, SEARCH_FLAGS, withDb } from './shared.ts';\nimport type { Ctx } from './types.ts';\n\n// Fallback when the first positional is not a command: a saved query, { sql } or { search }.\n// SEARCH_FLAGS override a saved search's fields the same way they override a preset's.\nexport default async function named(ctx: Ctx, queryName: string): Promise<void> {\n const usage = `usage: ${ctx.name} ${queryName} [params...] [--format table|json|csv] [--config path] [--where \"<sql>\"] [--k n] [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude]`;\n const { values, positionals: params } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const format = rowFormatOf(values);\n const configPath = values.config as string | undefined;\n\n const cfg = ctx.resolveConfig(configPath);\n const entry = cfg.queries[queryName];\n if (entry === undefined) {\n console.error(`unknown command or saved entry: \"${queryName}\"`);\n console.error(`saved queries: ${Object.keys(cfg.queries).sort().join(', ')}`);\n process.exit(2);\n }\n\n if ('sql' in entry) {\n // A saved statement written against `scope` is preset-agnostic, so the same entry can be\n // re-pointed at another layer from the command line instead of being copied per preset.\n runSql(cfg, entry.sql, params, format, `query \"${queryName}\"`, values.preset as string | undefined);\n return;\n }\n\n // A saved search's text is fixed in config; there is nowhere for a positional to bind.\n if (params.length > 0) {\n ctx.usageError(`\"${queryName}\" is a saved search and takes no positional parameters; edit its \"search\" in sense.config.json, or use \"${ctx.name} search\" directly`);\n }\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? entry.k;\n const where = (values.where as string | undefined) ?? entry.where;\n const preset = (values.preset as string | undefined) ?? entry.preset;\n const include = (values.include as string[] | undefined) ?? entry.include;\n const exclude = (values.exclude as string[] | undefined) ?? entry.exclude;\n const noExclude = values['no-exclude'] === true;\n await withDb(ctx, configPath, async (db, resolvedCfg) => printRows(await search(db, resolvedCfg, entry.search, { k, where, preset, include, exclude, noExclude }), format));\n}\n"],"names":["named","ctx","queryName","parseK","values","usage","parse","params","format","configPath","cfg","entry","k","where","preset","include","exclude","noExclude","name","argv","SEARCH_FLAGS","FORMAT","CONFIG","positionals","rowFormatOf","config","resolveConfig","queries","undefined","console","error","Object","keys","sort","join","process","exit","runSql","sql","length","usageError","withDb","db","resolvedCfg","search","printRows"],"mappings":";;;;+BAKA,6FAA6F;AAC7F,uFAAuF;AACv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;oBAEA,uFAAuF;oBACvF,IAAIP,OAAOgC,MAAM,GAAG,GAAG;wBACrBtC,IAAIuC,UAAU,CAAC,AAAC,IAAuHvC,OAApHC,WAAU,4GAAmH,OAATD,IAAIiB,IAAI,EAAC;oBAClJ;oBACMN,KAAIT,UAAAA,IAAAA,gBAAM,EAACC,OAAOQ,CAAC,EAAwBX,IAAIuC,UAAU,eAArDrC,qBAAAA,UAA0DQ,MAAMC,CAAC;oBACrEC,SAAST,gBAAAA,OAAOS,KAAK,cAAZT,2BAAAA,gBAAuCO,MAAME,KAAK;oBAC3DC,UAAUV,iBAAAA,OAAOU,MAAM,cAAbV,4BAAAA,iBAAwCO,MAAMG,MAAM;oBAC9DC,WAAWX,kBAAAA,OAAOW,OAAO,cAAdX,6BAAAA,kBAA2CO,MAAMI,OAAO;oBACnEC,WAAWZ,kBAAAA,OAAOY,OAAO,cAAdZ,6BAAAA,kBAA2CO,MAAMK,OAAO;oBACnEC,YAAYb,MAAM,CAAC,aAAa,KAAK;oBAC3C;;wBAAMqC,IAAAA,gBAAM,EAACxC,KAAKQ,YAAY,SAAOiC,IAAIC;;;;;4CAA0B;;gDAAMC,IAAAA,eAAM,EAACF,IAAIC,aAAahC,MAAMiC,MAAM,EAAE;oDAAEhC,GAAAA;oDAAGC,OAAAA;oDAAOC,QAAAA;oDAAQC,SAAAA;oDAASC,SAAAA;oDAASC,WAAAA;gDAAU;;;;;gDAAtG4B,mBAAS;oDAAC;oDAAgGrC;;;;;;;;;oBAAnK;;;;;;IACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, runSql, SEARCH_FLAGS, withDb } from './shared.ts';\nimport type { Ctx } from './types.ts';\n\n// Fallback when the first positional is not a command: a saved query, { sql } or { search }.\n// SEARCH_FLAGS override a saved search's fields the same way they override a preset's.\nexport default async function named(ctx: Ctx, queryName: string): Promise<void> {\n const usage = `usage: ${ctx.name} ${queryName} [params...] [--format table|json|csv] [--config path] [--where \"<sql>\"] [--k n] [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude]`;\n const { values, positionals: params } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const format = rowFormatOf(values);\n const configPath = values.config as string | undefined;\n\n const cfg = ctx.resolveConfig(configPath);\n const entry = cfg.queries[queryName];\n if (entry === undefined) {\n console.error(`unknown command or saved entry: \"${queryName}\"`);\n console.error(`saved queries: ${Object.keys(cfg.queries).sort().join(', ')}`);\n process.exit(2);\n }\n\n if ('sql' in entry) {\n // A saved statement written against `scope` is preset-agnostic, so the same entry can be\n // re-pointed at another layer from the command line instead of being copied per preset.\n runSql(cfg, entry.sql, params, format, `query \"${queryName}\"`, values.preset as string | undefined);\n return;\n }\n\n // A saved search's text is fixed in config; there is nowhere for a positional to bind.\n if (params.length > 0) {\n ctx.usageError(`\"${queryName}\" is a saved search and takes no positional parameters; edit its \"search\" in sense.config.json, or use \"${ctx.name} search\" directly`);\n }\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? entry.k;\n const where = (values.where as string | undefined) ?? entry.where;\n const preset = (values.preset as string | undefined) ?? entry.preset;\n const include = (values.include as string[] | undefined) ?? entry.include;\n const exclude = (values.exclude as string[] | undefined) ?? entry.exclude;\n const noExclude = values['no-exclude'] === true;\n await withDb(ctx, configPath, async (db, resolvedCfg) => printRows(await search(db, resolvedCfg, entry.search, { k, where, preset, include, exclude, noExclude }), format));\n}\n"],"names":["named","ctx","queryName","parseK","values","usage","parse","params","format","configPath","cfg","entry","k","where","preset","include","exclude","noExclude","name","argv","SEARCH_FLAGS","FORMAT","CONFIG","positionals","rowFormatOf","config","resolveConfig","queries","undefined","console","error","Object","keys","sort","join","process","exit","runSql","sql","length","usageError","withDb","db","resolvedCfg","search","printRows"],"mappings":";;;;+BAKA,6FAA6F;AAC7F,uF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BACF;oBAEA,uFAAuF;oBACvF,IAAIP,OAAOgC,MAAM,GAAG,GAAG;wBACrBtC,IAAIuC,UAAU,CAAC,AAAC,IAAuHvC,OAApHC,WAAU,4GAAmH,OAATD,IAAIiB,IAAI,EAAC;oBAClJ;oBACMN,KAAIT,UAAAA,IAAAA,gBAAM,EAACC,OAAOQ,CAAC,EAAwBX,IAAIuC,UAAU,eAArDrC,qBAAAA,UAA0DQ,MAAMC,CAAC;oBACrEC,SAAST,gBAAAA,OAAOS,KAAK,cAAZT,2BAAAA,gBAAuCO,MAAME,KAAK;oBAC3DC,UAAUV,iBAAAA,OAAOU,MAAM,cAAbV,4BAAAA,iBAAwCO,MAAMG,MAAM;oBAC9DC,WAAWX,kBAAAA,OAAOW,OAAO,cAAdX,6BAAAA,kBAA2CO,MAAMI,OAAO;oBACnEC,WAAWZ,kBAAAA,OAAOY,OAAO,cAAdZ,6BAAAA,kBAA2CO,MAAMK,OAAO;oBACnEC,YAAYb,MAAM,CAAC,aAAa,KAAK;oBAC3C;;wBAAMqC,IAAAA,gBAAM,EAACxC,KAAKQ,YAAY,SAAOiC,IAAIC;;;;;4CAA0B;;gDAAMC,IAAAA,eAAM,EAACF,IAAIC,aAAahC,MAAMiC,MAAM,EAAE;oDAAEhC,GAAAA;oDAAGC,OAAAA;oDAAOC,QAAAA;oDAAQC,SAAAA;oDAASC,SAAAA;oDAASC,WAAAA;gDAAU;;;;;gDAAtG4B,mBAAS;oDAAC;oDAAgGrC;;;;;;;;;oBAAnK;;;;;;IACF"}
@@ -29,9 +29,7 @@ function _define_property(obj, key, value) {
29
29
  configurable: true,
30
30
  writable: true
31
31
  });
32
- } else {
33
- obj[key] = value;
34
- }
32
+ } else obj[key] = value;
35
33
  return obj;
36
34
  }
37
35
  function _iterable_to_array_limit(arr, i) {
@@ -59,7 +57,7 @@ function _iterable_to_array_limit(arr, i) {
59
57
  return _arr;
60
58
  }
61
59
  function _non_iterable_rest() {
62
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
60
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
63
61
  }
64
62
  function _object_spread(target) {
65
63
  for(var i = 1; i < arguments.length; i++){
@@ -91,9 +89,8 @@ function ownKeys(object, enumerableOnly) {
91
89
  }
92
90
  function _object_spread_props(target, source) {
93
91
  source = source != null ? source : {};
94
- if (Object.getOwnPropertyDescriptors) {
95
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
96
- } else {
92
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
93
+ else {
97
94
  ownKeys(Object(source)).forEach(function(key) {
98
95
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
99
96
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { resolveNote, scopedPaths } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { findPath } from '../traverse.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, 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, ...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, (db, cfg) => {\n const paths = (db.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 = scopedPaths(db, cfg, scopeOf(values));\n const hops = findPath(db, 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","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","db","cfg","paths","prepare","all","map","r","from","resolveNote","to","allowed","scopedPaths","scopeOf","hops","findPath","console","log","JSON","stringify","rows","p","step","printRows"],"mappings":";;;;+BA0CA;;;eAAA;;;uBA1CyC;wBAEf;0BACD;wBACH;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,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,eAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,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Content":["import { resolveNote, scopedPaths } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { findPath } from '../traverse.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, 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, ...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, (db, cfg) => {\n const paths = (db.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 = scopedPaths(db, cfg, scopeOf(values));\n const hops = findPath(db, 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","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","db","cfg","paths","prepare","all","map","r","from","resolveNote","to","allowed","scopedPaths","scopeOf","hops","findPath","console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AA,oBAAW,EAACN,OAAOR;QAC9B,IAAMgB,UAAUC,IAAAA,oBAAW,EAACX,IAAIC,KAAKW,IAAAA,iBAAO,EAACrB;QAC7C,IAAMsB,OAAOC,IAAAA,oBAAQ,EAACd,IAAIO,MAAME,IAAI;YAAEd,UAAAA;YAAUe,SAAAA;QAAQ;QAExD,IAAId,WAAW,QAAQ;YACrBmB,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACL;YAC3B;QACF;QACA,IAAIA,SAAS,MAAM;YACjBE,QAAQC,GAAG,CAACrB,WAAW,AAAC,kBAA0B,OAATA,UAAS,WAAS;YAC3D;QACF;QACA,IAAMwB,OAAcN,KAAKR,GAAG,CAAC,SAACe,GAAGC;mBAAU;gBAAEA,MAAAA;gBAAMrC,MAAMoC;YAAE;;QAC3DE,IAAAA,mBAAS,EAACH,MAAMvB;IAClB;AACF;IACA,WAAejB"}
@@ -28,9 +28,7 @@ function _define_property(obj, key, value) {
28
28
  configurable: true,
29
29
  writable: true
30
30
  });
31
- } else {
32
- obj[key] = value;
33
- }
31
+ } else obj[key] = value;
34
32
  return obj;
35
33
  }
36
34
  function _iterable_to_array_limit(arr, i) {
@@ -58,7 +56,7 @@ function _iterable_to_array_limit(arr, i) {
58
56
  return _arr;
59
57
  }
60
58
  function _non_iterable_rest() {
61
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
60
  }
63
61
  function _object_spread(target) {
64
62
  for(var i = 1; i < arguments.length; i++){
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands/index.ts';\nimport { renderPeek } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst peekCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.peek}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const overrides = scopeOf(values);\n const result = peek(db, cfg, pathArg, overrides);\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderPeek(result));\n });\n};\nexport default peekCmd;\n"],"names":["peekCmd","ctx","usage","USAGE","name","peek","parse","argv","SCOPE","FORMAT","CONFIG","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","overrides","scopeOf","result","console","log","JSON","stringify","renderPeek"],"mappings":";;;;+BAkBA;;;eAAA;;;uBAlBqB;wBACM;wBACL;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,eAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,mBAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,IAA/EC,SAAwBL,OAAxBK,QAAQC,cAAgBN,OAAhBM;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASZ,IAAIa,UAAU,CAACZ;IAC7B,IAAMa,SAASC,IAAAA,kBAAQ,EAACL;IACxB,OAAOM,IAAAA,gBAAM,EAAChB,KAAKU,OAAOO,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,YAAYC,IAAAA,iBAAO,EAACX;QAC1B,IAAMY,SAASlB,IAAAA,aAAI,EAACc,IAAIC,KAAKP,SAASQ;QACtCG,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACJ,QAAQ,MAAM,KAAKK,IAAAA,oBAAU,EAACL;IAC/E;AACF;IACA,WAAevB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands/index.ts';\nimport { renderPeek } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst peekCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.peek}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const overrides = scopeOf(values);\n const result = peek(db, cfg, pathArg, overrides);\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderPeek(result));\n });\n};\nexport default peekCmd;\n"],"names":["peekCmd","ctx","usage","USAGE","name","peek","parse","argv","SCOPE","FORMAT","CONFIG","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","overrides","scopeOf","result","console","log","JSON","stringify","renderPeek"],"mappings":";;;;+BAkBA;;;eAAA;;;uBAlBqB;wBACM;wBACL;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,eAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,mBAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,IAA/EC,SAAwBL,OAAxBK,QAAQC,cAAgBN,OAAhBM;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASZ,IAAIa,UAAU,CAACZ;IAC7B,IAAMa,SAASC,IAAAA,kBAAQ,EAACL;IACxB,OAAOM,IAAAA,gBAAM,EAAChB,KAAKU,OAAOO,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,YAAYC,IAAAA,iBAAO,EAACX;QAC1B,IAAMY,SAASlB,IAAAA,aAAI,EAACc,IAAIC,KAAKP,SAASQ;QACtCG,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACJ,QAAQ,MAAM,KAAKK,IAAAA,oBAAU,EAACL;IAC/E;AACF;IACA,WAAevB"}
@@ -28,11 +28,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
28
28
  reject(error);
29
29
  return;
30
30
  }
31
- if (info.done) {
32
- resolve(value);
33
- } else {
34
- Promise.resolve(value).then(_next, _throw);
35
- }
31
+ if (info.done) resolve(value);
32
+ else Promise.resolve(value).then(_next, _throw);
36
33
  }
37
34
  function _async_to_generator(fn) {
38
35
  return function() {
@@ -57,9 +54,7 @@ function _define_property(obj, key, value) {
57
54
  configurable: true,
58
55
  writable: true
59
56
  });
60
- } else {
61
- obj[key] = value;
62
- }
57
+ } else obj[key] = value;
63
58
  return obj;
64
59
  }
65
60
  function _iterable_to_array_limit(arr, i) {
@@ -87,7 +82,7 @@ function _iterable_to_array_limit(arr, i) {
87
82
  return _arr;
88
83
  }
89
84
  function _non_iterable_rest() {
90
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
85
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
91
86
  }
92
87
  function _object_spread(target) {
93
88
  for(var i = 1; i < arguments.length; i++){
@@ -119,9 +114,8 @@ function ownKeys(object, enumerableOnly) {
119
114
  }
120
115
  function _object_spread_props(target, source) {
121
116
  source = source != null ? source : {};
122
- if (Object.getOwnPropertyDescriptors) {
123
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
124
- } else {
117
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
118
+ else {
125
119
  ownKeys(Object(source)).forEach(function(key) {
126
120
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
127
121
  });
@@ -131,14 +125,6 @@ function _object_spread_props(target, source) {
131
125
  function _sliced_to_array(arr, i) {
132
126
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
133
127
  }
134
- function _unsupported_iterable_to_array(o, minLen) {
135
- if (!o) return;
136
- if (typeof o === "string") return _array_like_to_array(o, minLen);
137
- var n = Object.prototype.toString.call(o).slice(8, -1);
138
- if (n === "Object" && o.constructor) n = o.constructor.name;
139
- if (n === "Map" || n === "Set") return Array.from(n);
140
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
141
- }
142
128
  function _ts_generator(thisArg, body) {
143
129
  var f, y, t, _ = {
144
130
  label: 0,
@@ -238,6 +224,14 @@ function _ts_generator(thisArg, body) {
238
224
  };
239
225
  }
240
226
  }
227
+ function _unsupported_iterable_to_array(o, minLen) {
228
+ if (!o) return;
229
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
230
+ var n = Object.prototype.toString.call(o).slice(8, -1);
231
+ if (n === "Object" && o.constructor) n = o.constructor.name;
232
+ if (n === "Map" || n === "Set") return Array.from(n);
233
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
234
+ }
241
235
  var RELATED_DEFAULT_K = 5;
242
236
  var relatedCmd = function relatedCmd(ctx) {
243
237
  var _parseK;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { relatedNotes } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, 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, ...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 return withDb(ctx, values.config as string | undefined, async (db, cfg) => {\n const overrides = scopeOf(values);\n printRows((await relatedNotes(db, 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","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","rowFormatOf","withDb","config","db","cfg","overrides","scopeOf","relatedNotes","printRows"],"mappings":";;;;+BAqBA;;;eAAA;;;uBArB6B;wBAEH;wBACJ;wBAC6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGnF,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,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAArGC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASf,IAAIgB,UAAU,CAACd;IAC7B,IAAMS,KAAIV,UAAAA,IAAAA,gBAAM,EAACY,OAAOF,CAAC,EAAwBX,IAAIgB,UAAU,eAArDf,qBAAAA,UAA0DH;IACpE,IAAMmB,SAASC,IAAAA,qBAAW,EAACL;IAC3B,OAAOM,IAAAA,gBAAM,EAACnB,KAAKa,OAAOO,MAAM,EAAwB,SAAOC,IAAIC;;gBAC3DC;;;;wBAAAA,YAAYC,IAAAA,iBAAO,EAACX;wBACf;;4BAAMY,IAAAA,qBAAY,EAACJ,IAAIC,KAAKP,SAASQ,WAAWZ;;;wBAA3De,mBAAS;4BAAE;4BAA8DT;;;;;;;QAC3E;;AACF;IACA,WAAelB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { relatedNotes } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, 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, ...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 return withDb(ctx, values.config as string | undefined, async (db, cfg) => {\n const overrides = scopeOf(values);\n printRows((await relatedNotes(db, 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","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","rowFormatOf","withDb","config","db","cfg","overrides","scopeOf","relatedNotes","printRows"],"mappings":";;;;+BAqBA;;;eAAA;;;uBArB6B;wBAEH;wBACJ;wBAC6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGnF,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,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAArGC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASf,IAAIgB,UAAU,CAACd;IAC7B,IAAMS,KAAIV,UAAAA,IAAAA,gBAAM,EAACY,OAAOF,CAAC,EAAwBX,IAAIgB,UAAU,eAArDf,qBAAAA,UAA0DH;IACpE,IAAMmB,SAASC,IAAAA,qBAAW,EAACL;IAC3B,OAAOM,IAAAA,gBAAM,EAACnB,KAAKa,OAAOO,MAAM,EAAwB,SAAOC,IAAIC;;gBAC3DC;;;;wBAAAA,YAAYC,IAAAA,iBAAO,EAACX;wBACf;;4BAAMY,IAAAA,qBAAY,EAACJ,IAAIC,KAAKP,SAASQ,WAAWZ;;;wBAA3De,mBAAS;4BAAE;4BAA8DT;;;;;;;QAC3E;;AACF;IACA,WAAelB"}
@@ -28,11 +28,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
28
28
  reject(error);
29
29
  return;
30
30
  }
31
- if (info.done) {
32
- resolve(value);
33
- } else {
34
- Promise.resolve(value).then(_next, _throw);
35
- }
31
+ if (info.done) resolve(value);
32
+ else Promise.resolve(value).then(_next, _throw);
36
33
  }
37
34
  function _async_to_generator(fn) {
38
35
  return function() {
@@ -57,9 +54,7 @@ function _define_property(obj, key, value) {
57
54
  configurable: true,
58
55
  writable: true
59
56
  });
60
- } else {
61
- obj[key] = value;
62
- }
57
+ } else obj[key] = value;
63
58
  return obj;
64
59
  }
65
60
  function _iterable_to_array_limit(arr, i) {
@@ -87,7 +82,7 @@ function _iterable_to_array_limit(arr, i) {
87
82
  return _arr;
88
83
  }
89
84
  function _non_iterable_rest() {
90
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
85
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
91
86
  }
92
87
  function _object_spread(target) {
93
88
  for(var i = 1; i < arguments.length; i++){
@@ -107,14 +102,6 @@ function _object_spread(target) {
107
102
  function _sliced_to_array(arr, i) {
108
103
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
109
104
  }
110
- function _unsupported_iterable_to_array(o, minLen) {
111
- if (!o) return;
112
- if (typeof o === "string") return _array_like_to_array(o, minLen);
113
- var n = Object.prototype.toString.call(o).slice(8, -1);
114
- if (n === "Object" && o.constructor) n = o.constructor.name;
115
- if (n === "Map" || n === "Set") return Array.from(n);
116
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
117
- }
118
105
  function _ts_generator(thisArg, body) {
119
106
  var f, y, t, _ = {
120
107
  label: 0,
@@ -214,6 +201,14 @@ function _ts_generator(thisArg, body) {
214
201
  };
215
202
  }
216
203
  }
204
+ function _unsupported_iterable_to_array(o, minLen) {
205
+ if (!o) return;
206
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
207
+ var n = Object.prototype.toString.call(o).slice(8, -1);
208
+ if (n === "Object" && o.constructor) n = o.constructor.name;
209
+ if (n === "Map" || n === "Set") return Array.from(n);
210
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
211
+ }
217
212
  var searchCmd = function searchCmd(ctx) {
218
213
  return _async_to_generator(function() {
219
214
  var usage, _parse, values, positionals, _positionals, terms, k, format;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/search.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, SEARCH_FLAGS, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst searchCmd: Command = async (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.search}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const [terms] = positionals;\n if (!terms) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError);\n const format = rowFormatOf(values);\n await withDb(ctx, values.config as string | undefined, async (db, cfg) => printRows(await search(db, cfg, terms, { k, ...scopeOf(values) }), format));\n};\nexport default searchCmd;\n"],"names":["searchCmd","ctx","usage","parse","values","positionals","terms","k","format","USAGE","name","search","argv","SEARCH_FLAGS","FORMAT","CONFIG","usageError","parseK","rowFormatOf","withDb","config","db","cfg","scopeOf","printRows"],"mappings":";;;;+BAeA;;;eAAA;;;uBAfuB;wBACG;wBACJ;wBACoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1F,IAAMA,YAAqB,mBAAOC;;YAC1BC,OAC0BC,QAAxBC,QAAQC,aACAA,cAATC,OAEDC,GACAC;;;;oBALAN,QAAQ,AAAC,UAAqBO,OAAZR,IAAIS,IAAI,EAAC,KAAgB,OAAbD,eAAK,CAACE,MAAM;oBAChBR,SAAAA,IAAAA,eAAK,EAACF,IAAIW,IAAI,EAAEV,OAAO,mBAAKW,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAAtFX,SAAwBD,OAAxBC,QAAQC,cAAgBF,OAAhBE;oBACAA,gCAAAA,iBAATC,QAASD;oBAChB,IAAI,CAACC,OAAOL,IAAIe,UAAU,CAACd;oBACrBK,IAAIU,IAAAA,gBAAM,EAACb,OAAOG,CAAC,EAAwBN,IAAIe,UAAU;oBACzDR,SAASU,IAAAA,qBAAW,EAACd;oBAC3B;;wBAAMe,IAAAA,gBAAM,EAAClB,KAAKG,OAAOgB,MAAM,EAAwB,SAAOC,IAAIC;;;;;4CAAkB;;gDAAMX,IAAAA,eAAM,EAACU,IAAIC,KAAKhB,OAAO;oDAAEC,GAAAA;mDAAMgB,IAAAA,iBAAO,EAACnB;;;;;gDAAvDoB,mBAAS;oDAAC;oDAAyDhB;;;;;;;;;oBAA7I;;;;;;IACF;;IACA,WAAeR"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/search.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, SEARCH_FLAGS, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst searchCmd: Command = async (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.search}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const [terms] = positionals;\n if (!terms) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError);\n const format = rowFormatOf(values);\n await withDb(ctx, values.config as string | undefined, async (db, cfg) => printRows(await search(db, cfg, terms, { k, ...scopeOf(values) }), format));\n};\nexport default searchCmd;\n"],"names":["searchCmd","ctx","usage","parse","values","positionals","terms","k","format","USAGE","name","search","argv","SEARCH_FLAGS","FORMAT","CONFIG","usageError","parseK","rowFormatOf","withDb","config","db","cfg","scopeOf","printRows"],"mappings":";;;;+BAeA;;;eAAA;;;uBAfuB;wBACG;wBACJ;wBACoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1F,IAAMA,YAAqB,mBAAOC;;YAC1BC,OAC0BC,QAAxBC,QAAQC,aACAA,cAATC,OAEDC,GACAC;;;;oBALAN,QAAQ,AAAC,UAAqBO,OAAZR,IAAIS,IAAI,EAAC,KAAgB,OAAbD,eAAK,CAACE,MAAM;oBAChBR,SAAAA,IAAAA,eAAK,EAACF,IAAIW,IAAI,EAAEV,OAAO,mBAAKW,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAAtFX,SAAwBD,OAAxBC,QAAQC,cAAgBF,OAAhBE;oBACAA,gCAAAA,iBAATC,QAASD;oBAChB,IAAI,CAACC,OAAOL,IAAIe,UAAU,CAACd;oBACrBK,IAAIU,IAAAA,gBAAM,EAACb,OAAOG,CAAC,EAAwBN,IAAIe,UAAU;oBACzDR,SAASU,IAAAA,qBAAW,EAACd;oBAC3B;;wBAAMe,IAAAA,gBAAM,EAAClB,KAAKG,OAAOgB,MAAM,EAAwB,SAAOC,IAAIC;;;;;4CAAkB;;gDAAMX,IAAAA,eAAM,EAACU,IAAIC,KAAKhB,OAAO;oDAAEC,GAAAA;mDAAMgB,IAAAA,iBAAO,EAACnB;;;;;gDAAvDoB,mBAAS;oDAAC;oDAAyDhB;;;;;;;;;oBAA7I;;;;;;IACF;;IACA,WAAeR"}
@@ -68,11 +68,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
68
68
  reject(error);
69
69
  return;
70
70
  }
71
- if (info.done) {
72
- resolve(value);
73
- } else {
74
- Promise.resolve(value).then(_next, _throw);
75
- }
71
+ if (info.done) resolve(value);
72
+ else Promise.resolve(value).then(_next, _throw);
76
73
  }
77
74
  function _async_to_generator(fn) {
78
75
  return function() {
@@ -97,16 +94,16 @@ function _define_property(obj, key, value) {
97
94
  configurable: true,
98
95
  writable: true
99
96
  });
100
- } else {
101
- obj[key] = value;
102
- }
97
+ } else obj[key] = value;
103
98
  return obj;
104
99
  }
105
100
  function _iterable_to_array(iter) {
106
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
101
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
102
+ return Array.from(iter);
103
+ }
107
104
  }
108
105
  function _non_iterable_spread() {
109
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
106
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
107
  }
111
108
  function _object_spread(target) {
112
109
  for(var i = 1; i < arguments.length; i++){
@@ -138,9 +135,8 @@ function ownKeys(object, enumerableOnly) {
138
135
  }
139
136
  function _object_spread_props(target, source) {
140
137
  source = source != null ? source : {};
141
- if (Object.getOwnPropertyDescriptors) {
142
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
143
- } else {
138
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
139
+ else {
144
140
  ownKeys(Object(source)).forEach(function(key) {
145
141
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
146
142
  });
@@ -150,14 +146,6 @@ function _object_spread_props(target, source) {
150
146
  function _to_consumable_array(arr) {
151
147
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
152
148
  }
153
- function _unsupported_iterable_to_array(o, minLen) {
154
- if (!o) return;
155
- if (typeof o === "string") return _array_like_to_array(o, minLen);
156
- var n = Object.prototype.toString.call(o).slice(8, -1);
157
- if (n === "Object" && o.constructor) n = o.constructor.name;
158
- if (n === "Map" || n === "Set") return Array.from(n);
159
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
160
- }
161
149
  function _ts_generator(thisArg, body) {
162
150
  var f, y, t, _ = {
163
151
  label: 0,
@@ -257,6 +245,14 @@ function _ts_generator(thisArg, body) {
257
245
  };
258
246
  }
259
247
  }
248
+ function _unsupported_iterable_to_array(o, minLen) {
249
+ if (!o) return;
250
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
251
+ var n = Object.prototype.toString.call(o).slice(8, -1);
252
+ if (n === "Object" && o.constructor) n = o.constructor.name;
253
+ if (n === "Map" || n === "Set") return Array.from(n);
254
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
255
+ }
260
256
  var FORMAT = {
261
257
  format: {
262
258
  type: 'string',
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util';\nimport { parseArgs } from 'node:util';\nimport { columnHint } from '../column-hint.ts';\nimport type { ResolvedConfig, SearchOverrides } from '../config/index.ts';\nimport { resolvePreset } from '../config/index.ts';\nimport type { OpenResult } from '../db/index.ts';\nimport { open } from '../db/index.ts';\nimport type { Row, RowFormat } from '../output.ts';\nimport { printRowStream } from '../output.ts';\nimport { searchError } from '../search-error.ts';\nimport type { Ctx } from './types.ts';\n\n// Spreadable option fragments -- one flag name keeps one meaning across every command's table.\nexport const FORMAT: ParseArgsOptionsConfig = { format: { type: 'string', default: 'table' } };\nexport const CONFIG: ParseArgsOptionsConfig = { config: { type: 'string' } };\n// The scope vocabulary every scoped command shares: named preset, ad hoc include/exclude\n// globs, a where SQL condition. search adds k on top.\nexport const SCOPE: ParseArgsOptionsConfig = {\n where: { type: 'string' },\n preset: { type: 'string' },\n include: { type: 'string', multiple: true },\n exclude: { type: 'string', multiple: true },\n // Widening, which no other flag can express: --include and --exclude each override their\n // own side of the preset, so neither can drop an exclusion the preset declares.\n 'no-exclude': { type: 'boolean', default: false },\n};\nexport const SEARCH_FLAGS: ParseArgsOptionsConfig = { ...SCOPE, k: { type: 'string' } };\n\ntype Values = Record<string, string | boolean | string[] | undefined>;\n\n// The SCOPE fragment's parsed values as the overrides every scoped command passes down. One\n// place to read them, so a new scope field is added to the fragment and here, not in each\n// command's call.\nexport function scopeOf(values: Values): SearchOverrides {\n return {\n preset: values.preset as string | undefined,\n include: values.include as string[] | undefined,\n exclude: values.exclude as string[] | undefined,\n where: values.where as string | undefined,\n noExclude: values['no-exclude'] === true,\n };\n}\n\n// An unrecognised value used to fall through to `table`, so a typo looked like it worked.\n// parseArgs is strict about flag names; this is the same strictness for the value.\nfunction pickFormat<T extends string>(values: Values, allowed: readonly T[]): T {\n const format = String(values.format);\n if ((allowed as readonly string[]).includes(format)) return format as T;\n console.error(`unknown --format \"${format}\"; expected ${allowed.join(', ')}`);\n process.exit(2);\n}\n\nexport function formatOf(values: Values): 'table' | 'json' {\n return pickFormat(values, ['table', 'json'] as const);\n}\n\n// csv is a row set rendered as rows; map, peek, status, and path render structures instead,\n// and take formatOf.\nexport function rowFormatOf(values: Values): RowFormat {\n return pickFormat(values, ['table', 'json', 'csv'] as const);\n}\n\n// Per-command parseArgs: strict (a foreign flag exits 2), and every table gets --help for free.\nexport function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): { values: Values; positionals: string[] } {\n let values: Values;\n let positionals: string[];\n try {\n ({ values, positionals } = parseArgs({\n args: argv,\n options: { ...options, help: { type: 'boolean', default: false, short: 'h' } },\n strict: true,\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage);\n process.exit(2);\n }\n if (values.help) {\n console.log(usage);\n process.exit(0);\n }\n return { values, positionals };\n}\n\n// --k must be a positive integer: SQLite reads a bound LIMIT of -1 as \"unlimited\" and 0 as\n// \"nothing\", and parseInt would silently truncate \"5.9\" -- all three are caller mistakes\n// worth a usage error, matching the config-level SavedSearch validation.\nexport function parseK(k: string | undefined, usageError: (message: string) => never): number | undefined {\n if (k === undefined) return undefined;\n const parsed = Number(k);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--k expects a positive integer, got \"${k}\"`);\n return parsed;\n}\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport async function withDb(ctx: Ctx, configPath: string | undefined, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void | Promise<void>): Promise<void> {\n const cfg = ctx.resolveConfig(configPath);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n await fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// `--preset` on SQL binds the scope rather than applying it: the statement joins `scope`\n// itself. Filtering behind the query's back is not available -- the obvious version, temp views\n// shadowing the base tables, cannot cover `content`, because FTS5 `MATCH` uses the table name\n// as a hidden column and a view has none. A flag that silently scoped three tables of four\n// would look scoped and not be.\nfunction bindScope(db: OpenResult['db'], cfg: ResolvedConfig, preset: string): void {\n const { name } = resolvePreset(cfg, preset); // unknown names throw, listing what is declared\n db.exec('DROP TABLE IF EXISTS temp.scope');\n db.exec('CREATE TEMP TABLE scope (\"path\" TEXT PRIMARY KEY)');\n db.prepare('INSERT INTO temp.scope (\"path\") SELECT \"path\" FROM preset_files WHERE preset = ?').run(name);\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: RowFormat, label: string, preset?: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n // Naming a preset and never joining it would return the whole index while reading as scoped,\n // which is the one hazard of binding rather than applying. Refuse instead.\n if (preset !== undefined && !/\\bscope\\b/i.test(sql)) {\n console.error(`--preset binds a temporary \"scope\" table of the preset's paths, and ${label} never joins it, so the preset would have no effect`);\n console.error(`add: JOIN scope ON scope.\"path\" = <table>.\"path\"`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n if (preset !== undefined) bindScope(db, cfg, preset);\n // Streamed rather than collected: `sql` is the one caller whose result size is the\n // statement's business, not this package's, so the rows are never held here in bulk.\n // columns() reads the statement's own metadata, so a 0-row csv still has its header.\n // A mid-stream SQLite error (e.g. SQLITE_BUSY outlasting busy_timeout) can still leave\n // partial output; the nonzero exit code is the caller's signal, output completeness is not\n // guaranteed on failure.\n try {\n const statement = db.prepare(sql);\n statement.setReadBigInts(true); // int64 past 2^53 arrives as BigInt instead of throwing at step time\n const columns = statement.columns().map((c) => c.name);\n printRowStream(statement.iterate(...params) as Iterable<Row>, format, columns);\n } catch (err) {\n const hinted = columnHint(db, err as Error); // pragma needs the db still open\n db.close();\n // A saved query or ad-hoc SQL can carry `content MATCH ?` too, so the same FTS5\n // punctuation trap applies -- the bound parameters are the search terms there. SQL\n // without MATCH gets its error verbatim; search advice on a plain typo would mislead.\n if (/\\bMATCH\\b/i.test(sql)) throw searchError(hinted, params.join(' '));\n throw hinted;\n }\n db.close();\n}\n"],"names":["CONFIG","FORMAT","SCOPE","SEARCH_FLAGS","formatOf","parse","parseK","printWarnings","rowFormatOf","runSql","scopeOf","withDb","format","type","default","config","where","preset","include","multiple","exclude","k","values","noExclude","pickFormat","allowed","String","includes","console","error","join","process","exit","argv","usage","options","positionals","parseArgs","args","help","short","strict","allowPositionals","err","message","log","usageError","undefined","parsed","Number","isInteger","warnings","w","warn","ctx","configPath","fn","cfg","open","db","resolveConfig","close","bindScope","name","resolvePreset","exec","prepare","run","sql","params","label","placeholderCount","match","length","test","statement","setReadBigInts","columns","map","c","printRowStream","iterate","hinted","columnHint","searchError"],"mappings":";;;;;;;;;;;QAcaA;eAAAA;;QADAC;eAAAA;;QAIAC;eAAAA;;QASAC;eAAAA;;QA0BGC;eAAAA;;QAWAC;eAAAA;;QAyBAC;eAAAA;;QASAC;eAAAA;;QAvCAC;eAAAA;;QAmEAC;eAAAA;;QA5FAC;eAAAA;;QAoEMC;eAAAA;;;wBApGI;4BACC;uBAEG;wBAET;wBAEU;6BACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIrB,IAAMV,SAAiC;IAAEW,QAAQ;QAAEC,MAAM;QAAUC,SAAS;IAAQ;AAAE;AACtF,IAAMd,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;;QACrDiB,IAAAA,wBAAc,EAACL,CAAAA,aAAAA,WAAUM,OAAO,OAAjBN,YAAkB,qBAAGN,UAA0BzD,QAAQiE;IACxE,EAAE,OAAOlC,KAAK;QACZ,IAAMuC,SAASC,IAAAA,wBAAU,EAACxB,IAAIhB,MAAe,iCAAiC;QAC9EgB,GAAGE,KAAK;QACR,gFAAgF;QAChF,mFAAmF;QACnF,sFAAsF;QACtF,IAAI,aAAaa,IAAI,CAACN,MAAM,MAAMgB,IAAAA,0BAAW,EAACF,QAAQb,OAAOvC,IAAI,CAAC;QAClE,MAAMoD;IACR;IACAvB,GAAGE,KAAK;AACV"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util';\nimport { parseArgs } from 'node:util';\nimport { columnHint } from '../column-hint.ts';\nimport type { ResolvedConfig, SearchOverrides } from '../config/index.ts';\nimport { resolvePreset } from '../config/index.ts';\nimport type { OpenResult } from '../db/index.ts';\nimport { open } from '../db/index.ts';\nimport type { Row, RowFormat } from '../output.ts';\nimport { printRowStream } from '../output.ts';\nimport { searchError } from '../search-error.ts';\nimport type { Ctx } from './types.ts';\n\n// Spreadable option fragments -- one flag name keeps one meaning across every command's table.\nexport const FORMAT: ParseArgsOptionsConfig = { format: { type: 'string', default: 'table' } };\nexport const CONFIG: ParseArgsOptionsConfig = { config: { type: 'string' } };\n// The scope vocabulary every scoped command shares: named preset, ad hoc include/exclude\n// globs, a where SQL condition. search adds k on top.\nexport const SCOPE: ParseArgsOptionsConfig = {\n where: { type: 'string' },\n preset: { type: 'string' },\n include: { type: 'string', multiple: true },\n exclude: { type: 'string', multiple: true },\n // Widening, which no other flag can express: --include and --exclude each override their\n // own side of the preset, so neither can drop an exclusion the preset declares.\n 'no-exclude': { type: 'boolean', default: false },\n};\nexport const SEARCH_FLAGS: ParseArgsOptionsConfig = { ...SCOPE, k: { type: 'string' } };\n\ntype Values = Record<string, string | boolean | string[] | undefined>;\n\n// The SCOPE fragment's parsed values as the overrides every scoped command passes down. One\n// place to read them, so a new scope field is added to the fragment and here, not in each\n// command's call.\nexport function scopeOf(values: Values): SearchOverrides {\n return {\n preset: values.preset as string | undefined,\n include: values.include as string[] | undefined,\n exclude: values.exclude as string[] | undefined,\n where: values.where as string | undefined,\n noExclude: values['no-exclude'] === true,\n };\n}\n\n// An unrecognised value used to fall through to `table`, so a typo looked like it worked.\n// parseArgs is strict about flag names; this is the same strictness for the value.\nfunction pickFormat<T extends string>(values: Values, allowed: readonly T[]): T {\n const format = String(values.format);\n if ((allowed as readonly string[]).includes(format)) return format as T;\n console.error(`unknown --format \"${format}\"; expected ${allowed.join(', ')}`);\n process.exit(2);\n}\n\nexport function formatOf(values: Values): 'table' | 'json' {\n return pickFormat(values, ['table', 'json'] as const);\n}\n\n// csv is a row set rendered as rows; map, peek, status, and path render structures instead,\n// and take formatOf.\nexport function rowFormatOf(values: Values): RowFormat {\n return pickFormat(values, ['table', 'json', 'csv'] as const);\n}\n\n// Per-command parseArgs: strict (a foreign flag exits 2), and every table gets --help for free.\nexport function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): { values: Values; positionals: string[] } {\n let values: Values;\n let positionals: string[];\n try {\n ({ values, positionals } = parseArgs({\n args: argv,\n options: { ...options, help: { type: 'boolean', default: false, short: 'h' } },\n strict: true,\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage);\n process.exit(2);\n }\n if (values.help) {\n console.log(usage);\n process.exit(0);\n }\n return { values, positionals };\n}\n\n// --k must be a positive integer: SQLite reads a bound LIMIT of -1 as \"unlimited\" and 0 as\n// \"nothing\", and parseInt would silently truncate \"5.9\" -- all three are caller mistakes\n// worth a usage error, matching the config-level SavedSearch validation.\nexport function parseK(k: string | undefined, usageError: (message: string) => never): number | undefined {\n if (k === undefined) return undefined;\n const parsed = Number(k);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--k expects a positive integer, got \"${k}\"`);\n return parsed;\n}\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport async function withDb(ctx: Ctx, configPath: string | undefined, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void | Promise<void>): Promise<void> {\n const cfg = ctx.resolveConfig(configPath);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n await fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// `--preset` on SQL binds the scope rather than applying it: the statement joins `scope`\n// itself. Filtering behind the query's back is not available -- the obvious version, temp views\n// shadowing the base tables, cannot cover `content`, because FTS5 `MATCH` uses the table name\n// as a hidden column and a view has none. A flag that silently scoped three tables of four\n// would look scoped and not be.\nfunction bindScope(db: OpenResult['db'], cfg: ResolvedConfig, preset: string): void {\n const { name } = resolvePreset(cfg, preset); // unknown names throw, listing what is declared\n db.exec('DROP TABLE IF EXISTS temp.scope');\n db.exec('CREATE TEMP TABLE scope (\"path\" TEXT PRIMARY KEY)');\n db.prepare('INSERT INTO temp.scope (\"path\") SELECT \"path\" FROM preset_files WHERE preset = ?').run(name);\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: RowFormat, label: string, preset?: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n // Naming a preset and never joining it would return the whole index while reading as scoped,\n // which is the one hazard of binding rather than applying. Refuse instead.\n if (preset !== undefined && !/\\bscope\\b/i.test(sql)) {\n console.error(`--preset binds a temporary \"scope\" table of the preset's paths, and ${label} never joins it, so the preset would have no effect`);\n console.error(`add: JOIN scope ON scope.\"path\" = <table>.\"path\"`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n if (preset !== undefined) bindScope(db, cfg, preset);\n // Streamed rather than collected: `sql` is the one caller whose result size is the\n // statement's business, not this package's, so the rows are never held here in bulk.\n // columns() reads the statement's own metadata, so a 0-row csv still has its header.\n // A mid-stream SQLite error (e.g. SQLITE_BUSY outlasting busy_timeout) can still leave\n // partial output; the nonzero exit code is the caller's signal, output completeness is not\n // guaranteed on failure.\n try {\n const statement = db.prepare(sql);\n statement.setReadBigInts(true); // int64 past 2^53 arrives as BigInt instead of throwing at step time\n const columns = statement.columns().map((c) => c.name);\n printRowStream(statement.iterate(...params) as Iterable<Row>, format, columns);\n } catch (err) {\n const hinted = columnHint(db, err as Error); // pragma needs the db still open\n db.close();\n // A saved query or ad-hoc SQL can carry `content MATCH ?` too, so the same FTS5\n // punctuation trap applies -- the bound parameters are the search terms there. SQL\n // without MATCH gets its error verbatim; search advice on a plain typo would mislead.\n if (/\\bMATCH\\b/i.test(sql)) throw searchError(hinted, params.join(' '));\n throw hinted;\n }\n db.close();\n}\n"],"names":["CONFIG","FORMAT","SCOPE","SEARCH_FLAGS","formatOf","parse","parseK","printWarnings","rowFormatOf","runSql","scopeOf","withDb","format","type","default","config","where","preset","include","multiple","exclude","k","values","noExclude","pickFormat","allowed","String","includes","console","error","join","process","exit","argv","usage","options","positionals","parseArgs","args","help","short","strict","allowPositionals","err","message","log","usageError","undefined","parsed","Number","isInteger","warnings","w","warn","ctx","configPath","fn","cfg","open","db","resolveConfig","close","bindScope","name","resolvePreset","exec","prepare","run","sql","params","label","placeholderCount","match","length","test","statement","setReadBigInts","columns","map","c","printRowStream","iterate","hinted","columnHint","searchError"],"mappings":";;;;;;;;;;;QAcaA;eAAAA;;QADAC;eAAAA;;QAIAC;eAAAA;;QASAC;eAAAA;;QA0BGC;eAAAA;;QAWAC;eAAAA;;QAyBAC;eAAAA;;QASAC;eAAAA;;QAvCAC;eAAAA;;QAmEAC;eAAAA;;QA5FAC;eAAAA;;QAoEMC;eAAAA;;;wBApGI;4BACC;uBAEG;wBAET;wBAEU;6BACH;;;;;;;;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