sensemaking 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/bin/cli.js +5 -1
- package/dist/cjs/cli/check.js +36 -4
- package/dist/cjs/cli/check.js.map +1 -1
- package/dist/cjs/cli/exit.d.cts +5 -0
- package/dist/cjs/cli/exit.d.ts +5 -0
- package/dist/cjs/cli/exit.js +147 -0
- package/dist/cjs/cli/exit.js.map +1 -0
- package/dist/cjs/cli/index.d.cts +11 -0
- package/dist/cjs/cli/index.d.ts +11 -0
- package/dist/cjs/cli/index.js +22 -3
- package/dist/cjs/cli/index.js.map +1 -1
- package/dist/cjs/cli/init.js +3 -0
- package/dist/cjs/cli/init.js.map +1 -1
- package/dist/cjs/cli/map.js +33 -2
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.d.cts +1 -1
- package/dist/cjs/cli/named.d.ts +1 -1
- package/dist/cjs/cli/named.js +48 -17
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/peek.js +36 -4
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/query.js +35 -3
- package/dist/cjs/cli/query.js.map +1 -1
- package/dist/cjs/cli/rebuild.js +31 -1
- package/dist/cjs/cli/rebuild.js.map +1 -1
- package/dist/cjs/cli/search.js +42 -10
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +18 -2
- package/dist/cjs/cli/shared.d.ts +18 -2
- package/dist/cjs/cli/shared.js +238 -11
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/status.js +5 -2
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/cli/types.d.cts +2 -12
- package/dist/cjs/cli/types.d.ts +2 -12
- package/dist/cjs/cli/watch.js +38 -2
- package/dist/cjs/cli/watch.js.map +1 -1
- package/dist/cjs/cli.js +147 -150
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/db.js +5 -0
- package/dist/cjs/db.js.map +1 -1
- package/dist/esm/cli/check.js +11 -4
- package/dist/esm/cli/check.js.map +1 -1
- package/dist/esm/cli/exit.d.ts +5 -0
- package/dist/esm/cli/exit.js +15 -0
- package/dist/esm/cli/exit.js.map +1 -0
- package/dist/esm/cli/index.d.ts +11 -0
- package/dist/esm/cli/index.js +14 -0
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/init.js +3 -0
- package/dist/esm/cli/init.js.map +1 -1
- package/dist/esm/cli/map.js +11 -3
- package/dist/esm/cli/map.js.map +1 -1
- package/dist/esm/cli/named.d.ts +1 -1
- package/dist/esm/cli/named.js +25 -18
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/peek.js +12 -5
- package/dist/esm/cli/peek.js.map +1 -1
- package/dist/esm/cli/query.js +11 -4
- package/dist/esm/cli/query.js.map +1 -1
- package/dist/esm/cli/rebuild.js +6 -2
- package/dist/esm/cli/rebuild.js.map +1 -1
- package/dist/esm/cli/search.js +18 -10
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +18 -2
- package/dist/esm/cli/shared.js +100 -11
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/status.js +9 -3
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/cli/types.d.ts +2 -12
- package/dist/esm/cli/types.js.map +1 -1
- package/dist/esm/cli/watch.js +11 -3
- package/dist/esm/cli/watch.js.map +1 -1
- package/dist/esm/cli.js +83 -102
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/db.js +5 -0
- package/dist/esm/db.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -21,6 +21,9 @@ npm install -g sensemaking
|
|
|
21
21
|
cd your-notes && sense init
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Needs Node 22.16 or newer: that is the first release whose built-in SQLite carries FTS5, which
|
|
25
|
+
`sense search` indexes prose with.
|
|
26
|
+
|
|
24
27
|
```bash
|
|
25
28
|
sense map # orient: fields, hub notes, recent changes
|
|
26
29
|
sense search "revenue OR earnings" --k 10 # locate: words + links + meaning, one ranked list
|
|
@@ -78,7 +81,7 @@ and vector similarity — fused into one list. `via` labels each row's evidence
|
|
|
78
81
|
`lines` points at the section that earned the row — a direct read range. Rows that only
|
|
79
82
|
vectors produced are the "these words aren't in the tree, this is what's near in meaning"
|
|
80
83
|
signal. `--preset` picks a named settings bundle from the config, `--lexical` skips vectors
|
|
81
|
-
for one command, `--where` filters on frontmatter. `--format json` on any command returns
|
|
84
|
+
for one command, `--where` filters on frontmatter. `--format json` on any reporting command returns
|
|
82
85
|
structured output; `--version` and `--help` do what they say.
|
|
83
86
|
|
|
84
87
|
## Config
|
|
@@ -182,7 +185,9 @@ features, frontmatter conventions, and note size are decisions with consequences
|
|
|
182
185
|
Dependencies: [yaml](https://github.com/eemeli/yaml),
|
|
183
186
|
[remove-markdown](https://github.com/zuchka/remove-markdown),
|
|
184
187
|
[fast-glob](https://github.com/mrmlnc/fast-glob),
|
|
185
|
-
[@huggingface/tokenizers](https://github.com/huggingface/tokenizers.js) (pure JS),
|
|
188
|
+
[@huggingface/tokenizers](https://github.com/huggingface/tokenizers.js) (pure JS),
|
|
189
|
+
[getopts-compat](https://github.com/kmalakoff/getopts) and
|
|
190
|
+
[exit-compat](https://github.com/kmalakoff/exit-compat) for the CLI, and Node's
|
|
186
191
|
built-in SQLite. No native builds.
|
|
187
192
|
|
|
188
193
|
## License
|
package/bin/cli.js
CHANGED
|
@@ -2,4 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// biome-ignore lint/security/noGlobalEval: dual esm and cjs
|
|
4
4
|
if (typeof require === 'undefined') eval("import('../dist/esm/cli.js').then((cli) => cli.default(process.argv.slice(2), 'sense')).catch((err) => { console.error(err); process.exit(-1); });");
|
|
5
|
-
else
|
|
5
|
+
else
|
|
6
|
+
require('../dist/cjs/cli.js')(process.argv.slice(2), 'sense').catch((err) => {
|
|
7
|
+
console.error(err);
|
|
8
|
+
process.exit(-1);
|
|
9
|
+
});
|
package/dist/cjs/cli/check.js
CHANGED
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
var _commandsts = require("../commands.js");
|
|
12
12
|
var _dbts = require("../db.js");
|
|
13
13
|
var _outputts = require("../output.js");
|
|
14
|
+
var _exitts = require("./exit.js");
|
|
15
|
+
var _indexts = require("./index.js");
|
|
14
16
|
var _sharedts = require("./shared.js");
|
|
15
17
|
function _array_like_to_array(arr, len) {
|
|
16
18
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -49,6 +51,19 @@ function _async_to_generator(fn) {
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
}
|
|
54
|
+
function _define_property(obj, key, value) {
|
|
55
|
+
if (key in obj) {
|
|
56
|
+
Object.defineProperty(obj, key, {
|
|
57
|
+
value: value,
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
obj[key] = value;
|
|
64
|
+
}
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
52
67
|
function _iterable_to_array_limit(arr, i) {
|
|
53
68
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
54
69
|
if (_i == null) return;
|
|
@@ -76,6 +91,21 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
76
91
|
function _non_iterable_rest() {
|
|
77
92
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
93
|
}
|
|
94
|
+
function _object_spread(target) {
|
|
95
|
+
for(var i = 1; i < arguments.length; i++){
|
|
96
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
97
|
+
var ownKeys = Object.keys(source);
|
|
98
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
99
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
100
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
ownKeys.forEach(function(key) {
|
|
104
|
+
_define_property(target, key, source[key]);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
79
109
|
function _sliced_to_array(arr, i) {
|
|
80
110
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
81
111
|
}
|
|
@@ -202,11 +232,13 @@ function _ts_generator(thisArg, body) {
|
|
|
202
232
|
// result being empty is good or bad is the reader's judgment -- there is no assertion path.
|
|
203
233
|
var check = function check(ctx) {
|
|
204
234
|
return _async_to_generator(function() {
|
|
205
|
-
var _cfg_queries, cfg, _open, db, warnings, rows, failed, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, entry, _sql_match, count, err, sql, params, statement, count1, err1;
|
|
235
|
+
var _cfg_queries, values, format, cfg, _open, db, warnings, rows, failed, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, entry, _sql_match, count, err, sql, params, statement, count1, err1;
|
|
206
236
|
return _ts_generator(this, function(_state) {
|
|
207
237
|
switch(_state.label){
|
|
208
238
|
case 0:
|
|
209
|
-
|
|
239
|
+
values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.check), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
|
|
240
|
+
format = (0, _sharedts.formatOf)(values);
|
|
241
|
+
cfg = ctx.resolveConfig(values.config);
|
|
210
242
|
_open = (0, _dbts.open)(cfg), db = _open.db, warnings = _open.warnings;
|
|
211
243
|
(0, _sharedts.printWarnings)(warnings);
|
|
212
244
|
rows = [];
|
|
@@ -354,8 +386,8 @@ var check = function check(ctx) {
|
|
|
354
386
|
2
|
|
355
387
|
];
|
|
356
388
|
}
|
|
357
|
-
(0, _outputts.printRows)(rows,
|
|
358
|
-
if (failed > 0)
|
|
389
|
+
(0, _outputts.printRows)(rows, format);
|
|
390
|
+
if (failed > 0) throw new _exitts.ExitError(1);
|
|
359
391
|
return [
|
|
360
392
|
2
|
|
361
393
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/check.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A saved query that returns zero rows looks identical to a true empty result, so a broken\n// one can sit unnoticed -- one field report had `WHERE flag = 'true'` against a numeric\n// column reading as \"nothing tagged yet\" for hours. Preparing each query catches syntax and\n// unknown-column errors without executing it; queries that take no parameters are also run\n// for a row count. Parameterised queries are validated but not counted: inventing arguments\n// would report a count for a query nobody ran. Saved searches run lexically with k=1 -- that\n// validates the `where` fragment, the FTS5 terms, and the `preset` name (resolveSearch throws\n// on an unknown one, the same breakage class prepare() catches for SQL strings) -- but never\n// semantically (a semantic pass costs model time and, on api trees, network). Whether a\n// result being empty is good or bad is the reader's judgment -- there is no assertion path.\nconst check: Command = async (ctx) => {\n const cfg = ctx.resolveConfig();\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n\n const rows: Row[] = [];\n let failed = 0;\n for (const [name, entry] of Object.entries(cfg.queries ?? {})) {\n if (typeof entry === 'object' && entry !== null && 'search' in entry) {\n try {\n const count = (await search(db, cfg, entry.search, { k: 1, where: entry.where, preset: entry.preset, include: entry.include, semantic: false })).length;\n rows.push({ query: name, params: '—', rows: '—', status: count === 0 ? 'ok, but matches 0 notes (lexical probe)' : 'ok (probe run with k=1)' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params: '—', rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n continue;\n }\n const sql = typeof entry === 'string' ? entry : entry.sql;\n const params = (sql.match(/\\?/g) ?? []).length;\n try {\n const statement = db.prepare(sql);\n if (params > 0) {\n rows.push({ query: name, params, rows: '—', status: 'ok (not run: needs parameters)' });\n continue;\n }\n const count = (statement.all() as unknown[]).length;\n rows.push({ query: name, params, rows: count, status: count === 0 ? 'ok, but returns 0 rows' : 'ok' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params, rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n }\n\n db.close();\n if (rows.length === 0) {\n console.log('no saved queries in config');\n return;\n }\n printRows(rows,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/check.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { ExitError } from './exit.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A saved query that returns zero rows looks identical to a true empty result, so a broken\n// one can sit unnoticed -- one field report had `WHERE flag = 'true'` against a numeric\n// column reading as \"nothing tagged yet\" for hours. Preparing each query catches syntax and\n// unknown-column errors without executing it; queries that take no parameters are also run\n// for a row count. Parameterised queries are validated but not counted: inventing arguments\n// would report a count for a query nobody ran. Saved searches run lexically with k=1 -- that\n// validates the `where` fragment, the FTS5 terms, and the `preset` name (resolveSearch throws\n// on an unknown one, the same breakage class prepare() catches for SQL strings) -- but never\n// semantically (a semantic pass costs model time and, on api trees, network). Whether a\n// result being empty is good or bad is the reader's judgment -- there is no assertion path.\nconst check: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.check}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n\n const rows: Row[] = [];\n let failed = 0;\n for (const [name, entry] of Object.entries(cfg.queries ?? {})) {\n if (typeof entry === 'object' && entry !== null && 'search' in entry) {\n try {\n const count = (await search(db, cfg, entry.search, { k: 1, where: entry.where, preset: entry.preset, include: entry.include, semantic: false })).length;\n rows.push({ query: name, params: '—', rows: '—', status: count === 0 ? 'ok, but matches 0 notes (lexical probe)' : 'ok (probe run with k=1)' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params: '—', rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n continue;\n }\n const sql = typeof entry === 'string' ? entry : entry.sql;\n const params = (sql.match(/\\?/g) ?? []).length;\n try {\n const statement = db.prepare(sql);\n if (params > 0) {\n rows.push({ query: name, params, rows: '—', status: 'ok (not run: needs parameters)' });\n continue;\n }\n const count = (statement.all() as unknown[]).length;\n rows.push({ query: name, params, rows: count, status: count === 0 ? 'ok, but returns 0 rows' : 'ok' });\n } catch (err) {\n failed++;\n rows.push({ query: name, params, rows: '—', status: `FAILED: ${(err as Error).message}` });\n }\n }\n\n db.close();\n if (rows.length === 0) {\n console.log('no saved queries in config');\n return;\n }\n printRows(rows, format);\n if (failed > 0) throw new ExitError(1);\n};\nexport default check;\n"],"names":["check","ctx","cfg","values","format","open","db","warnings","rows","failed","name","entry","sql","count","err","params","statement","parse","argv","USAGE","FORMAT","CONFIG","formatOf","resolveConfig","config","printWarnings","Object","entries","queries","search","k","where","preset","include","semantic","length","push","query","status","message","match","prepare","all","close","console","log","printRows","ExitError"],"mappings":";;;;+BA+DA;;;eAAA;;;0BA/DuB;oBACF;wBAEK;sBACA;uBACJ;wBACyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG/D,2FAA2F;AAC3F,wFAAwF;AACxF,4FAA4F;AAC5F,2FAA2F;AAC3F,4FAA4F;AAC5F,6FAA6F;AAC7F,8FAA8F;AAC9F,6FAA6F;AAC7F,wFAAwF;AACxF,4FAA4F;AAC5F,IAAMA,QAAiB,eAAOC;;YASeC,cARnCC,QACFC,QACAF,KACmBG,OAAjBC,IAAIC,UAGNC,MACFC,QACC,2BAAA,mBAAA,gBAAA,WAAA,oBAAOC,MAAMC,OAYAC,YATNC,OAECC,KAMLF,KACAG,QAEEC,WAKAH;;;;oBA3BFV,SAAWc,IAAAA,eAAK,EAAChB,IAAIiB,IAAI,EAAE,AAAC,UAAqBC,OAAZlB,IAAIS,IAAI,EAAC,KAAe,OAAZS,cAAK,CAACnB,KAAK,GAAI,mBAAKoB,gBAAM,EAAKC,gBAAM,GAAtFlB;oBACFC,SAASkB,IAAAA,kBAAQ,EAACnB;oBAClBD,MAAMD,IAAIsB,aAAa,CAACpB,OAAOqB,MAAM;oBAClBnB,QAAAA,IAAAA,UAAI,EAACH,MAAtBI,KAAiBD,MAAjBC,IAAIC,WAAaF,MAAbE;oBACZkB,IAAAA,uBAAa,EAAClB;oBAERC;oBACFC,SAAS;oBACR,kCAAA,2BAAA;;;;;;;;;oBAAA,YAAuBiB,OAAOC,OAAO,EAACzB,eAAAA,IAAI0B,OAAO,cAAX1B,0BAAAA,eAAe,CAAC;;;2BAAtD,6BAAA,QAAA;;;;mDAAA,iBAAOQ,uBAAMC;yBACZ,CAAA,CAAA,OAAOA,sCAAP,SAAOA,MAAI,MAAM,YAAYA,UAAU,QAAQ,YAAYA,KAAI,GAA/D;;;;;;;;;;;;oBAEe;;wBAAMkB,IAAAA,kBAAM,EAACvB,IAAIJ,KAAKS,MAAMkB,MAAM,EAAE;4BAAEC,GAAG;4BAAGC,OAAOpB,MAAMoB,KAAK;4BAAEC,QAAQrB,MAAMqB,MAAM;4BAAEC,SAAStB,MAAMsB,OAAO;4BAAEC,UAAU;wBAAM;;;oBAAvIrB,QAAQ,AAAC,cAAkIsB,MAAM;oBACvJ3B,KAAK4B,IAAI,CAAC;wBAAEC,OAAO3B;wBAAMK,QAAQ;wBAAKP,MAAM;wBAAK8B,QAAQzB,UAAU,IAAI,4CAA4C;oBAA0B;;;;;;oBACtIC;oBACPL;oBACAD,KAAK4B,IAAI,CAAC;wBAAEC,OAAO3B;wBAAMK,QAAQ;wBAAKP,MAAM;wBAAK8B,QAAQ,AAAC,WAAiC,OAAvB,AAACxB,IAAcyB,OAAO;oBAAG;;;;;;oBAE/F;;;;;oBAEI3B,MAAM,OAAOD,UAAU,WAAWA,QAAQA,MAAMC,GAAG;oBACnDG,SAAS,EAACH,aAAAA,IAAI4B,KAAK,CAAC,oBAAV5B,wBAAAA,iBAAwBuB,MAAM;oBAC9C,IAAI;wBACInB,YAAYV,GAAGmC,OAAO,CAAC7B;wBAC7B,IAAIG,SAAS,GAAG;4BACdP,KAAK4B,IAAI,CAAC;gCAAEC,OAAO3B;gCAAMK,QAAAA;gCAAQP,MAAM;gCAAK8B,QAAQ;4BAAiC;4BACrF;;;;wBACF;wBACMzB,SAAQ,AAACG,UAAU0B,GAAG,GAAiBP,MAAM;wBACnD3B,KAAK4B,IAAI,CAAC;4BAAEC,OAAO3B;4BAAMK,QAAAA;4BAAQP,MAAMK;4BAAOyB,QAAQzB,WAAU,IAAI,2BAA2B;wBAAK;oBACtG,EAAE,OAAOC,KAAK;wBACZL;wBACAD,KAAK4B,IAAI,CAAC;4BAAEC,OAAO3B;4BAAMK,QAAAA;4BAAQP,MAAM;4BAAK8B,QAAQ,AAAC,WAAiC,OAAvB,AAACxB,IAAcyB,OAAO;wBAAG;oBAC1F;;;oBAxBG;;;;;;;;;;;;oBAAA;oBAAA;;;;;;;6BAAA,6BAAA;4BAAA;;;4BAAA;kCAAA;;;;;;;oBA2BLjC,GAAGqC,KAAK;oBACR,IAAInC,KAAK2B,MAAM,KAAK,GAAG;wBACrBS,QAAQC,GAAG,CAAC;wBACZ;;;oBACF;oBACAC,IAAAA,mBAAS,EAACtC,MAAMJ;oBAChB,IAAIK,SAAS,GAAG,MAAM,IAAIsC,iBAAS,CAAC;;;;;;IACtC;;IACA,WAAe/C"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Commands never end the process themselves: they throw this, and cli.ts -- the one place
|
|
2
|
+
// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative
|
|
3
|
+
// works here: a direct process.exit() races a pending write, and a bare return would let a
|
|
4
|
+
// command body run on after --help had already printed its usage.
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
get ExitError () {
|
|
17
|
+
return ExitError;
|
|
18
|
+
},
|
|
19
|
+
get usageError () {
|
|
20
|
+
return usageError;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function _assert_this_initialized(self) {
|
|
24
|
+
if (self === void 0) {
|
|
25
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
28
|
+
}
|
|
29
|
+
function _call_super(_this, derived, args) {
|
|
30
|
+
derived = _get_prototype_of(derived);
|
|
31
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
32
|
+
}
|
|
33
|
+
function _class_call_check(instance, Constructor) {
|
|
34
|
+
if (!(instance instanceof Constructor)) {
|
|
35
|
+
throw new TypeError("Cannot call a class as a function");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _construct(Parent, args, Class) {
|
|
39
|
+
if (_is_native_reflect_construct()) {
|
|
40
|
+
_construct = Reflect.construct;
|
|
41
|
+
} else {
|
|
42
|
+
_construct = function construct(Parent, args, Class) {
|
|
43
|
+
var a = [
|
|
44
|
+
null
|
|
45
|
+
];
|
|
46
|
+
a.push.apply(a, args);
|
|
47
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
48
|
+
var instance = new Constructor();
|
|
49
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
50
|
+
return instance;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return _construct.apply(null, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _get_prototype_of(o) {
|
|
56
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
57
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
58
|
+
};
|
|
59
|
+
return _get_prototype_of(o);
|
|
60
|
+
}
|
|
61
|
+
function _inherits(subClass, superClass) {
|
|
62
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
63
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
64
|
+
}
|
|
65
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
66
|
+
constructor: {
|
|
67
|
+
value: subClass,
|
|
68
|
+
writable: true,
|
|
69
|
+
configurable: true
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
73
|
+
}
|
|
74
|
+
function _is_native_function(fn) {
|
|
75
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
76
|
+
}
|
|
77
|
+
function _possible_constructor_return(self, call) {
|
|
78
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
79
|
+
return call;
|
|
80
|
+
}
|
|
81
|
+
return _assert_this_initialized(self);
|
|
82
|
+
}
|
|
83
|
+
function _set_prototype_of(o, p) {
|
|
84
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
85
|
+
o.__proto__ = p;
|
|
86
|
+
return o;
|
|
87
|
+
};
|
|
88
|
+
return _set_prototype_of(o, p);
|
|
89
|
+
}
|
|
90
|
+
function _type_of(obj) {
|
|
91
|
+
"@swc/helpers - typeof";
|
|
92
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
93
|
+
}
|
|
94
|
+
function _wrap_native_super(Class) {
|
|
95
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
96
|
+
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
97
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
98
|
+
if (typeof Class !== "function") {
|
|
99
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
100
|
+
}
|
|
101
|
+
if (typeof _cache !== "undefined") {
|
|
102
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
103
|
+
_cache.set(Class, Wrapper);
|
|
104
|
+
}
|
|
105
|
+
function Wrapper() {
|
|
106
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
107
|
+
}
|
|
108
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
109
|
+
constructor: {
|
|
110
|
+
value: Wrapper,
|
|
111
|
+
enumerable: false,
|
|
112
|
+
writable: true,
|
|
113
|
+
configurable: true
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return _set_prototype_of(Wrapper, Class);
|
|
117
|
+
};
|
|
118
|
+
return _wrap_native_super(Class);
|
|
119
|
+
}
|
|
120
|
+
function _is_native_reflect_construct() {
|
|
121
|
+
try {
|
|
122
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
123
|
+
} catch (_) {}
|
|
124
|
+
return (_is_native_reflect_construct = function() {
|
|
125
|
+
return !!result;
|
|
126
|
+
})();
|
|
127
|
+
}
|
|
128
|
+
var ExitError = /*#__PURE__*/ function(Error1) {
|
|
129
|
+
"use strict";
|
|
130
|
+
_inherits(ExitError, Error1);
|
|
131
|
+
function ExitError(code) {
|
|
132
|
+
_class_call_check(this, ExitError);
|
|
133
|
+
var _this;
|
|
134
|
+
_this = _call_super(this, ExitError, [
|
|
135
|
+
"exit ".concat(code)
|
|
136
|
+
]);
|
|
137
|
+
_this.code = code;
|
|
138
|
+
return _this;
|
|
139
|
+
}
|
|
140
|
+
return ExitError;
|
|
141
|
+
}(_wrap_native_super(Error));
|
|
142
|
+
function usageError(message, usage) {
|
|
143
|
+
console.error(message);
|
|
144
|
+
if (usage !== undefined) console.error(usage);
|
|
145
|
+
throw new ExitError(2);
|
|
146
|
+
}
|
|
147
|
+
/* 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/cli/exit.ts"],"sourcesContent":["// Commands never end the process themselves: they throw this, and cli.ts -- the one place\n// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative\n// works here: a direct process.exit() races a pending write, and a bare return would let a\n// command body run on after --help had already printed its usage.\nexport class ExitError extends Error {\n readonly code: number;\n constructor(code: number) {\n super(`exit ${code}`);\n this.code = code;\n }\n}\n\nexport function usageError(message: string, usage?: string): never {\n console.error(message);\n if (usage !== undefined) console.error(usage);\n throw new ExitError(2);\n}\n"],"names":["ExitError","usageError","code","Error","message","usage","console","error","undefined"],"mappings":"AAAA,0FAA0F;AAC1F,0FAA0F;AAC1F,2FAA2F;AAC3F,kEAAkE;;;;;;;;;;;;QACrDA;eAAAA;;QAQGC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AART,IAAA,AAAMD,0BAAN;;cAAMA;aAAAA,UAECE,IAAY;gCAFbF;;gBAGT,kBAHSA;YAGF,QAAY,OAALE;;QACd,MAAKA,IAAI,GAAGA;;;WAJHF;qBAAkBG;AAQxB,SAASF,WAAWG,OAAe,EAAEC,KAAc;IACxDC,QAAQC,KAAK,CAACH;IACd,IAAIC,UAAUG,WAAWF,QAAQC,KAAK,CAACF;IACvC,MAAM,IAAIL,UAAU;AACtB"}
|
package/dist/cjs/cli/index.d.cts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { Command } from './types.js';
|
|
2
|
+
export declare const USAGE: {
|
|
3
|
+
readonly init: "init";
|
|
4
|
+
readonly watch: "watch [--force] [--config path]";
|
|
5
|
+
readonly status: "status [--format table|json] [--config path]";
|
|
6
|
+
readonly check: "check [--format table|json] [--config path]";
|
|
7
|
+
readonly rebuild: "rebuild [--config path]";
|
|
8
|
+
readonly query: "query \"<sql>\" [params...] [--format table|json] [--config path]";
|
|
9
|
+
readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--where \"<sql>\"] [--k n] [--lexical] [--format table|json] [--config path]";
|
|
10
|
+
readonly map: "map [--format table|json] [--config path]";
|
|
11
|
+
readonly peek: "peek <path> [--format table|json] [--config path]";
|
|
12
|
+
};
|
|
2
13
|
export declare const COMMANDS: Record<string, () => Promise<{
|
|
3
14
|
default: Command;
|
|
4
15
|
}>>;
|
package/dist/cjs/cli/index.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { Command } from './types.js';
|
|
2
|
+
export declare const USAGE: {
|
|
3
|
+
readonly init: "init";
|
|
4
|
+
readonly watch: "watch [--force] [--config path]";
|
|
5
|
+
readonly status: "status [--format table|json] [--config path]";
|
|
6
|
+
readonly check: "check [--format table|json] [--config path]";
|
|
7
|
+
readonly rebuild: "rebuild [--config path]";
|
|
8
|
+
readonly query: "query \"<sql>\" [params...] [--format table|json] [--config path]";
|
|
9
|
+
readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--where \"<sql>\"] [--k n] [--lexical] [--format table|json] [--config path]";
|
|
10
|
+
readonly map: "map [--format table|json] [--config path]";
|
|
11
|
+
readonly peek: "peek <path> [--format table|json] [--config path]";
|
|
12
|
+
};
|
|
2
13
|
export declare const COMMANDS: Record<string, () => Promise<{
|
|
3
14
|
default: Command;
|
|
4
15
|
}>>;
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 COMMANDS () {
|
|
8
13
|
return COMMANDS;
|
|
14
|
+
},
|
|
15
|
+
get USAGE () {
|
|
16
|
+
return USAGE;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
11
19
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -49,6 +57,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
49
57
|
}
|
|
50
58
|
return newObj;
|
|
51
59
|
}
|
|
60
|
+
var USAGE = {
|
|
61
|
+
init: 'init',
|
|
62
|
+
watch: 'watch [--force] [--config path]',
|
|
63
|
+
status: 'status [--format table|json] [--config path]',
|
|
64
|
+
check: 'check [--format table|json] [--config path]',
|
|
65
|
+
rebuild: 'rebuild [--config path]',
|
|
66
|
+
query: 'query "<sql>" [params...] [--format table|json] [--config path]',
|
|
67
|
+
search: 'search "<terms>" [--preset name] [--include glob ...] [--where "<sql>"] [--k n] [--lexical] [--format table|json] [--config path]',
|
|
68
|
+
map: 'map [--format table|json] [--config path]',
|
|
69
|
+
peek: 'peek <path> [--format table|json] [--config path]'
|
|
70
|
+
};
|
|
52
71
|
var COMMANDS = {
|
|
53
72
|
init: function init() {
|
|
54
73
|
return Promise.resolve().then(function() {
|
|
@@ -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// 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 named\n// query 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 check: () => import('./check.ts'),\n rebuild: () => import('./rebuild.ts'),\n query: () => import('./query.ts'),\n search: () => import('./search.ts'),\n map: () => import('./map.ts'),\n peek: () => import('./peek.ts'),\n};\n\nexport type { Command, Ctx } from './types.ts';\n"],"names":["COMMANDS","init","watch","status","check","rebuild","query","search","map","peek"],"mappings":"
|
|
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 check: 'check [--format table|json] [--config path]',\n rebuild: 'rebuild [--config path]',\n query: 'query \"<sql>\" [params...] [--format table|json] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--where \"<sql>\"] [--k n] [--lexical] [--format table|json] [--config path]',\n map: 'map [--format table|json] [--config path]',\n peek: 'peek <path> [--format table|json] [--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 named\n// query 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 check: () => import('./check.ts'),\n rebuild: () => import('./rebuild.ts'),\n query: () => import('./query.ts'),\n search: () => import('./search.ts'),\n map: () => import('./map.ts'),\n peek: () => import('./peek.ts'),\n};\n\nexport type { Command, Ctx } from './types.ts';\n"],"names":["COMMANDS","USAGE","init","watch","status","check","rebuild","query","search","map","peek"],"mappings":";;;;;;;;;;;QAoBaA;eAAAA;;QAfAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACRC,KAAK;IACLC,MAAM;AACR;AAKO,IAAMV,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,SAAS,SAATA;eAAe;2DAAA,QAAO;;;IACtBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;AACrB"}
|
package/dist/cjs/cli/init.js
CHANGED
|
@@ -9,7 +9,10 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _configts = require("../config.js");
|
|
12
|
+
var _indexts = require("./index.js");
|
|
13
|
+
var _sharedts = require("./shared.js");
|
|
12
14
|
var init = function init(ctx) {
|
|
15
|
+
(0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.init), {});
|
|
13
16
|
var configPath = (0, _configts.initConfig)(process.cwd());
|
|
14
17
|
console.log("created ".concat(configPath));
|
|
15
18
|
console.log("query away: ".concat(ctx.name, ' query "SELECT path FROM frontmatter LIMIT 10"'));
|
package/dist/cjs/cli/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/init.ts"],"sourcesContent":["import { initConfig } from '../config.ts';\nimport type { Command } from './types.ts';\n\nconst init: Command = (ctx) => {\n const configPath = initConfig(process.cwd());\n console.log(`created ${configPath}`);\n console.log(`query away: ${ctx.name} query \"SELECT path FROM frontmatter LIMIT 10\"`);\n // The decisions a new tree faces -- features, frontmatter conventions, note size -- are not\n // in this output; name both places that hold them, since an agent may have neither.\n console.log('features and tree design: the sense-setup skill, or schema.json');\n};\nexport default init;\n"],"names":["init","ctx","configPath","initConfig","process","cwd","console","log"
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/init.ts"],"sourcesContent":["import { initConfig } from '../config.ts';\nimport { USAGE } from './index.ts';\nimport { parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst init: Command = (ctx) => {\n parse(ctx.argv, `usage: ${ctx.name} ${USAGE.init}`, {});\n const configPath = initConfig(process.cwd());\n console.log(`created ${configPath}`);\n console.log(`query away: ${ctx.name} query \"SELECT path FROM frontmatter LIMIT 10\"`);\n // The decisions a new tree faces -- features, frontmatter conventions, note size -- are not\n // in this output; name both places that hold them, since an agent may have neither.\n console.log('features and tree design: the sense-setup skill, or schema.json');\n};\nexport default init;\n"],"names":["init","ctx","parse","argv","USAGE","name","configPath","initConfig","process","cwd","console","log"],"mappings":";;;;+BAcA;;;eAAA;;;wBAd2B;uBACL;wBACA;AAGtB,IAAMA,OAAgB,cAACC;IACrBC,IAAAA,eAAK,EAACD,IAAIE,IAAI,EAAE,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAc,OAAXD,cAAK,CAACJ,IAAI,GAAI,CAAC;IACrD,IAAMM,aAAaC,IAAAA,oBAAU,EAACC,QAAQC,GAAG;IACzCC,QAAQC,GAAG,CAAC,AAAC,WAAqB,OAAXL;IACvBI,QAAQC,GAAG,CAAC,AAAC,eAAuB,OAATV,IAAII,IAAI,EAAC;IACpC,4FAA4F;IAC5F,oFAAoF;IACpFK,QAAQC,GAAG,CAAC;AACd;IACA,WAAeX"}
|
package/dist/cjs/cli/map.js
CHANGED
|
@@ -10,11 +10,42 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
var _commandsts = require("../commands.js");
|
|
12
12
|
var _outputts = require("../output.js");
|
|
13
|
+
var _indexts = require("./index.js");
|
|
13
14
|
var _sharedts = require("./shared.js");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
function _object_spread(target) {
|
|
29
|
+
for(var i = 1; i < arguments.length; i++){
|
|
30
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
31
|
+
var ownKeys = Object.keys(source);
|
|
32
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
33
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
34
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
ownKeys.forEach(function(key) {
|
|
38
|
+
_define_property(target, key, source[key]);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
14
43
|
var map = function map(ctx) {
|
|
15
|
-
|
|
44
|
+
var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.map), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
|
|
45
|
+
var format = (0, _sharedts.formatOf)(values);
|
|
46
|
+
return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
|
|
16
47
|
var result = (0, _commandsts.mapTree)(db, cfg);
|
|
17
|
-
console.log(
|
|
48
|
+
console.log(format === 'json' ? JSON.stringify(result, null, 2) : (0, _outputts.renderMap)(result));
|
|
18
49
|
});
|
|
19
50
|
};
|
|
20
51
|
var _default = map;
|
package/dist/cjs/cli/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/map.ts"],"sourcesContent":["import { mapTree } from '../commands.ts';\nimport { renderMap } from '../output.ts';\nimport { withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst map: Command = (ctx)
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/map.ts"],"sourcesContent":["import { mapTree } from '../commands.ts';\nimport { renderMap } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, 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}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const result = mapTree(db, cfg);\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","FORMAT","CONFIG","format","formatOf","withDb","config","db","cfg","result","mapTree","console","log","JSON","stringify","renderMap"],"mappings":";;;;+BAcA;;;eAAA;;;0BAdwB;wBACE;uBACJ;wBACkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxD,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,gBAAM,EAAKC,gBAAM,GAApFN;IACR,IAAMO,SAASC,IAAAA,kBAAQ,EAACR;IACxB,OAAOS,IAAAA,gBAAM,EAACV,KAAKC,OAAOU,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASC,IAAAA,mBAAO,EAACH,IAAIC;QAC3BG,QAAQC,GAAG,CAACT,WAAW,SAASU,KAAKC,SAAS,CAACL,QAAQ,MAAM,KAAKM,IAAAA,mBAAS,EAACN;IAC9E;AACF;IACA,WAAef"}
|
package/dist/cjs/cli/named.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Ctx } from './types.js';
|
|
2
|
-
export default function named(ctx: Ctx, queryName: string
|
|
2
|
+
export default function named(ctx: Ctx, queryName: string): Promise<void>;
|
package/dist/cjs/cli/named.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Ctx } from './types.js';
|
|
2
|
-
export default function named(ctx: Ctx, queryName: string
|
|
2
|
+
export default function named(ctx: Ctx, queryName: string): Promise<void>;
|
package/dist/cjs/cli/named.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, // Fallback when the first positional is not a command: a named query from config, either a
|
|
6
6
|
// SQL string (run as-is) or a saved search (run through the `search` command's own machinery).
|
|
7
|
+
// Flags cover both shapes -- SEARCH_FLAGS override a saved search's fields the same way they
|
|
8
|
+
// override a preset's.
|
|
7
9
|
"default", {
|
|
8
10
|
enumerable: true,
|
|
9
11
|
get: function() {
|
|
@@ -12,6 +14,7 @@ Object.defineProperty(exports, // Fallback when the first positional is not a co
|
|
|
12
14
|
});
|
|
13
15
|
var _commandsts = require("../commands.js");
|
|
14
16
|
var _outputts = require("../output.js");
|
|
17
|
+
var _exitts = require("./exit.js");
|
|
15
18
|
var _sharedts = require("./shared.js");
|
|
16
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
17
20
|
try {
|
|
@@ -42,6 +45,34 @@ function _async_to_generator(fn) {
|
|
|
42
45
|
});
|
|
43
46
|
};
|
|
44
47
|
}
|
|
48
|
+
function _define_property(obj, key, value) {
|
|
49
|
+
if (key in obj) {
|
|
50
|
+
Object.defineProperty(obj, key, {
|
|
51
|
+
value: value,
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
obj[key] = value;
|
|
58
|
+
}
|
|
59
|
+
return obj;
|
|
60
|
+
}
|
|
61
|
+
function _object_spread(target) {
|
|
62
|
+
for(var i = 1; i < arguments.length; i++){
|
|
63
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
64
|
+
var ownKeys = Object.keys(source);
|
|
65
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
66
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
67
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
ownKeys.forEach(function(key) {
|
|
71
|
+
_define_property(target, key, source[key]);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return target;
|
|
75
|
+
}
|
|
45
76
|
function _ts_generator(thisArg, body) {
|
|
46
77
|
var f, y, t, _ = {
|
|
47
78
|
label: 0,
|
|
@@ -141,27 +172,27 @@ function _ts_generator(thisArg, body) {
|
|
|
141
172
|
};
|
|
142
173
|
}
|
|
143
174
|
}
|
|
144
|
-
function named(ctx, queryName
|
|
175
|
+
function named(ctx, queryName) {
|
|
145
176
|
return _async_to_generator(function() {
|
|
146
|
-
var _parseK,
|
|
177
|
+
var _parseK, _values_where, _values_preset, _values_include, usage, _parse, values, params, format, configPath, cfg, entry, k, where, preset, include, semantic;
|
|
147
178
|
return _ts_generator(this, function(_state) {
|
|
148
179
|
switch(_state.label){
|
|
149
180
|
case 0:
|
|
150
|
-
|
|
181
|
+
usage = "usage: ".concat(ctx.name, " ").concat(queryName, ' [params...] [--format table|json] [--config path] [--where "<sql>"] [--k n] [--preset name] [--include glob ...] [--lexical]');
|
|
182
|
+
_parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.SEARCH_FLAGS, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, params = _parse.positionals;
|
|
183
|
+
format = (0, _sharedts.formatOf)(values);
|
|
184
|
+
configPath = values.config;
|
|
185
|
+
cfg = ctx.resolveConfig(configPath);
|
|
151
186
|
entry = cfg.queries[queryName];
|
|
152
|
-
if (entry === undefined)
|
|
153
|
-
console.error('unknown query: "'.concat(queryName, '"'));
|
|
154
|
-
console.error("valid queries: ".concat(Object.keys(cfg.queries).sort().join(', ')));
|
|
155
|
-
process.exit(2);
|
|
156
|
-
}
|
|
187
|
+
if (entry === undefined) (0, _exitts.usageError)('unknown query: "'.concat(queryName, '"'), "valid queries: ".concat(Object.keys(cfg.queries).sort().join(', ')));
|
|
157
188
|
if (typeof entry === 'string') {
|
|
158
|
-
(0, _sharedts.runSql)(cfg, entry, params,
|
|
189
|
+
(0, _sharedts.runSql)(cfg, entry, params, format, 'query "'.concat(queryName, '"'));
|
|
159
190
|
return [
|
|
160
191
|
2
|
|
161
192
|
];
|
|
162
193
|
}
|
|
163
194
|
if ('sql' in entry) {
|
|
164
|
-
(0, _sharedts.runSql)(cfg, entry.sql, params,
|
|
195
|
+
(0, _sharedts.runSql)(cfg, entry.sql, params, format, 'query "'.concat(queryName, '"'));
|
|
165
196
|
return [
|
|
166
197
|
2
|
|
167
198
|
];
|
|
@@ -170,16 +201,16 @@ function named(ctx, queryName, params) {
|
|
|
170
201
|
if (params.length > 0) {
|
|
171
202
|
ctx.usageError('"'.concat(queryName, '" is a saved search and takes no positional parameters; edit its "search" in sense.config.json, or use "').concat(ctx.name, ' search" directly'));
|
|
172
203
|
}
|
|
173
|
-
k = (_parseK = (0, _sharedts.parseK)(ctx)) !== null && _parseK !== void 0 ? _parseK : entry.k;
|
|
174
|
-
where = (
|
|
175
|
-
preset = (
|
|
176
|
-
include = (
|
|
204
|
+
k = (_parseK = (0, _sharedts.parseK)(values.k, ctx.usageError)) !== null && _parseK !== void 0 ? _parseK : entry.k;
|
|
205
|
+
where = (_values_where = values.where) !== null && _values_where !== void 0 ? _values_where : entry.where;
|
|
206
|
+
preset = (_values_preset = values.preset) !== null && _values_preset !== void 0 ? _values_preset : entry.preset;
|
|
207
|
+
include = (_values_include = values.include) !== null && _values_include !== void 0 ? _values_include : entry.include;
|
|
177
208
|
// --lexical upgrades a saved search's semantic behavior the same way --where/--k
|
|
178
209
|
// override; absent means the saved value (the flag has no default false override).
|
|
179
|
-
semantic =
|
|
210
|
+
semantic = values.lexical ? false : entry.semantic;
|
|
180
211
|
return [
|
|
181
212
|
4,
|
|
182
|
-
(0, _sharedts.withDb)(ctx, function(db, resolvedCfg) {
|
|
213
|
+
(0, _sharedts.withDb)(ctx, configPath, function(db, resolvedCfg) {
|
|
183
214
|
return _async_to_generator(function() {
|
|
184
215
|
return _ts_generator(this, function(_state) {
|
|
185
216
|
switch(_state.label){
|
|
@@ -199,7 +230,7 @@ function named(ctx, queryName, params) {
|
|
|
199
230
|
2,
|
|
200
231
|
_outputts.printRows.apply(void 0, [
|
|
201
232
|
_state.sent(),
|
|
202
|
-
|
|
233
|
+
format
|
|
203
234
|
])
|
|
204
235
|
];
|
|
205
236
|
}
|