sensemaking 0.17.0 → 0.17.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 (47) hide show
  1. package/dist/cjs/cli/map.js +4 -4
  2. package/dist/cjs/cli/map.js.map +1 -1
  3. package/dist/cjs/cli/named.js +2 -2
  4. package/dist/cjs/cli/named.js.map +1 -1
  5. package/dist/cjs/cli/path.js +7 -6
  6. package/dist/cjs/cli/path.js.map +1 -1
  7. package/dist/cjs/cli/peek.js +4 -4
  8. package/dist/cjs/cli/peek.js.map +1 -1
  9. package/dist/cjs/cli/related.js +4 -4
  10. package/dist/cjs/cli/related.js.map +1 -1
  11. package/dist/cjs/cli/search.js +4 -4
  12. package/dist/cjs/cli/search.js.map +1 -1
  13. package/dist/cjs/cli/status.js +18 -18
  14. package/dist/cjs/cli/status.js.map +1 -1
  15. package/dist/cjs/embed/distribution.d.cts +4 -0
  16. package/dist/cjs/embed/distribution.d.ts +4 -0
  17. package/dist/cjs/embed/distribution.js +30 -0
  18. package/dist/cjs/embed/distribution.js.map +1 -0
  19. package/dist/cjs/embed/langfit.d.cts +0 -3
  20. package/dist/cjs/embed/langfit.d.ts +0 -3
  21. package/dist/cjs/embed/langfit.js +21 -24
  22. package/dist/cjs/embed/langfit.js.map +1 -1
  23. package/dist/cjs/embed/static.js +13 -3
  24. package/dist/cjs/embed/static.js.map +1 -1
  25. package/dist/esm/cli/map.js +1 -1
  26. package/dist/esm/cli/map.js.map +1 -1
  27. package/dist/esm/cli/named.js +1 -1
  28. package/dist/esm/cli/named.js.map +1 -1
  29. package/dist/esm/cli/path.js +2 -1
  30. package/dist/esm/cli/path.js.map +1 -1
  31. package/dist/esm/cli/peek.js +1 -1
  32. package/dist/esm/cli/peek.js.map +1 -1
  33. package/dist/esm/cli/related.js +1 -1
  34. package/dist/esm/cli/related.js.map +1 -1
  35. package/dist/esm/cli/search.js +1 -1
  36. package/dist/esm/cli/search.js.map +1 -1
  37. package/dist/esm/cli/status.js +2 -2
  38. package/dist/esm/cli/status.js.map +1 -1
  39. package/dist/esm/embed/distribution.d.ts +4 -0
  40. package/dist/esm/embed/distribution.js +11 -0
  41. package/dist/esm/embed/distribution.js.map +1 -0
  42. package/dist/esm/embed/langfit.d.ts +0 -3
  43. package/dist/esm/embed/langfit.js +10 -10
  44. package/dist/esm/embed/langfit.js.map +1 -1
  45. package/dist/esm/embed/static.js +6 -1
  46. package/dist/esm/embed/static.js.map +1 -1
  47. package/package.json +1 -1
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _indexts = require("../commands/index.js");
11
+ var _mapts = require("../commands/map.js");
12
12
  var _outputts = require("../output/output.js");
13
- var _indexts1 = require("./index.js");
13
+ var _indexts = require("./index.js");
14
14
  var _sharedts = require("./shared.js");
15
15
  function _define_property(obj, key, value) {
16
16
  if (key in obj) {
@@ -39,10 +39,10 @@ function _object_spread(target) {
39
39
  return target;
40
40
  }
41
41
  var map = function map(ctx) {
42
- var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.map), _object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG)).values;
42
+ var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.map), _object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG)).values;
43
43
  var format = (0, _sharedts.formatOf)(values);
44
44
  return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
45
- var result = (0, _indexts.mapTree)(db, cfg, (0, _sharedts.scopeOf)(values));
45
+ var result = (0, _mapts.mapTree)(db, cfg, (0, _sharedts.scopeOf)(values));
46
46
  console.log(format === 'json' ? JSON.stringify(result, null, 2) : (0, _outputts.renderMap)(result));
47
47
  });
48
48
  };
@@ -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/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/map.ts';\nimport { renderMap } from '../output/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;;;qBAdwB;wBACE;uBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,MAAe,aAACC;IACpB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAa,OAAVD,cAAK,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,cAAO,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"}
@@ -10,7 +10,7 @@ Object.defineProperty(exports, // Fallback when the first positional is not a co
10
10
  return named;
11
11
  }
12
12
  });
13
- var _indexts = require("../commands/index.js");
13
+ var _searchts = require("../commands/search.js");
14
14
  var _outputts = require("../output/output.js");
15
15
  var _sharedts = require("./shared.js");
16
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -208,7 +208,7 @@ function named(ctx, queryName) {
208
208
  case 0:
209
209
  return [
210
210
  4,
211
- (0, _indexts.search)(db, resolvedCfg, entry.search, {
211
+ (0, _searchts.search)(db, resolvedCfg, entry.search, {
212
212
  k: k,
213
213
  where: where,
214
214
  preset: preset,
@@ -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/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;AACvF;;;eAA8BA;;;uBAPP;wBACG;wBAC+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1E,SAAeA,MAAMC,GAAQ,EAAEC,SAAiB;;YAyBnDC,SACKC,eACCA,gBACCA,iBACAA,iBA5BXC,OACkCC,QAAhCF,QAAqBG,QACvBC,QACAC,YAEAC,KACAC,OAkBAC,GACAC,OACAC,QACAC,SACAC,SACAC;;;;oBA7BAZ,QAAQ,AAAC,UAAqBH,OAAZD,IAAIiB,IAAI,EAAC,KAAa,OAAVhB,WAAU;oBACNI,SAAAA,IAAAA,eAAK,EAACL,IAAIkB,IAAI,EAAEd,OAAO,mBAAKe,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAA9FlB,SAAgCE,OAAhCF,QAA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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/search.ts';\nimport { printRows } from '../output/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;AACvF;;;eAA8BA;;;wBAPP;wBACG;wBAC+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1E,SAAeA,MAAMC,GAAQ,EAAEC,SAAiB;;YAyBnDC,SACKC,eACCA,gBACCA,iBACAA,iBA5BXC,OACkCC,QAAhCF,QAAqBG,QACvBC,QACAC,YAEAC,KACAC,OAkBAC,GACAC,OACAC,QACAC,SACAC,SACAC;;;;oBA7BAZ,QAAQ,AAAC,UAAqBH,OAAZD,IAAIiB,IAAI,EAAC,KAAa,OAAVhB,WAAU;oBACNI,SAAAA,IAAAA,eAAK,EAACL,IAAIkB,IAAI,EAAEd,OAAO,mBAAKe,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAA9FlB,SAAgCE,OAAhC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KAAK;oBAC3C;;wBAAMqC,IAAAA,gBAAM,EAACxC,KAAKQ,YAAY,SAAOiC,IAAIC;;;;;4CAA0B;;gDAAMC,IAAAA,gBAAM,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"}
@@ -8,10 +8,11 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _indexts = require("../commands/index.js");
11
+ var _peekts = require("../commands/peek.js");
12
+ var _scopets = require("../commands/scope.js");
12
13
  var _traversets = require("../graph/traverse.js");
13
14
  var _outputts = require("../output/output.js");
14
- var _indexts1 = require("./index.js");
15
+ var _indexts = require("./index.js");
15
16
  var _sharedts = require("./shared.js");
16
17
  function _array_like_to_array(arr, len) {
17
18
  if (len == null || len > arr.length) len = arr.length;
@@ -116,7 +117,7 @@ function parseMaxDepth(depth, usageError) {
116
117
  return parsed;
117
118
  }
118
119
  var pathCmd = function pathCmd(ctx) {
119
- var usage = "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.path);
120
+ var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.path);
120
121
  var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread_props(_object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG), {
121
122
  'max-depth': {
122
123
  type: 'string'
@@ -130,9 +131,9 @@ var pathCmd = function pathCmd(ctx) {
130
131
  var paths = db.prepare('SELECT "path" FROM frontmatter').all().map(function(r) {
131
132
  return r.path;
132
133
  });
133
- var from = (0, _indexts.resolveNote)(paths, a);
134
- var to = (0, _indexts.resolveNote)(paths, b);
135
- var allowed = (0, _indexts.scopedPaths)(db, cfg, (0, _sharedts.scopeOf)(values));
134
+ var from = (0, _peekts.resolveNote)(paths, a);
135
+ var to = (0, _peekts.resolveNote)(paths, b);
136
+ var allowed = (0, _scopets.scopedPaths)(db, cfg, (0, _sharedts.scopeOf)(values));
136
137
  var hops = (0, _traversets.findPath)(db, from, to, {
137
138
  maxDepth: maxDepth,
138
139
  allowed: allowed
@@ -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 { findPath } from '../graph/traverse.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/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\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;0BAChB;wBAEC;wBACJ;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,wCAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM;QAAE,aAAa;YAAEC,MAAM;QAAS;SAA/GC,SAAwBN,OAAxBM,QAAQC,cAAgBP,OAAhBO;IAChB,IAAeA,gCAAAA,iBAARC,IAAQD,iBAALE,IAAKF;IACf,IAAI,CAACC,KAAK,CAACC,GAAGd,IAAIN,UAAU,CAACO;IAC7B,IAAMc,WAAWvB,cAAcmB,MAAM,CAAC,YAAY,EAAwBX,IAAIN,UAAU;IACxF,IAAMsB,SAASC,IAAAA,kBAAQ,EAACN;IACxB,OAAOO,IAAAA,gBAAM,EAAClB,KAAKW,OAAOQ,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,QAAQ,AAACF,GAAGG,OAAO,CAAC,kCAAkCC,GAAG,GAA+BC,GAAG,CAAC,SAACC;mBAAMA,EAAEtB,IAAI;;QAC/G,IAAMuB,OAAOC,IAAAA,oBAAW,EAACN,OAAOT;QAChC,IAAMgB,KAAKD,IAAAA,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"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { resolveNote } from '../commands/peek.ts';\nimport { scopedPaths } from '../commands/scope.ts';\nimport { findPath } from '../graph/traverse.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/output.ts';\nimport { 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":";;;;+BA2CA;;;eAAA;;;sBA3C4B;uBACA;0BACH;wBAEC;uBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,wEAAwE;AACxE,SAASA,cAAcC,KAAyB,EAAEC,UAAsC;IACtF,IAAID,UAAUE,WA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;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"}
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _indexts = require("../commands/index.js");
11
+ var _peekts = require("../commands/peek.js");
12
12
  var _outputts = require("../output/output.js");
13
- var _indexts1 = require("./index.js");
13
+ var _indexts = require("./index.js");
14
14
  var _sharedts = require("./shared.js");
15
15
  function _array_like_to_array(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
@@ -85,14 +85,14 @@ function _unsupported_iterable_to_array(o, minLen) {
85
85
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
86
86
  }
87
87
  var peekCmd = function peekCmd(ctx) {
88
- var usage = "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.peek);
88
+ var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.peek);
89
89
  var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, positionals = _parse.positionals;
90
90
  var _positionals = _sliced_to_array(positionals, 1), pathArg = _positionals[0];
91
91
  if (!pathArg) ctx.usageError(usage);
92
92
  var format = (0, _sharedts.formatOf)(values);
93
93
  return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
94
94
  var overrides = (0, _sharedts.scopeOf)(values);
95
- var result = (0, _indexts.peek)(db, cfg, pathArg, overrides);
95
+ var result = (0, _peekts.peek)(db, cfg, pathArg, overrides);
96
96
  console.log(format === 'json' ? JSON.stringify(result, null, 2) : (0, _outputts.renderPeek)(result));
97
97
  });
98
98
  };
@@ -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/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/peek.ts';\nimport { renderPeek } from '../output/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;;;sBAlBqB;wBACM;uBACL;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,cAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,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,YAAI,EAACc,IAAIC,KAAKP,SAASQ;QACtCG,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACJ,QAAQ,MAAM,KAAKK,IAAAA,oBAAU,EAACL;IAC/E;AACF;IACA,WAAevB"}
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _indexts = require("../commands/index.js");
11
+ var _relatedts = require("../commands/related.js");
12
12
  var _outputts = require("../output/output.js");
13
- var _indexts1 = require("./index.js");
13
+ var _indexts = require("./index.js");
14
14
  var _sharedts = require("./shared.js");
15
15
  function _array_like_to_array(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
@@ -235,7 +235,7 @@ function _unsupported_iterable_to_array(o, minLen) {
235
235
  var RELATED_DEFAULT_K = 5;
236
236
  var relatedCmd = function relatedCmd(ctx) {
237
237
  var _parseK;
238
- var usage = "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.related);
238
+ var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.related);
239
239
  var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread_props(_object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG), {
240
240
  k: {
241
241
  type: 'string'
@@ -254,7 +254,7 @@ var relatedCmd = function relatedCmd(ctx) {
254
254
  overrides = (0, _sharedts.scopeOf)(values);
255
255
  return [
256
256
  4,
257
- (0, _indexts.relatedNotes)(db, cfg, pathArg, overrides, k)
257
+ (0, _relatedts.relatedNotes)(db, cfg, pathArg, overrides, k)
258
258
  ];
259
259
  case 1:
260
260
  _outputts.printRows.apply(void 0, [
@@ -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/output.ts';\nimport { printRows } from '../output/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/related.ts';\nimport type { Row } from '../output/output.ts';\nimport { printRows } from '../output/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;;;yBArB6B;wBAEH;uBACJ;wBAC6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGnF,IAAMA,oBAAoB;AAE1B,IAAMC,aAAsB,oBAACC;QAKjBC;IAJV,IAAMC,QAAQ,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAiB,OAAdD,cAAK,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,uBAAY,EAACJ,IAAIC,KAAKP,SAASQ,WAAWZ;;;wBAA3De,mBAAS;4BAAE;4BAA8DT;;;;;;;QAC3E;;AACF;IACA,WAAelB"}
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
8
8
  return _default;
9
9
  }
10
10
  });
11
- var _indexts = require("../commands/index.js");
11
+ var _searchts = require("../commands/search.js");
12
12
  var _outputts = require("../output/output.js");
13
- var _indexts1 = require("./index.js");
13
+ var _indexts = require("./index.js");
14
14
  var _sharedts = require("./shared.js");
15
15
  function _array_like_to_array(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
@@ -215,7 +215,7 @@ var searchCmd = function searchCmd(ctx) {
215
215
  return _ts_generator(this, function(_state) {
216
216
  switch(_state.label){
217
217
  case 0:
218
- usage = "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.search);
218
+ usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.search);
219
219
  _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.SEARCH_FLAGS, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, positionals = _parse.positionals;
220
220
  _positionals = _sliced_to_array(positionals, 1), terms = _positionals[0];
221
221
  if (!terms) ctx.usageError(usage);
@@ -230,7 +230,7 @@ var searchCmd = function searchCmd(ctx) {
230
230
  case 0:
231
231
  return [
232
232
  4,
233
- (0, _indexts.search)(db, cfg, terms, _object_spread({
233
+ (0, _searchts.search)(db, cfg, terms, _object_spread({
234
234
  k: k
235
235
  }, (0, _sharedts.scopeOf)(values)))
236
236
  ];
@@ -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/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/search.ts';\nimport { printRows } from '../output/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;;;wBAfuB;wBACG;uBACJ;wBACoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1F,IAAMA,YAAqB,mBAAOC;;YAC1BC,OAC0BC,QAAxBC,QAAQC,aACAA,cAATC,OAEDC,GACAC;;;;oBALAN,QAAQ,AAAC,UAAqBO,OAAZR,IAAIS,IAAI,EAAC,KAAgB,OAAbD,cAAK,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,gBAAM,EAACU,IAAIC,KAAKhB,OAAO;oDAAEC,GAAAA;mDAAMgB,IAAAA,iBAAO,EAACnB;;;;;gDAAvDoB,mBAAS;oDAAC;oDAAyDhB;;;;;;;;;oBAA7I;;;;;;IACF;;IACA,WAAeR"}
@@ -17,14 +17,14 @@ _export(exports, {
17
17
  }
18
18
  });
19
19
  var _nodepath = require("node:path");
20
- var _indexts = require("../commands/index.js");
21
- var _indexts1 = require("../config/index.js");
22
- var _indexts2 = require("../db/index.js");
20
+ var _statusts = require("../commands/status.js");
21
+ var _indexts = require("../config/index.js");
22
+ var _indexts1 = require("../db/index.js");
23
+ var _distributionts = require("../embed/distribution.js");
23
24
  var _httpts = require("../embed/http.js");
24
- var _langfitts = require("../embed/langfit.js");
25
25
  var _storets = require("../embed/store.js");
26
26
  var _outputts = require("../output/output.js");
27
- var _indexts3 = require("./index.js");
27
+ var _indexts2 = require("./index.js");
28
28
  var _sharedts = require("./shared.js");
29
29
  function _array_like_to_array(arr, len) {
30
30
  if (len == null || len > arr.length) len = arr.length;
@@ -277,13 +277,13 @@ var status = function status(ctx) {
277
277
  return _ts_generator(this, function(_state) {
278
278
  switch(_state.label){
279
279
  case 0:
280
- values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts3.USAGE.status), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
280
+ values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts2.USAGE.status), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
281
281
  format = (0, _sharedts.formatOf)(values);
282
282
  cfg = ctx.resolveConfig(values.config);
283
- _open = (0, _indexts2.open)(cfg), db = _open.db, dbPath = _open.dbPath, warnings = _open.warnings;
283
+ _open = (0, _indexts1.open)(cfg), db = _open.db, dbPath = _open.dbPath, warnings = _open.warnings;
284
284
  (0, _sharedts.printWarnings)(warnings);
285
- features = (0, _indexts1.featureStates)(cfg);
286
- e = (0, _indexts1.embedConfig)(cfg);
285
+ features = (0, _indexts.featureStates)(cfg);
286
+ e = (0, _indexts.embedConfig)(cfg);
287
287
  hasModel = e ? (0, _storets.modelPresent)(cfg) : false;
288
288
  if (!e) return [
289
289
  3,
@@ -305,11 +305,11 @@ var status = function status(ctx) {
305
305
  case 3:
306
306
  reachable = _tmp;
307
307
  vectors = e ? vectorState(db) : null;
308
- presets = (0, _indexts.presetCoverage)(db, cfg);
308
+ presets = (0, _statusts.presetCoverage)(db, cfg);
309
309
  staticLanguages = e && e.provider === 'static' ? (0, _storets.readLanguages)(e.model) : undefined;
310
310
  declaredLanguages = staticLanguages && staticLanguages.length > 0 ? staticLanguages : null;
311
- detectedLanguages = (_languageDistribution = (0, _langfitts.languageDistribution)(db)) !== null && _languageDistribution !== void 0 ? _languageDistribution : null;
312
- heartbeat = (0, _indexts2.getMeta)(db, 'watch_heartbeat');
311
+ detectedLanguages = (_languageDistribution = (0, _distributionts.languageDistribution)(db)) !== null && _languageDistribution !== void 0 ? _languageDistribution : null;
312
+ heartbeat = (0, _indexts1.getMeta)(db, 'watch_heartbeat');
313
313
  // Derived at open() (F): 3x the largest reconcile this cache has ever held its write
314
314
  // transaction for, floored at 30s -- read back from the connection rather than
315
315
  // recomputed here, so this always reports what open() actually set.
@@ -321,14 +321,14 @@ var status = function status(ctx) {
321
321
  } : null;
322
322
  result = {
323
323
  config: cfg.configPath,
324
- configVersion: _indexts1.SUPPORTED_CONFIG_VERSION,
324
+ configVersion: _indexts.SUPPORTED_CONFIG_VERSION,
325
325
  migratedFrom: (_cfg_migratedFrom = cfg.migratedFrom) !== null && _cfg_migratedFrom !== void 0 ? _cfg_migratedFrom : null,
326
326
  unknownConfigKeys: (_cfg_unknownKeys = cfg.unknownKeys) !== null && _cfg_unknownKeys !== void 0 ? _cfg_unknownKeys : null,
327
327
  tree: cfg.baseDir,
328
328
  cache: (0, _nodepath.dirname)(dbPath),
329
329
  db: dbPath,
330
- cacheSchema: _indexts2.SCHEMA_VERSION,
331
- docs: (0, _indexts2.docCount)(db),
330
+ cacheSchema: _indexts1.SCHEMA_VERSION,
331
+ docs: (0, _indexts1.docCount)(db),
332
332
  unparseableFrontmatter: parseErrorCount(db),
333
333
  features: features.on,
334
334
  featuresOff: features.off,
@@ -345,7 +345,7 @@ var status = function status(ctx) {
345
345
  }, vectors !== null && vectors !== void 0 ? vectors : {}) : null,
346
346
  presets: presets,
347
347
  queries: Object.keys((_cfg_queries = cfg.queries) !== null && _cfg_queries !== void 0 ? _cfg_queries : {}).length,
348
- watcherPid: (0, _indexts2.getMeta)(db, 'watch_pid'),
348
+ watcherPid: (0, _indexts1.getMeta)(db, 'watch_pid'),
349
349
  watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,
350
350
  busyTimeoutMs: busyTimeoutMs
351
351
  };
@@ -353,11 +353,11 @@ var status = function status(ctx) {
353
353
  console.log(JSON.stringify(result, null, 2));
354
354
  } else {
355
355
  migrated = cfg.migratedFrom !== undefined ? ", migrated from v".concat(cfg.migratedFrom, " on this run") : '';
356
- console.log("config: ".concat(result.config, " (v").concat(_indexts1.SUPPORTED_CONFIG_VERSION).concat(migrated, ")"));
356
+ console.log("config: ".concat(result.config, " (v").concat(_indexts.SUPPORTED_CONFIG_VERSION).concat(migrated, ")"));
357
357
  // A load-time stderr warning has scrolled away by the time anyone looks here.
358
358
  if (cfg.unknownKeys) console.log(" unknown keys, ignored: ".concat(cfg.unknownKeys.join(', ')));
359
359
  console.log("tree: ".concat(result.tree));
360
- console.log("cache: ".concat(result.cache, " (schema ").concat(_indexts2.SCHEMA_VERSION, "; delete this directory to reset)"));
360
+ console.log("cache: ".concat(result.cache, " (schema ").concat(_indexts1.SCHEMA_VERSION, "; delete this directory to reset)"));
361
361
  console.log("docs: ".concat(result.docs).concat(result.unparseableFrontmatter > 0 ? " (".concat(result.unparseableFrontmatter, " with unparseable frontmatter: WHERE _parse_error IS NOT NULL)") : ''));
362
362
  console.log('');
363
363
  console.log((0, _outputts.featuresLine)(features));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { presetCoverage } from '../commands/index.ts';\nimport { embedConfig, featureStates, SUPPORTED_CONFIG_VERSION } from '../config/index.ts';\nimport { docCount, getMeta, open, SCHEMA_VERSION } from '../db/index.ts';\nimport { probeReachable } from '../embed/http.ts';\nimport { languageDistribution } from '../embed/langfit.ts';\nimport { isDownloadable, MODEL_FILENAMES, modelDir, modelPresent, readLanguages } from '../embed/store.ts';\nimport { featuresLine, presetsLines } from '../output/output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// status names what you cannot read off the config file: locations sense chose, values it\n// derived, state it stored. Config content is not echoed -- the config line says which file to\n// read, and duplicating its globs here would create two places that disagree after an edit.\n// The exception is the embed block's url and key, whose effect is remote and otherwise invisible.\n\n// Vectors are computed on the first semantic query, not at reconcile, so a tree can have a\n// semantic-on preset with nothing embedded yet -- reported here because a fast reconcile on\n// such a tree otherwise reads as \"the feature isn't on\".\nfunction vectorState(db: ReturnType<typeof open>['db']): { embedded: number; pending: number } | null {\n try {\n const row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get() as { embedded: number; pending: number };\n return row;\n } catch {\n return null;\n }\n}\n\nfunction parseErrorCount(db: ReturnType<typeof open>['db']): number {\n const row = db.prepare(`SELECT COUNT(*) AS n FROM frontmatter WHERE \"_parse_error\" IS NOT NULL`).get() as { n: number };\n return row.n;\n}\n\n// A URL can carry credentials in its userinfo (https://user:pass@host/v1). status output gets\n// pasted into issues and transcripts, so it is always safe to paste.\nexport function redactUrl(url: string): string {\n try {\n const parsed = new URL(url);\n if (!parsed.username && !parsed.password) return url;\n parsed.username = '';\n parsed.password = '';\n return `${parsed.toString().replace(/\\/$/, '')} (credentials redacted)`;\n } catch {\n return url;\n }\n}\n\n// A stopped Ollama/LM Studio/Cohere endpoint prints identically to a running one otherwise; any\n// HTTP response counts as reachable (probeReachable), so this only distinguishes up from down.\nasync function embedReachable(e: { provider: string; url?: string }): Promise<boolean | null> {\n if (e.provider === 'static' || (e.provider === 'openai' && !e.url)) return null;\n const base = (e.url ?? 'https://api.cohere.com').replace(/\\/+$/, '');\n return probeReachable(e.provider === 'openai' ? `${base}/models` : base);\n}\n\nconst status: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, dbPath, warnings } = open(cfg);\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const hasModel = e ? modelPresent(cfg) : false;\n const reachable = e ? await embedReachable(e) : null;\n const vectors = e ? vectorState(db) : null;\n const presets = presetCoverage(db, cfg);\n const staticLanguages = e && e.provider === 'static' ? readLanguages(e.model) : undefined;\n const declaredLanguages = staticLanguages && staticLanguages.length > 0 ? staticLanguages : null;\n const detectedLanguages = languageDistribution(db) ?? null;\n const heartbeat = getMeta(db, 'watch_heartbeat');\n // Derived at open() (F): 3x the largest reconcile this cache has ever held its write\n // transaction for, floored at 30s -- read back from the connection rather than\n // recomputed here, so this always reports what open() actually set.\n const busyTimeoutMs = (db.prepare('PRAGMA busy_timeout').get() as { timeout: number }).timeout;\n // The env var holds the token; only its name and whether it is set are ever reported.\n const keyEnv = e?.key ? { name: e.key, set: (process.env[e.key] ?? '') !== '' } : null;\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.baseDir,\n cache: dirname(dbPath),\n db: dbPath,\n cacheSchema: SCHEMA_VERSION,\n docs: docCount(db),\n unparseableFrontmatter: parseErrorCount(db),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { provider: e.provider, model: e.model, dir: e.provider === 'static' ? modelDir(e.model) : null, url: e.url ? redactUrl(e.url) : null, reachable, keyEnv, downloaded: hasModel, languages: declaredLanguages, detectedLanguages, ...(vectors ?? {}) } : null,\n presets,\n queries: Object.keys(cfg.queries ?? {}).length,\n watcherPid: getMeta(db, 'watch_pid'),\n watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,\n busyTimeoutMs,\n };\n\n if (format === 'json') {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migrated from v${cfg.migratedFrom} on this run` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n // A load-time stderr warning has scrolled away by the time anyone looks here.\n if (cfg.unknownKeys) console.log(` unknown keys, ignored: ${cfg.unknownKeys.join(', ')}`);\n console.log(`tree: ${result.tree}`);\n console.log(`cache: ${result.cache} (schema ${SCHEMA_VERSION}; delete this directory to reset)`);\n console.log(`docs: ${result.docs}${result.unparseableFrontmatter > 0 ? ` (${result.unparseableFrontmatter} with unparseable frontmatter: WHERE _parse_error IS NOT NULL)` : ''}`);\n console.log('');\n console.log(featuresLine(features));\n // One authoritative block, off states included: an absent model reads as a degraded search,\n // not as an empty corpus.\n if (!e) console.log('embed: off (no preset asks for vectors)');\n else {\n console.log(`embed: ${e.provider} ${e.model}`);\n if (e.provider === 'static') console.log(` model: ${modelDir(e.model)} (${hasModel ? 'present' : `missing, ${isDownloadable(e.model) ? `fetches automatically at first search, or run \\`${ctx.name} download\\` to prefetch` : `no ${MODEL_FILENAMES} in that directory`}`})`);\n if (declaredLanguages) console.log(` languages: ${declaredLanguages.join(', ')} (declared by the model card)`);\n // Cohere defaults to api.cohere.com with no url in the config; show it anyway so the\n // reachability probe below has something to name.\n if (e.url || reachable !== null) {\n const shown = e.url ? redactUrl(e.url) : 'https://api.cohere.com (default)';\n console.log(` url: ${shown}${reachable === null ? '' : reachable ? ' (reachable)' : ' (unreachable)'}`);\n }\n if (keyEnv) console.log(` key: env ${keyEnv.name} (${keyEnv.set ? 'set' : 'NOT SET'})`);\n if (!hasModel) console.log(' vectors: off until the model is present; search runs on words and links');\n else if (vectors) console.log(` vectors: ${vectors.embedded} embedded, ${vectors.pending} pending (embedded on the first semantic search)`);\n if (detectedLanguages) {\n const total = Object.values(detectedLanguages).reduce((a, b) => a + b, 0);\n const breakdown = Object.entries(detectedLanguages)\n .sort((a, b) => b[1] - a[1])\n .map(([code, n]) => `${code} ${Math.round((n / total) * 100)}%`)\n .join(', ');\n console.log(` detected: ${breakdown} (${total} chunks classified)`);\n }\n }\n console.log('');\n for (const line of presetsLines(presets)) console.log(line);\n console.log('');\n console.log(`queries: ${result.queries} saved (${ctx.name} --list)`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n console.log(`sqlite: busy_timeout ${result.busyTimeoutMs}ms (derived: 3x the largest reconcile this cache has recorded, floored at 30000ms)`);\n }\n db.close();\n};\nexport default status;\n"],"names":["redactUrl","vectorState","db","row","prepare","get","parseErrorCount","n","url","parsed","URL","username","password","toString","replace","embedReachable","e","base","provider","probeReachable","status","ctx","languageDistribution","process","cfg","values","format","open","dbPath","warnings","features","hasModel","reachable","vectors","presets","staticLanguages","declaredLanguages","detectedLanguages","heartbeat","busyTimeoutMs","keyEnv","result","migrated","shown","total","breakdown","line","pid","parse","argv","USAGE","name","FORMAT","CONFIG","formatOf","resolveConfig","config","printWarnings","featureStates","embedConfig","modelPresent","presetCoverage","readLanguages","model","undefined","length","getMeta","timeout","key","set","env","configPath","configVersion","SUPPORTED_CONFIG_VERSION","migratedFrom","unknownConfigKeys","unknownKeys","tree","baseDir","cache","dirname","cacheSchema","SCHEMA_VERSION","docs","docCount","unparseableFrontmatter","on","featuresOff","off","embed","dir","modelDir","downloaded","languages","queries","Object","keys","watcherPid","watcherHeartbeatSecondsAgo","Math","round","Date","now","console","log","JSON","stringify","join","featuresLine","isDownloadable","MODEL_FILENAMES","embedded","pending","reduce","a","b","entries","sort","map","code","presetsLines","close"],"mappings":";;;;;;;;;;;QAmJA;eAAA;;QA/GgBA;eAAAA;;;wBApCQ;uBACO;wBACsC;wBACb;sBACzB;yBACM;uBACkD;wBAC5C;wBACrB;wBACyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG/D,0FAA0F;AAC1F,+FAA+F;AAC/F,4FAA4F;AAC5F,kGAAkG;AAElG,2FAA2F;AAC3F,4FAA4F;AAC5F,yDAAyD;AACzD,SAASC,YAAYC,EAAiC;IACpD,IAAI;QACF,IAAMC,MAAMD,GAAGE,OAAO,CAAC,yFAAyFC,GAAG;QACnH,OAAOF;IACT,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,SAASG,gBAAgBJ,EAAiC;IACxD,IAAMC,MAAMD,GAAGE,OAAO,CAAC,0EAA0EC,GAAG;IACpG,OAAOF,IAAII,CAAC;AACd;AAIO,SAASP,UAAUQ,GAAW;IACnC,IAAI;QACF,IAAMC,SAAS,IAAIC,IAAIF;QACvB,IAAI,CAACC,OAAOE,QAAQ,IAAI,CAACF,OAAOG,QAAQ,EAAE,OAAOJ;QACjDC,OAAOE,QAAQ,GAAG;QAClBF,OAAOG,QAAQ,GAAG;QAClB,OAAO,AAAC,GAAuC,OAArCH,OAAOI,QAAQ,GAAGC,OAAO,CAAC,OAAO,KAAI;IACjD,EAAE,eAAM;QACN,OAAON;IACT;AACF;AAEA,gGAAgG;AAChG,+FAA+F;AAC/F,SAAeO,eAAeC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O,mBAAmB,AAAC,aAAiCzD,OAArBM,KAAI,mBAAmD,OAAlCN,OAAOyD,0BAA0B,EAAC;wBAChJK,QAAQC,GAAG,CAAC,AAAC,0BAA8C,OAArB/D,OAAOF,aAAa,EAAC;oBAC7D;oBACArC,GAAGuH,KAAK;;;;;;IACV;;IACA,WAAerG"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { presetCoverage } from '../commands/status.ts';\nimport { embedConfig, featureStates, SUPPORTED_CONFIG_VERSION } from '../config/index.ts';\nimport { docCount, getMeta, open, SCHEMA_VERSION } from '../db/index.ts';\nimport { languageDistribution } from '../embed/distribution.ts';\nimport { probeReachable } from '../embed/http.ts';\nimport { isDownloadable, MODEL_FILENAMES, modelDir, modelPresent, readLanguages } from '../embed/store.ts';\nimport { featuresLine, presetsLines } from '../output/output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// status names what you cannot read off the config file: locations sense chose, values it\n// derived, state it stored. Config content is not echoed -- the config line says which file to\n// read, and duplicating its globs here would create two places that disagree after an edit.\n// The exception is the embed block's url and key, whose effect is remote and otherwise invisible.\n\n// Vectors are computed on the first semantic query, not at reconcile, so a tree can have a\n// semantic-on preset with nothing embedded yet -- reported here because a fast reconcile on\n// such a tree otherwise reads as \"the feature isn't on\".\nfunction vectorState(db: ReturnType<typeof open>['db']): { embedded: number; pending: number } | null {\n try {\n const row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get() as { embedded: number; pending: number };\n return row;\n } catch {\n return null;\n }\n}\n\nfunction parseErrorCount(db: ReturnType<typeof open>['db']): number {\n const row = db.prepare(`SELECT COUNT(*) AS n FROM frontmatter WHERE \"_parse_error\" IS NOT NULL`).get() as { n: number };\n return row.n;\n}\n\n// A URL can carry credentials in its userinfo (https://user:pass@host/v1). status output gets\n// pasted into issues and transcripts, so it is always safe to paste.\nexport function redactUrl(url: string): string {\n try {\n const parsed = new URL(url);\n if (!parsed.username && !parsed.password) return url;\n parsed.username = '';\n parsed.password = '';\n return `${parsed.toString().replace(/\\/$/, '')} (credentials redacted)`;\n } catch {\n return url;\n }\n}\n\n// A stopped Ollama/LM Studio/Cohere endpoint prints identically to a running one otherwise; any\n// HTTP response counts as reachable (probeReachable), so this only distinguishes up from down.\nasync function embedReachable(e: { provider: string; url?: string }): Promise<boolean | null> {\n if (e.provider === 'static' || (e.provider === 'openai' && !e.url)) return null;\n const base = (e.url ?? 'https://api.cohere.com').replace(/\\/+$/, '');\n return probeReachable(e.provider === 'openai' ? `${base}/models` : base);\n}\n\nconst status: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, dbPath, warnings } = open(cfg);\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const hasModel = e ? modelPresent(cfg) : false;\n const reachable = e ? await embedReachable(e) : null;\n const vectors = e ? vectorState(db) : null;\n const presets = presetCoverage(db, cfg);\n const staticLanguages = e && e.provider === 'static' ? readLanguages(e.model) : undefined;\n const declaredLanguages = staticLanguages && staticLanguages.length > 0 ? staticLanguages : null;\n const detectedLanguages = languageDistribution(db) ?? null;\n const heartbeat = getMeta(db, 'watch_heartbeat');\n // Derived at open() (F): 3x the largest reconcile this cache has ever held its write\n // transaction for, floored at 30s -- read back from the connection rather than\n // recomputed here, so this always reports what open() actually set.\n const busyTimeoutMs = (db.prepare('PRAGMA busy_timeout').get() as { timeout: number }).timeout;\n // The env var holds the token; only its name and whether it is set are ever reported.\n const keyEnv = e?.key ? { name: e.key, set: (process.env[e.key] ?? '') !== '' } : null;\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.baseDir,\n cache: dirname(dbPath),\n db: dbPath,\n cacheSchema: SCHEMA_VERSION,\n docs: docCount(db),\n unparseableFrontmatter: parseErrorCount(db),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { provider: e.provider, model: e.model, dir: e.provider === 'static' ? modelDir(e.model) : null, url: e.url ? redactUrl(e.url) : null, reachable, keyEnv, downloaded: hasModel, languages: declaredLanguages, detectedLanguages, ...(vectors ?? {}) } : null,\n presets,\n queries: Object.keys(cfg.queries ?? {}).length,\n watcherPid: getMeta(db, 'watch_pid'),\n watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,\n busyTimeoutMs,\n };\n\n if (format === 'json') {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migrated from v${cfg.migratedFrom} on this run` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n // A load-time stderr warning has scrolled away by the time anyone looks here.\n if (cfg.unknownKeys) console.log(` unknown keys, ignored: ${cfg.unknownKeys.join(', ')}`);\n console.log(`tree: ${result.tree}`);\n console.log(`cache: ${result.cache} (schema ${SCHEMA_VERSION}; delete this directory to reset)`);\n console.log(`docs: ${result.docs}${result.unparseableFrontmatter > 0 ? ` (${result.unparseableFrontmatter} with unparseable frontmatter: WHERE _parse_error IS NOT NULL)` : ''}`);\n console.log('');\n console.log(featuresLine(features));\n // One authoritative block, off states included: an absent model reads as a degraded search,\n // not as an empty corpus.\n if (!e) console.log('embed: off (no preset asks for vectors)');\n else {\n console.log(`embed: ${e.provider} ${e.model}`);\n if (e.provider === 'static') console.log(` model: ${modelDir(e.model)} (${hasModel ? 'present' : `missing, ${isDownloadable(e.model) ? `fetches automatically at first search, or run \\`${ctx.name} download\\` to prefetch` : `no ${MODEL_FILENAMES} in that directory`}`})`);\n if (declaredLanguages) console.log(` languages: ${declaredLanguages.join(', ')} (declared by the model card)`);\n // Cohere defaults to api.cohere.com with no url in the config; show it anyway so the\n // reachability probe below has something to name.\n if (e.url || reachable !== null) {\n const shown = e.url ? redactUrl(e.url) : 'https://api.cohere.com (default)';\n console.log(` url: ${shown}${reachable === null ? '' : reachable ? ' (reachable)' : ' (unreachable)'}`);\n }\n if (keyEnv) console.log(` key: env ${keyEnv.name} (${keyEnv.set ? 'set' : 'NOT SET'})`);\n if (!hasModel) console.log(' vectors: off until the model is present; search runs on words and links');\n else if (vectors) console.log(` vectors: ${vectors.embedded} embedded, ${vectors.pending} pending (embedded on the first semantic search)`);\n if (detectedLanguages) {\n const total = Object.values(detectedLanguages).reduce((a, b) => a + b, 0);\n const breakdown = Object.entries(detectedLanguages)\n .sort((a, b) => b[1] - a[1])\n .map(([code, n]) => `${code} ${Math.round((n / total) * 100)}%`)\n .join(', ');\n console.log(` detected: ${breakdown} (${total} chunks classified)`);\n }\n }\n console.log('');\n for (const line of presetsLines(presets)) console.log(line);\n console.log('');\n console.log(`queries: ${result.queries} saved (${ctx.name} --list)`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n console.log(`sqlite: busy_timeout ${result.busyTimeoutMs}ms (derived: 3x the largest reconcile this cache has recorded, floored at 30000ms)`);\n }\n db.close();\n};\nexport default status;\n"],"names":["redactUrl","vectorState","db","row","prepare","get","parseErrorCount","n","url","parsed","URL","username","password","toString","replace","embedReachable","e","base","provider","probeReachable","status","ctx","languageDistribution","process","cfg","values","format","open","dbPath","warnings","features","hasModel","reachable","vectors","presets","staticLanguages","declaredLanguages","detectedLanguages","heartbeat","busyTimeoutMs","keyEnv","result","migrated","shown","total","breakdown","line","pid","parse","argv","USAGE","name","FORMAT","CONFIG","formatOf","resolveConfig","config","printWarnings","featureStates","embedConfig","modelPresent","presetCoverage","readLanguages","model","undefined","length","getMeta","timeout","key","set","env","configPath","configVersion","SUPPORTED_CONFIG_VERSION","migratedFrom","unknownConfigKeys","unknownKeys","tree","baseDir","cache","dirname","cacheSchema","SCHEMA_VERSION","docs","docCount","unparseableFrontmatter","on","featuresOff","off","embed","dir","modelDir","downloaded","languages","queries","Object","keys","watcherPid","watcherHeartbeatSecondsAgo","Math","round","Date","now","console","log","JSON","stringify","join","featuresLine","isDownloadable","MODEL_FILENAMES","embedded","pending","reduce","a","b","entries","sort","map","code","presetsLines","close"],"mappings":";;;;;;;;;;;QAmJA;eAAA;;QA/GgBA;eAAAA;;;wBApCQ;wBACO;uBACsC;wBACb;8BACnB;sBACN;uBACwD;wBAC5C;wBACrB;wBACyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG/D,0FAA0F;AAC1F,+FAA+F;AAC/F,4FAA4F;AAC5F,kGAAkG;AAElG,2FAA2F;AAC3F,4FAA4F;AAC5F,yDAAyD;AACzD,SAASC,YAAYC,EAAiC;IACpD,IAAI;QACF,IAAMC,MAAMD,GAAGE,OAAO,CAAC,yFAAyFC,GAAG;QACnH,OAAOF;IACT,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,SAASG,gBAAgBJ,EAAiC;IACxD,IAAMC,MAAMD,GAAGE,OAAO,CAAC,0EAA0EC,GAAG;IACpG,OAAOF,IAAII,CAAC;AACd;AAIO,SAASP,UAAUQ,GAAW;IACnC,IAAI;QACF,IAAMC,SAAS,IAAIC,IAAIF;QACvB,IAAI,CAACC,OAAOE,QAAQ,IAAI,CAACF,OAAOG,QAAQ,EAAE,OAAOJ;QACjDC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qCnF,OAAzBoB,OAAOqD,OAAO,EAAC,YAAmB,OAATzE,IAAI8B,IAAI,EAAC;wBACrDJ,MAAMN,OAAOwD,UAAU,GAAG,AAAC,OAAwB,OAAlBxD,OAAOwD,UAAU,EAAC,QAAM;wBAC/DM,QAAQC,GAAG,CAAC/D,OAAOyD,0BAA0B,KAAK,OAAO,mBAAmB,AAAC,aAAiCzD,OAArBM,KAAI,mBAAmD,OAAlCN,OAAOyD,0BAA0B,EAAC;wBAChJK,QAAQC,GAAG,CAAC,AAAC,0BAA8C,OAArB/D,OAAOF,aAAa,EAAC;oBAC7D;oBACArC,GAAGuH,KAAK;;;;;;IACV;;IACA,WAAerG"}
@@ -0,0 +1,4 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ export type LangCounts = Record<string, number>;
3
+ export declare function languageDistribution(db: DatabaseSync): LangCounts | undefined;
4
+ export declare function saveLanguageDistribution(db: DatabaseSync, counts: LangCounts): void;
@@ -0,0 +1,4 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ export type LangCounts = Record<string, number>;
3
+ export declare function languageDistribution(db: DatabaseSync): LangCounts | undefined;
4
+ export declare function saveLanguageDistribution(db: DatabaseSync, counts: LangCounts): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get languageDistribution () {
13
+ return languageDistribution;
14
+ },
15
+ get saveLanguageDistribution () {
16
+ return saveLanguageDistribution;
17
+ }
18
+ });
19
+ var _sharedts = require("../db/shared.js");
20
+ // Split out of langfit.ts so reading the persisted counts (status.ts's only need) never pulls in
21
+ // franc-min; only checkLanguageFit's classify path needs the classifier itself.
22
+ var META_KEY = 'embed_languages';
23
+ function languageDistribution(db) {
24
+ var raw = (0, _sharedts.getMeta)(db, META_KEY);
25
+ return raw ? JSON.parse(raw) : undefined;
26
+ }
27
+ function saveLanguageDistribution(db, counts) {
28
+ (0, _sharedts.setMeta)(db, META_KEY, JSON.stringify(counts));
29
+ }
30
+ /* 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; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/embed/distribution.ts"],"sourcesContent":["import type { DatabaseSync } from 'node:sqlite';\nimport { getMeta, setMeta } from '../db/shared.ts';\n\n// Split out of langfit.ts so reading the persisted counts (status.ts's only need) never pulls in\n// franc-min; only checkLanguageFit's classify path needs the classifier itself.\nconst META_KEY = 'embed_languages';\n\nexport type LangCounts = Record<string, number>;\n\nexport function languageDistribution(db: DatabaseSync): LangCounts | undefined {\n const raw = getMeta(db, META_KEY);\n return raw ? JSON.parse(raw) : undefined;\n}\n\nexport function saveLanguageDistribution(db: DatabaseSync, counts: LangCounts): void {\n setMeta(db, META_KEY, JSON.stringify(counts));\n}\n"],"names":["languageDistribution","saveLanguageDistribution","META_KEY","db","raw","getMeta","JSON","parse","undefined","counts","setMeta","stringify"],"mappings":";;;;;;;;;;;QASgBA;eAAAA;;QAKAC;eAAAA;;;wBAbiB;AAEjC,iGAAiG;AACjG,gFAAgF;AAChF,IAAMC,WAAW;AAIV,SAASF,qBAAqBG,EAAgB;IACnD,IAAMC,MAAMC,IAAAA,iBAAO,EAACF,IAAID;IACxB,OAAOE,MAAME,KAAKC,KAAK,CAACH,OAAOI;AACjC;AAEO,SAASP,yBAAyBE,EAAgB,EAAEM,MAAkB;IAC3EC,IAAAA,iBAAO,EAACP,IAAID,UAAUI,KAAKK,SAAS,CAACF;AACvC"}
@@ -1,6 +1,3 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  import type { EmbedProvider } from './types.js';
3
- type LangCounts = Record<string, number>;
4
- export declare function languageDistribution(db: DatabaseSync): LangCounts | undefined;
5
3
  export declare function checkLanguageFit(db: DatabaseSync, provider: EmbedProvider, texts: string[]): Promise<void>;
6
- export {};
@@ -1,6 +1,3 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  import type { EmbedProvider } from './types.js';
3
- type LangCounts = Record<string, number>;
4
- export declare function languageDistribution(db: DatabaseSync): LangCounts | undefined;
5
3
  export declare function checkLanguageFit(db: DatabaseSync, provider: EmbedProvider, texts: string[]): Promise<void>;
6
- export {};